diff --git a/src/core/config.cpp b/src/core/config.cpp index 9276958e7970f1da7d2c2db57210316295862ae1..2e1635d273d5f86eb861dc54b1c948a9bf2a5d62 100644 --- a/src/core/config.cpp +++ b/src/core/config.cpp @@ -3,7 +3,7 @@ #include "config.h" -namespace Core { +namespace core { Config::Config(const QString &configsDir, QObject *parent) : QObject(parent), configsDir_(configsDir) @@ -14,11 +14,11 @@ QJsonObject Config::get(const QString &name) QString configFile = configsDir_ + "/" + name + ".json"; if (!cacheData_.contains(name)) { - QString json = Utility::File::readText(configFile); + QString json = utility::File::readText(configFile); if (json.isEmpty()) { json = "{}"; // Blank JSON data as default } - cacheData_[name] = Utility::Json::convertStrToObj(json); + cacheData_[name] = utility::Json::convertStrToObj(json); } return cacheData_[name].toObject(); } @@ -26,14 +26,14 @@ QJsonObject Config::get(const QString &name) bool Config::set(const QString &name, const QJsonObject &jsonObj) { QString configFile = configsDir_ + "/" + name + ".json"; - QString json = Utility::Json::convertObjToStr(jsonObj); + QString json = utility::Json::convertObjToStr(jsonObj); - Utility::File::makeDir(configsDir_); - if (Utility::File::writeText(configFile, json)) { + utility::File::makeDir(configsDir_); + if (utility::File::writeText(configFile, json)) { cacheData_[name] = jsonObj; return true; } return false; } -} // namespace Core +} // namespace core diff --git a/src/core/config.h b/src/core/config.h index 16b4dea65da36d24787532d0bb594d3bb6be4647..cc1832d1580fb2e73477c92bb6a7d0f668bc51bf 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -4,7 +4,7 @@ #include <QObject> #include <QJsonObject> -namespace Core { +namespace core { class Config : public QObject { @@ -21,6 +21,6 @@ public: bool set(const QString &name, const QJsonObject &jsonObj); }; -} // namespace Core +} // namespace core #endif // CORE_CONFIG_H diff --git a/src/core/network.cpp b/src/core/network.cpp index 12d7b85e8eb557eedfe2ef2cbd0f3c13d94845d4..7b14b54815dbe0fd5a2f495bdce01b4366990a0f 100644 --- a/src/core/network.cpp +++ b/src/core/network.cpp @@ -5,7 +5,7 @@ #include "network.h" -namespace Core { +namespace core { Network::Network(const bool &async, QObject *parent) : QObject(parent), async_(async) @@ -48,4 +48,4 @@ QNetworkReply *Network::get(const QUrl &uri) return reply; } -} // namespace Core +} // namespace core diff --git a/src/core/network.h b/src/core/network.h index fc96e625656797c85327d4cb8f179a43c270fb82..c2c5c833f6c26ccedc4f43fd80d411e6decac25b 100644 --- a/src/core/network.h +++ b/src/core/network.h @@ -7,7 +7,7 @@ class QEventLoop; class QNetworkAccessManager; class QNetworkReply; -namespace Core { +namespace core { class Network : public QObject { @@ -30,6 +30,6 @@ signals: void downloadProgress(const qint64 &received, const qint64 &total); }; -} // namespace Core +} // namespace core #endif // CORE_NETWORK_H diff --git a/src/handlers/xdgurl.cpp b/src/handlers/xdgurl.cpp index f36c5f8feb40111259a36ba7506f498ed6a9b601..fb0c1951296bebb9a2c6b8cd3b1d1a0c48d7bc75 100644 --- a/src/handlers/xdgurl.cpp +++ b/src/handlers/xdgurl.cpp @@ -11,16 +11,16 @@ #include "xdgurl.h" -namespace Handlers { +namespace handlers { -XdgUrl::XdgUrl(const QString &xdgUrl, Core::Config *config, Core::Network *network, QObject *parent) : +XdgUrl::XdgUrl(const QString &xdgUrl, core::Config *config, core::Network *network, QObject *parent) : QObject(parent), xdgUrl_(xdgUrl), config_(config), network_(network) { parse_(); loadDestinations_(); - connect(network_, &Core::Network::finished, this, &XdgUrl::downloaded_); - connect(network_, &Core::Network::downloadProgress, this, &XdgUrl::downloadProgress); + connect(network_, &core::Network::finished, this, &XdgUrl::downloaded_); + connect(network_, &core::Network::downloadProgress, this, &XdgUrl::downloadProgress); } void XdgUrl::parse_() @@ -81,13 +81,13 @@ QString XdgUrl::convertPathString_(const QString &path) QString newPath = path; if (newPath.contains("$HOME")) { - newPath.replace("$HOME", Utility::File::homePath()); + newPath.replace("$HOME", utility::File::homePath()); } else if (newPath.contains("$XDG_DATA_HOME")) { - newPath.replace("$XDG_DATA_HOME", Utility::File::xdgDataHomePath()); + newPath.replace("$XDG_DATA_HOME", utility::File::xdgDataHomePath()); } else if (newPath.contains("$KDEHOME")) { - newPath.replace("$KDEHOME", Utility::File::kdehomePath()); + newPath.replace("$KDEHOME", utility::File::kdehomePath()); } return newPath; @@ -110,8 +110,8 @@ void XdgUrl::saveDownloadedFile_(QNetworkReply *reply) QString destination = destinations_[type].toString(); QString path = destination + "/" + metadata_["filename"].toString(); - Utility::File::makeDir(destination); - Utility::File::remove(path); // Remove previous downloaded file + utility::File::makeDir(destination); + utility::File::remove(path); // Remove previous downloaded file if (!temporaryFile.copy(path)) { result["status"] = QString("error_save"); @@ -144,38 +144,38 @@ void XdgUrl::installDownloadedFile_(QNetworkReply *reply) QString destination = destinations_[type].toString(); QString path = destination + "/" + metadata_["filename"].toString(); - Utility::File::makeDir(destination); - Utility::File::remove(path); // Remove previous downloaded file + utility::File::makeDir(destination); + utility::File::remove(path); // Remove previous downloaded file if (type == "bin" - && Utility::Package::installProgram(temporaryFile.fileName(), path)) { + && utility::Package::installProgram(temporaryFile.fileName(), path)) { result["message"] = QString("The program has been installed into " + destination); } else if ((type == "plasma_plasmoids" || type == "plasma4_plasmoids" || type == "plasma5_plasmoids") - && Utility::Package::installPlasmapkg(temporaryFile.fileName(), "plasmoid")) { + && utility::Package::installPlasmapkg(temporaryFile.fileName(), "plasmoid")) { result["message"] = QString("The plasmoid has been installed"); } else if ((type == "plasma_look_and_feel" || type == "plasma5_look_and_feel") - && Utility::Package::installPlasmapkg(temporaryFile.fileName(), "lookandfeel")) { + && utility::Package::installPlasmapkg(temporaryFile.fileName(), "lookandfeel")) { result["message"] = QString("The plasma look and feel has been installed"); } else if ((type == "plasma_desktopthemes" || type == "plasma5_desktopthemes") - && Utility::Package::installPlasmapkg(temporaryFile.fileName(), "theme")) { + && utility::Package::installPlasmapkg(temporaryFile.fileName(), "theme")) { result["message"] = QString("The plasma desktop theme has been installed"); } else if (type == "kwin_effects" - && Utility::Package::installPlasmapkg(temporaryFile.fileName(), "kwineffect")) { + && utility::Package::installPlasmapkg(temporaryFile.fileName(), "kwineffect")) { result["message"] = QString("The KWin effect has been installed"); } else if (type == "kwin_scripts" - && Utility::Package::installPlasmapkg(temporaryFile.fileName(), "kwinscript")) { + && utility::Package::installPlasmapkg(temporaryFile.fileName(), "kwinscript")) { result["message"] = QString("The KWin script has been installed"); } else if (type == "kwin_tabbox" - && Utility::Package::installPlasmapkg(temporaryFile.fileName(), "windowswitcher")) { + && utility::Package::installPlasmapkg(temporaryFile.fileName(), "windowswitcher")) { result["message"] = QString("The KWin window switcher has been installed"); } - else if (Utility::Package::uncompressArchive(temporaryFile.fileName(), destination)) { + else if (utility::Package::uncompressArchive(temporaryFile.fileName(), destination)) { result["message"] = QString("The archive file has been uncompressed into " + destination); } else if (temporaryFile.copy(path)) { @@ -289,4 +289,4 @@ void XdgUrl::downloaded_(QNetworkReply *reply) } } -} // namespace Handlers +} // namespace handlers diff --git a/src/handlers/xdgurl.h b/src/handlers/xdgurl.h index 7fe233c8ce504f260d5e2f1f4d097bfe41c63d25..e426ff7f3c9b3b1ea2a7f94b1fc68563f906a63e 100644 --- a/src/handlers/xdgurl.h +++ b/src/handlers/xdgurl.h @@ -6,12 +6,12 @@ class QNetworkReply; -namespace Core { +namespace core { class Config; class Network; } -namespace Handlers { +namespace handlers { class XdgUrl : public QObject { @@ -19,15 +19,15 @@ class XdgUrl : public QObject private: QString xdgUrl_; - Core::Config *config_; - Core::Network *network_; + core::Config *config_; + core::Network *network_; QJsonObject metadata_; QJsonObject destinations_; QString destination_; public: - explicit XdgUrl(const QString &xdgUrl, Core::Config *config, Core::Network *network, QObject *parent = 0); + explicit XdgUrl(const QString &xdgUrl, core::Config *config, core::Network *network, QObject *parent = 0); private: void parse_(); @@ -53,6 +53,6 @@ signals: void downloadProgress(const qint64 &received, const qint64 &total); }; -} // namespace Handlers +} // namespace handlers #endif // HANDLERS_XDGURL_H diff --git a/src/main.cpp b/src/main.cpp index 7999ecb7ce281fea5af2d6d9dbc2cd0bc3bba84a..6380ee48da9408a465e233411610381fb8ad3896 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -21,8 +21,8 @@ int main(int argc, char *argv[]) QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); #endif QGuiApplication app(argc, argv); - Core::Config *config = new Core::Config(":/configs"); - Core::Network *network = new Core::Network(true); + core::Config *config = new core::Config(":/configs"); + core::Network *network = new core::Network(true); QJsonObject configApplication = config->get("application"); @@ -51,7 +51,7 @@ int main(int argc, char *argv[]) // Setup QML QQmlApplicationEngine qmlAppEngine; QQmlContext *qmlContext = qmlAppEngine.rootContext(); - qmlContext->setContextProperty("xdgUrlHandler", new Handlers::XdgUrl(xdgUrl, config, network)); + qmlContext->setContextProperty("xdgUrlHandler", new handlers::XdgUrl(xdgUrl, config, network)); qmlAppEngine.load(QUrl("qrc:/qml/main.qml")); return app.exec(); diff --git a/src/utility/file.cpp b/src/utility/file.cpp index 6f6ed152ccfe1f04e68dae85177b1a0f0dc94509..525278147e4b05bc6ba1527c6ac82d6c06aae158 100644 --- a/src/utility/file.cpp +++ b/src/utility/file.cpp @@ -6,7 +6,7 @@ #include "file.h" -namespace Utility { +namespace utility { /** * XDG Base Directory Specification @@ -203,4 +203,4 @@ bool File::remove(const QString &path) return false; } -} // namespace Utility +} // namespace utility diff --git a/src/utility/file.h b/src/utility/file.h index 8700250686283ff77ccc33fbb4001295c6c0ea1e..bee2341195e4db79103139107e9d6050308198a3 100644 --- a/src/utility/file.h +++ b/src/utility/file.h @@ -6,7 +6,7 @@ class QFileInfo; typedef QList<QFileInfo> QFileInfoList; -namespace Utility { +namespace utility { class File : public QObject { @@ -33,6 +33,6 @@ public: static bool remove(const QString &path); }; -} // namespace Utility +} // namespace utility #endif // UTILITY_FILE_H diff --git a/src/utility/json.cpp b/src/utility/json.cpp index d70ba2da78a0a63215e0fbaa7b00a461cbacccaf..9546942afc9d7bdf633b14c48fff246676906e6e 100644 --- a/src/utility/json.cpp +++ b/src/utility/json.cpp @@ -4,7 +4,7 @@ #include "json.h" -namespace Utility { +namespace utility { Json::Json(QObject *parent) : QObject(parent) {} @@ -36,4 +36,4 @@ bool Json::isValid(const QString &json) return false; } -} // namespace Utility +} // namespace utility diff --git a/src/utility/json.h b/src/utility/json.h index 3b7a0d2ea2a78a2e82798122c317831926e64bc3..0d07c969dde6b9e533f2e16e4b4e9ed496ef319e 100644 --- a/src/utility/json.h +++ b/src/utility/json.h @@ -3,7 +3,7 @@ #include <QObject> -namespace Utility { +namespace utility { class Json : public QObject { @@ -17,6 +17,6 @@ public: static bool isValid(const QString &json); }; -} // namespace Utility +} // namespace utility #endif // UTILITY_JSON_H diff --git a/src/utility/package.cpp b/src/utility/package.cpp index 710b91921f13560f8fec467598f1b82f9ef6de00..033adc0892c6cab8625357cc6b64a06043c14b63 100644 --- a/src/utility/package.cpp +++ b/src/utility/package.cpp @@ -4,7 +4,7 @@ #include "package.h" -namespace Utility { +namespace utility { Package::Package(QObject *parent) : QObject(parent) {} @@ -106,4 +106,4 @@ bool Package::process_(const QString &program, const QStringList &arguments) return false; } -} // namespace Utility +} // namespace utility diff --git a/src/utility/package.h b/src/utility/package.h index 382711766a87feddbbf576fd1618186592d82fcc..d43757c77abc19b69e0797bbfa07151196d2fdbb 100644 --- a/src/utility/package.h +++ b/src/utility/package.h @@ -3,7 +3,7 @@ #include <QObject> -namespace Utility { +namespace utility { class Package : public QObject { @@ -22,6 +22,6 @@ private: static bool process_(const QString &program, const QStringList &arguments); }; -} // namespace Utility +} // namespace utility #endif // UTILITY_PACKAGE_H