IOT  0.5
I Only Think
MainController.h
Go to the documentation of this file.
00001 // -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
00002 
00003 /* IOT Copyright (C) 2010 CEG development team
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License version 2
00007  * as published by the Free Software Foundation.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
00017  *
00018  * Authors: CEG <ceg@ionlythink.com>, http://www.ionlythink.com
00019  */
00020 
00021 #ifndef MAINCONTROLLER_H
00022 #define MAINCONTROLLER_H
00023 
00024 #include <QList>
00025 
00026 #include "CegTcpServer.h"
00027 #include "View.h"
00028 #include "BoxController.h"
00029 #include "BoxType.h"
00030 #include "Window.h"
00031 
00032 class AbstractScene;
00033 class ICommunicationGraphicalServer;
00034 class IAction;
00035 class Systray;
00036 namespace Ceg
00037 {
00038     class Window;
00039 }
00040 
00045 class MainController : public QObject
00046 {
00047     Q_OBJECT
00048 public:
00049     MainController(Systray &);
00050     ~MainController();
00051 
00052     BoxController const &               getBoxController() const;
00053     ICommunicationGraphicalServer*      getComGs() const;
00054     AbstractScene*                      getCurrentScene() const; // Renvoie la scene qui est en premier dans la liste
00055     AbstractScene*                      getSceneAt(int position) const; // renvoie la scene a la posistion
00056     AbstractScene*                      getScene(QString const & id) const; // renvoie la scene qui a l'id
00057     int                                 getIndexOfScene(AbstractScene * sceneSearch) const; // Retourne l'index dans la liste des scenes
00058     int                                 getFirstOfType(BoxType type) const; // Retourne l'index du premier type chechez
00059     AbstractScene*                      getFirstNavigationScene() const; // Retourne  la premiere scene de navigation : Custom ou default
00060     View &                              getView();
00061     Ceg::Window &                       getWindow();
00062 
00063     AbstractScene *                     createScene(Ceg::Window const & window);
00064     void                                pushFrontScene(AbstractScene * scene); // Rajoute la scnene au debut des scenes et rafraichi la vue
00065     void                                popFrontScene(); // Supprime la scene du debut et rafraichi la vue
00066     void                                removeSceneAt(int index); // Supprime la scene qui est a l'index et affiche le menu home
00067 
00068 public slots:
00069     void                                on_start_navigation(); // Active la navigation
00070     void                                on_stop_navigation(); // Stop la navigationF
00071     void                                on_action_emitted(IAction &); // Attrape les actions a execute
00072 
00073 private:
00074     void                                initialize(); // Initialise tout les paremetres pour la navigation
00075 
00076 
00077 private:
00078     View                                    _view; // La vue pour representer les scene (Une vue pour toutes les scenes)
00079     QList<AbstractScene *>                  _scenes; // L'ensemble des scenes, une scnene par fenetre systemes ouvertes + eventuellement un menu
00080     BoxController                           _boxController;
00081     ICommunicationGraphicalServer *         _comGs;
00082     CegTcpServer                            _tcpServer;
00083     Ceg::Window                             _ownWindow; // Correspond a la fenetre de notre propre programme
00084 };
00085 
00086 #endif // MAINCONTROLLER_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator