metaforce/metaforce-gui/MainWindow.hpp

83 lines
2.1 KiB
C++
Raw Normal View History

2018-10-07 03:41:18 +00:00
#pragma once
2017-12-06 03:31:43 +00:00
#include <memory>
2017-12-06 03:31:43 +00:00
#include <QMainWindow>
#include <QProcess>
2018-01-03 23:53:01 +00:00
#include <QTextCursor>
#include <QCheckBox>
#include <QComboBox>
#include <QRadioButton>
#include "Common.hpp"
#include "DownloadManager.hpp"
#include <hecl/CVarCommons.hpp>
#include <hecl/Runtime.hpp>
class QPushButton;
class QTextCharFormat;
class QTextEdit;
2018-01-10 06:19:48 +00:00
class QuaZip;
2017-12-06 03:31:43 +00:00
namespace Ui {
class MainWindow;
} // namespace Ui
2017-12-06 03:31:43 +00:00
2018-12-08 05:19:40 +00:00
class MainWindow : public QMainWindow {
2019-06-29 18:02:33 +00:00
static const QStringList skUpdateTracks;
2018-12-08 05:19:40 +00:00
Q_OBJECT
std::unique_ptr<Ui::MainWindow> m_ui;
2018-12-08 05:19:40 +00:00
hecl::Runtime::FileStoreManager m_fileMgr;
hecl::CVarManager m_cvarManager;
hecl::CVarCommons m_cvarCommons;
QTextCursor m_cursor;
QString m_path;
2021-04-10 08:42:06 +00:00
QString m_metaforcePath;
2018-12-08 05:19:40 +00:00
QString m_heclPath;
QString m_blenderOverridePath;
2018-12-08 05:19:40 +00:00
QProcess m_heclProc;
DownloadManager m_dlManager;
QStringList m_warpSettings;
2018-12-08 05:19:40 +00:00
QSettings m_settings;
2021-04-10 08:42:06 +00:00
MetaforceVersion m_recommendedVersion;
2018-12-08 05:19:40 +00:00
bool m_inContinueNote = false;
QStringListModel m_launchOptionsModel;
2018-12-08 05:19:40 +00:00
2017-12-06 03:31:43 +00:00
public:
explicit MainWindow(QWidget* parent = nullptr);
2019-08-30 07:40:25 +00:00
~MainWindow() override;
2018-12-08 05:19:40 +00:00
void setTextTermFormatting(const QString& text);
void insertContinueNote(const QString& text);
2019-08-30 07:40:25 +00:00
2017-12-06 03:31:43 +00:00
private slots:
2018-12-08 05:19:40 +00:00
void onExtract();
2019-08-26 03:19:55 +00:00
void onExtractFinished(int exitCode, QProcess::ExitStatus);
2018-12-08 05:19:40 +00:00
void onPackage();
2019-08-26 03:19:55 +00:00
void onPackageFinished(int exitCode, QProcess::ExitStatus);
2018-12-08 05:19:40 +00:00
void onLaunch();
2019-08-26 03:19:55 +00:00
void onLaunchFinished(int exitCode, QProcess::ExitStatus);
2018-12-08 05:19:40 +00:00
void doHECLTerminate();
void onReturnPressed();
void onDownloadPressed();
// void onUpdateURDEPressed();
2019-06-29 18:02:33 +00:00
void onUpdateTrackChanged(int index);
2018-12-08 05:19:40 +00:00
2017-12-06 03:31:43 +00:00
private:
2018-12-08 05:19:40 +00:00
bool checkDownloadedBinary();
void setPath(const QString& path);
void initSlots();
void onIndexDownloaded(const QStringList& index);
void onBinaryDownloaded(QuaZip& file);
void onBinaryFailed();
void disableOperations();
void enableOperations();
bool isPackageComplete() const;
void initOptions();
void initGraphicsApiOption(QRadioButton* action, bool hidden, bool isDefault);
void initNumberComboOption(QComboBox* action, hecl::CVar* cvar);
void initCheckboxOption(QCheckBox* action, hecl::CVar* cvar);
void setBlenderOverride(const QString& path);
2017-12-06 03:31:43 +00:00
};