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