mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-07-04 23:31:19 +01:00
Re-enable toggling window mode.
This commit is contained in:
parent
5ad1aa8b68
commit
81f6062c85
4 changed files with 56 additions and 49 deletions
|
@ -32,9 +32,7 @@ GMainWindow::GMainWindow()
|
||||||
statusBar()->hide();
|
statusBar()->hide();
|
||||||
|
|
||||||
render_window = new GRenderWindow;
|
render_window = new GRenderWindow;
|
||||||
//render_window->setStyleSheet("background-color:black;");
|
render_window->hide();
|
||||||
ui.horizontalLayout->addWidget(render_window);
|
|
||||||
//render_window->hide();
|
|
||||||
|
|
||||||
disasmWidget = new DisassemblerWidget(this, render_window->GetEmuThread());
|
disasmWidget = new DisassemblerWidget(this, render_window->GetEmuThread());
|
||||||
addDockWidget(Qt::BottomDockWidgetArea, disasmWidget);
|
addDockWidget(Qt::BottomDockWidgetArea, disasmWidget);
|
||||||
|
@ -71,15 +69,15 @@ GMainWindow::GMainWindow()
|
||||||
restoreState(settings.value("state").toByteArray());
|
restoreState(settings.value("state").toByteArray());
|
||||||
render_window->restoreGeometry(settings.value("geometryRenderWindow").toByteArray());
|
render_window->restoreGeometry(settings.value("geometryRenderWindow").toByteArray());
|
||||||
|
|
||||||
//ui.action_Popout_Window_Mode->setChecked(settings.value("popupWindowMode", false).toBool());
|
ui.action_Popout_Window_Mode->setChecked(settings.value("popoutWindowMode", true).toBool());
|
||||||
//ToggleWindowMode();
|
ToggleWindowMode();
|
||||||
|
|
||||||
// Setup connections
|
// Setup connections
|
||||||
connect(ui.action_load_elf, SIGNAL(triggered()), this, SLOT(OnMenuLoadELF()));
|
connect(ui.action_Load_File, SIGNAL(triggered()), this, SLOT(OnMenuLoadFile()));
|
||||||
connect(ui.action_Start, SIGNAL(triggered()), this, SLOT(OnStartGame()));
|
connect(ui.action_Start, SIGNAL(triggered()), this, SLOT(OnStartGame()));
|
||||||
connect(ui.action_Pause, SIGNAL(triggered()), this, SLOT(OnPauseGame()));
|
connect(ui.action_Pause, SIGNAL(triggered()), this, SLOT(OnPauseGame()));
|
||||||
connect(ui.action_Stop, SIGNAL(triggered()), this, SLOT(OnStopGame()));
|
connect(ui.action_Stop, SIGNAL(triggered()), this, SLOT(OnStopGame()));
|
||||||
//connect(ui.action_Single_Window_Mode, SIGNAL(triggered(bool)), this, SLOT(SetupEmuWindowMode()));
|
connect(ui.action_Popout_Window_Mode, SIGNAL(triggered(bool)), this, SLOT(ToggleWindowMode()));
|
||||||
connect(ui.action_Hotkeys, SIGNAL(triggered()), this, SLOT(OnOpenHotkeysDialog()));
|
connect(ui.action_Hotkeys, SIGNAL(triggered()), this, SLOT(OnOpenHotkeysDialog()));
|
||||||
|
|
||||||
// BlockingQueuedConnection is important here, it makes sure we've finished refreshing our views before the CPU continues
|
// BlockingQueuedConnection is important here, it makes sure we've finished refreshing our views before the CPU continues
|
||||||
|
@ -88,15 +86,13 @@ GMainWindow::GMainWindow()
|
||||||
connect(&render_window->GetEmuThread(), SIGNAL(CPUStepped()), callstackWidget, SLOT(OnCPUStepped()), Qt::BlockingQueuedConnection);
|
connect(&render_window->GetEmuThread(), SIGNAL(CPUStepped()), callstackWidget, SLOT(OnCPUStepped()), Qt::BlockingQueuedConnection);
|
||||||
|
|
||||||
// Setup hotkeys
|
// Setup hotkeys
|
||||||
RegisterHotkey("Main Window", "Load Image", QKeySequence::Open);
|
RegisterHotkey("Main Window", "Load File", QKeySequence::Open);
|
||||||
RegisterHotkey("Main Window", "Start Emulation");
|
RegisterHotkey("Main Window", "Start Emulation");
|
||||||
LoadHotkeys(settings);
|
LoadHotkeys(settings);
|
||||||
|
|
||||||
connect(GetHotkey("Main Window", "Load Image", this), SIGNAL(activated()), this, SLOT(OnMenuLoadImage()));
|
connect(GetHotkey("Main Window", "Load File", this), SIGNAL(activated()), this, SLOT(OnMenuLoadFile()));
|
||||||
connect(GetHotkey("Main Window", "Start Emulation", this), SIGNAL(activated()), this, SLOT(OnStartGame()));
|
connect(GetHotkey("Main Window", "Start Emulation", this), SIGNAL(activated()), this, SLOT(OnStartGame()));
|
||||||
|
|
||||||
show();
|
|
||||||
|
|
||||||
LogManager::Init();
|
LogManager::Init();
|
||||||
System::Init(render_window);
|
System::Init(render_window);
|
||||||
}
|
}
|
||||||
|
@ -110,12 +106,9 @@ GMainWindow::~GMainWindow()
|
||||||
|
|
||||||
void GMainWindow::BootGame(const char* filename)
|
void GMainWindow::BootGame(const char* filename)
|
||||||
{
|
{
|
||||||
render_window->DoneCurrent(); // make sure EmuThread can access GL context
|
|
||||||
render_window->GetEmuThread().SetFilename(filename);
|
|
||||||
|
|
||||||
NOTICE_LOG(MASTER_LOG, "citra starting...\n");
|
NOTICE_LOG(MASTER_LOG, "citra starting...\n");
|
||||||
|
|
||||||
if (Core::Init(/*render_window*/)) {
|
if (Core::Init()) {
|
||||||
ERROR_LOG(MASTER_LOG, "core initialization failed, exiting...");
|
ERROR_LOG(MASTER_LOG, "core initialization failed, exiting...");
|
||||||
Core::Stop();
|
Core::Stop();
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -134,19 +127,22 @@ void GMainWindow::BootGame(const char* filename)
|
||||||
registersWidget->OnCPUStepped();
|
registersWidget->OnCPUStepped();
|
||||||
callstackWidget->OnCPUStepped();
|
callstackWidget->OnCPUStepped();
|
||||||
|
|
||||||
|
render_window->DoneCurrent(); // make sure EmuThread can access GL context
|
||||||
|
render_window->GetEmuThread().SetFilename(filename);
|
||||||
render_window->GetEmuThread().start();
|
render_window->GetEmuThread().start();
|
||||||
|
|
||||||
|
render_window->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::OnMenuLoadELF()
|
void GMainWindow::OnMenuLoadFile()
|
||||||
{
|
{
|
||||||
QString filename = QFileDialog::getOpenFileName(this, tr("Load ELF"), QString(), QString());
|
QString filename = QFileDialog::getOpenFileName(this, tr("Load file"), QString(), tr("3DS homebrew (*.elf *.dat)"));
|
||||||
if (filename.size())
|
if (filename.size())
|
||||||
BootGame(filename.toLatin1().data());
|
BootGame(filename.toLatin1().data());
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::OnStartGame()
|
void GMainWindow::OnStartGame()
|
||||||
{
|
{
|
||||||
render_window->show();
|
|
||||||
render_window->GetEmuThread().SetCpuRunning(true);
|
render_window->GetEmuThread().SetCpuRunning(true);
|
||||||
|
|
||||||
ui.action_Start->setEnabled(false);
|
ui.action_Start->setEnabled(false);
|
||||||
|
@ -181,18 +177,8 @@ void GMainWindow::OnOpenHotkeysDialog()
|
||||||
|
|
||||||
void GMainWindow::ToggleWindowMode()
|
void GMainWindow::ToggleWindowMode()
|
||||||
{
|
{
|
||||||
//if (!render_window->GetEmuThread().isRunning())
|
bool enable = ui.action_Popout_Window_Mode->isChecked();
|
||||||
// return;
|
if (enable && render_window->parent() != NULL)
|
||||||
/*
|
|
||||||
bool enable = ui.action_Single_Window_Mode->isChecked();
|
|
||||||
if (enable && render_window->parent() == NULL) // switch to single window mode
|
|
||||||
{
|
|
||||||
render_window->BackupGeometry();
|
|
||||||
ui.horizontalLayout->addWidget(render_window);
|
|
||||||
render_window->setVisible(true);
|
|
||||||
render_window->DoneCurrent();
|
|
||||||
}
|
|
||||||
else if (!enable && render_window->parent() != NULL) // switch to multiple windows mode
|
|
||||||
{
|
{
|
||||||
ui.horizontalLayout->removeWidget(render_window);
|
ui.horizontalLayout->removeWidget(render_window);
|
||||||
render_window->setParent(NULL);
|
render_window->setParent(NULL);
|
||||||
|
@ -200,7 +186,13 @@ void GMainWindow::ToggleWindowMode()
|
||||||
render_window->DoneCurrent();
|
render_window->DoneCurrent();
|
||||||
render_window->RestoreGeometry();
|
render_window->RestoreGeometry();
|
||||||
}
|
}
|
||||||
*/
|
else if (!enable && render_window->parent() == NULL)
|
||||||
|
{
|
||||||
|
render_window->BackupGeometry();
|
||||||
|
ui.horizontalLayout->addWidget(render_window);
|
||||||
|
render_window->setVisible(true);
|
||||||
|
render_window->DoneCurrent();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::OnConfigure()
|
void GMainWindow::OnConfigure()
|
||||||
|
@ -215,7 +207,7 @@ void GMainWindow::closeEvent(QCloseEvent* event)
|
||||||
settings.setValue("geometry", saveGeometry());
|
settings.setValue("geometry", saveGeometry());
|
||||||
settings.setValue("state", saveState());
|
settings.setValue("state", saveState());
|
||||||
settings.setValue("geometryRenderWindow", render_window->saveGeometry());
|
settings.setValue("geometryRenderWindow", render_window->saveGeometry());
|
||||||
//settings.setValue("singleWindowMode", ui.action_Single_Window_Mode->isChecked());
|
settings.setValue("popoutWindowMode", ui.action_Popout_Window_Mode->isChecked());
|
||||||
settings.setValue("firstStart", false);
|
settings.setValue("firstStart", false);
|
||||||
SaveHotkeys(settings);
|
SaveHotkeys(settings);
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ private slots:
|
||||||
void OnStartGame();
|
void OnStartGame();
|
||||||
void OnPauseGame();
|
void OnPauseGame();
|
||||||
void OnStopGame();
|
void OnStopGame();
|
||||||
void OnMenuLoadELF();
|
void OnMenuLoadFile();
|
||||||
void OnOpenHotkeysDialog();
|
void OnOpenHotkeysDialog();
|
||||||
void OnConfigure();
|
void OnConfigure();
|
||||||
void ToggleWindowMode();
|
void ToggleWindowMode();
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>&File</string>
|
<string>&File</string>
|
||||||
</property>
|
</property>
|
||||||
<addaction name="action_load_elf"/>
|
<addaction name="action_Load_File"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="action_Exit"/>
|
<addaction name="action_Exit"/>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -57,6 +57,7 @@
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>&View</string>
|
<string>&View</string>
|
||||||
</property>
|
</property>
|
||||||
|
<addaction name="action_Popout_Window_Mode"/>
|
||||||
<addaction name="action_Hotkeys"/>
|
<addaction name="action_Hotkeys"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="menu_Help">
|
<widget class="QMenu" name="menu_Help">
|
||||||
|
@ -71,9 +72,9 @@
|
||||||
<addaction name="menu_Help"/>
|
<addaction name="menu_Help"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QStatusBar" name="statusbar"/>
|
<widget class="QStatusBar" name="statusbar"/>
|
||||||
<action name="action_load_elf">
|
<action name="action_Load_File">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Load ELF ...</string>
|
<string>Load file...</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="action_Exit">
|
<action name="action_Exit">
|
||||||
|
@ -107,6 +108,14 @@
|
||||||
<string>About Citra</string>
|
<string>About Citra</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="action_Popout_Window_Mode">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Popout window</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
<action name="action_Hotkeys">
|
<action name="action_Hotkeys">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Configure &Hotkeys ...</string>
|
<string>Configure &Hotkeys ...</string>
|
||||||
|
|
|
@ -26,12 +26,13 @@ QT_BEGIN_NAMESPACE
|
||||||
class Ui_MainWindow
|
class Ui_MainWindow
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QAction *action_load_elf;
|
QAction *action_Load_File;
|
||||||
QAction *action_Exit;
|
QAction *action_Exit;
|
||||||
QAction *action_Start;
|
QAction *action_Start;
|
||||||
QAction *action_Pause;
|
QAction *action_Pause;
|
||||||
QAction *action_Stop;
|
QAction *action_Stop;
|
||||||
QAction *action_About;
|
QAction *action_About;
|
||||||
|
QAction *action_Popout_Window_Mode;
|
||||||
QAction *action_Hotkeys;
|
QAction *action_Hotkeys;
|
||||||
QAction *action_Configure;
|
QAction *action_Configure;
|
||||||
QWidget *centralwidget;
|
QWidget *centralwidget;
|
||||||
|
@ -53,8 +54,8 @@ public:
|
||||||
MainWindow->setWindowIcon(icon);
|
MainWindow->setWindowIcon(icon);
|
||||||
MainWindow->setTabShape(QTabWidget::Rounded);
|
MainWindow->setTabShape(QTabWidget::Rounded);
|
||||||
MainWindow->setDockNestingEnabled(true);
|
MainWindow->setDockNestingEnabled(true);
|
||||||
action_load_elf = new QAction(MainWindow);
|
action_Load_File = new QAction(MainWindow);
|
||||||
action_load_elf->setObjectName(QString::fromUtf8("action_load_elf"));
|
action_Load_File->setObjectName(QString::fromUtf8("action_Load_File"));
|
||||||
action_Exit = new QAction(MainWindow);
|
action_Exit = new QAction(MainWindow);
|
||||||
action_Exit->setObjectName(QString::fromUtf8("action_Exit"));
|
action_Exit->setObjectName(QString::fromUtf8("action_Exit"));
|
||||||
action_Start = new QAction(MainWindow);
|
action_Start = new QAction(MainWindow);
|
||||||
|
@ -67,6 +68,9 @@ public:
|
||||||
action_Stop->setEnabled(false);
|
action_Stop->setEnabled(false);
|
||||||
action_About = new QAction(MainWindow);
|
action_About = new QAction(MainWindow);
|
||||||
action_About->setObjectName(QString::fromUtf8("action_About"));
|
action_About->setObjectName(QString::fromUtf8("action_About"));
|
||||||
|
action_Popout_Window_Mode = new QAction(MainWindow);
|
||||||
|
action_Popout_Window_Mode->setObjectName(QString::fromUtf8("action_Popout_Window_Mode"));
|
||||||
|
action_Popout_Window_Mode->setCheckable(true);
|
||||||
action_Hotkeys = new QAction(MainWindow);
|
action_Hotkeys = new QAction(MainWindow);
|
||||||
action_Hotkeys->setObjectName(QString::fromUtf8("action_Hotkeys"));
|
action_Hotkeys->setObjectName(QString::fromUtf8("action_Hotkeys"));
|
||||||
action_Configure = new QAction(MainWindow);
|
action_Configure = new QAction(MainWindow);
|
||||||
|
@ -96,7 +100,7 @@ public:
|
||||||
menubar->addAction(menu_Emulation->menuAction());
|
menubar->addAction(menu_Emulation->menuAction());
|
||||||
menubar->addAction(menu_View->menuAction());
|
menubar->addAction(menu_View->menuAction());
|
||||||
menubar->addAction(menu_Help->menuAction());
|
menubar->addAction(menu_Help->menuAction());
|
||||||
menu_File->addAction(action_load_elf);
|
menu_File->addAction(action_Load_File);
|
||||||
menu_File->addSeparator();
|
menu_File->addSeparator();
|
||||||
menu_File->addAction(action_Exit);
|
menu_File->addAction(action_Exit);
|
||||||
menu_Emulation->addAction(action_Start);
|
menu_Emulation->addAction(action_Start);
|
||||||
|
@ -104,6 +108,7 @@ public:
|
||||||
menu_Emulation->addAction(action_Stop);
|
menu_Emulation->addAction(action_Stop);
|
||||||
menu_Emulation->addSeparator();
|
menu_Emulation->addSeparator();
|
||||||
menu_Emulation->addAction(action_Configure);
|
menu_Emulation->addAction(action_Configure);
|
||||||
|
menu_View->addAction(action_Popout_Window_Mode);
|
||||||
menu_View->addAction(action_Hotkeys);
|
menu_View->addAction(action_Hotkeys);
|
||||||
menu_Help->addAction(action_About);
|
menu_Help->addAction(action_About);
|
||||||
|
|
||||||
|
@ -117,12 +122,13 @@ public:
|
||||||
void retranslateUi(QMainWindow *MainWindow)
|
void retranslateUi(QMainWindow *MainWindow)
|
||||||
{
|
{
|
||||||
MainWindow->setWindowTitle(QApplication::translate("MainWindow", "Citra", 0, QApplication::UnicodeUTF8));
|
MainWindow->setWindowTitle(QApplication::translate("MainWindow", "Citra", 0, QApplication::UnicodeUTF8));
|
||||||
action_load_elf->setText(QApplication::translate("MainWindow", "Load ELF ...", 0, QApplication::UnicodeUTF8));
|
action_Load_File->setText(QApplication::translate("MainWindow", "Load file...", 0, QApplication::UnicodeUTF8));
|
||||||
action_Exit->setText(QApplication::translate("MainWindow", "E&xit", 0, QApplication::UnicodeUTF8));
|
action_Exit->setText(QApplication::translate("MainWindow", "E&xit", 0, QApplication::UnicodeUTF8));
|
||||||
action_Start->setText(QApplication::translate("MainWindow", "&Start", 0, QApplication::UnicodeUTF8));
|
action_Start->setText(QApplication::translate("MainWindow", "&Start", 0, QApplication::UnicodeUTF8));
|
||||||
action_Pause->setText(QApplication::translate("MainWindow", "&Pause", 0, QApplication::UnicodeUTF8));
|
action_Pause->setText(QApplication::translate("MainWindow", "&Pause", 0, QApplication::UnicodeUTF8));
|
||||||
action_Stop->setText(QApplication::translate("MainWindow", "&Stop", 0, QApplication::UnicodeUTF8));
|
action_Stop->setText(QApplication::translate("MainWindow", "&Stop", 0, QApplication::UnicodeUTF8));
|
||||||
action_About->setText(QApplication::translate("MainWindow", "About Citra", 0, QApplication::UnicodeUTF8));
|
action_About->setText(QApplication::translate("MainWindow", "About Citra", 0, QApplication::UnicodeUTF8));
|
||||||
|
action_Popout_Window_Mode->setText(QApplication::translate("MainWindow", "Popout window", 0, QApplication::UnicodeUTF8));
|
||||||
action_Hotkeys->setText(QApplication::translate("MainWindow", "Configure &Hotkeys ...", 0, QApplication::UnicodeUTF8));
|
action_Hotkeys->setText(QApplication::translate("MainWindow", "Configure &Hotkeys ...", 0, QApplication::UnicodeUTF8));
|
||||||
action_Configure->setText(QApplication::translate("MainWindow", "Configure ...", 0, QApplication::UnicodeUTF8));
|
action_Configure->setText(QApplication::translate("MainWindow", "Configure ...", 0, QApplication::UnicodeUTF8));
|
||||||
menu_File->setTitle(QApplication::translate("MainWindow", "&File", 0, QApplication::UnicodeUTF8));
|
menu_File->setTitle(QApplication::translate("MainWindow", "&File", 0, QApplication::UnicodeUTF8));
|
||||||
|
|
Loading…
Reference in a new issue