Skip to content
This repository has been archived by the owner on Dec 17, 2017. It is now read-only.

Commit

Permalink
issue #37 - Config-mousetheme show not all themes, my KDE show 6 them…
Browse files Browse the repository at this point in the history
…es but razor only 1. (mHidden attribute fixed)
  • Loading branch information
pvanek committed Sep 12, 2011
1 parent 322a684 commit d97deae
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
6 changes: 5 additions & 1 deletion razorqt-config/razor-config-mousetheme/crtheme.cpp
Expand Up @@ -38,6 +38,7 @@ static QHash<QString, QString> alternatives;

///////////////////////////////////////////////////////////////////////////////
XCursorThemeData::XCursorThemeData (const QDir &aDir) {
mHidden = false;
// parse configs, etc
mPath = aDir.path();
setName(aDir.dirName());
Expand All @@ -52,7 +53,10 @@ void XCursorThemeData::parseIndexFile () {
if (cfg.contains("icon theme/name")) mTitle = cfg.values("icon theme/name").at(0).trimmed();
if (cfg.contains("icon theme/comment")) mDescription = cfg.values("icon theme/comment").at(0).trimmed();
if (cfg.contains("icon theme/example")) mSample = cfg.values("icon theme/example").at(0).trimmed();
//if (cfg.contains("icon theme/hidden")) mSample = cfg["icon theme/hidden"];
if (cfg.contains("icon theme/hidden")) {
QString hiddenValue = cfg.values("icon theme/hidden").at(0).toLower();
mHidden = hiddenValue=="false" ? false : true;
}
if (cfg.contains("icon theme/inherits")) {
QStringList i = cfg.values("icon theme/inherits"), res;
for (int f = i.size()-1; f >= 0; f--) res << i.at(f).trimmed();
Expand Down
2 changes: 1 addition & 1 deletion razorqt-config/razor-config-mousetheme/crtheme.h
Expand Up @@ -102,7 +102,7 @@ class XCursorThemeData {
QString mPath;
QString mSample;
mutable QPixmap mIcon;
bool mHidden:1;
bool mHidden;
uint mHash;
QStringList mInherits;
};
Expand Down
15 changes: 11 additions & 4 deletions razorqt-config/razor-config-mousetheme/thememodel.cpp
Expand Up @@ -186,7 +186,7 @@ bool XCursorThemeModel::handleDefault (const QDir &themeDir) {
return false;
}


//#define DUMP_FOUND_THEMES
void XCursorThemeModel::processThemeDir (const QDir &themeDir) {
#ifdef DUMP_FOUND_THEMES
qDebug() << "looking at:" << themeDir.path();
Expand All @@ -199,7 +199,10 @@ void XCursorThemeModel::processThemeDir (const QDir &themeDir) {
}
// If the directory doesn't have a cursors subdir and lacks an
// index.theme file it can't be a cursor theme.
if (!themeDir.exists("index.theme") && !haveCursors) return;
if (!themeDir.exists("index.theme") && !haveCursors) {
// qDebug() << "IS NOT THEME" << themeDir;
return;
}
// Create a cursor theme object for the theme dir
XCursorThemeData *theme = new XCursorThemeData(themeDir);
// Skip this theme if it's hidden
Expand All @@ -213,6 +216,7 @@ void XCursorThemeModel::processThemeDir (const QDir &themeDir) {
;
#endif
if (theme->isHidden()) {
// qDebug() << "HIDDEN THEME" << theme->name() << themeDir;
delete theme;
return;
}
Expand All @@ -235,18 +239,21 @@ void XCursorThemeModel::insertThemes () {
// Scan each base dir for Xcursor themes and add them to the list
foreach (const QString &baseDir, searchPaths()) {
QDir dir(baseDir);
// qDebug() << "TOPLEVEL" << baseDir;
if (!dir.exists()) continue;
// qDebug() << " continue passed";
// Process each subdir in the directory
foreach (const QString &name, dir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot | QDir::Readable | QDir::Executable)) {
// qDebug() << " SUBDIR" << name;
// Don't process the theme if a theme with the same name already exists
// in the list. Xcursor will pick the first one it finds in that case,
// and since we use the same search order, the one Xcursor picks should
// be the one already in the list
if (hasTheme(name)) {
//k8:qDebug() << "duplicate theme:" << dir.path()+name;
qDebug() << "duplicate theme:" << dir.path()+name;
}
if (!dir.cd(name)) {
//k8:qDebug() << "can't cd:" << dir.path()+name;
qDebug() << "can't cd:" << dir.path()+name;
continue;
}
processThemeDir(dir);
Expand Down

0 comments on commit d97deae

Please sign in to comment.