]> git.lyx.org Git - features.git/commitdiff
GuiLyXFiles: add icons that indicate whether a file is from user or system
authorJuergen Spitzmueller <spitz@lyx.org>
Wed, 20 Mar 2019 17:38:07 +0000 (18:38 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 18 Jun 2020 13:48:18 +0000 (15:48 +0200)
lib/Makefile.am
lib/images/lyxfiles-system.svgz [new file with mode: 0644]
lib/images/lyxfiles-user.svgz [new file with mode: 0644]
src/frontends/qt4/GuiLyXFiles.cpp

index 819a61ec8169576ea44eff6277490846bb19504f..2b37cc015e01d6058cd89acb910d357ede6064b8 100644 (file)
@@ -618,6 +618,8 @@ dist_images_DATA1X = \
        images/layout-toggle_LyX-Code.svgz \
        images/layout-toggle_Chunk.svgz \
        images/layout-toggle_Section.svgz \
+       images/lyxfiles-system.svgz \
+       images/lyxfiles-user.svgz \
        images/lyx-quit.svgz \
        images/marginalnote-insert.svgz \
        images/master-buffer-update.svgz \
diff --git a/lib/images/lyxfiles-system.svgz b/lib/images/lyxfiles-system.svgz
new file mode 100644 (file)
index 0000000..24d9941
Binary files /dev/null and b/lib/images/lyxfiles-system.svgz differ
diff --git a/lib/images/lyxfiles-user.svgz b/lib/images/lyxfiles-user.svgz
new file mode 100644 (file)
index 0000000..6e21ca7
Binary files /dev/null and b/lib/images/lyxfiles-user.svgz differ
index 95b5ef217142550f8fe42752dfb380bce850c7b4..c442b4e0230566e7c514f8c7ca64b2df98ee68da 100644 (file)
@@ -30,7 +30,6 @@
 #include "support/Package.h"
 
 #include <QDirIterator>
-#include <QFileIconProvider>
 #include <QTreeWidget>
 
 using namespace std;
@@ -274,7 +273,8 @@ void GuiLyXFiles::updateContents()
        getFiles(files, type);
 
        filesLW->clear();
-       QFileIconProvider iconprovider;
+       QIcon user_icon(getPixmap("images/", "lyxfiles-user", "svgz,png"));
+       QIcon system_icon(getPixmap("images/", "lyxfiles-system", "svgz,png"));
        QStringList cats;
        QMap<QString, QString>::const_iterator it = files.constBegin();
        QFont capfont;
@@ -306,7 +306,9 @@ void GuiLyXFiles::updateContents()
                QString guiname = filename.left(filename.lastIndexOf(getSuffix())).replace('_', ' ');
                if (translateName())
                        guiname = toqstr(translateIfPossible(qstring_to_ucs4(guiname)));
-               item->setIcon(0, iconprovider.icon(info));
+               QIcon file_icon = (info.filePath().startsWith(toqstr(package().user_support().absFileName()))) ?
+                               user_icon : system_icon;
+               item->setIcon(0, file_icon);
                item->setData(0, Qt::UserRole, info.filePath());
                item->setData(0, Qt::DisplayRole, guiname);
                item->setData(0, Qt::ToolTipRole, info.filePath());
@@ -326,6 +328,7 @@ void GuiLyXFiles::updateContents()
                                }
                        } else {
                                subcatItem->setText(0, subcat);
+                               subcatItem->setIcon(0, file_icon);
                                cats << catsave;
                        }
                        subcatItem->addChild(item);