OpenMW
apps/opencs/view/doc/viewmanager.hpp
Go to the documentation of this file.
00001 #ifndef CSV_DOC_VIEWMANAGER_H
00002 #define CSV_DOC_VIEWMANAGER_H
00003 
00004 #include <vector>
00005 
00006 #include <QObject>
00007 
00008 namespace CSMDoc
00009 {
00010     class Document;
00011     class DocumentManager;
00012 }
00013 
00014 namespace CSVWorld
00015 {
00016     class CommandDelegateFactoryCollection;
00017 }
00018 
00019 namespace CSVDoc
00020 {
00021     class View;
00022 
00023     class ViewManager : public QObject
00024     {
00025             Q_OBJECT
00026 
00027             CSMDoc::DocumentManager& mDocumentManager;
00028             std::vector<View *> mViews;
00029             CSVWorld::CommandDelegateFactoryCollection *mDelegateFactories;
00030             bool mExitOnSaveStateChange;
00031             bool mUserWarned;
00032 
00033             // not implemented
00034             ViewManager (const ViewManager&);
00035             ViewManager& operator= (const ViewManager&);
00036 
00037             void updateIndices();
00038             bool notifySaveOnClose (View *view = 0);
00039             bool showModifiedDocumentMessageBox (View *view);
00040             bool showSaveInProgressMessageBox (View *view);
00041 
00042         public:
00043 
00044             ViewManager (CSMDoc::DocumentManager& documentManager);
00045 
00046             virtual ~ViewManager();
00047 
00048             View *addView (CSMDoc::Document *document);
00050 
00051             int countViews (const CSMDoc::Document *document) const;
00053 
00054             bool closeRequest (View *view);
00055 
00056         signals:
00057 
00058             void newGameRequest();
00059 
00060             void newAddonRequest();
00061 
00062             void loadDocumentRequest();
00063 
00064             void closeMessageBox();
00065 
00066             void editSettingsRequest();
00067 
00068         public slots:
00069 
00070             void exitApplication (CSVDoc::View *view);
00071 
00072         private slots:
00073 
00074             void documentStateChanged (int state, CSMDoc::Document *document);
00075 
00076             void progress (int current, int max, int type, int threads, CSMDoc::Document *document);
00077 
00078             void onExitWarningHandler(int state, CSMDoc::Document* document);
00079 
00081             void slotUpdateEditorSetting (const QString &, const QString &);
00082     };
00083 
00084 }
00085 
00086 #endif