2010-02-09 11:09:11 +01:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2010-03-05 11:25:49 +01:00
|
|
|
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
2010-02-09 11:09:11 +01:00
|
|
|
**
|
|
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
|
|
|
**
|
|
|
|
|
** Commercial Usage
|
|
|
|
|
**
|
|
|
|
|
** Licensees holding valid Qt Commercial licenses may use this file in
|
|
|
|
|
** accordance with the Qt Commercial License Agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Nokia.
|
|
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
**
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
|
|
** General Public License version 2.1 as published by the Free Software
|
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
|
|
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
|
|
|
**
|
|
|
|
|
** If you are unsure which license is appropriate for your use, please
|
|
|
|
|
** contact the sales department at http://qt.nokia.com/contact.
|
|
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "designersettings.h"
|
2010-03-16 16:51:45 +01:00
|
|
|
#include "qmldesignerconstants.h"
|
2010-02-09 11:09:11 +01:00
|
|
|
|
|
|
|
|
#include <QtCore/QSettings>
|
|
|
|
|
|
|
|
|
|
using namespace QmlDesigner;
|
|
|
|
|
|
2010-02-09 16:01:47 +01:00
|
|
|
DesignerSettings::DesignerSettings()
|
2010-06-11 13:40:32 +10:00
|
|
|
: openDesignMode(QmlDesigner::Constants::QML_OPENDESIGNMODE_DEFAULT),
|
|
|
|
|
itemSpacing(0),
|
|
|
|
|
snapMargin(0)
|
2010-02-09 16:01:47 +01:00
|
|
|
{}
|
2010-06-11 13:40:32 +10:00
|
|
|
|
2010-02-09 11:09:11 +01:00
|
|
|
void DesignerSettings::fromSettings(QSettings *settings)
|
|
|
|
|
{
|
2010-03-16 16:51:45 +01:00
|
|
|
settings->beginGroup(QLatin1String(QmlDesigner::Constants::QML_SETTINGS_GROUP));
|
|
|
|
|
settings->beginGroup(QLatin1String(QmlDesigner::Constants::QML_DESIGNER_SETTINGS_GROUP));
|
|
|
|
|
openDesignMode = settings->value(
|
|
|
|
|
QLatin1String(QmlDesigner::Constants::QML_OPENDESIGNMODE_SETTINGS_KEY),
|
|
|
|
|
bool(QmlDesigner::Constants::QML_OPENDESIGNMODE_DEFAULT)).toBool();
|
2010-04-08 16:26:45 +02:00
|
|
|
itemSpacing = settings->value(
|
|
|
|
|
QLatin1String(QmlDesigner::Constants::QML_ITEMSPACING_KEY), QVariant(0)).toInt();
|
|
|
|
|
snapMargin = settings->value(
|
|
|
|
|
QLatin1String(QmlDesigner::Constants::QML_SNAPMARGIN_KEY), QVariant(0)).toInt();
|
2010-07-06 10:59:01 +02:00
|
|
|
enableContextPane = settings->value(
|
2010-08-02 17:09:35 +02:00
|
|
|
QLatin1String(QmlDesigner::Constants::QML_CONTEXTPANE_KEY), QVariant(1)).toBool();
|
|
|
|
|
pinContextPane = settings->value(
|
|
|
|
|
QLatin1String(QmlDesigner::Constants::QML_CONTEXTPANEPIN_KEY), QVariant(0)).toBool();
|
2010-02-09 11:09:11 +01:00
|
|
|
settings->endGroup();
|
|
|
|
|
settings->endGroup();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DesignerSettings::toSettings(QSettings *settings) const
|
|
|
|
|
{
|
2010-03-16 16:51:45 +01:00
|
|
|
settings->beginGroup(QLatin1String(QmlDesigner::Constants::QML_SETTINGS_GROUP));
|
|
|
|
|
settings->beginGroup(QLatin1String(QmlDesigner::Constants::QML_DESIGNER_SETTINGS_GROUP));
|
|
|
|
|
settings->setValue(QLatin1String(QmlDesigner::Constants::QML_OPENDESIGNMODE_SETTINGS_KEY), openDesignMode);
|
2010-04-08 16:26:45 +02:00
|
|
|
settings->setValue(QLatin1String(QmlDesigner::Constants::QML_ITEMSPACING_KEY), itemSpacing);
|
|
|
|
|
settings->setValue(QLatin1String(QmlDesigner::Constants::QML_SNAPMARGIN_KEY), snapMargin);
|
2010-07-06 10:59:01 +02:00
|
|
|
settings->setValue(QLatin1String(QmlDesigner::Constants::QML_CONTEXTPANE_KEY), enableContextPane);
|
2010-08-02 17:09:35 +02:00
|
|
|
settings->setValue(QLatin1String(QmlDesigner::Constants::QML_CONTEXTPANEPIN_KEY), pinContextPane);
|
2010-04-08 16:26:45 +02:00
|
|
|
|
2010-02-09 11:09:11 +01:00
|
|
|
settings->endGroup();
|
|
|
|
|
settings->endGroup();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool DesignerSettings::equals(const DesignerSettings &other) const
|
|
|
|
|
{
|
2010-04-08 16:26:45 +02:00
|
|
|
return openDesignMode == other.openDesignMode
|
|
|
|
|
&& snapMargin == other.snapMargin
|
2010-07-06 10:59:01 +02:00
|
|
|
&& itemSpacing == other.itemSpacing
|
2010-08-02 17:09:35 +02:00
|
|
|
&& enableContextPane == other.enableContextPane
|
|
|
|
|
&& pinContextPane == other.pinContextPane;
|
2010-02-09 11:09:11 +01:00
|
|
|
}
|