From bfa9bab78dcb9f348ff046ff3848c47f9dc0ed06 Mon Sep 17 00:00:00 2001 From: XinyuHou Date: Wed, 4 Feb 2015 14:09:03 +0000 Subject: [PATCH] added plugin manager gui #4168 --- ext/toolchain/commands1.py | 33 +++++++++-- src/gui/plugin/gui.pro | 24 ++++++++ src/gui/plugin/res/MainWindowBase.ui | 84 ++++++++++++++++++++++++++++ src/gui/plugin/src/Arguments.h | 13 +++++ src/gui/plugin/src/Authenticate.cpp | 5 ++ src/gui/plugin/src/Authenticate.h | 10 ++++ src/gui/plugin/src/MainWindow.cpp | 31 ++++++++++ src/gui/plugin/src/MainWindow.h | 26 +++++++++ src/gui/plugin/src/main.cpp | 27 +++++++++ 9 files changed, 248 insertions(+), 5 deletions(-) create mode 100644 src/gui/plugin/gui.pro create mode 100644 src/gui/plugin/res/MainWindowBase.ui create mode 100644 src/gui/plugin/src/Arguments.h create mode 100644 src/gui/plugin/src/Authenticate.cpp create mode 100644 src/gui/plugin/src/Authenticate.h create mode 100644 src/gui/plugin/src/MainWindow.cpp create mode 100644 src/gui/plugin/src/MainWindow.h create mode 100644 src/gui/plugin/src/main.cpp diff --git a/ext/toolchain/commands1.py b/ext/toolchain/commands1.py index d0b0960a..effaff0c 100644 --- a/ext/toolchain/commands1.py +++ b/ext/toolchain/commands1.py @@ -213,7 +213,8 @@ class InternalCommands: defaultTarget = 'release' cmake_dir = 'res' - gui_dir = 'src/gui' + main_gui_dir = 'src/gui/main' + plugin_gui_dir = 'src/gui/plugin' doc_dir = 'doc' extDir = 'ext' @@ -539,13 +540,21 @@ class InternalCommands: print "QMake command: " + qmake_cmd_string # run qmake from the gui dir - self.try_chdir(self.gui_dir) + self.try_chdir(self.main_gui_dir) err = os.system(qmake_cmd_string) self.restore_chdir() if err != 0: raise Exception('QMake encountered error: ' + str(err)) + # run qmake from the gui dir + self.try_chdir(self.plugin_gui_dir) + err = os.system(qmake_cmd_string) + self.restore_chdir() + + if err != 0: + raise Exception('QMake encountered error: ' + str(err)) + def getQmakeVersion(self): version = commands.getoutput("qmake --version") result = re.search('(\d+)\.(\d+)\.(\d)', version) @@ -777,14 +786,21 @@ class InternalCommands: if sys.platform == 'win32': for target in targets: - self.try_chdir(self.gui_dir) + self.try_chdir(self.main_gui_dir) err = os.system(gui_make_cmd + ' ' + target) self.restore_chdir() - + + if err != 0: + raise Exception(gui_make_cmd + ' failed with error: ' + str(err)) + + self.try_chdir(self.plugin_gui_dir) + err = os.system(gui_make_cmd + ' ' + target) + self.restore_chdir() + if err != 0: raise Exception(gui_make_cmd + ' failed with error: ' + str(err)) else: - self.try_chdir(self.gui_dir) + self.try_chdir(self.main_gui_dir) err = os.system(gui_make_cmd) self.restore_chdir() @@ -797,6 +813,13 @@ class InternalCommands: self.fixQtFrameworksLayout() + self.try_chdir(self.plugin_gui_dir) + err = os.system(gui_make_cmd) + self.restore_chdir() + + if err != 0: + raise Exception(gui_make_cmd + ' failed with error: ' + str(err)) + def symlink(self, source, target): if not os.path.exists(target): os.symlink(source, target) diff --git a/src/gui/plugin/gui.pro b/src/gui/plugin/gui.pro new file mode 100644 index 00000000..ba4beddc --- /dev/null +++ b/src/gui/plugin/gui.pro @@ -0,0 +1,24 @@ +TARGET = plugindownloader +TEMPLATE = app +SOURCES += src/main.cpp \ + src/MainWindow.cpp \ + src/Authenticate.cpp +HEADERS += src/MainWindow.h \ + src/Arguments.h \ + src/Authenticate.h +FORMS += res/MainWindowBase.ui +win32 { + Debug:DESTDIR = ../../../bin/Debug + Release:DESTDIR = ../../../bin/Release +} +else:DESTDIR = ../../../bin +debug { + OBJECTS_DIR = tmp/debug + MOC_DIR = tmp/debug + RCC_DIR = tmp/debug +} +release { + OBJECTS_DIR = tmp/release + MOC_DIR = tmp/release + RCC_DIR = tmp/release +} diff --git a/src/gui/plugin/res/MainWindowBase.ui b/src/gui/plugin/res/MainWindowBase.ui new file mode 100644 index 00000000..f4b2b0af --- /dev/null +++ b/src/gui/plugin/res/MainWindowBase.ui @@ -0,0 +1,84 @@ + + + MainWindow + + + + 0 + 0 + 400 + 293 + + + + Synergy Plugin Downloader + + + + + + + true + + + false + + + true + + + + + + + + + Processing, please wait... + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + 0 + 0 + 400 + 21 + + + + + + + + diff --git a/src/gui/plugin/src/Arguments.h b/src/gui/plugin/src/Arguments.h new file mode 100644 index 00000000..8f0a7276 --- /dev/null +++ b/src/gui/plugin/src/Arguments.h @@ -0,0 +1,13 @@ +#ifndef ARGUMENTS_H +#define ARGUMENTS_H + +#include + +class Arguments +{ +public: + QString email; + QString password; +}; + +#endif // ARGUMENTS_H diff --git a/src/gui/plugin/src/Authenticate.cpp b/src/gui/plugin/src/Authenticate.cpp new file mode 100644 index 00000000..730d4421 --- /dev/null +++ b/src/gui/plugin/src/Authenticate.cpp @@ -0,0 +1,5 @@ +#include "Authenticate.h" + +Authenticate::Authenticate() +{ +} diff --git a/src/gui/plugin/src/Authenticate.h b/src/gui/plugin/src/Authenticate.h new file mode 100644 index 00000000..a0f13d22 --- /dev/null +++ b/src/gui/plugin/src/Authenticate.h @@ -0,0 +1,10 @@ +#ifndef AUTHENTICATE_H +#define AUTHENTICATE_H + +class Authenticate +{ +public: + Authenticate(); +}; + +#endif // AUTHENTICATE_H diff --git a/src/gui/plugin/src/MainWindow.cpp b/src/gui/plugin/src/MainWindow.cpp new file mode 100644 index 00000000..5aa2a690 --- /dev/null +++ b/src/gui/plugin/src/MainWindow.cpp @@ -0,0 +1,31 @@ +#include "MainWindow.h" +#include "ui_MainWindowBase.h" + +MainWindow::MainWindow(Arguments& args, QWidget* parent) : + QMainWindow(parent), + m_Arguments(args) +{ + setupUi(this); + appendInfo(m_Arguments.email); +} + +MainWindow::~MainWindow() +{ +} + +void MainWindow::changeEvent(QEvent* e) +{ + QMainWindow::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + retranslateUi(this); + break; + default: + break; + } +} + +void MainWindow::appendInfo(QString& s) +{ + m_pTextEditInfo->append(s); +} diff --git a/src/gui/plugin/src/MainWindow.h b/src/gui/plugin/src/MainWindow.h new file mode 100644 index 00000000..993daded --- /dev/null +++ b/src/gui/plugin/src/MainWindow.h @@ -0,0 +1,26 @@ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include "Arguments.h" + +#include + +#include "ui_MainWindowBase.h" + +class MainWindow : public QMainWindow, public Ui::MainWindow { + Q_OBJECT +public: + MainWindow(Arguments& args, QWidget* parent = 0); + ~MainWindow(); + +protected: + void changeEvent(QEvent* e); + +private: + void appendInfo(QString& s); + +private: + Arguments m_Arguments; +}; + +#endif // MAINWINDOW_H diff --git a/src/gui/plugin/src/main.cpp b/src/gui/plugin/src/main.cpp new file mode 100644 index 00000000..2f1ba115 --- /dev/null +++ b/src/gui/plugin/src/main.cpp @@ -0,0 +1,27 @@ +#include "MainWindow.h" +#include "Arguments.h" + +#include + +void parseArgs(Arguments& args, int argc, char* argv[]) +{ + for (int i = 1; i < argc; i++) { + if (strcmp(argv[i], "--email") == 0) { + args.email = argv[++i]; + } + if (strcmp(argv[i], "--password") == 0) { + args.password = argv[++i]; + } + } +} + +int main(int argc, char *argv[]) +{ + Arguments args; + parseArgs(args, argc, argv); + + QApplication a(argc, argv); + MainWindow w(args); + w.show(); + return a.exec(); +}