File: viewmanager.hpp

package info (click to toggle)
openmw 0.50.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 37,076 kB
  • sloc: cpp: 380,958; xml: 2,192; sh: 1,449; python: 911; makefile: 26; javascript: 5
file content (97 lines) | stat: -rw-r--r-- 2,183 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#ifndef CSV_DOC_VIEWMANAGER_H
#define CSV_DOC_VIEWMANAGER_H

#include <string>
#include <vector>

#include <QObject>

#include "loader.hpp"

namespace CSMDoc
{
    class Document;
    class DocumentManager;
}

namespace CSVWorld
{
    class CommandDelegateFactoryCollection;
}

namespace CSMWorld
{
    class UniversalId;
}

namespace CSVDoc
{
    class View;

    class ViewManager : public QObject
    {
        Q_OBJECT

        CSMDoc::DocumentManager& mDocumentManager;
        std::vector<View*> mViews;
        CSVWorld::CommandDelegateFactoryCollection* mDelegateFactories;
        bool mExitOnSaveStateChange;
        bool mUserWarned;
        Loader mLoader;

        // not implemented
        ViewManager(const ViewManager&);
        ViewManager& operator=(const ViewManager&);

        void updateIndices();
        bool notifySaveOnClose(View* view = nullptr);
        bool showModifiedDocumentMessageBox(View* view);
        bool showSaveInProgressMessageBox(View* view);
        bool removeDocument(View* view);

    public:
        ViewManager(CSMDoc::DocumentManager& documentManager);

        ~ViewManager() override;

        View* addView(CSMDoc::Document* document);
        ///< The ownership of the returned view is not transferred.

        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.

        bool closeRequest(View* view);
        void removeDocAndView(CSMDoc::Document* document);

    signals:

        void newGameRequest();

        void newAddonRequest();

        void loadDocumentRequest();

        void closeMessageBox();

        void editSettingsRequest();

        void mergeDocument(CSMDoc::Document* document);

    public slots:

        void exitApplication(CSVDoc::View* view);

    private slots:

        void documentStateChanged(int state, CSMDoc::Document* document);

        void progress(int current, int max, int type, int threads, CSMDoc::Document* document);

        void onExitWarningHandler(int state, CSMDoc::Document* document);
    };

}

#endif