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
This commit is contained in:
Eberhard Graether
2017-04-26 15:38:55 +02:00
parent bf094b52da
commit b98444c15e
17 changed files with 214 additions and 80 deletions
@@ -77,15 +77,6 @@
<navigation>
<text>#A0A0A0</text>
<line>#CCCCCC</line>
<button>
<normal>#808080</normal>
<hover>#B1B1B1</hover>
<press>#CCCCCC</press>
<disabled>#606060</disabled>
<icon>white</icon>
<icon_disabled>#808080</icon_disabled>
</button>
</navigation>
<file>
+2 -11
View File
@@ -10,7 +10,7 @@
<press>#626262</press>
<disabled>#F2F2F2</disabled>
<icon>white</icon>
<icon_disabled>#FDFDFD</icon_disabled>
<icon_disabled>#DEDEDE</icon_disabled>
</button>
<field>
@@ -75,17 +75,8 @@
<background>white</background>
<navigation>
<text>#BCBCBC</text>
<text>#B2B2B2</text>
<line>#B2B2B2</line>
<button>
<normal>#E0E0E0</normal>
<hover>#B2B2B2</hover>
<press>#626262</press>
<disabled>#F2F2F2</disabled>
<icon>white</icon>
<icon_disabled>#FDFDFD</icon_disabled>
</button>
</navigation>
<file>
-9
View File
@@ -77,15 +77,6 @@
<navigation>
<text>#A0A0A0</text>
<line>#CCC</line>
<button>
<normal>#777777</normal>
<hover>#555555</hover>
<press>#444444</press>
<disabled>#333333</disabled>
<icon>white</icon>
<icon_disabled>#777777</icon_disabled>
</button>
</navigation>
<file>
+5 -5
View File
@@ -22,23 +22,23 @@
}
#code_navigation QPushButton {
background: <color:code/navigation/button/normal>;
background: <color:search/button/normal>;
border: none;
color: <color:code/navigation/button/icon>;
color: <color:search/button/icon>;
height: 24px;
width: 24px;
}
#code_navigation QPushButton:hover, #code_navigation QPushButton:checked {
background: <color:code/navigation/button/hover>;
background: <color:search/button/hover>;
}
#code_navigation QPushButton:disabled {
background: <color:code/navigation/button/disabled>;
background: <color:search/button/disabled>;
}
#code_navigation QPushButton:pressed {
background: <color:code/navigation/button/press>;
background: <color:search/button/press>;
}
#code_navigation #reference_button_previous {
+62 -1
View File
@@ -6,7 +6,7 @@ QGraphicsView, QGraphicsScene {
QPushButton {
background: <color:search/button/normal>;
border: none;
color: white;
color: <color:search/button/icon>;
border-radius: 5px;
}
@@ -21,3 +21,64 @@ QPushButton:hover {
QPushButton:pressed {
background: <color:search/button/press>;
}
#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:search/button/normal>;
color: <color:search/button/icon>;
}
#depth_label:disabled {
background: <color:search/button/disabled>;
color: <color:search/button/icon_disabled>;
}
#depth_slider {
background: <color:search/button/normal>;
padding-bottom: 5px;
border-bottom-left-radius: 7px;
border-bottom-right-radius: 7px;
}
#depth_slider:disabled {
background: <color:search/button/disabled>;
}
#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: <color:search/button/icon>;
}
#depth_slider::groove:disabled, #depth_slider::handle:disabled {
background: <color:search/button/icon_disabled>;
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1009 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 957 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 926 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

@@ -26,6 +26,8 @@
<scroll_speed><!-- DECIMAL: multiplier for default scroll speed in views --></scroll_speed>
<logging_enabled><!-- BOOL: define if console and file logging is enabled --></logging_enabled>
<graph_controls_visible><!-- BOOL: define if the graph controls are visible or collapsed --></graph_controls_visible>
</application>
<indexing>
+10
View File
@@ -176,6 +176,16 @@ void ApplicationSettings::setScrollSpeed(float scrollSpeed)
setValue<float>("application/scroll_speed", scrollSpeed);
}
bool ApplicationSettings::getGraphControlsVisible() const
{
return getValue<bool>("application/graph_controls_visible", true);
}
void ApplicationSettings::setGraphControlsVisible(bool visible)
{
setValue<bool>("application/graph_controls_visible", visible);
}
bool ApplicationSettings::getLoggingEnabled() const
{
return getValue<bool>("application/logging_enabled", false);
+3
View File
@@ -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);
+4 -4
View File
@@ -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));
+119 -41
View File
@@ -10,6 +10,7 @@
#include <QPushButton>
#include <QScrollBar>
#include <QSequentialAnimationGroup>
#include <QStackedLayout>
#include <QSlider>
#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<QStackedLayout*>(m_trailWidget->layout())->setCurrentIndex(0);
ApplicationSettings::getInstance()->setGraphControlsVisible(false);
ApplicationSettings::getInstance()->save();
}
void QtGraphView::clickedExpand()
{
dynamic_cast<QStackedLayout*>(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<QtGraphNode> QtGraphView::findNodeRecursive(const std::list<std::shared_ptr<QtGraphNode>>& nodes, Id tokenId)
@@ -772,7 +850,7 @@ QRectF QtGraphView::getSceneRect(const std::list<std::shared_ptr<QtGraphNode>>&
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(
+7
View File
@@ -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;