UKUI跟随主题优化
This commit is contained in:
parent
8e441dc926
commit
11137dfbc2
|
@ -9,7 +9,8 @@
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include "xatom-helper.h"
|
#include "xatom-helper.h"
|
||||||
#include "gsettingswrapper.h"
|
#include "gsettingswrapper.h"
|
||||||
#include "./component/mylabel.h"
|
#include "component/mylabel.h"
|
||||||
|
#include "component/pixmaplabel.h"
|
||||||
#include "../common/utils.h"
|
#include "../common/utils.h"
|
||||||
|
|
||||||
// #define SUPPORT "<a href=\"mailto://support@kylinos.cn\">support@kylinos.cn</a>"
|
// #define SUPPORT "<a href=\"mailto://support@kylinos.cn\">support@kylinos.cn</a>"
|
||||||
|
@ -48,10 +49,8 @@ AboutDialog::AboutDialog(QWidget *parent) :
|
||||||
connect(closeBtn, &QPushButton::clicked, this, &AboutDialog::close);
|
connect(closeBtn, &QPushButton::clicked, this, &AboutDialog::close);
|
||||||
|
|
||||||
// 第二行,备份还原图标
|
// 第二行,备份还原图标
|
||||||
QLabel *backupIconLabel = new QLabel;
|
PixmapLabel *backupIconLabel = new PixmapLabel;
|
||||||
QIcon titleIcon = QIcon::fromTheme("yhkylin-backup-tools");
|
backupIconLabel->setUkuiIconSchema(THEME_YHKYLIN_BACKUP_TOOLS, QSize(96, 96));
|
||||||
backupIconLabel->setPixmap(titleIcon.pixmap(titleIcon.actualSize(QSize(96, 96))));
|
|
||||||
g_GSettingWrapper.connectUkuiIconSchema(backupIconLabel, QSize(96, 96));
|
|
||||||
QHBoxLayout *hlayoutLine2 = new QHBoxLayout;
|
QHBoxLayout *hlayoutLine2 = new QHBoxLayout;
|
||||||
hlayoutLine2->addStretch();
|
hlayoutLine2->addStretch();
|
||||||
hlayoutLine2->addWidget(backupIconLabel);
|
hlayoutLine2->addWidget(backupIconLabel);
|
||||||
|
|
|
@ -82,23 +82,8 @@ BackupPointListDialog::BackupPointListDialog(QWidget *parent, bool isOnlyShowLoc
|
||||||
|
|
||||||
// 表格中的布局
|
// 表格中的布局
|
||||||
// 列表为空时展示图片
|
// 列表为空时展示图片
|
||||||
m_labelEmpty = new QLabel(m_tableWidget);
|
m_labelEmpty = new PixmapLabel(m_tableWidget);
|
||||||
if (g_GSettingWrapper.isDarkTheme()) {
|
m_labelEmpty->setLightAndDarkPixmap(":/images/empty.png", ":/images/empty_dark.png");
|
||||||
QPixmap pixmap(":/images/empty_dark.png");
|
|
||||||
m_labelEmpty->setPixmap(pixmap);
|
|
||||||
} else {
|
|
||||||
QPixmap pixmap(":/images/empty.png");
|
|
||||||
m_labelEmpty->setPixmap(pixmap);
|
|
||||||
}
|
|
||||||
connect(GlobelBackupInfo::inst().getGlobalSignals(), &GlobalSignals::styleNameChanged, this, [=](bool isDark) {
|
|
||||||
if (isDark) {
|
|
||||||
QPixmap pixmap(":/images/empty_dark.png");
|
|
||||||
m_labelEmpty->setPixmap(pixmap);
|
|
||||||
} else {
|
|
||||||
QPixmap pixmap(":/images/empty.png");
|
|
||||||
m_labelEmpty->setPixmap(pixmap);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
m_labelEmptyText = new QLabel(tr("No Backup"));
|
m_labelEmptyText = new QLabel(tr("No Backup"));
|
||||||
m_labelEmptyText->setEnabled(false);
|
m_labelEmptyText->setEnabled(false);
|
||||||
m_labelEmpty->setVisible(false);
|
m_labelEmpty->setVisible(false);
|
||||||
|
|
|
@ -7,7 +7,8 @@
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include "../backup-daemon/parsebackuplist.h"
|
#include "../backup-daemon/parsebackuplist.h"
|
||||||
#include "./module/udiskdetector.h"
|
#include "module/udiskdetector.h"
|
||||||
|
#include "component/pixmaplabel.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class BackupPointListDialog;
|
class BackupPointListDialog;
|
||||||
|
@ -48,7 +49,7 @@ protected:
|
||||||
|
|
||||||
QTableWidget *m_tableWidget;
|
QTableWidget *m_tableWidget;
|
||||||
QHBoxLayout *m_bottomLayout = nullptr;
|
QHBoxLayout *m_bottomLayout = nullptr;
|
||||||
QLabel *m_labelEmpty; // 空记录图片
|
PixmapLabel *m_labelEmpty; // 空记录图片
|
||||||
QLabel *m_labelEmptyText; // 空记录文本
|
QLabel *m_labelEmptyText; // 空记录文本
|
||||||
private:
|
private:
|
||||||
Ui::BackupPointListDialog *ui;
|
Ui::BackupPointListDialog *ui;
|
||||||
|
|
|
@ -7,23 +7,37 @@
|
||||||
#include "mylabel.h"
|
#include "mylabel.h"
|
||||||
#include "../messageboxutils.h"
|
#include "../messageboxutils.h"
|
||||||
|
|
||||||
|
MyItemWidget::MyItemWidget(QWidget* parent) :
|
||||||
|
QWidget(parent)
|
||||||
|
{}
|
||||||
|
|
||||||
|
MyItemWidget::~MyItemWidget()
|
||||||
|
{}
|
||||||
|
|
||||||
BackupListWidget::BackupListWidget(QWidget *parent /*= nullptr*/) :
|
BackupListWidget::BackupListWidget(QWidget *parent /*= nullptr*/) :
|
||||||
QListWidget(parent)
|
QListWidget(parent)
|
||||||
{
|
{
|
||||||
setSortingEnabled(false);
|
setSortingEnabled(false);
|
||||||
setAcceptDrops(true);
|
setAcceptDrops(true);
|
||||||
|
setAlternatingRowColors(true);
|
||||||
|
// 设置为无边框,默认时为StyledPanel
|
||||||
|
// setFrameShape(QListWidget::NoFrame);
|
||||||
|
|
||||||
// 列表为空时,展示一个“+”号图标和拖拽文件提示
|
// 列表为空时,展示一个“+”号图标和拖拽文件提示
|
||||||
m_plusLogo = new MyIconLabel;
|
m_plusLogo = new QLabel;
|
||||||
m_plusLogo->setFixedHeight(36);
|
m_plusLogo->setFixedHeight(36);
|
||||||
m_plusLogo->setThemeIcon("list-add-symbolic", ":/symbos/list-add-symbolic.png");
|
QIcon icon = QIcon::fromTheme("list-add-symbolic", QIcon(":/symbos/list-add-symbolic.png"));
|
||||||
// 文件拖放区域
|
m_plusLogo->setPixmap(icon.pixmap(icon.actualSize(QSize(24, 24))));
|
||||||
m_plusLogo->setDesplayText(tr("File drag and drop area"));
|
|
||||||
m_plusLogo->setEnabled(false);
|
m_plusLogo->setEnabled(false);
|
||||||
|
// 文件拖放区域
|
||||||
|
m_plusText = new QLabel;
|
||||||
|
m_plusText->setText(tr("File drag and drop area"));
|
||||||
|
m_plusText->setEnabled(false);
|
||||||
|
|
||||||
QHBoxLayout *hlayout = new QHBoxLayout;
|
QHBoxLayout *hlayout = new QHBoxLayout;
|
||||||
hlayout->addStretch();
|
hlayout->addStretch();
|
||||||
hlayout->addWidget(m_plusLogo);
|
hlayout->addWidget(m_plusLogo);
|
||||||
|
hlayout->addWidget(m_plusText);
|
||||||
hlayout->addStretch();
|
hlayout->addStretch();
|
||||||
|
|
||||||
QVBoxLayout *vlayout = new QVBoxLayout;
|
QVBoxLayout *vlayout = new QVBoxLayout;
|
||||||
|
@ -31,6 +45,20 @@ BackupListWidget::BackupListWidget(QWidget *parent /*= nullptr*/) :
|
||||||
vlayout->addLayout(hlayout);
|
vlayout->addLayout(hlayout);
|
||||||
vlayout->addStretch();
|
vlayout->addStretch();
|
||||||
setLayout(vlayout);
|
setLayout(vlayout);
|
||||||
|
|
||||||
|
connect(this, &BackupListWidget::currentItemChanged, this, [=](QListWidgetItem *current, QListWidgetItem *previous) {
|
||||||
|
if (current) {
|
||||||
|
MyItemWidget *widget = qobject_cast<MyItemWidget *>(this->itemWidget(current));
|
||||||
|
emit widget->selected(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (previous) {
|
||||||
|
MyItemWidget *widget = qobject_cast<MyItemWidget *>(this->itemWidget(previous));
|
||||||
|
emit widget->selected(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
repaint();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
BackupListWidget::~BackupListWidget()
|
BackupListWidget::~BackupListWidget()
|
||||||
|
@ -72,15 +100,19 @@ bool BackupListWidget::appendItem(const QString &text)
|
||||||
|
|
||||||
QListWidgetItem *item = new QListWidgetItem(this, m_type);
|
QListWidgetItem *item = new QListWidgetItem(this, m_type);
|
||||||
item->setSizeHint(QSize(width - 10, 36));
|
item->setSizeHint(QSize(width - 10, 36));
|
||||||
QWidget *widget = new QWidget;
|
MyItemWidget *widget = new MyItemWidget;
|
||||||
QHBoxLayout *hlayout = new QHBoxLayout;
|
QHBoxLayout *hlayout = new QHBoxLayout;
|
||||||
|
hlayout->setContentsMargins(0,5,0,5);
|
||||||
|
|
||||||
MyLabel *label = new MyLabel;
|
MyLabel *label = new MyLabel;
|
||||||
label->setDeplayText(text);
|
label->setDeplayText(text);
|
||||||
label->setToolTip(text);
|
label->setToolTip(text);
|
||||||
label->setFixedSize(width - 50, 36);
|
label->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||||
label->setAlignment(Qt::AlignTop);
|
// label->setMinimumWidth(width - 60);
|
||||||
|
label->setMaximumWidth(width - 10);
|
||||||
|
label->setIsOriginal(true);
|
||||||
hlayout->addWidget(label);
|
hlayout->addWidget(label);
|
||||||
|
hlayout->addStretch();
|
||||||
m_List << text;
|
m_List << text;
|
||||||
|
|
||||||
QPushButton *buttonDelete = new QPushButton;
|
QPushButton *buttonDelete = new QPushButton;
|
||||||
|
@ -89,22 +121,33 @@ bool BackupListWidget::appendItem(const QString &text)
|
||||||
buttonDelete->setFlat(true);
|
buttonDelete->setFlat(true);
|
||||||
buttonDelete->setFixedSize(20, 20);
|
buttonDelete->setFixedSize(20, 20);
|
||||||
buttonDelete->setIcon(QIcon::fromTheme("window-close-symbolic"));
|
buttonDelete->setIcon(QIcon::fromTheme("window-close-symbolic"));
|
||||||
|
buttonDelete->setVisible(false);
|
||||||
hlayout->addWidget(buttonDelete);
|
hlayout->addWidget(buttonDelete);
|
||||||
|
|
||||||
widget->setLayout(hlayout);
|
widget->setLayout(hlayout);
|
||||||
|
|
||||||
this->setItemWidget(item, widget);
|
this->setItemWidget(item, widget);
|
||||||
this->setCurrentItem(item);
|
// this->setCurrentItem(item);
|
||||||
|
|
||||||
|
connect(widget, &MyItemWidget::selected, buttonDelete, [=](bool checked) {
|
||||||
|
if (checked)
|
||||||
|
buttonDelete->setVisible(true);
|
||||||
|
else
|
||||||
|
buttonDelete->setVisible(false);
|
||||||
|
});
|
||||||
|
|
||||||
connect(buttonDelete, &QPushButton::clicked, [=]() {
|
connect(buttonDelete, &QPushButton::clicked, [=]() {
|
||||||
this->m_List.removeOne(label->text());
|
this->m_List.removeOne(label->text());
|
||||||
this->takeItem(this->findIndexOfItem(item));
|
this->takeItem(this->findIndexOfItem(item));
|
||||||
delete item;
|
delete item;
|
||||||
if (this->count() == 0)
|
if (this->count() == 0) {
|
||||||
m_plusLogo->setVisible(true);
|
m_plusLogo->setVisible(true);
|
||||||
|
m_plusText->setVisible(true);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
m_plusLogo->setVisible(false);
|
m_plusLogo->setVisible(false);
|
||||||
|
m_plusText->setVisible(false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,18 @@
|
||||||
#include <QListWidget>
|
#include <QListWidget>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QDropEvent>
|
#include <QDropEvent>
|
||||||
#include "myiconlabel.h"
|
#include <QLabel>
|
||||||
|
|
||||||
|
class MyItemWidget : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit MyItemWidget(QWidget* parent = nullptr);
|
||||||
|
virtual ~MyItemWidget();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void selected(bool checked);
|
||||||
|
};
|
||||||
|
|
||||||
class BackupListWidget : public QListWidget
|
class BackupListWidget : public QListWidget
|
||||||
{
|
{
|
||||||
|
@ -41,7 +52,8 @@ private:
|
||||||
bool checkPathLimit(const QString &path);
|
bool checkPathLimit(const QString &path);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MyIconLabel *m_plusLogo;
|
QLabel *m_plusLogo;
|
||||||
|
QLabel *m_plusText;
|
||||||
int m_type = QListWidgetItem::ItemType::UserType + 1;
|
int m_type = QListWidgetItem::ItemType::UserType + 1;
|
||||||
QStringList m_List;
|
QStringList m_List;
|
||||||
QStringList m_pathLimit;
|
QStringList m_pathLimit;
|
||||||
|
|
|
@ -38,7 +38,7 @@ void MyIconLabel::setThemeIcon(const QString &themeIconName, const QString &defa
|
||||||
m_defaultIconName = defaultIconName;
|
m_defaultIconName = defaultIconName;
|
||||||
|
|
||||||
QIcon icon = QIcon::fromTheme(themeIconName, QIcon(defaultIconName));
|
QIcon icon = QIcon::fromTheme(themeIconName, QIcon(defaultIconName));
|
||||||
m_iconLabel->setPixmap(icon.pixmap(icon.actualSize(QSize(24, 24))));
|
m_iconLabel->setPixmap(icon.pixmap(icon.actualSize(QSize(16, 16))));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyIconLabel::setDesplayText(const QString &text)
|
void MyIconLabel::setDesplayText(const QString &text)
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
#include "pixmaplabel.h"
|
||||||
|
#include <QIcon>
|
||||||
|
#include "../globalsignals.h"
|
||||||
|
#include "../globalbackupinfo.h"
|
||||||
|
#include "../gsettingswrapper.h"
|
||||||
|
#include "../../common/mydefine.h"
|
||||||
|
|
||||||
|
PixmapLabel::PixmapLabel(QWidget *parent) :
|
||||||
|
QLabel(parent)
|
||||||
|
{}
|
||||||
|
|
||||||
|
PixmapLabel::~PixmapLabel()
|
||||||
|
{}
|
||||||
|
|
||||||
|
void PixmapLabel::setLightAndDarkPixmap(const QString &light, const QString &dark)
|
||||||
|
{
|
||||||
|
m_light = light;
|
||||||
|
m_dark = dark;
|
||||||
|
|
||||||
|
on_styleNameChanged(g_GSettingWrapper.isDarkTheme());
|
||||||
|
|
||||||
|
disconnect(GlobelBackupInfo::inst().getGlobalSignals(), &GlobalSignals::styleNameChanged, this, &PixmapLabel::on_styleNameChanged);
|
||||||
|
connect(GlobelBackupInfo::inst().getGlobalSignals(), &GlobalSignals::styleNameChanged, this, &PixmapLabel::on_styleNameChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PixmapLabel::on_styleNameChanged(bool isDark)
|
||||||
|
{
|
||||||
|
if (isDark) {
|
||||||
|
QPixmap pixmap(m_dark);
|
||||||
|
setPixmap(pixmap);
|
||||||
|
} else {
|
||||||
|
QPixmap pixmap(m_light);
|
||||||
|
setPixmap(pixmap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置跟随主题图标
|
||||||
|
void PixmapLabel::setUkuiIconSchema(const QString &schema, QSize size)
|
||||||
|
{
|
||||||
|
m_iconTheme = schema;
|
||||||
|
m_iconSize = size;
|
||||||
|
|
||||||
|
on_themeIconChanged();
|
||||||
|
|
||||||
|
disconnect(GlobelBackupInfo::inst().getGlobalSignals(), &GlobalSignals::themeIconChanged, this, &PixmapLabel::on_themeIconChanged);
|
||||||
|
connect(GlobelBackupInfo::inst().getGlobalSignals(), &GlobalSignals::themeIconChanged, this, &PixmapLabel::on_themeIconChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PixmapLabel::on_themeIconChanged()
|
||||||
|
{
|
||||||
|
QIcon titleIcon = QIcon::fromTheme(m_iconTheme);
|
||||||
|
setPixmap(titleIcon.pixmap(titleIcon.actualSize(m_iconSize)));
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
#ifndef PIXMAPLABEL_H
|
||||||
|
#define PIXMAPLABEL_H
|
||||||
|
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QSize>
|
||||||
|
|
||||||
|
class PixmapLabel : public QLabel
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit PixmapLabel(QWidget *parent = nullptr);
|
||||||
|
~PixmapLabel();
|
||||||
|
|
||||||
|
// 设置深浅主题分别展示的图片
|
||||||
|
void setLightAndDarkPixmap(const QString &light, const QString &dark);
|
||||||
|
|
||||||
|
// 设置跟随主题图标
|
||||||
|
void setUkuiIconSchema(const QString &schema, QSize size = QSize(24, 24));
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void on_styleNameChanged(bool isDark);
|
||||||
|
void on_themeIconChanged();
|
||||||
|
|
||||||
|
private:
|
||||||
|
// 浅色背景时显示图
|
||||||
|
QString m_light;
|
||||||
|
// 深色背景时显示图
|
||||||
|
QString m_dark;
|
||||||
|
|
||||||
|
// 主题图标
|
||||||
|
QString m_iconTheme;
|
||||||
|
// 主题图标大小
|
||||||
|
QSize m_iconSize;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // PIXMAPLABEL_H
|
|
@ -9,7 +9,6 @@
|
||||||
#include "../common/mydefine.h"
|
#include "../common/mydefine.h"
|
||||||
#include "../common/utils.h"
|
#include "../common/utils.h"
|
||||||
#include "messageboxutils.h"
|
#include "messageboxutils.h"
|
||||||
#include "gsettingswrapper.h"
|
|
||||||
|
|
||||||
DeleteBackupDialog::DeleteBackupDialog(ParseBackupList::BackupPoint backupPonit, QWidget *parent) :
|
DeleteBackupDialog::DeleteBackupDialog(ParseBackupList::BackupPoint backupPonit, QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
|
@ -34,11 +33,9 @@ DeleteBackupDialog::DeleteBackupDialog(ParseBackupList::BackupPoint backupPonit,
|
||||||
QHBoxLayout * titleLayout = new QHBoxLayout();
|
QHBoxLayout * titleLayout = new QHBoxLayout();
|
||||||
|
|
||||||
// logo
|
// logo
|
||||||
m_mTitleIcon = new QLabel;
|
m_mTitleIcon = new PixmapLabel;
|
||||||
m_mTitleIcon->setFixedSize(24, 24);
|
m_mTitleIcon->setFixedSize(24, 24);
|
||||||
QIcon titleIcon = QIcon::fromTheme(THEME_YHKYLIN_BACKUP_TOOLS);
|
m_mTitleIcon->setUkuiIconSchema(THEME_YHKYLIN_BACKUP_TOOLS);
|
||||||
m_mTitleIcon->setPixmap(titleIcon.pixmap(titleIcon.actualSize(QSize(24, 24))));
|
|
||||||
g_GSettingWrapper.connectUkuiIconSchema(m_mTitleIcon);
|
|
||||||
|
|
||||||
// 标题
|
// 标题
|
||||||
m_titleLabel = new MyLabel;
|
m_titleLabel = new MyLabel;
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <QMovie>
|
#include <QMovie>
|
||||||
#include "component/mylabel.h"
|
#include "component/mylabel.h"
|
||||||
#include "component/mypushbutton.h"
|
#include "component/mypushbutton.h"
|
||||||
|
#include "component/pixmaplabel.h"
|
||||||
#include "backup_manager_interface.h"
|
#include "backup_manager_interface.h"
|
||||||
#include "../backup-daemon/parsebackuplist.h"
|
#include "../backup-daemon/parsebackuplist.h"
|
||||||
|
|
||||||
|
@ -36,7 +37,7 @@ private:
|
||||||
Ui::DeleteBackupDialog *ui;
|
Ui::DeleteBackupDialog *ui;
|
||||||
ParseBackupList::BackupPoint m_backupPonit;
|
ParseBackupList::BackupPoint m_backupPonit;
|
||||||
|
|
||||||
QLabel *m_mTitleIcon;
|
PixmapLabel *m_mTitleIcon;
|
||||||
MyLabel *m_titleLabel;
|
MyLabel *m_titleLabel;
|
||||||
QPushButton *m_buttonClose;
|
QPushButton *m_buttonClose;
|
||||||
MyLabel *m_labelMessage;
|
MyLabel *m_labelMessage;
|
||||||
|
|
|
@ -17,6 +17,9 @@ signals:
|
||||||
// 主题背景变化信号
|
// 主题背景变化信号
|
||||||
void styleNameChanged(bool isDark);
|
void styleNameChanged(bool isDark);
|
||||||
|
|
||||||
|
// 主题图标变更
|
||||||
|
void themeIconChanged();
|
||||||
|
|
||||||
// 窗口或控件的背景色发生了变化。主要用于通知主题监控模块,用于修正控件颜色,以简化用户自定义背景色跟随主题变化的代码
|
// 窗口或控件的背景色发生了变化。主要用于通知主题监控模块,用于修正控件颜色,以简化用户自定义背景色跟随主题变化的代码
|
||||||
void backgroundColorChanged();
|
void backgroundColorChanged();
|
||||||
};
|
};
|
||||||
|
|
|
@ -36,6 +36,9 @@ GSettingsWrapper::GSettingsWrapper(token)
|
||||||
// 浅色主题
|
// 浅色主题
|
||||||
emit GlobelBackupInfo::inst().getGlobalSignals()->styleNameChanged(false);
|
emit GlobelBackupInfo::inst().getGlobalSignals()->styleNameChanged(false);
|
||||||
}
|
}
|
||||||
|
} else if (key == ICON_THEME_NAME) {
|
||||||
|
// 图标变更
|
||||||
|
emit GlobelBackupInfo::inst().getGlobalSignals()->themeIconChanged();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -46,75 +49,3 @@ GSettingsWrapper::~GSettingsWrapper()
|
||||||
delete m_pGsettingThemeData;
|
delete m_pGsettingThemeData;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief 绑定连接UKui风格的主题
|
|
||||||
* @param QWidget *, 跟随风格变化的窗体对象指针
|
|
||||||
*/
|
|
||||||
void GSettingsWrapper::connectUkuiIconSchema(QWidget * widgetPtr, QSize size)
|
|
||||||
{
|
|
||||||
if (widgetPtr != nullptr && QGSettings::isSchemaInstalled(ORG_UKUI_STYLE)) {
|
|
||||||
QObject::connect(m_pGsettingThemeData, &QGSettings::changed, [=](const QString &key) {
|
|
||||||
if (key == ICON_THEME_NAME) {
|
|
||||||
QIcon titleIcon = QIcon::fromTheme(THEME_YHKYLIN_BACKUP_TOOLS);
|
|
||||||
if (widgetPtr->inherits("QLabel")) {
|
|
||||||
QLabel *labelPtr = qobject_cast<QLabel *>(widgetPtr);
|
|
||||||
const QPixmap * pixmapPtr = labelPtr->pixmap();
|
|
||||||
if (pixmapPtr != nullptr) {
|
|
||||||
labelPtr->setPixmap(titleIcon.pixmap(titleIcon.actualSize(size)));
|
|
||||||
} else {
|
|
||||||
labelPtr->setPixmap(titleIcon.pixmap(titleIcon.actualSize(QSize(24, 24))));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
widgetPtr->setWindowIcon(titleIcon);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief 绑定连接UKui风格的背景颜色
|
|
||||||
* @param widgetPtr, 跟随风格变化的窗体对象指针
|
|
||||||
* @param light 浅色
|
|
||||||
* @param dark 深色
|
|
||||||
*/
|
|
||||||
void GSettingsWrapper::connectUkuiBackground(QWidget * widgetPtr, QColor light, QColor dark)
|
|
||||||
{
|
|
||||||
if (widgetPtr != nullptr && QGSettings::isSchemaInstalled(ORG_UKUI_STYLE)) {
|
|
||||||
QObject::connect(m_pGsettingThemeData, &QGSettings::changed, [=](const QString &key) {
|
|
||||||
// 主题变更
|
|
||||||
if (key == STYLE_NAME) {
|
|
||||||
widgetPtr->setAutoFillBackground(true);
|
|
||||||
QPalette palette = widgetPtr->palette();
|
|
||||||
// 只有跟随主题时,才会变化
|
|
||||||
if (GlobelBackupInfo::BlackgroundMode::Auto == GlobelBackupInfo::inst().getBlackgroundMode()) {
|
|
||||||
QString themeStyle = this->m_pGsettingThemeData->get(STYLE_NAME).toString();
|
|
||||||
if (STYLE_NAME_VALUE_DARK == themeStyle || STYLE_NAME_VALUE_BLACK == themeStyle) {
|
|
||||||
// 深色主题
|
|
||||||
palette.setColor(QPalette::Window, dark);
|
|
||||||
palette.setColor(QPalette::WindowText, Qt::white);
|
|
||||||
palette.setColor(QPalette::ButtonText, Qt::white);
|
|
||||||
} else if (STYLE_NAME_VALUE_DEFAULT == themeStyle || STYLE_NAME_VALUE_LIGHT == themeStyle || STYLE_NAME_VALUE_WHITE == themeStyle) {
|
|
||||||
// 浅色主题
|
|
||||||
palette.setColor(QPalette::Window, light);
|
|
||||||
palette.setColor(QPalette::WindowText, Qt::black);
|
|
||||||
palette.setColor(QPalette::ButtonText, Qt::black);
|
|
||||||
}
|
|
||||||
} else if (GlobelBackupInfo::BlackgroundMode::Dark == GlobelBackupInfo::inst().getBlackgroundMode()) {
|
|
||||||
// 深色主题
|
|
||||||
palette.setColor(QPalette::Window, dark);
|
|
||||||
palette.setColor(QPalette::WindowText, Qt::white);
|
|
||||||
palette.setColor(QPalette::ButtonText, Qt::white);
|
|
||||||
} else if (GlobelBackupInfo::BlackgroundMode::Light == GlobelBackupInfo::inst().getBlackgroundMode()) {
|
|
||||||
// 浅色主题
|
|
||||||
palette.setColor(QPalette::Window, light);
|
|
||||||
palette.setColor(QPalette::WindowText, Qt::black);
|
|
||||||
palette.setColor(QPalette::ButtonText, Qt::black);
|
|
||||||
}
|
|
||||||
widgetPtr->setPalette(palette);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -45,14 +45,6 @@ public:
|
||||||
*/
|
*/
|
||||||
void connectUkuiIconSchema(QWidget * labelPtr, QSize size = QSize(24, 24));
|
void connectUkuiIconSchema(QWidget * labelPtr, QSize size = QSize(24, 24));
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief 绑定连接UKui风格的背景颜色
|
|
||||||
* @param widgetPtr, 跟随风格变化的窗体对象指针
|
|
||||||
* @param light 浅色
|
|
||||||
* @param dark 深色
|
|
||||||
*/
|
|
||||||
void connectUkuiBackground(QWidget * widgetPtr, QColor light, QColor dark);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 是否深色主题
|
* @brief 是否深色主题
|
||||||
* @return true-深色主题;false-浅色主题
|
* @return true-深色主题;false-浅色主题
|
||||||
|
|
|
@ -52,6 +52,7 @@ HEADERS += \
|
||||||
component/mylineedit.h \
|
component/mylineedit.h \
|
||||||
component/mypushbutton.h \
|
component/mypushbutton.h \
|
||||||
component/mywidget.h \
|
component/mywidget.h \
|
||||||
|
component/pixmaplabel.h \
|
||||||
component/ringsprogressbar.h \
|
component/ringsprogressbar.h \
|
||||||
deletebackupdialog.h \
|
deletebackupdialog.h \
|
||||||
functypeconverter.h \
|
functypeconverter.h \
|
||||||
|
@ -97,6 +98,7 @@ SOURCES += \
|
||||||
component/mylineedit.cpp \
|
component/mylineedit.cpp \
|
||||||
component/mypushbutton.cpp \
|
component/mypushbutton.cpp \
|
||||||
component/mywidget.cpp \
|
component/mywidget.cpp \
|
||||||
|
component/pixmaplabel.cpp \
|
||||||
component/ringsprogressbar.cpp \
|
component/ringsprogressbar.cpp \
|
||||||
deletebackupdialog.cpp \
|
deletebackupdialog.cpp \
|
||||||
functypeconverter.cpp \
|
functypeconverter.cpp \
|
||||||
|
|
|
@ -15,29 +15,26 @@ LeftsiderbarWidget::LeftsiderbarWidget(QWidget *parent, StartMode mode)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
m_parent = parent;
|
m_parent = parent;
|
||||||
m_leftSideBarVLayout = new QVBoxLayout();
|
m_leftSideBarVLayout = new QVBoxLayout;
|
||||||
m_leftSideBarVLayout->setObjectName(QString::fromUtf8("m_leftSideBarVLayout"));
|
m_leftSideBarVLayout->setObjectName("m_leftSideBarVLayout");
|
||||||
m_leftSideBarVLayout->setContentsMargins(5,0,0,0);
|
m_leftSideBarVLayout->setContentsMargins(5,0,0,0);
|
||||||
setLayout(m_leftSideBarVLayout);
|
|
||||||
m_leftSideBarVLayout->setSpacing(5);
|
m_leftSideBarVLayout->setSpacing(5);
|
||||||
|
setLayout(m_leftSideBarVLayout);
|
||||||
|
|
||||||
QWidget *titleWidget = new QWidget(this);
|
QWidget *titleWidget = new QWidget(this);
|
||||||
m_leftSideBarVLayout->addWidget(titleWidget);
|
m_leftSideBarVLayout->addWidget(titleWidget);
|
||||||
|
|
||||||
QHBoxLayout * titleLayout = new QHBoxLayout();
|
QHBoxLayout * titleLayout = new QHBoxLayout;
|
||||||
m_mTitleIcon = new QLabel();
|
m_mTitleIcon = new PixmapLabel;
|
||||||
m_titleLabel = new MyLabel();
|
m_mTitleIcon->setFixedSize(24, 24);
|
||||||
|
m_mTitleIcon->setUkuiIconSchema(THEME_YHKYLIN_BACKUP_TOOLS);
|
||||||
|
m_titleLabel = new MyLabel;
|
||||||
m_titleLabel->setDeplayText(tr("Backup & Restore"));
|
m_titleLabel->setDeplayText(tr("Backup & Restore"));
|
||||||
m_titleLabel->setToolTip(tr("Backup & Restore"));
|
m_titleLabel->setToolTip(tr("Backup & Restore"));
|
||||||
|
m_titleLabel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||||
titleWidget->setLayout(titleLayout);
|
titleWidget->setLayout(titleLayout);
|
||||||
titleLayout->addWidget(m_mTitleIcon);
|
titleLayout->addWidget(m_mTitleIcon);
|
||||||
titleLayout->addWidget(m_titleLabel);
|
titleLayout->addWidget(m_titleLabel);
|
||||||
|
|
||||||
m_mTitleIcon->setFixedSize(24, 24);
|
|
||||||
QIcon titleIcon = QIcon::fromTheme(THEME_YHKYLIN_BACKUP_TOOLS);
|
|
||||||
m_mTitleIcon->setPixmap(titleIcon.pixmap(titleIcon.actualSize(QSize(24, 24))));
|
|
||||||
g_GSettingWrapper.connectUkuiIconSchema(m_mTitleIcon);
|
|
||||||
m_titleLabel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
|
||||||
m_leftSideBarVLayout->addSpacing(10);
|
m_leftSideBarVLayout->addSpacing(10);
|
||||||
|
|
||||||
// 功能列表
|
// 功能列表
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include <QGSettings>
|
#include <QGSettings>
|
||||||
#include "functypeconverter.h"
|
#include "functypeconverter.h"
|
||||||
#include "component/mylabel.h"
|
#include "component/mylabel.h"
|
||||||
|
#include "component/pixmaplabel.h"
|
||||||
|
|
||||||
class LeftsiderbarWidget : public QWidget
|
class LeftsiderbarWidget : public QWidget
|
||||||
{
|
{
|
||||||
|
@ -36,7 +37,7 @@ private:
|
||||||
QWidget *m_parent;
|
QWidget *m_parent;
|
||||||
|
|
||||||
QVBoxLayout *m_leftSideBarVLayout = nullptr;
|
QVBoxLayout *m_leftSideBarVLayout = nullptr;
|
||||||
QLabel *m_mTitleIcon = nullptr;
|
PixmapLabel *m_mTitleIcon = nullptr;
|
||||||
MyLabel *m_titleLabel = nullptr;
|
MyLabel *m_titleLabel = nullptr;
|
||||||
QButtonGroup *m_funcGroup = nullptr;
|
QButtonGroup *m_funcGroup = nullptr;
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,6 @@ void MainDialog::initUI()
|
||||||
m_totalHLayout->addWidget(m_leftSiderBarWidget);
|
m_totalHLayout->addWidget(m_leftSiderBarWidget);
|
||||||
|
|
||||||
m_rightWidget = new MyWidget;
|
m_rightWidget = new MyWidget;
|
||||||
m_rightWidget->setFixedSize(760, 640);
|
|
||||||
|
|
||||||
m_rightVLayout = new QVBoxLayout;
|
m_rightVLayout = new QVBoxLayout;
|
||||||
m_rightVLayout->setObjectName(QString::fromUtf8("m_rightVLayout"));
|
m_rightVLayout->setObjectName(QString::fromUtf8("m_rightVLayout"));
|
||||||
|
|
|
@ -1,42 +1,60 @@
|
||||||
#include "messageboxutils.h"
|
#include "messageboxutils.h"
|
||||||
#include "gsettingswrapper.h"
|
#include "gsettingswrapper.h"
|
||||||
#include "../common/mydefine.h"
|
#include "../common/mydefine.h"
|
||||||
#include <QMessageBox>
|
#include "globalsignals.h"
|
||||||
|
#include "globalbackupinfo.h"
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
|
|
||||||
|
MyMessageBox::MyMessageBox(QWidget *parent) :
|
||||||
|
QMessageBox(parent)
|
||||||
|
{
|
||||||
|
setThemeIcon(THEME_YHKYLIN_BACKUP_TOOLS);
|
||||||
|
}
|
||||||
|
|
||||||
|
MyMessageBox::~MyMessageBox()
|
||||||
|
{}
|
||||||
|
|
||||||
|
void MyMessageBox::setThemeIcon(const QString& themeIcon)
|
||||||
|
{
|
||||||
|
m_themeIcon = themeIcon;
|
||||||
|
on_themeIconChanged();
|
||||||
|
disconnect(GlobelBackupInfo::inst().getGlobalSignals(), &GlobalSignals::themeIconChanged, this, &MyMessageBox::on_themeIconChanged);
|
||||||
|
connect(GlobelBackupInfo::inst().getGlobalSignals(), &GlobalSignals::themeIconChanged, this, &MyMessageBox::on_themeIconChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyMessageBox::on_themeIconChanged()
|
||||||
|
{
|
||||||
|
QIcon titleIcon = QIcon::fromTheme(m_themeIcon);
|
||||||
|
setWindowIcon(titleIcon);
|
||||||
|
}
|
||||||
|
|
||||||
void MessageBoxUtils::QMESSAGE_BOX_INFORMATION(QWidget* q_parent, const QString& typelabel, const QString& message, const QString& label)
|
void MessageBoxUtils::QMESSAGE_BOX_INFORMATION(QWidget* q_parent, const QString& typelabel, const QString& message, const QString& label)
|
||||||
{
|
{
|
||||||
QMessageBox box(q_parent);
|
MyMessageBox box(q_parent);
|
||||||
|
|
||||||
box.setIcon(QMessageBox::Information);
|
box.setIcon(QMessageBox::Information);
|
||||||
box.setWindowTitle(typelabel);
|
box.setWindowTitle(typelabel);
|
||||||
box.setText(message);
|
box.setText(message);
|
||||||
box.setStandardButtons(QMessageBox::Ok);
|
box.setStandardButtons(QMessageBox::Ok);
|
||||||
box.setButtonText(QMessageBox::Ok, label);
|
box.setButtonText(QMessageBox::Ok, label);
|
||||||
QIcon titleIcon = QIcon::fromTheme(THEME_YHKYLIN_BACKUP_TOOLS);
|
|
||||||
box.setWindowIcon(titleIcon);
|
|
||||||
g_GSettingWrapper.connectUkuiIconSchema(&box);
|
|
||||||
box.exec();
|
box.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageBoxUtils::QMESSAGE_BOX_WARNING(QWidget* q_parent, const QString& typelabel, const QString& message, const QString& label)
|
void MessageBoxUtils::QMESSAGE_BOX_WARNING(QWidget* q_parent, const QString& typelabel, const QString& message, const QString& label)
|
||||||
{
|
{
|
||||||
QMessageBox box(q_parent);
|
MyMessageBox box(q_parent);
|
||||||
|
|
||||||
box.setIcon(QMessageBox::Warning);
|
box.setIcon(QMessageBox::Warning);
|
||||||
box.setWindowTitle(typelabel);
|
box.setWindowTitle(typelabel);
|
||||||
box.setText(message);
|
box.setText(message);
|
||||||
box.setStandardButtons(QMessageBox::Ok);
|
box.setStandardButtons(QMessageBox::Ok);
|
||||||
box.setButtonText(QMessageBox::Ok, label);
|
box.setButtonText(QMessageBox::Ok, label);
|
||||||
QIcon titleIcon = QIcon::fromTheme(THEME_YHKYLIN_BACKUP_TOOLS);
|
|
||||||
box.setWindowIcon(titleIcon);
|
|
||||||
g_GSettingWrapper.connectUkuiIconSchema(&box);
|
|
||||||
box.exec();
|
box.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MessageBoxUtils::QMESSAGE_BOX_WARNING_CANCEL(QWidget *q_parent, const QString &typelabel, const QString &message, const QString &label_yes, const QString &label_no)
|
bool MessageBoxUtils::QMESSAGE_BOX_WARNING_CANCEL(QWidget *q_parent, const QString &typelabel, const QString &message, const QString &label_yes, const QString &label_no)
|
||||||
{
|
{
|
||||||
QMessageBox box(q_parent);
|
MyMessageBox box(q_parent);
|
||||||
|
|
||||||
box.setIcon(QMessageBox::Question);
|
box.setIcon(QMessageBox::Question);
|
||||||
box.setWindowTitle(typelabel);
|
box.setWindowTitle(typelabel);
|
||||||
|
@ -44,9 +62,6 @@ bool MessageBoxUtils::QMESSAGE_BOX_WARNING_CANCEL(QWidget *q_parent, const QStri
|
||||||
box.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
|
box.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
|
||||||
box.setButtonText(QMessageBox::Ok, label_yes);
|
box.setButtonText(QMessageBox::Ok, label_yes);
|
||||||
box.setButtonText(QMessageBox::Cancel, label_no);
|
box.setButtonText(QMessageBox::Cancel, label_no);
|
||||||
QIcon titleIcon = QIcon::fromTheme(THEME_YHKYLIN_BACKUP_TOOLS);
|
|
||||||
box.setWindowIcon(titleIcon);
|
|
||||||
g_GSettingWrapper.connectUkuiIconSchema(&box);
|
|
||||||
if (box.exec() != QMessageBox::Ok)
|
if (box.exec() != QMessageBox::Ok)
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
|
@ -54,14 +69,11 @@ bool MessageBoxUtils::QMESSAGE_BOX_WARNING_CANCEL(QWidget *q_parent, const QStri
|
||||||
|
|
||||||
void MessageBoxUtils::QMESSAGE_BOX_CRITICAL(QWidget* q_parent, const QString& typelabel, const QString& message, const QString& label)
|
void MessageBoxUtils::QMESSAGE_BOX_CRITICAL(QWidget* q_parent, const QString& typelabel, const QString& message, const QString& label)
|
||||||
{
|
{
|
||||||
QMessageBox box(q_parent);
|
MyMessageBox box(q_parent);
|
||||||
box.setIcon(QMessageBox::Critical);
|
box.setIcon(QMessageBox::Critical);
|
||||||
box.setWindowTitle(typelabel);
|
box.setWindowTitle(typelabel);
|
||||||
box.setText(message);
|
box.setText(message);
|
||||||
box.setStandardButtons(QMessageBox::Ok);
|
box.setStandardButtons(QMessageBox::Ok);
|
||||||
box.setButtonText(QMessageBox::Ok, label);
|
box.setButtonText(QMessageBox::Ok, label);
|
||||||
QIcon titleIcon = QIcon::fromTheme(THEME_YHKYLIN_BACKUP_TOOLS);
|
|
||||||
box.setWindowIcon(titleIcon);
|
|
||||||
g_GSettingWrapper.connectUkuiIconSchema(&box);
|
|
||||||
box.exec();
|
box.exec();
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,23 @@
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
|
class MyMessageBox : public QMessageBox
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
MyMessageBox(QWidget *parent = nullptr);
|
||||||
|
virtual ~MyMessageBox();
|
||||||
|
|
||||||
|
void setThemeIcon(const QString& themeIcon);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void on_themeIconChanged();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString m_themeIcon;
|
||||||
|
};
|
||||||
|
|
||||||
class MessageBoxUtils
|
class MessageBoxUtils
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include "../component/linelabel.h"
|
#include "../component/linelabel.h"
|
||||||
#include "../component/ringsprogressbar.h"
|
#include "../component/ringsprogressbar.h"
|
||||||
#include "../component/myfileselect.h"
|
#include "../component/myfileselect.h"
|
||||||
|
#include "../component/pixmaplabel.h"
|
||||||
#include "../../common/utils.h"
|
#include "../../common/utils.h"
|
||||||
#include "../globalbackupinfo.h"
|
#include "../globalbackupinfo.h"
|
||||||
#include "managebackuppointlist.h"
|
#include "managebackuppointlist.h"
|
||||||
|
@ -58,25 +59,10 @@ void DataBackup::initFirstWidget()
|
||||||
QWidget *first = new QWidget;
|
QWidget *first = new QWidget;
|
||||||
|
|
||||||
// 图片
|
// 图片
|
||||||
QLabel *imageBackup_firstPage = new QLabel(first);
|
PixmapLabel *imageBackup_firstPage = new PixmapLabel(first);
|
||||||
imageBackup_firstPage->setGeometry(421, 120, 300, 326);
|
imageBackup_firstPage->setGeometry(421, 120, 300, 326);
|
||||||
imageBackup_firstPage->setScaledContents(true);
|
imageBackup_firstPage->setScaledContents(true);
|
||||||
if (g_GSettingWrapper.isDarkTheme()) {
|
imageBackup_firstPage->setLightAndDarkPixmap(":/images/data_backup.svg", ":/images/data_backup_dark.svg");
|
||||||
QPixmap pixmap(":/images/data_backup_dark.svg");
|
|
||||||
imageBackup_firstPage->setPixmap(pixmap);
|
|
||||||
} else {
|
|
||||||
QPixmap pixmap(":/images/data_backup.svg");
|
|
||||||
imageBackup_firstPage->setPixmap(pixmap);
|
|
||||||
}
|
|
||||||
connect(GlobelBackupInfo::inst().getGlobalSignals(), &GlobalSignals::styleNameChanged, this, [=](bool isDark) {
|
|
||||||
if (isDark) {
|
|
||||||
QPixmap pixmap(":/images/data_backup_dark.svg");
|
|
||||||
imageBackup_firstPage->setPixmap(pixmap);
|
|
||||||
} else {
|
|
||||||
QPixmap pixmap(":/images/data_backup.svg");
|
|
||||||
imageBackup_firstPage->setPixmap(pixmap);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 系统备份大字提示
|
// 系统备份大字提示
|
||||||
MyLabel *labelBackup_firstPage = new MyLabel(first);
|
MyLabel *labelBackup_firstPage = new MyLabel(first);
|
||||||
|
@ -144,6 +130,7 @@ void DataBackup::initFirstWidget()
|
||||||
beginBackup->setText(tr("Start Backup"));
|
beginBackup->setText(tr("Start Backup"));
|
||||||
beginBackup->setEnabled(true);
|
beginBackup->setEnabled(true);
|
||||||
beginBackup->setAutoRepeat(true);
|
beginBackup->setAutoRepeat(true);
|
||||||
|
beginBackup->setProperty("isImportant", true);
|
||||||
font.setPixelSize(24);
|
font.setPixelSize(24);
|
||||||
beginBackup->setFont(font);
|
beginBackup->setFont(font);
|
||||||
connect(beginBackup, &MyPushButton::clicked, this, [=](bool checked) {
|
connect(beginBackup, &MyPushButton::clicked, this, [=](bool checked) {
|
||||||
|
@ -158,7 +145,6 @@ void DataBackup::initFirstWidget()
|
||||||
|
|
||||||
// 增量备份按钮
|
// 增量备份按钮
|
||||||
MyPushButton *incrementBackup = new MyPushButton(first);
|
MyPushButton *incrementBackup = new MyPushButton(first);
|
||||||
// incrementBackup->setGeometry(241, 372, 180, 52);
|
|
||||||
incrementBackup->setFixedHeight(52);
|
incrementBackup->setFixedHeight(52);
|
||||||
incrementBackup->move(241, 372);
|
incrementBackup->move(241, 372);
|
||||||
incrementBackup->setText(tr("Update Backup"));
|
incrementBackup->setText(tr("Update Backup"));
|
||||||
|
@ -168,6 +154,7 @@ void DataBackup::initFirstWidget()
|
||||||
incrementBackup->setFixedWidth(180);
|
incrementBackup->setFixedWidth(180);
|
||||||
incrementBackup->setEnabled(true);
|
incrementBackup->setEnabled(true);
|
||||||
incrementBackup->setAutoRepeat(true);
|
incrementBackup->setAutoRepeat(true);
|
||||||
|
incrementBackup->setProperty("isImportant", true);
|
||||||
font.setPixelSize(24);
|
font.setPixelSize(24);
|
||||||
incrementBackup->setFont(font);
|
incrementBackup->setFont(font);
|
||||||
connect(incrementBackup, &MyPushButton::clicked, this, [=](bool checked) {
|
connect(incrementBackup, &MyPushButton::clicked, this, [=](bool checked) {
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include "../component/mypushbutton.h"
|
#include "../component/mypushbutton.h"
|
||||||
#include "../component/linelabel.h"
|
#include "../component/linelabel.h"
|
||||||
#include "../component/ringsprogressbar.h"
|
#include "../component/ringsprogressbar.h"
|
||||||
|
#include "../component/pixmaplabel.h"
|
||||||
#include "../../common/utils.h"
|
#include "../../common/utils.h"
|
||||||
#include "../globalbackupinfo.h"
|
#include "../globalbackupinfo.h"
|
||||||
#include "../gsettingswrapper.h"
|
#include "../gsettingswrapper.h"
|
||||||
|
@ -48,25 +49,10 @@ void DataRestore::initFirstWidget()
|
||||||
QWidget *first = new QWidget;
|
QWidget *first = new QWidget;
|
||||||
|
|
||||||
// 图片
|
// 图片
|
||||||
QLabel *imageRestore_firstPage = new QLabel(first);
|
PixmapLabel *imageRestore_firstPage = new PixmapLabel(first);
|
||||||
imageRestore_firstPage->setGeometry(421, 120, 300, 326);
|
imageRestore_firstPage->setGeometry(421, 120, 300, 326);
|
||||||
imageRestore_firstPage->setScaledContents(true);
|
imageRestore_firstPage->setScaledContents(true);
|
||||||
if (g_GSettingWrapper.isDarkTheme()) {
|
imageRestore_firstPage->setLightAndDarkPixmap(":/images/data_restore.svg", ":/images/data_restore_dark.svg");
|
||||||
QPixmap pixmap(":/images/data_restore_dark.svg");
|
|
||||||
imageRestore_firstPage->setPixmap(pixmap);
|
|
||||||
} else {
|
|
||||||
QPixmap pixmap(":/images/data_restore.svg");
|
|
||||||
imageRestore_firstPage->setPixmap(pixmap);
|
|
||||||
}
|
|
||||||
connect(GlobelBackupInfo::inst().getGlobalSignals(), &GlobalSignals::styleNameChanged, this, [=](bool isDark) {
|
|
||||||
if (isDark) {
|
|
||||||
QPixmap pixmap(":/images/data_restore_dark.svg");
|
|
||||||
imageRestore_firstPage->setPixmap(pixmap);
|
|
||||||
} else {
|
|
||||||
QPixmap pixmap(":/images/data_restore.svg");
|
|
||||||
imageRestore_firstPage->setPixmap(pixmap);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 数据还原大字提示
|
// 数据还原大字提示
|
||||||
MyLabel *labelRestore_firstPage = new MyLabel(first);
|
MyLabel *labelRestore_firstPage = new MyLabel(first);
|
||||||
|
@ -129,6 +115,7 @@ void DataRestore::initFirstWidget()
|
||||||
beginRestore->setText(tr("Start Restore"));
|
beginRestore->setText(tr("Start Restore"));
|
||||||
beginRestore->setEnabled(true);
|
beginRestore->setEnabled(true);
|
||||||
beginRestore->setAutoRepeat(true);
|
beginRestore->setAutoRepeat(true);
|
||||||
|
beginRestore->setProperty("isImportant", true);
|
||||||
font.setPixelSize(24);
|
font.setPixelSize(24);
|
||||||
beginRestore->setFont(font);
|
beginRestore->setFont(font);
|
||||||
connect(beginRestore, &MyPushButton::clicked, this, &DataRestore::on_button_beginRestore_clicked);
|
connect(beginRestore, &MyPushButton::clicked, this, &DataRestore::on_button_beginRestore_clicked);
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include "../component/linelabel.h"
|
#include "../component/linelabel.h"
|
||||||
#include "../component/ringsprogressbar.h"
|
#include "../component/ringsprogressbar.h"
|
||||||
#include "../component/myfileselect.h"
|
#include "../component/myfileselect.h"
|
||||||
|
#include "../component/pixmaplabel.h"
|
||||||
#include "../../common/utils.h"
|
#include "../../common/utils.h"
|
||||||
#include "../globalbackupinfo.h"
|
#include "../globalbackupinfo.h"
|
||||||
#include "../gsettingswrapper.h"
|
#include "../gsettingswrapper.h"
|
||||||
|
@ -55,25 +56,10 @@ void GhostImage::initFirstWidget()
|
||||||
QWidget *first = new QWidget;
|
QWidget *first = new QWidget;
|
||||||
|
|
||||||
// 图片
|
// 图片
|
||||||
QLabel *imageGhost_firstPage = new QLabel(first);
|
PixmapLabel *imageGhost_firstPage = new PixmapLabel(first);
|
||||||
imageGhost_firstPage->setGeometry(421, 120, 300, 326);
|
imageGhost_firstPage->setGeometry(421, 120, 300, 326);
|
||||||
imageGhost_firstPage->setScaledContents(true);
|
imageGhost_firstPage->setScaledContents(true);
|
||||||
if (g_GSettingWrapper.isDarkTheme()) {
|
imageGhost_firstPage->setLightAndDarkPixmap(":/images/ghost_image.svg", ":/images/ghost_image_dark.svg");
|
||||||
QPixmap pixmap(":/images/ghost_image_dark.svg");
|
|
||||||
imageGhost_firstPage->setPixmap(pixmap);
|
|
||||||
} else {
|
|
||||||
QPixmap pixmap(":/images/ghost_image.svg");
|
|
||||||
imageGhost_firstPage->setPixmap(pixmap);
|
|
||||||
}
|
|
||||||
connect(GlobelBackupInfo::inst().getGlobalSignals(), &GlobalSignals::styleNameChanged, this, [=](bool isDark) {
|
|
||||||
if (isDark) {
|
|
||||||
QPixmap pixmap(":/images/ghost_image_dark.svg");
|
|
||||||
imageGhost_firstPage->setPixmap(pixmap);
|
|
||||||
} else {
|
|
||||||
QPixmap pixmap(":/images/ghost_image.svg");
|
|
||||||
imageGhost_firstPage->setPixmap(pixmap);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Ghost Image大字提示
|
// Ghost Image大字提示
|
||||||
MyLabel *labelGhost_firstPage = new MyLabel(first);
|
MyLabel *labelGhost_firstPage = new MyLabel(first);
|
||||||
|
@ -139,6 +125,7 @@ void GhostImage::initFirstWidget()
|
||||||
beginBackup->setText(tr("Start Ghost"));
|
beginBackup->setText(tr("Start Ghost"));
|
||||||
beginBackup->setEnabled(true);
|
beginBackup->setEnabled(true);
|
||||||
beginBackup->setAutoRepeat(true);
|
beginBackup->setAutoRepeat(true);
|
||||||
|
beginBackup->setProperty("isImportant", true);
|
||||||
font.setPixelSize(24);
|
font.setPixelSize(24);
|
||||||
beginBackup->setFont(font);
|
beginBackup->setFont(font);
|
||||||
connect(beginBackup, &MyPushButton::clicked, this, [=](bool checked) {
|
connect(beginBackup, &MyPushButton::clicked, this, [=](bool checked) {
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <QTextCodec>
|
#include <QTextCodec>
|
||||||
#include "globalbackupinfo.h"
|
#include "globalbackupinfo.h"
|
||||||
#include "gsettingswrapper.h"
|
#include "gsettingswrapper.h"
|
||||||
|
#include "../component/pixmaplabel.h"
|
||||||
|
|
||||||
OperationLog::OperationLog(QWidget *parent) :
|
OperationLog::OperationLog(QWidget *parent) :
|
||||||
QStackedWidget(parent)
|
QStackedWidget(parent)
|
||||||
|
@ -31,23 +32,8 @@ void OperationLog::initFirstWidget()
|
||||||
|
|
||||||
// 列表为空时展示图片
|
// 列表为空时展示图片
|
||||||
QHBoxLayout *hlayoutLine1 = new QHBoxLayout;
|
QHBoxLayout *hlayoutLine1 = new QHBoxLayout;
|
||||||
QLabel *labelEmptyLogo = new QLabel(this);
|
PixmapLabel *labelEmptyLogo = new PixmapLabel(this);
|
||||||
if (g_GSettingWrapper.isDarkTheme()) {
|
labelEmptyLogo->setLightAndDarkPixmap(":/images/empty.png", ":/images/empty_dark.png");
|
||||||
QPixmap pixmap(":/images/empty_dark.png");
|
|
||||||
labelEmptyLogo->setPixmap(pixmap);
|
|
||||||
} else {
|
|
||||||
QPixmap pixmap(":/images/empty.png");
|
|
||||||
labelEmptyLogo->setPixmap(pixmap);
|
|
||||||
}
|
|
||||||
connect(GlobelBackupInfo::inst().getGlobalSignals(), &GlobalSignals::styleNameChanged, this, [=](bool isDark) {
|
|
||||||
if (isDark) {
|
|
||||||
QPixmap pixmap(":/images/empty_dark.png");
|
|
||||||
labelEmptyLogo->setPixmap(pixmap);
|
|
||||||
} else {
|
|
||||||
QPixmap pixmap(":/images/empty.png");
|
|
||||||
labelEmptyLogo->setPixmap(pixmap);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
hlayoutLine1->addStretch();
|
hlayoutLine1->addStretch();
|
||||||
hlayoutLine1->addWidget(labelEmptyLogo);
|
hlayoutLine1->addWidget(labelEmptyLogo);
|
||||||
hlayoutLine1->addStretch();
|
hlayoutLine1->addStretch();
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include "../component/mypushbutton.h"
|
#include "../component/mypushbutton.h"
|
||||||
#include "../component/linelabel.h"
|
#include "../component/linelabel.h"
|
||||||
#include "../component/ringsprogressbar.h"
|
#include "../component/ringsprogressbar.h"
|
||||||
|
#include "../component/pixmaplabel.h"
|
||||||
#include "../../common/utils.h"
|
#include "../../common/utils.h"
|
||||||
#include "../globalbackupinfo.h"
|
#include "../globalbackupinfo.h"
|
||||||
#include "../gsettingswrapper.h"
|
#include "../gsettingswrapper.h"
|
||||||
|
@ -54,25 +55,10 @@ void SystemBackup::initFirstWidget()
|
||||||
QWidget *first = new QWidget;
|
QWidget *first = new QWidget;
|
||||||
|
|
||||||
// 图片
|
// 图片
|
||||||
QLabel *imageBackup_firstPage = new QLabel(first);
|
PixmapLabel *imageBackup_firstPage = new PixmapLabel(first);
|
||||||
imageBackup_firstPage->setGeometry(421, 120, 300, 326);
|
imageBackup_firstPage->setGeometry(421, 120, 300, 326);
|
||||||
imageBackup_firstPage->setScaledContents(true);
|
imageBackup_firstPage->setScaledContents(true);
|
||||||
if (g_GSettingWrapper.isDarkTheme()) {
|
imageBackup_firstPage->setLightAndDarkPixmap(":/images/system_backup.svg", ":/images/system_backup_dark.svg");
|
||||||
QPixmap pixmap(":/images/system_backup_dark.svg");
|
|
||||||
imageBackup_firstPage->setPixmap(pixmap);
|
|
||||||
} else {
|
|
||||||
QPixmap pixmap(":/images/system_backup.svg");
|
|
||||||
imageBackup_firstPage->setPixmap(pixmap);
|
|
||||||
}
|
|
||||||
connect(GlobelBackupInfo::inst().getGlobalSignals(), &GlobalSignals::styleNameChanged, this, [=](bool isDark) {
|
|
||||||
if (isDark) {
|
|
||||||
QPixmap pixmap(":/images/system_backup_dark.svg");
|
|
||||||
imageBackup_firstPage->setPixmap(pixmap);
|
|
||||||
} else {
|
|
||||||
QPixmap pixmap(":/images/system_backup.svg");
|
|
||||||
imageBackup_firstPage->setPixmap(pixmap);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 系统备份大字提示
|
// 系统备份大字提示
|
||||||
MyLabel *labelBackup_firstPage = new MyLabel(first);
|
MyLabel *labelBackup_firstPage = new MyLabel(first);
|
||||||
|
@ -137,6 +123,7 @@ void SystemBackup::initFirstWidget()
|
||||||
beginBackup->setText(tr("Start Backup"));
|
beginBackup->setText(tr("Start Backup"));
|
||||||
beginBackup->setEnabled(true);
|
beginBackup->setEnabled(true);
|
||||||
beginBackup->setAutoRepeat(true);
|
beginBackup->setAutoRepeat(true);
|
||||||
|
beginBackup->setProperty("isImportant", true);
|
||||||
font.setPixelSize(24);
|
font.setPixelSize(24);
|
||||||
beginBackup->setFont(font);
|
beginBackup->setFont(font);
|
||||||
connect(beginBackup, &MyPushButton::clicked, this, [=](bool clicked) {
|
connect(beginBackup, &MyPushButton::clicked, this, [=](bool clicked) {
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include "../component/mypushbutton.h"
|
#include "../component/mypushbutton.h"
|
||||||
#include "../component/linelabel.h"
|
#include "../component/linelabel.h"
|
||||||
#include "../component/ringsprogressbar.h"
|
#include "../component/ringsprogressbar.h"
|
||||||
|
#include "../component/pixmaplabel.h"
|
||||||
#include "../../common/utils.h"
|
#include "../../common/utils.h"
|
||||||
#include "../globalbackupinfo.h"
|
#include "../globalbackupinfo.h"
|
||||||
#include "../gsettingswrapper.h"
|
#include "../gsettingswrapper.h"
|
||||||
|
@ -50,25 +51,10 @@ void SystemRestore::initFirstWidget()
|
||||||
QWidget *first = new QWidget;
|
QWidget *first = new QWidget;
|
||||||
|
|
||||||
// 图片
|
// 图片
|
||||||
QLabel *imageRestore_firstPage = new QLabel(first);
|
PixmapLabel *imageRestore_firstPage = new PixmapLabel(first);
|
||||||
imageRestore_firstPage->setGeometry(421, 120, 300, 326);
|
imageRestore_firstPage->setGeometry(421, 120, 300, 326);
|
||||||
imageRestore_firstPage->setScaledContents(true);
|
imageRestore_firstPage->setScaledContents(true);
|
||||||
if (g_GSettingWrapper.isDarkTheme()) {
|
imageRestore_firstPage->setLightAndDarkPixmap(":/images/system_restore.svg", ":/images/system_restore_dark.svg");
|
||||||
QPixmap pixmap(":/images/system_restore_dark.svg");
|
|
||||||
imageRestore_firstPage->setPixmap(pixmap);
|
|
||||||
} else {
|
|
||||||
QPixmap pixmap(":/images/system_restore.svg");
|
|
||||||
imageRestore_firstPage->setPixmap(pixmap);
|
|
||||||
}
|
|
||||||
connect(GlobelBackupInfo::inst().getGlobalSignals(), &GlobalSignals::styleNameChanged, this, [=](bool isDark) {
|
|
||||||
if (isDark) {
|
|
||||||
QPixmap pixmap(":/images/system_restore_dark.svg");
|
|
||||||
imageRestore_firstPage->setPixmap(pixmap);
|
|
||||||
} else {
|
|
||||||
QPixmap pixmap(":/images/system_restore.svg");
|
|
||||||
imageRestore_firstPage->setPixmap(pixmap);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 系统还原大字提示
|
// 系统还原大字提示
|
||||||
MyLabel *labelRestore_firstPage = new MyLabel(first);
|
MyLabel *labelRestore_firstPage = new MyLabel(first);
|
||||||
|
@ -131,6 +117,7 @@ void SystemRestore::initFirstWidget()
|
||||||
beginRestore->setText(tr("Start Restore"));
|
beginRestore->setText(tr("Start Restore"));
|
||||||
beginRestore->setEnabled(true);
|
beginRestore->setEnabled(true);
|
||||||
beginRestore->setAutoRepeat(true);
|
beginRestore->setAutoRepeat(true);
|
||||||
|
beginRestore->setProperty("isImportant", true);
|
||||||
font.setPixelSize(24);
|
font.setPixelSize(24);
|
||||||
beginRestore->setFont(font);
|
beginRestore->setFont(font);
|
||||||
connect(beginRestore, &MyPushButton::clicked, this, &SystemRestore::on_button_beginRestore_clicked);
|
connect(beginRestore, &MyPushButton::clicked, this, &SystemRestore::on_button_beginRestore_clicked);
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue