2011-04-07 22:04:09 +00:00
|
|
|
#ifndef MAINDIALOG_H
|
|
|
|
#define MAINDIALOG_H
|
|
|
|
|
2013-04-02 19:32:23 +00:00
|
|
|
#ifndef Q_MOC_RUN
|
2014-04-18 11:17:37 +00:00
|
|
|
#include <components/process/processinvoker.hpp>
|
|
|
|
|
2013-12-24 23:50:25 +00:00
|
|
|
#include <components/config/gamesettings.hpp>
|
|
|
|
#include <components/config/launchersettings.hpp>
|
|
|
|
|
2018-12-01 20:27:43 +00:00
|
|
|
#endif
|
2013-03-02 23:48:09 +00:00
|
|
|
#include "ui_mainwindow.h"
|
|
|
|
|
2011-04-07 22:04:09 +00:00
|
|
|
class QListWidgetItem;
|
2014-01-27 19:14:02 +00:00
|
|
|
class QStackedWidget;
|
|
|
|
class QStringListModel;
|
|
|
|
class QString;
|
2011-04-07 22:04:09 +00:00
|
|
|
|
2023-03-21 20:27:25 +00:00
|
|
|
namespace Files
|
|
|
|
{
|
|
|
|
struct ConfigurationManager;
|
|
|
|
}
|
|
|
|
|
2013-10-25 16:17:26 +00:00
|
|
|
namespace Launcher
|
2011-04-07 22:04:09 +00:00
|
|
|
{
|
2013-10-25 16:17:26 +00:00
|
|
|
class GraphicsPage;
|
|
|
|
class DataFilesPage;
|
|
|
|
class UnshieldThread;
|
2023-01-06 19:01:50 +00:00
|
|
|
class ImportPage;
|
2014-01-27 19:14:02 +00:00
|
|
|
class SettingsPage;
|
2013-10-25 16:17:26 +00:00
|
|
|
|
2015-05-17 08:38:15 +00:00
|
|
|
enum FirstRunDialogResult
|
|
|
|
{
|
2015-05-16 10:18:04 +00:00
|
|
|
FirstRunDialogResultFailure,
|
|
|
|
FirstRunDialogResultContinue,
|
|
|
|
FirstRunDialogResultWizard
|
2015-05-17 08:38:15 +00:00
|
|
|
};
|
2015-05-16 10:18:04 +00:00
|
|
|
|
2013-10-25 16:17:26 +00:00
|
|
|
#ifndef WIN32
|
|
|
|
bool expansions(Launcher::UnshieldThread& cd);
|
|
|
|
#endif
|
2011-04-07 22:04:09 +00:00
|
|
|
|
2013-10-25 16:17:26 +00:00
|
|
|
class MainDialog : public QMainWindow, private Ui::MainWindow
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2011-04-07 22:04:09 +00:00
|
|
|
|
2013-10-25 16:17:26 +00:00
|
|
|
public:
|
2023-03-21 20:27:25 +00:00
|
|
|
explicit MainDialog(const Files::ConfigurationManager& configurationManager, QWidget* parent = nullptr);
|
2021-05-19 00:42:24 +00:00
|
|
|
~MainDialog() override;
|
2014-04-18 11:17:37 +00:00
|
|
|
|
2015-05-16 10:18:04 +00:00
|
|
|
FirstRunDialogResult showFirstRunDialog();
|
2011-04-24 21:03:21 +00:00
|
|
|
|
2014-04-16 14:54:55 +00:00
|
|
|
bool reloadSettings();
|
|
|
|
bool writeSettings();
|
|
|
|
|
2013-10-25 16:17:26 +00:00
|
|
|
public slots:
|
2023-01-06 19:01:50 +00:00
|
|
|
void enableDataPage();
|
|
|
|
void enableGraphicsPage();
|
|
|
|
void enableSettingsPage();
|
|
|
|
void enableImportPage();
|
2013-10-25 16:17:26 +00:00
|
|
|
void play();
|
2020-04-18 20:54:21 +00:00
|
|
|
void help();
|
2013-02-11 14:01:00 +00:00
|
|
|
|
2024-05-12 08:40:19 +00:00
|
|
|
protected:
|
|
|
|
bool event(QEvent* event) override;
|
|
|
|
|
2014-05-29 15:57:41 +00:00
|
|
|
private slots:
|
|
|
|
void wizardStarted();
|
|
|
|
void wizardFinished(int exitCode, QProcess::ExitStatus exitStatus);
|
|
|
|
|
2013-10-25 16:17:26 +00:00
|
|
|
private:
|
2016-01-16 11:43:45 +00:00
|
|
|
bool setup();
|
|
|
|
|
2013-10-25 16:17:26 +00:00
|
|
|
void createIcons();
|
|
|
|
void createPages();
|
2013-02-20 18:27:04 +00:00
|
|
|
|
2013-10-25 16:17:26 +00:00
|
|
|
bool setupLauncherSettings();
|
|
|
|
bool setupGameSettings();
|
|
|
|
bool setupGraphicsSettings();
|
2017-08-03 21:15:26 +00:00
|
|
|
bool setupGameData();
|
2013-02-11 14:01:00 +00:00
|
|
|
|
2015-07-18 01:01:06 +00:00
|
|
|
void setVersionLabel();
|
|
|
|
|
2013-10-25 16:17:26 +00:00
|
|
|
void loadSettings();
|
|
|
|
void saveSettings();
|
2013-02-20 18:27:04 +00:00
|
|
|
|
2013-10-25 16:17:26 +00: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-07 22:04:09 +00:00
|
|
|
|
2020-10-16 18:18:54 +00:00
|
|
|
void closeEvent(QCloseEvent* event) override;
|
2011-05-02 20:21:42 +00:00
|
|
|
|
2013-10-25 16:17:26 +00:00
|
|
|
GraphicsPage* mGraphicsPage;
|
|
|
|
DataFilesPage* mDataFilesPage;
|
2023-01-06 19:01:50 +00:00
|
|
|
ImportPage* mImportPage;
|
2014-01-27 19:14:02 +00:00
|
|
|
SettingsPage* mSettingsPage;
|
|
|
|
|
2014-04-18 11:17:37 +00:00
|
|
|
Process::ProcessInvoker* mGameInvoker;
|
2014-05-29 15:57:41 +00:00
|
|
|
Process::ProcessInvoker* mWizardInvoker;
|
2013-01-27 15:39:51 +00:00
|
|
|
|
2023-03-21 20:27:25 +00:00
|
|
|
const Files::ConfigurationManager& mCfgMgr;
|
2013-01-27 15:39:51 +00:00
|
|
|
|
2013-12-24 23:50:25 +00:00
|
|
|
Config::GameSettings mGameSettings;
|
|
|
|
Config::LauncherSettings mLauncherSettings;
|
2013-10-25 16:17:26 +00:00
|
|
|
};
|
|
|
|
}
|
2011-04-07 22:04:09 +00:00
|
|
|
#endif
|