Init window size from VideoCore. Start changing the default window behavior...

This commit is contained in:
Mathieu Vaillancourt 2014-04-12 19:01:33 -04:00
parent 0ecb0365e4
commit 68a8594d04
5 changed files with 17 additions and 29 deletions

View file

@ -6,6 +6,7 @@
#include "core/core.h" #include "core/core.h"
#include "core/loader.h" #include "core/loader.h"
#include "video_core/video_core.h"
#include "version.h" #include "version.h"
@ -35,7 +36,8 @@ void EmuThread::run()
exec_cpu_step = false; exec_cpu_step = false;
Core::SingleStep(); Core::SingleStep();
emit CPUStepped(); if (!cpu_running)
emit CPUStepped();
} }
} }
} }
@ -103,9 +105,8 @@ GRenderWindow::GRenderWindow(QWidget* parent) : QWidget(parent), emu_thread(this
// TODO: One of these flags might be interesting: WA_OpaquePaintEvent, WA_NoBackground, WA_DontShowOnScreen, WA_DeleteOnClose // TODO: One of these flags might be interesting: WA_OpaquePaintEvent, WA_NoBackground, WA_DontShowOnScreen, WA_DeleteOnClose
child = new GGLWidgetInternal(this); child = new GGLWidgetInternal(this);
QBoxLayout* layout = new QHBoxLayout(this); QBoxLayout* layout = new QHBoxLayout(this);
resize(640, 480); // TODO: Load size from config instead resize(VideoCore::kScreenTopWidth, VideoCore::kScreenTopHeight + VideoCore::kScreenBottomHeight);
layout->addWidget(child); layout->addWidget(child);
layout->setMargin(0); layout->setMargin(0);
setLayout(layout); setLayout(layout);

View file

@ -6,6 +6,7 @@
#include "common/common.h" #include "common/common.h"
#include "common/platform.h" #include "common/platform.h"
#include "common/log_manager.h"
#if EMU_PLATFORM == PLATFORM_LINUX #if EMU_PLATFORM == PLATFORM_LINUX
#include <unistd.h> #include <unistd.h>
#endif #endif
@ -31,7 +32,9 @@ GMainWindow::GMainWindow()
statusBar()->hide(); statusBar()->hide();
render_window = new GRenderWindow; render_window = new GRenderWindow;
render_window->hide(); //render_window->setStyleSheet("background-color:black;");
ui.horizontalLayout->addWidget(render_window);
//render_window->hide();
disasm = new GDisAsmView(this, render_window->GetEmuThread()); disasm = new GDisAsmView(this, render_window->GetEmuThread());
addDockWidget(Qt::BottomDockWidgetArea, disasm); addDockWidget(Qt::BottomDockWidgetArea, disasm);
@ -63,15 +66,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_Single_Window_Mode->setChecked(settings.value("singleWindowMode", false).toBool()); //ui.action_Popout_Window_Mode->setChecked(settings.value("popupWindowMode", false).toBool());
SetupEmuWindowMode(); //ToggleWindowMode();
// Setup connections // Setup connections
connect(ui.action_load_elf, SIGNAL(triggered()), this, SLOT(OnMenuLoadELF())); connect(ui.action_load_elf, SIGNAL(triggered()), this, SLOT(OnMenuLoadELF()));
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_Single_Window_Mode, SIGNAL(triggered(bool)), this, SLOT(SetupEmuWindowMode()));
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
@ -89,6 +92,7 @@ GMainWindow::GMainWindow()
show(); show();
System::Init(render_window); System::Init(render_window);
LogManager::Init();
} }
GMainWindow::~GMainWindow() GMainWindow::~GMainWindow()
@ -124,9 +128,6 @@ void GMainWindow::BootGame(const char* filename)
arm_regs->OnCPUStepped(); arm_regs->OnCPUStepped();
render_window->GetEmuThread().start(); render_window->GetEmuThread().start();
SetupEmuWindowMode();
render_window->show();
} }
void GMainWindow::OnMenuLoadELF() void GMainWindow::OnMenuLoadELF()
@ -171,11 +172,11 @@ void GMainWindow::OnOpenHotkeysDialog()
} }
void GMainWindow::SetupEmuWindowMode() void GMainWindow::ToggleWindowMode()
{ {
//if (!render_window->GetEmuThread().isRunning()) //if (!render_window->GetEmuThread().isRunning())
// return; // return;
/*
bool enable = ui.action_Single_Window_Mode->isChecked(); bool enable = ui.action_Single_Window_Mode->isChecked();
if (enable && render_window->parent() == NULL) // switch to single window mode if (enable && render_window->parent() == NULL) // switch to single window mode
{ {
@ -192,6 +193,7 @@ void GMainWindow::SetupEmuWindowMode()
render_window->DoneCurrent(); render_window->DoneCurrent();
render_window->RestoreGeometry(); render_window->RestoreGeometry();
} }
*/
} }
void GMainWindow::OnConfigure() void GMainWindow::OnConfigure()
@ -206,7 +208,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("singleWindowMode", ui.action_Single_Window_Mode->isChecked());
settings.setValue("firstStart", false); settings.setValue("firstStart", false);
SaveHotkeys(settings); SaveHotkeys(settings);

View file

@ -37,8 +37,8 @@ private slots:
void OnStopGame(); void OnStopGame();
void OnMenuLoadELF(); void OnMenuLoadELF();
void OnOpenHotkeysDialog(); void OnOpenHotkeysDialog();
void SetupEmuWindowMode();
void OnConfigure(); void OnConfigure();
void ToggleWindowMode();
private: private:
Ui::MainWindow ui; Ui::MainWindow ui;

View file

@ -57,7 +57,6 @@
<property name="title"> <property name="title">
<string>&amp;View</string> <string>&amp;View</string>
</property> </property>
<addaction name="action_Single_Window_Mode"/>
<addaction name="action_Hotkeys"/> <addaction name="action_Hotkeys"/>
</widget> </widget>
<widget class="QMenu" name="menu_Help"> <widget class="QMenu" name="menu_Help">
@ -108,14 +107,6 @@
<string>About Citra</string> <string>About Citra</string>
</property> </property>
</action> </action>
<action name="action_Single_Window_Mode">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Single Window Mode</string>
</property>
</action>
<action name="action_Hotkeys"> <action name="action_Hotkeys">
<property name="text"> <property name="text">
<string>Configure &amp;Hotkeys ...</string> <string>Configure &amp;Hotkeys ...</string>

View file

@ -32,7 +32,6 @@ public:
QAction *action_Pause; QAction *action_Pause;
QAction *action_Stop; QAction *action_Stop;
QAction *action_About; QAction *action_About;
QAction *action_Single_Window_Mode;
QAction *action_Hotkeys; QAction *action_Hotkeys;
QAction *action_Configure; QAction *action_Configure;
QWidget *centralwidget; QWidget *centralwidget;
@ -68,9 +67,6 @@ 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_Single_Window_Mode = new QAction(MainWindow);
action_Single_Window_Mode->setObjectName(QString::fromUtf8("action_Single_Window_Mode"));
action_Single_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);
@ -108,7 +104,6 @@ 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_Single_Window_Mode);
menu_View->addAction(action_Hotkeys); menu_View->addAction(action_Hotkeys);
menu_Help->addAction(action_About); menu_Help->addAction(action_About);
@ -128,7 +123,6 @@ public:
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_Single_Window_Mode->setText(QApplication::translate("MainWindow", "Single Window Mode", 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));