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 00000000..e6209f35 Binary files /dev/null and b/bin/app/data/gui/graph_view/images/graph.png differ 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 00000000..2b6a4c05 Binary files /dev/null and b/bin/app/data/gui/graph_view/images/graph_arrow.png differ diff --git a/bin/app/data/gui/graph_view/images/graph_down.png b/bin/app/data/gui/graph_view/images/graph_down.png new file mode 100644 index 00000000..37487f1c Binary files /dev/null and b/bin/app/data/gui/graph_view/images/graph_down.png differ 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 00000000..d645e99c Binary files /dev/null and b/bin/app/data/gui/graph_view/images/graph_left.png differ 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 00000000..6e0a6e65 Binary files /dev/null and b/bin/app/data/gui/graph_view/images/graph_right.png differ diff --git a/bin/app/data/gui/graph_view/images/graph_up.png b/bin/app/data/gui/graph_view/images/graph_up.png new file mode 100644 index 00000000..101339e6 Binary files /dev/null and b/bin/app/data/gui/graph_view/images/graph_up.png differ diff --git a/bin/app/user/ApplicationSettings_template.xml b/bin/app/user/ApplicationSettings_template.xml index f2ea4d00..a64eaa05 100644 --- a/bin/app/user/ApplicationSettings_template.xml +++ b/bin/app/user/ApplicationSettings_template.xml @@ -26,6 +26,8 @@ + + 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;