Qt: Add (empty) status bar

This commit is contained in:
Yuri Kunde Schlesner 2017-02-18 12:09:14 -08:00
parent 441f8b5a4b
commit 1b28b26682
6 changed files with 35 additions and 1 deletions

View file

@ -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);

View file

@ -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<QStandardItem*>>("QList<QStandardItem*>");
layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(tree_view);
setLayout(layout);
}

View file

@ -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();

View file

@ -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> config;
// Whether emulation is currently running in Citra.
bool emulation_running = false;
std::unique_ptr<EmuThread> emu_thread;
// Debugger panes
ProfilerWidget* profilerWidget;
MicroProfileDialog* microProfileDialog;
DisassemblerWidget* disasmWidget;

View file

@ -88,6 +88,7 @@
</widget>
<addaction name="action_Single_Window_Mode"/>
<addaction name="action_Display_Dock_Widget_Headers"/>
<addaction name="action_Show_Status_Bar"/>
<addaction name="menu_View_Debugging"/>
</widget>
<widget class="QMenu" name="menu_Help">
@ -101,7 +102,6 @@
<addaction name="menu_View"/>
<addaction name="menu_Help"/>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<action name="action_Load_File">
<property name="text">
<string>Load File...</string>
@ -167,6 +167,14 @@
<string>Display Dock Widget Headers</string>
</property>
</action>
<action name="action_Show_Status_Bar">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Show Status Bar</string>
</property>
</action>
<action name="action_Select_Game_List_Root">
<property name="text">
<string>Select Game Directory...</string>

View file

@ -27,6 +27,7 @@ struct Values {
bool single_window_mode;
bool display_titlebar;
bool show_status_bar;
bool confirm_before_closing;
bool first_start;