16551需求:PC中最大化和窗口大小变化适配改造
This commit is contained in:
parent
ddb38750f6
commit
ed2d68ff0a
|
@ -185,6 +185,18 @@ bool Utils::checkBootInfoExists()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 是否有平板模式
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
bool Utils::isTablet()
|
||||||
|
{
|
||||||
|
QString otaPath = Utils::m_sysRootPath + "/etc/apt/ota_version";
|
||||||
|
otaPath.replace("//", "/");
|
||||||
|
|
||||||
|
return QFile::exists(otaPath);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 获取备份分区的UUID
|
* @brief 获取备份分区的UUID
|
||||||
* @return 备份分区的UUID
|
* @return 备份分区的UUID
|
||||||
|
|
|
@ -72,6 +72,12 @@ public:
|
||||||
*/
|
*/
|
||||||
static bool checkBootInfoExists();
|
static bool checkBootInfoExists();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 是否有平板模式
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
static bool isTablet();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 获取备份分区的UUID
|
* @brief 获取备份分区的UUID
|
||||||
* @return 备份分区的UUID
|
* @return 备份分区的UUID
|
||||||
|
|
|
@ -12,15 +12,19 @@
|
||||||
|
|
||||||
#define WIDTH_ITEM 36
|
#define WIDTH_ITEM 36
|
||||||
#define MERGE_IN 8
|
#define MERGE_IN 8
|
||||||
|
#define WIDTH_SPACING 5
|
||||||
|
|
||||||
MyItemWidget::MyItemWidget(QWidget* parent) :
|
MyItemWidget::MyItemWidget(QWidget* parent, QListWidgetItem *item) :
|
||||||
QWidget(parent)
|
QWidget(parent),
|
||||||
|
m_item(item)
|
||||||
{
|
{
|
||||||
|
if (parent && item)
|
||||||
|
item->setSizeHint(QSize(parent->width() - 5, WIDTH_ITEM));
|
||||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||||
|
|
||||||
QHBoxLayout *hlayout = new QHBoxLayout;
|
QHBoxLayout *hlayout = new QHBoxLayout;
|
||||||
hlayout->setContentsMargins(5, 2, 2, 2);
|
hlayout->setContentsMargins(5, 2, 2, 2);
|
||||||
hlayout->setSpacing(5);
|
hlayout->setSpacing(WIDTH_SPACING);
|
||||||
|
|
||||||
m_label = new MyLabel;
|
m_label = new MyLabel;
|
||||||
m_label->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
m_label->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||||
|
@ -37,6 +41,8 @@ MyItemWidget::MyItemWidget(QWidget* parent) :
|
||||||
// hlayout->setAlignment(Qt::AlignLeft);
|
// hlayout->setAlignment(Qt::AlignLeft);
|
||||||
|
|
||||||
connect(this, &MyItemWidget::setScrollWidth, this, [=](int width) {
|
connect(this, &MyItemWidget::setScrollWidth, this, [=](int width) {
|
||||||
|
if (parent && this->m_item)
|
||||||
|
item->setSizeHint(QSize(width - 5 - this->m_scrollWidth, WIDTH_ITEM));
|
||||||
int labelWidth = this->m_label->width();
|
int labelWidth = this->m_label->width();
|
||||||
this->m_extWidth = 0;
|
this->m_extWidth = 0;
|
||||||
// 隐藏滚动条时会增加右侧边距
|
// 隐藏滚动条时会增加右侧边距
|
||||||
|
@ -64,7 +70,7 @@ MyItemWidget::MyItemWidget(QWidget* parent) :
|
||||||
int labelWidth = this->m_label->width();
|
int labelWidth = this->m_label->width();
|
||||||
if (checked) {
|
if (checked) {
|
||||||
this->m_buttonDelete->setVisible(true);
|
this->m_buttonDelete->setVisible(true);
|
||||||
this->m_label->setFixedWidth(labelWidth - 5 - m_buttonDelete->width());
|
this->m_label->setFixedWidth(labelWidth - WIDTH_SPACING - m_buttonDelete->width());
|
||||||
this->m_label->setElidedText(this->m_text, Qt::ElideLeft);
|
this->m_label->setElidedText(this->m_text, Qt::ElideLeft);
|
||||||
this->m_label->setFontColor(Qt::white);
|
this->m_label->setFontColor(Qt::white);
|
||||||
this->m_label->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
this->m_label->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||||
|
@ -73,7 +79,7 @@ MyItemWidget::MyItemWidget(QWidget* parent) :
|
||||||
this->m_checked = true;
|
this->m_checked = true;
|
||||||
} else {
|
} else {
|
||||||
this->m_buttonDelete->setVisible(false);
|
this->m_buttonDelete->setVisible(false);
|
||||||
this->m_label->setFixedWidth(labelWidth + 5 + m_buttonDelete->width());
|
this->m_label->setFixedWidth(labelWidth + WIDTH_SPACING + m_buttonDelete->width());
|
||||||
this->m_label->setElidedText(this->m_text, Qt::ElideLeft);
|
this->m_label->setElidedText(this->m_text, Qt::ElideLeft);
|
||||||
this->m_label->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
this->m_label->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||||
this->m_label->setStyleSheet("QLabel {color:palette(windowText)}"
|
this->m_label->setStyleSheet("QLabel {color:palette(windowText)}"
|
||||||
|
@ -82,7 +88,32 @@ MyItemWidget::MyItemWidget(QWidget* parent) :
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(m_buttonDelete, &QPushButton::clicked, this, &MyItemWidget::deleteItem);
|
connect(this, &MyItemWidget::resetItemWidth, this, [=](int width) {
|
||||||
|
if (parent && item) {
|
||||||
|
QListWidget *parentWidget = qobject_cast<QListWidget *>(parent);
|
||||||
|
QScrollBar *vertScroll = parentWidget->verticalScrollBar();
|
||||||
|
int scrollWidth = 0;
|
||||||
|
if (vertScroll->isVisible()) {
|
||||||
|
scrollWidth = vertScroll->size().width();
|
||||||
|
}
|
||||||
|
this->m_scrollWidth = scrollWidth;
|
||||||
|
item->setSizeHint(QSize(width - 5 - this->m_scrollWidth, WIDTH_ITEM));
|
||||||
|
}
|
||||||
|
if (this->m_buttonDelete->isVisible()) {
|
||||||
|
this->m_label->setFixedWidth(width - WIDTH_SPACING - m_buttonDelete->width() - 7 - this->m_scrollWidth);
|
||||||
|
this->m_label->setElidedText(this->m_text, Qt::ElideLeft);
|
||||||
|
this->m_label->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||||
|
} else {
|
||||||
|
this->m_label->setFixedWidth(width - WIDTH_SPACING - 2 - this->m_scrollWidth);
|
||||||
|
this->m_label->setElidedText(this->m_text, Qt::ElideLeft);
|
||||||
|
this->m_label->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(m_buttonDelete, &QPushButton::clicked, this, [=]() {
|
||||||
|
this->m_item = nullptr;
|
||||||
|
emit deleteItem();
|
||||||
|
});
|
||||||
|
|
||||||
this->setLayout(hlayout);
|
this->setLayout(hlayout);
|
||||||
}
|
}
|
||||||
|
@ -156,6 +187,11 @@ BackupListWidget::BackupListWidget(QWidget *parent /*= nullptr*/, QHBoxLayout *p
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 大小改变
|
||||||
|
connect(GlobelBackupInfo::inst().getGlobalSignals(), &GlobalSignals::widthChanged, this, [=](){
|
||||||
|
emit this->resetItemWidth(this->width());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
BackupListWidget::~BackupListWidget()
|
BackupListWidget::~BackupListWidget()
|
||||||
|
@ -181,8 +217,7 @@ bool BackupListWidget::appendItem(const QString &text)
|
||||||
++count;
|
++count;
|
||||||
|
|
||||||
QListWidgetItem *item = new QListWidgetItem(this, m_type);
|
QListWidgetItem *item = new QListWidgetItem(this, m_type);
|
||||||
item->setSizeHint(QSize(this->width() - 5, WIDTH_ITEM));
|
MyItemWidget *widget = new MyItemWidget(this, item);
|
||||||
MyItemWidget *widget = new MyItemWidget;
|
|
||||||
this->setItemWidget(item, widget);
|
this->setItemWidget(item, widget);
|
||||||
// 必须将scrollToBottom等这种滚动条操作放到判断滚动条是否显示isVisible之前
|
// 必须将scrollToBottom等这种滚动条操作放到判断滚动条是否显示isVisible之前
|
||||||
this->scrollToBottom();
|
this->scrollToBottom();
|
||||||
|
@ -195,7 +230,6 @@ bool BackupListWidget::appendItem(const QString &text)
|
||||||
if (m_parentLayout != nullptr)
|
if (m_parentLayout != nullptr)
|
||||||
m_parentLayout->setContentsMargins(MERGE_IN, MERGE_IN, 0, MERGE_IN);
|
m_parentLayout->setContentsMargins(MERGE_IN, MERGE_IN, 0, MERGE_IN);
|
||||||
scrollWidth = vertScroll->size().width();
|
scrollWidth = vertScroll->size().width();
|
||||||
item->setSizeHint(QSize(this->width() - 5 - scrollWidth, WIDTH_ITEM));
|
|
||||||
emit this->setScrollWidth(scrollWidth);
|
emit this->setScrollWidth(scrollWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,6 +256,8 @@ bool BackupListWidget::appendItem(const QString &text)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
connect(this, &BackupListWidget::resetItemWidth, widget, &MyItemWidget::resetItemWidth);
|
||||||
|
|
||||||
m_plusLogo->setVisible(false);
|
m_plusLogo->setVisible(false);
|
||||||
m_plusText->setVisible(false);
|
m_plusText->setVisible(false);
|
||||||
emit this->addedItem();
|
emit this->addedItem();
|
||||||
|
|
|
@ -14,7 +14,7 @@ class MyItemWidget : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit MyItemWidget(QWidget* parent = nullptr);
|
explicit MyItemWidget(QWidget* parent = nullptr, QListWidgetItem *item = nullptr);
|
||||||
virtual ~MyItemWidget();
|
virtual ~MyItemWidget();
|
||||||
|
|
||||||
void setSize(int width, int height);
|
void setSize(int width, int height);
|
||||||
|
@ -29,6 +29,7 @@ signals:
|
||||||
void selected(bool checked);
|
void selected(bool checked);
|
||||||
void deleteItem();
|
void deleteItem();
|
||||||
void setScrollWidth(int width);
|
void setScrollWidth(int width);
|
||||||
|
void resetItemWidth(int width);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_text;
|
QString m_text;
|
||||||
|
@ -37,6 +38,8 @@ private:
|
||||||
int m_scrollWidth = 0; //父窗口QListWidget的滚动条宽度
|
int m_scrollWidth = 0; //父窗口QListWidget的滚动条宽度
|
||||||
int m_extWidth = 0; //去掉父窗口QListWidget的父窗口QFrame的右侧边距时扩展的宽度
|
int m_extWidth = 0; //去掉父窗口QListWidget的父窗口QFrame的右侧边距时扩展的宽度
|
||||||
bool m_checked = false;
|
bool m_checked = false;
|
||||||
|
|
||||||
|
QListWidgetItem *m_item;
|
||||||
};
|
};
|
||||||
|
|
||||||
class BackupListWidget : public QListWidget
|
class BackupListWidget : public QListWidget
|
||||||
|
@ -74,6 +77,7 @@ signals:
|
||||||
void deleteEmpty();
|
void deleteEmpty();
|
||||||
void addedItem();
|
void addedItem();
|
||||||
void setScrollWidth(int width);
|
void setScrollWidth(int width);
|
||||||
|
void resetItemWidth(int width);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool checkPathLimit(const QString &path);
|
bool checkPathLimit(const QString &path);
|
||||||
|
|
|
@ -89,6 +89,31 @@ MyLabel::MyLabel(const QString& text, QWidget* parent /*= nullptr*/, Qt::Alignme
|
||||||
MyLabel::~MyLabel()
|
MyLabel::~MyLabel()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
void MyLabel::setMaxLenText()
|
||||||
|
{
|
||||||
|
QFontMetrics fontMetrics(this->font());
|
||||||
|
int fontSize = fontMetrics.width(this->m_text);
|
||||||
|
if (this->m_maxWidth > 0 && fontSize >= this->m_maxWidth) {
|
||||||
|
this->setFixedWidth(this->m_maxWidth);
|
||||||
|
this->setWordWrap(true);
|
||||||
|
} else {
|
||||||
|
this->setFixedWidth(fontSize);
|
||||||
|
}
|
||||||
|
this->setText(this->m_text);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 设置显示文本,根据字体自动设置控件宽度,并限制最大宽度;超过长度换行展示;
|
||||||
|
* @param text
|
||||||
|
* @param length 最大宽度
|
||||||
|
*/
|
||||||
|
void MyLabel::setMaxLenText(const QString& text, int width)
|
||||||
|
{
|
||||||
|
m_text = text;
|
||||||
|
m_maxWidth = width;
|
||||||
|
setMaxLenText();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 如果文本超长则显示省略号,不超长正常显示
|
* @brief 如果文本超长则显示省略号,不超长正常显示
|
||||||
* @param text
|
* @param text
|
||||||
|
|
|
@ -16,6 +16,7 @@ public:
|
||||||
const QString & getOriginalText() const { return m_text; }
|
const QString & getOriginalText() const { return m_text; }
|
||||||
void setDeplayText(const QString& text) { m_text = text; this->setText(text);}
|
void setDeplayText(const QString& text) { m_text = text; this->setText(text);}
|
||||||
void setElidedText(const QString& text, Qt::TextElideMode mode = Qt::ElideRight);
|
void setElidedText(const QString& text, Qt::TextElideMode mode = Qt::ElideRight);
|
||||||
|
void setMaxLenText(const QString& text, int width);
|
||||||
void setFontColor(QColor color);
|
void setFontColor(QColor color);
|
||||||
void setFontSize(int size);
|
void setFontSize(int size);
|
||||||
void setFontWordWrap(bool on);
|
void setFontWordWrap(bool on);
|
||||||
|
@ -25,13 +26,16 @@ protected:
|
||||||
// 主要因为字体变化而重绘,故暂不重写paintEvent,改为在构造方法中监控主题的字体(家族和大小)变化
|
// 主要因为字体变化而重绘,故暂不重写paintEvent,改为在构造方法中监控主题的字体(家族和大小)变化
|
||||||
// void paintEvent(QPaintEvent *event);
|
// void paintEvent(QPaintEvent *event);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void setMaxLenText();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_text;
|
QString m_text;
|
||||||
bool m_bWordWrap = false;
|
bool m_bWordWrap = false;
|
||||||
int m_width = 0;
|
int m_width = 0;
|
||||||
int m_height = 0;
|
int m_height = 0;
|
||||||
|
int m_maxWidth = 0;
|
||||||
bool m_isOriginal = false;
|
bool m_isOriginal = false;
|
||||||
bool m_needResize = false;
|
|
||||||
QRect m_rect;
|
QRect m_rect;
|
||||||
QColor m_fontColor;
|
QColor m_fontColor;
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,9 @@ signals:
|
||||||
|
|
||||||
// 强调色变化
|
// 强调色变化
|
||||||
void themeColorChanged();
|
void themeColorChanged();
|
||||||
|
|
||||||
|
// 控件宽度发生变化
|
||||||
|
void widthChanged();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GLOBALSIGNALS_H
|
#endif // GLOBALSIGNALS_H
|
||||||
|
|
|
@ -43,6 +43,7 @@ GSettingsWrapper::GSettingsWrapper(token)
|
||||||
// 字体大小或字体类型发生变化
|
// 字体大小或字体类型发生变化
|
||||||
int fontSize = m_pGsettingThemeData->get("system-font-size").toInt();
|
int fontSize = m_pGsettingThemeData->get("system-font-size").toInt();
|
||||||
emit GlobelBackupInfo::inst().getGlobalSignals()->fontChanged(fontSize);
|
emit GlobelBackupInfo::inst().getGlobalSignals()->fontChanged(fontSize);
|
||||||
|
emit GlobelBackupInfo::inst().getGlobalSignals()->widthChanged();
|
||||||
} else if (key == COLOR_QT_KEY) {
|
} else if (key == COLOR_QT_KEY) {
|
||||||
// 强调色变化
|
// 强调色变化
|
||||||
emit GlobelBackupInfo::inst().getGlobalSignals()->themeColorChanged();
|
emit GlobelBackupInfo::inst().getGlobalSignals()->themeColorChanged();
|
||||||
|
|
|
@ -71,29 +71,34 @@ void MainDialog::initUI()
|
||||||
m_totalHLayout->setSpacing(0);
|
m_totalHLayout->setSpacing(0);
|
||||||
ui->centralwidget->setLayout(m_totalHLayout);
|
ui->centralwidget->setLayout(m_totalHLayout);
|
||||||
|
|
||||||
|
// 左栏窗口
|
||||||
if (GlobelBackupInfo::inst().isManager())
|
if (GlobelBackupInfo::inst().isManager())
|
||||||
m_leftSiderBarWidget = new LeftsiderbarWidget(ui->centralwidget);
|
m_leftSiderBarWidget = new LeftsiderbarWidget(ui->centralwidget);
|
||||||
else
|
else
|
||||||
m_leftSiderBarWidget = new LeftsiderbarWidget(ui->centralwidget, LeftsiderbarWidget::StartMode::std_user);
|
m_leftSiderBarWidget = new LeftsiderbarWidget(ui->centralwidget, LeftsiderbarWidget::StartMode::std_user);
|
||||||
m_leftSiderBarWidget->setObjectName(QString::fromUtf8("m_leftSiderBarWidget"));
|
m_leftSiderBarWidget->setObjectName(QString::fromUtf8("m_leftSiderBarWidget"));
|
||||||
m_leftSiderBarWidget->setFixedSize(200, 640);
|
m_leftSiderBarWidget->setFixedWidth(200);
|
||||||
|
//m_leftSiderBarWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
|
||||||
m_leftSiderBarWidget->initUi();
|
m_leftSiderBarWidget->initUi();
|
||||||
|
|
||||||
m_totalHLayout->addWidget(m_leftSiderBarWidget);
|
m_totalHLayout->addWidget(m_leftSiderBarWidget);
|
||||||
|
|
||||||
|
// 右侧窗口
|
||||||
m_rightWidget = new MyWidget;
|
m_rightWidget = new MyWidget;
|
||||||
|
//m_rightWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||||
|
|
||||||
m_rightVLayout = new QVBoxLayout;
|
m_rightVLayout = new QVBoxLayout;
|
||||||
m_rightVLayout->setObjectName(QString::fromUtf8("m_rightVLayout"));
|
m_rightVLayout->setObjectName(QString::fromUtf8("m_rightVLayout"));
|
||||||
m_rightVLayout->setContentsMargins(0, 0, 0, 0);
|
m_rightVLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
m_rightVLayout->setSpacing(0);
|
m_rightVLayout->setSpacing(0);
|
||||||
|
|
||||||
|
// 右侧窗口:标题栏
|
||||||
m_titleWidget = new QWidget;
|
m_titleWidget = new QWidget;
|
||||||
m_titleWidget->setObjectName(QString::fromUtf8("m_titleWidget"));
|
m_titleWidget->setObjectName(QString::fromUtf8("m_titleWidget"));
|
||||||
m_titleWidget->setFixedSize(760, 40);
|
m_titleWidget->setFixedHeight(40);
|
||||||
m_rightVLayout->addWidget(m_titleWidget);
|
m_rightVLayout->addWidget(m_titleWidget);
|
||||||
m_rightVLayout->addStretch();
|
|
||||||
|
|
||||||
|
// 右侧窗口:工作区
|
||||||
if (GlobelBackupInfo::inst().isManager() && GlobelBackupInfo::inst().hasArgRestore())
|
if (GlobelBackupInfo::inst().isManager() && GlobelBackupInfo::inst().hasArgRestore())
|
||||||
selected(FuncTypeConverter::FunType::RESTORE_SYSTEM);
|
selected(FuncTypeConverter::FunType::RESTORE_SYSTEM);
|
||||||
else if (!GlobelBackupInfo::inst().isManager() && GlobelBackupInfo::inst().hasArgRestore())
|
else if (!GlobelBackupInfo::inst().isManager() && GlobelBackupInfo::inst().hasArgRestore())
|
||||||
|
@ -105,7 +110,6 @@ void MainDialog::initUI()
|
||||||
|
|
||||||
m_rightWidget->setLayout(m_rightVLayout);
|
m_rightWidget->setLayout(m_rightVLayout);
|
||||||
m_totalHLayout->addWidget(m_rightWidget);
|
m_totalHLayout->addWidget(m_rightWidget);
|
||||||
m_totalHLayout->addStretch();
|
|
||||||
|
|
||||||
initTileBar();
|
initTileBar();
|
||||||
}
|
}
|
||||||
|
@ -114,14 +118,16 @@ void MainDialog::initTileBar()
|
||||||
{
|
{
|
||||||
m_titleLayout = new QHBoxLayout;
|
m_titleLayout = new QHBoxLayout;
|
||||||
m_titleLayout->setContentsMargins(8, 4, 4, 0);
|
m_titleLayout->setContentsMargins(8, 4, 4, 0);
|
||||||
m_titleLayout->setSpacing(0);
|
m_titleLayout->setSpacing(4);
|
||||||
|
|
||||||
m_menuOptionBtn = new QToolButton;
|
m_menuOptionBtn = new QToolButton;
|
||||||
m_minBtn = new QPushButton;
|
m_minBtn = new QPushButton;
|
||||||
|
m_maxBtn = new QPushButton;
|
||||||
m_closeBtn = new QPushButton;
|
m_closeBtn = new QPushButton;
|
||||||
|
|
||||||
m_menuOptionBtn->setToolTip(tr("Main menu"));
|
m_menuOptionBtn->setToolTip(tr("Main menu"));
|
||||||
m_minBtn->setToolTip(tr("Minimize"));
|
m_minBtn->setToolTip(tr("Minimize"));
|
||||||
|
m_maxBtn->setToolTip(tr("Maximize"));
|
||||||
m_closeBtn->setToolTip(tr("Close"));
|
m_closeBtn->setToolTip(tr("Close"));
|
||||||
|
|
||||||
m_menuOptionBtn->setProperty("isWindowButton", 0x1);
|
m_menuOptionBtn->setProperty("isWindowButton", 0x1);
|
||||||
|
@ -130,21 +136,24 @@ void MainDialog::initTileBar()
|
||||||
m_menuOptionBtn->setFixedSize(30, 30);
|
m_menuOptionBtn->setFixedSize(30, 30);
|
||||||
m_menuOptionBtn->setAutoRaise(true);
|
m_menuOptionBtn->setAutoRaise(true);
|
||||||
m_menuOptionBtn->setPopupMode(QToolButton::InstantPopup);
|
m_menuOptionBtn->setPopupMode(QToolButton::InstantPopup);
|
||||||
// m_menuOptionBtn->setProperty("setIconHighlightEffectDefaultColor", m_closeBtn->palette().color(QPalette::Active, QPalette::Base));
|
|
||||||
|
|
||||||
m_minBtn->setProperty("isWindowButton", 0x1);
|
m_minBtn->setProperty("isWindowButton", 0x1);
|
||||||
m_minBtn->setProperty("useIconHighlightEffect", 0x2);
|
m_minBtn->setProperty("useIconHighlightEffect", 0x2);
|
||||||
m_minBtn->setFixedSize(30, 30);
|
m_minBtn->setFixedSize(30, 30);
|
||||||
m_minBtn->setFlat(true);
|
m_minBtn->setFlat(true);
|
||||||
m_minBtn->setIcon(QIcon::fromTheme("window-minimize-symbolic"));
|
m_minBtn->setIcon(QIcon::fromTheme("window-minimize-symbolic"));
|
||||||
// m_minBtn->setProperty("setIconHighlightEffectDefaultColor", m_closeBtn->palette().color(QPalette::Active, QPalette::Base));
|
|
||||||
|
m_maxBtn->setProperty("isWindowButton", 0x1);
|
||||||
|
m_maxBtn->setProperty("useIconHighlightEffect", 0x2);
|
||||||
|
m_maxBtn->setFixedSize(30, 30);
|
||||||
|
m_maxBtn->setFlat(true);
|
||||||
|
m_maxBtn->setIcon(QIcon::fromTheme("window-maximize-symbolic"));
|
||||||
|
|
||||||
m_closeBtn->setProperty("isWindowButton", 0x2);
|
m_closeBtn->setProperty("isWindowButton", 0x2);
|
||||||
m_closeBtn->setProperty("useIconHighlightEffect", 0x8);
|
m_closeBtn->setProperty("useIconHighlightEffect", 0x8);
|
||||||
m_closeBtn->setFixedSize(30, 30);
|
m_closeBtn->setFixedSize(30, 30);
|
||||||
m_closeBtn->setFlat(true);
|
m_closeBtn->setFlat(true);
|
||||||
m_closeBtn->setIcon(QIcon::fromTheme("window-close-symbolic"));
|
m_closeBtn->setIcon(QIcon::fromTheme("window-close-symbolic"));
|
||||||
// m_closeBtn->setProperty("setIconHighlightEffectDefaultColor", m_closeBtn->palette().color(QPalette::Active, QPalette::Base));
|
|
||||||
|
|
||||||
QMenu* backupMain = new QMenu(m_titleWidget);
|
QMenu* backupMain = new QMenu(m_titleWidget);
|
||||||
backupMain->setObjectName("mainMenu");
|
backupMain->setObjectName("mainMenu");
|
||||||
|
@ -173,9 +182,8 @@ void MainDialog::initTileBar()
|
||||||
|
|
||||||
m_titleLayout->addStretch();
|
m_titleLayout->addStretch();
|
||||||
m_titleLayout->addWidget(m_menuOptionBtn);
|
m_titleLayout->addWidget(m_menuOptionBtn);
|
||||||
m_titleLayout->addSpacing(4);
|
|
||||||
m_titleLayout->addWidget(m_minBtn);
|
m_titleLayout->addWidget(m_minBtn);
|
||||||
m_titleLayout->addSpacing(4);
|
m_titleLayout->addWidget(m_maxBtn);
|
||||||
m_titleLayout->addWidget(m_closeBtn);
|
m_titleLayout->addWidget(m_closeBtn);
|
||||||
m_titleWidget->setLayout(m_titleLayout);
|
m_titleWidget->setLayout(m_titleLayout);
|
||||||
}
|
}
|
||||||
|
@ -204,6 +212,17 @@ void MainDialog::initConnect()
|
||||||
//最小化按钮
|
//最小化按钮
|
||||||
connect(m_minBtn, &QPushButton::clicked, this, &MainDialog::showMinimized);
|
connect(m_minBtn, &QPushButton::clicked, this, &MainDialog::showMinimized);
|
||||||
|
|
||||||
|
//最大化按钮
|
||||||
|
connect(m_maxBtn, &QPushButton::clicked, this, [=] {
|
||||||
|
if (isMaximized()) {
|
||||||
|
showNormal();
|
||||||
|
m_maxBtn->setIcon(QIcon::fromTheme("window-maximize-symbolic"));
|
||||||
|
} else {
|
||||||
|
showMaximized();
|
||||||
|
m_maxBtn->setIcon(QIcon::fromTheme("window-restore-symbolic"));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
//关闭按钮
|
//关闭按钮
|
||||||
connect(m_closeBtn, &QPushButton::clicked, this, &MainDialog::closeBtn);
|
connect(m_closeBtn, &QPushButton::clicked, this, &MainDialog::closeBtn);
|
||||||
}
|
}
|
||||||
|
@ -254,7 +273,7 @@ void MainDialog::selected(int func_type)
|
||||||
}
|
}
|
||||||
|
|
||||||
m_stackedWidget->setObjectName(QString::fromUtf8("m_stackedWidget"));
|
m_stackedWidget->setObjectName(QString::fromUtf8("m_stackedWidget"));
|
||||||
m_stackedWidget->setFixedSize(760, 600);
|
// m_stackedWidget->setMinimumSize(760, 600);
|
||||||
m_rightVLayout->addWidget(m_stackedWidget);
|
m_rightVLayout->addWidget(m_stackedWidget);
|
||||||
|
|
||||||
m_leftSiderBarWidget->setCheckedFunc(func_type);
|
m_leftSiderBarWidget->setCheckedFunc(func_type);
|
||||||
|
@ -333,6 +352,11 @@ void MainDialog::closeEvent(QCloseEvent *e)
|
||||||
e->accept();
|
e->accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainDialog::resizeEvent(QResizeEvent *event) {
|
||||||
|
emit GlobelBackupInfo::inst().getGlobalSignals()->widthChanged();
|
||||||
|
QMainWindow::resizeEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
void MainDialog::closeBtn()
|
void MainDialog::closeBtn()
|
||||||
{
|
{
|
||||||
if (this->close()) {
|
if (this->close()) {
|
||||||
|
|
|
@ -23,6 +23,9 @@ public:
|
||||||
|
|
||||||
void closeEvent(QCloseEvent *e);
|
void closeEvent(QCloseEvent *e);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void resizeEvent(QResizeEvent *event);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void sltMessageReceived(const QString &msg);
|
void sltMessageReceived(const QString &msg);
|
||||||
void closeBtn();
|
void closeBtn();
|
||||||
|
@ -48,6 +51,7 @@ private:
|
||||||
QHBoxLayout *m_titleLayout = nullptr;
|
QHBoxLayout *m_titleLayout = nullptr;
|
||||||
QToolButton *m_menuOptionBtn = nullptr;
|
QToolButton *m_menuOptionBtn = nullptr;
|
||||||
QPushButton *m_minBtn = nullptr;
|
QPushButton *m_minBtn = nullptr;
|
||||||
|
QPushButton *m_maxBtn = nullptr;
|
||||||
QPushButton *m_closeBtn = nullptr;
|
QPushButton *m_closeBtn = nullptr;
|
||||||
|
|
||||||
QAction *m_backupHelp = nullptr;
|
QAction *m_backupHelp = nullptr;
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
|
@ -24,8 +24,8 @@
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>960</width>
|
<width>16777215</width>
|
||||||
<height>640</height>
|
<height>16777215</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
|
|
@ -32,6 +32,11 @@
|
||||||
|
|
||||||
using namespace kdk;
|
using namespace kdk;
|
||||||
|
|
||||||
|
// bigTitle控件前面的宽度:24+spacing
|
||||||
|
#define LEN_TITLE_PRE 50
|
||||||
|
// labelCheck1、labelCheck2控件前面的宽度:10+6+5
|
||||||
|
#define LEN_DOT_PRE 50
|
||||||
|
|
||||||
DataBackup::DataBackup(QWidget *parent /*= nullptr*/) :
|
DataBackup::DataBackup(QWidget *parent /*= nullptr*/) :
|
||||||
QStackedWidget(parent),
|
QStackedWidget(parent),
|
||||||
m_udector(new UdiskDetector()),
|
m_udector(new UdiskDetector()),
|
||||||
|
@ -65,15 +70,25 @@ DataBackup::~DataBackup()
|
||||||
void DataBackup::initFirstWidget()
|
void DataBackup::initFirstWidget()
|
||||||
{
|
{
|
||||||
QWidget *first = new QWidget;
|
QWidget *first = new QWidget;
|
||||||
|
QVBoxLayout *vLayout = new QVBoxLayout;
|
||||||
|
vLayout->addStretch();
|
||||||
|
|
||||||
|
// 中部布局包含一个独立的窗口,用于大小变化时局部相对不变
|
||||||
|
QWidget *center = new QWidget;
|
||||||
|
center->setFixedSize(760, 540);
|
||||||
|
QHBoxLayout *centerHBoxLayout = new QHBoxLayout;
|
||||||
|
centerHBoxLayout->addStretch();
|
||||||
|
centerHBoxLayout->addWidget(center);
|
||||||
|
centerHBoxLayout->addStretch();
|
||||||
|
vLayout->addLayout(centerHBoxLayout);
|
||||||
// 图片
|
// 图片
|
||||||
PixmapLabel *imageBackup_firstPage = new PixmapLabel(first);
|
PixmapLabel *imageBackup_firstPage = new PixmapLabel(center);
|
||||||
imageBackup_firstPage->setGeometry(421, 120, 300, 326);
|
imageBackup_firstPage->setGeometry(421, 120, 300, 326);
|
||||||
imageBackup_firstPage->setScaledContents(true);
|
imageBackup_firstPage->setScaledContents(true);
|
||||||
imageBackup_firstPage->setLightAndDarkPixmap(":/images/data_backup.png", ":/images/data_backup_dark.png");
|
imageBackup_firstPage->setLightAndDarkPixmap(":/images/data_backup.png", ":/images/data_backup_dark.png");
|
||||||
|
|
||||||
// 系统备份大字提示
|
// 系统备份大字提示
|
||||||
MyLabel *labelBackup_firstPage = new MyLabel(first);
|
MyLabel *labelBackup_firstPage = new MyLabel(center);
|
||||||
labelBackup_firstPage->setDeplayText(tr("Data Backup"));
|
labelBackup_firstPage->setDeplayText(tr("Data Backup"));
|
||||||
labelBackup_firstPage->setFixedWidth(500);
|
labelBackup_firstPage->setFixedWidth(500);
|
||||||
labelBackup_firstPage->setFixedHeight(48);
|
labelBackup_firstPage->setFixedHeight(48);
|
||||||
|
@ -90,7 +105,7 @@ void DataBackup::initFirstWidget()
|
||||||
labelBackup_firstPage->adjustSize();
|
labelBackup_firstPage->adjustSize();
|
||||||
|
|
||||||
// 数据备份说明
|
// 数据备份说明
|
||||||
MyLabel *labelNote_firstPage = new MyLabel(first);
|
MyLabel *labelNote_firstPage = new MyLabel(center);
|
||||||
labelNote_firstPage->setFixedWidth(700);
|
labelNote_firstPage->setFixedWidth(700);
|
||||||
labelNote_firstPage->setFixedHeight(24);
|
labelNote_firstPage->setFixedHeight(24);
|
||||||
labelNote_firstPage->move(41, 180);
|
labelNote_firstPage->move(41, 180);
|
||||||
|
@ -105,35 +120,35 @@ void DataBackup::initFirstWidget()
|
||||||
labelNote_firstPage->adjustSize();
|
labelNote_firstPage->adjustSize();
|
||||||
|
|
||||||
// 多点还原
|
// 多点还原
|
||||||
MyIconLabel *iconMultiBackup_firstPage = new MyIconLabel(first);
|
MyIconLabel *iconMultiBackup_firstPage = new MyIconLabel(center);
|
||||||
iconMultiBackup_firstPage->setGeometry(41, 244, 210, 36);
|
iconMultiBackup_firstPage->setGeometry(41, 244, 210, 36);
|
||||||
iconMultiBackup_firstPage->setThemeIcon("ukui-multipoint-symbolic", ":/symbos/ukui-multipoint-symbolic");
|
iconMultiBackup_firstPage->setThemeIcon("ukui-multipoint-symbolic", ":/symbos/ukui-multipoint-symbolic");
|
||||||
iconMultiBackup_firstPage->setDesplayText(tr("Multi-Spot"));
|
iconMultiBackup_firstPage->setDesplayText(tr("Multi-Spot"));
|
||||||
iconMultiBackup_firstPage->setEnabled(false);
|
iconMultiBackup_firstPage->setEnabled(false);
|
||||||
|
|
||||||
// 安全
|
// 安全
|
||||||
MyIconLabel *iconSecurity_firstPage = new MyIconLabel(first);
|
MyIconLabel *iconSecurity_firstPage = new MyIconLabel(center);
|
||||||
iconSecurity_firstPage->setGeometry(231, 244, 180, 36);
|
iconSecurity_firstPage->setGeometry(231, 244, 180, 36);
|
||||||
iconSecurity_firstPage->setThemeIcon("ukui-bf-security-symbolic", ":/symbos/ukui-bf-security-symbolic");
|
iconSecurity_firstPage->setThemeIcon("ukui-bf-security-symbolic", ":/symbos/ukui-bf-security-symbolic");
|
||||||
iconSecurity_firstPage->setDesplayText(tr("Security"));
|
iconSecurity_firstPage->setDesplayText(tr("Security"));
|
||||||
iconSecurity_firstPage->setEnabled(false);
|
iconSecurity_firstPage->setEnabled(false);
|
||||||
|
|
||||||
// 防止数据丢失
|
// 防止数据丢失
|
||||||
MyIconLabel *iconDataLoss_firstPage = new MyIconLabel(first);
|
MyIconLabel *iconDataLoss_firstPage = new MyIconLabel(center);
|
||||||
iconDataLoss_firstPage->setGeometry(41, 296, 210, 36);
|
iconDataLoss_firstPage->setGeometry(41, 296, 210, 36);
|
||||||
iconDataLoss_firstPage->setThemeIcon("ukui-bf-dataloss-symbolic", ":/symbos/ukui-bf-dataloss-symbolic");
|
iconDataLoss_firstPage->setThemeIcon("ukui-bf-dataloss-symbolic", ":/symbos/ukui-bf-dataloss-symbolic");
|
||||||
iconDataLoss_firstPage->setDesplayText(tr("Protect Data"));
|
iconDataLoss_firstPage->setDesplayText(tr("Protect Data"));
|
||||||
iconDataLoss_firstPage->setEnabled(false);
|
iconDataLoss_firstPage->setEnabled(false);
|
||||||
|
|
||||||
// 方便快捷
|
// 方便快捷
|
||||||
MyIconLabel *iconSimple_firstPage = new MyIconLabel(first);
|
MyIconLabel *iconSimple_firstPage = new MyIconLabel(center);
|
||||||
iconSimple_firstPage->setGeometry(231, 296, 180, 36);
|
iconSimple_firstPage->setGeometry(231, 296, 180, 36);
|
||||||
iconSimple_firstPage->setThemeIcon("ukui-bf-fast-symbolic", ":/symbos/ukui-bf-fast-symbolic");
|
iconSimple_firstPage->setThemeIcon("ukui-bf-fast-symbolic", ":/symbos/ukui-bf-fast-symbolic");
|
||||||
iconSimple_firstPage->setDesplayText(tr("Convenient"));
|
iconSimple_firstPage->setDesplayText(tr("Convenient"));
|
||||||
iconSimple_firstPage->setEnabled(false);
|
iconSimple_firstPage->setEnabled(false);
|
||||||
|
|
||||||
// 开始备份按钮
|
// 开始备份按钮
|
||||||
MyPushButton *beginBackup = new MyPushButton(first);
|
MyPushButton *beginBackup = new MyPushButton(center);
|
||||||
beginBackup->setGeometry(41, 372, 180, 52);
|
beginBackup->setGeometry(41, 372, 180, 52);
|
||||||
beginBackup->setText(tr("Start Backup"));
|
beginBackup->setText(tr("Start Backup"));
|
||||||
beginBackup->setEnabled(true);
|
beginBackup->setEnabled(true);
|
||||||
|
@ -152,8 +167,8 @@ void DataBackup::initFirstWidget()
|
||||||
});
|
});
|
||||||
|
|
||||||
// 增量备份按钮
|
// 增量备份按钮
|
||||||
KBorderButton *incrementBackup = new KBorderButton(first);
|
KBorderButton *incrementBackup = new KBorderButton(center);
|
||||||
// MyPushButton *incrementBackup = new MyPushButton(first);
|
// MyPushButton *incrementBackup = new MyPushButton(center);
|
||||||
incrementBackup->setFixedHeight(52);
|
incrementBackup->setFixedHeight(52);
|
||||||
incrementBackup->move(241, 372);
|
incrementBackup->move(241, 372);
|
||||||
incrementBackup->setText(tr("Update Backup"));
|
incrementBackup->setText(tr("Update Backup"));
|
||||||
|
@ -209,11 +224,10 @@ void DataBackup::initFirstWidget()
|
||||||
bottomHBoxLayout->addSpacing(20);
|
bottomHBoxLayout->addSpacing(20);
|
||||||
bottomHBoxLayout->setAlignment(Qt::AlignRight);
|
bottomHBoxLayout->setAlignment(Qt::AlignRight);
|
||||||
|
|
||||||
QVBoxLayout *bottomVBoxLayout = new QVBoxLayout;
|
vLayout->addStretch();
|
||||||
bottomVBoxLayout->addStretch();
|
vLayout->addLayout(bottomHBoxLayout);
|
||||||
bottomVBoxLayout->addLayout(bottomHBoxLayout);
|
vLayout->addSpacing(20);
|
||||||
bottomVBoxLayout->addSpacing(20);
|
first->setLayout(vLayout);
|
||||||
first->setLayout(bottomVBoxLayout);
|
|
||||||
|
|
||||||
connect(backupPointManage, &MyPushButton::clicked, this, [=]() {
|
connect(backupPointManage, &MyPushButton::clicked, this, [=]() {
|
||||||
ManageBackupPointList backupManager(first, ManageBackupPointList::DATA);
|
ManageBackupPointList backupManager(first, ManageBackupPointList::DATA);
|
||||||
|
@ -924,7 +938,6 @@ void DataBackup::initThirdWidget()
|
||||||
|
|
||||||
QHBoxLayout *hlayout = new QHBoxLayout;
|
QHBoxLayout *hlayout = new QHBoxLayout;
|
||||||
hlayout->addStretch();
|
hlayout->addStretch();
|
||||||
hlayout->addSpacing(80);
|
|
||||||
QWidget *centerFont = new QWidget(third);
|
QWidget *centerFont = new QWidget(third);
|
||||||
centerFont->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
centerFont->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||||
QVBoxLayout *vlayoutCenterFont = new QVBoxLayout;
|
QVBoxLayout *vlayoutCenterFont = new QVBoxLayout;
|
||||||
|
@ -1032,7 +1045,6 @@ void DataBackup::initThirdWidget()
|
||||||
|
|
||||||
centerFont->setLayout(vlayoutCenterFont);
|
centerFont->setLayout(vlayoutCenterFont);
|
||||||
hlayout->addWidget(centerFont);
|
hlayout->addWidget(centerFont);
|
||||||
hlayout->addSpacing(80);
|
|
||||||
hlayout->addStretch();
|
hlayout->addStretch();
|
||||||
hlayout->setAlignment(Qt::AlignCenter);
|
hlayout->setAlignment(Qt::AlignCenter);
|
||||||
vlayout->addLayout(hlayout);
|
vlayout->addLayout(hlayout);
|
||||||
|
@ -1067,6 +1079,7 @@ void DataBackup::initThirdWidget()
|
||||||
recheck->setVisible(false);
|
recheck->setVisible(false);
|
||||||
|
|
||||||
this->on_checkEnv_start();
|
this->on_checkEnv_start();
|
||||||
|
emit GlobelBackupInfo::inst().getGlobalSignals()->widthChanged();
|
||||||
});
|
});
|
||||||
|
|
||||||
// 检测结果
|
// 检测结果
|
||||||
|
@ -1118,6 +1131,39 @@ void DataBackup::initThirdWidget()
|
||||||
}
|
}
|
||||||
|
|
||||||
preStep->setVisible(true);
|
preStep->setVisible(true);
|
||||||
|
|
||||||
|
emit GlobelBackupInfo::inst().getGlobalSignals()->widthChanged();
|
||||||
|
});
|
||||||
|
|
||||||
|
// 调整中部控件大小
|
||||||
|
connect(GlobelBackupInfo::inst().getGlobalSignals(), &GlobalSignals::widthChanged, this, [=](){
|
||||||
|
// 控件bigTitle的宽度
|
||||||
|
int len_title = 0;
|
||||||
|
if (bigTitle->isVisible()) {
|
||||||
|
QFontMetrics fontMetrics(bigTitle->font());
|
||||||
|
len_title = fontMetrics.width(bigTitle->getOriginalText());
|
||||||
|
len_title += LEN_TITLE_PRE;
|
||||||
|
}
|
||||||
|
// 控件labelCheck1的宽度
|
||||||
|
int len_labelCheck1 = 0;
|
||||||
|
if (labelCheck1->isVisible()) {
|
||||||
|
QFontMetrics fontMetrics(labelCheck1->font());
|
||||||
|
len_labelCheck1 = fontMetrics.width(labelCheck1->getOriginalText());
|
||||||
|
len_labelCheck1 += LEN_DOT_PRE;
|
||||||
|
}
|
||||||
|
// 控件labelCheck2的宽度
|
||||||
|
int len_labelCheck2 = 0;
|
||||||
|
if (labelCheck2->isVisible()) {
|
||||||
|
QFontMetrics fontMetrics(labelCheck2->font());
|
||||||
|
len_labelCheck2 = fontMetrics.width(labelCheck2->getOriginalText());
|
||||||
|
len_labelCheck2 += LEN_DOT_PRE;
|
||||||
|
}
|
||||||
|
int len_max = len_title > len_labelCheck1 ? len_title : len_labelCheck1;
|
||||||
|
len_max = len_max > len_labelCheck2 ? len_max : len_labelCheck2;
|
||||||
|
if (len_max >= this->width())
|
||||||
|
len_max = this->width();
|
||||||
|
|
||||||
|
centerFont->setFixedWidth(len_max);
|
||||||
});
|
});
|
||||||
|
|
||||||
addWidget(third);
|
addWidget(third);
|
||||||
|
@ -1281,9 +1327,10 @@ void DataBackup::initForthWidget()
|
||||||
QHBoxLayout *hlayoutCenterLine1 = new QHBoxLayout;
|
QHBoxLayout *hlayoutCenterLine1 = new QHBoxLayout;
|
||||||
// 备份名称
|
// 备份名称
|
||||||
MyLabel *labelBackupName = new MyLabel(forth);
|
MyLabel *labelBackupName = new MyLabel(forth);
|
||||||
labelBackupName->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
|
||||||
labelBackupName->setAlignment(Qt::AlignRight | Qt::AlignHCenter);
|
|
||||||
labelBackupName->setDeplayText(tr("Backup Name"));
|
labelBackupName->setDeplayText(tr("Backup Name"));
|
||||||
|
QFontMetrics fontMetrics(labelBackupName->font());
|
||||||
|
int fontSize = fontMetrics.width(labelBackupName->getOriginalText());
|
||||||
|
labelBackupName->setFixedWidth(fontSize);
|
||||||
MyLineEdit *editBackupName = new MyLineEdit(forth);
|
MyLineEdit *editBackupName = new MyLineEdit(forth);
|
||||||
editBackupName->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
editBackupName->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||||
editBackupName->setMinimumWidth(350);
|
editBackupName->setMinimumWidth(350);
|
||||||
|
@ -1303,13 +1350,11 @@ void DataBackup::initForthWidget()
|
||||||
hlayoutCenterLine1->addStretch();
|
hlayoutCenterLine1->addStretch();
|
||||||
hlayoutCenterLine1->addWidget(labelBackupName);
|
hlayoutCenterLine1->addWidget(labelBackupName);
|
||||||
hlayoutCenterLine1->addWidget(editBackupName);
|
hlayoutCenterLine1->addWidget(editBackupName);
|
||||||
hlayoutCenterLine1->addSpacing(40);
|
|
||||||
hlayoutCenterLine1->addStretch();
|
hlayoutCenterLine1->addStretch();
|
||||||
hlayoutCenterLine1->setAlignment(Qt::AlignCenter);
|
hlayoutCenterLine1->setAlignment(Qt::AlignCenter);
|
||||||
vlayout->addLayout(hlayoutCenterLine1);
|
vlayout->addLayout(hlayoutCenterLine1);
|
||||||
|
|
||||||
// 中部第二行
|
// 中部第二行
|
||||||
// QHBoxLayout *hlayoutCenterLine2 = new QHBoxLayout;
|
|
||||||
// 备份名称错误提示
|
// 备份名称错误提示
|
||||||
MyLabel *labelError = new MyLabel(forth);
|
MyLabel *labelError = new MyLabel(forth);
|
||||||
labelError->setFixedSize(editBackupName->size());
|
labelError->setFixedSize(editBackupName->size());
|
||||||
|
@ -1318,13 +1363,14 @@ void DataBackup::initForthWidget()
|
||||||
labelError->setVisible(false);
|
labelError->setVisible(false);
|
||||||
labelError->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
labelError->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
||||||
|
|
||||||
// hlayoutCenterLine2->addStretch();
|
connect(GlobelBackupInfo::inst().getGlobalSignals(), &GlobalSignals::widthChanged, this, [=]{
|
||||||
// hlayoutCenterLine2->addSpacing(labelBackupName->width() + 10); // 和上一行对齐
|
QFontMetrics fontMetrics(labelBackupName->font());
|
||||||
// hlayoutCenterLine2->addWidget(labelError);
|
int fontSize = fontMetrics.width(labelBackupName->getOriginalText());
|
||||||
// hlayoutCenterLine2->addSpacing(40);
|
labelBackupName->setFixedWidth(fontSize);
|
||||||
// hlayoutCenterLine2->addStretch();
|
|
||||||
// hlayoutCenterLine2->setAlignment(Qt::AlignCenter);
|
if (labelError->isVisible())
|
||||||
// vlayout->addLayout(hlayoutCenterLine2);
|
labelError->move(editBackupName->geometry().left(), editBackupName->geometry().bottom() + 10);
|
||||||
|
});
|
||||||
|
|
||||||
connect(validator, &InputValidator::checked, this, [=](bool valid, QString in, int pos, QChar c) {
|
connect(validator, &InputValidator::checked, this, [=](bool valid, QString in, int pos, QChar c) {
|
||||||
if (in.isEmpty())
|
if (in.isEmpty())
|
||||||
|
@ -1391,9 +1437,9 @@ void DataBackup::initForthWidget()
|
||||||
nextStep->setProperty("isImportant", true);
|
nextStep->setProperty("isImportant", true);
|
||||||
connect(nextStep, &MyPushButton::clicked, this, [=](bool checked) {
|
connect(nextStep, &MyPushButton::clicked, this, [=](bool checked) {
|
||||||
Q_UNUSED(checked)
|
Q_UNUSED(checked)
|
||||||
if (labelError->isVisible()) {
|
/*if (labelError->isVisible()) {
|
||||||
editBackupName->setFocus();
|
editBackupName->setFocus();
|
||||||
} else {
|
} else*/ {
|
||||||
QString backupName = editBackupName->text();
|
QString backupName = editBackupName->text();
|
||||||
if (backupName.isEmpty()) {
|
if (backupName.isEmpty()) {
|
||||||
backupName = editBackupName->placeholderText();
|
backupName = editBackupName->placeholderText();
|
||||||
|
@ -1922,9 +1968,6 @@ void DataBackup::initLastWidget()
|
||||||
resultLogo->setVisible(true);
|
resultLogo->setVisible(true);
|
||||||
// 备份成功
|
// 备份成功
|
||||||
bigTitle->setDeplayText(tr("The backup is successful"));
|
bigTitle->setDeplayText(tr("The backup is successful"));
|
||||||
QFontMetrics fontMetrics(bigTitle->font());
|
|
||||||
int fontSize = fontMetrics.width(bigTitle->getOriginalText());
|
|
||||||
bigTitle->setFixedWidth(fontSize);
|
|
||||||
hlayoutCenterFont1->setAlignment(Qt::AlignCenter);
|
hlayoutCenterFont1->setAlignment(Qt::AlignCenter);
|
||||||
|
|
||||||
dot1->setVisible(false);
|
dot1->setVisible(false);
|
||||||
|
@ -1951,6 +1994,38 @@ void DataBackup::initLastWidget()
|
||||||
|
|
||||||
homePage->setVisible(true);
|
homePage->setVisible(true);
|
||||||
}
|
}
|
||||||
|
emit GlobelBackupInfo::inst().getGlobalSignals()->widthChanged();
|
||||||
|
});
|
||||||
|
|
||||||
|
// 调整中部控件大小
|
||||||
|
connect(GlobelBackupInfo::inst().getGlobalSignals(), &GlobalSignals::widthChanged, this, [=](){
|
||||||
|
// 控件bigTitle的宽度
|
||||||
|
int len_title = 0;
|
||||||
|
if (bigTitle->isVisible()) {
|
||||||
|
QFontMetrics fontMetrics(bigTitle->font());
|
||||||
|
len_title = fontMetrics.width(bigTitle->getOriginalText());
|
||||||
|
len_title += LEN_TITLE_PRE;
|
||||||
|
}
|
||||||
|
// 控件labelError1的宽度
|
||||||
|
int len_labelError1 = 0;
|
||||||
|
if (labelError1->isVisible()) {
|
||||||
|
QFontMetrics fontMetrics(labelError1->font());
|
||||||
|
len_labelError1 = fontMetrics.width(labelError1->getOriginalText());
|
||||||
|
len_labelError1 += LEN_DOT_PRE;
|
||||||
|
}
|
||||||
|
// 控件labelError2的宽度
|
||||||
|
int len_labelError2 = 0;
|
||||||
|
if (labelError2->isVisible()) {
|
||||||
|
QFontMetrics fontMetrics(labelError2->font());
|
||||||
|
len_labelError2 = fontMetrics.width(labelError2->getOriginalText());
|
||||||
|
len_labelError2 += LEN_DOT_PRE;
|
||||||
|
}
|
||||||
|
int len_max = len_title > len_labelError1 ? len_title : len_labelError1;
|
||||||
|
len_max = len_max > len_labelError2 ? len_max : len_labelError2;
|
||||||
|
if (len_max >= this->width())
|
||||||
|
len_max = this->width();
|
||||||
|
|
||||||
|
centerFont->setFixedWidth(len_max);
|
||||||
});
|
});
|
||||||
|
|
||||||
// 再试一次
|
// 再试一次
|
||||||
|
|
|
@ -25,6 +25,10 @@
|
||||||
#include "kborderbutton.h"
|
#include "kborderbutton.h"
|
||||||
|
|
||||||
using namespace kdk;
|
using namespace kdk;
|
||||||
|
// bigTitle控件前面的宽度:24+spacing
|
||||||
|
#define LEN_TITLE_PRE 50
|
||||||
|
// labelCheck1、labelCheck2控件前面的宽度:10+6+5
|
||||||
|
#define LEN_DOT_PRE 50
|
||||||
|
|
||||||
DataRestore::DataRestore(QWidget *parent) :
|
DataRestore::DataRestore(QWidget *parent) :
|
||||||
QStackedWidget(parent)
|
QStackedWidget(parent)
|
||||||
|
@ -50,15 +54,28 @@ DataRestore::~DataRestore()
|
||||||
void DataRestore::initFirstWidget()
|
void DataRestore::initFirstWidget()
|
||||||
{
|
{
|
||||||
QWidget *first = new QWidget;
|
QWidget *first = new QWidget;
|
||||||
|
QVBoxLayout *vLayout = new QVBoxLayout;
|
||||||
|
vLayout->addStretch();
|
||||||
|
|
||||||
|
// 中部布局包含一个独立的窗口,用于大小变化时局部相对不变
|
||||||
|
QWidget *center = new QWidget;
|
||||||
|
center->setFixedSize(760, 540);
|
||||||
|
QHBoxLayout *centerHBoxLayout = new QHBoxLayout;
|
||||||
|
centerHBoxLayout->addStretch();
|
||||||
|
centerHBoxLayout->addWidget(center);
|
||||||
|
centerHBoxLayout->addStretch();
|
||||||
|
vLayout->addLayout(centerHBoxLayout);
|
||||||
|
vLayout->addStretch();
|
||||||
|
vLayout->addSpacing(60);
|
||||||
|
first->setLayout(vLayout);
|
||||||
// 图片
|
// 图片
|
||||||
PixmapLabel *imageRestore_firstPage = new PixmapLabel(first);
|
PixmapLabel *imageRestore_firstPage = new PixmapLabel(center);
|
||||||
imageRestore_firstPage->setGeometry(421, 120, 300, 326);
|
imageRestore_firstPage->setGeometry(421, 120, 300, 326);
|
||||||
imageRestore_firstPage->setScaledContents(true);
|
imageRestore_firstPage->setScaledContents(true);
|
||||||
imageRestore_firstPage->setLightAndDarkPixmap(":/images/data_restore.png", ":/images/data_restore_dark.png");
|
imageRestore_firstPage->setLightAndDarkPixmap(":/images/data_restore.png", ":/images/data_restore_dark.png");
|
||||||
|
|
||||||
// 数据还原大字提示
|
// 数据还原大字提示
|
||||||
MyLabel *labelRestore_firstPage = new MyLabel(first);
|
MyLabel *labelRestore_firstPage = new MyLabel(center);
|
||||||
labelRestore_firstPage->setDeplayText(tr("Data Restore"));
|
labelRestore_firstPage->setDeplayText(tr("Data Restore"));
|
||||||
labelRestore_firstPage->setFixedWidth(500);
|
labelRestore_firstPage->setFixedWidth(500);
|
||||||
labelRestore_firstPage->setFixedHeight(48);
|
labelRestore_firstPage->setFixedHeight(48);
|
||||||
|
@ -72,7 +89,7 @@ void DataRestore::initFirstWidget()
|
||||||
labelRestore_firstPage->adjustSize();
|
labelRestore_firstPage->adjustSize();
|
||||||
|
|
||||||
// 数据还原说明
|
// 数据还原说明
|
||||||
MyLabel *labelNote_firstPage = new MyLabel(first);
|
MyLabel *labelNote_firstPage = new MyLabel(center);
|
||||||
labelNote_firstPage->setFixedWidth(700);
|
labelNote_firstPage->setFixedWidth(700);
|
||||||
labelNote_firstPage->setFixedHeight(24);
|
labelNote_firstPage->setFixedHeight(24);
|
||||||
labelNote_firstPage->move(41, 180);
|
labelNote_firstPage->move(41, 180);
|
||||||
|
@ -85,35 +102,35 @@ void DataRestore::initFirstWidget()
|
||||||
labelNote_firstPage->adjustSize();
|
labelNote_firstPage->adjustSize();
|
||||||
|
|
||||||
// 快速恢复
|
// 快速恢复
|
||||||
MyIconLabel *iconSimple_firstPage = new MyIconLabel(first);
|
MyIconLabel *iconSimple_firstPage = new MyIconLabel(center);
|
||||||
iconSimple_firstPage->setGeometry(41, 244, 210, 36);
|
iconSimple_firstPage->setGeometry(41, 244, 210, 36);
|
||||||
iconSimple_firstPage->setThemeIcon("object-rotate-left-symbolic", ":/symbos/object-rotate-left-symbolic");
|
iconSimple_firstPage->setThemeIcon("object-rotate-left-symbolic", ":/symbos/object-rotate-left-symbolic");
|
||||||
iconSimple_firstPage->setDesplayText(tr("Fast Recovery"));
|
iconSimple_firstPage->setDesplayText(tr("Fast Recovery"));
|
||||||
iconSimple_firstPage->setEnabled(false);
|
iconSimple_firstPage->setEnabled(false);
|
||||||
|
|
||||||
// 安全可靠
|
// 安全可靠
|
||||||
MyIconLabel *iconSecurity_firstPage = new MyIconLabel(first);
|
MyIconLabel *iconSecurity_firstPage = new MyIconLabel(center);
|
||||||
iconSecurity_firstPage->setGeometry(231, 244, 180, 36);
|
iconSecurity_firstPage->setGeometry(231, 244, 180, 36);
|
||||||
iconSecurity_firstPage->setThemeIcon("ukui-bf-security-symbolic", ":/symbos/ukui-bf-security-symbolic");
|
iconSecurity_firstPage->setThemeIcon("ukui-bf-security-symbolic", ":/symbos/ukui-bf-security-symbolic");
|
||||||
iconSecurity_firstPage->setDesplayText(tr("Security"));
|
iconSecurity_firstPage->setDesplayText(tr("Security"));
|
||||||
iconSecurity_firstPage->setEnabled(false);
|
iconSecurity_firstPage->setEnabled(false);
|
||||||
|
|
||||||
// 防止数据丢失
|
// 防止数据丢失
|
||||||
MyIconLabel *iconMultiBackup_firstPage = new MyIconLabel(first);
|
MyIconLabel *iconMultiBackup_firstPage = new MyIconLabel(center);
|
||||||
iconMultiBackup_firstPage->setGeometry(41, 296, 210, 36);
|
iconMultiBackup_firstPage->setGeometry(41, 296, 210, 36);
|
||||||
iconMultiBackup_firstPage->setThemeIcon("ukui-bf-dataloss-symbolic", ":/symbos/ukui-bf-dataloss-symbolic");
|
iconMultiBackup_firstPage->setThemeIcon("ukui-bf-dataloss-symbolic", ":/symbos/ukui-bf-dataloss-symbolic");
|
||||||
iconMultiBackup_firstPage->setDesplayText(tr("Protect Data"));
|
iconMultiBackup_firstPage->setDesplayText(tr("Protect Data"));
|
||||||
iconMultiBackup_firstPage->setEnabled(false);
|
iconMultiBackup_firstPage->setEnabled(false);
|
||||||
|
|
||||||
// 自主操作
|
// 自主操作
|
||||||
MyIconLabel *iconSmallSize_firstPage = new MyIconLabel(first);
|
MyIconLabel *iconSmallSize_firstPage = new MyIconLabel(center);
|
||||||
iconSmallSize_firstPage->setGeometry(231, 296, 180, 36);
|
iconSmallSize_firstPage->setGeometry(231, 296, 180, 36);
|
||||||
iconSmallSize_firstPage->setThemeIcon("ukui-self-help-symbolic", ":/symbos/ukui-self-help-symbolic");
|
iconSmallSize_firstPage->setThemeIcon("ukui-self-help-symbolic", ":/symbos/ukui-self-help-symbolic");
|
||||||
iconSmallSize_firstPage->setDesplayText(tr("Independent"));
|
iconSmallSize_firstPage->setDesplayText(tr("Independent"));
|
||||||
iconSmallSize_firstPage->setEnabled(false);
|
iconSmallSize_firstPage->setEnabled(false);
|
||||||
|
|
||||||
// 开始还原按钮
|
// 开始还原按钮
|
||||||
MyPushButton *beginRestore = new MyPushButton(first);
|
MyPushButton *beginRestore = new MyPushButton(center);
|
||||||
beginRestore->setGeometry(41, 372, 180, 52);
|
beginRestore->setGeometry(41, 372, 180, 52);
|
||||||
beginRestore->setText(tr("Start Restore"));
|
beginRestore->setText(tr("Start Restore"));
|
||||||
beginRestore->setEnabled(true);
|
beginRestore->setEnabled(true);
|
||||||
|
@ -400,6 +417,7 @@ void DataRestore::initSecondWidget()
|
||||||
recheck->setVisible(false);
|
recheck->setVisible(false);
|
||||||
|
|
||||||
this->on_checkEnv_start();
|
this->on_checkEnv_start();
|
||||||
|
emit GlobelBackupInfo::inst().getGlobalSignals()->widthChanged();
|
||||||
});
|
});
|
||||||
|
|
||||||
// 检测结果
|
// 检测结果
|
||||||
|
@ -451,6 +469,38 @@ void DataRestore::initSecondWidget()
|
||||||
}
|
}
|
||||||
|
|
||||||
preStep->setVisible(true);
|
preStep->setVisible(true);
|
||||||
|
emit GlobelBackupInfo::inst().getGlobalSignals()->widthChanged();
|
||||||
|
});
|
||||||
|
|
||||||
|
// 调整中部控件大小
|
||||||
|
connect(GlobelBackupInfo::inst().getGlobalSignals(), &GlobalSignals::widthChanged, this, [=](){
|
||||||
|
// 控件bigTitle的宽度
|
||||||
|
int len_title = 0;
|
||||||
|
if (bigTitle->isVisible()) {
|
||||||
|
QFontMetrics fontMetrics(bigTitle->font());
|
||||||
|
len_title = fontMetrics.width(bigTitle->getOriginalText());
|
||||||
|
len_title += LEN_TITLE_PRE;
|
||||||
|
}
|
||||||
|
// 控件labelCheck1的宽度
|
||||||
|
int len_labelCheck1 = 0;
|
||||||
|
if (labelCheck1->isVisible()) {
|
||||||
|
QFontMetrics fontMetrics(labelCheck1->font());
|
||||||
|
len_labelCheck1 = fontMetrics.width(labelCheck1->getOriginalText());
|
||||||
|
len_labelCheck1 += LEN_DOT_PRE;
|
||||||
|
}
|
||||||
|
// 控件labelCheck2的宽度
|
||||||
|
int len_labelCheck2 = 0;
|
||||||
|
if (labelCheck2->isVisible()) {
|
||||||
|
QFontMetrics fontMetrics(labelCheck2->font());
|
||||||
|
len_labelCheck2 = fontMetrics.width(labelCheck2->getOriginalText());
|
||||||
|
len_labelCheck2 += LEN_DOT_PRE;
|
||||||
|
}
|
||||||
|
int len_max = len_title > len_labelCheck1 ? len_title : len_labelCheck1;
|
||||||
|
len_max = len_max > len_labelCheck2 ? len_max : len_labelCheck2;
|
||||||
|
if (len_max >= this->width())
|
||||||
|
len_max = this->width();
|
||||||
|
|
||||||
|
centerFont->setFixedWidth(len_max);
|
||||||
});
|
});
|
||||||
|
|
||||||
// 重新检查
|
// 重新检查
|
||||||
|
@ -968,6 +1018,38 @@ void DataRestore::initLastWidget()
|
||||||
reboot->setVisible(false);
|
reboot->setVisible(false);
|
||||||
hlayoutCenterFont1->setAlignment(Qt::AlignLeft);
|
hlayoutCenterFont1->setAlignment(Qt::AlignLeft);
|
||||||
}
|
}
|
||||||
|
emit GlobelBackupInfo::inst().getGlobalSignals()->widthChanged();
|
||||||
|
});
|
||||||
|
|
||||||
|
// 调整中部控件大小
|
||||||
|
connect(GlobelBackupInfo::inst().getGlobalSignals(), &GlobalSignals::widthChanged, this, [=](){
|
||||||
|
// 控件bigTitle的宽度
|
||||||
|
int len_title = 0;
|
||||||
|
if (bigTitle->isVisible()) {
|
||||||
|
QFontMetrics fontMetrics(bigTitle->font());
|
||||||
|
len_title = fontMetrics.width(bigTitle->getOriginalText());
|
||||||
|
len_title += LEN_TITLE_PRE;
|
||||||
|
}
|
||||||
|
// 控件labelError1的宽度
|
||||||
|
int len_labelError1 = 0;
|
||||||
|
if (labelError1->isVisible()) {
|
||||||
|
QFontMetrics fontMetrics(labelError1->font());
|
||||||
|
len_labelError1 = fontMetrics.width(labelError1->getOriginalText());
|
||||||
|
len_labelError1 += LEN_DOT_PRE;
|
||||||
|
}
|
||||||
|
// 控件labelError2的宽度
|
||||||
|
int len_labelError2 = 0;
|
||||||
|
if (labelError2->isVisible()) {
|
||||||
|
QFontMetrics fontMetrics(labelError2->font());
|
||||||
|
len_labelError2 = fontMetrics.width(labelError2->getOriginalText());
|
||||||
|
len_labelError2 += LEN_DOT_PRE;
|
||||||
|
}
|
||||||
|
int len_max = len_title > len_labelError1 ? len_title : len_labelError1;
|
||||||
|
len_max = len_max > len_labelError2 ? len_max : len_labelError2;
|
||||||
|
if (len_max >= this->width())
|
||||||
|
len_max = this->width();
|
||||||
|
|
||||||
|
centerFont->setFixedWidth(len_max);
|
||||||
});
|
});
|
||||||
|
|
||||||
// 再试一次
|
// 再试一次
|
||||||
|
|
|
@ -26,6 +26,10 @@
|
||||||
#include "kborderbutton.h"
|
#include "kborderbutton.h"
|
||||||
|
|
||||||
using namespace kdk;
|
using namespace kdk;
|
||||||
|
// bigTitle控件前面的宽度:24+spacing
|
||||||
|
#define LEN_TITLE_PRE 50
|
||||||
|
// labelCheck1、labelCheck2控件前面的宽度:10+6+5
|
||||||
|
#define LEN_DOT_PRE 50
|
||||||
|
|
||||||
GhostImage::GhostImage(QWidget *parent) :
|
GhostImage::GhostImage(QWidget *parent) :
|
||||||
QStackedWidget(parent),
|
QStackedWidget(parent),
|
||||||
|
@ -59,15 +63,28 @@ GhostImage::~GhostImage()
|
||||||
void GhostImage::initFirstWidget()
|
void GhostImage::initFirstWidget()
|
||||||
{
|
{
|
||||||
QWidget *first = new QWidget;
|
QWidget *first = new QWidget;
|
||||||
|
QVBoxLayout *vLayout = new QVBoxLayout;
|
||||||
|
vLayout->addStretch();
|
||||||
|
|
||||||
|
// 中部布局包含一个独立的窗口,用于大小变化时局部相对不变
|
||||||
|
QWidget *center = new QWidget;
|
||||||
|
center->setFixedSize(760, 540);
|
||||||
|
QHBoxLayout *centerHBoxLayout = new QHBoxLayout;
|
||||||
|
centerHBoxLayout->addStretch();
|
||||||
|
centerHBoxLayout->addWidget(center);
|
||||||
|
centerHBoxLayout->addStretch();
|
||||||
|
vLayout->addLayout(centerHBoxLayout);
|
||||||
|
vLayout->addStretch();
|
||||||
|
vLayout->addSpacing(60);
|
||||||
|
first->setLayout(vLayout);
|
||||||
// 图片
|
// 图片
|
||||||
PixmapLabel *imageGhost_firstPage = new PixmapLabel(first);
|
PixmapLabel *imageGhost_firstPage = new PixmapLabel(center);
|
||||||
imageGhost_firstPage->setGeometry(421, 120, 300, 326);
|
imageGhost_firstPage->setGeometry(421, 120, 300, 326);
|
||||||
imageGhost_firstPage->setScaledContents(true);
|
imageGhost_firstPage->setScaledContents(true);
|
||||||
imageGhost_firstPage->setLightAndDarkPixmap(":/images/ghost_image.png", ":/images/ghost_image_dark.png");
|
imageGhost_firstPage->setLightAndDarkPixmap(":/images/ghost_image.png", ":/images/ghost_image_dark.png");
|
||||||
|
|
||||||
// Ghost Image大字提示
|
// Ghost Image大字提示
|
||||||
MyLabel *labelGhost_firstPage = new MyLabel(first);
|
MyLabel *labelGhost_firstPage = new MyLabel(center);
|
||||||
labelGhost_firstPage->setDeplayText(tr("Ghost Image"));
|
labelGhost_firstPage->setDeplayText(tr("Ghost Image"));
|
||||||
labelGhost_firstPage->setFixedWidth(500);
|
labelGhost_firstPage->setFixedWidth(500);
|
||||||
labelGhost_firstPage->setFixedHeight(48);
|
labelGhost_firstPage->setFixedHeight(48);
|
||||||
|
@ -84,7 +101,7 @@ void GhostImage::initFirstWidget()
|
||||||
labelGhost_firstPage->adjustSize();
|
labelGhost_firstPage->adjustSize();
|
||||||
|
|
||||||
// Ghost说明
|
// Ghost说明
|
||||||
MyLabel *labelNote_firstPage = new MyLabel(first);
|
MyLabel *labelNote_firstPage = new MyLabel(center);
|
||||||
labelNote_firstPage->setFixedWidth(700);
|
labelNote_firstPage->setFixedWidth(700);
|
||||||
labelNote_firstPage->setFixedHeight(24);
|
labelNote_firstPage->setFixedHeight(24);
|
||||||
labelNote_firstPage->move(41, 180);
|
labelNote_firstPage->move(41, 180);
|
||||||
|
@ -97,35 +114,35 @@ void GhostImage::initFirstWidget()
|
||||||
labelNote_firstPage->adjustSize();
|
labelNote_firstPage->adjustSize();
|
||||||
|
|
||||||
// 操作简单
|
// 操作简单
|
||||||
MyIconLabel *iconSimple_firstPage = new MyIconLabel(first);
|
MyIconLabel *iconSimple_firstPage = new MyIconLabel(center);
|
||||||
iconSimple_firstPage->setGeometry(41, 244, 180, 36);
|
iconSimple_firstPage->setGeometry(41, 244, 180, 36);
|
||||||
iconSimple_firstPage->setThemeIcon("ukui-bf-simple-symbolic", ":/symbos/ukui-bf-simple-symbolic");
|
iconSimple_firstPage->setThemeIcon("ukui-bf-simple-symbolic", ":/symbos/ukui-bf-simple-symbolic");
|
||||||
iconSimple_firstPage->setDesplayText(tr("Simple"));
|
iconSimple_firstPage->setDesplayText(tr("Simple"));
|
||||||
iconSimple_firstPage->setEnabled(false);
|
iconSimple_firstPage->setEnabled(false);
|
||||||
|
|
||||||
// 快速
|
// 快速
|
||||||
MyIconLabel *iconFast_firstPage = new MyIconLabel(first);
|
MyIconLabel *iconFast_firstPage = new MyIconLabel(center);
|
||||||
iconFast_firstPage->setGeometry(206, 244, 180, 36);
|
iconFast_firstPage->setGeometry(206, 244, 180, 36);
|
||||||
iconFast_firstPage->setThemeIcon("ukui-bf-fast-symbolic", ":/symbos/ukui-bf-fast-symbolic");
|
iconFast_firstPage->setThemeIcon("ukui-bf-fast-symbolic", ":/symbos/ukui-bf-fast-symbolic");
|
||||||
iconFast_firstPage->setDesplayText(tr("Fast"));
|
iconFast_firstPage->setDesplayText(tr("Fast"));
|
||||||
iconFast_firstPage->setEnabled(false);
|
iconFast_firstPage->setEnabled(false);
|
||||||
|
|
||||||
// 安全
|
// 安全
|
||||||
MyIconLabel *iconSecurity_firstPage = new MyIconLabel(first);
|
MyIconLabel *iconSecurity_firstPage = new MyIconLabel(center);
|
||||||
iconSecurity_firstPage->setGeometry(41, 296, 180, 36);
|
iconSecurity_firstPage->setGeometry(41, 296, 180, 36);
|
||||||
iconSecurity_firstPage->setThemeIcon("ukui-bf-security-symbolic", ":/symbos/ukui-bf-security-symbolic");
|
iconSecurity_firstPage->setThemeIcon("ukui-bf-security-symbolic", ":/symbos/ukui-bf-security-symbolic");
|
||||||
iconSecurity_firstPage->setDesplayText(tr("Security"));
|
iconSecurity_firstPage->setDesplayText(tr("Security"));
|
||||||
iconSecurity_firstPage->setEnabled(false);
|
iconSecurity_firstPage->setEnabled(false);
|
||||||
|
|
||||||
// 节省时间
|
// 节省时间
|
||||||
MyIconLabel *iconSimple_firstPage1 = new MyIconLabel(first);
|
MyIconLabel *iconSimple_firstPage1 = new MyIconLabel(center);
|
||||||
iconSimple_firstPage1->setGeometry(206, 296, 180, 36);
|
iconSimple_firstPage1->setGeometry(206, 296, 180, 36);
|
||||||
iconSimple_firstPage1->setThemeIcon("document-open-recent-symbolic", ":/symbos/document-open-recent-symbolic");
|
iconSimple_firstPage1->setThemeIcon("document-open-recent-symbolic", ":/symbos/document-open-recent-symbolic");
|
||||||
iconSimple_firstPage1->setDesplayText(tr("Timesaving"));
|
iconSimple_firstPage1->setDesplayText(tr("Timesaving"));
|
||||||
iconSimple_firstPage1->setEnabled(false);
|
iconSimple_firstPage1->setEnabled(false);
|
||||||
|
|
||||||
// 制作镜像按钮
|
// 制作镜像按钮
|
||||||
MyPushButton *beginBackup = new MyPushButton(first);
|
MyPushButton *beginBackup = new MyPushButton(center);
|
||||||
beginBackup->setGeometry(41, 372, 180, 52);
|
beginBackup->setGeometry(41, 372, 180, 52);
|
||||||
beginBackup->setText(tr("Start Ghost"));
|
beginBackup->setText(tr("Start Ghost"));
|
||||||
beginBackup->setEnabled(true);
|
beginBackup->setEnabled(true);
|
||||||
|
@ -462,6 +479,7 @@ void GhostImage::initThirdWidget()
|
||||||
recheck->setVisible(false);
|
recheck->setVisible(false);
|
||||||
|
|
||||||
this->on_checkEnv_start();
|
this->on_checkEnv_start();
|
||||||
|
emit GlobelBackupInfo::inst().getGlobalSignals()->widthChanged();
|
||||||
});
|
});
|
||||||
|
|
||||||
// 检测结果
|
// 检测结果
|
||||||
|
@ -513,6 +531,38 @@ void GhostImage::initThirdWidget()
|
||||||
}
|
}
|
||||||
|
|
||||||
preStep->setVisible(true);
|
preStep->setVisible(true);
|
||||||
|
emit GlobelBackupInfo::inst().getGlobalSignals()->widthChanged();
|
||||||
|
});
|
||||||
|
|
||||||
|
// 调整中部控件大小
|
||||||
|
connect(GlobelBackupInfo::inst().getGlobalSignals(), &GlobalSignals::widthChanged, this, [=](){
|
||||||
|
// 控件bigTitle的宽度
|
||||||
|
int len_title = 0;
|
||||||
|
if (bigTitle->isVisible()) {
|
||||||
|
QFontMetrics fontMetrics(bigTitle->font());
|
||||||
|
len_title = fontMetrics.width(bigTitle->getOriginalText());
|
||||||
|
len_title += LEN_TITLE_PRE;
|
||||||
|
}
|
||||||
|
// 控件labelError1的宽度
|
||||||
|
int len_labelError1 = 0;
|
||||||
|
if (labelCheck1->isVisible()) {
|
||||||
|
QFontMetrics fontMetrics(labelCheck1->font());
|
||||||
|
len_labelError1 = fontMetrics.width(labelCheck1->getOriginalText());
|
||||||
|
len_labelError1 += LEN_DOT_PRE;
|
||||||
|
}
|
||||||
|
// 控件labelError2的宽度
|
||||||
|
int len_labelError2 = 0;
|
||||||
|
if (labelCheck2->isVisible()) {
|
||||||
|
QFontMetrics fontMetrics(labelCheck2->font());
|
||||||
|
len_labelError2 = fontMetrics.width(labelCheck2->getOriginalText());
|
||||||
|
len_labelError2 += LEN_DOT_PRE;
|
||||||
|
}
|
||||||
|
int len_max = len_title > len_labelError1 ? len_title : len_labelError1;
|
||||||
|
len_max = len_max > len_labelError2 ? len_max : len_labelError2;
|
||||||
|
if (len_max >= this->width())
|
||||||
|
len_max = this->width();
|
||||||
|
|
||||||
|
centerFont->setFixedWidth(len_max);
|
||||||
});
|
});
|
||||||
|
|
||||||
// 重新检查
|
// 重新检查
|
||||||
|
@ -1169,6 +1219,38 @@ void GhostImage::initLastWidget()
|
||||||
retry->setVisible(true);
|
retry->setVisible(true);
|
||||||
homePage->setVisible(true);
|
homePage->setVisible(true);
|
||||||
}
|
}
|
||||||
|
emit GlobelBackupInfo::inst().getGlobalSignals()->widthChanged();
|
||||||
|
});
|
||||||
|
|
||||||
|
// 调整中部控件大小
|
||||||
|
connect(GlobelBackupInfo::inst().getGlobalSignals(), &GlobalSignals::widthChanged, this, [=](){
|
||||||
|
// 控件bigTitle的宽度
|
||||||
|
int len_title = 0;
|
||||||
|
if (bigTitle->isVisible()) {
|
||||||
|
QFontMetrics fontMetrics(bigTitle->font());
|
||||||
|
len_title = fontMetrics.width(bigTitle->getOriginalText());
|
||||||
|
len_title += LEN_TITLE_PRE;
|
||||||
|
}
|
||||||
|
// 控件labelError1的宽度
|
||||||
|
int len_labelError1 = 0;
|
||||||
|
if (labelError1->isVisible()) {
|
||||||
|
QFontMetrics fontMetrics(labelError1->font());
|
||||||
|
len_labelError1 = fontMetrics.width(labelError1->getOriginalText());
|
||||||
|
len_labelError1 += LEN_DOT_PRE;
|
||||||
|
}
|
||||||
|
// 控件labelError2的宽度
|
||||||
|
int len_labelError2 = 0;
|
||||||
|
if (labelError2->isVisible()) {
|
||||||
|
QFontMetrics fontMetrics(labelError2->font());
|
||||||
|
len_labelError2 = fontMetrics.width(labelError2->getOriginalText());
|
||||||
|
len_labelError2 += LEN_DOT_PRE;
|
||||||
|
}
|
||||||
|
int len_max = len_title > len_labelError1 ? len_title : len_labelError1;
|
||||||
|
len_max = len_max > len_labelError2 ? len_max : len_labelError2;
|
||||||
|
if (len_max >= this->width())
|
||||||
|
len_max = this->width();
|
||||||
|
|
||||||
|
centerFont->setFixedWidth(len_max);
|
||||||
});
|
});
|
||||||
|
|
||||||
// 再试一次
|
// 再试一次
|
||||||
|
|
|
@ -28,6 +28,10 @@
|
||||||
#include "kborderbutton.h"
|
#include "kborderbutton.h"
|
||||||
|
|
||||||
using namespace kdk;
|
using namespace kdk;
|
||||||
|
// bigTitle控件前面的宽度:24+spacing
|
||||||
|
#define LEN_TITLE_PRE 50
|
||||||
|
// labelCheck1、labelCheck2控件前面的宽度:10+6+5
|
||||||
|
#define LEN_DOT_PRE 50
|
||||||
|
|
||||||
SystemBackup::SystemBackup(QWidget *parent /*= nullptr*/) :
|
SystemBackup::SystemBackup(QWidget *parent /*= nullptr*/) :
|
||||||
QStackedWidget(parent),
|
QStackedWidget(parent),
|
||||||
|
@ -61,15 +65,25 @@ SystemBackup::~SystemBackup()
|
||||||
void SystemBackup::initFirstWidget()
|
void SystemBackup::initFirstWidget()
|
||||||
{
|
{
|
||||||
QWidget *first = new QWidget;
|
QWidget *first = new QWidget;
|
||||||
|
QVBoxLayout *vLayout = new QVBoxLayout;
|
||||||
|
vLayout->addStretch();
|
||||||
|
|
||||||
|
// 中部布局包含一个独立的窗口,用于大小变化时局部相对不变
|
||||||
|
QWidget *center = new QWidget;
|
||||||
|
center->setFixedSize(760, 540);
|
||||||
|
QHBoxLayout *centerHBoxLayout = new QHBoxLayout;
|
||||||
|
centerHBoxLayout->addStretch();
|
||||||
|
centerHBoxLayout->addWidget(center);
|
||||||
|
centerHBoxLayout->addStretch();
|
||||||
|
vLayout->addLayout(centerHBoxLayout);
|
||||||
// 图片
|
// 图片
|
||||||
PixmapLabel *imageBackup_firstPage = new PixmapLabel(first);
|
PixmapLabel *imageBackup_firstPage = new PixmapLabel(center);
|
||||||
imageBackup_firstPage->setGeometry(421, 120, 300, 326);
|
imageBackup_firstPage->setGeometry(421, 120, 300, 326);
|
||||||
imageBackup_firstPage->setScaledContents(true);
|
imageBackup_firstPage->setScaledContents(true);
|
||||||
imageBackup_firstPage->setLightAndDarkPixmap(":/images/system_backup.png", ":/images/system_backup_dark.png");
|
imageBackup_firstPage->setLightAndDarkPixmap(":/images/system_backup.png", ":/images/system_backup_dark.png");
|
||||||
|
|
||||||
// 系统备份大字提示
|
// 系统备份大字提示
|
||||||
MyLabel *labelBackup_firstPage = new MyLabel(first);
|
MyLabel *labelBackup_firstPage = new MyLabel(center);
|
||||||
labelBackup_firstPage->setDeplayText(tr("System Backup"));
|
labelBackup_firstPage->setDeplayText(tr("System Backup"));
|
||||||
labelBackup_firstPage->setFixedWidth(500);
|
labelBackup_firstPage->setFixedWidth(500);
|
||||||
labelBackup_firstPage->setFixedHeight(48);
|
labelBackup_firstPage->setFixedHeight(48);
|
||||||
|
@ -86,7 +100,7 @@ void SystemBackup::initFirstWidget()
|
||||||
labelBackup_firstPage->adjustSize();
|
labelBackup_firstPage->adjustSize();
|
||||||
|
|
||||||
// 系统备份说明
|
// 系统备份说明
|
||||||
MyLabel *labelNote_firstPage = new MyLabel(first);
|
MyLabel *labelNote_firstPage = new MyLabel(center);
|
||||||
labelNote_firstPage->setFixedWidth(700);
|
labelNote_firstPage->setFixedWidth(700);
|
||||||
labelNote_firstPage->setFixedHeight(24);
|
labelNote_firstPage->setFixedHeight(24);
|
||||||
labelNote_firstPage->move(41, 180);
|
labelNote_firstPage->move(41, 180);
|
||||||
|
@ -98,35 +112,35 @@ void SystemBackup::initFirstWidget()
|
||||||
labelNote_firstPage->adjustSize();
|
labelNote_firstPage->adjustSize();
|
||||||
|
|
||||||
// 多点还原
|
// 多点还原
|
||||||
MyIconLabel *iconMultiBackup_firstPage = new MyIconLabel(first);
|
MyIconLabel *iconMultiBackup_firstPage = new MyIconLabel(center);
|
||||||
iconMultiBackup_firstPage->setGeometry(41, 244, 180, 36);
|
iconMultiBackup_firstPage->setGeometry(41, 244, 180, 36);
|
||||||
iconMultiBackup_firstPage->setThemeIcon("ukui-multipoint-symbolic", ":/symbos/ukui-multipoint-symbolic");
|
iconMultiBackup_firstPage->setThemeIcon("ukui-multipoint-symbolic", ":/symbos/ukui-multipoint-symbolic");
|
||||||
iconMultiBackup_firstPage->setDesplayText(tr("Multi-Spot"));
|
iconMultiBackup_firstPage->setDesplayText(tr("Multi-Spot"));
|
||||||
iconMultiBackup_firstPage->setEnabled(false);
|
iconMultiBackup_firstPage->setEnabled(false);
|
||||||
|
|
||||||
// 体积小
|
// 体积小
|
||||||
MyIconLabel *iconSmallSize_firstPage = new MyIconLabel(first);
|
MyIconLabel *iconSmallSize_firstPage = new MyIconLabel(center);
|
||||||
iconSmallSize_firstPage->setGeometry(201, 244, 180, 36);
|
iconSmallSize_firstPage->setGeometry(201, 244, 180, 36);
|
||||||
iconSmallSize_firstPage->setThemeIcon("ukui-volume-symbolic", ":/symbos/ukui-volume-symbolic");
|
iconSmallSize_firstPage->setThemeIcon("ukui-volume-symbolic", ":/symbos/ukui-volume-symbolic");
|
||||||
iconSmallSize_firstPage->setDesplayText(tr("Small Size"));
|
iconSmallSize_firstPage->setDesplayText(tr("Small Size"));
|
||||||
iconSmallSize_firstPage->setEnabled(false);
|
iconSmallSize_firstPage->setEnabled(false);
|
||||||
|
|
||||||
// 安全
|
// 安全
|
||||||
MyIconLabel *iconSecurity_firstPage = new MyIconLabel(first);
|
MyIconLabel *iconSecurity_firstPage = new MyIconLabel(center);
|
||||||
iconSecurity_firstPage->setGeometry(41, 296, 180, 36);
|
iconSecurity_firstPage->setGeometry(41, 296, 180, 36);
|
||||||
iconSecurity_firstPage->setThemeIcon("ukui-bf-security-symbolic", ":/symbos/ukui-bf-security-symbolic");
|
iconSecurity_firstPage->setThemeIcon("ukui-bf-security-symbolic", ":/symbos/ukui-bf-security-symbolic");
|
||||||
iconSecurity_firstPage->setDesplayText(tr("Security"));
|
iconSecurity_firstPage->setDesplayText(tr("Security"));
|
||||||
iconSecurity_firstPage->setEnabled(false);
|
iconSecurity_firstPage->setEnabled(false);
|
||||||
|
|
||||||
// 操作简单
|
// 操作简单
|
||||||
MyIconLabel *iconSimple_firstPage = new MyIconLabel(first);
|
MyIconLabel *iconSimple_firstPage = new MyIconLabel(center);
|
||||||
iconSimple_firstPage->setGeometry(201, 296, 180, 36);
|
iconSimple_firstPage->setGeometry(201, 296, 180, 36);
|
||||||
iconSimple_firstPage->setThemeIcon("ukui-bf-simple-symbolic", ":/symbos/ukui-bf-simple-symbolic");
|
iconSimple_firstPage->setThemeIcon("ukui-bf-simple-symbolic", ":/symbos/ukui-bf-simple-symbolic");
|
||||||
iconSimple_firstPage->setDesplayText(tr("Simple"));
|
iconSimple_firstPage->setDesplayText(tr("Simple"));
|
||||||
iconSimple_firstPage->setEnabled(false);
|
iconSimple_firstPage->setEnabled(false);
|
||||||
|
|
||||||
// 开始备份按钮
|
// 开始备份按钮
|
||||||
MyPushButton *beginBackup = new MyPushButton(first);
|
MyPushButton *beginBackup = new MyPushButton(center);
|
||||||
beginBackup->setGeometry(41, 372, 180, 52);
|
beginBackup->setGeometry(41, 372, 180, 52);
|
||||||
beginBackup->setText(tr("Start Backup"));
|
beginBackup->setText(tr("Start Backup"));
|
||||||
beginBackup->setEnabled(true);
|
beginBackup->setEnabled(true);
|
||||||
|
@ -156,11 +170,10 @@ void SystemBackup::initFirstWidget()
|
||||||
bottomHBoxLayout->addSpacing(20);
|
bottomHBoxLayout->addSpacing(20);
|
||||||
bottomHBoxLayout->setAlignment(Qt::AlignRight);
|
bottomHBoxLayout->setAlignment(Qt::AlignRight);
|
||||||
|
|
||||||
QVBoxLayout *bottomVBoxLayout = new QVBoxLayout;
|
vLayout->addStretch();
|
||||||
bottomVBoxLayout->addStretch();
|
vLayout->addLayout(bottomHBoxLayout);
|
||||||
bottomVBoxLayout->addLayout(bottomHBoxLayout);
|
vLayout->addSpacing(20);
|
||||||
bottomVBoxLayout->addSpacing(20);
|
first->setLayout(vLayout);
|
||||||
first->setLayout(bottomVBoxLayout);
|
|
||||||
|
|
||||||
connect(backupPointManage, &MyPushButton::clicked, this, [=]() {
|
connect(backupPointManage, &MyPushButton::clicked, this, [=]() {
|
||||||
ManageBackupPointList backupManager(first, ManageBackupPointList::SYSTEM);
|
ManageBackupPointList backupManager(first, ManageBackupPointList::SYSTEM);
|
||||||
|
@ -595,6 +608,7 @@ void SystemBackup::initThirdWidget()
|
||||||
recheck->setVisible(false);
|
recheck->setVisible(false);
|
||||||
|
|
||||||
this->on_checkEnv_start();
|
this->on_checkEnv_start();
|
||||||
|
emit GlobelBackupInfo::inst().getGlobalSignals()->widthChanged();
|
||||||
});
|
});
|
||||||
|
|
||||||
// 检测结果
|
// 检测结果
|
||||||
|
@ -646,6 +660,38 @@ void SystemBackup::initThirdWidget()
|
||||||
}
|
}
|
||||||
|
|
||||||
preStep->setVisible(true);
|
preStep->setVisible(true);
|
||||||
|
emit GlobelBackupInfo::inst().getGlobalSignals()->widthChanged();
|
||||||
|
});
|
||||||
|
|
||||||
|
// 调整中部控件大小
|
||||||
|
connect(GlobelBackupInfo::inst().getGlobalSignals(), &GlobalSignals::widthChanged, this, [=](){
|
||||||
|
// 控件bigTitle的宽度
|
||||||
|
int len_title = 0;
|
||||||
|
if (bigTitle->isVisible()) {
|
||||||
|
QFontMetrics fontMetrics(bigTitle->font());
|
||||||
|
len_title = fontMetrics.width(bigTitle->getOriginalText());
|
||||||
|
len_title += LEN_TITLE_PRE;
|
||||||
|
}
|
||||||
|
// 控件labelCheck1的宽度
|
||||||
|
int len_labelCheck1 = 0;
|
||||||
|
if (labelCheck1->isVisible()) {
|
||||||
|
QFontMetrics fontMetrics(labelCheck1->font());
|
||||||
|
len_labelCheck1 = fontMetrics.width(labelCheck1->getOriginalText());
|
||||||
|
len_labelCheck1 += LEN_DOT_PRE;
|
||||||
|
}
|
||||||
|
// 控件labelCheck2的宽度
|
||||||
|
int len_labelCheck2 = 0;
|
||||||
|
if (labelCheck2->isVisible()) {
|
||||||
|
QFontMetrics fontMetrics(labelCheck2->font());
|
||||||
|
len_labelCheck2 = fontMetrics.width(labelCheck2->getOriginalText());
|
||||||
|
len_labelCheck2 += LEN_DOT_PRE;
|
||||||
|
}
|
||||||
|
int len_max = len_title > len_labelCheck1 ? len_title : len_labelCheck1;
|
||||||
|
len_max = len_max > len_labelCheck2 ? len_max : len_labelCheck2;
|
||||||
|
if (len_max >= this->width())
|
||||||
|
len_max = this->width();
|
||||||
|
|
||||||
|
centerFont->setFixedWidth(len_max);
|
||||||
});
|
});
|
||||||
|
|
||||||
addWidget(third);
|
addWidget(third);
|
||||||
|
@ -815,9 +861,10 @@ void SystemBackup::initForthWidget()
|
||||||
QHBoxLayout *hlayoutCenterLine1 = new QHBoxLayout;
|
QHBoxLayout *hlayoutCenterLine1 = new QHBoxLayout;
|
||||||
// 备份名称
|
// 备份名称
|
||||||
MyLabel *labelBackupName = new MyLabel(forth);
|
MyLabel *labelBackupName = new MyLabel(forth);
|
||||||
labelBackupName->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
|
||||||
labelBackupName->setAlignment(Qt::AlignRight | Qt::AlignHCenter);
|
|
||||||
labelBackupName->setDeplayText(tr("Backup Name"));
|
labelBackupName->setDeplayText(tr("Backup Name"));
|
||||||
|
QFontMetrics fontMetrics(labelBackupName->font());
|
||||||
|
int fontSize = fontMetrics.width(labelBackupName->getOriginalText());
|
||||||
|
labelBackupName->setFixedWidth(fontSize);
|
||||||
MyLineEdit *editBackupName = new MyLineEdit(forth);
|
MyLineEdit *editBackupName = new MyLineEdit(forth);
|
||||||
editBackupName->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
editBackupName->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||||
editBackupName->setMinimumWidth(350);
|
editBackupName->setMinimumWidth(350);
|
||||||
|
@ -833,7 +880,6 @@ void SystemBackup::initForthWidget()
|
||||||
hlayoutCenterLine1->addStretch();
|
hlayoutCenterLine1->addStretch();
|
||||||
hlayoutCenterLine1->addWidget(labelBackupName);
|
hlayoutCenterLine1->addWidget(labelBackupName);
|
||||||
hlayoutCenterLine1->addWidget(editBackupName);
|
hlayoutCenterLine1->addWidget(editBackupName);
|
||||||
hlayoutCenterLine1->addSpacing(40);
|
|
||||||
hlayoutCenterLine1->addStretch();
|
hlayoutCenterLine1->addStretch();
|
||||||
hlayoutCenterLine1->setAlignment(Qt::AlignCenter);
|
hlayoutCenterLine1->setAlignment(Qt::AlignCenter);
|
||||||
vlayout->addLayout(hlayoutCenterLine1);
|
vlayout->addLayout(hlayoutCenterLine1);
|
||||||
|
@ -846,6 +892,15 @@ void SystemBackup::initForthWidget()
|
||||||
labelError->setVisible(false);
|
labelError->setVisible(false);
|
||||||
labelError->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
labelError->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
||||||
|
|
||||||
|
connect(GlobelBackupInfo::inst().getGlobalSignals(), &GlobalSignals::widthChanged, this, [=]{
|
||||||
|
QFontMetrics fontMetrics(labelBackupName->font());
|
||||||
|
int fontSize = fontMetrics.width(labelBackupName->getOriginalText());
|
||||||
|
labelBackupName->setFixedWidth(fontSize);
|
||||||
|
|
||||||
|
if (labelError->isVisible())
|
||||||
|
labelError->move(editBackupName->geometry().left(), editBackupName->geometry().bottom() + 10);
|
||||||
|
});
|
||||||
|
|
||||||
connect(validator, &InputValidator::checked, this, [=](bool valid, QString in, int pos, QChar c) {
|
connect(validator, &InputValidator::checked, this, [=](bool valid, QString in, int pos, QChar c) {
|
||||||
if (in.isEmpty())
|
if (in.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
@ -909,9 +964,9 @@ void SystemBackup::initForthWidget()
|
||||||
nextStep->setProperty("isImportant", true);
|
nextStep->setProperty("isImportant", true);
|
||||||
connect(nextStep, &MyPushButton::clicked, this, [=](bool checked) {
|
connect(nextStep, &MyPushButton::clicked, this, [=](bool checked) {
|
||||||
Q_UNUSED(checked)
|
Q_UNUSED(checked)
|
||||||
if (labelError->isVisible()) {
|
/*if (labelError->isVisible()) {
|
||||||
editBackupName->setFocus();
|
editBackupName->setFocus();
|
||||||
} else {
|
} else*/ {
|
||||||
this->m_backupName = editBackupName->text();
|
this->m_backupName = editBackupName->text();
|
||||||
if (this->m_backupName.isEmpty()) {
|
if (this->m_backupName.isEmpty()) {
|
||||||
this->m_backupName = editBackupName->placeholderText();
|
this->m_backupName = editBackupName->placeholderText();
|
||||||
|
@ -1422,7 +1477,6 @@ void SystemBackup::initLastWidget()
|
||||||
bigTitle->setIsOriginal(true);
|
bigTitle->setIsOriginal(true);
|
||||||
bigTitle->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
bigTitle->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||||
hlayoutCenterFont1->addWidget(bigTitle);
|
hlayoutCenterFont1->addWidget(bigTitle);
|
||||||
// hlayoutCenterFont1->setAlignment(Qt::AlignLeft);
|
|
||||||
vlayoutCenterFont->addLayout(hlayoutCenterFont1);
|
vlayoutCenterFont->addLayout(hlayoutCenterFont1);
|
||||||
|
|
||||||
// 第二行
|
// 第二行
|
||||||
|
@ -1499,9 +1553,6 @@ void SystemBackup::initLastWidget()
|
||||||
resultLogo->setVisible(true);
|
resultLogo->setVisible(true);
|
||||||
// 备份成功
|
// 备份成功
|
||||||
bigTitle->setDeplayText(tr("The backup is successful"));
|
bigTitle->setDeplayText(tr("The backup is successful"));
|
||||||
QFontMetrics fontMetrics(bigTitle->font());
|
|
||||||
int fontSize = fontMetrics.width(bigTitle->getOriginalText());
|
|
||||||
bigTitle->setFixedWidth(fontSize);
|
|
||||||
hlayoutCenterFont1->setAlignment(Qt::AlignCenter);
|
hlayoutCenterFont1->setAlignment(Qt::AlignCenter);
|
||||||
|
|
||||||
dot1->setVisible(false);
|
dot1->setVisible(false);
|
||||||
|
@ -1528,6 +1579,39 @@ void SystemBackup::initLastWidget()
|
||||||
|
|
||||||
homePage->setVisible(true);
|
homePage->setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
emit GlobelBackupInfo::inst().getGlobalSignals()->widthChanged();
|
||||||
|
});
|
||||||
|
|
||||||
|
// 调整中部控件大小
|
||||||
|
connect(GlobelBackupInfo::inst().getGlobalSignals(), &GlobalSignals::widthChanged, this, [=](){
|
||||||
|
// 控件bigTitle的宽度
|
||||||
|
int len_title = 0;
|
||||||
|
if (bigTitle->isVisible()) {
|
||||||
|
QFontMetrics fontMetrics(bigTitle->font());
|
||||||
|
len_title = fontMetrics.width(bigTitle->getOriginalText());
|
||||||
|
len_title += LEN_TITLE_PRE;
|
||||||
|
}
|
||||||
|
// 控件labelError1的宽度
|
||||||
|
int len_labelError1 = 0;
|
||||||
|
if (labelError1->isVisible()) {
|
||||||
|
QFontMetrics fontMetrics(labelError1->font());
|
||||||
|
len_labelError1 = fontMetrics.width(labelError1->getOriginalText());
|
||||||
|
len_labelError1 += LEN_DOT_PRE;
|
||||||
|
}
|
||||||
|
// 控件labelError2的宽度
|
||||||
|
int len_labelError2 = 0;
|
||||||
|
if (labelError2->isVisible()) {
|
||||||
|
QFontMetrics fontMetrics(labelError2->font());
|
||||||
|
len_labelError2 = fontMetrics.width(labelError2->getOriginalText());
|
||||||
|
len_labelError2 += LEN_DOT_PRE;
|
||||||
|
}
|
||||||
|
int len_max = len_title > len_labelError1 ? len_title : len_labelError1;
|
||||||
|
len_max = len_max > len_labelError2 ? len_max : len_labelError2;
|
||||||
|
if (len_max >= this->width())
|
||||||
|
len_max = this->width();
|
||||||
|
|
||||||
|
centerFont->setFixedWidth(len_max);
|
||||||
});
|
});
|
||||||
|
|
||||||
// 再试一次
|
// 再试一次
|
||||||
|
|
|
@ -25,6 +25,10 @@
|
||||||
#include "kborderbutton.h"
|
#include "kborderbutton.h"
|
||||||
|
|
||||||
using namespace kdk;
|
using namespace kdk;
|
||||||
|
// bigTitle控件前面的宽度:24+spacing
|
||||||
|
#define LEN_TITLE_PRE 50
|
||||||
|
// labelCheck1、labelCheck2控件前面的宽度:10+6+5
|
||||||
|
#define LEN_DOT_PRE 50
|
||||||
|
|
||||||
SystemRestore::SystemRestore(QWidget *parent) :
|
SystemRestore::SystemRestore(QWidget *parent) :
|
||||||
QStackedWidget(parent)
|
QStackedWidget(parent)
|
||||||
|
@ -53,15 +57,25 @@ SystemRestore::~SystemRestore()
|
||||||
void SystemRestore::initFirstWidget()
|
void SystemRestore::initFirstWidget()
|
||||||
{
|
{
|
||||||
QWidget *first = new QWidget;
|
QWidget *first = new QWidget;
|
||||||
|
QVBoxLayout *vLayout = new QVBoxLayout;
|
||||||
|
vLayout->addStretch();
|
||||||
|
|
||||||
|
// 中部布局包含一个独立的窗口,用于大小变化时局部相对不变
|
||||||
|
QWidget *center = new QWidget;
|
||||||
|
center->setFixedSize(760, 540);
|
||||||
|
QHBoxLayout *centerHBoxLayout = new QHBoxLayout;
|
||||||
|
centerHBoxLayout->addStretch();
|
||||||
|
centerHBoxLayout->addWidget(center);
|
||||||
|
centerHBoxLayout->addStretch();
|
||||||
|
vLayout->addLayout(centerHBoxLayout);
|
||||||
// 图片
|
// 图片
|
||||||
PixmapLabel *imageRestore_firstPage = new PixmapLabel(first);
|
PixmapLabel *imageRestore_firstPage = new PixmapLabel(center);
|
||||||
imageRestore_firstPage->setGeometry(421, 120, 300, 326);
|
imageRestore_firstPage->setGeometry(421, 120, 300, 326);
|
||||||
imageRestore_firstPage->setScaledContents(true);
|
imageRestore_firstPage->setScaledContents(true);
|
||||||
imageRestore_firstPage->setLightAndDarkPixmap(":/images/system_restore.png", ":/images/system_restore_dark.png");
|
imageRestore_firstPage->setLightAndDarkPixmap(":/images/system_restore.png", ":/images/system_restore_dark.png");
|
||||||
|
|
||||||
// 系统还原大字提示
|
// 系统还原大字提示
|
||||||
MyLabel *labelRestore_firstPage = new MyLabel(first);
|
MyLabel *labelRestore_firstPage = new MyLabel(center);
|
||||||
labelRestore_firstPage->setDeplayText(tr("System Restore"));
|
labelRestore_firstPage->setDeplayText(tr("System Restore"));
|
||||||
labelRestore_firstPage->setFixedWidth(500);
|
labelRestore_firstPage->setFixedWidth(500);
|
||||||
labelRestore_firstPage->setFixedHeight(48);
|
labelRestore_firstPage->setFixedHeight(48);
|
||||||
|
@ -75,7 +89,7 @@ void SystemRestore::initFirstWidget()
|
||||||
labelRestore_firstPage->adjustSize();
|
labelRestore_firstPage->adjustSize();
|
||||||
|
|
||||||
// 系统还原说明
|
// 系统还原说明
|
||||||
MyLabel *labelNote_firstPage = new MyLabel(first);
|
MyLabel *labelNote_firstPage = new MyLabel(center);
|
||||||
labelNote_firstPage->setFixedWidth(700);
|
labelNote_firstPage->setFixedWidth(700);
|
||||||
labelNote_firstPage->setFixedHeight(24);
|
labelNote_firstPage->setFixedHeight(24);
|
||||||
labelNote_firstPage->move(41, 180);
|
labelNote_firstPage->move(41, 180);
|
||||||
|
@ -88,35 +102,35 @@ void SystemRestore::initFirstWidget()
|
||||||
labelNote_firstPage->adjustSize();
|
labelNote_firstPage->adjustSize();
|
||||||
|
|
||||||
// 操作简单
|
// 操作简单
|
||||||
MyIconLabel *iconSimple_firstPage = new MyIconLabel(first);
|
MyIconLabel *iconSimple_firstPage = new MyIconLabel(center);
|
||||||
iconSimple_firstPage->setGeometry(41, 244, 210, 36);
|
iconSimple_firstPage->setGeometry(41, 244, 210, 36);
|
||||||
iconSimple_firstPage->setThemeIcon("ukui-bf-simple-symbolic", ":/symbos/ukui-bf-simple-symbolic");
|
iconSimple_firstPage->setThemeIcon("ukui-bf-simple-symbolic", ":/symbos/ukui-bf-simple-symbolic");
|
||||||
iconSimple_firstPage->setDesplayText(tr("Simple"));
|
iconSimple_firstPage->setDesplayText(tr("Simple"));
|
||||||
iconSimple_firstPage->setEnabled(false);
|
iconSimple_firstPage->setEnabled(false);
|
||||||
|
|
||||||
// 安全可靠
|
// 安全可靠
|
||||||
MyIconLabel *iconSecurity_firstPage = new MyIconLabel(first);
|
MyIconLabel *iconSecurity_firstPage = new MyIconLabel(center);
|
||||||
iconSecurity_firstPage->setGeometry(231, 244, 180, 36);
|
iconSecurity_firstPage->setGeometry(231, 244, 180, 36);
|
||||||
iconSecurity_firstPage->setThemeIcon("ukui-bf-security-symbolic", ":/symbos/ukui-bf-security-symbolic");
|
iconSecurity_firstPage->setThemeIcon("ukui-bf-security-symbolic", ":/symbos/ukui-bf-security-symbolic");
|
||||||
iconSecurity_firstPage->setDesplayText(tr("Security"));
|
iconSecurity_firstPage->setDesplayText(tr("Security"));
|
||||||
iconSecurity_firstPage->setEnabled(false);
|
iconSecurity_firstPage->setEnabled(false);
|
||||||
|
|
||||||
// 修复系统损坏
|
// 修复系统损坏
|
||||||
MyIconLabel *iconMultiBackup_firstPage = new MyIconLabel(first);
|
MyIconLabel *iconMultiBackup_firstPage = new MyIconLabel(center);
|
||||||
iconMultiBackup_firstPage->setGeometry(41, 296, 210, 36);
|
iconMultiBackup_firstPage->setGeometry(41, 296, 210, 36);
|
||||||
iconMultiBackup_firstPage->setThemeIcon("ukui-bf-damage-symbolic", ":/symbos/ukui-bf-damage-symbolic");
|
iconMultiBackup_firstPage->setThemeIcon("ukui-bf-damage-symbolic", ":/symbos/ukui-bf-damage-symbolic");
|
||||||
iconMultiBackup_firstPage->setDesplayText(tr("Repair"));
|
iconMultiBackup_firstPage->setDesplayText(tr("Repair"));
|
||||||
iconMultiBackup_firstPage->setEnabled(false);
|
iconMultiBackup_firstPage->setEnabled(false);
|
||||||
|
|
||||||
// 自主操作
|
// 自主操作
|
||||||
MyIconLabel *iconSmallSize_firstPage = new MyIconLabel(first);
|
MyIconLabel *iconSmallSize_firstPage = new MyIconLabel(center);
|
||||||
iconSmallSize_firstPage->setGeometry(231, 296, 180, 36);
|
iconSmallSize_firstPage->setGeometry(231, 296, 180, 36);
|
||||||
iconSmallSize_firstPage->setThemeIcon("ukui-self-help-symbolic", ":/symbos/ukui-self-help-symbolic");
|
iconSmallSize_firstPage->setThemeIcon("ukui-self-help-symbolic", ":/symbos/ukui-self-help-symbolic");
|
||||||
iconSmallSize_firstPage->setDesplayText(tr("Independent"));
|
iconSmallSize_firstPage->setDesplayText(tr("Independent"));
|
||||||
iconSmallSize_firstPage->setEnabled(false);
|
iconSmallSize_firstPage->setEnabled(false);
|
||||||
|
|
||||||
// 开始还原按钮
|
// 开始还原按钮
|
||||||
MyPushButton *beginRestore = new MyPushButton(first);
|
MyPushButton *beginRestore = new MyPushButton(center);
|
||||||
beginRestore->setGeometry(41, 372, 180, 52);
|
beginRestore->setGeometry(41, 372, 180, 52);
|
||||||
beginRestore->setText(tr("Start Restore"));
|
beginRestore->setText(tr("Start Restore"));
|
||||||
beginRestore->setEnabled(true);
|
beginRestore->setEnabled(true);
|
||||||
|
@ -141,11 +155,10 @@ void SystemRestore::initFirstWidget()
|
||||||
bottomHBoxLayout->addSpacing(40);
|
bottomHBoxLayout->addSpacing(40);
|
||||||
bottomHBoxLayout->setAlignment(Qt::AlignRight);
|
bottomHBoxLayout->setAlignment(Qt::AlignRight);
|
||||||
|
|
||||||
QVBoxLayout *bottomVBoxLayout = new QVBoxLayout;
|
vLayout->addStretch();
|
||||||
bottomVBoxLayout->addStretch();
|
vLayout->addLayout(bottomHBoxLayout);
|
||||||
bottomVBoxLayout->addLayout(bottomHBoxLayout);
|
vLayout->addSpacing(20);
|
||||||
bottomVBoxLayout->addSpacing(20);
|
first->setLayout(vLayout);
|
||||||
first->setLayout(bottomVBoxLayout);
|
|
||||||
|
|
||||||
connect(checkFactoryRestore, &MyCheckBox::stateChanged, this, [=](int state) {
|
connect(checkFactoryRestore, &MyCheckBox::stateChanged, this, [=](int state) {
|
||||||
this->m_isFactoryRestore = Qt::Unchecked == state ? false : true;
|
this->m_isFactoryRestore = Qt::Unchecked == state ? false : true;
|
||||||
|
@ -421,6 +434,7 @@ void SystemRestore::initSecondWidget()
|
||||||
recheck->setVisible(false);
|
recheck->setVisible(false);
|
||||||
|
|
||||||
this->on_checkEnv_start();
|
this->on_checkEnv_start();
|
||||||
|
emit GlobelBackupInfo::inst().getGlobalSignals()->widthChanged();
|
||||||
});
|
});
|
||||||
|
|
||||||
// 检测结果
|
// 检测结果
|
||||||
|
@ -472,6 +486,38 @@ void SystemRestore::initSecondWidget()
|
||||||
}
|
}
|
||||||
|
|
||||||
preStep->setVisible(true);
|
preStep->setVisible(true);
|
||||||
|
emit GlobelBackupInfo::inst().getGlobalSignals()->widthChanged();
|
||||||
|
});
|
||||||
|
|
||||||
|
// 调整中部控件大小
|
||||||
|
connect(GlobelBackupInfo::inst().getGlobalSignals(), &GlobalSignals::widthChanged, this, [=](){
|
||||||
|
// 控件bigTitle的宽度
|
||||||
|
int len_title = 0;
|
||||||
|
if (bigTitle->isVisible()) {
|
||||||
|
QFontMetrics fontMetrics(bigTitle->font());
|
||||||
|
len_title = fontMetrics.width(bigTitle->getOriginalText());
|
||||||
|
len_title += LEN_TITLE_PRE;
|
||||||
|
}
|
||||||
|
// 控件labelError1的宽度
|
||||||
|
int len_labelError1 = 0;
|
||||||
|
if (labelCheck1->isVisible()) {
|
||||||
|
QFontMetrics fontMetrics(labelCheck1->font());
|
||||||
|
len_labelError1 = fontMetrics.width(labelCheck1->getOriginalText());
|
||||||
|
len_labelError1 += LEN_DOT_PRE;
|
||||||
|
}
|
||||||
|
// 控件labelError2的宽度
|
||||||
|
int len_labelError2 = 0;
|
||||||
|
if (labelCheck2->isVisible()) {
|
||||||
|
QFontMetrics fontMetrics(labelCheck2->font());
|
||||||
|
len_labelError2 = fontMetrics.width(labelCheck2->getOriginalText());
|
||||||
|
len_labelError2 += LEN_DOT_PRE;
|
||||||
|
}
|
||||||
|
int len_max = len_title > len_labelError1 ? len_title : len_labelError1;
|
||||||
|
len_max = len_max > len_labelError2 ? len_max : len_labelError2;
|
||||||
|
if (len_max >= this->width())
|
||||||
|
len_max = this->width();
|
||||||
|
|
||||||
|
centerFont->setFixedWidth(len_max);
|
||||||
});
|
});
|
||||||
|
|
||||||
// 重新检查
|
// 重新检查
|
||||||
|
@ -977,6 +1023,38 @@ void SystemRestore::initLastWidget()
|
||||||
retry->setVisible(true);
|
retry->setVisible(true);
|
||||||
homePage->setVisible(true);
|
homePage->setVisible(true);
|
||||||
}
|
}
|
||||||
|
emit GlobelBackupInfo::inst().getGlobalSignals()->widthChanged();
|
||||||
|
});
|
||||||
|
|
||||||
|
// 调整中部控件大小
|
||||||
|
connect(GlobelBackupInfo::inst().getGlobalSignals(), &GlobalSignals::widthChanged, this, [=](){
|
||||||
|
// 控件bigTitle的宽度
|
||||||
|
int len_title = 0;
|
||||||
|
if (bigTitle->isVisible()) {
|
||||||
|
QFontMetrics fontMetrics(bigTitle->font());
|
||||||
|
len_title = fontMetrics.width(bigTitle->getOriginalText());
|
||||||
|
len_title += LEN_TITLE_PRE;
|
||||||
|
}
|
||||||
|
// 控件labelError1的宽度
|
||||||
|
int len_labelError1 = 0;
|
||||||
|
if (labelError1->isVisible()) {
|
||||||
|
QFontMetrics fontMetrics(labelError1->font());
|
||||||
|
len_labelError1 = fontMetrics.width(labelError1->getOriginalText());
|
||||||
|
len_labelError1 += LEN_DOT_PRE;
|
||||||
|
}
|
||||||
|
// 控件labelError2的宽度
|
||||||
|
int len_labelError2 = 0;
|
||||||
|
if (labelError2->isVisible()) {
|
||||||
|
QFontMetrics fontMetrics(labelError2->font());
|
||||||
|
len_labelError2 = fontMetrics.width(labelError2->getOriginalText());
|
||||||
|
len_labelError2 += LEN_DOT_PRE;
|
||||||
|
}
|
||||||
|
int len_max = len_title > len_labelError1 ? len_title : len_labelError1;
|
||||||
|
len_max = len_max > len_labelError2 ? len_max : len_labelError2;
|
||||||
|
if (len_max >= this->width())
|
||||||
|
len_max = this->width();
|
||||||
|
|
||||||
|
centerFont->setFixedWidth(len_max);
|
||||||
});
|
});
|
||||||
|
|
||||||
// 再试一次
|
// 再试一次
|
||||||
|
|
Loading…
Reference in New Issue