Duckstation/src/duckstation-qt/mainwindow.h

136 lines
4.4 KiB
C
Raw Normal View History

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"
class QLabel;
class QThread;
2019-12-31 06:17:17 +00:00
class GameListWidget;
class QtHostInterface;
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
class HostDisplay;
struct GameListEntry;
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:
void reportError(const QString& message);
void reportMessage(const QString& message);
bool confirmMessage(const QString& message);
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);
void destroyDisplay();
void focusDisplayWidget();
2020-06-24 15:31:23 +00:00
void setTheme(const QString& theme);
void updateTheme();
void onEmulationStarting();
2019-12-31 06:17:17 +00:00
void onEmulationStarted();
void onEmulationStopped();
void onEmulationPaused(bool paused);
void onStateSaved(const QString& game_code, bool global, qint32 slot);
void onSystemPerformanceCountersUpdated(float speed, float fps, float vps, float average_frame_time,
float worst_frame_time);
void onRunningGameChanged(const QString& filename, const QString& game_code, const QString& game_title);
2019-12-31 06:17:17 +00:00
void onStartDiscActionTriggered();
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();
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();
void onViewGamePropertiesActionTriggered();
2019-12-31 06:17:17 +00:00
void onGitHubRepositoryActionTriggered();
void onIssueTrackerActionTriggered();
void onDiscordServerActionTriggered();
2019-12-31 06:17:17 +00:00
void onAboutActionTriggered();
void onCheckForUpdatesActionTriggered();
2020-09-18 14:28:07 +00:00
void onToolsMemoryCardEditorTriggered();
2020-10-19 15:14:49 +00:00
void onToolsCheatManagerTriggered();
void onToolsOpenDataDirectoryTriggered();
2019-12-31 06:17:17 +00:00
void onGameListEntrySelected(const GameListEntry* entry);
void onGameListEntryDoubleClicked(const GameListEntry* entry);
void onGameListContextMenuRequested(const QPoint& point, const GameListEntry* entry);
void onGameListSetCoverImageRequested(const GameListEntry* entry);
2020-08-06 12:08:22 +00:00
void checkForUpdates(bool display_message);
void onUpdateCheckComplete();
protected:
void closeEvent(QCloseEvent* event) override;
void changeEvent(QEvent* event) override;
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();
void saveStateToConfig();
void restoreStateFromConfig();
void saveDisplayWindowGeometryToConfig();
void restoreDisplayWindowGeometryFromConfig();
void destroyDisplayWidget();
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();
void updateDebugMenuCropMode();
2019-12-31 06:17:17 +00:00
Ui::MainWindow m_ui;
QString m_unthemed_style_name;
2019-12-31 06:17:17 +00:00
QtHostInterface* m_host_interface = nullptr;
GameListWidget* m_game_list_widget = nullptr;
HostDisplay* m_host_display = nullptr;
QtDisplayWidget* m_display_widget = nullptr;
2019-12-31 06:17:17 +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;
};