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>
|
|
|
|
|
|
|
|
#include <QTextCodec>
|
|
|
|
#include <QApplication>
|
|
|
|
#include <QFile>
|
|
|
|
|
2015-09-01 20:18:13 +02:00
|
|
|
using namespace ApplicationUtilities;
|
|
|
|
|
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);
|
2015-09-01 20:18:13 +02:00
|
|
|
// load resources needed by classes of qtutilities
|
|
|
|
QtUtilitiesResources::init();
|
|
|
|
// apply settings specified via command line args
|
|
|
|
qtConfigArgs.applySettings();
|
2015-08-25 19:14:49 +02:00
|
|
|
LOAD_QT_TRANSLATIONS;
|
2015-04-22 19:30:09 +02:00
|
|
|
QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
|
|
|
|
// init widgets GUI
|
|
|
|
QtGui::MainWindow w;
|
|
|
|
w.show();
|
|
|
|
if(!file.isEmpty()) {
|
|
|
|
w.openFile(file);
|
|
|
|
}
|
|
|
|
// start event loop
|
|
|
|
int res = a.exec();
|
|
|
|
// cleanup resources
|
|
|
|
QtUtilitiesResources::cleanup();
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|