Compare commits
12 Commits
v1.1.2
...
03ccf03808
| Author | SHA1 | Date | |
|---|---|---|---|
| 03ccf03808 | |||
| cdeb1205ef | |||
| c4d74bb22b | |||
| f99ab4741b | |||
| b014daad7e | |||
|
|
73363bf12c | ||
|
|
ff4ebbc82f | ||
|
|
8dd5892327 | ||
|
|
c00dd40def | ||
|
|
3626ffa54e | ||
|
|
7b17dfb044 | ||
|
|
8ceae034e1 |
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
*.pro.*
|
||||||
4
Info.plist
Executable file → Normal file
@@ -3,11 +3,11 @@
|
|||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>CFBundleExecutable</key>
|
<key>CFBundleExecutable</key>
|
||||||
<string>TaskNote</string>
|
<string>WorkPad</string>
|
||||||
<key>CFBundleIconFile</key>
|
<key>CFBundleIconFile</key>
|
||||||
<string></string>
|
<string></string>
|
||||||
<key>CFBundleIdentifier</key>
|
<key>CFBundleIdentifier</key>
|
||||||
<string>com.aureliedelhaie.TaskNote</string>
|
<string>com.aureliedelhaie.WorkPad</string>
|
||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>APPL</string>
|
<string>APPL</string>
|
||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
|
|||||||
14
README.md
@@ -1,5 +1,17 @@
|
|||||||
# TaskNote - Simple note editor
|
# WorkPad - Simple note editor
|
||||||
|
|
||||||
Wrote with Qt 6 Open Source : [Download](https://www.qt.io/download-open-source)
|
Wrote with Qt 6 Open Source : [Download](https://www.qt.io/download-open-source)
|
||||||
|
|
||||||
This is a very simple note editor. The editor has a Markdown text area and a rendering view
|
This is a very simple note editor. The editor has a Markdown text area and a rendering view
|
||||||
|
|
||||||
|
## Prepare to use on linux
|
||||||
|
You need to install Qt 6.2.4 dependencies
|
||||||
|
|
||||||
|
```sh
|
||||||
|
sudo apt install libxcb1 libxcb-xinerama0 libqt6widgets6 libqt6gui6 libqt6core5compat6 libqt6core5compat6 libqt6core6 libqt6dbus6 qt6-qpa-plugins
|
||||||
|
```
|
||||||
|
### To run on Wayland
|
||||||
|
|
||||||
|
```sh
|
||||||
|
sudo apt install qt6-wayland
|
||||||
|
```
|
||||||
|
|||||||
@@ -1,263 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE QtCreatorProject>
|
|
||||||
<!-- Written by QtCreator 6.0.2, 2022-03-01T21:27:21. -->
|
|
||||||
<qtcreator>
|
|
||||||
<data>
|
|
||||||
<variable>EnvironmentId</variable>
|
|
||||||
<value type="QByteArray">{dbe9fba1-e5a9-4d98-85bf-f46da0900eba}</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">8</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>
|
|
||||||
</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.2.3 GCC 64bit</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 6.2.3 GCC 64bit</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt6.623.gcc_64_kit</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="int" key="EnableQmlDebugging">0</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/aurelie/src/build-TaskNote-Desktop_Qt_6_2_3_GCC_64bit-Debug</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/aurelie/src/build-TaskNote-Desktop_Qt_6_2_3_GCC_64bit-Debug</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
|
||||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
|
||||||
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</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">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</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">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
|
||||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/aurelie/src/build-TaskNote-Desktop_Qt_6_2_3_GCC_64bit-Release</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/aurelie/src/build-TaskNote-Desktop_Qt_6_2_3_GCC_64bit-Release</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
|
||||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
|
||||||
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</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">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</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">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
|
||||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
|
||||||
<value type="int" key="QtQuickCompiler">0</value>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
|
|
||||||
<value type="int" key="EnableQmlDebugging">0</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/aurelie/src/build-TaskNote-Desktop_Qt_6_2_3_GCC_64bit-Profile</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/aurelie/src/build-TaskNote-Desktop_Qt_6_2_3_GCC_64bit-Profile</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
|
||||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
|
||||||
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</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">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</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">Profile</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
|
||||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
|
||||||
<value type="int" key="QtQuickCompiler">0</value>
|
|
||||||
<value type="int" key="SeparateDebugInfo">0</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.Target.BuildConfigurationCount">3</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.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey"></value>
|
|
||||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
|
||||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
|
||||||
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
|
||||||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</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>
|
|
||||||
@@ -1,267 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE QtCreatorProject>
|
|
||||||
<!-- Written by QtCreator 6.0.2, 2022-02-01T14:33:09. -->
|
|
||||||
<qtcreator>
|
|
||||||
<data>
|
|
||||||
<variable>EnvironmentId</variable>
|
|
||||||
<value type="QByteArray">{4f8813a6-3af3-4bb9-ae1e-fccaa8f98bf0}</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="QString">-fno-delayed-template-parsing</value>
|
|
||||||
</valuelist>
|
|
||||||
<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">8</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>
|
|
||||||
</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.2.3 MSVC2019 64bit</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 6.2.3 MSVC2019 64bit</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt6.623.win64_msvc2019_64_kit</value>
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.Target.ActiveBuildConfiguration">1</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="int" key="EnableQmlDebugging">0</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:\build-TaskNote-Desktop_Qt_6_2_3_MSVC2019_64bit-Debug</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">D:/build-TaskNote-Desktop_Qt_6_2_3_MSVC2019_64bit-Debug</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
|
||||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
|
||||||
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</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">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</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">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
|
||||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:\build-TaskNote-Desktop_Qt_6_2_3_MSVC2019_64bit-Release</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">D:/build-TaskNote-Desktop_Qt_6_2_3_MSVC2019_64bit-Release</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
|
||||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
|
||||||
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</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">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</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">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
|
||||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
|
||||||
<value type="int" key="QtQuickCompiler">0</value>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
|
|
||||||
<value type="int" key="EnableQmlDebugging">0</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:\build-TaskNote-Desktop_Qt_6_2_3_MSVC2019_64bit-Profile</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">D:/build-TaskNote-Desktop_Qt_6_2_3_MSVC2019_64bit-Profile</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
|
||||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
|
||||||
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</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">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</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">Profile</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
|
||||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
|
||||||
<value type="int" key="QtQuickCompiler">0</value>
|
|
||||||
<value type="int" key="SeparateDebugInfo">0</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.Target.BuildConfigurationCount">3</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.Id">Qt4ProjectManager.Qt4RunConfiguration:D:/TaskNote/TaskNote.pro</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">D:/TaskNote/TaskNote.pro</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">D:/build-TaskNote-Desktop_Qt_6_2_3_MSVC2019_64bit-Release</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>
|
|
||||||
@@ -1,265 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE QtCreatorProject>
|
|
||||||
<!-- Written by QtCreator 6.0.2, 2022-02-01T15:58:51. -->
|
|
||||||
<qtcreator>
|
|
||||||
<data>
|
|
||||||
<variable>EnvironmentId</variable>
|
|
||||||
<value type="QByteArray">{6652f76d-bc53-48e0-b6d8-98a4bb74cdef}</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">8</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>
|
|
||||||
</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.2.3 GCC 64bit</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 6.2.3 GCC 64bit</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt6.623.gcc_64_kit</value>
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.Target.ActiveBuildConfiguration">1</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="int" key="EnableQmlDebugging">0</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/aurelie/build-TaskNote-Desktop_Qt_6_2_3_GCC_64bit-Debug</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/aurelie/build-TaskNote-Desktop_Qt_6_2_3_GCC_64bit-Debug</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
|
||||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
|
||||||
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</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">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</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">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
|
||||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/aurelie/build-TaskNote-Desktop_Qt_6_2_3_GCC_64bit-Release</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/aurelie/build-TaskNote-Desktop_Qt_6_2_3_GCC_64bit-Release</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
|
||||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
|
||||||
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</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">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</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">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
|
||||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
|
||||||
<value type="int" key="QtQuickCompiler">0</value>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
|
|
||||||
<value type="int" key="EnableQmlDebugging">0</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/aurelie/build-TaskNote-Desktop_Qt_6_2_3_GCC_64bit-Profile</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/aurelie/build-TaskNote-Desktop_Qt_6_2_3_GCC_64bit-Profile</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
|
||||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
|
||||||
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</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">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</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">Profile</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
|
||||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
|
||||||
<value type="int" key="QtQuickCompiler">0</value>
|
|
||||||
<value type="int" key="SeparateDebugInfo">0</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.Target.BuildConfigurationCount">3</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.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/aurelie/TaskNote/TaskNote.pro</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">/home/aurelie/TaskNote/TaskNote.pro</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/aurelie/build-TaskNote-Desktop_Qt_6_2_3_GCC_64bit-Release</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>
|
|
||||||
@@ -1,264 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE QtCreatorProject>
|
|
||||||
<!-- Written by QtCreator 5.0.2, 2022-02-01T10:53:16. -->
|
|
||||||
<qtcreator>
|
|
||||||
<data>
|
|
||||||
<variable>EnvironmentId</variable>
|
|
||||||
<value type="QByteArray">{f1407b1e-b4d5-4aac-ba0d-b38072a0dfb8}</value>
|
|
||||||
</data>
|
|
||||||
<data>
|
|
||||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
|
||||||
<value type="int">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="int" 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">4</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>
|
|
||||||
</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">Qt 6.2.0 for macOS</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Qt 6.2.0 for macOS</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt6.620.clang_64_kit</value>
|
|
||||||
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
|
||||||
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
|
||||||
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
|
||||||
<value type="int" key="EnableQmlDebugging">0</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/Users/alexis/build-TaskNote-Qt_6_2_0_for_macOS-Debug</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/Users/alexis/build-TaskNote-Qt_6_2_0_for_macOS-Debug</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
|
||||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
|
||||||
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis">
|
|
||||||
<value type="QString">arm-darwin-generic-mach_o-64bit</value>
|
|
||||||
</valuelist>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</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">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" 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"/>
|
|
||||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
|
||||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/Users/alexis/build-TaskNote-Qt_6_2_0_for_macOS-Release</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/Users/alexis/build-TaskNote-Qt_6_2_0_for_macOS-Release</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
|
||||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">true</value>
|
|
||||||
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</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">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" 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"/>
|
|
||||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
|
||||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
|
||||||
<value type="int" key="QtQuickCompiler">0</value>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
|
|
||||||
<value type="int" key="EnableQmlDebugging">0</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/Users/alexis/build-TaskNote-Qt_6_2_0_for_macOS-Profile</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/Users/alexis/build-TaskNote-Qt_6_2_0_for_macOS-Profile</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
|
||||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">true</value>
|
|
||||||
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</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">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" 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"/>
|
|
||||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Profile</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
|
||||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
|
||||||
<value type="int" key="QtQuickCompiler">0</value>
|
|
||||||
<value type="int" key="SeparateDebugInfo">0</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">3</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
|
||||||
<value type="int" 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="int" 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.Id">Qt4ProjectManager.Qt4RunConfiguration:/Users/alexis/TaskNote/TaskNote.pro</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">/Users/alexis/TaskNote/TaskNote.pro</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">/Users/alexis/build-TaskNote-Qt_6_2_0_for_macOS-Debug/TaskNote.app/Contents/MacOS</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
|
||||||
</valuemap>
|
|
||||||
</data>
|
|
||||||
<data>
|
|
||||||
<variable>ProjectExplorer.Project.TargetCount</variable>
|
|
||||||
<value type="int">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>
|
|
||||||
59
TaskNote.pro → WorkPad.pro
Executable file → Normal file
@@ -1,14 +1,14 @@
|
|||||||
QT += core gui
|
QT += core gui
|
||||||
|
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
greaterThan(QT_MAJOR_VERSION, 5): QT += widgets webenginewidgets
|
||||||
|
|
||||||
CONFIG += c++17
|
CONFIG += c++17
|
||||||
|
|
||||||
win32:VERSION = 1.1.2.0 # major.minor.patch.build
|
win32:VERSION = 3.0.0.0 # major.minor.patch.build
|
||||||
else:VERSION = 1.1.2 # major.minor.patch
|
else:VERSION = 3.0.0 # major.minor.patch
|
||||||
|
|
||||||
DEFINES += APP_VERSION=\"\\\"$${VERSION}\\\"\"
|
DEFINES += APP_VERSION=\"\\\"$${VERSION}\\\"\"
|
||||||
DEFINES += APP_NAME=\"\\\"TaskNote\\\"\"
|
DEFINES += APP_NAME=\"\\\"WorkPad\\\"\"
|
||||||
|
|
||||||
# remove possible other optimization flags
|
# remove possible other optimization flags
|
||||||
win32 {
|
win32 {
|
||||||
@@ -17,7 +17,7 @@ win32 {
|
|||||||
QMAKE_CXXFLAGS_RELEASE -= -O1
|
QMAKE_CXXFLAGS_RELEASE -= -O1
|
||||||
QMAKE_CXXFLAGS_RELEASE *= -O2
|
QMAKE_CXXFLAGS_RELEASE *= -O2
|
||||||
DEFINES += APP_OS=\"\\\"Windows\\\"\"
|
DEFINES += APP_OS=\"\\\"Windows\\\"\"
|
||||||
DEFINES += APP_OS_VERSION=\"\\\"$$system(wmic os get version /value)\\\"\"
|
DEFINES += APP_OS_VERSION=\"\\\"$$system(ver)\\\"\"
|
||||||
equals(QMAKE_TARGET.arch, arm64) {
|
equals(QMAKE_TARGET.arch, arm64) {
|
||||||
message("CPU Architecture : aarch64")
|
message("CPU Architecture : aarch64")
|
||||||
DEFINES += APP_ARCH=\"\\\"arm64\\\"\"
|
DEFINES += APP_ARCH=\"\\\"arm64\\\"\"
|
||||||
@@ -29,8 +29,8 @@ win32 {
|
|||||||
}
|
}
|
||||||
RC_ICONS = icon.ico
|
RC_ICONS = icon.ico
|
||||||
QMAKE_TARGET_COMPANY = "Aurelie Delhaie"
|
QMAKE_TARGET_COMPANY = "Aurelie Delhaie"
|
||||||
QMAKE_TARGET_PRODUCT = "TaskNote"
|
QMAKE_TARGET_PRODUCT = "WorkPad"
|
||||||
QMAKE_TARGET_DESCRIPTION = "Simple note-taking workbook"
|
QMAKE_TARGET_DESCRIPTION = "WorkPad"
|
||||||
}
|
}
|
||||||
|
|
||||||
macx {
|
macx {
|
||||||
@@ -47,13 +47,21 @@ macx {
|
|||||||
DEFINES += APP_ARCH=\"\\\"universal\\\"\"
|
DEFINES += APP_ARCH=\"\\\"universal\\\"\"
|
||||||
}
|
}
|
||||||
|
|
||||||
linux-g++* {
|
linux-* {
|
||||||
message("Build for Linux")
|
message("Build for Linux")
|
||||||
DEFINES += APP_OS=\"\\\"$$system(cat /etc/issue | cut -d\' \' -f1)\\\"\"
|
DEFINES += APP_OS=\"\\\"$$system(cat /etc/issue | cut -d\' \' -f1)\\\"\"
|
||||||
DEFINES += APP_OS_VERSION=\"\\\"$$system(uname -r)\\\"\"
|
DEFINES += APP_OS_VERSION=\"\\\"$$system(uname -r)\\\"\"
|
||||||
DEFINES += APP_ARCH=\"\\\"amd64\\\"\"
|
DEFINES += APP_ARCH=\"\\\"$$system(uname -m)\\\"\"
|
||||||
QMAKE_CXXFLAGS_RELEASE *= -O3
|
ARCH = $$system(uname -m)
|
||||||
|
equals(ARCH, aarch64) {
|
||||||
|
message("CPU Architecture : aarch64")
|
||||||
|
QMAKE_CXXFLAGS_RELEASE += -mtune=cortex-a72
|
||||||
|
}
|
||||||
|
equals(ARCH, amd64) {
|
||||||
|
message("CPU Architecture : amd64")
|
||||||
QMAKE_CXXFLAGS_RELEASE += -march=skylake
|
QMAKE_CXXFLAGS_RELEASE += -march=skylake
|
||||||
|
}
|
||||||
|
QMAKE_CXXFLAGS_RELEASE *= -O3
|
||||||
}
|
}
|
||||||
|
|
||||||
# You can make your code fail to compile if it uses deprecated APIs.
|
# You can make your code fail to compile if it uses deprecated APIs.
|
||||||
@@ -61,21 +69,41 @@ linux-g++* {
|
|||||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
src/frames/aboutdialog.cpp \
|
src/frames/configdialog.cpp \
|
||||||
|
src/services/configmanager.cpp \
|
||||||
|
src/frames/exportdialog.cpp \
|
||||||
|
src/frames/renamedialog.cpp \
|
||||||
|
src/frames/createdialog.cpp \
|
||||||
|
src/frames/movedialog.cpp \
|
||||||
src/main.cpp \
|
src/main.cpp \
|
||||||
src/frames/mainwindow.cpp \
|
src/frames/mainwindow.cpp \
|
||||||
|
src/models/appconfiguration.cpp \
|
||||||
src/models/note.cpp \
|
src/models/note.cpp \
|
||||||
|
src/models/folder.cpp \
|
||||||
src/services/savemanager.cpp
|
src/services/savemanager.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
src/frames/aboutdialog.h \
|
maddy/parserconfig.h \
|
||||||
|
maddy/parser.h \
|
||||||
|
src/frames/configdialog.h \
|
||||||
|
src/services/configmanager.h \
|
||||||
|
src/frames/exportdialog.h \
|
||||||
|
src/frames/renamedialog.h \
|
||||||
|
src/frames/createdialog.h \
|
||||||
src/frames/mainwindow.h \
|
src/frames/mainwindow.h \
|
||||||
|
src/frames/movedialog.h \
|
||||||
|
src/models/appconfiguration.h \
|
||||||
src/models/note.h \
|
src/models/note.h \
|
||||||
|
src/models/folder.h \
|
||||||
src/services/savemanager.h
|
src/services/savemanager.h
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
src/frames/aboutdialog.ui \
|
src/frames/configdialog.ui \
|
||||||
src/frames/mainwindow.ui
|
src/frames/exportdialog.ui \
|
||||||
|
src/frames/renamedialog.ui \
|
||||||
|
src/frames/createdialog.ui \
|
||||||
|
src/frames/mainwindow.ui \
|
||||||
|
src/frames/movedialog.ui
|
||||||
|
|
||||||
# Default rules for deployment.
|
# Default rules for deployment.
|
||||||
qnx: target.path = /tmp/$${TARGET}/bin
|
qnx: target.path = /tmp/$${TARGET}/bin
|
||||||
@@ -83,4 +111,5 @@ else: unix:!android: target.path = /opt/$${TARGET}/bin
|
|||||||
!isEmpty(target.path): INSTALLS += target
|
!isEmpty(target.path): INSTALLS += target
|
||||||
|
|
||||||
RESOURCES += \
|
RESOURCES += \
|
||||||
icons.qrc
|
icons.qrc \
|
||||||
|
static.qrc
|
||||||
0
icon.ico
Executable file → Normal file
|
Before Width: | Height: | Size: 113 KiB After Width: | Height: | Size: 113 KiB |
8
icons.qrc
Executable file → Normal file
@@ -1,12 +1,10 @@
|
|||||||
<RCC>
|
<RCC>
|
||||||
<qresource prefix="/icon">
|
<qresource prefix="/icon">
|
||||||
<file>resources/outline_add_circle_outline_black_48dp.png</file>
|
|
||||||
<file>resources/outline_delete_forever_black_48dp.png</file>
|
<file>resources/outline_delete_forever_black_48dp.png</file>
|
||||||
<file>resources/outline_help_outline_black_48dp.png</file>
|
|
||||||
<file>resources/outline_lock_black_48dp.png</file>
|
|
||||||
<file>resources/outline_save_black_48dp.png</file>
|
<file>resources/outline_save_black_48dp.png</file>
|
||||||
<file>resources/outline_shield_black_48dp.png</file>
|
<file>resources/new_file.png</file>
|
||||||
<file>resources/outline_lock_open_black_48dp.png</file>
|
<file>resources/new_folder.png</file>
|
||||||
|
<file>resources/settings.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
<qresource prefix="/logo">
|
<qresource prefix="/logo">
|
||||||
<file>resources/logo.png</file>
|
<file>resources/logo.png</file>
|
||||||
|
|||||||
192
maddy/blockparser.h
Normal file
@@ -0,0 +1,192 @@
|
|||||||
|
/*
|
||||||
|
* This project is licensed under the MIT license. For more information see the
|
||||||
|
* LICENSE file.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
#include <sstream>
|
||||||
|
#include <string>
|
||||||
|
// windows compatibility includes
|
||||||
|
#include <algorithm>
|
||||||
|
#include <cctype>
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace maddy {
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BlockParser
|
||||||
|
*
|
||||||
|
* The code expects every child to have the following static function to be
|
||||||
|
* implemented:
|
||||||
|
* `static bool IsStartingLine(const std::string& line)`
|
||||||
|
*
|
||||||
|
* @class
|
||||||
|
*/
|
||||||
|
class BlockParser
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* ctor
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @param {std::function<void(std::string&)>} parseLineCallback
|
||||||
|
* @param {std::function<std::shared_ptr<BlockParser>(const std::string&
|
||||||
|
* line)>} getBlockParserForLineCallback
|
||||||
|
*/
|
||||||
|
BlockParser(
|
||||||
|
std::function<void(std::string&)> parseLineCallback,
|
||||||
|
std::function<std::shared_ptr<BlockParser>(const std::string& line)>
|
||||||
|
getBlockParserForLineCallback
|
||||||
|
)
|
||||||
|
: result("", std::ios_base::ate | std::ios_base::in | std::ios_base::out)
|
||||||
|
, childParser(nullptr)
|
||||||
|
, parseLineCallback(parseLineCallback)
|
||||||
|
, getBlockParserForLineCallback(getBlockParserForLineCallback)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* dtor
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
*/
|
||||||
|
virtual ~BlockParser() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AddLine
|
||||||
|
*
|
||||||
|
* Adding a line which has to be parsed.
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @param {std::string&} line
|
||||||
|
* @return {void}
|
||||||
|
*/
|
||||||
|
virtual void AddLine(std::string& line)
|
||||||
|
{
|
||||||
|
this->parseBlock(line);
|
||||||
|
|
||||||
|
if (this->isInlineBlockAllowed() && !this->childParser)
|
||||||
|
{
|
||||||
|
this->childParser = this->getBlockParserForLine(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this->childParser)
|
||||||
|
{
|
||||||
|
this->childParser->AddLine(line);
|
||||||
|
|
||||||
|
if (this->childParser->IsFinished())
|
||||||
|
{
|
||||||
|
this->result << this->childParser->GetResult().str();
|
||||||
|
this->childParser = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this->isLineParserAllowed())
|
||||||
|
{
|
||||||
|
this->parseLine(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
this->result << line;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IsFinished
|
||||||
|
*
|
||||||
|
* Check if the BlockParser is done
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @return {bool}
|
||||||
|
*/
|
||||||
|
virtual bool IsFinished() const = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GetResult
|
||||||
|
*
|
||||||
|
* Get the parsed HTML output.
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @return {std::stringstream}
|
||||||
|
*/
|
||||||
|
std::stringstream& GetResult() { return this->result; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear
|
||||||
|
*
|
||||||
|
* Clear the result to reuse the parser object.
|
||||||
|
*
|
||||||
|
* It is only used by one test for now.
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @return {void}
|
||||||
|
*/
|
||||||
|
void Clear() { this->result.str(""); }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
std::stringstream result;
|
||||||
|
std::shared_ptr<BlockParser> childParser;
|
||||||
|
|
||||||
|
virtual bool isInlineBlockAllowed() const = 0;
|
||||||
|
virtual bool isLineParserAllowed() const = 0;
|
||||||
|
virtual void parseBlock(std::string& line) = 0;
|
||||||
|
|
||||||
|
void parseLine(std::string& line)
|
||||||
|
{
|
||||||
|
if (parseLineCallback)
|
||||||
|
{
|
||||||
|
parseLineCallback(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t getIndentationWidth(const std::string& line) const
|
||||||
|
{
|
||||||
|
bool hasMetNonSpace = false;
|
||||||
|
|
||||||
|
uint32_t indentation = static_cast<uint32_t>(std::count_if(
|
||||||
|
line.begin(),
|
||||||
|
line.end(),
|
||||||
|
[&hasMetNonSpace](unsigned char c)
|
||||||
|
{
|
||||||
|
if (hasMetNonSpace)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (std::isspace(c))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
hasMetNonSpace = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
));
|
||||||
|
|
||||||
|
return indentation;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<BlockParser> getBlockParserForLine(const std::string& line)
|
||||||
|
{
|
||||||
|
if (getBlockParserForLineCallback)
|
||||||
|
{
|
||||||
|
return getBlockParserForLineCallback(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::function<void(std::string&)> parseLineCallback;
|
||||||
|
std::function<std::shared_ptr<BlockParser>(const std::string& line)>
|
||||||
|
getBlockParserForLineCallback;
|
||||||
|
}; // class BlockParser
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
} // namespace maddy
|
||||||
50
maddy/breaklineparser.h
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* This project is licensed under the MIT license. For more information see the
|
||||||
|
* LICENSE file.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include <regex>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "maddy/lineparser.h"
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace maddy {
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BreakLineParser
|
||||||
|
*
|
||||||
|
* @class
|
||||||
|
*/
|
||||||
|
class BreakLineParser : public LineParser
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Parse
|
||||||
|
*
|
||||||
|
* From Markdown: `text\r\n text`
|
||||||
|
*
|
||||||
|
* To HTML: `text<br> text`
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @param {std::string&} line The line to interpret
|
||||||
|
* @return {void}
|
||||||
|
*/
|
||||||
|
void Parse(std::string& line) override
|
||||||
|
{
|
||||||
|
static std::regex re(R"((\r\n|\r))");
|
||||||
|
static std::string replacement = "<br>";
|
||||||
|
|
||||||
|
line = std::regex_replace(line, re, replacement);
|
||||||
|
}
|
||||||
|
}; // class BreakLineParser
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
} // namespace maddy
|
||||||
127
maddy/checklistparser.h
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
/*
|
||||||
|
* This project is licensed under the MIT license. For more information see the
|
||||||
|
* LICENSE file.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
#include <regex>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "maddy/blockparser.h"
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace maddy {
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ChecklistParser
|
||||||
|
*
|
||||||
|
* @class
|
||||||
|
*/
|
||||||
|
class ChecklistParser : public BlockParser
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* ctor
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @param {std::function<void(std::string&)>} parseLineCallback
|
||||||
|
* @param {std::function<std::shared_ptr<BlockParser>(const std::string&
|
||||||
|
* line)>} getBlockParserForLineCallback
|
||||||
|
*/
|
||||||
|
ChecklistParser(
|
||||||
|
std::function<void(std::string&)> parseLineCallback,
|
||||||
|
std::function<std::shared_ptr<BlockParser>(const std::string& line)>
|
||||||
|
getBlockParserForLineCallback
|
||||||
|
)
|
||||||
|
: BlockParser(parseLineCallback, getBlockParserForLineCallback)
|
||||||
|
, isStarted(false)
|
||||||
|
, isFinished(false)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IsStartingLine
|
||||||
|
*
|
||||||
|
* An unordered list starts with `* `.
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @param {const std::string&} line
|
||||||
|
* @return {bool}
|
||||||
|
*/
|
||||||
|
static bool IsStartingLine(const std::string& line)
|
||||||
|
{
|
||||||
|
static std::regex re(R"(^- \[[x| ]\] .*)");
|
||||||
|
return std::regex_match(line, re);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IsFinished
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @return {bool}
|
||||||
|
*/
|
||||||
|
bool IsFinished() const override { return this->isFinished; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool isInlineBlockAllowed() const override { return true; }
|
||||||
|
|
||||||
|
bool isLineParserAllowed() const override { return true; }
|
||||||
|
|
||||||
|
void parseBlock(std::string& line) override
|
||||||
|
{
|
||||||
|
bool isStartOfNewListItem = IsStartingLine(line);
|
||||||
|
uint32_t indentation = getIndentationWidth(line);
|
||||||
|
|
||||||
|
static std::regex lineRegex("^(- )");
|
||||||
|
line = std::regex_replace(line, lineRegex, "");
|
||||||
|
|
||||||
|
static std::regex emptyBoxRegex(R"(^\[ \])");
|
||||||
|
static std::string emptyBoxReplacement = "<input type=\"checkbox\"/>";
|
||||||
|
line = std::regex_replace(line, emptyBoxRegex, emptyBoxReplacement);
|
||||||
|
|
||||||
|
static std::regex boxRegex(R"(^\[x\])");
|
||||||
|
static std::string boxReplacement =
|
||||||
|
"<input type=\"checkbox\" checked=\"checked\"/>";
|
||||||
|
line = std::regex_replace(line, boxRegex, boxReplacement);
|
||||||
|
|
||||||
|
if (!this->isStarted)
|
||||||
|
{
|
||||||
|
line = "<ul class=\"checklist\"><li><label>" + line;
|
||||||
|
this->isStarted = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (indentation >= 2)
|
||||||
|
{
|
||||||
|
line = line.substr(2);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (line.empty() ||
|
||||||
|
line.find("</label></li><li><label>") != std::string::npos ||
|
||||||
|
line.find("</label></li></ul>") != std::string::npos)
|
||||||
|
{
|
||||||
|
line = "</label></li></ul>" + line;
|
||||||
|
this->isFinished = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isStartOfNewListItem)
|
||||||
|
{
|
||||||
|
line = "</label></li><li><label>" + line;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool isStarted;
|
||||||
|
bool isFinished;
|
||||||
|
}; // class ChecklistParser
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
} // namespace maddy
|
||||||
132
maddy/codeblockparser.h
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
/*
|
||||||
|
* This project is licensed under the MIT license. For more information see the
|
||||||
|
* LICENSE file.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
#include <regex>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "maddy/blockparser.h"
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace maddy {
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CodeBlockParser
|
||||||
|
*
|
||||||
|
* From Markdown: 3 times surrounded code (without space in the beginning)
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
* ```
|
||||||
|
* some code
|
||||||
|
* ```
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* To HTML:
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
* <pre><code>
|
||||||
|
* some code
|
||||||
|
* </code></pre>
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @class
|
||||||
|
*/
|
||||||
|
class CodeBlockParser : public BlockParser
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* ctor
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @param {std::function<void(std::string&)>} parseLineCallback
|
||||||
|
* @param {std::function<std::shared_ptr<BlockParser>(const std::string&
|
||||||
|
* line)>} getBlockParserForLineCallback
|
||||||
|
*/
|
||||||
|
CodeBlockParser(
|
||||||
|
std::function<void(std::string&)> parseLineCallback,
|
||||||
|
std::function<std::shared_ptr<BlockParser>(const std::string& line)>
|
||||||
|
getBlockParserForLineCallback
|
||||||
|
)
|
||||||
|
: BlockParser(parseLineCallback, getBlockParserForLineCallback)
|
||||||
|
, isStarted(false)
|
||||||
|
, isFinished(false)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IsStartingLine
|
||||||
|
*
|
||||||
|
* If the line starts with three code signs, then it is a code block.
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
* ```
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @param {const std::string&} line
|
||||||
|
* @return {bool}
|
||||||
|
*/
|
||||||
|
static bool IsStartingLine(const std::string& line)
|
||||||
|
{
|
||||||
|
static std::regex re("^(?:`){3}(.*)$");
|
||||||
|
return std::regex_match(line, re);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IsFinished
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @return {bool}
|
||||||
|
*/
|
||||||
|
bool IsFinished() const override { return this->isFinished; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool isInlineBlockAllowed() const override { return false; }
|
||||||
|
|
||||||
|
bool isLineParserAllowed() const override { return false; }
|
||||||
|
|
||||||
|
void parseBlock(std::string& line) override
|
||||||
|
{
|
||||||
|
if (line == "```")
|
||||||
|
{
|
||||||
|
if (!this->isStarted)
|
||||||
|
{
|
||||||
|
line = "<pre><code>\n";
|
||||||
|
this->isStarted = true;
|
||||||
|
this->isFinished = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
line = "</code></pre>";
|
||||||
|
this->isFinished = true;
|
||||||
|
this->isStarted = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!this->isStarted && line.substr(0, 3) == "```")
|
||||||
|
{
|
||||||
|
line = "<pre class=\"" + line.substr(3) + "\"><code>\n";
|
||||||
|
this->isStarted = true;
|
||||||
|
this->isFinished = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
line += "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool isStarted;
|
||||||
|
bool isFinished;
|
||||||
|
}; // class CodeBlockParser
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
} // namespace maddy
|
||||||
54
maddy/emphasizedparser.h
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
/*
|
||||||
|
* This project is licensed under the MIT license. For more information see the
|
||||||
|
* LICENSE file.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include <regex>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "maddy/lineparser.h"
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace maddy {
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EmphasizedParser
|
||||||
|
*
|
||||||
|
* Has to be used after the `StrongParser`.
|
||||||
|
*
|
||||||
|
* @class
|
||||||
|
*/
|
||||||
|
class EmphasizedParser : public LineParser
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Parse
|
||||||
|
*
|
||||||
|
* From Markdown: `text _text_`
|
||||||
|
*
|
||||||
|
* To HTML: `text <em>text</em>`
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @param {std::string&} line The line to interpret
|
||||||
|
* @return {void}
|
||||||
|
*/
|
||||||
|
void Parse(std::string& line) override
|
||||||
|
{
|
||||||
|
static std::regex re(
|
||||||
|
R"((?!.*`.*|.*<code>.*)_(?!.*`.*|.*<\/code>.*)([^_]*)_(?!.*`.*|.*<\/code>.*))"
|
||||||
|
);
|
||||||
|
static std::string replacement = "<em>$1</em>";
|
||||||
|
|
||||||
|
line = std::regex_replace(line, re, replacement);
|
||||||
|
}
|
||||||
|
}; // class EmphasizedParser
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
} // namespace maddy
|
||||||
134
maddy/headlineparser.h
Normal file
@@ -0,0 +1,134 @@
|
|||||||
|
/*
|
||||||
|
* This project is licensed under the MIT license. For more information see the
|
||||||
|
* LICENSE file.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
#include <regex>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "maddy/blockparser.h"
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace maddy {
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HeadlineParser
|
||||||
|
*
|
||||||
|
* From Markdown:
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
* # Headline 1
|
||||||
|
* ## Headline 2
|
||||||
|
* ### Headline 3
|
||||||
|
* #### Headline 4
|
||||||
|
* ##### Headline 5
|
||||||
|
* ###### Headline 6
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* To HTML:
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
* <h1>Headline 1</h1>
|
||||||
|
* <h2>Headline 2</h2>
|
||||||
|
* <h3>Headline 3</h3>
|
||||||
|
* <h4>Headline 4</h4>
|
||||||
|
* <h5>Headline 5</h5>
|
||||||
|
* <h6>Headline 6</h6>
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @class
|
||||||
|
*/
|
||||||
|
class HeadlineParser : public BlockParser
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* ctor
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @param {std::function<void(std::string&)>} parseLineCallback
|
||||||
|
* @param {std::function<std::shared_ptr<BlockParser>(const std::string&
|
||||||
|
* line)>} getBlockParserForLineCallback
|
||||||
|
*/
|
||||||
|
HeadlineParser(
|
||||||
|
std::function<void(std::string&)> parseLineCallback,
|
||||||
|
std::function<std::shared_ptr<BlockParser>(const std::string& line)>
|
||||||
|
getBlockParserForLineCallback,
|
||||||
|
bool isInlineParserAllowed = true
|
||||||
|
)
|
||||||
|
: BlockParser(parseLineCallback, getBlockParserForLineCallback)
|
||||||
|
, isInlineParserAllowed(isInlineParserAllowed)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IsStartingLine
|
||||||
|
*
|
||||||
|
* If the line starts with 1 - 6 `#`, then it is a headline.
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @param {const std::string&} line
|
||||||
|
* @return {bool}
|
||||||
|
*/
|
||||||
|
static bool IsStartingLine(const std::string& line)
|
||||||
|
{
|
||||||
|
static std::regex re("^(?:#){1,6} (.*)");
|
||||||
|
return std::regex_match(line, re);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IsFinished
|
||||||
|
*
|
||||||
|
* The headline is always only one line long, so this method always returns
|
||||||
|
* true.
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @return {bool}
|
||||||
|
*/
|
||||||
|
bool IsFinished() const override { return true; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool isInlineBlockAllowed() const override { return false; }
|
||||||
|
|
||||||
|
bool isLineParserAllowed() const override
|
||||||
|
{
|
||||||
|
return this->isInlineParserAllowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
void parseBlock(std::string& line) override
|
||||||
|
{
|
||||||
|
static std::vector<std::regex> hlRegex = {
|
||||||
|
std::regex("^# (.*)"),
|
||||||
|
std::regex("^(?:#){2} (.*)"),
|
||||||
|
std::regex("^(?:#){3} (.*)"),
|
||||||
|
std::regex("^(?:#){4} (.*)"),
|
||||||
|
std::regex("^(?:#){5} (.*)"),
|
||||||
|
std::regex("^(?:#){6} (.*)")
|
||||||
|
};
|
||||||
|
static std::vector<std::string> hlReplacement = {
|
||||||
|
"<h1>$1</h1>",
|
||||||
|
"<h2>$1</h2>",
|
||||||
|
"<h3>$1</h3>",
|
||||||
|
"<h4>$1</h4>",
|
||||||
|
"<h5>$1</h5>",
|
||||||
|
"<h6>$1</h6>"
|
||||||
|
};
|
||||||
|
|
||||||
|
for (uint8_t i = 0; i < 6; ++i)
|
||||||
|
{
|
||||||
|
line = std::regex_replace(line, hlRegex[i], hlReplacement[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool isInlineParserAllowed;
|
||||||
|
}; // class HeadlineParser
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
} // namespace maddy
|
||||||
94
maddy/horizontallineparser.h
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
/*
|
||||||
|
* This project is licensed under the MIT license. For more information see the
|
||||||
|
* LICENSE file.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
#include <regex>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "maddy/blockparser.h"
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace maddy {
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HorizontalLineParser
|
||||||
|
*
|
||||||
|
* From Markdown: `---`
|
||||||
|
*
|
||||||
|
* To HTML: `<hr/>`
|
||||||
|
*
|
||||||
|
* @class
|
||||||
|
*/
|
||||||
|
class HorizontalLineParser : public BlockParser
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* ctor
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @param {std::function<void(std::string&)>} parseLineCallback
|
||||||
|
* @param {std::function<std::shared_ptr<BlockParser>(const std::string&
|
||||||
|
* line)>} getBlockParserForLineCallback
|
||||||
|
*/
|
||||||
|
HorizontalLineParser(
|
||||||
|
std::function<void(std::string&)> parseLineCallback,
|
||||||
|
std::function<std::shared_ptr<BlockParser>(const std::string& line)>
|
||||||
|
getBlockParserForLineCallback
|
||||||
|
)
|
||||||
|
: BlockParser(parseLineCallback, getBlockParserForLineCallback)
|
||||||
|
, lineRegex("^---$")
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IsStartingLine
|
||||||
|
*
|
||||||
|
* If the line has exact three dashes `---`, then it is a horizontal line.
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @param {const std::string&} line
|
||||||
|
* @return {bool}
|
||||||
|
*/
|
||||||
|
static bool IsStartingLine(const std::string& line)
|
||||||
|
{
|
||||||
|
static std::regex re("^---$");
|
||||||
|
return std::regex_match(line, re);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IsFinished
|
||||||
|
*
|
||||||
|
* The horizontal line is always only one line long, so this method always
|
||||||
|
* returns true.
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @return {bool}
|
||||||
|
*/
|
||||||
|
bool IsFinished() const override { return true; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool isInlineBlockAllowed() const override { return false; }
|
||||||
|
|
||||||
|
bool isLineParserAllowed() const override { return false; }
|
||||||
|
|
||||||
|
void parseBlock(std::string& line) override
|
||||||
|
{
|
||||||
|
static std::string replacement = "<hr/>";
|
||||||
|
|
||||||
|
line = std::regex_replace(line, lineRegex, replacement);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::regex lineRegex;
|
||||||
|
}; // class HorizontalLineParser
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
} // namespace maddy
|
||||||
112
maddy/htmlparser.h
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
/*
|
||||||
|
* This project is licensed under the MIT license. For more information see the
|
||||||
|
* LICENSE file.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "maddy/blockparser.h"
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace maddy {
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HtmlParser
|
||||||
|
*
|
||||||
|
* @class
|
||||||
|
*/
|
||||||
|
class HtmlParser : public BlockParser
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* ctor
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @param {std::function<void(std::string&)>} parseLineCallback
|
||||||
|
* @param {std::function<std::shared_ptr<BlockParser>(const std::string&
|
||||||
|
* line)>} getBlockParserForLineCallback
|
||||||
|
*/
|
||||||
|
HtmlParser(
|
||||||
|
std::function<void(std::string&)> parseLineCallback,
|
||||||
|
std::function<std::shared_ptr<BlockParser>(const std::string& line)>
|
||||||
|
getBlockParserForLineCallback
|
||||||
|
)
|
||||||
|
: BlockParser(parseLineCallback, getBlockParserForLineCallback)
|
||||||
|
, isStarted(false)
|
||||||
|
, isFinished(false)
|
||||||
|
, isGreaterThanFound(false)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IsStartingLine
|
||||||
|
*
|
||||||
|
* If the line is starting with `<`, HTML is expected to follow.
|
||||||
|
* Nothing after that will be parsed, it only is copied.
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @param {const std::string&} line
|
||||||
|
* @return {bool}
|
||||||
|
*/
|
||||||
|
static bool IsStartingLine(const std::string& line) { return line[0] == '<'; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IsFinished
|
||||||
|
*
|
||||||
|
* `>` followed by an empty line will end the HTML block.
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @return {bool}
|
||||||
|
*/
|
||||||
|
bool IsFinished() const override { return this->isFinished; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool isInlineBlockAllowed() const override { return false; }
|
||||||
|
|
||||||
|
bool isLineParserAllowed() const override { return false; }
|
||||||
|
|
||||||
|
void parseBlock(std::string& line) override
|
||||||
|
{
|
||||||
|
if (!this->isStarted)
|
||||||
|
{
|
||||||
|
this->isStarted = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!line.empty() && line[line.size() - 1] == '>')
|
||||||
|
{
|
||||||
|
this->isGreaterThanFound = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (line.empty() && this->isGreaterThanFound)
|
||||||
|
{
|
||||||
|
this->isFinished = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!line.empty() && this->isGreaterThanFound)
|
||||||
|
{
|
||||||
|
this->isGreaterThanFound = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!line.empty())
|
||||||
|
{
|
||||||
|
line += " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool isStarted;
|
||||||
|
bool isFinished;
|
||||||
|
bool isGreaterThanFound;
|
||||||
|
}; // class HtmlParser
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
} // namespace maddy
|
||||||
52
maddy/imageparser.h
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* This project is licensed under the MIT license. For more information see the
|
||||||
|
* LICENSE file.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include <regex>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "maddy/lineparser.h"
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace maddy {
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ImageParser
|
||||||
|
*
|
||||||
|
* Has to be used before the `LinkParser`.
|
||||||
|
*
|
||||||
|
* @class
|
||||||
|
*/
|
||||||
|
class ImageParser : public LineParser
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Parse
|
||||||
|
*
|
||||||
|
* From Markdown: ``
|
||||||
|
*
|
||||||
|
* To HTML: `<img src="http://example.com/a.png" alt="text"/>`
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @param {std::string&} line The line to interpret
|
||||||
|
* @return {void}
|
||||||
|
*/
|
||||||
|
void Parse(std::string& line) override
|
||||||
|
{
|
||||||
|
static std::regex re(R"(\!\[([^\]]*)\]\(([^\]]*)\))");
|
||||||
|
static std::string replacement = "<img src=\"$2\" alt=\"$1\"/>";
|
||||||
|
|
||||||
|
line = std::regex_replace(line, re, replacement);
|
||||||
|
}
|
||||||
|
}; // class ImageParser
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
} // namespace maddy
|
||||||
50
maddy/inlinecodeparser.h
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* This project is licensed under the MIT license. For more information see the
|
||||||
|
* LICENSE file.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include <regex>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "maddy/lineparser.h"
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace maddy {
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* InlineCodeParser
|
||||||
|
*
|
||||||
|
* @class
|
||||||
|
*/
|
||||||
|
class InlineCodeParser : public LineParser
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Parse
|
||||||
|
*
|
||||||
|
* From Markdown: `text `some code``
|
||||||
|
*
|
||||||
|
* To HTML: `text <code>some code</code>`
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @param {std::string&} line The line to interpret
|
||||||
|
* @return {void}
|
||||||
|
*/
|
||||||
|
void Parse(std::string& line) override
|
||||||
|
{
|
||||||
|
static std::regex re("`([^`]*)`");
|
||||||
|
static std::string replacement = "<code>$1</code>";
|
||||||
|
|
||||||
|
line = std::regex_replace(line, re, replacement);
|
||||||
|
}
|
||||||
|
}; // class InlineCodeParser
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
} // namespace maddy
|
||||||
51
maddy/italicparser.h
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* This project is licensed under the MIT license. For more information see the
|
||||||
|
* LICENSE file.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include <regex>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "maddy/lineparser.h"
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace maddy {
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ItalicParser
|
||||||
|
*
|
||||||
|
* @class
|
||||||
|
*/
|
||||||
|
class ItalicParser : public LineParser
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Parse
|
||||||
|
*
|
||||||
|
* From Markdown: `text *text*`
|
||||||
|
*
|
||||||
|
* To HTML: `text <i>text</i>`
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @param {std::string&} line The line to interpret
|
||||||
|
* @return {void}
|
||||||
|
*/
|
||||||
|
void Parse(std::string& line) override
|
||||||
|
{
|
||||||
|
static std::regex re(
|
||||||
|
R"((?!.*`.*|.*<code>.*)\*(?!.*`.*|.*<\/code>.*)([^\*]*)\*(?!.*`.*|.*<\/code>.*))"
|
||||||
|
);
|
||||||
|
static std::string replacement = "<i>$1</i>";
|
||||||
|
line = std::regex_replace(line, re, replacement);
|
||||||
|
}
|
||||||
|
}; // class ItalicParser
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
} // namespace maddy
|
||||||
124
maddy/latexblockparser.h
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
/*
|
||||||
|
* This project is licensed under the MIT license. For more information see the
|
||||||
|
* LICENSE file.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
#include <regex>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "maddy/blockparser.h"
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace maddy {
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LatexBlockParser
|
||||||
|
*
|
||||||
|
* Support for https://www.mathjax.org/
|
||||||
|
* Be aware, that if you want to make MathJax work, you need also their
|
||||||
|
* JavaScript library added to your HTML code.
|
||||||
|
* maddy does not itself add that code to be more flexible in how you write your
|
||||||
|
* head and full body.
|
||||||
|
*
|
||||||
|
* From Markdown: `$$` surrounded text
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
* $$some formula
|
||||||
|
* $$
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* To HTML:
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
* $$some formula
|
||||||
|
* $$
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @class
|
||||||
|
*/
|
||||||
|
class LatexBlockParser : public BlockParser
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* ctor
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @param {std::function<void(std::string&)>} parseLineCallback
|
||||||
|
* @param {std::function<std::shared_ptr<BlockParser>(const std::string&
|
||||||
|
* line)>} getBlockParserForLineCallback
|
||||||
|
*/
|
||||||
|
LatexBlockParser(
|
||||||
|
std::function<void(std::string&)> parseLineCallback,
|
||||||
|
std::function<std::shared_ptr<BlockParser>(const std::string& line)>
|
||||||
|
getBlockParserForLineCallback
|
||||||
|
)
|
||||||
|
: BlockParser(parseLineCallback, getBlockParserForLineCallback)
|
||||||
|
, isStarted(false)
|
||||||
|
, isFinished(false)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IsStartingLine
|
||||||
|
*
|
||||||
|
* If the line starts with two dollars, then it is a latex block.
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
* $$
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @param {const std::string&} line
|
||||||
|
* @return {bool}
|
||||||
|
*/
|
||||||
|
static bool IsStartingLine(const std::string& line)
|
||||||
|
{
|
||||||
|
static std::regex re(R"(^(?:\$){2}(.*)$)");
|
||||||
|
return std::regex_match(line, re);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IsFinished
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @return {bool}
|
||||||
|
*/
|
||||||
|
bool IsFinished() const override { return this->isFinished; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool isInlineBlockAllowed() const override { return false; }
|
||||||
|
|
||||||
|
bool isLineParserAllowed() const override { return false; }
|
||||||
|
|
||||||
|
void parseBlock(std::string& line) override
|
||||||
|
{
|
||||||
|
if (!this->isStarted && line.substr(0, 2) == "$$")
|
||||||
|
{
|
||||||
|
this->isStarted = true;
|
||||||
|
this->isFinished = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this->isStarted && !this->isFinished && line.size() > 1 &&
|
||||||
|
line.substr(line.size() - 2, 2) == "$$")
|
||||||
|
{
|
||||||
|
this->isFinished = true;
|
||||||
|
this->isStarted = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
line += "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool isStarted;
|
||||||
|
bool isFinished;
|
||||||
|
}; // class LatexBlockParser
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
} // namespace maddy
|
||||||
46
maddy/lineparser.h
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* This project is licensed under the MIT license. For more information see the
|
||||||
|
* LICENSE file.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace maddy {
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LineParser
|
||||||
|
*
|
||||||
|
* @class
|
||||||
|
*/
|
||||||
|
class LineParser
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* dtor
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
*/
|
||||||
|
virtual ~LineParser() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse
|
||||||
|
*
|
||||||
|
* From Markdown to HTML
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @param {std::string&} line The line to interpret
|
||||||
|
* @return {void}
|
||||||
|
*/
|
||||||
|
virtual void Parse(std::string& line) = 0;
|
||||||
|
}; // class LineParser
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
} // namespace maddy
|
||||||
52
maddy/linkparser.h
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* This project is licensed under the MIT license. For more information see the
|
||||||
|
* LICENSE file.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include <regex>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "maddy/lineparser.h"
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace maddy {
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LinkParser
|
||||||
|
*
|
||||||
|
* Has to be used after the `ImageParser`.
|
||||||
|
*
|
||||||
|
* @class
|
||||||
|
*/
|
||||||
|
class LinkParser : public LineParser
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Parse
|
||||||
|
*
|
||||||
|
* From Markdown: `[text](http://example.com)`
|
||||||
|
*
|
||||||
|
* To HTML: `<a href="http://example.com">text</a>`
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @param {std::string&} line The line to interpret
|
||||||
|
* @return {void}
|
||||||
|
*/
|
||||||
|
void Parse(std::string& line) override
|
||||||
|
{
|
||||||
|
static std::regex re(R"(\[([^\]]*)\]\(([^\]]*)\))");
|
||||||
|
static std::string replacement = "<a href=\"$2\">$1</a>";
|
||||||
|
|
||||||
|
line = std::regex_replace(line, re, replacement);
|
||||||
|
}
|
||||||
|
}; // class LinkParser
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
} // namespace maddy
|
||||||
126
maddy/orderedlistparser.h
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
/*
|
||||||
|
* This project is licensed under the MIT license. For more information see the
|
||||||
|
* LICENSE file.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
#include <regex>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "maddy/blockparser.h"
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace maddy {
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OrderedListParser
|
||||||
|
*
|
||||||
|
* @class
|
||||||
|
*/
|
||||||
|
class OrderedListParser : public BlockParser
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* ctor
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @param {std::function<void(std::string&)>} parseLineCallback
|
||||||
|
* @param {std::function<std::shared_ptr<BlockParser>(const std::string&
|
||||||
|
* line)>} getBlockParserForLineCallback
|
||||||
|
*/
|
||||||
|
OrderedListParser(
|
||||||
|
std::function<void(std::string&)> parseLineCallback,
|
||||||
|
std::function<std::shared_ptr<BlockParser>(const std::string& line)>
|
||||||
|
getBlockParserForLineCallback
|
||||||
|
)
|
||||||
|
: BlockParser(parseLineCallback, getBlockParserForLineCallback)
|
||||||
|
, isStarted(false)
|
||||||
|
, isFinished(false)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IsStartingLine
|
||||||
|
*
|
||||||
|
* An ordered list starts with `1. `.
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @param {const std::string&} line
|
||||||
|
* @return {bool}
|
||||||
|
*/
|
||||||
|
static bool IsStartingLine(const std::string& line)
|
||||||
|
{
|
||||||
|
static std::regex re("^1\\. .*");
|
||||||
|
return std::regex_match(line, re);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IsFinished
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @return {bool}
|
||||||
|
*/
|
||||||
|
bool IsFinished() const override { return this->isFinished; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool isInlineBlockAllowed() const override { return true; }
|
||||||
|
|
||||||
|
bool isLineParserAllowed() const override { return true; }
|
||||||
|
|
||||||
|
void parseBlock(std::string& line) override
|
||||||
|
{
|
||||||
|
bool isStartOfNewListItem = this->isStartOfNewListItem(line);
|
||||||
|
uint32_t indentation = getIndentationWidth(line);
|
||||||
|
|
||||||
|
static std::regex orderedlineRegex(R"(^[1-9]+[0-9]*\. )");
|
||||||
|
line = std::regex_replace(line, orderedlineRegex, "");
|
||||||
|
static std::regex unorderedlineRegex(R"(^\* )");
|
||||||
|
line = std::regex_replace(line, unorderedlineRegex, "");
|
||||||
|
|
||||||
|
if (!this->isStarted)
|
||||||
|
{
|
||||||
|
line = "<ol><li>" + line;
|
||||||
|
this->isStarted = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (indentation >= 2)
|
||||||
|
{
|
||||||
|
line = line.substr(2);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (line.empty() || line.find("</li><li>") != std::string::npos ||
|
||||||
|
line.find("</li></ol>") != std::string::npos ||
|
||||||
|
line.find("</li></ul>") != std::string::npos)
|
||||||
|
{
|
||||||
|
line = "</li></ol>" + line;
|
||||||
|
this->isFinished = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isStartOfNewListItem)
|
||||||
|
{
|
||||||
|
line = "</li><li>" + line;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool isStarted;
|
||||||
|
bool isFinished;
|
||||||
|
|
||||||
|
bool isStartOfNewListItem(const std::string& line) const
|
||||||
|
{
|
||||||
|
static std::regex re(R"(^(?:[1-9]+[0-9]*\. |\* ).*)");
|
||||||
|
return std::regex_match(line, re);
|
||||||
|
}
|
||||||
|
}; // class OrderedListParser
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
} // namespace maddy
|
||||||
115
maddy/paragraphparser.h
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
/*
|
||||||
|
* This project is licensed under the MIT license. For more information see the
|
||||||
|
* LICENSE file.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "maddy/blockparser.h"
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace maddy {
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ParagraphParser
|
||||||
|
*
|
||||||
|
* @class
|
||||||
|
*/
|
||||||
|
class ParagraphParser : public BlockParser
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* ctor
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @param {std::function<void(std::string&)>} parseLineCallback
|
||||||
|
* @param {std::function<std::shared_ptr<BlockParser>(const std::string&
|
||||||
|
* line)>} getBlockParserForLineCallback
|
||||||
|
*/
|
||||||
|
ParagraphParser(
|
||||||
|
std::function<void(std::string&)> parseLineCallback,
|
||||||
|
std::function<std::shared_ptr<BlockParser>(const std::string& line)>
|
||||||
|
getBlockParserForLineCallback,
|
||||||
|
bool isEnabled
|
||||||
|
)
|
||||||
|
: BlockParser(parseLineCallback, getBlockParserForLineCallback)
|
||||||
|
, isStarted(false)
|
||||||
|
, isFinished(false)
|
||||||
|
, isEnabled(isEnabled)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IsStartingLine
|
||||||
|
*
|
||||||
|
* If the line is not empty, it will be a paragraph.
|
||||||
|
*
|
||||||
|
* This block parser has to always run as the last one!
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @param {const std::string&} line
|
||||||
|
* @return {bool}
|
||||||
|
*/
|
||||||
|
static bool IsStartingLine(const std::string& line) { return !line.empty(); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IsFinished
|
||||||
|
*
|
||||||
|
* An empty line will end the paragraph.
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @return {bool}
|
||||||
|
*/
|
||||||
|
bool IsFinished() const override { return this->isFinished; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool isInlineBlockAllowed() const override { return false; }
|
||||||
|
|
||||||
|
bool isLineParserAllowed() const override { return true; }
|
||||||
|
|
||||||
|
void parseBlock(std::string& line) override
|
||||||
|
{
|
||||||
|
if (this->isEnabled && !this->isStarted)
|
||||||
|
{
|
||||||
|
line = "<p>" + line + " ";
|
||||||
|
this->isStarted = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (!this->isEnabled && !this->isStarted)
|
||||||
|
{
|
||||||
|
line += " ";
|
||||||
|
this->isStarted = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this->isEnabled && line.empty())
|
||||||
|
{
|
||||||
|
line += "</p>";
|
||||||
|
this->isFinished = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (!this->isEnabled && line.empty())
|
||||||
|
{
|
||||||
|
line += "<br/>";
|
||||||
|
this->isFinished = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
line += " ";
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool isStarted;
|
||||||
|
bool isFinished;
|
||||||
|
bool isEnabled;
|
||||||
|
}; // class ParagraphParser
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
} // namespace maddy
|
||||||
412
maddy/parser.h
Normal file
@@ -0,0 +1,412 @@
|
|||||||
|
/*
|
||||||
|
* This project is licensed under the MIT license. For more information see the
|
||||||
|
* LICENSE file.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "maddy/parserconfig.h"
|
||||||
|
|
||||||
|
// BlockParser
|
||||||
|
#include "maddy/checklistparser.h"
|
||||||
|
#include "maddy/codeblockparser.h"
|
||||||
|
#include "maddy/headlineparser.h"
|
||||||
|
#include "maddy/horizontallineparser.h"
|
||||||
|
#include "maddy/htmlparser.h"
|
||||||
|
#include "maddy/latexblockparser.h"
|
||||||
|
#include "maddy/orderedlistparser.h"
|
||||||
|
#include "maddy/paragraphparser.h"
|
||||||
|
#include "maddy/quoteparser.h"
|
||||||
|
#include "maddy/tableparser.h"
|
||||||
|
#include "maddy/unorderedlistparser.h"
|
||||||
|
|
||||||
|
// LineParser
|
||||||
|
#include "maddy/breaklineparser.h"
|
||||||
|
#include "maddy/emphasizedparser.h"
|
||||||
|
#include "maddy/imageparser.h"
|
||||||
|
#include "maddy/inlinecodeparser.h"
|
||||||
|
#include "maddy/italicparser.h"
|
||||||
|
#include "maddy/linkparser.h"
|
||||||
|
#include "maddy/strikethroughparser.h"
|
||||||
|
#include "maddy/strongparser.h"
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace maddy {
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parser
|
||||||
|
*
|
||||||
|
* Transforms Markdown to HTML
|
||||||
|
*
|
||||||
|
* @class
|
||||||
|
*/
|
||||||
|
class Parser
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Version info
|
||||||
|
*
|
||||||
|
* Check https://github.com/progsource/maddy/blob/master/CHANGELOG.md
|
||||||
|
* for the changelog.
|
||||||
|
*/
|
||||||
|
static const std::string& version()
|
||||||
|
{
|
||||||
|
static const std::string v = "1.3.0";
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ctor
|
||||||
|
*
|
||||||
|
* Initializes all `LineParser`
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
*/
|
||||||
|
Parser(std::shared_ptr<ParserConfig> config = nullptr) : config(config)
|
||||||
|
{
|
||||||
|
// deprecated backward compatibility
|
||||||
|
// will be removed in 1.4.0 latest including the booleans
|
||||||
|
if (this->config && !this->config->isEmphasizedParserEnabled)
|
||||||
|
{
|
||||||
|
this->config->enabledParsers &= ~maddy::types::EMPHASIZED_PARSER;
|
||||||
|
}
|
||||||
|
if (this->config && !this->config->isHTMLWrappedInParagraph)
|
||||||
|
{
|
||||||
|
this->config->enabledParsers |= maddy::types::HTML_PARSER;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this->config ||
|
||||||
|
(this->config->enabledParsers & maddy::types::BREAKLINE_PARSER) != 0)
|
||||||
|
{
|
||||||
|
this->breakLineParser = std::make_shared<BreakLineParser>();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this->config ||
|
||||||
|
(this->config->enabledParsers & maddy::types::EMPHASIZED_PARSER) != 0)
|
||||||
|
{
|
||||||
|
this->emphasizedParser = std::make_shared<EmphasizedParser>();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this->config ||
|
||||||
|
(this->config->enabledParsers & maddy::types::IMAGE_PARSER) != 0)
|
||||||
|
{
|
||||||
|
this->imageParser = std::make_shared<ImageParser>();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this->config ||
|
||||||
|
(this->config->enabledParsers & maddy::types::INLINE_CODE_PARSER) != 0)
|
||||||
|
{
|
||||||
|
this->inlineCodeParser = std::make_shared<InlineCodeParser>();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this->config ||
|
||||||
|
(this->config->enabledParsers & maddy::types::ITALIC_PARSER) != 0)
|
||||||
|
{
|
||||||
|
this->italicParser = std::make_shared<ItalicParser>();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this->config ||
|
||||||
|
(this->config->enabledParsers & maddy::types::LINK_PARSER) != 0)
|
||||||
|
{
|
||||||
|
this->linkParser = std::make_shared<LinkParser>();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this->config || (this->config->enabledParsers &
|
||||||
|
maddy::types::STRIKETHROUGH_PARSER) != 0)
|
||||||
|
{
|
||||||
|
this->strikeThroughParser = std::make_shared<StrikeThroughParser>();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this->config ||
|
||||||
|
(this->config->enabledParsers & maddy::types::STRONG_PARSER) != 0)
|
||||||
|
{
|
||||||
|
this->strongParser = std::make_shared<StrongParser>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @param {const std::istream&} markdown
|
||||||
|
* @return {std::string} HTML
|
||||||
|
*/
|
||||||
|
std::string Parse(std::istream& markdown) const
|
||||||
|
{
|
||||||
|
std::string result = "";
|
||||||
|
std::shared_ptr<BlockParser> currentBlockParser = nullptr;
|
||||||
|
|
||||||
|
for (std::string line; std::getline(markdown, line);)
|
||||||
|
{
|
||||||
|
if (!currentBlockParser)
|
||||||
|
{
|
||||||
|
currentBlockParser = getBlockParserForLine(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentBlockParser)
|
||||||
|
{
|
||||||
|
currentBlockParser->AddLine(line);
|
||||||
|
|
||||||
|
if (currentBlockParser->IsFinished())
|
||||||
|
{
|
||||||
|
result += currentBlockParser->GetResult().str();
|
||||||
|
currentBlockParser = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// make sure, that all parsers are finished
|
||||||
|
if (currentBlockParser)
|
||||||
|
{
|
||||||
|
std::string emptyLine = "";
|
||||||
|
currentBlockParser->AddLine(emptyLine);
|
||||||
|
if (currentBlockParser->IsFinished())
|
||||||
|
{
|
||||||
|
result += currentBlockParser->GetResult().str();
|
||||||
|
currentBlockParser = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::shared_ptr<ParserConfig> config;
|
||||||
|
std::shared_ptr<BreakLineParser> breakLineParser;
|
||||||
|
std::shared_ptr<EmphasizedParser> emphasizedParser;
|
||||||
|
std::shared_ptr<ImageParser> imageParser;
|
||||||
|
std::shared_ptr<InlineCodeParser> inlineCodeParser;
|
||||||
|
std::shared_ptr<ItalicParser> italicParser;
|
||||||
|
std::shared_ptr<LinkParser> linkParser;
|
||||||
|
std::shared_ptr<StrikeThroughParser> strikeThroughParser;
|
||||||
|
std::shared_ptr<StrongParser> strongParser;
|
||||||
|
|
||||||
|
// block parser have to run before
|
||||||
|
void runLineParser(std::string& line) const
|
||||||
|
{
|
||||||
|
// Attention! ImageParser has to be before LinkParser
|
||||||
|
if (this->imageParser)
|
||||||
|
{
|
||||||
|
this->imageParser->Parse(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this->linkParser)
|
||||||
|
{
|
||||||
|
this->linkParser->Parse(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Attention! StrongParser has to be before EmphasizedParser
|
||||||
|
if (this->strongParser)
|
||||||
|
{
|
||||||
|
this->strongParser->Parse(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this->emphasizedParser)
|
||||||
|
{
|
||||||
|
this->emphasizedParser->Parse(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this->strikeThroughParser)
|
||||||
|
{
|
||||||
|
this->strikeThroughParser->Parse(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this->inlineCodeParser)
|
||||||
|
{
|
||||||
|
this->inlineCodeParser->Parse(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this->italicParser)
|
||||||
|
{
|
||||||
|
this->italicParser->Parse(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this->breakLineParser)
|
||||||
|
{
|
||||||
|
this->breakLineParser->Parse(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<BlockParser> getBlockParserForLine(const std::string& line
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
std::shared_ptr<BlockParser> parser;
|
||||||
|
|
||||||
|
if ((!this->config || (this->config->enabledParsers &
|
||||||
|
maddy::types::CODE_BLOCK_PARSER) != 0) &&
|
||||||
|
maddy::CodeBlockParser::IsStartingLine(line))
|
||||||
|
{
|
||||||
|
parser = std::make_shared<maddy::CodeBlockParser>(nullptr, nullptr);
|
||||||
|
}
|
||||||
|
else if (this->config &&
|
||||||
|
(this->config->enabledParsers & maddy::types::LATEX_BLOCK_PARSER
|
||||||
|
) != 0 &&
|
||||||
|
maddy::LatexBlockParser::IsStartingLine(line))
|
||||||
|
{
|
||||||
|
parser = std::make_shared<LatexBlockParser>(nullptr, nullptr);
|
||||||
|
}
|
||||||
|
else if ((!this->config || (this->config->enabledParsers &
|
||||||
|
maddy::types::HEADLINE_PARSER) != 0) &&
|
||||||
|
maddy::HeadlineParser::IsStartingLine(line))
|
||||||
|
{
|
||||||
|
if (!this->config || this->config->isHeadlineInlineParsingEnabled)
|
||||||
|
{
|
||||||
|
parser = std::make_shared<maddy::HeadlineParser>(
|
||||||
|
[this](std::string& line) { this->runLineParser(line); },
|
||||||
|
nullptr,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
parser =
|
||||||
|
std::make_shared<maddy::HeadlineParser>(nullptr, nullptr, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ((!this->config || (this->config->enabledParsers &
|
||||||
|
maddy::types::HORIZONTAL_LINE_PARSER) != 0) &&
|
||||||
|
maddy::HorizontalLineParser::IsStartingLine(line))
|
||||||
|
{
|
||||||
|
parser = std::make_shared<maddy::HorizontalLineParser>(nullptr, nullptr);
|
||||||
|
}
|
||||||
|
else if ((!this->config || (this->config->enabledParsers &
|
||||||
|
maddy::types::QUOTE_PARSER) != 0) &&
|
||||||
|
maddy::QuoteParser::IsStartingLine(line))
|
||||||
|
{
|
||||||
|
parser = std::make_shared<maddy::QuoteParser>(
|
||||||
|
[this](std::string& line) { this->runLineParser(line); },
|
||||||
|
[this](const std::string& line)
|
||||||
|
{ return this->getBlockParserForLine(line); }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else if ((!this->config || (this->config->enabledParsers &
|
||||||
|
maddy::types::TABLE_PARSER) != 0) &&
|
||||||
|
maddy::TableParser::IsStartingLine(line))
|
||||||
|
{
|
||||||
|
parser = std::make_shared<maddy::TableParser>(
|
||||||
|
[this](std::string& line) { this->runLineParser(line); }, nullptr
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else if ((!this->config || (this->config->enabledParsers &
|
||||||
|
maddy::types::CHECKLIST_PARSER) != 0) &&
|
||||||
|
maddy::ChecklistParser::IsStartingLine(line))
|
||||||
|
{
|
||||||
|
parser = this->createChecklistParser();
|
||||||
|
}
|
||||||
|
else if ((!this->config || (this->config->enabledParsers &
|
||||||
|
maddy::types::ORDERED_LIST_PARSER) != 0) &&
|
||||||
|
maddy::OrderedListParser::IsStartingLine(line))
|
||||||
|
{
|
||||||
|
parser = this->createOrderedListParser();
|
||||||
|
}
|
||||||
|
else if ((!this->config || (this->config->enabledParsers &
|
||||||
|
maddy::types::UNORDERED_LIST_PARSER) != 0) &&
|
||||||
|
maddy::UnorderedListParser::IsStartingLine(line))
|
||||||
|
{
|
||||||
|
parser = this->createUnorderedListParser();
|
||||||
|
}
|
||||||
|
else if (this->config &&
|
||||||
|
(this->config->enabledParsers & maddy::types::HTML_PARSER) != 0 &&
|
||||||
|
maddy::HtmlParser::IsStartingLine(line))
|
||||||
|
{
|
||||||
|
parser = std::make_shared<maddy::HtmlParser>(nullptr, nullptr);
|
||||||
|
}
|
||||||
|
else if (maddy::ParagraphParser::IsStartingLine(line))
|
||||||
|
{
|
||||||
|
parser = std::make_shared<maddy::ParagraphParser>(
|
||||||
|
[this](std::string& line) { this->runLineParser(line); },
|
||||||
|
nullptr,
|
||||||
|
(!this->config ||
|
||||||
|
(this->config->enabledParsers & maddy::types::PARAGRAPH_PARSER) != 0)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return parser;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<BlockParser> createChecklistParser() const
|
||||||
|
{
|
||||||
|
return std::make_shared<maddy::ChecklistParser>(
|
||||||
|
[this](std::string& line) { this->runLineParser(line); },
|
||||||
|
[this](const std::string& line)
|
||||||
|
{
|
||||||
|
std::shared_ptr<BlockParser> parser;
|
||||||
|
|
||||||
|
if ((!this->config || (this->config->enabledParsers &
|
||||||
|
maddy::types::CHECKLIST_PARSER) != 0) &&
|
||||||
|
maddy::ChecklistParser::IsStartingLine(line))
|
||||||
|
{
|
||||||
|
parser = this->createChecklistParser();
|
||||||
|
}
|
||||||
|
|
||||||
|
return parser;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<BlockParser> createOrderedListParser() const
|
||||||
|
{
|
||||||
|
return std::make_shared<maddy::OrderedListParser>(
|
||||||
|
[this](std::string& line) { this->runLineParser(line); },
|
||||||
|
[this](const std::string& line)
|
||||||
|
{
|
||||||
|
std::shared_ptr<BlockParser> parser;
|
||||||
|
|
||||||
|
if ((!this->config || (this->config->enabledParsers &
|
||||||
|
maddy::types::ORDERED_LIST_PARSER) != 0) &&
|
||||||
|
maddy::OrderedListParser::IsStartingLine(line))
|
||||||
|
{
|
||||||
|
parser = this->createOrderedListParser();
|
||||||
|
}
|
||||||
|
else if ((!this->config || (this->config->enabledParsers &
|
||||||
|
maddy::types::UNORDERED_LIST_PARSER) != 0
|
||||||
|
) &&
|
||||||
|
maddy::UnorderedListParser::IsStartingLine(line))
|
||||||
|
{
|
||||||
|
parser = this->createUnorderedListParser();
|
||||||
|
}
|
||||||
|
|
||||||
|
return parser;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<BlockParser> createUnorderedListParser() const
|
||||||
|
{
|
||||||
|
return std::make_shared<maddy::UnorderedListParser>(
|
||||||
|
[this](std::string& line) { this->runLineParser(line); },
|
||||||
|
[this](const std::string& line)
|
||||||
|
{
|
||||||
|
std::shared_ptr<BlockParser> parser;
|
||||||
|
|
||||||
|
if ((!this->config || (this->config->enabledParsers &
|
||||||
|
maddy::types::ORDERED_LIST_PARSER) != 0) &&
|
||||||
|
maddy::OrderedListParser::IsStartingLine(line))
|
||||||
|
{
|
||||||
|
parser = this->createOrderedListParser();
|
||||||
|
}
|
||||||
|
else if ((!this->config || (this->config->enabledParsers &
|
||||||
|
maddy::types::UNORDERED_LIST_PARSER) != 0
|
||||||
|
) &&
|
||||||
|
maddy::UnorderedListParser::IsStartingLine(line))
|
||||||
|
{
|
||||||
|
parser = this->createUnorderedListParser();
|
||||||
|
}
|
||||||
|
|
||||||
|
return parser;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}; // class Parser
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
} // namespace maddy
|
||||||
97
maddy/parserconfig.h
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
/*
|
||||||
|
* This project is licensed under the MIT license. For more information see the
|
||||||
|
* LICENSE file.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace maddy {
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace types {
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
|
/**
|
||||||
|
* PARSER_TYPE
|
||||||
|
*
|
||||||
|
* Bitwise flags to turn on/off each parser
|
||||||
|
*/
|
||||||
|
enum PARSER_TYPE : uint32_t
|
||||||
|
{
|
||||||
|
NONE = 0,
|
||||||
|
|
||||||
|
BREAKLINE_PARSER = 0b1,
|
||||||
|
CHECKLIST_PARSER = 0b10,
|
||||||
|
CODE_BLOCK_PARSER = 0b100,
|
||||||
|
EMPHASIZED_PARSER = 0b1000,
|
||||||
|
HEADLINE_PARSER = 0b10000,
|
||||||
|
HORIZONTAL_LINE_PARSER = 0b100000,
|
||||||
|
HTML_PARSER = 0b1000000,
|
||||||
|
IMAGE_PARSER = 0b10000000,
|
||||||
|
INLINE_CODE_PARSER = 0b100000000,
|
||||||
|
ITALIC_PARSER = 0b1000000000,
|
||||||
|
LINK_PARSER = 0b10000000000,
|
||||||
|
ORDERED_LIST_PARSER = 0b100000000000,
|
||||||
|
PARAGRAPH_PARSER = 0b1000000000000,
|
||||||
|
QUOTE_PARSER = 0b10000000000000,
|
||||||
|
STRIKETHROUGH_PARSER = 0b100000000000000,
|
||||||
|
STRONG_PARSER = 0b1000000000000000,
|
||||||
|
TABLE_PARSER = 0b10000000000000000,
|
||||||
|
UNORDERED_LIST_PARSER = 0b100000000000000000,
|
||||||
|
LATEX_BLOCK_PARSER = 0b1000000000000000000,
|
||||||
|
|
||||||
|
DEFAULT = 0b0111111111110111111,
|
||||||
|
ALL = 0b1111111111111111111,
|
||||||
|
};
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
|
} // namespace types
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ParserConfig
|
||||||
|
*
|
||||||
|
* @class
|
||||||
|
*/
|
||||||
|
struct ParserConfig
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @deprecated will be removed in 1.4.0 latest
|
||||||
|
*
|
||||||
|
* this flag = false == `enabledParsers &= ~maddy::types::EMPHASIZED_PARSER`
|
||||||
|
*/
|
||||||
|
bool isEmphasizedParserEnabled;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated will be removed in 1.4.0 latest
|
||||||
|
*
|
||||||
|
* this flag = false == `enabledParsers |= maddy::types::HTML_PARSER`
|
||||||
|
*/
|
||||||
|
bool isHTMLWrappedInParagraph;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* en-/disable headline inline-parsing
|
||||||
|
*
|
||||||
|
* default: enabled
|
||||||
|
*/
|
||||||
|
bool isHeadlineInlineParsingEnabled;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* enabled parsers bitfield
|
||||||
|
*/
|
||||||
|
uint32_t enabledParsers;
|
||||||
|
|
||||||
|
ParserConfig()
|
||||||
|
: isEmphasizedParserEnabled(true)
|
||||||
|
, isHTMLWrappedInParagraph(true)
|
||||||
|
, isHeadlineInlineParsingEnabled(true)
|
||||||
|
, enabledParsers(maddy::types::DEFAULT)
|
||||||
|
{}
|
||||||
|
}; // class ParserConfig
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
} // namespace maddy
|
||||||
152
maddy/quoteparser.h
Normal file
@@ -0,0 +1,152 @@
|
|||||||
|
/*
|
||||||
|
* This project is licensed under the MIT license. For more information see the
|
||||||
|
* LICENSE file.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
#include <regex>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "maddy/blockparser.h"
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace maddy {
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* QuoteParser
|
||||||
|
*
|
||||||
|
* @class
|
||||||
|
*/
|
||||||
|
class QuoteParser : public BlockParser
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* ctor
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @param {std::function<void(std::string&)>} parseLineCallback
|
||||||
|
* @param {std::function<std::shared_ptr<BlockParser>(const std::string&
|
||||||
|
* line)>} getBlockParserForLineCallback
|
||||||
|
*/
|
||||||
|
QuoteParser(
|
||||||
|
std::function<void(std::string&)> parseLineCallback,
|
||||||
|
std::function<std::shared_ptr<BlockParser>(const std::string& line)>
|
||||||
|
getBlockParserForLineCallback
|
||||||
|
)
|
||||||
|
: BlockParser(parseLineCallback, getBlockParserForLineCallback)
|
||||||
|
, isStarted(false)
|
||||||
|
, isFinished(false)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IsStartingLine
|
||||||
|
*
|
||||||
|
* A quote starts with `> `.
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @param {const std::string&} line
|
||||||
|
* @return {bool}
|
||||||
|
*/
|
||||||
|
static bool IsStartingLine(const std::string& line)
|
||||||
|
{
|
||||||
|
static std::regex re(R"(^\>.*)");
|
||||||
|
return std::regex_match(line, re);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AddLine
|
||||||
|
*
|
||||||
|
* Adding a line which has to be parsed.
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @param {std::string&} line
|
||||||
|
* @return {void}
|
||||||
|
*/
|
||||||
|
void AddLine(std::string& line) override
|
||||||
|
{
|
||||||
|
if (!this->isStarted)
|
||||||
|
{
|
||||||
|
this->result << "<blockquote>";
|
||||||
|
this->isStarted = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool finish = false;
|
||||||
|
if (line.empty())
|
||||||
|
{
|
||||||
|
finish = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->parseBlock(line);
|
||||||
|
|
||||||
|
if (this->isInlineBlockAllowed() && !this->childParser)
|
||||||
|
{
|
||||||
|
this->childParser = this->getBlockParserForLine(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this->childParser)
|
||||||
|
{
|
||||||
|
this->childParser->AddLine(line);
|
||||||
|
|
||||||
|
if (this->childParser->IsFinished())
|
||||||
|
{
|
||||||
|
this->result << this->childParser->GetResult().str();
|
||||||
|
this->childParser = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this->isLineParserAllowed())
|
||||||
|
{
|
||||||
|
this->parseLine(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (finish)
|
||||||
|
{
|
||||||
|
this->result << "</blockquote>";
|
||||||
|
this->isFinished = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->result << line;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IsFinished
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @return {bool}
|
||||||
|
*/
|
||||||
|
bool IsFinished() const override { return this->isFinished; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool isInlineBlockAllowed() const override { return true; }
|
||||||
|
|
||||||
|
bool isLineParserAllowed() const override { return true; }
|
||||||
|
|
||||||
|
void parseBlock(std::string& line) override
|
||||||
|
{
|
||||||
|
static std::regex lineRegexWithSpace(R"(^\> )");
|
||||||
|
line = std::regex_replace(line, lineRegexWithSpace, "");
|
||||||
|
static std::regex lineRegexWithoutSpace(R"(^\>)");
|
||||||
|
line = std::regex_replace(line, lineRegexWithoutSpace, "");
|
||||||
|
|
||||||
|
if (!line.empty())
|
||||||
|
{
|
||||||
|
line += " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool isStarted;
|
||||||
|
bool isFinished;
|
||||||
|
}; // class QuoteParser
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
} // namespace maddy
|
||||||
52
maddy/strikethroughparser.h
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* This project is licensed under the MIT license. For more information see the
|
||||||
|
* LICENSE file.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include <regex>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "maddy/lineparser.h"
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace maddy {
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* StrikeThroughParser
|
||||||
|
*
|
||||||
|
* @class
|
||||||
|
*/
|
||||||
|
class StrikeThroughParser : public LineParser
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Parse
|
||||||
|
*
|
||||||
|
* From Markdown: `text ~~text~~`
|
||||||
|
*
|
||||||
|
* To HTML: `text <s>text</s>`
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @param {std::string&} line The line to interpret
|
||||||
|
* @return {void}
|
||||||
|
*/
|
||||||
|
void Parse(std::string& line) override
|
||||||
|
{
|
||||||
|
static std::regex re(
|
||||||
|
R"((?!.*`.*|.*<code>.*)\~\~(?!.*`.*|.*<\/code>.*)([^\~]*)\~\~(?!.*`.*|.*<\/code>.*))"
|
||||||
|
);
|
||||||
|
static std::string replacement = "<s>$1</s>";
|
||||||
|
|
||||||
|
line = std::regex_replace(line, re, replacement);
|
||||||
|
}
|
||||||
|
}; // class StrikeThroughParser
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
} // namespace maddy
|
||||||
61
maddy/strongparser.h
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* This project is licensed under the MIT license. For more information see the
|
||||||
|
* LICENSE file.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include <regex>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "maddy/lineparser.h"
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace maddy {
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* StrongParser
|
||||||
|
*
|
||||||
|
* Has to be used before the `EmphasizedParser`.
|
||||||
|
*
|
||||||
|
* @class
|
||||||
|
*/
|
||||||
|
class StrongParser : public LineParser
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Parse
|
||||||
|
*
|
||||||
|
* From Markdown: `text **text** __text__`
|
||||||
|
*
|
||||||
|
* To HTML: `text <strong>text</strong> <strong>text</strong>`
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @param {std::string&} line The line to interpret
|
||||||
|
* @return {void}
|
||||||
|
*/
|
||||||
|
void Parse(std::string& line) override
|
||||||
|
{
|
||||||
|
static std::vector<std::regex> res{
|
||||||
|
std::regex{
|
||||||
|
R"((?!.*`.*|.*<code>.*)\*\*(?!.*`.*|.*<\/code>.*)([^\*\*]*)\*\*(?!.*`.*|.*<\/code>.*))"
|
||||||
|
},
|
||||||
|
std::regex{
|
||||||
|
R"((?!.*`.*|.*<code>.*)__(?!.*`.*|.*<\/code>.*)([^__]*)__(?!.*`.*|.*<\/code>.*))"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
static std::string replacement = "<strong>$1</strong>";
|
||||||
|
for (const auto& re : res)
|
||||||
|
{
|
||||||
|
line = std::regex_replace(line, re, replacement);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}; // class StrongParser
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
} // namespace maddy
|
||||||
233
maddy/tableparser.h
Normal file
@@ -0,0 +1,233 @@
|
|||||||
|
/*
|
||||||
|
* This project is licensed under the MIT license. For more information see the
|
||||||
|
* LICENSE file.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
#include <regex>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "maddy/blockparser.h"
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace maddy {
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TableParser
|
||||||
|
*
|
||||||
|
* For more information, see the docs folder.
|
||||||
|
*
|
||||||
|
* @class
|
||||||
|
*/
|
||||||
|
class TableParser : public BlockParser
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* ctor
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @param {std::function<void(std::string&)>} parseLineCallback
|
||||||
|
* @param {std::function<std::shared_ptr<BlockParser>(const std::string&
|
||||||
|
* line)>} getBlockParserForLineCallback
|
||||||
|
*/
|
||||||
|
TableParser(
|
||||||
|
std::function<void(std::string&)> parseLineCallback,
|
||||||
|
std::function<std::shared_ptr<BlockParser>(const std::string& line)>
|
||||||
|
getBlockParserForLineCallback
|
||||||
|
)
|
||||||
|
: BlockParser(parseLineCallback, getBlockParserForLineCallback)
|
||||||
|
, isStarted(false)
|
||||||
|
, isFinished(false)
|
||||||
|
, currentBlock(0)
|
||||||
|
, currentRow(0)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IsStartingLine
|
||||||
|
*
|
||||||
|
* If the line has exact `|table>`, then it is starting the table.
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @param {const std::string&} line
|
||||||
|
* @return {bool}
|
||||||
|
*/
|
||||||
|
static bool IsStartingLine(const std::string& line)
|
||||||
|
{
|
||||||
|
static std::string matchString("|table>");
|
||||||
|
return line == matchString;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AddLine
|
||||||
|
*
|
||||||
|
* Adding a line which has to be parsed.
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @param {std::string&} line
|
||||||
|
* @return {void}
|
||||||
|
*/
|
||||||
|
void AddLine(std::string& line) override
|
||||||
|
{
|
||||||
|
if (!this->isStarted && line == "|table>")
|
||||||
|
{
|
||||||
|
this->isStarted = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this->isStarted)
|
||||||
|
{
|
||||||
|
if (line == "- | - | -")
|
||||||
|
{
|
||||||
|
++this->currentBlock;
|
||||||
|
this->currentRow = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (line == "|<table")
|
||||||
|
{
|
||||||
|
static std::string emptyLine = "";
|
||||||
|
this->parseBlock(emptyLine);
|
||||||
|
this->isFinished = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this->table.size() < this->currentBlock + 1)
|
||||||
|
{
|
||||||
|
this->table.push_back(std::vector<std::vector<std::string>>());
|
||||||
|
}
|
||||||
|
this->table[this->currentBlock].push_back(std::vector<std::string>());
|
||||||
|
|
||||||
|
std::string segment;
|
||||||
|
std::stringstream streamToSplit(line);
|
||||||
|
|
||||||
|
while (std::getline(streamToSplit, segment, '|'))
|
||||||
|
{
|
||||||
|
this->parseLine(segment);
|
||||||
|
this->table[this->currentBlock][this->currentRow].push_back(segment);
|
||||||
|
}
|
||||||
|
|
||||||
|
++this->currentRow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IsFinished
|
||||||
|
*
|
||||||
|
* A table ends with `|<table`.
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @return {bool}
|
||||||
|
*/
|
||||||
|
bool IsFinished() const override { return this->isFinished; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool isInlineBlockAllowed() const override { return false; }
|
||||||
|
|
||||||
|
bool isLineParserAllowed() const override { return true; }
|
||||||
|
|
||||||
|
void parseBlock(std::string&) override
|
||||||
|
{
|
||||||
|
result << "<table>";
|
||||||
|
|
||||||
|
bool hasHeader = false;
|
||||||
|
bool hasFooter = false;
|
||||||
|
bool isFirstBlock = true;
|
||||||
|
uint32_t currentBlockNumber = 0;
|
||||||
|
|
||||||
|
if (this->table.size() > 1)
|
||||||
|
{
|
||||||
|
hasHeader = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this->table.size() >= 3)
|
||||||
|
{
|
||||||
|
hasFooter = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const std::vector<std::vector<std::string>>& block : this->table)
|
||||||
|
{
|
||||||
|
bool isInHeader = false;
|
||||||
|
bool isInFooter = false;
|
||||||
|
++currentBlockNumber;
|
||||||
|
|
||||||
|
if (hasHeader && isFirstBlock)
|
||||||
|
{
|
||||||
|
result << "<thead>";
|
||||||
|
isInHeader = true;
|
||||||
|
}
|
||||||
|
else if (hasFooter && currentBlockNumber == this->table.size())
|
||||||
|
{
|
||||||
|
result << "<tfoot>";
|
||||||
|
isInFooter = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result << "<tbody>";
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const std::vector<std::string>& row : block)
|
||||||
|
{
|
||||||
|
result << "<tr>";
|
||||||
|
|
||||||
|
for (const std::string& column : row)
|
||||||
|
{
|
||||||
|
if (isInHeader)
|
||||||
|
{
|
||||||
|
result << "<th>";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result << "<td>";
|
||||||
|
}
|
||||||
|
|
||||||
|
result << column;
|
||||||
|
|
||||||
|
if (isInHeader)
|
||||||
|
{
|
||||||
|
result << "</th>";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result << "</td>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
result << "</tr>";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isInHeader)
|
||||||
|
{
|
||||||
|
result << "</thead>";
|
||||||
|
}
|
||||||
|
else if (isInFooter)
|
||||||
|
{
|
||||||
|
result << "</tfoot>";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result << "</tbody>";
|
||||||
|
}
|
||||||
|
|
||||||
|
isFirstBlock = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
result << "</table>";
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool isStarted;
|
||||||
|
bool isFinished;
|
||||||
|
uint32_t currentBlock;
|
||||||
|
uint32_t currentRow;
|
||||||
|
std::vector<std::vector<std::vector<std::string>>> table;
|
||||||
|
}; // class TableParser
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
} // namespace maddy
|
||||||
118
maddy/unorderedlistparser.h
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
/*
|
||||||
|
* This project is licensed under the MIT license. For more information see the
|
||||||
|
* LICENSE file.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
#include <regex>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "maddy/blockparser.h"
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace maddy {
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* UnorderedListParser
|
||||||
|
*
|
||||||
|
* @class
|
||||||
|
*/
|
||||||
|
class UnorderedListParser : public BlockParser
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* ctor
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @param {std::function<void(std::string&)>} parseLineCallback
|
||||||
|
* @param {std::function<std::shared_ptr<BlockParser>(const std::string&
|
||||||
|
* line)>} getBlockParserForLineCallback
|
||||||
|
*/
|
||||||
|
UnorderedListParser(
|
||||||
|
std::function<void(std::string&)> parseLineCallback,
|
||||||
|
std::function<std::shared_ptr<BlockParser>(const std::string& line)>
|
||||||
|
getBlockParserForLineCallback
|
||||||
|
)
|
||||||
|
: BlockParser(parseLineCallback, getBlockParserForLineCallback)
|
||||||
|
, isStarted(false)
|
||||||
|
, isFinished(false)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IsStartingLine
|
||||||
|
*
|
||||||
|
* An unordered list starts with `* `.
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @param {const std::string&} line
|
||||||
|
* @return {bool}
|
||||||
|
*/
|
||||||
|
static bool IsStartingLine(const std::string& line)
|
||||||
|
{
|
||||||
|
static std::regex re("^[+*-] .*");
|
||||||
|
return std::regex_match(line, re);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IsFinished
|
||||||
|
*
|
||||||
|
* @method
|
||||||
|
* @return {bool}
|
||||||
|
*/
|
||||||
|
bool IsFinished() const override { return this->isFinished; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool isInlineBlockAllowed() const override { return true; }
|
||||||
|
|
||||||
|
bool isLineParserAllowed() const override { return true; }
|
||||||
|
|
||||||
|
void parseBlock(std::string& line) override
|
||||||
|
{
|
||||||
|
bool isStartOfNewListItem = IsStartingLine(line);
|
||||||
|
uint32_t indentation = getIndentationWidth(line);
|
||||||
|
|
||||||
|
static std::regex lineRegex("^([+*-] )");
|
||||||
|
line = std::regex_replace(line, lineRegex, "");
|
||||||
|
|
||||||
|
if (!this->isStarted)
|
||||||
|
{
|
||||||
|
line = "<ul><li>" + line;
|
||||||
|
this->isStarted = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (indentation >= 2)
|
||||||
|
{
|
||||||
|
line = line.substr(2);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (line.empty() || line.find("</li><li>") != std::string::npos ||
|
||||||
|
line.find("</li></ol>") != std::string::npos ||
|
||||||
|
line.find("</li></ul>") != std::string::npos)
|
||||||
|
{
|
||||||
|
line = "</li></ul>" + line;
|
||||||
|
this->isFinished = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isStartOfNewListItem)
|
||||||
|
{
|
||||||
|
line = "</li><li>" + line;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool isStarted;
|
||||||
|
bool isFinished;
|
||||||
|
}; // class UnorderedListParser
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
} // namespace maddy
|
||||||
0
resources/logo.png
Executable file → Normal file
|
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB |
BIN
resources/new_file.png
Normal file
|
After Width: | Height: | Size: 442 B |
BIN
resources/new_folder.png
Normal file
|
After Width: | Height: | Size: 374 B |
|
Before Width: | Height: | Size: 885 B |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 620 B |
|
Before Width: | Height: | Size: 620 B |
|
Before Width: | Height: | Size: 963 B |
BIN
resources/settings.png
Normal file
|
After Width: | Height: | Size: 887 B |
1106
resources/style.css
Normal file
7
src/LICENSE
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
Copyright 2022 Aurélie Delhaie
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
#include "aboutdialog.h"
|
|
||||||
#include "ui_aboutdialog.h"
|
|
||||||
|
|
||||||
AboutDialog::AboutDialog(QWidget *parent) :
|
|
||||||
QDialog(parent),
|
|
||||||
ui(new Ui::AboutDialog)
|
|
||||||
{
|
|
||||||
ui->setupUi(this);
|
|
||||||
ui->appNameLabel->setText(QString("%1 (%2)").arg(APP_NAME, APP_ARCH));
|
|
||||||
ui->versionLabel->setText(QString("Version %1").arg(APP_VERSION));
|
|
||||||
}
|
|
||||||
|
|
||||||
AboutDialog::~AboutDialog()
|
|
||||||
{
|
|
||||||
delete ui;
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
#ifndef ABOUTDIALOG_H
|
|
||||||
#define ABOUTDIALOG_H
|
|
||||||
|
|
||||||
#include <QDialog>
|
|
||||||
#include <QSysInfo>
|
|
||||||
|
|
||||||
namespace Ui {
|
|
||||||
class AboutDialog;
|
|
||||||
}
|
|
||||||
|
|
||||||
class AboutDialog : public QDialog
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit AboutDialog(QWidget *parent = nullptr);
|
|
||||||
~AboutDialog();
|
|
||||||
|
|
||||||
private:
|
|
||||||
Ui::AboutDialog *ui;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // ABOUTDIALOG_H
|
|
||||||
@@ -1,100 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>AboutDialog</class>
|
|
||||||
<widget class="QDialog" name="AboutDialog">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>334</width>
|
|
||||||
<height>180</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>334</width>
|
|
||||||
<height>180</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>334</width>
|
|
||||||
<height>180</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>About TaskNote</string>
|
|
||||||
</property>
|
|
||||||
<property name="modal">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>64</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>16777215</width>
|
|
||||||
<height>64</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">image: url(:/logo/resources/logo.png);</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="appNameLabel">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<pointsize>14</pointsize>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>TaskNote</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="versionLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Version 1.2.0.0</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_4">
|
|
||||||
<property name="text">
|
|
||||||
<string>Author: Aurélie Delhaie (aureliedelhaie.fr)</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<resources/>
|
|
||||||
<connections/>
|
|
||||||
</ui>
|
|
||||||
45
src/frames/configdialog.cpp
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
#include "configdialog.h"
|
||||||
|
#include "ui_configdialog.h"
|
||||||
|
|
||||||
|
ConfigDialog::ConfigDialog(AppConfiguration *cfg, QWidget *parent) :
|
||||||
|
QDialog(parent),
|
||||||
|
ui(new Ui::ConfigDialog)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
ui->appNameLabel->setText(QString("%1 (%2)").arg(APP_NAME, APP_ARCH));
|
||||||
|
ui->versionLabel->setText(QString("Version %1").arg(APP_VERSION));
|
||||||
|
|
||||||
|
this->cfg = cfg;
|
||||||
|
applyCfg();
|
||||||
|
|
||||||
|
connect(ui->autoSaveEnableCheckbox, &QCheckBox::stateChanged, this, &ConfigDialog::autoSaveEnableChange);
|
||||||
|
connect(ui->autoSaveDelaySpinbox, &QSpinBox::valueChanged, this, &ConfigDialog::autoSaveDelayChange);
|
||||||
|
}
|
||||||
|
|
||||||
|
ConfigDialog::~ConfigDialog()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConfigDialog::autoSaveEnableChange(int state)
|
||||||
|
{
|
||||||
|
if (state == Qt::CheckState::Checked)
|
||||||
|
{
|
||||||
|
cfg->setEnableAutoSave(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cfg->setEnableAutoSave(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConfigDialog::autoSaveDelayChange(int value)
|
||||||
|
{
|
||||||
|
cfg->setAutoSaveDelay(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConfigDialog::applyCfg()
|
||||||
|
{
|
||||||
|
ui->autoSaveEnableCheckbox->setCheckState(cfg->isEnableAutoSave() ? Qt::CheckState::Checked : Qt::CheckState::Unchecked);
|
||||||
|
ui->autoSaveDelaySpinbox->setValue(cfg->getAutoSaveDelay());
|
||||||
|
}
|
||||||
31
src/frames/configdialog.h
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
#ifndef CONFIGDIALOG_H
|
||||||
|
#define CONFIGDIALOG_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
#include "../models/appconfiguration.h"
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class ConfigDialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
class ConfigDialog : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit ConfigDialog(AppConfiguration *cfg, QWidget *parent = nullptr);
|
||||||
|
~ConfigDialog();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void autoSaveEnableChange(int);
|
||||||
|
void autoSaveDelayChange(int);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::ConfigDialog *ui;
|
||||||
|
AppConfiguration *cfg;
|
||||||
|
|
||||||
|
void applyCfg();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CONFIGDIALOG_H
|
||||||
296
src/frames/configdialog.ui
Normal file
@@ -0,0 +1,296 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>ConfigDialog</class>
|
||||||
|
<widget class="QDialog" name="ConfigDialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>400</width>
|
||||||
|
<height>612</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>400</width>
|
||||||
|
<height>612</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>400</width>
|
||||||
|
<height>612</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Configuration</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>10</y>
|
||||||
|
<width>381</width>
|
||||||
|
<height>561</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="tab">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>General</string>
|
||||||
|
</attribute>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>20</y>
|
||||||
|
<width>361</width>
|
||||||
|
<height>17</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Auto save</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>50</y>
|
||||||
|
<width>51</width>
|
||||||
|
<height>17</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Enable</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QCheckBox" name="autoSaveEnableCheckbox">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>360</x>
|
||||||
|
<y>45</y>
|
||||||
|
<width>31</width>
|
||||||
|
<height>23</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="Line" name="line">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>56</x>
|
||||||
|
<y>56</y>
|
||||||
|
<width>231</width>
|
||||||
|
<height>16</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="label_6">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>81</y>
|
||||||
|
<width>71</width>
|
||||||
|
<height>17</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Delay (ms.)</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="Line" name="line_2">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>76</x>
|
||||||
|
<y>84</y>
|
||||||
|
<width>211</width>
|
||||||
|
<height>20</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QSpinBox" name="autoSaveDelaySpinbox">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>291</x>
|
||||||
|
<y>71</y>
|
||||||
|
<width>81</width>
|
||||||
|
<height>26</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>500</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>900000000</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>1000</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="tab_2">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>About</string>
|
||||||
|
</attribute>
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>7</x>
|
||||||
|
<y>321</y>
|
||||||
|
<width>314</width>
|
||||||
|
<height>26</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Author: Aurélie Delhaie (github.com/mojitaurelie)</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="versionLabel">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>7</x>
|
||||||
|
<y>290</y>
|
||||||
|
<width>314</width>
|
||||||
|
<height>26</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Version 1.2.0.0</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="appNameLabel">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>3</x>
|
||||||
|
<y>229</y>
|
||||||
|
<width>371</width>
|
||||||
|
<height>41</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>20</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>WorkPad</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignmentFlag::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>8</x>
|
||||||
|
<y>10</y>
|
||||||
|
<width>360</width>
|
||||||
|
<height>201</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">image: url(:/logo/resources/logo.png);</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignmentFlag::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>7</x>
|
||||||
|
<y>353</y>
|
||||||
|
<width>314</width>
|
||||||
|
<height>26</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string><html><head/><body><p>Under MIT license</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPlainTextEdit" name="plainTextEdit">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>9</x>
|
||||||
|
<y>380</y>
|
||||||
|
<width>361</width>
|
||||||
|
<height>141</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="plainText">
|
||||||
|
<string>Copyright 2025 Aurélie Delhaie
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>225</x>
|
||||||
|
<y>578</y>
|
||||||
|
<width>166</width>
|
||||||
|
<height>25</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::StandardButton::Ok</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>accepted()</signal>
|
||||||
|
<receiver>ConfigDialog</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>307</x>
|
||||||
|
<y>590</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>199</x>
|
||||||
|
<y>305</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
||||||
19
src/frames/createdialog.cpp
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
#include "createdialog.h"
|
||||||
|
#include "ui_createdialog.h"
|
||||||
|
|
||||||
|
CreateDialog::CreateDialog(QWidget *parent) :
|
||||||
|
QDialog(parent),
|
||||||
|
ui(new Ui::CreateDialog)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
CreateDialog::~CreateDialog()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CreateDialog::getTitle()
|
||||||
|
{
|
||||||
|
return ui->lineEdit->text();
|
||||||
|
}
|
||||||
23
src/frames/createdialog.h
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
#ifndef CREATEDIALOG_H
|
||||||
|
#define CREATEDIALOG_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class CreateDialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
class CreateDialog : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit CreateDialog(QWidget *parent = nullptr);
|
||||||
|
~CreateDialog();
|
||||||
|
QString getTitle();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::CreateDialog *ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CREATEDIALOG_H
|
||||||
111
src/frames/createdialog.ui
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CreateDialog</class>
|
||||||
|
<widget class="QDialog" name="CreateDialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>400</width>
|
||||||
|
<height>139</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>400</width>
|
||||||
|
<height>139</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>400</width>
|
||||||
|
<height>139</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Create</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>100</y>
|
||||||
|
<width>381</width>
|
||||||
|
<height>32</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>10</y>
|
||||||
|
<width>141</width>
|
||||||
|
<height>41</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>24</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Create</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLineEdit" name="lineEdit">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>60</y>
|
||||||
|
<width>381</width>
|
||||||
|
<height>25</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>Title</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>accepted()</signal>
|
||||||
|
<receiver>CreateDialog</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>248</x>
|
||||||
|
<y>254</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>157</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>rejected()</signal>
|
||||||
|
<receiver>CreateDialog</receiver>
|
||||||
|
<slot>reject()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>316</x>
|
||||||
|
<y>260</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>286</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
||||||
27
src/frames/exportdialog.cpp
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
#include "exportdialog.h"
|
||||||
|
#include "ui_exportdialog.h"
|
||||||
|
|
||||||
|
ExportDialog::ExportDialog(QWidget *parent) :
|
||||||
|
QDialog(parent),
|
||||||
|
ui(new Ui::ExportDialog)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
ExportDialog::~ExportDialog()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ExportDialog::getResult()
|
||||||
|
{
|
||||||
|
if (ui->markdownButton->isChecked())
|
||||||
|
{
|
||||||
|
return MARKDOWN;
|
||||||
|
}
|
||||||
|
else if (ui->pdfRadio->isChecked())
|
||||||
|
{
|
||||||
|
return PDF;
|
||||||
|
}
|
||||||
|
return PLAIN;
|
||||||
|
}
|
||||||
27
src/frames/exportdialog.h
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
#ifndef EXPORTDIALOG_H
|
||||||
|
#define EXPORTDIALOG_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
#define MARKDOWN 1
|
||||||
|
#define PLAIN 2
|
||||||
|
#define PDF 3
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class ExportDialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
class ExportDialog : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit ExportDialog(QWidget *parent = nullptr);
|
||||||
|
~ExportDialog();
|
||||||
|
int getResult();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::ExportDialog *ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // EXPORTDIALOG_H
|
||||||
122
src/frames/exportdialog.ui
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>ExportDialog</class>
|
||||||
|
<widget class="QDialog" name="ExportDialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>223</width>
|
||||||
|
<height>138</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>223</width>
|
||||||
|
<height>138</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>223</width>
|
||||||
|
<height>138</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Export</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>100</y>
|
||||||
|
<width>211</width>
|
||||||
|
<height>32</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QRadioButton" name="markdownButton">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>30</x>
|
||||||
|
<y>20</y>
|
||||||
|
<width>171</width>
|
||||||
|
<height>23</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Markdown file</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QRadioButton" name="plainTextRadio">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>30</x>
|
||||||
|
<y>40</y>
|
||||||
|
<width>92</width>
|
||||||
|
<height>23</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Text file</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QRadioButton" name="pdfRadio">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>30</x>
|
||||||
|
<y>60</y>
|
||||||
|
<width>92</width>
|
||||||
|
<height>23</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>PDF file</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>accepted()</signal>
|
||||||
|
<receiver>ExportDialog</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>248</x>
|
||||||
|
<y>254</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>157</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>rejected()</signal>
|
||||||
|
<receiver>ExportDialog</receiver>
|
||||||
|
<slot>reject()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>316</x>
|
||||||
|
<y>260</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>286</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
||||||
510
src/frames/mainwindow.cpp
Executable file → Normal file
@@ -1,28 +1,77 @@
|
|||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "ui_mainwindow.h"
|
#include "ui_mainwindow.h"
|
||||||
|
|
||||||
|
#include "configdialog.h"
|
||||||
|
#include "createdialog.h"
|
||||||
|
#include "movedialog.h"
|
||||||
|
#include "renamedialog.h"
|
||||||
|
#include "exportdialog.h"
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent)
|
MainWindow::MainWindow(QWidget *parent)
|
||||||
: QMainWindow(parent)
|
: QMainWindow(parent)
|
||||||
, ui(new Ui::MainWindow)
|
, ui(new Ui::MainWindow)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
timer = new QTimer(this);
|
timer = new QTimer(this);
|
||||||
|
parser = std::make_shared<maddy::Parser>();
|
||||||
|
|
||||||
|
// open stylesheet resource
|
||||||
|
QFile f(":/css/resources/style.css");
|
||||||
|
f.open(QFile::OpenModeFlag::ReadOnly);
|
||||||
|
style = f.readAll();
|
||||||
|
f.close();
|
||||||
|
|
||||||
|
connect(ui->actionAdd_folder, &QAction::triggered, this, &MainWindow::createFolder);
|
||||||
connect(ui->actionAdd, &QAction::triggered, this, &MainWindow::createNote);
|
connect(ui->actionAdd, &QAction::triggered, this, &MainWindow::createNote);
|
||||||
connect(ui->actionRemove, &QAction::triggered, this, &MainWindow::removeSelected);
|
|
||||||
connect(ui->actionSave, &QAction::triggered, this, &MainWindow::save);
|
connect(ui->actionSave, &QAction::triggered, this, &MainWindow::save);
|
||||||
connect(ui->actionAbout, &QAction::triggered, this, &MainWindow::showAboutBox);
|
connect(ui->actionSettings, &QAction::triggered, this, &MainWindow::showSettingsBox);
|
||||||
connect(ui->noteList, &QListWidget::currentRowChanged, this, &MainWindow::selectionChanged);
|
connect(ui->plainTextEdit, &QPlainTextEdit::textChanged, this, &MainWindow::plainContentChanged);
|
||||||
connect(ui->titleEdit, &QLineEdit::textChanged, this, &MainWindow::titleChanged);
|
connect(ui->treeWidget, &QTreeWidget::itemSelectionChanged, this, &MainWindow::selectionChanged);
|
||||||
connect(ui->contentEdit, &QPlainTextEdit::textChanged, this, &MainWindow::contentChanged);
|
connect(ui->treeWidget, &QTreeWidget::customContextMenuRequested, this, &MainWindow::prepareMenu);
|
||||||
|
connect(this, &MainWindow::updateViewers, this, &MainWindow::viewReady);
|
||||||
const QFont fixedFont = QFontDatabase::systemFont(QFontDatabase::FixedFont);
|
const QFont fixedFont = QFontDatabase::systemFont(QFontDatabase::FixedFont);
|
||||||
ui->contentEdit->setFont(fixedFont);
|
ui->plainTextEdit->setFont(fixedFont);
|
||||||
|
ui->treeWidget->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
|
ui->renderingProgressBar->setVisible(false);
|
||||||
this->savemng = new SaveManager();
|
this->savemng = new SaveManager();
|
||||||
|
this->cfgmng = new ConfigManager();
|
||||||
updateListView();
|
updateListView();
|
||||||
connect(timer, &QTimer::timeout, this, &MainWindow::save);
|
connect(timer, &QTimer::timeout, this, &MainWindow::save);
|
||||||
|
|
||||||
|
// start render thread
|
||||||
|
threaddone = new bool(false);
|
||||||
|
queue = new QVector<QString>;
|
||||||
|
queueMutex = new QMutex();
|
||||||
|
updateViewThread = new std::thread([this](){
|
||||||
|
while (!*threaddone) {
|
||||||
|
queueMutex->lock();
|
||||||
|
if (queue->count() == 0) {
|
||||||
|
queueMutex->unlock();
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
QString content = (*queue)[0];
|
||||||
|
queue->pop_front();
|
||||||
|
queueMutex->unlock();
|
||||||
|
std::stringstream markdownInput(content.toStdString());
|
||||||
|
QString htmlOutput = "<html><body class='markdown-body'>";
|
||||||
|
htmlOutput += QString::fromStdString(parser->Parse(markdownInput));
|
||||||
|
htmlOutput += "</body><style>" + style + "</style></html>";
|
||||||
|
emit updateViewers(htmlOutput);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
{
|
{
|
||||||
|
*threaddone = true;
|
||||||
|
updateViewThread->join();
|
||||||
|
delete queue;
|
||||||
|
delete queueMutex;
|
||||||
|
delete threaddone;
|
||||||
|
delete updateViewThread;
|
||||||
delete timer;
|
delete timer;
|
||||||
delete savemng;
|
delete savemng;
|
||||||
delete ui;
|
delete ui;
|
||||||
@@ -30,120 +79,427 @@ MainWindow::~MainWindow()
|
|||||||
|
|
||||||
void MainWindow::createNote()
|
void MainWindow::createNote()
|
||||||
{
|
{
|
||||||
Note *n = new Note();
|
if (ui->treeWidget->selectedItems().length() == 1)
|
||||||
n->setTitle("untitled note");
|
|
||||||
savemng->addNote(n);
|
|
||||||
updateListView();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::selectionChanged(int i)
|
|
||||||
{
|
|
||||||
this->currentIndex = i;
|
|
||||||
if (i == -1)
|
|
||||||
{
|
{
|
||||||
clearAndDisableFields();
|
CreateDialog dialog(this);
|
||||||
|
if (dialog.exec() != QDialog::Accepted) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Note *n = this->savemng->getNoteByIndex(i);
|
QString title = dialog.getTitle();
|
||||||
|
QString uuidFolder = "";
|
||||||
|
auto item = ui->treeWidget->selectedItems()[0];
|
||||||
|
if (item->text(COLUMN_TYPE) == TYPE_NOTE)
|
||||||
|
{
|
||||||
|
uuidFolder = item->parent()->text(COLUMN_UUID);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
uuidFolder = item->text(COLUMN_UUID);
|
||||||
|
}
|
||||||
|
Note *n = savemng->newNote(uuidFolder, title);
|
||||||
|
updateListView();
|
||||||
|
selectTreeItem(n->getUUID());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::createFolder()
|
||||||
|
{
|
||||||
|
CreateDialog dialog;
|
||||||
|
if (dialog.exec() != QDialog::Accepted) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QString title = dialog.getTitle();
|
||||||
|
Folder *f = savemng->newFolder(title);
|
||||||
|
updateListView();
|
||||||
|
selectTreeItem(f->getUUID());
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::selectionChanged()
|
||||||
|
{
|
||||||
|
if (ui->treeWidget->selectedItems().length() == 1)
|
||||||
|
{
|
||||||
|
auto item = ui->treeWidget->selectedItems()[0];
|
||||||
|
ui->actionAdd->setDisabled(false);
|
||||||
|
if (item->text(COLUMN_TYPE) == TYPE_NOTE)
|
||||||
|
{
|
||||||
|
Note *n = savemng->getNoteByUUID(item->text(COLUMN_UUID));
|
||||||
if (n == nullptr)
|
if (n == nullptr)
|
||||||
{
|
{
|
||||||
QMessageBox::critical(this, tr("TaskNote"), "Failed to get this note, the memory pointer is empty", QMessageBox::Ok, QMessageBox::Ok);
|
QMessageBox::critical(this, tr("WorkPad"), "Failed to get this note, the memory pointer is empty", QMessageBox::Ok, QMessageBox::Ok);
|
||||||
clearAndDisableFields();
|
clearAndDisableFields();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
ui->plainTextEdit->blockSignals(true);
|
||||||
|
|
||||||
ui->contentEdit->blockSignals(true);
|
this->setWindowTitle(n->getTitle() + " - WorkPad");
|
||||||
ui->titleEdit->blockSignals(true);
|
|
||||||
|
|
||||||
ui->titleEdit->setDisabled(false);
|
ui->plainTextEdit->setDisabled(false);
|
||||||
ui->contentEdit->setDisabled(false);
|
ui->plainTextEdit->setPlainText(n->getContent());
|
||||||
ui->actionRemove->setDisabled(false);
|
updateHTMLView();
|
||||||
ui->titleEdit->setText(n->getTitle());
|
|
||||||
ui->contentEdit->setPlainText(n->getContent());
|
|
||||||
ui->markdownViewer->setMarkdown(ui->contentEdit->toPlainText());
|
|
||||||
|
|
||||||
ui->contentEdit->blockSignals(false);
|
ui->plainTextEdit->blockSignals(false);
|
||||||
ui->titleEdit->blockSignals(false);
|
}
|
||||||
}
|
else
|
||||||
|
|
||||||
void MainWindow::removeSelected()
|
|
||||||
{
|
|
||||||
if (this->currentIndex > -1)
|
|
||||||
{
|
{
|
||||||
this->savemng->removeNoteByIndex(this->currentIndex);
|
|
||||||
clearAndDisableFields();
|
clearAndDisableFields();
|
||||||
updateListView();
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
clearAndDisableFields();
|
||||||
|
ui->actionAdd->setDisabled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::save()
|
void MainWindow::save()
|
||||||
{
|
{
|
||||||
ui->actionSave->setDisabled(true);
|
ui->actionSave->setDisabled(true);
|
||||||
if (this->currentIndex > -1)
|
|
||||||
{
|
|
||||||
Note *n = this->savemng->getNoteByIndex(this->currentIndex);
|
|
||||||
n->setTitle(ui->titleEdit->text());
|
|
||||||
n->setContent(ui->contentEdit->toPlainText());
|
|
||||||
}
|
|
||||||
this->savemng->flushSave();
|
this->savemng->flushSave();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::titleChanged()
|
void MainWindow::showSettingsBox()
|
||||||
{
|
{
|
||||||
timer->stop();
|
ConfigDialog dialog(cfgmng->getConfiguration(), this);
|
||||||
if (this->currentIndex > -1)
|
|
||||||
{
|
|
||||||
Note *n = this->savemng->getNoteByIndex(this->currentIndex);
|
|
||||||
n->setTitle(ui->titleEdit->text());
|
|
||||||
ui->noteList->item(this->currentIndex)->setText(ui->titleEdit->text());
|
|
||||||
}
|
|
||||||
ui->actionSave->setDisabled(false);
|
|
||||||
timer->start(1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::showAboutBox()
|
|
||||||
{
|
|
||||||
AboutDialog dialog;
|
|
||||||
dialog.setModal(true);
|
dialog.setModal(true);
|
||||||
dialog.exec();
|
dialog.exec();
|
||||||
|
cfgmng->writeToDisk();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::contentChanged()
|
void MainWindow::prepareMenu(const QPoint &pos)
|
||||||
|
{
|
||||||
|
if (ui->treeWidget->selectedItems().length() == 1) {
|
||||||
|
QTreeWidgetItem *item = ui->treeWidget->selectedItems()[0];
|
||||||
|
|
||||||
|
QMenu menu(this);
|
||||||
|
QAction *deleteAction = new QAction(tr("Delete"), this);
|
||||||
|
connect(deleteAction, &QAction::triggered, this, &MainWindow::deleteItem);
|
||||||
|
menu.addAction(deleteAction);
|
||||||
|
QAction *renameAction = new QAction(tr("Rename"), this);
|
||||||
|
connect(renameAction, &QAction::triggered, this, &MainWindow::editName);
|
||||||
|
menu.addAction(renameAction);
|
||||||
|
if (item->text(COLUMN_TYPE) == TYPE_NOTE)
|
||||||
|
{
|
||||||
|
QAction *moveAction = new QAction(tr("Move to..."), this);
|
||||||
|
connect(moveAction, &QAction::triggered, this, &MainWindow::moveNote);
|
||||||
|
menu.addAction(moveAction);
|
||||||
|
QAction *exportAction = new QAction(tr("Export"), this);
|
||||||
|
connect(exportAction, &QAction::triggered, this, &MainWindow::exportNote);
|
||||||
|
menu.addAction(exportAction);
|
||||||
|
}
|
||||||
|
menu.exec(ui->treeWidget->mapToGlobal(pos));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::deleteItem()
|
||||||
|
{
|
||||||
|
if (ui->treeWidget->selectedItems().length() == 1) {
|
||||||
|
QTreeWidgetItem *item = ui->treeWidget->selectedItems()[0];
|
||||||
|
QString uuid = item->text(COLUMN_UUID);
|
||||||
|
QMessageBox::StandardButton res = QMessageBox::question(this, tr("Remove"), QString("Do you want to remove '%1'?").arg(item->text(COLUMN_NAME)));
|
||||||
|
if (res == QMessageBox::Yes)
|
||||||
|
{
|
||||||
|
if (item->text(COLUMN_TYPE) == TYPE_NOTE)
|
||||||
|
{
|
||||||
|
QString uuidFolder = item->parent()->text(COLUMN_UUID);
|
||||||
|
Note *n = savemng->getNoteByUUID(uuid);
|
||||||
|
if (n == nullptr)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!savemng->removeNote(uuidFolder, uuid))
|
||||||
|
{
|
||||||
|
QMessageBox::critical(this, tr("WorkPad"), "Failed to remove this note", QMessageBox::Ok, QMessageBox::Ok);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
delete n;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Folder *f = savemng->getFolderByUUID(uuid);
|
||||||
|
if (f == nullptr)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!savemng->removeFolder(uuid))
|
||||||
|
{
|
||||||
|
QMessageBox::critical(this, tr("WorkPad"), "Failed to remove this folder", QMessageBox::Ok, QMessageBox::Ok);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
delete f;
|
||||||
|
}
|
||||||
|
savemng->flushSave();
|
||||||
|
updateListView();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::moveNote()
|
||||||
|
{
|
||||||
|
if (ui->treeWidget->selectedItems().length() == 1) {
|
||||||
|
QTreeWidgetItem *item = ui->treeWidget->selectedItems()[0];
|
||||||
|
if (item->text(COLUMN_TYPE) == TYPE_NOTE)
|
||||||
|
{
|
||||||
|
QString uuidParent = item->parent()->text(COLUMN_UUID);
|
||||||
|
MoveDialog dialog(savemng->getFolders(), this);
|
||||||
|
if (dialog.exec() != QDialog::Accepted) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QString uuidFolder = dialog.getSelectedUUID();
|
||||||
|
if (uuidFolder.length() == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Check if parent is not the same folder
|
||||||
|
if (uuidFolder == uuidParent)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QString uuid = item->text(COLUMN_UUID);
|
||||||
|
Note *n = savemng->getNoteByUUID(uuid);
|
||||||
|
if (n == nullptr)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Add to new folder
|
||||||
|
Folder *f = savemng->getFolderByUUID(uuidFolder);
|
||||||
|
if (f == nullptr)
|
||||||
|
{
|
||||||
|
QMessageBox::critical(this, tr("WorkPad"), "The folder is not found", QMessageBox::Ok, QMessageBox::Ok);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
f->append(n);
|
||||||
|
// Remove from parent folder
|
||||||
|
Folder *oldFolder = savemng->getFolderByUUID(uuidParent);
|
||||||
|
if (oldFolder == nullptr)
|
||||||
|
{
|
||||||
|
QMessageBox::critical(this, tr("WorkPad"), "The previous folder is not found, cannot delete the old version of this note", QMessageBox::Ok, QMessageBox::Ok);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
oldFolder->remove(uuid);
|
||||||
|
}
|
||||||
|
savemng->flushSave();
|
||||||
|
updateListView();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::editName()
|
||||||
|
{
|
||||||
|
if (ui->treeWidget->selectedItems().length() == 1) {
|
||||||
|
QTreeWidgetItem *item = ui->treeWidget->selectedItems()[0];
|
||||||
|
QString uuid = item->text(COLUMN_UUID);
|
||||||
|
RenameDialog dialog(item->text(COLUMN_NAME), this);
|
||||||
|
if (dialog.exec() != QDialog::Accepted)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QString newName = dialog.getNewName();
|
||||||
|
if (item->text(COLUMN_TYPE) == TYPE_NOTE)
|
||||||
|
{
|
||||||
|
Note *n = savemng->getNoteByUUID(uuid);
|
||||||
|
if (n == nullptr)
|
||||||
|
{
|
||||||
|
QMessageBox::critical(this, tr("WorkPad"), "The note is not found", QMessageBox::Ok, QMessageBox::Ok);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
n->setTitle(newName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Folder *f = savemng->getFolderByUUID(uuid);
|
||||||
|
if (f == nullptr)
|
||||||
|
{
|
||||||
|
QMessageBox::critical(this, tr("WorkPad"), "The folder is not found", QMessageBox::Ok, QMessageBox::Ok);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
f->setName(newName);
|
||||||
|
}
|
||||||
|
savemng->flushSave();
|
||||||
|
updateListView();
|
||||||
|
selectTreeItem(uuid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::exportNote()
|
||||||
|
{
|
||||||
|
if (ui->treeWidget->selectedItems().length() == 1) {
|
||||||
|
QTreeWidgetItem *item = ui->treeWidget->selectedItems()[0];
|
||||||
|
if (item->text(COLUMN_TYPE) == TYPE_NOTE)
|
||||||
|
{
|
||||||
|
Note *n = savemng->getNoteByUUID(item->text(COLUMN_UUID));
|
||||||
|
if (n == nullptr)
|
||||||
|
{
|
||||||
|
QMessageBox::critical(this, tr("WorkPad"), "The note is not found", QMessageBox::Ok, QMessageBox::Ok);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ExportDialog d(this);
|
||||||
|
if (d.exec() == QDialog::Accepted)
|
||||||
|
{
|
||||||
|
int fileType = d.getResult();
|
||||||
|
QString filter = "Plain text file (*.txt)";
|
||||||
|
if (fileType == MARKDOWN)
|
||||||
|
{
|
||||||
|
filter = "Markdown file (*.md)";
|
||||||
|
}
|
||||||
|
else if (fileType == PDF)
|
||||||
|
{
|
||||||
|
filter = "PDF file (*.pdf)";
|
||||||
|
}
|
||||||
|
QString fileName = QFileDialog::getSaveFileName(this, tr("Export note"), "", filter);
|
||||||
|
if (!fileName.isEmpty())
|
||||||
|
{
|
||||||
|
if (fileType == MARKDOWN && !fileName.endsWith(".md", Qt::CaseInsensitive))
|
||||||
|
{
|
||||||
|
fileName += ".md";
|
||||||
|
}
|
||||||
|
else if (fileType == PLAIN && !fileName.endsWith(".txt", Qt::CaseInsensitive))
|
||||||
|
{
|
||||||
|
fileName += ".txt";
|
||||||
|
}
|
||||||
|
else if (fileType == PDF && !fileName.endsWith(".pdf", Qt::CaseInsensitive))
|
||||||
|
{
|
||||||
|
fileName += ".pdf";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fileType == PDF)
|
||||||
|
{
|
||||||
|
ui->webEngineViewer->printToPdf(fileName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QFile *f = new QFile(fileName);
|
||||||
|
if (f->open(QIODevice::WriteOnly))
|
||||||
|
{
|
||||||
|
|
||||||
|
f->write(n->getContent().toUtf8());
|
||||||
|
f->close();
|
||||||
|
}
|
||||||
|
delete f;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::viewReady(QString html)
|
||||||
|
{
|
||||||
|
if (queue->count() == 0)
|
||||||
|
{
|
||||||
|
ui->renderingProgressBar->setVisible(false);
|
||||||
|
}
|
||||||
|
ui->webEngineViewer->setHtml(html);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::markdownContentChanged()
|
||||||
{
|
{
|
||||||
timer->stop();
|
timer->stop();
|
||||||
if (this->currentIndex > -1)
|
ui->plainTextEdit->blockSignals(true);
|
||||||
|
if (ui->treeWidget->selectedItems().length() == 1)
|
||||||
{
|
{
|
||||||
Note *n = this->savemng->getNoteByIndex(this->currentIndex);
|
QString uuid = ui->treeWidget->selectedItems()[0]->text(COLUMN_UUID);
|
||||||
n->setContent(ui->contentEdit->toPlainText());
|
Note *n = savemng->getNoteByUUID(uuid);
|
||||||
ui->markdownViewer->setMarkdown(ui->contentEdit->toPlainText());
|
if (n != nullptr) {
|
||||||
|
QString content = ui->plainTextEdit->toPlainText();
|
||||||
|
n->setContent(content);
|
||||||
|
updateHTMLView();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
ui->plainTextEdit->blockSignals(false);
|
||||||
ui->actionSave->setDisabled(false);
|
ui->actionSave->setDisabled(false);
|
||||||
timer->start(1000);
|
if (cfgmng->getConfiguration()->isEnableAutoSave())
|
||||||
|
{
|
||||||
|
timer->start(cfgmng->getConfiguration()->getAutoSaveDelay());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::plainContentChanged()
|
||||||
|
{
|
||||||
|
timer->stop();
|
||||||
|
ui->plainTextEdit->blockSignals(true);
|
||||||
|
if (ui->treeWidget->selectedItems().length() == 1)
|
||||||
|
{
|
||||||
|
QString uuid = ui->treeWidget->selectedItems()[0]->text(COLUMN_UUID);
|
||||||
|
Note *n = savemng->getNoteByUUID(uuid);
|
||||||
|
if (n != nullptr) {
|
||||||
|
QString content = ui->plainTextEdit->toPlainText();
|
||||||
|
n->setContent(content);
|
||||||
|
updateHTMLView();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ui->plainTextEdit->blockSignals(false);
|
||||||
|
ui->actionSave->setDisabled(false);
|
||||||
|
if (cfgmng->getConfiguration()->isEnableAutoSave())
|
||||||
|
{
|
||||||
|
timer->start(cfgmng->getConfiguration()->getAutoSaveDelay());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::updateListView()
|
void MainWindow::updateListView()
|
||||||
{
|
{
|
||||||
ui->noteList->clear();
|
ui->treeWidget->clear();
|
||||||
foreach (Note *n, savemng->getNotes())
|
foreach (Folder *f, savemng->getFolders())
|
||||||
{
|
{
|
||||||
ui->noteList->addItem(n->getTitle());
|
QTreeWidgetItem *topLevel = new QTreeWidgetItem();
|
||||||
|
topLevel->setText(COLUMN_NAME, f->getName());
|
||||||
|
topLevel->setText(COLUMN_UUID, f->getUUID());
|
||||||
|
topLevel->setText(COLUMN_TYPE, TYPE_FOLDER);
|
||||||
|
foreach (Note *n, f->getNotes())
|
||||||
|
{
|
||||||
|
QTreeWidgetItem *children = new QTreeWidgetItem();
|
||||||
|
children->setText(COLUMN_NAME, n->getTitle());
|
||||||
|
children->setText(COLUMN_UUID, n->getUUID());
|
||||||
|
children->setText(COLUMN_TYPE, TYPE_NOTE);
|
||||||
|
topLevel->addChild(children);
|
||||||
}
|
}
|
||||||
|
ui->treeWidget->addTopLevelItem(topLevel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::updateHTMLView()
|
||||||
|
{
|
||||||
|
queueMutex->lock();
|
||||||
|
ui->renderingProgressBar->setVisible(true);
|
||||||
|
if (queue->count() > 4) {
|
||||||
|
queue->pop_front();
|
||||||
|
}
|
||||||
|
queue->append(ui->plainTextEdit->toPlainText());
|
||||||
|
queueMutex->unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::clearAndDisableFields()
|
void MainWindow::clearAndDisableFields()
|
||||||
{
|
{
|
||||||
ui->contentEdit->blockSignals(true);
|
ui->plainTextEdit->blockSignals(true);
|
||||||
ui->titleEdit->blockSignals(true);
|
|
||||||
|
|
||||||
this->currentIndex = -1;
|
ui->plainTextEdit->setDisabled(true);
|
||||||
ui->actionRemove->setDisabled(true);
|
ui->plainTextEdit->clear();
|
||||||
ui->titleEdit->setDisabled(true);
|
this->setWindowTitle("WorkPad");
|
||||||
ui->contentEdit->setDisabled(true);
|
|
||||||
ui->titleEdit->clear();
|
|
||||||
ui->contentEdit->clear();
|
|
||||||
ui->markdownViewer->clear();
|
|
||||||
|
|
||||||
ui->contentEdit->blockSignals(false);
|
ui->plainTextEdit->blockSignals(false);
|
||||||
ui->titleEdit->blockSignals(false);
|
}
|
||||||
|
|
||||||
|
void MainWindow::selectTreeItem(QString uuid)
|
||||||
|
{
|
||||||
|
ui->treeWidget->clearSelection();
|
||||||
|
int c = ui->treeWidget->topLevelItemCount();
|
||||||
|
int cc = 0;
|
||||||
|
for (int i = 0; i < c; i++)
|
||||||
|
{
|
||||||
|
QTreeWidgetItem *topLevel = ui->treeWidget->topLevelItem(i);
|
||||||
|
if (topLevel->text(COLUMN_UUID) == uuid)
|
||||||
|
{
|
||||||
|
topLevel->setSelected(true);
|
||||||
|
}
|
||||||
|
cc = topLevel->childCount();
|
||||||
|
for (int y = 0; y < cc; y++)
|
||||||
|
{
|
||||||
|
QTreeWidgetItem *child = topLevel->child(y);
|
||||||
|
if (child->text(COLUMN_UUID) == uuid)
|
||||||
|
{
|
||||||
|
child->setSelected(true);
|
||||||
|
topLevel->setExpanded(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
49
src/frames/mainwindow.h
Executable file → Normal file
@@ -5,10 +5,26 @@
|
|||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
#include <QTreeWidgetItem>
|
||||||
|
#include <QMenu>
|
||||||
|
#include <QPoint>
|
||||||
|
#include <QFileDialog>
|
||||||
|
#include <QScrollBar>
|
||||||
|
#include <QMutex>
|
||||||
|
#include <thread>
|
||||||
|
|
||||||
#include "../services/savemanager.h"
|
#include "../services/savemanager.h"
|
||||||
#include "aboutdialog.h"
|
#include "../services/configmanager.h"
|
||||||
|
|
||||||
|
#include "../../maddy/parserconfig.h"
|
||||||
|
#include "../../maddy/parser.h"
|
||||||
|
|
||||||
|
#define COLUMN_NAME 0
|
||||||
|
#define COLUMN_UUID 1
|
||||||
|
#define COLUMN_TYPE 2
|
||||||
|
|
||||||
|
#define TYPE_FOLDER "1"
|
||||||
|
#define TYPE_NOTE "2"
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
namespace Ui { class MainWindow; }
|
namespace Ui { class MainWindow; }
|
||||||
@@ -22,23 +38,42 @@ public:
|
|||||||
MainWindow(QWidget *parent = nullptr);
|
MainWindow(QWidget *parent = nullptr);
|
||||||
~MainWindow();
|
~MainWindow();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void updateViewers(QString html);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void createNote();
|
void createNote();
|
||||||
void selectionChanged(int);
|
void createFolder();
|
||||||
void removeSelected();
|
void selectionChanged();
|
||||||
void save();
|
void save();
|
||||||
void contentChanged();
|
void markdownContentChanged();
|
||||||
void titleChanged();
|
void plainContentChanged();
|
||||||
void showAboutBox();
|
void showSettingsBox();
|
||||||
|
void prepareMenu(const QPoint &pos);
|
||||||
|
void deleteItem();
|
||||||
|
void moveNote();
|
||||||
|
void editName();
|
||||||
|
void exportNote();
|
||||||
|
void viewReady(QString html);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
SaveManager *savemng;
|
SaveManager *savemng;
|
||||||
|
ConfigManager *cfgmng;
|
||||||
QTimer *timer;
|
QTimer *timer;
|
||||||
|
std::shared_ptr<maddy::Parser> parser;
|
||||||
|
|
||||||
int currentIndex = -1;
|
QString style;
|
||||||
|
|
||||||
|
//shared between threads
|
||||||
|
QVector<QString>* queue;
|
||||||
|
QMutex* queueMutex;
|
||||||
|
bool* threaddone;
|
||||||
|
std::thread *updateViewThread;
|
||||||
|
|
||||||
void updateListView();
|
void updateListView();
|
||||||
void clearAndDisableFields();
|
void clearAndDisableFields();
|
||||||
|
void selectTreeItem(QString uuid);
|
||||||
|
void updateHTMLView();
|
||||||
};
|
};
|
||||||
#endif // MAINWINDOW_H
|
#endif // MAINWINDOW_H
|
||||||
|
|||||||
258
src/frames/mainwindow.ui
Executable file → Normal file
@@ -17,116 +17,20 @@
|
|||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>TaskNote</string>
|
<string>WorkPad</string>
|
||||||
|
</property>
|
||||||
|
<property name="unifiedTitleAndToolBarOnMac">
|
||||||
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="centralwidget">
|
<widget class="QWidget" name="centralwidget">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<widget class="QPlainTextEdit" name="plainTextEdit">
|
||||||
<item>
|
|
||||||
<widget class="QListWidget" name="noteList">
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>250</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="Line" name="line">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>16777215</width>
|
|
||||||
<height>13</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Title</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="titleEdit">
|
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QSplitter" name="splitter">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="childrenCollapsible">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<widget class="QPlainTextEdit" name="contentEdit">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>200</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<kerning>false</kerning>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="lineWrapMode">
|
|
||||||
<enum>QPlainTextEdit::NoWrap</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QTextEdit" name="markdownViewer">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>200</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="autoFormatting">
|
|
||||||
<set>QTextEdit::AutoAll</set>
|
|
||||||
</property>
|
|
||||||
<property name="lineWrapMode">
|
|
||||||
<enum>QTextEdit::NoWrap</enum>
|
|
||||||
</property>
|
|
||||||
<property name="readOnly">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="acceptRichText">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="textInteractionFlags">
|
|
||||||
<set>Qt::TextSelectableByMouse</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QToolBar" name="toolBar">
|
<widget class="QToolBar" name="toolBar">
|
||||||
@@ -140,7 +44,7 @@
|
|||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="contextMenuPolicy">
|
<property name="contextMenuPolicy">
|
||||||
<enum>Qt::PreventContextMenu</enum>
|
<enum>Qt::ContextMenuPolicy::PreventContextMenu</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>toolBar</string>
|
<string>toolBar</string>
|
||||||
@@ -149,7 +53,7 @@
|
|||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolButtonStyle">
|
<property name="toolButtonStyle">
|
||||||
<enum>Qt::ToolButtonTextUnderIcon</enum>
|
<enum>Qt::ToolButtonStyle::ToolButtonTextUnderIcon</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="floatable">
|
<property name="floatable">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@@ -160,32 +64,119 @@
|
|||||||
<attribute name="toolBarBreak">
|
<attribute name="toolBarBreak">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</attribute>
|
</attribute>
|
||||||
|
<addaction name="actionAdd_folder"/>
|
||||||
<addaction name="actionAdd"/>
|
<addaction name="actionAdd"/>
|
||||||
<addaction name="actionRemove"/>
|
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionSave"/>
|
<addaction name="actionSave"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionAbout"/>
|
<addaction name="actionSettings"/>
|
||||||
|
</widget>
|
||||||
|
<widget class="QDockWidget" name="dockWidget_2">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>500</width>
|
||||||
|
<height>84</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="features">
|
||||||
|
<set>QDockWidget::DockWidgetFeature::DockWidgetFloatable|QDockWidget::DockWidgetFeature::DockWidgetMovable</set>
|
||||||
|
</property>
|
||||||
|
<attribute name="dockWidgetArea">
|
||||||
|
<number>2</number>
|
||||||
|
</attribute>
|
||||||
|
<widget class="QWidget" name="dockWidgetContents_2">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QWebEngineView" name="webEngineViewer" native="true">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QProgressBar" name="renderingProgressBar">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>160</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="invertedAppearance">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<widget class="QDockWidget" name="dockWidget_3">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>250</width>
|
||||||
|
<height>120</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="features">
|
||||||
|
<set>QDockWidget::DockWidgetFeature::NoDockWidgetFeatures</set>
|
||||||
|
</property>
|
||||||
|
<attribute name="dockWidgetArea">
|
||||||
|
<number>1</number>
|
||||||
|
</attribute>
|
||||||
|
<widget class="QWidget" name="dockWidgetContents_3">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QTreeWidget" name="treeWidget">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>250</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="editTriggers">
|
||||||
|
<set>QAbstractItemView::EditTrigger::NoEditTriggers</set>
|
||||||
|
</property>
|
||||||
|
<property name="animated">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">Workspace</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
<action name="actionAdd">
|
<action name="actionAdd">
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="../../icons.qrc">
|
|
||||||
<normaloff>:/icon/resources/outline_add_circle_outline_black_48dp.png</normaloff>:/icon/resources/outline_add_circle_outline_black_48dp.png</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Add</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionRemove">
|
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="../../icons.qrc">
|
<iconset resource="../../icons.qrc">
|
||||||
<normaloff>:/icon/resources/outline_delete_forever_black_48dp.png</normaloff>:/icon/resources/outline_delete_forever_black_48dp.png</iconset>
|
<normaloff>:/icon/resources/new_file.png</normaloff>:/icon/resources/new_file.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Remove</string>
|
<string>New note</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Create a new note</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Ctrl+N</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionSave">
|
<action name="actionSave">
|
||||||
@@ -199,17 +190,46 @@
|
|||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Save</string>
|
<string>Save</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Ctrl+S</string>
|
||||||
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionAbout">
|
<action name="actionSettings">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="../../icons.qrc">
|
<iconset resource="../../icons.qrc">
|
||||||
<normaloff>:/icon/resources/outline_help_outline_black_48dp.png</normaloff>:/icon/resources/outline_help_outline_black_48dp.png</iconset>
|
<normaloff>:/icon/resources/settings.png</normaloff>:/icon/resources/settings.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>About</string>
|
<string>Settings</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Settings</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionAdd_folder">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../icons.qrc">
|
||||||
|
<normaloff>:/icon/resources/new_folder.png</normaloff>:/icon/resources/new_folder.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>New folder</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Create a new folder</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Ctrl+F, Ctrl+N</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>QWebEngineView</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header>qwebengineview.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../../icons.qrc"/>
|
<include location="../../icons.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
37
src/frames/movedialog.cpp
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
#include "movedialog.h"
|
||||||
|
#include "ui_movedialog.h"
|
||||||
|
|
||||||
|
MoveDialog::MoveDialog(QVector<Folder*> folders, QWidget *parent) :
|
||||||
|
QDialog(parent),
|
||||||
|
ui(new Ui::MoveDialog)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
if (folders.length() > 0)
|
||||||
|
{
|
||||||
|
this->folders = folders;
|
||||||
|
foreach (Folder *f, this->folders)
|
||||||
|
{
|
||||||
|
ui->comboBox->addItem(f->getName());
|
||||||
|
}
|
||||||
|
ui->comboBox->setCurrentIndex(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->comboBox->setDisabled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MoveDialog::~MoveDialog()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString MoveDialog::getSelectedUUID()
|
||||||
|
{
|
||||||
|
int i = ui->comboBox->currentIndex();
|
||||||
|
if (i == -1)
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return folders[i]->getUUID();
|
||||||
|
}
|
||||||
28
src/frames/movedialog.h
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
#ifndef MOVEDIALOG_H
|
||||||
|
#define MOVEDIALOG_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
#include "../models/folder.h"
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class MoveDialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
class MoveDialog : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit MoveDialog(QVector<Folder*> folders, QWidget *parent = nullptr);
|
||||||
|
~MoveDialog();
|
||||||
|
|
||||||
|
QString getSelectedUUID();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::MoveDialog *ui;
|
||||||
|
|
||||||
|
QVector<Folder*> folders;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // MOVEDIALOG_H
|
||||||
108
src/frames/movedialog.ui
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>MoveDialog</class>
|
||||||
|
<widget class="QDialog" name="MoveDialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>400</width>
|
||||||
|
<height>142</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>400</width>
|
||||||
|
<height>142</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>400</width>
|
||||||
|
<height>142</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Move note</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>20</x>
|
||||||
|
<y>100</y>
|
||||||
|
<width>361</width>
|
||||||
|
<height>32</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>10</y>
|
||||||
|
<width>141</width>
|
||||||
|
<height>41</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>24</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Move to</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QComboBox" name="comboBox">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>20</x>
|
||||||
|
<y>60</y>
|
||||||
|
<width>361</width>
|
||||||
|
<height>25</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>accepted()</signal>
|
||||||
|
<receiver>MoveDialog</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>248</x>
|
||||||
|
<y>254</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>157</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>rejected()</signal>
|
||||||
|
<receiver>MoveDialog</receiver>
|
||||||
|
<slot>reject()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>316</x>
|
||||||
|
<y>260</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>286</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
||||||
20
src/frames/renamedialog.cpp
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
#include "renamedialog.h"
|
||||||
|
#include "ui_renamedialog.h"
|
||||||
|
|
||||||
|
RenameDialog::RenameDialog(QString oldName, QWidget *parent) :
|
||||||
|
QDialog(parent),
|
||||||
|
ui(new Ui::RenameDialog)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
ui->lineEdit->setText(oldName);
|
||||||
|
}
|
||||||
|
|
||||||
|
RenameDialog::~RenameDialog()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString RenameDialog::getNewName()
|
||||||
|
{
|
||||||
|
return ui->lineEdit->text();
|
||||||
|
}
|
||||||
24
src/frames/renamedialog.h
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#ifndef RENAMEDIALOG_H
|
||||||
|
#define RENAMEDIALOG_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class RenameDialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
class RenameDialog : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit RenameDialog(QString oldName, QWidget *parent = nullptr);
|
||||||
|
~RenameDialog();
|
||||||
|
|
||||||
|
QString getNewName();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::RenameDialog *ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // RENAMEDIALOG_H
|
||||||
96
src/frames/renamedialog.ui
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>RenameDialog</class>
|
||||||
|
<widget class="QDialog" name="RenameDialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>400</width>
|
||||||
|
<height>145</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Rename</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>20</x>
|
||||||
|
<y>100</y>
|
||||||
|
<width>361</width>
|
||||||
|
<height>32</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>10</y>
|
||||||
|
<width>141</width>
|
||||||
|
<height>41</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>24</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Rename</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLineEdit" name="lineEdit">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>60</y>
|
||||||
|
<width>381</width>
|
||||||
|
<height>25</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>accepted()</signal>
|
||||||
|
<receiver>RenameDialog</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>248</x>
|
||||||
|
<y>254</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>157</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>rejected()</signal>
|
||||||
|
<receiver>RenameDialog</receiver>
|
||||||
|
<slot>reject()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>316</x>
|
||||||
|
<y>260</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>286</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
||||||
1
src/main.cpp
Executable file → Normal file
@@ -6,6 +6,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
MainWindow w;
|
MainWindow w;
|
||||||
|
w.setWindowState(Qt::WindowState::WindowMaximized);
|
||||||
w.show();
|
w.show();
|
||||||
return a.exec();
|
return a.exec();
|
||||||
}
|
}
|
||||||
|
|||||||
43
src/models/appconfiguration.cpp
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
#include "appconfiguration.h"
|
||||||
|
|
||||||
|
AppConfiguration::AppConfiguration()
|
||||||
|
{
|
||||||
|
this->enableAutoSave = true;
|
||||||
|
this->autoSaveDelay = 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
AppConfiguration::AppConfiguration(QJsonObject obj)
|
||||||
|
{
|
||||||
|
this->enableAutoSave = obj[ENABLEAUTOSAVEKEY].toBool(true);
|
||||||
|
this->autoSaveDelay = obj[AUTOSAVEDELAY].toInt(1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
QJsonObject AppConfiguration::toJson()
|
||||||
|
{
|
||||||
|
QJsonObject obj;
|
||||||
|
|
||||||
|
obj[ENABLEAUTOSAVEKEY] = this->enableAutoSave;
|
||||||
|
obj[AUTOSAVEDELAY] = this->autoSaveDelay;
|
||||||
|
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AppConfiguration::isEnableAutoSave()
|
||||||
|
{
|
||||||
|
return enableAutoSave;
|
||||||
|
}
|
||||||
|
|
||||||
|
int AppConfiguration::getAutoSaveDelay()
|
||||||
|
{
|
||||||
|
return autoSaveDelay;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AppConfiguration::setEnableAutoSave(bool value)
|
||||||
|
{
|
||||||
|
this->enableAutoSave = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AppConfiguration::setAutoSaveDelay(int value)
|
||||||
|
{
|
||||||
|
this->autoSaveDelay = value;
|
||||||
|
}
|
||||||
27
src/models/appconfiguration.h
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
#ifndef APPCONFIGURATION_H
|
||||||
|
#define APPCONFIGURATION_H
|
||||||
|
|
||||||
|
#define ENABLEAUTOSAVEKEY "enable_auto_save"
|
||||||
|
#define AUTOSAVEDELAY "auto_save_delay"
|
||||||
|
|
||||||
|
#include <QJsonObject>
|
||||||
|
|
||||||
|
class AppConfiguration
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
bool enableAutoSave;
|
||||||
|
int autoSaveDelay;
|
||||||
|
|
||||||
|
public:
|
||||||
|
AppConfiguration();
|
||||||
|
AppConfiguration(QJsonObject obj);
|
||||||
|
|
||||||
|
QJsonObject toJson();
|
||||||
|
bool isEnableAutoSave();
|
||||||
|
int getAutoSaveDelay();
|
||||||
|
|
||||||
|
void setEnableAutoSave(bool);
|
||||||
|
void setAutoSaveDelay(int);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // APPCONFIGURATION_H
|
||||||
83
src/models/folder.cpp
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
#include "folder.h"
|
||||||
|
|
||||||
|
Folder::Folder(QString name)
|
||||||
|
{
|
||||||
|
QUuid uid = QUuid::createUuid();
|
||||||
|
this->uuid = uid.toString(QUuid::StringFormat::WithoutBraces);
|
||||||
|
this->name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
Folder::Folder(QJsonObject obj)
|
||||||
|
{
|
||||||
|
QUuid uid = QUuid::createUuid();
|
||||||
|
QString newUuid = uid.toString(QUuid::StringFormat::WithoutBraces);
|
||||||
|
|
||||||
|
this->uuid = obj["uuid"].toString(newUuid);
|
||||||
|
this->name = obj["name"].toString("<unamed folder>");
|
||||||
|
foreach (QJsonValue value, obj["notes"].toArray()) {
|
||||||
|
this->notes.append(new Note(value.toObject()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Folder::~Folder()
|
||||||
|
{
|
||||||
|
foreach (Note *n, notes)
|
||||||
|
{
|
||||||
|
delete n;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString Folder::getName()
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Folder::setName(QString name)
|
||||||
|
{
|
||||||
|
this->name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString Folder::getUUID()
|
||||||
|
{
|
||||||
|
return uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
QVector<Note *> Folder::getNotes()
|
||||||
|
{
|
||||||
|
return notes;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Folder::append(Note *n)
|
||||||
|
{
|
||||||
|
notes.append(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
int Folder::remove(QString uuid)
|
||||||
|
{
|
||||||
|
int res = 0;
|
||||||
|
int idx = -1;
|
||||||
|
for (int i = 0; i < notes.length(); i++)
|
||||||
|
{
|
||||||
|
if (notes[i]->getUUID() == uuid)
|
||||||
|
{
|
||||||
|
idx = i;
|
||||||
|
res = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
notes.removeAt(idx);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
QJsonObject Folder::toJson()
|
||||||
|
{
|
||||||
|
QJsonObject folder;
|
||||||
|
QJsonArray arr;
|
||||||
|
foreach (Note *n, notes) {
|
||||||
|
arr.append(n->toJson());
|
||||||
|
}
|
||||||
|
folder["name"] = this->name;
|
||||||
|
folder["uuid"] = this->uuid;
|
||||||
|
folder["notes"] = arr;
|
||||||
|
return folder;
|
||||||
|
}
|
||||||
|
|
||||||
33
src/models/folder.h
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
#ifndef FOLDER_H
|
||||||
|
#define FOLDER_H
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
#include <QJsonObject>
|
||||||
|
#include <QJsonArray>
|
||||||
|
|
||||||
|
#include "note.h"
|
||||||
|
|
||||||
|
|
||||||
|
class Folder
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
QString uuid;
|
||||||
|
QString name;
|
||||||
|
QVector<Note*> notes;
|
||||||
|
|
||||||
|
public:
|
||||||
|
Folder(QString name);
|
||||||
|
Folder(QJsonObject obj);
|
||||||
|
~Folder();
|
||||||
|
|
||||||
|
QString getName();
|
||||||
|
void setName(QString name);
|
||||||
|
QString getUUID();
|
||||||
|
QVector<Note*> getNotes();
|
||||||
|
void append(Note *n);
|
||||||
|
int remove(QString uuid);
|
||||||
|
|
||||||
|
QJsonObject toJson();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // FOLDER_H
|
||||||
32
src/models/note.cpp
Executable file → Normal file
@@ -1,9 +1,20 @@
|
|||||||
#include "note.h"
|
#include "note.h"
|
||||||
|
|
||||||
Note::Note()
|
Note::Note(QString name)
|
||||||
{
|
{
|
||||||
QUuid uid = QUuid::createUuid();
|
QUuid uid = QUuid::createUuid();
|
||||||
this->uuid = uid.toString(QUuid::StringFormat::WithoutBraces);
|
this->uuid = uid.toString(QUuid::StringFormat::WithoutBraces);
|
||||||
|
this->title = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
Note::Note(QJsonObject obj)
|
||||||
|
{
|
||||||
|
QUuid uid = QUuid::createUuid();
|
||||||
|
QString newUuid = uid.toString(QUuid::StringFormat::WithoutBraces);
|
||||||
|
|
||||||
|
this->uuid = obj["uuid"].toString(newUuid);
|
||||||
|
this->title = obj["title"].toString("<untitled note>");
|
||||||
|
this->content = obj["content"].toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QJsonObject Note::toJson()
|
QJsonObject Note::toJson()
|
||||||
@@ -14,18 +25,7 @@ QJsonObject Note::toJson()
|
|||||||
o["content"] = this->content;
|
o["content"] = this->content;
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
QString Note::getUUID()
|
||||||
Note *Note::fromJson(QJsonObject o)
|
|
||||||
{
|
|
||||||
Note *n = new Note();
|
|
||||||
n->uuid = o["uuid"].toString(n->uuid);
|
|
||||||
n->title = o["title"].toString();
|
|
||||||
n->content = o["content"].toString();
|
|
||||||
n->encrypted = o["encrypted"].toBool(false);
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString Note::getUuid()
|
|
||||||
{
|
{
|
||||||
return uuid;
|
return uuid;
|
||||||
}
|
}
|
||||||
@@ -37,11 +37,7 @@ QString Note::getTitle()
|
|||||||
|
|
||||||
QString Note::getContent()
|
QString Note::getContent()
|
||||||
{
|
{
|
||||||
if (!this->encrypted)
|
|
||||||
{
|
|
||||||
return content;
|
return content;
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
void Note::setTitle(QString value)
|
void Note::setTitle(QString value)
|
||||||
{
|
{
|
||||||
@@ -50,7 +46,5 @@ void Note::setTitle(QString value)
|
|||||||
|
|
||||||
void Note::setContent(QString value)
|
void Note::setContent(QString value)
|
||||||
{
|
{
|
||||||
if (!this->encrypted) {
|
|
||||||
this->content = value;
|
this->content = value;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
8
src/models/note.h
Executable file → Normal file
@@ -14,12 +14,13 @@
|
|||||||
class Note
|
class Note
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Note();
|
Note(QString name);
|
||||||
|
Note(QJsonObject obj);
|
||||||
|
|
||||||
|
|
||||||
QJsonObject toJson();
|
QJsonObject toJson();
|
||||||
static Note* fromJson(QJsonObject o);
|
|
||||||
|
|
||||||
QString getUuid();
|
QString getUUID();
|
||||||
QString getTitle();
|
QString getTitle();
|
||||||
QString getContent();
|
QString getContent();
|
||||||
|
|
||||||
@@ -29,7 +30,6 @@ private:
|
|||||||
QString uuid;
|
QString uuid;
|
||||||
QString title;
|
QString title;
|
||||||
QString content;
|
QString content;
|
||||||
bool encrypted;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // NOTE_H
|
#endif // NOTE_H
|
||||||
|
|||||||
62
src/services/configmanager.cpp
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
#include "configmanager.h"
|
||||||
|
|
||||||
|
ConfigManager::ConfigManager()
|
||||||
|
{
|
||||||
|
load();
|
||||||
|
}
|
||||||
|
|
||||||
|
ConfigManager::~ConfigManager()
|
||||||
|
{
|
||||||
|
delete cfg;
|
||||||
|
}
|
||||||
|
|
||||||
|
AppConfiguration *ConfigManager::getConfiguration()
|
||||||
|
{
|
||||||
|
return cfg;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ConfigManager::getSaveFilePath() {
|
||||||
|
QString path = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
|
||||||
|
if (!QDir(path).exists())
|
||||||
|
{
|
||||||
|
QDir().mkpath(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
path += "/data/";
|
||||||
|
if (!QDir(path).exists())
|
||||||
|
{
|
||||||
|
QDir().mkpath(path);
|
||||||
|
}
|
||||||
|
path += FILENAME;
|
||||||
|
return QDir::cleanPath(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConfigManager::load() {
|
||||||
|
QFile* file = new QFile(getSaveFilePath());
|
||||||
|
if (!file->open(QIODevice::ReadOnly))
|
||||||
|
{
|
||||||
|
delete file;
|
||||||
|
this->cfg = new AppConfiguration();
|
||||||
|
writeToDisk();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
auto json = QString(file->readAll());
|
||||||
|
file->close();
|
||||||
|
delete file;
|
||||||
|
|
||||||
|
QJsonObject obj = QJsonDocument::fromJson(json.toUtf8()).object();
|
||||||
|
this->cfg = new AppConfiguration(obj);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConfigManager::writeToDisk()
|
||||||
|
{
|
||||||
|
QJsonDocument doc(cfg->toJson());
|
||||||
|
QFile *f = new QFile(getSaveFilePath());
|
||||||
|
if (f->open(QIODevice::WriteOnly))
|
||||||
|
{
|
||||||
|
f->write(doc.toJson());
|
||||||
|
f->close();
|
||||||
|
}
|
||||||
|
delete f;
|
||||||
|
}
|
||||||
29
src/services/configmanager.h
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
#ifndef CONFIGMANAGER_H
|
||||||
|
#define CONFIGMANAGER_H
|
||||||
|
|
||||||
|
#define FILENAME "config.json"
|
||||||
|
|
||||||
|
#include <QJsonDocument>
|
||||||
|
#include <QJsonObject>
|
||||||
|
#include <QStandardPaths>
|
||||||
|
#include <QString>
|
||||||
|
#include <QDir>
|
||||||
|
|
||||||
|
#include "../models/appconfiguration.h"
|
||||||
|
|
||||||
|
class ConfigManager
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
QString getSaveFilePath();
|
||||||
|
void load();
|
||||||
|
AppConfiguration *cfg;
|
||||||
|
|
||||||
|
public:
|
||||||
|
ConfigManager();
|
||||||
|
~ConfigManager();
|
||||||
|
|
||||||
|
AppConfiguration *getConfiguration();
|
||||||
|
void writeToDisk();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CONFIGMANAGER_H
|
||||||
183
src/services/savemanager.cpp
Executable file → Normal file
@@ -3,29 +3,33 @@
|
|||||||
SaveManager::SaveManager()
|
SaveManager::SaveManager()
|
||||||
{
|
{
|
||||||
openSave();
|
openSave();
|
||||||
|
if (oldSaveVersionExist())
|
||||||
|
{
|
||||||
|
migrate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SaveManager::~SaveManager()
|
SaveManager::~SaveManager()
|
||||||
{
|
{
|
||||||
flushSave();
|
flushSave();
|
||||||
foreach (Note *n, notes)
|
foreach (Folder *f, folders)
|
||||||
{
|
{
|
||||||
delete n;
|
delete f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveManager::flushSave()
|
void SaveManager::flushSave()
|
||||||
{
|
{
|
||||||
QJsonArray json_notes;
|
QJsonArray json_folders;
|
||||||
|
|
||||||
foreach (Note *n, notes)
|
foreach (Folder *f, folders)
|
||||||
{
|
{
|
||||||
json_notes.append(n->toJson());
|
json_folders.append(f->toJson());
|
||||||
}
|
}
|
||||||
|
|
||||||
QJsonObject obj
|
QJsonObject obj
|
||||||
{
|
{
|
||||||
{"notes", json_notes},
|
{"folders", json_folders},
|
||||||
};
|
};
|
||||||
|
|
||||||
QJsonDocument doc(obj);
|
QJsonDocument doc(obj);
|
||||||
@@ -38,37 +42,152 @@ void SaveManager::flushSave()
|
|||||||
delete f;
|
delete f;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<Note *> SaveManager::getNotes()
|
QVector<Folder *> SaveManager::getFolders()
|
||||||
{
|
{
|
||||||
return notes;
|
return folders;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveManager::addNote(Note *n)
|
Note *SaveManager::newNote(QString uuidFolder, QString name)
|
||||||
{
|
{
|
||||||
this->notes.append(n);
|
Folder *f = getFolderByUUID(uuidFolder);
|
||||||
flushSave();
|
if (f == nullptr)
|
||||||
}
|
|
||||||
|
|
||||||
bool SaveManager::removeNoteByIndex(int i)
|
|
||||||
{
|
|
||||||
if ((i < 0) || (i >= this->notes.length()))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Note *n = this->notes[i];
|
|
||||||
this->notes.removeAt(i);
|
|
||||||
delete n;
|
|
||||||
flushSave();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Note *SaveManager::getNoteByIndex(int i)
|
|
||||||
{
|
|
||||||
if ((i < 0) || (i >= this->notes.length()))
|
|
||||||
{
|
{
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return this->notes[i];
|
if (name.length() == 0)
|
||||||
|
{
|
||||||
|
name = "<untitle note>";
|
||||||
|
}
|
||||||
|
Note *n = new Note(name);
|
||||||
|
f->append(n);
|
||||||
|
flushSave();
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
Folder *SaveManager::newFolder(QString name)
|
||||||
|
{
|
||||||
|
if (name.length() == 0)
|
||||||
|
{
|
||||||
|
name = "<untitle folder>";
|
||||||
|
}
|
||||||
|
Folder *f = new Folder(name);
|
||||||
|
folders.append(f);
|
||||||
|
flushSave();
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
|
Folder *SaveManager::getFolderByUUID(QString uuid)
|
||||||
|
{
|
||||||
|
Folder *folder = nullptr;
|
||||||
|
foreach (Folder *f, folders)
|
||||||
|
{
|
||||||
|
if (f->getUUID() == uuid)
|
||||||
|
{
|
||||||
|
folder = f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return folder;
|
||||||
|
}
|
||||||
|
|
||||||
|
Note *SaveManager::getNoteByUUID(QString uuid)
|
||||||
|
{
|
||||||
|
Note *note = nullptr;
|
||||||
|
foreach (Folder *f, folders)
|
||||||
|
{
|
||||||
|
foreach (Note *n, f->getNotes())
|
||||||
|
{
|
||||||
|
if (n->getUUID() == uuid)
|
||||||
|
{
|
||||||
|
note = n;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return note;
|
||||||
|
}
|
||||||
|
|
||||||
|
int SaveManager::addNoteToFolder(QString uuidFolder, Note *n)
|
||||||
|
{
|
||||||
|
Folder *f = getFolderByUUID(uuidFolder);
|
||||||
|
if (f == nullptr)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
f->append(n);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int SaveManager::removeFolder(QString uuid)
|
||||||
|
{
|
||||||
|
int res = 0;
|
||||||
|
int idx = -1;
|
||||||
|
for (int i = 0; i < folders.length(); i++)
|
||||||
|
{
|
||||||
|
if (folders[i]->getUUID() == uuid)
|
||||||
|
{
|
||||||
|
idx = i;
|
||||||
|
res = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
folders.removeAt(idx);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
int SaveManager::removeNote(QString uuidFolder, QString uuid)
|
||||||
|
{
|
||||||
|
Folder *f = getFolderByUUID(uuidFolder);
|
||||||
|
if (f == nullptr)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return f->remove(uuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SaveManager::oldSaveVersionExist()
|
||||||
|
{
|
||||||
|
QString path = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
|
||||||
|
path.replace("WorkPad", "TaskNote");
|
||||||
|
if (!QDir(path).exists())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
path += "/data/";
|
||||||
|
if (!QDir(path).exists())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
path += OLD_FILENAME;
|
||||||
|
return QFile::exists(QDir::cleanPath(path));
|
||||||
|
}
|
||||||
|
|
||||||
|
void SaveManager::migrate()
|
||||||
|
{
|
||||||
|
QString path = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
|
||||||
|
path.replace("WorkPad", "TaskNote");
|
||||||
|
if (!QDir(path).exists())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
path += "/data/";
|
||||||
|
if (!QDir(path).exists())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
path = QDir::cleanPath(path + OLD_FILENAME);
|
||||||
|
QFile* file = new QFile(path);
|
||||||
|
file->open(QIODevice::ReadOnly);
|
||||||
|
auto json = QString(file->readAll());
|
||||||
|
file->close();
|
||||||
|
delete file;
|
||||||
|
|
||||||
|
QJsonObject obj = QJsonDocument::fromJson(json.toUtf8()).object();
|
||||||
|
Folder *f = newFolder("Backup from older version");
|
||||||
|
QJsonArray arr = obj["notes"].toArray();
|
||||||
|
for (int i = 0; i < arr.size(); i++)
|
||||||
|
{
|
||||||
|
f->append(new Note(arr[i].toObject()));
|
||||||
|
}
|
||||||
|
flushSave();
|
||||||
|
QFile::remove(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SaveManager::getSaveFilePath() {
|
QString SaveManager::getSaveFilePath() {
|
||||||
@@ -95,9 +214,9 @@ void SaveManager::openSave() {
|
|||||||
delete file;
|
delete file;
|
||||||
|
|
||||||
QJsonObject obj = QJsonDocument::fromJson(json.toUtf8()).object();
|
QJsonObject obj = QJsonDocument::fromJson(json.toUtf8()).object();
|
||||||
QJsonArray arr = obj["notes"].toArray();
|
QJsonArray arr = obj["folders"].toArray();
|
||||||
for (int i = 0; i < arr.size(); i++)
|
for (int i = 0; i < arr.size(); i++)
|
||||||
{
|
{
|
||||||
this->notes.append(Note::fromJson(arr[i].toObject()));
|
this->folders.append(new Folder(arr[i].toObject()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
21
src/services/savemanager.h
Executable file → Normal file
@@ -1,7 +1,8 @@
|
|||||||
#ifndef SAVEMANAGER_H
|
#ifndef SAVEMANAGER_H
|
||||||
#define SAVEMANAGER_H
|
#define SAVEMANAGER_H
|
||||||
|
|
||||||
#define SAVE_FILENAME "data.json"
|
#define SAVE_FILENAME "workspace.json"
|
||||||
|
#define OLD_FILENAME "data.json"
|
||||||
|
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
@@ -11,6 +12,7 @@
|
|||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
|
||||||
#include "../models/note.h"
|
#include "../models/note.h"
|
||||||
|
#include "../models/folder.h"
|
||||||
|
|
||||||
class SaveManager
|
class SaveManager
|
||||||
{
|
{
|
||||||
@@ -20,16 +22,23 @@ public:
|
|||||||
|
|
||||||
void flushSave();
|
void flushSave();
|
||||||
|
|
||||||
QVector<Note*> getNotes();
|
QVector<Folder*> getFolders();
|
||||||
|
|
||||||
|
Note *newNote(QString uuidFolder, QString name);
|
||||||
|
Folder *newFolder(QString name);
|
||||||
|
Folder *getFolderByUUID(QString uuid);
|
||||||
|
Note *getNoteByUUID(QString uuid);
|
||||||
|
int addNoteToFolder(QString uuidFolder, Note *n);
|
||||||
|
int removeFolder(QString uuid);
|
||||||
|
int removeNote(QString uuidFolder, QString uuid);
|
||||||
|
|
||||||
void addNote(Note *n);
|
|
||||||
bool removeNoteByIndex(int i);
|
|
||||||
Note *getNoteByIndex(int i);
|
|
||||||
private:
|
private:
|
||||||
QString getSaveFilePath();
|
QString getSaveFilePath();
|
||||||
void openSave();
|
void openSave();
|
||||||
|
bool oldSaveVersionExist();
|
||||||
|
void migrate();
|
||||||
|
|
||||||
QVector<Note*> notes;
|
QVector<Folder*> folders;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SAVEMANAGER_H
|
#endif // SAVEMANAGER_H
|
||||||
|
|||||||
5
static.qrc
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<RCC>
|
||||||
|
<qresource prefix="/css">
|
||||||
|
<file>resources/style.css</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
||||||