完成1.更新数据库2.获取导航栏

master
Mike Solar 2023-08-08 15:15:19 +08:00
parent 4220083ac3
commit 0ecf1bdf6a
22 changed files with 1365 additions and 636 deletions

Binary file not shown.

View File

@ -14,16 +14,18 @@
<ProjectGuid>{A49230DF-A869-4AA1-8ACA-3C7322530E46}</ProjectGuid> <ProjectGuid>{A49230DF-A869-4AA1-8ACA-3C7322530E46}</ProjectGuid>
<Keyword>QtVS_v304</Keyword> <Keyword>QtVS_v304</Keyword>
<QtMsBuild Condition="'$(QtMsBuild)'=='' OR !Exists('$(QtMsBuild)\qt.targets')">$(MSBuildProjectDirectory)\QtMsBuild</QtMsBuild> <QtMsBuild Condition="'$(QtMsBuild)'=='' OR !Exists('$(QtMsBuild)\qt.targets')">$(MSBuildProjectDirectory)\QtMsBuild</QtMsBuild>
<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">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v140_xp</PlatformToolset> <PlatformToolset>v141_xp</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v140_xp</PlatformToolset> <PlatformToolset>v141_xp</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Condition="Exists('$(QtMsBuild)\qt_defaults.props')"> <ImportGroup Condition="Exists('$(QtMsBuild)\qt_defaults.props')">
@ -31,12 +33,12 @@
</ImportGroup> </ImportGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|Win32'" Label="QtSettings"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|Win32'" Label="QtSettings">
<QtInstall>5.6.3_msvc2015</QtInstall> <QtInstall>5.6.3_msvc2015</QtInstall>
<QtModules>core;gui;widgets;network</QtModules> <QtModules>core;gui;widgets;network;svg;sql;xml</QtModules>
<QtBuildConfig>debug</QtBuildConfig> <QtBuildConfig>debug</QtBuildConfig>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|Win32'" Label="QtSettings"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|Win32'" Label="QtSettings">
<QtInstall>5.6.3_msvc2015</QtInstall> <QtInstall>5.6.3_msvc2015</QtInstall>
<QtModules>core;gui;widgets</QtModules> <QtModules>core;gui;widgets;sql;svg;network;xml</QtModules>
<QtBuildConfig>release</QtBuildConfig> <QtBuildConfig>release</QtBuildConfig>
</PropertyGroup> </PropertyGroup>
<Target Name="QtMsBuildNotFound" BeforeTargets="CustomBuild;ClCompile" Condition="!Exists('$(QtMsBuild)\qt.targets') or !Exists('$(QtMsBuild)\qt.props')"> <Target Name="QtMsBuildNotFound" BeforeTargets="CustomBuild;ClCompile" Condition="!Exists('$(QtMsBuild)\qt.targets') or !Exists('$(QtMsBuild)\qt.props')">
@ -60,11 +62,14 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>
<AdditionalIncludeDirectories>$(ProjectDir)\$(Configuration);.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ProjectDir)\$(Configuration);.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>/Zc:strictStrings- %(AdditionalOptions)</AdditionalOptions>
</ClCompile> </ClCompile>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile> <ClCompile>
<AdditionalIncludeDirectories>$(ProjectDir)\$(Configuration);.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ProjectDir)\$(Configuration);.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
<AdditionalOptions>/Zc:strictStrings- %(AdditionalOptions)</AdditionalOptions>
</ClCompile> </ClCompile>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|Win32'" Label="Configuration"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|Win32'" Label="Configuration">
@ -99,10 +104,12 @@
<ItemGroup> <ItemGroup>
<ClInclude Include="buttonstruct.h" /> <ClInclude Include="buttonstruct.h" />
<ClInclude Include="config.h" /> <ClInclude Include="config.h" />
<QtMoc Include="exitmanager.h" />
<ClInclude Include="globalvariables.h" /> <ClInclude Include="globalvariables.h" />
<QtMoc Include="qminiblink.h" /> <QtMoc Include="qminiblink.h" />
<QtMoc Include="mysettingsdialog.h" /> <QtMoc Include="mysettingsdialog.h" />
<ClInclude Include="resource.h" /> <ClInclude Include="resource.h" />
<QtMoc Include="sqlitehelper.h" />
<ClInclude Include="wke.h" /> <ClInclude Include="wke.h" />
<QtMoc Include="mainwindowlayout.h" /> <QtMoc Include="mainwindowlayout.h" />
<QtMoc Include="mainwindow.h" /> <QtMoc Include="mainwindow.h" />
@ -121,6 +128,7 @@
<ClCompile Include="navbar.cpp" /> <ClCompile Include="navbar.cpp" />
<ClCompile Include="netio.cpp" /> <ClCompile Include="netio.cpp" />
<ClCompile Include="qminiblink.cpp" /> <ClCompile Include="qminiblink.cpp" />
<ClCompile Include="sqlitehelper.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<QtUic Include="mainscreen.ui" /> <QtUic Include="mainscreen.ui" />

View File

@ -22,11 +22,6 @@
<Extensions>ts</Extensions> <Extensions>ts</Extensions>
</Filter> </Filter>
</ItemGroup> </ItemGroup>
<ItemGroup>
<QtRcc Include="OfficeAssistant_msvc.qrc">
<Filter>Resource Files</Filter>
</QtRcc>
</ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="buttonstruct.h"> <ClInclude Include="buttonstruct.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
@ -69,6 +64,12 @@
<QtMoc Include="mysettingsdialog.h"> <QtMoc Include="mysettingsdialog.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</QtMoc> </QtMoc>
<QtMoc Include="sqlitehelper.h">
<Filter>Header Files</Filter>
</QtMoc>
<QtMoc Include="exitmanager.h">
<Filter>Header Files</Filter>
</QtMoc>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="main.cpp"> <ClCompile Include="main.cpp">
@ -83,9 +84,6 @@
<ClCompile Include="mainwindowlayout.cpp"> <ClCompile Include="mainwindowlayout.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="MyButton.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="navbar.cpp"> <ClCompile Include="navbar.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
@ -98,6 +96,12 @@
<ClCompile Include="mysettingsdialog.cpp"> <ClCompile Include="mysettingsdialog.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="sqlitehelper.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="MyButton.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<QtUic Include="navbar.ui"> <QtUic Include="navbar.ui">
@ -129,4 +133,9 @@
<Filter>Resource Files</Filter> <Filter>Resource Files</Filter>
</Image> </Image>
</ItemGroup> </ItemGroup>
<ItemGroup>
<QtRcc Include="OfficeAssistant_msvc.qrc">
<Filter>Resource Files</Filter>
</QtRcc>
</ItemGroup>
</Project> </Project>

View File

