mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 23:25:53 +08:00
refs #512, added settings to dock widget for testing
This commit is contained in:
@@ -541,4 +541,30 @@ namespace BlackGui
|
||||
this->setStyleSheet(qss);
|
||||
}
|
||||
|
||||
QString CDockWidget::getNameForSettings() const
|
||||
{
|
||||
return this->m_windowTitleBackup.toLower().remove(' '); // let`s see how far I get with that
|
||||
}
|
||||
|
||||
CSettingsDockWidget CDockWidget::getSettings() const
|
||||
{
|
||||
const CSettingsDockWidgets all = this->m_settings.getCopy();
|
||||
const QString name(this->getNameForSettings());
|
||||
const CSettingsDockWidget s = all.value(name);
|
||||
return s;
|
||||
}
|
||||
|
||||
void CDockWidget::setSettings(const CSettingsDockWidget &settings)
|
||||
{
|
||||
const CSettingsDockWidget current = getSettings();
|
||||
if (current == settings) { return; }
|
||||
CSettingsDockWidgets all = this->m_settings.getCopy();
|
||||
const QString name(this->getNameForSettings());
|
||||
all.insert(name, settings);
|
||||
const CStatusMessage m = this->m_settings.setAndSave(all);
|
||||
if (m.isFailure())
|
||||
{
|
||||
CLogMessage::preformatted(m);
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackgui/enableforframelesswindow.h"
|
||||
#include "blackgui/managedstatusbar.h"
|
||||
#include "blackgui/settings/settingsdockwidget.h"
|
||||
#include "blackmisc/statusmessage.h"
|
||||
#include "blackmisc/statusmessagelist.h"
|
||||
|
||||
@@ -215,6 +216,7 @@ namespace BlackGui
|
||||
bool m_selected = false; //!< selected when tabbed
|
||||
bool m_dockWidgetVisible = false; //!< logical visible, not to be confused with QDockWidget::isVisible()
|
||||
bool m_wasFrameless = false; //!< frameless when last floating
|
||||
BlackMisc::CSetting<BlackGui::Settings::SettingsDockWidgets> m_settings { this, &CDockWidget::ps_settingsChanged };
|
||||
|
||||
//! Empty widget with no size
|
||||
void initTitleBarWidgets();
|
||||
@@ -224,8 +226,16 @@ namespace BlackGui
|
||||
|
||||
//! Force a style sheet update
|
||||
void forceStyleSheetUpdate();
|
||||
};
|
||||
|
||||
//! Name used as key for settings
|
||||
QString getNameForSettings() const;
|
||||
|
||||
//! This widget`s settings
|
||||
BlackGui::Settings::CSettingsDockWidget getSettings() const;
|
||||
|
||||
//! Save my updated settings
|
||||
void setAndSaveSettings(const BlackGui::Settings::CSettingsDockWidget &settings);
|
||||
};
|
||||
} // namespace
|
||||
|
||||
#endif // guard
|
||||
|
||||
Reference in New Issue
Block a user