1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-22 20:23:53 +00:00
openmw/apps/opencs/view/doc/viewmanager.hpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

98 lines
2.1 KiB
C++
Raw Normal View History

2012-11-22 12:30:02 +00:00
#ifndef CSV_DOC_VIEWMANAGER_H
#define CSV_DOC_VIEWMANAGER_H
2022-10-19 17:02:00 +00:00
#include <string>
2012-11-22 12:30:02 +00:00
#include <vector>
#include <QObject>
2014-04-29 12:17:25 +00:00
#include "loader.hpp"
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;
}
namespace CSMWorld
{
class UniversalId;
}
2012-11-22 12:30:02 +00:00
namespace CSVDoc
{
class View;
class ViewManager : public QObject
2012-11-22 12:30:02 +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;
bool mExitOnSaveStateChange;
2013-03-06 12:41:33 +00:00
bool mUserWarned;
2014-04-29 12:17:25 +00:00
Loader mLoader;
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();
2020-11-13 07:39:47 +00:00
bool notifySaveOnClose(View* view = nullptr);
bool showModifiedDocumentMessageBox(View* view);
bool showSaveInProgressMessageBox(View* view);
2014-09-10 04:40:41 +00:00
bool removeDocument(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 13:10:23 +00:00
~ViewManager() override;
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 12:30:02 +00:00
View* addView(CSMDoc::Document* document, const CSMWorld::UniversalId& id, const std::string& hint);
int countViews(const CSMDoc::Document* document) const;
///< Return number of views for \a document.
2012-11-22 13:10:23 +00:00
bool closeRequest(View* view);
void removeDocAndView(CSMDoc::Document* document);
2022-09-22 18:26:05 +00:00
signals:
2012-11-22 13:10:23 +00:00
void newGameRequest();
2012-11-23 13:05:49 +00:00
void newAddonRequest();
void loadDocumentRequest();
2012-11-23 13:05:49 +00:00
2013-02-02 15:14:58 +00:00
void closeMessageBox();
2013-03-06 12:41:33 +00:00
void editSettingsRequest();
void mergeDocument(CSMDoc::Document* document);
public slots:
void exitApplication(CSVDoc::View* view);
private slots:
void documentStateChanged(int state, CSMDoc::Document* document);
2012-11-22 12:30:02 +00:00
void progress(int current, int max, int type, int threads, CSMDoc::Document* document);
2012-11-23 09:25:34 +00:00
void onExitWarningHandler(int state, CSMDoc::Document* document);
2012-11-22 12:30:02 +00:00
};
}
2013-03-02 13:57:41 +00:00
#endif