mirror of
https://github.com/QuasarApp/QtDeployer.git
synced 2025-04-27 14:04:31 +00:00
port for qt 5.5
This commit is contained in:
parent
1d8307ea7a
commit
7afefc4272
@ -1,37 +1,34 @@
|
||||
name: qt-deployer
|
||||
version: '1.0test1'
|
||||
version: '1.0test3'
|
||||
summary: Deploy Qt Project
|
||||
description: |
|
||||
Deploy Qt Projects. this application extract all depends library of executable and create launch script for your application.
|
||||
|
||||
grade: stable # must be 'stable' to release into candidate/stable channels
|
||||
confinement: classic # use 'strict' once you have the right plugs and slots
|
||||
base: core18
|
||||
confinement: strict # use 'strict' once you have the right plugs and slots
|
||||
|
||||
icon: snap/gui/icon.png
|
||||
|
||||
apps:
|
||||
qt-deployer:
|
||||
command: qt5-launch opt/qt-deployer/bin/qt-deployer
|
||||
# desktop: usr/share/applications/desc.desktop
|
||||
plugs: [desktop, home, opengl, x11, wayland]
|
||||
command: bin/qt-deployer
|
||||
|
||||
plugs: [desktop, home, opengl, x11, dbus]
|
||||
environment:
|
||||
LD_LIBRARY_PATH: $SNAP/lib
|
||||
QML_IMPORT_PATH: $SNAP/qml
|
||||
QML2_IMPORT_PATH: $SNAP/qml
|
||||
QT_PLUGIN_PATH: $SNAP/plugins
|
||||
QT_QPA_PLATFORM_PLUGIN_PATH: $SNAP/plugins/platforms
|
||||
|
||||
|
||||
parts:
|
||||
qt-deployer:
|
||||
plugin: qmake
|
||||
source: source/
|
||||
build-packages:
|
||||
- qtbase5-dev
|
||||
- qtdeclarative5-dev
|
||||
stage-packages:
|
||||
# Here for the plugins-- they're not linked in automatically.
|
||||
- libqt5gui5
|
||||
- libqt5qml5
|
||||
- libqt5quick5
|
||||
- qml-module-qtquick2
|
||||
- qml-module-qtquick-dialogs
|
||||
- qml-module-qtquick-controls
|
||||
- qml-module-qtgraphicaleffects
|
||||
after: [qt5conf] # A wiki part
|
||||
plugin: dump
|
||||
source: Release-QtDeployer
|
||||
source-type: local
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -11,7 +11,7 @@ BuildManager::BuildManager(QObject *parent) : BaseClass(parent)
|
||||
|
||||
void BuildManager::buildLog(){
|
||||
tempLog = pQMake.readAll();
|
||||
emit logChanged();
|
||||
emit logChanged(tempLog);
|
||||
}
|
||||
|
||||
void BuildManager::buildFinihed(int error) {
|
||||
|
@ -28,7 +28,7 @@ public:
|
||||
bool build();
|
||||
|
||||
signals:
|
||||
void logChanged();
|
||||
void logChanged(QString);
|
||||
void finished();
|
||||
|
||||
public slots:
|
||||
|
71
source/CPP/buildpage.cpp
Normal file
71
source/CPP/buildpage.cpp
Normal file
@ -0,0 +1,71 @@
|
||||
#include "buildpage.h"
|
||||
#include "ui_buildpage.h"
|
||||
#include <QFileDialog>
|
||||
|
||||
|
||||
BuildPage::BuildPage(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::BuildPage)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
connect(ui->chooseProjectPath, &QPushButton::clicked, this, &BuildPage::chooseProjectDir);
|
||||
connect(ui->chooseQtBuildButton, &QPushButton::clicked, this, &BuildPage::chooseQtDir);
|
||||
connect(ui->build, &QPushButton::clicked, this, &BuildPage::buildClick);
|
||||
connect(ui->pathQtBuild, &QLineEdit::textChanged, this, &BuildPage::chooseChanged);
|
||||
connect(ui->projectPath, &QLineEdit::textChanged, this, &BuildPage::chooseChanged);
|
||||
|
||||
}
|
||||
|
||||
void BuildPage::log(QString log){
|
||||
ui->consloleLog->appendPlainText(log);
|
||||
}
|
||||
|
||||
void BuildPage::checkPathes(){
|
||||
QString QtBuild = ui->pathQtBuild->text();
|
||||
QString Project = ui->projectPath->text();
|
||||
|
||||
bool allGood = true;
|
||||
|
||||
if(!QFile::exists(QtBuild)){
|
||||
allGood = false;
|
||||
ui->pathQtBuild->setStyleSheet("QLineEdit { background-color: red }");
|
||||
}else {
|
||||
|
||||
ui->pathQtBuild->setStyleSheet("QLineEdit { background-color: '#41cd71' }");
|
||||
}
|
||||
|
||||
if(!QFile::exists(Project)){
|
||||
allGood = false;
|
||||
ui->projectPath->setStyleSheet("QLineEdit { background-color: red }");
|
||||
}else {
|
||||
ui->projectPath->setStyleSheet("QLineEdit { background-color: '#41cd71' }");
|
||||
}
|
||||
|
||||
ui->build->setEnabled(allGood);
|
||||
|
||||
}
|
||||
|
||||
void BuildPage::chooseQtDir(){
|
||||
QString _OutputFolder = QFileDialog::getExistingDirectory(this, (tr("Selectt QT Folder")), QDir::homePath());
|
||||
ui->pathQtBuild->setText(_OutputFolder);
|
||||
}
|
||||
|
||||
|
||||
void BuildPage::chooseProjectDir(){
|
||||
QString _OutputFolder = QFileDialog::getExistingDirectory(this, tr("Select project Folder"), QDir::currentPath());
|
||||
ui->projectPath->setText(_OutputFolder);
|
||||
}
|
||||
|
||||
void BuildPage::buildClick(){
|
||||
emit build(ui->pathQtBuild->text(), ui->projectPath->text());
|
||||
}
|
||||
|
||||
void BuildPage::chooseChanged(QString) {
|
||||
checkPathes();
|
||||
}
|
||||
|
||||
BuildPage::~BuildPage()
|
||||
{
|
||||
delete ui;
|
||||
}
|
33
source/CPP/buildpage.h
Normal file
33
source/CPP/buildpage.h
Normal file
@ -0,0 +1,33 @@
|
||||
#ifndef BUILDPAGE_H
|
||||
#define BUILDPAGE_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class BuildPage;
|
||||
}
|
||||
|
||||
class BuildPage : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit BuildPage(QWidget *parent = 0);
|
||||
~BuildPage();
|
||||
|
||||
public slots:
|
||||
void log(QString);
|
||||
private:
|
||||
Ui::BuildPage *ui;
|
||||
|
||||
void checkPathes();
|
||||
private slots:
|
||||
void chooseQtDir();
|
||||
void chooseProjectDir();
|
||||
void buildClick();
|
||||
void chooseChanged(QString);
|
||||
signals:
|
||||
void build(QString qt, QString pro);
|
||||
};
|
||||
|
||||
#endif // BUILDPAGE_H
|
103
source/CPP/buildpage.ui
Normal file
103
source/CPP/buildpage.ui
Normal file
@ -0,0 +1,103 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>BuildPage</class>
|
||||
<widget class="QWidget" name="BuildPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="qtBuildInfo">
|
||||
<property name="text">
|
||||
<string>Qt build:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="pathQtBuild"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="chooseQtBuildButton">
|
||||
<property name="text">
|
||||
<string>Chose</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="projectInfo">
|
||||
<property name="text">
|
||||
<string>Project Dir:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="projectPath"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="chooseProjectPath">
|
||||
<property name="text">
|
||||
<string>Chose</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="consloleLog">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="plainText">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<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>
|
||||
<widget class="QPushButton" name="build">
|
||||
<property name="text">
|
||||
<string>build</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
33
source/CPP/deploypage.cpp
Normal file
33
source/CPP/deploypage.cpp
Normal file
@ -0,0 +1,33 @@
|
||||
#include "deploypage.h"
|
||||
#include "ui_deploypage.h"
|
||||
#include <QMessageBox>
|
||||
|
||||
DeployPage::DeployPage(CppManager * cpp, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::DeployPage)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
m_cpp = cpp;
|
||||
model = new ListModel();
|
||||
ui->tableView->setModel(model);
|
||||
connect(ui->checkBox, &QCheckBox::stateChanged, this, &DeployPage::checkChanged);
|
||||
connect(ui->deoply, &QPushButton::clicked, this, &DeployPage::deployClicked);
|
||||
}
|
||||
|
||||
void DeployPage::deployClicked(){
|
||||
emit deploy(model->getSelectedList());
|
||||
}
|
||||
|
||||
void DeployPage::buildFinished(){
|
||||
model->setSource(m_cpp->cppLibraries());
|
||||
}
|
||||
|
||||
void DeployPage::checkChanged(int e){
|
||||
ui->checkBox->setEnabled(!e);
|
||||
}
|
||||
|
||||
DeployPage::~DeployPage()
|
||||
{
|
||||
delete model;
|
||||
delete ui;
|
||||
}
|
37
source/CPP/deploypage.h
Normal file
37
source/CPP/deploypage.h
Normal file
@ -0,0 +1,37 @@
|
||||
#ifndef DEPLOYPAGE_H
|
||||
#define DEPLOYPAGE_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "listmodel.h"
|
||||
#include "mainmanager.h"
|
||||
#include "cppmanager.h"
|
||||
|
||||
namespace Ui {
|
||||
class DeployPage;
|
||||
}
|
||||
|
||||
class DeployPage : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DeployPage(CppManager *cpp ,QWidget *parent = 0);
|
||||
void buildFinished();
|
||||
|
||||
~DeployPage();
|
||||
|
||||
private:
|
||||
|
||||
CppManager *m_cpp;
|
||||
Ui::DeployPage *ui;
|
||||
ListModel *model;
|
||||
|
||||
private slots:
|
||||
void deployClicked();
|
||||
void checkChanged(int);
|
||||
|
||||
signals:
|
||||
void deploy(QStringList);
|
||||
};
|
||||
|
||||
#endif // DEPLOYPAGE_H
|
58
source/CPP/deploypage.ui
Normal file
58
source/CPP/deploypage.ui
Normal file
@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DeployPage</class>
|
||||
<widget class="QWidget" name="DeployPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QTableView" name="tableView"/>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox">
|
||||
<property name="text">
|
||||
<string>select all</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<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>
|
||||
<widget class="QPushButton" name="deoply">
|
||||
<property name="text">
|
||||
<string>Deploy</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
98
source/CPP/listmodel.cpp
Normal file
98
source/CPP/listmodel.cpp
Normal file
@ -0,0 +1,98 @@
|
||||
#include "listmodel.h"
|
||||
|
||||
ListModel::ListModel(QObject *parent)
|
||||
: QStandardItemModel(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QVariant ListModel::headerData(int section, Qt::Orientation orientation, int) const
|
||||
{
|
||||
if(orientation == Qt::Vertical){
|
||||
switch (section) {
|
||||
case 0:
|
||||
return tr("lib Path");
|
||||
case 1:
|
||||
return tr("is Deploy");
|
||||
default:
|
||||
return QVariant();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
int ListModel::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
if (parent.isValid())
|
||||
return 0;
|
||||
|
||||
return source.size();
|
||||
}
|
||||
|
||||
QVariant ListModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
return QVariant();
|
||||
|
||||
if(role == Qt::DisplayRole){
|
||||
switch (index.column()) {
|
||||
case 0: return source[index.row()].first;
|
||||
case 1: return source[index.row()].second;
|
||||
break;
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
}
|
||||
|
||||
return QStandardItemModel::data(index, role);
|
||||
}
|
||||
|
||||
bool ListModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
||||
{
|
||||
if(index.column() != 1){
|
||||
return false;
|
||||
}
|
||||
|
||||
if (data(index, role) != value) {
|
||||
source[index.row()].second = value.toBool();
|
||||
emit dataChanged(index, index, QVector<int>() << role);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Qt::ItemFlags ListModel::flags(const QModelIndex &index) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
return Qt::NoItemFlags;
|
||||
|
||||
if (index.column() == 1){
|
||||
return Qt::ItemIsSelectable;
|
||||
}
|
||||
|
||||
return Qt::NoItemFlags; // FIXME: Implement me!
|
||||
}
|
||||
|
||||
void ListModel::setSource(const QStringList &_source){
|
||||
|
||||
beginResetModel();
|
||||
|
||||
source.clear();
|
||||
for(const QString &i : _source){
|
||||
source.push_back(QPair<QString, bool>(i, false));
|
||||
}
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
QStringList ListModel::getSelectedList()const {
|
||||
QStringList list;
|
||||
|
||||
for (const QPair<QString, bool> &p: source){
|
||||
if(p.second){
|
||||
list.push_back(p.first);
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
36
source/CPP/listmodel.h
Normal file
36
source/CPP/listmodel.h
Normal file
@ -0,0 +1,36 @@
|
||||
#ifndef LISTMODEL_H
|
||||
#define LISTMODEL_H
|
||||
|
||||
#include <QStandardItemModel>
|
||||
|
||||
class ListModel : public QStandardItemModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ListModel(QObject *parent = nullptr);
|
||||
|
||||
// Header:
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
||||
|
||||
// Basic functionality:
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
|
||||
// Editable:
|
||||
bool setData(const QModelIndex &index, const QVariant &value,
|
||||
int role = Qt::EditRole) override;
|
||||
|
||||
Qt::ItemFlags flags(const QModelIndex& index) const override;
|
||||
|
||||
void setSource(const QStringList &source);
|
||||
|
||||
QStringList getSelectedList() const;
|
||||
|
||||
private:
|
||||
|
||||
QList<QPair<QString, bool>> source;
|
||||
};
|
||||
|
||||
#endif // LISTMODEL_H
|
@ -32,6 +32,14 @@ void MainManager::buildFinished(){
|
||||
m_cpp->start(getAllExecutables());
|
||||
}
|
||||
|
||||
BuildManager* MainManager::getBuild(){
|
||||
return m_bld;
|
||||
}
|
||||
|
||||
CppManager* MainManager::getCpp(){
|
||||
return m_cpp;
|
||||
}
|
||||
|
||||
void MainManager::prepare(const QString &qtdir, const QString &projectdir)
|
||||
{
|
||||
QStringList list;
|
||||
@ -46,6 +54,11 @@ void MainManager::prepare(const QString &qtdir, const QString &projectdir)
|
||||
m_bld->build();
|
||||
}
|
||||
|
||||
void MainManager::deploy(const QStringList& list){
|
||||
m_cpp->setCppLibraries(list);
|
||||
start(false);
|
||||
}
|
||||
|
||||
void MainManager::start(bool erase)
|
||||
{
|
||||
setState(1);
|
||||
|
@ -35,9 +35,13 @@ public:
|
||||
|
||||
int state() const;
|
||||
|
||||
BuildManager* getBuild();
|
||||
CppManager* getCpp();
|
||||
|
||||
public slots:
|
||||
void prepare(const QString &qtdir, const QString &projectdir);
|
||||
|
||||
void deploy(const QStringList& list);
|
||||
void start(bool erase);
|
||||
const QString& outDir() const;
|
||||
|
||||
|
11
source/QML/Theme.js
Normal file
11
source/QML/Theme.js
Normal file
@ -0,0 +1,11 @@
|
||||
function accentColor() {
|
||||
return "#41cd71";
|
||||
}
|
||||
|
||||
function backgroundColor() {
|
||||
return "#ffffff";
|
||||
}
|
||||
|
||||
function baseHeight(){
|
||||
return 30;
|
||||
}
|
@ -2,6 +2,10 @@ TEMPLATE = app
|
||||
|
||||
QT += qml quick
|
||||
|
||||
lessThan(QT_MINOR_VERSION, 6){
|
||||
QT += widgets
|
||||
}
|
||||
|
||||
CONFIG += c++14
|
||||
|
||||
RESOURCES += qml.qrc
|
||||
@ -37,7 +41,11 @@ SOURCES += \
|
||||
CPP/outputmanager.cpp \
|
||||
CPP/pluginmanager.cpp \
|
||||
CPP/qmlmanager.cpp \
|
||||
CPP/buildmanager.cpp
|
||||
CPP/buildmanager.cpp \
|
||||
mainwindow.cpp \
|
||||
CPP/buildpage.cpp \
|
||||
CPP/deploypage.cpp \
|
||||
CPP/listmodel.cpp
|
||||
|
||||
HEADERS += \
|
||||
CPP/baseclass.h \
|
||||
@ -46,7 +54,11 @@ HEADERS += \
|
||||
CPP/outputmanager.h \
|
||||
CPP/pluginmanager.h \
|
||||
CPP/qmlmanager.h \
|
||||
CPP/buildmanager.h
|
||||
CPP/buildmanager.h \
|
||||
mainwindow.h \
|
||||
CPP/buildpage.h \
|
||||
CPP/deploypage.h \
|
||||
CPP/listmodel.h
|
||||
|
||||
TRANSLATIONS += \
|
||||
languages/en.ts
|
||||
@ -54,3 +66,8 @@ TRANSLATIONS += \
|
||||
VERSION = 1.0.0.0
|
||||
TEMPLATE = app
|
||||
RC_ICONS = snap/icon.ico
|
||||
|
||||
FORMS += \
|
||||
mainwindow.ui \
|
||||
CPP/buildpage.ui \
|
||||
CPP/deploypage.ui
|
||||
|
@ -1,6 +1,12 @@
|
||||
#include <QGuiApplication>
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QQmlContext>
|
||||
#if QT_VERSION > 0x050501
|
||||
#include <QGuiApplication>
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QQmlContext>
|
||||
#else
|
||||
#include <QApplication>
|
||||
#include "mainwindow.h"
|
||||
#endif
|
||||
|
||||
#include <QIcon>
|
||||
#include <QTranslator>
|
||||
|
||||
@ -12,7 +18,8 @@
|
||||
#include "CPP/buildmanager.h"
|
||||
|
||||
|
||||
bool loadTr(QGuiApplication &app){
|
||||
|
||||
bool loadTr(QGuiApplication *app){
|
||||
QTranslator translator;
|
||||
|
||||
QString defaultLocale = QLocale::system().name();
|
||||
@ -21,7 +28,7 @@ bool loadTr(QGuiApplication &app){
|
||||
if(!translator.load(QString(":/languages/%0").arg(defaultLocale))){
|
||||
return false;
|
||||
}
|
||||
app.installTranslator(&translator);
|
||||
app->installTranslator(&translator);
|
||||
|
||||
return true;
|
||||
|
||||
@ -29,9 +36,18 @@ bool loadTr(QGuiApplication &app){
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QGuiApplication app(argc, argv);
|
||||
QGuiApplication *app;;
|
||||
|
||||
app.setWindowIcon(QIcon("://icon"));
|
||||
|
||||
#if QT_VERSION > 0x050501
|
||||
app = new QGuiApplication(argc, argv);
|
||||
#else
|
||||
app = new QApplication(argc, argv);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
app->setWindowIcon(QIcon("://icon"));
|
||||
|
||||
loadTr(app);
|
||||
|
||||
@ -44,6 +60,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
MainManager M(&C, &Q, &O, &P, &B);
|
||||
|
||||
#if QT_VERSION > 0x050501
|
||||
QQmlApplicationEngine engine;
|
||||
|
||||
auto *R = engine.rootContext();
|
||||
@ -58,6 +75,14 @@ int main(int argc, char *argv[])
|
||||
|
||||
engine.load(QUrl(QLatin1String("qrc:/QML/main.qml")));
|
||||
if (engine.rootObjects().isEmpty()) return -1;
|
||||
#else
|
||||
MainWindow mainApp(&M);
|
||||
mainApp.show();
|
||||
#endif
|
||||
|
||||
|
||||
int returnCode = app->exec();
|
||||
delete app;
|
||||
return returnCode;
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
|
43
source/mainwindow.cpp
Normal file
43
source/mainwindow.cpp
Normal file
@ -0,0 +1,43 @@
|
||||
#include "mainwindow.h"
|
||||
#include "ui_mainwindow.h"
|
||||
#include <QMessageBox>
|
||||
|
||||
MainWindow::MainWindow(MainManager * mainManager, QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::MainWindow)
|
||||
{
|
||||
_mainManager = mainManager;
|
||||
ui->setupUi(this);
|
||||
|
||||
buidlpage = new BuildPage(this);
|
||||
deployPage = new DeployPage(_mainManager->getCpp() ,this);
|
||||
|
||||
ui->stackedWidget->addWidget(buidlpage);
|
||||
ui->stackedWidget->addWidget(deployPage);
|
||||
|
||||
ui->stackedWidget->setCurrentIndex(0);
|
||||
|
||||
|
||||
connect(buidlpage, SIGNAL(build(QString,QString)), _mainManager, SLOT(prepare(QString,QString)));
|
||||
connect(_mainManager->getBuild(), SIGNAL(logChanged(QString)), buidlpage, SLOT(log(QString)));
|
||||
connect(_mainManager->getBuild(), SIGNAL(finished()), this, SLOT(buidlFinisfed()));
|
||||
connect(_mainManager, SIGNAL(stateChanged(int)), this, SLOT(stateChanged(int)));
|
||||
|
||||
connect(deployPage,SIGNAL(deploy(QStringList)), _mainManager, SLOT(deploy(QStringList)));
|
||||
}
|
||||
|
||||
void MainWindow::buidlFinisfed(){
|
||||
ui->stackedWidget->setCurrentIndex(1);
|
||||
deployPage->buildFinished();
|
||||
}
|
||||
|
||||
void MainWindow::stateChanged(int state){
|
||||
if(state == 2){
|
||||
QMessageBox::information(this, tr("deploy finished"), tr("programm has been deply into release folder"));
|
||||
}
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
delete ui;
|
||||
}
|
34
source/mainwindow.h
Normal file
34
source/mainwindow.h
Normal file
@ -0,0 +1,34 @@
|
||||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
#include "CPP/mainmanager.h"
|
||||
#include "CPP/buildpage.h"
|
||||
#include "CPP/deploypage.h"
|
||||
|
||||
namespace Ui {
|
||||
class MainWindow;
|
||||
}
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
|
||||
MainManager *_mainManager;
|
||||
BuildPage *buidlpage;
|
||||
DeployPage *deployPage;
|
||||
|
||||
private slots:
|
||||
void buidlFinisfed();
|
||||
void stateChanged(int);
|
||||
public:
|
||||
explicit MainWindow(MainManager * mainManager, QWidget *parent = 0);
|
||||
~MainWindow();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
96
source/mainwindow.ui
Normal file
96
source/mainwindow.ui
Normal file
@ -0,0 +1,96 @@
|
||||
<?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>800</width>
|
||||
<height>600</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>MainWindow</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="qml.qrc">
|
||||
<normaloff>:/qtquickcontrols2.conf</normaloff>:/qtquickcontrols2.conf</iconset>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QStackedWidget" name="stackedWidget"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menusettings">
|
||||
<property name="title">
|
||||
<string>file</string>
|
||||
</property>
|
||||
<addaction name="actionsettings"/>
|
||||
<addaction name="actionexit"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuabout">
|
||||
<property name="title">
|
||||
<string>about</string>
|
||||
</property>
|
||||
<addaction name="actioncontact"/>
|
||||
<addaction name="actionabout"/>
|
||||
</widget>
|
||||
<addaction name="menusettings"/>
|
||||
<addaction name="menuabout"/>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
<action name="actioncontact">
|
||||
<property name="text">
|
||||
<string>contact</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionabout">
|
||||
<property name="text">
|
||||
<string>about</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionsettings">
|
||||
<property name="text">
|
||||
<string>settings</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionexit">
|
||||
<property name="text">
|
||||
<string>exit</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="qml.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>actionexit</sender>
|
||||
<signal>triggered()</signal>
|
||||
<receiver>MainWindow</receiver>
|
||||
<slot>close()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>-1</x>
|
||||
<y>-1</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>399</x>
|
||||
<y>299</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
@ -12,6 +12,7 @@
|
||||
<file alias="icon">res/icon.png</file>
|
||||
<file>QML/Header.qml</file>
|
||||
<file>QML/About.qml</file>
|
||||
<file>QML/Theme.js</file>
|
||||
</qresource>
|
||||
<qresource prefix="/languages">
|
||||
<file alias="en">languages/en.qm</file>
|
||||
|
Loading…
x
Reference in New Issue
Block a user