diff --git a/.gitignore b/.gitignore index 1316742b3cd061754803991b0233865f78c9b37e..f474670489a0948c11b3be725fc8729685fb1cbe 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ *.pro.user build_*/ -lib/qtlib/ +lib/qtil/ diff --git a/app/src/handlers/confighandler.cpp b/app/src/handlers/confighandler.cpp index b0c4964651174fda83b733e4eb501cbca9f60078..4463b50179f32c7ceb01f0a0e6bcefc8beaa8a63 100644 --- a/app/src/handlers/confighandler.cpp +++ b/app/src/handlers/confighandler.cpp @@ -3,12 +3,12 @@ #include <QStringList> #include <QStandardPaths> -#include "qtlib_dir.h" +#include "qtil_dir.h" ConfigHandler::ConfigHandler(QObject *parent) : QObject(parent) { - appConfig_ = qtlib::Config(":/configs"); + appConfig_ = qtil::Config(":/configs"); importAppConfigApplication(); importAppConfigInstallTypes(); } @@ -55,7 +55,7 @@ QString ConfigHandler::convertPathString(const QString &path) const { auto newPath = path; if (newPath.contains("$HOME")) { - newPath.replace("$HOME", qtlib::Dir::homePath()); + newPath.replace("$HOME", qtil::Dir::homePath()); } else if (newPath.contains("$XDG_DOCUMENTS_DIR")) { newPath.replace("$XDG_DOCUMENTS_DIR", QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation)); @@ -73,13 +73,13 @@ QString ConfigHandler::convertPathString(const QString &path) const newPath.replace("$XDG_VIDEOS_DIR", QStandardPaths::writableLocation(QStandardPaths::MoviesLocation)); } else if (newPath.contains("$XDG_DATA_HOME")) { - newPath.replace("$XDG_DATA_HOME", qtlib::Dir::genericDataPath()); + newPath.replace("$XDG_DATA_HOME", qtil::Dir::genericDataPath()); } else if (newPath.contains("$KDEHOME")) { - newPath.replace("$KDEHOME", qtlib::Dir::kdehomePath()); + newPath.replace("$KDEHOME", qtil::Dir::kdehomePath()); } else if (newPath.contains("$APP_DATA")) { - newPath.replace("$APP_DATA", qtlib::Dir::genericDataPath() + "/" + getAppConfigApplication()["id"].toString()); + newPath.replace("$APP_DATA", qtil::Dir::genericDataPath() + "/" + getAppConfigApplication()["id"].toString()); } return newPath; } diff --git a/app/src/handlers/confighandler.h b/app/src/handlers/confighandler.h index 07c695136172eb52c5ffe7bbdd067cb10cb6ad0e..3e7ab4db9440b855d95fa133b1c6ccd160688b99 100644 --- a/app/src/handlers/confighandler.h +++ b/app/src/handlers/confighandler.h @@ -3,7 +3,7 @@ #include <QObject> #include <QJsonObject> -#include "qtlib_config.h" +#include "qtil_config.h" class ConfigHandler : public QObject { @@ -21,7 +21,7 @@ private: void importAppConfigInstallTypes(); QString convertPathString(const QString &path) const; - qtlib::Config appConfig_; + qtil::Config appConfig_; QJsonObject appConfigApplication_; QJsonObject appConfigInstallTypes_; }; diff --git a/app/src/handlers/ocsurlhandler.cpp b/app/src/handlers/ocsurlhandler.cpp index 29996c0b8c8e35348659876edb8520d8bd897384..f94dc5b09350945e174bcd1d1b57d25fde9a9a4a 100644 --- a/app/src/handlers/ocsurlhandler.cpp +++ b/app/src/handlers/ocsurlhandler.cpp @@ -3,10 +3,10 @@ #include <QUrlQuery> #include <QDesktopServices> -#include "qtlib_file.h" -#include "qtlib_dir.h" -#include "qtlib_networkresource.h" -#include "qtlib_package.h" +#include "qtil_file.h" +#include "qtil_dir.h" +#include "qtil_networkresource.h" +#include "qtil_package.h" #include "handlers/confighandler.h" @@ -40,9 +40,9 @@ void OcsUrlHandler::process() } auto url = metadata_["url"].toString(); - auto *resource = new qtlib::NetworkResource(url, QUrl(url), true, this); - connect(resource, &qtlib::NetworkResource::downloadProgress, this, &OcsUrlHandler::downloadProgress); - connect(resource, &qtlib::NetworkResource::finished, this, &OcsUrlHandler::networkResourceFinished); + auto *resource = new qtil::NetworkResource(url, QUrl(url), true, this); + connect(resource, &qtil::NetworkResource::downloadProgress, this, &OcsUrlHandler::downloadProgress); + connect(resource, &qtil::NetworkResource::finished, this, &OcsUrlHandler::networkResourceFinished); resource->get(); emit started(); } @@ -72,7 +72,7 @@ void OcsUrlHandler::openDestination() const QDesktopServices::openUrl(QUrl("file://" + configHandler_->getAppConfigInstallTypes()[type].toObject()["destination"].toString())); } -void OcsUrlHandler::networkResourceFinished(qtlib::NetworkResource *resource) +void OcsUrlHandler::networkResourceFinished(qtil::NetworkResource *resource) { if (!resource->isFinishedWithNoError()) { QJsonObject result; @@ -127,14 +127,14 @@ void OcsUrlHandler::parse() } } -void OcsUrlHandler::saveDownloadedFile(qtlib::NetworkResource *resource) +void OcsUrlHandler::saveDownloadedFile(qtil::NetworkResource *resource) { QJsonObject result; auto type = metadata_["type"].toString(); - qtlib::Dir destDir(configHandler_->getAppConfigInstallTypes()[type].toObject()["destination"].toString()); + qtil::Dir destDir(configHandler_->getAppConfigInstallTypes()[type].toObject()["destination"].toString()); destDir.make(); - qtlib::File destFile(destDir.path() + "/" + metadata_["filename"].toString()); + qtil::File destFile(destDir.path() + "/" + metadata_["filename"].toString()); if (!resource->saveData(destFile.path())) { result["status"] = QString("error_save"); @@ -151,11 +151,11 @@ void OcsUrlHandler::saveDownloadedFile(qtlib::NetworkResource *resource) resource->deleteLater(); } -void OcsUrlHandler::installDownloadedFile(qtlib::NetworkResource *resource) +void OcsUrlHandler::installDownloadedFile(qtil::NetworkResource *resource) { QJsonObject result; - qtlib::File tempFile(qtlib::Dir::tempPath() + "/" + metadata_["filename"].toString()); + qtil::File tempFile(qtil::Dir::tempPath() + "/" + metadata_["filename"].toString()); if (!resource->saveData(tempFile.path())) { result["status"] = QString("error_save"); @@ -165,11 +165,11 @@ void OcsUrlHandler::installDownloadedFile(qtlib::NetworkResource *resource) return; } - qtlib::Package package(tempFile.path()); + qtil::Package package(tempFile.path()); auto type = metadata_["type"].toString(); - qtlib::Dir destDir(configHandler_->getAppConfigInstallTypes()[type].toObject()["destination"].toString()); + qtil::Dir destDir(configHandler_->getAppConfigInstallTypes()[type].toObject()["destination"].toString()); destDir.make(); - qtlib::File destFile(destDir.path() + "/" + metadata_["filename"].toString()); + qtil::File destFile(destDir.path() + "/" + metadata_["filename"].toString()); if (type == "bin" && package.installAsProgram(destFile.path())) { diff --git a/app/src/handlers/ocsurlhandler.h b/app/src/handlers/ocsurlhandler.h index 38ed279847c1c9791f1025604bc9780203a49bab..f2b9ebd355aeb6ff199e57828c645c3a3787198b 100644 --- a/app/src/handlers/ocsurlhandler.h +++ b/app/src/handlers/ocsurlhandler.h @@ -3,7 +3,7 @@ #include <QObject> #include <QJsonObject> -namespace qtlib { +namespace qtil { class NetworkResource; } @@ -31,12 +31,12 @@ public slots: void openDestination() const; private slots: - void networkResourceFinished(qtlib::NetworkResource *resource); + void networkResourceFinished(qtil::NetworkResource *resource); private: void parse(); - void saveDownloadedFile(qtlib::NetworkResource *resource); - void installDownloadedFile(qtlib::NetworkResource *resource); + void saveDownloadedFile(qtil::NetworkResource *resource); + void installDownloadedFile(qtil::NetworkResource *resource); QString ocsUrl_; ConfigHandler *configHandler_; diff --git a/lib/lib.pri b/lib/lib.pri index 5343ea67e320f54da6851de3969e590c456d432d..935a6b22ae6efe513973b1299a7fbe36a51b92fa 100644 --- a/lib/lib.pri +++ b/lib/lib.pri @@ -1 +1 @@ -include($${PWD}/qtlib/qtlib.pri) +include($${PWD}/qtil/qtil.pri) diff --git a/scripts/import.sh b/scripts/import.sh index 64f9385d803786dcee097c4e88ccbc97a7cd50d2..b97eb7a293709ee3e23d12f486cb4d44b6dfebc8 100644 --- a/scripts/import.sh +++ b/scripts/import.sh @@ -2,6 +2,6 @@ PROJDIR="$(cd "$(dirname "${0}")/../" && pwd)" -if [ ! -d "${PROJDIR}/lib/qtlib" ]; then - git clone https://github.com/akiraohgaki/qtlib.git -b release-0.2.1 --single-branch --depth=1 "${PROJDIR}/lib/qtlib" +if [ ! -d "${PROJDIR}/lib/qtil" ]; then + git clone https://github.com/akiraohgaki/qtil.git -b release-0.3.0 --single-branch --depth=1 "${PROJDIR}/lib/qtil" fi