summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Mathieu Vaillancourt2014-04-21 23:15:17 -0400
committerGravatar Mathieu Vaillancourt2014-04-21 23:21:02 -0400
commit81f6062c85290dd2e63d0083e9f1c32a77d7783e (patch)
tree668e5f9934daa57219a685384f1fc24cf850575b
parentAdd a quick way to load Launcher.dat files (diff)
downloadyuzu-81f6062c85290dd2e63d0083e9f1c32a77d7783e.tar.gz
yuzu-81f6062c85290dd2e63d0083e9f1c32a77d7783e.tar.xz
yuzu-81f6062c85290dd2e63d0083e9f1c32a77d7783e.zip
Re-enable toggling window mode.
-rw-r--r--src/citra_qt/main.cpp60
-rw-r--r--src/citra_qt/main.hxx2
-rw-r--r--src/citra_qt/main.ui25
-rw-r--r--src/citra_qt/ui_main.h16
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()
32 statusBar()->hide(); 32 statusBar()->hide();
33 33
34 render_window = new GRenderWindow; 34 render_window = new GRenderWindow;
35 //render_window->setStyleSheet("background-color:black;"); 35 render_window->hide();
36 ui.horizontalLayout->addWidget(render_window);
37 //render_window->hide();
38 36
39 disasmWidget = new DisassemblerWidget(this, render_window->GetEmuThread()); 37 disasmWidget = new DisassemblerWidget(this, render_window->GetEmuThread());
40 addDockWidget(Qt::BottomDockWidgetArea, disasmWidget); 38 addDockWidget(Qt::BottomDockWidgetArea, disasmWidget);
@@ -71,15 +69,15 @@ GMainWindow::GMainWindow()
71 restoreState(settings.value("state").toByteArray()); 69 restoreState(settings.value("state").toByteArray());
72 render_window->restoreGeometry(settings.value("geometryRenderWindow").toByteArray()); 70 render_window->restoreGeometry(settings.value("geometryRenderWindow").toByteArray());
73 71
74 //ui.action_Popout_Window_Mode->setChecked(settings.value("popupWindowMode", false).toBool()); 72 ui.action_Popout_Window_Mode->setChecked(settings.value("popoutWindowMode", true).toBool());
75 //ToggleWindowMode(); 73 ToggleWindowMode();
76 74
77 // Setup connections 75 // Setup connections
78 connect(ui.action_load_elf, SIGNAL(triggered()), this, SLOT(OnMenuLoadELF())); 76 connect(ui.action_Load_File, SIGNAL(triggered()), this, SLOT(OnMenuLoadFile()));
79 connect(ui.action_Start, SIGNAL(triggered()), this, SLOT(OnStartGame())); 77 connect(ui.action_Start, SIGNAL(triggered()), this, SLOT(OnStartGame()));
80 connect(ui.action_Pause, SIGNAL(triggered()), this, SLOT(OnPauseGame())); 78 connect(ui.action_Pause, SIGNAL(triggered()), this, SLOT(OnPauseGame()));
81 connect(ui.action_Stop, SIGNAL(triggered()), this, SLOT(OnStopGame())); 79 connect(ui.action_Stop, SIGNAL(triggered()), this, SLOT(OnStopGame()));
82 //connect(ui.action_Single_Window_Mode, SIGNAL(triggered(bool)), this, SLOT(SetupEmuWindowMode())); 80 connect(ui.action_Popout_Window_Mode, SIGNAL(triggered(bool)), this, SLOT(ToggleWindowMode()));
83 connect(ui.action_Hotkeys, SIGNAL(triggered()), this, SLOT(OnOpenHotkeysDialog())); 81 connect(ui.action_Hotkeys, SIGNAL(triggered()), this, SLOT(OnOpenHotkeysDialog()));
84 82
85 // BlockingQueuedConnection is important here, it makes sure we've finished refreshing our views before the CPU continues 83 // BlockingQueuedConnection is important here, it makes sure we've finished refreshing our views before the CPU continues
@@ -88,15 +86,13 @@ GMainWindow::GMainWindow()
88 connect(&render_window->GetEmuThread(), SIGNAL(CPUStepped()), callstackWidget, SLOT(OnCPUStepped()), Qt::BlockingQueuedConnection); 86 connect(&render_window->GetEmuThread(), SIGNAL(CPUStepped()), callstackWidget, SLOT(OnCPUStepped()), Qt::BlockingQueuedConnection);
89 87
90 // Setup hotkeys 88 // Setup hotkeys
91 RegisterHotkey("Main Window", "Load Image", QKeySequence::Open); 89 RegisterHotkey("Main Window", "Load File", QKeySequence::Open);
92 RegisterHotkey("Main Window", "Start Emulation"); 90 RegisterHotkey("Main Window", "Start Emulation");
93 LoadHotkeys(settings); 91 LoadHotkeys(settings);
94 92
95 connect(GetHotkey("Main Window", "Load Image", this), SIGNAL(activated()), this, SLOT(OnMenuLoadImage())); 93 connect(GetHotkey("Main Window", "Load File", this), SIGNAL(activated()), this, SLOT(OnMenuLoadFile()));
96 connect(GetHotkey("Main Window", "Start Emulation", this), SIGNAL(activated()), this, SLOT(OnStartGame())); 94 connect(GetHotkey("Main Window", "Start Emulation", this), SIGNAL(activated()), this, SLOT(OnStartGame()));
97 95
98 show();
99
100 LogManager::Init(); 96 LogManager::Init();
101 System::Init(render_window); 97 System::Init(render_window);
102} 98}
@@ -110,12 +106,9 @@ GMainWindow::~GMainWindow()
110 106
111void GMainWindow::BootGame(const char* filename) 107void GMainWindow::BootGame(const char* filename)
112{ 108{
113 render_window->DoneCurrent(); // make sure EmuThread can access GL context
114 render_window->GetEmuThread().SetFilename(filename);
115
116 NOTICE_LOG(MASTER_LOG, "citra starting...\n"); 109 NOTICE_LOG(MASTER_LOG, "citra starting...\n");
117 110
118 if (Core::Init(/*render_window*/)) { 111 if (Core::Init()) {
119 ERROR_LOG(MASTER_LOG, "core initialization failed, exiting..."); 112 ERROR_LOG(MASTER_LOG, "core initialization failed, exiting...");
120 Core::Stop(); 113 Core::Stop();
121 exit(1); 114 exit(1);
@@ -134,19 +127,22 @@ void GMainWindow::BootGame(const char* filename)
134 registersWidget->OnCPUStepped(); 127 registersWidget->OnCPUStepped();
135 callstackWidget->OnCPUStepped(); 128 callstackWidget->OnCPUStepped();
136 129
130 render_window->DoneCurrent(); // make sure EmuThread can access GL context
131 render_window->GetEmuThread().SetFilename(filename);
137 render_window->GetEmuThread().start(); 132 render_window->GetEmuThread().start();
133
134 render_window->show();
138} 135}
139 136
140void GMainWindow::OnMenuLoadELF() 137void GMainWindow::OnMenuLoadFile()
141{ 138{
142 QString filename = QFileDialog::getOpenFileName(this, tr("Load ELF"), QString(), QString()); 139 QString filename = QFileDialog::getOpenFileName(this, tr("Load file"), QString(), tr("3DS homebrew (*.elf *.dat)"));
143 if (filename.size()) 140 if (filename.size())
144 BootGame(filename.toLatin1().data()); 141 BootGame(filename.toLatin1().data());
145} 142}
146 143
147void GMainWindow::OnStartGame() 144void GMainWindow::OnStartGame()
148{ 145{
149 render_window->show();
150 render_window->GetEmuThread().SetCpuRunning(true); 146 render_window->GetEmuThread().SetCpuRunning(true);
151 147
152 ui.action_Start->setEnabled(false); 148 ui.action_Start->setEnabled(false);
@@ -181,26 +177,22 @@ void GMainWindow::OnOpenHotkeysDialog()
181 177
182void GMainWindow::ToggleWindowMode() 178void GMainWindow::ToggleWindowMode()
183{ 179{
184 //if (!render_window->GetEmuThread().isRunning()) 180 bool enable = ui.action_Popout_Window_Mode->isChecked();
185 // return; 181 if (enable && render_window->parent() != NULL)
186 /*
187 bool enable = ui.action_Single_Window_Mode->isChecked();
188 if (enable && render_window->parent() == NULL) // switch to single window mode
189 { 182 {
190 render_window->BackupGeometry(); 183 ui.horizontalLayout->removeWidget(render_window);
191 ui.horizontalLayout->addWidget(render_window); 184 render_window->setParent(NULL);
192 render_window->setVisible(true); 185 render_window->setVisible(true);
193 render_window->DoneCurrent(); 186 render_window->DoneCurrent();
187 render_window->RestoreGeometry();
194 } 188 }
195 else if (!enable && render_window->parent() != NULL) // switch to multiple windows mode 189 else if (!enable && render_window->parent() == NULL)
196 { 190 {
197 ui.horizontalLayout->removeWidget(render_window); 191 render_window->BackupGeometry();
198 render_window->setParent(NULL); 192 ui.horizontalLayout->addWidget(render_window);
199 render_window->setVisible(true); 193 render_window->setVisible(true);
200 render_window->DoneCurrent(); 194 render_window->DoneCurrent();
201 render_window->RestoreGeometry();
202 } 195 }
203 */
204} 196}
205 197
206void GMainWindow::OnConfigure() 198void GMainWindow::OnConfigure()
@@ -215,7 +207,7 @@ void GMainWindow::closeEvent(QCloseEvent* event)
215 settings.setValue("geometry", saveGeometry()); 207 settings.setValue("geometry", saveGeometry());
216 settings.setValue("state", saveState()); 208 settings.setValue("state", saveState());
217 settings.setValue("geometryRenderWindow", render_window->saveGeometry()); 209 settings.setValue("geometryRenderWindow", render_window->saveGeometry());
218 //settings.setValue("singleWindowMode", ui.action_Single_Window_Mode->isChecked()); 210 settings.setValue("popoutWindowMode", ui.action_Popout_Window_Mode->isChecked());
219 settings.setValue("firstStart", false); 211 settings.setValue("firstStart", false);
220 SaveHotkeys(settings); 212 SaveHotkeys(settings);
221 213
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:
36 void OnStartGame(); 36 void OnStartGame();
37 void OnPauseGame(); 37 void OnPauseGame();
38 void OnStopGame(); 38 void OnStopGame();
39 void OnMenuLoadELF(); 39 void OnMenuLoadFile();
40 void OnOpenHotkeysDialog(); 40 void OnOpenHotkeysDialog();
41 void OnConfigure(); 41 void OnConfigure();
42 void ToggleWindowMode(); 42 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 @@
39 <property name="title"> 39 <property name="title">
40 <string>&amp;File</string> 40 <string>&amp;File</string>
41 </property> 41 </property>
42 <addaction name="action_load_elf"/> 42 <addaction name="action_Load_File"/>
43 <addaction name="separator"/> 43 <addaction name="separator"/>
44 <addaction name="action_Exit"/> 44 <addaction name="action_Exit"/>
45 </widget> 45 </widget>
@@ -57,6 +57,7 @@
57 <property name="title"> 57 <property name="title">
58 <string>&amp;View</string> 58 <string>&amp;View</string>
59 </property> 59 </property>
60 <addaction name="action_Popout_Window_Mode"/>
60 <addaction name="action_Hotkeys"/> 61 <addaction name="action_Hotkeys"/>
61 </widget> 62 </widget>
62 <widget class="QMenu" name="menu_Help"> 63 <widget class="QMenu" name="menu_Help">
@@ -71,9 +72,9 @@
71 <addaction name="menu_Help"/> 72 <addaction name="menu_Help"/>
72 </widget> 73 </widget>
73 <widget class="QStatusBar" name="statusbar"/> 74 <widget class="QStatusBar" name="statusbar"/>
74 <action name="action_load_elf"> 75 <action name="action_Load_File">
75 <property name="text"> 76 <property name="text">
76 <string>Load ELF ...</string> 77 <string>Load file...</string>
77 </property> 78 </property>
78 </action> 79 </action>
79 <action name="action_Exit"> 80 <action name="action_Exit">
@@ -103,11 +104,19 @@
103 </property> 104 </property>
104 </action> 105 </action>
105 <action name="action_About"> 106 <action name="action_About">
106 <property name="text"> 107 <property name="text">
107 <string>About Citra</string> 108 <string>About Citra</string>
108 </property> 109 </property>
109 </action> 110 </action>
110 <action name="action_Hotkeys"> 111 <action name="action_Popout_Window_Mode">
112 <property name="checkable">
113 <bool>true</bool>
114 </property>
115 <property name="text">
116 <string>Popout window</string>
117 </property>
118 </action>
119 <action name="action_Hotkeys">
111 <property name="text"> 120 <property name="text">
112 <string>Configure &amp;Hotkeys ...</string> 121 <string>Configure &amp;Hotkeys ...</string>
113 </property> 122 </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
26class Ui_MainWindow 26class Ui_MainWindow
27{ 27{
28public: 28public:
29 QAction *action_load_elf; 29 QAction *action_Load_File;
30 QAction *action_Exit; 30 QAction *action_Exit;
31 QAction *action_Start; 31 QAction *action_Start;
32 QAction *action_Pause; 32 QAction *action_Pause;
33 QAction *action_Stop; 33 QAction *action_Stop;
34 QAction *action_About; 34 QAction *action_About;
35 QAction *action_Popout_Window_Mode;
35 QAction *action_Hotkeys; 36 QAction *action_Hotkeys;
36 QAction *action_Configure; 37 QAction *action_Configure;
37 QWidget *centralwidget; 38 QWidget *centralwidget;
@@ -53,8 +54,8 @@ public:
53 MainWindow->setWindowIcon(icon); 54 MainWindow->setWindowIcon(icon);
54 MainWindow->setTabShape(QTabWidget::Rounded); 55 MainWindow->setTabShape(QTabWidget::Rounded);
55 MainWindow->setDockNestingEnabled(true); 56 MainWindow->setDockNestingEnabled(true);
56 action_load_elf = new QAction(MainWindow); 57 action_Load_File = new QAction(MainWindow);
57 action_load_elf->setObjectName(QString::fromUtf8("action_load_elf")); 58 action_Load_File->setObjectName(QString::fromUtf8("action_Load_File"));
58 action_Exit = new QAction(MainWindow); 59 action_Exit = new QAction(MainWindow);
59 action_Exit->setObjectName(QString::fromUtf8("action_Exit")); 60 action_Exit->setObjectName(QString::fromUtf8("action_Exit"));
60 action_Start = new QAction(MainWindow); 61 action_Start = new QAction(MainWindow);
@@ -67,6 +68,9 @@ public:
67 action_Stop->setEnabled(false); 68 action_Stop->setEnabled(false);
68 action_About = new QAction(MainWindow); 69 action_About = new QAction(MainWindow);
69 action_About->setObjectName(QString::fromUtf8("action_About")); 70 action_About->setObjectName(QString::fromUtf8("action_About"));
71 action_Popout_Window_Mode = new QAction(MainWindow);
72 action_Popout_Window_Mode->setObjectName(QString::fromUtf8("action_Popout_Window_Mode"));
73 action_Popout_Window_Mode->setCheckable(true);
70 action_Hotkeys = new QAction(MainWindow); 74 action_Hotkeys = new QAction(MainWindow);
71 action_Hotkeys->setObjectName(QString::fromUtf8("action_Hotkeys")); 75 action_Hotkeys->setObjectName(QString::fromUtf8("action_Hotkeys"));
72 action_Configure = new QAction(MainWindow); 76 action_Configure = new QAction(MainWindow);
@@ -96,7 +100,7 @@ public:
96 menubar->addAction(menu_Emulation->menuAction()); 100 menubar->addAction(menu_Emulation->menuAction());
97 menubar->addAction(menu_View->menuAction()); 101 menubar->addAction(menu_View->menuAction());
98 menubar->addAction(menu_Help->menuAction()); 102 menubar->addAction(menu_Help->menuAction());
99 menu_File->addAction(action_load_elf); 103 menu_File->addAction(action_Load_File);
100 menu_File->addSeparator(); 104 menu_File->addSeparator();
101 menu_File->addAction(action_Exit); 105 menu_File->addAction(action_Exit);
102 menu_Emulation->addAction(action_Start); 106 menu_Emulation->addAction(action_Start);
@@ -104,6 +108,7 @@ public:
104 menu_Emulation->addAction(action_Stop); 108 menu_Emulation->addAction(action_Stop);
105 menu_Emulation->addSeparator(); 109 menu_Emulation->addSeparator();
106 menu_Emulation->addAction(action_Configure); 110 menu_Emulation->addAction(action_Configure);
111 menu_View->addAction(action_Popout_Window_Mode);
107 menu_View->addAction(action_Hotkeys); 112 menu_View->addAction(action_Hotkeys);
108 menu_Help->addAction(action_About); 113 menu_Help->addAction(action_About);
109 114
@@ -117,12 +122,13 @@ public:
117 void retranslateUi(QMainWindow *MainWindow) 122 void retranslateUi(QMainWindow *MainWindow)
118 { 123 {
119 MainWindow->setWindowTitle(QApplication::translate("MainWindow", "Citra", 0, QApplication::UnicodeUTF8)); 124 MainWindow->setWindowTitle(QApplication::translate("MainWindow", "Citra", 0, QApplication::UnicodeUTF8));
120 action_load_elf->setText(QApplication::translate("MainWindow", "Load ELF ...", 0, QApplication::UnicodeUTF8)); 125 action_Load_File->setText(QApplication::translate("MainWindow", "Load file...", 0, QApplication::UnicodeUTF8));
121 action_Exit->setText(QApplication::translate("MainWindow", "E&xit", 0, QApplication::UnicodeUTF8)); 126 action_Exit->setText(QApplication::translate("MainWindow", "E&xit", 0, QApplication::UnicodeUTF8));
122 action_Start->setText(QApplication::translate("MainWindow", "&Start", 0, QApplication::UnicodeUTF8)); 127 action_Start->setText(QApplication::translate("MainWindow", "&Start", 0, QApplication::UnicodeUTF8));
123 action_Pause->setText(QApplication::translate("MainWindow", "&Pause", 0, QApplication::UnicodeUTF8)); 128 action_Pause->setText(QApplication::translate("MainWindow", "&Pause", 0, QApplication::UnicodeUTF8));
124 action_Stop->setText(QApplication::translate("MainWindow", "&Stop", 0, QApplication::UnicodeUTF8)); 129 action_Stop->setText(QApplication::translate("MainWindow", "&Stop", 0, QApplication::UnicodeUTF8));
125 action_About->setText(QApplication::translate("MainWindow", "About Citra", 0, QApplication::UnicodeUTF8)); 130 action_About->setText(QApplication::translate("MainWindow", "About Citra", 0, QApplication::UnicodeUTF8));
131 action_Popout_Window_Mode->setText(QApplication::translate("MainWindow", "Popout window", 0, QApplication::UnicodeUTF8));
126 action_Hotkeys->setText(QApplication::translate("MainWindow", "Configure &Hotkeys ...", 0, QApplication::UnicodeUTF8)); 132 action_Hotkeys->setText(QApplication::translate("MainWindow", "Configure &Hotkeys ...", 0, QApplication::UnicodeUTF8));
127 action_Configure->setText(QApplication::translate("MainWindow", "Configure ...", 0, QApplication::UnicodeUTF8)); 133 action_Configure->setText(QApplication::translate("MainWindow", "Configure ...", 0, QApplication::UnicodeUTF8));
128 menu_File->setTitle(QApplication::translate("MainWindow", "&File", 0, QApplication::UnicodeUTF8)); 134 menu_File->setTitle(QApplication::translate("MainWindow", "&File", 0, QApplication::UnicodeUTF8));