* 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
89 lines
2.5 KiB
C++
89 lines
2.5 KiB
C++
#include "component/ComponentManager.h"
|
|
|
|
#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"
|
|
#include "component/view/RefreshView.h"
|
|
#include "component/view/SearchView.h"
|
|
#include "component/view/UndoRedoView.h"
|
|
#include "component/view/ViewFactory.h"
|
|
|
|
std::shared_ptr<ComponentManager> ComponentManager::create(ViewFactory* viewFactory, StorageAccess* storageAccess)
|
|
{
|
|
std::shared_ptr<ComponentManager> ptr(new ComponentManager());
|
|
|
|
ptr->m_componentFactory = ComponentFactory::create(viewFactory, storageAccess);
|
|
|
|
return ptr;
|
|
}
|
|
|
|
ComponentManager::~ComponentManager()
|
|
{
|
|
}
|
|
|
|
void ComponentManager::setup(ViewLayout* viewLayout)
|
|
{
|
|
std::shared_ptr<CompositeView> compositeView =
|
|
m_componentFactory->getViewFactory()->createCompositeView(viewLayout, CompositeView::DIRECTION_HORIZONTAL, "Search");
|
|
m_compositeViews.push_back(compositeView);
|
|
|
|
std::shared_ptr<Component> undoRedoComponent = m_componentFactory->createUndoRedoComponent(compositeView.get());
|
|
m_components.push_back(undoRedoComponent);
|
|
|
|
std::shared_ptr<Component> refreshComponent = m_componentFactory->createRefreshComponent(compositeView.get());
|
|
m_components.push_back(refreshComponent);
|
|
|
|
std::shared_ptr<Component> searchComponent = m_componentFactory->createSearchComponent(compositeView.get());
|
|
m_components.push_back(searchComponent);
|
|
|
|
std::shared_ptr<Component> graphComponent = m_componentFactory->createGraphComponent(viewLayout);
|
|
m_components.push_back(graphComponent);
|
|
|
|
std::shared_ptr<Component> codeComponent = m_componentFactory->createCodeComponent(viewLayout);
|
|
m_components.push_back(codeComponent);
|
|
|
|
std::shared_ptr<Component> statusBarComponent = m_componentFactory->createStatusBarComponent(viewLayout);
|
|
m_components.push_back(statusBarComponent);
|
|
|
|
std::shared_ptr<Component> featureComponent = m_componentFactory->createFeatureComponent();
|
|
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)
|
|
{
|
|
View* view = component->getView<View>();
|
|
|
|
if (view)
|
|
{
|
|
view->refreshView();
|
|
}
|
|
}
|
|
|
|
for (std::shared_ptr<CompositeView> view : m_compositeViews)
|
|
{
|
|
view->refreshView();
|
|
}
|
|
}
|
|
|
|
ComponentManager::ComponentManager()
|
|
{
|
|
}
|