Unverified Commit 00fb050f authored by akiraohgaki's avatar akiraohgaki Committed by GitHub
Browse files

Merge pull request #66 from opendesktop/develop

Develop
parents dd798fda 59fcfeab
......@@ -8,7 +8,7 @@
ConfigHandler::ConfigHandler(QObject *parent)
: QObject(parent)
{
appConfig_ = qtil::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", qtil::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", qtil::Dir::genericDataPath());
newPath.replace("$XDG_DATA_HOME", Qtil::Dir::genericDataPath());
}
else if (newPath.contains("$KDEHOME")) {
newPath.replace("$KDEHOME", qtil::Dir::kdehomePath());
newPath.replace("$KDEHOME", Qtil::Dir::kdehomePath());
}
else if (newPath.contains("$APP_DATA")) {
newPath.replace("$APP_DATA", qtil::Dir::genericDataPath() + "/" + getAppConfigApplication()["id"].toString());
newPath.replace("$APP_DATA", Qtil::Dir::genericDataPath() + "/" + getAppConfigApplication()["id"].toString());
}
return newPath;
}
......@@ -21,7 +21,7 @@ private:
void importAppConfigInstallTypes();
QString convertPathString(const QString &path) const;
qtil::Config appConfig_;
Qtil::Config appConfig_;
QJsonObject appConfigApplication_;
QJsonObject appConfigInstallTypes_;
};
......@@ -40,9 +40,9 @@ void OcsUrlHandler::process()
}
auto url = metadata_["url"].toString();
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);
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();
}
......@@ -71,7 +71,7 @@ void OcsUrlHandler::openDestination() const
QDesktopServices::openUrl(QUrl("file://" + configHandler_->getAppConfigInstallTypes()[type].toObject()["destination"].toString()));
}
void OcsUrlHandler::networkResourceFinished(qtil::NetworkResource *resource)
void OcsUrlHandler::networkResourceFinished(Qtil::NetworkResource *resource)
{
if (!resource->isFinishedWithNoError()) {
QJsonObject result;
......@@ -126,14 +126,14 @@ void OcsUrlHandler::parse()
}
}
void OcsUrlHandler::saveDownloadedFile(qtil::NetworkResource *resource)
void OcsUrlHandler::saveDownloadedFile(Qtil::NetworkResource *resource)
{
QJsonObject result;
auto type = metadata_["type"].toString();
qtil::Dir destDir(configHandler_->getAppConfigInstallTypes()[type].toObject()["destination"].toString());
Qtil::Dir destDir(configHandler_->getAppConfigInstallTypes()[type].toObject()["destination"].toString());
destDir.make();
qtil::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");
......@@ -150,11 +150,11 @@ void OcsUrlHandler::saveDownloadedFile(qtil::NetworkResource *resource)
resource->deleteLater();
}
void OcsUrlHandler::installDownloadedFile(qtil::NetworkResource *resource)
void OcsUrlHandler::installDownloadedFile(Qtil::NetworkResource *resource)
{
QJsonObject result;
qtil::File tempFile(qtil::Dir::tempPath() + "/" + metadata_["filename"].toString());
Qtil::File tempFile(Qtil::Dir::tempPath() + "/" + metadata_["filename"].toString());
if (!resource->saveData(tempFile.path())) {
result["status"] = QString("error_save");
......@@ -164,11 +164,11 @@ void OcsUrlHandler::installDownloadedFile(qtil::NetworkResource *resource)
return;
}
qtil::Package package(tempFile.path());
Qtil::Package package(tempFile.path());
auto type = metadata_["type"].toString();
qtil::Dir destDir(configHandler_->getAppConfigInstallTypes()[type].toObject()["destination"].toString());
Qtil::Dir destDir(configHandler_->getAppConfigInstallTypes()[type].toObject()["destination"].toString());
destDir.make();
qtil::File destFile(destDir.path() + "/" + metadata_["filename"].toString());
Qtil::File destFile(destDir.path() + "/" + metadata_["filename"].toString());
if (type == "bin"
&& package.installAsProgram(destFile.path())) {
......
......@@ -3,7 +3,7 @@
#include <QObject>
#include <QJsonObject>
namespace qtil {
namespace Qtil {
class NetworkResource;
}
......@@ -31,12 +31,12 @@ public slots:
void openDestination() const;
private slots:
void networkResourceFinished(qtil::NetworkResource *resource);
void networkResourceFinished(Qtil::NetworkResource *resource);
private:
void parse();
void saveDownloadedFile(qtil::NetworkResource *resource);
void installDownloadedFile(qtil::NetworkResource *resource);
void saveDownloadedFile(Qtil::NetworkResource *resource);
void installDownloadedFile(Qtil::NetworkResource *resource);
QString ocsUrl_;
ConfigHandler *configHandler_;
......
......@@ -3,5 +3,5 @@
PROJDIR="$(cd "$(dirname "${0}")/../" && pwd)"
if [[ ! -d "${PROJDIR}/lib/qtil" ]]; then
git clone https://github.com/akiraohgaki/qtil.git -b release-0.3.1 --single-branch --depth=1 "${PROJDIR}/lib/qtil"
git clone https://github.com/akiraohgaki/qtil.git -b release-0.4.0 --single-branch --depth=1 "${PROJDIR}/lib/qtil"
fi
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment