Commit beb3556b authored by Fabian Riethmayer's avatar Fabian Riethmayer

Merge branch 'Kirigami' into 'master'

Add Kirigami documentation and refactor code examples

See merge request !23
parents 7eb91492 88ba6b71
......@@ -2,4 +2,5 @@
build
*.qmlc
*.jsc
*.tag
/__pycache__
*.tags
kate: space-indent on; tab-width 4; indent-width 4; replace-tabs on; eol unix;
kate-wildcard(*.rst): word-wrap-column 80; word-wrap on;
......@@ -18,4 +18,4 @@ Sphinx==1.7.0
sphinx-rtd-theme==0.2.4
sphinxcontrib-websupport==1.0.1
urllib3==1.22
sphinxcontrib-doxylink==1.6
sphinxcontrib-doxylink==1.6.1
......@@ -153,31 +153,9 @@ Kirigami
- :kirigamiapi:`Kirigami: InlineMessage <InlineMessage>`
.. code-block:: qml
...
import QtQuick.Controls 2.2 as Controls
import org.kde.kirigami 2.4 as Kirigami
...
Kirigami.InlineMessage {
visible: true
text: i18n("&Remember password?")
type: Kirigami.MessageType.Positive
showCloseButton: true
...
actions: [
Kirigami.Action {
text: i18n("&Remember")
icon.name: "dialog-ok-apply"
},
Kirigami.Action {
text: i18n("&Do not remember")
icon.name: "dialog-cancel"
}
]
}
.. literalinclude:: /../../examples/kirigami/InlineMessage.qml
:language: qml
Qt Widgets
~~~~~~~~~~
......
......@@ -296,59 +296,8 @@ Kirigami
- :kirigamiapi:`Kirigami: BasicListItem <BasicListItem>`
- :kirigamiapi:`Kirigami: SwipeListItem <SwipeListItem>`
.. code-block:: qml
...
ListView {
...
delegate: Kirigami.SwipeListItem {
id: lineItem
contentItem: Row {
spacing: lineItem.leftPadding
Item {
width: Kirigami.Units.iconSizes.medium
height: width
Image {
id: avatar
width: parent.width
height: width
source: "..."
visible: false
}
OpacityMask {
anchors.fill: avatar
source: avatar
maskSource: Rectangle {
height: avatar.width
width: height
radius: height / 2
}
}
}
Label {
anchors.verticalCenter: parent.verticalCenter
text: "..."
}
}
actions: [
Kirigami.Action {
text: i18n("&Make call")
iconName: "call-start"
},
Kirigami.Action {
text: i18n("&Write mail")
iconName: "mail-message"
}
]
}
...
}
...
.. literalinclude:: /../../examples/kirigami/AddressbookListView.qml
:language: qml
Plasma components
~~~~~~~~~~~~~~~~~
......
......@@ -75,31 +75,5 @@ Kirigami
- :kirigamiapi:`Kirigami: Action <Action>`
- :kirigamiapi:`Kirigami: ScrollablePage <ScrollablePage>`
.. code-block:: qml
...
import QtQuick.Controls 2.2 as Controls
import org.kde.kirigami 2.4 as Kirigami
...
Kirigami.ApplicationWindow {
...
pageStack.initialPage: Kirigami.ScrollablePage {
...
actions {
left: Kirigami.Action {
iconName: "mail-message"
text: i18n("&Write mail")
}
main: Kirigami.Action {
iconName: "call-start"
text: i18n("&Make call")
}
right: Kirigami.Action {
iconName: "kmouth-phrase-new"
text: i18n("&Write SMS")
}
}
}
...
}
.. literalinclude:: /../../examples/kirigami/ActionButton.qml
:language: qml
......@@ -74,54 +74,5 @@ Kirigami
- :kirigamiapi:`Kirigami: Action <Action>`
- :kirigamiapi:`Kirigami: ScrollablePage <ScrollablePage>`
.. code-block:: qml
...
import QtQuick.Controls 2.2 as Controls
import org.kde.kirigami 2.4 as Kirigami
...
Kirigami.ApplicationWindow {
...
pageStack.initialPage: Kirigami.ScrollablePage {
...
actions {
...
contextualActions: [
Kirigami.Action {
iconName: "favorite"
text: i18n("&Select as favorite")
},
Kirigami.Action {
iconName: "document-share"
text: i18n("&Share")
},
Kirigami.Action {
iconName: "document-edit"
text: i18n("&Edit")
},
Kirigami.Action {
iconName: "edit-image-face-add"
text: i18n("&Choose photo")
},
Kirigami.Action {
iconName: "im-kick-user"
text: i18n("&Block number")
},
Kirigami.Action {
iconName: "delete"
text: i18n("&Delete contact")
},
Kirigami.Action {
iconName: "edit-clear-history"
text: i18n("&Delete history")
}
]
...
}
}
...
contextDrawer: Kirigami.ContextDrawer {
}
...
}
.. literalinclude:: /../../examples/kirigami/AddressbookContextDrawer.qml
:language: qml
......@@ -106,45 +106,5 @@ Kirigami
- :kirigamiapi:`Kirigami: GlobalDrawer <GlobalDrawer>`
.. code-block:: qml
...
import QtQuick.Controls 2.2 as Controls
import org.kde.kirigami 2.4 as Kirigami
...
Kirigami.ApplicationWindow {
...
globalDrawer: Kirigami.GlobalDrawer {
title: "..."
titleIcon: "..."
topContent: [
...
]
actions: [
Kirigami.Action {
iconName: "list-import-user"
text: i18n("&Import")
},
Kirigami.Action {
iconName: "list-export-user"
text: i18n("&Export")
},
Kirigami.Action {
iconName: "user-group-delete"
text: i18n("&Merge contacts")
},
Kirigami.Action {
iconName: "user-group-new"
text: i18n("&Search dupplicate contacts")
},
Kirigami.Action {
iconName: "configure"
text: i18n("&Settings")
}
]
}
...
}
.. literalinclude:: /../../examples/kirigami/AddressbookGlobalDrawer.qml
:language: qml
......@@ -89,40 +89,5 @@ Kirigami
- :kirigamiapi:`Kirigami: ApplicationWindow <ApplicationWindow>`
- `QML: MenuBar <https://doc.qt.io/qt-5/qml-qtquick-controls-menubar.html>`_
.. code-block:: qml
...
import QtQuick.Controls 2.2 as Controls
import org.kde.kirigami 2.4 as Kirigami
...
Kirigami.ApplicationWindow {
...
menuBar: MenuBar {
Menu {
title: i18n("&File")
Action { text: i18n("&New...") }
Action { text: i18n("&Import") }
Action { text: i18n("&Export") }
}
Menu {
title: i18n("&Edit")
Action { text: i18n("&Merge contacts") }
Action { text: i18n("&Search dupplicate contacts") }
Action { text: i18n("&Export") }
}
Menu {
title: i18n("&Settings")
Action { text: i18n("&Settings") }
Action { text: i18n("&Configure shortcuts") }
}
Menu {
title: i18n("&Help")
Action { text: i18n("&Report Bug...") }
Action { text: i18n("&Donate") }
Action { text: i18n("&About Addressbook") }
Action { text: i18n("&About KDE") }
}
}
...
}
.. literalinclude:: /../../examples/kirigami/AddressbookMenubar.qml
:language: qml
......@@ -110,59 +110,14 @@ Kirigami
Application toolbar
"""""""""""""""""""
.. code-block:: qml
...
import QtQuick.Controls 2.2 as Controls
import org.kde.kirigami 2.4 as Kirigami
...
Kirigami.ApplicationWindow {
...
pageStack.initialPage: Kirigami.ScrollablePage {
...
actions {
left: Kirigami.Action {
iconName: "mail-message"
text: i18n("&Write mail")
}
main: Kirigami.Action {
iconName: "call-start"
text: i18n("&Make call")
}
right: Kirigami.Action {
iconName: "kmouth-phrase-new"
text: i18n("&Write SMS")
}
}
}
...
}
.. literalinclude:: /../../examples/kirigami/ApplicationToolbar.qml
:language: qml
Component toolbar
^^^^^^^^^^^^^^^^^
.. code-block:: qml
...
import QtQuick.Controls 2.2 as Controls
import org.kde.kirigami 2.4 as Kirigami
...
Kirigami.ActionToolBar {
...
actions: [
Kirigami.Action {
iconName: "favorite"
text: i18n("&Select as favorite")
},
Kirigami.Action {
iconName: "document-share"
text: i18n("&Share")
}
]
...
}
...
.. literalinclude:: /../../examples/kirigami/ComponentToolbar.qml
:language: qml
Plasma components
~~~~~~~~~~~~~~~~~
......
......@@ -23,7 +23,7 @@ import requests
import os
import sys
sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.path.abspath('../..'))
# -- General configuration ------------------------------------------------
......@@ -50,7 +50,7 @@ master_doc = 'index'
# General information about the project.
project = 'Human Interface Guidelines'
copyright = '2018, KDE. Licensed under Creative Commons License SA 4.0'
copyright = '2019, KDE. Licensed under Creative Commons License SA 4.0'
author = 'KDE'
# The version info for the project you're documenting, acts as replacement for
......@@ -168,8 +168,11 @@ texinfo_documents = [
'Miscellaneous'),
]
# Adding common substitions between Kirigami and HIG
from epilog import rst_epilog
# Adding global substitutions
rst_epilog = """
rst_epilog += """
.. |devicon| image:: /img/DevIcon.svg
:width: 32px
:height: 32px
......@@ -221,6 +224,14 @@ rst_prolog = """
.. role:: intend
"""
# -- Options for intersphinx extension ---------------------------------------
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {
'kirigami': ('https://kirigami.kde.org/', None),
'pm': ('https://docs.plasma-mobile.org', None)
}
# add css file
def setup(app):
app.add_stylesheet('css/breeze.css')
......