1
0
Fork 0

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.single_window_mode = qt_config->value("singleWindowMode", true).toBool();
UISettings::values.display_titlebar = qt_config->value("displayTitleBars", 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.confirm_before_closing = qt_config->value("confirmClose", true).toBool();
UISettings::values.first_start = qt_config->value("firstStart", 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("singleWindowMode", UISettings::values.single_window_mode);
qt_config->setValue("displayTitleBars", UISettings::values.display_titlebar); 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("confirmClose", UISettings::values.confirm_before_closing);
qt_config->setValue("firstStart", UISettings::values.first_start); 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. // with signals/slots. In this case, QList falls under the umbrells of custom types.
qRegisterMetaType<QList<QStandardItem*>>("QList<QStandardItem*>"); qRegisterMetaType<QList<QStandardItem*>>("QList<QStandardItem*>");
layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(tree_view); layout->addWidget(tree_view);
setLayout(layout); setLayout(layout);
} }

View File

@ -94,6 +94,17 @@ void GMainWindow::InitializeWidgets() {
game_list = new GameList(); game_list = new GameList();
ui.horizontalLayout->addWidget(game_list); 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() { void GMainWindow::InitializeDebugWidgets() {
@ -229,6 +240,9 @@ void GMainWindow::RestoreUIState() {
ui.action_Display_Dock_Widget_Headers->setChecked(UISettings::values.display_titlebar); ui.action_Display_Dock_Widget_Headers->setChecked(UISettings::values.display_titlebar);
OnDisplayTitleBars(ui.action_Display_Dock_Widget_Headers->isChecked()); 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() { void GMainWindow::ConnectWidgetEvents() {
@ -261,6 +275,7 @@ void GMainWindow::ConnectMenuEvents() {
&GMainWindow::ToggleWindowMode); &GMainWindow::ToggleWindowMode);
connect(ui.action_Display_Dock_Widget_Headers, &QAction::triggered, this, connect(ui.action_Display_Dock_Widget_Headers, &QAction::triggered, this,
&GMainWindow::OnDisplayTitleBars); &GMainWindow::OnDisplayTitleBars);
connect(ui.action_Show_Status_Bar, &QAction::triggered, statusBar(), &QStatusBar::setVisible);
} }
void GMainWindow::OnDisplayTitleBars(bool show) { void GMainWindow::OnDisplayTitleBars(bool show) {
@ -624,6 +639,7 @@ void GMainWindow::closeEvent(QCloseEvent* event) {
#endif #endif
UISettings::values.single_window_mode = ui.action_Single_Window_Mode->isChecked(); UISettings::values.single_window_mode = ui.action_Single_Window_Mode->isChecked();
UISettings::values.display_titlebar = ui.action_Display_Dock_Widget_Headers->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; UISettings::values.first_start = false;
game_list->SaveInterfaceLayout(); game_list->SaveInterfaceLayout();

View File

@ -132,12 +132,18 @@ private:
GRenderWindow* render_window; GRenderWindow* render_window;
GameList* game_list; 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; std::unique_ptr<Config> config;
// Whether emulation is currently running in Citra. // Whether emulation is currently running in Citra.
bool emulation_running = false; bool emulation_running = false;
std::unique_ptr<EmuThread> emu_thread; std::unique_ptr<EmuThread> emu_thread;
// Debugger panes
ProfilerWidget* profilerWidget; ProfilerWidget* profilerWidget;
MicroProfileDialog* microProfileDialog; MicroProfileDialog* microProfileDialog;
DisassemblerWidget* disasmWidget; DisassemblerWidget* disasmWidget;

View File

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

View File

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