2015-09-06 20:33:09 +02:00
|
|
|
#include "./initiategui.h"
|
2015-04-22 19:30:09 +02:00
|
|
|
|
2015-12-05 22:52:00 +01:00
|
|
|
#include "./gui/mainwindow.h"
|
|
|
|
|
2015-12-08 08:37:18 +01:00
|
|
|
#include "resources/config.h"
|
2015-04-22 19:30:09 +02: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>
|
2016-08-19 16:17:49 +02:00
|
|
|
#include <qtutilities/resources/importplugin.h>
|
2016-08-16 00:37:17 +02:00
|
|
|
#include <qtutilities/settingsdialog/qtsettings.h>
|
2015-04-22 19:30:09 +02:00
|
|
|
|
|
|
|
#include <QApplication>
|
2016-08-16 00:37:17 +02:00
|
|
|
#include <QSettings>
|
2015-04-22 19:30:09 +02:00
|
|
|
|
2015-09-01 20:18:13 +02:00
|
|
|
using namespace ApplicationUtilities;
|
2016-08-16 00:37:17 +02:00
|
|
|
using namespace Dialogs;
|
2015-09-01 20:18:13 +02:00
|
|
|
|
2015-04-22 19:30:09 +02:00
|
|
|
namespace QtGui {
|
|
|
|
|
2015-09-01 20:18:13 +02:00
|
|
|
int runWidgetsGui(int argc, char *argv[], const QtConfigArguments &qtConfigArgs, const QString &file)
|
2015-04-22 19:30:09 +02:00
|
|
|
{
|
2015-08-25 19:14:49 +02:00
|
|
|
SET_QT_APPLICATION_INFO;
|
2015-04-22 19:30:09 +02:00
|
|
|
// init application
|
|
|
|
QApplication a(argc, argv);
|
2016-08-16 00:37:17 +02:00
|
|
|
// restore Qt settings
|
|
|
|
QtSettings qtSettings;
|
|
|
|
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(), QApplication::applicationName());
|
|
|
|
qtSettings.restore(settings);
|
|
|
|
qtSettings.apply();
|
2015-09-01 20:18:13 +02:00
|
|
|
// apply settings specified via command line args
|
2016-08-27 15:19:49 +02:00
|
|
|
qtConfigArgs.applySettings(qtSettings.hasCustomFont());
|
2015-08-25 19:14:49 +02:00
|
|
|
LOAD_QT_TRANSLATIONS;
|
2015-04-22 19:30:09 +02:00
|
|
|
// init widgets GUI
|
2016-08-16 00:37:17 +02:00
|
|
|
MainWindow w(settings, &qtSettings);
|
2015-04-22 19:30:09 +02:00
|
|
|
w.show();
|
|
|
|
if(!file.isEmpty()) {
|
|
|
|
w.openFile(file);
|
|
|
|
}
|
|
|
|
// start event loop
|
|
|
|
int res = a.exec();
|
2016-08-16 00:37:17 +02:00
|
|
|
// save Qt settings
|
|
|
|
qtSettings.save(settings);
|
2015-04-22 19:30:09 +02:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|