LCOV - code coverage report
Current view: top level - src/tools/qt-gui/src - main.cpp (source / functions) Hit Total Coverage
Test: coverage-filtered.info Lines: 0 38 0.0 %
Date: 2019-09-12 12:28:41 Functions: 0 2 0.0 %

          Line data    Source code
       1             : /**
       2             :  * @file
       3             :  *
       4             :  * @brief
       5             :  *
       6             :  * @copyright BSD License (see LICENSE.md or https://www.libelektra.org)
       7             :  */
       8             : 
       9             : #include <QApplication>
      10             : #include <QDebug>
      11             : #include <QMessageBox>
      12             : #include <QMetaType>
      13             : #include <QQmlApplicationEngine>
      14             : #include <QTranslator>
      15             : #include <QtQml>
      16             : #include <QtTest/qtestcase.h>
      17             : #include <kdb.hpp>
      18             : #include <merging/mergingkdb.hpp>
      19             : 
      20             : #include "QQuickThemeIconProvider.hpp"
      21             : 
      22             : #include "confignode.hpp"
      23             : #include "datacontainer.hpp"
      24             : #include "guibackend.hpp"
      25             : #include "guisettings.hpp"
      26             : #include "treeviewmodel.hpp"
      27             : #include "undomanager.hpp"
      28             : 
      29           0 : int main (int argc, char * argv[])
      30             : {
      31           0 :         QApplication app (argc, argv);
      32             : 
      33           0 :         qRegisterMetaType<TreeViewModel> ("TreeViewModel");
      34           0 :         qRegisterMetaType<ConfigNode> ("ConfigNode");
      35           0 :         qRegisterMetaType<UndoManager> ("UndoManager");
      36           0 :         qRegisterMetaType<GUIBackend> ("GUIBackend");
      37           0 :         qRegisterMetaType<GUISettings> ("GUISettings");
      38           0 :         qmlRegisterType<DataContainer> ("org.libelektra.qtgui", 1, 0, "DataContainer");
      39             : 
      40           0 :         QString locale = QLocale::system ().name ();
      41             : 
      42           0 :         QTranslator translator;
      43           0 :         translator.load (QString (":/qml/i18n/lang_") + locale + QString (".qm"));
      44           0 :         app.installTranslator (&translator);
      45             : 
      46           0 :         app.setOrganizationName ("Elektra Initiative");
      47           0 :         app.setOrganizationDomain ("libelektra.org");
      48           0 :         app.setApplicationName ("org.libelektra.elektra-qt-editor");
      49             : 
      50           0 :         QQmlApplicationEngine engine;
      51           0 :         QQmlContext * ctxt = engine.rootContext ();
      52           0 :         engine.addImageProvider (QLatin1String ("theme"), new QQuickThemeIconProvider);
      53             : 
      54           0 :         UndoManager manager;
      55           0 :         GUIBackend backend;
      56           0 :         GUISettings settings;
      57           0 :         kdb::tools::merging::MergingKDB kdb;
      58           0 :         TreeViewModel treeModel (&kdb);
      59             : 
      60           0 :         engine.setObjectOwnership (&treeModel, QQmlApplicationEngine::CppOwnership);
      61             : 
      62           0 :         ctxt->setContextProperty ("undoManager", &manager);
      63           0 :         ctxt->setContextProperty ("externTreeModel", &treeModel);
      64           0 :         ctxt->setContextProperty ("guiBackend", &backend);
      65           0 :         ctxt->setContextProperty ("guiSettings", &settings);
      66             : 
      67             :         try
      68             :         {
      69           0 :                 treeModel.populateModel ();
      70             :         }
      71           0 :         catch (std::exception const & e)
      72             :         {
      73           0 :                 QMessageBox msgBox;
      74           0 :                 msgBox.setText ("Could not start qt-gui. Failed while reading the whole configuration.");
      75           0 :                 msgBox.setInformativeText (e.what ());
      76           0 :                 msgBox.setIcon (QMessageBox::Critical);
      77           0 :                 msgBox.exec ();
      78             :                 return 1;
      79             :         }
      80             : 
      81           0 :         engine.load (QUrl (QStringLiteral ("qrc:/qml/main.qml")));
      82             : 
      83           0 :         return app.exec ();
      84           0 : }

Generated by: LCOV version 1.13