修复导航栏问题
parent
6fa68053bb
commit
4220083ac3
Binary file not shown.
|
@ -1,86 +1,87 @@
|
|||
//
|
||||
// Created by HW on 2023/07/26.
|
||||
//
|
||||
#define TEXT_SIZE 7
|
||||
#include "MyButton.h"
|
||||
MyButton::MyButton(ButtonStruct &buttonStruct,int width,int height,QList<MyButton *> *buttons,QWidget *parent) : QPushButton(parent) {
|
||||
this->buttons=buttons;
|
||||
this->width2=width;
|
||||
this->height2=height;
|
||||
this->text=buttonStruct.text;
|
||||
this->url = buttonStruct.url;
|
||||
this->logo=buttonStruct.image;
|
||||
this->logo_cover = buttonStruct.image_cover;
|
||||
QString style = "background-color:";
|
||||
style += buttonStruct.background_color;
|
||||
style += ";border:none;";
|
||||
this->setStyleSheet(style);
|
||||
this->text_color = buttonStruct.text_color;
|
||||
this->text_cover_color = buttonStruct.text_cover_color;
|
||||
this->checked = false;
|
||||
}
|
||||
|
||||
MyButton::~MyButton() {
|
||||
}
|
||||
|
||||
void MyButton::paintEvent(QPaintEvent *e) {
|
||||
QPushButton::paintEvent(e);
|
||||
QPainter painter(this);
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
int logo_width=width()/3;
|
||||
int logo_x=width()/3;
|
||||
int logo_y=(height()-logo_width)/3;
|
||||
setContentsMargins(0,0,0,0);
|
||||
QFont ft;
|
||||
ft.setPixelSize(TEXT_SIZE);
|
||||
//别问我为啥乘3,我也不知道
|
||||
int text_x=(width()-TEXT_SIZE*text.length()*scale*3)/2;
|
||||
int text_y=(logo_width+logo_y+10);
|
||||
QRectF logo_rect(logo_x, logo_y, logo_width, logo_width);
|
||||
QRectF text_rect(text_x,text_y, TEXT_SIZE*text.length()*scale*3,TEXT_SIZE*scale*3);
|
||||
|
||||
if(checked){
|
||||
painter.setPen(text_cover_color);
|
||||
painter.drawImage(logo_rect, *logo_cover);
|
||||
painter.drawText(text_rect, Qt::AlignCenter, text);
|
||||
}
|
||||
else {
|
||||
painter.setPen(text_color);
|
||||
painter.drawImage(logo_rect, *logo);
|
||||
painter.drawText(text_rect, Qt::AlignCenter, text);
|
||||
}
|
||||
|
||||
}
|
||||
QSize MyButton::sizeHint() const {
|
||||
return QSize(width2,height2);
|
||||
}
|
||||
|
||||
void MyButton::enterEvent(QEvent *event) {
|
||||
QWidget::enterEvent(event);
|
||||
checked = true;
|
||||
update();
|
||||
}
|
||||
|
||||
void MyButton::leaveEvent(QEvent *event) {
|
||||
QWidget::leaveEvent(event);
|
||||
checked = false;
|
||||
update();
|
||||
}
|
||||
|
||||
void MyButton::mousePressEvent(QMouseEvent *event) {
|
||||
QPushButton::mousePressEvent(event);
|
||||
}
|
||||
|
||||
void MyButton::mouseReleaseEvent(QMouseEvent *event) {
|
||||
QPushButton::mouseReleaseEvent(event);
|
||||
for(auto button:*buttons){
|
||||
button->setChecked(false);
|
||||
button->update();
|
||||
}
|
||||
if(checked)
|
||||
checked=false;
|
||||
else
|
||||
checked=true;
|
||||
emit clicked1(text, url);
|
||||
}
|
||||
|
||||
//
|
||||
// Created by HW on 2023/07/26.
|
||||
//
|
||||
#define TEXT_SIZE 7
|
||||
#include "MyButton.h"
|
||||
MyButton::MyButton(ButtonStruct &buttonStruct,int width,int height,QList<MyButton *> *buttons,QWidget *parent) : QPushButton(parent) {
|
||||
this->buttons=buttons;
|
||||
this->width2=width;
|
||||
this->height2=height;
|
||||
this->text=buttonStruct.text;
|
||||
this->url = buttonStruct.url;
|
||||
this->logo=buttonStruct.image;
|
||||
this->logo_cover = buttonStruct.image_cover;
|
||||
this->background_color = buttonStruct.background_color;
|
||||
QString style = "background-color:";
|
||||
style += buttonStruct.background_color;
|
||||
style += ";border:none;";
|
||||
this->setStyleSheet(style);
|
||||
this->text_color = buttonStruct.text_color;
|
||||
this->text_cover_color = buttonStruct.text_cover_color;
|
||||
this->checked = false;
|
||||
}
|
||||
|
||||
MyButton::~MyButton() {
|
||||
}
|
||||
|
||||
void MyButton::paintEvent(QPaintEvent *e) {
|
||||
QPushButton::paintEvent(e);
|
||||
QPainter painter(this);
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
int logo_width=width()/3;
|
||||
int logo_x=width()/3;
|
||||
int logo_y=(height()-logo_width)/3;
|
||||
setContentsMargins(0,0,0,0);
|
||||
QFont ft;
|
||||
ft.setPixelSize(TEXT_SIZE);
|
||||
//别问我为啥乘3,我也不知道
|
||||
int text_x=(width()-TEXT_SIZE*text.length()*scale*3)/2;
|
||||
int text_y=(logo_width+logo_y+10);
|
||||
QRectF logo_rect(logo_x, logo_y, logo_width, logo_width);
|
||||
QRectF text_rect(text_x,text_y, TEXT_SIZE*text.length()*scale*3,TEXT_SIZE*scale*3);
|
||||
|
||||
if(checked){
|
||||
painter.setPen(text_cover_color);
|
||||
painter.drawImage(logo_rect, *logo_cover);
|
||||
painter.drawText(text_rect, Qt::AlignCenter, text);
|
||||
}
|
||||
else {
|
||||
painter.setPen(text_color);
|
||||
painter.drawImage(logo_rect, *logo);
|
||||
painter.drawText(text_rect, Qt::AlignCenter, text);
|
||||
}
|
||||
|
||||
}
|
||||
QSize MyButton::sizeHint() const {
|
||||
return QSize(width2,height2);
|
||||
}
|
||||
|
||||
void MyButton::enterEvent(QEvent *event) {
|
||||
QWidget::enterEvent(event);
|
||||
checked = true;
|
||||
update();
|
||||
}
|
||||
|
||||
void MyButton::leaveEvent(QEvent *event) {
|
||||
QWidget::leaveEvent(event);
|
||||
checked = false;
|
||||
update();
|
||||
}
|
||||
|
||||
void MyButton::mousePressEvent(QMouseEvent *event) {
|
||||
QPushButton::mousePressEvent(event);
|
||||
}
|
||||
|
||||
void MyButton::mouseReleaseEvent(QMouseEvent *event) {
|
||||
QPushButton::mouseReleaseEvent(event);
|
||||
for(auto button:*buttons){
|
||||
button->setChecked(false);
|
||||
button->update();
|
||||
}
|
||||
if(checked)
|
||||
checked=false;
|
||||
else
|
||||
checked=true;
|
||||
emit clicked1(text, url);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,68 +1,69 @@
|
|||
//
|
||||
// Created by HW on 2023/07/26.
|
||||
//
|
||||
|
||||
#ifndef OFFICEASSISTANT_MYBUTTON_H
|
||||
#define OFFICEASSISTANT_MYBUTTON_H
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QPaintEvent>
|
||||
#include <QtSvg/QtSvg>
|
||||
#include <QtSvg/QSvgWidget>
|
||||
#include <QtSvg/QSvgRenderer>
|
||||
#include "globalvariables.h"
|
||||
#include "buttonstruct.h"
|
||||
|
||||
class MyButton: public QPushButton{
|
||||
Q_OBJECT
|
||||
signals:
|
||||
void clicked1(QString text, QString url);
|
||||
public:
|
||||
MyButton(ButtonStruct &buttonStruct,int width,int height,QList<MyButton *> *buttons,QWidget *parent=nullptr);
|
||||
~MyButton() override;
|
||||
QString getText(){
|
||||
return text;
|
||||
}
|
||||
|
||||
QSize sizeHint() const override;
|
||||
void setChecked(bool checked){
|
||||
this->checked=checked;
|
||||
}
|
||||
QSize getLogicalSize() const {
|
||||
if(scale>=1.25){
|
||||
return QSize(width2,height2);
|
||||
}
|
||||
else{
|
||||
return QSize(width2,height2);
|
||||
};
|
||||
}
|
||||
void setSize(int width,int height,int logicalwidth,int logicalheight){
|
||||
this->width2=width;
|
||||
this->height2=height;
|
||||
this->logicalwidth=logicalwidth;
|
||||
this->logicalheight=logicalheight;
|
||||
}
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
void enterEvent(QEvent *event) override;
|
||||
void leaveEvent(QEvent *event) override;
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
void mouseReleaseEvent(QMouseEvent *event) override;
|
||||
private:
|
||||
QColor text_color;
|
||||
QColor text_cover_color;
|
||||
QList<MyButton *> *buttons;
|
||||
QImage *logo;
|
||||
QImage *logo_cover;
|
||||
QVBoxLayout *layout;
|
||||
QString text;
|
||||
QString url;
|
||||
int width2;
|
||||
int height2;
|
||||
int logicalwidth;
|
||||
int logicalheight;
|
||||
bool checked=false;
|
||||
};
|
||||
|
||||
|
||||
#endif //OFFICEASSISTANT_MYBUTTON_H
|
||||
//
|
||||
// Created by HW on 2023/07/26.
|
||||
//
|
||||
|
||||
#ifndef OFFICEASSISTANT_MYBUTTON_H
|
||||
#define OFFICEASSISTANT_MYBUTTON_H
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QPaintEvent>
|
||||
#include <QtSvg/QtSvg>
|
||||
#include <QtSvg/QSvgWidget>
|
||||
#include <QtSvg/QSvgRenderer>
|
||||
#include "globalvariables.h"
|
||||
#include "buttonstruct.h"
|
||||
|
||||
class MyButton: public QPushButton{
|
||||
Q_OBJECT
|
||||
signals:
|
||||
void clicked1(QString text, QString url);
|
||||
public:
|
||||
MyButton(ButtonStruct &buttonStruct,int width,int height,QList<MyButton *> *buttons,QWidget *parent=nullptr);
|
||||
~MyButton() override;
|
||||
QString getText(){
|
||||
return text;
|
||||
}
|
||||
|
||||
QSize sizeHint() const override;
|
||||
void setChecked(bool checked){
|
||||
this->checked=checked;
|
||||
}
|
||||
QSize getLogicalSize() const {
|
||||
if(scale>=1.25){
|
||||
return QSize(width2,height2);
|
||||
}
|
||||
else{
|
||||
return QSize(width2,height2);
|
||||
};
|
||||
}
|
||||
void setSize(int width,int height,int logicalwidth,int logicalheight){
|
||||
this->width2=width;
|
||||
this->height2=height;
|
||||
this->logicalwidth=logicalwidth;
|
||||
this->logicalheight=logicalheight;
|
||||
}
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
void enterEvent(QEvent *event) override;
|
||||
void leaveEvent(QEvent *event) override;
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
void mouseReleaseEvent(QMouseEvent *event) override;
|
||||
private:
|
||||
QColor text_color;
|
||||
QColor text_cover_color;
|
||||
QString background_color;
|
||||
QList<MyButton *> *buttons;
|
||||
QImage *logo;
|
||||
QImage *logo_cover;
|
||||
QVBoxLayout *layout;
|
||||
QString text;
|
||||
QString url;
|
||||
int width2;
|
||||
int height2;
|
||||
int logicalwidth;
|
||||
int logicalheight;
|
||||
bool checked=false;
|
||||
};
|
||||
|
||||
|
||||
#endif //OFFICEASSISTANT_MYBUTTON_H
|
||||
|
|
|
@ -1,145 +1,145 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{A49230DF-A869-4AA1-8ACA-3C7322530E46}</ProjectGuid>
|
||||
<Keyword>QtVS_v304</Keyword>
|
||||
<QtMsBuild Condition="'$(QtMsBuild)'=='' OR !Exists('$(QtMsBuild)\qt.targets')">$(MSBuildProjectDirectory)\QtMsBuild</QtMsBuild>
|
||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v140_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v140_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Condition="Exists('$(QtMsBuild)\qt_defaults.props')">
|
||||
<Import Project="$(QtMsBuild)\qt_defaults.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|Win32'" Label="QtSettings">
|
||||
<QtInstall>5.6.3_msvc2015</QtInstall>
|
||||
<QtModules>core;gui;widgets;network</QtModules>
|
||||
<QtBuildConfig>debug</QtBuildConfig>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|Win32'" Label="QtSettings">
|
||||
<QtInstall>5.6.3_msvc2015</QtInstall>
|
||||
<QtModules>core;gui;widgets</QtModules>
|
||||
<QtBuildConfig>release</QtBuildConfig>
|
||||
</PropertyGroup>
|
||||
<Target Name="QtMsBuildNotFound" BeforeTargets="CustomBuild;ClCompile" Condition="!Exists('$(QtMsBuild)\qt.targets') or !Exists('$(QtMsBuild)\qt.props')">
|
||||
<Message Importance="High" Text="QtMsBuild: could not locate qt.targets, qt.props; project may not build correctly." />
|
||||
</Target>
|
||||
<ImportGroup Label="ExtensionSettings" />
|
||||
<ImportGroup Label="Shared" />
|
||||
<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="$(QtMsBuild)\Qt.props" />
|
||||
</ImportGroup>
|
||||
<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="$(QtMsBuild)\Qt.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|Win32'">
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|Win32'">
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)\$(Configuration);.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)\$(Configuration);.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|Win32'" Label="Configuration">
|
||||
<ClCompile>
|
||||
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)' == 'Release|Win32'" Label="Configuration">
|
||||
<ClCompile>
|
||||
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<DebugInformationFormat>None</DebugInformationFormat>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<QtRcc Include="OfficeAssistant_msvc.qrc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="buttonstruct.h" />
|
||||
<ClInclude Include="config.h" />
|
||||
<ClInclude Include="globalvariables.h" />
|
||||
<QtMoc Include="qminiblink.h" />
|
||||
<QtMoc Include="mysettingsdialog.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="wke.h" />
|
||||
<QtMoc Include="mainwindowlayout.h" />
|
||||
<QtMoc Include="mainwindow.h" />
|
||||
<QtMoc Include="mainscreen.h" />
|
||||
<QtMoc Include="MyButton.h" />
|
||||
<QtMoc Include="netio.h" />
|
||||
<QtMoc Include="navbar.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp" />
|
||||
<ClCompile Include="mainscreen.cpp" />
|
||||
<ClCompile Include="mainwindow.cpp" />
|
||||
<ClCompile Include="mainwindowlayout.cpp" />
|
||||
<ClCompile Include="MyButton.cpp" />
|
||||
<ClCompile Include="mysettingsdialog.cpp" />
|
||||
<ClCompile Include="navbar.cpp" />
|
||||
<ClCompile Include="netio.cpp" />
|
||||
<ClCompile Include="qminiblink.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtUic Include="mainscreen.ui" />
|
||||
<QtUic Include="mainwindow.ui" />
|
||||
<QtUic Include="mainwindowlayout.ui" />
|
||||
<QtUic Include="mysettingsdialog.ui" />
|
||||
<QtUic Include="navbar.ui" />
|
||||
<QtUic Include="qminiblink.ui" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="logo.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="icon\wechat.ico" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')">
|
||||
<Import Project="$(QtMsBuild)\qt.targets" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{A49230DF-A869-4AA1-8ACA-3C7322530E46}</ProjectGuid>
|
||||
<Keyword>QtVS_v304</Keyword>
|
||||
<QtMsBuild Condition="'$(QtMsBuild)'=='' OR !Exists('$(QtMsBuild)\qt.targets')">$(MSBuildProjectDirectory)\QtMsBuild</QtMsBuild>
|
||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v140_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v140_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Condition="Exists('$(QtMsBuild)\qt_defaults.props')">
|
||||
<Import Project="$(QtMsBuild)\qt_defaults.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|Win32'" Label="QtSettings">
|
||||
<QtInstall>5.6.3_msvc2015</QtInstall>
|
||||
<QtModules>core;gui;widgets;network</QtModules>
|
||||
<QtBuildConfig>debug</QtBuildConfig>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|Win32'" Label="QtSettings">
|
||||
<QtInstall>5.6.3_msvc2015</QtInstall>
|
||||
<QtModules>core;gui;widgets</QtModules>
|
||||
<QtBuildConfig>release</QtBuildConfig>
|
||||
</PropertyGroup>
|
||||
<Target Name="QtMsBuildNotFound" BeforeTargets="CustomBuild;ClCompile" Condition="!Exists('$(QtMsBuild)\qt.targets') or !Exists('$(QtMsBuild)\qt.props')">
|
||||
<Message Importance="High" Text="QtMsBuild: could not locate qt.targets, qt.props; project may not build correctly." />
|
||||
</Target>
|
||||
<ImportGroup Label="ExtensionSettings" />
|
||||
<ImportGroup Label="Shared" />
|
||||
<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="$(QtMsBuild)\Qt.props" />
|
||||
</ImportGroup>
|
||||
<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="$(QtMsBuild)\Qt.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|Win32'">
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|Win32'">
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)\$(Configuration);.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)\$(Configuration);.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|Win32'" Label="Configuration">
|
||||
<ClCompile>
|
||||
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)' == 'Release|Win32'" Label="Configuration">
|
||||
<ClCompile>
|
||||
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<DebugInformationFormat>None</DebugInformationFormat>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<QtRcc Include="OfficeAssistant_msvc.qrc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="buttonstruct.h" />
|
||||
<ClInclude Include="config.h" />
|
||||
<ClInclude Include="globalvariables.h" />
|
||||
<QtMoc Include="qminiblink.h" />
|
||||
<QtMoc Include="mysettingsdialog.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="wke.h" />
|
||||
<QtMoc Include="mainwindowlayout.h" />
|
||||
<QtMoc Include="mainwindow.h" />
|
||||
<QtMoc Include="mainscreen.h" />
|
||||
<QtMoc Include="MyButton.h" />
|
||||
<QtMoc Include="netio.h" />
|
||||
<QtMoc Include="navbar.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp" />
|
||||
<ClCompile Include="mainscreen.cpp" />
|
||||
<ClCompile Include="mainwindow.cpp" />
|
||||
<ClCompile Include="mainwindowlayout.cpp" />
|
||||
<ClCompile Include="MyButton.cpp" />
|
||||
<ClCompile Include="mysettingsdialog.cpp" />
|
||||
<ClCompile Include="navbar.cpp" />
|
||||
<ClCompile Include="netio.cpp" />
|
||||
<ClCompile Include="qminiblink.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtUic Include="mainscreen.ui" />
|
||||
<QtUic Include="mainwindow.ui" />
|
||||
<QtUic Include="mainwindowlayout.ui" />
|
||||
<QtUic Include="mysettingsdialog.ui" />
|
||||
<QtUic Include="navbar.ui" />
|
||||
<QtUic Include="qminiblink.ui" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="logo.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="icon\wechat.ico" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')">
|
||||
<Import Project="$(QtMsBuild)\qt.targets" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
|
@ -1,132 +1,132 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>qrc;rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Form Files">
|
||||
<UniqueIdentifier>{99349809-55BA-4b9d-BF79-8FDBB0286EB3}</UniqueIdentifier>
|
||||
<Extensions>ui</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\Translation Files">
|
||||
<UniqueIdentifier>{639EADAA-A684-42e4-A9AD-28FC9BCB8F7C}</UniqueIdentifier>
|
||||
<Extensions>ts</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtRcc Include="OfficeAssistant_msvc.qrc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</QtRcc>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="buttonstruct.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="config.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="globalvariables.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="wke.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="resource.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtMoc Include="navbar.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
<QtMoc Include="mainscreen.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
<QtMoc Include="mainwindow.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
<QtMoc Include="mainwindowlayout.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
<QtMoc Include="netio.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
<QtMoc Include="MyButton.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
<QtMoc Include="qminiblink.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
<QtMoc Include="mysettingsdialog.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="mainscreen.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="mainwindow.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="mainwindowlayout.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="MyButton.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="navbar.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="netio.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="qminiblink.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="mysettingsdialog.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtUic Include="navbar.ui">
|
||||
<Filter>Form Files</Filter>
|
||||
</QtUic>
|
||||
<QtUic Include="mainscreen.ui">
|
||||
<Filter>Form Files</Filter>
|
||||
</QtUic>
|
||||
<QtUic Include="mainwindow.ui">
|
||||
<Filter>Form Files</Filter>
|
||||
</QtUic>
|
||||
<QtUic Include="mainwindowlayout.ui">
|
||||
<Filter>Form Files</Filter>
|
||||
</QtUic>
|
||||
<QtUic Include="qminiblink.ui">
|
||||
<Filter>Form Files</Filter>
|
||||
</QtUic>
|
||||
<QtUic Include="mysettingsdialog.ui">
|
||||
<Filter>Form Files</Filter>
|
||||
</QtUic>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="logo.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="icon\wechat.ico">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Image>
|
||||
</ItemGroup>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Form Files">
|
||||
<UniqueIdentifier>{99349809-55BA-4b9d-BF79-8FDBB0286EB3}</UniqueIdentifier>
|
||||
<Extensions>ui</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>qrc;rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Translation Files">
|
||||
<UniqueIdentifier>{639EADAA-A684-42e4-A9AD-28FC9BCB8F7C}</UniqueIdentifier>
|
||||
<Extensions>ts</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtRcc Include="OfficeAssistant_msvc.qrc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</QtRcc>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="buttonstruct.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="config.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="globalvariables.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="wke.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="resource.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtMoc Include="navbar.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
<QtMoc Include="mainscreen.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
<QtMoc Include="mainwindow.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
<QtMoc Include="mainwindowlayout.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
<QtMoc Include="netio.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
<QtMoc Include="MyButton.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
<QtMoc Include="qminiblink.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
<QtMoc Include="mysettingsdialog.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="mainscreen.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="mainwindow.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="mainwindowlayout.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="MyButton.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="navbar.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="netio.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="qminiblink.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="mysettingsdialog.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtUic Include="navbar.ui">
|
||||
<Filter>Form Files</Filter>
|
||||
</QtUic>
|
||||
<QtUic Include="mainscreen.ui">
|
||||
<Filter>Form Files</Filter>
|
||||
</QtUic>
|
||||
<QtUic Include="mainwindow.ui">
|
||||
<Filter>Form Files</Filter>
|
||||
</QtUic>
|
||||
<QtUic Include="mainwindowlayout.ui">
|
||||
<Filter>Form Files</Filter>
|
||||
</QtUic>
|
||||
<QtUic Include="qminiblink.ui">
|
||||
<Filter>Form Files</Filter>
|
||||
</QtUic>
|
||||
<QtUic Include="mysettingsdialog.ui">
|
||||
<Filter>Form Files</Filter>
|
||||
</QtUic>
|
||||
</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>
|
|
@ -1,13 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LocalDebuggerCommandArguments>79c86fb12b36dfa33d1a537c9af100b4c7928a9c</LocalDebuggerCommandArguments>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<QtLastBackgroundBuild>2023-08-01T03:05:45.8140795Z</QtLastBackgroundBuild>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<QtLastBackgroundBuild>2023-08-01T03:05:46.4588999Z</QtLastBackgroundBuild>
|
||||
</PropertyGroup>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LocalDebuggerCommandArguments>79c86fb12b36dfa33d1a537c9af100b4c7928a9c</LocalDebuggerCommandArguments>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<QtLastBackgroundBuild>2023-08-03T08:03:42.8435391Z</QtLastBackgroundBuild>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<QtLastBackgroundBuild>2023-08-03T08:03:43.2818738Z</QtLastBackgroundBuild>
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -1,228 +1,261 @@
|
|||
//
|
||||
// Created by HW on 2023/07/26.
|
||||
//
|
||||
|
||||
// You may need to build the project (run Qt uic code generator) to get "ui_NavBar.h" resolved
|
||||
|
||||
#include "navbar.h"
|
||||
#include "ui_NavBar.h"
|
||||
#include "config.h"
|
||||
#include <QTimer>
|
||||
#include <QtSvg/QtSvg>
|
||||
#include <QPixmap>
|
||||
#include "mainwindowlayout.h"
|
||||
#include "globalvariables.h"
|
||||
#ifdef _DEBUG
|
||||
#pragma comment(lib, "Qt5Svgd.lib")
|
||||
#else
|
||||
#pragma comment(lib, "Qt5Svg.lib")
|
||||
#endif
|
||||
QString url_param;
|
||||
NavBar::NavBar(ConfigResponse *configResponse, MainScreen *mainScreen,QWidget *parent) :
|
||||
QWidget(parent), ui(new Ui::NavBar) {
|
||||
ui->setupUi(this);
|
||||
//this->setAttribute(Qt::WA_DeleteOnClose);
|
||||
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) {
|
||||
getLogoFromInternet(configResponse);
|
||||
}
|
||||
else {
|
||||
getLogoFromLocal();
|
||||
}
|
||||
layout2 = new QHBoxLayout;
|
||||
layout_right = new QHBoxLayout;
|
||||
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) {
|
||||
MyButton *myButton = new MyButton(buttonStruct, height(), height(), &buttons,this);
|
||||
myButton->setMaximumHeight(parent->height() / 8);
|
||||
layout_right->addWidget(myButton);
|
||||
//myButton->show();
|
||||
connect(myButton, &MyButton::clicked1, mainWindowLayout, &MainWindowLayout::clickButton);
|
||||
buttons << myButton;
|
||||
}
|
||||
layout_right->setAlignment(Qt::AlignLeft);
|
||||
if (!buttonStructs.empty()) {
|
||||
connect(this, &NavBar::firstUrl, mainScreen, &MainScreen::firstUrl);
|
||||
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() {
|
||||
for (auto buttonStruct : buttonStructs) {
|
||||
delete buttonStruct.image;
|
||||
delete buttonStruct.image_cover;
|
||||
}
|
||||
for(auto button : buttons){
|
||||
layout_right->removeWidget(button);
|
||||
delete button;
|
||||
}
|
||||
layout2->removeWidget(logo_label);
|
||||
delete logo_label;
|
||||
delete logo;
|
||||
//delete layout_left;
|
||||
delete layout_right;
|
||||
delete layout2;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void NavBar::paintEvent(QPaintEvent *event) {
|
||||
QWidget::paintEvent(event);
|
||||
|
||||
QPainter painter(this);
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
|
||||
QRectF rect(0, 0, this->width(), this->height());
|
||||
painter.fillRect(rect, qColor);
|
||||
|
||||
}
|
||||
void NavBar::resizeEvent(QResizeEvent *event) {
|
||||
QWidget::resizeEvent(event);
|
||||
for(auto button:buttons){
|
||||
button->setMaximumSize(event->size().height(), event->size().height());
|
||||
button->update();
|
||||
}
|
||||
logo_label->setMaximumSize(event->size().width() / 5, event->size().height());
|
||||
}
|
||||
void NavBar::getLogoFromInternet(ConfigResponse *configResponse) {
|
||||
qColor.setNamedColor(configResponse->basic.backgroud_color);
|
||||
|
||||
QUrl url_logo(configResponse->basic.logo_url);
|
||||
QNetworkRequest *request_logo = new QNetworkRequest(url_logo);
|
||||
manager = new QNetworkAccessManager;
|
||||
reply = manager->get(*request_logo);
|
||||
QTimer timer;
|
||||
timer.setInterval(5000);
|
||||
connect(reply, &QNetworkReply::finished, &eventLoop,&QEventLoop::quit);
|
||||
connect(&timer, &QTimer::timeout,this, &NavBar::cancelDownload);
|
||||
eventLoop.exec();
|
||||
timer.stop();
|
||||
buffer = new QByteArray;
|
||||
delete request_logo;
|
||||
if (downloadSuccess == true) {
|
||||
*buffer = reply->readAll();
|
||||
logo = new QImage();
|
||||
logo->loadFromData(*buffer);
|
||||
buffer->clear();
|
||||
for (auto button : configResponse->menus) {
|
||||
QUrl url_image(button.img);
|
||||
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, &NavBar::cancelDownload);
|
||||
eventLoop.exec();
|
||||
timer.stop();
|
||||
if (!downloadSuccess) {
|
||||
break;
|
||||
}
|
||||
*buffer = reply->readAll();
|
||||
QSvgRenderer *render_image = new QSvgRenderer(*buffer);
|
||||
QImage *image = new QImage(200, 200, QImage::Format_ARGB32);
|
||||
QPainter painter_image(image);
|
||||
render_image->render(&painter_image);
|
||||
|
||||
QUrl url_image_cover(button.img_cover);
|
||||
QNetworkRequest *request_image_cover = new QNetworkRequest(url_image_cover);
|
||||
reply = manager->get(*request_image_cover);
|
||||
timer.setInterval(5000);
|
||||
connect(reply, &QNetworkReply::finished, &eventLoop, &QEventLoop::quit);
|
||||
connect(&timer, &QTimer::timeout, this, &NavBar::cancelDownload);
|
||||
if (!downloadSuccess) {
|
||||
break;
|
||||
}
|
||||
*buffer = reply->readAll();
|
||||
QSvgRenderer *render_image_cover = new QSvgRenderer(*buffer);
|
||||
QImage *image_cover = new QImage(200, 200, QImage::Format_ARGB32);
|
||||
QPainter painter_image_cover(image_cover);
|
||||
render_image_cover->render(&painter_image_cover);
|
||||
ButtonStruct buttonStruct;
|
||||
buttonStruct.image = image;
|
||||
buttonStruct.image_cover = image_cover;
|
||||
buttonStruct.text = button.title;
|
||||
buttonStruct.url = button.url;
|
||||
buttonStruct.background_color = configResponse->basic.backgroud_color;
|
||||
buttonStruct.text_color.setNamedColor(configResponse->basic.title_color);
|
||||
buttonStruct.text_cover_color.setNamedColor(configResponse->basic.title_cover_color);
|
||||
buttonStructs << buttonStruct;
|
||||
delete request_image;
|
||||
delete render_image;
|
||||
delete request_image_cover;
|
||||
delete render_image_cover;
|
||||
}
|
||||
}
|
||||
delete manager;
|
||||
manager = nullptr;
|
||||
|
||||
}
|
||||
void NavBar::storeToBuffer() {
|
||||
buffer = new QByteArray;
|
||||
|
||||
}
|
||||
void NavBar::cancelDownload() {
|
||||
disconnect(reply, &QNetworkReply::finished, &eventLoop, &QEventLoop::quit);
|
||||
eventLoop.quit();
|
||||
reply->abort();
|
||||
downloadSuccess = false;
|
||||
}
|
||||
|
||||
void NavBar::getLogoFromLocal() {
|
||||
QString dir = QApplication::applicationDirPath();
|
||||
QFile file(dir + DEFAULT_FILE);
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
QMessageBox::warning(nullptr, QString::fromLocal8Bit("错误"), QString::fromLocal8Bit("无法打开配置文件"));
|
||||
exit(1);
|
||||
}
|
||||
buffer->clear();
|
||||
*buffer = file.readAll();
|
||||
file.close();
|
||||
QJsonDocument *qJsonDocument = new QJsonDocument;
|
||||
*qJsonDocument = QJsonDocument::fromJson(*buffer);
|
||||
QJsonObject *obj_root = new QJsonObject;
|
||||
if (qJsonDocument->isObject()) {
|
||||
*obj_root = qJsonDocument->object();
|
||||
delete qJsonDocument;
|
||||
QString logo_path = obj_root->value("basic").toObject().value("logo").toString();
|
||||
logo = new QImage(logo_path);
|
||||
QString color= obj_root->value("basic").toObject().value("backgroud_color").toString();
|
||||
qColor.setNamedColor(color);
|
||||
QJsonArray *array = new QJsonArray;
|
||||
*array = obj_root->value("menu").toArray();
|
||||
for (auto obj : *array) {
|
||||
ButtonStruct buttonStruct;
|
||||
buttonStruct.text = obj.toObject().value("title").toString();
|
||||
buttonStruct.url = QString(BASE_URL)+obj.toObject().value("url").toString();
|
||||
buttonStruct.image = new QImage(obj.toObject().value("img").toString());
|
||||
buttonStruct.image_cover = new QImage(obj.toObject().value("img_cover").toString());
|
||||
buttonStructs << buttonStruct;
|
||||
}
|
||||
delete array;
|
||||
}
|
||||
else {
|
||||
QMessageBox::warning(nullptr, QString::fromLocal8Bit("错误"), QString::fromLocal8Bit("配置文件损坏"));
|
||||
delete obj_root;
|
||||
exit(1);
|
||||
}
|
||||
delete obj_root;
|
||||
|
||||
//
|
||||
// Created by HW on 2023/07/26.
|
||||
//
|
||||
|
||||
// You may need to build the project (run Qt uic code generator) to get "ui_NavBar.h" resolved
|
||||
|
||||
#include "navbar.h"
|
||||
#include "ui_NavBar.h"
|
||||
#include "config.h"
|
||||
#include <QTimer>
|
||||
#include <QtSvg/QtSvg>
|
||||
#include <QPixmap>
|
||||
#include "mainwindowlayout.h"
|
||||
#include "globalvariables.h"
|
||||
#ifdef _DEBUG
|
||||
#pragma comment(lib, "Qt5Svgd.lib")
|
||||
#else
|
||||
#pragma comment(lib, "Qt5Svg.lib")
|
||||
#endif
|
||||
QString url_param;
|
||||
void ConvertImageToTransparent(QImage &img)
|
||||
{
|
||||
img = img.convertToFormat(QImage::Format_ARGB32);
|
||||
union myrgb
|
||||
{
|
||||
uint rgba;
|
||||
uchar rgba_bits[4];
|
||||
};
|
||||
myrgb* mybits = (myrgb*)img.bits();
|
||||
int len = img.width()*img.height();
|
||||
while (len--> 0)
|
||||
{
|
||||
mybits->rgba_bits[3] = (mybits->rgba == 0xFFFFFFFF) ? 0 : 255;
|
||||
mybits++;
|
||||
}
|
||||
}
|
||||
|
||||
NavBar::NavBar(ConfigResponse *configResponse, MainScreen *mainScreen,QWidget *parent) :
|
||||
QWidget(parent), ui(new Ui::NavBar) {
|
||||
ui->setupUi(this);
|
||||
//this->setAttribute(Qt::WA_DeleteOnClose);
|
||||
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) {
|
||||
getLogoFromInternet(configResponse);
|
||||
}
|
||||
else {
|
||||
getLogoFromLocal();
|
||||
}
|
||||
layout2 = new QHBoxLayout;
|
||||
layout_right = new QHBoxLayout;
|
||||
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) {
|
||||
MyButton *myButton = new MyButton(buttonStruct, height(), height(), &buttons,this);
|
||||
myButton->setMaximumHeight(parent->height() / 8);
|
||||
layout_right->addWidget(myButton);
|
||||
//myButton->show();
|
||||
connect(myButton, &MyButton::clicked1, mainWindowLayout, &MainWindowLayout::clickButton);
|
||||
buttons << myButton;
|
||||
}
|
||||
layout_right->setAlignment(Qt::AlignLeft);
|
||||
if (!buttonStructs.empty()) {
|
||||
connect(this, &NavBar::firstUrl, mainScreen, &MainScreen::firstUrl);
|
||||
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() {
|
||||
for (auto buttonStruct : buttonStructs) {
|
||||
delete buttonStruct.image;
|
||||
delete buttonStruct.image_cover;
|
||||
}
|
||||
for(auto button : buttons){
|
||||
layout_right->removeWidget(button);
|
||||
delete button;
|
||||
}
|
||||
layout2->removeWidget(logo_label);
|
||||
delete logo_label;
|
||||
delete logo;
|
||||
//delete layout_left;
|
||||
delete layout_right;
|
||||
delete layout2;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void NavBar::paintEvent(QPaintEvent *event) {
|
||||
QWidget::paintEvent(event);
|
||||
|
||||
QPainter painter(this);
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
|
||||
QRectF rect(0, 0, this->width(), this->height());
|
||||
painter.fillRect(rect, qColor);
|
||||
|
||||
}
|
||||
void NavBar::resizeEvent(QResizeEvent *event) {
|
||||
QWidget::resizeEvent(event);
|
||||
for(auto button:buttons){
|
||||
button->setMaximumSize(event->size().height(), event->size().height());
|
||||
button->update();
|
||||
}
|
||||
logo_label->setMaximumSize(event->size().width() / 5, event->size().height());
|
||||
}
|
||||
void NavBar::getLogoFromInternet(ConfigResponse *configResponse) {
|
||||
qColor.setNamedColor(configResponse->basic.backgroud_color);
|
||||
|
||||
QUrl url_logo(configResponse->basic.logo_url);
|
||||
QNetworkRequest *request_logo = new QNetworkRequest(url_logo);
|
||||
manager = new QNetworkAccessManager;
|
||||
reply = manager->get(*request_logo);
|
||||
QTimer timer;
|
||||
timer.setInterval(5000);
|
||||
connect(reply, &QNetworkReply::finished, &eventLoop,&QEventLoop::quit);
|
||||
connect(&timer, &QTimer::timeout,this, &NavBar::cancelDownload);
|
||||
eventLoop.exec();
|
||||
timer.stop();
|
||||
buffer = new QByteArray;
|
||||
delete request_logo;
|
||||
reply->close();
|
||||
if (downloadSuccess == true) {
|
||||
*buffer = reply->readAll();
|
||||
logo = new QImage();
|
||||
logo->loadFromData(*buffer);
|
||||
buffer->clear();
|
||||
for (auto button : configResponse->menus) {
|
||||
QUrl url_image(button.img);
|
||||
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, &NavBar::cancelDownload);
|
||||
eventLoop.exec();
|
||||
timer.stop();
|
||||
if (!downloadSuccess) {
|
||||
break;
|
||||
}
|
||||
*buffer = reply->readAll();
|
||||
|
||||
QSvgRenderer *render_image = new QSvgRenderer(*buffer);
|
||||
|
||||
QImage *image = new QImage(200, 200, QImage::Format_ARGB32);
|
||||
QPainter painter_image(image);
|
||||
painter_image.setCompositionMode(QPainter::CompositionMode_Clear); // 清除画布
|
||||
painter_image.fillRect(rect(), Qt::transparent); // 填充透明色
|
||||
painter_image.setCompositionMode(QPainter::CompositionMode_SourceOver); // 恢复默认值
|
||||
render_image->render(&painter_image);
|
||||
buffer->clear();
|
||||
reply->close();
|
||||
|
||||
QUrl url_image_cover(button.img_cover);
|
||||
QNetworkRequest *request_image_cover = new QNetworkRequest(url_image_cover);
|
||||
reply = manager->get(*request_image_cover);
|
||||
timer.setInterval(5000);
|
||||
connect(reply, &QNetworkReply::finished, &eventLoop, &QEventLoop::quit);
|
||||
connect(&timer, &QTimer::timeout, this, &NavBar::cancelDownload);
|
||||
if (!downloadSuccess) {
|
||||
break;
|
||||
}
|
||||
eventLoop.exec();
|
||||
*buffer = reply->readAll();
|
||||
qDebug() << *buffer;
|
||||
QSvgRenderer *render_image_cover = new QSvgRenderer(*buffer);
|
||||
QImage *image_cover = new QImage(200, 200, QImage::Format_ARGB32);
|
||||
QPainter painter_image_cover(image_cover);
|
||||
painter_image_cover.setCompositionMode(QPainter::CompositionMode_Clear); // 清除画布
|
||||
painter_image_cover.fillRect(rect(), Qt::transparent); // 填充透明色
|
||||
painter_image_cover.setCompositionMode(QPainter::CompositionMode_SourceOver); // 恢复默认值
|
||||
render_image_cover->render(&painter_image_cover);
|
||||
buffer->clear();
|
||||
reply->close();
|
||||
|
||||
ButtonStruct buttonStruct;
|
||||
buttonStruct.image = image;
|
||||
buttonStruct.image_cover = image_cover;
|
||||
buttonStruct.text = button.title;
|
||||
buttonStruct.url = button.url;
|
||||
buttonStruct.background_color = configResponse->basic.backgroud_color;
|
||||
buttonStruct.text_color.setNamedColor(configResponse->basic.title_color);
|
||||
buttonStruct.text_cover_color.setNamedColor(configResponse->basic.title_cover_color);
|
||||
buttonStructs << buttonStruct;
|
||||
delete request_image;
|
||||
delete render_image;
|
||||
delete request_image_cover;
|
||||
delete render_image_cover;
|
||||
}
|
||||
}
|
||||
delete manager;
|
||||
manager = nullptr;
|
||||
|
||||
}
|
||||
void NavBar::storeToBuffer() {
|
||||
buffer = new QByteArray;
|
||||
|
||||
}
|
||||
void NavBar::cancelDownload() {
|
||||
disconnect(reply, &QNetworkReply::finished, &eventLoop, &QEventLoop::quit);
|
||||
eventLoop.quit();
|
||||
reply->abort();
|
||||
downloadSuccess = false;
|
||||
}
|
||||
|
||||
void NavBar::getLogoFromLocal() {
|
||||
QString dir = QApplication::applicationDirPath();
|
||||
QFile file(dir + DEFAULT_FILE);
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
QMessageBox::warning(nullptr, QString::fromLocal8Bit("错误"), QString::fromLocal8Bit("无法打开配置文件"));
|
||||
exit(1);
|
||||
}
|
||||
buffer->clear();
|
||||
*buffer = file.readAll();
|
||||
file.close();
|
||||
QJsonDocument *qJsonDocument = new QJsonDocument;
|
||||
*qJsonDocument = QJsonDocument::fromJson(*buffer);
|
||||
QJsonObject *obj_root = new QJsonObject;
|
||||
if (qJsonDocument->isObject()) {
|
||||
*obj_root = qJsonDocument->object();
|
||||
delete qJsonDocument;
|
||||
QString logo_path = obj_root->value("basic").toObject().value("logo").toString();
|
||||
logo = new QImage(logo_path);
|
||||
QString color= obj_root->value("basic").toObject().value("backgroud_color").toString();
|
||||
qColor.setNamedColor(color);
|
||||
QJsonArray *array = new QJsonArray;
|
||||
*array = obj_root->value("menu").toArray();
|
||||
for (auto obj : *array) {
|
||||
ButtonStruct buttonStruct;
|
||||
buttonStruct.text = obj.toObject().value("title").toString();
|
||||
buttonStruct.url = QString(BASE_URL)+obj.toObject().value("url").toString();
|
||||
buttonStruct.image = new QImage(obj.toObject().value("img").toString());
|
||||
buttonStruct.image_cover = new QImage(obj.toObject().value("img_cover").toString());
|
||||
buttonStructs << buttonStruct;
|
||||
}
|
||||
delete array;
|
||||
}
|
||||
else {
|
||||
QMessageBox::warning(nullptr, QString::fromLocal8Bit("错误"), QString::fromLocal8Bit("配置文件损坏"));
|
||||
delete obj_root;
|
||||
exit(1);
|
||||
}
|
||||
delete obj_root;
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,113 +1,116 @@
|
|||
//
|
||||
// Created by HW on 2023/07/27.
|
||||
//
|
||||
|
||||
#ifndef OFFICEASSISTANT_NETIO_H
|
||||
#define OFFICEASSISTANT_NETIO_H
|
||||
#include <QString>
|
||||
#include <QFile>
|
||||
#include <QMessageBox>
|
||||
#include <cstring>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <Windows.h>
|
||||
#include <QtNetwork/QtNetwork>
|
||||
|
||||
|
||||
typedef struct {
|
||||
QString img;
|
||||
QString img_cover;
|
||||
QString title;
|
||||
QString func;
|
||||
QString url;
|
||||
} Menu;
|
||||
typedef struct {
|
||||
bool succeed;
|
||||
struct {
|
||||
QString logo_url;
|
||||
QString device_id;
|
||||
QString dev_id;
|
||||
QString token;
|
||||
QString backgroud_color;
|
||||
QString title_color;
|
||||
QString title_cover_color;
|
||||
}basic;
|
||||
QList<Menu> menus;
|
||||
}ConfigResponse;
|
||||
|
||||
class RequestBodyBase:public QObject{
|
||||
Q_OBJECT;
|
||||
public:
|
||||
RequestBodyBase();
|
||||
virtual void sendRequest();
|
||||
protected:
|
||||
QString product;
|
||||
QString parter_id;
|
||||
QString os;
|
||||
QString os_version;
|
||||
QString device_id;
|
||||
QString request_id;
|
||||
QString version;
|
||||
QString release;
|
||||
QString sign;
|
||||
QJsonDocument qJsonDocument;
|
||||
QNetworkReply *reply;
|
||||
QEventLoop eventLoop;
|
||||
QTimer *timer;
|
||||
protected slots:
|
||||
void cancelDownload();
|
||||
};
|
||||
class ConfigRequest:public RequestBodyBase{
|
||||
public:
|
||||
ConfigRequest():RequestBodyBase(){}
|
||||
void sendRequest(ConfigResponse * configResponse);
|
||||
};
|
||||
class OpRequest:public RequestBodyBase{
|
||||
public:
|
||||
OpRequest(QString Op,QString OpValue):RequestBodyBase(),op(Op),op_value(OpValue){
|
||||
QJsonObject obj_root=qJsonDocument.object();
|
||||
QJsonValue value=op;
|
||||
obj_root.insert("op",op);
|
||||
value=op_value;
|
||||
obj_root.insert("op_value",op_value);
|
||||
qJsonDocument.setObject(obj_root);
|
||||
}
|
||||
QString getOpValue(){
|
||||
return op_value;
|
||||
}
|
||||
QString getOp(){
|
||||
return op;
|
||||
}
|
||||
void setOpValue(QString op_value){
|
||||
this->op_value=op_value;
|
||||
}
|
||||
void setOp(QString op){
|
||||
this->op=op;
|
||||
}
|
||||
void sendRequest();
|
||||
protected:
|
||||
QString op;
|
||||
QString op_value;
|
||||
};
|
||||
|
||||
class DeviceRequest:RequestBodyBase{
|
||||
DeviceRequest();
|
||||
};
|
||||
|
||||
class OpenMulitiWechat:public RequestBodyBase{
|
||||
public:
|
||||
OpenMulitiWechat(): RequestBodyBase(){}
|
||||
};
|
||||
inline QString getMachineGUID() {
|
||||
HKEY hKey;
|
||||
RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Cryptography",
|
||||
0, KEY_READ | KEY_WOW64_64KEY, &hKey);
|
||||
DWORD dwType1 = REG_SZ;
|
||||
DWORD dwLen = MAX_PATH;
|
||||
WCHAR buf[100];
|
||||
RegQueryValueExA(hKey, "MachineGuid", 0, &dwType1, (LPBYTE)buf, &dwLen);
|
||||
QString guid = QString::fromWCharArray(buf);
|
||||
return guid;
|
||||
}
|
||||
|
||||
#endif //OFFICEASSISTANT_NETIO_H
|
||||
//
|
||||
// Created by HW on 2023/07/27.
|
||||
//
|
||||
|
||||
#ifndef OFFICEASSISTANT_NETIO_H
|
||||
#define OFFICEASSISTANT_NETIO_H
|
||||
#include <QString>
|
||||
#include <QFile>
|
||||
#include <QMessageBox>
|
||||
#include <cstring>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <Windows.h>
|
||||
#include <QtNetwork/QtNetwork>
|
||||
|
||||
|
||||
typedef struct {
|
||||
QString img;
|
||||
QString img_cover;
|
||||
QString title;
|
||||
QString func;
|
||||
QString url;
|
||||
} Menu;
|
||||
typedef struct {
|
||||
bool succeed;
|
||||
struct {
|
||||
QString logo_url;
|
||||
QString device_id;
|
||||
QString dev_id;
|
||||
QString token;
|
||||
QString backgroud_color;
|
||||
QString title_color;
|
||||
QString title_cover_color;
|
||||
}basic;
|
||||
QList<Menu> menus;
|
||||
}ConfigResponse;
|
||||
|
||||
class RequestBodyBase:public QObject{
|
||||
Q_OBJECT;
|
||||
public:
|
||||
RequestBodyBase();
|
||||
virtual void sendRequest();
|
||||
protected:
|
||||
QString product;
|
||||
QString parter_id;
|
||||
QString os;
|
||||
QString os_version;
|
||||
QString device_id;
|
||||
QString request_id;
|
||||
QString version;
|
||||
QString release;
|
||||
QString sign;
|
||||
QJsonDocument qJsonDocument;
|
||||
QNetworkReply *reply;
|
||||
QEventLoop eventLoop;
|
||||
QTimer *timer;
|
||||
protected slots:
|
||||
void cancelDownload();
|
||||
};
|
||||
class ConfigRequest:public RequestBodyBase{
|
||||
public:
|
||||
ConfigRequest():RequestBodyBase(){}
|
||||
void sendRequest(ConfigResponse * configResponse);
|
||||
};
|
||||
class OpRequest:public RequestBodyBase{
|
||||
public:
|
||||
OpRequest(QString Op,QString OpValue):RequestBodyBase(),op(Op),op_value(OpValue){
|
||||
QJsonObject obj_root=qJsonDocument.object();
|
||||
QJsonValue value=op;
|
||||
obj_root.insert("op",op);
|
||||
value=op_value;
|
||||
obj_root.insert("op_value",op_value);
|
||||
qJsonDocument.setObject(obj_root);
|
||||
}
|
||||
QString getOpValue(){
|
||||
return op_value;
|
||||
}
|
||||
QString getOp(){
|
||||
return op;
|
||||
}
|
||||
void setOpValue(QString op_value){
|
||||
this->op_value=op_value;
|
||||
}
|
||||
void setOp(QString op){
|
||||
this->op=op;
|
||||
}
|
||||
void sendRequest();
|
||||
protected:
|
||||
QString op;
|
||||
QString op_value;
|
||||
};
|
||||
|
||||
class DeviceRequest:RequestBodyBase{
|
||||
DeviceRequest();
|
||||
};
|
||||
|
||||
class OpenMulitiWechat:public RequestBodyBase{
|
||||
public:
|
||||
OpenMulitiWechat(): RequestBodyBase(){}
|
||||
};
|
||||
inline QString getMachineGUID() {
|
||||
HKEY hKey;
|
||||
RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Cryptography",
|
||||
0, KEY_READ | KEY_WOW64_64KEY, &hKey);
|
||||
DWORD dwType1 = REG_SZ;
|
||||
DWORD dwLen = MAX_PATH;
|
||||
WCHAR buf[100];
|
||||
RegQueryValueExA(hKey, "MachineGuid", 0, &dwType1, (LPBYTE)buf, &dwLen);
|
||||
QString guid = QString::fromWCharArray(buf);
|
||||
return guid;
|
||||
}
|
||||
|
||||
class SoftwareRequest :public RequestBodyBase {
|
||||
|
||||
};
|
||||
#endif //OFFICEASSISTANT_NETIO_H
|
||||
|
|
Loading…
Reference in New Issue