diff options
author | rtk0c <[email protected]> | 2022-06-27 00:09:44 +0000 |
---|---|---|
committer | rtk0c <[email protected]> | 2022-06-27 00:09:44 +0000 |
commit | 753c26d320e894069157bd401f7779ad07073d7c (patch) | |
tree | 8dc49b0b68285396c6b619db6c1443b1ecc5abd5 /ui.qt | |
parent | 21aa12d231ab70529322bab325df8293da63dc8d (diff) |
(From git) Initial Qt GUI setup
git-svn-id: file:///home/arch/svn/epistmool/trunk@2 71f44415-077c-4ad7-a976-72ddbf76608f
Diffstat (limited to 'ui.qt')
-rw-r--r-- | ui.qt/.clang-format | 55 | ||||
-rw-r--r-- | ui.qt/CMakeLists.txt | 43 | ||||
-rw-r--r-- | ui.qt/CMakeLists.txt.user | 332 | ||||
-rw-r--r-- | ui.qt/locale/EpistmoolUI_zh_CN.ts | 3 | ||||
-rw-r--r-- | ui.qt/source/document.cpp | 78 | ||||
-rw-r--r-- | ui.qt/source/document.hpp | 62 | ||||
-rw-r--r-- | ui.qt/source/fwd.hpp | 14 | ||||
-rw-r--r-- | ui.qt/source/keyword.cpp | 10 | ||||
-rw-r--r-- | ui.qt/source/keyword.hpp | 26 | ||||
-rw-r--r-- | ui.qt/source/knowledgefragment.cpp | 11 | ||||
-rw-r--r-- | ui.qt/source/knowledgefragment.hpp | 38 | ||||
-rw-r--r-- | ui.qt/source/main.cpp | 35 | ||||
-rw-r--r-- | ui.qt/source/qml/Document.qml | 39 | ||||
-rw-r--r-- | ui.qt/source/qml/GoToKnowledge.qml | 4 | ||||
-rw-r--r-- | ui.qt/source/qml/MainWindow.qml | 12 |
15 files changed, 762 insertions, 0 deletions
diff --git a/ui.qt/.clang-format b/ui.qt/.clang-format new file mode 100644 index 0000000..841dce2 --- /dev/null +++ b/ui.qt/.clang-format @@ -0,0 +1,55 @@ +BasedOnStyle: LLVM +AccessModifierOffset: -4 +AlignAfterOpenBracket: DontAlign +AlignOperands: false +AlignTrailingComments: false +AllowAllParametersOfDeclarationOnNextLine: true +AllowAllArgumentsOnNextLine: true +AllowShortCaseLabelsOnASingleLine: true +AllowShortFunctionsOnASingleLine: Inline +AllowShortIfStatementsOnASingleLine: true +AlwaysBreakTemplateDeclarations: MultiLine +BinPackArguments: false +BinPackParameters: false +BraceWrapping: + AfterClass: true + AfterControlStatement: MultiLine + AfterEnum: false + AfterFunction: true + AfterNamespace: true + AfterObjCDeclaration: false + AfterStruct: true + AfterUnion: false + AfterExternBlock: false + BeforeCatch: false + BeforeElse: false + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: true + SplitEmptyNamespace: true +BreakBeforeBraces: Custom +BreakBeforeTernaryOperators: true +BreakConstructorInitializers: BeforeComma +ColumnLimit: 0 +ConstructorInitializerAllOnOneLineOrOnePerLine: true +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: false +IncludeCategories: + - Regex: '".*"' + Priority: 1 + - Regex: '^<.*\.h>' + Priority: 2 + - Regex: '^<.*' + Priority: 3 +IndentCaseLabels: true +IndentPPDirectives: AfterHash +IndentWidth: 4 +NamespaceIndentation: Inner +PointerAlignment: Left +TabWidth: 4 +UseTab: Always +--- +### C++ specific config ### +Language: Cpp +Standard: Cpp11 diff --git a/ui.qt/CMakeLists.txt b/ui.qt/CMakeLists.txt new file mode 100644 index 0000000..7d7624a --- /dev/null +++ b/ui.qt/CMakeLists.txt @@ -0,0 +1,43 @@ +cmake_minimum_required(VERSION 3.16) +project(EpistmoolUI VERSION 0.1 LANGUAGES CXX) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +find_package(Qt6 6.2 COMPONENTS Quick REQUIRED) + +qt_add_executable(appEpistmoolUI + source/main.cpp + source/fwd.hpp + source/document.hpp source/document.cpp + source/knowledgefragment.hpp source/knowledgefragment.cpp + source/keyword.hpp source/keyword.cpp +) + + +qt_add_qml_module(appEpistmoolUI + URI EpistmoolUI + VERSION 1.0 + QML_FILES + source/qml/MainWindow.qml + source/qml/GoToKnowledge.qml + source/qml/Document.qml +) + +set_target_properties(appEpistmoolUI PROPERTIES + MACOSX_BUNDLE_GUI_IDENTIFIER rtk0cium0001.github.io + MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION} + MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} + MACOSX_BUNDLE TRUE + WIN32_EXECUTABLE TRUE +) + +target_include_directories(appEpistmoolUI PUBLIC source) +target_compile_definitions(appEpistmoolUI +PRIVATE + $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG> +) +target_link_libraries(appEpistmoolUI +PRIVATE + Qt6::Quick +) diff --git a/ui.qt/CMakeLists.txt.user b/ui.qt/CMakeLists.txt.user new file mode 100644 index 0000000..69693ad --- /dev/null +++ b/ui.qt/CMakeLists.txt.user @@ -0,0 +1,332 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE QtCreatorProject> +<!-- Written by QtCreator 6.0.2, 2022-02-20T10:38:25. --> +<qtcreator> + <data> + <variable>EnvironmentId</variable> + <value type="QByteArray">{f75faabe-ab95-4cc2-874a-48bde0690e72}</value> + </data> + <data> + <variable>ProjectExplorer.Project.ActiveTarget</variable> + <value type="qlonglong">0</value> + </data> + <data> + <variable>ProjectExplorer.Project.EditorSettings</variable> + <valuemap type="QVariantMap"> + <value type="bool" key="EditorConfiguration.AutoIndent">true</value> + <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value> + <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value> + <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0"> + <value type="QString" key="language">Cpp</value> + <valuemap type="QVariantMap" key="value"> + <value type="QByteArray" key="CurrentPreferences">CppGlobal</value> + </valuemap> + </valuemap> + <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1"> + <value type="QString" key="language">QmlJS</value> + <valuemap type="QVariantMap" key="value"> + <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value> + </valuemap> + </valuemap> + <value type="qlonglong" key="EditorConfiguration.CodeStyle.Count">2</value> + <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value> + <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value> + <value type="int" key="EditorConfiguration.IndentSize">4</value> + <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value> + <value type="int" key="EditorConfiguration.MarginColumn">80</value> + <value type="bool" key="EditorConfiguration.MouseHiding">true</value> + <value type="bool" key="EditorConfiguration.MouseNavigation">true</value> + <value type="int" key="EditorConfiguration.PaddingMode">1</value> + <value type="bool" key="EditorConfiguration.PreferSingleLineComments">false</value> + <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value> + <value type="bool" key="EditorConfiguration.ShowMargin">false</value> + <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value> + <value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value> + <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value> + <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value> + <value type="int" key="EditorConfiguration.TabSize">8</value> + <value type="bool" key="EditorConfiguration.UseGlobal">true</value> + <value type="bool" key="EditorConfiguration.UseIndenter">false</value> + <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value> + <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value> + <value type="bool" key="EditorConfiguration.cleanIndentation">true</value> + <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value> + <value type="QString" key="EditorConfiguration.ignoreFileTypes">*.md, *.MD, Makefile</value> + <value type="bool" key="EditorConfiguration.inEntireDocument">false</value> + <value type="bool" key="EditorConfiguration.skipTrailingWhitespace">true</value> + </valuemap> + </data> + <data> + <variable>ProjectExplorer.Project.PluginSettings</variable> + <valuemap type="QVariantMap"> + <valuemap type="QVariantMap" key="AutoTest.ActiveFrameworks"> + <value type="bool" key="AutoTest.Framework.Boost">true</value> + <value type="bool" key="AutoTest.Framework.CTest">false</value> + <value type="bool" key="AutoTest.Framework.Catch">true</value> + <value type="bool" key="AutoTest.Framework.GTest">true</value> + <value type="bool" key="AutoTest.Framework.QtQuickTest">true</value> + <value type="bool" key="AutoTest.Framework.QtTest">true</value> + </valuemap> + <valuemap type="QVariantMap" key="AutoTest.CheckStates"/> + <value type="int" key="AutoTest.RunAfterBuild">0</value> + <value type="bool" key="AutoTest.UseGlobal">true</value> + <valuelist type="QVariantList" key="ClangCodeModel.CustomCommandLineKey"/> + <value type="bool" key="ClangCodeModel.UseGlobalConfig">true</value> + <value type="QString" key="ClangCodeModel.WarningConfigId">Builtin.BuildSystem</value> + <valuemap type="QVariantMap" key="ClangTools"> + <value type="bool" key="ClangTools.AnalyzeOpenFiles">true</value> + <value type="bool" key="ClangTools.BuildBeforeAnalysis">true</value> + <value type="QString" key="ClangTools.DiagnosticConfig">Builtin.DefaultTidyAndClazy</value> + <value type="int" key="ClangTools.ParallelJobs">6</value> + <valuelist type="QVariantList" key="ClangTools.SelectedDirs"/> + <valuelist type="QVariantList" key="ClangTools.SelectedFiles"/> + <valuelist type="QVariantList" key="ClangTools.SuppressedDiagnostics"/> + <value type="bool" key="ClangTools.UseGlobalSettings">true</value> + </valuemap> + <valuemap type="QVariantMap" key="CppEditor.QuickFix"> + <value type="bool" key="UseGlobalSettings">true</value> + </valuemap> + </valuemap> + </data> + <data> + <variable>ProjectExplorer.Project.Target.0</variable> + <valuemap type="QVariantMap"> + <value type="QString" key="DeviceType">Desktop</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop (Qt 6)</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop (Qt 6)</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{bb2c42c9-b15c-4e15-9289-35a041c6fb85}</value> + <value type="qlonglong" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value> + <value type="qlonglong" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> + <value type="qlonglong" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> + <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> + <value type="QString" key="CMake.Build.Type">Debug</value> + <value type="QString" key="CMake.Initial.Parameters">-GNinja +-DCMAKE_BUILD_TYPE:STRING=Debug +-DCMAKE_PROJECT_INCLUDE_BEFORE:PATH=%{IDE:ResourcePath}/package-manager/auto-setup.cmake +-DQT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable} +-DCMAKE_PREFIX_PATH:STRING=%{Qt:QT_INSTALL_PREFIX} +-DCMAKE_C_COMPILER:STRING=%{Compiler:Executable:C} +-DCMAKE_CXX_COMPILER:STRING=%{Compiler:Executable:Cxx}</value> + <value type="int" key="EnableQmlDebugging">0</value> + <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/rtk0c/Development/epistmool/ui.qt/build/Debug</value> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> + <valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets"> + <value type="QString">all</value> + </valuelist> + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value> + </valuemap> + <value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> + </valuemap> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> + <valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets"> + <value type="QString">clean</value> + </valuelist> + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value> + </valuemap> + <value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> + </valuemap> + <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> + <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> + <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/> + <value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value> + <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value> + </valuemap> + <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1"> + <value type="QString" key="CMake.Build.Type">Release</value> + <value type="QString" key="CMake.Initial.Parameters">-GNinja +-DCMAKE_BUILD_TYPE:STRING=Release +-DCMAKE_PROJECT_INCLUDE_BEFORE:PATH=%{IDE:ResourcePath}/package-manager/auto-setup.cmake +-DQT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable} +-DCMAKE_PREFIX_PATH:STRING=%{Qt:QT_INSTALL_PREFIX} +-DCMAKE_C_COMPILER:STRING=%{Compiler:Executable:C} +-DCMAKE_CXX_COMPILER:STRING=%{Compiler:Executable:Cxx}</value> + <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/rtk0c/Development/epistmool/ui.qt/build-EpistmoolUI-Desktop_Qt_6-Release</value> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> + <valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets"> + <value type="QString">all</value> + </valuelist> + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value> + </valuemap> + <value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> + </valuemap> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> + <valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets"> + <value type="QString">clean</value> + </valuelist> + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value> + </valuemap> + <value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> + </valuemap> + <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> + <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> + <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/> + <value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value> + <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value> + </valuemap> + <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2"> + <value type="QString" key="CMake.Build.Type">RelWithDebInfo</value> + <value type="QString" key="CMake.Initial.Parameters">-GNinja +-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo +-DCMAKE_PROJECT_INCLUDE_BEFORE:PATH=%{IDE:ResourcePath}/package-manager/auto-setup.cmake +-DQT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable} +-DCMAKE_PREFIX_PATH:STRING=%{Qt:QT_INSTALL_PREFIX} +-DCMAKE_C_COMPILER:STRING=%{Compiler:Executable:C} +-DCMAKE_CXX_COMPILER:STRING=%{Compiler:Executable:Cxx}</value> + <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/rtk0c/Development/epistmool/ui.qt/build-EpistmoolUI-Desktop_Qt_6-RelWithDebInfo</value> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> + <valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets"> + <value type="QString">all</value> + </valuelist> + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value> + </valuemap> + <value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> + </valuemap> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> + <valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets"> + <value type="QString">clean</value> + </valuelist> + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value> + </valuemap> + <value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> + </valuemap> + <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> + <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> + <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/> + <value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value> + <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release with Debug Information</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value> + </valuemap> + <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.3"> + <value type="QString" key="CMake.Build.Type">MinSizeRel</value> + <value type="QString" key="CMake.Initial.Parameters">-GNinja +-DCMAKE_BUILD_TYPE:STRING=MinSizeRel +-DCMAKE_PROJECT_INCLUDE_BEFORE:PATH=%{IDE:ResourcePath}/package-manager/auto-setup.cmake +-DQT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable} +-DCMAKE_PREFIX_PATH:STRING=%{Qt:QT_INSTALL_PREFIX} +-DCMAKE_C_COMPILER:STRING=%{Compiler:Executable:C} +-DCMAKE_CXX_COMPILER:STRING=%{Compiler:Executable:Cxx}</value> + <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/rtk0c/Development/epistmool/ui.qt/build-EpistmoolUI-Desktop_Qt_6-MinSizeRel</value> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> + <valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets"> + <value type="QString">all</value> + </valuelist> + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value> + </valuemap> + <value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> + </valuemap> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> + <valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets"> + <value type="QString">clean</value> + </valuelist> + <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value> + </valuemap> + <value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> + </valuemap> + <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> + <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> + <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/> + <value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value> + <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Minimum Size Release</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value> + </valuemap> + <value type="qlonglong" key="ProjectExplorer.Target.BuildConfigurationCount">4</value> + <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0"> + <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> + <value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">0</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Deploy</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value> + </valuemap> + <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value> + <valuemap type="QVariantMap" key="ProjectExplorer.DeployConfiguration.CustomData"/> + <value type="bool" key="ProjectExplorer.DeployConfiguration.CustomDataEnabled">false</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value> + </valuemap> + <value type="qlonglong" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> + <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> + <value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value> + <value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value> + <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value> + <valuelist type="QVariantList" key="CustomOutputParsers"/> + <value type="int" key="PE.EnvironmentAspect.Base">2</value> + <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">appEpistmoolUI</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeRunConfiguration.appEpistmoolUI</value> + <value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">appEpistmoolUI</value> + <value type="bool" key="RunConfiguration.UseCppDebugger">false</value> + <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value> + <value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value> + <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> + <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> + <value type="QString" key="RunConfiguration.WorkingDirectory.default">/home/rtk0c/Development/epistmool/ui.qt/build/Debug</value> + </valuemap> + <value type="qlonglong" key="ProjectExplorer.Target.RunConfigurationCount">1</value> + </valuemap> + </data> + <data> + <variable>ProjectExplorer.Project.TargetCount</variable> + <value type="qlonglong">1</value> + </data> + <data> + <variable>ProjectExplorer.Project.Updater.FileVersion</variable> + <value type="int">22</value> + </data> + <data> + <variable>Version</variable> + <value type="int">22</value> + </data> +</qtcreator> diff --git a/ui.qt/locale/EpistmoolUI_zh_CN.ts b/ui.qt/locale/EpistmoolUI_zh_CN.ts new file mode 100644 index 0000000..630fd35 --- /dev/null +++ b/ui.qt/locale/EpistmoolUI_zh_CN.ts @@ -0,0 +1,3 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.1" language="zh_CN"></TS> diff --git a/ui.qt/source/document.cpp b/ui.qt/source/document.cpp new file mode 100644 index 0000000..b418b0d --- /dev/null +++ b/ui.qt/source/document.cpp @@ -0,0 +1,78 @@ +#include "document.hpp" + +#include <QMetaType> +#include <QVariant> + +DocumentBlock::DocumentBlock(QObject* parent) + : QObject{ parent } +{ +} + +DocumentModel* DocumentBlock::getModel() const +{ + return mModel; +} + +void DocumentBlock::setModel(DocumentModel* newModel) +{ + mModel = newModel; +} + +QQuickTextDocument* DocumentBlock::getDoc() const +{ + return mDoc; +} + +void DocumentBlock::setDoc(QQuickTextDocument* newDoc) +{ + if (mDoc != newDoc) { + if (mDoc) { + disconnect(mDoc->textDocument(), nullptr, this, nullptr); + } + mDoc = newDoc; + if (newDoc) { + connect(newDoc->textDocument(), &QTextDocument::modificationChanged, this, [&]() { + // TODO add a timer to wait for 1 second before updating? + mModifyTime = QDateTime::currentDateTime(); + emit modificationChanged(); + }); + } + emit docChanged(); + } +} + +const QDateTime& DocumentBlock::getModifyTime() const +{ + return mModifyTime; +} + +void DocumentModel::appendBlock(DocumentBlock* block) +{ + mBlocks.push_back(block); +} + +int DocumentModel::rowCount(const QModelIndex& parent) const +{ + return mBlocks.size(); +} + +QVariant DocumentModel::data(const QModelIndex& index, int role) const +{ + if (index.row() < 0 || index.row() >= mBlocks.size()) { + return QVariant(); + } + + switch (role) { + case Qt::DisplayRole: return QVariant::fromValue(mBlocks[index.row()]); + case ModifyTimeRole: return mBlocks[index.row()]->getModifyTime(); + default: return QVariant(); + } +} + +QHash<int, QByteArray> DocumentModel::roleNames() const +{ + QHash<int, QByteArray> roles; + roles[Qt::DisplayRole] = "display", + roles[ModifyTimeRole] = "modifyTime"; + return roles; +} diff --git a/ui.qt/source/document.hpp b/ui.qt/source/document.hpp new file mode 100644 index 0000000..ba11e26 --- /dev/null +++ b/ui.qt/source/document.hpp @@ -0,0 +1,62 @@ +#pragma once + +#include "fwd.hpp" + +#include <QAbstractItemModel> +#include <QDateTime> +#include <QObject> +#include <QQuickTextDocument> + +class DocumentBlock : public QObject +{ + Q_OBJECT + QML_ELEMENT + + Q_PROPERTY(QQuickTextDocument* textDocument READ getDoc WRITE setDoc NOTIFY docChanged) + +private: + DocumentModel* mModel; + QQuickTextDocument* mDoc = nullptr; + QDateTime mModifyTime; + +public: + explicit DocumentBlock(QObject* parent = nullptr); + + DocumentModel* getModel() const; + void setModel(DocumentModel* newModel); + + QQuickTextDocument* getDoc() const; + void setDoc(QQuickTextDocument* newDoc); + + const QDateTime& getModifyTime() const; + +signals: + void docChanged(); + void modificationChanged(); +}; + +class DocumentModel : public QAbstractItemModel +{ + Q_OBJECT + QML_ELEMENT + +private: + std::vector<DocumentBlock*> mBlocks; + +public: + enum DocumentRoles { + ModifyTimeRole = Qt::UserRole + 1, + }; + + DocumentModel(QObject* parent = nullptr); + + void appendBlock(DocumentBlock* block); + // TODO + // void moveBlock() + + int rowCount(const QModelIndex& parent = QModelIndex()) const override; + QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; + +protected: + QHash<int, QByteArray> roleNames() const override; +}; diff --git a/ui.qt/source/fwd.hpp b/ui.qt/source/fwd.hpp new file mode 100644 index 0000000..7f98627 --- /dev/null +++ b/ui.qt/source/fwd.hpp @@ -0,0 +1,14 @@ +#pragma once + +// document.hpp +class DocumentBlock; +class DocumentModel; + +// keyword.hpp +class Keyword; +class KeywordDatabase; + +// knowledgefragment.cpp +struct KnowledgeId; +class KnowledgeFragment; +class KnowledgeDatabase; diff --git a/ui.qt/source/keyword.cpp b/ui.qt/source/keyword.cpp new file mode 100644 index 0000000..f782437 --- /dev/null +++ b/ui.qt/source/keyword.cpp @@ -0,0 +1,10 @@ +#include "keyword.hpp" + +#include "knowledgefragment.hpp" + +Keyword::Keyword(const QString& name) + : name(name) +{ +} + +Keyword::~Keyword() = default; diff --git a/ui.qt/source/keyword.hpp b/ui.qt/source/keyword.hpp new file mode 100644 index 0000000..bc50473 --- /dev/null +++ b/ui.qt/source/keyword.hpp @@ -0,0 +1,26 @@ +#pragma once + +#include "fwd.hpp" + +#include <QString> +#include <vector> + +class Keyword +{ +private: + QString name; + std::vector<KnowledgeId> associations; + +public: + Keyword(const QString& name); + ~Keyword(); + + Keyword(const Keyword&) = default; + Keyword& operator=(const Keyword&) = default; + Keyword(Keyword&&) = default; + Keyword& operator=(Keyword&&) = default; +}; + +class KeywordDatabase +{ +}; diff --git a/ui.qt/source/knowledgefragment.cpp b/ui.qt/source/knowledgefragment.cpp new file mode 100644 index 0000000..4db09e7 --- /dev/null +++ b/ui.qt/source/knowledgefragment.cpp @@ -0,0 +1,11 @@ +#include "knowledgefragment.hpp" + +KnowledgeFragment::KnowledgeFragment(KnowledgeId id) + : id{ id } +{ +} + +KnowledgeId KnowledgeFragment::getId() const +{ + return id; +} diff --git a/ui.qt/source/knowledgefragment.hpp b/ui.qt/source/knowledgefragment.hpp new file mode 100644 index 0000000..533d99f --- /dev/null +++ b/ui.qt/source/knowledgefragment.hpp @@ -0,0 +1,38 @@ +#pragma once + +#include "fwd.hpp" + +#include <QDateTime> +#include <cstddef> +#include <vector> + +struct KnowledgeId +{ + size_t id; +}; + +class KnowledgeFragment +{ +private: + QDateTime createTime; + QDateTime modifyTime; + KnowledgeId id; + +public: + KnowledgeFragment(KnowledgeId id); + + KnowledgeId getId() const; +}; + +class KnowledgeDatabase +{ +private: + std::vector<KnowledgeFragment> storage; + std::vector<size_t> index; // Mapping from KnowledgeId (index) to `storage` index + KnowledgeId nextId; + +public: + KnowledgeId allocateFragment(); + bool deleteFragment(KnowledgeId id); + KnowledgeFragment* getFragment(KnowledgeId id); +}; diff --git a/ui.qt/source/main.cpp b/ui.qt/source/main.cpp new file mode 100644 index 0000000..e92863f --- /dev/null +++ b/ui.qt/source/main.cpp @@ -0,0 +1,35 @@ +#include <QGuiApplication> +#include <QLocale> +#include <QQmlApplicationEngine> +#include <QTranslator> + +int main(int argc, char *argv[]) +{ + QGuiApplication app(argc, argv); + + QTranslator translator; + const QStringList uiLanguages = QLocale::system().uiLanguages(); + for (const QString& locale : uiLanguages) { + const QString baseName = "EpistmoolUI_" + QLocale(locale).name(); + if (translator.load(":/i18n/" + baseName)) { + app.installTranslator(&translator); + break; + } + } + + QQmlApplicationEngine engine; + const QUrl url(u"qrc:/EpistmoolUI/source/qml/MainWindow.qml"_qs); + QObject::connect( + &engine, + &QQmlApplicationEngine::objectCreated, + &app, + [url](QObject* obj, const QUrl& objUrl) { + if (!obj && url == objUrl) { + QCoreApplication::exit(-1); + } + }, + Qt::QueuedConnection); + engine.load(url); + + return app.exec(); +} diff --git a/ui.qt/source/qml/Document.qml b/ui.qt/source/qml/Document.qml new file mode 100644 index 0000000..e62b731 --- /dev/null +++ b/ui.qt/source/qml/Document.qml @@ -0,0 +1,39 @@ +import QtCore +import QtQuick +import QtQuick.Controls + +import EpistmoolUI + +Item { + DocumentModel { + id: documentModel + } + + ScrollView { + id: scrollView + + ListView { + id: listView + model: documentModel + anchors.fill: parent + + delegate: Item { + required property DocumentBlock documentBlock + required property date modifyTime + + Component.onCompleted: { + documentBlock.textDocument = textArea.textDocument + } + + TextArea { + id: textArea + textFormat: Qt.RichText + wrapMode: TextArea.Wrap + focus: true + selectByMouse: true + persistentSelection: true + } + } + } + } +} diff --git a/ui.qt/source/qml/GoToKnowledge.qml b/ui.qt/source/qml/GoToKnowledge.qml new file mode 100644 index 0000000..f97cbcf --- /dev/null +++ b/ui.qt/source/qml/GoToKnowledge.qml @@ -0,0 +1,4 @@ +import QtQuick + +Item { +} diff --git a/ui.qt/source/qml/MainWindow.qml b/ui.qt/source/qml/MainWindow.qml new file mode 100644 index 0000000..905f0e8 --- /dev/null +++ b/ui.qt/source/qml/MainWindow.qml @@ -0,0 +1,12 @@ +import QtQuick + +Window { + width: 640 + height: 480 + visible: true + title: qsTr("Hello World") + + Document { + id: doc + } +} |