Gui: expose various overlay UI options to preference pages

This commit is contained in:
Zheng, Lei
2022-11-24 08:00:15 +08:00
committed by Yorik van Havre
parent ba6b2a4375
commit 033f520cc5
12 changed files with 1419 additions and 79 deletions

View File

@@ -47,12 +47,15 @@
#include <Gui/DlgPreferencePackManagementImp.h>
#include <Gui/DlgRevertToBackupConfigImp.h>
#include <Gui/MainWindow.h>
#include <Gui/OverlayManager.h>
#include <Gui/ParamHandler.h>
#include <Gui/PreferencePackManager.h>
#include <Gui/Language/Translator.h>
#include "DlgSettingsGeneral.h"
#include "ui_DlgSettingsGeneral.h"
using namespace Gui;
using namespace Gui::Dialog;
namespace fs = boost::filesystem;
using namespace Base;
@@ -655,4 +658,34 @@ void DlgSettingsGeneral::onThemeChanged(int index) {
themeChanged = true;
}
///////////////////////////////////////////////////////////
namespace {
class ApplyDockWidget: public ParamHandler {
public:
bool onChange(const ParamKey *) override {
OverlayManager::instance()->reload(OverlayManager::ReloadMode::ReloadPause);
return true;
}
void onTimer() override {
getMainWindow()->initDockWindows(true);
OverlayManager::instance()->reload(OverlayManager::ReloadMode::ReloadResume);
}
};
} // anonymous namespace
void DlgSettingsGeneral::attachObserver()
{
static ParamHandlers handlers;
auto hDockWindows = App::GetApplication().GetUserParameter().GetGroup("BaseApp/Preferences/DockWindows");
auto applyDockWidget = std::shared_ptr<ParamHandler>(new ApplyDockWidget);
handlers.addHandler(ParamKey(hDockWindows->GetGroup("ComboView"), "Enabled"), applyDockWidget);
handlers.addHandler(ParamKey(hDockWindows->GetGroup("TreeView"), "Enabled"), applyDockWidget);
handlers.addHandler(ParamKey(hDockWindows->GetGroup("PropertyView"), "Enabled"), applyDockWidget);
handlers.addHandler(ParamKey(hDockWindows->GetGroup("DAGView"), "Enabled"), applyDockWidget);
}
#include "moc_DlgSettingsGeneral.cpp"