From 3e62367af06113a1a46a179b46a9ecee342b9b8b Mon Sep 17 00:00:00 2001 From: Eberhard Graether Date: Thu, 8 Jun 2017 00:35:31 +0200 Subject: [PATCH] src: More fixes for release * Show declname in java import error * Don't clear window stack when saving preferences * Fixed spacing in source group UI, status view and error view * Resize graph scene rect when widget is resized * Graph node centering respect no animation preference * Fixed undoing of view commands * Avoid scrollbar jump when restoring graph scroll position * Deactivate local symbols in code when clicking into empty space --- bin/app/data/gui/tabbed_view/tabbed_view.css | 4 +- .../projects/tictactoe/tictactoe.srctrlprj | 1 + .../src/com/sourcetrail/AstVisitor.java | 2 +- .../controller/UndoRedoController.cpp | 34 ++++----------- src/lib_gui/qt/element/QtCodeArea.cpp | 17 +++++--- src/lib_gui/qt/graphics/QtGraphicsView.cpp | 41 +++++++++++-------- src/lib_gui/qt/graphics/QtGraphicsView.h | 1 + src/lib_gui/qt/view/QtErrorView.cpp | 5 ++- src/lib_gui/qt/view/QtGraphView.cpp | 8 +++- src/lib_gui/qt/view/QtGraphView.h | 2 + src/lib_gui/qt/view/QtStatusView.cpp | 10 ++--- src/lib_gui/qt/window/QtPreferencesWindow.cpp | 2 +- .../project_wizzard/QtProjectWizzard.cpp | 1 + 13 files changed, 65 insertions(+), 63 deletions(-) diff --git a/bin/app/data/gui/tabbed_view/tabbed_view.css b/bin/app/data/gui/tabbed_view/tabbed_view.css index 72dc7703..8865bb5d 100644 --- a/bin/app/data/gui/tabbed_view/tabbed_view.css +++ b/bin/app/data/gui/tabbed_view/tabbed_view.css @@ -36,7 +36,7 @@ QTableView { alternate-background-color: ; border-radius: 10px; border: 1px solid ; - margin: 10px; + margin: 10px 10px 2px; padding-right: 10px; font-size: px; } @@ -84,6 +84,7 @@ QHeaderView::section:vertical { QCheckBox { color: ; border-color: ; + margin: 0; /*background-color: ;*/ } @@ -120,4 +121,3 @@ QTableView QTableCornerButton::section { border-bottom: 1px solid ; border-top-left-radius: 10px; } - diff --git a/bin/app/user/projects/tictactoe/tictactoe.srctrlprj b/bin/app/user/projects/tictactoe/tictactoe.srctrlprj index e9a3b92a..8cb27799 100644 --- a/bin/app/user/projects/tictactoe/tictactoe.srctrlprj +++ b/bin/app/user/projects/tictactoe/tictactoe.srctrlprj @@ -2,6 +2,7 @@ + C++ Source Group .cpp .cxx diff --git a/java_indexer/src/com/sourcetrail/AstVisitor.java b/java_indexer/src/com/sourcetrail/AstVisitor.java index f339ae3e..38004cdd 100644 --- a/java_indexer/src/com/sourcetrail/AstVisitor.java +++ b/java_indexer/src/com/sourcetrail/AstVisitor.java @@ -458,7 +458,7 @@ public class AstVisitor extends AstVisitorAdapter } else { - m_client.recordError("Import not found.", true, true, n.getRange()); + m_client.recordError("Import not found: " + name, true, true, n.getRange()); } } catch (Exception e) diff --git a/src/lib/component/controller/UndoRedoController.cpp b/src/lib/component/controller/UndoRedoController.cpp index f2781321..d6b0e9cc 100644 --- a/src/lib/component/controller/UndoRedoController.cpp +++ b/src/lib/component/controller/UndoRedoController.cpp @@ -281,7 +281,7 @@ void UndoRedoController::handleMessage(MessageShowReference* message) return; } - Command command(std::make_shared(*message), Command::ORDER_VIEW); + Command command(std::make_shared(*message), Command::ORDER_VIEW, true); processCommand(command); } @@ -395,9 +395,6 @@ void UndoRedoController::replayCommands() void UndoRedoController::replayCommands(std::list::iterator it) { - std::vector::iterator> viewCommands; - bool keepsContent = true; - std::map::iterator> lastOfType; std::list::iterator at = it; while (at != m_iterator) @@ -410,6 +407,8 @@ void UndoRedoController::replayCommands(std::list::iterator it) std::advance(at, 1); } + bool keepsContent = true; + while (it != m_iterator) { if (!it->replayLastOnly || lastOfType[it->message->getType()] == it) @@ -421,32 +420,10 @@ void UndoRedoController::replayCommands(std::list::iterator it) keepsContent = false; } } - else if (it->order == Command::ORDER_VIEW) - { - viewCommands.push_back(it); - } std::advance(it, 1); } - std::set messageTypes; - std::vector::iterator> lastViewCommands; - - for (size_t i = viewCommands.size(); i > 0; i--) - { - it = viewCommands[i - 1]; - if (messageTypes.find(it->message->getType()) == messageTypes.end()) - { - messageTypes.insert(it->message->getType()); - lastViewCommands.push_back(it); - } - } - - for (size_t i = lastViewCommands.size(); i > 0; i--) - { - replayCommand(lastViewCommands[i - 1]); - } - MessageFlushUpdates(keepsContent).dispatch(); } @@ -529,6 +506,11 @@ void UndoRedoController::processCommand(Command command) bool UndoRedoController::sameMessageTypeAsLast(MessageBase* message) const { + if (message->isReplayed()) + { + return false; + } + if (!m_list.size() || m_list.begin() == m_iterator) { return false; diff --git a/src/lib_gui/qt/element/QtCodeArea.cpp b/src/lib_gui/qt/element/QtCodeArea.cpp index 7e32e47f..d0be046f 100644 --- a/src/lib_gui/qt/element/QtCodeArea.cpp +++ b/src/lib_gui/qt/element/QtCodeArea.cpp @@ -519,14 +519,21 @@ void QtCodeArea::mouseReleaseEvent(QMouseEvent* event) QTextCursor cursor = this->cursorForPosition(event->pos()); std::vector annotations = getInteractiveAnnotationsForPosition(cursor.position()); - if (m_navigator->hasErrors()) + if (annotations.size()) { - activateErrors(annotations); + if (m_navigator->hasErrors()) + { + activateErrors(annotations); + } + else + { + activateSourceLocations(annotations); + activateLocalSymbols(annotations); + } } - else + else if (m_navigator->getActiveLocalSymbolIds().size()) { - activateSourceLocations(annotations); - activateLocalSymbols(annotations); + MessageActivateLocalSymbols(std::vector()).dispatch(); } } } diff --git a/src/lib_gui/qt/graphics/QtGraphicsView.cpp b/src/lib_gui/qt/graphics/QtGraphicsView.cpp index 7fbc21f9..6ec88a62 100644 --- a/src/lib_gui/qt/graphics/QtGraphicsView.cpp +++ b/src/lib_gui/qt/graphics/QtGraphicsView.cpp @@ -105,29 +105,32 @@ void QtGraphicsView::ensureVisibleAnimated(const QRectF& rect, int xmargin, int ensureVisible(rect, xmargin, ymargin); - int xval2 = horizontalScrollBar()->value(); - int yval2 = verticalScrollBar()->value(); + if (ApplicationSettings::getInstance()->getUseAnimations()) + { + int xval2 = horizontalScrollBar()->value(); + int yval2 = verticalScrollBar()->value(); - horizontalScrollBar()->setValue(xval); - verticalScrollBar()->setValue(yval); + horizontalScrollBar()->setValue(xval); + verticalScrollBar()->setValue(yval); - QParallelAnimationGroup* move = new QParallelAnimationGroup(); + QParallelAnimationGroup* move = new QParallelAnimationGroup(); - QPropertyAnimation* xanim = new QPropertyAnimation(horizontalScrollBar(), "value"); - xanim->setDuration(150); - xanim->setStartValue(xval); - xanim->setEndValue(xval2); - xanim->setEasingCurve(QEasingCurve::InOutQuad); - move->addAnimation(xanim); + QPropertyAnimation* xanim = new QPropertyAnimation(horizontalScrollBar(), "value"); + xanim->setDuration(150); + xanim->setStartValue(xval); + xanim->setEndValue(xval2); + xanim->setEasingCurve(QEasingCurve::InOutQuad); + move->addAnimation(xanim); - QPropertyAnimation* yanim = new QPropertyAnimation(verticalScrollBar(), "value"); - yanim->setDuration(150); - yanim->setStartValue(yval); - yanim->setEndValue(yval2); - yanim->setEasingCurve(QEasingCurve::InOutQuad); - move->addAnimation(yanim); + QPropertyAnimation* yanim = new QPropertyAnimation(verticalScrollBar(), "value"); + yanim->setDuration(150); + yanim->setStartValue(yval); + yanim->setEndValue(yval2); + yanim->setEasingCurve(QEasingCurve::InOutQuad); + move->addAnimation(yanim); - move->start(); + move->start(); + } } void QtGraphicsView::updateZoom(float delta) @@ -165,6 +168,8 @@ void QtGraphicsView::resizeEvent(QResizeEvent* event) m_zoomInButton->setIconSize(QSize(15, 15)); m_zoomOutButton->setIconSize(QSize(15, 15)); + + emit resized(); } void QtGraphicsView::mousePressEvent(QMouseEvent *event) diff --git a/src/lib_gui/qt/graphics/QtGraphicsView.h b/src/lib_gui/qt/graphics/QtGraphicsView.h index 0ae3b2db..bb4fae2f 100644 --- a/src/lib_gui/qt/graphics/QtGraphicsView.h +++ b/src/lib_gui/qt/graphics/QtGraphicsView.h @@ -46,6 +46,7 @@ protected: signals: void emptySpaceClicked(); void characterKeyPressed(QChar c); + void resized(); private slots: void updateTimer(); diff --git a/src/lib_gui/qt/view/QtErrorView.cpp b/src/lib_gui/qt/view/QtErrorView.cpp index ccf3c7f8..b2398a92 100644 --- a/src/lib_gui/qt/view/QtErrorView.cpp +++ b/src/lib_gui/qt/view/QtErrorView.cpp @@ -68,7 +68,7 @@ void QtErrorView::initView() QWidget* widget = QtViewWidgetWrapper::getWidgetOfView(this); QBoxLayout* layout = new QVBoxLayout(); - layout->setContentsMargins(0, 0, 0, 5); + layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); widget->setLayout(layout); @@ -107,7 +107,8 @@ void QtErrorView::initView() // Setup Checkboxes QBoxLayout* checkboxes = new QHBoxLayout(); - checkboxes->addSpacing(15); + checkboxes->setContentsMargins(10, 0, 0, 0); + checkboxes->setSpacing(0); { m_showFatals = createFilterCheckbox("fatals", m_errorFilter.fatal, checkboxes); diff --git a/src/lib_gui/qt/view/QtGraphView.cpp b/src/lib_gui/qt/view/QtGraphView.cpp index 2cb996ab..9e6a29f1 100644 --- a/src/lib_gui/qt/view/QtGraphView.cpp +++ b/src/lib_gui/qt/view/QtGraphView.cpp @@ -82,6 +82,7 @@ void QtGraphView::initView() connect(view, SIGNAL(emptySpaceClicked()), this, SLOT(clickedInEmptySpace())); connect(view, SIGNAL(characterKeyPressed(QChar)), this, SLOT(pressedCharacterKey(QChar))); + connect(view, SIGNAL(resized()), this, SLOT(resized())); m_scrollSpeedChangeListenerHorizontal.setScrollBar(view->horizontalScrollBar()); m_scrollSpeedChangeListenerVertical.setScrollBar(view->verticalScrollBar()); @@ -337,6 +338,11 @@ void QtGraphView::scrolled(int) MessageScrollGraph(view->horizontalScrollBar()->value(), view->verticalScrollBar()->value()).dispatch(); } +void QtGraphView::resized() +{ + doResize(); +} + void QtGraphView::trailDepthChanged(int) { if (m_trailDepthSlider->value() == m_trailDepthSlider->maximum()) @@ -1065,7 +1071,7 @@ void QtGraphView::createTransition() anim->setDuration(300); - if (!remainingNodes.size() || m_scrollToTop) + if (!remainingNodes.size() || m_scrollToTop || m_restoreScroll) { connect(anim, SIGNAL(finished()), this, SLOT(updateScrollBars())); } diff --git a/src/lib_gui/qt/view/QtGraphView.h b/src/lib_gui/qt/view/QtGraphView.h index f214a737..778ec4c4 100644 --- a/src/lib_gui/qt/view/QtGraphView.h +++ b/src/lib_gui/qt/view/QtGraphView.h @@ -62,7 +62,9 @@ private slots: void finishedTransition(); void clickedInEmptySpace(); void pressedCharacterKey(QChar c); + void scrolled(int); + void resized(); void trailDepthChanged(int); diff --git a/src/lib_gui/qt/view/QtStatusView.cpp b/src/lib_gui/qt/view/QtStatusView.cpp index b91d11a5..e2474b2e 100644 --- a/src/lib_gui/qt/view/QtStatusView.cpp +++ b/src/lib_gui/qt/view/QtStatusView.cpp @@ -37,7 +37,7 @@ void QtStatusView::initView() QWidget* widget = QtViewWidgetWrapper::getWidgetOfView(this); QBoxLayout* layout = new QVBoxLayout(); - layout->setContentsMargins(0, 0, 0, 5); + layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); widget->setLayout(layout); @@ -57,7 +57,8 @@ void QtStatusView::initView() // Setup filters QHBoxLayout* filters = new QHBoxLayout(); - filters->addSpacing(15); + filters->setContentsMargins(10, 0, 0, 0); + filters->setSpacing(25); const StatusFilter filter = ApplicationSettings::getInstance()->getStatusFilter(); m_showInfo = createFilterCheckbox("info", filters, filter & StatusType::STATUS_INFO); @@ -100,7 +101,6 @@ QCheckBox* QtStatusView::createFilterCheckbox(const QString& name, QBoxLayout* l ); layout->addWidget(checkbox); - layout->addSpacing(25); return checkbox; } @@ -168,9 +168,5 @@ void QtStatusView::setStyleSheet() const QPalette palette(m_showErrors->palette()); palette.setColor(QPalette::WindowText, QColor(ColorScheme::getInstance()->getColor("error/text/normal").c_str())); - // widget->setStyleSheet( - // utility::getStyleSheet(ResourcePaths::getGuiPath() + "error_view/error_view.css").c_str() - // ); - m_table->updateRows(); } diff --git a/src/lib_gui/qt/window/QtPreferencesWindow.cpp b/src/lib_gui/qt/window/QtPreferencesWindow.cpp index 44ade359..028e3746 100644 --- a/src/lib_gui/qt/window/QtPreferencesWindow.cpp +++ b/src/lib_gui/qt/window/QtPreferencesWindow.cpp @@ -89,5 +89,5 @@ void QtPreferencesWindow::handleNext() MessageRefresh().refreshUiOnly().dispatch(); } - QtWindow::handleNext(); + QtWindow::handleClose(); } diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.cpp index 179a45de..61b2b703 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.cpp @@ -198,6 +198,7 @@ void QtProjectWizzard::populateWindow(QWidget* widget) separator->setPalette(palette); layout->addWidget(separator); + layout->addSpacing(10); m_contentWidget = new QWidget(); m_contentWidget->setObjectName("form");