Reorganize part of codes

Reorganize spark-store.pro, widget.h and widget.cpp.
This commit is contained in:
zty199 2021-04-17 04:30:28 +08:00
parent c80737a458
commit 6fd3c40e97
3 changed files with 521 additions and 344 deletions

View File

@ -8,9 +8,6 @@ QT += core gui network concurrent webenginewidgets
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++11 link_pkgconfig
PKGCONFIG += dtkwidget glib-2.0 gdk-pixbuf-2.0 libnotify
TARGET = spark-store TARGET = spark-store
TEMPLATE = app TEMPLATE = app
@ -25,35 +22,42 @@ DEFINES += QT_DEPRECATED_WARNINGS
# You can also select to disable deprecated APIs only up to a certain version of Qt. # You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
DEFINES += QT_APP_DEBUG
include(../third-party/QtNetworkService/QtNetworkService.pri)
CONFIG += c++11 link_pkgconfig
PKGCONFIG += dtkwidget glib-2.0 gdk-pixbuf-2.0 libnotify
# 禁止输出 qWarning / qDebug 信息 # 禁止输出 qWarning / qDebug 信息
CONFIG(release, debug|release): DEFINES += QT_NO_WARNING_OUTPUT QT_NO_DEBUG_OUTPUT CONFIG(release, debug|release): DEFINES += QT_NO_WARNING_OUTPUT QT_NO_DEBUG_OUTPUT
SOURCES += main.cpp\ SOURCES += \
appitem.cpp \ appitem.cpp \
downloadworker.cpp \
widget.cpp \
downloadlist.cpp \
image_show.cpp \
big_image.cpp \ big_image.cpp \
progressload.cpp \ downloadlist.cpp \
downloadworker.cpp \
flowlayout.cpp \ flowlayout.cpp \
image_show.cpp \
main.cpp \
progressload.cpp \
widget.cpp \
workerthreads.cpp workerthreads.cpp
HEADERS += \ HEADERS += \
appitem.h \ appitem.h \
downloadworker.h \
widget.h \
downloadlist.h \
image_show.h \
big_image.h \ big_image.h \
progressload.h \ downloadlist.h \
downloadworker.h \
flowlayout.h \ flowlayout.h \
image_show.h \
progressload.h \
widget.h \
workerthreads.h workerthreads.h
FORMS += \ FORMS += \
appitem.ui \ appitem.ui \
widget.ui \ downloadlist.ui \
downloadlist.ui widget.ui
RESOURCES += \ RESOURCES += \
../assets/icons.qrc ../assets/icons.qrc
@ -73,10 +77,7 @@ DISTFILES += \
../assets/tags/logo_icon.svg \ ../assets/tags/logo_icon.svg \
../assets/tags/uos.svg ../assets/tags/uos.svg
TRANSLATIONS = ../translations/spark-store_en.ts \ TRANSLATIONS += \
../translations/spark-store_zh_CN.ts ../translations/spark-store_en.ts \
../translations/spark-store_fr.ts\ ../translations/spark-store_fr.ts \
../translations/spark-store_zh_CN.ts
DEFINES += QT_APP_DEBUG
include(../third-party/QtNetworkService/QtNetworkService.pri)

File diff suppressed because it is too large Load Diff

View File

@ -2,12 +2,10 @@
#define WIDGET_H #define WIDGET_H
#include <QWidget> #include <QWidget>
#include <QLabel>
#include <QUrl>
#include <QFile> #include <QFile>
#include <QNetworkReply> #include <QNetworkReply>
#include <QNetworkAccessManager> #include <QNetworkAccessManager>
#include <downloadlist.h>
#include <QJsonObject> #include <QJsonObject>
#include <QProcess> #include <QProcess>
#include <QFuture> #include <QFuture>
@ -18,40 +16,42 @@
#include <QFontDatabase> #include <QFontDatabase>
#include <QMutex> #include <QMutex>
#include <DSettings>
#include <DBlurEffectWidget> #include <DBlurEffectWidget>
#include <DSpinner>
#include <DWaterProgress>
#include <DSpinner>
#include <DTitlebar> #include <DTitlebar>
#include <DSearchEdit> #include <DSearchEdit>
#include <progressload.h> #include <DSettings>
#include "workerthreads.h" #include <DSpinner>
#include "image_show.h" #include <DWaterProgress>
#define LIST_MAX 99 //一次最多下载数量 #include "image_show.h"
#include "downloadlist.h"
#include "progressload.h"
#include "workerthreads.h"
#define LIST_MAX 99 // 一次最多下载数量
#define TMP_PATH "/tmp/spark-store" #define TMP_PATH "/tmp/spark-store"
DWIDGET_USE_NAMESPACE DWIDGET_USE_NAMESPACE
namespace Ui { namespace Ui {
class Widget; class Widget;
} }
class FlowLayout; class FlowLayout;
class DownloadController; class DownloadController;
namespace AeaQt { namespace AeaQt {
class HttpClient; class HttpClient;
} }
class Widget : public DBlurEffectWidget class Widget : public DBlurEffectWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit Widget(DBlurEffectWidget *parent = nullptr); explicit Widget(DBlurEffectWidget *parent = nullptr);
~Widget(); ~Widget();
void startRequest(QUrl url, QString fileName); void startRequest(QUrl url, QString fileName);
void searchApp(QString); void searchApp(QString);
int nowDownload=0; int nowDownload=0;
@ -103,7 +103,6 @@ private slots:
void on_pushButton_translate_clicked(); void on_pushButton_translate_clicked();
public: public:
QUrl url; QUrl url;
downloadlist download_list[LIST_MAX]; downloadlist download_list[LIST_MAX];