mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-07-06 13:46:00 +08:00
format: 代码格式化
This commit is contained in:
parent
89a3ab0b4c
commit
fd4fdbe970
src
@ -30,7 +30,6 @@ void DownloadController::setFilename(QString filename)
|
|||||||
this->filename = filename;
|
this->filename = filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool checkMeatlink(QString metaUrl)
|
bool checkMeatlink(QString metaUrl)
|
||||||
{
|
{
|
||||||
QFile metaStatus("/tmp/spark-store/metaStatus.txt");
|
QFile metaStatus("/tmp/spark-store/metaStatus.txt");
|
||||||
|
@ -4,8 +4,7 @@
|
|||||||
#include <QScreen> // Qt5 不再建议使用 QDesktopWidget
|
#include <QScreen> // Qt5 不再建议使用 QDesktopWidget
|
||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
|
|
||||||
image_show::image_show(QWidget *parent) :
|
image_show::image_show(QWidget *parent) : QWidget(parent),
|
||||||
QWidget(parent),
|
|
||||||
m_dialog(new big_image),
|
m_dialog(new big_image),
|
||||||
m_label(new QLabel)
|
m_label(new QLabel)
|
||||||
{
|
{
|
||||||
|
@ -17,7 +17,8 @@ void SparkAPI::get(QUrl url)
|
|||||||
QNetworkRequest request;
|
QNetworkRequest request;
|
||||||
HttpRequest *httprequest = new HttpRequest;
|
HttpRequest *httprequest = new HttpRequest;
|
||||||
request.setUrl(QUrl(url.toString().replace("+", "%2B")));
|
request.setUrl(QUrl(url.toString().replace("+", "%2B")));
|
||||||
connect(httprequest,&HttpRequest::finished,[=](QString data){
|
connect(httprequest, &HttpRequest::finished, [=](QString data)
|
||||||
|
{
|
||||||
QByteArray arr = data.toUtf8();
|
QByteArray arr = data.toUtf8();
|
||||||
//解析Json
|
//解析Json
|
||||||
QJsonParseError error;
|
QJsonParseError error;
|
||||||
@ -30,8 +31,7 @@ void SparkAPI::get(QUrl url)
|
|||||||
emit finishedObject(doc);
|
emit finishedObject(doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
httprequest->deleteLater();
|
httprequest->deleteLater(); });
|
||||||
});
|
|
||||||
httprequest->getRequest(request);
|
httprequest->getRequest(request);
|
||||||
}
|
}
|
||||||
void SparkAPI::getRAW(QUrl url)
|
void SparkAPI::getRAW(QUrl url)
|
||||||
@ -39,10 +39,10 @@ void SparkAPI::getRAW(QUrl url)
|
|||||||
QNetworkRequest request;
|
QNetworkRequest request;
|
||||||
HttpRequest *httprequest = new HttpRequest;
|
HttpRequest *httprequest = new HttpRequest;
|
||||||
request.setUrl(QUrl(url.toString().replace("+", "%2B")));
|
request.setUrl(QUrl(url.toString().replace("+", "%2B")));
|
||||||
connect(httprequest,&HttpRequest::finished,[=](QString data){
|
connect(httprequest, &HttpRequest::finished, [=](QString data)
|
||||||
|
{
|
||||||
emit finishedRAW(data);
|
emit finishedRAW(data);
|
||||||
httprequest->deleteLater();
|
httprequest->deleteLater(); });
|
||||||
});
|
|
||||||
httprequest->getRequest(request);
|
httprequest->getRequest(request);
|
||||||
}
|
}
|
||||||
void SparkAPI::getAppList(QString type)
|
void SparkAPI::getAppList(QString type)
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
DBusSparkStoreService::DBusSparkStoreService(QObject *parent)
|
DBusSparkStoreService::DBusSparkStoreService(QObject *parent)
|
||||||
: QDBusAbstractAdaptor(parent)
|
: QDBusAbstractAdaptor(parent)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DBusSparkStoreService::activeWindow(const QString &arg)
|
void DBusSparkStoreService::activeWindow(const QString &arg)
|
||||||
|
43
src/main.cpp
43
src/main.cpp
@ -20,32 +20,34 @@ int main(int argc, char *argv[])
|
|||||||
static const QTime buildTime = QTime::fromString(__TIME__, "hh:mm:ss");
|
static const QTime buildTime = QTime::fromString(__TIME__, "hh:mm:ss");
|
||||||
|
|
||||||
// 设置桌面环境环境变量
|
// 设置桌面环境环境变量
|
||||||
if (!QString(qgetenv("XDG_CURRENT_DESKTOP")).toLower().startsWith("deepin")) {
|
if (!QString(qgetenv("XDG_CURRENT_DESKTOP")).toLower().startsWith("deepin"))
|
||||||
|
{
|
||||||
setenv("XDG_CURRENT_DESKTOP", "Deepin", 1);
|
setenv("XDG_CURRENT_DESKTOP", "Deepin", 1);
|
||||||
}
|
}
|
||||||
bool isWayland = false;
|
bool isWayland = false;
|
||||||
auto e = QProcessEnvironment::systemEnvironment();
|
auto e = QProcessEnvironment::systemEnvironment();
|
||||||
QString XDG_SESSION_TYPE = e.value(QStringLiteral("XDG_SESSION_TYPE"));
|
QString XDG_SESSION_TYPE = e.value(QStringLiteral("XDG_SESSION_TYPE"));
|
||||||
QString WAYLAND_DISPLAY = e.value(QStringLiteral("WAYLAND_DISPLAY"));
|
QString WAYLAND_DISPLAY = e.value(QStringLiteral("WAYLAND_DISPLAY"));
|
||||||
if (XDG_SESSION_TYPE == QLatin1String("wayland") || WAYLAND_DISPLAY.contains(QLatin1String("wayland"), Qt::CaseInsensitive)){
|
if (XDG_SESSION_TYPE == QLatin1String("wayland") || WAYLAND_DISPLAY.contains(QLatin1String("wayland"), Qt::CaseInsensitive))
|
||||||
|
{
|
||||||
isWayland = true;
|
isWayland = true;
|
||||||
}
|
}
|
||||||
qDebug() << "Wayland enabled:" << isWayland;
|
qDebug() << "Wayland enabled:" << isWayland;
|
||||||
|
|
||||||
if(isWayland && !Dtk::Core::DSysInfo::isDDE()){
|
if (isWayland && !Dtk::Core::DSysInfo::isDDE())
|
||||||
|
{
|
||||||
qputenv("QT_QPA_PLATFORM", "wayland");
|
qputenv("QT_QPA_PLATFORM", "wayland");
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (isWayland && Dtk::Core::DSysInfo::isDDE()){
|
else if (isWayland && Dtk::Core::DSysInfo::isDDE())
|
||||||
|
{
|
||||||
qputenv("QT_QPA_PLATFORM", "dwayland");
|
qputenv("QT_QPA_PLATFORM", "dwayland");
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
qputenv("QT_QPA_PLATFORM", "dxcb");
|
qputenv("QT_QPA_PLATFORM", "dxcb");
|
||||||
}
|
}
|
||||||
DApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // 开启 Hidpi 支持
|
DApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // 开启 Hidpi 支持
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 浏览器开启 GPU 支持
|
// 浏览器开启 GPU 支持
|
||||||
qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--ignore-gpu-blocklist --enable-gpu-rasterization --enable-native-gpu-memory-buffers --enable-accelerated-video-decode");
|
qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--ignore-gpu-blocklist --enable-gpu-rasterization --enable-native-gpu-memory-buffers --enable-accelerated-video-decode");
|
||||||
|
|
||||||
@ -53,18 +55,18 @@ int main(int argc, char *argv[])
|
|||||||
fakeArgs[0] = argv[0];
|
fakeArgs[0] = argv[0];
|
||||||
fakeArgs[1] = "-platformtheme";
|
fakeArgs[1] = "-platformtheme";
|
||||||
fakeArgs[2] = "deepin";
|
fakeArgs[2] = "deepin";
|
||||||
for(int i = 1; i < argc; i++) fakeArgs[i + 2] = argv[i];
|
for (int i = 1; i < argc; i++)
|
||||||
int fakeArgc = argc + 2; // 为啥DApplication的argc要用引用啊?
|
fakeArgs[i + 2] = argv[i];
|
||||||
|
int fakeArgc = argc + 2; // DApplication的argc要用引用,避免c++编译器优化
|
||||||
DApplication a(fakeArgc, fakeArgs.data());
|
DApplication a(fakeArgc, fakeArgs.data());
|
||||||
|
|
||||||
|
|
||||||
// 初始化日志模块 (默认日志位置 ~/.cache/deepin/spark-store)
|
// 初始化日志模块 (默认日志位置 ~/.cache/deepin/spark-store)
|
||||||
DLogManager::registerConsoleAppender();
|
DLogManager::registerConsoleAppender();
|
||||||
DLogManager::registerFileAppender();
|
DLogManager::registerFileAppender();
|
||||||
|
|
||||||
|
|
||||||
// Wayland 环境下使用,防止子控件 Native 化
|
// Wayland 环境下使用,防止子控件 Native 化
|
||||||
if (!DPlatformWindowHandle::pluginVersion().isEmpty()) {
|
if (!DPlatformWindowHandle::pluginVersion().isEmpty())
|
||||||
|
{
|
||||||
a.setAttribute(Qt::AA_DontCreateNativeWidgetSiblings, true);
|
a.setAttribute(Qt::AA_DontCreateNativeWidgetSiblings, true);
|
||||||
}
|
}
|
||||||
a.setAttribute(Qt::AA_UseHighDpiPixmaps);
|
a.setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||||
@ -74,7 +76,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
QSettings readConfig(QDir::homePath() + "/.config/spark-store/config.ini", QSettings::IniFormat);
|
QSettings readConfig(QDir::homePath() + "/.config/spark-store/config.ini", QSettings::IniFormat);
|
||||||
|
|
||||||
if (readConfig.value("build/version").toString() != version){
|
if (readConfig.value("build/version").toString() != version)
|
||||||
|
{
|
||||||
qDebug() << "Spark Store has been updated!";
|
qDebug() << "Spark Store has been updated!";
|
||||||
QSettings *setConfig = new QSettings(QDir::homePath() + "/.config/spark-store/config.ini", QSettings::IniFormat);
|
QSettings *setConfig = new QSettings(QDir::homePath() + "/.config/spark-store/config.ini", QSettings::IniFormat);
|
||||||
setConfig->setValue("build/version", version);
|
setConfig->setValue("build/version", version);
|
||||||
@ -94,9 +97,7 @@ int main(int argc, char *argv[])
|
|||||||
QObject::tr(
|
QObject::tr(
|
||||||
"<span style=' font-size:10pt;font-weight:60;'>An appstore powered by community</span><br/>"
|
"<span style=' font-size:10pt;font-weight:60;'>An appstore powered by community</span><br/>"
|
||||||
"<a href='https://www.spark-app.store/'>https://www.spark-app.store</a><br/>"
|
"<a href='https://www.spark-app.store/'>https://www.spark-app.store</a><br/>"
|
||||||
"<span style=' font-size:12pt;'>Spark developers</span>"
|
"<span style=' font-size:12pt;'>Spark developers</span>"));
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
dialog.setProductName(QLabel::tr("Spark Store"));
|
dialog.setProductName(QLabel::tr("Spark Store"));
|
||||||
dialog.setCompanyLogo(QPixmap(":/spark-store.png"));
|
dialog.setCompanyLogo(QPixmap(":/spark-store.png"));
|
||||||
@ -113,9 +114,7 @@ int main(int argc, char *argv[])
|
|||||||
"<span style='font-size:10pt;font-weight:60;'>An appstore powered by deepin community</span><br/>"
|
"<span style='font-size:10pt;font-weight:60;'>An appstore powered by deepin community</span><br/>"
|
||||||
"<a href='https://www.spark-app.store/'>https://www.spark-app.store</a><br/>"
|
"<a href='https://www.spark-app.store/'>https://www.spark-app.store</a><br/>"
|
||||||
"<span style='font-size:12pt;'>Spark developers</span><br/><br/>"
|
"<span style='font-size:12pt;'>Spark developers</span><br/><br/>"
|
||||||
"Published under GPL V3"
|
"Published under GPL V3"));
|
||||||
)
|
|
||||||
);
|
|
||||||
// 限制单实例运行
|
// 限制单实例运行
|
||||||
if (!a.setSingleInstance("spark-store"))
|
if (!a.setSingleInstance("spark-store"))
|
||||||
{
|
{
|
||||||
@ -129,7 +128,6 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
iface.asyncCall("activeWindow", arg1);
|
iface.asyncCall("activeWindow", arg1);
|
||||||
|
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,7 +139,8 @@ int main(int argc, char *argv[])
|
|||||||
Dtk::Widget::moveToCenter(&w);
|
Dtk::Widget::moveToCenter(&w);
|
||||||
|
|
||||||
QString arg1 = argv[1];
|
QString arg1 = argv[1];
|
||||||
if (arg1.startsWith("spk://")) {
|
if (arg1.startsWith("spk://"))
|
||||||
|
{
|
||||||
w.openUrl(QUrl(argv[1]));
|
w.openUrl(QUrl(argv[1]));
|
||||||
}
|
}
|
||||||
w.show();
|
w.show();
|
||||||
|
@ -11,8 +11,7 @@
|
|||||||
#define AppPageSettings 3
|
#define AppPageSettings 3
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent)
|
MainWindow::MainWindow(QWidget *parent)
|
||||||
: BaseWidgetOpacity(parent)
|
: BaseWidgetOpacity(parent), ui(new Ui::MainWindow)
|
||||||
, ui(new Ui::MainWindow)
|
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
initConfig();
|
initConfig();
|
||||||
@ -42,12 +41,14 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
menu->addAction(actionSubmissionWithClient);
|
menu->addAction(actionSubmissionWithClient);
|
||||||
|
|
||||||
ui->titlebar->setMenu(menu);
|
ui->titlebar->setMenu(menu);
|
||||||
connect(actionSubmission, &QAction::triggered, this, [=]{QDesktopServices::openUrl(QUrl("https://upload.deepinos.org/"));});
|
connect(actionSubmission, &QAction::triggered, this, [=]
|
||||||
connect(setting, &QAction::triggered, this, [=]{
|
{ QDesktopServices::openUrl(QUrl("https://upload.deepinos.org/")); });
|
||||||
|
connect(setting, &QAction::triggered, this, [=]
|
||||||
|
{
|
||||||
switchPage(AppPageSettings);
|
switchPage(AppPageSettings);
|
||||||
ui->settingspage->updateUI();
|
ui->settingspage->updateUI(); });
|
||||||
});
|
connect(upgrade, &QAction::triggered, this, [=]
|
||||||
connect(upgrade, &QAction::triggered, this, [=]{QProcess::startDetached("/opt/durapps/spark-store/bin/update-upgrade/ss-update-controler.sh");});
|
{ QProcess::startDetached("/opt/durapps/spark-store/bin/update-upgrade/ss-update-controler.sh"); });
|
||||||
// 投稿器
|
// 投稿器
|
||||||
connect(actionSubmissionWithClient, &QAction::triggered, this, [=]
|
connect(actionSubmissionWithClient, &QAction::triggered, this, [=]
|
||||||
{
|
{
|
||||||
@ -58,16 +59,16 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
qDebug() << "投稿器存在";
|
qDebug() << "投稿器存在";
|
||||||
QProcess::startDetached("/opt/spark-store-submitter/bin/spark-store-submitter");
|
QProcess::startDetached("/opt/spark-store-submitter/bin/spark-store-submitter");
|
||||||
}
|
}
|
||||||
else{
|
else
|
||||||
|
{
|
||||||
qDebug() << "投稿器不存在,跳转页面";
|
qDebug() << "投稿器不存在,跳转页面";
|
||||||
openUrl(submitterSpk);
|
openUrl(submitterSpk);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// 主题切换
|
// 主题切换
|
||||||
connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, this, [=](DGuiApplicationHelper::ColorType themeType) {
|
connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, this, [=](DGuiApplicationHelper::ColorType themeType)
|
||||||
|
{
|
||||||
if (themeType == DGuiApplicationHelper::DarkType) {
|
if (themeType == DGuiApplicationHelper::DarkType) {
|
||||||
//深色模式
|
//深色模式
|
||||||
setMaskColor(QColor("#2a2b2b"));
|
setMaskColor(QColor("#2a2b2b"));
|
||||||
@ -123,32 +124,32 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
ui->applistpage->setTheme(themeType == DGuiApplicationHelper::DarkType);
|
ui->applistpage->setTheme(themeType == DGuiApplicationHelper::DarkType);
|
||||||
ui->applistpage_1->setTheme(themeType == DGuiApplicationHelper::DarkType);
|
ui->applistpage_1->setTheme(themeType == DGuiApplicationHelper::DarkType);
|
||||||
ui->appintopage->setTheme(themeType == DGuiApplicationHelper::DarkType);
|
ui->appintopage->setTheme(themeType == DGuiApplicationHelper::DarkType);
|
||||||
ui->settingspage->setTheme(themeType == DGuiApplicationHelper::DarkType);
|
ui->settingspage->setTheme(themeType == DGuiApplicationHelper::DarkType); });
|
||||||
});
|
|
||||||
|
|
||||||
// 初始化标题栏控件
|
// 初始化标题栏控件
|
||||||
connect(downloadButton, &ProgressButton::clicked, [=]() {
|
connect(downloadButton, &ProgressButton::clicked, [=]()
|
||||||
|
{
|
||||||
QPoint pos;
|
QPoint pos;
|
||||||
pos.setX(downloadButton->mapToGlobal(QPoint(0, 0)).x() + downloadButton->width() / 2 - downloadlistwidget->width() / 2);
|
pos.setX(downloadButton->mapToGlobal(QPoint(0, 0)).x() + downloadButton->width() / 2 - downloadlistwidget->width() / 2);
|
||||||
pos.setY(downloadButton->mapToGlobal(QPoint(0, 0)).y() + downloadButton->height() + 5);
|
pos.setY(downloadButton->mapToGlobal(QPoint(0, 0)).y() + downloadButton->height() + 5);
|
||||||
downloadlistwidget->m_move(pos.x(), pos.y());
|
downloadlistwidget->m_move(pos.x(), pos.y());
|
||||||
downloadlistwidget->show();
|
downloadlistwidget->show(); });
|
||||||
});
|
|
||||||
|
|
||||||
// appintopage按下下载按钮时标题栏下载列表按钮抖动
|
// appintopage按下下载按钮时标题栏下载列表按钮抖动
|
||||||
connect(ui->appintopage, &AppIntoPage::clickedDownloadBtn, [=]() {
|
connect(ui->appintopage, &AppIntoPage::clickedDownloadBtn, [=]()
|
||||||
|
{
|
||||||
WidgetAnimation::widgetShake(downloadButton, 6); // 第一个参数是抖动的控件,第二个参数是抖动范围(像素)
|
WidgetAnimation::widgetShake(downloadButton, 6); // 第一个参数是抖动的控件,第二个参数是抖动范围(像素)
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(backButtom, &QPushButton::clicked, [=]() {
|
connect(backButtom, &QPushButton::clicked, [=]()
|
||||||
|
{
|
||||||
ui->stackedWidget->setCurrentIndex(pageHistory.at(pageHistory.count() - 2));
|
ui->stackedWidget->setCurrentIndex(pageHistory.at(pageHistory.count() - 2));
|
||||||
pageHistory.removeLast();
|
pageHistory.removeLast();
|
||||||
if (pageHistory.count() > 1) {
|
if (pageHistory.count() > 1) {
|
||||||
backButtom->show();
|
backButtom->show();
|
||||||
} else {
|
} else {
|
||||||
backButtom->hide();
|
backButtom->hide();
|
||||||
}
|
} });
|
||||||
});
|
|
||||||
downloadlistwidget->hide();
|
downloadlistwidget->hide();
|
||||||
backButtom->hide();
|
backButtom->hide();
|
||||||
ui->titlebar->setIcon(QIcon::fromTheme(":/icon/logo.svg"));
|
ui->titlebar->setIcon(QIcon::fromTheme(":/icon/logo.svg"));
|
||||||
@ -166,19 +167,21 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
ui->titlebar->setCustomWidget(w_titlebar);
|
ui->titlebar->setCustomWidget(w_titlebar);
|
||||||
// 侧边栏按钮
|
// 侧边栏按钮
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (i < ui->buttonGroup->buttons().size()) {
|
while (i < ui->buttonGroup->buttons().size())
|
||||||
|
{
|
||||||
ui->buttonGroup->buttons()[i]->setStyleSheet("QPushButton{qproperty-icon: url(data/images/userMangaer/teacher.png);}");
|
ui->buttonGroup->buttons()[i]->setStyleSheet("QPushButton{qproperty-icon: url(data/images/userMangaer/teacher.png);}");
|
||||||
connect(ui->buttonGroup->buttons()[i], &QPushButton::toggled, [=](bool checked) {
|
connect(ui->buttonGroup->buttons()[i], &QPushButton::toggled, [=](bool checked)
|
||||||
|
{
|
||||||
if (checked == true) {
|
if (checked == true) {
|
||||||
searchEdit->clearEdit();
|
searchEdit->clearEdit();
|
||||||
updateUi(i);
|
updateUi(i);
|
||||||
}
|
} });
|
||||||
});
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 搜索事件
|
// 搜索事件
|
||||||
connect(searchEdit, &DSearchEdit::returnPressed, this, [=]() {
|
connect(searchEdit, &DSearchEdit::returnPressed, this, [=]()
|
||||||
|
{
|
||||||
QString searchtext = searchEdit->text();
|
QString searchtext = searchEdit->text();
|
||||||
if (!searchtext.isEmpty()) {
|
if (!searchtext.isEmpty()) {
|
||||||
if (searchtext.startsWith("spk://")) {
|
if (searchtext.startsWith("spk://")) {
|
||||||
@ -189,22 +192,17 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
switchPage(AppPageSearchlist);
|
switchPage(AppPageSearchlist);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this->setFocus();
|
this->setFocus(); });
|
||||||
});
|
|
||||||
|
|
||||||
connect(downloadlistwidget, &DownloadListWidget::downloadProgress, this, [=](int i) {
|
connect(downloadlistwidget, &DownloadListWidget::downloadProgress, this, [=](int i)
|
||||||
downloadButton->setProgress(i);
|
{ downloadButton->setProgress(i); });
|
||||||
});
|
|
||||||
// 列表点击事件
|
// 列表点击事件
|
||||||
connect(ui->applistpage, &AppListPage::clicked, this, [=](QUrl spk) {
|
connect(ui->applistpage, &AppListPage::clicked, this, [=](QUrl spk)
|
||||||
openUrl(spk);
|
{ openUrl(spk); });
|
||||||
});
|
connect(ui->applistpage_1, &AppListPage::clicked, this, [=](QUrl spk)
|
||||||
connect(ui->applistpage_1, &AppListPage::clicked, this, [=](QUrl spk) {
|
{ openUrl(spk); });
|
||||||
openUrl(spk);
|
connect(ui->settingspage, &SettingsPage::openUrl, this, [=](QUrl spk)
|
||||||
});
|
{ openUrl(spk); });
|
||||||
connect(ui->settingspage, &SettingsPage::openUrl, this, [=](QUrl spk) {
|
|
||||||
openUrl(spk);
|
|
||||||
});
|
|
||||||
emit DGuiApplicationHelper::instance()->themeTypeChanged(DGuiApplicationHelper::instance()->themeType());
|
emit DGuiApplicationHelper::instance()->themeTypeChanged(DGuiApplicationHelper::instance()->themeType());
|
||||||
|
|
||||||
initDbus();
|
initDbus();
|
||||||
@ -237,10 +235,13 @@ void MainWindow::onGetUrl(const QString &url)
|
|||||||
|
|
||||||
void MainWindow::openUrl(QUrl url)
|
void MainWindow::openUrl(QUrl url)
|
||||||
{
|
{
|
||||||
if (url.toString().startsWith("spk://")) {
|
if (url.toString().startsWith("spk://"))
|
||||||
|
{
|
||||||
ui->appintopage->openUrl(QUrl(url.toString().replace("+", "%2B")));
|
ui->appintopage->openUrl(QUrl(url.toString().replace("+", "%2B")));
|
||||||
switchPage(AppPageAppdetail);
|
switchPage(AppPageAppdetail);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
QDesktopServices::openUrl(QUrl(url.toString().replace("+", "%2B")));
|
QDesktopServices::openUrl(QUrl(url.toString().replace("+", "%2B")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -255,9 +256,12 @@ void MainWindow::initConfig()
|
|||||||
void MainWindow::switchPage(int now) // 临时方案,回家后修改
|
void MainWindow::switchPage(int now) // 临时方案,回家后修改
|
||||||
{
|
{
|
||||||
qDebug() << pageHistory.count();
|
qDebug() << pageHistory.count();
|
||||||
if (pageHistory.count() >= 1) {
|
if (pageHistory.count() >= 1)
|
||||||
|
{
|
||||||
backButtom->show();
|
backButtom->show();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
backButtom->hide();
|
backButtom->hide();
|
||||||
}
|
}
|
||||||
ui->stackedWidget->setCurrentIndex(now);
|
ui->stackedWidget->setCurrentIndex(now);
|
||||||
@ -290,12 +294,13 @@ void MainWindow::updateUi(int now)
|
|||||||
void MainWindow::on_pushButton_14_clicked()
|
void MainWindow::on_pushButton_14_clicked()
|
||||||
{
|
{
|
||||||
QFile upgradeStatus("/tmp/spark-store/upgradeStatus.txt");
|
QFile upgradeStatus("/tmp/spark-store/upgradeStatus.txt");
|
||||||
if (!upgradeStatus.exists()){
|
if (!upgradeStatus.exists())
|
||||||
QtConcurrent::run([=]{
|
{
|
||||||
|
QtConcurrent::run([=]
|
||||||
|
{
|
||||||
auto upgradeP = new QProcess();
|
auto upgradeP = new QProcess();
|
||||||
upgradeP->startDetached("/opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade.sh");
|
upgradeP->startDetached("/opt/durapps/spark-store/bin/update-upgrade/ss-do-upgrade.sh");
|
||||||
upgradeP->waitForStarted();
|
upgradeP->waitForStarted();
|
||||||
upgradeP->waitForFinished(-1);
|
upgradeP->waitForFinished(-1); });
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#include "appintopage.h"
|
#include "appintopage.h"
|
||||||
#include "ui_appintopage.h"
|
#include "ui_appintopage.h"
|
||||||
AppIntoPage::AppIntoPage(QWidget *parent) :
|
AppIntoPage::AppIntoPage(QWidget *parent) : QWidget(parent),
|
||||||
QWidget(parent),
|
|
||||||
ui(new Ui::AppIntoPage)
|
ui(new Ui::AppIntoPage)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
@ -10,11 +9,11 @@ AppIntoPage::AppIntoPage(QWidget *parent) :
|
|||||||
ui->listWidget->setMaximumHeight(200);
|
ui->listWidget->setMaximumHeight(200);
|
||||||
ui->listWidget->setFlow(QListView::TopToBottom);
|
ui->listWidget->setFlow(QListView::TopToBottom);
|
||||||
api1 = new SparkAPI(this);
|
api1 = new SparkAPI(this);
|
||||||
connect(api1,&SparkAPI::finishedRAW,[=](QString download_times){
|
connect(api1, &SparkAPI::finishedRAW, [=](QString download_times)
|
||||||
|
{
|
||||||
download_times.remove(QRegExp("\\n"));
|
download_times.remove(QRegExp("\\n"));
|
||||||
ui->download_times->setText(download_times);
|
ui->download_times->setText(download_times);
|
||||||
qDebug()<<"Download Times:"+download_times;
|
qDebug()<<"Download Times:"+download_times; });
|
||||||
});
|
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,16 +49,16 @@ void AppIntoPage::clear()
|
|||||||
void AppIntoPage::setDownloadWidget(DownloadListWidget *w)
|
void AppIntoPage::setDownloadWidget(DownloadListWidget *w)
|
||||||
{
|
{
|
||||||
dw = w;
|
dw = w;
|
||||||
connect(w, &DownloadListWidget::downloadFinished, [=]() {
|
connect(w, &DownloadListWidget::downloadFinished, [=]()
|
||||||
isDownloading(SparkAPI::getServerUrl()+"store"+spk.path()+"/"+info["Filename"].toString());
|
{ isDownloading(SparkAPI::getServerUrl() + "store" + spk.path() + "/" + info["Filename"].toString()); });
|
||||||
});
|
|
||||||
}
|
}
|
||||||
void AppIntoPage::openUrl(QUrl url)
|
void AppIntoPage::openUrl(QUrl url)
|
||||||
{
|
{
|
||||||
spk = url;
|
spk = url;
|
||||||
SparkAPI *api = new SparkAPI(this);
|
SparkAPI *api = new SparkAPI(this);
|
||||||
clear();
|
clear();
|
||||||
connect(api,&SparkAPI::finishedObject,[=](QJsonObject appinfo){
|
connect(api, &SparkAPI::finishedObject, [=](QJsonObject appinfo)
|
||||||
|
{
|
||||||
|
|
||||||
info = appinfo;
|
info = appinfo;
|
||||||
// qDebug()<<url;
|
// qDebug()<<url;
|
||||||
@ -188,36 +187,42 @@ void AppIntoPage::openUrl(QUrl url)
|
|||||||
}
|
}
|
||||||
this->sltAppinfoTags(&taglist);
|
this->sltAppinfoTags(&taglist);
|
||||||
disconnect(api,&SparkAPI::finished,nullptr,nullptr);
|
disconnect(api,&SparkAPI::finished,nullptr,nullptr);
|
||||||
api->deleteLater();
|
api->deleteLater(); });
|
||||||
});
|
|
||||||
api->getAppInfo(url);
|
api->getAppInfo(url);
|
||||||
api1->getAppDownloadTimes(url);
|
api1->getAppDownloadTimes(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppIntoPage::isDownloading(QUrl url)
|
void AppIntoPage::isDownloading(QUrl url)
|
||||||
{
|
{
|
||||||
if (dw->getUrlList().lastIndexOf(url) == -1) {
|
if (dw->getUrlList().lastIndexOf(url) == -1)
|
||||||
|
{
|
||||||
ui->downloadButton->setEnabled(true);
|
ui->downloadButton->setEnabled(true);
|
||||||
return;
|
return;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
ui->downloadButton->setEnabled(false);
|
ui->downloadButton->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->pushButton_3->hide();
|
ui->pushButton_3->hide();
|
||||||
if (dw->getDIList()[dw->getUrlList().lastIndexOf(url)]->download == 2) {
|
if (dw->getDIList()[dw->getUrlList().lastIndexOf(url)]->download == 2)
|
||||||
|
{
|
||||||
ui->downloadButton->setEnabled(true);
|
ui->downloadButton->setEnabled(true);
|
||||||
ui->downloadButton->setText(tr("Download"));
|
ui->downloadButton->setText(tr("Download"));
|
||||||
}
|
}
|
||||||
if (dw->getDIList()[dw->getUrlList().lastIndexOf(url)]->download == 1) {
|
if (dw->getDIList()[dw->getUrlList().lastIndexOf(url)]->download == 1)
|
||||||
|
{
|
||||||
ui->downloadButton->setEnabled(true);
|
ui->downloadButton->setEnabled(true);
|
||||||
ui->downloadButton->setText(tr("Install"));
|
ui->downloadButton->setText(tr("Install"));
|
||||||
}
|
}
|
||||||
if (dw->getDIList()[dw->getUrlList().lastIndexOf(url)]->isInstall) {
|
if (dw->getDIList()[dw->getUrlList().lastIndexOf(url)]->isInstall)
|
||||||
|
{
|
||||||
ui->downloadButton->setEnabled(false);
|
ui->downloadButton->setEnabled(false);
|
||||||
ui->downloadButton->setText(tr("Installing"));
|
ui->downloadButton->setText(tr("Installing"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (dw->getDIList()[dw->getUrlList().lastIndexOf(url)]->download == 3) {
|
if (dw->getDIList()[dw->getUrlList().lastIndexOf(url)]->download == 3)
|
||||||
|
{
|
||||||
ui->downloadButton->setEnabled(true);
|
ui->downloadButton->setEnabled(true);
|
||||||
ui->downloadButton->setText(tr("Reinstall"));
|
ui->downloadButton->setText(tr("Reinstall"));
|
||||||
ui->downloadButton->show();
|
ui->downloadButton->show();
|
||||||
@ -279,7 +284,9 @@ void AppIntoPage::setTheme(bool dark)
|
|||||||
ui->icon_4->setPixmap(QPixmap(":/icon/dark/text.svg"));
|
ui->icon_4->setPixmap(QPixmap(":/icon/dark/text.svg"));
|
||||||
ui->icon_5->setPixmap(QPixmap(":/icon/dark/folder.svg"));
|
ui->icon_5->setPixmap(QPixmap(":/icon/dark/folder.svg"));
|
||||||
ui->icon_6->setPixmap(QPixmap(":/icon/dark/globe.svg"));
|
ui->icon_6->setPixmap(QPixmap(":/icon/dark/globe.svg"));
|
||||||
}else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// 亮色模式
|
// 亮色模式
|
||||||
QString frameStyleSheet = "#frame,#frame_2,#frame_3,#frame_4{background-color: #fbfbfb;border-radius:14px;border:1px solid rgb(229,229,229);}";
|
QString frameStyleSheet = "#frame,#frame_2,#frame_3,#frame_4{background-color: #fbfbfb;border-radius:14px;border:1px solid rgb(229,229,229);}";
|
||||||
ui->frame->setStyleSheet(frameStyleSheet);
|
ui->frame->setStyleSheet(frameStyleSheet);
|
||||||
@ -293,7 +300,6 @@ void AppIntoPage::setTheme(bool dark)
|
|||||||
ui->icon_4->setPixmap(QPixmap(":/icon/light/text.svg"));
|
ui->icon_4->setPixmap(QPixmap(":/icon/light/text.svg"));
|
||||||
ui->icon_5->setPixmap(QPixmap(":/icon/light/folder.svg"));
|
ui->icon_5->setPixmap(QPixmap(":/icon/light/folder.svg"));
|
||||||
ui->icon_6->setPixmap(QPixmap(":/icon/light/globe.svg"));
|
ui->icon_6->setPixmap(QPixmap(":/icon/light/globe.svg"));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AppIntoPage::~AppIntoPage()
|
AppIntoPage::~AppIntoPage()
|
||||||
@ -307,10 +313,10 @@ void AppIntoPage::on_downloadButton_clicked()
|
|||||||
{
|
{
|
||||||
dw->getDIList()[dw->getUrlList().lastIndexOf(SparkAPI::getServerUrl() + "store" + spk.path() + "/" + info["Filename"].toString())]->install(0);
|
dw->getDIList()[dw->getUrlList().lastIndexOf(SparkAPI::getServerUrl() + "store" + spk.path() + "/" + info["Filename"].toString())]->install(0);
|
||||||
isDownloading(SparkAPI::getServerUrl() + "store" + spk.path() + "/" + info["Filename"].toString());
|
isDownloading(SparkAPI::getServerUrl() + "store" + spk.path() + "/" + info["Filename"].toString());
|
||||||
QObject::connect(dw->getDIList()[dw->getUrlList().lastIndexOf(SparkAPI::getServerUrl()+"store"+spk.path()+"/"+info["Filename"].toString())],&DownloadItem::finished,[=](){
|
QObject::connect(dw->getDIList()[dw->getUrlList().lastIndexOf(SparkAPI::getServerUrl() + "store" + spk.path() + "/" + info["Filename"].toString())], &DownloadItem::finished, [=]()
|
||||||
|
{
|
||||||
isDownloading(SparkAPI::getServerUrl()+"store"+spk.path()+"/"+info["Filename"].toString());
|
isDownloading(SparkAPI::getServerUrl()+"store"+spk.path()+"/"+info["Filename"].toString());
|
||||||
disconnect(dw->getDIList()[dw->getUrlList().lastIndexOf(SparkAPI::getServerUrl()+"store"+spk.path()+"/"+info["Filename"].toString())],&DownloadItem::finished,nullptr,nullptr);
|
disconnect(dw->getDIList()[dw->getUrlList().lastIndexOf(SparkAPI::getServerUrl()+"store"+spk.path()+"/"+info["Filename"].toString())],&DownloadItem::finished,nullptr,nullptr); });
|
||||||
});
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
emit clickedDownloadBtn();
|
emit clickedDownloadBtn();
|
||||||
@ -320,10 +326,10 @@ void AppIntoPage::on_downloadButton_clicked()
|
|||||||
dw->getDIList()[dw->allDownload - 1]->reinstall = true;
|
dw->getDIList()[dw->allDownload - 1]->reinstall = true;
|
||||||
}
|
}
|
||||||
ui->downloadButton->setEnabled(false);
|
ui->downloadButton->setEnabled(false);
|
||||||
QObject::connect(dw->getDIList()[dw->getUrlList().lastIndexOf(SparkAPI::getServerUrl()+"store"+spk.path()+"/"+info["Filename"].toString())],&DownloadItem::finished,[=](){
|
QObject::connect(dw->getDIList()[dw->getUrlList().lastIndexOf(SparkAPI::getServerUrl() + "store" + spk.path() + "/" + info["Filename"].toString())], &DownloadItem::finished, [=]()
|
||||||
|
{
|
||||||
isDownloading(SparkAPI::getServerUrl()+"store"+spk.path()+"/"+info["Filename"].toString());
|
isDownloading(SparkAPI::getServerUrl()+"store"+spk.path()+"/"+info["Filename"].toString());
|
||||||
disconnect(dw->getDIList()[dw->getUrlList().lastIndexOf(SparkAPI::getServerUrl()+"store"+spk.path()+"/"+info["Filename"].toString())],&DownloadItem::finished,nullptr,nullptr);
|
disconnect(dw->getDIList()[dw->getUrlList().lastIndexOf(SparkAPI::getServerUrl()+"store"+spk.path()+"/"+info["Filename"].toString())],&DownloadItem::finished,nullptr,nullptr); });
|
||||||
});
|
|
||||||
isDownloading(SparkAPI::getServerUrl() + "store" + spk.path() + "/" + info["Filename"].toString());
|
isDownloading(SparkAPI::getServerUrl() + "store" + spk.path() + "/" + info["Filename"].toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -352,8 +358,7 @@ void AppIntoPage::on_pushButton_3_clicked()
|
|||||||
}
|
}
|
||||||
|
|
||||||
ui->downloadButton->setEnabled(true);
|
ui->downloadButton->setEnabled(true);
|
||||||
ui->pushButton_3->setEnabled(true);
|
ui->pushButton_3->setEnabled(true); });
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppIntoPage::on_shareButton_clicked()
|
void AppIntoPage::on_shareButton_clicked()
|
||||||
@ -364,7 +369,6 @@ void AppIntoPage::on_shareButton_clicked()
|
|||||||
clipboard->setText(spk.toString());
|
clipboard->setText(spk.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AppIntoPage::on_updateButton_clicked()
|
void AppIntoPage::on_updateButton_clicked()
|
||||||
{
|
{
|
||||||
QString feedbackSpk = "spk://store/chat/store.spark-app.feedback";
|
QString feedbackSpk = "spk://store/chat/store.spark-app.feedback";
|
||||||
@ -374,9 +378,9 @@ void AppIntoPage::on_updateButton_clicked()
|
|||||||
qDebug() << "反馈器存在";
|
qDebug() << "反馈器存在";
|
||||||
QProcess::startDetached("sh /opt/durapps/store.spark-app.feedback/launch.sh");
|
QProcess::startDetached("sh /opt/durapps/store.spark-app.feedback/launch.sh");
|
||||||
}
|
}
|
||||||
else{
|
else
|
||||||
|
{
|
||||||
qDebug() << "反馈器不存在,跳转页面";
|
qDebug() << "反馈器不存在,跳转页面";
|
||||||
openUrl(feedbackSpk);
|
openUrl(feedbackSpk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
#include "applistpage.h"
|
#include "applistpage.h"
|
||||||
#include "ui_applistpage.h"
|
#include "ui_applistpage.h"
|
||||||
|
|
||||||
AppListPage::AppListPage(QWidget *parent) :
|
AppListPage::AppListPage(QWidget *parent) : QWidget(parent),
|
||||||
QWidget(parent),
|
|
||||||
ui(new Ui::AppListPage)
|
ui(new Ui::AppListPage)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
@ -14,14 +13,18 @@ void AppListPage::setTheme(bool dark)
|
|||||||
if (dark)
|
if (dark)
|
||||||
{
|
{
|
||||||
this->setStyleSheet("#frame{background-color: #252525;border-radius:14px;border:1px solid rgb(64, 64, 64);}");
|
this->setStyleSheet("#frame{background-color: #252525;border-radius:14px;border:1px solid rgb(64, 64, 64);}");
|
||||||
}else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// 亮色模式
|
// 亮色模式
|
||||||
this->setStyleSheet("#frame{background-color: #ffffff;border-radius:14px;border:1px solid rgb(229,229,229);}");
|
this->setStyleSheet("#frame{background-color: #ffffff;border-radius:14px;border:1px solid rgb(229,229,229);}");
|
||||||
}
|
}
|
||||||
if (isSearch)
|
if (isSearch)
|
||||||
{
|
{
|
||||||
getSearchList(nowType);
|
getSearchList(nowType);
|
||||||
}else{
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
getAppList(nowType);
|
getAppList(nowType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -35,13 +38,17 @@ void AppListPage::getAppList(QString type)
|
|||||||
if (isDark)
|
if (isDark)
|
||||||
{
|
{
|
||||||
theme = "theme=dark";
|
theme = "theme=dark";
|
||||||
}else{
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
theme = "theme=light";
|
theme = "theme=light";
|
||||||
}
|
}
|
||||||
if (type == "")
|
if (type == "")
|
||||||
{
|
{
|
||||||
url = api->getServerUrl() + "store/#/flamescion/?" + theme;
|
url = api->getServerUrl() + "store/#/flamescion/?" + theme;
|
||||||
}else{
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
url = api->getServerUrl() + "store/#/flamescion/applist?type=" + type + "&" + theme;
|
url = api->getServerUrl() + "store/#/flamescion/applist?type=" + type + "&" + theme;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,7 +65,9 @@ void AppListPage::getSearchList(QString keyword)
|
|||||||
if (isDark)
|
if (isDark)
|
||||||
{
|
{
|
||||||
theme = "theme=dark";
|
theme = "theme=dark";
|
||||||
}else{
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
theme = "theme=light";
|
theme = "theme=light";
|
||||||
}
|
}
|
||||||
url = api->getServerUrl() + "store/#/flamescion/search?keywords=" + keyword + "&" + theme;
|
url = api->getServerUrl() + "store/#/flamescion/search?keywords=" + keyword + "&" + theme;
|
||||||
@ -83,4 +92,3 @@ void AppListPage::on_webEngineView_urlChanged(const QUrl &arg1)
|
|||||||
emit clicked(url);
|
emit clicked(url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
#include "settingspage.h"
|
#include "settingspage.h"
|
||||||
#include "ui_settingspage.h"
|
#include "ui_settingspage.h"
|
||||||
bool SettingsPage::isdownload = false;
|
bool SettingsPage::isdownload = false;
|
||||||
SettingsPage::SettingsPage(QWidget *parent) :
|
SettingsPage::SettingsPage(QWidget *parent) : QWidget(parent),
|
||||||
QWidget(parent),
|
|
||||||
ui(new Ui::SettingsPage)
|
ui(new Ui::SettingsPage)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
@ -15,7 +14,9 @@ void SettingsPage::setTheme(bool dark)
|
|||||||
if (dark)
|
if (dark)
|
||||||
{
|
{
|
||||||
this->setStyleSheet("#frame{background-color: #252525;border-radius:14px;border:1px solid rgb(64, 64, 64);}");
|
this->setStyleSheet("#frame{background-color: #252525;border-radius:14px;border:1px solid rgb(64, 64, 64);}");
|
||||||
}else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// 亮色模式
|
// 亮色模式
|
||||||
this->setStyleSheet("#frame{background-color: #ffffff;border-radius:14px;border:1px solid rgb(229,229,229);}");
|
this->setStyleSheet("#frame{background-color: #ffffff;border-radius:14px;border:1px solid rgb(229,229,229);}");
|
||||||
}
|
}
|
||||||
@ -97,11 +98,9 @@ void SettingsPage::on_pushButton_updateServer_clicked()
|
|||||||
|
|
||||||
ui->pushButton_updateServer->setEnabled(true);
|
ui->pushButton_updateServer->setEnabled(true);
|
||||||
readServerList();
|
readServerList();
|
||||||
ui->comboBox_server->setCurrentIndex(0);
|
ui->comboBox_server->setCurrentIndex(0); });
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SettingsPage::on_comboBox_server_currentIndexChanged(const QString &arg1)
|
void SettingsPage::on_comboBox_server_currentIndexChanged(const QString &arg1)
|
||||||
{
|
{
|
||||||
SparkAPI::setServerUrl(arg1); // 服务器信息更新
|
SparkAPI::setServerUrl(arg1); // 服务器信息更新
|
||||||
@ -184,11 +183,9 @@ void SettingsPage::on_pushButton_updateApt_clicked()
|
|||||||
emit openUrl(QUrl("spk://store/tools/spark-store"));
|
emit openUrl(QUrl("spk://store/tools/spark-store"));
|
||||||
ui->label_aptserver->setText(tr(""));
|
ui->label_aptserver->setText(tr(""));
|
||||||
|
|
||||||
ui->pushButton_updateApt->setEnabled(true);
|
ui->pushButton_updateApt->setEnabled(true); });
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SettingsPage::on_pushButton_clear_clicked()
|
void SettingsPage::on_pushButton_clear_clicked()
|
||||||
{
|
{
|
||||||
QtConcurrent::run([=]()
|
QtConcurrent::run([=]()
|
||||||
@ -204,11 +201,9 @@ void SettingsPage::on_pushButton_clear_clicked()
|
|||||||
}
|
}
|
||||||
Utils::sendNotification("spark-store",tr("Spark Store"),tr("Temporary cache was cleaned"));
|
Utils::sendNotification("spark-store",tr("Spark Store"),tr("Temporary cache was cleaned"));
|
||||||
ui->pushButton_clear->setEnabled(true);
|
ui->pushButton_clear->setEnabled(true);
|
||||||
updateUI();
|
updateUI(); });
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SettingsPage::on_pushButton_clearWebCache_clicked()
|
void SettingsPage::on_pushButton_clearWebCache_clicked()
|
||||||
{
|
{
|
||||||
QtConcurrent::run([=]()
|
QtConcurrent::run([=]()
|
||||||
@ -220,7 +215,5 @@ void SettingsPage::on_pushButton_clearWebCache_clicked()
|
|||||||
dataLocal = QStandardPaths::writableLocation(QStandardPaths::TempLocation);
|
dataLocal = QStandardPaths::writableLocation(QStandardPaths::TempLocation);
|
||||||
qDebug() << dataLocal;
|
qDebug() << dataLocal;
|
||||||
QDir cacheDir(dataLocal);
|
QDir cacheDir(dataLocal);
|
||||||
cacheDir.removeRecursively();
|
cacheDir.removeRecursively(); });
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,10 +1,7 @@
|
|||||||
#include "httprequest.h"
|
#include "httprequest.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
HttpRequest::HttpRequest()
|
HttpRequest::HttpRequest()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HttpRequest::getRequest(QNetworkRequest request)
|
void HttpRequest::getRequest(QNetworkRequest request)
|
||||||
|
@ -2,10 +2,9 @@
|
|||||||
|
|
||||||
Utils::Utils()
|
Utils::Utils()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//这个函数是chatGPT写的
|
// Author: chatGPT
|
||||||
void Utils::sendNotification(QString icon, QString title, QString body)
|
void Utils::sendNotification(QString icon, QString title, QString body)
|
||||||
{
|
{
|
||||||
QDBusInterface iface("org.freedesktop.Notifications",
|
QDBusInterface iface("org.freedesktop.Notifications",
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
WidgetAnimation::WidgetAnimation()
|
WidgetAnimation::WidgetAnimation()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WidgetAnimation::widgetShake(QWidget *pWidget, int nRange)
|
void WidgetAnimation::widgetShake(QWidget *pWidget, int nRange)
|
||||||
@ -16,7 +15,8 @@ void WidgetAnimation::widgetShake(QWidget *pWidget, int nRange)
|
|||||||
|
|
||||||
int nShakeCount = 8;
|
int nShakeCount = 8;
|
||||||
double nStep = 1.0 / nShakeCount;
|
double nStep = 1.0 / nShakeCount;
|
||||||
for(int i = 1; i < nShakeCount; i++){
|
for (int i = 1; i < nShakeCount; i++)
|
||||||
|
{
|
||||||
nRange = i & 1 ? -nRange : nRange;
|
nRange = i & 1 ? -nRange : nRange;
|
||||||
pAnimation->setKeyValueAt(nStep * i, QRect(QPoint(nX + nRange, nY), pWidget->size()));
|
pAnimation->setKeyValueAt(nStep * i, QRect(QPoint(nX + nRange, nY), pWidget->size()));
|
||||||
}
|
}
|
||||||
@ -38,7 +38,9 @@ QPropertyAnimation* WidgetAnimation::createWidgetOpacity(QWidget *pWidget, bool
|
|||||||
animation->setKeyValueAt(0, 0);
|
animation->setKeyValueAt(0, 0);
|
||||||
// m_animation->setKeyValueAt(0.5, 0);
|
// m_animation->setKeyValueAt(0.5, 0);
|
||||||
animation->setKeyValueAt(1, 1);
|
animation->setKeyValueAt(1, 1);
|
||||||
}else{
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
animation->setKeyValueAt(0, 1);
|
animation->setKeyValueAt(0, 1);
|
||||||
animation->setKeyValueAt(1, 0);
|
animation->setKeyValueAt(1, 0);
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,8 @@ BaseWidgetOpacity::BaseWidgetOpacity(QWidget *parent) : DBlurEffectWidget(parent
|
|||||||
/// @param event
|
/// @param event
|
||||||
void BaseWidgetOpacity::closeEvent(QCloseEvent *event)
|
void BaseWidgetOpacity::closeEvent(QCloseEvent *event)
|
||||||
{
|
{
|
||||||
if (!closeWindowAnimation) {
|
if (!closeWindowAnimation)
|
||||||
|
{
|
||||||
closeWindowAnimation = true;
|
closeWindowAnimation = true;
|
||||||
|
|
||||||
QPropertyAnimation *animation = new QPropertyAnimation(this, "windowOpacity");
|
QPropertyAnimation *animation = new QPropertyAnimation(this, "windowOpacity");
|
||||||
@ -21,18 +22,20 @@ void BaseWidgetOpacity::closeEvent(QCloseEvent *event)
|
|||||||
animation->setStartValue(1.0);
|
animation->setStartValue(1.0);
|
||||||
animation->setEndValue(0.0);
|
animation->setEndValue(0.0);
|
||||||
|
|
||||||
QObject::connect(animation, &QPropertyAnimation::valueChanged, this, [=](const QVariant &value){
|
QObject::connect(animation, &QPropertyAnimation::valueChanged, this, [=](const QVariant &value)
|
||||||
|
{
|
||||||
this->update();
|
this->update();
|
||||||
// setWindowTitle(QString("ヾ(⌒∇⌒*)See You♪ - %1%").arg(int(value.toFloat() * 100)));
|
// setWindowTitle(QString("ヾ(⌒∇⌒*)See You♪ - %1%").arg(int(value.toFloat() * 100)));
|
||||||
});
|
});
|
||||||
|
|
||||||
QObject::connect(animation, &QPropertyAnimation::finished, this, [=](){
|
QObject::connect(animation, &QPropertyAnimation::finished, this, [=]()
|
||||||
this->close();
|
{ this->close(); });
|
||||||
});
|
|
||||||
|
|
||||||
animation->start();
|
animation->start();
|
||||||
event->ignore();
|
event->ignore();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
event->accept();
|
event->accept();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,7 @@
|
|||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QtConcurrent>
|
#include <QtConcurrent>
|
||||||
|
|
||||||
big_image::big_image(DBlurEffectWidget *parent) :
|
big_image::big_image(DBlurEffectWidget *parent) : DBlurEffectWidget(parent),
|
||||||
DBlurEffectWidget(parent),
|
|
||||||
m_image(new QLabel)
|
m_image(new QLabel)
|
||||||
{
|
{
|
||||||
// setWindowFlags(this->windowFlags() | Qt::WindowStaysOnTopHint); // 设置图片对话框总在最前
|
// setWindowFlags(this->windowFlags() | Qt::WindowStaysOnTopHint); // 设置图片对话框总在最前
|
||||||
|
@ -6,8 +6,7 @@
|
|||||||
|
|
||||||
bool DownloadItem::isInstall = false;
|
bool DownloadItem::isInstall = false;
|
||||||
|
|
||||||
DownloadItem::DownloadItem(QWidget *parent) :
|
DownloadItem::DownloadItem(QWidget *parent) : QWidget(parent),
|
||||||
QWidget(parent),
|
|
||||||
reinstall(false),
|
reinstall(false),
|
||||||
close(false),
|
close(false),
|
||||||
ui(new Ui::DownloadItem),
|
ui(new Ui::DownloadItem),
|
||||||
@ -164,8 +163,7 @@ void DownloadItem::install(int t)
|
|||||||
|
|
||||||
ui->widget_spinner->hide();
|
ui->widget_spinner->hide();
|
||||||
DownloadItem::isInstall = false;
|
DownloadItem::isInstall = false;
|
||||||
emit finished();
|
emit finished(); });
|
||||||
});
|
|
||||||
// emit finished();
|
// emit finished();
|
||||||
qDebug() << ui->label_filename->text().toUtf8();
|
qDebug() << ui->label_filename->text().toUtf8();
|
||||||
}
|
}
|
||||||
|
@ -152,14 +152,11 @@ void ProgressButton::mousePressEvent(QMouseEvent *event)
|
|||||||
|
|
||||||
void ProgressButton::operationProcessing()
|
void ProgressButton::operationProcessing()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const int RADIUS = 60;
|
const int RADIUS = 60;
|
||||||
WaterDrop::WaterDrop(QWidget *parent)
|
WaterDrop::WaterDrop(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent), m_waterDropAnimation(nullptr), m_animationRadius(0)
|
||||||
, m_waterDropAnimation(nullptr)
|
|
||||||
, m_animationRadius(0)
|
|
||||||
{
|
{
|
||||||
this->setFixedSize(QSize(RADIUS * 2, RADIUS * 2));
|
this->setFixedSize(QSize(RADIUS * 2, RADIUS * 2));
|
||||||
this->setWindowFlags(Qt::FramelessWindowHint | Qt::Tool);
|
this->setWindowFlags(Qt::FramelessWindowHint | Qt::Tool);
|
||||||
|
@ -13,7 +13,8 @@ WebEnginePage::~WebEnginePage()
|
|||||||
|
|
||||||
void WebEnginePage::setUrl(const QUrl &url)
|
void WebEnginePage::setUrl(const QUrl &url)
|
||||||
{
|
{
|
||||||
if (m_currentUrl == url) {
|
if (m_currentUrl == url)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,7 +33,8 @@ QWebEnginePage *WebEnginePage::createWindow(QWebEnginePage::WebWindowType type)
|
|||||||
|
|
||||||
void WebEnginePage::slotUrlChanged(const QUrl &url)
|
void WebEnginePage::slotUrlChanged(const QUrl &url)
|
||||||
{
|
{
|
||||||
if (m_currentUrl == url) {
|
if (m_currentUrl == url)
|
||||||
|
{
|
||||||
sender()->deleteLater();
|
sender()->deleteLater();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,7 @@
|
|||||||
#include <QGraphicsOpacityEffect>
|
#include <QGraphicsOpacityEffect>
|
||||||
#include <QPropertyAnimation>
|
#include <QPropertyAnimation>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
DownloadListWidget::DownloadListWidget(QWidget *parent) :
|
DownloadListWidget::DownloadListWidget(QWidget *parent) : DBlurEffectWidget(parent),
|
||||||
DBlurEffectWidget(parent),
|
|
||||||
ui(new Ui::DownloadListWidget)
|
ui(new Ui::DownloadListWidget)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
@ -47,13 +46,13 @@ DownloadListWidget::DownloadListWidget(QWidget *parent) :
|
|||||||
downloaditemlist[nowDownload - 1]->setSpeed(theSpeed);
|
downloaditemlist[nowDownload - 1]->setSpeed(theSpeed);
|
||||||
}else{
|
}else{
|
||||||
emit downloadProgress(0);
|
emit downloadProgress(0);
|
||||||
}
|
} });
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DownloadListWidget::~DownloadListWidget()
|
DownloadListWidget::~DownloadListWidget()
|
||||||
{
|
{
|
||||||
if (downloadController) {
|
if (downloadController)
|
||||||
|
{
|
||||||
downloadController->stopDownload();
|
downloadController->stopDownload();
|
||||||
downloadController->deleteLater();
|
downloadController->deleteLater();
|
||||||
}
|
}
|
||||||
@ -175,7 +174,6 @@ void DownloadListWidget::updateDataReadProgress(QString speedInfo, qint64 bytesR
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DownloadListWidget::m_move(int x, int y)
|
void DownloadListWidget::m_move(int x, int y)
|
||||||
{
|
{
|
||||||
m_rect.setX(x);
|
m_rect.setX(x);
|
||||||
@ -185,11 +183,14 @@ void DownloadListWidget::m_move(int x,int y)
|
|||||||
}
|
}
|
||||||
bool DownloadListWidget::eventFilter(QObject *watched, QEvent *event)
|
bool DownloadListWidget::eventFilter(QObject *watched, QEvent *event)
|
||||||
{
|
{
|
||||||
if (Q_NULLPTR == watched) {
|
if (Q_NULLPTR == watched)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (QEvent::ActivationChange == event->type()) {
|
if (QEvent::ActivationChange == event->type())
|
||||||
if(QApplication::activeWindow() != this){
|
{
|
||||||
|
if (QApplication::activeWindow() != this)
|
||||||
|
{
|
||||||
this->close();
|
this->close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user