diff --git a/_codeql_detected_source_root b/_codeql_detected_source_root new file mode 120000 index 0000000..945c9b4 --- /dev/null +++ b/_codeql_detected_source_root @@ -0,0 +1 @@ +. \ No newline at end of file diff --git a/qt_app/CMakeLists.txt b/qt_app/CMakeLists.txt index c04e98e..fa397ea 100644 --- a/qt_app/CMakeLists.txt +++ b/qt_app/CMakeLists.txt @@ -142,17 +142,6 @@ set(TS_FILES translations/app_fr.ts ) -# Create translation targets (Qt 6.2+) -if(COMMAND qt6_add_translations) - qt6_add_translations(${PROJECT_NAME} - TS_FILES ${TS_FILES} - RESOURCE_PREFIX "/translations" - ) -else() - # Fallback for older Qt versions - qt_add_translation(QM_FILES ${TS_FILES}) -endif() - # Create lib that will be reused everywhere add_library(${PROJECT_NAME}_static_lib STATIC ${SOURCES} ${HEADERS}) target_link_libraries(${PROJECT_NAME}_static_lib PUBLIC @@ -218,6 +207,17 @@ target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::Concurrent ) +# Create translation targets (Qt 6.2+) +if(COMMAND qt6_add_translations) + qt6_add_translations(${PROJECT_NAME} + TS_FILES ${TS_FILES} + RESOURCE_PREFIX "/translations" + ) +else() + # Fallback for older Qt versions + qt_add_translation(QM_FILES ${TS_FILES}) +endif() + # Install rules install(TARGETS ${PROJECT_NAME} BUNDLE DESTINATION . diff --git a/qt_app/src/database/database.cpp b/qt_app/src/database/database.cpp index 7437714..795bb34 100644 --- a/qt_app/src/database/database.cpp +++ b/qt_app/src/database/database.cpp @@ -86,12 +86,10 @@ bool Database::initialize(const QString &dbPath) return false; } - // Run migrations if not in demo mode - if (!m_demoMode) { - if (!runMigrations()) { - qCritical() << "Failed to run migrations"; - return false; - } + // Run migrations + if (!runMigrations()) { + qCritical() << "Failed to run migrations"; + return false; } m_initialized = true; diff --git a/qt_app/tests/test_timeentrymanager.cpp b/qt_app/tests/test_timeentrymanager.cpp index 107b76e..a9229f9 100644 --- a/qt_app/tests/test_timeentrymanager.cpp +++ b/qt_app/tests/test_timeentrymanager.cpp @@ -1,11 +1,24 @@ #include #include "../include/managers/timeentrymanager.h" +#include "../include/database/database.h" +#include class TestTimeEntryManager : public QObject { Q_OBJECT private slots: + void initTestCase() + { + Database* db = Database::instance(); + db->setDemoMode(true); + QVERIFY(db->initialize()); + + // Create a test project + QSqlQuery query(db->database()); + QVERIFY(query.exec("INSERT INTO projects (id, name, description, color) VALUES (1, 'Test Project', 'Test Description', '#FF0000')")); + } + void testTimerStartStop() { TimeEntryManager manager; @@ -14,6 +27,9 @@ private slots: QVERIFY(manager.startTimer(1, -1, "Test")); QVERIFY(manager.timerRunning()); + // Wait a bit so we have some elapsed time + QTest::qWait(100); + QVERIFY(manager.stopTimer()); QVERIFY(!manager.timerRunning()); }