diff --git a/analyzer/CMakeLists.txt b/analyzer/CMakeLists.txt index eb1939f039437d9220c959d254e489b678e0af3e..ebe40322493769277c246af35cc811ec72d73295 100644 --- a/analyzer/CMakeLists.txt +++ b/analyzer/CMakeLists.txt @@ -2,6 +2,7 @@ set(analyzer_lib_srcs core/product.cpp core/schemaentry.cpp core/schemaentryelement.cpp + core/schemaentrytemplates.cpp core/survey.cpp rest/restapi.cpp @@ -11,6 +12,8 @@ set(analyzer_lib_srcs model/productmodel.cpp model/schemamodel.cpp model/surveymodel.cpp + + schemaentrytemplates/schemaentrytemplates.qrc ) add_library(UserFeedbackAnalyzer STATIC ${analyzer_lib_srcs}) @@ -35,11 +38,8 @@ set(analyzer_srcs schemaeditor/schemaeditwidget.cpp schemaeditor/schemaentryitemeditorfactory.cpp - schemaeditor/schemaentrytemplates.cpp schemaeditor/schemaentrytypecombobox.cpp - schemaentrytemplates/schemaentrytemplates.qrc - surveyeditor/surveydialog.cpp surveyeditor/surveyeditor.cpp ) diff --git a/analyzer/schemaeditor/schemaentrytemplates.cpp b/analyzer/core/schemaentrytemplates.cpp similarity index 98% rename from analyzer/schemaeditor/schemaentrytemplates.cpp rename to analyzer/core/schemaentrytemplates.cpp index d343a80aa1c8dfafb669642ee98574dc4f3286b7..37b2c6eab02745a2e71a598a2836e1ff8c7070c9 100644 --- a/analyzer/schemaeditor/schemaentrytemplates.cpp +++ b/analyzer/core/schemaentrytemplates.cpp @@ -40,8 +40,6 @@ QVector<SchemaEntry> SchemaEntryTemplates::availableTemplates() QDirIterator it(dir, {QStringLiteral("*.json")}, QDir::Files | QDir::Readable); while (it.hasNext()) { const auto fileName = it.next(); - qDebug() << fileName; - QFile f(fileName); if (!f.open(QFile::ReadOnly)) continue; diff --git a/analyzer/schemaeditor/schemaentrytemplates.h b/analyzer/core/schemaentrytemplates.h similarity index 100% rename from analyzer/schemaeditor/schemaentrytemplates.h rename to analyzer/core/schemaentrytemplates.h diff --git a/analyzer/main.cpp b/analyzer/main.cpp index 5559426691024f868d9ada23a0d713453e050c6d..6f7fe2aa762277821aaf367266adefb6e742045e 100644 --- a/analyzer/main.cpp +++ b/analyzer/main.cpp @@ -27,6 +27,8 @@ int main(int argc, char** argv) QCoreApplication::setOrganizationName(QStringLiteral("KDE")); QCoreApplication::setOrganizationDomain(QStringLiteral("kde.org")); + Q_INIT_RESOURCE(schemaentrytemplates); + QApplication app(argc, argv); UserFeedback::Analyzer::MainWindow mainWindow; diff --git a/analyzer/schemaeditor/schemaeditwidget.cpp b/analyzer/schemaeditor/schemaeditwidget.cpp index bce6f46696a770cefb3604c2f0c86f75d17397ad..883a8f83f71d7ed8db6c1216ff15bbf8e91459f3 100644 --- a/analyzer/schemaeditor/schemaeditwidget.cpp +++ b/analyzer/schemaeditor/schemaeditwidget.cpp @@ -18,11 +18,11 @@ #include "schemaeditwidget.h" #include "ui_schemaeditwidget.h" #include "schemaentryitemeditorfactory.h" -#include "schemaentrytemplates.h" #include <model/schemamodel.h> #include <rest/restapi.h> #include <core/product.h> +#include <core/schemaentrytemplates.h> #include <QDebug> #include <QMenu> diff --git a/tests/auto/schemamodeltest.cpp b/tests/auto/schemamodeltest.cpp index d54bdd5f7fa720e57beeb3fa193d2b7a74a78066..476842c085d2aabdd32973d86223989625f43408 100644 --- a/tests/auto/schemamodeltest.cpp +++ b/tests/auto/schemamodeltest.cpp @@ -16,6 +16,7 @@ */ #include <model/schemamodel.h> +#include <core/schemaentrytemplates.h> #include <3rdparty/qt/modeltest.h> @@ -33,6 +34,7 @@ class SchemaModelTest : public QObject private slots: void initTestCase() { + Q_INIT_RESOURCE(schemaentrytemplates); QStandardPaths::setTestModeEnabled(true); } @@ -56,6 +58,10 @@ private slots: p.setSchema(schema); model.setProduct(p); QCOMPARE(model.rowCount(), schema.size()); + + p.setSchema(SchemaEntryTemplates::availableTemplates()); + model.setProduct(p); + QVERIFY(model.rowCount() > 0); } };