Skip to content

Commit

Permalink
qDebug() output resulted in application installer showing warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
probonopd committed Aug 28, 2023
1 parent 082a8e1 commit 846b6a1
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions platformthemeplugin/hintsettings.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "hintsettings.h"

#include <QDebug>
#include <QDir>
#include <QString>
#include <QFileInfo>
Expand All @@ -19,6 +18,7 @@
#include <QDBusConnection>
#include <QDBusInterface>
#include <QDirIterator>
#include <QTextStream>

static const QByteArray s_systemFontName = QByteArrayLiteral("Font");
static const QByteArray s_systemFixedFontName = QByteArrayLiteral("FixedFont");
Expand Down Expand Up @@ -62,32 +62,32 @@ HintsSettings::HintsSettings(QObject *parent)
QString defaultIconTheme;

for (const QString &iconThemePath : iconThemePaths) {
qDebug() << "iconThemePath" << iconThemePath;
// qDebug() << "iconThemePath" << iconThemePath;
QDir defaultDir(resolveSymlink(iconThemePath + "/default"));

qDebug() << "defaultDir" << defaultDir.path();
// qDebug() << "defaultDir" << defaultDir.path();
if (!defaultDir.exists()) {
qDebug() << "defaultDir" << defaultDir.path() << "does not exist";
// qDebug() << "defaultDir" << defaultDir.path() << "does not exist";
defaultIconTheme = "hicolor";
}

QFile indexThemeFile(resolveSymlink(defaultDir.path() + "/index.theme"));

if (indexThemeFile.exists()) {
qDebug() << "indexThemeFile" << indexThemeFile.fileName();
// qDebug() << "indexThemeFile" << indexThemeFile.fileName();
QFile file(indexThemeFile.fileName());
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
QTextStream in(&file);
while (!in.atEnd()) {
QString line = in.readLine();
if (line.startsWith("Name=")) {
qDebug() << "line" << line;
// qDebug() << "line" << line;
QString themeNameFromFile = line.mid(5); // Remove "Name="
QDir themesDir(resolveSymlink(iconThemePath));
QDirIterator it(themesDir.path(), QDir::Dirs | QDir::NoDotAndDotDot, QDirIterator::NoIteratorFlags);
while (it.hasNext()) {
QString subDir = it.next();
qDebug() << "subDir" << subDir;
// qDebug() << "subDir" << subDir;
// If it is a symlink, resolve it
if (QFileInfo(subDir).isSymLink()) {
subDir = resolveSymlink(subDir);
Expand All @@ -107,17 +107,17 @@ HintsSettings::HintsSettings(QObject *parent)
if (subDir.contains("_cursors")) {
continue;
}
qDebug() << "subIndexThemeFile" << subIndexThemeFile.fileName();
// qDebug() << "subIndexThemeFile" << subIndexThemeFile.fileName();
QFile subFile(subIndexThemeFile.fileName());
if (subFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
QTextStream subIn(&subFile);
while (!subIn.atEnd()) {
QString subLine = subIn.readLine();
if (subLine.startsWith("Name=")) {
qDebug() << "Comparing to" << subLine;
// qDebug() << "Comparing to" << subLine;
QString themeNameFromSubFile = subLine.mid(5); // Remove "Name="
if (themeNameFromFile == themeNameFromSubFile) {
qDebug() << "Found default icon theme" << themeNameFromFile << "in" << subDir;
// qDebug() << "Found default icon theme" << themeNameFromFile << "in" << subDir;
// defaultIconTheme = themeNameFromSubFile; // Breeze
// Actually the directory is called breeze, so we need to use the subDir;
// is this a bug in how Qt finds the icon theme?
Expand All @@ -128,7 +128,7 @@ HintsSettings::HintsSettings(QObject *parent)
}
}
} else {
qDebug() << "subIndexThemeFile" << subIndexThemeFile.fileName() << "does not exist";
// qDebug() << "subIndexThemeFile" << subIndexThemeFile.fileName() << "does not exist";
}
}
}
Expand All @@ -137,9 +137,9 @@ HintsSettings::HintsSettings(QObject *parent)
}
}

qDebug() << "defaultIconTheme" << defaultIconTheme;
// qDebug() << "defaultIconTheme" << defaultIconTheme;
if (defaultIconTheme.isEmpty()) {
qDebug() << "Falling back to hicolor icon theme";
// qDebug() << "Falling back to hicolor icon theme";
defaultIconTheme = "hicolor";
}

Expand Down

0 comments on commit 846b6a1

Please sign in to comment.