From f68704f8fd4e6ad1c8d704b7a535f78b3afae50c Mon Sep 17 00:00:00 2001
From: Tobias Hunger <tobias.hunger@theqtcompany.com>
Date: Thu, 28 May 2015 15:51:05 +0200
Subject: [PATCH] JsonWizard: Make checkbox default values true and false

That is closer to what a user expects than the "0" and "1" used
before.

Change-Id: I08b3a7b0361dd54b75ee7b2213b3d120fb016bf5
Reviewed-by: Alessandro Portale <alessandro.portale@theqtcompany.com>
---
 share/qtcreator/templates/wizards/files/js/file.js            | 2 +-
 share/qtcreator/templates/wizards/files/js/wizard.json        | 2 --
 .../wizards/projects/qmake/qtquickapplication/wizard.json     | 2 --
 .../projects/qmake/qtquickcontrolsapplication/wizard.json     | 4 ----
 .../projects/qmlproject/qtquickapplication/wizard.json        | 2 --
 .../qmlproject/qtquickcontrolsapplication/wizard.json         | 2 --
 src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp      | 4 ++--
 7 files changed, 3 insertions(+), 15 deletions(-)

diff --git a/share/qtcreator/templates/wizards/files/js/file.js b/share/qtcreator/templates/wizards/files/js/file.js
index b17567bd0bc..8e7f43ee120 100644
--- a/share/qtcreator/templates/wizards/files/js/file.js
+++ b/share/qtcreator/templates/wizards/files/js/file.js
@@ -1,4 +1,4 @@
-@if '%{Stateless}'
+@if %{Stateless}
 .pragma library
 
 @endif
diff --git a/share/qtcreator/templates/wizards/files/js/wizard.json b/share/qtcreator/templates/wizards/files/js/wizard.json
index 80165502e1f..017795cd23a 100644
--- a/share/qtcreator/templates/wizards/files/js/wizard.json
+++ b/share/qtcreator/templates/wizards/files/js/wizard.json
@@ -29,8 +29,6 @@
                     "span": true,
                     "data":
                     {
-                        "checkedValue": "yes",
-                        "uncheckedValue": "",
                         "checked": false
                     }
                 }
diff --git a/share/qtcreator/templates/wizards/projects/qmake/qtquickapplication/wizard.json b/share/qtcreator/templates/wizards/projects/qmake/qtquickapplication/wizard.json
index 25c22b68c55..841873a91d5 100644
--- a/share/qtcreator/templates/wizards/projects/qmake/qtquickapplication/wizard.json
+++ b/share/qtcreator/templates/wizards/projects/qmake/qtquickapplication/wizard.json
@@ -73,8 +73,6 @@
                     "type": "CheckBox",
                     "data":
                     {
-                        "checkedValue": true,
-                        "uncheckedValue": false,
                         "checked": false
                     }
                 }
diff --git a/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrolsapplication/wizard.json b/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrolsapplication/wizard.json
index 7d3cec48578..562fb15ff19 100644
--- a/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrolsapplication/wizard.json
+++ b/share/qtcreator/templates/wizards/projects/qmake/qtquickcontrolsapplication/wizard.json
@@ -81,8 +81,6 @@
                     "type": "CheckBox",
                     "data":
                     {
-                        "checkedValue": true,
-                        "uncheckedValue": false,
                         "checked": true
                     }
                 },
@@ -92,8 +90,6 @@
                     "type": "CheckBox",
                     "data":
                     {
-                        "checkedValue": true,
-                        "uncheckedValue": false,
                         "checked": true
                     }
                 }
diff --git a/share/qtcreator/templates/wizards/projects/qmlproject/qtquickapplication/wizard.json b/share/qtcreator/templates/wizards/projects/qmlproject/qtquickapplication/wizard.json
index 48a06a902e8..30d885eb00a 100644
--- a/share/qtcreator/templates/wizards/projects/qmlproject/qtquickapplication/wizard.json
+++ b/share/qtcreator/templates/wizards/projects/qmlproject/qtquickapplication/wizard.json
@@ -73,8 +73,6 @@
                     "type": "CheckBox",
                     "data":
                     {
-                        "checkedValue": true,
-                        "uncheckedValue": false,
                         "checked": false
                     }
                 }
diff --git a/share/qtcreator/templates/wizards/projects/qmlproject/qtquickcontrolsapplication/wizard.json b/share/qtcreator/templates/wizards/projects/qmlproject/qtquickcontrolsapplication/wizard.json
index dfa8a6822c5..ead3eaf47c8 100644
--- a/share/qtcreator/templates/wizards/projects/qmlproject/qtquickcontrolsapplication/wizard.json
+++ b/share/qtcreator/templates/wizards/projects/qmlproject/qtquickcontrolsapplication/wizard.json
@@ -81,8 +81,6 @@
                     "type": "CheckBox",
                     "data":
                     {
-                        "checkedValue": true,
-                        "uncheckedValue": false,
                         "checked": true
                     }
                 }
diff --git a/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp b/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp
index 8923419b0f9..282aa229c1e 100644
--- a/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp
+++ b/src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp
@@ -617,8 +617,8 @@ bool JsonFieldPage::CheckBoxField::parseData(const QVariant &data, QString *erro
 
     QVariantMap tmp = data.toMap();
 
-    m_checkedValue = tmp.value(QLatin1String("checkedValue"), QLatin1String("0")).toString();
-    m_uncheckedValue = tmp.value(QLatin1String("uncheckedValue"), QLatin1String("1")).toString();
+    m_checkedValue = tmp.value(QLatin1String("checkedValue"), true).toString();
+    m_uncheckedValue = tmp.value(QLatin1String("uncheckedValue"), false).toString();
     if (m_checkedValue == m_uncheckedValue) {
         *errorMessage= QCoreApplication::translate("ProjectExplorer::JsonFieldPage",
                                                    "CheckBox values for checked and unchecked state are identical.");
-- 
GitLab