【备份还原】【次要】删除备份成功的弹窗,关闭按钮无悬浮提示

This commit is contained in:
赵民勇 2023-03-29 09:32:23 +08:00
parent 89fa26ff45
commit bc5ecc9131
10 changed files with 1224 additions and 1146 deletions

View File

@ -1,12 +1,15 @@
#include "backuppointlistdialog.h"
#include "ui_backuppointlistdialog.h"
#include <QHeaderView>
#include <QSizePolicy>
#include <QFile>
#include "component/mylabel.h"
#include <ukuistylehelper/ukuistylehelper.h>
#include <windowmanager/windowmanager.h>
#include "component/mypushbutton.h"
#include "../common/utils.h"
#include "globalbackupinfo.h"
#include "gsettingswrapper.h"
#include "xatom-helper.h"
BackupPointListDialog::BackupPointListDialog(QWidget *parent, bool isOnlyShowLocal) :
QDialog(parent),
@ -22,14 +25,50 @@ BackupPointListDialog::BackupPointListDialog(QWidget *parent, bool isOnlyShowLoc
// this->setWindowFlags(Qt::WindowCloseButtonHint);
// this->setWindowFlags(this->windowFlags() & ~Qt::WindowMinMaxButtonsHint);
// this->setMinimumSize(QSize(800, 368));
// 为解决贴边问题,设置为固定大小
this->setFixedSize(QSize(800, 368));
this->setFixedSize(QSize(800, 408));
this->setAutoFillBackground(true);
// 添加窗管协议
if (GlobelBackupInfo::instance().isWayland()){
// 去除窗管标题栏传入参数为QWidget *
kdk::UkuiStyleHelper::self()->removeHeader(this);
} else {
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);
setWindowModality(Qt::WindowModal);
}
// 纵向布局
QVBoxLayout *vlayout = new QVBoxLayout;
vlayout->setContentsMargins(20, 0, 20, 10);
// 设置标题栏
QHBoxLayout * titleLayout = new QHBoxLayout();
// logo
PixmapLabel *titleIcon = new PixmapLabel;
titleIcon->setFixedSize(24, 24);
titleIcon->setThemeIconSchema(THEME_YHKYLIN_BACKUP_TOOLS, ":/images/yhkylin-backup-tools.png");
// 标题
m_titleLabel = new MyLabel;
m_titleLabel->setFixedHeight(30);
m_titleLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
// 关闭按钮
QPushButton *buttonClose = new QPushButton;
buttonClose->setProperty("isWindowButton", 0x2);
buttonClose->setProperty("useIconHighlightEffect", 0x8);
buttonClose->setFlat(true);
buttonClose->setFixedSize(30, 30);
buttonClose->setIcon(QIcon::fromTheme("window-close-symbolic"));
buttonClose->setToolTip(tr("Close"));
connect(buttonClose, &QPushButton::clicked, this, &BackupPointListDialog::close);
titleLayout->addWidget(titleIcon);
titleLayout->addWidget(m_titleLabel);
titleLayout->addWidget(buttonClose);
vlayout->addLayout(titleLayout);
QStringList headerLabels;
// 注意此处的列需要和枚举Column_Index一一对应
@ -59,9 +98,14 @@ BackupPointListDialog::BackupPointListDialog(QWidget *parent, bool isOnlyShowLoc
m_tableWidget->setAlternatingRowColors(true);
m_tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
m_tableWidget->setShowGrid(false);
vlayout->addWidget(m_tableWidget);
QHBoxLayout *tableLayout = new QHBoxLayout;
tableLayout->setContentsMargins(10, 0, 10, 0);
tableLayout->addWidget(m_tableWidget);
vlayout->addLayout(tableLayout);
m_bottomLayout = new QHBoxLayout;
m_bottomLayout->setContentsMargins(10, 0, 10, 0);
vlayout->addLayout(m_bottomLayout);
this->setLayout(vlayout);

View File

@ -10,6 +10,7 @@
#include "../backup-daemon/parsebackuplist.h"
#include "module/udiskdetector.h"
#include "component/pixmaplabel.h"
#include "component/mylabel.h"
namespace Ui {
class BackupPointListDialog;
@ -52,6 +53,7 @@ protected:
QHBoxLayout *m_bottomLayout = nullptr;
PixmapLabel *m_labelEmpty; // 空记录图片
QLabel *m_labelEmptyText; // 空记录文本
MyLabel *m_titleLabel; // 窗口标题
private:
Ui::BackupPointListDialog *ui;

View File

@ -19,8 +19,6 @@ DeleteBackupDialog::DeleteBackupDialog(ParseBackupList::BackupPoint backupPonit,
m_pInterface(nullptr)
{
ui->setupUi(this);
// setMinimumSize(450, 138);
// setMaximumSize(450, 200);
// 为解决自动贴边问题,设置为固定大小
setFixedSize(450, 200);
this->setAutoFillBackground(true);
@ -60,6 +58,7 @@ DeleteBackupDialog::DeleteBackupDialog(ParseBackupList::BackupPoint backupPonit,
m_buttonClose->setFlat(true);
m_buttonClose->setFixedSize(30, 30);
m_buttonClose->setIcon(QIcon::fromTheme("window-close-symbolic"));
m_buttonClose->setToolTip(tr("Close"));
titleLayout->addWidget(m_mTitleIcon);
titleLayout->addWidget(m_titleLabel);

View File

@ -14,8 +14,10 @@ ManageBackupPointList::ManageBackupPointList(QWidget *parent, BackupPointType ba
{
if (BackupPointType::SYSTEM == backupType) {
this->setWindowTitle(tr("System Backup Information"));
m_titleLabel->setDeplayText(tr("System Backup Information"));
} else {
this->setWindowTitle(tr("Data Backup Information"));
m_titleLabel->setDeplayText(tr("Data Backup Information"));
}
// 隐藏备份点大小Backup Size字段

View File

@ -12,8 +12,10 @@ SelectRestorePoint::SelectRestorePoint(QWidget *parent, BackupPointType backupTy
{
if (BackupPointType::SYSTEM == backupType) {
this->setWindowTitle(tr("System Backup Information"));
m_titleLabel->setDeplayText(tr("System Backup Information"));
} else {
this->setWindowTitle(tr("Data Backup Information"));
m_titleLabel->setDeplayText(tr("Data Backup Information"));
}
// 隐藏备份点状态Backup State字段

View File

@ -934,7 +934,10 @@ void SystemBackup::initForthWidget()
labelError->setDeplayText(tr("Maximum length reached"));
labelError->setVisible(true);
labelError->move(editBackupName->geometry().left(), editBackupName->geometry().bottom() + 10);
} else if (text == in) {
} else if (!text.isEmpty() && this->isExistsBackupName(text)) {
labelError->setDeplayText(tr("Name already exists"));
labelError->setVisible(true);
} else if (text == in) {
labelError->setVisible(false);
}
} else {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff