aboutsummaryrefslogtreecommitdiff
path: root/dev-tools
diff options
context:
space:
mode:
authorZackaryWelch <welch.zackary@gmail.com>2018-04-18 11:37:51 -0400
committerZackaryWelch <welch.zackary@gmail.com>2018-04-18 11:37:51 -0400
commit727a1a17ecf0b534b7d6132326849b9efb760c07 (patch)
treef210f19bad2f19420fbbe175e1b886fdb64b8d9f /dev-tools
parentMuted unused variable warnings in the Poppler backend (diff)
parentClean up the default fluxbox key bindings: (diff)
downloadlumina-727a1a17ecf0b534b7d6132326849b9efb760c07.tar.gz
lumina-727a1a17ecf0b534b7d6132326849b9efb760c07.tar.bz2
lumina-727a1a17ecf0b534b7d6132326849b9efb760c07.zip
Merge branch 'master' of http://github.com/trueos/lumina
Diffstat (limited to 'dev-tools')
-rw-r--r--dev-tools/iconprobe/main.cpp80
-rw-r--r--dev-tools/iconprobe/test.pro12
2 files changed, 92 insertions, 0 deletions
diff --git a/dev-tools/iconprobe/main.cpp b/dev-tools/iconprobe/main.cpp
new file mode 100644
index 00000000..06599bf7
--- /dev/null
+++ b/dev-tools/iconprobe/main.cpp
@@ -0,0 +1,80 @@
+#include <QApplication>
+#include <QDebug>
+#include <QFile>
+#include <QDir>
+#include <QTextStream>
+#include <QIcon>
+
+QString findInDir(QString dir, QString file){
+ QDir _dir(dir);
+ QStringList files = _dir.entryList(QStringList() << file+".*", QDir::Files | QDir::NoDotAndDotDot, QDir::Name);
+ if(files.isEmpty()){
+ QStringList dirs = _dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name);
+ QString tmp;
+ for(int i=0; i<dirs.length() && tmp.isEmpty(); i++){
+ tmp = findInDir( _dir.absoluteFilePath(dirs[i]), file);
+ }
+ return tmp;
+ }else{
+ return _dir.absoluteFilePath(files.first());
+ }
+}
+
+QStringList themeInherits(QString dir){
+ QFile file(dir+"/index.theme");
+ QStringList list;
+ if( file.open(QIODevice::Text | QIODevice::ReadOnly) ){
+ QTextStream in(&file);
+ while(!in.atEnd()){
+ QString line = in.readLine();
+ if(line.startsWith("Inherits=")){
+ //qDebug() << "Got Inherit Line" << line;
+ list = line.section("=",1,-1).split(";");
+ break; //done now
+ }
+ }
+ file.close();
+ }
+ return list;
+}
+
+bool isIconTheme(QString dir){
+ if(!QFile::exists(dir+"/index.theme")){ return false; }
+ QDir base(dir);
+ QStringList dirs = base.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name);
+ dirs.removeAll("cursors");
+ return (!dirs.isEmpty());
+}
+
+int main(int argc, char ** argv)
+{
+ QApplication a(argc, argv);
+
+ QString icondir="/usr/local/share/icons";
+ QStringList iconfiles;
+ if(argc<2){ iconfiles << "folder-downloads" << "start-here-lumina" << "firefox" << "utilities-terminal"; }
+ else{ iconfiles = QString(argv[1]).split(" "); }
+
+ QDir dir(icondir);
+ QStringList themes = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name);
+ //Now look through them and see which themes have this file
+ QIcon::setThemeSearchPaths( QStringList() << icondir );
+ for(int i=0; i<themes.length(); i++){
+ QString themepath = dir.absoluteFilePath(themes[i]);
+ if( !isIconTheme(themepath) ){ continue; }
+ qDebug() << "Testing Theme:" << themes[i];
+ QIcon::setThemeName(themes[i]);
+ QStringList inherits = themeInherits(themepath);
+ for(int j=0; j<inherits.length(); j++){ inherits << themeInherits(dir.absoluteFilePath(inherits[j])); }
+ qDebug() << " - Inherits From Themes (in order):" << inherits;
+ for(int j=0; j<iconfiles.length(); j++){
+ qDebug() << " -------------------------";
+ qDebug() << " - Looking for icon:" << iconfiles[j];
+ qDebug() << " - Found File:" << findInDir(themepath, iconfiles[j]);
+ qDebug() << " - Has Theme Icon:" << QIcon::hasThemeIcon(iconfiles[j]);
+ qDebug() << " - Found Icon:" << QIcon::fromTheme(iconfiles[j]).name();
+ }
+ qDebug() << " ================";
+ }
+ return 0;
+}
diff --git a/dev-tools/iconprobe/test.pro b/dev-tools/iconprobe/test.pro
new file mode 100644
index 00000000..48b02c00
--- /dev/null
+++ b/dev-tools/iconprobe/test.pro
@@ -0,0 +1,12 @@
+# Simple Qt program to test whether UI files can be loaded when there is no DBUS session running
+
+QT = core gui widgets
+#Just for consistency - remove the dbus module from this app build (in case "gui" or "widgets" pulled it in)
+QT -= dbus
+
+CONFIG += debug
+
+TARGET = test
+target.path = $${PWD}
+
+SOURCES = main.cpp
bgstack15