ui: Added tabs UI to top of main window (issue #215)
* Added tab bar to top of main window with UI/shortcuts similar to web browsers * ComponentManager offers components for 2 use-cases: application and tab * Application components: log view (status/errors), bookmarks, screen search, status bar, tabs, tooltips, dialogs and all tab views disabled * Tab components: graph, code, history and search * When a project is loaded there is always at least one tab, otherwise there is none * Each tab replaces the application views of the same name in the main layout when activated * Each tab has it's own TaskScheduler, to process tasks independent from other tabs * The application has a global TaskScheduler for application wide tasks * The singloton class TaskManager is responsible for managing the TaskSchedulers * MessageListeners and Messages hold an optional schedulerId, both must be set to only send to a specific TaskScheduler * Bookmark buttons where split off into a separate view per tab, bookmark managemement is done in the application * History menu processing is done by the QtMainWindow now * Screen search is an application component, the responders are always changed to the active tab * Plugin messages are opened in a new tab * Symbols can be opened in a new tab via middle click/context menu in graph, code, history dropdown * Full text index creation is mutexed now in PersistenStorage to make it fully thread-safe * All tabs are closed when switching projects * Tab contents are only animated when visible fortune cookie message = Catch your lucky star!
This commit is contained in:
@@ -22,10 +22,11 @@
|
||||
#include "utilityQt.h"
|
||||
#include "ApplicationSettings.h"
|
||||
#include "MessageActivateLegend.h"
|
||||
#include "MessageBookmarkCreate.h"
|
||||
#include "MessageCodeShowDefinition.h"
|
||||
#include "MessageDisplayBookmarkCreator.h"
|
||||
#include "MessageGraphNodeExpand.h"
|
||||
#include "MessageGraphNodeHide.h"
|
||||
#include "MessageTabOpenWith.h"
|
||||
#include "ResourcePaths.h"
|
||||
#include "utilityApp.h"
|
||||
|
||||
@@ -55,10 +56,10 @@ QtGraphicsView::QtGraphicsView(QWidget* parent)
|
||||
m_zoomLabelTimer = std::make_shared<QTimer>(this);
|
||||
connect(m_zoomLabelTimer.get(), &QTimer::timeout, this, &QtGraphicsView::hideZoomLabel);
|
||||
|
||||
m_exportGraphAction = new QAction("Save as Image", this);
|
||||
m_exportGraphAction->setStatusTip("Save this graph as image file");
|
||||
m_exportGraphAction->setToolTip("Save this graph as image file");
|
||||
connect(m_exportGraphAction, &QAction::triggered, this, &QtGraphicsView::exportGraph);
|
||||
m_openInTabAction = new QAction("Open in New Tab", this);
|
||||
m_openInTabAction->setStatusTip("Open this node in a new tab");
|
||||
m_openInTabAction->setToolTip("Open this node in a new tab");
|
||||
connect(m_openInTabAction, &QAction::triggered, this, &QtGraphicsView::openInTab);
|
||||
|
||||
m_copyNodeNameAction = new QAction("Copy Name", this);
|
||||
m_copyNodeNameAction->setStatusTip("Copies the name of this node to the clipboard");
|
||||
@@ -98,6 +99,11 @@ QtGraphicsView::QtGraphicsView(QWidget* parent)
|
||||
m_bookmarkNodeAction->setToolTip("Create a bookmark for this node");
|
||||
connect(m_bookmarkNodeAction, &QAction::triggered, this, &QtGraphicsView::bookmarkNode);
|
||||
|
||||
m_exportGraphAction = new QAction("Save as Image", this);
|
||||
m_exportGraphAction->setStatusTip("Save this graph as image file");
|
||||
m_exportGraphAction->setToolTip("Save this graph as image file");
|
||||
connect(m_exportGraphAction, &QAction::triggered, this, &QtGraphicsView::exportGraph);
|
||||
|
||||
m_zoomState = new QPushButton(this);
|
||||
m_zoomState->setObjectName("zoom_state");
|
||||
m_zoomState->hide();
|
||||
@@ -175,7 +181,7 @@ void QtGraphicsView::ensureVisibleAnimated(const QRectF& rect, int xmargin, int
|
||||
|
||||
ensureVisible(rect, xmargin, ymargin);
|
||||
|
||||
if (ApplicationSettings::getInstance()->getUseAnimations())
|
||||
if (ApplicationSettings::getInstance()->getUseAnimations() && isVisible())
|
||||
{
|
||||
int xval2 = horizontalScrollBar()->value();
|
||||
int yval2 = verticalScrollBar()->value();
|
||||
@@ -345,6 +351,7 @@ void QtGraphicsView::wheelEvent(QWheelEvent* event)
|
||||
|
||||
void QtGraphicsView::contextMenuEvent(QContextMenuEvent* event)
|
||||
{
|
||||
m_openInTabNodeId = 0;
|
||||
m_clipboardNodeName = L"";
|
||||
m_collapseNodeId = 0;
|
||||
m_expandNodeId = 0;
|
||||
@@ -369,6 +376,7 @@ void QtGraphicsView::contextMenuEvent(QContextMenuEvent* event)
|
||||
if (dataNode)
|
||||
{
|
||||
m_clipboardNodeName = dataNode->getName();
|
||||
m_openInTabNodeId = dataNode->getTokenId();
|
||||
m_bookmarkNodeId = dataNode->getTokenId();
|
||||
clipboardFilePath = dataNode->getFilePath();
|
||||
}
|
||||
@@ -408,6 +416,7 @@ void QtGraphicsView::contextMenuEvent(QContextMenuEvent* event)
|
||||
}
|
||||
}
|
||||
|
||||
m_openInTabAction->setEnabled(m_openInTabNodeId);
|
||||
m_collapseAction->setEnabled(m_collapseNodeId);
|
||||
m_expandAction->setEnabled(m_expandNodeId);
|
||||
m_showDefinitionAction->setEnabled(m_hideNodeId);
|
||||
@@ -419,8 +428,8 @@ void QtGraphicsView::contextMenuEvent(QContextMenuEvent* event)
|
||||
|
||||
QtContextMenu menu(event, this);
|
||||
|
||||
menu.addSeparator();
|
||||
menu.addAction(m_exportGraphAction);
|
||||
menu.addAction(m_openInTabAction);
|
||||
menu.addUndoActions();
|
||||
|
||||
menu.addSeparator();
|
||||
|
||||
@@ -438,6 +447,9 @@ void QtGraphicsView::contextMenuEvent(QContextMenuEvent* event)
|
||||
menu.addAction(m_hideEdgeAction);
|
||||
menu.addAction(m_bookmarkNodeAction);
|
||||
|
||||
menu.addSeparator();
|
||||
menu.addAction(m_exportGraphAction);
|
||||
|
||||
menu.addSeparator();
|
||||
menu.addAction(m_copyNodeNameAction);
|
||||
menu.addFileActions(clipboardFilePath);
|
||||
@@ -507,6 +519,11 @@ void QtGraphicsView::stopTimer()
|
||||
m_timer->stop();
|
||||
}
|
||||
|
||||
void QtGraphicsView::openInTab()
|
||||
{
|
||||
MessageTabOpenWith(m_openInTabNodeId).dispatch();
|
||||
}
|
||||
|
||||
void QtGraphicsView::exportGraph()
|
||||
{
|
||||
const QString exportNotice = "Exported from Sourcetrail";
|
||||
@@ -616,7 +633,7 @@ void QtGraphicsView::hideEdge()
|
||||
|
||||
void QtGraphicsView::bookmarkNode()
|
||||
{
|
||||
MessageDisplayBookmarkCreator(m_bookmarkNodeId).dispatch();
|
||||
MessageBookmarkCreate(m_bookmarkNodeId).dispatch();
|
||||
}
|
||||
|
||||
void QtGraphicsView::zoomInPressed()
|
||||
|
||||
@@ -55,6 +55,8 @@ private slots:
|
||||
void updateTimer();
|
||||
void stopTimer();
|
||||
|
||||
void openInTab();
|
||||
|
||||
void exportGraph();
|
||||
void copyNodeName();
|
||||
|
||||
@@ -91,6 +93,7 @@ private:
|
||||
bool m_shift;
|
||||
|
||||
std::wstring m_clipboardNodeName;
|
||||
Id m_openInTabNodeId;
|
||||
Id m_hideNodeId;
|
||||
Id m_hideEdgeId;
|
||||
Id m_bookmarkNodeId;
|
||||
@@ -101,7 +104,8 @@ private:
|
||||
std::shared_ptr<QTimer> m_timerStopper;
|
||||
std::shared_ptr<QTimer> m_zoomLabelTimer;
|
||||
|
||||
QAction* m_exportGraphAction;
|
||||
QAction* m_openInTabAction;
|
||||
|
||||
QAction* m_copyNodeNameAction;
|
||||
QAction* m_collapseAction;
|
||||
QAction* m_expandAction;
|
||||
@@ -110,6 +114,8 @@ private:
|
||||
QAction* m_hideEdgeAction;
|
||||
QAction* m_bookmarkNodeAction;
|
||||
|
||||
QAction* m_exportGraphAction;
|
||||
|
||||
QPushButton* m_zoomState;
|
||||
QtSelfRefreshIconButton* m_zoomInButton;
|
||||
QtSelfRefreshIconButton* m_zoomOutButton;
|
||||
|
||||
Reference in New Issue
Block a user