第一阶段只差兼容性问题了

master
Mike Solar 2023-08-01 23:51:40 +08:00
parent 9b53ef9764
commit 6a695e8a03
20 changed files with 167 additions and 54 deletions

View File

@ -1,4 +1,3 @@
<RCC> <RCC>
<qresource prefix="OfficeAssistant_msvc"> <qresource prefix="/OfficeAssistant_msvc"/>
</qresource>
</RCC> </RCC>

View File

@ -102,6 +102,7 @@
<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="wke.h" /> <ClInclude Include="wke.h" />
<QtMoc Include="mainwindowlayout.h" /> <QtMoc Include="mainwindowlayout.h" />
<QtMoc Include="mainwindow.h" /> <QtMoc Include="mainwindow.h" />
@ -129,6 +130,12 @@
<QtUic Include="navbar.ui" /> <QtUic Include="navbar.ui" />
<QtUic Include="qminiblink.ui" /> <QtUic Include="qminiblink.ui" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ResourceCompile Include="logo.rc" />
</ItemGroup>
<ItemGroup>
<Image Include="icon\wechat.ico" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')"> <ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')">
<Import Project="$(QtMsBuild)\qt.targets" /> <Import Project="$(QtMsBuild)\qt.targets" />

View File

@ -40,6 +40,9 @@
<ClInclude Include="wke.h"> <ClInclude Include="wke.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<QtMoc Include="navbar.h"> <QtMoc Include="navbar.h">
@ -116,4 +119,14 @@
<Filter>Form Files</Filter> <Filter>Form Files</Filter>
</QtUic> </QtUic>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ResourceCompile Include="logo.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<Image Include="icon\wechat.ico">
<Filter>Resource Files</Filter>
</Image>
</ItemGroup>
</Project> </Project>

View File

@ -4,13 +4,18 @@
#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" #define KEY "3b046cfe4a2a3e62141a4840f2006210a3224e3615312bef6e19f4983921abe0" //Key
#define NAME "办公助手" //中文名
#define LOGO_TITLEBAR "/icon/logo_navbar.png" //标题栏图标
#define ENG_NAME "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 RELEASE "20230801" //Release
#endif //OFFICEASSISTANT_CONFIG_H #endif //OFFICEASSISTANT_CONFIG_H

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Binary file not shown.

View File

@ -24,12 +24,17 @@ MainScreen::MainScreen(QWidget *parent) :
button = new QPushButton(widget); button = new QPushButton(widget);
layout_left->addStretch(4); layout_left->addStretch(4);
layout_left->addWidget(button,1); layout_left->addWidget(button,1);
layout_left->setAlignment(Qt::AlignCenter);
button->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
button->setMinimumSize(100,50);
button->setMaximumSize(200,100);
widget->setLayout(layout_left); widget->setLayout(layout_left);
widget->setHidden(true); widget->setHidden(true);
button->setStyleSheet("border-style:none;padding:10px;border-radius:5px;background-color:#09bb07"); button->setStyleSheet("border-style:none;padding:10px;border-radius:5px;background-color:#09bb07;color:white;font-family:SimHei");
//Plus Math icon by Icons8 //Plus Math icon by Icons8
QString dir = QApplication::applicationDirPath(); QString dir = QApplication::applicationDirPath();
button->setText(QString::fromLocal8Bit("´ò¿ªÎ¢ÐÅ")); button->setText(QString::fromLocal8Bit("´ò¿ªÎ¢ÐÅ"));
//button->setStyleSheet("text-color:white");
layout = new QHBoxLayout; layout = new QHBoxLayout;
miniblink = new QMiniBlink(this); miniblink = new QMiniBlink(this);
layout->addWidget(widget, 1); layout->addWidget(widget, 1);

View File

