单击版本号打开官网

This commit is contained in:
RigoLigoRLC
2021-07-22 19:25:23 +08:00
parent 8198dc48c5
commit 3eb2a0d63a
+24 -16
View File
@@ -1,31 +1,42 @@
#include "gitver.h" #include <QDesktopServices>
#include "spkabout.h" #include "spkabout.h"
#include "gitver.h"
SpkAbout::SpkAbout(QWidget *parent) : SpkDialog(parent) SpkAbout::SpkAbout(QWidget *parent) : SpkDialog(parent)
{ {
setWindowModality(Qt::ApplicationModal); setWindowModality(Qt::ApplicationModal);
mDialogWidget->setMaximumWidth(600);
mDialogWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
mIconLay = new QHBoxLayout; mIconLay = new QHBoxLayout;
mSpkVersion = new QLabel; mSpkVersion = new QLabel;
mSpkVersion->setText(tr("<h1>Spark Store</h1>" mSpkVersion->setText(tr("<h1>Spark Store</h1>"
"<h3>Version %1</h3>" "<h3>Version <a href=\"https://www.spark-app.store\">%1</a></h3>"
"<t>Code committed on (%2)</t><br>" "<t>Code committed on (%2)</t><br>"
"<t>Built on %3 %4</t>") "<t>Built on %3 %4</t>")
.arg(GitVer::DescribeTags()) .arg(GitVer::DescribeTags(),
.arg(GitVer::CommitDate()) GitVer::CommitDate(),
.arg(__DATE__) __DATE__, __TIME__));
.arg(__TIME__)); connect(mSpkVersion, &QLabel::linkActivated,
[](const QString &link){ QDesktopServices::openUrl(link); });
mSpkIcon = new QLabel; mSpkIcon = new QLabel;
mSpkIcon->setPixmap(QIcon(":/icons/spark-store.svg").pixmap(QSize(128, 128))); mSpkIcon->setPixmap(QIcon(":/icons/spark-store.svg").pixmap(QSize(128, 128)));
QFile lipsum(":/info/lipsum.txt"); auto description =
lipsum.open(QFile::ReadOnly); "Spark Store was started when Chinese home-grown Linux operating systems "
"had initially hit the market. Because the Linux desktop ecosystem is not "
"good enough at the time being, volunteers built this small App Store in "
"the hope that users can get useful applications faster.\n\n"
"Right now we are not just a Chinese group. We are discovering our way into "
"more Debian-based Linux OSes, and build a real community software repository "
"for users around the world.";
mDescriptionText = new QLabel; mDescriptionText = new QLabel;
mDescriptionText->setText(lipsum.readAll()); mDescriptionText->setWordWrap(true);
lipsum.close(); mDescriptionText->setText(description);
mIconLay->addWidget(mSpkIcon); mIconLay->addWidget(mSpkIcon);
mIconLay->addWidget(mSpkVersion); mIconLay->addWidget(mSpkVersion);
@@ -33,7 +44,7 @@ SpkAbout::SpkAbout(QWidget *parent) : SpkDialog(parent)
AddLayout(mIconLay); AddLayout(mIconLay);
AddSpacing(18); AddSpacing(18);
AddWidget(mDescriptionText); AddWidget(mDescriptionText);
SetMargin(18); SetMargin(18, 0, 18, 18);
GetTitleBar()->SetOperationButton(SpkTitleBar::OperationButton::Close); GetTitleBar()->SetOperationButton(SpkTitleBar::OperationButton::Close);
GetTitleBar()->SetTitle(tr("About Spark Store")); GetTitleBar()->SetTitle(tr("About Spark Store"));
@@ -41,17 +52,14 @@ SpkAbout::SpkAbout(QWidget *parent) : SpkDialog(parent)
SpkAbout::~SpkAbout() SpkAbout::~SpkAbout()
{ {
// delete mIconLay; // delete mIconLay;
// delete mDescriptionText; // delete mDescriptionText;
} }
void SpkAbout::Show() void SpkAbout::Show()
{ {
SpkAbout *b = new SpkAbout; SpkAbout *b = new SpkAbout;
b->Exec(); b->Exec();
delete b; delete b;
} }