1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
|
#ifndef MAINDIALOG_H
#define MAINDIALOG_H
#ifndef Q_MOC_RUN
#include <components/process/processinvoker.hpp>
#include <components/config/gamesettings.hpp>
#include <components/config/launchersettings.hpp>
#endif
#include "ui_mainwindow.h"
class QListWidgetItem;
class QStackedWidget;
class QStringListModel;
class QString;
namespace Files
{
struct ConfigurationManager;
}
namespace Launcher
{
class GraphicsPage;
class DataFilesPage;
class UnshieldThread;
class ImportPage;
class SettingsPage;
enum FirstRunDialogResult
{
FirstRunDialogResultFailure,
FirstRunDialogResultContinue,
FirstRunDialogResultWizard
};
#ifndef WIN32
bool expansions(Launcher::UnshieldThread& cd);
#endif
class MainDialog : public QMainWindow, private Ui::MainWindow
{
Q_OBJECT
public:
explicit MainDialog(const Files::ConfigurationManager& configurationManager, QWidget* parent = nullptr);
~MainDialog() override;
FirstRunDialogResult showFirstRunDialog();
bool reloadSettings();
bool writeSettings();
public slots:
void enableDataPage();
void enableGraphicsPage();
void enableSettingsPage();
void enableImportPage();
void play();
void help();
protected:
bool event(QEvent* event) override;
private slots:
void wizardStarted();
void wizardFinished(int exitCode, QProcess::ExitStatus exitStatus);
private:
bool setup();
void createIcons();
void createPages();
bool setupLauncherSettings();
bool setupGameSettings();
bool setupGraphicsSettings();
bool setupGameData();
void setVersionLabel();
void loadSettings();
void saveSettings();
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);
void closeEvent(QCloseEvent* event) override;
GraphicsPage* mGraphicsPage;
DataFilesPage* mDataFilesPage;
ImportPage* mImportPage;
SettingsPage* mSettingsPage;
Process::ProcessInvoker* mGameInvoker;
Process::ProcessInvoker* mWizardInvoker;
const Files::ConfigurationManager& mCfgMgr;
Config::GameSettings mGameSettings;
Config::LauncherSettings mLauncherSettings;
};
}
#endif
|