2021-11-25 10:20:56 +01:00
|
|
|
#ifndef QT_MAINWINDOW_HPP
|
|
|
|
|
#define QT_MAINWINDOW_HPP
|
|
|
|
|
|
|
|
|
|
#include <QMainWindow>
|
|
|
|
|
#include <QLabel>
|
2021-11-30 22:06:41 +01:00
|
|
|
#include <QEvent>
|
2021-12-05 15:57:46 +06:00
|
|
|
#include <QFocusEvent>
|
2021-11-25 10:20:56 +01:00
|
|
|
|
2021-12-03 11:38:00 +01:00
|
|
|
#include <memory>
|
2022-07-11 12:10:57 +06:00
|
|
|
#include <array>
|
2024-06-26 23:09:55 +02:00
|
|
|
#include <atomic>
|
2021-12-03 11:38:00 +01:00
|
|
|
|
|
|
|
|
class MediaMenu;
|
2022-07-04 01:50:42 +06:00
|
|
|
class RendererStack;
|
2021-12-03 11:38:00 +01:00
|
|
|
|
2021-11-25 10:20:56 +01:00
|
|
|
namespace Ui {
|
|
|
|
|
class MainWindow;
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-30 22:06:41 +01:00
|
|
|
class MachineStatus;
|
|
|
|
|
|
2022-11-19 08:49:04 -05:00
|
|
|
class MainWindow : public QMainWindow {
|
2021-11-25 10:20:56 +01:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
explicit MainWindow(QWidget *parent = nullptr);
|
|
|
|
|
~MainWindow();
|
2021-11-29 17:25:31 +01:00
|
|
|
|
2022-11-19 08:49:04 -05:00
|
|
|
void showMessage(int flags, const QString &header, const QString &message);
|
|
|
|
|
void getTitle(wchar_t *title);
|
|
|
|
|
void blitToWidget(int x, int y, int w, int h, int monitor_index);
|
2021-12-12 01:16:27 +06:00
|
|
|
QSize getRenderWidgetSize();
|
2022-11-19 08:49:04 -05:00
|
|
|
void setSendKeyboardInput(bool enabled);
|
2023-07-24 17:16:01 -03:00
|
|
|
void checkFullscreenHotkey();
|
2022-08-10 01:27:54 +06:00
|
|
|
|
|
|
|
|
std::array<std::unique_ptr<RendererStack>, 8> renderers;
|
2021-11-25 10:20:56 +01:00
|
|
|
signals:
|
2022-11-19 08:49:04 -05:00
|
|
|
void paint(const QImage &image);
|
2021-11-25 10:20:56 +01:00
|
|
|
void resizeContents(int w, int h);
|
2022-07-04 17:54:38 +06:00
|
|
|
void resizeContentsMonitor(int w, int h, int monitor_index);
|
2022-11-19 08:49:04 -05:00
|
|
|
void statusBarMessage(const QString &msg);
|
2021-11-28 20:49:05 +01:00
|
|
|
void updateStatusBarPanes();
|
|
|
|
|
void updateStatusBarActivity(int tag, bool active);
|
|
|
|
|
void updateStatusBarEmpty(int tag, bool empty);
|
2021-12-14 00:31:55 +06:00
|
|
|
void updateStatusBarTip(int tag);
|
2021-12-12 01:16:27 +06:00
|
|
|
void updateMenuResizeOptions();
|
|
|
|
|
void updateWindowRememberOption();
|
2022-07-04 01:50:42 +06:00
|
|
|
void initRendererMonitor(int monitor_index);
|
|
|
|
|
void destroyRendererMonitor(int monitor_index);
|
|
|
|
|
void initRendererMonitorForNonQtThread(int monitor_index);
|
|
|
|
|
void destroyRendererMonitorForNonQtThread(int monitor_index);
|
2023-01-03 15:42:57 +06:00
|
|
|
void hardResetCompleted();
|
2021-11-25 10:20:56 +01:00
|
|
|
|
2022-11-19 08:49:04 -05:00
|
|
|
void setTitle(const QString &title);
|
2021-11-25 10:20:56 +01:00
|
|
|
void setFullscreen(bool state);
|
|
|
|
|
void setMouseCapture(bool state);
|
|
|
|
|
|
2024-06-26 23:09:55 +02:00
|
|
|
void showMessageForNonQtThread(int flags, const QString &header, const QString &message, std::atomic_bool* done);
|
2022-11-19 08:49:04 -05:00
|
|
|
void getTitleForNonQtThread(wchar_t *title);
|
2022-01-22 01:10:11 +02:00
|
|
|
public slots:
|
|
|
|
|
void showSettings();
|
|
|
|
|
void hardReset();
|
2022-01-22 02:41:02 +02:00
|
|
|
void togglePause();
|
2022-07-04 01:50:42 +06:00
|
|
|
void initRendererMonitorSlot(int monitor_index);
|
|
|
|
|
void destroyRendererMonitorSlot(int monitor_index);
|
2024-09-18 09:38:47 +02:00
|
|
|
void updateStatusEmptyIcons();
|
2022-10-29 09:09:30 -04:00
|
|
|
void updateUiPauseState();
|
2021-11-25 10:20:56 +01:00
|
|
|
private slots:
|
|
|
|
|
void on_actionFullscreen_triggered();
|
|
|
|
|
void on_actionSettings_triggered();
|
|
|
|
|
void on_actionExit_triggered();
|
2023-10-13 23:30:31 +02:00
|
|
|
void on_actionAuto_pause_triggered();
|
2021-11-25 10:20:56 +01:00
|
|
|
void on_actionPause_triggered();
|
|
|
|
|
void on_actionCtrl_Alt_Del_triggered();
|
|
|
|
|
void on_actionCtrl_Alt_Esc_triggered();
|
|
|
|
|
void on_actionHard_Reset_triggered();
|
|
|
|
|
void on_actionRight_CTRL_is_left_ALT_triggered();
|
2024-05-03 17:02:13 +02:00
|
|
|
static void on_actionKeyboard_requires_capture_triggered();
|
2021-12-06 21:26:17 +01:00
|
|
|
void on_actionResizable_window_triggered(bool checked);
|
2021-12-06 21:45:40 +01:00
|
|
|
void on_actionInverted_VGA_monitor_triggered();
|
2021-12-06 21:58:41 +01:00
|
|
|
void on_action0_5x_triggered();
|
|
|
|
|
void on_action1x_triggered();
|
|
|
|
|
void on_action1_5x_triggered();
|
|
|
|
|
void on_action2x_triggered();
|
2022-11-01 11:53:49 -07:00
|
|
|
void on_action3x_triggered();
|
|
|
|
|
void on_action4x_triggered();
|
|
|
|
|
void on_action5x_triggered();
|
|
|
|
|
void on_action6x_triggered();
|
|
|
|
|
void on_action7x_triggered();
|
|
|
|
|
void on_action8x_triggered();
|
2021-12-06 22:02:18 +01:00
|
|
|
void on_actionLinear_triggered();
|
|
|
|
|
void on_actionNearest_triggered();
|
2021-12-07 13:47:42 +01:00
|
|
|
void on_actionFullScreen_int_triggered();
|
2023-10-13 23:30:31 +02:00
|
|
|
void on_actionFullScreen_int43_triggered();
|
2021-12-07 13:47:42 +01:00
|
|
|
void on_actionFullScreen_keepRatio_triggered();
|
|
|
|
|
void on_actionFullScreen_43_triggered();
|
|
|
|
|
void on_actionFullScreen_stretch_triggered();
|
2021-12-08 15:12:21 +01:00
|
|
|
void on_actionWhite_monitor_triggered();
|
|
|
|
|
void on_actionGreen_monitor_triggered();
|
|
|
|
|
void on_actionAmber_monitor_triggered();
|
|
|
|
|
void on_actionRGB_Grayscale_triggered();
|
|
|
|
|
void on_actionRGB_Color_triggered();
|
2021-12-08 15:17:33 +01:00
|
|
|
void on_actionAverage_triggered();
|
|
|
|
|
void on_actionBT709_HDTV_triggered();
|
|
|
|
|
void on_actionBT601_NTSC_PAL_triggered();
|
2021-12-09 16:27:53 +06:00
|
|
|
void on_actionDocumentation_triggered();
|
|
|
|
|
void on_actionAbout_86Box_triggered();
|
|
|
|
|
void on_actionAbout_Qt_triggered();
|
2021-12-09 11:55:28 +01:00
|
|
|
void on_actionForce_4_3_display_ratio_triggered();
|
|
|
|
|
void on_actionChange_contrast_for_monochrome_display_triggered();
|
|
|
|
|
void on_actionCGA_PCjr_Tandy_EGA_S_VGA_overscan_triggered();
|
2021-12-12 01:16:27 +06:00
|
|
|
void on_actionRemember_size_and_position_triggered();
|
|
|
|
|
void on_actionSpecify_dimensions_triggered();
|
|
|
|
|
void on_actionHiDPI_scaling_triggered();
|
|
|
|
|
void on_actionHide_status_bar_triggered();
|
2022-01-09 17:00:16 +02:00
|
|
|
void on_actionHide_tool_bar_triggered();
|
2021-12-12 01:16:27 +06:00
|
|
|
void on_actionUpdate_status_bar_icons_triggered();
|
|
|
|
|
void on_actionTake_screenshot_triggered();
|
2021-12-12 16:22:35 +06:00
|
|
|
void on_actionSound_gain_triggered();
|
2021-12-28 16:47:10 +06:00
|
|
|
void on_actionPreferences_triggered();
|
2022-01-09 01:04:59 +06:00
|
|
|
void on_actionEnable_Discord_integration_triggered(bool checked);
|
2022-02-27 14:56:51 +02:00
|
|
|
void on_actionRenderer_options_triggered();
|
2021-11-25 10:20:56 +01:00
|
|
|
|
2021-12-03 11:38:00 +01:00
|
|
|
void refreshMediaMenu();
|
2024-06-26 23:09:55 +02:00
|
|
|
void showMessage_(int flags, const QString &header, const QString &message, std::atomic_bool* done = nullptr);
|
2022-11-19 08:49:04 -05:00
|
|
|
void getTitle_(wchar_t *title);
|
2021-12-12 01:16:27 +06:00
|
|
|
|
2022-05-23 17:29:45 +06:00
|
|
|
void on_actionMCA_devices_triggered();
|
2021-12-12 16:22:35 +06:00
|
|
|
|
2021-11-30 16:26:49 +06:00
|
|
|
protected:
|
2022-11-19 08:49:04 -05:00
|
|
|
void keyPressEvent(QKeyEvent *event) override;
|
|
|
|
|
void keyReleaseEvent(QKeyEvent *event) override;
|
|
|
|
|
void focusInEvent(QFocusEvent *event) override;
|
|
|
|
|
void focusOutEvent(QFocusEvent *event) override;
|
|
|
|
|
bool eventFilter(QObject *receiver, QEvent *event) override;
|
|
|
|
|
void showEvent(QShowEvent *event) override;
|
|
|
|
|
void closeEvent(QCloseEvent *event) override;
|
|
|
|
|
void changeEvent(QEvent *event) override;
|
2021-12-27 16:32:03 +06:00
|
|
|
|
2023-01-03 15:42:57 +06:00
|
|
|
private slots:
|
|
|
|
|
void on_actionPen_triggered();
|
2021-12-28 16:47:10 +06:00
|
|
|
|
2023-01-03 15:42:57 +06:00
|
|
|
private slots:
|
|
|
|
|
void on_actionCursor_Puck_triggered();
|
2022-01-09 01:04:59 +06:00
|
|
|
|
2023-02-06 01:39:34 +06:00
|
|
|
void on_actionACPI_Shutdown_triggered();
|
2022-02-16 01:09:11 +06:00
|
|
|
|
2022-07-10 11:41:02 +06:00
|
|
|
private slots:
|
|
|
|
|
void on_actionShow_non_primary_monitors_triggered();
|
|
|
|
|
|
2022-11-19 08:49:04 -05:00
|
|
|
void on_actionOpen_screenshots_folder_triggered();
|
2022-08-09 15:35:32 +06:00
|
|
|
|
2022-08-10 01:27:54 +06:00
|
|
|
void on_actionApply_fullscreen_stretch_mode_when_maximized_triggered(bool checked);
|
2021-12-04 21:33:04 +01:00
|
|
|
|
2021-11-25 10:20:56 +01:00
|
|
|
private:
|
2022-11-19 08:49:04 -05:00
|
|
|
Ui::MainWindow *ui;
|
2021-11-30 22:06:41 +01:00
|
|
|
std::unique_ptr<MachineStatus> status;
|
2022-11-19 08:49:04 -05:00
|
|
|
std::shared_ptr<MediaMenu> mm;
|
2022-02-20 02:26:27 -05:00
|
|
|
|
2023-04-09 19:26:56 -03:00
|
|
|
void processKeyboardInput(bool down, uint32_t keycode);
|
2022-03-19 23:06:17 +00:00
|
|
|
#ifdef Q_OS_MACOS
|
|
|
|
|
uint32_t last_modifiers = 0;
|
2022-11-19 08:49:04 -05:00
|
|
|
void processMacKeyboardInput(bool down, const QKeyEvent *event);
|
2022-03-19 23:06:17 +00:00
|
|
|
#endif
|
2022-02-16 01:09:11 +06:00
|
|
|
|
2021-12-09 20:59:50 +02:00
|
|
|
/* If main window should send keyboard input */
|
|
|
|
|
bool send_keyboard_input = true;
|
2022-11-19 08:49:04 -05:00
|
|
|
bool shownonce = false;
|
|
|
|
|
bool resizableonce = false;
|
|
|
|
|
bool vnc_enabled = false;
|
2021-12-24 01:57:26 +06:00
|
|
|
|
2023-04-13 23:00:01 +02:00
|
|
|
/* Full screen ON and OFF signals */
|
2023-04-13 23:21:40 +02:00
|
|
|
bool fs_on_signal = false;
|
|
|
|
|
bool fs_off_signal = false;
|
2021-12-24 01:57:26 +06:00
|
|
|
|
|
|
|
|
friend class SpecifyDimensions;
|
2021-12-28 16:47:10 +06:00
|
|
|
friend class ProgSettings;
|
2022-02-15 02:34:13 +06:00
|
|
|
friend class RendererCommon;
|
2022-08-02 00:14:09 +06:00
|
|
|
friend class RendererStack; // For UI variable access by non-primary renderer windows.
|
2024-01-16 14:58:41 +06:00
|
|
|
friend class WindowsRawInputFilter; // Needed to reload renderers on style sheet changes.
|
2021-11-25 10:20:56 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // QT_MAINWINDOW_HPP
|