MainWindow.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. // Copyright 2014 Dolphin Emulator Project
  2. // Licensed under GPLv2+
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include <memory>
  6. #include <QMainWindow>
  7. #include "Core/Core.h"
  8. #include "DolphinQt/GameList/GameTracker.h"
  9. #include "DolphinQt/VideoInterface/RenderWidget.h"
  10. // Predefinitions
  11. namespace Ui
  12. {
  13. class DMainWindow;
  14. }
  15. class DMainWindow : public QMainWindow
  16. {
  17. Q_OBJECT
  18. public:
  19. explicit DMainWindow(QWidget* parent_widget = nullptr);
  20. ~DMainWindow();
  21. // DRenderWidget
  22. bool RenderWidgetHasFocus() const { return m_render_widget->isActiveWindow(); }
  23. DRenderWidget* GetRenderWidget() { return m_render_widget.get(); }
  24. signals:
  25. void CoreStateChanged(Core::EState state);
  26. public slots:
  27. // Main toolbar (also used by DRenderWidget)
  28. bool OnStop();
  29. private slots:
  30. // Emulation
  31. void StartGame(const QString filename);
  32. void OnCoreStateChanged(Core::EState state);
  33. // Main toolbar
  34. void OnOpen();
  35. void OnBrowse();
  36. void OnExit();
  37. void OnPlay();
  38. void OnReset();
  39. // View menu
  40. void OnGameListStyleChanged();
  41. // Help menu
  42. void OnOpenWebsite();
  43. void OnOpenDocs();
  44. void OnOpenGitHub();
  45. void OnOpenSystemInfo();
  46. void OnOpenAbout();
  47. void OnOpenAboutQt();
  48. // Misc.
  49. void UpdateIcons();
  50. private:
  51. void closeEvent(QCloseEvent* ce);
  52. std::unique_ptr<Ui::DMainWindow> m_ui;
  53. DGameTracker* m_game_tracker;
  54. // Emulation
  55. QString RequestBootFilename();
  56. QString ShowFileDialog();
  57. QString ShowFolderDialog();
  58. void DoStartPause();
  59. bool Stop();
  60. std::unique_ptr<DRenderWidget> m_render_widget;
  61. bool m_isStopping = false;
  62. };
  63. // Pointer to the only instance of DMainWindow, used by Host_*
  64. extern DMainWindow* g_main_window;