videodownloader/gui/initiate.cpp

47 lines
1.3 KiB
C++
Raw Normal View History

2015-09-08 17:05:59 +02:00
#include "./initiate.h"
#include "./mainwindow.h"
2017-05-01 03:22:50 +02:00
#include "./settings.h"
2015-12-08 08:41:06 +01:00
#include "resources/config.h"
2015-12-05 22:56:32 +01:00
2017-05-01 03:22:50 +02:00
#include <qtutilities/resources/importplugin.h>
2015-09-01 20:12:37 +02:00
#include <qtutilities/resources/qtconfigarguments.h>
#include <qtutilities/resources/resources.h>
2016-08-14 22:52:15 +02:00
#include <qtutilities/settingsdialog/qtsettings.h>
#if defined(VIDEODOWNLOADER_GUI_QTWIDGETS)
2017-05-01 03:22:50 +02:00
#include <QApplication>
#elif defined(VIDEODOWNLOADER_GUI_QTQUICK)
2017-05-01 03:22:50 +02:00
#include <QGuiApplication>
#endif
using namespace std;
2019-06-10 22:50:15 +02:00
using namespace CppUtilities;
using namespace QtUtilities;
namespace QtGui {
2015-09-01 20:12:37 +02:00
int runWidgetsGui(int argc, char *argv[], const QtConfigArguments &qtConfigArgs)
{
#ifdef VIDEODOWNLOADER_GUI_QTWIDGETS
2015-09-01 20:12:37 +02:00
SET_QT_APPLICATION_INFO;
QApplication a(argc, argv);
2016-08-14 22:52:15 +02:00
restoreSettings();
// apply settings specified via command line args after the settings chosen in the GUI to give the CLI options precedence
qtSettings().apply();
qtConfigArgs.applySettings(qtSettings().hasCustomFont());
2015-09-01 20:12:37 +02:00
// load resources needed by classes of qtutilities
QtUtilitiesResources::init();
2016-08-14 22:52:15 +02:00
MainWindow w;
2015-09-01 20:12:37 +02:00
w.show();
int r = a.exec();
2016-08-14 22:52:15 +02:00
saveSettings();
2015-09-01 20:12:37 +02:00
return r;
#else
2015-09-08 17:05:59 +02:00
CMD_UTILS_START_CONSOLE;
2015-09-01 20:12:37 +02:00
cout << "Application has not been build with Qt widgets GUI support." << endl;
return 0;
#endif
}
2019-07-20 20:20:58 +02:00
} // namespace QtGui