完成获取应用列表、获取内置app列表
parent
0ecf1bdf6a
commit
b8da134809
|
@ -8,7 +8,11 @@ MyButton::MyButton(ButtonStruct &buttonStruct,int width,int height,QList<MyButto
|
||||||
this->width2=width;
|
this->width2=width;
|
||||||
this->height2=height;
|
this->height2=height;
|
||||||
this->text=buttonStruct.text;
|
this->text=buttonStruct.text;
|
||||||
|
this->op = buttonStruct.op;
|
||||||
|
this->func = buttonStruct.func;
|
||||||
this->url = buttonStruct.url;
|
this->url = buttonStruct.url;
|
||||||
|
this->path = buttonStruct.path;
|
||||||
|
this->initial_position = buttonStruct.initial_position;
|
||||||
this->logo=buttonStruct.image;
|
this->logo=buttonStruct.image;
|
||||||
this->logo_cover = buttonStruct.image_cover;
|
this->logo_cover = buttonStruct.image_cover;
|
||||||
this->background_color = buttonStruct.background_color;
|
this->background_color = buttonStruct.background_color;
|
||||||
|
@ -82,6 +86,6 @@ void MyButton::mouseReleaseEvent(QMouseEvent *event) {
|
||||||
checked=false;
|
checked=false;
|
||||||
else
|
else
|
||||||
checked=true;
|
checked=true;
|
||||||
emit clicked1(text, url);
|
emit clicked1(op, func, url, path, initial_position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
class MyButton: public QPushButton{
|
class MyButton: public QPushButton{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
signals:
|
signals:
|
||||||
void clicked1(QString text, QString url);
|
void clicked1(QString op, QString func, QString url, QString path, QString initial_position);
|
||||||
public:
|
public:
|
||||||
MyButton(ButtonStruct &buttonStruct,int width,int height,QList<MyButton *> *buttons,QWidget *parent=nullptr);
|
MyButton(ButtonStruct &buttonStruct,int width,int height,QList<MyButton *> *buttons,QWidget *parent=nullptr);
|
||||||
~MyButton() override;
|
~MyButton() override;
|
||||||
|
@ -58,6 +58,10 @@ private:
|
||||||
QVBoxLayout *layout;
|
QVBoxLayout *layout;
|
||||||
QString text;
|
QString text;
|
||||||
QString url;
|
QString url;
|
||||||
|
QString op;
|
||||||
|
QString path;
|
||||||
|
QString initial_position;
|
||||||
|
QString func;
|
||||||
int width2;
|
int width2;
|
||||||
int height2;
|
int height2;
|
||||||
int logicalwidth;
|
int logicalwidth;
|
||||||
|
|
|
@ -72,9 +72,6 @@
|
||||||
</QtMoc>
|
</QtMoc>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="main.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="mainscreen.cpp">
|
<ClCompile Include="mainscreen.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -102,6 +99,9 @@
|
||||||
<ClCompile Include="MyButton.cpp">
|
<ClCompile Include="MyButton.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="main.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<QtUic Include="navbar.ui">
|
<QtUic Include="navbar.ui">
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<QtLastBackgroundBuild>2023-08-06T14:26:06.9540300Z</QtLastBackgroundBuild>
|
<QtLastBackgroundBuild>2023-08-08T01:58:42.4896992Z</QtLastBackgroundBuild>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<QtLastBackgroundBuild>2023-08-08T01:58:34.1935757Z</QtLastBackgroundBuild>
|
<QtLastBackgroundBuild>2023-08-08T01:58:34.1935757Z</QtLastBackgroundBuild>
|
||||||
|
|
|
@ -16,5 +16,8 @@ typedef struct taButtonStruct{
|
||||||
QColor text_color;
|
QColor text_color;
|
||||||
QColor text_cover_color;
|
QColor text_cover_color;
|
||||||
QString path;
|
QString path;
|
||||||
|
QString initial_position;
|
||||||
|
QString op;
|
||||||
|
QString func;
|
||||||
}ButtonStruct;
|
}ButtonStruct;
|
||||||
#endif //OFFICEASSISTANT_BUTTONSTRUCT_H
|
#endif //OFFICEASSISTANT_BUTTONSTRUCT_H
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#define DEFAULT_FILE "/config/default_navbar.kmd" //默认导航栏文件位置
|
#define DEFAULT_FILE "/config/default_navbar.kmd" //默认导航栏文件位置
|
||||||
#define KEY "3b046cfe4a2a3e62141a4840f2006210a3224e3615312bef6e19f4983921abe0" //Key
|
#define KEY "3b046cfe4a2a3e62141a4840f2006210a3224e3615312bef6e19f4983921abe0" //Key
|
||||||
#define NAME "办公助手" //中文名
|
#define NAME "办公助手" //中文名
|
||||||
#define LOGO_TITLEBAR "/icon/logo_navbar.png" //깃痙으暠깃
|
#define LOGO_TITLEBAR "/images/icon/logo_navbar.png" //깃痙으暠깃
|
||||||
#define ENG_NAME "OfficeAssistant" //英文名
|
#define ENG_NAME "OfficeAssistant" //英文名
|
||||||
#define LENG_NAME L"OfficeAssistant" //英文名(宽字符)
|
#define LENG_NAME L"OfficeAssistant" //英文名(宽字符)
|
||||||
#define ADD_AUTOSTART 1
|
#define ADD_AUTOSTART 1
|
||||||
|
@ -19,4 +19,6 @@
|
||||||
#define VERSION "1.0.0" //软件版本
|
#define VERSION "1.0.0" //软件版本
|
||||||
#define RELEASE "20230801" //Release
|
#define RELEASE "20230801" //Release
|
||||||
#define SOFTWARE_URL "http://softapi.1.y01.cn/addons/Kmdsoft/Index/soft"
|
#define SOFTWARE_URL "http://softapi.1.y01.cn/addons/Kmdsoft/Index/soft"
|
||||||
|
#define DEFAULT_COLOR "#3399FF"
|
||||||
|
#define DEFAULT_IMAGE "/images/icon/default.svg"
|
||||||
#endif //OFFICEASSISTANT_CONFIG_H
|
#endif //OFFICEASSISTANT_CONFIG_H
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
double scale;
|
double scale;
|
||||||
|
|
|
@ -76,9 +76,9 @@ void MainScreen::firstUrl(QString url)
|
||||||
QString url_full = BASE_URL + url + url_param;
|
QString url_full = BASE_URL + url + url_param;
|
||||||
emit changeUrl(url_full);
|
emit changeUrl(url_full);
|
||||||
}
|
}
|
||||||
void MainScreen::clickButton1(QString text, QString url) {
|
void MainScreen::clickButton1(QString op,QString url) {
|
||||||
QString url_full = BASE_URL + url + url_param;
|
QString url_full = BASE_URL + url + url_param;
|
||||||
if (text == QString::fromLocal8Bit("微信多开")) {
|
if (op == "openwechat") {
|
||||||
widget->setHidden(false);
|
widget->setHidden(false);
|
||||||
miniblink->setHidden(false);
|
miniblink->setHidden(false);
|
||||||
emit changeUrl(url_full);
|
emit changeUrl(url_full);
|
||||||
|
@ -91,7 +91,7 @@ void MainScreen::clickButton1(QString text, QString url) {
|
||||||
}
|
}
|
||||||
void MainScreen::startWeChat() {
|
void MainScreen::startWeChat() {
|
||||||
QString path = QApplication::applicationDirPath();
|
QString path = QApplication::applicationDirPath();
|
||||||
QString exe = path + "/app/wxdk.exe";
|
QString exe = path + "/app/wxdk/wxdk.exe";
|
||||||
path.replace("/", "\\");
|
path.replace("/", "\\");
|
||||||
ShellExecute(GetDesktopWindow(), L"open", exe.toStdWString().c_str(), L"79c86fb12b36dfa33d1a537c9af100b4c7928a9c", path.toStdWString().c_str(), SW_SHOW);
|
ShellExecute(GetDesktopWindow(), L"open", exe.toStdWString().c_str(), L"79c86fb12b36dfa33d1a537c9af100b4c7928a9c", path.toStdWString().c_str(), SW_SHOW);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ public:
|
||||||
explicit MainScreen(QWidget *parent = nullptr);
|
explicit MainScreen(QWidget *parent = nullptr);
|
||||||
~MainScreen() override;
|
~MainScreen() override;
|
||||||
public slots:
|
public slots:
|
||||||
void clickButton1(QString text, QString url);
|
void clickButton1(QString op, QString url);
|
||||||
void firstUrl(QString url);
|
void firstUrl(QString url);
|
||||||
protected:
|
protected:
|
||||||
//void resizeEvent(QResizeEvent *event) override;
|
//void resizeEvent(QResizeEvent *event) override;
|
||||||
|
|
|
@ -7,16 +7,18 @@
|
||||||
#include "mainwindowlayout.h"
|
#include "mainwindowlayout.h"
|
||||||
#include "ui_MainWindowLayout.h"
|
#include "ui_MainWindowLayout.h"
|
||||||
#include "mysettingsdialog.h"
|
#include "mysettingsdialog.h"
|
||||||
|
#include "netio.h"
|
||||||
#include "sqlitehelper.h"
|
#include "sqlitehelper.h"
|
||||||
MainWindowLayout::MainWindowLayout(QWidget *parent) :
|
MainWindowLayout::MainWindowLayout(QWidget *parent) :
|
||||||
QWidget(parent), ui(new Ui::MainWindowLayout) {
|
QWidget(parent), ui(new Ui::MainWindowLayout) {
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
setContentsMargins(0, 0, 0, 0);
|
setContentsMargins(0, 0, 0, 0);
|
||||||
|
SQLiteHelper sqlite_helper;
|
||||||
|
sqlite_helper.update_app();
|
||||||
|
sqlite_helper.update_software();
|
||||||
layout=new QVBoxLayout(this);
|
layout=new QVBoxLayout(this);
|
||||||
mainWindowLayout = this;
|
mainWindowLayout = this;
|
||||||
SQLiteHelper sqlite_helper;
|
|
||||||
QList<ButtonStruct> list;
|
QList<ButtonStruct> list;
|
||||||
sqlite_helper.get_software(&list);
|
|
||||||
ConfigRequest *configRequest = new ConfigRequest;
|
ConfigRequest *configRequest = new ConfigRequest;
|
||||||
configResponse = new ConfigResponse;
|
configResponse = new ConfigResponse;
|
||||||
configRequest->sendRequest(configResponse);
|
configRequest->sendRequest(configResponse);
|
||||||
|
@ -54,20 +56,35 @@ void MainWindowLayout::resizeEvent(QResizeEvent *event) {
|
||||||
//layout->setAlignment(Qt::AlignmentFlag::AlignHCenter);
|
//layout->setAlignment(Qt::AlignmentFlag::AlignHCenter);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindowLayout::clickButton(QString text, QString url) {
|
void MainWindowLayout::clickButton(QString op, QString func, QString url,QString path,QString initial_position) {
|
||||||
QString path = QApplication::applicationDirPath();
|
QString root_path = QApplication::applicationDirPath();
|
||||||
path += "/app/startcalc.exe";
|
if(op=="app")
|
||||||
|
{
|
||||||
|
if(func=="openwechat")
|
||||||
|
{
|
||||||
|
emit clickButton1("openwechat", url);
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
path = root_path + path;
|
||||||
path.replace("/", "\\");
|
path.replace("/", "\\");
|
||||||
if (text== QString::fromLocal8Bit("计算器")) {
|
|
||||||
WinExec(path.toStdString().c_str(), SW_SHOW);
|
WinExec(path.toStdString().c_str(), SW_SHOW);
|
||||||
|
emit clickButton1(op, url);
|
||||||
}
|
}
|
||||||
else if (text == QString::fromLocal8Bit("软件设置")) {
|
}
|
||||||
|
else if (op == "self") {
|
||||||
|
if(func=="settings")
|
||||||
|
{
|
||||||
MySettingsDialog* settings = new MySettingsDialog;
|
MySettingsDialog* settings = new MySettingsDialog;
|
||||||
settings->exec();
|
settings->exec();
|
||||||
delete settings;
|
delete settings;
|
||||||
}
|
}
|
||||||
else{
|
}
|
||||||
emit clickButton1(text, url);
|
else if(op=="soft"){
|
||||||
|
ShellExecute(GetDesktopWindow(), L"open",path.toStdWString().c_str(),L"",initial_position.toStdWString().c_str(),SW_SHOW);
|
||||||
|
emit clickButton1(op, url);
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
emit clickButton1(op, url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,13 +19,13 @@ QT_END_NAMESPACE
|
||||||
class MainWindowLayout : public QWidget {
|
class MainWindowLayout : public QWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
signals:
|
signals:
|
||||||
void clickButton1(QString text, QString url);
|
void clickButton1(QString op,QString url);
|
||||||
public:
|
public:
|
||||||
explicit MainWindowLayout(QWidget *parent = nullptr);
|
explicit MainWindowLayout(QWidget *parent = nullptr);
|
||||||
|
|
||||||
~MainWindowLayout() override;
|
~MainWindowLayout() override;
|
||||||
public slots:
|
public slots:
|
||||||
void clickButton(QString text, QString url);
|
void clickButton(QString op, QString func, QString url, QString path, QString initial_position);
|
||||||
protected:
|
protected:
|
||||||
void resizeEvent(QResizeEvent *event) override;
|
void resizeEvent(QResizeEvent *event) override;
|
||||||
//void paintEvent(QPaintEvent *event) override;
|
//void paintEvent(QPaintEvent *event) override;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#include <QClipBoard>
|
#include <QClipBoard>
|
||||||
#include "netio.h"
|
#include "netio.h"
|
||||||
|
#include "sqlitehelper.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "globalvariables.h"
|
#include "globalvariables.h"
|
||||||
MySettingsDialog::MySettingsDialog(QWidget *parent)
|
MySettingsDialog::MySettingsDialog(QWidget *parent)
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
#include "mainwindowlayout.h"
|
#include "mainwindowlayout.h"
|
||||||
#include "globalvariables.h"
|
#include "globalvariables.h"
|
||||||
|
#include "sqlitehelper.h"
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
#pragma comment(lib, "Qt5Svgd.lib")
|
#pragma comment(lib, "Qt5Svgd.lib")
|
||||||
#pragma comment(lib, "Qt5Sqld.lib")
|
#pragma comment(lib, "Qt5Sqld.lib")
|
||||||
|
@ -48,10 +49,16 @@ NavBar::NavBar(ConfigResponse *configResponse, MainScreen *mainScreen,QWidget *p
|
||||||
setStyleSheet(style);*/
|
setStyleSheet(style);*/
|
||||||
//setStyleSheet("margin:0");
|
//setStyleSheet("margin:0");
|
||||||
setContentsMargins(0, 0, 0, 0);
|
setContentsMargins(0, 0, 0, 0);
|
||||||
if (configResponse->succeed&&configResponse->buttons.empty()!=true) {
|
ConfigResponse config_response;
|
||||||
getLogoFromInternet(configResponse);
|
ConfigRequest config_request;
|
||||||
}
|
config_request.sendRequest(&config_response);
|
||||||
else {
|
SQLiteHelper sqlite_helper;
|
||||||
|
sqlite_helper.get_software(&buttonStructs, &config_response);
|
||||||
|
if(config_response.succeed==true)
|
||||||
|
{
|
||||||
|
getLogoFromInternet(&config_response);
|
||||||
|
}else
|
||||||
|
{
|
||||||
getLogoFromLocal();
|
getLogoFromLocal();
|
||||||
}
|
}
|
||||||
layout2 = new QHBoxLayout;
|
layout2 = new QHBoxLayout;
|
||||||
|
@ -143,68 +150,9 @@ void NavBar::getLogoFromInternet(ConfigResponse *configResponse) {
|
||||||
logo = new QImage();
|
logo = new QImage();
|
||||||
logo->loadFromData(*buffer);
|
logo->loadFromData(*buffer);
|
||||||
buffer->clear();
|
buffer->clear();
|
||||||
for (auto button : configResponse->buttons) {
|
}else
|
||||||
QUrl url_image(button.img);
|
{
|
||||||
QNetworkRequest *request_image = new QNetworkRequest(url_image);
|
getLogoFromLocal();
|
||||||
reply = manager->get(*request_image);
|
|
||||||
QTimer timer;
|
|
||||||
timer.setInterval(5000);
|
|
||||||
connect(reply, &QNetworkReply::finished, &eventLoop, &QEventLoop::quit);
|
|
||||||
connect(&timer, &QTimer::timeout, this, &NavBar::cancelDownload);
|
|
||||||
eventLoop.exec();
|
|
||||||
timer.stop();
|
|
||||||
if (!downloadSuccess) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
*buffer = reply->readAll();
|
|
||||||
|
|
||||||
QSvgRenderer *render_image = new QSvgRenderer(*buffer);
|
|
||||||
|
|
||||||
QImage *image = new QImage(200, 200, QImage::Format_ARGB32);
|
|
||||||
QPainter painter_image(image);
|
|
||||||
painter_image.setCompositionMode(QPainter::CompositionMode_Clear); // 清除画布
|
|
||||||
painter_image.fillRect(rect(), Qt::transparent); // 填充透明色
|
|
||||||
painter_image.setCompositionMode(QPainter::CompositionMode_SourceOver); // 恢复默认值
|
|
||||||
render_image->render(&painter_image);
|
|
||||||
buffer->clear();
|
|
||||||
reply->close();
|
|
||||||
|
|
||||||
QUrl url_image_cover(button.img_cover);
|
|
||||||
QNetworkRequest *request_image_cover = new QNetworkRequest(url_image_cover);
|
|
||||||
reply = manager->get(*request_image_cover);
|
|
||||||
timer.setInterval(5000);
|
|
||||||
connect(reply, &QNetworkReply::finished, &eventLoop, &QEventLoop::quit);
|
|
||||||
connect(&timer, &QTimer::timeout, this, &NavBar::cancelDownload);
|
|
||||||
if (!downloadSuccess) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
eventLoop.exec();
|
|
||||||
*buffer = reply->readAll();
|
|
||||||
qDebug() << *buffer;
|
|
||||||
QSvgRenderer *render_image_cover = new QSvgRenderer(*buffer);
|
|
||||||
QImage *image_cover = new QImage(200, 200, QImage::Format_ARGB32);
|
|
||||||
QPainter painter_image_cover(image_cover);
|
|
||||||
painter_image_cover.setCompositionMode(QPainter::CompositionMode_Clear); // 清除画布
|
|
||||||
painter_image_cover.fillRect(rect(), Qt::transparent); // 填充透明色
|
|
||||||
painter_image_cover.setCompositionMode(QPainter::CompositionMode_SourceOver); // 恢复默认值
|
|
||||||
render_image_cover->render(&painter_image_cover);
|
|
||||||
buffer->clear();
|
|
||||||
reply->close();
|
|
||||||
|
|
||||||
ButtonStruct buttonStruct;
|
|
||||||
buttonStruct.image = image;
|
|
||||||
buttonStruct.image_cover = image_cover;
|
|
||||||
buttonStruct.text = button.title;
|
|
||||||
buttonStruct.url = button.url;
|
|
||||||
buttonStruct.background_color = configResponse->basic.backgroud_color;
|
|
||||||
buttonStruct.text_color.setNamedColor(configResponse->basic.title_color);
|
|
||||||
buttonStruct.text_cover_color.setNamedColor(configResponse->basic.title_cover_color);
|
|
||||||
buttonStructs << buttonStruct;
|
|
||||||
delete request_image;
|
|
||||||
delete render_image;
|
|
||||||
delete request_image_cover;
|
|
||||||
delete render_image_cover;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
delete manager;
|
delete manager;
|
||||||
manager = nullptr;
|
manager = nullptr;
|
||||||
|
@ -242,16 +190,6 @@ void NavBar::getLogoFromLocal() {
|
||||||
QString color= obj_root->value("basic").toObject().value("backgroud_color").toString();
|
QString color= obj_root->value("basic").toObject().value("backgroud_color").toString();
|
||||||
qColor.setNamedColor(color);
|
qColor.setNamedColor(color);
|
||||||
QJsonArray *array = new QJsonArray;
|
QJsonArray *array = new QJsonArray;
|
||||||
*array = obj_root->value("menu").toArray();
|
|
||||||
for (auto obj : *array) {
|
|
||||||
ButtonStruct buttonStruct;
|
|
||||||
buttonStruct.text = obj.toObject().value("title").toString();
|
|
||||||
buttonStruct.url = QString(BASE_URL)+obj.toObject().value("url").toString();
|
|
||||||
buttonStruct.image = new QImage(obj.toObject().value("img").toString());
|
|
||||||
buttonStruct.image_cover = new QImage(obj.toObject().value("img_cover").toString());
|
|
||||||
buttonStructs << buttonStruct;
|
|
||||||
}
|
|
||||||
delete array;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
QMessageBox::warning(nullptr, QString::fromLocal8Bit("´íÎó"), QString::fromLocal8Bit("ÅäÖÃÎļþËð»µ"));
|
QMessageBox::warning(nullptr, QString::fromLocal8Bit("´íÎó"), QString::fromLocal8Bit("ÅäÖÃÎļþËð»µ"));
|
||||||
|
|
|
@ -585,10 +585,13 @@ bool SoftwareRequest::sendRequest(QHash<QString, Record> *records)
|
||||||
QJsonArray array;
|
QJsonArray array;
|
||||||
for(auto record : *records)
|
for(auto record : *records)
|
||||||
{
|
{
|
||||||
array.append(record.orig_name);
|
QJsonObject object;
|
||||||
|
object.insert("orig_name", record.orig_name);
|
||||||
|
object.insert("path", record.path);
|
||||||
|
array.append(object);
|
||||||
}
|
}
|
||||||
QJsonObject obj_root = qJsonDocument.object();
|
QJsonObject obj_root = qJsonDocument.object();
|
||||||
obj_root.insert("orig_names", array);
|
obj_root.insert("software", array);
|
||||||
qJsonDocument.setObject(obj_root);
|
qJsonDocument.setObject(obj_root);
|
||||||
QString url = SOFTWARE_URL;
|
QString url = SOFTWARE_URL;
|
||||||
requestInfo.setUrl(url);
|
requestInfo.setUrl(url);
|
||||||
|
@ -626,9 +629,8 @@ bool SoftwareRequest::sendRequest(QHash<QString, Record> *records)
|
||||||
QJsonObject object = value.toObject();
|
QJsonObject object = value.toObject();
|
||||||
QString orig_name = object.value("orig_name").toString();
|
QString orig_name = object.value("orig_name").toString();
|
||||||
(*records)[orig_name].logo = object.value("img").toString();
|
(*records)[orig_name].logo = object.value("img").toString();
|
||||||
(*records)[orig_name].op = object.value("op").toString();
|
|
||||||
(*records)[orig_name].func = object.value("func").toString();
|
|
||||||
(*records)[orig_name].url = object.value("url").toString();
|
(*records)[orig_name].url = object.value("url").toString();
|
||||||
|
(*records)[orig_name].path = object.value("path").toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -25,7 +25,7 @@ typedef struct {
|
||||||
QString func;
|
QString func;
|
||||||
QString url;
|
QString url;
|
||||||
} Button;
|
} Button;
|
||||||
typedef struct {
|
struct ConfigResponse {
|
||||||
bool succeed;
|
bool succeed;
|
||||||
struct {
|
struct {
|
||||||
QString logo_url;
|
QString logo_url;
|
||||||
|
@ -37,7 +37,7 @@ typedef struct {
|
||||||
QString title_cover_color;
|
QString title_cover_color;
|
||||||
}basic;
|
}basic;
|
||||||
QList<Button> buttons;
|
QList<Button> buttons;
|
||||||
}ConfigResponse;
|
};
|
||||||
|
|
||||||
class RequestBodyBase:public QObject{
|
class RequestBodyBase:public QObject{
|
||||||
Q_OBJECT;
|
Q_OBJECT;
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -6,9 +6,11 @@
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QDate>
|
#include <QDate>
|
||||||
#include <QtNetwork/QtNetwork>
|
#include <QtNetwork/QtNetwork>
|
||||||
|
|
||||||
#include "buttonstruct.h"
|
#include "buttonstruct.h"
|
||||||
typedef struct {
|
struct ConfigResponse;
|
||||||
|
class ConfigRequest;
|
||||||
|
class SoftwareRequest;
|
||||||
|
typedef struct tagRecord{
|
||||||
int id;
|
int id;
|
||||||
int sort;
|
int sort;
|
||||||
QString app_id;
|
QString app_id;
|
||||||
|
@ -26,7 +28,9 @@ typedef struct {
|
||||||
QString func;
|
QString func;
|
||||||
QString path;
|
QString path;
|
||||||
QString url;
|
QString url;
|
||||||
|
bool status;
|
||||||
}Record;
|
}Record;
|
||||||
|
#include "netio.h"
|
||||||
|
|
||||||
class SQLiteHelper : public QObject
|
class SQLiteHelper : public QObject
|
||||||
{
|
{
|
||||||
|
@ -35,8 +39,8 @@ class SQLiteHelper : public QObject
|
||||||
public:
|
public:
|
||||||
SQLiteHelper(QObject *parent = nullptr);
|
SQLiteHelper(QObject *parent = nullptr);
|
||||||
bool update_software();
|
bool update_software();
|
||||||
bool get_software(QList<ButtonStruct>* buttons);
|
bool get_software(QList<ButtonStruct>* buttons, ConfigResponse* config_response);
|
||||||
bool update_others();
|
bool update_app();
|
||||||
~SQLiteHelper();
|
~SQLiteHelper();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Binary file not shown.
|
@ -28,7 +28,7 @@
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
<PlatformToolset>v141_xp</PlatformToolset>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
@ -71,14 +71,14 @@
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<LinkIncremental>true</LinkIncremental>
|
<LinkIncremental>true</LinkIncremental>
|
||||||
<OutDir>$(SolutionDir)$(Configuration)\app\</OutDir>
|
<OutDir>$(SolutionDir)$(Configuration)\app\startcalc\</OutDir>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<LinkIncremental>true</LinkIncremental>
|
<LinkIncremental>true</LinkIncremental>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<LinkIncremental>false</LinkIncremental>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
<OutDir>$(SolutionDir)$(Configuration)\app</OutDir>
|
<OutDir>$(SolutionDir)$(Configuration)\app\startcalc\</OutDir>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<LinkIncremental>false</LinkIncremental>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
<ProjectGuid>{EB7371E8-27B1-4A15-9EE5-7BE1BC109FFB}</ProjectGuid>
|
<ProjectGuid>{EB7371E8-27B1-4A15-9EE5-7BE1BC109FFB}</ProjectGuid>
|
||||||
<Keyword>Win32Proj</Keyword>
|
<Keyword>Win32Proj</Keyword>
|
||||||
<RootNamespace>wxdk</RootNamespace>
|
<RootNamespace>wxdk</RootNamespace>
|
||||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>7.0</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
@ -71,14 +71,14 @@
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<LinkIncremental>true</LinkIncremental>
|
<LinkIncremental>true</LinkIncremental>
|
||||||
<OutDir>$(SolutionDir)$(Configuration)\app\</OutDir>
|
<OutDir>$(SolutionDir)$(Configuration)\app\wxdk\</OutDir>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<LinkIncremental>true</LinkIncremental>
|
<LinkIncremental>true</LinkIncremental>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<LinkIncremental>false</LinkIncremental>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
<OutDir>$(SolutionDir)$(Configuration)\app</OutDir>
|
<OutDir>$(SolutionDir)$(Configuration)\app\wxdk\</OutDir>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<LinkIncremental>false</LinkIncremental>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
|
Loading…
Reference in New Issue