formeditorw.h 3.16 KB
Newer Older
hjk's avatar
hjk committed
1
/****************************************************************************
con's avatar
con committed
2
**
3 4
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
con's avatar
con committed
5
**
hjk's avatar
hjk committed
6
** This file is part of Qt Creator.
con's avatar
con committed
7
**
hjk's avatar
hjk committed
8 9 10 11
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
12 13 14
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
15
**
16 17 18 19 20 21 22
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
con's avatar
con committed
23
**
hjk's avatar
hjk committed
24
****************************************************************************/
hjk's avatar
hjk committed
25

hjk's avatar
hjk committed
26
#pragma once
con's avatar
con committed
27

28 29
#include "designerconstants.h"

30
#include <QObject>
31

con's avatar
con committed
32 33 34 35
QT_BEGIN_NAMESPACE
class QDesignerFormEditorInterface;
QT_END_NAMESPACE

36 37 38 39 40
namespace Core {
class IEditor;
class IOptionsPage;
}

41
namespace SharedTools { class WidgetHost; }
con's avatar
con committed
42 43 44

namespace Designer {

45 46 47
class FormWindowEditor;

namespace Internal {
con's avatar
con committed
48 49

/** FormEditorW is a singleton that stores the Designer CoreInterface and
50
  * performs centralized operations. The instance() function will return an
con's avatar
con committed
51 52 53 54 55 56 57 58
  * instance. However, it must be manually deleted when unloading the
  * plugin. Since fully initializing Designer at startup is expensive, the
  * class has an internal partial initialisation stage "RegisterPlugins"
  * which is there to register the Creator plugin objects
  * that must be present at startup (settings pages, actions).
  * The plugin uses this stage at first by calling ensureInitStage().
  * Requesting an editor via instance() will fully initialize the class.
  * This is based on the assumption that the Designer settings work with
59
  * no plugins loaded.
60 61
  *
  * The form editor shows a read-only XML editor in edit mode and Qt Designer
62
  * in Design mode. */
con's avatar
con committed
63 64 65 66 67 68
class FormEditorW : public QObject
{
public:
    enum InitializationStage {
        // Register Creator plugins (settings pages, actions)
        RegisterPlugins,
69 70
        // Subwindows of the designer are initialized
        SubwindowsInitialized,
con's avatar
con committed
71 72 73 74 75 76 77 78 79
        // Fully initialized for handling editor requests
        FullyInitialized
    };

    // Create an instance and initialize up to stage s
    static void ensureInitStage(InitializationStage s);
    // Deletes an existing instance if there is one.
    static void deleteInstance();

80
    static Core::IEditor *createEditor();
Lasse Holmstedt's avatar
Lasse Holmstedt committed
81

82 83
    static QDesignerFormEditorInterface *designerEditor();
    static QWidget * const *designerSubWindows();
Lasse Holmstedt's avatar
Lasse Holmstedt committed
84

85 86 87
    static SharedTools::WidgetHost *activeWidgetHost();
    static FormWindowEditor *activeEditor();
    static QList<Core::IOptionsPage *> optionsPages();
con's avatar
con committed
88 89 90 91
};

} // namespace Internal
} // namespace Designer