src: replaced gui wording with view wording
Changed gui wording in lib and app to view wording, since MVC views do not necessarily deal with GUIs. And moved files so structure is similar in lib and app.
This commit is contained in:
@@ -7,4 +7,4 @@
|
||||
|
||||
# fortune cookie message = <message>
|
||||
|
||||
# modules: build, logic, ui, data, utility, test, script
|
||||
# modules: build, src, logic, ui, data, utility, test, script
|
||||
|
||||
@@ -37,11 +37,10 @@ add_files(
|
||||
qt/view/QtMainView.h
|
||||
qt/view/QtSearchView.cpp
|
||||
qt/view/QtSearchView.h
|
||||
|
||||
qt/QtGuiFactory.cpp
|
||||
qt/QtGuiFactory.h
|
||||
qt/QtWidgetWrapper.cpp
|
||||
qt/QtWidgetWrapper.h
|
||||
qt/view/QtViewFactory.cpp
|
||||
qt/view/QtViewFactory.h
|
||||
qt/view/QtViewWidgetWrapper.cpp
|
||||
qt/view/QtViewWidgetWrapper.h
|
||||
|
||||
main.cpp
|
||||
)
|
||||
|
||||
+3
-3
@@ -4,8 +4,8 @@
|
||||
|
||||
#include "Application.h"
|
||||
#include "includes.h" // defines 'void setup()'
|
||||
#include "qt/QtGuiFactory.h"
|
||||
#include "qt/utility/utilityQt.h"
|
||||
#include "qt/view/QtViewFactory.h"
|
||||
#include "utility/logging/ConsoleLogger.h"
|
||||
#include "utility/logging/LogManager.h"
|
||||
|
||||
@@ -21,11 +21,11 @@ int main(int argc, char *argv[])
|
||||
setup();
|
||||
|
||||
QApplication qtApp(argc, argv);
|
||||
QtGuiFactory guiFactory;
|
||||
|
||||
init();
|
||||
|
||||
std::shared_ptr<Application> app = Application::create(&guiFactory);
|
||||
QtViewFactory viewFactory;
|
||||
std::shared_ptr<Application> app = Application::create(&viewFactory);
|
||||
app->loadProject("data/ProjectSettings.xml");
|
||||
|
||||
return qtApp.exec();
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
#include "qt/QtGuiFactory.h"
|
||||
|
||||
#include "qt/view/QtCodeView.h"
|
||||
#include "qt/view/QtGraphView.h"
|
||||
#include "qt/view/QtMainView.h"
|
||||
#include "qt/view/QtSearchView.h"
|
||||
|
||||
QtGuiFactory::QtGuiFactory()
|
||||
{
|
||||
}
|
||||
|
||||
QtGuiFactory::~QtGuiFactory()
|
||||
{
|
||||
}
|
||||
|
||||
std::shared_ptr<MainView> QtGuiFactory::createMainView() const
|
||||
{
|
||||
return std::make_shared<QtMainView>();
|
||||
}
|
||||
|
||||
std::shared_ptr<CodeView> QtGuiFactory::createCodeView(ViewLayout* viewLayout) const
|
||||
{
|
||||
return View::create<QtCodeView>(viewLayout);
|
||||
}
|
||||
|
||||
std::shared_ptr<GraphView> QtGuiFactory::createGraphView(ViewLayout* viewLayout) const
|
||||
{
|
||||
return View::create<QtGraphView>(viewLayout);
|
||||
}
|
||||
|
||||
std::shared_ptr<SearchView> QtGuiFactory::createSearchView(ViewLayout* viewLayout) const
|
||||
{
|
||||
return View::create<QtSearchView>(viewLayout);
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
#include "qt/QtWidgetWrapper.h"
|
||||
|
||||
#include "component/view/View.h"
|
||||
#include "utility/logging/logging.h"
|
||||
|
||||
QWidget* QtWidgetWrapper::getWidgetOfView(View* view)
|
||||
{
|
||||
QtWidgetWrapper* widgetWrapper = dynamic_cast<QtWidgetWrapper*>(view->getWidgetWrapper());
|
||||
|
||||
if (!widgetWrapper)
|
||||
{
|
||||
LOG_ERROR("Trying to get the qt widget of non qt view.");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!widgetWrapper->getWidget())
|
||||
{
|
||||
LOG_ERROR("The QtWidgetWrapper is not holdling a QWidget.");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return widgetWrapper->getWidget();
|
||||
}
|
||||
|
||||
QtWidgetWrapper::QtWidgetWrapper(std::shared_ptr<QWidget> widget)
|
||||
: m_widget(widget)
|
||||
{
|
||||
}
|
||||
|
||||
QtWidgetWrapper::~QtWidgetWrapper()
|
||||
{
|
||||
}
|
||||
|
||||
QWidget* QtWidgetWrapper::getWidget()
|
||||
{
|
||||
return m_widget.get();
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
#ifndef QT_WIDGET_WRAPPER_H
|
||||
#define QT_WIDGET_WRAPPER_H
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <QtWidgets/qwidget.h>
|
||||
|
||||
#include "gui/GuiWidgetWrapper.h"
|
||||
|
||||
class View;
|
||||
|
||||
class QtWidgetWrapper: public GuiWidgetWrapper
|
||||
{
|
||||
public:
|
||||
static QWidget* getWidgetOfView(View* view);
|
||||
|
||||
QtWidgetWrapper(std::shared_ptr<QWidget> widget);
|
||||
virtual ~QtWidgetWrapper();
|
||||
|
||||
QWidget* getWidget();
|
||||
|
||||
private:
|
||||
std::shared_ptr<QWidget> m_widget;
|
||||
};
|
||||
|
||||
#endif // QT_WIDGET_WRAPPER_H
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <QSettings>
|
||||
|
||||
#include "component/view/View.h"
|
||||
#include "qt/QtWidgetWrapper.h"
|
||||
#include "qt/view/QtViewWidgetWrapper.h"
|
||||
#include "utility/logging/logging.h"
|
||||
#include "utility/messaging/type/MessageFind.h"
|
||||
#include "utility/messaging/type/MessageLoadProject.h"
|
||||
@@ -77,7 +77,7 @@ void QtMainWindow::find()
|
||||
void QtMainWindow::addView(View* view)
|
||||
{
|
||||
QDockWidget* dock = new QDockWidget(tr(view->getName().c_str()), this);
|
||||
dock->setWidget(QtWidgetWrapper::getWidgetOfView(view));
|
||||
dock->setWidget(QtViewWidgetWrapper::getWidgetOfView(view));
|
||||
addDockWidget(Qt::TopDockWidgetArea, dock);
|
||||
m_dockWidgets.push_back(std::make_pair(view, dock));
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
|
||||
#include "data/location/TokenLocationFile.h"
|
||||
#include "qt/element/QtCodeFile.h"
|
||||
#include "qt/QtWidgetWrapper.h"
|
||||
#include "qt/utility/utilityQt.h"
|
||||
#include "qt/view/QtViewWidgetWrapper.h"
|
||||
#include "utility/FileSystem.h"
|
||||
#include "utility/messaging/type/MessageActivateToken.h"
|
||||
#include "utility/text/TextAccess.h"
|
||||
@@ -25,12 +25,12 @@ QtCodeView::~QtCodeView()
|
||||
|
||||
void QtCodeView::createWidgetWrapper()
|
||||
{
|
||||
setWidgetWrapper(std::make_shared<QtWidgetWrapper>(std::make_shared<QScrollArea>()));
|
||||
setWidgetWrapper(std::make_shared<QtViewWidgetWrapper>(std::make_shared<QScrollArea>()));
|
||||
}
|
||||
|
||||
void QtCodeView::initGui()
|
||||
void QtCodeView::initView()
|
||||
{
|
||||
QWidget* widget = QtWidgetWrapper::getWidgetOfView(this);
|
||||
QWidget* widget = QtViewWidgetWrapper::getWidgetOfView(this);
|
||||
widget->setStyleSheet(TextAccess::createFromFile("data/gui/code_view/code_view.css")->getText().c_str());
|
||||
widget->setObjectName("code_view");
|
||||
|
||||
@@ -79,7 +79,7 @@ void QtCodeView::doAddCodeSnippet(const CodeSnippetParams params)
|
||||
|
||||
if (!file)
|
||||
{
|
||||
QWidget* widget = QtWidgetWrapper::getWidgetOfView(this);
|
||||
QWidget* widget = QtViewWidgetWrapper::getWidgetOfView(this);
|
||||
std::shared_ptr<QtCodeFile> filePtr = std::make_shared<QtCodeFile>(this, fileName, widget);
|
||||
|
||||
m_files.push_back(filePtr);
|
||||
|
||||
@@ -19,7 +19,7 @@ public:
|
||||
|
||||
// View implementation
|
||||
virtual void createWidgetWrapper();
|
||||
virtual void initGui();
|
||||
virtual void initView();
|
||||
|
||||
// CodeView implementation
|
||||
virtual void addCodeSnippet(const CodeSnippetParams params);
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
#include <QGraphicsScene>
|
||||
#include <QGraphicsView>
|
||||
|
||||
#include "qt/QtWidgetWrapper.h"
|
||||
#include "qt/utility/utilityQt.h"
|
||||
#include "qt/view/QtViewWidgetWrapper.h"
|
||||
#include "qt/view/graphElements/QtGraphEdge.h"
|
||||
#include "qt/view/graphElements/QtGraphNode.h"
|
||||
#include "qt/view/graphElements/QtGraphNodeMouseMovable.h"
|
||||
@@ -30,12 +30,12 @@ QtGraphView::~QtGraphView()
|
||||
|
||||
void QtGraphView::createWidgetWrapper()
|
||||
{
|
||||
setWidgetWrapper(std::make_shared<QtWidgetWrapper>(std::make_shared<QFrame>()));
|
||||
setWidgetWrapper(std::make_shared<QtViewWidgetWrapper>(std::make_shared<QFrame>()));
|
||||
}
|
||||
|
||||
void QtGraphView::initGui()
|
||||
void QtGraphView::initView()
|
||||
{
|
||||
QWidget* widget = QtWidgetWrapper::getWidgetOfView(this);
|
||||
QWidget* widget = QtViewWidgetWrapper::getWidgetOfView(this);
|
||||
utility::setWidgetBackgroundColor(widget, Colori(100, 20, 200, 255));
|
||||
|
||||
QBoxLayout* layout = new QBoxLayout(QBoxLayout::TopToBottom);
|
||||
@@ -63,7 +63,7 @@ void QtGraphView::clear()
|
||||
|
||||
QGraphicsView* QtGraphView::getView()
|
||||
{
|
||||
QWidget* widget = QtWidgetWrapper::getWidgetOfView(this);
|
||||
QWidget* widget = QtViewWidgetWrapper::getWidgetOfView(this);
|
||||
|
||||
QObjectList children = widget->children();
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ public:
|
||||
|
||||
// View implementation
|
||||
virtual void createWidgetWrapper();
|
||||
virtual void initGui();
|
||||
virtual void initView();
|
||||
|
||||
virtual void rebuildGraph(const std::vector<DummyNode>& nodes, const std::vector<DummyEdge>& edges);
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
#include "component/controller/SearchController.h"
|
||||
#include "qt/element/QtButton.h"
|
||||
#include "qt/element/QtEditBox.h"
|
||||
#include "qt/QtWidgetWrapper.h"
|
||||
#include "qt/utility/utilityQt.h"
|
||||
#include "qt/view/QtViewWidgetWrapper.h"
|
||||
#include "utility/text/TextAccess.h"
|
||||
|
||||
QtSearchView::QtSearchView(ViewLayout* viewLayout)
|
||||
@@ -23,12 +23,12 @@ QtSearchView::~QtSearchView()
|
||||
|
||||
void QtSearchView::createWidgetWrapper()
|
||||
{
|
||||
setWidgetWrapper(std::make_shared<QtWidgetWrapper>(std::make_shared<QFrame>()));
|
||||
setWidgetWrapper(std::make_shared<QtViewWidgetWrapper>(std::make_shared<QFrame>()));
|
||||
}
|
||||
|
||||
void QtSearchView::initGui()
|
||||
void QtSearchView::initView()
|
||||
{
|
||||
QWidget* widget = QtWidgetWrapper::getWidgetOfView(this);
|
||||
QWidget* widget = QtViewWidgetWrapper::getWidgetOfView(this);
|
||||
widget->setObjectName("search_view");
|
||||
widget->setStyleSheet(TextAccess::createFromFile("data/gui/search_view/search_view.css")->getText().c_str());
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ public:
|
||||
|
||||
// View implementation
|
||||
virtual void createWidgetWrapper();
|
||||
virtual void initGui();
|
||||
virtual void initView();
|
||||
|
||||
// SearchView implementation
|
||||
virtual void setText(const std::string& s);
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
#include "qt/view/QtViewFactory.h"
|
||||
|
||||
#include "qt/view/QtCodeView.h"
|
||||
#include "qt/view/QtGraphView.h"
|
||||
#include "qt/view/QtMainView.h"
|
||||
#include "qt/view/QtSearchView.h"
|
||||
|
||||
QtViewFactory::QtViewFactory()
|
||||
{
|
||||
}
|
||||
|
||||
QtViewFactory::~QtViewFactory()
|
||||
{
|
||||
}
|
||||
|
||||
std::shared_ptr<MainView> QtViewFactory::createMainView() const
|
||||
{
|
||||
return std::make_shared<QtMainView>();
|
||||
}
|
||||
|
||||
std::shared_ptr<CodeView> QtViewFactory::createCodeView(ViewLayout* viewLayout) const
|
||||
{
|
||||
return View::create<QtCodeView>(viewLayout);
|
||||
}
|
||||
|
||||
std::shared_ptr<GraphView> QtViewFactory::createGraphView(ViewLayout* viewLayout) const
|
||||
{
|
||||
return View::create<QtGraphView>(viewLayout);
|
||||
}
|
||||
|
||||
std::shared_ptr<SearchView> QtViewFactory::createSearchView(ViewLayout* viewLayout) const
|
||||
{
|
||||
return View::create<QtSearchView>(viewLayout);
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
#ifndef QT_GUI_FACTORY_H
|
||||
#define QT_GUI_FACTORY_H
|
||||
#ifndef QT_VIEW_FACTORY_H
|
||||
#define QT_VIEW_FACTORY_H
|
||||
|
||||
#include "gui/GuiFactory.h"
|
||||
#include "component/view/ViewFactory.h"
|
||||
|
||||
class QtGuiFactory: public GuiFactory
|
||||
class QtViewFactory: public ViewFactory
|
||||
{
|
||||
public:
|
||||
QtGuiFactory();
|
||||
virtual ~QtGuiFactory();
|
||||
QtViewFactory();
|
||||
virtual ~QtViewFactory();
|
||||
|
||||
virtual std::shared_ptr<MainView> createMainView() const;
|
||||
virtual std::shared_ptr<CodeView> createCodeView(ViewLayout* viewLayout) const;
|
||||
@@ -15,4 +15,4 @@ public:
|
||||
virtual std::shared_ptr<SearchView> createSearchView(ViewLayout* viewLayout) const;
|
||||
};
|
||||
|
||||
#endif // QT_GUI_FACTORY_H
|
||||
#endif // QT_VIEW_FACTORY_H
|
||||
@@ -0,0 +1,37 @@
|
||||
#include "qt/view/QtViewWidgetWrapper.h"
|
||||
|
||||
#include "component/view/View.h"
|
||||
#include "utility/logging/logging.h"
|
||||
|
||||
QWidget* QtViewWidgetWrapper::getWidgetOfView(View* view)
|
||||
{
|
||||
QtViewWidgetWrapper* widgetWrapper = dynamic_cast<QtViewWidgetWrapper*>(view->getWidgetWrapper());
|
||||
|
||||
if (!widgetWrapper)
|
||||
{
|
||||
LOG_ERROR("Trying to get the qt widget of non qt view.");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!widgetWrapper->getWidget())
|
||||
{
|
||||
LOG_ERROR("The QtViewWidgetWrapper is not holdling a QWidget.");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return widgetWrapper->getWidget();
|
||||
}
|
||||
|
||||
QtViewWidgetWrapper::QtViewWidgetWrapper(std::shared_ptr<QWidget> widget)
|
||||
: m_widget(widget)
|
||||
{
|
||||
}
|
||||
|
||||
QtViewWidgetWrapper::~QtViewWidgetWrapper()
|
||||
{
|
||||
}
|
||||
|
||||
QWidget* QtViewWidgetWrapper::getWidget()
|
||||
{
|
||||
return m_widget.get();
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
#ifndef QT_VIEW_WIDGET_WRAPPER_H
|
||||
#define QT_VIEW_WIDGET_WRAPPER_H
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "component/view/ViewWidgetWrapper.h"
|
||||
|
||||
class View;
|
||||
|
||||
class QtViewWidgetWrapper: public ViewWidgetWrapper
|
||||
{
|
||||
public:
|
||||
static QWidget* getWidgetOfView(View* view);
|
||||
|
||||
QtViewWidgetWrapper(std::shared_ptr<QWidget> widget);
|
||||
virtual ~QtViewWidgetWrapper();
|
||||
|
||||
QWidget* getWidget();
|
||||
|
||||
private:
|
||||
std::shared_ptr<QWidget> m_widget;
|
||||
};
|
||||
|
||||
#endif // QT_VIEW_WIDGET_WRAPPER_H
|
||||
@@ -2,13 +2,13 @@
|
||||
|
||||
#include "ApplicationSettings.h"
|
||||
#include "component/view/MainView.h"
|
||||
#include "component/view/ViewFactory.h"
|
||||
#include "data/access/GraphAccessProxy.h"
|
||||
#include "data/access/LocationAccessProxy.h"
|
||||
#include "gui/GuiFactory.h"
|
||||
#include "utility/messaging/MessageQueue.h"
|
||||
#include "utility/messaging/type/MessageActivateToken.h"
|
||||
|
||||
std::shared_ptr<Application> Application::create(GuiFactory* guiFactory)
|
||||
std::shared_ptr<Application> Application::create(ViewFactory* viewFactory)
|
||||
{
|
||||
ApplicationSettings::getInstance()->load("data/ApplicationSettings.xml");
|
||||
|
||||
@@ -17,9 +17,9 @@ std::shared_ptr<Application> Application::create(GuiFactory* guiFactory)
|
||||
ptr->m_graphAccessProxy = std::make_shared<GraphAccessProxy>();
|
||||
ptr->m_locationAccessProxy = std::make_shared<LocationAccessProxy>();
|
||||
|
||||
ptr->m_mainView = guiFactory->createMainView();
|
||||
ptr->m_mainView = viewFactory->createMainView();
|
||||
ptr->m_componentManager = ComponentManager::create(
|
||||
guiFactory, ptr->m_mainView.get(), ptr->m_graphAccessProxy.get(), ptr->m_locationAccessProxy.get());
|
||||
viewFactory, ptr->m_mainView.get(), ptr->m_graphAccessProxy.get(), ptr->m_locationAccessProxy.get());
|
||||
|
||||
ptr->m_componentManager->setup();
|
||||
ptr->m_mainView->loadLayout();
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "utility/messaging/type/MessageLoadProject.h"
|
||||
#include "utility/messaging/type/MessageLoadSource.h"
|
||||
|
||||
class GuiFactory;
|
||||
class ViewFactory;
|
||||
class MainView;
|
||||
class GraphAccessProxy;
|
||||
class LocationAccessProxy;
|
||||
@@ -19,7 +19,7 @@ class Application
|
||||
, public MessageListener<MessageLoadSource>
|
||||
{
|
||||
public:
|
||||
static std::shared_ptr<Application> create(GuiFactory* guiFactory);
|
||||
static std::shared_ptr<Application> create(ViewFactory* viewFactory);
|
||||
|
||||
~Application();
|
||||
|
||||
|
||||
@@ -48,8 +48,12 @@ add_files(
|
||||
component/view/SearchView.h
|
||||
component/view/View.cpp
|
||||
component/view/View.h
|
||||
component/view/ViewFactory.cpp
|
||||
component/view/ViewFactory.h
|
||||
component/view/ViewLayout.cpp
|
||||
component/view/ViewLayout.h
|
||||
component/view/ViewWidgetWrapper.cpp
|
||||
component/view/ViewWidgetWrapper.h
|
||||
|
||||
component/Component.cpp
|
||||
component/Component.h
|
||||
@@ -124,11 +128,6 @@ add_files(
|
||||
data/Storage.cpp
|
||||
data/Storage.h
|
||||
|
||||
gui/GuiFactory.cpp
|
||||
gui/GuiFactory.h
|
||||
gui/GuiWidgetWrapper.cpp
|
||||
gui/GuiWidgetWrapper.h
|
||||
|
||||
utility/logging/ConsoleLogger.cpp
|
||||
utility/logging/ConsoleLogger.h
|
||||
utility/logging/FileLogger.cpp
|
||||
|
||||
@@ -7,14 +7,14 @@
|
||||
#include "component/view/CodeView.h"
|
||||
#include "component/view/GraphView.h"
|
||||
#include "component/view/SearchView.h"
|
||||
#include "component/view/ViewFactory.h"
|
||||
#include "component/view/ViewLayout.h"
|
||||
#include "gui/GuiFactory.h"
|
||||
|
||||
std::shared_ptr<ComponentFactory> ComponentFactory::create(
|
||||
GuiFactory* guiFactory, ViewLayout* viewLayout, GraphAccess* graphAccess, LocationAccess* locationAccess
|
||||
ViewFactory* viewFactory, ViewLayout* viewLayout, GraphAccess* graphAccess, LocationAccess* locationAccess
|
||||
){
|
||||
std::shared_ptr<ComponentFactory> ptr(new ComponentFactory());
|
||||
ptr->m_guiFactory = guiFactory;
|
||||
ptr->m_viewFactory = viewFactory;
|
||||
ptr->m_viewLayout = viewLayout;
|
||||
ptr->m_graphAccess = graphAccess;
|
||||
ptr->m_locationAccess = locationAccess;
|
||||
@@ -27,7 +27,7 @@ ComponentFactory::~ComponentFactory()
|
||||
|
||||
std::shared_ptr<Component> ComponentFactory::createCodeComponent()
|
||||
{
|
||||
std::shared_ptr<CodeView> view = m_guiFactory->createCodeView(m_viewLayout);
|
||||
std::shared_ptr<CodeView> view = m_viewFactory->createCodeView(m_viewLayout);
|
||||
std::shared_ptr<CodeController> controller = std::make_shared<CodeController>(m_locationAccess);
|
||||
|
||||
std::shared_ptr<Component> component = std::make_shared<Component>(view, controller);
|
||||
@@ -36,7 +36,7 @@ std::shared_ptr<Component> ComponentFactory::createCodeComponent()
|
||||
|
||||
std::shared_ptr<Component> ComponentFactory::createGraphComponent()
|
||||
{
|
||||
std::shared_ptr<View> view = m_guiFactory->createGraphView(m_viewLayout);
|
||||
std::shared_ptr<View> view = m_viewFactory->createGraphView(m_viewLayout);
|
||||
std::shared_ptr<GraphController> controller = std::make_shared<GraphController>(m_graphAccess);
|
||||
|
||||
std::shared_ptr<Component> component = std::make_shared<Component>(view, controller);
|
||||
@@ -45,7 +45,7 @@ std::shared_ptr<Component> ComponentFactory::createGraphComponent()
|
||||
|
||||
std::shared_ptr<Component> ComponentFactory::createSearchComponent()
|
||||
{
|
||||
std::shared_ptr<SearchView> view = m_guiFactory->createSearchView(m_viewLayout);
|
||||
std::shared_ptr<SearchView> view = m_viewFactory->createSearchView(m_viewLayout);
|
||||
std::shared_ptr<SearchController> controller = std::make_shared<SearchController>(m_graphAccess);
|
||||
|
||||
std::shared_ptr<Component> component = std::make_shared<Component>(view, controller);
|
||||
|
||||
@@ -7,14 +7,14 @@
|
||||
#include "data/access/GraphAccess.h"
|
||||
|
||||
class Component;
|
||||
class GuiFactory;
|
||||
class ViewFactory;
|
||||
class ViewLayout;
|
||||
|
||||
class ComponentFactory
|
||||
{
|
||||
public:
|
||||
static std::shared_ptr<ComponentFactory> create(
|
||||
GuiFactory* guiFactory, ViewLayout* viewLayout, GraphAccess* graphAccess, LocationAccess* locationAccess
|
||||
ViewFactory* viewFactory, ViewLayout* viewLayout, GraphAccess* graphAccess, LocationAccess* locationAccess
|
||||
);
|
||||
|
||||
~ComponentFactory();
|
||||
@@ -27,7 +27,7 @@ private:
|
||||
ComponentFactory();
|
||||
ComponentFactory(const ComponentFactory&);
|
||||
|
||||
GuiFactory* m_guiFactory;
|
||||
ViewFactory* m_viewFactory;
|
||||
ViewLayout* m_viewLayout;
|
||||
|
||||
GraphAccess* m_graphAccess;
|
||||
|
||||
@@ -2,15 +2,12 @@
|
||||
|
||||
#include "component/view/CodeView.h"
|
||||
#include "component/view/GraphView.h"
|
||||
#include "component/view/ViewLayout.h"
|
||||
|
||||
#include "data/location/TokenLocationFile.h"
|
||||
|
||||
std::shared_ptr<ComponentManager> ComponentManager::create(
|
||||
GuiFactory* guiFactory, ViewLayout* viewLayout, GraphAccess* graphAccess, LocationAccess* locationAccess
|
||||
ViewFactory* viewFactory, ViewLayout* viewLayout, GraphAccess* graphAccess, LocationAccess* locationAccess
|
||||
){
|
||||
std::shared_ptr<ComponentManager> ptr(new ComponentManager());
|
||||
ptr->m_componentFactory = ComponentFactory::create(guiFactory, viewLayout, graphAccess, locationAccess);
|
||||
ptr->m_componentFactory = ComponentFactory::create(viewFactory, viewLayout, graphAccess, locationAccess);
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@@ -9,14 +9,14 @@
|
||||
#include "data/access/LocationAccess.h"
|
||||
#include "data/access/GraphAccess.h"
|
||||
|
||||
class GuiFactory;
|
||||
class ViewFactory;
|
||||
class ViewLayout;
|
||||
|
||||
class ComponentManager
|
||||
{
|
||||
public:
|
||||
static std::shared_ptr<ComponentManager> create(
|
||||
GuiFactory* guiFactory, ViewLayout* viewLayout, GraphAccess* graphAccess, LocationAccess* locationAccess
|
||||
ViewFactory* viewFactory, ViewLayout* viewLayout, GraphAccess* graphAccess, LocationAccess* locationAccess
|
||||
);
|
||||
|
||||
~ComponentManager();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "component/view/View.h"
|
||||
|
||||
#include "gui/GuiWidgetWrapper.h"
|
||||
#include "component/view/ViewWidgetWrapper.h"
|
||||
|
||||
View::View(ViewLayout* viewLayout, const Vec2i& minSize)
|
||||
: m_viewLayout(viewLayout)
|
||||
@@ -14,12 +14,12 @@ View::~View()
|
||||
m_viewLayout->removeView(this);
|
||||
}
|
||||
|
||||
void View::setWidgetWrapper(std::shared_ptr<GuiWidgetWrapper> widgetWrapper)
|
||||
void View::setWidgetWrapper(std::shared_ptr<ViewWidgetWrapper> widgetWrapper)
|
||||
{
|
||||
m_widgetWrapper = widgetWrapper;
|
||||
}
|
||||
|
||||
GuiWidgetWrapper* View::getWidgetWrapper()
|
||||
ViewWidgetWrapper* View::getWidgetWrapper()
|
||||
{
|
||||
return m_widgetWrapper.get();
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "component/view/ViewLayout.h"
|
||||
#include "utility/math/Vector2.h"
|
||||
|
||||
class GuiWidgetWrapper;
|
||||
class ViewWidgetWrapper;
|
||||
|
||||
class View
|
||||
{
|
||||
@@ -20,15 +20,14 @@ public:
|
||||
virtual ~View();
|
||||
|
||||
virtual std::string getName() const = 0;
|
||||
|
||||
virtual void createWidgetWrapper() = 0;
|
||||
void setWidgetWrapper(std::shared_ptr<GuiWidgetWrapper> widgetWrapper);
|
||||
GuiWidgetWrapper* getWidgetWrapper();
|
||||
|
||||
virtual void initGui() = 0;
|
||||
virtual void initView() = 0;
|
||||
|
||||
void setComponent(Component* component);
|
||||
|
||||
void setWidgetWrapper(std::shared_ptr<ViewWidgetWrapper> widgetWrapper);
|
||||
ViewWidgetWrapper* getWidgetWrapper();
|
||||
|
||||
int getMinWidth() const;
|
||||
int getMinHeight() const;
|
||||
Vec2i getMinSize() const;
|
||||
@@ -42,7 +41,7 @@ protected:
|
||||
private:
|
||||
Component* m_component;
|
||||
ViewLayout* const m_viewLayout;
|
||||
std::shared_ptr<GuiWidgetWrapper> m_widgetWrapper;
|
||||
std::shared_ptr<ViewWidgetWrapper> m_widgetWrapper;
|
||||
Vec2i m_minSize;
|
||||
};
|
||||
|
||||
@@ -52,7 +51,7 @@ std::shared_ptr<T> View::create(ViewLayout* viewLayout)
|
||||
std::shared_ptr<T> ptr = std::make_shared<T>(viewLayout);
|
||||
|
||||
ptr->createWidgetWrapper();
|
||||
ptr->initGui();
|
||||
ptr->initView();
|
||||
|
||||
viewLayout->addView(ptr.get());
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
#include "component/view/ViewFactory.h"
|
||||
|
||||
ViewFactory::ViewFactory()
|
||||
{
|
||||
}
|
||||
|
||||
ViewFactory::~ViewFactory()
|
||||
{
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef GUI_FACTORY_H
|
||||
#define GUI_FACTORY_H
|
||||
#ifndef VIEW_FACTORY_H
|
||||
#define VIEW_FACTORY_H
|
||||
|
||||
#include <memory>
|
||||
|
||||
@@ -9,11 +9,11 @@ class MainView;
|
||||
class SearchView;
|
||||
class ViewLayout;
|
||||
|
||||
class GuiFactory
|
||||
class ViewFactory
|
||||
{
|
||||
public:
|
||||
GuiFactory();
|
||||
virtual ~GuiFactory();
|
||||
ViewFactory();
|
||||
virtual ~ViewFactory();
|
||||
|
||||
virtual std::shared_ptr<MainView> createMainView() const = 0;
|
||||
virtual std::shared_ptr<CodeView> createCodeView(ViewLayout* viewLayout) const = 0;
|
||||
@@ -21,4 +21,4 @@ public:
|
||||
virtual std::shared_ptr<SearchView> createSearchView(ViewLayout* viewLayout) const = 0;
|
||||
};
|
||||
|
||||
#endif // GUI_FACTORY_H
|
||||
#endif // VIEW_FACTORY_H
|
||||
@@ -0,0 +1,9 @@
|
||||
#include "component/view/ViewWidgetWrapper.h"
|
||||
|
||||
ViewWidgetWrapper::ViewWidgetWrapper()
|
||||
{
|
||||
}
|
||||
|
||||
ViewWidgetWrapper::~ViewWidgetWrapper()
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
#ifndef VIEW_WIDGET_WRAPPER_H
|
||||
#define VIEW_WIDGET_WRAPPER_H
|
||||
|
||||
class ViewWidgetWrapper
|
||||
{
|
||||
public:
|
||||
ViewWidgetWrapper();
|
||||
virtual ~ViewWidgetWrapper();
|
||||
};
|
||||
|
||||
#endif // VIEW_WIDGET_WRAPPER_H
|
||||
@@ -1,9 +0,0 @@
|
||||
#include "gui/GuiFactory.h"
|
||||
|
||||
GuiFactory::GuiFactory()
|
||||
{
|
||||
}
|
||||
|
||||
GuiFactory::~GuiFactory()
|
||||
{
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
#include "gui/GuiWidgetWrapper.h"
|
||||
|
||||
GuiWidgetWrapper::GuiWidgetWrapper()
|
||||
{
|
||||
}
|
||||
|
||||
GuiWidgetWrapper::~GuiWidgetWrapper()
|
||||
{
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
#ifndef GUI_WIDGET_WRAPPER_H
|
||||
#define GUI_WIDGET_WRAPPER_H
|
||||
|
||||
class GuiWidgetWrapper
|
||||
{
|
||||
public:
|
||||
GuiWidgetWrapper();
|
||||
virtual ~GuiWidgetWrapper();
|
||||
};
|
||||
|
||||
#endif // GUI_WIDGET_WRAPPER_H
|
||||
Reference in New Issue
Block a user