mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-12-14 04:42:03 +08:00
进度更新
This commit is contained in:
19
gui/spkabout.cpp
Normal file
19
gui/spkabout.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
|
||||
#include "spkabout.h"
|
||||
|
||||
SpkAbout::SpkAbout(QWidget *parent) : SpkDialog(parent)
|
||||
{
|
||||
setWindowModality(Qt::ApplicationModal);
|
||||
}
|
||||
|
||||
void SpkAbout::Show()
|
||||
{
|
||||
SpkAbout *b = new SpkAbout;
|
||||
|
||||
b->GetTitleBar()->SetOperationButton(SpkTitleBar::OperationButton::Close);
|
||||
|
||||
// TODO: Waiting for qygw
|
||||
|
||||
b->Exec();
|
||||
delete b;
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "spkdialog.h"
|
||||
|
||||
SpkDialog::SpkDialog(QWidget *parent) :
|
||||
SpkWindow(parent)
|
||||
SpkWindow(parent, Qt::Dialog)
|
||||
{
|
||||
mDialogWidget = new QWidget;
|
||||
mMainVLay = new QVBoxLayout(mDialogWidget);
|
||||
@@ -19,7 +19,8 @@ SpkDialog::SpkDialog(QWidget *parent) :
|
||||
|
||||
SetCentralWidget(mDialogWidget);
|
||||
|
||||
connect(mBtnGroup, QOverload<int>::of(&QButtonGroup::idClicked),
|
||||
// idClicked is not available on platforms we support, shouldn't change it
|
||||
connect(mBtnGroup, QOverload<int>::of(&QButtonGroup::buttonClicked),
|
||||
this, &SpkDialog::ButtonPressed);
|
||||
connect(this, &SpkWindow::Closed, this, &SpkDialog::ForceClose);
|
||||
}
|
||||
|
||||
@@ -5,21 +5,23 @@
|
||||
#include <QScreen>
|
||||
#include "spkui_general.h"
|
||||
#include "spkmsgbox.h"
|
||||
#include "spkstore.h"
|
||||
|
||||
// Suppress unwanted Clazy check warnings
|
||||
// clazy:excludeall=connect-3arg-lambda,lambda-in-connect
|
||||
|
||||
const QSize SpkMsgBox::IconSize; // I don't know why I need it
|
||||
const QSize SpkMsgBox::IconSize; // I don't know why I need it, compiler wants that
|
||||
|
||||
SpkMsgBox::SpkMsgBox()
|
||||
SpkMsgBox::SpkMsgBox(QWidget *parent)
|
||||
{
|
||||
Q_UNUSED(parent);
|
||||
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
|
||||
}
|
||||
|
||||
int SpkMsgBox::StaticExec(QString msg, QString title, QMessageBox::Icon icon,
|
||||
QMessageBox::StandardButtons buttons, QString extra)
|
||||
{
|
||||
SpkMsgBox *b = new SpkMsgBox;
|
||||
SpkMsgBox *b = new SpkMsgBox(SpkStore::Instance->GetRootWindow());
|
||||
QWidget *wMsgWidget = new QWidget;
|
||||
QHBoxLayout *wMsg = new QHBoxLayout(wMsgWidget);
|
||||
QPushButton *wExpandBtn;
|
||||
@@ -53,7 +55,7 @@ int SpkMsgBox::StaticExec(QString msg, QString title, QMessageBox::Icon icon,
|
||||
wMsg->addWidget(wIcon);
|
||||
}
|
||||
wMsgText->setText(msg);
|
||||
wMsgText->setAlignment(Qt::AlignCenter);
|
||||
wMsgText->setAlignment(Qt::AlignLeft);
|
||||
wMsg->addWidget(wMsgText);
|
||||
wMsg->setSpacing(10);
|
||||
wMsgWidget->setLayout(wMsg);
|
||||
@@ -95,7 +97,8 @@ int SpkMsgBox::StaticExec(QString msg, QString title, QMessageBox::Icon icon,
|
||||
InitialHeight = b->minimumSizeHint().height();
|
||||
auto pos = (SpkUi::PrimaryScreenSize - b->sizeHint()) / 2;
|
||||
b->move(pos.width(), pos.height());
|
||||
b->setWindowModality(Qt::WindowModal);
|
||||
b->setWindowModality(Qt::ApplicationModal);
|
||||
b->setFixedSize(b->sizeHint());
|
||||
|
||||
auto r = b->Exec();
|
||||
if(r != -1)
|
||||
|
||||
@@ -11,10 +11,11 @@
|
||||
#include <QDateTime>
|
||||
#include <QDebug>
|
||||
#include <QScreen>
|
||||
#include <QPluginLoader>
|
||||
#include <QStyleFactory>
|
||||
#include <csignal>
|
||||
#include <dlfcn.h>
|
||||
#include <execinfo.h>
|
||||
#include "deepinplatform.h"
|
||||
|
||||
#include "spkui_general.h"
|
||||
#include "spkmsgbox.h"
|
||||
#include "spklogging.h"
|
||||
@@ -24,6 +25,8 @@ namespace SpkUi
|
||||
QString StylesheetLight, StylesheetDark, *CurrentStylesheet = &StylesheetLight;
|
||||
QColor ColorLine, ColorBack;
|
||||
QSize PrimaryScreenSize;
|
||||
SpkDtkPlugin *DtkPlugin = nullptr;
|
||||
|
||||
namespace Priv
|
||||
{
|
||||
bool CrashHandlerActivated;
|
||||
@@ -50,9 +53,10 @@ namespace SpkUi
|
||||
signal(SIGFPE, SpkUi::CrashSignalHandler);
|
||||
|
||||
// Prepare theme following for DDE
|
||||
PrepareForDeepinDesktop();
|
||||
if(CheckIsDeepinDesktop())
|
||||
PrepareForDeepinDesktop();
|
||||
|
||||
// Data initialization
|
||||
// Misc data initialization
|
||||
PrimaryScreenSize = QGuiApplication::primaryScreen()->size();
|
||||
}
|
||||
|
||||
@@ -64,6 +68,7 @@ namespace SpkUi
|
||||
bool CheckIsDeepinDesktop()
|
||||
{
|
||||
QString Desktop(getenv("XDG_CURRENT_DESKTOP"));
|
||||
// This method of checking is from DTK source code.
|
||||
if(Desktop.contains("deepin", Qt::CaseInsensitive) ||
|
||||
Desktop.contains("tablet", Qt::CaseInsensitive))
|
||||
return true;
|
||||
@@ -73,7 +78,30 @@ namespace SpkUi
|
||||
|
||||
void PrepareForDeepinDesktop()
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
// Normally it's installed to system library path
|
||||
qApp->addLibraryPath(qApp->applicationDirPath() + "/plugin/dtkplugin");
|
||||
#endif
|
||||
QPluginLoader p("libspkdtkplugin");
|
||||
if(p.load())
|
||||
{
|
||||
auto i = qobject_cast<SpkDtkPlugin*>(p.instance());
|
||||
if(i)
|
||||
DtkPlugin = i;
|
||||
}
|
||||
|
||||
// FIXME: Chameleon style kept adding unwanted blue focus indication border
|
||||
// to widgets that shouldn't have borders.
|
||||
// We need to eliminate this irritating problem.
|
||||
auto styles = QStyleFactory::keys();
|
||||
styles.removeAll("chameleon");
|
||||
if(styles.contains("Fusion"))
|
||||
qApp->setStyle(QStyleFactory::create("Fusion"));
|
||||
else if(styles.size()) // What? This shouldn't happen.
|
||||
qApp->setStyle(QStyleFactory::create(styles[0]));
|
||||
else // Duh...
|
||||
sWarn(QObject::tr("Cannot find styles other than 'chameleon'! You may see widgets "
|
||||
"with unwanted blue borders."));
|
||||
}
|
||||
|
||||
void SetGlobalStyle(const SpkUiStyle aStyle)
|
||||
|
||||
@@ -12,9 +12,12 @@
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
SpkWindow::SpkWindow(QWidget *parent) : QMainWindow(parent)
|
||||
SpkWindow::SpkWindow(QWidget *parent, Qt::WindowFlags flags) : QMainWindow(parent, flags)
|
||||
{
|
||||
setWindowFlags(Qt::FramelessWindowHint); // Remove default title bar, we'll have custom title bar
|
||||
if(SpkUi::DtkPlugin)
|
||||
SpkUi::DtkPlugin->addWindow(this, parent); // Register window to DXcb so we got Deepin
|
||||
else
|
||||
setWindowFlags(Qt::FramelessWindowHint); // Remove default title bar
|
||||
mCornerRadius = 5;
|
||||
mUserCentralWidget = nullptr;
|
||||
mResizable = true;
|
||||
|
||||
Reference in New Issue
Block a user