ui: Fixes and improvements for bookmarks
* moved bookmark buttons behind search bar * suggest qualified name when creating, file name for files * fixed bug when updating bookmark category * changed comment toggle arrow * changed edit and delete icons * fixed undo for edge bookmarks * keep categories always alphabetical regardless of subsorting * keep category expansion state when opening and closing browser * removed QtBookmarkBar, moved logic into QtBookmarkView * added bookmarks Menu with shortcuts Ctrl + D: Create Bookmark Ctrl + B: Bookmark Manager
@@ -49,7 +49,7 @@
|
||||
|
||||
#category_name {
|
||||
color: black;
|
||||
font-size: 14px;
|
||||
font-size: 12px;
|
||||
margin-left: 1px;
|
||||
}
|
||||
|
||||
@@ -60,17 +60,24 @@
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
#edit_button {
|
||||
margin-right: 3px;
|
||||
}
|
||||
|
||||
/* Bookmark */
|
||||
|
||||
#bookmark {
|
||||
padding: 3px 10px 3px 23px;
|
||||
padding: 3px 10px 3px 3px;
|
||||
margin: 0;
|
||||
background: white;
|
||||
border-bottom: 1px solid #DFDFDF;
|
||||
}
|
||||
|
||||
#bookmark_comment {
|
||||
font-size: 12px;
|
||||
margin: 3px 0px 3px 26px;
|
||||
padding: 3px 6px 3px 7px;
|
||||
margin: 0;
|
||||
color: #707070;
|
||||
}
|
||||
|
||||
#activate_button {
|
||||
@@ -78,7 +85,7 @@
|
||||
border: 2px solid white;
|
||||
border-radius: 8px;
|
||||
color: black;
|
||||
font-size: 14px;
|
||||
font-size: 12px;
|
||||
padding: 4px 8px 3px;
|
||||
text-align: right;
|
||||
}
|
||||
@@ -87,10 +94,14 @@
|
||||
border-color: #2D3C86;
|
||||
}
|
||||
|
||||
#activate_button:pressed {
|
||||
background: #CDD4F7;
|
||||
}
|
||||
|
||||
#date_label {
|
||||
margin: 3px 5px 0px;
|
||||
margin: 1px 5px 0px;
|
||||
font-size: 12px;
|
||||
color: gray;
|
||||
color: #707070;
|
||||
}
|
||||
|
||||
/* Search bar buttons */
|
||||
|
||||
|
After Width: | Height: | Size: 461 B |
|
After Width: | Height: | Size: 1021 B |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1000 B |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 649 B |
|
Before Width: | Height: | Size: 602 B |
@@ -33,9 +33,6 @@ void ComponentManager::setup(ViewLayout* viewLayout)
|
||||
m_componentFactory->getViewFactory()->createCompositeView(viewLayout, CompositeView::DIRECTION_HORIZONTAL, "Search");
|
||||
m_compositeViews.push_back(compositeView);
|
||||
|
||||
std::shared_ptr<Component> bookmarkComponent = m_componentFactory->createBookmarkComponent(compositeView.get());
|
||||
m_components.push_back(bookmarkComponent);
|
||||
|
||||
std::shared_ptr<Component> undoRedoComponent = m_componentFactory->createUndoRedoComponent(compositeView.get());
|
||||
m_components.push_back(undoRedoComponent);
|
||||
|
||||
@@ -45,6 +42,9 @@ void ComponentManager::setup(ViewLayout* viewLayout)
|
||||
std::shared_ptr<Component> searchComponent = m_componentFactory->createSearchComponent(compositeView.get());
|
||||
m_components.push_back(searchComponent);
|
||||
|
||||
std::shared_ptr<Component> bookmarkComponent = m_componentFactory->createBookmarkComponent(compositeView.get());
|
||||
m_components.push_back(bookmarkComponent);
|
||||
|
||||
std::shared_ptr<Component> graphComponent = m_componentFactory->createGraphComponent(viewLayout);
|
||||
m_components.push_back(graphComponent);
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
#include "data/bookmark/EdgeBookmark.h"
|
||||
#include "data/bookmark/NodeBookmark.h"
|
||||
|
||||
const std::string BookmarkController::s_edgeSeperatorToken = "=>";
|
||||
const std::string BookmarkController::s_defaultCategoryName = "Default Bookmark Category";
|
||||
const std::string BookmarkController::s_edgeSeperatorToken = " => ";
|
||||
const std::string BookmarkController::s_defaultCategoryName = "default";
|
||||
|
||||
BookmarkController::BookmarkController(StorageAccess* storageAccess)
|
||||
: m_storageAccess(storageAccess)
|
||||
@@ -34,7 +34,8 @@ void BookmarkController::clear()
|
||||
{
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<Bookmark>> BookmarkController::getBookmarks(const MessageDisplayBookmarks::BookmarkFilter& filter, const MessageDisplayBookmarks::BookmarkOrder& order) const
|
||||
std::vector<std::shared_ptr<Bookmark>> BookmarkController::getBookmarks(
|
||||
const MessageDisplayBookmarks::BookmarkFilter& filter, const MessageDisplayBookmarks::BookmarkOrder& order) const
|
||||
{
|
||||
LOG_INFO_STREAM(<< "Retrieving bookmarks with filter \"" << std::to_string(filter) << "\" and order \"" << std::to_string(order) << "\"");
|
||||
|
||||
@@ -75,7 +76,8 @@ std::shared_ptr<Bookmark> BookmarkController::getBookmarkForActiveToken() const
|
||||
{
|
||||
for (std::shared_ptr<EdgeBookmark> edgeBookmark: getAllEdgeBookmarks())
|
||||
{
|
||||
if (!m_activeNodeIds.empty() && edgeBookmark->getActiveNodeId() == m_activeNodeIds.front() && utility::isPermutation(edgeBookmark->getEdgeIds(), m_activeEdgeIds))
|
||||
if (!m_activeNodeIds.empty() && edgeBookmark->getActiveNodeId() == m_activeNodeIds.front() &&
|
||||
utility::isPermutation(edgeBookmark->getEdgeIds(), m_activeEdgeIds))
|
||||
{
|
||||
return std::make_shared<EdgeBookmark>(*(edgeBookmark.get()));
|
||||
}
|
||||
@@ -132,10 +134,6 @@ void BookmarkController::handleMessage(MessageActivateBookmark* message)
|
||||
|
||||
if (std::shared_ptr<EdgeBookmark> bookmark = std::dynamic_pointer_cast<EdgeBookmark>(message->bookmark))
|
||||
{
|
||||
MessageActivateNodes activateNodes;
|
||||
activateNodes.addNode(bookmark->getActiveNodeId(), NameHierarchy());
|
||||
activateNodes.dispatch();
|
||||
|
||||
if (!bookmark->getEdgeIds().empty())
|
||||
{
|
||||
const Id firstEdgeId = bookmark->getEdgeIds().front();
|
||||
@@ -146,6 +144,14 @@ void BookmarkController::handleMessage(MessageActivateBookmark* message)
|
||||
|
||||
if (bookmark->getEdgeIds().size() == 1)
|
||||
{
|
||||
Id activeNodeId = bookmark->getActiveNodeId();
|
||||
if (activeNodeId)
|
||||
{
|
||||
MessageActivateNodes activateNodes;
|
||||
activateNodes.addNode(activeNodeId, m_storageAccess->getNameHierarchyForNodeId(activeNodeId));
|
||||
activateNodes.dispatch();
|
||||
}
|
||||
|
||||
MessageActivateEdge(firstEdgeId, Edge::intToType(storageEdge.type), sourceName, targetName).dispatch();
|
||||
}
|
||||
else
|
||||
@@ -292,7 +298,6 @@ void BookmarkController::handleMessage(MessageDeleteBookmark* message)
|
||||
m_storageAccess->removeBookmark(message->bookmarkId);
|
||||
|
||||
cleanBookmarkCategories();
|
||||
m_bookmarkCache.clear();
|
||||
|
||||
if (!getBookmarkForActiveToken())
|
||||
{
|
||||
@@ -327,7 +332,6 @@ void BookmarkController::handleMessage(MessageDeleteBookmarkForActiveTokens* mes
|
||||
m_storageAccess->removeBookmark(bookmark->getId());
|
||||
|
||||
cleanBookmarkCategories();
|
||||
m_bookmarkCache.clear();
|
||||
|
||||
m_hasBookmarkForActiveToken = false;
|
||||
getView<BookmarkView>()->setCreateButtonState(BookmarkView::CreateButtonState::CAN_CREATE);
|
||||
@@ -347,7 +351,6 @@ void BookmarkController::handleMessage(MessageEditBookmark* message)
|
||||
m_storageAccess->updateBookmark(message->bookmarkId, message->displayName, message->comment, categoryName);
|
||||
|
||||
cleanBookmarkCategories();
|
||||
m_bookmarkCache.clear();
|
||||
|
||||
getView<BookmarkView>()->update();
|
||||
}
|
||||
@@ -399,9 +402,9 @@ std::vector<std::shared_ptr<EdgeBookmark>> BookmarkController::getAllEdgeBookmar
|
||||
std::vector<std::string> BookmarkController::getActiveNodeDisplayNames() const
|
||||
{
|
||||
std::vector<std::string> names;
|
||||
for (const NameHierarchy& nameHierarchy: m_storageAccess->getNameHierarchiesForNodeIds(m_activeNodeIds))
|
||||
for (Id nodeId : m_activeNodeIds)
|
||||
{
|
||||
names.push_back(nameHierarchy.getRawName());
|
||||
names.push_back(getNodeDisplayName(nodeId));
|
||||
}
|
||||
return names;
|
||||
}
|
||||
@@ -421,11 +424,19 @@ std::vector<std::string> BookmarkController::getActiveEdgeDisplayNames() const
|
||||
|
||||
std::string BookmarkController::getNodeDisplayName(const Id nodeId) const
|
||||
{
|
||||
Node::NodeType type = m_storageAccess->getNodeTypeForNodeWithId(nodeId);
|
||||
NameHierarchy nameHierarchy = m_storageAccess->getNameHierarchyForNodeId(nodeId);
|
||||
return nameHierarchy.getRawName();
|
||||
|
||||
if (type == Node::NODE_FILE)
|
||||
{
|
||||
return FilePath(nameHierarchy.getQualifiedName()).fileName();
|
||||
}
|
||||
|
||||
return nameHierarchy.getQualifiedName();
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<Bookmark>> BookmarkController::getFilteredBookmarks(const std::vector<std::shared_ptr<Bookmark>>& bookmarks, const MessageDisplayBookmarks::BookmarkFilter& filter) const
|
||||
std::vector<std::shared_ptr<Bookmark>> BookmarkController::getFilteredBookmarks(
|
||||
const std::vector<std::shared_ptr<Bookmark>>& bookmarks, const MessageDisplayBookmarks::BookmarkFilter& filter) const
|
||||
{
|
||||
std::vector<std::shared_ptr<Bookmark>> result;
|
||||
|
||||
@@ -457,7 +468,8 @@ std::vector<std::shared_ptr<Bookmark>> BookmarkController::getFilteredBookmarks(
|
||||
return result;
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<Bookmark>> BookmarkController::getOrderedBookmarks(const std::vector<std::shared_ptr<Bookmark>>& bookmarks, const MessageDisplayBookmarks::BookmarkOrder& order) const
|
||||
std::vector<std::shared_ptr<Bookmark>> BookmarkController::getOrderedBookmarks(
|
||||
const std::vector<std::shared_ptr<Bookmark>>& bookmarks, const MessageDisplayBookmarks::BookmarkOrder& order) const
|
||||
{
|
||||
std::vector<std::shared_ptr<Bookmark>> result = bookmarks;
|
||||
|
||||
@@ -481,7 +493,8 @@ std::vector<std::shared_ptr<Bookmark>> BookmarkController::getOrderedBookmarks(c
|
||||
return result;
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<Bookmark>> BookmarkController::getDateOrderedBookmarks(const std::vector<std::shared_ptr<Bookmark>>& bookmarks, const bool ascending) const
|
||||
std::vector<std::shared_ptr<Bookmark>> BookmarkController::getDateOrderedBookmarks(
|
||||
const std::vector<std::shared_ptr<Bookmark>>& bookmarks, const bool ascending) const
|
||||
{
|
||||
std::vector<std::shared_ptr<Bookmark>> result = bookmarks;
|
||||
|
||||
@@ -495,7 +508,8 @@ std::vector<std::shared_ptr<Bookmark>> BookmarkController::getDateOrderedBookmar
|
||||
return result;
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<Bookmark>> BookmarkController::getNameOrderedBookmarks(const std::vector<std::shared_ptr<Bookmark>>& bookmarks, const bool ascending) const
|
||||
std::vector<std::shared_ptr<Bookmark>> BookmarkController::getNameOrderedBookmarks(
|
||||
const std::vector<std::shared_ptr<Bookmark>>& bookmarks, const bool ascending) const
|
||||
{
|
||||
std::vector<std::shared_ptr<Bookmark>> result = bookmarks;
|
||||
|
||||
@@ -511,6 +525,8 @@ std::vector<std::shared_ptr<Bookmark>> BookmarkController::getNameOrderedBookmar
|
||||
|
||||
void BookmarkController::cleanBookmarkCategories()
|
||||
{
|
||||
m_bookmarkCache.clear();
|
||||
|
||||
std::vector<std::shared_ptr<Bookmark>> bookmarks = getAllBookmarks();
|
||||
|
||||
for (const BookmarkCategory& category: getAllBookmarkCategories())
|
||||
|
||||
@@ -42,7 +42,8 @@ public:
|
||||
|
||||
virtual void clear();
|
||||
|
||||
std::vector<std::shared_ptr<Bookmark>> getBookmarks(const MessageDisplayBookmarks::BookmarkFilter& filter, const MessageDisplayBookmarks::BookmarkOrder& order) const;
|
||||
std::vector<std::shared_ptr<Bookmark>> getBookmarks(
|
||||
const MessageDisplayBookmarks::BookmarkFilter& filter, const MessageDisplayBookmarks::BookmarkOrder& order) const;
|
||||
|
||||
std::vector<std::string> getActiveTokenDisplayNames() const;
|
||||
std::vector<BookmarkCategory> getAllBookmarkCategories() const;
|
||||
@@ -86,10 +87,14 @@ private:
|
||||
std::vector<std::string> getActiveEdgeDisplayNames() const;
|
||||
std::string getNodeDisplayName(const Id id) const;
|
||||
|
||||
std::vector<std::shared_ptr<Bookmark>> getFilteredBookmarks(const std::vector<std::shared_ptr<Bookmark>>& bookmarks, const MessageDisplayBookmarks::BookmarkFilter& filter) const;
|
||||
std::vector<std::shared_ptr<Bookmark>> getOrderedBookmarks(const std::vector<std::shared_ptr<Bookmark>>& bookmarks, const MessageDisplayBookmarks::BookmarkOrder& order) const;
|
||||
std::vector<std::shared_ptr<Bookmark>> getDateOrderedBookmarks(const std::vector<std::shared_ptr<Bookmark>>& bookmarks, const bool ascending) const;
|
||||
std::vector<std::shared_ptr<Bookmark>> getNameOrderedBookmarks(const std::vector<std::shared_ptr<Bookmark>>& bookmarks, const bool ascending) const;
|
||||
std::vector<std::shared_ptr<Bookmark>> getFilteredBookmarks(
|
||||
const std::vector<std::shared_ptr<Bookmark>>& bookmarks, const MessageDisplayBookmarks::BookmarkFilter& filter) const;
|
||||
std::vector<std::shared_ptr<Bookmark>> getOrderedBookmarks(
|
||||
const std::vector<std::shared_ptr<Bookmark>>& bookmarks, const MessageDisplayBookmarks::BookmarkOrder& order) const;
|
||||
std::vector<std::shared_ptr<Bookmark>> getDateOrderedBookmarks(
|
||||
const std::vector<std::shared_ptr<Bookmark>>& bookmarks, const bool ascending) const;
|
||||
std::vector<std::shared_ptr<Bookmark>> getNameOrderedBookmarks(
|
||||
const std::vector<std::shared_ptr<Bookmark>>& bookmarks, const bool ascending) const;
|
||||
|
||||
void cleanBookmarkCategories();
|
||||
|
||||
|
||||
@@ -46,40 +46,17 @@ void BookmarkView::handleMessage(MessageDisplayBookmarks* message)
|
||||
|
||||
void BookmarkView::handleMessage(MessageDisplayBookmarkCreator* message)
|
||||
{
|
||||
std::vector<std::string> names = getController()->getActiveTokenDisplayNames();
|
||||
|
||||
if (getController()->hasBookmarkForActiveToken())
|
||||
{
|
||||
std::vector<BookmarkCategory> categories = getController()->getAllBookmarkCategories();
|
||||
|
||||
displayBookmarkEditor(getController()->getBookmarkForActiveToken(), categories);
|
||||
displayBookmarkEditor(getController()->getBookmarkForActiveToken(), getController()->getAllBookmarkCategories());
|
||||
}
|
||||
else
|
||||
{
|
||||
for (unsigned int i = 0; i < names.size(); i++)
|
||||
{
|
||||
std::string name = names[i];
|
||||
|
||||
// skip the first letter as to not insert a leading space
|
||||
for (unsigned int i = 1; i < name.size(); i++)
|
||||
{
|
||||
if (std::isupper(name[i]))
|
||||
{
|
||||
name.insert(i, 1, ' ');
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
names[i] = name;
|
||||
}
|
||||
|
||||
displayBookmarkCreator(names, getController()->getAllBookmarkCategories());
|
||||
displayBookmarkCreator(getController()->getActiveTokenDisplayNames(), getController()->getAllBookmarkCategories());
|
||||
}
|
||||
}
|
||||
|
||||
void BookmarkView::handleMessage(MessageDisplayBookmarkEditor* message)
|
||||
{
|
||||
std::vector<BookmarkCategory> categories = getController()->getAllBookmarkCategories();
|
||||
|
||||
displayBookmarkEditor(message->bookmark, categories);
|
||||
displayBookmarkEditor(message->bookmark, getController()->getAllBookmarkCategories());
|
||||
}
|
||||
|
||||
@@ -625,11 +625,6 @@ StorageEdge PersistentStorage::getEdgeById(Id edgeId) const
|
||||
return m_sqliteIndexStorage.getEdgeById(edgeId);
|
||||
}
|
||||
|
||||
bool PersistentStorage::checkEdgeExists(Id edgeId) const
|
||||
{
|
||||
return m_sqliteIndexStorage.checkEdgeExists(edgeId);
|
||||
}
|
||||
|
||||
std::shared_ptr<SourceLocationCollection> PersistentStorage::getFullTextSearchLocations(
|
||||
const std::string& searchTerm, bool caseSensitive
|
||||
) const
|
||||
|
||||
@@ -103,7 +103,6 @@ public:
|
||||
virtual Id getIdForEdge(
|
||||
Edge::EdgeType type, const NameHierarchy& fromNameHierarchy, const NameHierarchy& toNameHierarchy) const;
|
||||
virtual StorageEdge getEdgeById(Id edgeId) const;
|
||||
virtual bool checkEdgeExists(Id edgeId) const;
|
||||
|
||||
virtual std::shared_ptr<SourceLocationCollection> getFullTextSearchLocations(
|
||||
const std::string& searchTerm, bool caseSensitive) const;
|
||||
|
||||
@@ -504,27 +504,6 @@ std::vector<StorageEdge> SqliteIndexStorage::getEdgesByTargetsType(const std::ve
|
||||
return doGetAll<StorageEdge>("WHERE target_node_id IN (" + utility::join(utility::toStrings(targetIds), ',') + ") AND type == " + std::to_string(type));
|
||||
}
|
||||
|
||||
bool SqliteIndexStorage::checkEdgeExists(Id edgeId) const
|
||||
{
|
||||
CppSQLite3Statement stmt = m_database.compileStatement(
|
||||
("SELECT type FROM edge WHERE id == " + std::to_string(edgeId) + ";").c_str()
|
||||
);
|
||||
|
||||
CppSQLite3Query q = executeQuery(stmt);
|
||||
|
||||
if (!q.eof())
|
||||
{
|
||||
const int type = q.getIntField(0, -1);
|
||||
|
||||
if (type != -1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
StorageNode SqliteIndexStorage::getNodeById(Id id) const
|
||||
{
|
||||
std::vector<StorageNode> candidates = doGetAll<StorageNode>("WHERE id = " + std::to_string(id));
|
||||
|
||||
@@ -67,8 +67,6 @@ public:
|
||||
std::vector<StorageEdge> getEdgesByTargetType(Id targetId, int type) const;
|
||||
std::vector<StorageEdge> getEdgesByTargetsType(const std::vector<Id>& targetIds, int type) const;
|
||||
|
||||
bool checkEdgeExists(Id edgeId) const;
|
||||
|
||||
StorageNode getNodeById(Id id) const;
|
||||
StorageNode getNodeBySerializedName(const std::string& serializedName) const;
|
||||
|
||||
|
||||
@@ -42,7 +42,6 @@ public:
|
||||
virtual Id getIdForEdge(
|
||||
Edge::EdgeType type, const NameHierarchy& fromNameHierarchy, const NameHierarchy& toNameHierarchy) const = 0;
|
||||
virtual StorageEdge getEdgeById(Id edgeId) const = 0;
|
||||
virtual bool checkEdgeExists(Id edgeId) const = 0;
|
||||
|
||||
virtual std::shared_ptr<SourceLocationCollection> getFullTextSearchLocations(
|
||||
const std::string& searchTerm, bool caseSensitive) const = 0;
|
||||
|
||||
@@ -114,16 +114,6 @@ StorageEdge StorageAccessProxy::getEdgeById(Id edgeId) const
|
||||
return StorageEdge();
|
||||
}
|
||||
|
||||
bool StorageAccessProxy::checkEdgeExists(Id edgeId) const
|
||||
{
|
||||
if (hasSubject())
|
||||
{
|
||||
return m_subject->checkEdgeExists(edgeId);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
std::shared_ptr<SourceLocationCollection> StorageAccessProxy::getFullTextSearchLocations(
|
||||
const std::string &searchTerm, bool caseSensitive) const
|
||||
{
|
||||
|
||||
@@ -30,7 +30,6 @@ public:
|
||||
virtual Id getIdForEdge(
|
||||
Edge::EdgeType type, const NameHierarchy& fromNameHierarchy, const NameHierarchy& toNameHierarchy) const;
|
||||
virtual StorageEdge getEdgeById(Id edgeId) const;
|
||||
virtual bool checkEdgeExists(Id edgeId) const;
|
||||
|
||||
virtual std::shared_ptr<SourceLocationCollection> getFullTextSearchLocations(
|
||||
const std::string& searchTerm, bool caseSensitive) const;
|
||||
|
||||
@@ -14,7 +14,7 @@ public:
|
||||
NODES,
|
||||
EDGES
|
||||
};
|
||||
|
||||
|
||||
enum BookmarkOrder
|
||||
{
|
||||
NONE = 0,
|
||||
@@ -30,6 +30,12 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
MessageDisplayBookmarks()
|
||||
: filter(MessageDisplayBookmarks::BookmarkFilter::ALL)
|
||||
, order(MessageDisplayBookmarks::BookmarkOrder::NONE)
|
||||
{
|
||||
}
|
||||
|
||||
static const std::string getStaticType()
|
||||
{
|
||||
return "MessageDisplayBookmarks";
|
||||
|
||||
@@ -10,8 +10,6 @@ add_files(
|
||||
qt/element/QtAutocompletionList.h
|
||||
qt/element/QtBookmark.cpp
|
||||
qt/element/QtBookmark.h
|
||||
qt/element/QtBookmarkBar.cpp
|
||||
qt/element/QtBookmarkBar.h
|
||||
qt/element/QtBookmarkCategory.cpp
|
||||
qt/element/QtBookmarkCategory.h
|
||||
qt/element/QtCodeArea.cpp
|
||||
|
||||
@@ -7,16 +7,16 @@
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "utility/messaging/type/MessageActivateBookmark.h"
|
||||
#include "utility/messaging/type/MessageDeleteBookmark.h"
|
||||
#include "utility/messaging/type/MessageDisplayBookmarkEditor.h"
|
||||
#include "utility/ResourcePaths.h"
|
||||
|
||||
#include "data/bookmark/EdgeBookmark.h"
|
||||
#include "qt/window/QtBookmarkCreator.h"
|
||||
#include "qt/utility/utilityQt.h"
|
||||
|
||||
QtBookmark::QtBookmark()
|
||||
: m_treeWidgetItem(NULL)
|
||||
, m_arrowImageName("arrow_right.png")
|
||||
, m_arrowImageName("arrow_line_down.png")
|
||||
, m_hovered(false)
|
||||
, m_ignoreNextResize(false)
|
||||
{
|
||||
@@ -33,21 +33,21 @@ QtBookmark::QtBookmark()
|
||||
buttonsLayout->setContentsMargins(0, 0, 0, 0);
|
||||
buttonsLayout->setAlignment(Qt::AlignTop);
|
||||
|
||||
m_toggleCommentButton = new QPushButton();
|
||||
m_toggleCommentButton->setObjectName("comment_button");
|
||||
m_toggleCommentButton->setToolTip("Show Comment");
|
||||
m_toggleCommentButton->setAttribute(Qt::WA_LayoutUsesWidgetRect);
|
||||
m_toggleCommentButton->setIconSize(QSize(10, 10));
|
||||
utility::setWidgetRetainsSpaceWhenHidden(m_toggleCommentButton);
|
||||
buttonsLayout->addWidget(m_toggleCommentButton);
|
||||
updateArrow();
|
||||
|
||||
m_activateButton = new QPushButton();
|
||||
m_activateButton->setObjectName("activate_button");
|
||||
m_activateButton->setToolTip("Activate bookmark");
|
||||
m_activateButton->setAttribute(Qt::WA_LayoutUsesWidgetRect);
|
||||
buttonsLayout->addWidget(m_activateButton);
|
||||
|
||||
m_toggleCommentButton = new QPushButton();
|
||||
m_toggleCommentButton->setObjectName("comment_button");
|
||||
m_toggleCommentButton->setToolTip("Show Comment");
|
||||
m_toggleCommentButton->setAttribute(Qt::WA_LayoutUsesWidgetRect);
|
||||
m_toggleCommentButton->setIconSize(QSize(20, 20));
|
||||
utility::setWidgetRetainsSpaceWhenHidden(m_toggleCommentButton);
|
||||
buttonsLayout->addWidget(m_toggleCommentButton);
|
||||
updateArrow();
|
||||
|
||||
buttonsLayout->addStretch();
|
||||
|
||||
m_dateLabel = new QLabel();
|
||||
@@ -58,6 +58,7 @@ QtBookmark::QtBookmark()
|
||||
m_editButton->setObjectName("edit_button");
|
||||
m_editButton->setToolTip("Edit bookmark");
|
||||
m_editButton->setAttribute(Qt::WA_LayoutUsesWidgetRect);
|
||||
m_editButton->setIconSize(QSize(20, 20));
|
||||
m_editButton->setIcon(QPixmap((ResourcePaths::getGuiPath() + "bookmark_view/images/bookmark_edit_icon.png").c_str()));
|
||||
utility::setWidgetRetainsSpaceWhenHidden(m_editButton);
|
||||
m_editButton->hide();
|
||||
@@ -67,6 +68,7 @@ QtBookmark::QtBookmark()
|
||||
m_deleteButton->setObjectName("delete_button");
|
||||
m_deleteButton->setToolTip("Delete bookmark");
|
||||
m_deleteButton->setAttribute(Qt::WA_LayoutUsesWidgetRect);
|
||||
m_deleteButton->setIconSize(QSize(20, 20));
|
||||
m_deleteButton->setIcon(QPixmap((ResourcePaths::getGuiPath() + "bookmark_view/images/bookmark_delete_icon.png").c_str()));
|
||||
utility::setWidgetRetainsSpaceWhenHidden(m_deleteButton);
|
||||
m_deleteButton->hide();
|
||||
@@ -144,13 +146,13 @@ void QtBookmark::commentToggled()
|
||||
|
||||
if (m_comment->isVisible() == false)
|
||||
{
|
||||
m_arrowImageName = "arrow_down.png";
|
||||
m_arrowImageName = "arrow_line_up.png";
|
||||
m_comment->show();
|
||||
m_comment->setMinimumHeight(m_comment->heightForWidth(m_comment->width()));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_arrowImageName = "arrow_right.png";
|
||||
m_arrowImageName = "arrow_line_down.png";
|
||||
m_comment->hide();
|
||||
}
|
||||
|
||||
@@ -231,21 +233,10 @@ void QtBookmark::elideButtonText()
|
||||
m_bookmark->getName().c_str(), Qt::ElideMiddle, m_activateButton->width() - 16));
|
||||
}
|
||||
|
||||
void QtBookmark::handleMessage(MessageEditBookmark* message)
|
||||
{
|
||||
if (m_bookmark->getId() == message->bookmarkId)
|
||||
{
|
||||
m_bookmark->setName(message->displayName);
|
||||
m_bookmark->setComment(message->comment);
|
||||
|
||||
m_activateButton->setText(message->displayName.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void QtBookmark::updateArrow()
|
||||
{
|
||||
QPixmap pixmap((ResourcePaths::getGuiPath() + "bookmark_view/images/" + m_arrowImageName).c_str());
|
||||
m_toggleCommentButton->setIcon(QIcon(utility::colorizePixmap(pixmap, m_hovered ? "black" : "#707070")));
|
||||
m_toggleCommentButton->setIcon(QIcon(utility::colorizePixmap(pixmap, m_hovered ? "#707070" : "black")));
|
||||
}
|
||||
|
||||
std::string QtBookmark::getDateString() const
|
||||
|
||||
@@ -4,18 +4,14 @@
|
||||
#include <QFrame>
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
|
||||
#include "utility/messaging/MessageListener.h"
|
||||
#include "utility/messaging/type/MessageDeleteBookmark.h"
|
||||
#include "utility/messaging/type/MessageEditBookmark.h"
|
||||
#include <QTreeWidget>
|
||||
|
||||
#include "data/bookmark/Bookmark.h"
|
||||
|
||||
#include <QTreeWidget>
|
||||
class Bookmark;
|
||||
|
||||
class QtBookmark
|
||||
: public QFrame
|
||||
, public MessageListener<MessageEditBookmark>
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -46,8 +42,6 @@ private slots:
|
||||
void elideButtonText();
|
||||
|
||||
private:
|
||||
void handleMessage(MessageEditBookmark* message) override;
|
||||
|
||||
void updateArrow();
|
||||
|
||||
std::string getDateString() const;
|
||||
|
||||
@@ -1,254 +0,0 @@
|
||||
#include "QtBookmarkBar.h"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QMessageBox>
|
||||
#include <QPushButton>
|
||||
|
||||
#include "data/bookmark/EdgeBookmark.h"
|
||||
|
||||
#include "utility/messaging/type/MessageDeleteBookmarkForActiveTokens.h"
|
||||
#include "utility/messaging/type/MessageDisplayBookmarks.h"
|
||||
#include "utility/messaging/type/MessageDisplayBookmarkCreator.h"
|
||||
#include "utility/ResourcePaths.h"
|
||||
|
||||
#include "qt/utility/utilityQt.h"
|
||||
#include "settings/ApplicationSettings.h"
|
||||
#include "settings/ColorScheme.h"
|
||||
|
||||
#include "qt/window/QtBookmarkCreator.h"
|
||||
|
||||
#include "qt/window/QtMainWindow.h"
|
||||
|
||||
#include "qt/element/QtBookmark.h"
|
||||
|
||||
QtBookmarkBar::QtBookmarkBar()
|
||||
: m_displayBookmarksFunctor(std::bind(&QtBookmarkBar::doDisplayBookmarks, this, std::placeholders::_1))
|
||||
, m_displayBookmarkCreatorFunctor(std::bind(&QtBookmarkBar::doDisplayBookmarkCreator, this, std::placeholders::_1, std::placeholders::_2))
|
||||
, m_displayBookmarkEditorFunctor(std::bind(&QtBookmarkBar::doDisplayBookmarkEditor, this, std::placeholders::_1, std::placeholders::_2))
|
||||
, m_setCreateButtonStateFunctor(std::bind(&QtBookmarkBar::doSetCreateButtonState, this, std::placeholders::_1))
|
||||
, m_enableDisplayButtonFunctor(std::bind(&QtBookmarkBar::doEnableDisplayButton, this, std::placeholders::_1))
|
||||
, m_bookmarkBrowser(NULL)
|
||||
, m_createButtonState(BookmarkView::CreateButtonState::CANNOT_CREATE)
|
||||
{
|
||||
setObjectName("bookmark_bar");
|
||||
|
||||
QBoxLayout* layout = new QHBoxLayout();
|
||||
layout->setSpacing(0);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->setAlignment(Qt::AlignTop);
|
||||
setLayout(layout);
|
||||
|
||||
m_createBookmarkButton = new QPushButton(this);
|
||||
m_createBookmarkButton->setObjectName("bookmark_button");
|
||||
m_createBookmarkButton->setToolTip("create a bookmark for the active symbol");
|
||||
m_createBookmarkButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
layout->addWidget(m_createBookmarkButton);
|
||||
|
||||
m_createBookmarkButton->setEnabled(false);
|
||||
|
||||
connect(m_createBookmarkButton, SIGNAL(clicked()), this, SLOT(createBookmarkClicked()));
|
||||
|
||||
m_showBookmarksButton = new QPushButton(this);
|
||||
m_showBookmarksButton->setObjectName("show_bookmark_button");
|
||||
m_showBookmarksButton->setToolTip("Show bookmarks");
|
||||
m_showBookmarksButton->setAttribute(Qt::WA_LayoutUsesWidgetRect);
|
||||
layout->addWidget(m_showBookmarksButton);
|
||||
|
||||
m_showBookmarksButton->setEnabled(false);
|
||||
|
||||
connect(m_showBookmarksButton, SIGNAL(clicked()), this, SLOT(showBookmarksClicked()));
|
||||
|
||||
refreshStyle();
|
||||
}
|
||||
|
||||
QtBookmarkBar::~QtBookmarkBar()
|
||||
{
|
||||
}
|
||||
|
||||
void QtBookmarkBar::refreshStyle()
|
||||
{
|
||||
float height = std::max(ApplicationSettings::getInstance()->getFontSize() + 16, 30);
|
||||
|
||||
m_createBookmarkButton->setFixedHeight(height);
|
||||
m_showBookmarksButton->setFixedHeight(height);
|
||||
|
||||
m_createBookmarkButton->setIcon(utility::createButtonIcon(
|
||||
ResourcePaths::getGuiPath() + "bookmark_view/images/edit_bookmark_icon.png",
|
||||
"search/button"
|
||||
));
|
||||
|
||||
m_showBookmarksButton->setIcon(utility::createButtonIcon(
|
||||
ResourcePaths::getGuiPath() + "bookmark_view/images/bookmark_list_icon.png",
|
||||
"search/button"
|
||||
));
|
||||
}
|
||||
|
||||
void QtBookmarkBar::displayBookmarks(const std::vector<std::shared_ptr<Bookmark>>& bookmarks)
|
||||
{
|
||||
m_displayBookmarksFunctor(bookmarks);
|
||||
}
|
||||
|
||||
void QtBookmarkBar::displayBookmarkCreator(const std::vector<std::string>& names, const std::vector<BookmarkCategory>& categories)
|
||||
{
|
||||
m_displayBookmarkCreatorFunctor(names, categories);
|
||||
}
|
||||
|
||||
void QtBookmarkBar::displayBookmarkEditor(std::shared_ptr<Bookmark> bookmark, const std::vector<BookmarkCategory>& categories)
|
||||
{
|
||||
m_displayBookmarkEditorFunctor(bookmark, categories);
|
||||
}
|
||||
|
||||
void QtBookmarkBar::setCreateButtonState(const BookmarkView::CreateButtonState& state)
|
||||
{
|
||||
m_setCreateButtonStateFunctor(state);
|
||||
}
|
||||
|
||||
void QtBookmarkBar::enableDisplayButton(bool enable)
|
||||
{
|
||||
m_enableDisplayButtonFunctor(enable);
|
||||
}
|
||||
|
||||
bool QtBookmarkBar::bookmarkBrowserIsVisible() const
|
||||
{
|
||||
if (m_bookmarkBrowser != NULL)
|
||||
{
|
||||
return m_bookmarkBrowser->isVisible();
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void QtBookmarkBar::createBookmarkClicked()
|
||||
{
|
||||
if (m_createButtonState == BookmarkView::CreateButtonState::CAN_CREATE)
|
||||
{
|
||||
MessageDisplayBookmarkCreator().dispatch();
|
||||
}
|
||||
else if (m_createButtonState == BookmarkView::CreateButtonState::ALREADY_CREATED)
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("Edit Bookmark");
|
||||
msgBox.setInformativeText("Do you want to update or delete the Bookmark for the active Token?");
|
||||
msgBox.addButton("Edit", QMessageBox::ButtonRole::YesRole);
|
||||
msgBox.addButton("Delete", QMessageBox::ButtonRole::DestructiveRole);
|
||||
msgBox.addButton("Cancel", QMessageBox::ButtonRole::NoRole);
|
||||
msgBox.setIcon(QMessageBox::Icon::Question);
|
||||
int ret = msgBox.exec();
|
||||
|
||||
if (ret == 0) // QMessageBox::Yes
|
||||
{
|
||||
MessageDisplayBookmarkCreator().dispatch();
|
||||
}
|
||||
else if (ret == 1)
|
||||
{
|
||||
MessageDeleteBookmarkForActiveTokens().dispatch();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QtBookmarkBar::showBookmarksClicked()
|
||||
{
|
||||
MessageDisplayBookmarks(MessageDisplayBookmarks::BookmarkFilter::ALL, MessageDisplayBookmarks::BookmarkOrder::NONE).dispatch();
|
||||
}
|
||||
|
||||
void QtBookmarkBar::handleMessage(MessageEnteredLicense* message)
|
||||
{
|
||||
m_onQtThread(
|
||||
[=]()
|
||||
{
|
||||
// actually only want to enable this when a project is loaded
|
||||
// maybe factor in licence later...
|
||||
// m_createBookmarkButton->setEnabled(true);
|
||||
// m_showBookmarksButton->setEnabled(true);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void QtBookmarkBar::doDisplayBookmarkCreator(const std::vector<std::string>& names, const std::vector<BookmarkCategory>& categories)
|
||||
{
|
||||
QtBookmarkCreator* bookmarkCreator = new QtBookmarkCreator();
|
||||
bookmarkCreator->setupBookmarkCreator();
|
||||
|
||||
std::string displayName = "";
|
||||
|
||||
for (unsigned int i = 0; i < names.size(); i++)
|
||||
{
|
||||
displayName += names[i];
|
||||
|
||||
if (i < names.size() - 1)
|
||||
{
|
||||
displayName += "; ";
|
||||
}
|
||||
}
|
||||
|
||||
bookmarkCreator->setDisplayName(displayName);
|
||||
bookmarkCreator->setBookmarkCategories(categories);
|
||||
bookmarkCreator->show();
|
||||
bookmarkCreator->raise();
|
||||
}
|
||||
|
||||
void QtBookmarkBar::doDisplayBookmarkEditor(std::shared_ptr<Bookmark> bookmark, const std::vector<BookmarkCategory>& categories)
|
||||
{
|
||||
QtBookmarkCreator* bookmarkCreator = new QtBookmarkCreator(NULL, true, bookmark->getId());
|
||||
bookmarkCreator->setupBookmarkCreator();
|
||||
bookmarkCreator->setDisplayName(bookmark->getName());
|
||||
bookmarkCreator->setComment(bookmark->getComment());
|
||||
bookmarkCreator->setBookmarkCategories(categories);
|
||||
bookmarkCreator->setCurrentBookmarkCategory(bookmark->getCategory());
|
||||
bookmarkCreator->setIsEdge((dynamic_cast<EdgeBookmark*>(bookmark.get()) != NULL));
|
||||
|
||||
bookmarkCreator->show();
|
||||
bookmarkCreator->raise();
|
||||
}
|
||||
|
||||
void QtBookmarkBar::doDisplayBookmarks(const std::vector<std::shared_ptr<Bookmark>>& bookmarks)
|
||||
{
|
||||
if (m_bookmarkBrowser == NULL)
|
||||
{
|
||||
m_bookmarkBrowser = new QtBookmarkBrowser();
|
||||
m_bookmarkBrowser->setupBookmarkBrowser();
|
||||
}
|
||||
|
||||
m_bookmarkBrowser->setBookmarks(bookmarks);
|
||||
m_bookmarkBrowser->show();
|
||||
m_bookmarkBrowser->raise();
|
||||
}
|
||||
|
||||
void QtBookmarkBar::doSetCreateButtonState(const BookmarkView::CreateButtonState& state)
|
||||
{
|
||||
m_createButtonState = state;
|
||||
|
||||
m_createBookmarkButton->setIcon(utility::createButtonIcon(
|
||||
ResourcePaths::getGuiPath() + "bookmark_view/images/edit_bookmark_icon.png",
|
||||
"search/button"
|
||||
));
|
||||
|
||||
if (state == BookmarkView::CreateButtonState::CAN_CREATE)
|
||||
{
|
||||
m_createBookmarkButton->setEnabled(true);
|
||||
}
|
||||
else if (state == BookmarkView::CreateButtonState::CANNOT_CREATE)
|
||||
{
|
||||
m_createBookmarkButton->setEnabled(false);
|
||||
}
|
||||
else if (state == BookmarkView::CreateButtonState::ALREADY_CREATED)
|
||||
{
|
||||
m_createBookmarkButton->setEnabled(true);
|
||||
|
||||
m_createBookmarkButton->setIcon(utility::createButtonIcon(
|
||||
ResourcePaths::getGuiPath() + "bookmark_view/images/bookmark_active.png",
|
||||
"search/button"
|
||||
));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_createBookmarkButton->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void QtBookmarkBar::doEnableDisplayButton(bool enable)
|
||||
{
|
||||
m_showBookmarksButton->setEnabled(enable);
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
#ifndef QT_BOOKMARK_BAR_H
|
||||
#define QT_BOOKMARK_BAR_H
|
||||
|
||||
#include <QFrame>
|
||||
#include <qtextedit.h>
|
||||
|
||||
#include "data/bookmark/Bookmark.h"
|
||||
|
||||
#include "component/view/BookmarkView.h"
|
||||
#include "qt/window/QtBookmarkBrowser.h"
|
||||
#include "qt/utility/QtThreadedFunctor.h"
|
||||
#include "utility/messaging/type/MessageEnteredLicense.h"
|
||||
#include "utility/messaging/MessageListener.h"
|
||||
|
||||
#include "data/bookmark/Bookmark.h"
|
||||
|
||||
class QPushButton;
|
||||
|
||||
class QtBookmarkBar
|
||||
: public QFrame
|
||||
, public MessageListener<MessageEnteredLicense>
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtBookmarkBar();
|
||||
virtual ~QtBookmarkBar();
|
||||
|
||||
void refreshStyle();
|
||||
|
||||
virtual void displayBookmarks(const std::vector<std::shared_ptr<Bookmark>>& bookmarks);
|
||||
virtual void displayBookmarkCreator(const std::vector<std::string>& names, const std::vector<BookmarkCategory>& categories);
|
||||
virtual void displayBookmarkEditor(std::shared_ptr<Bookmark> bookmark, const std::vector<BookmarkCategory>& categories);
|
||||
|
||||
void setCreateButtonState(const BookmarkView::CreateButtonState& state);
|
||||
void enableDisplayButton(bool enable);
|
||||
|
||||
bool bookmarkBrowserIsVisible() const;
|
||||
|
||||
private slots:
|
||||
void createBookmarkClicked();
|
||||
void showBookmarksClicked();
|
||||
|
||||
private:
|
||||
virtual void handleMessage(MessageEnteredLicense* message);
|
||||
|
||||
void doDisplayBookmarks(const std::vector<std::shared_ptr<Bookmark>>& bookmarks);
|
||||
void doDisplayBookmarkCreator(const std::vector<std::string>& names, const std::vector<BookmarkCategory>& categories);
|
||||
void doDisplayBookmarkEditor(std::shared_ptr<Bookmark> bookmark, const std::vector<BookmarkCategory>& categories);
|
||||
void doSetCreateButtonState(const BookmarkView::CreateButtonState& state);
|
||||
void doEnableDisplayButton(bool enable);
|
||||
|
||||
QtThreadedLambdaFunctor m_onQtThread;
|
||||
|
||||
QPushButton* m_createBookmarkButton;
|
||||
QPushButton* m_showBookmarksButton;
|
||||
|
||||
QtThreadedFunctor<std::vector<std::shared_ptr<Bookmark>>> m_displayBookmarksFunctor;
|
||||
QtThreadedFunctor<std::vector<std::string>, std::vector<BookmarkCategory>> m_displayBookmarkCreatorFunctor;
|
||||
QtThreadedFunctor<std::shared_ptr<Bookmark>, std::vector<BookmarkCategory>> m_displayBookmarkEditorFunctor;
|
||||
QtThreadedFunctor<BookmarkView::CreateButtonState> m_setCreateButtonStateFunctor;
|
||||
QtThreadedFunctor<bool> m_enableDisplayButtonFunctor;
|
||||
|
||||
QtBookmarkBrowser* m_bookmarkBrowser;
|
||||
|
||||
BookmarkView::CreateButtonState m_createButtonState;
|
||||
};
|
||||
|
||||
#endif // QT_BOOKMARK_BAR_H
|
||||
@@ -24,7 +24,7 @@ QtBookmarkCategory::QtBookmarkCategory()
|
||||
m_expandButton->setToolTip("Show/Hide bookmarks in this category");
|
||||
m_expandButton->setAttribute(Qt::WA_LayoutUsesWidgetRect);
|
||||
m_expandButton->setIcon(QPixmap((ResourcePaths::getGuiPath() + "bookmark_view/images/arrow_down.png").c_str()));
|
||||
m_expandButton->setIconSize(QSize(10, 10));
|
||||
m_expandButton->setIconSize(QSize(8, 8));
|
||||
layout->addWidget(m_expandButton);
|
||||
|
||||
connect(m_expandButton, SIGNAL(clicked()), this, SLOT(expandClicked()));
|
||||
@@ -39,6 +39,7 @@ QtBookmarkCategory::QtBookmarkCategory()
|
||||
m_deleteButton->setObjectName("category_delete_button");
|
||||
m_deleteButton->setToolTip("Delete this Bookmark Category and the containing Bookmarks");
|
||||
m_deleteButton->setAttribute(Qt::WA_LayoutUsesWidgetRect);
|
||||
m_deleteButton->setIconSize(QSize(20, 20));
|
||||
m_deleteButton->setIcon(QPixmap((ResourcePaths::getGuiPath() + "bookmark_view/images/bookmark_delete_icon.png").c_str()));
|
||||
utility::setWidgetRetainsSpaceWhenHidden(m_deleteButton);
|
||||
m_deleteButton->hide();
|
||||
@@ -53,22 +54,12 @@ QtBookmarkCategory::~QtBookmarkCategory()
|
||||
|
||||
void QtBookmarkCategory::setName(const std::string& name)
|
||||
{
|
||||
if (m_name != NULL)
|
||||
{
|
||||
m_name->setText(name.c_str());
|
||||
}
|
||||
m_name->setText(name.c_str());
|
||||
}
|
||||
|
||||
std::string QtBookmarkCategory::getName() const
|
||||
{
|
||||
std::string result = "";
|
||||
|
||||
if (m_name != NULL)
|
||||
{
|
||||
result = m_name->text().toStdString();
|
||||
}
|
||||
|
||||
return result;
|
||||
return m_name->text().toStdString();
|
||||
}
|
||||
|
||||
void QtBookmarkCategory::setId(const Id id)
|
||||
@@ -107,15 +98,7 @@ void QtBookmarkCategory::expandClicked()
|
||||
{
|
||||
if (m_treeItem != NULL)
|
||||
{
|
||||
if (m_treeItem->isExpanded())
|
||||
{
|
||||
m_treeItem->setExpanded(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_treeItem->setExpanded(true);
|
||||
}
|
||||
|
||||
m_treeItem->setExpanded(!m_treeItem->isExpanded());
|
||||
updateArrow();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,26 +1,35 @@
|
||||
#include "qt/view/QtBookmarkView.h"
|
||||
|
||||
#include "qt/window/QtBookmarkBrowser.h"
|
||||
#include "qt/utility/utilityQt.h"
|
||||
#include <QFrame>
|
||||
#include <QHBoxLayout>
|
||||
#include <QMessageBox>
|
||||
#include <QPushButton>
|
||||
|
||||
#include "data/bookmark/EdgeBookmark.h"
|
||||
|
||||
#include "qt/utility/utilityQt.h"
|
||||
#include "qt/view/QtViewWidgetWrapper.h"
|
||||
#include "qt/window/QtBookmarkCreator.h"
|
||||
#include "qt/window/QtBookmarkBrowser.h"
|
||||
|
||||
#include "utility/messaging/type/MessageDeleteBookmarkForActiveTokens.h"
|
||||
#include "utility/messaging/type/MessageDisplayBookmarks.h"
|
||||
#include "utility/messaging/type/MessageDisplayBookmarkCreator.h"
|
||||
#include "utility/ResourcePaths.h"
|
||||
|
||||
#include "component/controller/RefreshController.h"
|
||||
#include "qt/view/QtViewWidgetWrapper.h"
|
||||
|
||||
#include "settings/ApplicationSettings.h"
|
||||
#include "settings/ColorScheme.h"
|
||||
|
||||
QtBookmarkView::QtBookmarkView(ViewLayout* viewLayout)
|
||||
: BookmarkView(viewLayout)
|
||||
, m_refreshViewFunctor(std::bind(&QtBookmarkView::doRefreshView, this))
|
||||
, m_bookmarkBrowser(nullptr)
|
||||
, m_createButtonState(BookmarkView::CreateButtonState::CANNOT_CREATE)
|
||||
{
|
||||
m_widget = new QtBookmarkBar();
|
||||
setStyleSheet();
|
||||
m_widget = new QFrame();
|
||||
}
|
||||
|
||||
QtBookmarkView::~QtBookmarkView()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void QtBookmarkView::createWidgetWrapper()
|
||||
@@ -30,33 +39,203 @@ void QtBookmarkView::createWidgetWrapper()
|
||||
|
||||
void QtBookmarkView::initView()
|
||||
{
|
||||
m_widget->setObjectName("bookmark_bar");
|
||||
|
||||
QBoxLayout* layout = new QHBoxLayout();
|
||||
layout->setSpacing(0);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->setAlignment(Qt::AlignTop);
|
||||
m_widget->setLayout(layout);
|
||||
|
||||
m_createBookmarkButton = new QPushButton();
|
||||
m_createBookmarkButton->setObjectName("bookmark_button");
|
||||
m_createBookmarkButton->setToolTip("create a bookmark for the active symbol");
|
||||
m_createBookmarkButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
m_createBookmarkButton->setEnabled(false);
|
||||
layout->addWidget(m_createBookmarkButton);
|
||||
|
||||
connect(m_createBookmarkButton, SIGNAL(clicked()), this, SLOT(createBookmarkClicked()));
|
||||
|
||||
m_showBookmarksButton = new QPushButton();
|
||||
m_showBookmarksButton->setObjectName("show_bookmark_button");
|
||||
m_showBookmarksButton->setToolTip("Show bookmarks");
|
||||
m_showBookmarksButton->setAttribute(Qt::WA_LayoutUsesWidgetRect);
|
||||
m_showBookmarksButton->setEnabled(false);
|
||||
layout->addWidget(m_showBookmarksButton);
|
||||
|
||||
connect(m_showBookmarksButton, SIGNAL(clicked()), this, SLOT(showBookmarksClicked()));
|
||||
|
||||
setStyleSheet();
|
||||
refreshStyle();
|
||||
}
|
||||
|
||||
void QtBookmarkView::refreshView()
|
||||
{
|
||||
m_refreshViewFunctor();
|
||||
m_onQtThread(
|
||||
[=]()
|
||||
{
|
||||
setStyleSheet();
|
||||
refreshStyle();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void QtBookmarkView::setCreateButtonState(const CreateButtonState& state)
|
||||
{
|
||||
m_widget->setCreateButtonState(state);
|
||||
m_onQtThread(
|
||||
[=]()
|
||||
{
|
||||
m_createButtonState = state;
|
||||
|
||||
m_createBookmarkButton->setIcon(utility::createButtonIcon(
|
||||
ResourcePaths::getGuiPath() + "bookmark_view/images/edit_bookmark_icon.png",
|
||||
"search/button"
|
||||
));
|
||||
|
||||
if (state == BookmarkView::CreateButtonState::CAN_CREATE)
|
||||
{
|
||||
m_createBookmarkButton->setEnabled(true);
|
||||
}
|
||||
else if (state == BookmarkView::CreateButtonState::CANNOT_CREATE)
|
||||
{
|
||||
m_createBookmarkButton->setEnabled(false);
|
||||
}
|
||||
else if (state == BookmarkView::CreateButtonState::ALREADY_CREATED)
|
||||
{
|
||||
m_createBookmarkButton->setEnabled(true);
|
||||
|
||||
m_createBookmarkButton->setIcon(utility::createButtonIcon(
|
||||
ResourcePaths::getGuiPath() + "bookmark_view/images/bookmark_active.png",
|
||||
"search/button"
|
||||
));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_createBookmarkButton->setEnabled(false);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void QtBookmarkView::enableDisplayBookmarks(bool enable)
|
||||
{
|
||||
m_widget->enableDisplayButton(enable);
|
||||
m_onQtThread(
|
||||
[=]()
|
||||
{
|
||||
m_showBookmarksButton->setEnabled(enable);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
bool QtBookmarkView::bookmarkBrowserIsVisible() const
|
||||
{
|
||||
return m_widget->bookmarkBrowserIsVisible();
|
||||
if (m_bookmarkBrowser != nullptr)
|
||||
{
|
||||
return m_bookmarkBrowser->isVisible();
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void QtBookmarkView::doRefreshView()
|
||||
void QtBookmarkView::createBookmarkClicked()
|
||||
{
|
||||
setStyleSheet();
|
||||
m_widget->refreshStyle();
|
||||
if (m_createButtonState == BookmarkView::CreateButtonState::CAN_CREATE)
|
||||
{
|
||||
MessageDisplayBookmarkCreator().dispatch();
|
||||
}
|
||||
else if (m_createButtonState == BookmarkView::CreateButtonState::ALREADY_CREATED)
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("Edit Bookmark");
|
||||
msgBox.setInformativeText("Do you want to edit or delete the bookmark for this symbol?");
|
||||
msgBox.addButton("Edit", QMessageBox::ButtonRole::YesRole);
|
||||
msgBox.addButton("Delete", QMessageBox::ButtonRole::NoRole);
|
||||
QPushButton* cancelButton = msgBox.addButton("Cancel", QMessageBox::ButtonRole::RejectRole);
|
||||
msgBox.setDefaultButton(cancelButton);
|
||||
msgBox.setIcon(QMessageBox::Icon::Question);
|
||||
int ret = msgBox.exec();
|
||||
|
||||
if (ret == 0) // QMessageBox::Yes
|
||||
{
|
||||
MessageDisplayBookmarkCreator().dispatch();
|
||||
}
|
||||
else if (ret == 1)
|
||||
{
|
||||
MessageDeleteBookmarkForActiveTokens().dispatch();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QtBookmarkView::showBookmarksClicked()
|
||||
{
|
||||
MessageDisplayBookmarks().dispatch();
|
||||
}
|
||||
|
||||
void QtBookmarkView::displayBookmarks(const std::vector<std::shared_ptr<Bookmark>>& bookmarks)
|
||||
{
|
||||
m_onQtThread(
|
||||
[=]()
|
||||
{
|
||||
if (m_bookmarkBrowser == nullptr)
|
||||
{
|
||||
m_bookmarkBrowser = new QtBookmarkBrowser();
|
||||
m_bookmarkBrowser->setupBookmarkBrowser();
|
||||
}
|
||||
|
||||
m_bookmarkBrowser->setBookmarks(bookmarks);
|
||||
m_bookmarkBrowser->show();
|
||||
m_bookmarkBrowser->raise();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void QtBookmarkView::displayBookmarkCreator(const std::vector<std::string>& names, const std::vector<BookmarkCategory>& categories)
|
||||
{
|
||||
m_onQtThread(
|
||||
[=]()
|
||||
{
|
||||
QtBookmarkCreator* bookmarkCreator = new QtBookmarkCreator();
|
||||
bookmarkCreator->setupBookmarkCreator();
|
||||
|
||||
std::string displayName = "";
|
||||
|
||||
for (unsigned int i = 0; i < names.size(); i++)
|
||||
{
|
||||
displayName += names[i];
|
||||
|
||||
if (i < names.size() - 1)
|
||||
{
|
||||
displayName += "; ";
|
||||
}
|
||||
}
|
||||
|
||||
bookmarkCreator->setDisplayName(displayName);
|
||||
bookmarkCreator->setBookmarkCategories(categories);
|
||||
bookmarkCreator->show();
|
||||
bookmarkCreator->raise();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void QtBookmarkView::displayBookmarkEditor(std::shared_ptr<Bookmark> bookmark, const std::vector<BookmarkCategory>& categories)
|
||||
{
|
||||
m_onQtThread(
|
||||
[=]()
|
||||
{
|
||||
QtBookmarkCreator* bookmarkCreator = new QtBookmarkCreator(nullptr, true, bookmark->getId());
|
||||
bookmarkCreator->setupBookmarkCreator();
|
||||
bookmarkCreator->setDisplayName(bookmark->getName());
|
||||
bookmarkCreator->setComment(bookmark->getComment());
|
||||
bookmarkCreator->setBookmarkCategories(categories);
|
||||
bookmarkCreator->setCurrentBookmarkCategory(bookmark->getCategory());
|
||||
bookmarkCreator->setIsEdge((dynamic_cast<EdgeBookmark*>(bookmark.get()) != nullptr));
|
||||
|
||||
bookmarkCreator->show();
|
||||
bookmarkCreator->raise();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void QtBookmarkView::setStyleSheet()
|
||||
@@ -64,17 +243,20 @@ void QtBookmarkView::setStyleSheet()
|
||||
m_widget->setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath() + "bookmark_view/bookmark_view.css").c_str());
|
||||
}
|
||||
|
||||
void QtBookmarkView::displayBookmarks(const std::vector<std::shared_ptr<Bookmark>>& bookmarks)
|
||||
void QtBookmarkView::refreshStyle()
|
||||
{
|
||||
m_widget->displayBookmarks(bookmarks);
|
||||
}
|
||||
float height = std::max(ApplicationSettings::getInstance()->getFontSize() + 16, 30);
|
||||
|
||||
void QtBookmarkView::displayBookmarkCreator(const std::vector<std::string>& names, const std::vector<BookmarkCategory>& categories)
|
||||
{
|
||||
m_widget->displayBookmarkCreator(names, categories);
|
||||
}
|
||||
m_createBookmarkButton->setFixedHeight(height);
|
||||
m_showBookmarksButton->setFixedHeight(height);
|
||||
|
||||
void QtBookmarkView::displayBookmarkEditor(std::shared_ptr<Bookmark> bookmark, const std::vector<BookmarkCategory>& categories)
|
||||
{
|
||||
m_widget->displayBookmarkEditor(bookmark, categories);
|
||||
}
|
||||
m_createBookmarkButton->setIcon(utility::createButtonIcon(
|
||||
ResourcePaths::getGuiPath() + "bookmark_view/images/edit_bookmark_icon.png",
|
||||
"search/button"
|
||||
));
|
||||
|
||||
m_showBookmarksButton->setIcon(utility::createButtonIcon(
|
||||
ResourcePaths::getGuiPath() + "bookmark_view/images/bookmark_list_icon.png",
|
||||
"search/button"
|
||||
));
|
||||
}
|
||||
|
||||
@@ -3,12 +3,18 @@
|
||||
|
||||
#include "component/view/BookmarkView.h"
|
||||
|
||||
#include "qt/element/QtBookmarkBar.h"
|
||||
#include "qt/utility/QtThreadedFunctor.h"
|
||||
|
||||
class QFrame;
|
||||
class QPushButton;
|
||||
class QtBookmarkBrowser;
|
||||
|
||||
class QtBookmarkView
|
||||
: public BookmarkView
|
||||
: public QObject
|
||||
, public BookmarkView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtBookmarkView(ViewLayout* viewLayout);
|
||||
virtual ~QtBookmarkView();
|
||||
@@ -22,19 +28,29 @@ public:
|
||||
virtual void enableDisplayBookmarks(bool enable);
|
||||
|
||||
virtual bool bookmarkBrowserIsVisible() const;
|
||||
|
||||
|
||||
private slots:
|
||||
void createBookmarkClicked();
|
||||
void showBookmarksClicked();
|
||||
|
||||
private:
|
||||
void doRefreshView();
|
||||
|
||||
void setStyleSheet();
|
||||
|
||||
virtual void displayBookmarks(const std::vector<std::shared_ptr<Bookmark>>& bookmarks);
|
||||
virtual void displayBookmarkCreator(const std::vector<std::string>& names, const std::vector<BookmarkCategory>& categories);
|
||||
virtual void displayBookmarkEditor(std::shared_ptr<Bookmark> bookmark, const std::vector<BookmarkCategory>& categories);
|
||||
|
||||
QtThreadedFunctor<> m_refreshViewFunctor;
|
||||
void setStyleSheet();
|
||||
void refreshStyle();
|
||||
|
||||
QtBookmarkBar* m_widget;
|
||||
QtThreadedLambdaFunctor m_onQtThread;
|
||||
|
||||
QFrame* m_widget;
|
||||
|
||||
QPushButton* m_createBookmarkButton;
|
||||
QPushButton* m_showBookmarksButton;
|
||||
|
||||
QtBookmarkBrowser* m_bookmarkBrowser;
|
||||
|
||||
BookmarkView::CreateButtonState m_createButtonState;
|
||||
};
|
||||
|
||||
#endif // QT_BOOKMARK_VIEW_H
|
||||
#endif // QT_BOOKMARK_VIEW_H
|
||||
|
||||
@@ -482,6 +482,11 @@ void QtGraphView::doRebuildGraph(
|
||||
finishedTransition();
|
||||
}
|
||||
|
||||
if (graph)
|
||||
{
|
||||
m_graph = graph;
|
||||
}
|
||||
|
||||
QGraphicsView* view = getView();
|
||||
|
||||
size_t activeNodeCount = 0;
|
||||
@@ -504,7 +509,8 @@ void QtGraphView::doRebuildGraph(
|
||||
}
|
||||
}
|
||||
|
||||
if (graph->getTrailMode() == Graph::TRAIL_NONE)
|
||||
Graph::TrailMode trailMode = m_graph ? m_graph->getTrailMode() : Graph::TRAIL_NONE;
|
||||
if (trailMode == Graph::TRAIL_NONE)
|
||||
{
|
||||
QPointF center = itemsBoundingRect(m_nodes).center();
|
||||
Vec2i o = GraphViewStyle::alignOnRaster(Vec2i(center.x(), center.y()));
|
||||
@@ -524,7 +530,7 @@ void QtGraphView::doRebuildGraph(
|
||||
{
|
||||
if (!edge->data || !edge->data->isType(Edge::EDGE_AGGREGATION))
|
||||
{
|
||||
createEdge(view, edge.get(), &visibleEdgeIds, graph->getTrailMode());
|
||||
createEdge(view, edge.get(), &visibleEdgeIds, trailMode);
|
||||
}
|
||||
}
|
||||
for (std::shared_ptr<DummyEdge> edge : edges)
|
||||
@@ -535,12 +541,6 @@ void QtGraphView::doRebuildGraph(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (graph)
|
||||
{
|
||||
m_graph = graph;
|
||||
}
|
||||
|
||||
m_centerActiveNode = params.centerActiveNode;
|
||||
m_scrollToTop = params.scrollToTop;
|
||||
m_isIndexedList = params.isIndexedList;
|
||||
|
||||
@@ -73,10 +73,10 @@ void QtBookmarkBrowser::setupBookmarkBrowser()
|
||||
orderLabel->setObjectName("order_label");
|
||||
headerLayout->addWidget(orderLabel);
|
||||
|
||||
m_orderNames.push_back("Date des.");
|
||||
m_orderNames.push_back("Date asc.");
|
||||
m_orderNames.push_back("Name des.");
|
||||
m_orderNames.push_back("Name asc.");
|
||||
m_orderNames.push_back("Name des.");
|
||||
m_orderNames.push_back("Date asc.");
|
||||
m_orderNames.push_back("Date des.");
|
||||
|
||||
m_orderComboBox = new QComboBox(this);
|
||||
// m_orderComboBox->setToolTip("Select Bookmark Order");
|
||||
@@ -105,8 +105,6 @@ void QtBookmarkBrowser::setupBookmarkBrowser()
|
||||
m_bookmarkTree->setIndentation(0);
|
||||
m_bookmarkTree->setHeaderLabel("Bookmarks");
|
||||
|
||||
connect(m_bookmarkTree, SIGNAL(itemExpanded(QTreeWidgetItem*)), this, SLOT(categoryExpansionChanged(QTreeWidgetItem*)));
|
||||
connect(m_bookmarkTree, SIGNAL(itemCollapsed(QTreeWidgetItem*)), this, SLOT(categoryExpansionChanged(QTreeWidgetItem*)));
|
||||
connect(m_bookmarkTree, SIGNAL(itemClicked(QTreeWidgetItem*, int)), this, SLOT(treeItemClicked(QTreeWidgetItem*, int)));
|
||||
|
||||
bodyLayout->addWidget(m_bookmarkTree);
|
||||
@@ -124,21 +122,46 @@ void QtBookmarkBrowser::setupBookmarkBrowser()
|
||||
|
||||
void QtBookmarkBrowser::setBookmarks(const std::vector<std::shared_ptr<Bookmark>>& bookmarks)
|
||||
{
|
||||
std::map<QString, bool> wasCategoryExpanded;
|
||||
for (int i = 0; i < m_bookmarkTree->topLevelItemCount(); i++)
|
||||
{
|
||||
QTreeWidgetItem* item = m_bookmarkTree->topLevelItem(i);
|
||||
wasCategoryExpanded.emplace(item->whatsThis(0), item->isExpanded());
|
||||
}
|
||||
|
||||
m_bookmarkTree->clear();
|
||||
|
||||
std::map<std::string, BookmarkCategory> categoryNamesOrdered;
|
||||
for (std::shared_ptr<Bookmark> bookmark: bookmarks)
|
||||
{
|
||||
categoryNamesOrdered.emplace(bookmark->getCategory().getName(), bookmark->getCategory());
|
||||
}
|
||||
|
||||
for (auto p : categoryNamesOrdered)
|
||||
{
|
||||
findOrCreateTreeCategory(p.second);
|
||||
}
|
||||
|
||||
for (std::shared_ptr<Bookmark> bookmark: bookmarks)
|
||||
{
|
||||
QtBookmark* qtBookmark = new QtBookmark();
|
||||
qtBookmark->setBookmark(bookmark);
|
||||
|
||||
QTreeWidgetItem* top = findOrCreateTreeCategory(bookmark->getCategory());
|
||||
QTreeWidgetItem* treeWidgetItem = new QTreeWidgetItem(top);
|
||||
QTreeWidgetItem* categoryItem = findOrCreateTreeCategory(bookmark->getCategory());
|
||||
QTreeWidgetItem* treeWidgetItem = new QTreeWidgetItem(categoryItem);
|
||||
m_bookmarkTree->setItemWidget(treeWidgetItem, 0, qtBookmark);
|
||||
top->addChild(treeWidgetItem);
|
||||
categoryItem->addChild(treeWidgetItem);
|
||||
qtBookmark->setTreeWidgetItem(categoryItem);
|
||||
|
||||
qtBookmark->setTreeWidgetItem(top);
|
||||
bool wasExpanded = true;
|
||||
auto it = wasCategoryExpanded.find(categoryItem->whatsThis(0));
|
||||
if (it != wasCategoryExpanded.end())
|
||||
{
|
||||
wasExpanded = it->second;
|
||||
}
|
||||
|
||||
top->setExpanded(true);
|
||||
categoryItem->setExpanded(!wasExpanded);
|
||||
categoryItem->setExpanded(wasExpanded);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,15 +187,6 @@ void QtBookmarkBrowser::filterOrOrderChanged(const QString& text)
|
||||
MessageDisplayBookmarks(getSelectedFilter(), getSelectedOrder()).dispatch();
|
||||
}
|
||||
|
||||
void QtBookmarkBrowser::categoryExpansionChanged(QTreeWidgetItem* item)
|
||||
{
|
||||
QtBookmarkCategory* category = dynamic_cast<QtBookmarkCategory*>(m_bookmarkTree->itemWidget(item, 0));
|
||||
if (category != NULL)
|
||||
{
|
||||
category->updateArrow();
|
||||
}
|
||||
}
|
||||
|
||||
void QtBookmarkBrowser::treeItemClicked(QTreeWidgetItem* item, int column)
|
||||
{
|
||||
QtBookmarkCategory* category = dynamic_cast<QtBookmarkCategory*>(m_bookmarkTree->itemWidget(item, 0));
|
||||
@@ -190,16 +204,6 @@ void QtBookmarkBrowser::treeItemClicked(QTreeWidgetItem* item, int column)
|
||||
}
|
||||
}
|
||||
|
||||
void QtBookmarkBrowser::handleMessage(MessageDeleteBookmark* message)
|
||||
{
|
||||
MessageDisplayBookmarks(getSelectedFilter(), getSelectedOrder()).dispatch();
|
||||
}
|
||||
|
||||
void QtBookmarkBrowser::handleMessage(MessageEditBookmark* message)
|
||||
{
|
||||
MessageDisplayBookmarks(getSelectedFilter(), getSelectedOrder()).dispatch();
|
||||
}
|
||||
|
||||
MessageDisplayBookmarks::BookmarkFilter QtBookmarkBrowser::getSelectedFilter()
|
||||
{
|
||||
std::string text = m_filterComboBox->currentText().toStdString();
|
||||
|
||||
@@ -7,10 +7,7 @@
|
||||
|
||||
#include "qt/window/QtWindow.h"
|
||||
|
||||
#include "utility/messaging/MessageListener.h"
|
||||
#include "utility/messaging/type/MessageDeleteBookmark.h"
|
||||
#include "utility/messaging/type/MessageDisplayBookmarks.h"
|
||||
#include "utility/messaging/type/MessageEditBookmark.h"
|
||||
|
||||
class Bookmark;
|
||||
class BookmarkCategory;
|
||||
@@ -18,8 +15,6 @@ class QtBookmark;
|
||||
|
||||
class QtBookmarkBrowser
|
||||
: public QtWindow
|
||||
, public MessageListener<MessageDeleteBookmark>
|
||||
, public MessageListener<MessageEditBookmark>
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -38,13 +33,9 @@ protected:
|
||||
|
||||
private slots:
|
||||
void filterOrOrderChanged(const QString& text);
|
||||
void categoryExpansionChanged(QTreeWidgetItem* item);
|
||||
void treeItemClicked(QTreeWidgetItem* item, int column);
|
||||
|
||||
private:
|
||||
virtual void handleMessage(MessageDeleteBookmark* message) override;
|
||||
virtual void handleMessage(MessageEditBookmark* message) override;
|
||||
|
||||
MessageDisplayBookmarks::BookmarkFilter getSelectedFilter();
|
||||
MessageDisplayBookmarks::BookmarkOrder getSelectedOrder();
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "utility/file/FileSystem.h"
|
||||
#include "utility/logging/logging.h"
|
||||
#include "utility/messaging/type/MessageCodeReference.h"
|
||||
#include "utility/messaging/type/MessageDisplayBookmarkCreator.h"
|
||||
#include "utility/messaging/type/MessageDisplayBookmarks.h"
|
||||
#include "utility/messaging/type/MessageEnteredLicense.h"
|
||||
#include "utility/messaging/type/MessageFind.h"
|
||||
@@ -114,6 +115,7 @@ QtMainWindow::QtMainWindow()
|
||||
setupProjectMenu();
|
||||
setupEditMenu();
|
||||
setupViewMenu();
|
||||
setupBookmarksMenu();
|
||||
setupHelpMenu();
|
||||
|
||||
// Need to call loadLayout here for right DockWidget size on Linux
|
||||
@@ -578,6 +580,16 @@ void QtMainWindow::toggleShowDockWidgetTitleBars()
|
||||
setShowDockWidgetTitleBars(!m_showDockWidgetTitleBars);
|
||||
}
|
||||
|
||||
void QtMainWindow::showBookmarkCreator()
|
||||
{
|
||||
MessageDisplayBookmarkCreator().dispatch();
|
||||
}
|
||||
|
||||
void QtMainWindow::showBookmarkBrowser()
|
||||
{
|
||||
MessageDisplayBookmarks().dispatch();
|
||||
}
|
||||
|
||||
void QtMainWindow::setupProjectMenu()
|
||||
{
|
||||
QMenu *menu = new QMenu(tr("&Project"), this);
|
||||
@@ -677,6 +689,15 @@ void QtMainWindow::setupViewMenu()
|
||||
m_viewMenu = menu;
|
||||
}
|
||||
|
||||
void QtMainWindow::setupBookmarksMenu()
|
||||
{
|
||||
QMenu *menu = new QMenu(tr("&Bookmarks"), this);
|
||||
menuBar()->addMenu(menu);
|
||||
|
||||
menu->addAction(tr("Bookmark Active Symbols..."), this, SLOT(showBookmarkCreator()), QKeySequence(Qt::CTRL + Qt::Key_D));
|
||||
menu->addAction(tr("Bookmark Manager"), this, SLOT(showBookmarkBrowser()), QKeySequence(Qt::CTRL + Qt::Key_B));
|
||||
}
|
||||
|
||||
void QtMainWindow::setupHelpMenu()
|
||||
{
|
||||
QMenu *menu = new QMenu(tr("&Help"), this);
|
||||
|
||||
@@ -123,6 +123,9 @@ public slots:
|
||||
private slots:
|
||||
void toggleShowDockWidgetTitleBars();
|
||||
|
||||
void showBookmarkCreator();
|
||||
void showBookmarkBrowser();
|
||||
|
||||
private:
|
||||
struct DockWidget
|
||||
{
|
||||
@@ -135,6 +138,7 @@ private:
|
||||
void setupEditMenu();
|
||||
void setupProjectMenu();
|
||||
void setupViewMenu();
|
||||
void setupBookmarksMenu();
|
||||
void setupHelpMenu();
|
||||
|
||||
void setTrialActionsEnabled(bool enabled);
|
||||
|
||||