details:add clear pattern button

pull/19/head
Michail Vourlakos 5 years ago
parent 0286966cab
commit c3fd137032

@ -345,7 +345,7 @@ void AbstractLayout::loadConfig()
m_color = m_layoutGroup.readEntry("color", QString("blue"));
m_backgroundStyle = static_cast<BackgroundStyle>(m_layoutGroup.readEntry("backgroundStyle", (int)ColorBackgroundStyle));
QString deprecatedTextColor = m_layoutGroup.readEntry("textColor", QString("fcfcfc"));
QString deprecatedTextColor = m_layoutGroup.readEntry("textColor", QString());
QString deprecatedBackground = m_layoutGroup.readEntry("background", QString());
if (deprecatedBackground.startsWith("/")) {
@ -359,7 +359,7 @@ void AbstractLayout::loadConfig()
saveConfig();
} else {
m_customBackground = m_layoutGroup.readEntry("customBackground", QString(""));
m_customTextColor = m_layoutGroup.readEntry("customTextColor", QString("fcfcfc"));
m_customTextColor = m_layoutGroup.readEntry("customTextColor", QString(""));
}
}

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>550</width>
<width>569</width>
<height>615</height>
</rect>
</property>
@ -79,7 +79,7 @@
<widget class="Latte::Settings::Widget::PatternWidget" name="backPatternWidget" native="true">
<property name="minimumSize">
<size>
<width>320</width>
<width>358</width>
<height>60</height>
</size>
</property>
@ -147,7 +147,7 @@
<widget class="QComboBox" name="colorsCmb">
<property name="minimumSize">
<size>
<width>320</width>
<width>358</width>
<height>0</height>
</size>
</property>
@ -286,6 +286,29 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="patternClearBtn">
<property name="minimumSize">
<size>
<width>30</width>
<height>5</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>30</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="edit-clear">
<normaloff>.</normaloff>.</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item>
@ -325,7 +348,7 @@
<widget class="Latte::Settings::Widget::PatternWidget" name="colorPatternWidget" native="true">
<property name="minimumSize">
<size>
<width>320</width>
<width>358</width>
<height>60</height>
</size>
</property>
@ -487,7 +510,7 @@
<widget class="QComboBox" name="layoutsCmb">
<property name="minimumSize">
<size>
<width>320</width>
<width>358</width>
<height>0</height>
</size>
</property>

@ -72,6 +72,8 @@ void DetailsHandler::init()
m_ui->colorsCmb->setItemDelegate(new Details::Delegate::ColorCmbBoxItem(this));
m_ui->colorsCmb->setModel(m_colorsModel);
m_ui->patternClearBtn->setFixedHeight(m_ui->backgroundBtn->height()+2);
connect(m_backButtonsGroup, static_cast<void(QButtonGroup::*)(int, bool)>(&QButtonGroup::buttonToggled),
[ = ](int id, bool checked) {
@ -82,6 +84,8 @@ void DetailsHandler::init()
connect(m_ui->backgroundBtn, &QPushButton::pressed, this, &DetailsHandler::selectBackground);
connect(m_ui->textColorBtn, &QPushButton::pressed, this, &DetailsHandler::selectTextColor);
connect(m_ui->patternClearBtn, &QPushButton::pressed, this, &DetailsHandler::on_clearPattern);
//! Options
connect(m_ui->inMenuChk, &QCheckBox::stateChanged, this, [&]() {
@ -137,6 +141,7 @@ void DetailsHandler::loadLayout(const Data::Layout &data)
m_ui->colorsCmb->setVisible(true);
m_ui->backgroundBtn->setVisible(false);
m_ui->textColorBtn->setVisible(false);
m_ui->patternClearBtn->setVisible(false);
} else {
m_ui->colorRadioBtn->setChecked(false);
m_ui->backRadioBtn->setChecked(true);
@ -144,6 +149,7 @@ void DetailsHandler::loadLayout(const Data::Layout &data)
m_ui->colorsCmb->setVisible(false);
m_ui->backgroundBtn->setVisible(true);
m_ui->textColorBtn->setVisible(true);
m_ui->patternClearBtn->setVisible(true);
}
m_ui->colorPatternWidget->setBackground(m_colorsModel->colorPath(data.color));
@ -159,6 +165,13 @@ void DetailsHandler::loadLayout(const Data::Layout &data)
m_ui->backPatternWidget->setTextColor(data.textColor);
}
qDebug() << " VALUES : " << data.background << "_" << data.textColor;
if (!data.background.isEmpty() || !data.textColor.isEmpty()) {
m_ui->patternClearBtn->setEnabled(true);
} else {
m_ui->patternClearBtn->setEnabled(false);
}
m_ui->inMenuChk->setChecked(data.isShownInMenu);
m_ui->borderlessChk->setChecked(data.hasDisabledBorders);
}
@ -195,6 +208,12 @@ void DetailsHandler::save()
{
}
void DetailsHandler::on_clearPattern()
{
setBackground("");
setTextColor("");
}
void DetailsHandler::on_currentColorIndexChanged(int row)
{
QString selectedColor = m_ui->colorsCmb->itemData(row, Model::Colors::IDROLE).toString();

@ -78,9 +78,10 @@ public:
signals:
void currentLayoutChanged();
private:
private slots:
void on_currentLayoutIndexChanged(int row);
void on_currentColorIndexChanged(int row);
void on_clearPattern();
private:
void init();

Loading…
Cancel
Save