2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2010-02-09 11:09:11 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://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
|
2016-01-15 14:57:40 +01:00
|
|
|
** 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.
|
2010-02-09 11:09:11 +01:00
|
|
|
**
|
2015-09-18 11:34:48 +02:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
2016-01-15 14:57:40 +01:00
|
|
|
** 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.
|
2010-12-17 16:01:08 +01:00
|
|
|
**
|
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();
|
2015-12-14 16:31:29 +09:00
|
|
|
useQsTrFunction = settings->value(
|
|
|
|
|
QLatin1String(QmlDesigner::Constants::QML_USE_QSTR_FUNCTION), QVariant(true)).toBool();
|
2015-07-16 11:49:50 +02:00
|
|
|
puppetFallbackDirectory = settings->value(
|
|
|
|
|
QLatin1String(QmlDesigner::Constants::QML_PUPPET_FALLBACK_DIRECTORY)).toString();
|
|
|
|
|
puppetToplevelBuildDirectory = settings->value(
|
|
|
|
|
QLatin1String(QmlDesigner::Constants::QML_PUPPET_TOPLEVEL_BUILD_DIRECTORY)).toString();
|
|
|
|
|
controlsStyle = settings->value(
|
|
|
|
|
QLatin1String(QmlDesigner::Constants::QML_CONTROLS_STYLE)).toString();
|
|
|
|
|
|
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);
|
2015-12-14 16:31:29 +09:00
|
|
|
settings->setValue(QLatin1String(QmlDesigner::Constants::QML_USE_QSTR_FUNCTION), useQsTrFunction);
|
2015-07-16 11:49:50 +02:00
|
|
|
settings->setValue(QLatin1String(QmlDesigner::Constants::QML_PUPPET_FALLBACK_DIRECTORY), puppetFallbackDirectory);
|
|
|
|
|
settings->setValue(QLatin1String(QmlDesigner::Constants::QML_PUPPET_TOPLEVEL_BUILD_DIRECTORY), puppetToplevelBuildDirectory);
|
|
|
|
|
settings->setValue(QLatin1String(QmlDesigner::Constants::QML_CONTROLS_STYLE), controlsStyle);
|
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
|
2015-07-16 11:49:50 +02:00
|
|
|
&& useOnlyFallbackPuppet == other.useOnlyFallbackPuppet
|
2015-12-14 16:31:29 +09:00
|
|
|
&& useQsTrFunction == other.useQsTrFunction
|
2015-07-16 11:49:50 +02:00
|
|
|
&& puppetFallbackDirectory == other.puppetFallbackDirectory
|
|
|
|
|
&& puppetToplevelBuildDirectory == other.puppetToplevelBuildDirectory
|
|
|
|
|
&& controlsStyle == other.controlsStyle;
|
2010-02-09 11:09:11 +01:00
|
|
|
}
|