Skip to content
Snippets Groups Projects
Commit 527c3b99 authored by akiraohgaki's avatar akiraohgaki
Browse files

Fix for Qtil

parent 3bb9bb7f
No related branches found
No related tags found
No related merge requests found
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
ConfigHandler::ConfigHandler(QObject *parent) ConfigHandler::ConfigHandler(QObject *parent)
: QObject(parent) : QObject(parent)
{ {
appConfig_ = qtil::Config(":/configs"); appConfig_ = Qtil::Config(":/configs");
importAppConfigApplication(); importAppConfigApplication();
importAppConfigInstallTypes(); importAppConfigInstallTypes();
} }
...@@ -55,7 +55,7 @@ QString ConfigHandler::convertPathString(const QString &path) const ...@@ -55,7 +55,7 @@ QString ConfigHandler::convertPathString(const QString &path) const
{ {
auto newPath = path; auto newPath = path;
if (newPath.contains("$HOME")) { if (newPath.contains("$HOME")) {
newPath.replace("$HOME", qtil::Dir::homePath()); newPath.replace("$HOME", Qtil::Dir::homePath());
} }
else if (newPath.contains("$XDG_DOCUMENTS_DIR")) { else if (newPath.contains("$XDG_DOCUMENTS_DIR")) {
newPath.replace("$XDG_DOCUMENTS_DIR", QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation)); newPath.replace("$XDG_DOCUMENTS_DIR", QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation));
...@@ -73,13 +73,13 @@ QString ConfigHandler::convertPathString(const QString &path) const ...@@ -73,13 +73,13 @@ QString ConfigHandler::convertPathString(const QString &path) const
newPath.replace("$XDG_VIDEOS_DIR", QStandardPaths::writableLocation(QStandardPaths::MoviesLocation)); newPath.replace("$XDG_VIDEOS_DIR", QStandardPaths::writableLocation(QStandardPaths::MoviesLocation));
} }
else if (newPath.contains("$XDG_DATA_HOME")) { 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")) { else if (newPath.contains("$KDEHOME")) {
newPath.replace("$KDEHOME", qtil::Dir::kdehomePath()); newPath.replace("$KDEHOME", Qtil::Dir::kdehomePath());
} }
else if (newPath.contains("$APP_DATA")) { 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; return newPath;
} }
...@@ -21,7 +21,7 @@ private: ...@@ -21,7 +21,7 @@ private:
void importAppConfigInstallTypes(); void importAppConfigInstallTypes();
QString convertPathString(const QString &path) const; QString convertPathString(const QString &path) const;
qtil::Config appConfig_; Qtil::Config appConfig_;
QJsonObject appConfigApplication_; QJsonObject appConfigApplication_;
QJsonObject appConfigInstallTypes_; QJsonObject appConfigInstallTypes_;
}; };
...@@ -40,9 +40,9 @@ void OcsUrlHandler::process() ...@@ -40,9 +40,9 @@ void OcsUrlHandler::process()
} }
auto url = metadata_["url"].toString(); auto url = metadata_["url"].toString();
auto *resource = new qtil::NetworkResource(url, QUrl(url), true, this); auto *resource = new Qtil::NetworkResource(url, QUrl(url), true, this);
connect(resource, &qtil::NetworkResource::downloadProgress, this, &OcsUrlHandler::downloadProgress); connect(resource, &Qtil::NetworkResource::downloadProgress, this, &OcsUrlHandler::downloadProgress);
connect(resource, &qtil::NetworkResource::finished, this, &OcsUrlHandler::networkResourceFinished); connect(resource, &Qtil::NetworkResource::finished, this, &OcsUrlHandler::networkResourceFinished);
resource->get(); resource->get();
emit started(); emit started();
} }
...@@ -71,7 +71,7 @@ void OcsUrlHandler::openDestination() const ...@@ -71,7 +71,7 @@ void OcsUrlHandler::openDestination() const
QDesktopServices::openUrl(QUrl("file://" + configHandler_->getAppConfigInstallTypes()[type].toObject()["destination"].toString())); 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()) { if (!resource->isFinishedWithNoError()) {
QJsonObject result; QJsonObject result;
...@@ -126,14 +126,14 @@ void OcsUrlHandler::parse() ...@@ -126,14 +126,14 @@ void OcsUrlHandler::parse()
} }
} }
void OcsUrlHandler::saveDownloadedFile(qtil::NetworkResource *resource) void OcsUrlHandler::saveDownloadedFile(Qtil::NetworkResource *resource)
{ {
QJsonObject result; QJsonObject result;
auto type = metadata_["type"].toString(); 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(); destDir.make();
qtil::File destFile(destDir.path() + "/" + metadata_["filename"].toString()); Qtil::File destFile(destDir.path() + "/" + metadata_["filename"].toString());
if (!resource->saveData(destFile.path())) { if (!resource->saveData(destFile.path())) {
result["status"] = QString("error_save"); result["status"] = QString("error_save");
...@@ -150,11 +150,11 @@ void OcsUrlHandler::saveDownloadedFile(qtil::NetworkResource *resource) ...@@ -150,11 +150,11 @@ void OcsUrlHandler::saveDownloadedFile(qtil::NetworkResource *resource)
resource->deleteLater(); resource->deleteLater();
} }
void OcsUrlHandler::installDownloadedFile(qtil::NetworkResource *resource) void OcsUrlHandler::installDownloadedFile(Qtil::NetworkResource *resource)
{ {
QJsonObject result; 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())) { if (!resource->saveData(tempFile.path())) {
result["status"] = QString("error_save"); result["status"] = QString("error_save");
...@@ -164,11 +164,11 @@ void OcsUrlHandler::installDownloadedFile(qtil::NetworkResource *resource) ...@@ -164,11 +164,11 @@ void OcsUrlHandler::installDownloadedFile(qtil::NetworkResource *resource)
return; return;
} }
qtil::Package package(tempFile.path()); Qtil::Package package(tempFile.path());
auto type = metadata_["type"].toString(); 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(); destDir.make();
qtil::File destFile(destDir.path() + "/" + metadata_["filename"].toString()); Qtil::File destFile(destDir.path() + "/" + metadata_["filename"].toString());
if (type == "bin" if (type == "bin"
&& package.installAsProgram(destFile.path())) { && package.installAsProgram(destFile.path())) {
......
...@@ -31,12 +31,12 @@ public slots: ...@@ -31,12 +31,12 @@ public slots:
void openDestination() const; void openDestination() const;
private slots: private slots:
void networkResourceFinished(qtil::NetworkResource *resource); void networkResourceFinished(Qtil::NetworkResource *resource);
private: private:
void parse(); void parse();
void saveDownloadedFile(qtil::NetworkResource *resource); void saveDownloadedFile(Qtil::NetworkResource *resource);
void installDownloadedFile(qtil::NetworkResource *resource); void installDownloadedFile(Qtil::NetworkResource *resource);
QString ocsUrl_; QString ocsUrl_;
ConfigHandler *configHandler_; ConfigHandler *configHandler_;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment