main window owns the facade.

This commit is contained in:
Alexandre Quessy
2014-01-05 17:10:13 -05:00
parent bae2e74fde
commit f4bef80559
4 changed files with 14 additions and 3 deletions
+3 -2
View File
@@ -20,8 +20,9 @@
#include "Facade.h"
Facade::Facade(MappingManager *manager) :
_manager(manager)
Facade::Facade(MappingManager *manager, MainWindow *window) :
_manager(manager),
_window(window)
{
}
+3 -1
View File
@@ -19,6 +19,7 @@
*/
#include "MappingManager.h"
#include "MainWindow.h"
/**
* Facade to control the application.
@@ -26,7 +27,7 @@
class Facade
{
public:
Facade(MappingManager *manager);
Facade(MappingManager *manager, MainWindow *window);
/**
* Clears all mappings and paints.
*/
@@ -68,5 +69,6 @@ class Facade
// bool getPaint(const char *paint_id, Paint &paint);
private:
MappingManager *_manager;
MainWindow *_window;
};
+4
View File
@@ -21,10 +21,13 @@
#include "MainWindow.h"
#include "ProjectWriter.h"
#include "ProjectReader.h"
#include "Facade.h"
MainWindow::MainWindow()
{
mappingManager = new MappingManager;
_facade = new Facade(mappingManager, this);
currentPaintId = -1;
currentMappingId = -1;
@@ -52,6 +55,7 @@ MainWindow& MainWindow::getInstance()
MainWindow::~MainWindow()
{
delete mappingManager;
delete _facade;
}
void MainWindow::handleSourceItemSelectionChanged()
+4
View File
@@ -33,6 +33,9 @@
#define LIBREMAPPING_VERSION "0.1"
// Forward declaration:
class Facade;
class MainWindow: public QMainWindow
{
Q_OBJECT
@@ -140,6 +143,7 @@ private:
private:
// Model.
MappingManager* mappingManager;
Facade* _facade;
// View.
int currentPaintId;