2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2010-02-09 11:09:11 +01:00
|
|
|
**
|
2015-01-14 18:07:15 +01:00
|
|
|
** Copyright (C) 2015 The Qt Company Ltd.
|
|
|
|
|
** Contact: http://www.qt.io/licensing
|
2010-02-09 11:09:11 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2010-02-09 11:09:11 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** 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
|
2015-01-14 18:07:15 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms and
|
|
|
|
|
** conditions see http://www.qt.io/terms-conditions. For further information
|
2014-10-01 13:21:18 +02:00
|
|
|
** use the contact form at http://www.qt.io/contact-us.
|
2010-02-09 11:09:11 +01:00
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
2014-10-01 13:21:18 +02:00
|
|
|
** General Public License version 2.1 or version 3 as published by the Free
|
|
|
|
|
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
|
|
|
|
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
|
|
|
|
** following information to ensure the GNU Lesser General Public License
|
|
|
|
|
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2012-10-02 09:12:39 +02:00
|
|
|
**
|
2015-01-14 18:07:15 +01:00
|
|
|
** In addition, as a special exception, The Qt Company gives you certain additional
|
|
|
|
|
** rights. These rights are described in The Qt Company LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2010-02-09 11:09:11 +01:00
|
|
|
|
|
|
|
|
#include "designersettings.h"
|
2010-03-16 16:51:45 +01:00
|
|
|
#include "qmldesignerconstants.h"
|
2010-02-09 11:09:11 +01:00
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QSettings>
|
2010-02-09 11:09:11 +01:00
|
|
|
|
|
|
|
|
using namespace QmlDesigner;
|
|
|
|
|
|
2010-02-09 16:01:47 +01:00
|
|
|
DesignerSettings::DesignerSettings()
|
2013-05-31 12:52:53 +02:00
|
|
|
: itemSpacing(0),
|
2013-05-23 15:30:43 +02:00
|
|
|
containerPadding(0),
|
2011-03-02 16:20:36 +01:00
|
|
|
canvasWidth(10000),
|
2012-10-26 13:57:58 +02:00
|
|
|
canvasHeight(10000),
|
|
|
|
|
warningsInDesigner(true),
|
2013-03-14 16:02:19 +01:00
|
|
|
designerWarningsInEditor(false),
|
|
|
|
|
showDebugView(false),
|
2014-06-25 18:01:53 +02:00
|
|
|
enableDebugView(false),
|
2014-08-05 18:18:27 +02:00
|
|
|
alwaysSaveInCrumbleBar(false),
|
2014-09-09 10:37:48 +02:00
|
|
|
useOnlyFallbackPuppet(true)
|
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));
|
2010-04-08 16:26:45 +02:00
|
|
|
itemSpacing = settings->value(
|
2013-05-15 17:16:04 +02:00
|
|
|
QLatin1String(QmlDesigner::Constants::QML_ITEMSPACING_KEY), QVariant(6)).toInt();
|
2013-05-23 15:30:43 +02:00
|
|
|
containerPadding = settings->value(
|
|
|
|
|
QLatin1String(QmlDesigner::Constants::QML_CONTAINERPADDING_KEY), QVariant(8)).toInt();
|
2011-03-02 16:20:36 +01:00
|
|
|
canvasWidth = settings->value(QLatin1String(QmlDesigner::Constants::QML_CANVASWIDTH_KEY), QVariant(10000)).toInt();
|
|
|
|
|
canvasHeight = settings->value(QLatin1String(QmlDesigner::Constants::QML_CANVASHEIGHT_KEY), QVariant(10000)).toInt();
|
2012-10-26 13:57:58 +02:00
|
|
|
warningsInDesigner = settings->value(
|
|
|
|
|
QLatin1String(QmlDesigner::Constants::QML_WARNIN_FOR_FEATURES_IN_DESIGNER_KEY), QVariant(true)).toBool();
|
|
|
|
|
designerWarningsInEditor = settings->value(
|
|
|
|
|
QLatin1String(QmlDesigner::Constants::QML_WARNIN_FOR_DESIGNER_FEATURES_IN_EDITOR_KEY), QVariant(false)).toBool();
|
2013-03-14 16:02:19 +01:00
|
|
|
showDebugView = settings->value(
|
|
|
|
|
QLatin1String(QmlDesigner::Constants::QML_SHOW_DEBUGVIEW), QVariant(false)).toBool();
|
|
|
|
|
enableDebugView = settings->value(
|
|
|
|
|
QLatin1String(QmlDesigner::Constants::QML_ENABLE_DEBUGVIEW), QVariant(false)).toBool();
|
2014-06-25 18:01:53 +02:00
|
|
|
alwaysSaveInCrumbleBar = settings->value(
|
|
|
|
|
QLatin1String(QmlDesigner::Constants::QML_ALWAYS_SAFE_IN_CRUMBLEBAR), QVariant(false)).toBool();
|
2014-08-05 18:18:27 +02:00
|
|
|
useOnlyFallbackPuppet = settings->value(
|
2014-09-09 10:37:48 +02:00
|
|
|
QLatin1String(QmlDesigner::Constants::QML_USE_ONLY_FALLBACK_PUPPET), QVariant(true)).toBool();
|
2012-10-26 13:57:58 +02:00
|
|
|
|
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));
|
2010-04-08 16:26:45 +02:00
|
|
|
settings->setValue(QLatin1String(QmlDesigner::Constants::QML_ITEMSPACING_KEY), itemSpacing);
|
2013-05-23 15:30:43 +02:00
|
|
|
settings->setValue(QLatin1String(QmlDesigner::Constants::QML_CONTAINERPADDING_KEY), containerPadding);
|
2011-03-02 16:20:36 +01:00
|
|
|
settings->setValue(QLatin1String(QmlDesigner::Constants::QML_CANVASWIDTH_KEY), canvasWidth);
|
|
|
|
|
settings->setValue(QLatin1String(QmlDesigner::Constants::QML_CANVASHEIGHT_KEY), canvasHeight);
|
2012-10-26 13:57:58 +02:00
|
|
|
settings->setValue(QLatin1String(QmlDesigner::Constants::QML_WARNIN_FOR_FEATURES_IN_DESIGNER_KEY), warningsInDesigner);
|
|
|
|
|
settings->setValue(QLatin1String(QmlDesigner::Constants::QML_WARNIN_FOR_DESIGNER_FEATURES_IN_EDITOR_KEY), designerWarningsInEditor);
|
2013-03-14 16:02:19 +01:00
|
|
|
settings->setValue(QLatin1String(QmlDesigner::Constants::QML_SHOW_DEBUGVIEW), showDebugView);
|
|
|
|
|
settings->setValue(QLatin1String(QmlDesigner::Constants::QML_ENABLE_DEBUGVIEW), enableDebugView);
|
2014-06-25 18:01:53 +02:00
|
|
|
settings->setValue(QLatin1String(QmlDesigner::Constants::QML_ALWAYS_SAFE_IN_CRUMBLEBAR), alwaysSaveInCrumbleBar);
|
2014-08-05 18:18:27 +02:00
|
|
|
settings->setValue(QLatin1String(QmlDesigner::Constants::QML_USE_ONLY_FALLBACK_PUPPET), useOnlyFallbackPuppet);
|
2012-10-26 13:57:58 +02:00
|
|
|
|
2010-02-09 11:09:11 +01:00
|
|
|
settings->endGroup();
|
|
|
|
|
settings->endGroup();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool DesignerSettings::equals(const DesignerSettings &other) const
|
|
|
|
|
{
|
2013-05-31 12:52:53 +02:00
|
|
|
return containerPadding == other.containerPadding
|
2011-03-02 16:20:36 +01:00
|
|
|
&& canvasWidth == other.canvasWidth
|
2012-10-26 13:57:58 +02:00
|
|
|
&& canvasHeight == other.canvasHeight
|
|
|
|
|
&& warningsInDesigner == other.warningsInDesigner
|
2013-03-14 16:02:19 +01:00
|
|
|
&& designerWarningsInEditor == other.designerWarningsInEditor
|
|
|
|
|
&& showDebugView == other.showDebugView
|
2014-06-25 18:01:53 +02:00
|
|
|
&& enableDebugView == other.enableDebugView
|
2014-08-05 18:18:27 +02:00
|
|
|
&& alwaysSaveInCrumbleBar == other.alwaysSaveInCrumbleBar
|
|
|
|
|
&& useOnlyFallbackPuppet == other.useOnlyFallbackPuppet;
|
2010-02-09 11:09:11 +01:00
|
|
|
}
|