logic: code controller communication

- Replaced CodeAccess with LocationAccess.
- Implemented basic functionality for CodeController.
- Added messaging to the project.
- Added QtThreadedFunctor to enable our Messaging thread to invoke calls on the QtThread.
- Added GraphController.

fortune cookie message = Good news from someone dear is coming soon.
This commit is contained in:
malte_langkabel
2014-07-02 16:42:33 +02:00
parent a8e32af5dd
commit 400e2629d2
37 changed files with 441 additions and 78 deletions
+7
View File
@@ -1,5 +1,7 @@
#include "component/view/CodeView.h"
#include "component/controller/CodeController.h"
CodeView::CodeView(ViewLayout* viewLayout)
: View(viewLayout, Vec2i(100, 100))
{
@@ -13,3 +15,8 @@ std::string CodeView::getName() const
{
return "CodeView";
}
CodeController* CodeView::getController()
{
return View::getController<CodeController>();
}
+5
View File
@@ -3,6 +3,8 @@
#include "component/view/View.h"
class CodeController;
class CodeView: public View
{
public:
@@ -13,6 +15,9 @@ public:
virtual void addCodeSnippet(std::string str) = 0;
virtual void clearCodeSnippets() = 0;
private:
CodeController* getController();
};
#endif // CODE_VIEW_H
+5
View File
@@ -18,6 +18,11 @@ GuiWidgetWrapper* View::getWidgetWrapper()
return m_widgetWrapper.get();
}
void View::setComponent(Component* component)
{
m_component = component;
}
int View::getMinWidth() const
{
return m_minSize.x;
+18 -1
View File
@@ -9,6 +9,7 @@
class GuiWidgetWrapper;
class ViewLayout;
class Component;
class View
{
@@ -26,14 +27,20 @@ public:
virtual void initGui() = 0;
void setComponent(Component* component);
int getMinWidth() const;
int getMinHeight() const;
Vec2i getMinSize() const;
protected:
View(ViewLayout* viewLayout, const Vec2i& minSize);
View(ViewLayout* viewLayout, const Vec2i& minSize); // make public
template <typename ControllerType>
ControllerType* getController();
private:
Component* m_component;
ViewLayout* const m_viewLayout;
std::shared_ptr<GuiWidgetWrapper> m_widgetWrapper;
Vec2i m_minSize;
@@ -52,4 +59,14 @@ std::shared_ptr<T> View::create(ViewLayout* viewLayout)
return ptr;
}
template <typename ControllerType>
ControllerType* View::getController()
{
if (m_component)
{
return m_component->getController<ControllerType>();
}
return NULL;
}
#endif // VIEW_H