1
0
mirror of https://github.com/KDE/latte-dock.git synced 2024-12-23 13:33:50 +03:00

details:provided layout backgrounds

This commit is contained in:
Michail Vourlakos 2020-04-14 16:33:55 +03:00
parent 423df425ee
commit 14e739b395
18 changed files with 680 additions and 96 deletions

View File

@ -22,6 +22,7 @@ add_subdirectory(settings/handlers)
add_subdirectory(settings/models)
add_subdirectory(settings/tools)
add_subdirectory(settings/views)
add_subdirectory(settings/widgets)
add_subdirectory(shortcuts)
add_subdirectory(view)
add_subdirectory(view/helpers)

View File

@ -222,37 +222,41 @@ void AbstractLayout::clearLastUsedActivity()
emit lastUsedActivityChanged();
}
QString AbstractLayout::predefinedTextColor() const
QString AbstractLayout::defaultTextColor(const QString &color)
{
//! the user is in default layout theme
if (m_color == "blue") {
if (color == "blue") {
return "#D7E3FF";
} else if (m_color == "brown") {
} else if (color == "brown") {
return "#F1DECB";
} else if (m_color == "darkgrey") {
} else if (color == "darkgrey") {
return "#ECECEC";
} else if (m_color == "gold") {
} else if (color == "gold") {
return "#7C3636";
} else if (m_color == "green") {
} else if (color == "green") {
return "#4D7549";
} else if (m_color == "lightskyblue") {
} else if (color == "lightskyblue") {
return "#0C2A43";
} else if (m_color == "orange") {
} else if (color == "orange") {
return "#6F3902";
} else if (m_color == "pink") {
} else if (color == "pink") {
return "#743C46";
} else if (m_color == "purple") {
} else if (color == "purple") {
return "#ECD9FF";
} else if (m_color == "red") {
} else if (color == "red") {
return "#F3E4E4";
} else if (m_color == "wheat") {
} else if (color == "wheat") {
return "#6A4E25";
} else {
return "#FCFCFC";
}
}
QString AbstractLayout::predefinedTextColor() const
{
return AbstractLayout::defaultTextColor(m_color);
}
QString AbstractLayout::customTextColor() const
{
return m_customTextColor;

View File

@ -110,6 +110,7 @@ public:
virtual Type type() const;
// STATIC
static QString defaultTextColor(const QString &color);
static QString layoutName(const QString &fileName);
static QList<Plasma::Types::Location> combinedFreeEdges(const QList<Plasma::Types::Location> &edges1,
const QList<Plasma::Types::Location> &edges2);

View File

@ -172,6 +172,17 @@ bool Layouts::selectedLayoutIsCurrentActive() const
return (selectedLayoutCurrent.isActive && (selectedLayoutOriginal.name == m_handler->corona()->layoutsManager()->currentLayoutName()));
}
QString Layouts::colorPath(const QString color) const
{
QString path = m_iconsPath + color + "print.jpg";
if (!QFileInfo(path).exists()) {
return m_iconsPath + "blueprint.jpg";
}
return path;
}
QString Layouts::iconsPath() const
{
return m_iconsPath;
@ -380,9 +391,9 @@ void Layouts::loadLayouts()
CentralLayout *central = new CentralLayout(this, original.id);
original.name = central->name();
original.background = central->background();
original.color = central->color();
original.textColor = central->textColor();
original.background = central->customBackground();
original.textColor = central->customTextColor();
original.isActive = (m_handler->corona()->layoutsManager()->synchronizer()->layout(original.name) != nullptr);
original.isLocked = !central->isWritable();
original.isShownInMenu = central->showInMenu();
@ -516,8 +527,8 @@ const Data::Layout Layouts::addLayoutForFile(QString file, QString layoutName, b
copied.name = uniqueLayoutName(layoutName);
copied.color = settings->color();
copied.textColor = settings->textColor();
copied.background = settings->background();
copied.textColor = settings->customTextColor();
copied.background = settings->customBackground();
copied.isLocked = !settings->isWritable();
copied.isShownInMenu = settings->showInMenu();
copied.hasDisabledBorders = settings->disableBordersForMaximizedWindows();

View File

@ -81,6 +81,7 @@ public:
void toggleSharedForSelected();
QString iconsPath() const;
QString colorPath(const QString color) const;
QString layoutNameForFreeActivities() const;
void setOriginalLayoutForFreeActivities(const QString &id);

View File

@ -22,24 +22,42 @@
// local
#include "ui_detailsdialog.h"
#include "../controllers/layoutscontroller.h"
#include "../handlers/detailshandler.h"
namespace Latte {
namespace Settings {
namespace Dialog {
DetailsDialog::DetailsDialog(SettingsDialog *parent)
DetailsDialog::DetailsDialog(SettingsDialog *parent, Controller::Layouts *controller)
: QDialog(parent),
m_parentDlg(parent),
m_ui(new Ui::DetailsDialog)
m_ui(new Ui::DetailsDialog),
m_layoutsController(controller)
{
//! first we need to setup the ui
m_ui->setupUi(this);
//! we must create handlers after creating/adjusting the ui
m_handler = new Handler::DetailsHandler(this);
m_ui->messageWidget->setVisible(false);
}
DetailsDialog::~DetailsDialog()
{
}
Controller::Layouts *DetailsDialog::layoutsController() const
{
return m_layoutsController;
}
Ui::DetailsDialog *DetailsDialog::ui() const
{
return m_ui;
}
}
}
}

View File

@ -32,6 +32,17 @@ namespace Ui {
class DetailsDialog;
}
namespace Latte {
namespace Settings {
namespace Controller {
class Layouts;
}
namespace Handler {
class DetailsHandler;
}
}
}
namespace Latte {
namespace Settings {
namespace Dialog {
@ -41,12 +52,18 @@ class DetailsDialog : public QDialog
Q_OBJECT
public:
DetailsDialog(SettingsDialog *parent);
DetailsDialog(SettingsDialog *parent, Controller::Layouts *controller);
~DetailsDialog();
Ui::DetailsDialog *ui() const;
Controller::Layouts *layoutsController() const;
private:
SettingsDialog *m_parentDlg{nullptr};
Ui::DetailsDialog *m_ui;
Controller::Layouts *m_layoutsController{nullptr};
Handler::DetailsHandler *m_handler;
};
}

View File

@ -59,19 +59,23 @@
</item>
<item>
<layout class="QGridLayout" name="gridLayout" columnstretch="5,0,8">
<item row="3" column="1">
<widget class="QCheckBox" name="inMenuChk">
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item row="2" column="2">
<layout class="QHBoxLayout" name="backgroundOptLayout">
<item>
<widget class="QLabel" name="backgroundPatternLbl">
<widget class="Latte::Settings::Widget::PatternWidget" name="backPatternWidget" native="true">
<property name="minimumSize">
<size>
<width>0</width>
<height>40</height>
<width>160</width>
<height>60</height>
</size>
</property>
<property name="text">
<string notr="true">------------------</string>
</property>
</widget>
</item>
<item>
@ -231,6 +235,31 @@
</item>
</layout>
</item>
<item row="1" column="1">
<widget class="QRadioButton" name="colorRadioBtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item row="4" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_10">
<item>
@ -260,67 +289,6 @@
</property>
</widget>
</item>
<item row="1" column="2">
<layout class="QHBoxLayout" name="colorsOptLayout">
<item>
<widget class="QLabel" name="colorPatternLbl">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>40</height>
</size>
</property>
<property name="text">
<string>------------------</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="1" column="1">
<widget class="QRadioButton" name="colorRadioBtn">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QRadioButton" name="backgroundRadioBtn">
<property name="sizePolicy">
@ -340,13 +308,6 @@
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="inMenuChk">
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="borderlessChk">
<property name="text">
@ -354,6 +315,33 @@
</property>
</widget>
</item>
<item row="1" column="2">
<layout class="QHBoxLayout" name="colorsOptLayout">
<item>
<widget class="Latte::Settings::Widget::PatternWidget" name="colorPatternWidget" native="true">
<property name="minimumSize">
<size>
<width>160</width>
<height>60</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
</layout>
@ -389,6 +377,9 @@
</property>
</spacer>
</item>
<item>
<widget class="KMessageWidget" name="messageWidget"/>
</item>
<item>
<widget class="QDialogButtonBox" name="mainButtonBox">
<property name="orientation">
@ -401,6 +392,19 @@
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KMessageWidget</class>
<extends>QFrame</extends>
<header>kmessagewidget.h</header>
</customwidget>
<customwidget>
<class>Latte::Settings::Widget::PatternWidget</class>
<extends>QWidget</extends>
<header>settings/widgets/patternwidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>

View File

@ -1,5 +1,7 @@
set(lattedock-app_SRCS
${lattedock-app_SRCS}
${CMAKE_CURRENT_SOURCE_DIR}/detailshandler.cpp
${CMAKE_CURRENT_SOURCE_DIR}/detailsinfohandler.cpp
${CMAKE_CURRENT_SOURCE_DIR}/generichandler.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tabpreferenceshandler.cpp
${CMAKE_CURRENT_SOURCE_DIR}/tablayoutshandler.cpp

View File

@ -0,0 +1,73 @@
/*
* Copyright 2020 Michail Vourlakos <mvourlakos@gmail.com>
*
* This file is part of Latte-Dock
*
* Latte-Dock is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Latte-Dock is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "detailshandler.h"
#include "../dialogs/detailsdialog.h"
namespace Latte {
namespace Settings {
namespace Handler {
DetailsHandler::DetailsHandler(Dialog::DetailsDialog *parentDialog)
: Generic(parentDialog),
m_parentDialog(parentDialog),
m_ui(m_parentDialog->ui()),
m_infoHandler(new DetailsInfoHandler(this, parentDialog))
{
}
DetailsHandler::~DetailsHandler()
{
}
bool DetailsHandler::dataAreChanged() const
{
return m_infoHandler->dataAreChanged();
}
bool DetailsHandler::inDefaultValues() const
{
//nothing special
return true;
}
void DetailsHandler::reset()
{
}
void DetailsHandler::resetDefaults()
{
//do nothing
}
void DetailsHandler::save()
{
}
void DetailsHandler::showInlineMessage(const QString &msg, const KMessageWidget::MessageType &type, const int &hideInterval, QList<QAction *> actions)
{
}
}
}
}

View File

@ -0,0 +1,76 @@
/*
* Copyright 2020 Michail Vourlakos <mvourlakos@gmail.com>
*
* This file is part of Latte-Dock
*
* Latte-Dock is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Latte-Dock is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef DETAILSDIALOGHANDLER_H
#define DETAILSDIALOGHANDLER_H
//! local
#include "generichandler.h"
#include "detailsinfohandler.h"
namespace Ui {
class DetailsDialog;
}
namespace Latte{
namespace Settings{
namespace Dialog{
class DetailsDialog;
}
}
}
namespace Latte {
namespace Settings {
namespace Handler {
//! Handlers are objects to handle the UI elements that semantically associate with specific
//! ui::tabs or different windows. They are responsible also to handle the user interaction
//! between controllers and views
class DetailsHandler : public Generic
{
Q_OBJECT
public:
DetailsHandler(Dialog::DetailsDialog *parentDialog);
~DetailsHandler();
bool dataAreChanged() const override;
bool inDefaultValues() const override;
void reset() override;
void resetDefaults() override;
void save() override;
void showInlineMessage(const QString &msg, const KMessageWidget::MessageType &type, const int &hideInterval = 0, QList<QAction *> actions = QList<QAction *>()) override;
private:
Dialog::DetailsDialog *m_parentDialog{nullptr};
Ui::DetailsDialog *m_ui{nullptr};
DetailsInfoHandler *m_infoHandler{nullptr};
};
}
}
}
#endif

View File

@ -0,0 +1,94 @@
/*
* Copyright 2020 Michail Vourlakos <mvourlakos@gmail.com>
*
* This file is part of Latte-Dock
*
* Latte-Dock is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Latte-Dock is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "detailsinfohandler.h"
// local
#include "ui_detailsdialog.h"
#include "../dialogs/detailsdialog.h"
#include "../widgets/patternwidget.h"
#include "../../layout/abstractlayout.h"
namespace Latte {
namespace Settings {
namespace Handler {
DetailsInfoHandler::DetailsInfoHandler(QObject *parent, Dialog::DetailsDialog *parentDialog)
: Generic(parent),
m_parentDialog(parentDialog),
m_ui(m_parentDialog->ui())
{
init();
}
DetailsInfoHandler::~DetailsInfoHandler()
{
}
void DetailsInfoHandler::init()
{
Settings::Data::Layout selectedLayoutCurrent = m_parentDialog->layoutsController()->selectedLayoutCurrentData();
initLayout(selectedLayoutCurrent);
}
void DetailsInfoHandler::initLayout(const Data::Layout &data)
{
o_data = data;
c_data = data;
m_ui->colorPatternWidget->setBackground(m_parentDialog->layoutsController()->colorPath(o_data.color));
m_ui->backPatternWidget->setBackground(o_data.background);
m_ui->colorPatternWidget->setTextColor(Layout::AbstractLayout::defaultTextColor(o_data.color));
m_ui->backPatternWidget->setTextColor(o_data.textColor);
}
bool DetailsInfoHandler::dataAreChanged() const
{
return true;
}
bool DetailsInfoHandler::inDefaultValues() const
{
//nothing special
return true;
}
void DetailsInfoHandler::reset()
{
}
void DetailsInfoHandler::resetDefaults()
{
//do nothing
}
void DetailsInfoHandler::save()
{
}
void DetailsInfoHandler::showInlineMessage(const QString &msg, const KMessageWidget::MessageType &type, const int &hideInterval, QList<QAction *> actions)
{
}
}
}
}

View File

@ -0,0 +1,84 @@
/*
* Copyright 2020 Michail Vourlakos <mvourlakos@gmail.com>
*
* This file is part of Latte-Dock
*
* Latte-Dock is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Latte-Dock is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef DETAILSINFOHANDLER_H
#define DETAILSINFOHANDLER_H
//! local
#include "generichandler.h"
#include "../data/layoutdata.h"
namespace Ui {
class DetailsDialog;
}
namespace Latte{
namespace Settings{
namespace Dialog{
class DetailsDialog;
}
}
}
namespace Latte {
namespace Settings {
namespace Handler {
//! Handlers are objects to handle the UI elements that semantically associate with specific
//! ui::tabs or different windows. They are responsible also to handle the user interaction
//! between controllers and views
class DetailsInfoHandler : public Generic
{
Q_OBJECT
public:
DetailsInfoHandler(QObject *parent, Dialog::DetailsDialog *parentDialog);
~DetailsInfoHandler();
bool dataAreChanged() const override;
bool inDefaultValues() const override;
void reset() override;
void resetDefaults() override;
void save() override;
void showInlineMessage(const QString &msg, const KMessageWidget::MessageType &type, const int &hideInterval = 0, QList<QAction *> actions = QList<QAction *>()) override;
private slots:
void init();
private:
void initLayout(const Data::Layout &data);
private:
Dialog::DetailsDialog *m_parentDialog{nullptr};
Ui::DetailsDialog *m_ui{nullptr};
Data::Layout o_data;
Data::Layout c_data;
};
}
}
}
#endif

View File

@ -669,7 +669,7 @@ void TabLayouts::on_details_action()
Settings::Data::Layout selectedLayout = m_layoutsController->selectedLayoutCurrentData();
auto detailsDlg = new Settings::Dialog::DetailsDialog(m_parentDialog);
auto detailsDlg = new Settings::Dialog::DetailsDialog(m_parentDialog, m_layoutsController);
detailsDlg->exec();
}

View File

@ -396,7 +396,7 @@ QList<Data::LayoutIcon> Layouts::icons(const int &row) const
//! background image
if (icons.count() == 0) {
QString colorPath = m_layoutsTable[row].background.startsWith("/") ? m_layoutsTable[row].background : m_iconsPath + m_layoutsTable[row].background + "print.jpg";
QString colorPath = m_layoutsTable[row].background.startsWith("/") ? m_layoutsTable[row].background : m_iconsPath + m_layoutsTable[row].color + "print.jpg";
if (QFileInfo(colorPath).exists()) {
Data::LayoutIcon icon;

View File

@ -0,0 +1,5 @@
set(lattedock-app_SRCS
${lattedock-app_SRCS}
${CMAKE_CURRENT_SOURCE_DIR}/patternwidget.cpp
PARENT_SCOPE
)

View File

@ -0,0 +1,124 @@
/*
* Copyright 2020 Michail Vourlakos <mvourlakos@gmail.com>
*
* This file is part of Latte-Dock
*
* Latte-Dock is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Latte-Dock is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "patternwidget.h"
//! Qt
#include <QDebug>
#include <QFont>
#include <QGraphicsDropShadowEffect>
#include <QHBoxLayout>
#include <QPainter>
#include <QStyleOption>
//! KDE
#include <KLocalizedString>
namespace Latte {
namespace Settings {
namespace Widget {
PatternWidget::PatternWidget(QWidget *parent, Qt::WindowFlags f)
: QWidget(parent, f)
{
setProperty("isBackground", true);
initUi();
connect(this, &PatternWidget::backgroundChanged, this, &PatternWidget::updateUi);
connect(this, &PatternWidget::textColorChanged, this, &PatternWidget::updateUi);
}
void PatternWidget::initUi()
{
QHBoxLayout *l = new QHBoxLayout(this);
m_label = new QLabel(this);
l->addWidget(m_label);
l->setAlignment(Qt::AlignCenter);
setLayout(l);
m_label->setText(i18n("Sample Text"));
QFont font = m_label->font();
font.setBold(true);
m_label->setFont(font);
//! shadow
QGraphicsDropShadowEffect* effect = new QGraphicsDropShadowEffect();
effect->setColor(Qt::black);
effect->setBlurRadius(3);
effect->setXOffset(0);
effect->setYOffset(0);
m_label->setGraphicsEffect(effect);
}
void PatternWidget::setBackground(const QString &file)
{
if (m_background == file) {
return;
}
m_background = file;
emit backgroundChanged();
}
void PatternWidget::setText(const QString &text)
{
m_label->setText(text);
}
void PatternWidget::setTextColor(const QString &color)
{
if (m_textColor == color) {
return;
}
m_textColor = color;
emit textColorChanged();
}
void PatternWidget::updateUi()
{
QString backgroundImage = "url(" + m_background + ");";
if (m_background.isEmpty()) {
backgroundImage = "none;";
}
setStyleSheet("[isBackground=true] {border: 1px solid black; border-radius: 8px; background-image: " + backgroundImage + "}");
m_label->setStyleSheet("QLabel {border: 0px; background-image:none; color:" + m_textColor + "}");
}
void PatternWidget::paintEvent(QPaintEvent* event)
{
//! it is needed from Qt, otherwise QWidget is not updated
//! https://wiki.qt.io/How_to_Change_the_Background_Color_of_QWidget
QStyleOption opt;
opt.init(this);
QPainter p(this);
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
QWidget::paintEvent(event);
}
}
}
}

View File

@ -0,0 +1,69 @@
/*
* Copyright 2020 Michail Vourlakos <mvourlakos@gmail.com>
*
* This file is part of Latte-Dock
*
* Latte-Dock is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Latte-Dock is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef SETTINGSPATTERNWIDGET_H
#define SETTINGSPATTERNWIDGET_H
// Qt
#include <QLabel>
#include <QWidget>
namespace Latte {
namespace Settings {
namespace Widget {
class PatternWidget : public QWidget
{
Q_OBJECT
public:
explicit PatternWidget(QWidget *parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
void setBackground(const QString &file);
void setText(const QString &text);
void setTextColor(const QString &color);
signals:
void backgroundChanged();
void textColorChanged();
protected:
void paintEvent(QPaintEvent* event) override;
private slots:
void updateUi();
private:
void initUi();
private:
QLabel *m_label{nullptr};
QString m_background;
QString m_textColor;
};
}
}
}
#endif