@ -5,9 +5,9 @@
<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-03T08:03:42.8435391Z</QtLastBackgroundBuild> <QtLastBackgroundBuild>2023-08-06T14:26:06.9540300Z</QtLastBackgroundBuild>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<QtLastBackgroundBuild>2023-08-03T08:03:43.2818738Z</QtLastBackgroundBuild> <QtLastBackgroundBuild>2023-08-08T01:58:34.1935757Z</QtLastBackgroundBuild>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View File

@ -1,18 +1,20 @@
// //
// Created by HW on 2023/07/26. // Created by HW on 2023/07/26.
// //
#ifndef OFFICEASSISTANT_BUTTONSTRUCT_H #ifndef OFFICEASSISTANT_BUTTONSTRUCT_H
#define OFFICEASSISTANT_BUTTONSTRUCT_H #define OFFICEASSISTANT_BUTTONSTRUCT_H
#include <QString> #include <QString>
#include <QImage> #include <QImage>
typedef struct taButtonStruct{ typedef struct taButtonStruct{
QImage *image; QImage *image;
QImage *image_cover; QImage *image_cover;
QString text; QString text;
QString url; QString orig_name;
QString background_color; QString url;
QColor text_color; QString background_color;
QColor text_cover_color; QColor text_color;
}ButtonStruct; QColor text_cover_color;
#endif //OFFICEASSISTANT_BUTTONSTRUCT_H QString path;
}ButtonStruct;
#endif //OFFICEASSISTANT_BUTTONSTRUCT_H

View File

@ -1,21 +1,22 @@
// //
// Created by HW on 2023/07/27. // Created by HW on 2023/07/27.
// //
#ifndef OFFICEASSISTANT_CONFIG_H #ifndef OFFICEASSISTANT_CONFIG_H
#define OFFICEASSISTANT_CONFIG_H #define OFFICEASSISTANT_CONFIG_H
#define CONFIG_URL "http://softapi.s103.y01.cn/addons/Kmdsoft/Index/config" //获取导航栏信息的地址 #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 OP_URL "http://softapi.s103.y01.cn/addons/Kmdsoft/Index/op" //上传是否设置开机启动、是否建立桌面快捷方式的地址
#define DEVICE_URL "http://softapi.s103.y01.cn/addons/Kmdsoft/Index/device" //上传设备信息的地址 #define DEVICE_URL "http://softapi.s103.y01.cn/addons/Kmdsoft/Index/device" //上传设备信息的地址
#define BASE_URL "http://softapi.s103.y01.cn/" //域名 #define BASE_URL "http://softapi.s103.y01.cn/" //域名
#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 "/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
#define ADD_SHORTCUT 2 #define ADD_SHORTCUT 2
#define VERSION "1.0.0" //软件版本 #define VERSION "1.0.0" //软件版本
#define RELEASE "20230801" //Release #define RELEASE "20230801" //Release
#endif //OFFICEASSISTANT_CONFIG_H #define SOFTWARE_URL "http://softapi.1.y01.cn/addons/Kmdsoft/Index/soft"
#endif //OFFICEASSISTANT_CONFIG_H

View File

@ -0,0 +1,52 @@
#pragma once
#include <QObject>
#include <QList>
template <typename T>
class AutoDeleteList
{
public:
// 添加对象
void add(T *obj)
{
objs.append(obj);
}
// 析构对象列表
~AutoDeleteList()
{
qDeleteAll(objs);
}
private:
QList<T *> objs;
};
class ExitManager : public QObject
{
Q_OBJECT
public:
// 添加需要在退出时自动析构的对象
template <typename T>
void add(T *obj)
{
autoDeleteList.add(obj);
}
// 退出应用程序
void exit(int exitCode = 0)
{
// 发射退出应用程序信号
emit exitApplication(exitCode);
}
signals:
// 退出应用程序信号
void exitApplication(int exitCode);
private:
// 自动析构对象列表
AutoDeleteList<QObject> autoDeleteList;
};

View File

@ -1,11 +1,13 @@
// //
// Created by HW on 2023/07/27. // Created by HW on 2023/07/27.
// //
#ifndef OFFICEASSISTANT_GLOBALVARIABLES_H #ifndef OFFICEASSISTANT_GLOBALVARIABLES_H
#define OFFICEASSISTANT_GLOBALVARIABLES_H #define OFFICEASSISTANT_GLOBALVARIABLES_H
class MainWindowLayout; #include "exitmanager.h"
extern double scale; class MainWindowLayout;
extern MainWindowLayout *mainWindowLayout; extern ExitManager exit_manager;
extern QString url_param; extern double scale;
#endif //OFFICEASSISTANT_GLOBALVARIABLES_H extern MainWindowLayout *mainWindowLayout;
extern QString url_param;
#endif //OFFICEASSISTANT_GLOBALVARIABLES_H

View File

@ -1,33 +1,34 @@
// //
// Created by HW on 2023/07/26. // Created by HW on 2023/07/26.
// //
// You may need to build the project (run Qt uic code generator) to get "ui_MainWindow.h" resolved // You may need to build the project (run Qt uic code generator) to get "ui_MainWindow.h" resolved
#include "mainwindow.h" #include "mainwindow.h"
#include "ui_MainWindow.h" #include "ui_MainWindow.h"
#include "config.h" #include "config.h"
MainWindow::MainWindow(QWidget *parent) : ExitManager exit_manager;
QMainWindow(parent), ui(new Ui::MainWindow) { MainWindow::MainWindow(QWidget *parent) :
ui->setupUi(this); QMainWindow(parent), ui(new Ui::MainWindow) {
QDesktopWidget* desktopWidget = QApplication::desktop(); ui->setupUi(this);
QRect deskRect = desktopWidget->availableGeometry(); QDesktopWidget* desktopWidget = QApplication::desktop();
resize(deskRect.width()*0.8, deskRect.height()*0.8); QRect deskRect = desktopWidget->availableGeometry();
setWindowState(Qt::WindowMaximized); resize(deskRect.width()*0.8, deskRect.height()*0.8);
mainWindowLayout=new MainWindowLayout(this); setWindowState(Qt::WindowMaximized);
setCentralWidget(mainWindowLayout); mainWindowLayout=new MainWindowLayout(this);
setWindowTitle(QString::fromLocal8Bit(NAME)); setCentralWidget(mainWindowLayout);
QString path = QApplication::applicationDirPath(); setWindowTitle(QString::fromLocal8Bit(NAME));
path += LOGO_TITLEBAR; QString path = QApplication::applicationDirPath();
icon = new QIcon(path); path += LOGO_TITLEBAR;
setWindowIcon(*icon); icon = new QIcon(path);
setWindowIcon(*icon);
}
}
MainWindow::~MainWindow() {
delete icon; MainWindow::~MainWindow() {
this->setCentralWidget(nullptr); delete icon;
delete mainWindowLayout; this->setCentralWidget(nullptr);
delete ui; delete mainWindowLayout;
} delete ui;
}

View File

