added plugin manager gui #4168

This commit is contained in:
XinyuHou 2015-02-04 14:09:03 +00:00
parent afc2a4d1a0
commit bfa9bab78d
9 changed files with 248 additions and 5 deletions

View File

@ -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)

24
src/gui/plugin/gui.pro Normal file
View File

@ -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
}

View File

@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>293</height>
</rect>
</property>
<property name="windowTitle">
<string>Synergy Plugin Downloader</string>
</property>
<widget class="QWidget" name="centralWidget">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTextEdit" name="m_pTextEditInfo">
<property name="enabled">
<bool>true</bool>
</property>
<property name="undoRedoEnabled">
<bool>false</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QLabel" name="m_pLabelTip">
<property name="text">
<string>Processing, please wait...</string>
</property>
</widget>
</item>
<item row="0" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>21</height>
</rect>
</property>
</widget>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,13 @@
#ifndef ARGUMENTS_H
#define ARGUMENTS_H
#include <QString>
class Arguments
{
public:
QString email;
QString password;
};
#endif // ARGUMENTS_H

View File

@ -0,0 +1,5 @@
#include "Authenticate.h"
Authenticate::Authenticate()
{
}

View File

@ -0,0 +1,10 @@
#ifndef AUTHENTICATE_H
#define AUTHENTICATE_H
class Authenticate
{
public:
Authenticate();
};
#endif // AUTHENTICATE_H

View File

@ -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);
}

View File

@ -0,0 +1,26 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include "Arguments.h"
#include <QMainWindow>
#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

View File

@ -0,0 +1,27 @@
#include "MainWindow.h"
#include "Arguments.h"
#include <QtGui/QApplication>
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();
}