2012-11-22 13:30:02 +01:00
|
|
|
#ifndef CSV_DOC_VIEWMANAGER_H
|
|
|
|
#define CSV_DOC_VIEWMANAGER_H
|
|
|
|
|
2022-10-19 19:02:00 +02:00
|
|
|
#include <string>
|
2012-11-22 13:30:02 +01:00
|
|
|
#include <vector>
|
|
|
|
|
2012-11-22 23:42:17 +01:00
|
|
|
#include <QObject>
|
|
|
|
|
2014-04-29 14:17:25 +02:00
|
|
|
#include "loader.hpp"
|
|
|
|
|
2012-11-22 13:30:02 +01:00
|
|
|
namespace CSMDoc
|
|
|
|
{
|
|
|
|
class Document;
|
2012-11-22 14:10:23 +01:00
|
|
|
class DocumentManager;
|
2012-11-22 13:30:02 +01:00
|
|
|
}
|
|
|
|
|
2013-02-10 17:21:25 +01:00
|
|
|
namespace CSVWorld
|
|
|
|
{
|
|
|
|
class CommandDelegateFactoryCollection;
|
|
|
|
}
|
|
|
|
|
2014-09-23 17:01:08 +10:00
|
|
|
namespace CSMWorld
|
|
|
|
{
|
|
|
|
class UniversalId;
|
|
|
|
}
|
|
|
|
|
2012-11-22 13:30:02 +01:00
|
|
|
namespace CSVDoc
|
|
|
|
{
|
|
|
|
class View;
|
|
|
|
|
2012-11-22 23:42:17 +01:00
|
|
|
class ViewManager : public QObject
|
2012-11-22 13:30:02 +01:00
|
|
|
{
|
2012-11-22 23:42:17 +01:00
|
|
|
Q_OBJECT
|
|
|
|
|
2012-11-22 14:10:23 +01:00
|
|
|
CSMDoc::DocumentManager& mDocumentManager;
|
2012-11-22 13:30:02 +01:00
|
|
|
std::vector<View*> mViews;
|
2013-02-10 17:21:25 +01:00
|
|
|
CSVWorld::CommandDelegateFactoryCollection* mDelegateFactories;
|
2013-03-12 06:28:13 -05:00
|
|
|
bool mExitOnSaveStateChange;
|
2013-03-06 06:41:33 -06:00
|
|
|
bool mUserWarned;
|
2014-04-29 14:17:25 +02:00
|
|
|
Loader mLoader;
|
2012-11-22 13:30:02 +01:00
|
|
|
|
|
|
|
// not implemented
|
|
|
|
ViewManager(const ViewManager&);
|
|
|
|
ViewManager& operator=(const ViewManager&);
|
|
|
|
|
2012-11-22 15:09:04 +01:00
|
|
|
void updateIndices();
|
2020-11-13 11:39:47 +04:00
|
|
|
bool notifySaveOnClose(View* view = nullptr);
|
2013-03-12 06:28:13 -05:00
|
|
|
bool showModifiedDocumentMessageBox(View* view);
|
|
|
|
bool showSaveInProgressMessageBox(View* view);
|
2014-09-10 14:40:41 +10:00
|
|
|
bool removeDocument(View* view);
|
2012-11-22 15:09:04 +01:00
|
|
|
|
2012-11-22 13:30:02 +01:00
|
|
|
public:
|
2012-11-22 14:10:23 +01:00
|
|
|
ViewManager(CSMDoc::DocumentManager& documentManager);
|
2012-11-22 13:30:02 +01:00
|
|
|
|
2012-11-22 14:10:23 +01:00
|
|
|
~ViewManager() override;
|
2012-11-22 13:30:02 +01:00
|
|
|
|
2021-05-18 19:53:55 -05:00
|
|
|
View* addView(CSMDoc::Document* document);
|
|
|
|
///< The ownership of the returned view is not transferred.
|
2012-11-22 13:30:02 +01:00
|
|
|
|
|
|
|
View* addView(CSMDoc::Document* document, const CSMWorld::UniversalId& id, const std::string& hint);
|
|
|
|
|
2014-09-23 17:01:08 +10:00
|
|
|
int countViews(const CSMDoc::Document* document) const;
|
|
|
|
///< Return number of views for \a document.
|
|
|
|
|
2012-11-22 14:10:23 +01:00
|
|
|
bool closeRequest(View* view);
|
|
|
|
void removeDocAndView(CSMDoc::Document* document);
|
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
signals:
|
2012-11-22 14:10:23 +01:00
|
|
|
|
2013-09-08 12:06:28 +02:00
|
|
|
void newGameRequest();
|
2012-11-23 14:05:49 +01:00
|
|
|
|
2013-09-08 12:06:28 +02:00
|
|
|
void newAddonRequest();
|
|
|
|
|
|
|
|
void loadDocumentRequest();
|
2012-11-23 14:05:49 +01:00
|
|
|
|
2013-02-02 16:14:58 +01:00
|
|
|
void closeMessageBox();
|
|
|
|
|
2013-03-06 06:41:33 -06:00
|
|
|
void editSettingsRequest();
|
|
|
|
|
2013-09-08 09:33:45 +02:00
|
|
|
void mergeDocument(CSMDoc::Document* document);
|
|
|
|
|
2013-03-12 06:28:13 -05:00
|
|
|
public slots:
|
2015-08-06 12:52:10 +02:00
|
|
|
|
2013-03-12 06:28:13 -05:00
|
|
|
void exitApplication(CSVDoc::View* view);
|
|
|
|
|
|
|
|
private slots:
|
2013-03-11 06:38:27 -05:00
|
|
|
|
2012-11-22 23:42:17 +01:00
|
|
|
void documentStateChanged(int state, CSMDoc::Document* document);
|
2012-11-22 13:30:02 +01:00
|
|
|
|
2012-11-22 23:42:17 +01:00
|
|
|
void progress(int current, int max, int type, int threads, CSMDoc::Document* document);
|
2012-11-23 10:25:34 +01:00
|
|
|
|
2013-03-11 06:38:27 -05:00
|
|
|
void onExitWarningHandler(int state, CSMDoc::Document* document);
|
2012-11-22 13:30:02 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-03-02 07:57:41 -06:00
|
|
|
#endif
|