2015-09-06 20:33:09 +02:00
|
|
|
#include "./initiatequick.h"
|
2015-12-05 22:52:00 +01:00
|
|
|
#include "./applicationinfo.h"
|
2015-04-22 19:30:09 +02:00
|
|
|
|
2016-04-16 00:51:52 +02:00
|
|
|
#include "../model/entryfiltermodel.h"
|
|
|
|
#include "../model/entrymodel.h"
|
|
|
|
#include "../model/fieldmodel.h"
|
2015-04-22 19:30:09 +02:00
|
|
|
|
2016-04-25 22:06:24 +02:00
|
|
|
#include "resources/config.h"
|
2015-12-05 22:52:00 +01:00
|
|
|
|
2015-09-01 20:18:13 +02:00
|
|
|
#include <qtutilities/resources/qtconfigarguments.h>
|
2015-04-22 19:30:09 +02:00
|
|
|
#include <qtutilities/resources/resources.h>
|
|
|
|
|
|
|
|
#if defined(GUI_QTWIDGETS)
|
2017-05-01 03:26:04 +02:00
|
|
|
#include <QApplication>
|
2015-04-22 19:30:09 +02:00
|
|
|
#else
|
2017-05-01 03:26:04 +02:00
|
|
|
#include <QGuiApplication>
|
2015-04-22 19:30:09 +02:00
|
|
|
#endif
|
2017-05-01 03:26:04 +02:00
|
|
|
#include <QDebug>
|
2015-04-22 19:30:09 +02:00
|
|
|
#include <QGuiApplication>
|
2017-05-01 03:26:04 +02:00
|
|
|
#include <QQmlApplicationEngine>
|
2015-04-22 19:30:09 +02:00
|
|
|
#include <QTextCodec>
|
|
|
|
#include <QtQml>
|
|
|
|
|
2015-09-01 20:18:13 +02:00
|
|
|
using namespace ApplicationUtilities;
|
|
|
|
|
2015-04-22 19:30:09 +02:00
|
|
|
namespace QtGui {
|
|
|
|
|
|
|
|
static QObject *applicationInfo(QQmlEngine *engine, QJSEngine *scriptEngine)
|
|
|
|
{
|
|
|
|
Q_UNUSED(engine)
|
|
|
|
Q_UNUSED(scriptEngine)
|
|
|
|
return new ApplicationInfo();
|
|
|
|
}
|
|
|
|
|
2015-09-01 20:18:13 +02:00
|
|
|
int runQuickGui(int argc, char *argv[], const QtConfigArguments &qtConfigArgs)
|
2015-04-22 19:30:09 +02:00
|
|
|
{
|
|
|
|
// init application
|
2015-09-01 20:18:13 +02:00
|
|
|
SET_QT_APPLICATION_INFO;
|
2015-04-22 19:30:09 +02:00
|
|
|
#if defined(GUI_QTWIDGETS)
|
|
|
|
QApplication a(argc, argv);
|
|
|
|
#else
|
|
|
|
QGuiApplication a(argc, argv);
|
|
|
|
#endif
|
2015-09-01 20:18:13 +02:00
|
|
|
// apply settings specified via command line args
|
|
|
|
qtConfigArgs.applySettings();
|
|
|
|
LOAD_QT_TRANSLATIONS;
|
|
|
|
QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
|
2015-04-22 19:30:09 +02:00
|
|
|
// init quick GUI
|
|
|
|
qmlRegisterSingletonType<QtGui::ApplicationInfo>("martchus.passwordmanager", 2, 0, "ApplicationInfo", applicationInfo);
|
|
|
|
qmlRegisterType<QtGui::EntryFilterModel>("martchus.passwordmanager", 2, 0, "EntryFilterModel");
|
|
|
|
qmlRegisterType<QtGui::EntryModel>("martchus.passwordmanager", 2, 0, "EntryModel");
|
|
|
|
qmlRegisterType<QtGui::FieldModel>("martchus.passwordmanager", 2, 0, "FieldModel");
|
|
|
|
QQmlApplicationEngine engine(QUrl("qrc:/qml/main.qml"));
|
|
|
|
// start event loop
|
|
|
|
int res = a.exec();
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
}
|