mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-12-14 04:42:03 +08:00
加入SpkAbout(无内容)
This commit is contained in:
@@ -1,18 +1,56 @@
|
||||
|
||||
#include "gitver.h"
|
||||
#include "spkabout.h"
|
||||
|
||||
SpkAbout::SpkAbout(QWidget *parent) : SpkDialog(parent)
|
||||
{
|
||||
setWindowModality(Qt::ApplicationModal);
|
||||
|
||||
mIconLay = new QHBoxLayout;
|
||||
|
||||
mSpkVersion = new QLabel;
|
||||
mSpkVersion->setText(tr("<h1>Spark Store</h1>"
|
||||
"<h3>Version %1</h3>"
|
||||
"<t>Code committed on (%2)</t><br>"
|
||||
"<t>Built on %3 %4</t>")
|
||||
.arg(GitVer::DescribeTags())
|
||||
.arg(GitVer::CommitDate())
|
||||
.arg(__DATE__)
|
||||
.arg(__TIME__));
|
||||
|
||||
mSpkIcon = new QLabel;
|
||||
mSpkIcon->setPixmap(QIcon(":/icons/spark-store.svg").pixmap(QSize(128, 128)));
|
||||
|
||||
QFile lipsum(":/info/lipsum.txt");
|
||||
lipsum.open(QFile::ReadOnly);
|
||||
mDescriptionText = new QLabel;
|
||||
mDescriptionText->setText(lipsum.readAll());
|
||||
lipsum.close();
|
||||
|
||||
mIconLay->addWidget(mSpkIcon);
|
||||
mIconLay->addWidget(mSpkVersion);
|
||||
mIconLay->setAlignment(Qt::AlignVCenter);
|
||||
AddLayout(mIconLay);
|
||||
AddSpacing(18);
|
||||
AddWidget(mDescriptionText);
|
||||
SetMargin(18);
|
||||
|
||||
GetTitleBar()->SetOperationButton(SpkTitleBar::OperationButton::Close);
|
||||
GetTitleBar()->SetTitle(tr("About Spark Store"));
|
||||
}
|
||||
|
||||
SpkAbout::~SpkAbout()
|
||||
{
|
||||
// delete mIconLay;
|
||||
// delete mDescriptionText;
|
||||
}
|
||||
|
||||
void SpkAbout::Show()
|
||||
{
|
||||
SpkAbout *b = new SpkAbout;
|
||||
|
||||
b->GetTitleBar()->SetOperationButton(SpkTitleBar::OperationButton::Close);
|
||||
|
||||
// TODO: Waiting for qygw
|
||||
|
||||
|
||||
b->Exec();
|
||||
delete b;
|
||||
|
||||
@@ -59,16 +59,29 @@ void SpkDialog::AddButton(QString text, SpkUi::SpkButtonStyle style)
|
||||
|
||||
void SpkDialog::AddWidget(QWidget *w)
|
||||
{
|
||||
// Adding a widget does not take the ownership.
|
||||
mWidgetsVLay->addWidget(w);
|
||||
mWidgetsList << w;
|
||||
mParentsList << w->parentWidget();
|
||||
}
|
||||
|
||||
void SpkDialog::AddLayout(QLayout *w)
|
||||
{
|
||||
mWidgetsVLay->addLayout(w);
|
||||
mWidgetsList << w;
|
||||
mParentsList << w->parentWidget();
|
||||
}
|
||||
|
||||
void SpkDialog::AddSpacing(int a)
|
||||
{
|
||||
mWidgetsVLay->addSpacing(a);
|
||||
}
|
||||
|
||||
void SpkDialog::SetMargin(int a)
|
||||
{
|
||||
mWidgetsVLay->setMargin(a);
|
||||
}
|
||||
|
||||
int SpkDialog::Exec()
|
||||
{
|
||||
QEventLoop loop;
|
||||
|
||||
@@ -25,7 +25,7 @@ SpkTitleBar::SpkTitleBar(QWidget *parent) : QWidget(parent)
|
||||
mMainLayout->setSpacing(8);
|
||||
mBtnGroup->setSpacing(0);
|
||||
|
||||
mMainLayout->addSpacing(8);
|
||||
mMainLayout->addSpacing(12);
|
||||
mMainLayout->addWidget(mIcon);
|
||||
mMainLayout->addWidget(mTitle);
|
||||
mMainLayout->addLayout(mUserSpace);
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
SpkWindow::SpkWindow(QWidget *parent, Qt::WindowFlags flags) : QMainWindow(parent, flags)
|
||||
{
|
||||
mUseCustomEvents = SpkUi::DtkPlugin == nullptr; // Put to the front, to prevent warnings
|
||||
if(SpkUi::DtkPlugin && !qgetenv("SPARK_NO_DXCB").toInt())
|
||||
SpkUi::DtkPlugin->addWindow(this, parent); // Register window to DXcb so we got Deepin
|
||||
else
|
||||
@@ -24,7 +25,6 @@ SpkWindow::SpkWindow(QWidget *parent, Qt::WindowFlags flags) : QMainWindow(paren
|
||||
mMoving = mResizing = false;
|
||||
mCloseHook = nullptr;
|
||||
mMaximized = windowState().testFlag(Qt::WindowMaximized);
|
||||
mUseCustomEvents = SpkUi::DtkPlugin == nullptr;
|
||||
|
||||
PopulateUi();
|
||||
}
|
||||
@@ -225,6 +225,20 @@ void SpkWindow::closeEvent(QCloseEvent *e)
|
||||
emit Closed();
|
||||
}
|
||||
|
||||
void SpkWindow::paintEvent(QPaintEvent *e)
|
||||
{
|
||||
//FIXME: DOESN'T WORK!
|
||||
// QPainter painter(this);
|
||||
// painter.setBrush(QBrush(Qt::NoBrush));
|
||||
// painter.setPen(QPen(SpkUi::ColorLine));
|
||||
// QRect rect = this->rect();
|
||||
// rect.setWidth(rect.width() - 2);
|
||||
// rect.setHeight(rect.height() - 2);
|
||||
// rect.adjust(-1, -1, 1, 1);
|
||||
// painter.drawRect(rect);
|
||||
// QWidget::paintEvent(e);
|
||||
}
|
||||
|
||||
void SpkWindow::SetCornerRadius(int radius)
|
||||
{
|
||||
mCornerRadius = radius;
|
||||
|
||||
Reference in New Issue
Block a user