qt: Add Show non-primary monitors option
This commit is contained in:
@@ -163,6 +163,7 @@ int isamem_type[ISAMEM_MAX] = { 0,0,0,0 }; /* (C) enable ISA mem cards */
|
||||
int isartc_type = 0; /* (C) enable ISA RTC card */
|
||||
int gfxcard = 0; /* (C) graphics/video card */
|
||||
int gfxcard_2 = 0; /* (C) graphics/video card */
|
||||
int show_second_monitors = 1; /* (C) show non-primary monitors */
|
||||
int sound_is_float = 1; /* (C) sound uses FP values */
|
||||
int GAMEBLASTER = 0; /* (C) sound option */
|
||||
int GUS = 0; /* (C) sound option */
|
||||
|
@@ -926,6 +926,7 @@ load_video(void)
|
||||
voodoo_enabled = !!config_get_int(cat, "voodoo", 0);
|
||||
ibm8514_enabled = !!config_get_int(cat, "8514a", 0);
|
||||
xga_enabled = !!config_get_int(cat, "xga", 0);
|
||||
show_second_monitors = !!config_get_int(cat, "show_second_monitors", 1);
|
||||
p = config_get_string(cat, "gfxcard_2", NULL);
|
||||
if (!p) p = "none";
|
||||
gfxcard_2 = video_get_video_from_internal_name(p);
|
||||
@@ -2519,6 +2520,11 @@ save_video(void)
|
||||
else
|
||||
config_set_string(cat, "gfxcard_2", video_get_internal_name(gfxcard_2));
|
||||
|
||||
if (show_second_monitors == 1)
|
||||
config_delete_var(cat, "show_second_monitors");
|
||||
else
|
||||
config_set_int(cat, "show_second_monitors", show_second_monitors);
|
||||
|
||||
delete_section_if_empty(cat);
|
||||
}
|
||||
|
||||
|
@@ -779,6 +779,7 @@ extern int machine_ps2_model_55sx_init(const machine_t *);
|
||||
extern int machine_ps2_model_70_type3_init(const machine_t *);
|
||||
extern int machine_ps2_model_80_init(const machine_t *);
|
||||
extern int machine_ps2_model_80_axx_init(const machine_t *);
|
||||
extern int machine_ps2_model_80_axx_cust_init(const machine_t *);
|
||||
|
||||
/* m_tandy.c */
|
||||
extern int tandy1k_eeprom_read(void);
|
||||
|
@@ -135,6 +135,7 @@ extern monitor_settings_t monitor_settings[MONITORS_NUM];
|
||||
extern atomic_bool doresize_monitors[MONITORS_NUM];
|
||||
extern int monitor_index_global;
|
||||
extern int gfxcard_2;
|
||||
extern int show_second_monitors;
|
||||
|
||||
typedef rgb_t PALETTE[256];
|
||||
|
||||
|
@@ -62,6 +62,7 @@ extern "C" {
|
||||
#include <QPushButton>
|
||||
#include <QDesktopServices>
|
||||
#include <QUrl>
|
||||
#include <QMenuBar>
|
||||
#include <QCheckBox>
|
||||
#include <QActionGroup>
|
||||
#include <QOpenGLContext>
|
||||
@@ -276,6 +277,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
ui->actionHiDPI_scaling->setChecked(dpi_scale);
|
||||
ui->actionHide_status_bar->setChecked(hide_status_bar);
|
||||
ui->actionHide_tool_bar->setChecked(hide_tool_bar);
|
||||
ui->actionShow_non_primary_monitors->setChecked(show_second_monitors);
|
||||
ui->actionUpdate_status_bar_icons->setChecked(update_icons);
|
||||
ui->actionEnable_Discord_integration->setChecked(enable_discord);
|
||||
|
||||
@@ -589,15 +591,18 @@ void MainWindow::initRendererMonitorSlot(int monitor_index)
|
||||
if (vid_resize == 2) {
|
||||
secondaryRenderer->setFixedSize(fixed_size_x, fixed_size_y);
|
||||
}
|
||||
secondaryRenderer->show();
|
||||
if (window_remember) {
|
||||
secondaryRenderer->setGeometry(monitor_settings[monitor_index].mon_window_x < 120 ? 120 : monitor_settings[monitor_index].mon_window_x,
|
||||
monitor_settings[monitor_index].mon_window_y < 120 ? 120 : monitor_settings[monitor_index].mon_window_y,
|
||||
monitor_settings[monitor_index].mon_window_w > 2048 ? 2048 : monitor_settings[monitor_index].mon_window_w,
|
||||
monitor_settings[monitor_index].mon_window_h > 2048 ? 2048 : monitor_settings[monitor_index].mon_window_h);
|
||||
}
|
||||
secondaryRenderer->switchRenderer((RendererStack::Renderer)vid_api);
|
||||
secondaryRenderer->setWindowIcon(this->windowIcon());
|
||||
if (show_second_monitors) {
|
||||
secondaryRenderer->show();
|
||||
if (window_remember) {
|
||||
secondaryRenderer->setGeometry(monitor_settings[monitor_index].mon_window_x < 120 ? 120 : monitor_settings[monitor_index].mon_window_x,
|
||||
monitor_settings[monitor_index].mon_window_y < 120 ? 120 : monitor_settings[monitor_index].mon_window_y,
|
||||
monitor_settings[monitor_index].mon_window_w > 2048 ? 2048 : monitor_settings[monitor_index].mon_window_w,
|
||||
monitor_settings[monitor_index].mon_window_h > 2048 ? 2048 : monitor_settings[monitor_index].mon_window_h);
|
||||
}
|
||||
secondaryRenderer->switchRenderer((RendererStack::Renderer)vid_api);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2009,3 +2014,36 @@ void MainWindow::on_actionMCA_devices_triggered()
|
||||
dlg->exec();
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_actionShow_non_primary_monitors_triggered()
|
||||
{
|
||||
show_second_monitors ^= 1;
|
||||
|
||||
if (show_second_monitors) {
|
||||
for (int monitor_index = 1; monitor_index < MONITORS_NUM; monitor_index++) {
|
||||
auto& secondaryRenderer = renderers[monitor_index];
|
||||
if (!renderers[monitor_index]) continue;
|
||||
secondaryRenderer->show();
|
||||
if (window_remember) {
|
||||
secondaryRenderer->setGeometry(monitor_settings[monitor_index].mon_window_x < 120 ? 120 : monitor_settings[monitor_index].mon_window_x,
|
||||
monitor_settings[monitor_index].mon_window_y < 120 ? 120 : monitor_settings[monitor_index].mon_window_y,
|
||||
monitor_settings[monitor_index].mon_window_w > 2048 ? 2048 : monitor_settings[monitor_index].mon_window_w,
|
||||
monitor_settings[monitor_index].mon_window_h > 2048 ? 2048 : monitor_settings[monitor_index].mon_window_h);
|
||||
}
|
||||
secondaryRenderer->switchRenderer((RendererStack::Renderer)vid_api);
|
||||
}
|
||||
} else {
|
||||
for (int monitor_index = 1; monitor_index < MONITORS_NUM; monitor_index++) {
|
||||
auto& secondaryRenderer = renderers[monitor_index];
|
||||
if (!renderers[monitor_index]) continue;
|
||||
secondaryRenderer->hide();
|
||||
if (window_remember && renderers[monitor_index]) {
|
||||
monitor_settings[monitor_index].mon_window_w = renderers[monitor_index]->geometry().width();
|
||||
monitor_settings[monitor_index].mon_window_h = renderers[monitor_index]->geometry().height();
|
||||
monitor_settings[monitor_index].mon_window_x = renderers[monitor_index]->geometry().x();
|
||||
monitor_settings[monitor_index].mon_window_y = renderers[monitor_index]->geometry().y();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -123,6 +123,9 @@ protected:
|
||||
void closeEvent(QCloseEvent* event) override;
|
||||
void changeEvent(QEvent* event) override;
|
||||
|
||||
private slots:
|
||||
void on_actionShow_non_primary_monitors_triggered();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
std::unique_ptr<MachineStatus> status;
|
||||
|
@@ -54,7 +54,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>724</width>
|
||||
<height>21</height>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuAction">
|
||||
@@ -161,6 +161,7 @@
|
||||
<addaction name="actionHide_tool_bar"/>
|
||||
<addaction name="actionHide_status_bar"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionShow_non_primary_monitors"/>
|
||||
<addaction name="actionResizable_window"/>
|
||||
<addaction name="actionRemember_size_and_position"/>
|
||||
<addaction name="separator"/>
|
||||
@@ -757,6 +758,14 @@
|
||||
<number>5</number>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionShow_non_primary_monitors">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Show non-primary monitors</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
@@ -447,7 +447,7 @@ RendererStack::blitCommon(int x, int y, int w, int h)
|
||||
|
||||
void RendererStack::closeEvent(QCloseEvent* event)
|
||||
{
|
||||
if (cpu_thread_run == 0 || is_quit == 0) { event->accept(); return; }
|
||||
if (cpu_thread_run == 0 || is_quit == 1) { event->accept(); return; }
|
||||
event->ignore();
|
||||
main_window->close();
|
||||
}
|
||||
|
Reference in New Issue
Block a user