diff options
author | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2010-03-16 16:51:45 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2010-03-16 16:51:45 +0100 |
commit | 2edcc7ef33f20e4e17f408821c67e90dada8237b (patch) | |
tree | 75d9b2d59497cb9d24edf4dc94f960c57fe69c45 /src/plugins/qmldesigner/designersettings.cpp | |
parent | 33574581017c0c310f4ad010a6e7adea825993b9 (diff) | |
download | qt-creator-2edcc7ef33f20e4e17f408821c67e90dada8237b.tar.gz |
Design mode: Give IEditor a 'preferred mode'.
... and switch to it in EditorManager::activateEditor.
There no longer is a need for special currentEditorChanged()
handling in the editor that use a special mode.
QmlDesigner receives an additional setting specifying the
desired edit mode. QmlJSEditor detects whether QmlDesigner
is present by checking the registered mimetypes of the
Design mode and retrieves the settings via keys.
Remove some obsolete code and clean up includes
on qmldesignerconstants.h
Reviewed-by: con
Diffstat (limited to 'src/plugins/qmldesigner/designersettings.cpp')
-rw-r--r-- | src/plugins/qmldesigner/designersettings.cpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/plugins/qmldesigner/designersettings.cpp b/src/plugins/qmldesigner/designersettings.cpp index b5eee4e051..acfa55cd82 100644 --- a/src/plugins/qmldesigner/designersettings.cpp +++ b/src/plugins/qmldesigner/designersettings.cpp @@ -28,13 +28,12 @@ **************************************************************************/ #include "designersettings.h" +#include "qmldesignerconstants.h" #include <QtCore/QSettings> using namespace QmlDesigner; -static const char *qmlGroup = "Qml"; -static const char *qmlDesignerGroup = "Designer"; static const char *snapToGridKey = "SnapToGrid"; static const char *showBoundingRectanglesKey = "ShowBoundingRectangles"; static const char *onlyShowItemsWithContentsKey = "OnlyShowItemsWithContents"; @@ -43,29 +42,34 @@ DesignerSettings::DesignerSettings() : snapToGrid(false) , showBoundingRectangles(false) , onlyShowItemsWithContents(false) + , openDesignMode(QmlDesigner::Constants::QML_OPENDESIGNMODE_DEFAULT) {} void DesignerSettings::fromSettings(QSettings *settings) { - settings->beginGroup(QLatin1String(qmlGroup)); - settings->beginGroup(QLatin1String(qmlDesignerGroup)); + settings->beginGroup(QLatin1String(QmlDesigner::Constants::QML_SETTINGS_GROUP)); + settings->beginGroup(QLatin1String(QmlDesigner::Constants::QML_DESIGNER_SETTINGS_GROUP)); snapToGrid = settings->value(QLatin1String(snapToGridKey), false).toBool(); showBoundingRectangles = settings->value( QLatin1String(showBoundingRectanglesKey), false).toBool(); onlyShowItemsWithContents = settings->value( QLatin1String(onlyShowItemsWithContentsKey), false).toBool(); + openDesignMode = settings->value( + QLatin1String(QmlDesigner::Constants::QML_OPENDESIGNMODE_SETTINGS_KEY), + bool(QmlDesigner::Constants::QML_OPENDESIGNMODE_DEFAULT)).toBool(); settings->endGroup(); settings->endGroup(); } void DesignerSettings::toSettings(QSettings *settings) const { - settings->beginGroup(QLatin1String(qmlGroup)); - settings->beginGroup(QLatin1String(qmlDesignerGroup)); + settings->beginGroup(QLatin1String(QmlDesigner::Constants::QML_SETTINGS_GROUP)); + settings->beginGroup(QLatin1String(QmlDesigner::Constants::QML_DESIGNER_SETTINGS_GROUP)); settings->setValue(QLatin1String(snapToGridKey), snapToGrid); settings->setValue(QLatin1String(showBoundingRectanglesKey), showBoundingRectangles); settings->setValue(QLatin1String(onlyShowItemsWithContentsKey), onlyShowItemsWithContents); + settings->setValue(QLatin1String(QmlDesigner::Constants::QML_OPENDESIGNMODE_SETTINGS_KEY), openDesignMode); settings->endGroup(); settings->endGroup(); } @@ -73,5 +77,7 @@ void DesignerSettings::toSettings(QSettings *settings) const bool DesignerSettings::equals(const DesignerSettings &other) const { return snapToGrid == other.snapToGrid - && showBoundingRectangles == other.showBoundingRectangles; + && showBoundingRectangles == other.showBoundingRectangles + && onlyShowItemsWithContents == other.onlyShowItemsWithContents + && openDesignMode == other.openDesignMode; } |