mirror of
https://github.com/KDE/latte-dock.git
synced 2025-01-27 06:03:51 +03:00
add outline width option in Preferences
This commit is contained in:
parent
f3f6dccf65
commit
aaee132951
@ -51,6 +51,11 @@ Theme::Theme(KSharedConfig::Ptr config, QObject *parent) :
|
||||
|
||||
loadConfig();
|
||||
|
||||
connect(this, &Theme::outlineWidthChanged, this, &Theme::saveConfig);
|
||||
connect(this, &Theme::userSetRoundnessChanged, this, &Theme::saveConfig);
|
||||
|
||||
connect(this, &Theme::userSetRoundnessChanged, this, &Theme::roundnessChanged);
|
||||
|
||||
connect(&m_theme, &Plasma::Theme::themeChanged, this, &Theme::hasShadowChanged);
|
||||
connect(&m_theme, &Plasma::Theme::themeChanged, this, &Theme::load);
|
||||
connect(&m_theme, &Plasma::Theme::themeChanged, this, &Theme::themeChanged);
|
||||
@ -110,6 +115,21 @@ int Theme::rightEdgeRoundness() const
|
||||
return ((themeHasExtendedInfo() && m_userRoundness == -1) ? m_rightEdgeRoundness : qMax(0, m_userRoundness));
|
||||
}
|
||||
|
||||
int Theme::outlineWidth() const
|
||||
{
|
||||
return m_outlineWidth;
|
||||
}
|
||||
|
||||
void Theme::setOutlineWidth(int width)
|
||||
{
|
||||
if (m_outlineWidth == width) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_outlineWidth = width;
|
||||
emit outlineWidthChanged();
|
||||
}
|
||||
|
||||
int Theme::userThemeRoundness() const
|
||||
{
|
||||
return m_userRoundness;
|
||||
@ -123,9 +143,7 @@ void Theme::setUserThemeRoundness(int roundness)
|
||||
|
||||
m_userRoundness = roundness;
|
||||
|
||||
emit roundnessChanged();
|
||||
|
||||
saveConfig();
|
||||
emit userSetRoundnessChanged();
|
||||
}
|
||||
|
||||
float Theme::backgroundMaxOpacity() const
|
||||
@ -511,11 +529,13 @@ void Theme::loadThemeLightness()
|
||||
void Theme::loadConfig()
|
||||
{
|
||||
setUserThemeRoundness(m_themeGroup.readEntry("userSetPlasmaThemeRoundness", -1));
|
||||
setOutlineWidth(m_themeGroup.readEntry("outlineWidth", 1));
|
||||
}
|
||||
|
||||
void Theme::saveConfig()
|
||||
{
|
||||
m_themeGroup.writeEntry("userSetPlasmaThemeRoundness", m_userRoundness);
|
||||
m_themeGroup.writeEntry("outlineWidth", m_outlineWidth);
|
||||
|
||||
m_themeGroup.sync();
|
||||
}
|
||||
|
@ -57,6 +57,8 @@ class Theme: public QObject
|
||||
Q_PROPERTY(int topEdgeRoundness READ topEdgeRoundness NOTIFY roundnessChanged)
|
||||
Q_PROPERTY(int rightEdgeRoundness READ rightEdgeRoundness NOTIFY roundnessChanged)
|
||||
|
||||
Q_PROPERTY(int outlineWidth READ outlineWidth NOTIFY outlineWidthChanged)
|
||||
|
||||
Q_PROPERTY(float backgroundMaxOpacity READ backgroundMaxOpacity NOTIFY backgroundMaxOpacityChanged)
|
||||
|
||||
Q_PROPERTY(SchemeColors *defaultTheme READ defaultTheme NOTIFY themeChanged)
|
||||
@ -76,6 +78,9 @@ public:
|
||||
int topEdgeRoundness() const;
|
||||
int rightEdgeRoundness() const;
|
||||
|
||||
int outlineWidth() const;
|
||||
void setOutlineWidth(int width);
|
||||
|
||||
int userThemeRoundness() const;
|
||||
void setUserThemeRoundness(int roundness);
|
||||
|
||||
@ -90,8 +95,10 @@ public:
|
||||
signals:
|
||||
void backgroundMaxOpacityChanged();
|
||||
void hasShadowChanged();
|
||||
void outlineWidthChanged();
|
||||
void roundnessChanged();
|
||||
void themeChanged();
|
||||
void userSetRoundnessChanged();
|
||||
|
||||
private slots:
|
||||
void loadConfig();
|
||||
@ -119,6 +126,7 @@ private:
|
||||
int m_leftEdgeRoundness{0};
|
||||
int m_topEdgeRoundness{0};
|
||||
int m_rightEdgeRoundness{0};
|
||||
int m_outlineWidth{1};
|
||||
int m_userRoundness{-1};
|
||||
|
||||
float m_backgroundMaxOpacity{1};
|
||||
|
@ -71,6 +71,7 @@ const int ACTIVITYCOLUMN = 6;
|
||||
|
||||
const int SCREENTRACKERDEFAULTVALUE = 2500;
|
||||
const int THEMEDEFAULTROUNDNESS = 0; //Breeze default value is used 0px.
|
||||
const int OUTLINEDEFAULTWIDTH = 1;
|
||||
|
||||
const QChar CheckMark{0x2714};
|
||||
|
||||
@ -138,6 +139,7 @@ SettingsDialog::SettingsDialog(QWidget *parent, Latte::Corona *corona)
|
||||
ui->screenTrackerSpinBox->setValue(m_corona->universalSettings()->screenTrackerInterval());
|
||||
ui->themeRoundnessSpinBox->setSpecialValueText(i18nc("automatic background roundness","Automatic"));
|
||||
ui->themeRoundnessSpinBox->setValue(m_corona->themeExtended()->userThemeRoundness());
|
||||
ui->outlineSpinBox->setValue(m_corona->themeExtended()->outlineWidth());
|
||||
|
||||
//! About Menu
|
||||
QMenuBar *menuBar = new QMenuBar(this);
|
||||
@ -195,6 +197,10 @@ SettingsDialog::SettingsDialog(QWidget *parent, Latte::Corona *corona)
|
||||
updateApplyButtonsState();
|
||||
});
|
||||
|
||||
connect(ui->outlineSpinBox, QOverload<int>::of(&QSpinBox::valueChanged), [ = ](int i) {
|
||||
updateApplyButtonsState();
|
||||
});
|
||||
|
||||
connect(ui->autostartChkBox, &QCheckBox::stateChanged, this, &SettingsDialog::updateApplyButtonsState);
|
||||
connect(ui->metaPressChkBox, &QCheckBox::stateChanged, this, &SettingsDialog::updateApplyButtonsState);
|
||||
connect(ui->metaPressHoldChkBox, &QCheckBox::stateChanged, this, &SettingsDialog::updateApplyButtonsState);
|
||||
@ -760,6 +766,7 @@ void SettingsDialog::restoreDefaults()
|
||||
ui->highSensitivityBtn->setChecked(true);
|
||||
ui->screenTrackerSpinBox->setValue(SCREENTRACKERDEFAULTVALUE);
|
||||
ui->themeRoundnessSpinBox->setValue(THEMEDEFAULTROUNDNESS);
|
||||
ui->outlineSpinBox->setValue(OUTLINEDEFAULTWIDTH);
|
||||
}
|
||||
}
|
||||
|
||||
@ -962,6 +969,7 @@ QList<int> SettingsDialog::currentSettings()
|
||||
settings << m_mouseSensitivityButtons->checkedId();
|
||||
settings << ui->screenTrackerSpinBox->value();
|
||||
settings << ui->themeRoundnessSpinBox->value();
|
||||
settings << ui->outlineSpinBox->value();
|
||||
settings << m_model->rowCount();
|
||||
|
||||
return settings;
|
||||
@ -1218,7 +1226,8 @@ void SettingsDialog::updateApplyButtonsState()
|
||||
|| ui->noBordersForMaximizedChkBox->isChecked()
|
||||
|| !ui->highSensitivityBtn->isChecked()
|
||||
|| ui->screenTrackerSpinBox->value() != SCREENTRACKERDEFAULTVALUE
|
||||
|| ui->themeRoundnessSpinBox->value() != THEMEDEFAULTROUNDNESS) {
|
||||
|| ui->themeRoundnessSpinBox->value() != THEMEDEFAULTROUNDNESS
|
||||
|| ui->outlineSpinBox->value() != OUTLINEDEFAULTWIDTH ) {
|
||||
ui->buttonBox->button(QDialogButtonBox::RestoreDefaults)->setEnabled(true);
|
||||
} else {
|
||||
ui->buttonBox->button(QDialogButtonBox::RestoreDefaults)->setEnabled(false);
|
||||
@ -1352,6 +1361,7 @@ bool SettingsDialog::saveAllChanges()
|
||||
m_corona->universalSettings()->setScreenTrackerInterval(ui->screenTrackerSpinBox->value());
|
||||
|
||||
m_corona->themeExtended()->setUserThemeRoundness(ui->themeRoundnessSpinBox->value());
|
||||
m_corona->themeExtended()->setOutlineWidth(ui->outlineSpinBox->value());
|
||||
|
||||
//! Update Layouts
|
||||
QStringList knownActivities = activities();
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>840</width>
|
||||
<height>621</height>
|
||||
<width>936</width>
|
||||
<height>710</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -140,8 +140,7 @@
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="user-identity">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
<normaloff>.</normaloff>.</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -155,8 +154,7 @@
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="media-playback-pause">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
<normaloff>.</normaloff>.</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -215,8 +213,7 @@
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="add">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
<normaloff>.</normaloff>.</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -230,8 +227,7 @@
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="edit-copy">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
<normaloff>.</normaloff>.</iconset>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>false</bool>
|
||||
@ -248,8 +244,7 @@
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="list-remove">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
<normaloff>.</normaloff>.</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -279,8 +274,7 @@
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="object-locked">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
<normaloff>.</normaloff>.</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
@ -357,8 +351,7 @@
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="document-import">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
<normaloff>.</normaloff>.</iconset>
|
||||
</property>
|
||||
<property name="default">
|
||||
<bool>false</bool>
|
||||
@ -375,8 +368,7 @@
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="document-export">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
<normaloff>.</normaloff>.</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -390,8 +382,7 @@
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="favorites">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
<normaloff>.</normaloff>.</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -453,15 +444,24 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>805</width>
|
||||
<height>523</height>
|
||||
<width>885</width>
|
||||
<height>613</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -1062,6 +1062,105 @@ when there are no other roundness information.</string>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_15">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_16">
|
||||
<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="outlineLbl">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Outline width used from background to draw its borders</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Outline width</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="outlineSpinBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>111</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Outline width used from background to draw its borders</string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> px.</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>16</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_15">
|
||||
<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_13">
|
||||
<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>
|
||||
<spacer name="verticalSpacer_6">
|
||||
<property name="orientation">
|
||||
|
@ -533,7 +533,7 @@ Item{
|
||||
sourceComponent: Colorizer.CustomBackground{
|
||||
backgroundColor: "transparent"
|
||||
borderColor: colorizerManager.outlineColor
|
||||
borderWidth: 1
|
||||
borderWidth: themeExtended ? themeExtended.outlineWidth : 1
|
||||
roundness: overlayedBackground.roundness
|
||||
}
|
||||
}
|
||||
|
@ -106,15 +106,15 @@ Item{
|
||||
if (drawWithoutRoundness) {
|
||||
return parent.width + 2*borderWidth;
|
||||
} else if (noOfBorders === 2) {
|
||||
return parent.width + Math.max(roundness,borderWidth);
|
||||
return parent.width + Math.max(roundness, 2*borderWidth);
|
||||
} else if (noOfBorders === 3) {
|
||||
return parent.width;
|
||||
}
|
||||
} else if (plasmoid.formFactor === PlasmaCore.Types.Vertical) {
|
||||
if (drawWithoutRoundness) {
|
||||
return parent.width + borderWidth;
|
||||
return parent.width + 2 * borderWidth;
|
||||
} else if (noOfBorders === 2 || noOfBorders === 3) {
|
||||
return parent.width + Math.max(roundness,borderWidth);
|
||||
return parent.width + Math.max(roundness, 2 * borderWidth);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -123,15 +123,15 @@ Item{
|
||||
height: {
|
||||
if (plasmoid.formFactor === PlasmaCore.Types.Horizontal) {
|
||||
if (drawWithoutRoundness) {
|
||||
return parent.height + borderWidth;
|
||||
return parent.height + 2 * borderWidth;
|
||||
} else if (noOfBorders === 2 || noOfBorders === 3) {
|
||||
return parent.height + Math.max(roundness,borderWidth);
|
||||
return parent.height + Math.max(roundness,2 * borderWidth);
|
||||
}
|
||||
} else if (plasmoid.formFactor === PlasmaCore.Types.Vertical) {
|
||||
if (drawWithoutRoundness) {
|
||||
return parent.height + 2*borderWidth;
|
||||
} else if (noOfBorders === 2) {
|
||||
return parent.height + Math.max(roundness,borderWidth);
|
||||
return parent.height + Math.max(roundness, 2*borderWidth);
|
||||
} else if (noOfBorders === 3) {
|
||||
return parent.height;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user