From 1b28b2668274dc266a7f523760a264c1af1044de Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Sat, 18 Feb 2017 12:09:14 -0800 Subject: Qt: Add (empty) status bar --- src/citra_qt/config.cpp | 2 ++ src/citra_qt/game_list.cpp | 1 + src/citra_qt/main.cpp | 16 ++++++++++++++++ src/citra_qt/main.h | 6 ++++++ src/citra_qt/main.ui | 10 +++++++++- src/citra_qt/ui_settings.h | 1 + 6 files changed, 35 insertions(+), 1 deletion(-) (limited to 'src/citra_qt') diff --git a/src/citra_qt/config.cpp b/src/citra_qt/config.cpp index b65f57fdc..5fe57dfa2 100644 --- a/src/citra_qt/config.cpp +++ b/src/citra_qt/config.cpp @@ -146,6 +146,7 @@ void Config::ReadValues() { UISettings::values.single_window_mode = qt_config->value("singleWindowMode", true).toBool(); UISettings::values.display_titlebar = qt_config->value("displayTitleBars", true).toBool(); + UISettings::values.show_status_bar = qt_config->value("showStatusBar", true).toBool(); UISettings::values.confirm_before_closing = qt_config->value("confirmClose", true).toBool(); UISettings::values.first_start = qt_config->value("firstStart", true).toBool(); @@ -252,6 +253,7 @@ void Config::SaveValues() { qt_config->setValue("singleWindowMode", UISettings::values.single_window_mode); qt_config->setValue("displayTitleBars", UISettings::values.display_titlebar); + qt_config->setValue("showStatusBar", UISettings::values.show_status_bar); qt_config->setValue("confirmClose", UISettings::values.confirm_before_closing); qt_config->setValue("firstStart", UISettings::values.first_start); diff --git a/src/citra_qt/game_list.cpp b/src/citra_qt/game_list.cpp index 222c82b1c..f15083b0a 100644 --- a/src/citra_qt/game_list.cpp +++ b/src/citra_qt/game_list.cpp @@ -44,6 +44,7 @@ GameList::GameList(QWidget* parent) : QWidget{parent} { // with signals/slots. In this case, QList falls under the umbrells of custom types. qRegisterMetaType>("QList"); + layout->setContentsMargins(0, 0, 0, 0); layout->addWidget(tree_view); setLayout(layout); } diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index 513da8001..43530b275 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -94,6 +94,17 @@ void GMainWindow::InitializeWidgets() { game_list = new GameList(); ui.horizontalLayout->addWidget(game_list); + + // Create status bar + emu_speed_label = new QLabel(); + game_fps_label = new QLabel(); + emu_frametime_label = new QLabel(); + + for (auto& label : {emu_speed_label, game_fps_label, emu_frametime_label}) { + label->setVisible(false); + statusBar()->addPermanentWidget(label); + } + statusBar()->setVisible(true); } void GMainWindow::InitializeDebugWidgets() { @@ -229,6 +240,9 @@ void GMainWindow::RestoreUIState() { ui.action_Display_Dock_Widget_Headers->setChecked(UISettings::values.display_titlebar); OnDisplayTitleBars(ui.action_Display_Dock_Widget_Headers->isChecked()); + + ui.action_Show_Status_Bar->setChecked(UISettings::values.show_status_bar); + statusBar()->setVisible(ui.action_Show_Status_Bar->isChecked()); } void GMainWindow::ConnectWidgetEvents() { @@ -261,6 +275,7 @@ void GMainWindow::ConnectMenuEvents() { &GMainWindow::ToggleWindowMode); connect(ui.action_Display_Dock_Widget_Headers, &QAction::triggered, this, &GMainWindow::OnDisplayTitleBars); + connect(ui.action_Show_Status_Bar, &QAction::triggered, statusBar(), &QStatusBar::setVisible); } void GMainWindow::OnDisplayTitleBars(bool show) { @@ -624,6 +639,7 @@ void GMainWindow::closeEvent(QCloseEvent* event) { #endif UISettings::values.single_window_mode = ui.action_Single_Window_Mode->isChecked(); UISettings::values.display_titlebar = ui.action_Display_Dock_Widget_Headers->isChecked(); + UISettings::values.show_status_bar = ui.action_Show_Status_Bar->isChecked(); UISettings::values.first_start = false; game_list->SaveInterfaceLayout(); diff --git a/src/citra_qt/main.h b/src/citra_qt/main.h index 87637b92b..3cbf4ea99 100644 --- a/src/citra_qt/main.h +++ b/src/citra_qt/main.h @@ -132,12 +132,18 @@ private: GRenderWindow* render_window; GameList* game_list; + // Status bar elements + QLabel* emu_speed_label = nullptr; + QLabel* game_fps_label = nullptr; + QLabel* emu_frametime_label = nullptr; + std::unique_ptr config; // Whether emulation is currently running in Citra. bool emulation_running = false; std::unique_ptr emu_thread; + // Debugger panes ProfilerWidget* profilerWidget; MicroProfileDialog* microProfileDialog; DisassemblerWidget* disasmWidget; diff --git a/src/citra_qt/main.ui b/src/citra_qt/main.ui index 4a95cda9a..47dbb6ef7 100644 --- a/src/citra_qt/main.ui +++ b/src/citra_qt/main.ui @@ -88,6 +88,7 @@ + @@ -101,7 +102,6 @@ - Load File... @@ -167,6 +167,14 @@ Display Dock Widget Headers + + + true + + + Show Status Bar + + Select Game Directory... diff --git a/src/citra_qt/ui_settings.h b/src/citra_qt/ui_settings.h index ed7fdff7e..6408ece2b 100644 --- a/src/citra_qt/ui_settings.h +++ b/src/citra_qt/ui_settings.h @@ -27,6 +27,7 @@ struct Values { bool single_window_mode; bool display_titlebar; + bool show_status_bar; bool confirm_before_closing; bool first_start; -- cgit v1.2.3