Skip to content

Commit

Permalink
Reversed case-insensitivity commit
Browse files Browse the repository at this point in the history
This reverses ead8cee. After a discussion with @yan12125, it turned out to be redundant (especially see lxqt/lxqt-themes#69 (comment)).
  • Loading branch information
tsujan committed May 4, 2022
1 parent ead8cee commit da77b37
Showing 1 changed file with 9 additions and 18 deletions.
27 changes: 9 additions & 18 deletions lxqtsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -415,16 +415,9 @@ QString LXQtThemeData::findTheme(const QString &themeName)

for(const QString &path : qAsConst(paths))
{
QDir dir(QString::fromLatin1("%1/lxqt/themes").arg(path));
const QFileInfoList dirs = dir.entryInfoList(QDir::AllDirs | QDir::NoDotAndDotDot, QDir::Name);
for(const QFileInfo &dir : dirs)
{
if (QString::compare(dir.fileName(), themeName, Qt::CaseInsensitive) == 0 &&
QDir(dir.absoluteFilePath()).exists(QL1S("lxqt-panel.qss")))
{
return dir.absoluteFilePath();
}
}
QDir dir(QString::fromLatin1("%1/lxqt/themes/%2").arg(path, themeName));
if (dir.isReadable())
return dir.absolutePath();
}

return QString();
Expand Down Expand Up @@ -562,7 +555,7 @@ const LXQtTheme &LXQtTheme::currentTheme()
{
static LXQtTheme theme;
QString name = Settings::globalSettings()->value(QL1S("theme")).toString();
if (QString::compare(theme.name(), name, Qt::CaseInsensitive) != 0)
if (theme.name() != name)
{
theme = LXQtTheme(name);
}
Expand All @@ -585,15 +578,14 @@ QList<LXQtTheme> LXQtTheme::allThemes()
for(const QString &path : qAsConst(paths))
{
QDir dir(QString::fromLatin1("%1/lxqt/themes").arg(path));
const QFileInfoList dirs = dir.entryInfoList(QDir::AllDirs | QDir::NoDotAndDotDot, QDir::Name);
const QFileInfoList dirs = dir.entryInfoList(QDir::AllDirs | QDir::NoDotAndDotDot);

for(const QFileInfo &dir : dirs)
{
auto name = dir.fileName().toLower();
if (!processed.contains(name) &&
QDir(dir.absoluteFilePath()).exists(QL1S("lxqt-panel.qss")))
if (!processed.contains(dir.fileName()) &&
QDir(dir.absoluteFilePath()).exists(QL1S("lxqt-panel.qss")))
{
processed << name;
processed << dir.fileName();
ret << LXQtTheme(dir.absoluteFilePath());
}

Expand Down Expand Up @@ -706,8 +698,7 @@ void GlobalSettings::fileChanged()

QString rt = value(QL1S("theme")).toString();
qlonglong themeUpdated = value(QL1S("__theme_updated__")).toLongLong();
if (QString::compare(d->mLXQtTheme, rt, Qt::CaseInsensitive) != 0 ||
d->mThemeUpdated != themeUpdated)
if ((d->mLXQtTheme != rt) || (d->mThemeUpdated != themeUpdated))
{
d->mLXQtTheme = rt;
Q_EMIT lxqtThemeChanged();
Expand Down

0 comments on commit da77b37

Please sign in to comment.