也许完成了?待调试
parent
f1ffe592f3
commit
0483fe84f9
|
@ -8,6 +8,7 @@ MyButton::MyButton(ButtonStruct &buttonStruct,int width,int height,QList<MyButto
|
|||
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->setStyleSheet("background-color:#333332;/*border:none;*/");
|
||||
|
@ -69,8 +70,6 @@ void MyButton::mouseReleaseEvent(QMouseEvent *event) {
|
|||
checked=false;
|
||||
else
|
||||
checked=true;
|
||||
if (text == "计算器") {
|
||||
|
||||
}
|
||||
emit clicked1(text, url);
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,9 @@
|
|||
#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;
|
||||
|
@ -51,6 +54,7 @@ private:
|
|||
QImage *logo_cover;
|
||||
QVBoxLayout *layout;
|
||||
QString text;
|
||||
QString url;
|
||||
int width2;
|
||||
int height2;
|
||||
int logicalwidth;
|
||||
|
|
|
@ -59,12 +59,12 @@
|
|||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)\$(Configuration);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)\$(Configuration);.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)\$(Configuration);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)\$(Configuration);.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|Win32'" Label="Configuration">
|
||||
|
@ -103,7 +103,8 @@
|
|||
<QtMoc Include="mainwindowlayout.h" />
|
||||
<QtMoc Include="mainwindow.h" />
|
||||
<QtMoc Include="mainscreen.h" />
|
||||
<ClInclude Include="MyButton.h" />
|
||||
<ClInclude Include="mb.h" />
|
||||
<QtMoc Include="MyButton.h" />
|
||||
<QtMoc Include="netio.h" />
|
||||
<QtMoc Include="navbar.h" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -28,9 +28,6 @@
|
|||
</QtRcc>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="MyButton.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="buttonstruct.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
|
@ -40,6 +37,9 @@
|
|||
<ClInclude Include="globalvariables.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="mb.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtMoc Include="navbar.h">
|
||||
|
@ -57,6 +57,9 @@
|
|||
<QtMoc Include="netio.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
<QtMoc Include="MyButton.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp">
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<QtLastBackgroundBuild>2023-07-29T21:43:00.7608665Z</QtLastBackgroundBuild>
|
||||
<QtLastBackgroundBuild>2023-07-29T22:55:59.2650920Z</QtLastBackgroundBuild>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<QtLastBackgroundBuild>2023-07-29T21:43:07.2652440Z</QtLastBackgroundBuild>
|
||||
<QtLastBackgroundBuild>2023-07-29T22:56:00.1037375Z</QtLastBackgroundBuild>
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -4,9 +4,9 @@
|
|||
|
||||
#ifndef OFFICEASSISTANT_CONFIG_H
|
||||
#define OFFICEASSISTANT_CONFIG_H
|
||||
#define CONFIG_URL "http://softapi.1.y01.cn/addons/Kmdsoft/Index/config"
|
||||
#define OP_URL "http://softapi.1.y01.cn/addons/Kmdsoft/Index/op"
|
||||
#define DEVICE_URL "http://softapi.1.y01.cn/addons/Kmdsoft/Index/device"
|
||||
#define BASE_URL "http://softapi.1.y01.cn/"
|
||||
#define CONFIG_URL "http://apisoft.s103.y01.cn/addons/Kmdsoft/Index/config"
|
||||
#define OP_URL "http://apisoft.s103.y01.cn/addons/Kmdsoft/Index/op"
|
||||
#define DEVICE_URL "http://apisoft.s103.y01.cn/addons/Kmdsoft/Index/device"
|
||||
#define BASE_URL "http://apisoft.s103.y01.cn/"
|
||||
#define DEFAULT_FILE "/config/default.kmd"
|
||||
#endif //OFFICEASSISTANT_CONFIG_H
|
||||
|
|
|
@ -4,5 +4,7 @@
|
|||
|
||||
#ifndef OFFICEASSISTANT_GLOBALVARIABLES_H
|
||||
#define OFFICEASSISTANT_GLOBALVARIABLES_H
|
||||
class MainWindowLayout;
|
||||
extern double scale;
|
||||
extern MainWindowLayout *mainWindowLayout;
|
||||
#endif //OFFICEASSISTANT_GLOBALVARIABLES_H
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 2.7 KiB |
|
@ -6,14 +6,74 @@
|
|||
|
||||
#include "mainscreen.h"
|
||||
#include "ui_MainScreen.h"
|
||||
#include "netio.h"
|
||||
#include <QPixmap>
|
||||
#include <exception>
|
||||
|
||||
|
||||
MainScreen::MainScreen(QWidget *parent) :
|
||||
QWidget(parent), ui(new Ui::MainScreen) {
|
||||
ui->setupUi(this);
|
||||
|
||||
layout = nullptr;
|
||||
layout_left = nullptr;
|
||||
broswer = nullptr;
|
||||
}
|
||||
|
||||
MainScreen::~MainScreen() {
|
||||
delete ui;
|
||||
}
|
||||
void MainScreen::clickButton1(QString text, QString url) {
|
||||
LRESULT *result=new LRESULT;
|
||||
try {
|
||||
mbFireWindowsMessage(mbView, mbGetHostHWND(mbView), WM_DESTROY, 0, 0, result);
|
||||
delete result;
|
||||
}
|
||||
catch(std::exception e){
|
||||
delete result;
|
||||
}
|
||||
if (text == "΢ÐŶ࿪") {
|
||||
if (layout == nullptr) {
|
||||
layout = new QHBoxLayout;
|
||||
button = new QPushButton;
|
||||
button->setStyleSheet("border-style:none;padding:10px;border-radius:5px;background-color:#FFFFFF");
|
||||
//Plus Math icon by Icons8
|
||||
QString dir = QApplication::applicationDirPath();
|
||||
icon = new QIcon(dir + "/images/add.png");
|
||||
button->setIcon(*icon);
|
||||
connect(button, &QPushButton::click, this, &MainScreen::startWeChat);
|
||||
layout->addWidget(button, 1);
|
||||
if (broswer == nullptr) {
|
||||
broswer = new QWidget;
|
||||
}
|
||||
layout->addWidget(broswer,4);
|
||||
this->setLayout(layout);
|
||||
mbView = mbCreateWebWindow(MB_WINDOW_TYPE_CONTROL, (HWND)broswer->winId(), 0, 0, broswer->width(), broswer->height());
|
||||
mbShowWindow(mbView, TRUE);
|
||||
mbLoadURL(mbView, url.toStdString().c_str());
|
||||
mbRunMessageLoop();
|
||||
mbUninit();
|
||||
}
|
||||
else {
|
||||
mbView = mbCreateWebWindow(MB_WINDOW_TYPE_CONTROL, (HWND)broswer->winId(), 0, 0, broswer->width(), broswer->height());
|
||||
mbShowWindow(mbView, TRUE);
|
||||
mbLoadURL(mbView, url.toStdString().c_str());
|
||||
mbRunMessageLoop();
|
||||
mbUninit();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (broswer == nullptr) {
|
||||
broswer = new QWidget;
|
||||
}
|
||||
setLayout(nullptr);
|
||||
broswer->setGeometry(0, 0, width(), height());
|
||||
mbView = mbCreateWebWindow(MB_WINDOW_TYPE_CONTROL, (HWND)broswer->winId(), 0, 0, broswer->width(), broswer->height());
|
||||
mbShowWindow(mbView, TRUE);
|
||||
mbLoadURL(mbView, url.toStdString().c_str());
|
||||
mbRunMessageLoop();
|
||||
mbUninit();
|
||||
}
|
||||
}
|
||||
void MainScreen::startWeChat() {
|
||||
ShellExecute(GetDesktopWindow(), L"open", L"wxdk.exe", L"", QApplication::applicationDirPath().toStdWString().c_str(), SW_SHOW);
|
||||
}
|
|
@ -6,7 +6,10 @@
|
|||
#define OFFICEASSISTANT_MAINSCREEN_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QVBoxLayout>
|
||||
#include <QPushButton>
|
||||
#include "mb.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui { class MainScreen; }
|
||||
|
@ -17,11 +20,19 @@ Q_OBJECT
|
|||
|
||||
public:
|
||||
explicit MainScreen(QWidget *parent = nullptr);
|
||||
|
||||
~MainScreen() override;
|
||||
|
||||
public slots:
|
||||
void clickButton1(QString text, QString url);
|
||||
private:
|
||||
Ui::MainScreen *ui;
|
||||
QHBoxLayout *layout;
|
||||
QVBoxLayout *layout_left;
|
||||
QPushButton *button;
|
||||
QIcon *icon;
|
||||
QWidget *broswer;
|
||||
mbWebView mbView;
|
||||
private slots:
|
||||
void startWeChat();
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
ui->setupUi(this);
|
||||
QDesktopWidget* desktopWidget = QApplication::desktop();
|
||||
QRect deskRect = desktopWidget->availableGeometry();
|
||||
delete desktopWidget;
|
||||
//delete desktopWidget;
|
||||
mainWindowLayout=new MainWindowLayout(this);
|
||||
setCentralWidget(mainWindowLayout);
|
||||
if(deskRect.width()*scale>1920){
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include "mainwindowlayout.h"
|
||||
#include "ui_MainWindowLayout.h"
|
||||
|
||||
|
||||
MainWindowLayout::MainWindowLayout(QWidget *parent) :
|
||||
QWidget(parent), ui(new Ui::MainWindowLayout) {
|
||||
ui->setupUi(this);
|
||||
|
@ -39,11 +38,13 @@ void MainWindowLayout::resizeEvent(QResizeEvent *event) {
|
|||
//layout->setAlignment(Qt::AlignmentFlag::AlignHCenter);
|
||||
}
|
||||
|
||||
/*void MainWindowLayout::paintEvent(QPaintEvent *event) {
|
||||
QWidget::paintEvent(event);
|
||||
QPainter painter(this);
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
void MainWindowLayout::clickButton(QString text, QString url) {
|
||||
if (text == "¼ÆËãÆ÷") {
|
||||
ShellExecute(GetDesktopWindow(), L"open", L"startclas.exe", L"", QApplication::applicationDirPath().toStdWString().c_str(), SW_SHOW);
|
||||
}
|
||||
else{
|
||||
emit clickButton1(text, url);
|
||||
}
|
||||
}
|
||||
|
||||
QRectF rect(0, 0, this->width(), this->height()/5);
|
||||
painter.fillRect(rect, QColor("#333332"));
|
||||
}*/
|
||||
MainWindowLayout *mainWindowLayout;
|
||||
|
|
|
@ -11,18 +11,21 @@
|
|||
#include "navbar.h"
|
||||
#include "mainscreen.h"
|
||||
#include "netio.h"
|
||||
|
||||
class NavBar;
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui { class MainWindowLayout; }
|
||||
QT_END_NAMESPACE
|
||||
|
||||
class MainWindowLayout : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
signals:
|
||||
void clickButton1(QString text, QString url);
|
||||
public:
|
||||
explicit MainWindowLayout(QWidget *parent = nullptr);
|
||||
|
||||
~MainWindowLayout() override;
|
||||
public slots:
|
||||
void clickButton(QString text, QString url);
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
//void paintEvent(QPaintEvent *event) override;
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
#include "config.h"
|
||||
#include <QTimer>
|
||||
#include <QtSvg/QtSvg>
|
||||
#include "mainwindowlayout.h"
|
||||
#include "globalvariables.h"
|
||||
#ifdef _DEBUG
|
||||
#pragma comment(lib, "Qt5Svgd.lib")
|
||||
#else
|
||||
|
@ -28,6 +30,7 @@ NavBar::NavBar(ConfigResponse *configResponse,QWidget *parent) :
|
|||
for (auto buttonStruct : buttonStructs) {
|
||||
MyButton *myButton = new MyButton(buttonStruct, height(), height(), &buttons);
|
||||
myButton->setGeometry(x, 0, height(), height());
|
||||
connect(myButton, &MyButton::clicked1, mainWindowLayout, &MainWindowLayout::clickButton);
|
||||
x += height();
|
||||
buttons << myButton;
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include <QResizeEvent>
|
||||
#include "buttonstruct.h"
|
||||
#include <QtNetwork/QtNetwork>
|
||||
#include "mainwindowlayout.h"
|
||||
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include <comutil.h>
|
||||
#include <iostream>
|
||||
#include <QGuiApplication>
|
||||
#include <QApplication>
|
||||
#include <ctime>
|
||||
#pragma comment(lib, "wbemuuid.lib")
|
||||
#ifdef _DEBUG
|
||||
|
@ -45,7 +46,8 @@ RequestBodyBase::RequestBodyBase(){
|
|||
wsprintf(unix_time,L"%ld",std::time(0));
|
||||
QString request_id=QString::fromWCharArray(unix_time);
|
||||
//打开配置文件
|
||||
QFile *infFile=new QFile(".\\config\\information.cfg");
|
||||
QString dir=QApplication::applicationDirPath();
|
||||
QFile *infFile=new QFile(dir+"config/information.kmd");
|
||||
if(!infFile->open(QIODevice::ReadOnly|QIODevice::Text)){
|
||||
QMessageBox::critical(nullptr,QString::fromLocal8Bit("错误"), QString::fromLocal8Bit("无法打开配置文件"));
|
||||
delete infFile;
|
||||
|
@ -128,7 +130,7 @@ RequestBodyBase::RequestBodyBase(){
|
|||
//读取MachineGUID并取MD5作为device_id
|
||||
QByteArray hash = QCryptographicHash::hash(getMachineGUID().toUtf8(), QCryptographicHash::Md5);
|
||||
device_id=hash.toHex();
|
||||
infFile=new QFile(".\\config\\information.cfg");
|
||||
infFile=new QFile(".\\config\\information.kmd");
|
||||
if(!infFile->open(QIODevice::WriteOnly|QIODevice::Text)){
|
||||
//处理错误
|
||||
QMessageBox::warning(nullptr, QString::fromLocal8Bit("错误"), QString::fromLocal8Bit("无法覆写配置文件"));
|
||||
|
|
Loading…
Reference in New Issue