void CQTOpenGLLuaMainWindow::SetCurrentFile(const QString& str_path) { m_strFileName = str_path; QString strShownName; if(m_strFileName.isEmpty()) { strShownName = "untitled"; } else { strShownName = StrippedFileName(m_strFileName); } setWindowTitle(tr("%1[*] - ARGoS v" ARGOS_VERSION "-" ARGOS_RELEASE " - Lua Editor").arg(strShownName)); if(!m_strFileName.isEmpty()) { m_pcCodeEditor->document()->setModified(false); setWindowModified(false); QSettings cSettings; cSettings.beginGroup("LuaEditor"); QStringList listFiles = cSettings.value("recent_files").toStringList(); listFiles.removeAll(m_strFileName); listFiles.prepend(m_strFileName); while(listFiles.size() > MAX_RECENT_FILES) { listFiles.removeLast(); } cSettings.setValue("recent_files", listFiles); cSettings.endGroup(); UpdateRecentFiles(); } else { m_pcCodeEditor->document()->setModified(true); setWindowModified(true); } }
// ------------------------------------------------------------------------- MainWindow::MainWindow(QWidget *parent, Qt::WFlags flags): QMainWindow(parent, flags), ui(new Ui::MainWindowClass), worldManagerTab(nullptr) { ui->setupUi(this); connect(DatabaseManager::GetInstance(), SIGNAL(database_opened()), this, SLOT(onDatabaseOpened())); connect(DatabaseManager::GetInstance(), SIGNAL(database_created()), this, SLOT(onDatabaseOpened())); connect(DatabaseManager::GetInstance(), SIGNAL(database_closed()), this, SLOT(onDatabaseClosed())); // Create the necessary dialogs. dialogAbout = new AboutDialog(this); EntityEditorTab* entityEditorTab = new EntityEditorTab(this); ComponentLibraryTab* componentLibraryTab = new ComponentLibraryTab(this); worldManagerTab = new WorldManagerTab(this, SETTINGS_FILE, new AeonWorldEditorPlugin()); connect(componentLibraryTab, SIGNAL(OnComponentDescriptorAdded(Aeon::ComponentDescriptor*)), entityEditorTab, SLOT(OnComponentDescriptorAdded(Aeon::ComponentDescriptor*))); connect(componentLibraryTab, SIGNAL(OnComponentDescriptorRemoved(Aeon::ComponentDescriptor*)), entityEditorTab, SLOT(OnComponentDescriptorRemoved(Aeon::ComponentDescriptor*))); PluginManager::Instance().RegisterTabWidget("Entity Editor", entityEditorTab); ui->MainTabWidget->addTab(entityEditorTab, tr("Entity Editor")); ui->MainTabWidget->addTab(componentLibraryTab, tr("Component Library")); ui->MainTabWidget->addTab(worldManagerTab, tr("World Manager")); ui->MainTabWidget->setDisabled(true); RecentFilesActions = new QAction*[MAX_RECENT_FILES]; LoadSettings(); AddFileActions(); UpdateRecentFiles(); }
void CQTOpenGLLuaMainWindow::CreateFileActions() { QIcon cFileNewIcon; cFileNewIcon.addPixmap(QPixmap(m_pcMainWindow->GetIconDir() + "/new.png")); m_pcFileNewAction = new QAction(cFileNewIcon, tr("&New"), this); m_pcFileNewAction->setToolTip(tr("Create a new file")); m_pcFileNewAction->setStatusTip(tr("Create a new file")); m_pcFileNewAction->setShortcut(QKeySequence::New); connect(m_pcFileNewAction, SIGNAL(triggered()), this, SLOT(New())); QIcon cFileOpenIcon; cFileOpenIcon.addPixmap(QPixmap(m_pcMainWindow->GetIconDir() + "/open.png")); m_pcFileOpenAction = new QAction(cFileOpenIcon, tr("&Open..."), this); m_pcFileOpenAction->setToolTip(tr("Open a file")); m_pcFileOpenAction->setStatusTip(tr("Open a file")); m_pcFileOpenAction->setShortcut(QKeySequence::Open); connect(m_pcFileOpenAction, SIGNAL(triggered()), this, SLOT(Open())); for (int i = 0; i < MAX_RECENT_FILES; ++i) { m_pcFileOpenRecentAction[i] = new QAction(this); m_pcFileOpenRecentAction[i]->setVisible(false); connect(m_pcFileOpenRecentAction[i], SIGNAL(triggered()), this, SLOT(OpenRecentFile())); } QIcon cFileSaveIcon; cFileSaveIcon.addPixmap(QPixmap(m_pcMainWindow->GetIconDir() + "/save.png")); m_pcFileSaveAction = new QAction(cFileSaveIcon, tr("&Save"), this); m_pcFileSaveAction->setToolTip(tr("Save the current file")); m_pcFileSaveAction->setStatusTip(tr("Save the current file")); m_pcFileSaveAction->setShortcut(QKeySequence::Save); connect(m_pcFileSaveAction, SIGNAL(triggered()), this, SLOT(Save())); QIcon cFileSaveAsIcon; cFileSaveAsIcon.addPixmap(QPixmap(m_pcMainWindow->GetIconDir() + "/saveas.png")); m_pcFileSaveAsAction = new QAction(cFileSaveAsIcon, tr("S&ave as..."), this); m_pcFileSaveAsAction->setToolTip(tr("Save the current file under a new name")); m_pcFileSaveAsAction->setStatusTip(tr("Save the current file under a new name")); m_pcFileSaveAsAction->setShortcut(QKeySequence::SaveAs); connect(m_pcFileSaveAsAction, SIGNAL(triggered()), this, SLOT(SaveAs())); QMenu* pcMenu = menuBar()->addMenu(tr("&File")); pcMenu->addAction(m_pcFileNewAction); pcMenu->addSeparator(); pcMenu->addAction(m_pcFileOpenAction); pcMenu->addSeparator(); pcMenu->addAction(m_pcFileSaveAction); pcMenu->addAction(m_pcFileSaveAsAction); m_pcFileSeparateRecentAction = pcMenu->addSeparator(); for (int i = 0; i < MAX_RECENT_FILES; ++i) { pcMenu->addAction(m_pcFileOpenRecentAction[i]); } QToolBar* pcToolBar = addToolBar(tr("File")); pcToolBar->setObjectName("FileToolBar"); pcToolBar->setIconSize(QSize(32,32)); pcToolBar->addAction(m_pcFileNewAction); pcToolBar->addAction(m_pcFileOpenAction); pcToolBar->addAction(m_pcFileSaveAction); UpdateRecentFiles(); }
void GMainWindow::StoreRecentFile(const QString& filename) { UISettings::values.recent_files.prepend(filename); UISettings::values.recent_files.removeDuplicates(); while (UISettings::values.recent_files.size() > max_recent_files_item) { UISettings::values.recent_files.removeLast(); } UpdateRecentFiles(); }
/* ================ rvGEApp::HandleCommandSave Handles the ID_GUIED_FILE_SAVE and ID_GUIED_FILE_SAVEAS commands ================ */ void rvGEApp::HandleCommandSave ( rvGEWorkspace* workspace, const char* filename ) { idStr realFilename; // See if we need to browse for a filename if ( workspace->IsNew ( ) || filename == NULL ) { OPENFILENAME ofn; char szFile[MAX_PATH]; strcpy ( szFile, workspace->GetFilename ( ) ); // Initialize OPENFILENAME ZeroMemory(&ofn, sizeof(OPENFILENAME)); ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = mMDIFrame; ofn.lpstrFile = szFile; ofn.nMaxFile = sizeof(szFile); ofn.lpstrFilter = "GUI Files\0*.GUI\0All Files\0*.*\0"; ofn.nFilterIndex = 1; ofn.Flags = OFN_PATHMUSTEXIST; // Display the save dialog box. if ( !GetSaveFileName(&ofn) ) { return; } realFilename = ofn.lpstrFile; realFilename.StripFileExtension ( ); realFilename.Append ( ".gui" ); // If the file already exists then warn about overwriting it if ( _taccess ( realFilename, 0 ) == 0 ) { if ( IDNO == MessageBox ( va("File '%s' already exists. Do you want to replace it?", realFilename.c_str()), MB_YESNO|MB_ICONQUESTION ) ) { return; } } } else { realFilename = filename; } // Now performe the file save if ( workspace->SaveFile ( realFilename ) ) { mOptions.AddRecentFile ( workspace->GetFilename ( ) ); UpdateRecentFiles ( ); } else { MessageBox ( va("Could not write file '%s'", workspace->GetFilename()), MB_OK|MB_ICONERROR ); } }
void GMainWindow::InitializeRecentFileMenuActions() { for (int i = 0; i < max_recent_files_item; ++i) { actions_recent_files[i] = new QAction(this); actions_recent_files[i]->setVisible(false); connect(actions_recent_files[i], SIGNAL(triggered()), this, SLOT(OnMenuRecentFile())); ui.menu_recent_files->addAction(actions_recent_files[i]); } UpdateRecentFiles(); }
// ------------------------------------------------------------------------- void MainWindow::OpenFile(const QString& fname) { if(!DatabaseManager::GetInstance()->Open(fname.toAscii().data())) { QMessageBox::critical(this, tr("Error"), QString(tr("Failed to open %1")).arg(fname), QMessageBox::Ok); } RecentFilesNames.prepend(fname); RecentFilesNames.removeDuplicates(); UpdateRecentFiles(); }
void AEPreferences::Read() { rapidjson::Document document; String filepath = GetPreferencesFullPath(); File jsonFile(context_, filepath); if (!jsonFile.IsOpen()) return; String json; jsonFile.ReadText(json); if (!json.Length()) return; if (document.Parse<0>(json.CString()).HasParseError()) { LOGERRORF("Could not parse JSON data from %s", filepath.CString()); return; } Clear(); const Value::Member* recent_files = document.FindMember("recent_files"); if (recent_files && recent_files->value.IsArray()) { for (Value::ConstValueIterator itr = recent_files->value.Begin(); itr != recent_files->value.End(); itr++) { if (!(*itr).IsString()) continue; String path(itr->GetString()); recentProjects_.Push(path.CString()); } } const Value::Member* android_sdk_path = document.FindMember("android_sdk_path"); if (android_sdk_path && android_sdk_path->value.IsString()) androidSDKPath_ = android_sdk_path->value.GetString(); const Value::Member* jdk_root_path = document.FindMember("jdk_root_path"); if (jdk_root_path && jdk_root_path->value.IsString()) jdkRootPath_ = jdk_root_path->value.GetString(); const Value::Member* ant_path = document.FindMember("ant_path"); if (ant_path && ant_path->value.IsString()) antPath_ = ant_path->value.GetString(); UpdateRecentFiles(false); }
/* ================ rvGEApp::OpenFile Opens the given file and will fail if its already open or could not be opened for some reason ================ */ bool rvGEApp::OpenFile ( const char* filename ) { int i; bool result = false; idStr error; // See if the file is already open and if so just make it active for ( i = 0; i < mWorkspaces.Num(); i ++ ) { if ( !idStr::Icmp ( mWorkspaces[i]->GetFilename(), filename ) ) { SendMessage ( mMDIClient, WM_MDIACTIVATE, (WPARAM)mWorkspaces[i]->GetWindow ( ), 0 ); return false; } } SetCursor ( LoadCursor ( NULL, MAKEINTRESOURCE(IDC_WAIT ) ) ); // Setup the default error. error = va("Failed to parse '%s'", filename ); rvGEWorkspace* workspace = new rvGEWorkspace ( this ); if ( workspace->LoadFile ( filename, &error ) ) { HWND child; child = CreateMDIWindow("QUAKE4_GUIEDITOR_CHILD_CLASS", "Unamed.gui", WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN|WS_HSCROLL|WS_VSCROLL|WS_MAXIMIZE, CW_USEDEFAULT, CW_USEDEFAULT, SCREEN_WIDTH, SCREEN_HEIGHT, mMDIClient, mInstance, (LONG)workspace ); ShowWindow ( child, SW_SHOW ); mOptions.AddRecentFile ( filename ); UpdateRecentFiles ( ); result = true; } else { MessageBox ( error, MB_OK|MB_ICONERROR ); } SetCursor ( LoadCursor ( NULL, MAKEINTRESOURCE(IDC_ARROW ) ) ); return result;; }
void AEPreferences::RegisterRecentProject(const String& fullpath) { if (recentProjects_.Contains(fullpath)) { recentProjects_.Remove(fullpath); } recentProjects_.Insert(0, fullpath); UpdateRecentFiles(); }
// ------------------------------------------------------------------------- bool MainWindow::SaveFile(const QString& fname) { if(!DatabaseManager::GetInstance()->Save(fname.toAscii().data())) { QMessageBox::critical(this, tr("Error"), QString(tr("Failed to save %1")).arg(fname), QMessageBox::Ok); return false; } RecentFilesNames.prepend(fname); RecentFilesNames.removeDuplicates(); UpdateRecentFiles(); return true; }
void GMainWindow::StoreRecentFile(const QString& filename) { QSettings settings; QStringList recent_files = settings.value("recentFiles").toStringList(); recent_files.prepend(filename); recent_files.removeDuplicates(); while (recent_files.size() > max_recent_files_item) { recent_files.removeLast(); } settings.setValue("recentFiles", recent_files); UpdateRecentFiles(); }
void GMainWindow::OnMenuRecentFile() { QAction* action = qobject_cast<QAction*>(sender()); assert(action); QString filename = action->data().toString(); QFileInfo file_info(filename); if (file_info.exists()) { BootGame(filename.toStdString()); } else { // Display an error message and remove the file from the list. QMessageBox::information(this, tr("File not found"), tr("File \"%1\" not found").arg(filename)); UISettings::values.recent_files.removeOne(filename); UpdateRecentFiles(); } }
void GMainWindow::OnMenuRecentFile() { QAction* action = qobject_cast<QAction*>(sender()); assert(action); QString filename = action->data().toString(); QFileInfo file_info(filename); if (file_info.exists()) { BootGame(filename.toLatin1().data()); StoreRecentFile(filename); // Put the filename on top of the list } else { // Display an error message and remove the file from the list. QMessageBox::information(this, tr("File not found"), tr("File \"%1\" not found").arg(filename)); QSettings settings; QStringList recent_files = settings.value("recentFiles").toStringList(); recent_files.removeOne(filename); settings.setValue("recentFiles", recent_files); UpdateRecentFiles(); } }
void frmMainConfig::OnOpen(wxCommandEvent &event) { if (CheckChanged(true)) return; #ifdef __WXMSW__ wxFileDialog dlg(this, _("Open configuration file"), lastDir, wxT(""), _("Configuration files (*.conf)|*.conf|All files (*.*)|*.*"), wxFD_OPEN); #else wxFileDialog dlg(this, _("Open configuration file"), lastDir, wxT(""), _("Configuration files (*.conf)|*.conf|All files (*)|*"), wxFD_OPEN); #endif if (dlg.ShowModal() == wxID_OK) { Init(); lastFilename = dlg.GetFilename(); lastDir = dlg.GetDirectory(); lastPath = dlg.GetPath(); OpenLastFile(); UpdateRecentFiles(); } }
GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) { Pica::g_debug_context = Pica::DebugContext::Construct(); ui.setupUi(this); statusBar()->hide(); render_window = new GRenderWindow(this, emu_thread.get()); render_window->hide(); game_list = new GameList(); ui.horizontalLayout->addWidget(game_list); profilerWidget = new ProfilerWidget(this); addDockWidget(Qt::BottomDockWidgetArea, profilerWidget); profilerWidget->hide(); #if MICROPROFILE_ENABLED microProfileDialog = new MicroProfileDialog(this); microProfileDialog->hide(); #endif disasmWidget = new DisassemblerWidget(this, emu_thread.get()); addDockWidget(Qt::BottomDockWidgetArea, disasmWidget); disasmWidget->hide(); registersWidget = new RegistersWidget(this); addDockWidget(Qt::RightDockWidgetArea, registersWidget); registersWidget->hide(); callstackWidget = new CallstackWidget(this); addDockWidget(Qt::RightDockWidgetArea, callstackWidget); callstackWidget->hide(); graphicsWidget = new GPUCommandStreamWidget(this); addDockWidget(Qt::RightDockWidgetArea, graphicsWidget); graphicsWidget ->hide(); graphicsCommandsWidget = new GPUCommandListWidget(this); addDockWidget(Qt::RightDockWidgetArea, graphicsCommandsWidget); graphicsCommandsWidget->hide(); auto graphicsBreakpointsWidget = new GraphicsBreakPointsWidget(Pica::g_debug_context, this); addDockWidget(Qt::RightDockWidgetArea, graphicsBreakpointsWidget); graphicsBreakpointsWidget->hide(); auto graphicsVertexShaderWidget = new GraphicsVertexShaderWidget(Pica::g_debug_context, this); addDockWidget(Qt::RightDockWidgetArea, graphicsVertexShaderWidget); graphicsVertexShaderWidget->hide(); auto graphicsTracingWidget = new GraphicsTracingWidget(Pica::g_debug_context, this); addDockWidget(Qt::RightDockWidgetArea, graphicsTracingWidget); graphicsTracingWidget->hide(); auto graphicsSurfaceViewerAction = new QAction(tr("Create Pica surface viewer"), this); connect(graphicsSurfaceViewerAction, SIGNAL(triggered()), this, SLOT(OnCreateGraphicsSurfaceViewer())); QMenu* debug_menu = ui.menu_View->addMenu(tr("Debugging")); debug_menu->addAction(graphicsSurfaceViewerAction); debug_menu->addSeparator(); debug_menu->addAction(profilerWidget->toggleViewAction()); #if MICROPROFILE_ENABLED debug_menu->addAction(microProfileDialog->toggleViewAction()); #endif debug_menu->addAction(disasmWidget->toggleViewAction()); debug_menu->addAction(registersWidget->toggleViewAction()); debug_menu->addAction(callstackWidget->toggleViewAction()); debug_menu->addAction(graphicsWidget->toggleViewAction()); debug_menu->addAction(graphicsCommandsWidget->toggleViewAction()); debug_menu->addAction(graphicsBreakpointsWidget->toggleViewAction()); debug_menu->addAction(graphicsVertexShaderWidget->toggleViewAction()); debug_menu->addAction(graphicsTracingWidget->toggleViewAction()); // Set default UI state // geometry: 55% of the window contents are in the upper screen half, 45% in the lower half QDesktopWidget* desktop = ((QApplication*)QApplication::instance())->desktop(); QRect screenRect = desktop->screenGeometry(this); int x, y, w, h; w = screenRect.width() * 2 / 3; h = screenRect.height() / 2; x = (screenRect.x() + screenRect.width()) / 2 - w / 2; y = (screenRect.y() + screenRect.height()) / 2 - h * 55 / 100; setGeometry(x, y, w, h); // Restore UI state restoreGeometry(UISettings::values.geometry); restoreState(UISettings::values.state); render_window->restoreGeometry(UISettings::values.renderwindow_geometry); #if MICROPROFILE_ENABLED microProfileDialog->restoreGeometry(UISettings::values.microprofile_geometry); microProfileDialog->setVisible(UISettings::values.microprofile_visible); #endif game_list->LoadInterfaceLayout(); ui.action_Single_Window_Mode->setChecked(UISettings::values.single_window_mode); ToggleWindowMode(); ui.actionDisplay_widget_title_bars->setChecked(UISettings::values.display_titlebar); OnDisplayTitleBars(ui.actionDisplay_widget_title_bars->isChecked()); // Prepare actions for recent files for (int i = 0; i < max_recent_files_item; ++i) { actions_recent_files[i] = new QAction(this); actions_recent_files[i]->setVisible(false); connect(actions_recent_files[i], SIGNAL(triggered()), this, SLOT(OnMenuRecentFile())); ui.menu_recent_files->addAction(actions_recent_files[i]); } UpdateRecentFiles(); // Setup connections connect(game_list, SIGNAL(GameChosen(QString)), this, SLOT(OnGameListLoadFile(QString)), Qt::DirectConnection); connect(ui.action_Configure, SIGNAL(triggered()), this, SLOT(OnConfigure())); connect(ui.action_Load_File, SIGNAL(triggered()), this, SLOT(OnMenuLoadFile()),Qt::DirectConnection); connect(ui.action_Load_Symbol_Map, SIGNAL(triggered()), this, SLOT(OnMenuLoadSymbolMap())); connect(ui.action_Select_Game_List_Root, SIGNAL(triggered()), this, SLOT(OnMenuSelectGameListRoot())); 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(ToggleWindowMode())); connect(this, SIGNAL(EmulationStarting(EmuThread*)), disasmWidget, SLOT(OnEmulationStarting(EmuThread*))); connect(this, SIGNAL(EmulationStopping()), disasmWidget, SLOT(OnEmulationStopping())); connect(this, SIGNAL(EmulationStarting(EmuThread*)), registersWidget, SLOT(OnEmulationStarting(EmuThread*))); connect(this, SIGNAL(EmulationStopping()), registersWidget, SLOT(OnEmulationStopping())); connect(this, SIGNAL(EmulationStarting(EmuThread*)), render_window, SLOT(OnEmulationStarting(EmuThread*))); connect(this, SIGNAL(EmulationStopping()), render_window, SLOT(OnEmulationStopping())); connect(this, SIGNAL(EmulationStarting(EmuThread*)), graphicsTracingWidget, SLOT(OnEmulationStarting(EmuThread*))); connect(this, SIGNAL(EmulationStopping()), graphicsTracingWidget, SLOT(OnEmulationStopping())); // Setup hotkeys RegisterHotkey("Main Window", "Load File", QKeySequence::Open); RegisterHotkey("Main Window", "Start Emulation"); LoadHotkeys(); connect(GetHotkey("Main Window", "Load File", this), SIGNAL(activated()), this, SLOT(OnMenuLoadFile())); connect(GetHotkey("Main Window", "Start Emulation", this), SIGNAL(activated()), this, SLOT(OnStartGame())); std::string window_title = Common::StringFromFormat("Citra | %s-%s", Common::g_scm_branch, Common::g_scm_desc); setWindowTitle(window_title.c_str()); show(); game_list->PopulateAsync(UISettings::values.gamedir, UISettings::values.gamedir_deepscan); QStringList args = QApplication::arguments(); if (args.length() >= 2) { BootGame(args[1].toStdString()); } }
GMainWindow::GMainWindow() : emu_thread(nullptr) { Pica::g_debug_context = Pica::DebugContext::Construct(); Config config; ui.setupUi(this); statusBar()->hide(); render_window = new GRenderWindow(this, emu_thread.get()); render_window->hide(); game_list = new GameList(); ui.horizontalLayout->addWidget(game_list); profilerWidget = new ProfilerWidget(this); addDockWidget(Qt::BottomDockWidgetArea, profilerWidget); profilerWidget->hide(); microProfileDialog = new MicroProfileDialog(this); microProfileDialog->hide(); disasmWidget = new DisassemblerWidget(this, emu_thread.get()); addDockWidget(Qt::BottomDockWidgetArea, disasmWidget); disasmWidget->hide(); registersWidget = new RegistersWidget(this); addDockWidget(Qt::RightDockWidgetArea, registersWidget); registersWidget->hide(); callstackWidget = new CallstackWidget(this); addDockWidget(Qt::RightDockWidgetArea, callstackWidget); callstackWidget->hide(); graphicsWidget = new GPUCommandStreamWidget(this); addDockWidget(Qt::RightDockWidgetArea, graphicsWidget); graphicsWidget ->hide(); graphicsCommandsWidget = new GPUCommandListWidget(this); addDockWidget(Qt::RightDockWidgetArea, graphicsCommandsWidget); graphicsCommandsWidget->hide(); auto graphicsBreakpointsWidget = new GraphicsBreakPointsWidget(Pica::g_debug_context, this); addDockWidget(Qt::RightDockWidgetArea, graphicsBreakpointsWidget); graphicsBreakpointsWidget->hide(); auto graphicsFramebufferWidget = new GraphicsFramebufferWidget(Pica::g_debug_context, this); addDockWidget(Qt::RightDockWidgetArea, graphicsFramebufferWidget); graphicsFramebufferWidget->hide(); auto graphicsVertexShaderWidget = new GraphicsVertexShaderWidget(Pica::g_debug_context, this); addDockWidget(Qt::RightDockWidgetArea, graphicsVertexShaderWidget); graphicsVertexShaderWidget->hide(); auto graphicsTracingWidget = new GraphicsTracingWidget(Pica::g_debug_context, this); addDockWidget(Qt::RightDockWidgetArea, graphicsTracingWidget); graphicsTracingWidget->hide(); QMenu* debug_menu = ui.menu_View->addMenu(tr("Debugging")); debug_menu->addAction(profilerWidget->toggleViewAction()); debug_menu->addAction(microProfileDialog->toggleViewAction()); debug_menu->addAction(disasmWidget->toggleViewAction()); debug_menu->addAction(registersWidget->toggleViewAction()); debug_menu->addAction(callstackWidget->toggleViewAction()); debug_menu->addAction(graphicsWidget->toggleViewAction()); debug_menu->addAction(graphicsCommandsWidget->toggleViewAction()); debug_menu->addAction(graphicsBreakpointsWidget->toggleViewAction()); debug_menu->addAction(graphicsFramebufferWidget->toggleViewAction()); debug_menu->addAction(graphicsVertexShaderWidget->toggleViewAction()); debug_menu->addAction(graphicsTracingWidget->toggleViewAction()); // Set default UI state // geometry: 55% of the window contents are in the upper screen half, 45% in the lower half QDesktopWidget* desktop = ((QApplication*)QApplication::instance())->desktop(); QRect screenRect = desktop->screenGeometry(this); int x, y, w, h; w = screenRect.width() * 2 / 3; h = screenRect.height() / 2; x = (screenRect.x() + screenRect.width()) / 2 - w / 2; y = (screenRect.y() + screenRect.height()) / 2 - h * 55 / 100; setGeometry(x, y, w, h); // Restore UI state QSettings settings; settings.beginGroup("UILayout"); restoreGeometry(settings.value("geometry").toByteArray()); restoreState(settings.value("state").toByteArray()); render_window->restoreGeometry(settings.value("geometryRenderWindow").toByteArray()); microProfileDialog->restoreGeometry(settings.value("microProfileDialogGeometry").toByteArray()); microProfileDialog->setVisible(settings.value("microProfileDialogVisible").toBool()); settings.endGroup(); game_list->LoadInterfaceLayout(settings); ui.action_Use_Hardware_Renderer->setChecked(Settings::values.use_hw_renderer); SetHardwareRendererEnabled(ui.action_Use_Hardware_Renderer->isChecked()); ui.action_Use_Shader_JIT->setChecked(Settings::values.use_shader_jit); SetShaderJITEnabled(ui.action_Use_Shader_JIT->isChecked()); ui.action_Single_Window_Mode->setChecked(settings.value("singleWindowMode", true).toBool()); ToggleWindowMode(); ui.actionDisplay_widget_title_bars->setChecked(settings.value("displayTitleBars", true).toBool()); OnDisplayTitleBars(ui.actionDisplay_widget_title_bars->isChecked()); // Prepare actions for recent files for (int i = 0; i < max_recent_files_item; ++i) { actions_recent_files[i] = new QAction(this); actions_recent_files[i]->setVisible(false); connect(actions_recent_files[i], SIGNAL(triggered()), this, SLOT(OnMenuRecentFile())); ui.menu_recent_files->addAction(actions_recent_files[i]); } UpdateRecentFiles(); // Setup connections connect(game_list, SIGNAL(GameChosen(QString)), this, SLOT(OnGameListLoadFile(QString))); connect(ui.action_Load_File, SIGNAL(triggered()), this, SLOT(OnMenuLoadFile())); connect(ui.action_Load_Symbol_Map, SIGNAL(triggered()), this, SLOT(OnMenuLoadSymbolMap())); connect(ui.action_Select_Game_List_Root, SIGNAL(triggered()), this, SLOT(OnMenuSelectGameListRoot())); 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_Use_Hardware_Renderer, SIGNAL(triggered(bool)), this, SLOT(SetHardwareRendererEnabled(bool))); connect(ui.action_Use_Shader_JIT, SIGNAL(triggered(bool)), this, SLOT(SetShaderJITEnabled(bool))); connect(ui.action_Single_Window_Mode, SIGNAL(triggered(bool)), this, SLOT(ToggleWindowMode())); connect(ui.action_Hotkeys, SIGNAL(triggered()), this, SLOT(OnOpenHotkeysDialog())); connect(this, SIGNAL(EmulationStarting(EmuThread*)), disasmWidget, SLOT(OnEmulationStarting(EmuThread*))); connect(this, SIGNAL(EmulationStopping()), disasmWidget, SLOT(OnEmulationStopping())); connect(this, SIGNAL(EmulationStarting(EmuThread*)), registersWidget, SLOT(OnEmulationStarting(EmuThread*))); connect(this, SIGNAL(EmulationStopping()), registersWidget, SLOT(OnEmulationStopping())); connect(this, SIGNAL(EmulationStarting(EmuThread*)), render_window, SLOT(OnEmulationStarting(EmuThread*))); connect(this, SIGNAL(EmulationStopping()), render_window, SLOT(OnEmulationStopping())); connect(this, SIGNAL(EmulationStarting(EmuThread*)), graphicsTracingWidget, SLOT(OnEmulationStarting(EmuThread*))); connect(this, SIGNAL(EmulationStopping()), graphicsTracingWidget, SLOT(OnEmulationStopping())); // Setup hotkeys RegisterHotkey("Main Window", "Load File", QKeySequence::Open); RegisterHotkey("Main Window", "Start Emulation"); LoadHotkeys(settings); connect(GetHotkey("Main Window", "Load File", this), SIGNAL(activated()), this, SLOT(OnMenuLoadFile())); connect(GetHotkey("Main Window", "Start Emulation", this), SIGNAL(activated()), this, SLOT(OnStartGame())); std::string window_title = Common::StringFromFormat("Citra | %s-%s", Common::g_scm_branch, Common::g_scm_desc); setWindowTitle(window_title.c_str()); show(); game_list->PopulateAsync(settings.value("gameListRootDir").toString(), settings.value("gameListDeepScan").toBool()); QStringList args = QApplication::arguments(); if (args.length() >= 2) { BootGame(args[1].toStdString()); } }