changed plugin manager gui from window to dialog #4168

This commit is contained in:
XinyuHou 2015-02-04 18:17:06 +00:00
parent d1c1d79453
commit 1132da4598
12 changed files with 223 additions and 174 deletions

View File

@ -1,12 +1,14 @@
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
src/Authenticate.cpp \
src/MainDialog.cpp
HEADERS += src/Arguments.h \
src/Authenticate.h \
src/MainDialog.h
FORMS += res/MainDialogBase.ui
RESOURCES += res/Synergy.qrc
RC_FILE = res/win/Synergy.rc
win32 {
Debug:DESTDIR = ../../../bin/Debug
Release:DESTDIR = ../../../bin/Release

View File

@ -0,0 +1,127 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainDialog</class>
<widget class="QDialog" name="MainDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>275</width>
<height>129</height>
</rect>
</property>
<property name="windowTitle">
<string>Synergy</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>2</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<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="1">
<widget class="QLabel" name="m_pLabelSpinning">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</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>
<item>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<spacer name="horizontalSpacer_3">
<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="1">
<widget class="QLabel" name="m_pLabelInfo">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer_4">
<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>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>2</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -1,84 +0,0 @@
<?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,6 @@
<RCC>
<qresource prefix="/res">
<file>image/spinning-wheel.gif</file>
<file>icons/256x256/synergy.ico</file>
</qresource>
</RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

View File

@ -0,0 +1 @@
IDI_ICON1 ICON DISCARDABLE "../icons/256x256/synergy.ico"

View File

@ -0,0 +1,34 @@
#include "MainDialog.h"
#include "ui_MainDialogBase.h"
#include <QMovie>
MainDialog::MainDialog(Arguments& args, QWidget* parent) :
QDialog(parent)
{
setupUi(this);
setFixedSize(size());
QMovie *movie = new QMovie(":/res/image/spinning-wheel.gif");
m_pLabelSpinning->setMovie(movie);
movie->start();
m_pLabelInfo->setText(args.email);
}
MainDialog::~MainDialog()
{
}
void MainDialog::changeEvent(QEvent *e)
{
QDialog::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
retranslateUi(this);
break;
default:
break;
}
}

View File

@ -0,0 +1,20 @@
#ifndef MAINDIALOG_H
#define MAINDIALOG_H
#include "Arguments.h"
#include "ui_MainDialogBase.h"
#include <QDialog>
class MainDialog : public QDialog, public Ui::MainDialog {
Q_OBJECT
public:
MainDialog(Arguments& args, QWidget* parent = 0);
~MainDialog();
protected:
void changeEvent(QEvent *e);
};
#endif // MAINDIALOG_H

View File

@ -1,31 +0,0 @@
#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

@ -1,26 +0,0 @@
#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

@ -1,27 +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();
}
#include "MainDialog.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);
MainDialog d(args);
d.show();
return a.exec();
}