mirror of
https://github.com/QuasarApp/CQtDeployer.git
synced 2025-05-14 18:39:35 +00:00
added qt application for cqtdeployer process
This commit is contained in:
parent
3d3f26973c
commit
68df18719b
@ -32,7 +32,7 @@ int main(int argc, char *argv[]) {
|
|||||||
QCoreApplication app(argc, argv);
|
QCoreApplication app(argc, argv);
|
||||||
|
|
||||||
Deploy deploy;
|
Deploy deploy;
|
||||||
if (deploy.run()) {
|
if (deploy.run(true)) {
|
||||||
app.exit(1);
|
app.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,22 +18,16 @@ Deploy::Deploy() {
|
|||||||
_packing = new Packing();
|
_packing = new Packing();
|
||||||
_paramsParser = new ConfigParser(_fileManager, _scaner, _packing);
|
_paramsParser = new ConfigParser(_fileManager, _scaner, _packing);
|
||||||
|
|
||||||
|
connect(this, &Deploy::sigStart, this, &Deploy::handleStart, Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Deploy::run() {
|
int Deploy::run(bool async) {
|
||||||
|
if (async) {
|
||||||
if (!prepare()) {
|
emit sigStart();
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!deploy()) {
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!packing())
|
|
||||||
return 3;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return runPrivate();
|
||||||
}
|
}
|
||||||
|
|
||||||
Deploy::~Deploy() {
|
Deploy::~Deploy() {
|
||||||
@ -86,7 +80,31 @@ bool Deploy::deploy() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Deploy::packing() {
|
bool Deploy::packing(bool async) {
|
||||||
|
if (async) {
|
||||||
|
connect(_packing, &Packing::sigFinished, this, &Deploy::sigFinish, Qt::QueuedConnection);
|
||||||
|
}
|
||||||
|
|
||||||
return _packing->create();
|
return _packing->create(async);
|
||||||
|
}
|
||||||
|
|
||||||
|
int Deploy::runPrivate(bool async) {
|
||||||
|
if (!prepare()) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!deploy()) {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!packing(async))
|
||||||
|
return 3;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Deploy::handleStart() {
|
||||||
|
if (int exit = runPrivate(true)) {
|
||||||
|
emit sigFinish(exit);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,14 +10,17 @@
|
|||||||
|
|
||||||
#include "deploy_global.h"
|
#include "deploy_global.h"
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
class ConfigParser;
|
class ConfigParser;
|
||||||
class Extracter;
|
class Extracter;
|
||||||
class FileManager;
|
class FileManager;
|
||||||
class DependenciesScanner;
|
class DependenciesScanner;
|
||||||
class Packing;
|
class Packing;
|
||||||
|
|
||||||
class DEPLOYSHARED_EXPORT Deploy
|
class DEPLOYSHARED_EXPORT Deploy : public QObject
|
||||||
{
|
{
|
||||||
|
Q_OBJECT
|
||||||
private:
|
private:
|
||||||
|
|
||||||
ConfigParser * _paramsParser = nullptr;
|
ConfigParser * _paramsParser = nullptr;
|
||||||
@ -28,11 +31,19 @@ private:
|
|||||||
|
|
||||||
bool prepare();
|
bool prepare();
|
||||||
bool deploy();
|
bool deploy();
|
||||||
bool packing();
|
bool packing(bool async);
|
||||||
|
int runPrivate(bool async = false);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void handleStart();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void sigFinish(int code);
|
||||||
|
void sigStart();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Deploy();
|
Deploy();
|
||||||
int run();
|
int run(bool async = false);
|
||||||
~Deploy();
|
~Deploy();
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,6 +15,9 @@ Packing::Packing() {
|
|||||||
connect(_proc, &QProcess::readyReadStandardOutput,
|
connect(_proc, &QProcess::readyReadStandardOutput,
|
||||||
this, &Packing::handleOutputUpdate, Qt::QueuedConnection);
|
this, &Packing::handleOutputUpdate, Qt::QueuedConnection);
|
||||||
|
|
||||||
|
connect(_proc, qOverload<int, QProcess::ExitStatus>(&QProcess::finished),
|
||||||
|
this, &Packing::handleFinished, Qt::QueuedConnection);
|
||||||
|
|
||||||
moveToThread( new QThread(this));
|
moveToThread( new QThread(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,7 +29,7 @@ void Packing::setDistribution(iDistribution *pakage) {
|
|||||||
_pakage = pakage;
|
_pakage = pakage;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Packing::create() {
|
bool Packing::create(bool async) {
|
||||||
|
|
||||||
if (!_pakage)
|
if (!_pakage)
|
||||||
return false;
|
return false;
|
||||||
@ -50,7 +53,7 @@ bool Packing::create() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_proc->waitForFinished(-1)) {
|
if (async && !_proc->waitForFinished(-1)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,3 +83,7 @@ void Packing::handleOutputUpdate() {
|
|||||||
qInfo() << erroutLog;
|
qInfo() << erroutLog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Packing::handleFinished(int exitCode, QProcess::ExitStatus ) {
|
||||||
|
emit sigFinished(exitCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -21,13 +21,17 @@ public:
|
|||||||
Packing();
|
Packing();
|
||||||
~Packing();
|
~Packing();
|
||||||
void setDistribution(iDistribution *pakage);
|
void setDistribution(iDistribution *pakage);
|
||||||
bool create();
|
bool create(bool async);
|
||||||
private:
|
private:
|
||||||
iDistribution *_pakage = nullptr;
|
iDistribution *_pakage = nullptr;
|
||||||
QProcess *_proc = nullptr;
|
QProcess *_proc = nullptr;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void handleOutputUpdate();
|
void handleOutputUpdate();
|
||||||
|
void handleFinished(int exitCode, QProcess::ExitStatus);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void sigFinished(int code);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PACKING_H
|
#endif // PACKING_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user