2019-12-31 06:17:17 +00:00
|
|
|
#pragma once
|
|
|
|
#include <QtCore/QThread>
|
|
|
|
#include <QtWidgets/QLabel>
|
|
|
|
#include <QtWidgets/QMainWindow>
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
#include "settingsdialog.h"
|
|
|
|
#include "ui_mainwindow.h"
|
|
|
|
|
2020-01-24 04:49:47 +00:00
|
|
|
class QLabel;
|
2020-02-15 15:14:28 +00:00
|
|
|
class QThread;
|
2020-01-24 04:49:47 +00:00
|
|
|
|
2019-12-31 06:17:17 +00:00
|
|
|
class GameListWidget;
|
|
|
|
class QtHostInterface;
|
2020-03-12 03:53:51 +00:00
|
|
|
class QtDisplayWidget;
|
2020-08-06 12:08:22 +00:00
|
|
|
class AutoUpdaterDialog;
|
2020-09-18 14:28:07 +00:00
|
|
|
class MemoryCardEditorDialog;
|
2020-10-19 15:14:49 +00:00
|
|
|
class CheatManagerDialog;
|
2019-12-31 06:17:17 +00:00
|
|
|
|
2020-06-29 16:46:57 +00:00
|
|
|
class HostDisplay;
|
2020-03-02 01:08:16 +00:00
|
|
|
struct GameListEntry;
|
|
|
|
|
2020-01-24 04:50:56 +00:00
|
|
|
class MainWindow final : public QMainWindow
|
2019-12-31 06:17:17 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit MainWindow(QtHostInterface* host_interface);
|
|
|
|
~MainWindow();
|
|
|
|
|
2020-08-06 12:08:22 +00:00
|
|
|
/// Performs update check if enabled in settings.
|
|
|
|
void startupUpdateCheck();
|
|
|
|
|
2020-08-18 14:01:57 +00:00
|
|
|
public Q_SLOTS:
|
|
|
|
/// Updates debug menu visibility (hides if disabled).
|
|
|
|
void updateDebugMenuVisibility();
|
|
|
|
|
2020-01-06 06:27:39 +00:00
|
|
|
private Q_SLOTS:
|
2020-02-15 15:14:30 +00:00
|
|
|
void reportError(const QString& message);
|
|
|
|
void reportMessage(const QString& message);
|
2020-02-26 09:25:57 +00:00
|
|
|
bool confirmMessage(const QString& message);
|
2020-06-29 16:46:57 +00:00
|
|
|
QtDisplayWidget* createDisplay(QThread* worker_thread, const QString& adapter_name, bool use_debug_device,
|
|
|
|
bool fullscreen, bool render_to_main);
|
|
|
|
QtDisplayWidget* updateDisplay(QThread* worker_thread, bool fullscreen, bool render_to_main);
|
2020-04-22 11:13:51 +00:00
|
|
|
void destroyDisplay();
|
2020-02-26 09:26:14 +00:00
|
|
|
void focusDisplayWidget();
|
2020-06-05 17:44:57 +00:00
|
|
|
|
2020-06-24 15:31:23 +00:00
|
|
|
void setTheme(const QString& theme);
|
|
|
|
void updateTheme();
|
|
|
|
|
2020-06-05 17:44:57 +00:00
|
|
|
void onEmulationStarting();
|
2019-12-31 06:17:17 +00:00
|
|
|
void onEmulationStarted();
|
|
|
|
void onEmulationStopped();
|
|
|
|
void onEmulationPaused(bool paused);
|
2020-02-15 15:15:18 +00:00
|
|
|
void onStateSaved(const QString& game_code, bool global, qint32 slot);
|
2020-02-09 13:16:25 +00:00
|
|
|
void onSystemPerformanceCountersUpdated(float speed, float fps, float vps, float average_frame_time,
|
|
|
|
float worst_frame_time);
|
2020-02-15 15:14:30 +00:00
|
|
|
void onRunningGameChanged(const QString& filename, const QString& game_code, const QString& game_title);
|
2019-12-31 06:17:17 +00:00
|
|
|
|
|
|
|
void onStartDiscActionTriggered();
|
2020-03-02 01:08:16 +00:00
|
|
|
void onStartBIOSActionTriggered();
|
2020-01-24 04:50:40 +00:00
|
|
|
void onChangeDiscFromFileActionTriggered();
|
|
|
|
void onChangeDiscFromGameListActionTriggered();
|
2020-08-15 10:39:11 +00:00
|
|
|
void onChangeDiscFromPlaylistMenuAboutToShow();
|
|
|
|
void onChangeDiscFromPlaylistMenuAboutToHide();
|
2020-09-09 13:44:21 +00:00
|
|
|
void onCheatsMenuAboutToShow();
|
2020-05-19 16:32:19 +00:00
|
|
|
void onRemoveDiscActionTriggered();
|
2020-08-20 13:39:29 +00:00
|
|
|
void onViewToolbarActionToggled(bool checked);
|
|
|
|
void onViewStatusBarActionToggled(bool checked);
|
|
|
|
void onViewGameListActionTriggered();
|
2020-09-23 14:02:13 +00:00
|
|
|
void onViewGameGridActionTriggered();
|
2020-08-20 13:39:29 +00:00
|
|
|
void onViewSystemDisplayTriggered();
|
2020-10-13 13:20:50 +00:00
|
|
|
void onViewGamePropertiesActionTriggered();
|
2019-12-31 06:17:17 +00:00
|
|
|
void onGitHubRepositoryActionTriggered();
|
|
|
|
void onIssueTrackerActionTriggered();
|
2020-04-07 03:54:20 +00:00
|
|
|
void onDiscordServerActionTriggered();
|
2019-12-31 06:17:17 +00:00
|
|
|
void onAboutActionTriggered();
|
2020-09-14 08:25:51 +00:00
|
|
|
void onCheckForUpdatesActionTriggered();
|
2020-09-18 14:28:07 +00:00
|
|
|
void onToolsMemoryCardEditorTriggered();
|
2020-10-19 15:14:49 +00:00
|
|
|
void onToolsCheatManagerTriggered();
|
2020-09-23 14:19:54 +00:00
|
|
|
void onToolsOpenDataDirectoryTriggered();
|
2019-12-31 06:17:17 +00:00
|
|
|
|
2020-03-02 01:08:16 +00:00
|
|
|
void onGameListEntrySelected(const GameListEntry* entry);
|
|
|
|
void onGameListEntryDoubleClicked(const GameListEntry* entry);
|
|
|
|
void onGameListContextMenuRequested(const QPoint& point, const GameListEntry* entry);
|
2020-10-03 13:20:48 +00:00
|
|
|
void onGameListSetCoverImageRequested(const GameListEntry* entry);
|
2020-03-02 01:08:16 +00:00
|
|
|
|
2020-08-06 12:08:22 +00:00
|
|
|
void checkForUpdates(bool display_message);
|
|
|
|
void onUpdateCheckComplete();
|
|
|
|
|
2020-01-24 04:50:56 +00:00
|
|
|
protected:
|
|
|
|
void closeEvent(QCloseEvent* event) override;
|
2020-03-22 11:50:49 +00:00
|
|
|
void changeEvent(QEvent* event) override;
|
2020-01-24 04:50:56 +00:00
|
|
|
|
2019-12-31 06:17:17 +00:00
|
|
|
private:
|
|
|
|
void setupAdditionalUi();
|
|
|
|
void connectSignals();
|
2020-06-24 15:31:23 +00:00
|
|
|
void addThemeToMenu(const QString& name, const QString& key);
|
2019-12-31 06:17:17 +00:00
|
|
|
void updateEmulationActions(bool starting, bool running);
|
2020-09-23 14:02:13 +00:00
|
|
|
bool isShowingGameList() const;
|
2019-12-31 06:17:17 +00:00
|
|
|
void switchToGameListView();
|
|
|
|
void switchToEmulationView();
|
2020-09-14 07:58:04 +00:00
|
|
|
void saveStateToConfig();
|
|
|
|
void restoreStateFromConfig();
|
2020-10-03 02:10:11 +00:00
|
|
|
void saveDisplayWindowGeometryToConfig();
|
|
|
|
void restoreDisplayWindowGeometryFromConfig();
|
2020-06-29 16:46:57 +00:00
|
|
|
void destroyDisplayWidget();
|
2020-01-24 04:50:53 +00:00
|
|
|
SettingsDialog* getSettingsDialog();
|
2019-12-31 06:17:17 +00:00
|
|
|
void doSettings(SettingsDialog::Category category = SettingsDialog::Category::Count);
|
2020-02-05 08:43:25 +00:00
|
|
|
void updateDebugMenuCPUExecutionMode();
|
2020-01-24 04:49:51 +00:00
|
|
|
void updateDebugMenuGPURenderer();
|
2020-10-09 07:52:05 +00:00
|
|
|
void updateDebugMenuCropMode();
|
2019-12-31 06:17:17 +00:00
|
|
|
|
|
|
|
Ui::MainWindow m_ui;
|
|
|
|
|
2020-07-04 05:54:26 +00:00
|
|
|
QString m_unthemed_style_name;
|
|
|
|
|
2019-12-31 06:17:17 +00:00
|
|
|
QtHostInterface* m_host_interface = nullptr;
|
|
|
|
|
|
|
|
GameListWidget* m_game_list_widget = nullptr;
|
2020-04-22 11:13:51 +00:00
|
|
|
|
2020-06-29 16:46:57 +00:00
|
|
|
HostDisplay* m_host_display = nullptr;
|
2020-03-12 03:53:51 +00:00
|
|
|
QtDisplayWidget* m_display_widget = nullptr;
|
2019-12-31 06:17:17 +00:00
|
|
|
|
2020-01-24 04:49:47 +00:00
|
|
|
QLabel* m_status_speed_widget = nullptr;
|
|
|
|
QLabel* m_status_fps_widget = nullptr;
|
|
|
|
QLabel* m_status_frame_time_widget = nullptr;
|
|
|
|
|
2019-12-31 06:17:17 +00:00
|
|
|
SettingsDialog* m_settings_dialog = nullptr;
|
2020-08-06 12:08:22 +00:00
|
|
|
AutoUpdaterDialog* m_auto_updater_dialog = nullptr;
|
2020-09-18 14:28:07 +00:00
|
|
|
MemoryCardEditorDialog* m_memory_card_editor_dialog = nullptr;
|
2020-10-19 15:14:49 +00:00
|
|
|
CheatManagerDialog* m_cheat_manager_dialog = nullptr;
|
2019-12-31 06:17:17 +00:00
|
|
|
|
|
|
|
bool m_emulation_running = false;
|
|
|
|
};
|