mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
GuiLyXFiles: add icons that indicate whether a file is from user or system
This commit is contained in:
parent
1222ce3bfe
commit
ca67b8aa2c
@ -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 \
|
||||
|
BIN
lib/images/lyxfiles-system.svgz
Normal file
BIN
lib/images/lyxfiles-system.svgz
Normal file
Binary file not shown.
BIN
lib/images/lyxfiles-user.svgz
Normal file
BIN
lib/images/lyxfiles-user.svgz
Normal file
Binary file not shown.
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user