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
b1750c15
Commit
b1750c15
authored
Dec 04, 2013
by
Aleksi Suomalainen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[glacier] Checkbox implemented with Switch spec
parent
8c716a0a
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
333 additions
and
25 deletions
+333
-25
CheckboxPage.qml
examples/touch/content/CheckboxPage.qml
+49
-0
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
+10
-0
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
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
+4
-0
components.json
tools/themehelper/components.json
+17
-0
No files found.
examples/touch/content/CheckboxPage.qml
0 → 100644
View file @
b1750c15
/****************************************************************************************
**
** 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/main.qml
View file @
b1750c15
...
...
@@ -95,6 +95,10 @@ ApplicationWindow {
title
:
"
Labels
"
page
:
"
content/LabelPage.qml
"
}
ListElement
{
title
:
"
Switches
"
page
:
"
content/CheckboxPage.qml
"
}
}
...
...
examples/touch/resources.qrc
View file @
b1750c15
...
...
@@ -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 @
b1750c15
...
...
@@ -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 @
b1750c15
import
QtQuick
2.1
import
QtQuick
.
Controls
1.0
CheckBox
{
}
src/controls/controls.pro
View file @
b1750c15
...
...
@@ -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 @
b1750c15
...
...
@@ -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 @
b1750c15
/*
* 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 @
b1750c15
...
...
@@ -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
;
...
...
@@ -377,4 +383,8 @@ void NemoTheme::loadFromFile(const QString &fileName)
// Setting properties for label
QJsonObject
stylesLabel
=
styles
.
value
(
"label"
).
toObject
();
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 @
b1750c15
...
...
@@ -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 @
b1750c15
/*
* 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 @
b1750c15
/*
* 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/images/switch-ball.png
0 → 100644
View file @
b1750c15
789 Bytes
src/styles/qquicknemostyleextensionplugin.cpp
View file @
b1750c15
...
...
@@ -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 @
b1750c15
...
...
@@ -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 @
b1750c15
...
...
@@ -57,6 +57,10 @@
},
"label"
:
{
"color"
:
"#ffffff"
},
"checkbox"
:
{
"back1"
:
"#0091e5"
,
"back2"
:
"#313131"
}
}
}
tools/themehelper/components.json
View file @
b1750c15
...
...
@@ -210,6 +210,19 @@
"type"
:
"QColor"
}
]
},
{
"name"
:
"Checkbox"
,
"properties"
:
[
{
"name"
:
"back1"
,
"type"
:
"QColor"
},
{
"name"
:
"back2"
,
"type"
:
"QColor"
}
]
}
],
"properties"
:
[
...
...
@@ -248,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