2015-09-06 20:20:00 +02:00
|
|
|
#include "./initiate.h"
|
|
|
|
#include "./mainwindow.h"
|
2016-01-14 23:53:28 +01:00
|
|
|
#include "./renamefilesdialog.h"
|
2015-09-01 20:20:15 +02:00
|
|
|
|
2015-09-06 20:20:00 +02:00
|
|
|
#include "../application/settings.h"
|
2015-04-22 19:33:53 +02:00
|
|
|
|
2016-04-24 21:07:36 +02:00
|
|
|
#include "resources/config.h"
|
2015-12-05 22:55:05 +01:00
|
|
|
|
2015-09-01 20:20:15 +02:00
|
|
|
#include <qtutilities/resources/qtconfigarguments.h>
|
2015-04-22 19:33:53 +02:00
|
|
|
#include <qtutilities/resources/resources.h>
|
2016-08-19 16:18:55 +02:00
|
|
|
#include <qtutilities/resources/importplugin.h>
|
2016-08-14 22:49:47 +02:00
|
|
|
#include <qtutilities/settingsdialog/qtsettings.h>
|
2015-04-22 19:33:53 +02:00
|
|
|
|
|
|
|
#include <QApplication>
|
|
|
|
|
2015-09-01 20:20:15 +02:00
|
|
|
using namespace ApplicationUtilities;
|
|
|
|
|
2015-04-22 19:33:53 +02:00
|
|
|
namespace QtGui {
|
|
|
|
|
2016-01-14 23:53:28 +01:00
|
|
|
int runWidgetsGui(int argc, char *argv[], const QtConfigArguments &qtConfigArgs, const QString &path, bool launchRenamingUtility)
|
2015-04-22 19:33:53 +02:00
|
|
|
{
|
2015-08-25 19:09:26 +02:00
|
|
|
SET_QT_APPLICATION_INFO;
|
2015-04-22 19:33:53 +02:00
|
|
|
QApplication a(argc, argv);
|
2016-08-14 22:49:47 +02:00
|
|
|
Settings::restore();
|
|
|
|
// apply settings specified via command line args after the settings chosen in the GUI to give the CLI options precedence
|
2016-10-24 20:15:10 +02:00
|
|
|
Settings::values().qt.apply();
|
|
|
|
qtConfigArgs.applySettings(Settings::values().qt.hasCustomFont());
|
2015-04-22 19:33:53 +02:00
|
|
|
// load resources needed by classes of qtutilities
|
|
|
|
QtUtilitiesResources::init();
|
2015-09-01 20:20:15 +02:00
|
|
|
LOAD_QT_TRANSLATIONS;
|
2016-01-14 23:53:28 +01:00
|
|
|
int res;
|
|
|
|
if(launchRenamingUtility) {
|
|
|
|
RenameFilesDialog w;
|
|
|
|
w.show();
|
|
|
|
res = a.exec();
|
|
|
|
} else {
|
|
|
|
MainWindow w;
|
|
|
|
w.show();
|
|
|
|
if(!path.isEmpty()) {
|
2016-02-29 23:59:46 +01:00
|
|
|
w.startParsing(path);
|
2016-01-14 23:53:28 +01:00
|
|
|
}
|
|
|
|
res = a.exec();
|
2015-07-27 23:26:51 +02:00
|
|
|
}
|
2015-04-22 19:33:53 +02:00
|
|
|
Settings::save();
|
|
|
|
// cleanup resources
|
|
|
|
QtUtilitiesResources::cleanup();
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|