From 5ec58b3bfb6734b7b1451aa0af98b2386e011e4a Mon Sep 17 00:00:00 2001 From: Mike Solar Date: Fri, 18 Aug 2023 20:51:05 +0800 Subject: [PATCH] =?UTF-8?q?=E9=99=A4=E4=BA=86win7=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E5=A4=96=E5=85=A8=E4=BF=AE=E5=A4=8D=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../OfficeAssistant_msvc.vcxproj.user | 4 +-- OfficeAssistant_msvc/addapp.cpp | 5 +++ OfficeAssistant_msvc/applicationmanager.cpp | 3 +- OfficeAssistant_msvc/mainscreen.cpp | 32 +++++++++++------ OfficeAssistant_msvc/netio.cpp | 3 +- OfficeAssistant_msvc/sqlitehelper.cpp | 35 +++++++++++++------ 6 files changed, 56 insertions(+), 26 deletions(-) diff --git a/OfficeAssistant_msvc/OfficeAssistant_msvc.vcxproj.user b/OfficeAssistant_msvc/OfficeAssistant_msvc.vcxproj.user index f01453d..e9cd272 100644 --- a/OfficeAssistant_msvc/OfficeAssistant_msvc.vcxproj.user +++ b/OfficeAssistant_msvc/OfficeAssistant_msvc.vcxproj.user @@ -5,9 +5,9 @@ WindowsLocalDebugger - 2023-08-17T22:00:04.0470850Z + 2023-08-18T11:11:43.0072355Z - 2023-08-17T22:00:04.1224923Z + 2023-08-18T11:11:44.6602281Z \ No newline at end of file diff --git a/OfficeAssistant_msvc/addapp.cpp b/OfficeAssistant_msvc/addapp.cpp index a3cea70..cf641c2 100644 --- a/OfficeAssistant_msvc/addapp.cpp +++ b/OfficeAssistant_msvc/addapp.cpp @@ -149,6 +149,11 @@ void AddApp::broswer_exe(){ } void AddApp::submit() { + if(sort->text().toInt()<10||sort->text().toInt()>100) + { + QMessageBox::critical(this, QString::fromLocal8Bit("错误"), QString::fromLocal8Bit("排序必须在10-100之间")); + return; + } if (isEdit) { QString name_str_old = name_str; diff --git a/OfficeAssistant_msvc/applicationmanager.cpp b/OfficeAssistant_msvc/applicationmanager.cpp index b2fcb21..37851e0 100644 --- a/OfficeAssistant_msvc/applicationmanager.cpp +++ b/OfficeAssistant_msvc/applicationmanager.cpp @@ -172,12 +172,13 @@ void ApplicationManager::onclick1(QString op, QString func, QString path, QStrin if(software_ok&&app_ok) { QMessageBox::information(this, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("更新成功")); - emit refresh(); + emit refresh_tab(); } else { QMessageBox::critical(this, QString::fromLocal8Bit("错误"), QString::fromLocal8Bit("更新部分或全部失败,全名是否重名?")); } + }else if(func=="app_category") { AddCategory add_category; diff --git a/OfficeAssistant_msvc/mainscreen.cpp b/OfficeAssistant_msvc/mainscreen.cpp index 15697b6..c4bab89 100644 --- a/OfficeAssistant_msvc/mainscreen.cpp +++ b/OfficeAssistant_msvc/mainscreen.cpp @@ -1,4 +1,4 @@ -// +// // Created by HW on 2023/07/27. // @@ -34,7 +34,7 @@ MainScreen::MainScreen(QWidget *parent) : button->setStyleSheet("border-style:none;padding:10px;border-radius:5px;background-color:#09bb07;color:white;font-family:SimHei"); //Plus Math icon by Icons8 QString dir = QApplication::applicationDirPath(); - button->setText(QString::fromLocal8Bit("΢")); + button->setText(QString::fromLocal8Bit("打开微信")); //button->setStyleSheet("text-color:white"); layout = new QHBoxLayout; miniblink = new QMiniBlink(this); @@ -80,31 +80,43 @@ MainScreen::~MainScreen() { void MainScreen::firstUrl(QString url) { QString url_full; - if (url.contains("http")) + if (url.isEmpty()) { - url_full = url; + url_full = ""; + } + else if (url.contains("?")) + { + url_full = BASE_URL + url + url_param; + emit changeUrl(url_full); } else { - url_full = BASE_URL + url + url_param; + url_full = BASE_URL + url + "?" + url_param; + emit changeUrl(url_full); } - emit changeUrl(url_full); } void MainScreen::clickButton1(QString op,QString url) { QString url_full; - if(url.contains("http")) + if (url.isEmpty()) { - url_full = url; - }else + url_full = ""; + } + else if (url.contains("?")) { url_full = BASE_URL + url + url_param; + emit changeUrl(url_full); + } + else + { + url_full = BASE_URL + url + "?" + url_param; + emit changeUrl(url_full); } if (op == "openwechat") { OpenWeChatRequest open_wechat_request; QString msg = open_wechat_request.sendRequest(); if(msg!="ok") { - QMessageBox::information(this, QString::fromLocal8Bit("ʾ"), msg); + QMessageBox::information(this, QString::fromLocal8Bit("提示"), msg); return; } widget->setHidden(false); diff --git a/OfficeAssistant_msvc/netio.cpp b/OfficeAssistant_msvc/netio.cpp index b545c83..07a14cf 100644 --- a/OfficeAssistant_msvc/netio.cpp +++ b/OfficeAssistant_msvc/netio.cpp @@ -162,8 +162,7 @@ RequestBodyBase::RequestBodyBase(){ obj_root.insert(QString::fromLocal8Bit("os_version"), os_version_json); obj_root.insert(QString::fromLocal8Bit("sign"), sign_json); qJsonDocument.setObject(obj_root); - url_param = "?"; - url_param += "product="; + url_param = "&product="; url_param += product; url_param += "&partner_id="; url_param += parter_id; diff --git a/OfficeAssistant_msvc/sqlitehelper.cpp b/OfficeAssistant_msvc/sqlitehelper.cpp index c642512..b19c342 100644 --- a/OfficeAssistant_msvc/sqlitehelper.cpp +++ b/OfficeAssistant_msvc/sqlitehelper.cpp @@ -932,7 +932,14 @@ bool SQLiteHelper::get_software(QList* button_structs, ConfigRespo } while (query.next()) { - QString icon = QApplication::applicationDirPath() + DEFAULT_SVG_PATH + query.value("orig_name").toString() + ".svg"; + QString icon; + if(query.value("logo").toString().contains(":")) + { + icon = query.value("logo").toString(); + }else + { + icon = QApplication::applicationDirPath() +query.value("logo").toString(); + } ButtonStruct button_struct; button_struct.path = query.value("path").toString(); button_struct.text = query.value("name").toString(); @@ -948,14 +955,16 @@ bool SQLiteHelper::get_software(QList* button_structs, ConfigRespo { QByteArray svg_buffer = file.readAll(); file.close(); - QSvgRenderer* render_image = new QSvgRenderer(svg_buffer); + QDomDocument doc; + doc.setContent(svg_buffer); + SetSVGBackColor(doc.documentElement(), "path", "fill", title_color); + QSvgRenderer* render_image = new QSvgRenderer(doc.toByteArray()); QPainter painter_image(image); painter_image.setCompositionMode(QPainter::CompositionMode_Clear); // 清除画布 painter_image.fillRect(image->rect(), Qt::transparent); // 填充透明色 painter_image.setCompositionMode(QPainter::CompositionMode_SourceOver); // 恢复默认值 render_image->render(&painter_image); //修改颜色 - QDomDocument doc; doc.setContent(svg_buffer); SetSVGBackColor(doc.documentElement(), "path", "fill", title_cover_color); QSvgRenderer* render_image_cover = new QSvgRenderer(doc.toByteArray()); @@ -976,14 +985,16 @@ bool SQLiteHelper::get_software(QList* button_structs, ConfigRespo { QByteArray svg_buffer = file.readAll(); file.close(); - QSvgRenderer* render_image = new QSvgRenderer(svg_buffer); + QDomDocument doc; + doc.setContent(svg_buffer); + SetSVGBackColor(doc.documentElement(), "path", "fill", title_color); + QSvgRenderer* render_image = new QSvgRenderer(doc.toByteArray()); QPainter painter_image(image); painter_image.setCompositionMode(QPainter::CompositionMode_Clear); // 清除画布 painter_image.fillRect(image->rect(), Qt::transparent); // 填充透明色 painter_image.setCompositionMode(QPainter::CompositionMode_SourceOver); // 恢复默认值 render_image->render(&painter_image); //修改颜色 - QDomDocument doc; doc.setContent(svg_buffer); SetSVGBackColor(doc.documentElement(), "path", "fill", title_cover_color); QSvgRenderer* render_image_cover = new QSvgRenderer(doc.toByteArray()); @@ -1038,14 +1049,16 @@ bool SQLiteHelper::get_software(QList* button_structs,QString back { QByteArray svg_buffer = file.readAll(); file.close(); - QSvgRenderer* render_image = new QSvgRenderer(svg_buffer); + QDomDocument doc; + doc.setContent(svg_buffer); + SetSVGBackColor(doc.documentElement(), "path", "fill", title_color); + QSvgRenderer* render_image = new QSvgRenderer(doc.toByteArray()); QPainter painter_image(image); painter_image.setCompositionMode(QPainter::CompositionMode_Clear); // 清除画布 painter_image.fillRect(image->rect(), Qt::transparent); // 填充透明色 painter_image.setCompositionMode(QPainter::CompositionMode_SourceOver); // 恢复默认值 render_image->render(&painter_image); //修改颜色 - QDomDocument doc; doc.setContent(svg_buffer); SetSVGBackColor(doc.documentElement(), "path", "fill", title_cover_color); QSvgRenderer* render_image_cover = new QSvgRenderer(doc.toByteArray()); @@ -1066,14 +1079,16 @@ bool SQLiteHelper::get_software(QList* button_structs,QString back { QByteArray svg_buffer = file.readAll(); file.close(); - QSvgRenderer* render_image = new QSvgRenderer(svg_buffer); + QDomDocument doc; + doc.setContent(svg_buffer); + SetSVGBackColor(doc.documentElement(), "path", "fill", title_color); + QSvgRenderer* render_image = new QSvgRenderer(doc.toByteArray()); QPainter painter_image(image); painter_image.setCompositionMode(QPainter::CompositionMode_Clear); // 清除画布 painter_image.fillRect(image->rect(), Qt::transparent); // 填充透明色 painter_image.setCompositionMode(QPainter::CompositionMode_SourceOver); // 恢复默认值 render_image->render(&painter_image); //修改颜色 - QDomDocument doc; doc.setContent(svg_buffer); SetSVGBackColor(doc.documentElement(), "path", "fill", title_cover_color); QSvgRenderer* render_image_cover = new QSvgRenderer(doc.toByteArray()); @@ -1174,8 +1189,6 @@ bool SQLiteHelper::update_app() categories[INNER - 1] = true; update_total(); } - - } } work.exec("commit;");