0
0
mirror of https://github.com/yse/easy_profiler.git synced 2024-12-26 16:11:02 +08:00

(profiler_gui) New style for icons

This commit is contained in:
Victor Zarubkin 2016-09-15 23:56:20 +03:00
parent cb6da49b3d
commit 925e2f1b26
12 changed files with 49 additions and 43 deletions

View File

@ -359,11 +359,11 @@ void EasyTreeWidget::contextMenuEvent(QContextMenuEvent* _event)
{
action = menu.addAction("Expand all");
connect(action, &QAction::triggered, this, &This::onExpandAllClicked);
{ QIcon icon(":/Expand"); if (!icon.isNull()) action->setIcon(icon); }
SET_ICON(action, ":/Expand");
action = menu.addAction("Collapse all");
connect(action, &QAction::triggered, this, &This::onCollapseAllClicked);
{ QIcon icon(":/Collapse"); if (!icon.isNull()) action->setIcon(icon); }
SET_ICON(action, ":/Colapse");
if (item != nullptr && col >= 0)
{
@ -371,11 +371,11 @@ void EasyTreeWidget::contextMenuEvent(QContextMenuEvent* _event)
action = menu.addAction("Expand all children");
connect(action, &QAction::triggered, this, &This::onExpandAllChildrenClicked);
{ QIcon icon(":/Expand"); if (!icon.isNull()) action->setIcon(icon); }
SET_ICON(action, ":/Expand");
action = menu.addAction("Collapse all children");
connect(action, &QAction::triggered, this, &This::onCollapseAllChildrenClicked);
{ QIcon icon(":/Collapse"); if (!icon.isNull()) action->setIcon(icon); }
SET_ICON(action, ":/Collapse");
}
menu.addSeparator();
@ -389,9 +389,9 @@ void EasyTreeWidget::contextMenuEvent(QContextMenuEvent* _event)
auto f = action->font();
f.setBold(true);
action->setFont(f);
{ QIcon icon(":/Color"); if (!icon.isNull()) action->setIcon(icon); }
SET_ICON(action, ":/Color");
}
else { QIcon icon(":/NoColor"); if (!icon.isNull()) action->setIcon(icon); }
else SET_ICON(action, ":/NoColor");
if (item != nullptr && item->parent() != nullptr)
{

View File

@ -35,6 +35,7 @@
#include <QObject>
#include <QColor>
#include <QTextCodec>
#include <QSize>
#include "common_types.h"
#include "globals_qobjects.h"
@ -130,6 +131,8 @@ inline ::profiler::BlocksTree& blocksTree(::profiler::block_index_t i) {
}
#endif
#define SET_ICON(objectName, iconName) { QIcon icon(iconName); if (!icon.isNull()) objectName->setIcon(icon); }
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////

View File

@ -4,9 +4,12 @@
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 210.002 210.002" style="enable-background:new 0 0 210.002 210.002;" xml:space="preserve">
<path style="fill:#020202;" d="M195.765,76.815l-77.424,11.118l11.119-77.422l19.932,19.931l30.445-30.441l26.439,26.44
l-30.441,30.444L195.765,76.815z M34.168,153.117L3.725,183.563l26.439,26.439l30.445-30.441l19.932,19.93l11.119-77.422
l-77.422,11.119L34.168,153.117z M60.61,30.441L30.164,0L3.725,26.44l30.443,30.444l-19.93,19.931L91.66,87.933L80.541,10.511
L60.61,30.441z M195.765,133.188l-77.424-11.119l11.119,77.422l19.932-19.93l30.445,30.441l26.439-26.439l-30.441-30.445
l-30.441,30.444L195.765,76.815z"/>
<path style="fill:#020202;" d="M34.168,153.117L3.725,183.563l26.439,26.439l30.445-30.441l19.932,19.93l11.119-77.422
l-77.422,11.119L34.168,153.117z"/>
<path style="fill:#ff2020;" d="M60.61,30.441L30.164,0L3.725,26.44l30.443,30.444l-19.93,19.931L91.66,87.933L80.541,10.511
L60.61,30.441z"/>
<path style="fill:#ff2020;" d="M195.765,133.188l-77.424-11.119l11.119,77.422l19.932-19.93l30.445,30.441l26.439-26.439l-30.441-30.445
L195.765,133.188z"/>
<g>
</g>

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -3,10 +3,12 @@
<!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="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 210 210" style="enable-background:new 0 0 210 210;" xml:space="preserve">
<path style="fill:#020202;" d="M34.774,152.509l26.441,26.442l19.93,19.931L3.724,210l11.119-77.422L34.774,152.509z
M175.226,152.509l-30.445-30.441l-26.44,26.439l30.441,30.444l-19.93,19.931L206.276,210l-11.119-77.422L175.226,152.509z
M65.22,122.067l26.439,26.439l-30.443,30.444l-26.441-26.442L65.22,122.067z M61.216,31.049l30.443,30.444L65.22,87.933
L34.774,57.491L14.843,77.422L3.724,0l77.422,11.118L61.216,31.049z M118.341,61.493l30.441-30.444l-19.93-19.931L206.276,0
<path style="fill:#ff2020;" d="M34.774,152.509l26.441,26.442l19.93,19.931L3.724,210l11.119-77.422L34.774,152.509z"/>
<path style="fill:#020202;" d="M175.226,152.509l-30.445-30.441l-26.44,26.439l30.441,30.444l-19.93,19.931L206.276,210l-11.119-77.422L175.226,152.509z"/>
<path style="fill:#ff2020;" d="M65.22,122.067l26.439,26.439l-30.443,30.444l-26.441-26.442L65.22,122.067z"/>
<path style="fill:#020202;" d="M61.216,31.049l30.443,30.444L65.22,87.933
L34.774,57.491L14.843,77.422L3.724,0l77.422,11.118L61.216,31.049z"/>
<path style="fill:#ff2020;" d="M118.341,61.493l30.441-30.444l-19.93-19.931L206.276,0
l-11.119,77.422l-19.932-19.931L144.78,87.933L118.341,61.493z"/>
<g>
</g>

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -15,7 +15,7 @@
h18.936V14.258c0-1.793,1.453-3.246,3.246-3.246c1.789,0,3.246,1.453,3.246,3.246C31.92,14.258,31.92,42.935,31.92,42.935z"/>
</g>
<g>
<path style="fill:#010002;" d="M12.712,31.784V14.262c0-1.793,1.453-3.246,3.246-3.246s3.246,1.453,3.246,3.246v17.522H12.712z"
<path style="fill:#ff2020;" d="M12.712,31.784V14.262c0-1.793,1.453-3.246,3.246-3.246s3.246,1.453,3.246,3.246v17.522H12.712z"
/>
</g>
<g>

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -12,9 +12,9 @@
C638.876,263.557,533.698,142.786,395.233,117.99z M342.758,637.52c-125.907,0-228.339-102.433-228.339-228.362
c0-125.896,102.433-228.305,228.339-228.305c125.895,0,228.339,102.41,228.339,228.305
C571.097,535.087,468.665,637.52,342.758,637.52z"/>
<path d="M651.987,153.333l-48.017-48.028c-4.274-4.286-10.065-6.688-16.098-6.688s-11.823,2.401-16.097,6.665l-38.929,38.939
<path style="fill:#ff2020;" d="M651.987,153.333l-48.017-48.028c-4.274-4.286-10.065-6.688-16.098-6.688s-11.823,2.401-16.097,6.665l-38.929,38.939
l80.246,80.2l38.894-38.917C660.869,176.612,660.869,162.227,651.987,153.333z"/>
<path d="M341.724,195.237c-117.714,0.54-212.966,96.125-212.966,213.92c0,118.231,95.815,214.022,214.012,214.022
<path style="fill:#ff2020;" d="M341.724,195.237c-117.714,0.54-212.966,96.125-212.966,213.92c0,118.231,95.815,214.022,214.012,214.022
c118.185,0,213.989-95.769,214-214H341.724V195.237z"/>
</g>
</g>

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -7,7 +7,7 @@
<path d="M17.284,2.033v3.3c3.006,1.551,5.065,4.683,5.065,8.299c0,5.161-4.184,9.344-9.343,9.344c-5.16,0-9.346-4.183-9.346-9.344
c0-3.316,1.735-6.223,4.34-7.881V2.32C3.662,4.242,0.63,8.581,0.63,13.632c0,6.834,5.539,12.377,12.374,12.377
c6.834,0,12.374-5.543,12.374-12.377C25.378,8.304,22.003,3.779,17.284,2.033z"/>
<path d="M12.766,15.229c1.359,0,2.457-0.803,2.457-1.79V1.795C15.224,0.804,14.125,0,12.766,0c-1.357,0-2.456,0.804-2.456,1.795
<path style="fill:#ff2020;" d="M12.766,15.229c1.359,0,2.457-0.803,2.457-1.79V1.795C15.224,0.804,14.125,0,12.766,0c-1.357,0-2.456,0.804-2.456,1.795
V13.44C10.311,14.427,11.41,15.229,12.766,15.229z"/>
</g>
<g id="Capa_1_192_">

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -5,7 +5,8 @@
viewBox="0 0 250.604 250.604" style="enable-background:new 0 0 250.604 250.604;" xml:space="preserve">
<path d="M66.34,115.302h173.065c4.148,0,6.846,2.708,8.084,4.322c2.898,3.776,3.847,8.949,2.537,13.839l-23.92,89.297
c-1.528,5.707-5.796,9.542-10.619,9.542H42.422c-4.148,0-6.846-2.708-8.084-4.322c-2.898-3.776-3.847-8.949-2.537-13.839
l23.919-89.297C57.249,119.137,61.517,115.302,66.34,115.302z M17.312,210.26l23.919-89.297
l23.919-89.297C57.249,119.137,61.517,115.302,66.34,115.302z"/>
<path style="fill:#ff2020;" d="M17.312,210.26l23.919-89.297
c3.31-12.358,13.399-20.661,25.108-20.661H229v-42c0-4.143-2.524-7-6.667-7H130v-2.633c0-17.021-13.014-30.367-30.033-30.367H31.2
C14.18,18.302,0,31.649,0,48.669v9.633v33v115.5c0,4.143,3.69,7.5,7.833,7.5h8.684C16.697,212.947,16.954,211.597,17.312,210.26z"/>
<g>

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -7,7 +7,7 @@
<path style="fill:#010002;" d="M203.758,153.541l37.576,73.686L297.03,55.674L125.456,0.022l37.274,73.125
C75.002,104.467,12.166,188.054,12.166,286.525c0,101.383,66.546,187.17,158.351,216.161
c-55.307-34.902-92.15-96.378-92.15-166.526C78.345,252.788,130.525,182.208,203.758,153.541z"/>
<path style="fill:#010002;" d="M298.993,349.209l-37.598-73.707l-55.631,171.531l171.509,55.674l-37.296-73.147
<path style="fill:#ff2020;" d="M298.993,349.209l-37.598-73.707l-55.631,171.531l171.509,55.674l-37.296-73.147
c87.75-31.278,150.564-114.886,150.564-213.4C490.541,114.8,424.017,29.013,332.212,0c55.286,34.902,92.172,96.357,92.172,166.526
C424.405,249.941,372.225,320.477,298.993,349.209z"/>
</g>

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -8,7 +8,7 @@
<g>
<path d="M101.98,186.441H30.484c-5.523,0-10,4.477-10,10v166.021c0,5.523,4.477,10,10,10h71.496c5.523,0,10-4.477,10-10V196.441
C111.98,190.919,107.503,186.441,101.98,186.441z"/>
<path d="M221.98,0h-71.496c-5.523,0-10,4.477-10,10v352.465c0,5.521,4.477,10,10,10h71.496c5.523,0,10-4.479,10-10V10
<path style="fill:#ff2020;" d="M221.98,0h-71.496c-5.523,0-10,4.477-10,10v352.465c0,5.521,4.477,10,10,10h71.496c5.523,0,10-4.479,10-10V10
C231.98,4.477,227.504,0,221.98,0z"/>
<path d="M341.98,115.257h-71.496c-5.523,0-10,4.477-10,10v237.208c0,5.521,4.477,10,10,10h71.496c5.523,0,10-4.479,10-10V125.257
C351.98,119.734,347.504,115.257,341.98,115.257z"/>

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -4,11 +4,14 @@
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 233.576 233.576" style="enable-background:new 0 0 233.576 233.576;" xml:space="preserve">
<path d="M176.982,129.274c-16.066-16.113-37.442-24.986-60.193-24.986s-44.128,8.873-60.193,24.986l-21.244-21.182
c21.735-21.799,50.657-33.805,81.438-33.805c30.781,0,59.703,12.005,81.438,33.805L176.982,129.274z M116.788,54.288
c21.735-21.799,50.657-33.805,81.438-33.805c30.781,0,59.703,12.005,81.438,33.805L176.982,129.274z"/>
<path d="M116.788,54.288
c36.109,0,70.045,14.076,95.554,39.636l21.234-21.192c-31.178-31.239-72.654-48.444-116.788-48.444
C72.653,24.288,31.178,41.493,0,72.732l21.234,21.192C46.743,68.364,80.678,54.288,116.788,54.288z M162.885,143.465
C72.653,24.288,31.178,41.493,0,72.732l21.234,21.192C46.743,68.364,80.678,54.288,116.788,54.288z"/>
<path style="fill:#ff2020;" d="M162.885,143.465
c-12.293-12.367-28.664-19.177-46.097-19.177c-17.432,0-33.803,6.811-46.097,19.177l21.275,21.151
c6.621-6.66,15.437-10.328,24.821-10.328c9.386,0,18.2,3.667,24.819,10.327L162.885,143.465z M116.788,169.288
c6.621-6.66,15.437-10.328,24.821-10.328c9.386,0,18.2,3.667,24.819,10.327L162.885,143.465z"/>
<path style="fill:#ff2020;" d="M116.788,169.288
c-11.046,0-20,8.954-20,20s8.954,20,20,20c11.044,0,20-8.954,20-20S127.832,169.288,116.788,169.288z"/>
<g>
</g>

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -34,6 +34,7 @@
* : along with this program.If not, see <http://www.gnu.org/licenses/>.
************************************************************************/
#include <QApplication>
#include <QStatusBar>
#include <QDockWidget>
#include <QFileDialog>
@ -61,12 +62,12 @@ const int LOADER_TIMER_INTERVAL = 40;
EasyMainWindow::EasyMainWindow() : Parent(), m_treeWidget(nullptr), m_graphicsView(nullptr), m_progress(nullptr)
{
{ QIcon icon(":/logo"); if (!icon.isNull()) QApplication::setWindowIcon(icon); }
setObjectName("ProfilerGUI_MainWindow");
setWindowTitle("EasyProfiler Reader beta");
setDockNestingEnabled(true);
resize(800, 600);
{ QIcon icon(":/logo"); if (!icon.isNull()) setWindowIcon(icon); }
setStatusBar(new QStatusBar());
@ -93,16 +94,16 @@ EasyMainWindow::EasyMainWindow() : Parent(), m_treeWidget(nullptr), m_graphicsVi
auto action = menu->addAction("&Open");
connect(action, &QAction::triggered, this, &This::onOpenFileClicked);
{ QIcon icon(":/Open"); if (!icon.isNull()) action->setIcon(icon); }
SET_ICON(action, ":/Open");
action = menu->addAction("&Reload");
connect(action, &QAction::triggered, this, &This::onReloadFileClicked);
{ QIcon icon(":/Reload"); if (!icon.isNull()) action->setIcon(icon); }
SET_ICON(action, ":/Reload");
menu->addSeparator();
action = menu->addAction("&Exit");
connect(action, &QAction::triggered, this, &This::onExitClicked);
{ QIcon icon(":/Exit"); if (!icon.isNull()) action->setIcon(icon); }
SET_ICON(action, ":/Exit");
menuBar()->addMenu(menu);
@ -112,11 +113,11 @@ EasyMainWindow::EasyMainWindow() : Parent(), m_treeWidget(nullptr), m_graphicsVi
action = menu->addAction("Expand all");
connect(action, &QAction::triggered, this, &This::onExpandAllClicked);
{ QIcon icon(":/Expand"); if (!icon.isNull()) action->setIcon(icon); }
SET_ICON(action, ":/Expand");
action = menu->addAction("Collapse all");
connect(action, &QAction::triggered, this, &This::onCollapseAllClicked);
{ QIcon icon(":/Collapse"); if (!icon.isNull()) action->setIcon(icon); }
SET_ICON(action, ":/Collapse");
menu->addSeparator();
action = menu->addAction("Draw items' borders");
@ -182,16 +183,12 @@ EasyMainWindow::EasyMainWindow() : Parent(), m_treeWidget(nullptr), m_graphicsVi
auto f = action->font();
f.setBold(true);
action->setFont(f);
QIcon icon(":/Stats");
if (!icon.isNull())
action->setIcon(icon);
SET_ICON(action, ":/Stats");
}
else
{
action->setText("Statistics disabled");
QIcon icon(":/Stats-off");
if (!icon.isNull())
action->setIcon(icon);
SET_ICON(action, ":/Stats-off");
}
menu->addAction(action);
@ -247,7 +244,8 @@ EasyMainWindow::~EasyMainWindow()
void EasyMainWindow::onOpenFileClicked(bool)
{
auto filename = QFileDialog::getOpenFileName(this, "Open profiler log", m_lastFile, "Profiler Log File (*.prof);;All Files (*.*)");
loadFile(filename);
if (!filename.isEmpty())
loadFile(filename);
}
//////////////////////////////////////////////////////////////////////////
@ -311,16 +309,12 @@ void EasyMainWindow::onEnableDisableStatistics(bool _checked)
if (_checked)
{
action->setText("Statistics enabled");
QIcon icon(":/Stats");
if (!icon.isNull())
action->setIcon(icon);
SET_ICON(action, ":/Stats");
}
else
{
action->setText("Statistics disabled");
QIcon icon(":/Stats-off");
if (!icon.isNull())
action->setIcon(icon);
SET_ICON(action, ":/Stats-off");
}
}
}