dolphin/Source/Core/DolphinQt/MainWindow.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

275 lines
7.1 KiB
C
Raw Normal View History

2015-11-27 08:33:07 +00:00
// Copyright 2015 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
2015-11-27 08:33:07 +00:00
#pragma once
#include <QMainWindow>
2018-11-05 18:20:45 +00:00
#include <QStringList>
2015-11-27 08:33:07 +00:00
#include <array>
#include <memory>
#include <optional>
#include <string>
#include "Core/Boot/Boot.h"
class QMenu;
class QStackedWidget;
class QString;
2018-03-24 01:13:56 +00:00
class AchievementsWindow;
class BreakpointWidget;
struct BootParameters;
2018-03-26 02:17:47 +00:00
class CheatsManager;
2018-02-14 22:25:01 +00:00
class CodeWidget;
2018-03-24 01:13:56 +00:00
class ControllersWindow;
2018-07-03 21:50:08 +00:00
class DiscordHandler;
2018-03-24 01:13:56 +00:00
class DragEnterEvent;
2017-08-30 14:44:28 +00:00
class FIFOPlayerWindow;
class FreeLookWindow;
class GameList;
class GBATASInputWindow;
2018-03-24 01:13:56 +00:00
class GCTASInputWindow;
class GraphicsWindow;
class HotkeyScheduler;
class InfinityBaseWindow;
2018-04-09 13:31:20 +00:00
class JITWidget;
class LogConfigWidget;
class LogWidget;
class MappingWindow;
2018-03-16 11:39:53 +00:00
class MemoryWidget;
class MenuBar;
2017-07-21 20:48:21 +00:00
class NetPlayDialog;
class NetPlaySetupDialog;
class NetworkWidget;
2018-03-24 01:13:56 +00:00
class RegisterWidget;
class RenderWidget;
2018-03-21 10:13:53 +00:00
class SearchBar;
class SettingsWindow;
class SkylanderPortalWindow;
class ThreadWidget;
class ToolBar;
2017-09-27 06:53:05 +00:00
class WatchWidget;
2018-01-31 11:35:09 +00:00
class WiiTASInputWindow;
struct WindowSystemInfo;
2016-02-10 04:42:06 +00:00
namespace DiscIO
{
enum class Region;
}
2018-11-05 18:20:45 +00:00
namespace UICommon
{
class GameFile;
}
namespace X11Utils
{
class XRRConfiguration;
}
2015-11-27 08:33:07 +00:00
class MainWindow final : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(std::unique_ptr<BootParameters> boot_parameters,
const std::string& movie_path);
2016-02-15 01:04:16 +00:00
~MainWindow();
2015-11-27 08:33:07 +00:00
void Show();
WindowSystemInfo GetWindowSystemInfo() const;
2017-06-24 15:00:37 +00:00
bool eventFilter(QObject* object, QEvent* event) override;
QMenu* createPopupMenu() override;
2017-06-24 15:00:37 +00:00
2015-11-27 08:33:07 +00:00
signals:
2017-08-27 11:55:05 +00:00
void ReadOnlyModeChanged(bool read_only);
void RecordingStatusChanged(bool recording);
2015-11-27 08:33:07 +00:00
private:
2015-11-27 08:33:07 +00:00
void Open();
2018-06-04 19:44:46 +00:00
void RefreshGameList();
void Play(const std::optional<std::string>& savestate_path = {});
2015-11-27 08:33:07 +00:00
void Pause();
void TogglePause();
// May ask for confirmation. Returns whether or not it actually stopped.
bool RequestStop();
2015-11-27 08:33:07 +00:00
void ForceStop();
void Reset();
void FrameAdvance();
void StateLoad();
void StateSave();
void StateLoadSlot();
void StateSaveSlot();
void StateLoadSlotAt(int slot);
void StateSaveSlotAt(int slot);
2018-05-17 18:27:14 +00:00
void StateLoadLastSavedAt(int slot);
void StateLoadUndo();
void StateSaveUndo();
void StateSaveOldest();
void SetStateSlot(int slot);
void IncrementSelectedStateSlot();
void DecrementSelectedStateSlot();
2017-07-06 09:01:32 +00:00
void BootWiiSystemMenu();
void PerformOnlineUpdate(const std::string& region);
void SetFullScreenResolution(bool fullscreen);
2015-11-27 08:33:07 +00:00
void FullScreen();
void UnlockCursor();
2015-11-27 08:33:07 +00:00
void ScreenShot();
2016-02-10 04:42:06 +00:00
void CreateComponents();
2016-02-10 04:42:06 +00:00
void ConnectGameList();
2018-03-24 01:13:56 +00:00
void ConnectHost();
void ConnectHotkeys();
2016-02-10 04:42:06 +00:00
void ConnectMenuBar();
void ConnectRenderWidget();
void ConnectStack();
void ConnectToolBar();
2017-05-23 20:12:01 +00:00
void InitControllers();
void ShutdownControllers();
2017-05-23 20:12:01 +00:00
void InitCoreCallbacks();
2018-11-05 18:20:45 +00:00
enum class ScanForSecondDisc
{
Yes,
No,
};
void ScanForSecondDiscAndStartGame(const UICommon::GameFile& game,
std::unique_ptr<BootSessionData> boot_session_data = nullptr);
2018-11-05 18:20:45 +00:00
void StartGame(const QString& path, ScanForSecondDisc scan,
std::unique_ptr<BootSessionData> boot_session_data = nullptr);
2018-11-05 18:20:45 +00:00
void StartGame(const std::string& path, ScanForSecondDisc scan,
std::unique_ptr<BootSessionData> boot_session_data = nullptr);
2018-11-05 18:20:45 +00:00
void StartGame(const std::vector<std::string>& paths,
std::unique_ptr<BootSessionData> boot_session_data = nullptr);
void StartGame(std::unique_ptr<BootParameters>&& parameters);
2015-11-27 08:33:07 +00:00
void ShowRenderWidget();
void HideRenderWidget(bool reinit = true, bool is_exit = false);
void ShowSettingsWindow();
void ShowGeneralWindow();
void ShowAudioWindow();
2017-05-09 16:49:10 +00:00
void ShowControllersWindow();
void ShowGraphicsWindow();
void ShowFreeLookWindow();
void ShowAboutDialog();
void ShowHotkeyDialog();
2017-07-21 20:48:21 +00:00
void ShowNetPlaySetupDialog();
2019-03-30 13:50:57 +00:00
void ShowNetPlayBrowser();
2017-08-30 14:44:28 +00:00
void ShowFIFOPlayer();
void ShowSkylanderPortal();
void ShowInfinityBase();
2018-01-25 18:54:50 +00:00
void ShowMemcardManager();
2018-11-17 15:36:28 +00:00
void ShowResourcePackManager();
2018-03-26 02:17:47 +00:00
void ShowCheatsManager();
void ShowRiivolutionBootWidget(const UICommon::GameFile& game);
2017-07-21 20:48:21 +00:00
#ifdef USE_RETRO_ACHIEVEMENTS
void ShowAchievementsWindow();
#endif // USE_RETRO_ACHIEVEMENTS
2017-07-21 20:48:21 +00:00
void NetPlayInit();
bool NetPlayJoin();
bool NetPlayHost(const UICommon::GameFile& game);
2017-07-21 20:48:21 +00:00
void NetPlayQuit();
void OnBootGameCubeIPL(DiscIO::Region region);
void OnImportNANDBackup();
void OnConnectWiiRemote(int id);
#if defined(__unix__) || defined(__unix) || defined(__APPLE__)
2018-05-22 19:30:54 +00:00
void OnSignal();
#endif
2017-08-27 11:55:05 +00:00
void OnPlayRecording();
void OnStartRecording();
void OnStopRecording();
void OnExportRecording();
void OnActivateChat();
void OnRequestGolfControl();
2018-01-27 13:35:02 +00:00
void ShowTASInput();
2017-08-27 11:55:05 +00:00
void ChangeDisc();
void EjectDisc();
void OpenUserFolder();
2018-11-05 18:20:45 +00:00
QStringList PromptFileNames();
void UpdateScreenSaverInhibition();
2018-01-01 21:15:26 +00:00
void OnStopComplete();
2017-06-26 21:22:40 +00:00
void dragEnterEvent(QDragEnterEvent* event) override;
void dropEvent(QDropEvent* event) override;
QSize sizeHint() const override;
2017-06-26 21:22:40 +00:00
#ifdef _WIN32
// This gets called for each event from the Windows message queue.
bool nativeEvent(const QByteArray& eventType, void* message, qintptr* result) override;
#endif
2021-02-22 13:32:53 +00:00
#ifdef HAVE_XRANDR
std::unique_ptr<X11Utils::XRRConfiguration> m_xrr_config;
#endif
2015-11-27 08:33:07 +00:00
QStackedWidget* m_stack;
ToolBar* m_tool_bar;
2015-12-20 05:24:48 +00:00
MenuBar* m_menu_bar;
2018-03-21 10:13:53 +00:00
SearchBar* m_search_bar;
2015-11-27 08:33:07 +00:00
GameList* m_game_list;
RenderWidget* m_render_widget = nullptr;
2015-11-27 08:33:07 +00:00
bool m_rendering_to_main;
bool m_stop_confirm_showing = false;
2017-06-24 15:00:37 +00:00
bool m_stop_requested = false;
bool m_exit_requested = false;
bool m_fullscreen_requested = false;
bool m_is_screensaver_inhibited = false;
2023-01-29 01:54:41 +00:00
u32 m_state_slot = 1;
std::unique_ptr<BootParameters> m_pending_boot;
ControllersWindow* m_controllers_window = nullptr;
SettingsWindow* m_settings_window = nullptr;
GraphicsWindow* m_graphics_window = nullptr;
FIFOPlayerWindow* m_fifo_window = nullptr;
SkylanderPortalWindow* m_skylander_window = nullptr;
InfinityBaseWindow* m_infinity_window = nullptr;
MappingWindow* m_hotkey_window = nullptr;
FreeLookWindow* m_freelook_window = nullptr;
HotkeyScheduler* m_hotkey_scheduler;
2017-07-21 20:48:21 +00:00
NetPlayDialog* m_netplay_dialog;
2018-07-03 21:50:08 +00:00
DiscordHandler* m_netplay_discord;
2017-07-21 20:48:21 +00:00
NetPlaySetupDialog* m_netplay_setup_dialog;
2018-01-31 11:35:09 +00:00
static constexpr int num_gc_controllers = 4;
std::array<GCTASInputWindow*, num_gc_controllers> m_gc_tas_input_windows{};
std::array<GBATASInputWindow*, num_gc_controllers> m_gba_tas_input_windows{};
2018-01-31 11:35:09 +00:00
static constexpr int num_wii_controllers = 4;
std::array<WiiTASInputWindow*, num_wii_controllers> m_wii_tas_input_windows{};
#ifdef USE_RETRO_ACHIEVEMENTS
AchievementsWindow* m_achievements_window = nullptr;
#endif // USE_RETRO_ACHIEVEMENTS
BreakpointWidget* m_breakpoint_widget;
2018-02-14 22:25:01 +00:00
CodeWidget* m_code_widget;
2018-04-09 13:31:20 +00:00
JITWidget* m_jit_widget;
LogWidget* m_log_widget;
LogConfigWidget* m_log_config_widget;
2018-03-16 11:39:53 +00:00
MemoryWidget* m_memory_widget;
NetworkWidget* m_network_widget;
RegisterWidget* m_register_widget;
ThreadWidget* m_thread_widget;
2017-09-27 06:53:05 +00:00
WatchWidget* m_watch_widget;
2018-03-26 02:17:47 +00:00
CheatsManager* m_cheats_manager;
QByteArray m_render_widget_geometry;
2015-11-27 08:33:07 +00:00
};