2012-11-22 12:30:02 +00:00
|
|
|
#ifndef CSV_DOC_VIEWMANAGER_H
|
|
|
|
#define CSV_DOC_VIEWMANAGER_H
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
2012-11-22 22:42:17 +00:00
|
|
|
#include <QObject>
|
|
|
|
|
2012-11-22 12:30:02 +00:00
|
|
|
namespace CSMDoc
|
|
|
|
{
|
|
|
|
class Document;
|
2012-11-22 13:10:23 +00:00
|
|
|
class DocumentManager;
|
2012-11-22 12:30:02 +00:00
|
|
|
}
|
|
|
|
|
2013-02-10 16:21:25 +00:00
|
|
|
namespace CSVWorld
|
|
|
|
{
|
|
|
|
class CommandDelegateFactoryCollection;
|
|
|
|
}
|
|
|
|
|
2012-11-22 12:30:02 +00:00
|
|
|
namespace CSVDoc
|
|
|
|
{
|
|
|
|
class View;
|
|
|
|
|
2012-11-22 22:42:17 +00:00
|
|
|
class ViewManager : public QObject
|
2012-11-22 12:30:02 +00:00
|
|
|
{
|
2012-11-22 22:42:17 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
2012-11-22 13:10:23 +00:00
|
|
|
CSMDoc::DocumentManager& mDocumentManager;
|
2012-11-22 12:30:02 +00:00
|
|
|
std::vector<View *> mViews;
|
2013-02-10 16:21:25 +00:00
|
|
|
CSVWorld::CommandDelegateFactoryCollection *mDelegateFactories;
|
2013-03-12 11:28:13 +00:00
|
|
|
bool mExitOnSaveStateChange;
|
2013-03-06 12:41:33 +00:00
|
|
|
bool mUserWarned;
|
2012-11-22 12:30:02 +00:00
|
|
|
|
|
|
|
// not implemented
|
|
|
|
ViewManager (const ViewManager&);
|
|
|
|
ViewManager& operator= (const ViewManager&);
|
|
|
|
|
2012-11-22 14:09:04 +00:00
|
|
|
void updateIndices();
|
2013-03-12 11:28:13 +00:00
|
|
|
bool notifySaveOnClose (View *view = 0);
|
|
|
|
bool showModifiedDocumentMessageBox (View *view);
|
|
|
|
bool showSaveInProgressMessageBox (View *view);
|
2012-11-22 14:09:04 +00:00
|
|
|
|
2012-11-22 12:30:02 +00:00
|
|
|
public:
|
|
|
|
|
2012-11-22 13:10:23 +00:00
|
|
|
ViewManager (CSMDoc::DocumentManager& documentManager);
|
2012-11-22 12:30:02 +00:00
|
|
|
|
2012-11-22 22:42:17 +00:00
|
|
|
virtual ~ViewManager();
|
2012-11-22 12:30:02 +00:00
|
|
|
|
|
|
|
View *addView (CSMDoc::Document *document);
|
|
|
|
///< The ownership of the returned view is not transferred.
|
|
|
|
|
2012-11-22 13:10:23 +00:00
|
|
|
int countViews (const CSMDoc::Document *document) const;
|
|
|
|
///< Return number of views for \a document.
|
|
|
|
|
|
|
|
bool closeRequest (View *view);
|
|
|
|
|
2012-11-23 13:05:49 +00:00
|
|
|
signals:
|
|
|
|
|
2013-09-08 10:06:28 +00:00
|
|
|
void newGameRequest();
|
|
|
|
|
|
|
|
void newAddonRequest();
|
2012-11-23 13:05:49 +00:00
|
|
|
|
2013-02-02 15:14:58 +00:00
|
|
|
void loadDocumentRequest();
|
|
|
|
|
2013-03-06 12:41:33 +00:00
|
|
|
void closeMessageBox();
|
|
|
|
|
2013-09-08 07:33:45 +00:00
|
|
|
void editSettingsRequest();
|
|
|
|
|
2013-03-12 11:28:13 +00:00
|
|
|
public slots:
|
|
|
|
|
|
|
|
void exitApplication (CSVDoc::View *view);
|
2013-03-11 11:38:27 +00:00
|
|
|
|
2012-11-22 22:42:17 +00:00
|
|
|
private slots:
|
2012-11-22 12:30:02 +00:00
|
|
|
|
2012-11-22 22:42:17 +00:00
|
|
|
void documentStateChanged (int state, CSMDoc::Document *document);
|
2012-11-23 09:25:34 +00:00
|
|
|
|
2012-11-23 11:20:35 +00:00
|
|
|
void progress (int current, int max, int type, int threads, CSMDoc::Document *document);
|
2013-03-06 12:41:33 +00:00
|
|
|
|
2013-03-11 11:38:27 +00:00
|
|
|
void onExitWarningHandler(int state, CSMDoc::Document* document);
|
2013-06-15 11:40:18 +00:00
|
|
|
|
2013-06-20 23:06:25 +00:00
|
|
|
/// connected to update signal in UserSettings
|
2013-06-15 11:40:18 +00:00
|
|
|
void slotUpdateEditorSetting (const QString &, const QString &);
|
2012-11-22 12:30:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-03-02 13:57:41 +00:00
|
|
|
#endif
|