diff --git a/CMakeLists.txt b/CMakeLists.txt index 6442944..c6336b6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,12 +6,12 @@ set(CMAKE_CXX_STANDARD 20) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_COMPILE_WARNING_AS_ERROR ON) -find_package(Qt6 6.6 REQUIRED COMPONENTS Quick) +find_package(Qt6 6.7 REQUIRED COMPONENTS Quick) include_directories(src) include_directories(libs) -qt_standard_project_setup(REQUIRES 6.6) +qt_standard_project_setup(REQUIRES 6.7) add_library(mirai-core src/core/Mirai.h src/core/Mirai.cpp @@ -74,7 +74,6 @@ qt_add_qml_module(mirai target_link_libraries(mirai PRIVATE Qt6::Quick) target_link_libraries(mirai PRIVATE mirai-core) - # Tests add_subdirectory(libs/Catch2) add_executable(tests tests/test.cpp) diff --git a/src/Backend.cpp b/src/Backend.cpp index 90c45d7..a7fa6b1 100644 --- a/src/Backend.cpp +++ b/src/Backend.cpp @@ -11,13 +11,13 @@ #include "core/TodoMd.h" #include "cpp-utils/debug.h" #include -#include #include #include #include #include #include #include +#include Backend::Backend() : todoView(&mirai) { @@ -49,7 +49,7 @@ Backend::Backend() : todoView(&mirai) mirai.loadFile(filePath.toString().toStdString()); loadingFileDuration.printTimeElapsed( "Loading file duration of " + filePath.toString().toStdString() - ); + ); } auto jsonTagsConfig = json["tags"]; @@ -63,8 +63,6 @@ Backend::Backend() : todoView(&mirai) qWarning() << "Couldn't find existing config file"; } - - cpputils::debug::Timer updatingViewDuration; todoView.update(); updatingViewDuration.printTimeElapsed("Updating view duration"); @@ -332,4 +330,5 @@ void Backend::saveConfig() } configFile.write(QJsonDocument(rootJson).toJson()); configFile.close(); + qDebug() << "Config file saved"; } diff --git a/src/qml/Main.qml b/src/qml/Main.qml index 75c99a3..006cd13 100644 --- a/src/qml/Main.qml +++ b/src/qml/Main.qml @@ -112,4 +112,26 @@ Window { } onWidthChanged: setFittingLayout() Component.onCompleted: setFittingLayout() + + Popup { + id: taskFormPopup + width: parent.width * 0.75 + implicitHeight: taskForm.height + padding * 2 + x: Math.round((parent.width - width) / 2) + y: Math.round((parent.height * 0.4) / 2) + padding: 8 + background: Rectangle { + border.color: colorPalette.selected.modalBorder + border.width: 2 + color: colorPalette.selected.pane + radius: 4 + } + TaskForm { + id: taskForm + width: parent.width + onConfirmed: { + taskFormPopup.close() + } + } + } } diff --git a/src/qml/MainPanel.qml b/src/qml/MainPanel.qml index 24fd896..7c8f2d9 100644 --- a/src/qml/MainPanel.qml +++ b/src/qml/MainPanel.qml @@ -87,26 +87,6 @@ Rectangle { - Popup { - id: taskFormPopup - width: parent.width * 0.75 - implicitHeight: taskForm.height + padding * 2 - x: Math.round((parent.width - width) / 2) - y: Math.round((parent.height * 0.4) / 2) - padding: 8 - background: Rectangle { - border.color: colorPalette.selected.modalBorder - border.width: 2 - color: colorPalette.selected.pane - radius: 4 - } - TaskForm { - id: taskForm - width: parent.width - onConfirmed: { - taskFormPopup.close() - } - } - } + } } diff --git a/src/qml/forms/FilesForm.qml b/src/qml/forms/FilesForm.qml index 3a20feb..3ac1a2f 100644 --- a/src/qml/forms/FilesForm.qml +++ b/src/qml/forms/FilesForm.qml @@ -8,6 +8,7 @@ import QtQuick import QtQuick.Window import QtQuick.Controls import QtQuick.Layouts +import QtQuick.Dialogs import Mirai // WIP @@ -39,10 +40,19 @@ ColumnLayout { } } + FileDialog { + id: fileDialog + currentFolder: StandardPaths.standardLocations(StandardPaths.PicturesLocation)[0] + onAccepted: { + console.log(selectedFile) + internal.paths = [...internal.paths, selectedFile] + } + } + AppButton { - text: "+" + text: "+ Add" onClicked: { - internal.paths = [...internal.paths, ""] + fileDialog.open() } } @@ -53,4 +63,3 @@ ColumnLayout { } } } -