@ -1,33 +1,34 @@
// //
// Created by HW on 2023/07/26. // Created by HW on 2023/07/26.
// //
#ifndef UNTITLED_MAINWINDOW_H #ifndef UNTITLED_MAINWINDOW_H
#define UNTITLED_MAINWINDOW_H #define UNTITLED_MAINWINDOW_H
#include <QMainWindow> #include <QMainWindow>
#include <QVBoxLayout> #include <QVBoxLayout>
#include "mainwindowlayout.h" #include "mainwindowlayout.h"
#include <QIcon> #include <QIcon>
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; } QT_BEGIN_NAMESPACE
QT_END_NAMESPACE namespace Ui { class MainWindow; }
QT_END_NAMESPACE
class MainWindow : public QMainWindow {
Q_OBJECT class MainWindow : public QMainWindow {
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = nullptr); public:
explicit MainWindow(QWidget *parent = nullptr);
~MainWindow() override;
~MainWindow() override;
private:
Ui::MainWindow *ui; private:
QIcon *icon; Ui::MainWindow *ui;
QVBoxLayout *layout; QIcon *icon;
MainWindowLayout *mainWindowLayout; QVBoxLayout *layout;
}; MainWindowLayout *mainWindowLayout;
};
#endif //UNTITLED_MAINWINDOW_H
#endif //UNTITLED_MAINWINDOW_H

View File

@ -1,71 +1,74 @@
// //
// Created by HW on 2023/07/26. // Created by HW on 2023/07/26.
// //
// You may need to build the project (run Qt uic code generator) to get "ui_MainWindowLagout.h" resolved // You may need to build the project (run Qt uic code generator) to get "ui_MainWindowLagout.h" resolved
#include "mainwindowlayout.h" #include "mainwindowlayout.h"
#include "ui_MainWindowLayout.h" #include "ui_MainWindowLayout.h"
#include "mysettingsdialog.h" #include "mysettingsdialog.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);
layout=new QVBoxLayout(this); layout=new QVBoxLayout(this);
mainWindowLayout = this; mainWindowLayout = this;
ConfigRequest *configRequest = new ConfigRequest; SQLiteHelper sqlite_helper;
configResponse = new ConfigResponse; QList<ButtonStruct> list;
configRequest->sendRequest(configResponse); sqlite_helper.get_software(&list);
mainScreen = new MainScreen(this); ConfigRequest *configRequest = new ConfigRequest;
navBar=new NavBar(configResponse,mainScreen,this); configResponse = new ConfigResponse;
navBar->setMinimumHeight(0); configRequest->sendRequest(configResponse);
navBar->setMaximumHeight(this->height() / 8); mainScreen = new MainScreen(this);
mainScreen->setMinimumHeight(0); navBar=new NavBar(configResponse,mainScreen,this);
//navBar->setAttribute(Qt::WA_DeleteOnClose); navBar->setMinimumHeight(0);
delete configRequest; navBar->setMaximumHeight(this->height() / 8);
//QSizePolicy sizePolicy(QSizePolicy::Policy::Fixed, QSizePolicy::QSizePolicy::Fixed); mainScreen->setMinimumHeight(0);
//navBar->setSizePolicy(sizePolicy); //navBar->setAttribute(Qt::WA_DeleteOnClose);
//layout->setContentsMargins(0, 0, 0, 0); delete configRequest;
layout->addWidget(navBar,1); //QSizePolicy sizePolicy(QSizePolicy::Policy::Fixed, QSizePolicy::QSizePolicy::Fixed);
layout->addWidget(mainScreen,7); //navBar->setSizePolicy(sizePolicy);
layout->setMargin(0); //layout->setContentsMargins(0, 0, 0, 0);
setLayout(layout); layout->addWidget(navBar,1);
connect(this,&MainWindowLayout::clickButton1,mainScreen,&MainScreen::clickButton1); layout->addWidget(mainScreen,7);
} layout->setMargin(0);
setLayout(layout);
MainWindowLayout::~MainWindowLayout() { connect(this,&MainWindowLayout::clickButton1,mainScreen,&MainScreen::clickButton1);
delete configResponse; }
layout->removeWidget(mainScreen);
layout->removeWidget(navBar); MainWindowLayout::~MainWindowLayout() {
delete mainScreen; delete configResponse;
//delete[] list[0]; layout->removeWidget(mainScreen);
delete navBar; layout->removeWidget(navBar);
delete layout; delete mainScreen;
delete ui; //delete[] list[0];
} delete navBar;
delete layout;
void MainWindowLayout::resizeEvent(QResizeEvent *event) { delete ui;
QWidget::resizeEvent(event); }
navBar->setMaximumHeight(event->size().height()/8);
//layout->setAlignment(Qt::AlignmentFlag::AlignHCenter); void MainWindowLayout::resizeEvent(QResizeEvent *event) {
} QWidget::resizeEvent(event);
navBar->setMaximumHeight(event->size().height()/8);
void MainWindowLayout::clickButton(QString text, QString url) { //layout->setAlignment(Qt::AlignmentFlag::AlignHCenter);
QString path = QApplication::applicationDirPath(); }
path += "/app/startcalc.exe";
path.replace("/", "\\"); void MainWindowLayout::clickButton(QString text, QString url) {
if (text== QString::fromLocal8Bit("¼ÆËãÆ÷")) { QString path = QApplication::applicationDirPath();
WinExec(path.toStdString().c_str(), SW_SHOW); path += "/app/startcalc.exe";
} path.replace("/", "\\");
else if (text == QString::fromLocal8Bit("Èí¼þÉèÖÃ")) { if (text== QString::fromLocal8Bit("¼ÆËãÆ÷")) {
MySettingsDialog *settings = new MySettingsDialog; WinExec(path.toStdString().c_str(), SW_SHOW);
settings->exec(); }
delete settings; else if (text == QString::fromLocal8Bit("Èí¼þÉèÖÃ")) {
} MySettingsDialog *settings = new MySettingsDialog;
else{ settings->exec();
emit clickButton1(text, url); delete settings;
} }
} else{
emit clickButton1(text, url);
MainWindowLayout *mainWindowLayout; }
}
MainWindowLayout *mainWindowLayout;

View File

