2011-04-08 00:04:09 +02:00
|
|
|
#ifndef MAINDIALOG_H
|
|
|
|
#define MAINDIALOG_H
|
|
|
|
|
2012-06-20 02:28:49 +02:00
|
|
|
#include <QMainWindow>
|
2014-05-29 17:57:41 +02:00
|
|
|
#include <QProcess>
|
|
|
|
|
2013-04-02 21:32:23 +02:00
|
|
|
#ifndef Q_MOC_RUN
|
2012-01-21 01:14:35 +01:00
|
|
|
#include <components/files/configurationmanager.hpp>
|
2013-04-02 21:32:23 +02:00
|
|
|
#endif
|
2014-04-18 13:17:37 +02:00
|
|
|
|
|
|
|
#include <components/process/processinvoker.hpp>
|
|
|
|
|
2013-12-25 00:50:25 +01:00
|
|
|
#include <components/config/gamesettings.hpp>
|
|
|
|
#include <components/config/launchersettings.hpp>
|
|
|
|
|
2013-02-20 19:27:04 +01:00
|
|
|
#include "settings/graphicssettings.hpp"
|
|
|
|
|
2013-03-03 00:48:09 +01:00
|
|
|
#include "ui_mainwindow.h"
|
|
|
|
|
2011-04-08 00:04:09 +02:00
|
|
|
class QListWidgetItem;
|
2014-01-27 20:14:02 +01:00
|
|
|
class QStackedWidget;
|
|
|
|
class QStringList;
|
|
|
|
class QStringListModel;
|
|
|
|
class QString;
|
2011-04-08 00:04:09 +02:00
|
|
|
|
2013-10-25 11:17:26 -05:00
|
|
|
namespace Launcher
|
2011-04-08 00:04:09 +02:00
|
|
|
{
|
2013-10-25 11:17:26 -05:00
|
|
|
class PlayPage;
|
|
|
|
class GraphicsPage;
|
|
|
|
class DataFilesPage;
|
|
|
|
class UnshieldThread;
|
2014-01-27 20:14:02 +01:00
|
|
|
class SettingsPage;
|
2013-10-25 11:17:26 -05:00
|
|
|
|
2015-05-17 10:38:15 +02:00
|
|
|
enum FirstRunDialogResult
|
|
|
|
{
|
2015-05-16 13:18:04 +03:00
|
|
|
FirstRunDialogResultFailure,
|
|
|
|
FirstRunDialogResultContinue,
|
|
|
|
FirstRunDialogResultWizard
|
2015-05-17 10:38:15 +02:00
|
|
|
};
|
2015-05-16 13:18:04 +03:00
|
|
|
|
2013-10-25 11:17:26 -05:00
|
|
|
#ifndef WIN32
|
|
|
|
bool expansions(Launcher::UnshieldThread& cd);
|
|
|
|
#endif
|
2011-04-08 00:04:09 +02:00
|
|
|
|
2013-10-25 11:17:26 -05:00
|
|
|
class MainDialog : public QMainWindow, private Ui::MainWindow
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2011-04-08 00:04:09 +02:00
|
|
|
|
2013-10-25 11:17:26 -05:00
|
|
|
public:
|
|
|
|
explicit MainDialog(QWidget *parent = 0);
|
2014-04-18 13:17:37 +02:00
|
|
|
~MainDialog();
|
|
|
|
|
2013-10-25 11:17:26 -05:00
|
|
|
bool setup();
|
2015-05-16 13:18:04 +03:00
|
|
|
FirstRunDialogResult showFirstRunDialog();
|
2011-04-24 23:03:21 +02:00
|
|
|
|
2014-04-16 16:54:55 +02:00
|
|
|
bool reloadSettings();
|
|
|
|
bool writeSettings();
|
|
|
|
|
2013-10-25 11:17:26 -05:00
|
|
|
public slots:
|
|
|
|
void changePage(QListWidgetItem *current, QListWidgetItem *previous);
|
|
|
|
void play();
|
2013-02-11 15:01:00 +01:00
|
|
|
|
2014-05-29 17:57:41 +02:00
|
|
|
private slots:
|
|
|
|
void wizardStarted();
|
|
|
|
void wizardFinished(int exitCode, QProcess::ExitStatus exitStatus);
|
|
|
|
|
2013-10-25 11:17:26 -05:00
|
|
|
private:
|
|
|
|
void createIcons();
|
|
|
|
void createPages();
|
2013-02-20 19:27:04 +01:00
|
|
|
|
2013-10-25 11:17:26 -05:00
|
|
|
bool setupLauncherSettings();
|
|
|
|
bool setupGameSettings();
|
|
|
|
bool setupGraphicsSettings();
|
2013-02-11 15:01:00 +01:00
|
|
|
|
2013-10-25 11:17:26 -05:00
|
|
|
void loadSettings();
|
|
|
|
void saveSettings();
|
2013-02-20 19:27:04 +01:00
|
|
|
|
2013-10-25 11:17:26 -05:00
|
|
|
inline bool startProgram(const QString &name, bool detached = false) { return startProgram(name, QStringList(), detached); }
|
|
|
|
bool startProgram(const QString &name, const QStringList &arguments, bool detached = false);
|
2011-04-08 00:04:09 +02:00
|
|
|
|
2013-10-25 11:17:26 -05:00
|
|
|
void closeEvent(QCloseEvent *event);
|
2011-05-02 22:21:42 +02:00
|
|
|
|
2013-10-25 11:17:26 -05:00
|
|
|
PlayPage *mPlayPage;
|
|
|
|
GraphicsPage *mGraphicsPage;
|
|
|
|
DataFilesPage *mDataFilesPage;
|
2014-01-27 20:14:02 +01:00
|
|
|
SettingsPage *mSettingsPage;
|
|
|
|
|
2014-04-18 13:17:37 +02:00
|
|
|
Process::ProcessInvoker *mGameInvoker;
|
2014-05-29 17:57:41 +02:00
|
|
|
Process::ProcessInvoker *mWizardInvoker;
|
2013-01-27 16:39:51 +01:00
|
|
|
|
2013-10-25 11:17:26 -05:00
|
|
|
Files::ConfigurationManager mCfgMgr;
|
2013-01-27 16:39:51 +01:00
|
|
|
|
2013-12-25 00:50:25 +01:00
|
|
|
Config::GameSettings mGameSettings;
|
2013-10-25 11:17:26 -05:00
|
|
|
GraphicsSettings mGraphicsSettings;
|
2013-12-25 00:50:25 +01:00
|
|
|
Config::LauncherSettings mLauncherSettings;
|
2011-04-08 00:04:09 +02:00
|
|
|
|
2013-10-25 11:17:26 -05:00
|
|
|
};
|
|
|
|
}
|
2011-04-08 00:04:09 +02:00
|
|
|
#endif
|