diff --git a/kybackup/aboutdialog.cpp b/kybackup/aboutdialog.cpp index 5d0834f..a9ce9ad 100755 --- a/kybackup/aboutdialog.cpp +++ b/kybackup/aboutdialog.cpp @@ -1,126 +1,28 @@ #include "aboutdialog.h" -#include "ui_aboutdialog.h" -#include -#include -#include -#include #include -#include -#include -#include "xatom-helper.h" -#include "gsettingswrapper.h" -#include "component/mylabel.h" -#include "component/pixmaplabel.h" +#include "globalbackupinfo.h" #include "../common/utils.h" // #define SUPPORT "support@kylinos.cn" #define SUPPORT "support@kylinos.cn" AboutDialog::AboutDialog(QWidget *parent) : - QDialog(parent), - ui(new Ui::AboutDialog) + kdk::KAboutDialog(parent) { - ui->setupUi(this); - - // 添加窗管协议 - MotifWmHints hints; - hints.flags = MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS; - hints.functions = MWM_FUNC_ALL; - hints.decorations = MWM_DECOR_BORDER; - XAtomHelper::getInstance()->setWindowMotifHint(winId(), hints); - - this->setAutoFillBackground(true); - this->setFixedWidth(420); - this->setMinimumHeight(420); - QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); - this->setSizePolicy(sizePolicy); - - // 顶行,关闭按钮 - QPushButton *closeBtn = new QPushButton; - closeBtn->setToolTip(tr("Close")); - closeBtn->setProperty("isWindowButton", 0x2); - closeBtn->setProperty("useIconHighlightEffect", 0x8); - closeBtn->setFixedSize(30, 30); - closeBtn->setFlat(true); - closeBtn->setIcon(QIcon::fromTheme("window-close-symbolic")); - QHBoxLayout *hlayoutLine1 = new QHBoxLayout; - hlayoutLine1->addStretch(); - hlayoutLine1->addWidget(closeBtn); - connect(closeBtn, &QPushButton::clicked, this, &AboutDialog::close); - - // 第二行,备份还原图标 - PixmapLabel *backupIconLabel = new PixmapLabel; - backupIconLabel->setUkuiIconSchema(THEME_YHKYLIN_BACKUP_TOOLS, QSize(96, 96)); - QHBoxLayout *hlayoutLine2 = new QHBoxLayout; - hlayoutLine2->addStretch(); - hlayoutLine2->addWidget(backupIconLabel); - hlayoutLine2->addStretch(); - - // 第三行,工具名称 - MyLabel *toolName = new MyLabel; - toolName->setFixedHeight(36); - toolName->setDeplayText(tr("Backup & Restore")); - toolName->setFontSize(28); - toolName->setIsOriginal(true); - QHBoxLayout *hlayoutLine3 = new QHBoxLayout; - hlayoutLine3->addStretch(); - hlayoutLine3->addWidget(toolName); - hlayoutLine3->addStretch(); - - // 第四行,工具版本 - MyLabel *toolVersion = new MyLabel; - toolName->setFixedHeight(36); - toolVersion->setDeplayText(tr("version: ") + getBackupVersion()); - toolVersion->setIsOriginal(true); - QHBoxLayout *hlayoutLine4 = new QHBoxLayout; - hlayoutLine4->addStretch(); - hlayoutLine4->addWidget(toolVersion); - hlayoutLine4->addStretch(); - - // 第五行,简介 - MyLabel *introduction = new MyLabel; - introduction->setFixedWidth(356); - introduction->setIsOriginal(true); - introduction->setWordWrap(true); - introduction->setSizePolicy(sizePolicy); + setAppIcon(QIcon::fromTheme(THEME_YHKYLIN_BACKUP_TOOLS)); + setAppName(tr("Backup & Restore")); + setAppVersion(getBackupVersion()); // 麒麟备份还原工具是一款支持系统备份还原和数据备份还原的工具,当用户数据损坏或系统遭受攻击时能够通过该工具灵活的还原到备份节点的状态。针对国产软硬件平台开展了大量的优化和创新。 - introduction->setDeplayText(tr("The backup tool is a tool that supports system backup and data backup. " - "When the user data is damaged or the system is attacked, the tool can flexibly restore " - "the status of the backup node. A lot of optimization and innovation have been " - "carried out for domestic hardware and software platforms.")); - QHBoxLayout *hlayoutLine5 = new QHBoxLayout; - hlayoutLine5->addStretch(); - hlayoutLine5->addWidget(introduction); - hlayoutLine5->addStretch(); + setBodyText(tr("The backup tool is a tool that supports system backup and data backup. " + "When the user data is damaged or the system is attacked, the tool can flexibly restore " + "the status of the backup node. A lot of optimization and innovation have been " + "carried out for domestic hardware and software platforms.")); + setBodyTextVisiable(true); + setAppSupport(tr("Service & Support: %1").arg(SUPPORT)); - // 第六行,服务与支持团队 - MyLabel *serviceAndSupport = new MyLabel; - serviceAndSupport->setIsOriginal(true); - serviceAndSupport->setDeplayText(tr("Service & Support: %1").arg(SUPPORT)); - serviceAndSupport->setAlignment(Qt::AlignCenter); - serviceAndSupport->setContextMenuPolicy(Qt::NoContextMenu); - QHBoxLayout *hlayoutLine6 = new QHBoxLayout; - hlayoutLine6->addStretch(); - hlayoutLine6->addWidget(serviceAndSupport); - hlayoutLine6->addStretch(); - - QVBoxLayout *vlayout = new QVBoxLayout; - vlayout->addLayout(hlayoutLine1); - vlayout->addLayout(hlayoutLine2); - vlayout->addLayout(hlayoutLine3); - vlayout->addLayout(hlayoutLine4); - vlayout->addLayout(hlayoutLine5); - vlayout->addSpacing(20); - vlayout->addLayout(hlayoutLine6); - vlayout->addSpacing(20); - vlayout->addStretch(); - this->setLayout(vlayout); - this->adjustSize(); - - connect(serviceAndSupport, &QLabel::linkActivated, this, [=](const QString url) { - QDesktopServices::openUrl(QUrl(url)); + connect(GlobelBackupInfo::inst().getGlobalSignals(), &GlobalSignals::themeIconChanged, this, [=](){ + this->setAppIcon(QIcon::fromTheme(THEME_YHKYLIN_BACKUP_TOOLS)); }); - } QString AboutDialog::getBackupVersion() @@ -139,16 +41,5 @@ QString AboutDialog::getBackupVersion() AboutDialog::~AboutDialog() { - delete ui; } -void AboutDialog::paintEvent(QPaintEvent *event) -{ - // 设置背景色 - QPalette palette = this->palette(); - palette.setColor(QPalette::Window, palette.color(QPalette::Base)); - this->setPalette(palette); - QDialog::paintEvent(event); -} - - diff --git a/kybackup/aboutdialog.h b/kybackup/aboutdialog.h index 67b6c02..c82bdeb 100755 --- a/kybackup/aboutdialog.h +++ b/kybackup/aboutdialog.h @@ -1,14 +1,9 @@ #ifndef ABOUTDIALOG_H #define ABOUTDIALOG_H -#include -#include +#include "kaboutdialog.h" -namespace Ui { -class AboutDialog; -} - -class AboutDialog : public QDialog +class AboutDialog : public kdk::KAboutDialog { Q_OBJECT @@ -16,12 +11,8 @@ public: explicit AboutDialog(QWidget *parent = nullptr); ~AboutDialog(); - QString getBackupVersion(); - - void paintEvent(QPaintEvent *event); - private: - Ui::AboutDialog *ui; + QString getBackupVersion(); }; #endif // ABOUTDIALOG_H