@ -6,23 +6,27 @@
#include "mainwindow.h" #include "mainwindow.h"
#include "ui_MainWindow.h" #include "ui_MainWindow.h"
#include "config.h"
MainWindow::MainWindow(QWidget *parent) : MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent), ui(new Ui::MainWindow) { QMainWindow(parent), ui(new Ui::MainWindow) {
ui->setupUi(this); ui->setupUi(this);
QDesktopWidget* desktopWidget = QApplication::desktop(); QDesktopWidget* desktopWidget = QApplication::desktop();
QRect deskRect = desktopWidget->availableGeometry(); QRect deskRect = desktopWidget->availableGeometry();
//delete desktopWidget; resize(deskRect.width()*0.8, deskRect.height()*0.8);
setWindowState(Qt::WindowMaximized);
mainWindowLayout=new MainWindowLayout(this); mainWindowLayout=new MainWindowLayout(this);
setCentralWidget(mainWindowLayout); setCentralWidget(mainWindowLayout);
setWindowState(Qt::WindowMaximized); setWindowTitle(QString::fromLocal8Bit(NAME));
QString path = QApplication::applicationDirPath();
path += LOGO_TITLEBAR;
icon = new QIcon(path);
setWindowIcon(*icon);
} }
MainWindow::~MainWindow() { MainWindow::~MainWindow() {
delete icon;
this->setCentralWidget(nullptr); this->setCentralWidget(nullptr);
delete mainWindowLayout; delete mainWindowLayout;
delete ui; delete ui;

View File

@ -8,6 +8,8 @@
#include <QMainWindow> #include <QMainWindow>
#include <QVBoxLayout> #include <QVBoxLayout>
#include "mainwindowlayout.h" #include "mainwindowlayout.h"
#include <QIcon>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; } namespace Ui { class MainWindow; }
QT_END_NAMESPACE QT_END_NAMESPACE
@ -22,6 +24,7 @@ public:
private: private:
Ui::MainWindow *ui; Ui::MainWindow *ui;
QIcon *icon;
QVBoxLayout *layout; QVBoxLayout *layout;
MainWindowLayout *mainWindowLayout; MainWindowLayout *mainWindowLayout;
}; };

View File

