src: miscellaneous bug fixes for upcoming release

* only randomize parsing order of source files for multithreaded indexing
* fixed overview not displayed when switching projects due to MessageScrollCode being dispatched
* avoid adding duplicate TokenLocations that causes highlighting to break in QtCodeArea
* clear all controllers when switching project
* maximize unindexed file when clicking title instead of activating it
This commit is contained in:
Eberhard Graether
2016-06-09 12:30:00 +02:00
parent 5173400b8d
commit 7e3b2622ec
33 changed files with 210 additions and 90 deletions
+14
View File
@@ -2,6 +2,7 @@
#include "component/controller/NetworkFactory.h"
#include "component/controller/Controller.h"
#include "component/view/CodeView.h"
#include "component/view/CompositeView.h"
#include "component/view/GraphView.h"
@@ -51,6 +52,19 @@ void ComponentManager::setup(ViewLayout* viewLayout)
m_components.push_back(featureComponent);
}
void ComponentManager::clearComponents()
{
for (std::shared_ptr<Component> component : m_components)
{
Controller* controller = component->getController<Controller>();
if (controller)
{
controller->clear();
}
}
}
void ComponentManager::refreshViews()
{
for (std::shared_ptr<Component> component : m_components)
+1
View File
@@ -23,6 +23,7 @@ public:
void setup(ViewLayout* viewLayout);
void clearComponents();
void refreshViews();
private:
@@ -103,8 +103,12 @@ void CodeController::handleMessage(MessageActivateTokens* message)
}
std::vector<Id> activeTokenIds = message->tokenIds;
Id declarationId = 0; // 0 means that no token is found.
if (!activeTokenIds.size())
{
return;
}
Id declarationId = 0; // 0 means that no token is found.
if (!message->isAggregation)
{
activeTokenIds = m_storageAccess->getActiveTokenIdsForId(activeTokenIds[0], &declarationId);
@@ -306,6 +310,13 @@ CodeView* CodeController::getView()
return Controller::getView<CodeView>();
}
void CodeController::clear()
{
getView()->clear();
m_collection.reset();
}
void CodeController::showContents(MessageBase* message)
{
if (!message->isReplayed())
@@ -61,6 +61,9 @@ private:
virtual void handleMessage(MessageShowScope* message);
CodeView* getView();
virtual void clear();
void showContents(MessageBase* message);
std::vector<CodeSnippetParams> getSnippetsForActiveTokenLocations(
+7 -3
View File
@@ -11,13 +11,14 @@ public:
void setComponent(Component* component);
virtual void clear() = 0;
protected:
template <typename ViewType>
ViewType* getView() const;
ViewType* getView() const;
private:
Component* m_component;
};
@@ -25,8 +26,11 @@ template <typename ViewType>
ViewType* Controller::getView() const
{
if (m_component)
{
return m_component->getView<ViewType>();
return NULL;
}
return nullptr;
}
#endif // CONTROLLER_H
@@ -19,6 +19,10 @@ FeatureController::~FeatureController()
{
}
void FeatureController::clear()
{
}
void FeatureController::handleMessage(MessageActivateEdge* message)
{
if (message->isAggregation())
@@ -61,9 +65,15 @@ void FeatureController::handleMessage(MessageActivateFile* message)
}
else
{
MessageActivateTokens m(message, std::vector<Id>());
m.unknownNames.push_back(message->filePath.fileName());
m.dispatchImmediately();
MessageChangeFileView msg(
message->filePath,
MessageChangeFileView::FILE_MAXIMIZED,
true,
true
);
msg.setIsReplayed(message->isReplayed());
msg.setKeepContent(message->keepContent());
msg.dispatchImmediately();
}
}
@@ -34,6 +34,8 @@ public:
FeatureController(StorageAccess* storageAccess);
~FeatureController();
virtual void clear();
private:
virtual void handleMessage(MessageActivateEdge* message);
virtual void handleMessage(MessageActivateFile* message);
@@ -186,6 +186,7 @@ void GraphController::clear()
m_activeEdgeIds.clear();
m_graph.reset();
getView()->clear();
}
@@ -58,7 +58,7 @@ private:
GraphView* getView() const;
void clear();
virtual void clear();
void createDummyGraphForTokenIds(const std::vector<Id>& tokenIds, const std::shared_ptr<Graph> graph);
std::shared_ptr<DummyNode> createDummyNodeTopDown(Node* node, Id parentId);
@@ -24,6 +24,10 @@ IDECommunicationController::~IDECommunicationController()
{
}
void IDECommunicationController::clear()
{
}
void IDECommunicationController::handleIncomingMessage(const std::string& message)
{
if (m_enabled == false)
@@ -20,6 +20,8 @@ public:
IDECommunicationController(StorageAccess* storageAccess);
virtual ~IDECommunicationController();
virtual void clear();
void handleIncomingMessage(const std::string& message);
bool getEnabled() const;
@@ -13,6 +13,10 @@ RefreshController::~RefreshController()
{
}
void RefreshController::clear()
{
}
void RefreshController::handleMessage(MessageAutoRefreshChanged* message)
{
m_autoRefreshEnabled = message->enabled;
@@ -17,6 +17,8 @@ public:
RefreshController();
virtual ~RefreshController();
virtual void clear();
private:
virtual void handleMessage(MessageAutoRefreshChanged* message);
virtual void handleMessage(MessageWindowFocus* message);
@@ -79,3 +79,8 @@ SearchView* SearchController::getView()
{
return Controller::getView<SearchView>();
}
void SearchController::clear()
{
getView()->setMatches(std::vector<SearchMatch>());
}
@@ -36,6 +36,8 @@ private:
SearchView* getView();
virtual void clear();
StorageAccess* m_storageAccess;
};
@@ -18,6 +18,12 @@ StatusBarView* StatusBarController::getView()
return Controller::getView<StatusBarView>();
}
void StatusBarController::clear()
{
getView()->setErrorCount(ErrorCountInfo());
getView()->showMessage("", false, false);
}
void StatusBarController::handleMessage(MessageClearErrorCount* message)
{
getView()->setErrorCount(ErrorCountInfo());
@@ -27,6 +27,8 @@ public:
StatusBarView* getView();
virtual void clear();
private:
virtual void handleMessage(MessageClearErrorCount* message);
virtual void handleMessage(MessageFinishedParsing* message);
@@ -22,6 +22,15 @@ UndoRedoView* UndoRedoController::getView()
return Controller::getView<UndoRedoView>();
}
void UndoRedoController::clear()
{
m_list.clear();
m_iterator = m_list.begin();
getView()->setUndoButtonEnabled(false);
getView()->setRedoButtonEnabled(false);
}
UndoRedoController::Command::Command(std::shared_ptr<MessageBase> message, Order order, bool replayLastOnly)
: message(message)
, order(order)
@@ -143,11 +152,6 @@ void UndoRedoController::handleMessage(MessageGraphNodeMove* message)
processCommand(command);
}
void UndoRedoController::handleMessage(MessageLoadProject* message)
{
clear();
}
void UndoRedoController::handleMessage(MessageRedo* message)
{
if (m_iterator == m_list.end())
@@ -326,6 +330,11 @@ void UndoRedoController::replayCommands(std::list<Command>::iterator it)
void UndoRedoController::processCommand(Command command)
{
if (command.order != Command::ORDER_ACTIVATE && m_iterator == m_list.begin())
{
return;
}
if (command.order == Command::ORDER_ACTIVATE && command.message->keepContent())
{
command.order = Command::ORDER_ADAPT;
@@ -369,15 +378,6 @@ void UndoRedoController::processCommand(Command command)
}
}
void UndoRedoController::clear()
{
m_list.clear();
m_iterator = m_list.end();
getView()->setUndoButtonEnabled(false);
getView()->setRedoButtonEnabled(false);
}
bool UndoRedoController::sameMessageTypeAsLast(MessageBase* message) const
{
if (!m_list.size() || m_list.begin() == m_iterator)
@@ -15,7 +15,6 @@
#include "utility/messaging/type/MessageGraphNodeBundleSplit.h"
#include "utility/messaging/type/MessageGraphNodeExpand.h"
#include "utility/messaging/type/MessageGraphNodeMove.h"
#include "utility/messaging/type/MessageLoadProject.h"
#include "utility/messaging/type/MessageRedo.h"
#include "utility/messaging/type/MessageRefresh.h"
#include "utility/messaging/type/MessageScrollCode.h"
@@ -41,7 +40,6 @@ class UndoRedoController
, public MessageListener<MessageGraphNodeBundleSplit>
, public MessageListener<MessageGraphNodeExpand>
, public MessageListener<MessageGraphNodeMove>
, public MessageListener<MessageLoadProject>
, public MessageListener<MessageRedo>
, public MessageListener<MessageRefresh>
, public MessageListener<MessageScrollCode>
@@ -56,6 +54,8 @@ public:
UndoRedoView* getView();
virtual void clear();
private:
struct Command
{
@@ -83,7 +83,6 @@ private:
virtual void handleMessage(MessageGraphNodeBundleSplit* message);
virtual void handleMessage(MessageGraphNodeExpand* message);
virtual void handleMessage(MessageGraphNodeMove* message);
virtual void handleMessage(MessageLoadProject* message);
virtual void handleMessage(MessageRedo* message);
virtual void handleMessage(MessageRefresh* message);
virtual void handleMessage(MessageScrollCode* message);
@@ -97,8 +96,6 @@ private:
void processCommand(Command command);
void clear();
bool sameMessageTypeAsLast(MessageBase* message) const;
MessageBase* lastMessage() const;