From 76c74ffc9633a9c69062f0477f84592fb899203a Mon Sep 17 00:00:00 2001 From: Kingcom Date: Tue, 6 Jan 2015 16:09:30 +0100 Subject: citra-qt: Add option to hide dock widget title bars --- src/citra_qt/main.cpp | 25 ++++++++++++++ src/citra_qt/main.h | 1 + src/citra_qt/main.ui | 94 ++++++++++++++++++++++++++++++++------------------- 3 files changed, 86 insertions(+), 34 deletions(-) (limited to 'src') diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index c6671bef1..3e7b5ddfe 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -114,6 +114,9 @@ GMainWindow::GMainWindow() 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()); + // Setup connections connect(ui.action_Load_File, SIGNAL(triggered()), this, SLOT(OnMenuLoadFile())); connect(ui.action_Load_Symbol_Map, SIGNAL(triggered()), this, SLOT(OnMenuLoadSymbolMap())); @@ -156,6 +159,27 @@ GMainWindow::~GMainWindow() Pica::g_debug_context.reset(); } +void GMainWindow::OnDisplayTitleBars(bool show) +{ + QList widgets = findChildren(); + + if (show) { + for (QDockWidget* widget: widgets) { + QWidget* old = widget->titleBarWidget(); + widget->setTitleBarWidget(nullptr); + if (old != nullptr) + delete old; + } + } else { + for (QDockWidget* widget: widgets) { + QWidget* old = widget->titleBarWidget(); + widget->setTitleBarWidget(new QWidget()); + if (old != nullptr) + delete old; + } + } +} + void GMainWindow::BootGame(std::string filename) { LOG_INFO(Frontend, "Citra starting...\n"); @@ -259,6 +283,7 @@ void GMainWindow::closeEvent(QCloseEvent* event) settings.setValue("state", saveState()); settings.setValue("geometryRenderWindow", render_window->saveGeometry()); settings.setValue("singleWindowMode", ui.action_Single_Window_Mode->isChecked()); + settings.setValue("displayTitleBars", ui.actionDisplay_widget_title_bars->isChecked()); settings.setValue("firstStart", false); SaveHotkeys(settings); diff --git a/src/citra_qt/main.h b/src/citra_qt/main.h index 72df17c50..dd53489dd 100644 --- a/src/citra_qt/main.h +++ b/src/citra_qt/main.h @@ -46,6 +46,7 @@ private slots: void OnMenuLoadSymbolMap(); void OnOpenHotkeysDialog(); void OnConfigure(); + void OnDisplayTitleBars(bool); void ToggleWindowMode(); private: diff --git a/src/citra_qt/main.ui b/src/citra_qt/main.ui index d06c207a0..a3752ac1e 100644 --- a/src/citra_qt/main.ui +++ b/src/citra_qt/main.ui @@ -32,7 +32,7 @@ 0 0 1081 - 20 + 21 @@ -59,6 +59,7 @@ &View + @@ -73,17 +74,17 @@ - - - Load File... - - - - - Load Symbol Map... - - - + + + Load File... + + + + + Load Symbol Map... + + + E&xit @@ -101,28 +102,28 @@ &Pause - - - false - - - &Stop - - - - - About Citra - - - - - true - - - Single Window Mode - - - + + + false + + + &Stop + + + + + About Citra + + + + + true + + + Single Window Mode + + + Configure &Hotkeys ... @@ -132,6 +133,14 @@ Configure ... + + + true + + + Display Dock Widget Headers + + @@ -167,8 +176,25 @@ + + actionDisplay_widget_title_bars + triggered(bool) + MainWindow + OnDisplayTitleBars(bool) + + + -1 + -1 + + + 540 + 364 + + + OnConfigure() + OnDisplayTitleBars(bool) -- cgit v1.2.3