@ -11,6 +11,7 @@
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);
layout=new QVBoxLayout(this); layout=new QVBoxLayout(this);
mainWindowLayout = this; mainWindowLayout = this;
ConfigRequest *configRequest = new ConfigRequest; ConfigRequest *configRequest = new ConfigRequest;
@ -18,13 +19,17 @@ MainWindowLayout::MainWindowLayout(QWidget *parent) :
configRequest->sendRequest(configResponse); configRequest->sendRequest(configResponse);
mainScreen = new MainScreen(this); mainScreen = new MainScreen(this);
navBar=new NavBar(configResponse,mainScreen,this); navBar=new NavBar(configResponse,mainScreen,this);
navBar->setAttribute(Qt::WA_DeleteOnClose); navBar->setMinimumHeight(0);
navBar->setMaximumHeight(this->height() / 8);
mainScreen->setMinimumHeight(0);
//navBar->setAttribute(Qt::WA_DeleteOnClose);
delete configRequest; delete configRequest;
//QSizePolicy sizePolicy(QSizePolicy::Policy::Fixed, QSizePolicy::QSizePolicy::Fixed); //QSizePolicy sizePolicy(QSizePolicy::Policy::Fixed, QSizePolicy::QSizePolicy::Fixed);
//navBar->setSizePolicy(sizePolicy); //navBar->setSizePolicy(sizePolicy);
layout->setMargin(0); //layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(navBar,1); layout->addWidget(navBar,1);
layout->addWidget(mainScreen,7); layout->addWidget(mainScreen,7);
layout->setMargin(0);
setLayout(layout); setLayout(layout);
connect(this,&MainWindowLayout::clickButton1,mainScreen,&MainScreen::clickButton1); connect(this,&MainWindowLayout::clickButton1,mainScreen,&MainScreen::clickButton1);
} }
@ -42,7 +47,7 @@ MainWindowLayout::~MainWindowLayout() {
void MainWindowLayout::resizeEvent(QResizeEvent *event) { void MainWindowLayout::resizeEvent(QResizeEvent *event) {
QWidget::resizeEvent(event); QWidget::resizeEvent(event);
navBar->resize(navBar->width(),height()/8); navBar->setMaximumHeight(event->size().height()/8);
//layout->setAlignment(Qt::AlignmentFlag::AlignHCenter); //layout->setAlignment(Qt::AlignmentFlag::AlignHCenter);
} }

View File

@ -2,11 +2,13 @@
#include <Windows.h> #include <Windows.h>
#include <QClipBoard> #include <QClipBoard>
#include "netio.h" #include "netio.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);
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 = L"Software\\Microsoft\\Windows\\CurrentVersion\\Run";
@ -19,10 +21,10 @@ MySettingsDialog::MySettingsDialog(QWidget *parent)
} }
QString app = QApplication::applicationFilePath(); QString app = QApplication::applicationFilePath();
app.replace("/", "\\"); app.replace("/", "\\");
DWORD size=128; DWORD size=128+sizeof(wchar_t);
wchar_t reg[128]; char reg[128] = { 0 };
lRet = RegGetValue(hRoot, szSubKey, L"OfficeAssistant", RRF_RT_ANY, nullptr, reg, &size); lRet = RegQueryValueEx(hKey, L"OfficeAssistant", NULL, NULL,(LPBYTE)reg, &size);
if (wcscmp(reg,app.toStdWString().c_str())==0) { if (lRet==0) {
ui.autostart->setChecked(true); ui.autostart->setChecked(true);
} }
copyButton = ui.copy; copyButton = ui.copy;
@ -31,6 +33,7 @@ MySettingsDialog::MySettingsDialog(QWidget *parent)
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));
} }
MySettingsDialog::~MySettingsDialog() MySettingsDialog::~MySettingsDialog()
@ -53,7 +56,7 @@ void MySettingsDialog::autoStart(int state)
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, L"OfficeAssistant", 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("创建开机启动项成功"));
@ -72,7 +75,7 @@ void MySettingsDialog::autoStart(int state)
return; return;
} }
QString app = QApplication::applicationFilePath(); QString app = QApplication::applicationFilePath();
lRet = RegDeleteValue(hKey, L"OfficeAssistant"); 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("移除开机启动项成功。"));
@ -95,7 +98,9 @@ void MySettingsDialog::copyToCLipboard() {
} }
void MySettingsDialog::createShortcut() { void MySettingsDialog::createShortcut() {
QString deskTopPath = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation); QString deskTopPath = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
deskTopPath = deskTopPath + QString::fromLocal8Bit("/°ì¹«ÖúÊÖ.lnk"); deskTopPath = deskTopPath + QString::fromLocal8Bit("/");
deskTopPath = deskTopPath + QString::fromLocal8Bit(NAME);
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) {

View File

@ -26,12 +26,51 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>70</x> <x>70</x>
<y>70</y> <y>40</y>
<width>581</width> <width>581</width>
<height>381</height> <height>461</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>版本信息</string>
</property>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>20</x>
<y>50</y>
<width>108</width>
<height>24</height>
</rect>
</property>
<property name="text">
<string>版本号</string>
</property>
</widget>
<widget class="QLabel" name="version">
<property name="geometry">
<rect>
<x>130</x>
<y>50</y>
<width>261</width>
<height>24</height>
</rect>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</widget>
</item>
<item> <item>
<widget class="QGroupBox" name="hardware"> <widget class="QGroupBox" name="hardware">
<property name="sizePolicy"> <property name="sizePolicy">
@ -151,6 +190,8 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<zorder>gridLayoutWidget</zorder>
<zorder>hardware</zorder>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>
<resources/> <resources/>

View File

@ -9,6 +9,7 @@
#include "config.h" #include "config.h"
#include <QTimer> #include <QTimer>
#include <QtSvg/QtSvg> #include <QtSvg/QtSvg>
#include <QPixmap>
#include "mainwindowlayout.h" #include "mainwindowlayout.h"
#include "globalvariables.h" #include "globalvariables.h"
#ifdef _DEBUG #ifdef _DEBUG
@ -20,30 +21,50 @@ QString url_param;
NavBar::NavBar(ConfigResponse *configResponse, MainScreen *mainScreen,QWidget *parent) : NavBar::NavBar(ConfigResponse *configResponse, MainScreen *mainScreen,QWidget *parent) :
QWidget(parent), ui(new Ui::NavBar) { QWidget(parent), ui(new Ui::NavBar) {
ui->setupUi(this); ui->setupUi(this);
this->setAttribute(Qt::WA_DeleteOnClose); //this->setAttribute(Qt::WA_DeleteOnClose);
buffer = new QByteArray; buffer = new QByteArray;
/*QString style = "background-color:";
style += configResponse->basic.backgroud_color.toUpper();
style += ";";
setStyleSheet(style);*/
//setStyleSheet("margin:0");
setContentsMargins(0, 0, 0, 0);
if (configResponse->succeed&&configResponse->menus.empty()!=true) { if (configResponse->succeed&&configResponse->menus.empty()!=true) {
getLogoFromInternet(configResponse); getLogoFromInternet(configResponse);
} }
else { else {
getLogoFromLocal(); getLogoFromLocal();
} }
this->setLayout(nullptr); layout2 = new QHBoxLayout;
int n = buttonStructs.length(); layout_right = new QHBoxLayout;
int x = (width() - height()*n) / 2; layout_left = new QHBoxLayout;
logo_label = new QLabel(this);
//*logo = logo->scaled(this->width() / (5 / scale), this->height());
logo_label->setScaledContents(true);
logo_label->setPixmap(QPixmap::fromImage(*logo));
logo_label->setMaximumHeight(parent->height() / 8);
layout_left->addWidget(logo_label);
layout_left->setAlignment(Qt::AlignCenter);
for (auto buttonStruct : buttonStructs) { for (auto buttonStruct : buttonStructs) {
MyButton *myButton = new MyButton(buttonStruct, height(), height(), &buttons,this); MyButton *myButton = new MyButton(buttonStruct, height(), height(), &buttons,this);
myButton->setGeometry(x, 0, height(), height()); myButton->setMaximumHeight(parent->height() / 8);
myButton->show(); layout_right->addWidget(myButton);
//myButton->show();
connect(myButton, &MyButton::clicked1, mainWindowLayout, &MainWindowLayout::clickButton); connect(myButton, &MyButton::clicked1, mainWindowLayout, &MainWindowLayout::clickButton);
x += height();
buttons << myButton; buttons << myButton;
} }
layout_right->setAlignment(Qt::AlignLeft);
if (!buttonStructs.empty()) { if (!buttonStructs.empty()) {
connect(this, &NavBar::firstUrl, mainScreen, &MainScreen::firstUrl); connect(this, &NavBar::firstUrl, mainScreen, &MainScreen::firstUrl);
emit firstUrl(buttonStructs[0].url); emit firstUrl(buttonStructs[0].url);
} }
layout2->addLayout(layout_left, 1);
layout2->addLayout(layout_right, 4);
layout_right->setMargin(0);
layout2->setMargin(0);
//layout2->setAlignment(Qt::AlignJustify);
this->setLayout(layout2);
logo_label->show();
} }
NavBar::~NavBar() { NavBar::~NavBar() {
@ -52,8 +73,15 @@ NavBar::~NavBar() {
delete buttonStruct.image_cover; delete buttonStruct.image_cover;
} }
for(auto button : buttons){ for(auto button : buttons){
layout_right->removeWidget(button);
delete button; delete button;
} }
layout2->removeWidget(logo_label);
delete logo_label;
delete logo;
//delete layout_left;
delete layout_right;
delete layout2;
delete ui; delete ui;
} }
@ -66,20 +94,14 @@ void NavBar::paintEvent(QPaintEvent *event) {
QRectF rect(0, 0, this->width(), this->height()); QRectF rect(0, 0, this->width(), this->height());
painter.fillRect(rect, qColor); painter.fillRect(rect, qColor);
QRectF rect2(0, 0, this->width()/5, this->height());
painter.drawImage(rect2, *logo);
} }
void NavBar::resizeEvent(QResizeEvent *event) { void NavBar::resizeEvent(QResizeEvent *event) {
QWidget::resizeEvent(event); QWidget::resizeEvent(event);
int n = buttonStructs.length();
int x = (width() - height()*n) / 2;
for(auto button:buttons){ for(auto button:buttons){
button->setSize(event->size().height(),event->size().height(),event->size().height(),event->size().height()); button->setMaximumSize(event->size().height(), event->size().height());
button->setGeometry(x, 0, event->size().height(), event->size().height());
x += event->size().height();
button->update(); button->update();
} }
logo_label->setMaximumSize(event->size().width() / 5, event->size().height());
} }
void NavBar::getLogoFromInternet(ConfigResponse *configResponse) { void NavBar::getLogoFromInternet(ConfigResponse *configResponse) {
qColor.setNamedColor(configResponse->basic.backgroud_color); qColor.setNamedColor(configResponse->basic.backgroud_color);
@ -98,10 +120,8 @@ void NavBar::getLogoFromInternet(ConfigResponse *configResponse) {
delete request_logo; delete request_logo;
if (downloadSuccess == true) { if (downloadSuccess == true) {
*buffer = reply->readAll(); *buffer = reply->readAll();
QSvgRenderer *render_logo = new QSvgRenderer(*buffer); logo = new QImage();
logo = new QImage(400, 200, QImage::Format_ARGB32); logo->loadFromData(*buffer);
QPainter painter_logo(logo);
render_logo->render(&painter_logo);
buffer->clear(); buffer->clear();
for (auto button : configResponse->menus) { for (auto button : configResponse->menus) {
QUrl url_image(button.img); QUrl url_image(button.img);

View File

@ -16,6 +16,7 @@
#include "buttonstruct.h" #include "buttonstruct.h"
#include <QtNetwork/QtNetwork> #include <QtNetwork/QtNetwork>
#include "mainscreen.h" #include "mainscreen.h"
#include <QImage>
#include "mainwindowlayout.h" #include "mainwindowlayout.h"
@ -49,10 +50,14 @@ private:
QNetworkReply *reply; QNetworkReply *reply;
QEventLoop eventLoop; QEventLoop eventLoop;
QImage *logo; QImage *logo;
QLabel *logo_label;
bool downloadSuccess=true; bool downloadSuccess=true;
void getLogoFromInternet(ConfigResponse *configResponse); void getLogoFromInternet(ConfigResponse *configResponse);
void getLogoFromLocal(); void getLogoFromLocal();
MainScreen *mainScreen; MainScreen *mainScreen;
QHBoxLayout *layout_left;
QHBoxLayout *layout_right;
QHBoxLayout *layout2;
private slots: private slots:
void storeToBuffer(); void storeToBuffer();
void cancelDownload(); void cancelDownload();

View File

@ -65,11 +65,6 @@ RequestBodyBase::RequestBodyBase(){
exit(1); exit(1);
} }
parter_id=obj_root.value("parter_id").toString(); parter_id=obj_root.value("parter_id").toString();
if(obj_root.value("release")==QJsonValue::Undefined){
QMessageBox::warning(nullptr, QString::fromLocal8Bit("错误"), QString::fromLocal8Bit("配置文件损坏"));
exit(1);
}
release=obj_root.value("release").toString();
}else{ }else{
//处理错误 //处理错误
QMessageBox::warning(nullptr, QString::fromLocal8Bit("错误"), QString::fromLocal8Bit("配置文件损坏")); QMessageBox::warning(nullptr, QString::fromLocal8Bit("错误"), QString::fromLocal8Bit("配置文件损坏"));
@ -107,6 +102,8 @@ RequestBodyBase::RequestBodyBase(){
default: default:
os_version="Unknown"; os_version="Unknown";
} }
this->release = RELEASE;
this->version = VERSION;
//读取MachineGUID并取MD5作为device_id //读取MachineGUID并取MD5作为device_id
QByteArray hash = QCryptographicHash::hash(getMachineGUID().toUtf8(), QCryptographicHash::Md5); QByteArray hash = QCryptographicHash::hash(getMachineGUID().toUtf8(), QCryptographicHash::Md5);
device_id = hash.toHex(); device_id = hash.toHex();
@ -114,6 +111,10 @@ RequestBodyBase::RequestBodyBase(){
QJsonValue value = device_id; QJsonValue value = device_id;
QJsonObject obj_root = qJsonDocument.object(); QJsonObject obj_root = qJsonDocument.object();
obj_root.insert("device_id", value); obj_root.insert("device_id", value);
QJsonValue version_json = this->version;
obj_root.insert("version", version_json);
QJsonValue release_json = this->release;
obj_root.insert("release", release_json);
qJsonDocument.setObject(obj_root); qJsonDocument.setObject(obj_root);
QJsonValue os_json(this->os); QJsonValue os_json(this->os);
QJsonValue os_version_json(this->os_version); QJsonValue os_version_json(this->os_version);

View File

@ -15,7 +15,7 @@ void QMiniBlink::init() {
ui.setupUi(this); ui.setupUi(this);
wkeInit(); wkeInit();
RECT rect; RECT rect;
GetWindowRect((HWND)this->winId(), &rect); GetWindowRect((HWND)parent->winId(), &rect);
resize(rect.right - rect.left, rect.bottom - rect.top); resize(rect.right - rect.left, rect.bottom - rect.top);
this->wkeView = wkeCreateWebWindow(WKE_WINDOW_TYPE_CONTROL, (HWND)this->winId(), 0, 0, rect.right - rect.left, rect.bottom - rect.top); this->wkeView = wkeCreateWebWindow(WKE_WINDOW_TYPE_CONTROL, (HWND)this->winId(), 0, 0, rect.right - rect.left, rect.bottom - rect.top);

Binary file not shown.

BIN
icon/logo_navbar.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

BIN
icon/wechat.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB