71 lines
2.2 KiB
C++
71 lines
2.2 KiB
C++
#include "aboutdialog.h"
|
|
#include "utils/Constants.h"
|
|
|
|
#include "ElaImageCard.h"
|
|
#include "ElaText.h"
|
|
#include "ElaPushButton.h"
|
|
|
|
#include <QDesktopServices>
|
|
#include <QUrl>
|
|
#include <QFont>
|
|
#include <QDateTime>
|
|
|
|
AboutDialog::AboutDialog(QWidget* parent) : InterDialog(parent)
|
|
{
|
|
setFixedSize(354, 180);
|
|
setWindowTitle("关于");
|
|
setStandardButtons(QDialogButtonBox::Ok);
|
|
|
|
auto* centralWidget = new QWidget(this);
|
|
auto* centralLayout = new QVBoxLayout(centralWidget);
|
|
centralLayout->setContentsMargins(0, 10, 0, 10);
|
|
this->setCentralWidget(centralWidget);
|
|
|
|
auto* pixCard = new ElaImageCard(this);
|
|
pixCard->setFixedSize(64, 64);
|
|
pixCard->setIsPreserveAspectCrop(false);
|
|
pixCard->setCardImage(QImage(":/resources/images/ChangeCode.png"));
|
|
|
|
auto* pixCardLayout = new QVBoxLayout();
|
|
pixCardLayout->addWidget(pixCard);
|
|
pixCardLayout->addStretch();
|
|
|
|
auto* nameText = new ElaText(this);
|
|
QFont nameTextFont = nameText->font();
|
|
nameTextFont.setWeight(QFont::Bold);
|
|
nameText->setFont(nameTextFont);
|
|
nameText->setTextPixelSize(17);
|
|
nameText->setText("UFT30 ChangeCode");
|
|
|
|
auto* versionText = new ElaText(this);
|
|
versionText->setText(QString("版本: %1").arg(Version::getVersionString()));
|
|
versionText->setTextPixelSize(12);
|
|
|
|
auto* dateText = new ElaText(this);
|
|
dateText->setText(QString("构建日期: %1").arg(Version::getBuildDateTime()));
|
|
dateText->setTextPixelSize(12);
|
|
|
|
auto* textLayout = new QVBoxLayout();
|
|
textLayout->setSpacing(10);
|
|
textLayout->addWidget(nameText);
|
|
textLayout->addWidget(versionText);
|
|
textLayout->addWidget(dateText);
|
|
textLayout->addStretch();
|
|
|
|
auto* downloadBtn = new ElaPushButton("下载最新", this);
|
|
connect(downloadBtn, &ElaPushButton::clicked, []
|
|
{
|
|
QDesktopServices::openUrl(QUrl(Constants::Urls::downloadPage()));
|
|
});
|
|
addFirstButton(downloadBtn);
|
|
|
|
auto* contentLayout = new QHBoxLayout();
|
|
contentLayout->addSpacing(10);
|
|
contentLayout->addLayout(pixCardLayout);
|
|
contentLayout->addSpacing(15);
|
|
contentLayout->addLayout(textLayout);
|
|
|
|
centralLayout->addLayout(contentLayout);
|
|
}
|
|
|
|
AboutDialog::~AboutDialog() = default; |