Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Q
qtquickcontrols-nemo
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
NemoMobile
qtquickcontrols-nemo
Commits
a8f19eb4
Commit
a8f19eb4
authored
Dec 08, 2013
by
Simonas Leleiva
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #15 from locusf/switch
[glacier] Checkbox implemented with Switch spec
parents
3dad6d94
b1750c15
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
336 additions
and
33 deletions
+336
-33
CheckboxPage.qml
examples/touch/content/CheckboxPage.qml
+49
-0
LabelPage.qml
examples/touch/content/LabelPage.qml
+0
-1
main.qml
examples/touch/main.qml
+4
-0
resources.qrc
examples/touch/resources.qrc
+1
-0
touch.pro
examples/touch/touch.pro
+2
-1
Checkbox.qml
src/controls/Checkbox.qml
+6
-0
controls.pro
src/controls/controls.pro
+2
-1
qmldir
src/controls/qmldir
+1
-1
CheckBoxStyle.qml
src/styles/CheckBoxStyle.qml
+124
-19
nemotheme.cpp
src/styles/autogenerated/nemotheme.cpp
+11
-3
nemotheme.h
src/styles/autogenerated/nemotheme.h
+4
-0
nemothemecheckbox.cpp
src/styles/autogenerated/nemothemecheckbox.cpp
+54
-0
nemothemecheckbox.h
src/styles/autogenerated/nemothemecheckbox.h
+48
-0
nemothemelabel.cpp
src/styles/autogenerated/nemothemelabel.cpp
+0
-1
switch-ball.png
src/styles/images/switch-ball.png
+0
-0
qquicknemostyleextensionplugin.cpp
src/styles/qquicknemostyleextensionplugin.cpp
+1
-0
styles.pro
src/styles/styles.pro
+6
-3
glacier.json
src/styles/themes/glacier.json
+5
-1
components.json
tools/themehelper/components.json
+18
-2
No files found.
examples/touch/content/CheckboxPage.qml
0 → 100644
View file @
a8f19eb4
/****************************************************************************************
**
** Copyright (C) 2013 Aleksi Suomalainen <suomalainen.aleksi@gmail.com>
** All rights reserved.
**
** You may use this file under the terms of BSD license as follows:
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** * Neither the name of the author nor the
** names of its contributors may be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
** ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**
****************************************************************************************/
import
QtQuick
2.1
import
QtQuick
.
Controls
1.0
//needed for the Stack attached property
import
QtQuick
.
Controls
.
Nemo
1.0
import
QtQuick
.
Controls
.
Styles
.
Nemo
1.0
Page
{
id
:
root
tools
:
ToolBarLayoutExample
{
title
:
"
Switch
"
}
Column
{
spacing
:
40
anchors.centerIn
:
parent
CheckBox
{
text
:
"
Test 1:
"
}
}
}
examples/touch/content/LabelPage.qml
View file @
a8f19eb4
...
...
@@ -44,7 +44,6 @@ Page {
anchors.centerIn
:
parent
Label
{
text
:
"
Test label
"
color
:
"
white
"
}
}
}
examples/touch/main.qml
View file @
a8f19eb4
...
...
@@ -95,6 +95,10 @@ ApplicationWindow {
title
:
"
Labels
"
page
:
"
content/LabelPage.qml
"
}
ListElement
{
title
:
"
Switches
"
page
:
"
content/CheckboxPage.qml
"
}
}
...
...
examples/touch/resources.qrc
View file @
a8f19eb4
...
...
@@ -19,5 +19,6 @@
<file>content/ToolBarLayoutExample.qml</file>
<file>content/SpinnerPage.qml</file>
<file>content/LabelPage.qml</file>
<file>content/CheckboxPage.qml</file>
</qresource>
</RCC>
examples/touch/touch.pro
View file @
a8f19eb4
...
...
@@ -20,7 +20,8 @@ OTHER_FILES += \
content
/
LiveCoding
.
qml
\
content
/
ToolBarLayoutExample
.
qml
\
content
/
SpinnerPage
.
qml
\
content
/
LabelPage
.
qml
content
/
LabelPage
.
qml
\
content
/
CheckboxPage
.
qml
RESOURCES
+=
\
resources
.
qrc
...
...
src/controls/Checkbox.qml
0 → 100644
View file @
a8f19eb4
import
QtQuick
2.1
import
QtQuick
.
Controls
1.0
CheckBox
{
}
src/controls/controls.pro
View file @
a8f19eb4
...
...
@@ -11,7 +11,8 @@ QML_FILES += \
ApplicationWindow
.
qml
\
Page
.
qml
\
Spinner
.
qml
\
Label
.
qml
Label
.
qml
\
Checkbox
.
qml
OTHER_FILES
+=
qmldir
\
$$
QML_FILES
...
...
src/controls/qmldir
View file @
a8f19eb4
...
...
@@ -13,6 +13,7 @@ ApplicationWindow 1.0 ApplicationWindow.qml
Page 1.0 Page.qml
Spinner 1.0 Spinner.qml
Label 1.0 Label.qml
CheckBox 1.0 Checkbox.qml
# MIRRORED CONTROLS:
# These are the controls that we take directly from official QQC.
...
...
@@ -23,7 +24,6 @@ Label 1.0 Label.qml
# case Nemo plugin doesn't provide an overridden component)
# NOTE: "../" here is assumed to be the relative path to the official QQC!!
CheckBox 1.0 ../CheckBox.qml
ComboBox 1.0 ../ComboBox.qml
GroupBox 1.0 ../GroupBox.qml
...
...
src/styles/CheckBoxStyle.qml
View file @
a8f19eb4
/*
* Copyright (C) 2013 Andrea Bernabei <and.bernabei@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
/****************************************************************************************
**
** Copyright (C) 2013 Aleksi Suomalainen <suomalainen.aleksi@gmail.com>
** All rights reserved.
**
** You may use this file under the terms of BSD license as follows:
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** * Neither the name of the author nor the
** names of its contributors may be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
** ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**
****************************************************************************************/
import
QtQuick
2.1
import
QtQuick
.
Controls
.
Styles
1.0
import
QtQuick
.
Controls
.
Nemo
1.0
//Styles.Nemo provides Theme
import
QtQuick
.
Controls
.
Styles
.
Nemo
1.0
CheckBoxStyle
{
CheckBoxStyle
{
indicator
:
Rectangle
{
id
:
background
color
:
"
transparent
"
implicitWidth
:
72
implicitHeight
:
32
Rectangle
{
id
:
back1
implicitWidth
:
72
implicitHeight
:
28
color
:
Theme
.
checkbox
.
back1
anchors.centerIn
:
parent
}
Rectangle
{
id
:
back2
implicitWidth
:
72
implicitHeight
:
28
color
:
Theme
.
checkbox
.
back2
anchors.centerIn
:
parent
}
Image
{
id
:
ball
source
:
"
images/switch-ball.png
"
anchors.verticalCenter
:
parent
.
verticalCenter
}
Connections
{
target
:
control
onCheckedChanged
:
{
if
(
control
.
checked
)
{
anim1
.
restart
()
}
else
{
anim2
.
restart
()
}
}
}
SequentialAnimation
{
id
:
anim1
running
:
false
NumberAnimation
{
target
:
ball
property
:
"
x
"
to
:
32
duration
:
120
}
NumberAnimation
{
target
:
back1
property
:
"
opacity
"
to
:
1
duration
:
60
}
NumberAnimation
{
target
:
back2
property
:
"
opacity
"
to
:
0
duration
:
60
}
}
SequentialAnimation
{
id
:
anim2
running
:
false
NumberAnimation
{
target
:
ball
property
:
"
x
"
to
:
0
duration
:
120
}
NumberAnimation
{
target
:
back2
property
:
"
opacity
"
to
:
1
duration
:
60
}
NumberAnimation
{
target
:
back1
property
:
"
opacity
"
to
:
0
duration
:
60
}
}
}
label
:
Label
{
text
:
control
.
text
}
spacing
:
10
}
src/styles/autogenerated/nemotheme.cpp
View file @
a8f19eb4
...
...
@@ -47,6 +47,7 @@ NemoTheme::NemoTheme(QObject *parent)
,
m_page
(
new
NemoThemePage
(
this
))
,
m_spinner
(
new
NemoThemeSpinner
(
this
))
,
m_label
(
new
NemoThemeLabel
(
this
))
,
m_checkbox
(
new
NemoThemeCheckbox
(
this
))
{
loadFromFile
(
GLACIER_THEME
);
int
id
=
QFontDatabase
::
addApplicationFont
(
"/usr/share/fonts/google-opensans/OpenSans-Regular.ttf"
);
...
...
@@ -129,6 +130,11 @@ NemoThemeLabel * NemoTheme::label() const
return
m_label
;
}
NemoThemeCheckbox
*
NemoTheme
::
checkbox
()
const
{
return
m_checkbox
;
}
QString
NemoTheme
::
fontFamily
()
const
{
return
m_fontFamily
;
...
...
@@ -376,7 +382,9 @@ void NemoTheme::loadFromFile(const QString &fileName)
}
// Setting properties for label
QJsonObject
stylesLabel
=
styles
.
value
(
"label"
).
toObject
();
if
(
stylesLabel
.
contains
(
"color"
))
{
m_label
->
setColor
(
jsonToColor
(
styles
.
value
(
"label"
),
defines
));
}
m_label
->
setColor
(
jsonToColor
(
jsonValue
(
stylesLabel
,
"color"
,
"label"
),
defines
));
// Setting properties for checkbox
QJsonObject
stylesCheckbox
=
styles
.
value
(
"checkbox"
).
toObject
();
m_checkbox
->
setBack1
(
jsonToColor
(
jsonValue
(
stylesCheckbox
,
"back1"
,
"checkbox"
),
defines
));
m_checkbox
->
setBack2
(
jsonToColor
(
jsonValue
(
stylesCheckbox
,
"back2"
,
"checkbox"
),
defines
));
}
src/styles/autogenerated/nemotheme.h
View file @
a8f19eb4
...
...
@@ -33,6 +33,7 @@
#include "nemothemepage.h"
#include "nemothemespinner.h"
#include "nemothemelabel.h"
#include "nemothemecheckbox.h"
class
NemoTheme
:
public
QObject
{
...
...
@@ -48,6 +49,7 @@ class NemoTheme: public QObject
Q_PROPERTY
(
NemoThemePage
*
page
READ
page
CONSTANT
)
Q_PROPERTY
(
NemoThemeSpinner
*
spinner
READ
spinner
CONSTANT
)
Q_PROPERTY
(
NemoThemeLabel
*
label
READ
label
CONSTANT
)
Q_PROPERTY
(
NemoThemeCheckbox
*
checkbox
READ
checkbox
CONSTANT
)
Q_PROPERTY
(
QString
fontFamily
READ
fontFamily
CONSTANT
)
public:
explicit
NemoTheme
(
QObject
*
parent
=
0
);
...
...
@@ -64,6 +66,7 @@ public:
NemoThemePage
*
page
()
const
;
NemoThemeSpinner
*
spinner
()
const
;
NemoThemeLabel
*
label
()
const
;
NemoThemeCheckbox
*
checkbox
()
const
;
QString
fontFamily
()
const
;
public
Q_SLOTS
:
void
loadFromFile
(
const
QString
&
fileName
);
...
...
@@ -82,6 +85,7 @@ private:
NemoThemePage
*
m_page
;
NemoThemeSpinner
*
m_spinner
;
NemoThemeLabel
*
m_label
;
NemoThemeCheckbox
*
m_checkbox
;
QString
m_fontFamily
;
};
...
...
src/styles/autogenerated/nemothemecheckbox.cpp
0 → 100644
View file @
a8f19eb4
/*
* Copyright (C) 2013 Lucien Xu <sfietkonstantin@free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
// This class is autogenerated using themehelper.py
// Any modification done in this file will be overridden
#include "nemothemecheckbox.h"
NemoThemeCheckbox
::
NemoThemeCheckbox
(
QObject
*
parent
)
:
QObject
(
parent
)
{
}
QColor
NemoThemeCheckbox
::
back1
()
const
{
return
m_back1
;
}
void
NemoThemeCheckbox
::
setBack1
(
const
QColor
&
back1
)
{
if
(
m_back1
!=
back1
)
{
m_back1
=
back1
;
emit
back1Changed
();
}
}
QColor
NemoThemeCheckbox
::
back2
()
const
{
return
m_back2
;
}
void
NemoThemeCheckbox
::
setBack2
(
const
QColor
&
back2
)
{
if
(
m_back2
!=
back2
)
{
m_back2
=
back2
;
emit
back2Changed
();
}
}
src/styles/autogenerated/nemothemecheckbox.h
0 → 100644
View file @
a8f19eb4
/*
* Copyright (C) 2013 Lucien Xu <sfietkonstantin@free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
// This class is autogenerated using themehelper.py
// Any modification done in this file will be overridden
#ifndef NEMOTHEMECHECKBOX_H
#define NEMOTHEMECHECKBOX_H
#include <QtCore/QObject>
#include <QtGui/QColor>
class
NemoThemeCheckbox
:
public
QObject
{
Q_OBJECT
Q_PROPERTY
(
QColor
back1
READ
back1
NOTIFY
back1Changed
)
Q_PROPERTY
(
QColor
back2
READ
back2
NOTIFY
back2Changed
)
public:
explicit
NemoThemeCheckbox
(
QObject
*
parent
=
0
);
QColor
back1
()
const
;
void
setBack1
(
const
QColor
&
back1
);
QColor
back2
()
const
;
void
setBack2
(
const
QColor
&
back2
);
Q_SIGNALS:
void
back1Changed
();
void
back2Changed
();
private:
QColor
m_back1
;
QColor
m_back2
;
};
#endif //NEMOTHEMECHECKBOX_H
src/styles/autogenerated/nemothemelabel.cpp
View file @
a8f19eb4
...
...
@@ -24,7 +24,6 @@
NemoThemeLabel
::
NemoThemeLabel
(
QObject
*
parent
)
:
QObject
(
parent
)
,
m_color
(
"white"
)
{
}
...
...
src/styles/images/switch-ball.png
0 → 100644
View file @
a8f19eb4
789 Bytes
src/styles/qquicknemostyleextensionplugin.cpp
View file @
a8f19eb4
...
...
@@ -51,6 +51,7 @@ void QQuickNemoStyleExtensionPlugin::registerTypes(const char *uri)
qmlRegisterUncreatableType
<
NemoThemePageDimmer
>
(
uri
,
1
,
0
,
"NemoThemePageDimmer"
,
reason
);
qmlRegisterUncreatableType
<
NemoThemeSpinner
>
(
uri
,
1
,
0
,
"NemoThemeSpinner"
,
reason
);
qmlRegisterUncreatableType
<
NemoThemeLabel
>
(
uri
,
1
,
0
,
"NemoThemeLabel"
,
reason
);
qmlRegisterUncreatableType
<
NemoThemeCheckbox
>
(
uri
,
1
,
0
,
"NemoThemeCheckbox"
,
reason
);
qmlRegisterSingletonType
<
QObject
>
(
uri
,
1
,
0
,
"Theme"
,
nemo_theme_provider
);
...
...
src/styles/styles.pro
View file @
a8f19eb4
...
...
@@ -49,7 +49,8 @@ QML_FILES += \
images
/
arrow
-
left
@
2
x
.
png
\
images
/
arrow
-
right
.
png
\
images
/
arrow
-
right
@
2
x
.
png
\
images
/
disabled
-
overlay
.
png
images
/
disabled
-
overlay
.
png
\
images
/
switch
-
ball
.
png
OTHER_FILES
+=
qmldir
\
themes
/
Theme1
.
js
\
...
...
@@ -84,7 +85,8 @@ HEADERS += \
autogenerated/nemothemepage.h \
autogenerated/nemothemepagedimmer.h \
autogenerated/nemothemespinner.h \
autogenerated/nemothemelabel.h
autogenerated/nemothemelabel.h \
autogenerated/nemothemecheckbox.h
SOURCES += \
qquicknemostyleextensionplugin.cpp \
...
...
@@ -100,7 +102,8 @@ SOURCES += \
autogenerated/nemothemepage.cpp \
autogenerated/nemothemepagedimmer.cpp \
autogenerated/nemothemespinner.cpp \
autogenerated/nemothemelabel.cpp
autogenerated/nemothemelabel.cpp \
autogenerated/nemothemecheckbox.cpp
INSTALLS += target images qmlfiles themes
...
...
src/styles/themes/glacier.json
View file @
a8f19eb4
...
...
@@ -56,7 +56,11 @@
"secondaryColor"
:
"#0091e5"
},
"label"
:
{
"color"
:
"white"
"color"
:
"#ffffff"
},
"checkbox"
:
{
"back1"
:
"#0091e5"
,
"back2"
:
"#313131"
}
}
}
tools/themehelper/components.json
View file @
a8f19eb4
...
...
@@ -207,8 +207,20 @@
"properties"
:
[
{
"name"
:
"color"
,
"type"
:
"QColor"
,
"default"
:
"white"
"type"
:
"QColor"
}
]
},
{
"name"
:
"Checkbox"
,
"properties"
:
[
{
"name"
:
"back1"
,
"type"
:
"QColor"
},
{
"name"
:
"back2"
,
"type"
:
"QColor"
}
]
}
...
...
@@ -249,6 +261,10 @@
{
"name"
:
"label"
,
"object"
:
"Label"
},
{
"name"
:
"checkbox"
,
"object"
:
"Checkbox"
}
],
"font"
:
"/usr/share/fonts/google-opensans/OpenSans-Regular.ttf"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment