From b98444c15e621445a91f94a71fd91835106e6697 Mon Sep 17 00:00:00 2001 From: Eberhard Graether Date: Wed, 26 Apr 2017 15:38:55 +0200 Subject: [PATCH] ui: styled trail navigation * added icons to buttons * added toggle for collapsing and expanding controls * added controls visibility to app settings * fixed low contrast for disabled buttons in bright color scheme --- bin/app/data/color_schemes/bad_rainbow.xml | 9 - bin/app/data/color_schemes/bright.xml | 13 +- bin/app/data/color_schemes/dark.xml | 9 - bin/app/data/gui/code_view/code_view.css | 10 +- bin/app/data/gui/graph_view/graph_view.css | 63 ++++++- bin/app/data/gui/graph_view/images/graph.png | Bin 0 -> 1025 bytes .../gui/graph_view/images/graph_arrow.png | Bin 0 -> 1009 bytes .../data/gui/graph_view/images/graph_down.png | Bin 0 -> 1741 bytes .../data/gui/graph_view/images/graph_left.png | Bin 0 -> 957 bytes .../gui/graph_view/images/graph_right.png | Bin 0 -> 926 bytes .../data/gui/graph_view/images/graph_up.png | Bin 0 -> 1704 bytes bin/app/user/ApplicationSettings_template.xml | 2 + src/lib/settings/ApplicationSettings.cpp | 10 ++ src/lib/settings/ApplicationSettings.h | 3 + src/lib_gui/qt/element/QtCodeNavigator.cpp | 8 +- src/lib_gui/qt/view/QtGraphView.cpp | 160 +++++++++++++----- src/lib_gui/qt/view/QtGraphView.h | 7 + 17 files changed, 214 insertions(+), 80 deletions(-) create mode 100644 bin/app/data/gui/graph_view/images/graph.png create mode 100644 bin/app/data/gui/graph_view/images/graph_arrow.png create mode 100644 bin/app/data/gui/graph_view/images/graph_down.png create mode 100644 bin/app/data/gui/graph_view/images/graph_left.png create mode 100644 bin/app/data/gui/graph_view/images/graph_right.png create mode 100644 bin/app/data/gui/graph_view/images/graph_up.png diff --git a/bin/app/data/color_schemes/bad_rainbow.xml b/bin/app/data/color_schemes/bad_rainbow.xml index 8a69296c..f2703002 100644 --- a/bin/app/data/color_schemes/bad_rainbow.xml +++ b/bin/app/data/color_schemes/bad_rainbow.xml @@ -77,15 +77,6 @@ #A0A0A0 #CCCCCC - - diff --git a/bin/app/data/color_schemes/bright.xml b/bin/app/data/color_schemes/bright.xml index 353274f2..a9911eb2 100644 --- a/bin/app/data/color_schemes/bright.xml +++ b/bin/app/data/color_schemes/bright.xml @@ -10,7 +10,7 @@ #626262 #F2F2F2 white - #FDFDFD + #DEDEDE @@ -75,17 +75,8 @@ white - #BCBCBC + #B2B2B2 #B2B2B2 - - diff --git a/bin/app/data/color_schemes/dark.xml b/bin/app/data/color_schemes/dark.xml index 626e9d0d..eeff6772 100644 --- a/bin/app/data/color_schemes/dark.xml +++ b/bin/app/data/color_schemes/dark.xml @@ -77,15 +77,6 @@ #A0A0A0 #CCC - - diff --git a/bin/app/data/gui/code_view/code_view.css b/bin/app/data/gui/code_view/code_view.css index 8817e045..ceea5e3e 100644 --- a/bin/app/data/gui/code_view/code_view.css +++ b/bin/app/data/gui/code_view/code_view.css @@ -22,23 +22,23 @@ } #code_navigation QPushButton { - background: ; + background: ; border: none; - color: ; + color: ; height: 24px; width: 24px; } #code_navigation QPushButton:hover, #code_navigation QPushButton:checked { - background: ; + background: ; } #code_navigation QPushButton:disabled { - background: ; + background: ; } #code_navigation QPushButton:pressed { - background: ; + background: ; } #code_navigation #reference_button_previous { diff --git a/bin/app/data/gui/graph_view/graph_view.css b/bin/app/data/gui/graph_view/graph_view.css index d15bdb58..ec848d86 100644 --- a/bin/app/data/gui/graph_view/graph_view.css +++ b/bin/app/data/gui/graph_view/graph_view.css @@ -6,7 +6,7 @@ QGraphicsView, QGraphicsScene { QPushButton { background: ; border: none; - color: white; + color: ; border-radius: 5px; } @@ -21,3 +21,64 @@ QPushButton:hover { QPushButton:pressed { background: ; } + +#expand_button { + max-width: 26px; + max-height: 26px; +} + +#collapse_button { + border-radius: 0; + border-top-left-radius: 7px; + border-top-right-radius: 7px; +} + +#trail_button { + border-radius: 0; +} + +#depth_label { + background: ; + color: ; +} + +#depth_label:disabled { + background: ; + color: ; +} + +#depth_slider { + background: ; + padding-bottom: 5px; + border-bottom-left-radius: 7px; + border-bottom-right-radius: 7px; +} + +#depth_slider:disabled { + background: ; +} + +#depth_slider::groove { + margin: 5px; + width: 2px; +} + +#depth_slider::handle { + height: 10px; + margin: 0px -4px; + border-radius: 5px; +} + +#depth_slider::handle:hover { + height: 12px; + margin: 0px -5px; + border-radius: 6px; +} + +#depth_slider::groove, #depth_slider::handle { + background: ; +} + +#depth_slider::groove:disabled, #depth_slider::handle:disabled { + background: ; +} diff --git a/bin/app/data/gui/graph_view/images/graph.png b/bin/app/data/gui/graph_view/images/graph.png new file mode 100644 index 0000000000000000000000000000000000000000..e6209f3587e5a5cbdcde8fb86fc049564f911eda GIT binary patch literal 1025 zcmV+c1pfPpP)D2NydhPdtiNvR+scyEB@bF(BEWclFrc)&Y=N z*=*$Z7H!E4+qkguaMl5<+H!5nhh?eTQa%#Ar6X`6ka_CxN)OlR^EtBxHZFJ~kOEJoQ^xe|k+Ve7Ay&Y#fCec5{}oLz{EqCJM8ggLb;` zKOlW>G5`xl{T^n&Qyg{YBUTY)768czAOR$R5_^e#MKU$OZW?op8Da<_95uvH`oJC{ z0knj;C4hET#s)FOX-rfQhX8LAEcVZ_L!2uv#$~$cMR4rBEvuLze&GNX+~=?GnT9%B zwzEdOxv%>P#Hw9?Y-QPgW)Mvm&`hRaddL;bCCTo@H%Pq=_uVbv8j6W07VLMn>f&A& ziM%GVSA?z3T~UegomcGy5V4!J8|jG|tH*V=`^4J6s2ca72lGWXX}0mi?)+<*Sdv|M zhB!vjG=*5-;pSh5=Z`%bld}^o9EZUhjMrIo!?|k9PsNn!rrC#rWq0zoAK6=aWW!+O z2Eb*WxZ%EwonvK@s3;}%<}wd7xhuTg987;yp4bmW{f!0GFG1FLQC!dW`K|D}8%O2vH0GeAjx<7{kF;-nT z7>F?o>pjF90koT+WdzX7DhS}!iC6)aio^i{RKN>HE146##{sAdFDHQiYyto0|AuQ` zQCjKAaWWxVlSvG{JWwK^yLd1F(}}87;Pn@YrMZ@to>$9m&TK>luk5eQ`@$#q)Iu(r z@UZ6w&w^D*7vgKlIa~}pPxji|v#J9=f_p`4V;MFwX|elF1NTwoa?`N6hpZ{nc2&Bp z?{inao^~%`eeVI@5TXx#xEa&_9`5tL@P}X>>jEA>Z>$}GtFWkVZWZ)Y%o z@MSy33(ZdTdneYbo&$B!%z#SX$fdHDpTR~(tCwTD#Jj4nw1c2w5;e`P3 z9VULVAjN460VIHA&H(0wXgt7^;Pb*^Ti;TLN!#C9+7f63Ms1@lKph)xLhHavply(y v^oO(&x23t<3ci6vw}PjCMnE>L{SjaQeHV6Po0|A900000NkvXXu0mjfRFK)L literal 0 HcmV?d00001 diff --git a/bin/app/data/gui/graph_view/images/graph_arrow.png b/bin/app/data/gui/graph_view/images/graph_arrow.png new file mode 100644 index 0000000000000000000000000000000000000000..2b6a4c0566e3c024335d238435517f7a2f8913b6 GIT binary patch literal 1009 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 KKbLh*2~7YiGUnL; literal 0 HcmV?d00001 diff --git a/bin/app/data/gui/graph_view/images/graph_left.png b/bin/app/data/gui/graph_view/images/graph_left.png new file mode 100644 index 0000000000000000000000000000000000000000..d645e99ca1610aa4343d6b27e4cb10543a30989f GIT binary patch literal 957 zcmV;u148_XP)9DHW;Or;ubHSwxM<3V&)-hLtTwmIS1^}qDgm~>t=TY<@DYE zl@oJ=0hk(!dp!LKany|jRuLo(fFuG)014oNp0KY-Tm$TM6qp(Z^{FDu`o%cL$683OmGT`3kQUS}$^MImtpWZ9XpR${vFv&5QL7Ge(Dc-m4i`M~0$PK&Hrfr&!gDOM_Dtad|y zpTqO)6h<~t-3?5C)&`bgAQ~!qOFeh#1C`cVCf#5FNyp0O~_@0uY<2bcFd6 z4z!&m39%x8>gq@LpT0oE>I-`V5wo#AK)e$`b;&FZNeq%Ci<@R#{uPa*1lqZ((aLdAn=AtnKf<`t!7{jPk*{NY-p z{Og8sB(nf-I&Ulufy;TlW;cm@HD}wXx9~0sqiCOJf5PiD^Ip@XuOoQx3y{8R?ENL6 z{&U?1Bu;3Z!QRjFPb*V_LZYR5tGQ7(H<*9P$v+5qz!^MD9`VgV&d)^!4>%9uY6BDv zJRjG>FNy;e0c7BwF?HL>Gk8ZprikF-2l$E=o(}*k%TT>>lg0CUatKjLM f5s=*KuK)u8V)$YAS8`K-00000NkvXXu0mjfxDmVM literal 0 HcmV?d00001 diff --git a/bin/app/data/gui/graph_view/images/graph_right.png b/bin/app/data/gui/graph_view/images/graph_right.png new file mode 100644 index 0000000000000000000000000000000000000000..6e0a6e65f29117809b7d6c46c45038669d6e1b88 GIT binary patch literal 926 zcmV;P17ZA$P)O+<^l#c!n@YLT^^=&g>sEmdvM>wAz(q01_=Z z9pD|~Nmb-F==G?^aT&B5^scF68Tp{mQNSgGwg$j0wI4J+0=(V=yt!tf!iyZhdst!; z;v`aXtm8UO2(k^5FrGDozJz9dHpVU9c$$O+FthlQtf66?nc*oAfZta>s|@*YW7q$) z^7(T}0M{(-!(jOh>%kL*E1xbZ2^k;|KmtervG{;70aS-q6F@z933Xwl@UQ~h4Lpnh zcLfg{z}>;a2C(43yKP(_9~K}lSo#L*(UKnq>t~krMWT>c!QWDe1k1v!20gDlOQ-Ku zn)Q#Cd|CPY@0Kr*Kj0noa|k7&2%gRCR=WXWDQERM(@&Eqa{@dq9My|s|87i9Hv(6sn%os#NhD|EMz(_5 zu?0R{4AYk9O?nRi`%vJ42YC08-~qu410Y&>K=5z_L<{e<0O&);aMxF?0QV43jXXH; zL5_hL0X#UwJ3$O*C2}T!mIIf26d%!;f)hbT0delee0r$=V~Po08SYJu$r4i!-E_9%ZYbvBKmD6^W7il^5_n@8*eOR-Xq|!q&2VFN7G@>d*?`h5X zc-VVvMOBF26YI;?%)!jD`Bq_tkxC8$xsUMM*7L$KsPBZ=*`bwjVucm_pYH4#mho%Q z-=KD0c&z^?qug(vTt6j!xo;JCVY@wp-h z;l%ol03sFwNB{|-Er|)B-n#eMVEIYtJt+hC*WVQ(0rYkOBV7T?ZLsS+C#C9D0BS3v*iS0onb8|oS8W7AZUnTBv4iY|~0L>t&w5X)?UL1X1yl$uzQ zUlfv`pJV3;3OfbQ+{EAFUm{>`W56OJ3||N3^AyB8-0*> zk-QHHTd*iFaP7E&Ho+pwj!RSTtStirOSh+sV@L(#+u7ZvmkmVP8V@tb9h6Q`TVa;r z_JJd@DXn>naEspsBgaE5yuubf7jgpr?PveGW0i{cMdfXatIr+1IQ8A@$!|o&?P|4z zTpoOGC~yAB`Xwu2ZtgE}HTi|?w->P#nmm)jP}ee0joLA9P?S#eblMK zD~UUK*{vUS@`pky)-gq#xfbHmFxT*R@3LQi-Z9j?72R_r{q9MNLv`$T9c!OT@%60k zYG~Zmd`zHGA!P2ILnri&;xiuvrISTtXL%Y8TTzNJ49uJ?yQT|AFt7=6l<2E(VBk>^coFCKpoPI~R#fu8Qg30qy(i0< zR(HIV^cK&TH*A;kn(iO_*h;P^RC&_7-nN3X1{?BPD^2UnA3Qcb8WzBn$atlC;TS%`?`&j-~GMMt)Cckn)B%| z;m7wcFkcCs@kdIFhwpyked%X4XU}|1DY$j;T=*}$omp%4H*E`;`={Y!nE64a5^KrZ zX}2_Deb<>C>xo^iH!pK>-0LTPcItX9tRd@fKKgfXM$g)8t7*MCCr)T-DlThMm-gbk z$QieP0xz3kd7f%>`VJ#;>Aq0=$bw=!kN@6J4y*8#L^Y&lM3fJa{JPj%eiY@7z-<^e7v?&6d?5^_^;0#~j^Zq*O`e6D#O-+~ + + diff --git a/src/lib/settings/ApplicationSettings.cpp b/src/lib/settings/ApplicationSettings.cpp index a573cee9..683a8473 100644 --- a/src/lib/settings/ApplicationSettings.cpp +++ b/src/lib/settings/ApplicationSettings.cpp @@ -176,6 +176,16 @@ void ApplicationSettings::setScrollSpeed(float scrollSpeed) setValue("application/scroll_speed", scrollSpeed); } +bool ApplicationSettings::getGraphControlsVisible() const +{ + return getValue("application/graph_controls_visible", true); +} + +void ApplicationSettings::setGraphControlsVisible(bool visible) +{ + setValue("application/graph_controls_visible", visible); +} + bool ApplicationSettings::getLoggingEnabled() const { return getValue("application/logging_enabled", false); diff --git a/src/lib/settings/ApplicationSettings.h b/src/lib/settings/ApplicationSettings.h index 46e056f1..0a014102 100644 --- a/src/lib/settings/ApplicationSettings.h +++ b/src/lib/settings/ApplicationSettings.h @@ -50,6 +50,9 @@ public: float getScrollSpeed() const; void setScrollSpeed(float scrollSpeed); + bool getGraphControlsVisible() const; + void setGraphControlsVisible(bool visible); + // logging bool getLoggingEnabled() const; void setLoggingEnabled(bool loggingEnabled); diff --git a/src/lib_gui/qt/element/QtCodeNavigator.cpp b/src/lib_gui/qt/element/QtCodeNavigator.cpp index f11f9848..a6828247 100644 --- a/src/lib_gui/qt/element/QtCodeNavigator.cpp +++ b/src/lib_gui/qt/element/QtCodeNavigator.cpp @@ -526,22 +526,22 @@ void QtCodeNavigator::refreshStyle() m_prevButton->setIcon(utility::createButtonIcon( ResourcePaths::getGuiPath() + "code_view/images/arrow_left.png", - "code/navigation/button" + "search/button" )); m_nextButton->setIcon(utility::createButtonIcon( ResourcePaths::getGuiPath() + "code_view/images/arrow_right.png", - "code/navigation/button" + "search/button" )); m_listButton->setIcon(utility::createButtonIcon( ResourcePaths::getGuiPath() + "code_view/images/list.png", - "code/navigation/button" + "search/button" )); m_fileButton->setIcon(utility::createButtonIcon( ResourcePaths::getGuiPath() + "code_view/images/file.png", - "code/navigation/button" + "search/button" )); m_prevButton->setIconSize(QSize(12, 12)); diff --git a/src/lib_gui/qt/view/QtGraphView.cpp b/src/lib_gui/qt/view/QtGraphView.cpp index c590bfae..87d72c3b 100644 --- a/src/lib_gui/qt/view/QtGraphView.cpp +++ b/src/lib_gui/qt/view/QtGraphView.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include "component/controller/helper/DummyEdge.h" @@ -89,36 +90,70 @@ void QtGraphView::initView() // trail controls { - m_forwardTrailButton = new QPushButton("<"); - m_backwardTrailButton = new QPushButton(">"); + QStackedLayout* stack = new QStackedLayout(); - connect(m_forwardTrailButton, SIGNAL(clicked()), this, SLOT(clickedForwardTrail())); - connect(m_backwardTrailButton, SIGNAL(clicked()), this, SLOT(clickedBackwardTrail())); + { + m_expandButton = new QPushButton(); + m_expandButton->setObjectName("expand_button"); + m_expandButton->setToolTip("show depth graph controls"); + m_expandButton->setGeometry(0, 0, 26, 26); + connect(m_expandButton, SIGNAL(clicked()), this, SLOT(clickedExpand())); + stack->addWidget(m_expandButton); + } - m_trailDepthSlider = new QSlider(Qt::Horizontal); - m_trailDepthSlider->setMinimum(1); - m_trailDepthSlider->setMaximum(51); - m_trailDepthSlider->setValue(10); - m_trailDepthSlider->setFixedWidth(150); - connect(m_trailDepthSlider, SIGNAL(valueChanged(int)), this, SLOT(trailDepthChanged(int))); + { + QWidget* ui = new QWidget(); + ui->setGeometry(0, 0, 26, 210); + stack->addWidget(ui); - m_trailDepthLabel = new QLabel("10"); - m_trailDepthLabel->setFixedWidth(30); + m_collapseButton = new QPushButton(ui); + m_collapseButton->setObjectName("collapse_button"); + m_collapseButton->setToolTip("hide depth graph controls"); + connect(m_collapseButton, SIGNAL(clicked()), this, SLOT(clickedCollapse())); - QHBoxLayout* trailLayout = new QHBoxLayout(); - trailLayout->addWidget(m_backwardTrailButton); - trailLayout->addWidget(m_forwardTrailButton); - trailLayout->addStretch(); - trailLayout->addWidget(new QLabel("depth:")); - trailLayout->addWidget(m_trailDepthSlider); - trailLayout->addWidget(m_trailDepthLabel); + m_forwardTrailButton = new QPushButton(ui); + m_forwardTrailButton->setObjectName("trail_button"); + connect(m_forwardTrailButton, SIGNAL(clicked()), this, SLOT(clickedForwardTrail())); - QWidget* trailWidget = new QWidget(widget); - trailWidget->setMinimumWidth(380); - trailWidget->setMinimumHeight(50); - trailWidget->setLayout(trailLayout); + m_backwardTrailButton = new QPushButton(ui); + m_backwardTrailButton->setObjectName("trail_button"); + connect(m_backwardTrailButton, SIGNAL(clicked()), this, SLOT(clickedBackwardTrail())); + + m_trailDepthLabel = new QLabel(ui); + m_trailDepthLabel->setObjectName("depth_label"); + m_trailDepthLabel->setToolTip("adjust graph depth"); + m_trailDepthLabel->setAlignment(Qt::AlignCenter); + + m_trailDepthSlider = new QSlider(Qt::Vertical, ui); + m_trailDepthSlider->setObjectName("depth_slider"); + m_trailDepthSlider->setToolTip("adjust graph depth"); + m_trailDepthSlider->setMinimum(1); + m_trailDepthSlider->setMaximum(26); + m_trailDepthSlider->setValue(5); + connect(m_trailDepthSlider, SIGNAL(valueChanged(int)), this, SLOT(trailDepthChanged(int))); + + m_collapseButton->setGeometry(0, 0, 26, 20); + m_backwardTrailButton->setGeometry(0, 22, 26, 26); + m_forwardTrailButton->setGeometry(0, 50, 26, 26); + m_trailDepthLabel->setGeometry(0, 78, 26, 26); + m_trailDepthSlider->setGeometry(0, 104, 26, 100); + } + + m_trailWidget = new QWidget(widget); + m_trailWidget->setGeometry(8, 8, 26, 210); + m_trailWidget->setLayout(stack); + + if (ApplicationSettings::getInstance()->getGraphControlsVisible()) + { + clickedExpand(); + } + else + { + clickedCollapse(); + } updateTrailButtons(); + trailDepthChanged(0); } doRefreshView(); @@ -275,6 +310,22 @@ void QtGraphView::trailDepthChanged(int) } } +void QtGraphView::clickedCollapse() +{ + dynamic_cast(m_trailWidget->layout())->setCurrentIndex(0); + + ApplicationSettings::getInstance()->setGraphControlsVisible(false); + ApplicationSettings::getInstance()->save(); +} + +void QtGraphView::clickedExpand() +{ + dynamic_cast(m_trailWidget->layout())->setCurrentIndex(1); + + ApplicationSettings::getInstance()->setGraphControlsVisible(true); + ApplicationSettings::getInstance()->save(); +} + void QtGraphView::clickedBackwardTrail() { activateTrail(false); @@ -350,40 +401,54 @@ void QtGraphView::updateTrailButtons() m_backwardTrailButton->setEnabled(message.trailType); m_forwardTrailButton->setEnabled(message.trailType); + m_trailDepthLabel->setEnabled(message.trailType); m_trailDepthSlider->setEnabled(message.trailType); + std::string backwardImagePath; + std::string forwardImagePath; + if (message.trailType & Edge::EDGE_CALL) { - m_backwardTrailButton->setToolTip("caller graph"); - m_forwardTrailButton->setToolTip("callee graph"); + m_backwardTrailButton->setToolTip("show caller graph"); + m_forwardTrailButton->setToolTip("show callee graph"); - m_backwardTrailButton->setText(">"); - m_forwardTrailButton->setText("<"); + backwardImagePath = "graph_left.png"; + forwardImagePath = "graph_right.png"; } else if (message.trailType & Edge::EDGE_INHERITANCE) { - m_backwardTrailButton->setToolTip("base hierarchy"); - m_forwardTrailButton->setToolTip("derived hierarchy"); + m_backwardTrailButton->setToolTip("show base hierarchy"); + m_forwardTrailButton->setToolTip("show derived hierarchy"); - m_backwardTrailButton->setText("b"); - m_forwardTrailButton->setText("d"); + backwardImagePath = "graph_up.png"; + forwardImagePath = "graph_down.png"; } else if (message.trailType & Edge::EDGE_INCLUDE) { - m_backwardTrailButton->setToolTip("including files hierarchy"); - m_forwardTrailButton->setToolTip("included files hierarchy"); + m_backwardTrailButton->setToolTip("show including files hierarchy"); + m_forwardTrailButton->setToolTip("show included files hierarchy"); - m_backwardTrailButton->setText(">"); - m_forwardTrailButton->setText("<"); + backwardImagePath = "graph_left.png"; + forwardImagePath = "graph_right.png"; } else { - m_backwardTrailButton->setToolTip("no hierarchy available for active symbol"); - m_forwardTrailButton->setToolTip("no hierarchy available for active symbol"); + m_backwardTrailButton->setToolTip("no depth graph available for active symbol"); + m_forwardTrailButton->setToolTip("no depth graph available for active symbol"); - m_backwardTrailButton->setText(">"); - m_forwardTrailButton->setText("<"); + backwardImagePath = "graph_left.png"; + forwardImagePath = "graph_right.png"; } + + m_backwardTrailButton->setIcon(utility::createButtonIcon( + ResourcePaths::getGuiPath() + "graph_view/images/" + backwardImagePath, + "search/button" + )); + + m_forwardTrailButton->setIcon(utility::createButtonIcon( + ResourcePaths::getGuiPath() + "graph_view/images/" + forwardImagePath, + "search/button" + )); } void QtGraphView::switchToNewGraphData() @@ -583,8 +648,21 @@ void QtGraphView::doRefreshView() std::string css = utility::getStyleSheet(ResourcePaths::getGuiPath() + "graph_view/graph_view.css"); view->setStyleSheet(css.c_str()); - view->setAppZoomFactor(GraphViewStyle::getZoomFactor()); + + m_trailWidget->setStyleSheet(css.c_str()); + + m_expandButton->setIcon(utility::createButtonIcon( + ResourcePaths::getGuiPath() + "graph_view/images/graph.png", + "search/button" + )); + + m_collapseButton->setIcon(utility::createButtonIcon( + ResourcePaths::getGuiPath() + "graph_view/images/graph_arrow.png", + "search/button" + )); + + updateTrailButtons(); } std::shared_ptr QtGraphView::findNodeRecursive(const std::list>& nodes, Id tokenId) @@ -772,7 +850,7 @@ QRectF QtGraphView::getSceneRect(const std::list>& sceneRect |= rect; } - return sceneRect.adjusted(-25, -75, 25, 25).translated(m_sceneRectOffset); + return sceneRect.adjusted(-25, -25, 25, 25).translated(m_sceneRectOffset); } void QtGraphView::compareNodesRecursive( diff --git a/src/lib_gui/qt/view/QtGraphView.h b/src/lib_gui/qt/view/QtGraphView.h index 88db218a..a355c8b0 100644 --- a/src/lib_gui/qt/view/QtGraphView.h +++ b/src/lib_gui/qt/view/QtGraphView.h @@ -63,6 +63,10 @@ private slots: void scrolled(int); void trailDepthChanged(int); + + void clickedCollapse(); + void clickedExpand(); + void clickedBackwardTrail(); void clickedForwardTrail(); @@ -144,6 +148,9 @@ private: QtScrollSpeedChangeListener m_scrollSpeedChangeListenerHorizontal; QtScrollSpeedChangeListener m_scrollSpeedChangeListenerVertical; + QWidget* m_trailWidget; + QPushButton* m_expandButton; + QPushButton* m_collapseButton; QPushButton* m_forwardTrailButton; QPushButton* m_backwardTrailButton; QSlider* m_trailDepthSlider;