阶段提交
This commit is contained in:
parent
8fc9d1bbc4
commit
b0963343af
|
@ -8,6 +8,12 @@
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include "../common/reflect.h"
|
#include "../common/reflect.h"
|
||||||
#include "mymountproxy.h"
|
#include "mymountproxy.h"
|
||||||
|
#include "parsebackuplist.h"
|
||||||
|
|
||||||
|
void testXml()
|
||||||
|
{
|
||||||
|
ParseBackupList parse("/backup/snapshots/backuplist.xml");
|
||||||
|
}
|
||||||
|
|
||||||
// test end
|
// test end
|
||||||
|
|
||||||
|
|
|
@ -323,7 +323,7 @@ bool Utils::generateExcludePathsFile()
|
||||||
in << "/var/lib/udisks2" << endl;
|
in << "/var/lib/udisks2" << endl;
|
||||||
in << "/var/log" << endl;
|
in << "/var/log" << endl;
|
||||||
|
|
||||||
// 系统安装后有的会将/data/home /data/root挂载到的/home /root上,实际文件是存放在/data/home /data/root下面
|
// 系统安装后有的会将/data/home /data/root挂载到的/home /root上,实际文件是存放在/data/home /data/root下面,为了统一标准保留/home /root排除/data/home /data/root
|
||||||
QStringList excludes;
|
QStringList excludes;
|
||||||
Utils::excludeFstabBindPath(excludes);
|
Utils::excludeFstabBindPath(excludes);
|
||||||
for (const QString& item : excludes) {
|
for (const QString& item : excludes) {
|
||||||
|
@ -477,6 +477,31 @@ bool Utils::writeBackupLog(QString line)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 立即写文件
|
||||||
|
* @param fileName 文件名,包含路径
|
||||||
|
* @param content 文件内容
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
bool Utils::syncWriteFile(const QString &fileName, const QString& content)
|
||||||
|
{
|
||||||
|
std::unique_ptr<std::FILE, int (*)(std::FILE*)> fp(std::fopen(fileName.toStdString().data(), "a+"), std::fclose);
|
||||||
|
|
||||||
|
if (!fp) {
|
||||||
|
std::perror("file opening failed!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList lines = content.split("\n");
|
||||||
|
for (const QString& line : lines) {
|
||||||
|
std::fputs(line.toStdString().data(), fp.get());
|
||||||
|
}
|
||||||
|
std::fflush(fp.get());
|
||||||
|
fdatasync(fileno(fp.get()));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 将字节大小转换为GB等表示的字符串
|
* @brief 将字节大小转换为GB等表示的字符串
|
||||||
* @param size,qint64,空间大小,单位字节
|
* @param size,qint64,空间大小,单位字节
|
||||||
|
|
|
@ -139,6 +139,14 @@ public:
|
||||||
*/
|
*/
|
||||||
static bool writeBackupLog(QString line);
|
static bool writeBackupLog(QString line);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 立即写文件
|
||||||
|
* @param fileName 文件名,包含路径
|
||||||
|
* @param content 文件内容
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
static bool syncWriteFile(const QString &fileName, const QString& content);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 将字节大小转换为GB等表示的字符串
|
* @brief 将字节大小转换为GB等表示的字符串
|
||||||
* @param size,qint64,空间大小,单位字节
|
* @param size,qint64,空间大小,单位字节
|
||||||
|
|
|
@ -5,5 +5,11 @@
|
||||||
<file alias="/images/ghost_image.svg">resource/images/ghost_image.svg</file>
|
<file alias="/images/ghost_image.svg">resource/images/ghost_image.svg</file>
|
||||||
<file alias="/images/system_restore.svg">resource/images/sysem_restore.svg</file>
|
<file alias="/images/system_restore.svg">resource/images/sysem_restore.svg</file>
|
||||||
<file alias="/images/system_backup.png">resource/images/system_backup.png</file>
|
<file alias="/images/system_backup.png">resource/images/system_backup.png</file>
|
||||||
|
<file alias="/images/system_backup.svg">resource/images/system_backup.svg</file>
|
||||||
|
<file alias="/images/data_backup_dark.svg">resource/images/data_backup_dark.svg</file>
|
||||||
|
<file alias="/images/data_restore_dark.svg">resource/images/data_restore_dark.svg</file>
|
||||||
|
<file alias="/images/ghost_image_dark.svg">resource/images/ghost_image_dark.svg</file>
|
||||||
|
<file alias="/images/system_restore_dark.svg">resource/images/sysem_restore_dark.svg</file>
|
||||||
|
<file alias="/images/system_backup_dark.svg">resource/images/system_backup_dark.svg</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
|
@ -19,7 +19,8 @@
|
||||||
*/
|
*/
|
||||||
#include "clicklabel.h"
|
#include "clicklabel.h"
|
||||||
|
|
||||||
ClickLabel::ClickLabel(const QString &text, QWidget *parent)
|
ClickLabel::ClickLabel(const QString &text, QWidget *parent) :
|
||||||
|
QLabel(parent)
|
||||||
{
|
{
|
||||||
setText(text);
|
setText(text);
|
||||||
adjustSize();
|
adjustSize();
|
||||||
|
|
|
@ -2,8 +2,9 @@
|
||||||
|
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
#include <QIcon>
|
||||||
|
|
||||||
const QPixmap ImageUtil::loadSvg(const QString &path, const QString color, int size)
|
const QPixmap ImageUtil::loadSvg(const QString &path, const QString& color, int size)
|
||||||
{
|
{
|
||||||
int origSize = size;
|
int origSize = size;
|
||||||
const auto ratio = qApp->devicePixelRatio();
|
const auto ratio = qApp->devicePixelRatio();
|
||||||
|
@ -25,7 +26,24 @@ const QPixmap ImageUtil::loadSvg(const QString &path, const QString color, int s
|
||||||
return drawSymbolicColoredPixmap(pixmap, color);
|
return drawSymbolicColoredPixmap(pixmap, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
QPixmap ImageUtil::drawSymbolicColoredPixmap(const QPixmap &source, QString cgColor)
|
const QPixmap ImageUtil::loadSvgTheme(const QString &theme, const QString& color, int size)
|
||||||
|
{
|
||||||
|
int origSize = size;
|
||||||
|
const auto ratio = qApp->devicePixelRatio();
|
||||||
|
if ( 2 == ratio) {
|
||||||
|
size += origSize;
|
||||||
|
} else if (3 == ratio) {
|
||||||
|
size += origSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
QIcon icon = QIcon::fromTheme(theme);
|
||||||
|
QPixmap pixmap = icon.pixmap(QSize(size, size));
|
||||||
|
|
||||||
|
pixmap.setDevicePixelRatio(ratio);
|
||||||
|
return drawSymbolicColoredPixmap(pixmap, color);
|
||||||
|
}
|
||||||
|
|
||||||
|
QPixmap ImageUtil::drawSymbolicColoredPixmap(const QPixmap &source, const QString& cgColor)
|
||||||
{
|
{
|
||||||
QImage img = source.toImage();
|
QImage img = source.toImage();
|
||||||
for (int x = 0; x < img.width(); x++) {
|
for (int x = 0; x < img.width(); x++) {
|
|
@ -7,8 +7,9 @@
|
||||||
class ImageUtil
|
class ImageUtil
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static const QPixmap loadSvg(const QString &path, const QString color, int size = 16);
|
static const QPixmap loadSvg(const QString &path, const QString &color, int size = 16);
|
||||||
static QPixmap drawSymbolicColoredPixmap(const QPixmap &source, QString cgColor);
|
static const QPixmap loadSvgTheme(const QString &theme, const QString &color, int size = 16);
|
||||||
|
static QPixmap drawSymbolicColoredPixmap(const QPixmap &source, const QString &cgColor);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // IMAGEUTIL_H
|
#endif // IMAGEUTIL_H
|
|
@ -3,6 +3,8 @@
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QStyleOptionButton>
|
#include <QStyleOptionButton>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
#include <QApplication>
|
||||||
|
#include "imageutil.h"
|
||||||
|
|
||||||
MyIconButton::MyIconButton(QWidget *parent) :
|
MyIconButton::MyIconButton(QWidget *parent) :
|
||||||
QPushButton(parent)
|
QPushButton(parent)
|
||||||
|
@ -20,7 +22,7 @@ MyIconButton::MyIconButton(QWidget *parent) :
|
||||||
textLabelPolicy.setHorizontalPolicy(QSizePolicy::Fixed);
|
textLabelPolicy.setHorizontalPolicy(QSizePolicy::Fixed);
|
||||||
textLabelPolicy.setVerticalPolicy(QSizePolicy::Fixed);
|
textLabelPolicy.setVerticalPolicy(QSizePolicy::Fixed);
|
||||||
m_textLabel->setSizePolicy(textLabelPolicy);
|
m_textLabel->setSizePolicy(textLabelPolicy);
|
||||||
m_textLabel->setScaledContents(true);
|
//m_textLabel->setScaledContents(true);
|
||||||
|
|
||||||
QHBoxLayout *hLayout = new QHBoxLayout();
|
QHBoxLayout *hLayout = new QHBoxLayout();
|
||||||
hLayout->setContentsMargins(8, 0, 0, 0);
|
hLayout->setContentsMargins(8, 0, 0, 0);
|
||||||
|
@ -29,22 +31,32 @@ MyIconButton::MyIconButton(QWidget *parent) :
|
||||||
hLayout->addStretch();
|
hLayout->addStretch();
|
||||||
setLayout(hLayout);
|
setLayout(hLayout);
|
||||||
|
|
||||||
connect(m_iconButton, &QPushButton::clicked, this, &QPushButton::click);
|
connect(m_iconButton, &QPushButton::clicked, this, &MyIconButton::clicked);
|
||||||
|
// connect(this, &QPushButton::toggled, this, [=] (bool checked) {
|
||||||
|
// if (checked)
|
||||||
|
// m_textLabel->setStyleSheet("color:white");
|
||||||
|
// else
|
||||||
|
// m_textLabel->setStyleSheet("color:palette(windowText)");
|
||||||
|
// });
|
||||||
|
connect(this, &QPushButton::toggled, this, &MyIconButton::changePalette);
|
||||||
}
|
}
|
||||||
|
|
||||||
MyIconButton::~MyIconButton()
|
MyIconButton::~MyIconButton()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void MyIconButton::setThemeIcon(const QString &themeIconName)
|
void MyIconButton::setThemeIcon(const QString &themeIconName, int size)
|
||||||
{
|
{
|
||||||
m_themeIconName = themeIconName;
|
m_themeIconName = themeIconName;
|
||||||
m_iconButton->setIcon(QIcon::fromTheme(themeIconName));
|
|
||||||
|
QIcon icon = QIcon::fromTheme(themeIconName);
|
||||||
|
m_iconButton->setIcon(icon.pixmap(icon.actualSize(QSize(size, size))));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyIconButton::setDesplayText(const QString &text)
|
void MyIconButton::setDesplayText(const QString &text)
|
||||||
{
|
{
|
||||||
m_textLabel->setFixedWidth(this->width() - 40);
|
m_originalText = text;
|
||||||
QFontMetrics fontMetrics(m_textLabel->font());
|
m_textLabel->setFixedWidth(this->width() - 30);
|
||||||
|
QFontMetrics fontMetrics(m_textLabel->font());
|
||||||
int fontSize = fontMetrics.width(text);
|
int fontSize = fontMetrics.width(text);
|
||||||
if (fontSize > m_textLabel->width()) {
|
if (fontSize > m_textLabel->width()) {
|
||||||
m_textLabel->setText(fontMetrics.elidedText(text, Qt::ElideRight, m_textLabel->width()));
|
m_textLabel->setText(fontMetrics.elidedText(text, Qt::ElideRight, m_textLabel->width()));
|
||||||
|
@ -53,3 +65,18 @@ void MyIconButton::setDesplayText(const QString &text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MyIconButton::changePalette(bool checked)
|
||||||
|
{
|
||||||
|
QPalette pal(m_textLabel->palette());
|
||||||
|
QPixmap pix;
|
||||||
|
if (checked) {
|
||||||
|
pal.setColor(QPalette::ButtonText, pal.color(QPalette::HighlightedText));
|
||||||
|
pix = ImageUtil::loadSvgTheme(m_themeIconName, QString("white"));
|
||||||
|
} else {
|
||||||
|
pal.setColor(QPalette::ButtonText, pal.color(QPalette::WindowText));
|
||||||
|
pix = ImageUtil::loadSvgTheme(m_themeIconName, QString("default"));
|
||||||
|
}
|
||||||
|
m_textLabel->setPalette(pal);
|
||||||
|
m_iconButton->setIcon(pix);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
#include <QPalette>
|
||||||
|
|
||||||
class MyIconButton : public QPushButton
|
class MyIconButton : public QPushButton
|
||||||
{
|
{
|
||||||
|
@ -11,14 +12,18 @@ public:
|
||||||
explicit MyIconButton(QWidget *parent = nullptr);
|
explicit MyIconButton(QWidget *parent = nullptr);
|
||||||
~MyIconButton();
|
~MyIconButton();
|
||||||
|
|
||||||
void setThemeIcon(const QString &themeIconName);
|
void setThemeIcon(const QString &themeIconName, int size = 16);
|
||||||
|
|
||||||
void setDesplayText(const QString &text);
|
void setDesplayText(const QString &text);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void changePalette(bool checked);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPushButton *m_iconButton;
|
QPushButton *m_iconButton;
|
||||||
QLabel *m_textLabel;
|
QLabel *m_textLabel;
|
||||||
QString m_themeIconName;
|
QString m_themeIconName;
|
||||||
|
QString m_originalText;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MYICONBUTTON_H
|
#endif // MYICONBUTTON_H
|
||||||
|
|
|
@ -1,14 +1,16 @@
|
||||||
#include "myiconlabel.h"
|
#include "myiconlabel.h"
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
|
#include <QApplication>
|
||||||
|
#include "imageutil.h"
|
||||||
|
|
||||||
MyIconLabel::MyIconLabel(QWidget *parent /*= nullptr*/) :
|
MyIconLabel::MyIconLabel(QWidget *parent /*= nullptr*/) :
|
||||||
QLabel(parent)
|
QLabel(parent)
|
||||||
{
|
{
|
||||||
m_iconLabel = new QLabel(this);
|
m_iconLabel = new QLabel(this);
|
||||||
// m_iconLabel->setFixedSize(QSize(24, 24));
|
|
||||||
// border:1px solid black;
|
// border:1px solid black;
|
||||||
const QString greySheetStyle = "min-width: 36px; min-height: 36px;max-width:36px; max-height: 36px;border-radius: 18px; background:grey";
|
// const QString greySheetStyle = "min-width: 36px; min-height: 36px;max-width:36px; max-height: 36px;border-radius: 18px; background:grey";
|
||||||
|
const QString greySheetStyle = "min-width: 36px; min-height: 36px;max-width:36px; max-height: 36px;border-radius: 18px";
|
||||||
m_iconLabel->setStyleSheet(greySheetStyle);
|
m_iconLabel->setStyleSheet(greySheetStyle);
|
||||||
|
|
||||||
m_textLabel = new QLabel(this);
|
m_textLabel = new QLabel(this);
|
||||||
|
@ -16,7 +18,7 @@ MyIconLabel::MyIconLabel(QWidget *parent /*= nullptr*/) :
|
||||||
textLabelPolicy.setHorizontalPolicy(QSizePolicy::Fixed);
|
textLabelPolicy.setHorizontalPolicy(QSizePolicy::Fixed);
|
||||||
textLabelPolicy.setVerticalPolicy(QSizePolicy::Fixed);
|
textLabelPolicy.setVerticalPolicy(QSizePolicy::Fixed);
|
||||||
m_textLabel->setSizePolicy(textLabelPolicy);
|
m_textLabel->setSizePolicy(textLabelPolicy);
|
||||||
m_textLabel->setScaledContents(true);
|
// m_textLabel->setScaledContents(true);
|
||||||
|
|
||||||
QHBoxLayout *hLayout = new QHBoxLayout();
|
QHBoxLayout *hLayout = new QHBoxLayout();
|
||||||
hLayout->setContentsMargins(8, 0, 0, 0);
|
hLayout->setContentsMargins(8, 0, 0, 0);
|
||||||
|
@ -32,11 +34,13 @@ MyIconLabel::~MyIconLabel()
|
||||||
void MyIconLabel::setThemeIcon(const QString &themeIconName)
|
void MyIconLabel::setThemeIcon(const QString &themeIconName)
|
||||||
{
|
{
|
||||||
m_themeIconName = themeIconName;
|
m_themeIconName = themeIconName;
|
||||||
m_textLabel->setPixmap(QIcon::fromTheme(themeIconName).pixmap(QSize(24,24)));
|
// m_textLabel->setPixmap(QIcon::fromTheme(themeIconName).pixmap(QSize(24,24)));
|
||||||
|
m_textLabel->setPixmap(ImageUtil::loadSvgTheme(m_themeIconName, QString("default")));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyIconLabel::setDesplayText(const QString &text)
|
void MyIconLabel::setDesplayText(const QString &text)
|
||||||
{
|
{
|
||||||
|
m_originalText = text;
|
||||||
m_textLabel->setFixedWidth(this->width() - 40);
|
m_textLabel->setFixedWidth(this->width() - 40);
|
||||||
QFontMetrics fontMetrics(m_textLabel->font());
|
QFontMetrics fontMetrics(m_textLabel->font());
|
||||||
int fontSize = fontMetrics.width(text);
|
int fontSize = fontMetrics.width(text);
|
||||||
|
@ -46,3 +50,18 @@ void MyIconLabel::setDesplayText(const QString &text)
|
||||||
m_textLabel->setText(text);
|
m_textLabel->setText(text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MyIconLabel::changePalette(bool dark)
|
||||||
|
{
|
||||||
|
QPalette pal(m_textLabel->palette());
|
||||||
|
QPixmap pix;
|
||||||
|
if (dark) {
|
||||||
|
pal.setColor(QPalette::WindowText, pal.color(QPalette::HighlightedText));
|
||||||
|
pix = ImageUtil::loadSvgTheme(m_themeIconName, QString("white"));
|
||||||
|
} else {
|
||||||
|
pal.setColor(QPalette::WindowText, this->palette().color(QPalette::WindowText));
|
||||||
|
pix = ImageUtil::loadSvgTheme(m_themeIconName, QString("default"));
|
||||||
|
}
|
||||||
|
m_textLabel->setPalette(pal);
|
||||||
|
m_iconLabel->setPixmap(pix);
|
||||||
|
}
|
||||||
|
|
|
@ -14,10 +14,14 @@ public:
|
||||||
|
|
||||||
void setDesplayText(const QString &text);
|
void setDesplayText(const QString &text);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void changePalette(bool checked);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QLabel *m_iconLabel;
|
QLabel *m_iconLabel;
|
||||||
QLabel *m_textLabel;
|
QLabel *m_textLabel;
|
||||||
QString m_themeIconName;
|
QString m_themeIconName;
|
||||||
|
QString m_originalText;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MYICONLABEL_H
|
#endif // MYICONLABEL_H
|
||||||
|
|
|
@ -35,11 +35,11 @@ HEADERS += \
|
||||||
backup_manager_interface.h \
|
backup_manager_interface.h \
|
||||||
component/clicklabel.h \
|
component/clicklabel.h \
|
||||||
component/hoverwidget.h \
|
component/hoverwidget.h \
|
||||||
|
component/imageutil.h \
|
||||||
component/myiconbutton.h \
|
component/myiconbutton.h \
|
||||||
component/myiconlabel.h \
|
component/myiconlabel.h \
|
||||||
functypeconverter.h \
|
functypeconverter.h \
|
||||||
gsettingswrapper.h \
|
gsettingswrapper.h \
|
||||||
imageutil.h \
|
|
||||||
leftsiderbarwidget.h \
|
leftsiderbarwidget.h \
|
||||||
maindialog.h \
|
maindialog.h \
|
||||||
module/systembackup.h \
|
module/systembackup.h \
|
||||||
|
@ -55,11 +55,11 @@ SOURCES += \
|
||||||
backup_manager_interface.cpp \
|
backup_manager_interface.cpp \
|
||||||
component/clicklabel.cpp \
|
component/clicklabel.cpp \
|
||||||
component/hoverwidget.cpp \
|
component/hoverwidget.cpp \
|
||||||
|
component/imageutil.cpp \
|
||||||
component/myiconbutton.cpp \
|
component/myiconbutton.cpp \
|
||||||
component/myiconlabel.cpp \
|
component/myiconlabel.cpp \
|
||||||
functypeconverter.cpp \
|
functypeconverter.cpp \
|
||||||
gsettingswrapper.cpp \
|
gsettingswrapper.cpp \
|
||||||
imageutil.cpp \
|
|
||||||
leftsiderbarwidget.cpp \
|
leftsiderbarwidget.cpp \
|
||||||
main.cpp \
|
main.cpp \
|
||||||
maindialog.cpp \
|
maindialog.cpp \
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include "../common/mydefine.h"
|
#include "../common/mydefine.h"
|
||||||
#include "component/myiconbutton.h"
|
#include "component/myiconbutton.h"
|
||||||
|
#include <QToolButton>
|
||||||
|
|
||||||
LeftsiderbarWidget::LeftsiderbarWidget(QWidget *parent, StartMode mode)
|
LeftsiderbarWidget::LeftsiderbarWidget(QWidget *parent, StartMode mode)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
|
@ -50,9 +51,10 @@ LeftsiderbarWidget::LeftsiderbarWidget(QWidget *parent, StartMode mode)
|
||||||
funcButton->setThemeIcon(themeIconName);
|
funcButton->setThemeIcon(themeIconName);
|
||||||
funcButton->setToolTip(mnamei18nString);
|
funcButton->setToolTip(mnamei18nString);
|
||||||
funcButton->setCheckable(true);
|
funcButton->setCheckable(true);
|
||||||
|
|
||||||
// 設置無邊框,跟隨背景色
|
// 設置無邊框,跟隨背景色
|
||||||
funcButton->setFlat(true);
|
funcButton->setFlat(true);
|
||||||
// 設置了setStyleSheet,不能再跟隨主題,捨棄此種方式
|
// 設置了setStyleSheet,不能再跟隨主題,舍弃此种方式
|
||||||
// funcButton->setStyleSheet("QPushButton:hover{background-color: rgba(55,144,250,0.30);border-radius: 4px;}"
|
// funcButton->setStyleSheet("QPushButton:hover{background-color: rgba(55,144,250,0.30);border-radius: 4px;}"
|
||||||
// "QPushButton:checked{background-color: palette(highlight);border-radius: 4px;}"
|
// "QPushButton:checked{background-color: palette(highlight);border-radius: 4px;}"
|
||||||
// "QPushButton:!checked{border: none;}");
|
// "QPushButton:!checked{border: none;}");
|
||||||
|
@ -73,9 +75,9 @@ LeftsiderbarWidget::~LeftsiderbarWidget()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LeftsiderbarWidget::paintEvent(QPaintEvent *event)
|
void LeftsiderbarWidget::paintEvent(QPaintEvent *event)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(event);
|
||||||
QStyleOption opt;
|
QStyleOption opt;
|
||||||
opt.init(this);
|
opt.init(this);
|
||||||
QPainter p(this);
|
QPainter p(this);
|
||||||
|
|
|
@ -69,7 +69,7 @@ int main(int argc, char *argv[])
|
||||||
// 使得窗口无边框
|
// 使得窗口无边框
|
||||||
// w.setWindowFlag(Qt::FramelessWindowHint);
|
// w.setWindowFlag(Qt::FramelessWindowHint);
|
||||||
// 指示窗口管理器模糊给定窗口后面指定区域的背景(毛玻璃化背景)
|
// 指示窗口管理器模糊给定窗口后面指定区域的背景(毛玻璃化背景)
|
||||||
KWindowEffects::enableBlurBehind(w.winId(),true);
|
KWindowEffects::enableBlurBehind(w.winId(), true);
|
||||||
|
|
||||||
// 添加窗管协议
|
// 添加窗管协议
|
||||||
MotifWmHints hints;
|
MotifWmHints hints;
|
||||||
|
|
|
@ -25,15 +25,16 @@ MainDialog::~MainDialog()
|
||||||
|
|
||||||
void MainDialog::initUI()
|
void MainDialog::initUI()
|
||||||
{
|
{
|
||||||
m_totalHLayout = new QHBoxLayout(this);
|
m_totalHLayout = new QHBoxLayout(ui->centralwidget);
|
||||||
m_totalHLayout->setSpacing(0);
|
m_totalHLayout->setSpacing(0);
|
||||||
m_totalHLayout->setObjectName(QString::fromUtf8("m_totalHLayout"));
|
m_totalHLayout->setObjectName(QString::fromUtf8("m_totalHLayout"));
|
||||||
m_totalHLayout->setContentsMargins(0, 0, 0, 0);
|
m_totalHLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
this->setLayout(m_totalHLayout);
|
ui->centralwidget->setLayout(m_totalHLayout);
|
||||||
|
|
||||||
m_leftSiderBarWidget = new LeftsiderbarWidget(ui->centralwidget);
|
m_leftSiderBarWidget = new LeftsiderbarWidget(ui->centralwidget);
|
||||||
m_leftSiderBarWidget->setObjectName(QString::fromUtf8("m_leftSiderBarWidget"));
|
m_leftSiderBarWidget->setObjectName(QString::fromUtf8("m_leftSiderBarWidget"));
|
||||||
m_leftSiderBarWidget->setGeometry(QRect(0, 0, 200, 640));
|
m_leftSiderBarWidget->setGeometry(QRect(0, 0, 200, 640));
|
||||||
|
m_leftSiderBarWidget->setFixedSize(QSize(200, 640));
|
||||||
|
|
||||||
m_totalHLayout->addWidget(m_leftSiderBarWidget);
|
m_totalHLayout->addWidget(m_leftSiderBarWidget);
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ void SystemBackup::initFirstWidget()
|
||||||
|
|
||||||
QLabel *imageBackup_firstPage = new QLabel(first);
|
QLabel *imageBackup_firstPage = new QLabel(first);
|
||||||
imageBackup_firstPage->setGeometry(421, 120, 300, 326);
|
imageBackup_firstPage->setGeometry(421, 120, 300, 326);
|
||||||
QPixmap pixmap(":/images/system_backup.png");
|
QPixmap pixmap(":/images/system_backup.svg");
|
||||||
imageBackup_firstPage->setPixmap(pixmap);
|
imageBackup_firstPage->setPixmap(pixmap);
|
||||||
imageBackup_firstPage->setScaledContents(true);
|
imageBackup_firstPage->setScaledContents(true);
|
||||||
|
|
||||||
|
@ -73,8 +73,13 @@ void SystemBackup::initFirstWidget()
|
||||||
iconSimple_firstPage->setDesplayText(tr("Simple"));
|
iconSimple_firstPage->setDesplayText(tr("Simple"));
|
||||||
iconSimple_firstPage->setEnabled(false);
|
iconSimple_firstPage->setEnabled(false);
|
||||||
|
|
||||||
QPushButton *beginBackup = new QPushButton(this);
|
QPushButton *beginBackup = new QPushButton(first);
|
||||||
// beginBackup->setGeometry();
|
beginBackup->setGeometry(41, 372, 180, 52);
|
||||||
|
beginBackup->setText(tr("Start Backup"));
|
||||||
|
beginBackup->setEnabled(true);
|
||||||
|
beginBackup->setAutoRepeat(true);
|
||||||
|
font.setPixelSize(24);
|
||||||
|
beginBackup->setFont(font);
|
||||||
|
|
||||||
addWidget(first);
|
addWidget(first);
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 34 KiB |
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 75 KiB |
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 49 KiB |
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 84 KiB |
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 69 KiB |
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 74 KiB |
Loading…
Reference in New Issue