From 7493ac4d2e340359981f5dd8c4a596f23cd50cac Mon Sep 17 00:00:00 2001 From: Mike Solar Date: Sat, 9 Sep 2023 16:11:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E8=88=AA=E6=A0=8F=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OfficeAssistant_msvc/applicationmanager.cpp | 20 ++++++++++++-------- OfficeAssistant_msvc/applicationmanager.h | 2 +- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/OfficeAssistant_msvc/applicationmanager.cpp b/OfficeAssistant_msvc/applicationmanager.cpp index d6801ca..c34f4c9 100644 --- a/OfficeAssistant_msvc/applicationmanager.cpp +++ b/OfficeAssistant_msvc/applicationmanager.cpp @@ -10,12 +10,14 @@ #include #include "globalvariables.h" +#include "mainwindowlayout.h" #include "MyButton.h" ApplicationManager::ApplicationManager(QWidget *parent) : QWidget(parent) { application_manager = this; ui.setupUi(this); + connect(this, &ApplicationManager::clickButton, mainWindowLayout, &MainWindowLayout::clickButton); resize(parent->width(), parent->height()); this->parent = parent; layout = new QVBoxLayout(this); @@ -202,16 +204,17 @@ void ApplicationManager::onclick1(QString op, QString func, QString path, QStrin } }else if(op=="soft") { - emit changeUrl(url); - ShellExecute(GetDesktopWindow(), L"open", path.toStdWString().c_str(), L"", L"", SW_SHOW); + emit clickButton("",op,func,url,path,""); + //ShellExecute(GetDesktopWindow(), L"open", path.toStdWString().c_str(), L"", L"", SW_SHOW); }else if(op=="app") { - emit changeUrl(url); - QString str = QApplication::applicationDirPath() + path; - ShellExecute(GetDesktopWindow(), L"open",str.toStdWString().c_str(), L"", L"", SW_SHOW); + emit clickButton("", op, func, url, path, ""); + //QString str = QApplication::applicationDirPath() + path; + //ShellExecute(GetDesktopWindow(), L"open",str.toStdWString().c_str(), L"", L"", SW_SHOW); }else if(op=="url") { - emit changeUrl(url); + //emit clickButton("", op, func, url, path, ""); + emit clickButton("", op, func, url, path, ""); } } @@ -224,8 +227,9 @@ void ApplicationManager::onclick2(QString orig_name, QString op) emit application_manager_page_all->onclick3(orig_name,application_manager_page_all->rows[orig_name].op, application_manager_page_all->rows[orig_name].func, application_manager_page_all->rows[orig_name].exe_file, application_manager_page_all->rows[orig_name].url); } else { - emit changeUrl(application_manager_page_all->rows[orig_name].url); - WinExec((QApplication::applicationDirPath()+application_manager_page_all->rows[orig_name].exe_file).toStdString().c_str(), SW_SHOW); + //emit changeUrl(application_manager_page_all->rows[orig_name].url); + //WinExec((QApplication::applicationDirPath()+application_manager_page_all->rows[orig_name].exe_file).toStdString().c_str(), SW_SHOW); + emit clickButton("", op, application_manager_page_all->rows[orig_name].func, application_manager_page_all->rows[orig_name].url, application_manager_page_all->rows[orig_name].exe_file, ""); } } else if (op == "settings") diff --git a/OfficeAssistant_msvc/applicationmanager.h b/OfficeAssistant_msvc/applicationmanager.h index 63010d2..2b2a1ab 100644 --- a/OfficeAssistant_msvc/applicationmanager.h +++ b/OfficeAssistant_msvc/applicationmanager.h @@ -53,7 +53,7 @@ class ApplicationManager : public QWidget { Q_OBJECT signals: - void changeUrl(QString url); + void clickButton(QString orig_name, QString op, QString func, QString url, QString path, QString initial_position); void refresh(); void refresh_tab(); public: