mirror of
https://github.com/KDE/latte-dock.git
synced 2025-01-09 17:18:11 +03:00
add theme roundness option at preferences page
This commit is contained in:
parent
59f66233f2
commit
f2d088a297
@ -66,6 +66,7 @@ const int BORDERSCOLUMN = 5;
|
||||
const int ACTIVITYCOLUMN = 6;
|
||||
|
||||
const int SCREENTRACKERDEFAULTVALUE = 2500;
|
||||
const int THEMEDEFAULTROUNDNESS = 0; //Breeze default value is used 0px.
|
||||
|
||||
const QChar CheckMark{0x2714};
|
||||
|
||||
@ -131,6 +132,7 @@ SettingsDialog::SettingsDialog(QWidget *parent, DockCorona *corona)
|
||||
m_mouseSensitivityButtons->setExclusive(true);
|
||||
|
||||
ui->screenTrackerSpinBox->setValue(m_corona->universalSettings()->screenTrackerInterval());
|
||||
ui->themeRoundnessSpinBox->setValue(m_corona->universalSettings()->plasmaThemeRoundness());
|
||||
|
||||
//! About Menu
|
||||
QMenuBar *menuBar = new QMenuBar(this);
|
||||
@ -184,6 +186,10 @@ SettingsDialog::SettingsDialog(QWidget *parent, DockCorona *corona)
|
||||
updateApplyButtonsState();
|
||||
});
|
||||
|
||||
connect(ui->themeRoundnessSpinBox, QOverload<int>::of(&QSpinBox::valueChanged), [ = ](int i) {
|
||||
updateApplyButtonsState();
|
||||
});
|
||||
|
||||
connect(ui->autostartChkBox, &QCheckBox::stateChanged, this, &SettingsDialog::updateApplyButtonsState);
|
||||
connect(ui->metaChkBox, &QCheckBox::stateChanged, this, &SettingsDialog::updateApplyButtonsState);
|
||||
connect(ui->infoWindowChkBox, &QCheckBox::stateChanged, this, &SettingsDialog::updateApplyButtonsState);
|
||||
@ -746,6 +752,7 @@ void SettingsDialog::restoreDefaults()
|
||||
ui->noBordersForMaximizedChkBox->setChecked(false);
|
||||
ui->highSensitivityBtn->setChecked(true);
|
||||
ui->screenTrackerSpinBox->setValue(SCREENTRACKERDEFAULTVALUE);
|
||||
ui->themeRoundnessSpinBox->setValue(THEMEDEFAULTROUNDNESS);
|
||||
}
|
||||
}
|
||||
|
||||
@ -945,6 +952,7 @@ QList<int> SettingsDialog::currentSettings()
|
||||
settings << (int)ui->noBordersForMaximizedChkBox->isChecked();
|
||||
settings << m_mouseSensitivityButtons->checkedId();
|
||||
settings << ui->screenTrackerSpinBox->value();
|
||||
settings << ui->themeRoundnessSpinBox->value();
|
||||
settings << m_model->rowCount();
|
||||
|
||||
return settings;
|
||||
@ -1194,9 +1202,13 @@ void SettingsDialog::updateApplyButtonsState()
|
||||
} else if (ui->tabWidget->currentIndex() == 1) {
|
||||
//! Defaults for general Latte settings
|
||||
|
||||
if (!ui->autostartChkBox->isChecked() || ui->metaChkBox->isChecked()
|
||||
|| !ui->infoWindowChkBox->isChecked() || ui->noBordersForMaximizedChkBox->isChecked()
|
||||
|| !ui->highSensitivityBtn->isChecked() || ui->screenTrackerSpinBox->value() != SCREENTRACKERDEFAULTVALUE) {
|
||||
if (!ui->autostartChkBox->isChecked()
|
||||
|| ui->metaChkBox->isChecked()
|
||||
|| !ui->infoWindowChkBox->isChecked()
|
||||
|| ui->noBordersForMaximizedChkBox->isChecked()
|
||||
|| !ui->highSensitivityBtn->isChecked()
|
||||
|| ui->screenTrackerSpinBox->value() != SCREENTRACKERDEFAULTVALUE
|
||||
|| ui->themeRoundnessSpinBox->value() != THEMEDEFAULTROUNDNESS) {
|
||||
ui->buttonBox->button(QDialogButtonBox::RestoreDefaults)->setEnabled(true);
|
||||
} else {
|
||||
ui->buttonBox->button(QDialogButtonBox::RestoreDefaults)->setEnabled(false);
|
||||
@ -1326,6 +1338,7 @@ bool SettingsDialog::saveAllChanges()
|
||||
m_corona->universalSettings()->setShowInfoWindow(showInfoWindow);
|
||||
m_corona->universalSettings()->setCanDisableBorders(noBordersForMaximized);
|
||||
m_corona->universalSettings()->setScreenTrackerInterval(ui->screenTrackerSpinBox->value());
|
||||
m_corona->universalSettings()->setPlasmaThemeRoundness(ui->themeRoundnessSpinBox->value());
|
||||
|
||||
//! Update Layouts
|
||||
QStringList knownActivities = activities();
|
||||
|
@ -444,8 +444,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>798</width>
|
||||
<height>505</height>
|
||||
<width>805</width>
|
||||
<height>518</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||
@ -896,6 +896,109 @@ This tracker is used in order to not lose any screen related update.</string>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_11">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="plasmaLbl">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Plasma Theme</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_12">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_12">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="plasmaRoundnessLbl">
|
||||
<property name="toolTip">
|
||||
<string>Roundess used from Latte elements in order to feel part of the current plasma theme.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Background roundness</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="themeRoundnessSpinBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Roundess used from Latte elements in order to feel part of the current plasma theme.</string>
|
||||
</property>
|
||||
<property name="specialValueText">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> px.</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>24</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_13">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_6">
|
||||
<property name="orientation">
|
||||
|
@ -51,6 +51,7 @@ UniversalSettings::UniversalSettings(KSharedConfig::Ptr config, QObject *parent)
|
||||
connect(this, &UniversalSettings::layoutsMemoryUsageChanged, this, &UniversalSettings::saveConfig);
|
||||
connect(this, &UniversalSettings::layoutsWindowSizeChanged, this, &UniversalSettings::saveConfig);
|
||||
connect(this, &UniversalSettings::mouseSensitivityChanged, this, &UniversalSettings::saveConfig);
|
||||
connect(this, &UniversalSettings::plasmaThemeRoundnessChanged, this, &UniversalSettings::saveConfig);
|
||||
connect(this, &UniversalSettings::screenTrackerIntervalChanged, this, &UniversalSettings::saveConfig);
|
||||
connect(this, &UniversalSettings::showInfoWindowChanged, this, &UniversalSettings::saveConfig);
|
||||
connect(this, &UniversalSettings::versionChanged, this, &UniversalSettings::saveConfig);
|
||||
@ -158,6 +159,21 @@ void UniversalSettings::load()
|
||||
parseGlobalShortcuts();
|
||||
}
|
||||
|
||||
int UniversalSettings::plasmaThemeRoundness() const
|
||||
{
|
||||
return m_plasmaThemeRoundness;
|
||||
}
|
||||
|
||||
void UniversalSettings::setPlasmaThemeRoundness(int roundness)
|
||||
{
|
||||
if (m_plasmaThemeRoundness == roundness) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_plasmaThemeRoundness = roundness;
|
||||
emit plasmaThemeRoundnessChanged();
|
||||
}
|
||||
|
||||
bool UniversalSettings::showInfoWindow() const
|
||||
{
|
||||
return m_showInfoWindow;
|
||||
@ -442,6 +458,7 @@ void UniversalSettings::loadConfig()
|
||||
m_layoutsWindowSize = m_universalGroup.readEntry("layoutsWindowSize", QSize(700, 450));
|
||||
m_layoutsColumnWidths = m_universalGroup.readEntry("layoutsColumnWidths", QStringList());
|
||||
m_launchers = m_universalGroup.readEntry("launchers", QStringList());
|
||||
m_plasmaThemeRoundness = m_universalGroup.readEntry("plasmaThemeRoundness", 0);
|
||||
m_screenTrackerInterval = m_universalGroup.readEntry("screenTrackerInterval", 2500);
|
||||
m_showInfoWindow = m_universalGroup.readEntry("showInfoWindow", true);
|
||||
m_memoryUsage = static_cast<Dock::LayoutsMemoryUsage>(m_universalGroup.readEntry("memoryUsage", (int)Dock::SingleLayout));
|
||||
@ -458,6 +475,7 @@ void UniversalSettings::saveConfig()
|
||||
m_universalGroup.writeEntry("layoutsWindowSize", m_layoutsWindowSize);
|
||||
m_universalGroup.writeEntry("layoutsColumnWidths", m_layoutsColumnWidths);
|
||||
m_universalGroup.writeEntry("launchers", m_launchers);
|
||||
m_universalGroup.writeEntry("plasmaThemeRoundness", m_plasmaThemeRoundness);
|
||||
m_universalGroup.writeEntry("screenTrackerInterval", m_screenTrackerInterval);
|
||||
m_universalGroup.writeEntry("showInfoWindow", m_showInfoWindow);
|
||||
m_universalGroup.writeEntry("memoryUsage", (int)m_memoryUsage);
|
||||
|
@ -42,6 +42,9 @@ class UniversalSettings : public QObject
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool autostart READ autostart WRITE setAutostart NOTIFY autostartChanged)
|
||||
Q_PROPERTY(bool showInfoWindow READ showInfoWindow WRITE setShowInfoWindow NOTIFY showInfoWindowChanged)
|
||||
|
||||
Q_PROPERTY(int plasmaThemeRoundness READ plasmaThemeRoundness NOTIFY plasmaThemeRoundnessChanged)
|
||||
|
||||
Q_PROPERTY(QString currentLayoutName READ currentLayoutName WRITE setCurrentLayoutName NOTIFY currentLayoutNameChanged)
|
||||
|
||||
Q_PROPERTY(QStringList badgesForActivate READ badgesForActivate NOTIFY badgesForActivateChanged)
|
||||
@ -68,6 +71,9 @@ public:
|
||||
bool showInfoWindow() const;
|
||||
void setShowInfoWindow(bool show);
|
||||
|
||||
int plasmaThemeRoundness() const;
|
||||
void setPlasmaThemeRoundness(int roundness);
|
||||
|
||||
int version() const;
|
||||
void setVersion(int ver);
|
||||
|
||||
@ -120,6 +126,7 @@ signals:
|
||||
void launchersChanged();
|
||||
void layoutsMemoryUsageChanged();
|
||||
void mouseSensitivityChanged();
|
||||
void plasmaThemeRoundnessChanged();
|
||||
void runningActivitiesModelChanged();
|
||||
void screenTrackerIntervalChanged();
|
||||
void showInfoWindowChanged();
|
||||
@ -148,6 +155,9 @@ private:
|
||||
bool m_canDisableBorders{false};
|
||||
bool m_showInfoWindow{true};
|
||||
|
||||
//! this Breeze default value
|
||||
int m_plasmaThemeRoundness{0};
|
||||
|
||||
//when there isnt a version it is an old universal file
|
||||
int m_version{1};
|
||||
|
||||
|
@ -479,7 +479,7 @@ Item{
|
||||
anchors.fill: solidBackground
|
||||
opacity: root.forceColorizeFromActiveWindowScheme ? solidBackground.opacity : 0
|
||||
backgroundColor: root.forceColorizeFromActiveWindowScheme ? dock.visibility.touchingWindowScheme.backgroundColor : "transparent"
|
||||
roundness: 4
|
||||
roundness: universalSettings ? universalSettings.plasmaThemeRoundness : 0
|
||||
}
|
||||
|
||||
PlasmaCore.FrameSvgItem{
|
||||
|
Loading…
Reference in New Issue
Block a user