Skip to content

Commit

Permalink
fix: [Vault] Change UI
Browse files Browse the repository at this point in the history
change vault title UI

Log: fix issue
Bug: https://pms.uniontech.com/bug-view-238997.html
  • Loading branch information
GongHeng2017 authored and max-lvs committed Jan 12, 2024
1 parent bfa4de4 commit b9b7213
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
#include <DDialog>
#include <DWaterProgress>
#include <DIconButton>
#ifdef DTKWIDGET_CLASS_DSizeMode
# include <DSizeMode>
#endif

#include <QGridLayout>
#include <QDebug>
Expand All @@ -44,11 +47,8 @@ VaultActiveFinishedView::VaultActiveFinishedView(QWidget *parent)
void VaultActiveFinishedView::initUi()
{
// 标题
DLabel *pLabelTitle = new DLabel(tr("Encrypt File Vault"), this);
QFont font = pLabelTitle->font();
font.setPixelSize(18);
pLabelTitle->setFont(font);
pLabelTitle->setAlignment(Qt::AlignHCenter);
titleLabel = new DLabel(tr("Encrypt File Vault"), this);
titleLabel->setAlignment(Qt::AlignHCenter);

// 加密提示
tipsLabel = new DLabel(tr("Click 'Encrypt' and input the user password."), this);
Expand Down Expand Up @@ -101,7 +101,7 @@ void VaultActiveFinishedView::initUi()

QVBoxLayout *m_pLay = new QVBoxLayout(this);
m_pLay->setMargin(0);
m_pLay->addWidget(pLabelTitle);
m_pLay->addWidget(titleLabel);
m_pLay->addSpacing(10);
m_pLay->addWidget(widgetOne);
m_pLay->addWidget(widgetTow, 0, Qt::AlignHCenter);
Expand All @@ -112,11 +112,13 @@ void VaultActiveFinishedView::initUi()
widgetTow->setVisible(false);
widgetThree->setVisible(false);

initUiForSizeMode();

// 初始化定时器
timer = new QTimer(this);

#ifdef ENABLE_TESTING
AddATTag(qobject_cast<QWidget *>(pLabelTitle), AcName::kAcLabelVaultFinishTitle);
AddATTag(qobject_cast<QWidget *>(titleLabel), AcName::kAcLabelVaultFinishTitle);
AddATTag(qobject_cast<QWidget *>(tipsLabel), AcName::kAcLabelVaultFinishContent);
AddATTag(qobject_cast<QWidget *>(encryVaultImageLabel), AcName::kAcLabelVaultFinishVaultImage);
AddATTag(qobject_cast<QWidget *>(waterProgress), AcName::kAcProgressVaultFinishProgress);
Expand All @@ -127,6 +129,19 @@ void VaultActiveFinishedView::initUi()
#endif
}

void VaultActiveFinishedView::initUiForSizeMode()
{
#ifdef DTKWIDGET_CLASS_DSizeMode
QFont font = titleLabel->font();
font.setPixelSize(DSizeModeHelper::element(13, 16));
titleLabel->setFont(font);
#else
QFont font = titleLabel->font();
font.setPixelSize(16);
titleLabel->setFont(font);
#endif
}

void VaultActiveFinishedView::initConnect()
{
connect(finishedBtn, &DPushButton::clicked,
Expand All @@ -135,6 +150,12 @@ void VaultActiveFinishedView::initConnect()
this, &VaultActiveFinishedView::slotEncryptComplete);
connect(timer, &QTimer::timeout,
this, &VaultActiveFinishedView::slotTimeout);

#ifdef DTKWIDGET_CLASS_DSizeMode
connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::sizeModeChanged, this, [this]() {
initUiForSizeMode();
});
#endif
}

void VaultActiveFinishedView::setFinishedBtnEnabled(bool b)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,11 @@ private slots:

private:
void initUi();
void initUiForSizeMode();
void initConnect();

private:
DTK_WIDGET_NAMESPACE::DLabel *titleLabel { Q_NULLPTR };
QWidget *widgetOne { nullptr };
DTK_WIDGET_NAMESPACE::DLabel *tipsLabel { nullptr };
DTK_WIDGET_NAMESPACE::DLabel *encryVaultImageLabel { nullptr };
Expand Down

0 comments on commit b9b7213

Please sign in to comment.