Просмотр исходного кода

add icon for notebook and directory items

Signed-off-by: Le Tan <[email protected]>
Le Tan 9 лет назад
Родитель
Сommit
e77c10df36

+ 10 - 0
src/resources/icons/dir_item.svg

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+	 width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M437.334,144H256.006l-42.668-48H74.666C51.197,96,32,115.198,32,138.667v234.666C32,396.802,51.197,416,74.666,416h362.668
+	C460.803,416,480,396.802,480,373.333V186.667C480,163.198,460.803,144,437.334,144z M448,373.333
+	c0,5.782-4.885,10.667-10.666,10.667H74.666C68.884,384,64,379.115,64,373.333V176h373.334c5.781,0,10.666,4.885,10.666,10.667
+	V373.333z"/>
+</svg>

+ 13 - 0
src/resources/icons/notebook_item.svg

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+	 width="512px" height="512px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve">
+<path d="M347.621,64c-40.941,0-79.121,14-91.578,44.495C242.5,78,205.408,64,164.466,64C109.265,64,64,89.98,64,143v1v8.995V417v9
+	h6.215h10.958h4.967c12.86-26.334,44.238-42,78.325-42c40.224,0,73.877,27.528,81.617,64h19.714c7.739-36.472,41.495-64,81.722-64
+	c34.085,0,61.149,11.666,78.429,42h4.967h10.959H448v-17V148v-4v-1C448,89.98,402.823,64,347.621,64z M248,410.926
+	C230,385.055,199.27,368,164.5,368c-34.769,0-64.5,10.055-83.5,35.926l-1,0.537V142l0,0v-1c3-41.825,40.089-61,84.293-61
+	c45.162,0,82.145,18.708,83.363,61.808c-0.017,0.729,0.016,1.459,0.016,2.192L248,157.103V410.926z M432,148v255.926
+	C414,378.055,382.269,368,347.5,368c-34.77,0-65.5,17.055-83.5,42.926V145v-1c0-44.112,37.659-64,83.587-64
+	C391.79,80,429,91.175,432,133v1V148z"/>
+</svg>

+ 1 - 0
src/vdirectorytree.cpp

@@ -102,6 +102,7 @@ void VDirectoryTree::fillDirectoryTreeItem(QTreeWidgetItem &item, QJsonObject it
 {
     item.setText(0, itemJson["name"].toString());
     item.setData(0, Qt::UserRole, itemJson);
+    item.setIcon(0, QIcon(":/resources/icons/dir_item.svg"));
 }
 
 QTreeWidgetItem* VDirectoryTree::insertDirectoryTreeItem(QTreeWidgetItem *parent, QTreeWidgetItem *preceding,

+ 4 - 2
src/vmainwindow.cpp

@@ -380,7 +380,8 @@ void VMainWindow::updateNotebookComboBox(const QVector<VNotebook> &notebooks)
     notebookComboMuted = true;
     notebookComboBox->clear();
     for (int i = 0; i < notebooks.size(); ++i) {
-        notebookComboBox->addItem(notebooks[i].getName());
+        notebookComboBox->addItem(QIcon(":/resources/icons/notebook_item.svg"),
+                                  notebooks[i].getName());
     }
     notebookComboMuted = false;
 
@@ -398,7 +399,8 @@ void VMainWindow::updateNotebookComboBox(const QVector<VNotebook> &notebooks)
 void VMainWindow::notebookComboBoxAdded(const QVector<VNotebook> &notebooks, int idx)
 {
     notebookComboMuted = true;
-    notebookComboBox->insertItem(idx, notebooks[idx].getName());
+    notebookComboBox->insertItem(idx, QIcon(":/resources/icons/notebook_item.svg"),
+                                 notebooks[idx].getName());
     notebookComboMuted = false;
     if (notebookComboBox->currentIndex() == vconfig.getCurNotebookIndex()) {
         setCurNotebookIndex(vconfig.getCurNotebookIndex());

+ 2 - 0
src/vnote.qrc

@@ -67,5 +67,7 @@
         <file>resources/icons/copy.svg</file>
         <file>resources/icons/cut.svg</file>
         <file>resources/icons/paste.svg</file>
+        <file>resources/icons/dir_item.svg</file>
+        <file>resources/icons/notebook_item.svg</file>
     </qresource>
 </RCC>