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:
@@ -15,8 +15,9 @@ UndoRedoController::UndoRedoController(StorageAccess* storageAccess)
|
||||
m_iterator = m_list.end();
|
||||
}
|
||||
|
||||
UndoRedoController::~UndoRedoController()
|
||||
Id UndoRedoController::getSchedulerId() const
|
||||
{
|
||||
return Controller::getTabId();
|
||||
}
|
||||
|
||||
UndoRedoView* UndoRedoController::getView()
|
||||
@@ -269,7 +270,10 @@ void UndoRedoController::handleMessage(MessageHistoryToPosition* message)
|
||||
else
|
||||
{
|
||||
replayCommand(m_iterator);
|
||||
MessageFlushUpdates(false).dispatch();
|
||||
|
||||
MessageFlushUpdates msg(false);
|
||||
msg.setSchedulerId(getSchedulerId());
|
||||
msg.dispatch();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -359,7 +363,9 @@ void UndoRedoController::handleMessage(MessageRefreshUI* message)
|
||||
{
|
||||
if (m_iterator == m_list.begin())
|
||||
{
|
||||
MessageActivateAll().dispatch();
|
||||
MessageActivateAll msg;
|
||||
msg.setSchedulerId(getSchedulerId());
|
||||
msg.dispatch();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -466,7 +472,9 @@ void UndoRedoController::replayCommands(std::list<Command>::iterator it)
|
||||
std::advance(it, 1);
|
||||
}
|
||||
|
||||
MessageFlushUpdates(keepsContent).dispatch();
|
||||
MessageFlushUpdates msg(keepsContent);
|
||||
msg.setSchedulerId(getSchedulerId());
|
||||
msg.dispatch();
|
||||
}
|
||||
|
||||
void UndoRedoController::replayCommand(std::list<Command>::iterator it)
|
||||
@@ -512,6 +520,7 @@ void UndoRedoController::replayCommand(std::list<Command>::iterator it)
|
||||
filter.unindexedFatal = false;
|
||||
|
||||
MessageActivateErrors msg(filter);
|
||||
msg.setSchedulerId(getSchedulerId());
|
||||
msg.setIsReplayed(true);
|
||||
msg.setIsLast(it == std::prev(m_iterator));
|
||||
msg.dispatch();
|
||||
@@ -608,34 +617,7 @@ MessageBase* UndoRedoController::lastMessage() const
|
||||
|
||||
void UndoRedoController::updateHistoryMenu(std::shared_ptr<MessageBase> message)
|
||||
{
|
||||
const size_t historyMenuSize = 20;
|
||||
|
||||
if (message && dynamic_cast<MessageActivateBase*>(message.get()))
|
||||
{
|
||||
std::vector<SearchMatch> matches = dynamic_cast<MessageActivateBase*>(message.get())->getSearchMatches();
|
||||
if (matches.size() && !matches[0].text.empty())
|
||||
{
|
||||
std::vector<std::shared_ptr<MessageBase>> history = { message };
|
||||
std::set<SearchMatch> uniqueMatches = { matches[0] };
|
||||
|
||||
for (std::shared_ptr<MessageBase> m : m_history)
|
||||
{
|
||||
if (uniqueMatches.insert(dynamic_cast<MessageActivateBase*>(m.get())->getSearchMatches()[0]).second)
|
||||
{
|
||||
history.push_back(m);
|
||||
|
||||
if (history.size() >= historyMenuSize)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_history = history;
|
||||
}
|
||||
}
|
||||
|
||||
Application::getInstance()->updateHistoryMenu(m_history);
|
||||
Application::getInstance()->updateHistoryMenu(message);
|
||||
}
|
||||
|
||||
void UndoRedoController::updateHistory()
|
||||
|
||||
Reference in New Issue
Block a user