Page Menu
Home
Phabricator (Chris)
Search
Configure Global Search
Log In
Files
F130243
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
12 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/src/FilesListWidget.cpp b/src/FilesListWidget.cpp
index df7048b..cb9fc4d 100644
--- a/src/FilesListWidget.cpp
+++ b/src/FilesListWidget.cpp
@@ -1,72 +1,107 @@
#include "FilesListWidget.h"
#include <QDebug>
#include <QPainter>
#include <QStyledItemDelegate>
namespace {
class ItemDelegate : public QStyledItemDelegate {
+private:
+ mutable QIcon icon_chg;
+ mutable QIcon icon_add;
+ mutable QIcon icon_del;
+ mutable QIcon icon_ren;
+ mutable QIcon icon_cpy;
public:
ItemDelegate(QObject *parent)
: QStyledItemDelegate(parent)
{
}
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
QStyleOptionViewItem o = option;
- // int h = o.rect.height();
- // int w = h * 2;
- int h = o.rect.height();
- int w = 2 + h + painter->fontMetrics().size(0, "WWW").width() + 2;
QStyledItemDelegate::initStyleOption(&o, index);
+
+ int h = o.rect.height();
+ int w = 2 + h + painter->fontMetrics().size(0, " Aaa").width() + 2;
#if 1
+ QIcon icon;
QString badge;
QColor bgcolor(240, 240, 240);
if (o.text.startsWith("(chg) ")) {
badge = "Chg";
o.text = o.text.mid(6);
- bgcolor = QColor(240, 240, 160);
- } else if (o.text.startsWith("(ren) ")) {
- badge = "Ren";
- o.text = o.text.mid(6);
- bgcolor = QColor(200, 210, 255);
+ bgcolor = QColor(240, 240, 140);
+ if (icon_chg.isNull()) {
+ icon_chg = QIcon(":/image/chg.svg");
+ }
+ icon = icon_chg;
} else if (o.text.startsWith("(add) ")) {
badge = "Add";
o.text = o.text.mid(6);
bgcolor = QColor(180, 240, 180);
+ if (icon_add.isNull()) {
+ icon_add = QIcon(":/image/add.svg");
+ }
+ icon = icon_add;
} else if (o.text.startsWith("(del) ")) {
badge = "Del";
o.text = o.text.mid(6);
bgcolor = QColor(255, 200, 200);
+ if (icon_del.isNull()) {
+ icon_del = QIcon(":/image/del.svg");
+ }
+ icon = icon_del;
+ } else if (o.text.startsWith("(ren) ")) {
+ badge = "Ren";
+ o.text = o.text.mid(6);
+ bgcolor = QColor(200, 210, 255);
+ if (icon_ren.isNull()) {
+ icon_ren = QIcon(":/image/ren.svg");
+ }
+ icon = icon_ren;
} else if (o.text.startsWith("(cpy) ")) {
badge = "Cpy";
o.text = o.text.mid(6);
-// bgcolor = QColor(255, 200, 200);
+ bgcolor = QColor(200, 210, 255);
+ if (icon_cpy.isNull()) {
+ icon_cpy = QIcon(":/image/cpy.svg");
+ }
+ icon = icon_cpy;
}
if (!badge.isEmpty()) {
- QRect r(o.rect.x(), o.rect.y(), w, h);
- QRect r2 = r.adjusted(2 + h, 0, 0, 0);
+ int x = o.rect.x();
+ int y = o.rect.y();
+ QRect r(x, y, w, h);
+ QRect r2 = QRect(x + 2, y + 1, h - 2, h - 2).adjusted(2, 2, -2, -2);
+ QRect r3 = r.adjusted(1, 1, -2, -2);
+ QRect r4 = r.adjusted(r2.width(), 0, 0, 0);
QTextOption to;
to.setAlignment(Qt::AlignCenter | Qt::AlignVCenter);
painter->setPen(Qt::NoPen);
- QRect r3 = r.adjusted(1, 1, -2, -2);
painter->setBrush(QBrush(bgcolor.darker(130)));
painter->drawRoundedRect(r3.translated(1, 1), 3, 3);
painter->setBrush(QBrush(bgcolor));
painter->drawRoundedRect(r3, 3, 3);
+ if (!icon.isNull()) {
+ painter->save();
+ painter->setOpacity(0.5);
+ icon.paint(painter, r2);
+ painter->restore();
+ }
painter->setPen(Qt::black);
- painter->drawText(r2, badge, to);
+ painter->drawText(r4, badge, to);
}
o.rect.adjust(w, 0, 0, 0);
#endif
option.widget->style()->drawControl(QStyle::CE_ItemViewItem, &o, painter, option.widget);
}
};
}
FilesListWidget::FilesListWidget(QWidget *parent)
: QListWidget(parent)
{
item_delegate = new ItemDelegate(this);
setItemDelegate(item_delegate);
}
diff --git a/src/resources/image/add.svg b/src/resources/image/add.svg
new file mode 100644
index 0000000..82da802
--- /dev/null
+++ b/src/resources/image/add.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1"
+ id="レイヤー_1" xmlns:cc="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:ns1="http://sozi.baierouge.fr" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 907.1 907.1"
+ style="enable-background:new 0 0 907.1 907.1;" xml:space="preserve">
+<style type="text/css">
+ .st0{stroke:#000000;stroke-width:10;stroke-linecap:round;stroke-linejoin:round;}
+</style>
+<polygon class="st0" points="878.7,396.9 510.2,396.8 510.2,28.4 396.9,28.4 396.9,396.8 28.3,396.9 28.3,510.2 396.9,510.2
+ 396.9,878.8 510.2,878.8 510.2,510.2 878.7,510.2 "/>
+</svg>
diff --git a/src/resources/image/chg.svg b/src/resources/image/chg.svg
new file mode 100644
index 0000000..ed233b8
--- /dev/null
+++ b/src/resources/image/chg.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1"
+ id="レイヤー_1" xmlns:cc="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:ns1="http://sozi.baierouge.fr" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 907.1 907.1"
+ style="enable-background:new 0 0 907.1 907.1;" xml:space="preserve">
+<style type="text/css">
+ .st0{stroke:#000000;stroke-width:10;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
+ .st1{fill:#FFFFFF;stroke:#000000;stroke-width:10;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
+</style>
+<rect x="143.6" y="262.4" transform="matrix(0.7071 -0.7071 0.7071 0.7071 -116.9432 482.9008)" class="st0" width="761.7" height="240.5"/>
+<polygon class="st1" points="56.7,850.4 170.1,566.9 340.2,737 "/>
+<polygon class="st0" points="56.7,850.4 124.8,680.3 226.8,782.3 "/>
+</svg>
diff --git a/src/resources/image/cpy.svg b/src/resources/image/cpy.svg
new file mode 100644
index 0000000..e57a17c
--- /dev/null
+++ b/src/resources/image/cpy.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1"
+ id="レイヤー_1" xmlns:cc="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:ns1="http://sozi.baierouge.fr" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 907.1 907.1"
+ style="enable-background:new 0 0 907.1 907.1;" xml:space="preserve">
+<style type="text/css">
+ .st0{fill:#FFFFFF;stroke:#000000;stroke-width:80;stroke-linecap:round;stroke-linejoin:round;}
+</style>
+<rect x="56.7" y="56.7" class="st0" width="566.9" height="566.9"/>
+<rect x="283.5" y="283.5" class="st0" width="566.9" height="566.9"/>
+</svg>
diff --git a/src/resources/image/del.svg b/src/resources/image/del.svg
new file mode 100644
index 0000000..827ac97
--- /dev/null
+++ b/src/resources/image/del.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1"
+ id="レイヤー_1" xmlns:cc="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:ns1="http://sozi.baierouge.fr" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 907.1 907.1"
+ style="enable-background:new 0 0 907.1 907.1;" xml:space="preserve">
+<style type="text/css">
+ .st0{stroke:#000000;stroke-width:10;stroke-linecap:round;stroke-linejoin:round;}
+</style>
+<polygon class="st0" points="878.7,396.9 28.3,396.9 28.3,510.2 878.7,510.2 "/>
+</svg>
diff --git a/src/resources/image/ren.svg b/src/resources/image/ren.svg
new file mode 100644
index 0000000..d21f316
--- /dev/null
+++ b/src/resources/image/ren.svg
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1"
+ id="レイヤー_1" xmlns:cc="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:ns1="http://sozi.baierouge.fr" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 907.1 907.1"
+ style="enable-background:new 0 0 907.1 907.1;" xml:space="preserve">
+<style type="text/css">
+ .st0{fill:#FFFFFF;}
+ .st1{fill:none;stroke:#000000;stroke-width:80;stroke-linecap:round;stroke-linejoin:round;}
+ .st2{fill:none;stroke:#000000;stroke-width:80;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:113.7,151.6;}
+ .st3{fill:#FFFFFF;stroke:#000000;stroke-width:80;stroke-linecap:round;stroke-linejoin:round;}
+</style>
+<g>
+ <rect x="56.7" y="56.7" class="st0" width="566.9" height="566.9"/>
+ <g>
+ <polyline class="st1" points="56.7,131.7 56.7,56.7 131.7,56.7 "/>
+ <line class="st2" x1="283.3" y1="56.7" x2="472.8" y2="56.7"/>
+ <polyline class="st1" points="548.6,56.7 623.6,56.7 623.6,131.7 "/>
+ <line class="st2" x1="623.6" y1="283.3" x2="623.6" y2="472.8"/>
+ <polyline class="st1" points="623.6,548.6 623.6,623.6 548.6,623.6 "/>
+ <line class="st2" x1="397" y1="623.6" x2="207.5" y2="623.6"/>
+ <polyline class="st1" points="131.7,623.6 56.7,623.6 56.7,548.6 "/>
+ <line class="st2" x1="56.7" y1="397" x2="56.7" y2="207.5"/>
+ </g>
+</g>
+<rect x="283.5" y="283.5" class="st3" width="566.9" height="566.9"/>
+</svg>
diff --git a/src/resources/resources.qrc b/src/resources/resources.qrc
index a751a2c..f098379 100644
--- a/src/resources/resources.qrc
+++ b/src/resources/resources.qrc
@@ -1,45 +1,50 @@
<RCC>
<qresource prefix="/">
<file>image/stage.svg</file>
<file>image/unstage.svg</file>
<file>image/commit.svg</file>
<file>image/push.svg</file>
<file>image/selall.svg</file>
<file>image/graphcolor.png</file>
<file>image/pull.svg</file>
<file>image/clone.svg</file>
<file>image/fetch.svg</file>
<file>image/digits.png</file>
<file>image/guitar.png</file>
<file>image/Guitar.svg</file>
<file>image/folder.png</file>
<file>image/repository.png</file>
<file>image/maximize.png</file>
<file>image/transparent.png</file>
<file>image/file.png</file>
<file>image/clear.png</file>
<file>image/terminal.svg</file>
<file>image/explorer.svg</file>
<file>image/about.png</file>
<file>image/redsquare.svg</file>
<file>darktheme/button/button_normal.png</file>
<file>darktheme/button/button_press.png</file>
<file>darktheme/hsb/hsb_add_line.png</file>
<file>darktheme/hsb/hsb_page_bg.png</file>
<file>darktheme/hsb/hsb_slider.png</file>
<file>darktheme/hsb/hsb_sub_line.png</file>
<file>darktheme/progress/horz.png</file>
<file>darktheme/progress/vert.png</file>
<file>darktheme/vsb/vsb_add_line.png</file>
<file>darktheme/vsb/vsb_page_bg.png</file>
<file>darktheme/vsb/vsb_slider.png</file>
<file>darktheme/vsb/vsb_sub_line.png</file>
<file>darktheme/graphcolor.png</file>
<file>image/menu.png</file>
<file>image/signature-bad.png</file>
<file>image/signature-dubious.png</file>
<file>image/signature-good.png</file>
- <file>translations/Guitar_ja.qm</file>
- <file>translations/Guitar_ru.qm</file>
+ <file>translations/Guitar_ja.qm</file>
+ <file>translations/Guitar_ru.qm</file>
+ <file>image/add.svg</file>
+ <file>image/chg.svg</file>
+ <file>image/del.svg</file>
+ <file>image/ren.svg</file>
+ <file>image/cpy.svg</file>
</qresource>
</RCC>
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Mon, Jun 15, 11:26 PM (2 w, 3 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
70007
Default Alt Text
(12 KB)
Attached To
Mode
R77 Guitar
Attached
Detach File
Event Timeline