diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 04dea20..ea6bd5a 100755 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,5 +1,5 @@ name: qt-deployer -version: '1.0.2.core16' +version: '1.0.3.core16' summary: Deploy Qt Project description: | Deploy Qt Projects. this application extract all depends library of executable and create launch script for your application. | diff --git a/source/CPP/about.cpp b/source/CPP/about.cpp index c36147d..deafe29 100644 --- a/source/CPP/about.cpp +++ b/source/CPP/about.cpp @@ -1,6 +1,7 @@ #include "about.h" #include "ui_about.h" #include +#include "utils.h" About::About(QWidget *parent) : QDialog(parent), @@ -12,6 +13,7 @@ About::About(QWidget *parent) : ui->logo->setText(""); QString text = QString("

 

" + "

Version:" + Utils::getVersion() + "
%1 QtLinuxDeployer

" "

%0
%1 QtLinuxDeployer

" "


%2
* %3 %4.
* %5 %6.

" "

%7

" diff --git a/source/CPP/buildmanager.cpp b/source/CPP/buildmanager.cpp index 1d39fd3..7c20122 100644 --- a/source/CPP/buildmanager.cpp +++ b/source/CPP/buildmanager.cpp @@ -115,24 +115,24 @@ bool BuildManager::build(){ pQMake.setWorkingDirectory(tempBuildFolder); pQMake.setArguments(QStringList() << m_projectdir); + QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); + env.insert("LD_LIBRARY_PATH", m_qtdir + "/lib"); + env.insert("QML_IMPORT_PATH", m_qtdir + "/qml"); + env.insert("QML2_IMPORT_PATH", m_qtdir + "/qml"); + env.insert("QT_PLUGIN_PATH", m_qtdir + "/plugins"); + env.insert("QT_QPA_PLATFORM_PLUGIN_PATH", m_qtdir + "/plugins/platforms"); + + pQMake.setProcessEnvironment(env); + pQMake.start(); - if(pQMake.state() == QProcess::NotRunning){ - emit logChanged(tr("run qmake error!")); - return false; - } - if(!pQMake.waitForFinished()){ + emit logChanged(tr("run qmake error!")); return false; } pQMake.setProgram("make"); - if(pQMake.state() == QProcess::NotRunning){ - emit logChanged(tr("run qmake error!")); - return false; - } - pQMake.setArguments(QStringList() << QString("-j%0").arg(QThread::idealThreadCount())); pQMake.start(); diff --git a/source/CPP/mainmanager.cpp b/source/CPP/mainmanager.cpp index 0c78123..d3ba148 100755 --- a/source/CPP/mainmanager.cpp +++ b/source/CPP/mainmanager.cpp @@ -1,4 +1,5 @@ #include "mainmanager.h" +#include "utils.h" QStringList MainManager::getAllExecutables() { @@ -90,6 +91,10 @@ const QString& MainManager::outDir() const{ return m_outputdir; } +QString MainManager::appVer() const{ + return Utils::getVersion(); +} + void MainManager::setState(int state) { if (m_state == state) return; diff --git a/source/CPP/mainmanager.h b/source/CPP/mainmanager.h index 54f5eeb..1f5e854 100755 --- a/source/CPP/mainmanager.h +++ b/source/CPP/mainmanager.h @@ -14,6 +14,8 @@ class MainManager : public BaseClass Q_PROPERTY(int state READ state WRITE setState NOTIFY stateChanged) Q_PROPERTY(QString outDir READ outDir NOTIFY outDirChanged) + Q_PROPERTY(QString appVer READ appVer) + CppManager *m_cpp; QmlManager *m_qml; @@ -45,6 +47,8 @@ public slots: void start(bool erase); const QString& outDir() const; + QString appVer() const; + bool hasPrems(const QString &path); QString stringFromUrl(QString url); bool pathExists(bool isdir, const QString &path); diff --git a/source/CPP/utils.cpp b/source/CPP/utils.cpp new file mode 100644 index 0000000..2151fc7 --- /dev/null +++ b/source/CPP/utils.cpp @@ -0,0 +1,35 @@ +#include "utils.h" +#include +#include + + +QString Utils::getVersion(){ + + QFileInfo f("./../snap/snapcraft.yaml"); + QFile file(f.absoluteFilePath()); + + if(file.open(QIODevice::ReadOnly)){ + QString yamlFile = file.readAll(); + file.close(); + + yamlFile.replace(" ", ""); + yamlFile.replace("'", ""); + + int tempIndex = yamlFile.indexOf(QRegExp("version:")); + if(tempIndex < 0){ + return "error in yaml version"; + } + int beginTarget = tempIndex + 8; + + tempIndex = yamlFile.indexOf("\n", beginTarget); + int longTraget = -1; + + if(tempIndex >= 0){ + longTraget = tempIndex - beginTarget; + } + + return yamlFile.mid(beginTarget, longTraget); + } + + return file.errorString(); +} diff --git a/source/CPP/utils.h b/source/CPP/utils.h new file mode 100644 index 0000000..9533f3e --- /dev/null +++ b/source/CPP/utils.h @@ -0,0 +1,14 @@ +#ifndef UTILS_H +#define UTILS_H +#include + +class Utils +{ +private: + Utils() = delete; +public: + static QString getVersion(); + +}; + +#endif // UTILS_H diff --git a/source/QML/About.qml b/source/QML/About.qml index 9423519..95d6f13 100644 --- a/source/QML/About.qml +++ b/source/QML/About.qml @@ -30,6 +30,7 @@ Item { text: qsTr("This application forked by ShahriarSS Page of original soft: https://github.com/ShahriarSS/QtLinuxDeployer +version: "+MainManager.appVer+" Developers of fork: * Programmer: Yankovich Andrei. diff --git a/source/QtDeployer.pro b/source/QtDeployer.pro index be3b355..2da0754 100755 --- a/source/QtDeployer.pro +++ b/source/QtDeployer.pro @@ -1,7 +1,7 @@ TEMPLATE = app -lessThan(QT_MINOR_VERSION, 6){ +lessThan(QT_MINOR_VERSION, 8){ QT += widgets }else { QT += qml quick @@ -42,7 +42,8 @@ SOURCES += \ CPP/outputmanager.cpp \ CPP/pluginmanager.cpp \ CPP/qmlmanager.cpp \ - CPP/buildmanager.cpp + CPP/buildmanager.cpp \ + CPP/utils.cpp HEADERS += \ CPP/baseclass.h \ @@ -51,10 +52,11 @@ HEADERS += \ CPP/outputmanager.h \ CPP/pluginmanager.h \ CPP/qmlmanager.h \ - CPP/buildmanager.h + CPP/buildmanager.h \ + CPP/utils.h -lessThan(QT_MINOR_VERSION, 6){ +lessThan(QT_MINOR_VERSION, 8){ SOURCES += \ mainwindow.cpp \ @@ -77,7 +79,7 @@ TRANSLATIONS += \ languages/en.ts \ languages/ru.ts -VERSION = 1.0.0.0 +VERSION = 1.0.3.0 TEMPLATE = app RC_ICONS = snap/icon.ico @@ -88,4 +90,6 @@ FORMS += \ CPP/about.ui DISTFILES += \ - ../snap/snapcraft.yaml + ../snap/snapcraft.yaml \ + ../snap/core18/snapcraft.yaml \ + ../snap/dumpSnap/snapcraft.yaml diff --git a/source/main.cpp b/source/main.cpp index 068826e..b8490e9 100755 --- a/source/main.cpp +++ b/source/main.cpp @@ -1,6 +1,6 @@ #include -#if (QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)) +#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)) #include #include #include @@ -43,7 +43,7 @@ int main(int argc, char *argv[]) QGuiApplication *app;; -#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0) +#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0) app = new QGuiApplication(argc, argv); #else app = new QApplication(argc, argv); @@ -74,7 +74,7 @@ int main(int argc, char *argv[]) MainManager M(&C, &Q, &O, &P, &B); -#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0) +#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0) QQmlApplicationEngine engine; auto *R = engine.rootContext();