diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/citra_qt/main.cpp | 60 | ||||
-rw-r--r-- | src/citra_qt/main.hxx | 2 | ||||
-rw-r--r-- | src/citra_qt/main.ui | 25 | ||||
-rw-r--r-- | src/citra_qt/ui_main.h | 16 |
4 files changed, 55 insertions, 48 deletions
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index bb8336c45..f20d33485 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -32,9 +32,7 @@ GMainWindow::GMainWindow() statusBar()->hide(); render_window = new GRenderWindow; - //render_window->setStyleSheet("background-color:black;"); - ui.horizontalLayout->addWidget(render_window); - //render_window->hide(); + render_window->hide(); disasmWidget = new DisassemblerWidget(this, render_window->GetEmuThread()); addDockWidget(Qt::BottomDockWidgetArea, disasmWidget); @@ -71,15 +69,15 @@ GMainWindow::GMainWindow() restoreState(settings.value("state").toByteArray()); render_window->restoreGeometry(settings.value("geometryRenderWindow").toByteArray()); - //ui.action_Popout_Window_Mode->setChecked(settings.value("popupWindowMode", false).toBool()); - //ToggleWindowMode(); + ui.action_Popout_Window_Mode->setChecked(settings.value("popoutWindowMode", true).toBool()); + ToggleWindowMode(); // Setup connections - connect(ui.action_load_elf, SIGNAL(triggered()), this, SLOT(OnMenuLoadELF())); - connect(ui.action_Start, SIGNAL(triggered()), this, SLOT(OnStartGame())); - connect(ui.action_Pause, SIGNAL(triggered()), this, SLOT(OnPauseGame())); - connect(ui.action_Stop, SIGNAL(triggered()), this, SLOT(OnStopGame())); - //connect(ui.action_Single_Window_Mode, SIGNAL(triggered(bool)), this, SLOT(SetupEmuWindowMode())); + connect(ui.action_Load_File, SIGNAL(triggered()), this, SLOT(OnMenuLoadFile())); + connect(ui.action_Start, SIGNAL(triggered()), this, SLOT(OnStartGame())); + connect(ui.action_Pause, SIGNAL(triggered()), this, SLOT(OnPauseGame())); + connect(ui.action_Stop, SIGNAL(triggered()), this, SLOT(OnStopGame())); + connect(ui.action_Popout_Window_Mode, SIGNAL(triggered(bool)), this, SLOT(ToggleWindowMode())); 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 @@ -88,15 +86,13 @@ GMainWindow::GMainWindow() connect(&render_window->GetEmuThread(), SIGNAL(CPUStepped()), callstackWidget, SLOT(OnCPUStepped()), Qt::BlockingQueuedConnection); // Setup hotkeys - RegisterHotkey("Main Window", "Load Image", QKeySequence::Open); + RegisterHotkey("Main Window", "Load File", QKeySequence::Open); RegisterHotkey("Main Window", "Start Emulation"); 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())); - show(); - LogManager::Init(); System::Init(render_window); } @@ -110,12 +106,9 @@ GMainWindow::~GMainWindow() 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"); - if (Core::Init(/*render_window*/)) { + if (Core::Init()) { ERROR_LOG(MASTER_LOG, "core initialization failed, exiting..."); Core::Stop(); exit(1); @@ -134,19 +127,22 @@ void GMainWindow::BootGame(const char* filename) registersWidget->OnCPUStepped(); callstackWidget->OnCPUStepped(); + render_window->DoneCurrent(); // make sure EmuThread can access GL context + render_window->GetEmuThread().SetFilename(filename); 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()) BootGame(filename.toLatin1().data()); } void GMainWindow::OnStartGame() { - render_window->show(); render_window->GetEmuThread().SetCpuRunning(true); ui.action_Start->setEnabled(false); @@ -181,26 +177,22 @@ void GMainWindow::OnOpenHotkeysDialog() void GMainWindow::ToggleWindowMode() { - //if (!render_window->GetEmuThread().isRunning()) - // return; - /* - bool enable = ui.action_Single_Window_Mode->isChecked(); - if (enable && render_window->parent() == NULL) // switch to single window mode + bool enable = ui.action_Popout_Window_Mode->isChecked(); + if (enable && render_window->parent() != NULL) { - render_window->BackupGeometry(); - ui.horizontalLayout->addWidget(render_window); + ui.horizontalLayout->removeWidget(render_window); + render_window->setParent(NULL); render_window->setVisible(true); render_window->DoneCurrent(); + render_window->RestoreGeometry(); } - else if (!enable && render_window->parent() != NULL) // switch to multiple windows mode + else if (!enable && render_window->parent() == NULL) { - ui.horizontalLayout->removeWidget(render_window); - render_window->setParent(NULL); + render_window->BackupGeometry(); + ui.horizontalLayout->addWidget(render_window); render_window->setVisible(true); render_window->DoneCurrent(); - render_window->RestoreGeometry(); } - */ } void GMainWindow::OnConfigure() @@ -215,7 +207,7 @@ void GMainWindow::closeEvent(QCloseEvent* event) settings.setValue("geometry", saveGeometry()); settings.setValue("state", saveState()); 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); SaveHotkeys(settings); diff --git a/src/citra_qt/main.hxx b/src/citra_qt/main.hxx index 77d08f072..b4b1c533c 100644 --- a/src/citra_qt/main.hxx +++ b/src/citra_qt/main.hxx @@ -36,7 +36,7 @@ private slots: void OnStartGame(); void OnPauseGame(); void OnStopGame(); - void OnMenuLoadELF(); + void OnMenuLoadFile(); void OnOpenHotkeysDialog(); void OnConfigure(); void ToggleWindowMode(); diff --git a/src/citra_qt/main.ui b/src/citra_qt/main.ui index d1362cdfc..c0cb11a10 100644 --- a/src/citra_qt/main.ui +++ b/src/citra_qt/main.ui @@ -39,7 +39,7 @@ <property name="title"> <string>&File</string> </property> - <addaction name="action_load_elf"/> + <addaction name="action_Load_File"/> <addaction name="separator"/> <addaction name="action_Exit"/> </widget> @@ -57,6 +57,7 @@ <property name="title"> <string>&View</string> </property> + <addaction name="action_Popout_Window_Mode"/> <addaction name="action_Hotkeys"/> </widget> <widget class="QMenu" name="menu_Help"> @@ -71,9 +72,9 @@ <addaction name="menu_Help"/> </widget> <widget class="QStatusBar" name="statusbar"/> - <action name="action_load_elf"> + <action name="action_Load_File"> <property name="text"> - <string>Load ELF ...</string> + <string>Load file...</string> </property> </action> <action name="action_Exit"> @@ -103,11 +104,19 @@ </property> </action> <action name="action_About"> - <property name="text"> - <string>About Citra</string> - </property> - </action> - <action name="action_Hotkeys"> + <property name="text"> + <string>About Citra</string> + </property> + </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"> <property name="text"> <string>Configure &Hotkeys ...</string> </property> diff --git a/src/citra_qt/ui_main.h b/src/citra_qt/ui_main.h index e098c45a6..cd3906ecc 100644 --- a/src/citra_qt/ui_main.h +++ b/src/citra_qt/ui_main.h @@ -26,12 +26,13 @@ QT_BEGIN_NAMESPACE class Ui_MainWindow { public: - QAction *action_load_elf; + QAction *action_Load_File; QAction *action_Exit; QAction *action_Start; QAction *action_Pause; QAction *action_Stop; QAction *action_About; + QAction *action_Popout_Window_Mode; QAction *action_Hotkeys; QAction *action_Configure; QWidget *centralwidget; @@ -53,8 +54,8 @@ public: MainWindow->setWindowIcon(icon); MainWindow->setTabShape(QTabWidget::Rounded); MainWindow->setDockNestingEnabled(true); - action_load_elf = new QAction(MainWindow); - action_load_elf->setObjectName(QString::fromUtf8("action_load_elf")); + action_Load_File = new QAction(MainWindow); + action_Load_File->setObjectName(QString::fromUtf8("action_Load_File")); action_Exit = new QAction(MainWindow); action_Exit->setObjectName(QString::fromUtf8("action_Exit")); action_Start = new QAction(MainWindow); @@ -67,6 +68,9 @@ public: action_Stop->setEnabled(false); action_About = new QAction(MainWindow); 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->setObjectName(QString::fromUtf8("action_Hotkeys")); action_Configure = new QAction(MainWindow); @@ -96,7 +100,7 @@ public: menubar->addAction(menu_Emulation->menuAction()); menubar->addAction(menu_View->menuAction()); menubar->addAction(menu_Help->menuAction()); - menu_File->addAction(action_load_elf); + menu_File->addAction(action_Load_File); menu_File->addSeparator(); menu_File->addAction(action_Exit); menu_Emulation->addAction(action_Start); @@ -104,6 +108,7 @@ public: menu_Emulation->addAction(action_Stop); menu_Emulation->addSeparator(); menu_Emulation->addAction(action_Configure); + menu_View->addAction(action_Popout_Window_Mode); menu_View->addAction(action_Hotkeys); menu_Help->addAction(action_About); @@ -117,12 +122,13 @@ public: void retranslateUi(QMainWindow *MainWindow) { 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_Start->setText(QApplication::translate("MainWindow", "&Start", 0, QApplication::UnicodeUTF8)); action_Pause->setText(QApplication::translate("MainWindow", "&Pause", 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_Popout_Window_Mode->setText(QApplication::translate("MainWindow", "Popout window", 0, QApplication::UnicodeUTF8)); action_Hotkeys->setText(QApplication::translate("MainWindow", "Configure &Hotkeys ...", 0, QApplication::UnicodeUTF8)); action_Configure->setText(QApplication::translate("MainWindow", "Configure ...", 0, QApplication::UnicodeUTF8)); menu_File->setTitle(QApplication::translate("MainWindow", "&File", 0, QApplication::UnicodeUTF8)); |