Files
Sourcetrail/src/lib_gui/qt/view/QtBookmarkView.cpp
T
Eberhard Graether f13aec70dd 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!
2018-11-05 01:28:12 +01:00

118 lines
2.6 KiB
C++

#include "QtBookmarkView.h"
#include "QtBookmarkBrowser.h"
#include "QtBookmarkCreator.h"
#include "QtMainView.h"
#include "QtMainWindow.h"
#include "TabId.h"
QtBookmarkView::QtBookmarkView(ViewLayout* viewLayout)
: BookmarkView(viewLayout)
, m_controllerProxy(this, TabId::app())
, m_bookmarkBrowser(nullptr)
{
}
void QtBookmarkView::createWidgetWrapper()
{
}
void QtBookmarkView::initView()
{
}
void QtBookmarkView::refreshView()
{
}
void QtBookmarkView::displayBookmarkCreator(
const std::vector<std::wstring>& names, const std::vector<BookmarkCategory>& categories, Id nodeId
){
m_onQtThread(
[=]()
{
QtBookmarkCreator* bookmarkCreator = new QtBookmarkCreator(
&m_controllerProxy,
dynamic_cast<QtMainView*>(dynamic_cast<View*>(getViewLayout())->getViewLayout())->getMainWindow()
);
bookmarkCreator->setupBookmarkCreator();
std::wstring displayName = L"";
for (unsigned int i = 0; i < names.size(); i++)
{
displayName += names[i];
if (i < names.size() - 1)
{
displayName += L"; ";
}
}
bookmarkCreator->setDisplayName(displayName);
bookmarkCreator->setBookmarkCategories(categories);
bookmarkCreator->setNodeId(nodeId);
bookmarkCreator->show();
bookmarkCreator->raise();
}
);
}
void QtBookmarkView::displayBookmarkEditor(
std::shared_ptr<Bookmark> bookmark, const std::vector<BookmarkCategory>& categories
){
m_onQtThread(
[=]()
{
QtBookmarkCreator* bookmarkCreator = new QtBookmarkCreator(
&m_controllerProxy,
dynamic_cast<QtMainView*>(dynamic_cast<View*>(getViewLayout())->getViewLayout())->getMainWindow(),
bookmark->getId()
);
bookmarkCreator->setupBookmarkCreator();
bookmarkCreator->setDisplayName(bookmark->getName());
bookmarkCreator->setComment(bookmark->getComment());
bookmarkCreator->setBookmarkCategories(categories);
bookmarkCreator->setCurrentBookmarkCategory(bookmark->getCategory());
bookmarkCreator->show();
bookmarkCreator->raise();
}
);
}
void QtBookmarkView::displayBookmarks(const std::vector<std::shared_ptr<Bookmark>>& bookmarks)
{
m_onQtThread(
[=]()
{
if (m_bookmarkBrowser == nullptr)
{
m_bookmarkBrowser = new QtBookmarkBrowser(
&m_controllerProxy,
dynamic_cast<QtMainView*>(dynamic_cast<View*>(getViewLayout())->getViewLayout())->getMainWindow()
);
m_bookmarkBrowser->setupBookmarkBrowser();
}
m_bookmarkBrowser->setBookmarks(bookmarks);
m_bookmarkBrowser->show();
m_bookmarkBrowser->raise();
}
);
}
bool QtBookmarkView::bookmarkBrowserIsVisible() const
{
if (m_bookmarkBrowser != nullptr)
{
return m_bookmarkBrowser->isVisible();
}
else
{
return false;
}
}