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-06-24 00:54:58 +02:00
|
|
|
|
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>
|
2015-06-24 00:54:58 +02:00
|
|
|
#include <qtutilities/resources/resources.h>
|
2016-08-14 22:52:15 +02:00
|
|
|
#include <qtutilities/settingsdialog/qtsettings.h>
|
2015-06-24 00:54:58 +02:00
|
|
|
|
2017-04-27 22:20:06 +02:00
|
|
|
#if defined(VIDEODOWNLOADER_GUI_QTWIDGETS)
|
2017-05-01 03:22:50 +02:00
|
|
|
#include <QApplication>
|
2017-04-27 22:20:06 +02:00
|
|
|
#elif defined(VIDEODOWNLOADER_GUI_QTQUICK)
|
2017-05-01 03:22:50 +02:00
|
|
|
#include <QGuiApplication>
|
2015-06-24 00:54:58 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
using namespace std;
|
2019-06-10 22:50:15 +02:00
|
|
|
using namespace CppUtilities;
|
|
|
|
using namespace QtUtilities;
|
2015-06-24 00:54:58 +02:00
|
|
|
|
|
|
|
namespace QtGui {
|
|
|
|
|
2015-09-01 20:12:37 +02:00
|
|
|
int runWidgetsGui(int argc, char *argv[], const QtConfigArguments &qtConfigArgs)
|
2015-06-24 00:54:58 +02:00
|
|
|
{
|
2017-04-27 22:20:06 +02:00
|
|
|
#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;
|
2015-06-24 00:54:58 +02:00
|
|
|
#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;
|
2015-06-24 00:54:58 +02:00
|
|
|
#endif
|
|
|
|
}
|
2019-07-20 20:20:58 +02:00
|
|
|
} // namespace QtGui
|