@ -1,112 +1,112 @@
#include "mysettingsdialog.h" #include "mysettingsdialog.h"
#include <Windows.h> #include <Windows.h>
#include <QClipBoard> #include <QClipBoard>
#include "netio.h" #include "netio.h"
#include "config.h" #include "config.h"
#include "globalvariables.h" #include "globalvariables.h"
MySettingsDialog::MySettingsDialog(QWidget *parent) MySettingsDialog::MySettingsDialog(QWidget *parent)
: QDialog(parent) : QDialog(parent)
{ {
ui.setupUi(this); ui.setupUi(this);
setWindowFlags(Qt::WindowCloseButtonHint); setWindowFlags(Qt::WindowCloseButtonHint);
this->setFixedSize(width(), height()); this->setFixedSize(width(), height());
HKEY hRoot = HKEY_CURRENT_USER; HKEY hRoot = HKEY_CURRENT_USER;
wchar_t *szSubKey = L"Software\\Microsoft\\Windows\\CurrentVersion\\Run"; wchar_t *szSubKey = (wchar_t *)"Software\\Microsoft\\Windows\\CurrentVersion\\Run";
HKEY hKey; HKEY hKey;
DWORD dwDisposition = REG_OPENED_EXISTING_KEY; // 如果不存在不创建 DWORD dwDisposition = REG_OPENED_EXISTING_KEY; // 如果不存在不创建
LONG lRet = RegCreateKeyEx(hRoot, szSubKey, 0, NULL, LONG lRet = RegCreateKeyEx(hRoot, szSubKey, 0, NULL,
REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &dwDisposition); REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &dwDisposition);
if (lRet != ERROR_SUCCESS) { if (lRet != ERROR_SUCCESS) {
ui.autostart->setDisabled(true); ui.autostart->setDisabled(true);
} }
QString app = QApplication::applicationFilePath(); QString app = QApplication::applicationFilePath();
app.replace("/", "\\"); app.replace("/", "\\");
DWORD size=128+sizeof(wchar_t); DWORD size=128+sizeof(wchar_t);
char reg[128] = { 0 }; char reg[128] = { 0 };
lRet = RegQueryValueEx(hKey, L"OfficeAssistant", NULL, NULL,(LPBYTE)reg, &size); lRet = RegQueryValueEx(hKey, L"OfficeAssistant", NULL, NULL,(LPBYTE)reg, &size);
if (lRet==0) { if (lRet==0) {
ui.autostart->setChecked(true); ui.autostart->setChecked(true);
} }
copyButton = ui.copy; copyButton = ui.copy;
connect(copyButton, &QPushButton::clicked, this, &MySettingsDialog::copyToCLipboard); connect(copyButton, &QPushButton::clicked, this, &MySettingsDialog::copyToCLipboard);
connect(ui.autostart, &QCheckBox::stateChanged, this, &MySettingsDialog::autoStart); connect(ui.autostart, &QCheckBox::stateChanged, this, &MySettingsDialog::autoStart);
connect(ui.addshortcut, &QPushButton::clicked, this, &MySettingsDialog::createShortcut); connect(ui.addshortcut, &QPushButton::clicked, this, &MySettingsDialog::createShortcut);
connect(ui.law_button, &QPushButton::clicked, this, &MySettingsDialog::law); connect(ui.law_button, &QPushButton::clicked, this, &MySettingsDialog::law);
ui.code->setText(QString(QCryptographicHash::hash(getMachineGUID().toUtf8(), QCryptographicHash::Md5).toHex())); ui.code->setText(QString(QCryptographicHash::hash(getMachineGUID().toUtf8(), QCryptographicHash::Md5).toHex()));
ui.version->setText(QString(VERSION) + "-" + QString(RELEASE)); ui.version->setText(QString(VERSION) + "-" + QString(RELEASE));
} }
MySettingsDialog::~MySettingsDialog() MySettingsDialog::~MySettingsDialog()
{ {
} }
void MySettingsDialog::autoStart(int state) void MySettingsDialog::autoStart(int state)
{ {
if (state == Qt::Checked) { if (state == Qt::Checked) {
HKEY hRoot = HKEY_CURRENT_USER; HKEY hRoot = HKEY_CURRENT_USER;
wchar_t *szSubKey = L"Software\\Microsoft\\Windows\\CurrentVersion\\Run"; wchar_t *szSubKey = (wchar_t*)L"Software\\Microsoft\\Windows\\CurrentVersion\\Run";
HKEY hKey; HKEY hKey;
DWORD dwDisposition = REG_OPENED_EXISTING_KEY; // 如果不存在不创建 DWORD dwDisposition = REG_OPENED_EXISTING_KEY; // 如果不存在不创建
LONG lRet = RegCreateKeyEx(hRoot, szSubKey, 0, NULL, LONG lRet = RegCreateKeyEx(hRoot, szSubKey, 0, NULL,
REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &dwDisposition); REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &dwDisposition);
if (lRet != ERROR_SUCCESS) { if (lRet != ERROR_SUCCESS) {
QMessageBox::critical(this, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("创建开机启动项失败")); QMessageBox::critical(this, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("创建开机启动项失败"));
return; return;
} }
QString app = QApplication::applicationFilePath(); QString app = QApplication::applicationFilePath();
app.replace("/", "\\"); app.replace("/", "\\");
qDebug() << app.toStdWString().c_str(); qDebug() << app.toStdWString().c_str();
lRet = RegSetValueEx(hKey, LENG_NAME, 0, REG_SZ, (BYTE*)app.toStdWString().c_str(), app.length()*sizeof(wchar_t)); lRet = RegSetValueEx(hKey, LENG_NAME, 0, REG_SZ, (BYTE*)app.toStdWString().c_str(), app.length()*sizeof(wchar_t));
if (lRet == ERROR_SUCCESS) if (lRet == ERROR_SUCCESS)
{ {
QMessageBox::information(this, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("创建开机启动项成功")); QMessageBox::information(this, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("创建开机启动项成功"));
} }
RegCloseKey(hKey); RegCloseKey(hKey);
} }
else if (state == Qt::Unchecked) { else if (state == Qt::Unchecked) {
HKEY hRoot = HKEY_CURRENT_USER; HKEY hRoot = HKEY_CURRENT_USER;
wchar_t *szSubKey = L"Software\\Microsoft\\Windows\\CurrentVersion\\Run"; wchar_t *szSubKey = (wchar_t*)L"Software\\Microsoft\\Windows\\CurrentVersion\\Run";
HKEY hKey; HKEY hKey;
DWORD dwDisposition = REG_OPENED_EXISTING_KEY; DWORD dwDisposition = REG_OPENED_EXISTING_KEY;
LONG lRet = RegCreateKeyEx(hRoot, szSubKey, 0, NULL, LONG lRet = RegCreateKeyEx(hRoot, szSubKey, 0, NULL,
REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &dwDisposition); REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &dwDisposition);
if (lRet != ERROR_SUCCESS) { if (lRet != ERROR_SUCCESS) {
QMessageBox::critical(this, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("移除开机启动项失败。")); QMessageBox::critical(this, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("移除开机启动项失败。"));
return; return;
} }
QString app = QApplication::applicationFilePath(); QString app = QApplication::applicationFilePath();
lRet = RegDeleteValue(hKey, LENG_NAME); lRet = RegDeleteValue(hKey, LENG_NAME);
if (lRet == ERROR_SUCCESS) if (lRet == ERROR_SUCCESS)
{ {
QMessageBox::information(this, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("移除开机启动项成功。")); QMessageBox::information(this, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("移除开机启动项成功。"));
} }
RegCloseKey(hKey); RegCloseKey(hKey);
} }
} }
void MySettingsDialog::law() void MySettingsDialog::law()
{ {
QString path = QApplication::applicationDirPath(); QString path = QApplication::applicationDirPath();
QString license = path + "/license.txt"; QString license = path + "/license.txt";
license.replace("/", "\\"); license.replace("/", "\\");
ShellExecute(GetDesktopWindow(), L"open", L"notepad.exe" , license.toStdWString().c_str(), nullptr, SW_SHOW); ShellExecute(GetDesktopWindow(), L"open", L"notepad.exe" , license.toStdWString().c_str(), nullptr, SW_SHOW);
} }
void MySettingsDialog::copyToCLipboard() { void MySettingsDialog::copyToCLipboard() {
QClipboard *clip = QApplication::clipboard(); QClipboard *clip = QApplication::clipboard();
clip->setText(QString(QCryptographicHash::hash(getMachineGUID().toUtf8(), QCryptographicHash::Md5).toHex())); clip->setText(QString(QCryptographicHash::hash(getMachineGUID().toUtf8(), QCryptographicHash::Md5).toHex()));
} }
void MySettingsDialog::createShortcut() { void MySettingsDialog::createShortcut() {
QString deskTopPath = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation); QString deskTopPath = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
deskTopPath = deskTopPath + QString::fromLocal8Bit("/"); deskTopPath = deskTopPath + QString::fromLocal8Bit("/");
deskTopPath = deskTopPath + QString::fromLocal8Bit(NAME); deskTopPath = deskTopPath + QString::fromLocal8Bit(NAME);
deskTopPath = deskTopPath + QString::fromLocal8Bit(".lnk"); deskTopPath = deskTopPath + QString::fromLocal8Bit(".lnk");
QString srcFile = QApplication::applicationFilePath(); QString srcFile = QApplication::applicationFilePath();
bool succeed=QFile::link(srcFile, deskTopPath); bool succeed=QFile::link(srcFile, deskTopPath);
if (succeed) { if (succeed) {
QMessageBox::information(this, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("创建快捷方式成功。")); QMessageBox::information(this, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("创建快捷方式成功。"));
} }
else { else {
QMessageBox::information(this, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("创建快捷方式失败。")); QMessageBox::information(this, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("创建快捷方式失败。"));
} }
} }

