diff --git a/OfficeAssistant_msvc/config.h b/OfficeAssistant_msvc/config.h index 99c686e..578de5c 100644 --- a/OfficeAssistant_msvc/config.h +++ b/OfficeAssistant_msvc/config.h @@ -1,37 +1,37 @@ +// +// Created by 孙羽 on 2023/07/27. // -// Created by on 2023/07/27. -// -//˵:ûע͵޸ +//说明:没有注释的项请勿修改 #ifndef OFFICEASSISTANT_CONFIG_H #define OFFICEASSISTANT_CONFIG_H -#define CONFIG_URL "http://softapi.s103.y01.cn/addons/Kmdsoft/Index/config" //ȡϢĵַ -#define OP_URL "http://softapi.s103.y01.cn/addons/Kmdsoft/Index/op" //ϴǷÿǷݷʽĵַ -#define DEVICE_URL "http://softapi.s103.y01.cn/addons/Kmdsoft/Index/device" //ϴ豸Ϣĵַ +#define CONFIG_URL "http://softapi.s103.y01.cn/addons/Kmdsoft/Index/config" //获取导航栏信息的地址 +#define OP_URL "http://softapi.s103.y01.cn/addons/Kmdsoft/Index/op" //上传是否设置开机启动、是否建立桌面快捷方式的地址 +#define DEVICE_URL "http://softapi.s103.y01.cn/addons/Kmdsoft/Index/device" //上传设备信息的地址 #define WECHAT_URL " http://softapi.s103.y01.cn/addons/Kmdsoft/Wxdk/open" -#define BASE_URL "http://softapi.s103.y01.cn/" // -#define DEFAULT_FILE "/config/config.kmd" //Ĭļλ +#define BASE_URL "http://softapi.s103.y01.cn/" //域名 +#define DEFAULT_FILE "/config/config.kmd" //默认配置文件位置 #define DEFAULT_NAVBAR_FILLE "/config/default_navbar.kmd" #define KEY "3b046cfe4a2a3e62141a4840f2006210a3224e3615312bef6e19f4983921abe0" //Key -#define NAME "칫" // -#define LOGO_TITLEBAR "/images/icon/logo_navbar.png" //ͼ -#define ENG_NAME "OfficeAssistant" //Ӣ -#define LENG_NAME L"OfficeAssistant" //Ӣַ +#define NAME "办公助手" //中文名 +#define LOGO_TITLEBAR "/images/logo_titlebar.png" //标题栏图标 +#define ENG_NAME "OfficeAssistant" //英文名 +#define LENG_NAME L"OfficeAssistant" //英文名(宽字符) #define ADD_AUTOSTART 1 #define ADD_SHORTCUT 2 -#define VERSION "1.0.0" //汾 +#define VERSION "1.0.0" //软件版本 #define RELEASE "20230801" //Release #define SOFTWARE_URL "http://softapi.s103.y01.cn/addons/Kmdsoft/App/update/type/add" -#define DEFAULT_BACKGROUND_COLOR "#333332" //Ĭϱɫӷʹ +#define DEFAULT_BACKGROUND_COLOR "#333332" //默认背景色,若从服务器读不到即使用这个 #define DEFAULT_COLOR "#3399FF" // -#define DEFAULT_TEXT_COLOR "#FFFFFF" //Ĭɫ -#define DEFAULT_COVER_COLOR "#0033FF" //ָɵɫҲǡӦáȼťĬɫ -#define DEFAULT_IMAGE "/images/svg/default.svg" //Ĭͼ +#define DEFAULT_TEXT_COLOR "#FFFFFF" //默认文字颜色 +#define DEFAULT_COVER_COLOR "#0033FF" //鼠标指向后变成的颜色,也是“添加应用”等几个按钮的默认颜色 +#define DEFAULT_IMAGE "/images/svg/default.svg" //默认图标 #define DEFAULT_SVG_PATH "/images/svg/" -#define DEFAULT_LOGO "/images/logo.png" //logo· -#define TITLE " " // -#define TEXT_SIZE 7 //Сܴ +#define DEFAULT_LOGO "/images/logo.png" //logo路径 +#define TITLE " " //标题栏 +#define TEXT_SIZE 7 //字体大小。不是所有字体受此项控制 #define TEXT_SIZE_BIG 10 -// +//分类 #define ALL 1 #define ELITE 2 #define SOFT 3 diff --git a/OfficeAssistant_msvc/navbar.cpp b/OfficeAssistant_msvc/navbar.cpp index 02927d1..4d209ef 100644 --- a/OfficeAssistant_msvc/navbar.cpp +++ b/OfficeAssistant_msvc/navbar.cpp @@ -1,4 +1,4 @@ -// +// // Created by HW on 2023/07/26. // @@ -67,6 +67,7 @@ NavBar::NavBar(MainScreen *mainScreen,QWidget *parent) : layout2 = new QHBoxLayout; layout_right = new QHBoxLayout; layout_left = new QHBoxLayout; + getLogoFromInternet(&config_response); logo_label = new QLabel(this); logo_label->setAttribute(Qt::WA_TranslucentBackground); //*logo = logo->scaled(this->width() / (5 / scale), this->height()); @@ -138,9 +139,7 @@ void NavBar::resizeEvent(QResizeEvent *event) { } logo_label->setMaximumSize(event->size().width() / 5, event->size().height()); } -/*void NavBar::getLogoFromInternet(ConfigResponse *configResponse) { - qColor.setNamedColor(configResponse->basic.backgroud_color); - +void NavBar::getLogoFromInternet(ConfigResponse *configResponse) { QUrl url_logo(configResponse->basic.logo_url); QNetworkRequest *request_logo = new QNetworkRequest(url_logo); manager = new QNetworkAccessManager; @@ -156,17 +155,17 @@ void NavBar::resizeEvent(QResizeEvent *event) { reply->close(); if (downloadSuccess == true) { *buffer = reply->readAll(); - logo = new ; - logo->loadFromData(*buffer); + QFile logo(QApplication::applicationDirPath() + DEFAULT_LOGO); + if (logo.open(QIODevice::WriteOnly)) { + logo.write(*buffer); + logo.close(); + } buffer->clear(); - }else - { - getLogoFromLocal(); } delete manager; manager = nullptr; -}*/ +} void NavBar::storeToBuffer() { buffer = new QByteArray; @@ -182,7 +181,7 @@ void NavBar::cancelDownload() { QString dir = QApplication::applicationDirPath(); QFile file(dir + DEFAULT_FILE); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { - QMessageBox::warning(nullptr, QString::fromLocal8Bit(""), QString::fromLocal8Bit("޷ļ")); + QMessageBox::warning(nullptr, QString::fromLocal8Bit("错误"), QString::fromLocal8Bit("无法打开配置文件")); exit(1); } buffer->clear(); @@ -199,7 +198,7 @@ void NavBar::cancelDownload() { QJsonArray *array = new QJsonArray; } else { - QMessageBox::warning(nullptr, QString::fromLocal8Bit(""), QString::fromLocal8Bit("ļ")); + QMessageBox::warning(nullptr, QString::fromLocal8Bit("错误"), QString::fromLocal8Bit("配置文件损坏")); delete obj_root; exit(1); } diff --git a/OfficeAssistant_msvc/navbar.h b/OfficeAssistant_msvc/navbar.h index c9448b9..f69a819 100644 --- a/OfficeAssistant_msvc/navbar.h +++ b/OfficeAssistant_msvc/navbar.h @@ -1,4 +1,4 @@ -// +// // Created by HW on 2023/07/26. // @@ -37,6 +37,8 @@ protected: void resizeEvent(QResizeEvent *event) override; + void getLogoFromInternet(ConfigResponse* configResponse); + private: Ui::NavBar *ui; @@ -52,7 +54,6 @@ private: QPixmap *logo; QLabel *logo_label; bool downloadSuccess=true; - //void getLogoFromInternet(ConfigResponse *configResponse); //void getLogoFromLocal(); MainScreen *mainScreen; QHBoxLayout *layout_left; diff --git a/OfficeAssistant_msvc/netio.cpp b/OfficeAssistant_msvc/netio.cpp index 34f8283..122a882 100644 --- a/OfficeAssistant_msvc/netio.cpp +++ b/OfficeAssistant_msvc/netio.cpp @@ -1,4 +1,4 @@ -// +// // Created by HW on 2023/07/27. // @@ -31,11 +31,11 @@ #pragma comment(lib, "Qt5Network.lib") #endif #pragma comment(lib,"comsuppw.lib") -//ȡעȡMachineUUID +//读取注册表获取MachineUUID bool IsWin11AndLater() { - //Windows 10 ڲ汾 10240 ʼڲ汾 19044 Windows 11 ڲ汾 22000 ʼô + //Windows 10 从内部版本 10240 开始,以内部版本 19044 结束。Windows 11 从内部版本 22000 开始,那么: //Environment.OSVersion.Version.Build >= 22000; NTSTATUS(WINAPI * RtlGetVersion)(LPOSVERSIONINFOEXW); OSVERSIONINFOEXW osInfo; @@ -54,40 +54,40 @@ RequestBodyBase::RequestBodyBase(){ wchar_t unix_time[65]={0}; wsprintf(unix_time,L"%ld",std::time(0)); QString request_id=QString::fromWCharArray(unix_time); - //ļ + //打开配置文件 QString dir=QApplication::applicationDirPath(); QFile *infFile=new QFile(dir+"/config/information.kmd"); if(!infFile->open(QIODevice::ReadOnly|QIODevice::Text)){ - QMessageBox::critical(nullptr,QString::fromLocal8Bit(""), QString::fromLocal8Bit("޷ļ")); + QMessageBox::critical(nullptr,QString::fromLocal8Bit("错误"), QString::fromLocal8Bit("无法打开配置文件")); delete infFile; exit_manager.exit(1); } - //ȡļ + //读取配置文件 QByteArray bytes; bytes=infFile->readAll(); infFile->close(); delete infFile; - //תΪjson + //转化为json qJsonDocument=QJsonDocument::fromJson(bytes); if(qJsonDocument.isObject()){ - //ȡݣдӦֶ + //读取数据,写入对应字段 QJsonObject obj_root=qJsonDocument.object(); if(obj_root.value("product")==QJsonValue::Undefined){ - QMessageBox::critical(nullptr, QString::fromLocal8Bit(""), QString::fromLocal8Bit("ļ")); + QMessageBox::critical(nullptr, QString::fromLocal8Bit("错误"), QString::fromLocal8Bit("配置文件损坏")); exit_manager.exit(1); } product=obj_root.value("product").toString(); if(obj_root.value("partner_id")==QJsonValue::Undefined){ - QMessageBox::critical(nullptr , QString::fromLocal8Bit(""), QString::fromLocal8Bit("ļ")); + QMessageBox::critical(nullptr , QString::fromLocal8Bit("错误"), QString::fromLocal8Bit("配置文件损坏")); exit_manager.exit(1); } parter_id=obj_root.value("partner_id").toString(); }else{ - // - QMessageBox::critical(nullptr, QString::fromLocal8Bit(""), QString::fromLocal8Bit("ļ")); + //处理错误 + QMessageBox::critical(nullptr, QString::fromLocal8Bit("错误"), QString::fromLocal8Bit("配置文件损坏")); exit_manager.exit(1); } - //ȡϵͳ汾 + //获取操作系统版本 this->os="Windows"; OSVERSIONINFOEXW os; os.dwOSVersionInfoSize=sizeof(os); @@ -96,12 +96,12 @@ RequestBodyBase::RequestBodyBase(){ *(FARPROC*)&RtlGetVersion = GetProcAddress(GetModuleHandleA("ntdll"), "RtlGetVersion"); if (RtlGetVersion != nullptr) { RtlGetVersion(&os); - switch (os.dwMajorVersion) {//汾 - case 5: //Windows 20005.xһWindows XP + switch (os.dwMajorVersion) {//主版本号 + case 5: //不兼容Windows 2000,因此5.x一定是Windows XP os_version = "Windows XP"; break; case 6: - switch (os.dwMinorVersion) { //ΰ汾 + switch (os.dwMinorVersion) { //次版本号 case 0: os_version = "Windows Vista or Windows Server 2008"; break; @@ -117,7 +117,7 @@ RequestBodyBase::RequestBodyBase(){ default: os_version = "Unknown"; } - case 10: //⼸ϵͳ10.0 + case 10: //这几个系统都是10.0 if (IsWin11AndLater()) { os_version = "Windows 11 or Windows Server 2022"; } @@ -135,10 +135,10 @@ RequestBodyBase::RequestBodyBase(){ this->release = RELEASE; this->version = VERSION; - //ȡMachineGUIDȡMD5Ϊdevice_id + //读取MachineGUID并取MD5作为device_id QByteArray hash = QCryptographicHash::hash(getMachineGUID().toUtf8(), QCryptographicHash::Md5); device_id = hash.toHex(); - //json + //加入json序列 QJsonValue value = device_id; QJsonObject obj_root = qJsonDocument.object(); obj_root.insert("device_id", value); @@ -156,7 +156,7 @@ RequestBodyBase::RequestBodyBase(){ QJsonValue sign_json(sign); QJsonValue requestId_json=QJsonValue(request_id); obj_root=qJsonDocument.object(); - //request_id + //插入request_id obj_root.insert(QString::fromLocal8Bit("request_id"),requestId_json); obj_root.insert(QString::fromLocal8Bit("os"), os_json); obj_root.insert(QString::fromLocal8Bit("os_version"), os_version_json); @@ -197,20 +197,20 @@ void ConfigRequest::sendRequest(ConfigResponse *configResponse) { QNetworkAccessManager *httpMgr = new QNetworkAccessManager(); QNetworkRequest requestInfo; - //HTTP - //ͷ + //HTTP请求 + //请求头 QString url = CONFIG_URL; requestInfo.setUrl(QUrl(CONFIG_URL)); requestInfo.setHeader(QNetworkRequest::ContentTypeHeader,QVariant("application/json")); - //Ӧı + //保存响应的变量 reply = httpMgr->post(requestInfo,qJsonDocument.toJson()); qDebug() << qJsonDocument.toJson(); - //һѭֱʱ߻ȡΪֹ + //开启一个循环,直到超时或者获取到数据为止 connect(reply,&QNetworkReply::finished, &eventLoop, &QEventLoop::quit); - //öʱֹʱ + //设置定时器防止超时 connect(timer,&QTimer::timeout,this,&ConfigRequest::cancelDownload); timer->start(5000); - //ѭ + //启动循环 eventLoop.exec(); timer->stop(); //delete httpMgr; @@ -219,11 +219,11 @@ void ConfigRequest::sendRequest(ConfigResponse *configResponse) { configResponse->succeed = false; //memset(configResponse,0,sizeof(*configResponse)); auto error = reply->error(); - //ûд + //如果没有错误 if(reply->error() == QNetworkReply::NoError) { buffer = reply->readAll(); }else{ - //д + //如果有错误 configResponse->succeed=false; //delete reply; delete timer; @@ -232,13 +232,15 @@ void ConfigRequest::sendRequest(ConfigResponse *configResponse) { } //qDebug() << result.toJson(); result = QJsonDocument::fromJson(buffer); - // + //如果数据完整 if(result.isObject()){ QJsonObject obj_root=result.object(); QJsonArray array; array = obj_root.value("data").toObject().value("menu").toArray(); - QJsonObject obj_basic = obj_root.value("data").toObject().value("basic").toObject(); + QJsonObject obj_data = obj_root.value("data").toObject(); + QString basic_str= obj_data.value("basic").toString(); + QJsonObject obj_basic=QJsonDocument::fromJson(basic_str.toUtf8()).object(); configResponse->basic.logo_url = obj_basic.value("logo").toString(); configResponse->basic.device_id = obj_basic.value("device_id").toString(); configResponse->basic.dev_id = obj_basic.value("dev_id").toString(); @@ -253,7 +255,7 @@ void ConfigRequest::sendRequest(ConfigResponse *configResponse) { button.img=object.value("img").toString(); button.orig_name= object.value("orig_name").toString(); // button.img_cover=object.value("img_cover").toString(); - button.title=object.value("title").toString(); + button.title=object.value("name").toString(); button.categroy_id = object.value("category_id").toString(); button.op = object.value("op").toString(); button.func=object.value("func").toString(); @@ -269,7 +271,7 @@ void ConfigRequest::sendRequest(ConfigResponse *configResponse) { file.close(); } }else{ - //ݲ + //数据不完整 configResponse->succeed=false; //delete reply; delete timer; @@ -288,18 +290,18 @@ void RequestBodyBase::sendRequest() { timer = new QTimer(this); QNetworkAccessManager *httpMgr = new QNetworkAccessManager(); QNetworkRequest requestInfo; - //HTTP - //ͷ + //HTTP请求 + //请求头 requestInfo.setUrl(QUrl(OP_URL)); requestInfo.setHeader(QNetworkRequest::ContentTypeHeader,QVariant("application/json")); - //Ӧı + //保存响应的变量 reply = httpMgr->post(requestInfo,qJsonDocument.toJson()); - //һѭֱʱ߻ȡΪֹ + //开启一个循环,直到超时或者获取到数据为止 connect(reply,&QNetworkReply::finished, this, &RequestBodyBase::cancelDownload); - //öʱֹʱ + //设置定时器防止超时 connect(timer,&QTimer::timeout,&eventLoop,&QEventLoop::quit); timer->start(5000); - //ѭ + //启动循环 eventLoop.exec(); delete timer; delete httpMgr; @@ -310,15 +312,15 @@ void RequestBodyBase::sendRequest() { DeviceRequest::DeviceRequest() : RequestBodyBase() { //CPU QString cpu = QSysInfo::currentCpuArchitecture(); - //ڴС + //内存大小 MEMORYSTATUSEX status; status.dwLength = sizeof(status); GlobalMemoryStatusEx(&status); int ram = status.ullTotalPhys / 1024 / 1024; - //Ӳ̴С + //硬盘大小 QStorageInfo storage = QStorageInfo::root(); int disk = storage.bytesTotal() / static_cast(1024 * 1024 * 1024); - //Կͺ + //显卡型号 QStringList gpus; BOOL success; DWORD deviceIndex = 0; @@ -346,9 +348,9 @@ DeviceRequest::DeviceRequest() : RequestBodyBase() { deviceIndex++; displayDevice.cb = sizeof(displayDevice); } - //ͺ + //主板型号 QString motherboard = QSysInfo::prettyProductName(); - //WMIȡͺ + //WMI获取网卡型号 HRESULT hr = CoInitializeEx(0, COINIT_MULTITHREADED); if (FAILED(hr)) { std::cerr << "Failed to initialize COM library." << std::endl; @@ -455,7 +457,7 @@ DeviceRequest::DeviceRequest() : RequestBodyBase() { pClassObj->Release(); } - //WMIȡͺ + //WMI获取声卡型号 hr = pSvc->ExecQuery( _bstr_t("WQL"), _bstr_t("SELECT * FROM Win32_SoundDevice"), @@ -534,8 +536,8 @@ DeviceRequest::DeviceRequest() : RequestBodyBase() { DISPLAY_DEVICE d = { sizeof(DISPLAY_DEVICE) }; ::EnumDisplayDevices(NULL, 0, &d, 0); QString monitor=QString::fromWCharArray(d.DeviceString, wcslen(d.DeviceString)); - // - //JSON + //发送 + //构造JSON QJsonDocument *device=new QJsonDocument; QJsonObject *object=new QJsonObject; object->insert("CPU",QJsonValue(cpu)); @@ -576,18 +578,18 @@ DeviceRequest::DeviceRequest() : RequestBodyBase() { timer = new QTimer(this); QNetworkAccessManager *httpMgr = new QNetworkAccessManager(); QNetworkRequest requestInfo; - //HTTP - //ͷ + //HTTP请求 + //请求头 requestInfo.setUrl(QUrl(DEVICE_URL)); requestInfo.setHeader(QNetworkRequest::ContentTypeHeader,QVariant("application/json")); - //Ӧı + //保存响应的变量 reply = httpMgr->post(requestInfo,qJsonDocument.toJson()); - //һѭֱʱ߻ȡΪֹ + //开启一个循环,直到超时或者获取到数据为止 connect(reply,&QNetworkReply::finished, &eventLoop, &QEventLoop::quit); - //öʱֹʱ + //设置定时器防止超时 connect(timer,&QTimer::timeout,this,&DeviceRequest::cancelDownload); timer->start(5000); - //ѭ + //启动循环 eventLoop.exec(); delete httpMgr; } @@ -596,8 +598,8 @@ bool SoftwareRequest::sendRequest(QHash&startMenu, QHash&startMenu, QHashpost(requestInfo, qJsonDocument.toJson()); qDebug() << qJsonDocument.toJson(); - //һѭֱʱ߻ȡΪֹ + //开启一个循环,直到超时或者获取到数据为止 connect(reply, &QNetworkReply::finished, &eventLoop, &QEventLoop::quit); - //öʱֹʱ + //设置定时器防止超时 connect(timer, &QTimer::timeout, this, &SoftwareRequest::cancelDownload); timer->start(5000); - //ѭ + //启动循环 eventLoop.exec(); timer->stop(); delete timer; QJsonDocument result; // auto error = reply->error(); - //ûд + //如果没有错误 qDebug() << reply->error(); if (reply->error() == QNetworkReply::NoError) { result = QJsonDocument::fromJson(reply->readAll()); } else { - //д + //如果有错误 delete httpMgr; return false; } //qDebug() << result.toJson(); - // + //如果数据完整 if (result.isObject()) { QJsonObject obj_root2 = result.object(); QJsonArray array = obj_root2.value("data").toObject().value("menu").toArray(); @@ -701,7 +703,7 @@ bool SoftwareRequest::sendRequest(QHash&startMenu, QHashpost(requestInfo, qJsonDocument.toJson()); - //һѭֱʱ߻ȡΪֹ + //开启一个循环,直到超时或者获取到数据为止 connect(reply, &QNetworkReply::finished, this, &OpenWeChatRequest::cancelDownload); - //öʱֹʱ + //设置定时器防止超时 connect(timer, &QTimer::timeout, &eventLoop, &QEventLoop::quit); timer->start(5000); - //ѭ + //启动循环 eventLoop.exec(); timer->stop(); QByteArray buffer = reply->readAll(); @@ -755,18 +757,18 @@ void OpRequest::sendRequest() qJsonDocument.setObject(object); QNetworkAccessManager* httpMgr = new QNetworkAccessManager(); QNetworkRequest requestInfo; - //HTTP - //ͷ + //HTTP请求 + //请求头 requestInfo.setUrl(QUrl(OP_URL)); requestInfo.setHeader(QNetworkRequest::ContentTypeHeader, QVariant("application/json")); - //Ӧı + //保存响应的变量 reply = httpMgr->post(requestInfo, qJsonDocument.toJson()); - //һѭֱʱ߻ȡΪֹ + //开启一个循环,直到超时或者获取到数据为止 connect(reply, &QNetworkReply::finished, this, &OpRequest::cancelDownload); - //öʱֹʱ + //设置定时器防止超时 connect(timer, &QTimer::timeout, &eventLoop, &QEventLoop::quit); timer->start(5000); - //ѭ + //启动循环 eventLoop.exec(); timer->stop(); delete timer; diff --git a/OfficeAssistant_msvc/sqlitehelper.cpp b/OfficeAssistant_msvc/sqlitehelper.cpp index dbac278..4fe1709 100644 --- a/OfficeAssistant_msvc/sqlitehelper.cpp +++ b/OfficeAssistant_msvc/sqlitehelper.cpp @@ -1,4 +1,4 @@ -#include "sqlitehelper.h" +#include "sqlitehelper.h" #include #include @@ -126,7 +126,7 @@ SQLiteHelper::SQLiteHelper(QObject *parent) } if (!db.open()) { - QMessageBox::critical(nullptr, QString::fromLocal8Bit("ʾ"), QString::fromLocal8Bit("޷ݿ")); + QMessageBox::critical(nullptr, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("无法打开数据库")); exit_manager.exit(1); } } @@ -172,9 +172,9 @@ bool SQLiteHelper::update_software() path.remove(path.length() - 1, 1); records.insert(path, record); }*/ - //ʼ˵Ѱװб + //开始菜单中已安装软件列表 WCHAR path[MAX_PATH]; - HRESULT hr = SHGetFolderPathW(nullptr, CSIDL_COMMON_PROGRAMS, nullptr, 0, path);//ȡProgramDataпʼ˵· + HRESULT hr = SHGetFolderPathW(nullptr, CSIDL_COMMON_PROGRAMS, nullptr, 0, path);//获取ProgramData中开始菜单的路径 std::wstring path_str(path); getMenu(path_str, paths); @@ -182,11 +182,11 @@ bool SQLiteHelper::update_software() { path[i] = 0; } - hr = SHGetFolderPathW(nullptr, CSIDL_PROGRAMS, nullptr, 0, path);//ȡûļпʼ˵· + hr = SHGetFolderPathW(nullptr, CSIDL_PROGRAMS, nullptr, 0, path);//获取用户文件夹中开始菜单的路径 path_str.clear(); path_str = std::wstring(path); getMenu(path_str, paths); - // עеѰװб + // 打开注册表中的已安装软件列表 QHash reg_records; HKEY hKey; if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, @@ -226,7 +226,7 @@ bool SQLiteHelper::update_software() &cbSecurityDescriptor, // security descriptor &ftLastWriteTime); // last write time - // öٸбӼ + // 枚举该列表下所有子键 for (DWORD i = 0; i < cSubKeys; i++) { WCHAR szSubKey[MAX_PATH] = { 0 }; @@ -234,7 +234,7 @@ bool SQLiteHelper::update_software() if (RegEnumKeyExW(hKey, i, szSubKey, &dwSize, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) { - // ȡֵ + // 读取软件属性值 HKEY hSubKey; if (RegOpenKeyExW(hKey, szSubKey, 0, KEY_READ | KEY_WOW64_64KEY, &hSubKey) == ERROR_SUCCESS) { @@ -243,7 +243,7 @@ bool SQLiteHelper::update_software() WCHAR buffer[MAX_PATH] = { 0 }; DWORD buffer_num; dwSize = MAX_PATH * sizeof(WCHAR); - //װļ + //安装文件夹 if (RegQueryValueExW(hSubKey, L"InstallLocation", NULL, NULL, (LPBYTE)szProductPath, &dwSize) != ERROR_SUCCESS) { @@ -251,7 +251,7 @@ bool SQLiteHelper::update_software() continue; } QString path = QString::fromWCharArray(szProductPath); - // + //软件名 if (RegQueryValueExW(hSubKey, L"DisplayName", NULL, NULL, (LPBYTE)buffer, &dwSize) != ERROR_SUCCESS) { @@ -260,22 +260,22 @@ bool SQLiteHelper::update_software() } record.name = QString::fromWCharArray(buffer); record.orig_name = QString::fromWCharArray(buffer); - //ͼ + //图标 RegQueryValueExW(hSubKey, L"DisplayIcon", NULL, NULL, (LPBYTE)buffer, &dwSize); record.logo = QString::fromWCharArray(buffer); - //汾 + //主版本号 RegQueryValueExW(hSubKey, L"VersionMajor", NULL, NULL, (LPBYTE)&buffer_num, &dwSize); QString versionMajor = QString::number(buffer_num); - //ΰ汾 + //次版本号 RegQueryValueExW(hSubKey, L"VersionMinor", NULL, NULL, (LPBYTE)&buffer_num, &dwSize); QString versionMinor = QString::number(buffer_num); - //汾źʹΰ汾ƴһ + //将主版本号和次版本号拼接在一起 QString version = versionMajor + "." + versionMinor; record.version = version; - // + //开发者 RegQueryValueExW(hSubKey, L"Publisher", NULL, NULL, (LPBYTE)buffer, &dwSize); record.dev = QString::fromWCharArray(buffer); @@ -336,7 +336,7 @@ bool SQLiteHelper::update_software() &cbSecurityDescriptor, // security descriptor &ftLastWriteTime); // last write time - // öٸбӼ + // 枚举该列表下所有子键 for (DWORD i = 0; i < cSubKeys; i++) { WCHAR szSubKey[MAX_PATH] = { 0 }; @@ -344,7 +344,7 @@ bool SQLiteHelper::update_software() if (RegEnumKeyExW(hkey2, i, szSubKey, &dwSize, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) { - // ȡֵ + // 读取软件属性值 HKEY hSubKey; if (RegOpenKeyExW(hkey2, szSubKey, 0, KEY_READ | KEY_WOW64_64KEY, &hSubKey) == ERROR_SUCCESS) { @@ -353,7 +353,7 @@ bool SQLiteHelper::update_software() WCHAR buffer[MAX_PATH] = { 0 }; DWORD buffer_num; dwSize = MAX_PATH * sizeof(WCHAR); - //װļ + //安装文件夹 if (RegQueryValueExW(hSubKey, L"InstallLocation", NULL, NULL, (LPBYTE)szProductPath, &dwSize) != ERROR_SUCCESS) { @@ -361,7 +361,7 @@ bool SQLiteHelper::update_software() continue; } QString path = QString::fromWCharArray(szProductPath); - // + //软件名 if (RegQueryValueExW(hSubKey, L"DisplayName", NULL, NULL, (LPBYTE)buffer, &dwSize) != ERROR_SUCCESS) { @@ -370,22 +370,22 @@ bool SQLiteHelper::update_software() } record.name = QString::fromWCharArray(buffer); record.orig_name = QString::fromWCharArray(buffer); - //ͼ + //图标 RegQueryValueExW(hSubKey, L"DisplayIcon", NULL, NULL, (LPBYTE)buffer, &dwSize); record.logo = QString::fromWCharArray(buffer); - //汾 + //主版本号 RegQueryValueExW(hSubKey, L"VersionMajor", NULL, NULL, (LPBYTE)&buffer_num, &dwSize); QString versionMajor = QString::number(buffer_num); - //ΰ汾 + //次版本号 RegQueryValueExW(hSubKey, L"VersionMinor", NULL, NULL, (LPBYTE)&buffer_num, &dwSize); QString versionMinor = QString::number(buffer_num); - //汾źʹΰ汾ƴһ + //将主版本号和次版本号拼接在一起 QString version = versionMajor + "." + versionMinor; record.version = version; - // + //开发者 RegQueryValueExW(hSubKey, L"Publisher", NULL, NULL, (LPBYTE)buffer, &dwSize); record.dev = QString::fromWCharArray(buffer); @@ -445,7 +445,7 @@ bool SQLiteHelper::update_software() &cbSecurityDescriptor, // security descriptor &ftLastWriteTime); // last write time - // öٸбӼ + // 枚举该列表下所有子键 for (DWORD i = 0; i < cSubKeys; i++) { WCHAR szSubKey[MAX_PATH] = { 0 }; @@ -453,7 +453,7 @@ bool SQLiteHelper::update_software() if (RegEnumKeyExW(hkey3, i, szSubKey, &dwSize, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) { - // ȡֵ + // 读取软件属性值 HKEY hSubKey; if (RegOpenKeyExW(hkey3, szSubKey, 0, KEY_READ | KEY_WOW64_64KEY, &hSubKey) == ERROR_SUCCESS) { @@ -462,7 +462,7 @@ bool SQLiteHelper::update_software() WCHAR buffer[MAX_PATH] = { 0 }; DWORD buffer_num; dwSize = MAX_PATH * sizeof(WCHAR); - //װļ + //安装文件夹 if (RegQueryValueExW(hSubKey, L"InstallLocation", NULL, NULL, (LPBYTE)szProductPath, &dwSize) != ERROR_SUCCESS) { @@ -470,7 +470,7 @@ bool SQLiteHelper::update_software() continue; } QString path = QString::fromWCharArray(szProductPath); - // + //软件名 if (RegQueryValueExW(hSubKey, L"DisplayName", NULL, NULL, (LPBYTE)buffer, &dwSize) != ERROR_SUCCESS) { @@ -479,22 +479,22 @@ bool SQLiteHelper::update_software() } record.name = QString::fromWCharArray(buffer); record.orig_name = QString::fromWCharArray(buffer); - //ͼ + //图标 RegQueryValueExW(hSubKey, L"DisplayIcon", NULL, NULL, (LPBYTE)buffer, &dwSize); record.logo = QString::fromWCharArray(buffer); - //汾 + //主版本号 RegQueryValueExW(hSubKey, L"VersionMajor", NULL, NULL, (LPBYTE)&buffer_num, &dwSize); QString versionMajor = QString::number(buffer_num); - //ΰ汾 + //次版本号 RegQueryValueExW(hSubKey, L"VersionMinor", NULL, NULL, (LPBYTE)&buffer_num, &dwSize); QString versionMinor = QString::number(buffer_num); - //汾źʹΰ汾ƴһ + //将主版本号和次版本号拼接在一起 QString version = versionMajor + "." + versionMinor; record.version = version; - // + //开发者 RegQueryValueExW(hSubKey, L"Publisher", NULL, NULL, (LPBYTE)buffer, &dwSize); record.dev = QString::fromWCharArray(buffer); @@ -551,7 +551,7 @@ bool SQLiteHelper::update_software() &cbSecurityDescriptor, // security descriptor &ftLastWriteTime); // last write time - // öٸбӼ + // 枚举该列表下所有子键 for (DWORD i = 0; i < cSubKeys; i++) for (DWORD i = 0; ; i++) { @@ -560,7 +560,7 @@ bool SQLiteHelper::update_software() if (RegEnumKeyExW(hkey4, i, szSubKey, &dwSize, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) { - //ȡֵ + //读取软件属性值 HKEY hSubKey; if (RegOpenKeyExW(hkey3, szSubKey, 0, KEY_READ | KEY_WOW64_64KEY, &hSubKey) == ERROR_SUCCESS) { @@ -569,7 +569,7 @@ bool SQLiteHelper::update_software() WCHAR buffer[MAX_PATH] = { 0 }; DWORD buffer_num; dwSize = MAX_PATH * sizeof(WCHAR); - //װļ + //安装文件夹 if (RegQueryValueExW(hSubKey, L"InstallLocation", NULL, NULL, (LPBYTE)szProductPath, &dwSize) != ERROR_SUCCESS) { @@ -577,7 +577,7 @@ bool SQLiteHelper::update_software() continue; } QString path = QString::fromWCharArray(szProductPath); - // + //软件名 if (RegQueryValueExW(hSubKey, L"DisplayName", NULL, NULL, (LPBYTE)buffer, &dwSize) != ERROR_SUCCESS) { @@ -586,22 +586,22 @@ bool SQLiteHelper::update_software() } record.name = QString::fromWCharArray(buffer); record.orig_name = QString::fromWCharArray(buffer); - //ͼ + //图标 RegQueryValueExW(hSubKey, L"DisplayIcon", NULL, NULL, (LPBYTE)buffer, &dwSize); record.logo = QString::fromWCharArray(buffer); - //汾 + //主版本号 RegQueryValueExW(hSubKey, L"VersionMajor", NULL, NULL, (LPBYTE)&buffer_num, &dwSize); QString versionMajor = QString::number(buffer_num); - //ΰ汾 + //次版本号 RegQueryValueExW(hSubKey, L"VersionMinor", NULL, NULL, (LPBYTE)&buffer_num, &dwSize); QString versionMinor = QString::number(buffer_num); - //汾źʹΰ汾ƴһ + //将主版本号和次版本号拼接在一起 QString version = versionMajor + "." + versionMinor; record.version = version; - // + //开发者 RegQueryValueExW(hSubKey, L"Publisher", NULL, NULL, (LPBYTE)buffer, &dwSize); record.dev = QString::fromWCharArray(buffer); @@ -622,7 +622,7 @@ bool SQLiteHelper::update_software() } } - //Ա·ҳ֣ + //对比两个路径,找出公共部分(划掉) QHash public_programs_list; /*for(auto path:*paths) { @@ -679,7 +679,7 @@ bool SQLiteHelper::update_software() } } - //󣬲ȫֶ + //进行网络请求,补全字段 SoftwareRequest software_request; bool ok=software_request.sendRequest(*paths,&public_programs_list,array); if(!ok) @@ -882,7 +882,7 @@ void SetSVGBackColor(QDomElement& elem, QString strtagname, QString strattr, QSt bool SQLiteHelper::get_software(QList* button_structs, ConfigResponse* config_response) { QSqlQuery query(db); - QString sql = "select * from kmd_menu where type='navbar' order by sort,orig_name asc ;"; + QString sql = "select * from kmd_menu where is_navbar=1 order by sort,orig_name asc ;"; if (!query.exec(sql)) { return false; @@ -906,7 +906,7 @@ bool SQLiteHelper::get_software(QList* button_structs, ConfigRespo buffer = file.readAll(); QJsonDocument result; result = QJsonDocument::fromJson(buffer); - // + //如果数据完整 if (result.isObject()) { QJsonObject obj_root = result.object(); QJsonArray array; @@ -1003,19 +1003,19 @@ bool SQLiteHelper::get_software(QList* button_structs, ConfigRespo QSvgRenderer* render_image = new QSvgRenderer(*buffer); QPainter painter_image(image); - painter_image.setCompositionMode(QPainter::CompositionMode_Clear); // - painter_image.fillRect(image->rect(), Qt::transparent); // ͸ɫ - painter_image.setCompositionMode(QPainter::CompositionMode_SourceOver); // ָĬֵ + 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(*buffer); SetSVGBackColor(doc.documentElement(), "path", "fill", title_cover_color); QSvgRenderer* render_image_cover = new QSvgRenderer(doc.toByteArray()); QPainter painter_image_cover(image_cover); - painter_image_cover.setCompositionMode(QPainter::CompositionMode_Clear); // - painter_image_cover.fillRect(image_cover->rect(), Qt::transparent); // ͸ɫ - painter_image_cover.setCompositionMode(QPainter::CompositionMode_SourceOver); // ָĬֵ + painter_image_cover.setCompositionMode(QPainter::CompositionMode_Clear); // 清除画布 + painter_image_cover.fillRect(image_cover->rect(), Qt::transparent); // 填充透明色 + painter_image_cover.setCompositionMode(QPainter::CompositionMode_SourceOver); // 恢复默认值 render_image_cover->render(&painter_image_cover); delete render_image; @@ -1048,19 +1048,19 @@ bool SQLiteHelper::get_software(QList* button_structs, ConfigRespo file.close(); QSvgRenderer* render_image = new QSvgRenderer(svg_buffer); QPainter painter_image(image); - painter_image.setCompositionMode(QPainter::CompositionMode_Clear); // - painter_image.fillRect(image->rect(), Qt::transparent); // ͸ɫ - painter_image.setCompositionMode(QPainter::CompositionMode_SourceOver); // ָĬֵ + 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()); QPainter painter_image_cover(image_cover); - painter_image_cover.setCompositionMode(QPainter::CompositionMode_Clear); // - painter_image_cover.fillRect(image_cover->rect(), Qt::transparent); // ͸ɫ - painter_image_cover.setCompositionMode(QPainter::CompositionMode_SourceOver); // ָĬֵ + painter_image_cover.setCompositionMode(QPainter::CompositionMode_Clear); // 清除画布 + painter_image_cover.fillRect(image_cover->rect(), Qt::transparent); // 填充透明色 + painter_image_cover.setCompositionMode(QPainter::CompositionMode_SourceOver); // 恢复默认值 render_image_cover->render(&painter_image_cover); delete render_image; @@ -1076,19 +1076,19 @@ bool SQLiteHelper::get_software(QList* button_structs, ConfigRespo file.close(); QSvgRenderer* render_image = new QSvgRenderer(svg_buffer); QPainter painter_image(image); - painter_image.setCompositionMode(QPainter::CompositionMode_Clear); // - painter_image.fillRect(image->rect(), Qt::transparent); // ͸ɫ - painter_image.setCompositionMode(QPainter::CompositionMode_SourceOver); // ָĬֵ + 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()); QPainter painter_image_cover(image_cover); - painter_image_cover.setCompositionMode(QPainter::CompositionMode_Clear); // - painter_image_cover.fillRect(image_cover->rect(), Qt::transparent); // ͸ɫ - painter_image_cover.setCompositionMode(QPainter::CompositionMode_SourceOver); // ָĬֵ + painter_image_cover.setCompositionMode(QPainter::CompositionMode_Clear); // 清除画布 + painter_image_cover.fillRect(image_cover->rect(), Qt::transparent); // 填充透明色 + painter_image_cover.setCompositionMode(QPainter::CompositionMode_SourceOver); // 恢复默认值 render_image_cover->render(&painter_image_cover); delete render_image; @@ -1258,7 +1258,7 @@ bool SQLiteHelper::insert_software(QString name, QString orig_name, QString path query.addBindValue(true); if(!query.exec()) { - //QMessageBox::critical(nullptr, QString::fromLocal8Bit(""), QString::fromLocal8Bit("дݿʧ")); + //QMessageBox::critical(nullptr, QString::fromLocal8Bit("错误"), QString::fromLocal8Bit("写入数据库失败")); return false; } for (int i = 0; i < 8; i++) @@ -1324,7 +1324,7 @@ bool SQLiteHelper::get_category(QList& categrories,bool is_edit,bool } while (query.next()) { - if (query.value("name") == QString::fromLocal8Bit("ȫ")) + if (query.value("name") == QString::fromLocal8Bit("全部")) { continue; } @@ -1361,7 +1361,7 @@ bool SQLiteHelper::get_category(QList& categrories,bool is_edit,bool } while (query.next()) { - if (query.value("name") == QString::fromLocal8Bit("ȫ")) + if (query.value("name") == QString::fromLocal8Bit("全部")) { continue; } diff --git a/identifier.sqlite b/identifier.sqlite index c220750..d0909f4 100644 Binary files a/identifier.sqlite and b/identifier.sqlite differ diff --git a/images/app.png b/images/app.png new file mode 100644 index 0000000..1768d21 Binary files /dev/null and b/images/app.png differ diff --git a/images/icon/default.svg b/images/icon/default.svg deleted file mode 100644 index 7d800b8..0000000 --- a/images/icon/default.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icon/logo_navbar.png b/images/icon/logo_navbar.png deleted file mode 100644 index e8c0e4a..0000000 Binary files a/images/icon/logo_navbar.png and /dev/null differ diff --git a/images/logo.png b/images/logo.png index e8c0e4a..3b74073 100644 Binary files a/images/logo.png and b/images/logo.png differ diff --git a/images/logo_titlebar.png b/images/logo_titlebar.png new file mode 100644 index 0000000..1768d21 Binary files /dev/null and b/images/logo_titlebar.png differ diff --git a/images/software/HAO123_原始名称.svg b/images/software/HAO123_原始名称.svg deleted file mode 100644 index 471f1d2..0000000 --- a/images/software/HAO123_原始名称.svg +++ /dev/null @@ -1,72 +0,0 @@ - - - - - 发生错误 - - - - - - -
-
- -
-
- 你所浏览的页面暂时无法访问{"s":"\/assets\/addons\/kmdsoft\/images\/wxdk\/menu\/hao123.svg"}
-
-
- -

- 你可以返回上一页重试

- -
- -
- - diff --git a/images/svg/.svg b/images/svg/.svg deleted file mode 100644 index e69de29..0000000 diff --git a/images/svg/360_原始名称.svg b/images/svg/360_原始名称.svg deleted file mode 100644 index e79f4a4..0000000 --- a/images/svg/360_原始名称.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/svg/HAO123_原始名称.svg b/images/svg/HAO123_原始名称.svg deleted file mode 100644 index 770b047..0000000 --- a/images/svg/HAO123_原始名称.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/svg/default.svg b/images/svg/default.svg index 7d800b8..ed50d1a 100644 --- a/images/svg/default.svg +++ b/images/svg/default.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/images/svg/修改-原始名称.svg b/images/svg/修改-原始名称.svg deleted file mode 100644 index e79f4a4..0000000 --- a/images/svg/修改-原始名称.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file