diff options
Diffstat (limited to 'daemon/appmanager.cpp')
| -rw-r--r-- | daemon/appmanager.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/daemon/appmanager.cpp b/daemon/appmanager.cpp index 8745160..c10cf22 100644 --- a/daemon/appmanager.cpp +++ b/daemon/appmanager.cpp @@ -17,7 +17,7 @@ struct ResourceEntry { } AppManager::AppManager(QObject *parent) - : QObject(parent), + : QObject(parent), l(metaObject()->className()), _watcher(new QFileSystemWatcher(this)) { connect(_watcher, &QFileSystemWatcher::directoryChanged, @@ -29,7 +29,7 @@ AppManager::AppManager(QObject *parent) logger()->warn() << "could not create dir" << dataDir.absoluteFilePath("apps"); } } - logger()->debug() << "install apps in" << dataDir.absoluteFilePath("apps"); + qCDebug(l) << "install apps in" << dataDir.absoluteFilePath("apps"); rescan(); } @@ -73,9 +73,9 @@ void AppManager::rescan() Q_FOREACH(const QString &path, appPaths()) { QDir dir(path); _watcher->addPath(dir.absolutePath()); - logger()->debug() << "scanning dir" << dir.absolutePath(); + qCDebug(l) << "scanning dir" << dir.absolutePath(); QStringList entries = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot | QDir::Readable | QDir::Executable); - logger()->debug() << "scanning dir results" << entries; + qCDebug(l) << "scanning dir results" << entries; Q_FOREACH(const QString &path, entries) { QString appPath = dir.absoluteFilePath(path); _watcher->addPath(appPath); @@ -86,22 +86,22 @@ void AppManager::rescan() } } - logger()->debug() << "now watching" << _watcher->directories() << _watcher->files(); + qCDebug(l) << "now watching" << _watcher->directories() << _watcher->files(); emit appsChanged(); } void AppManager::scanApp(const QString &path) { - logger()->debug() << "scanning app" << path; + qCDebug(l) << "scanning app" << path; QDir appDir(path); if (!appDir.isReadable()) { - logger()->warn() << "app" << appDir.absolutePath() << "is not readable"; + qCWarning(l) << "app" << appDir.absolutePath() << "is not readable"; return; } QFile appInfoFile(path + "/appinfo.json"); if (!appInfoFile.open(QIODevice::ReadOnly | QIODevice::Text)) { - logger()->warn() << "cannot open app info file" << appInfoFile.fileName() << ":" + qCWarning(l) << "cannot open app info file" << appInfoFile.fileName() << ":" << appInfoFile.errorString(); return; } @@ -109,7 +109,7 @@ void AppManager::scanApp(const QString &path) QJsonParseError parseError; QJsonDocument doc = QJsonDocument::fromJson(appInfoFile.readAll(), &parseError); if (parseError.error != QJsonParseError::NoError) { - logger()->warn() << "cannot parse app info file" << appInfoFile.fileName() << ":" + qCWarning(l) << "cannot parse app info file" << appInfoFile.fileName() << ":" << parseError.errorString(); return; } @@ -181,7 +181,7 @@ void AppManager::scanApp(const QString &path) info.setPath(path); if (info.uuid().isNull() || info.shortName().isEmpty()) { - logger()->warn() << "invalid or empty uuid/name in" << appInfoFile.fileName(); + qCWarning(l) << "invalid or empty uuid/name in" << appInfoFile.fileName(); return; } @@ -189,14 +189,14 @@ void AppManager::scanApp(const QString &path) _names.insert(info.shortName(), info.uuid()); const char *type = info.isWatchface() ? "watchface" : "app"; - logger()->debug() << "found installed" << type << info.shortName() << info.versionLabel() << "with uuid" << info.uuid().toString(); + qCDebug(l) << "found installed" << type << info.shortName() << info.versionLabel() << "with uuid" << info.uuid().toString(); } QByteArray AppManager::extractFromResourcePack(const QString &file, int wanted_id) const { QFile f(file); if (!f.open(QIODevice::ReadOnly)) { - logger()->warn() << "cannot open resource file" << f.fileName(); + qCWarning(l) << "cannot open resource file" << f.fileName(); return QByteArray(); } @@ -207,7 +207,7 @@ QByteArray AppManager::extractFromResourcePack(const QString &file, int wanted_i u.readLE<quint32>(); // crc for entire file u.readLE<quint32>(); // timestamp - logger()->debug() << "reading" << num_files << "resources from" << file; + qCDebug(l) << "reading" << num_files << "resources from" << file; QList<ResourceEntry> table; @@ -219,7 +219,7 @@ QByteArray AppManager::extractFromResourcePack(const QString &file, int wanted_i e.crc = u.readLE<quint32>(); if (u.bad()) { - logger()->warn() << "short read on resource file"; + qCWarning(l) << "short read on resource file"; return QByteArray(); } @@ -227,7 +227,7 @@ QByteArray AppManager::extractFromResourcePack(const QString &file, int wanted_i } if (wanted_id >= table.size()) { - logger()->warn() << "specified resource does not exist"; + qCWarning(l) << "specified resource does not exist"; return QByteArray(); } @@ -241,7 +241,7 @@ QByteArray AppManager::extractFromResourcePack(const QString &file, int wanted_i crc.addData(res); if (crc.result() != e.crc) { - logger()->warn() << "CRC failure in resource" << e.index << "on file" << file; + qCWarning(l) << "CRC failure in resource" << e.index << "on file" << file; return QByteArray(); } |