View File

@ -14,8 +14,10 @@
#include "globalvariables.h" #include "globalvariables.h"
#ifdef _DEBUG #ifdef _DEBUG
#pragma comment(lib, "Qt5Svgd.lib") #pragma comment(lib, "Qt5Svgd.lib")
#pragma comment(lib, "Qt5Sqld.lib")
#else #else
#pragma comment(lib, "Qt5Svg.lib") #pragma comment(lib, "Qt5Svg.lib")
#pragma comment(lib, "Qt5Sql.lib")
#endif #endif
QString url_param; QString url_param;
void ConvertImageToTransparent(QImage &img) void ConvertImageToTransparent(QImage &img)
@ -46,7 +48,7 @@ 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->menus.empty()!=true) { if (configResponse->succeed&&configResponse->buttons.empty()!=true) {
getLogoFromInternet(configResponse); getLogoFromInternet(configResponse);
} }
else { else {
@ -141,7 +143,7 @@ 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->menus) { for (auto button : configResponse->buttons) {
QUrl url_image(button.img); QUrl url_image(button.img);
QNetworkRequest *request_image = new QNetworkRequest(url_image); QNetworkRequest *request_image = new QNetworkRequest(url_image);
reply = manager->get(*request_image); reply = manager->get(*request_image);

View File

@ -23,6 +23,7 @@
#include <ctime> #include <ctime>
#include <qDebug> #include <qDebug>
#include "globalvariables.h" #include "globalvariables.h"
#include "buttonstruct.h"
#pragma comment(lib, "wbemuuid.lib") #pragma comment(lib, "wbemuuid.lib")
#ifdef _DEBUG #ifdef _DEBUG
#pragma comment(lib, "Qt5Networkd.lib") #pragma comment(lib, "Qt5Networkd.lib")
@ -221,7 +222,7 @@ void ConfigRequest::sendRequest(ConfigResponse *configResponse) {
delete httpMgr; delete httpMgr;
return; return;
} }
qDebug() << result.toJson(); //qDebug() << result.toJson();
//如果数据完整 //如果数据完整
if(result.isObject()){ if(result.isObject()){
@ -240,13 +241,15 @@ void ConfigRequest::sendRequest(ConfigResponse *configResponse) {
auto i=0; auto i=0;
for(auto value:array){ for(auto value:array){
QJsonObject object=value.toObject(); QJsonObject object=value.toObject();
Menu menu; Button button;
menu.img=object.value("img").toString(); button.img=object.value("img").toString();
menu.img_cover=object.value("img_cover").toString(); // button.img_cover=object.value("img_cover").toString();
menu.title=object.value("title").toString(); button.title=object.value("title").toString();
menu.func=object.value("func").toString(); button.categroy_id = object.value("category_id").toString();
menu.url=object.value("url").toString(); button.op = object.value("op").toString();
configResponse->menus << menu; button.func=object.value("func").toString();
button.url=object.value("url").toString();
configResponse->buttons << button;
i++; i++;
} }
configResponse->succeed = true; configResponse->succeed = true;
@ -572,3 +575,70 @@ DeviceRequest::DeviceRequest() : RequestBodyBase() {
eventLoop.exec(); eventLoop.exec();
delete httpMgr; delete httpMgr;
} }
bool SoftwareRequest::sendRequest(QHash<QString, Record> *records)
{
timer = new QTimer(this);
QNetworkAccessManager* httpMgr = new QNetworkAccessManager();
QNetworkRequest requestInfo;
//HTTP请求
//请求头
QJsonArray array;
for(auto record : *records)
{
array.append(record.orig_name);
}
QJsonObject obj_root = qJsonDocument.object();
obj_root.insert("orig_names", array);
qJsonDocument.setObject(obj_root);
QString url = SOFTWARE_URL;
requestInfo.setUrl(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, &SoftwareRequest::cancelDownload);
timer->start(5000);
//启动循环
eventLoop.exec();
timer->stop();
QJsonDocument result;
// auto error = reply->error();
//如果没有错误
if (reply->error() == QNetworkReply::NoError) {
result = QJsonDocument::fromJson(reply->readAll());
}
else {
//如果有错误
delete timer;
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();
for (auto value : array) {
QJsonObject object = value.toObject();
QString orig_name = object.value("orig_name").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();
}
}
else {
//数据不完整
//delete reply;
delete timer;
delete httpMgr;
return false;
}
delete httpMgr;
return true;
}

View File

@ -12,15 +12,19 @@
#include <QJsonObject> #include <QJsonObject>
#include <Windows.h> #include <Windows.h>
#include <QtNetwork/QtNetwork> #include <QtNetwork/QtNetwork>
#include "buttonstruct.h"
#include "sqlitehelper.h"
typedef struct { typedef struct {
QString img; QString img;
QString img_cover; QString img_cover;
QString title; QString title;
QString orig_name;
QString categroy_id;
QString op;
QString func; QString func;
QString url; QString url;
} Menu; } Button;
typedef struct { typedef struct {
bool succeed; bool succeed;
struct { struct {
@ -32,7 +36,7 @@ typedef struct {
QString title_color; QString title_color;
QString title_cover_color; QString title_cover_color;
}basic; }basic;
QList<Menu> menus; QList<Button> buttons;
}ConfigResponse; }ConfigResponse;
class RequestBodyBase:public QObject{ class RequestBodyBase:public QObject{
@ -111,6 +115,8 @@ inline QString getMachineGUID() {
} }
class SoftwareRequest :public RequestBodyBase { class SoftwareRequest :public RequestBodyBase {
public:
SoftwareRequest():RequestBodyBase(){}
bool sendRequest(QHash<QString, Record>*records);
}; };
#endif //OFFICEASSISTANT_NETIO_H #endif //OFFICEASSISTANT_NETIO_H

View File

@ -0,0 +1,519 @@
#include "sqlitehelper.h"
#include <QMessageBox>
#include "globalvariables.h"
#include "MyButton.h"
#include <Windows.h>
#include <ShObjIdl.h>
#include <PropKey.h>
#include <ShlObj.h>
#include <QtXml/QtXml>
#include <QtSvg/QtSvg>
#include "navbar.h"
#include "netio.h"
#include "config.h"
#ifdef _DEBUG
#pragma comment (lib,"Qt5Xmld.lib")
#else
#pragma comment (lib,"Qt5Xml.lib")
#endif
#pragma comment (lib,"Shell32.lib")
#if _MSC_VER >=1936
#include <filesystem>
namespace fs = std::filesystem;
#else
#define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING
#include <experimental/filesystem>
namespace fs = std::experimental::filesystem;
#endif
SQLiteHelper::SQLiteHelper(QObject *parent)
: QObject(parent)
{
if (QSqlDatabase::contains("qt_sql_default_connection"))
{
db = QSqlDatabase::database("qt_sql_default_connection");
}
else
{
db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName("OfficeAssistant.db");
}
if (!db.open())
{
QMessageBox::critical(nullptr, QString::fromLocal8Bit("提示"), QString::fromLocal8Bit("无法打开数据库"));
exit_manager.exit(1);
}
}
SQLiteHelper::~SQLiteHelper()
{
db.close();
}
bool SQLiteHelper::update_software()
{
HKEY hKeyUninstall = nullptr;
QMap<QString, Record> records;
QList<QString> paths;
/*QSqlQuery query;
QString sql = "select * from kmd_menu;";
query.exec(sql);
while(query.next())
{
Record record;
record.id = query.value("id").toInt();
record.sort = query.value("sort").toInt();
record.app_id = query.value("app_id").toString();
record.locked = query.value("locked").toBool();
record.type = query.value("type").toString();
record.category_id = query.value("category_id").toString();
record.name = query.value("name").toString();
record.orig_name = query.value("orig_name").toString();
record.version = query.value("version").toString();
record.dev = query.value("dev").toString();
record.create_time = query.value("create_time").toLongLong();
record.use_time = query.value("use_time").toLongLong();
record.op = query.value("op").toString();
record.func = query.value("func").toString();
record.path = query.value("path").toString();
record.url = query.value("url").toString();
QStringList path_list = record.path.split("\\");
path_list.removeLast();
QString path;
for(auto str : path_list)
{
path.append(str);
path.append("\\");
}
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中开始菜单的路径
std::wstring path_str(path);
for(auto file : fs::directory_iterator(path_str))
{
Record record;
if(fs::is_regular_file(file))
{
if(file.path().extension().wstring()==L".lnk")
{
HRESULT hr = CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
if (SUCCEEDED(hr))
{
IShellItem* pShellItem;
hr = SHCreateItemFromParsingName(file.path().wstring().c_str(), nullptr, IID_PPV_ARGS(&pShellItem));
if (SUCCEEDED(hr))
{
IPersistFile* pPersistFile;
hr = pShellItem->QueryInterface(IID_PPV_ARGS(&pPersistFile));
if (SUCCEEDED(hr))
{
WCHAR szTargetPath[MAX_PATH];
LPOLESTR pszTargetPath = szTargetPath;
hr = pPersistFile->Load(nullptr, STGM_READ);
if (SUCCEEDED(hr))
{
hr = pPersistFile->GetCurFile(&pszTargetPath);
if (SUCCEEDED(hr))
{
paths<<QString::fromWCharArray(szTargetPath);
}
else
{
pPersistFile->Release();
pShellItem->Release();
CoUninitialize();
return false;
}
}else
{
pPersistFile->Release();
pShellItem->Release();
CoUninitialize();
return false;
}
pPersistFile->Release();
}else
{
pShellItem->Release();
pShellItem->Release();
CoUninitialize();
return false;
}
pShellItem->Release();
}else
{
CoUninitialize();
return false;
}
CoUninitialize();
}
}
}
}
for(int i=0;i<sizeof(path)/sizeof(wchar_t);i++)
{
path[i] = 0;
}
hr = SHGetFolderPathW(nullptr, CSIDL_PROGRAMS, nullptr, 0, path);//获取用户文件夹中开始菜单的路径
path_str.clear();
path_str = std::wstring(path);
for (auto file : fs::directory_iterator(path_str))
{
Record record;
if (fs::is_regular_file(file))
{
if (file.path().extension().wstring() == L".lnk")
{
HRESULT hr = CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
if (SUCCEEDED(hr))
{
IShellItem* pShellItem;
hr = SHCreateItemFromParsingName(file.path().wstring().c_str(), nullptr, IID_PPV_ARGS(&pShellItem));
if (SUCCEEDED(hr))
{
IPersistFile* pPersistFile;
hr = pShellItem->QueryInterface(IID_PPV_ARGS(&pPersistFile));
if (SUCCEEDED(hr))
{
WCHAR szTargetPath[MAX_PATH];
LPOLESTR pszTargetPath = szTargetPath;
hr = pPersistFile->Load(nullptr, STGM_READ);
if (SUCCEEDED(hr))
{
hr = pPersistFile->GetCurFile(&pszTargetPath);
if (SUCCEEDED(hr))
{
paths << QString::fromWCharArray(szTargetPath);
}
else
{
pPersistFile->Release();
pShellItem->Release();
CoUninitialize();
return false;
}
}
else
{
pPersistFile->Release();
pShellItem->Release();
CoUninitialize();
return false;
}
pPersistFile->Release();
}
else
{
pShellItem->Release();
pShellItem->Release();
CoUninitialize();
return false;
}
pShellItem->Release();
}
else
{
CoUninitialize();
return false;
}
CoUninitialize();
}
}
}
}
// 打开注册表中的已安装软件列表
QHash<QString, Record> reg_records;
HKEY hKey;
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,
L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall",
0, KEY_READ, &hKey) == ERROR_SUCCESS)
{
// 枚举该列表下所有子键
for (DWORD i = 0; ; i++)
{
WCHAR szSubKey[MAX_PATH] = { 0 };
DWORD dwSize = MAX_PATH;
if (RegEnumKeyExW(hKey, i, szSubKey, &dwSize, NULL, NULL, NULL, NULL)
== ERROR_SUCCESS)
{
// 读取软件属性值
HKEY hSubKey;
if (RegOpenKeyExW(hKey, szSubKey, 0, KEY_READ, &hSubKey) == ERROR_SUCCESS)
{
Record record;
WCHAR szProductPath[MAX_PATH] = { 0 };
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)
{
RegCloseKey(hSubKey);
RegCloseKey(hKey);
return false;
}
QString path = QString::fromWCharArray(szProductPath);
//软件名
if (RegQueryValueExW(hSubKey, L"DisplayName", NULL, NULL,
(LPBYTE)buffer, &dwSize) != ERROR_SUCCESS)
{
RegCloseKey(hSubKey);
RegCloseKey(hKey);
return false;
}
record.name = QString::fromWCharArray(buffer);
record.orig_name = QString::fromWCharArray(buffer);
//图标
if (RegQueryValueExW(hSubKey, L"DisplayIcon", NULL, NULL,
(LPBYTE)buffer, &dwSize) != ERROR_SUCCESS)
{
RegCloseKey(hSubKey);
RegCloseKey(hKey);
return false;
}
record.logo = QString::fromWCharArray(buffer);
//主版本号
if (RegQueryValueExW(hSubKey, L"VersionMajor", NULL, NULL,
(LPBYTE)buffer_num, &dwSize) != ERROR_SUCCESS)
{
RegCloseKey(hSubKey);
RegCloseKey(hKey);
return false;
}
QString versionMajor = QString::number(buffer_num);
//次版本号
if (RegQueryValueExW(hSubKey, L"VersionMinor", NULL, NULL,
(LPBYTE)buffer_num, &dwSize) != ERROR_SUCCESS)
{
RegCloseKey(hSubKey);
RegCloseKey(hKey);
return false;
}
QString versionMinor = QString::number(buffer_num);
//将主版本号和次版本号拼接在一起
QString version = versionMajor + "." + versionMinor;
record.version = version;
//开发者
if (RegQueryValueExW(hSubKey, L"Publisher", NULL, NULL,
(LPBYTE)buffer, &dwSize) != ERROR_SUCCESS)
{
RegCloseKey(hSubKey);
RegCloseKey(hKey);
return false;
}
record.dev = QString::fromWCharArray(buffer);
record.type = "app";
record.locked = false;
RegCloseKey(hSubKey);
reg_records.insert(path, record);
}
}
else
{
break;
}
}
RegCloseKey(hKey);
}
//对比两个路径,找出公共部分
QHash<QString, Record> public_programs_list;
for(auto path:paths)
{
QStringList path_list = path.split("\\");
path_list.removeLast();
QString path2;
for(auto str : path_list)
{
path2.append(str);
path2.append("\\");
}
path2.remove(path2.length() - 1, 1);
if(reg_records.contains(path2))
{
reg_records[path2].path = path;
public_programs_list.insert(reg_records[path2].orig_name, reg_records[path2]);
}
}
//进行网络请求,补全字段
SoftwareRequest software_request;
if(!software_request.sendRequest(&public_programs_list))
{
return false;
}
QSqlQuery begin("begin;");
if (!begin.exec())
{
return false;
}
for(auto key : public_programs_list.keys())
{
QString sql_find = "select sort from kmd_menu where orig_name='";
sql_find += key;
sql_find += "';";
QSqlQuery query_find(sql_find);
if(!query_find.exec())
{
QSqlQuery rollback("rollback;");
rollback.exec();
return false;
}
QString sql;
if(query_find.next())
{
sql = "update kmd_menu set";
sql += " path='";
sql += public_programs_list[key].path;
sql += "'";
sql += " op=";
sql += public_programs_list[key].op;
sql += " func=";
sql += public_programs_list[key].func;
sql += " url=";
sql += public_programs_list[key].url;
sql += " where orig_name='";
sql += key;
sql += "';";
}
else
{
sql = "insert into kmd_menu (sort,app_id,locked,type,category_id,name,orig_name,version,dev,create_time,use_time,op,func,path,url) values (";
sql += "50";
sql += ",'";
sql += public_programs_list[key].app_id;
sql += "',";
sql += QString::number(public_programs_list[key].locked);
sql += ",'";
sql += public_programs_list[key].type;
sql += "','";
sql += public_programs_list[key].category_id;
sql += "','";
sql += public_programs_list[key].name;
sql += "','";
sql += public_programs_list[key].orig_name;
sql += "','";
sql += public_programs_list[key].version;
sql += "','";
sql += public_programs_list[key].dev;
sql += "',";
sql += QString::number(public_programs_list[key].create_time);
sql += ",";
sql += QString::number(public_programs_list[key].use_time);
sql += ",'";
sql += public_programs_list[key].op;
sql += "','";
sql += public_programs_list[key].func;
sql += "','";
sql += public_programs_list[key].path;
sql += "','";
sql += public_programs_list[key].url;
sql += "');";
}
QSqlQuery query(sql);
if(!query.exec())
{
QSqlQuery rollback("rollback;");
rollback.exec();
return false;
}
}
QSqlQuery commit("commit;");
commit.exec();
return true;
}
void SetSVGBackColor(QDomElement& elem, QString strtagname, QString strattr, QString strattrval)
{
if (elem.tagName().compare(strtagname) == 0)
{
QString before_color = elem.attribute(strattr);
elem.setAttribute(strattr, strattrval);
QString color = elem.attribute(strattr);
}
for (int i = 0; i < elem.childNodes().count(); i++)
{
if (!elem.childNodes().at(i).isElement())
{
continue;
}
SetSVGBackColor(elem.childNodes().at(i).toElement(), strtagname, strattr, strattrval);
}
}
bool SQLiteHelper::get_software(QList<ButtonStruct>* buttons)
{
QSqlQuery query(db);
QString sql = "select * from kmd_menu;";
if (!query.exec(sql))
{
return false;
}
QByteArray* buffer = new QByteArray;
while (query.next())
{
QNetworkAccessManager manager;
downloadSuccess = true;
ButtonStruct button_struct;
button_struct.path = query.value("path").toString();
button_struct.text = query.value("name").toString();
button_struct.orig_name = query.value("orig_name").toString();
QUrl url_image(query.value("logo").toString());
QNetworkRequest* request_image = new QNetworkRequest(url_image);
reply = manager.get(*request_image);
QTimer timer;
timer.setInterval(5000);
connect(reply, &QNetworkReply::finished, &eventLoop, &QEventLoop::quit);
connect(&timer, &QTimer::timeout, this, &SQLiteHelper::cancelDownload);
eventLoop.exec();
timer.stop();
QImage* image = new QImage(200, 200, QImage::Format_ARGB32);
if (downloadSuccess) {
*buffer = reply->readAll();
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); // 恢复默认值
render_image->render(&painter_image);
buffer->clear();
delete render_image;
}
else
{
QString icon = QApplication::applicationDirPath() + "/icon/default.svg";
QFile file(icon);
if(!file.open(QIODevice::ReadOnly))
{
return false;
}
QByteArray svg_buffer = file.readAll();
file.close();
QDomDocument doc;
doc.setContent(svg_buffer);
QColor color;
color.setNamedColor(DEFAULT_COLOR);
SetSVGBackColor(doc.documentElement(), "path", "fill",QColor() );
}
reply->close();
button_struct.image = image;
*buttons << button_struct;
}
return true;
}
void SQLiteHelper::cancelDownload() {
disconnect(reply, &QNetworkReply::finished, &eventLoop, &QEventLoop::quit);
eventLoop.quit();
reply->abort();
downloadSuccess = false;
}
bool SQLiteHelper::update_others()
{
}

View File

@ -0,0 +1,49 @@
#pragma once
#include <QtSql/QSqlDatabase>
#include <QtSql/QSqlError>
#include <QtSql/QSqlQuery>
#include <QString>
#include <QObject>
#include <QDate>
#include <QtNetwork/QtNetwork>
#include "buttonstruct.h"
typedef struct {
int id;
int sort;
QString app_id;
bool locked;
QString type;
QString category_id;
QString logo;
QString name;
QString orig_name;
QString version;
QString dev;
time_t create_time;
time_t use_time;
QString op;
QString func;
QString path;
QString url;
}Record;
class SQLiteHelper : public QObject
{
Q_OBJECT
public:
SQLiteHelper(QObject *parent = nullptr);
bool update_software();
bool get_software(QList<ButtonStruct>* buttons);
bool update_others();
~SQLiteHelper();
private:
QNetworkReply* reply;
QEventLoop eventLoop;
bool downloadSuccess;
QSqlDatabase db;
void cancelDownload();
};

BIN
identifier.sqlite Normal file

Binary file not shown.

0
kmd.db Normal file
View File

View File

@ -1,152 +1,152 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations"> <ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32"> <ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration> <Configuration>Debug</Configuration>
<Platform>Win32</Platform> <Platform>Win32</Platform>
</ProjectConfiguration> </ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32"> <ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration> <Configuration>Release</Configuration>
<Platform>Win32</Platform> <Platform>Win32</Platform>
</ProjectConfiguration> </ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64"> <ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration> <Configuration>Debug</Configuration>
<Platform>x64</Platform> <Platform>x64</Platform>
</ProjectConfiguration> </ProjectConfiguration>
<ProjectConfiguration Include="Release|x64"> <ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration> <Configuration>Release</Configuration>
<Platform>x64</Platform> <Platform>x64</Platform>
</ProjectConfiguration> </ProjectConfiguration>
</ItemGroup> </ItemGroup>
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<ProjectGuid>{4433F5C3-0237-403B-A997-264E56C78F53}</ProjectGuid> <ProjectGuid>{4433F5C3-0237-403B-A997-264E56C78F53}</ProjectGuid>
<Keyword>Win32Proj</Keyword> <Keyword>Win32Proj</Keyword>
<RootNamespace>startcalc</RootNamespace> <RootNamespace>startcalc</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">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset> <PlatformToolset>v142</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">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140_xp</PlatformToolset> <PlatformToolset>v141_xp</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings"> <ImportGroup Label="ExtensionSettings">
</ImportGroup> </ImportGroup>
<ImportGroup Label="Shared"> <ImportGroup Label="Shared">
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup> </ImportGroup>
<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\</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</OutDir>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>
<PrecompiledHeader> <PrecompiledHeader>
</PrecompiledHeader> </PrecompiledHeader>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile> <ClCompile>
<PrecompiledHeader> <PrecompiledHeader>
</PrecompiledHeader> </PrecompiledHeader>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile> <ClCompile>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<PrecompiledHeader> <PrecompiledHeader>
</PrecompiledHeader> </PrecompiledHeader>
<Optimization>MaxSpeed</Optimization> <Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile> <ClCompile>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<PrecompiledHeader> <PrecompiledHeader>
</PrecompiledHeader> </PrecompiledHeader>
<Optimization>MaxSpeed</Optimization> <Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="main.cpp" /> <ClCompile Include="main.cpp" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>
</Project> </Project>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>

View File

@ -1,159 +1,159 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations"> <ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32"> <ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration> <Configuration>Debug</Configuration>
<Platform>Win32</Platform> <Platform>Win32</Platform>
</ProjectConfiguration> </ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32"> <ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration> <Configuration>Release</Configuration>
<Platform>Win32</Platform> <Platform>Win32</Platform>
</ProjectConfiguration> </ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64"> <ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration> <Configuration>Debug</Configuration>
<Platform>x64</Platform> <Platform>x64</Platform>
</ProjectConfiguration> </ProjectConfiguration>
<ProjectConfiguration Include="Release|x64"> <ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration> <Configuration>Release</Configuration>
<Platform>x64</Platform> <Platform>x64</Platform>
</ProjectConfiguration> </ProjectConfiguration>
</ItemGroup> </ItemGroup>
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<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>8.1</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">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140_xp</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">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140_xp</PlatformToolset> <PlatformToolset>v141_xp</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings"> <ImportGroup Label="ExtensionSettings">
</ImportGroup> </ImportGroup>
<ImportGroup Label="Shared"> <ImportGroup Label="Shared">
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup> </ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup> </ImportGroup>
<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\</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</OutDir>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>
<PrecompiledHeader> <PrecompiledHeader>
</PrecompiledHeader> </PrecompiledHeader>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile> <ClCompile>
<PrecompiledHeader> <PrecompiledHeader>
</PrecompiledHeader> </PrecompiledHeader>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile> <ClCompile>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<PrecompiledHeader> <PrecompiledHeader>
</PrecompiledHeader> </PrecompiledHeader>
<Optimization>MaxSpeed</Optimization> <Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile> <ClCompile>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<PrecompiledHeader> <PrecompiledHeader>
</PrecompiledHeader> </PrecompiledHeader>
<Optimization>MaxSpeed</Optimization> <Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="main.cpp" /> <ClCompile Include="main.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\startcalc\openwechat.h" /> <ClInclude Include="..\startcalc\openwechat.h" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>
</Project> </Project>