几乎完成

This commit is contained in:
Mike Solar
2023-08-18 19:09:55 +08:00
parent bc3b3f69a7
commit b728e697fb
33 changed files with 1299 additions and 1182 deletions

View File

@ -1,4 +1,4 @@
#pragma once
#pragma once
#include <QtSql/QSqlDatabase>
#include <QtSql/QSqlError>
#include <QtSql/QSqlQuery>
@ -14,11 +14,15 @@ class SoftwareRequest;
typedef struct tagRecord{
int id;
int sort;
QString initial_position;
QString app_id;
bool locked;
bool is_navbar;
bool is_elite;
QString type;
QString category_id;
QString logo;
QString img;
QString name;
QString orig_name;
QString version;
@ -47,15 +51,19 @@ class SQLiteHelper : public QObject
public:
SQLiteHelper(QObject *parent = nullptr);
bool update_software();
bool insert_software(QString name, QString orig_name, QString path, QString sort, bool* categories);
bool insert_software(QString name, QString orig_name, QString path, QString sort, bool* categories, QString logo="", QString img="",QString type="app",bool locked=false,QString op="soft",QString func="",QString url="",bool is_navbar=false,bool is_elite=false,QString dev="");
bool edit_software(QString name, QString orig_name, QString path, QString sort, bool* categories,QString type="");
bool get_software(QList<ButtonStruct>* buttons, ConfigResponse* config_response);
bool get_software(QList<ButtonStruct>* button_structs,QString background_color , QString title_color, QString title_cover_color);
bool update_app();
bool get_buttons(QList<ButtonStruct> &buttons);
bool get_category(QList<Categrory>& categrories, bool is_edit,bool all=false);
bool set_category(QList<Categrory>& categrories);
bool get_all_software(QList<Record> &softwares,int category);
bool get_a_software(QString orig_name, Record2 *record);
bool update_total();//警告:这个函数必须用于事务中
bool use_software(QString orig_name);
QSqlDatabase db;
~SQLiteHelper();
@ -64,6 +72,8 @@ private:
QNetworkReply* reply;
QEventLoop eventLoop;
bool downloadSuccess;
bool delete_software(QString orig_name);
bool execute_query(QString sql, QList<Record>& softwares);
void cancelDownload();
};