← Back to team overview

uonedb-qt team mailing list archive

[Merge] lp:~kalikiana/u1db-qt/gallery2 into lp:u1db-qt

 

Christian Dywan has proposed merging lp:~kalikiana/u1db-qt/gallery2 into lp:u1db-qt.

Commit message:
Implement tabbed example gallery and install to example package

Requested reviews:
  Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot): continuous-integration
  U1DB Qt developers (uonedb-qt)

For more details, see:
https://code.launchpad.net/~kalikiana/u1db-qt/gallery2/+merge/160052

Implement tabbed example gallery and install to example package
-- 
https://code.launchpad.net/~kalikiana/u1db-qt/gallery2/+merge/160052
Your team U1DB Qt developers is requested to review the proposed merge of lp:~kalikiana/u1db-qt/gallery2 into lp:u1db-qt.
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt	2013-04-12 13:36:54 +0000
+++ CMakeLists.txt	2013-04-22 09:55:31 +0000
@@ -70,16 +70,24 @@
 
 # Unit-Test
 enable_testing()
-
 add_custom_target(check COMMAND "env" "CTEST_OUTPUT_ON_FAILURE=1" "${CMAKE_CTEST_COMMAND}")
-add_custom_target(doc "qdoc" "u1db.qdocconf"
-    COMMAND "sed" "-r" "-i" "'s@(</head>)@<link rel=\"stylesheet\" type=\"text/css\" href=\"style/base.css\" />\\1@'" "./output/html/*.html"
-    COMMAND "qhelpgenerator" "./output/html/u1dbqt.qhp"
-    COMMAND "assistant" "-register" "./output/html/u1dbqt.qch"
-    WORKING_DIRECTORY "documentation")
+
+option(BUILD_DOCS "Build documentation" OFF)
+if (BUILD_DOCS)
+    set(ALL "ALL")
+endif ()
+set(U1DB_DOCS "${PROJECT_BINARY_DIR}/documentation/output")
+add_custom_target(doc ${ALL} "mkdir" "-p" "${U1DB_DOCS}"
+    COMMAND "qdoc" "-outputdir" "${U1DB_DOCS}" "${CMAKE_SOURCE_DIR}/documentation/u1db.qdocconf" "1>/dev/null" "2>/dev/null"
+    COMMAND "sed" "-r" "-i" "'s@(</head>)@<link rel=\"stylesheet\" type=\"text/css\" href=\"style/base.css\" />\\1@'" "${U1DB_DOCS}/*.html"
+    COMMAND "qhelpgenerator" "${U1DB_DOCS}/u1dbqt.qhp"
+    COMMAND "assistant" "-register" "${U1DB_DOCS}/u1dbqt.qch"
+    SOURCES "${CMAKE_SOURCE_DIR}/documentation/u1db.qdocconf"
+    WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/documentation")
 add_subdirectory(modules)
 add_subdirectory(tests)
 add_subdirectory(examples)
+add_subdirectory(gallery)
 
 # Install
 set(INCLUDE_INSTALL_DIR include/lib${U1DB_QT_LIBNAME})
@@ -88,6 +96,24 @@
     LIBRARY DESTINATION lib${LIB_SUFFIX}
     )
 
+if (BUILD_DOCS)
+    install(FILES "${U1DB_DOCS}/u1dbqt.qch"
+        DESTINATION "${CMAKE_INSTALL_PREFIX}/share/qt5/phrasebooks/"
+        )
+    file(GLOB ALL_HTML ${U1DB_DOCS}/*.html)
+    install(FILES ${ALL_HTML}
+        DESTINATION ${CMAKE_INSTALL_PREFIX}/share/u1db-qt/doc/html
+        )
+    install(DIRECTORY "${U1DB_DOCS}/style"
+        DESTINATION "${CMAKE_INSTALL_PREFIX}/share/u1db-qt/doc/html"
+        )
+    file(GLOB ALL_EXAMPLES ${U1DB_DOCS}/*example-*.html)
+    install(FILES ${ALL_EXAMPLES}
+        DESTINATION ${CMAKE_INSTALL_PREFIX}/share/u1db-qt/examples
+        )
+endif ()
+
+
 install(FILES src/global.h src/database.h src/document.h src/index.h src/query.h
     DESTINATION ${INCLUDE_INSTALL_DIR}
     )

=== modified file 'debian/control'
--- debian/control	2013-04-12 13:52:00 +0000
+++ debian/control	2013-04-22 09:55:31 +0000
@@ -11,6 +11,7 @@
                qtdeclarative5-test-plugin,
                qtdeclarative5-qtquick2-plugin,
                libqt5sql5-sqlite,
+               qttools5-dev-tools,
                qtdeclarative5-dev-tools
 Standards-Version: 3.9.3
 Vcs-Bzr: https://launchpad.net/u1db-qt/trunk
@@ -46,3 +47,14 @@
  .
  This package contains the examples demonstrating the use of the Qt binding for U1DB
 
+Package: libu1db-qt5-doc
+Section: doc
+Architecture: all
+Depends: ${misc:Depends},
+         libu1db-qt5-1 (= ${binary:Version}),
+         qttools5-dev-tools
+Description: Qt5 binding and QtQuick2 plugin for U1DB - offline documentation
+ Simple Qt5 binding and QtQuick2 plugin for U1DB (https://launchpad.net/u1db).
+ .
+ This package contains the offline documentation for the Qt binding for U1DB
+

=== added file 'debian/libu1db-qt5-doc.install'
--- debian/libu1db-qt5-doc.install	1970-01-01 00:00:00 +0000
+++ debian/libu1db-qt5-doc.install	2013-04-22 09:55:31 +0000
@@ -0,0 +1,2 @@
+usr/share/qt5/phrasebooks/*
+usr/share/u1db-qt/doc/html/*

=== modified file 'debian/libu1db-qt5-examples.install'
--- debian/libu1db-qt5-examples.install	2013-04-12 13:52:00 +0000
+++ debian/libu1db-qt5-examples.install	2013-04-22 09:55:31 +0000
@@ -1,1 +1,3 @@
 usr/share/u1db-qt/examples/*.qml
+usr/share/u1db-qt/gallery/*.qml
+usr/share/applications/u1db-qt-gallery.desktop

=== modified file 'debian/rules'
--- debian/rules	2013-04-09 11:32:11 +0000
+++ debian/rules	2013-04-22 09:55:31 +0000
@@ -12,7 +12,7 @@
 override_dh_auto_configure:
 	PATH=/opt/qt5/bin:$(PATH) \
 	dh_auto_configure -- -DCMAKE_MODULE_PATH=/opt/qt5/lib/cmake \
-	-DLD_LIBRARY_PATH=/opt/qt5/lib:$(LD_LIBRARY_PATH)
+	-DLD_LIBRARY_PATH=/opt/qt5/lib:$(LD_LIBRARY_PATH) -DBUILD_DOCS=ON
 
 override_dh_auto_build:
 	dh_auto_build

=== added directory 'gallery'
=== added file 'gallery/CMakeLists.txt'
--- gallery/CMakeLists.txt	1970-01-01 00:00:00 +0000
+++ gallery/CMakeLists.txt	2013-04-22 09:55:31 +0000
@@ -0,0 +1,8 @@
+install(FILES gallery.qml SplitView.qml
+    DESTINATION ${CMAKE_INSTALL_PREFIX}/share/u1db-qt/gallery
+    )
+
+install(FILES u1db-qt-gallery.desktop
+    DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications
+    )
+

=== added file 'gallery/SplitView.qml'
--- gallery/SplitView.qml	1970-01-01 00:00:00 +0000
+++ gallery/SplitView.qml	2013-04-22 09:55:31 +0000
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2013 Canonical, Ltd.
+ *
+ * Authors:
+ *  Christian Dywan <christian.dywan@xxxxxxxxxxxxx>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; version 3.
+ *
+ * This program 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+import QtQuick 2.0
+import U1db 1.0 as U1db
+import Ubuntu.Components 0.1
+import QtWebKit 3.0
+import QtWebKit.experimental 1.0
+
+Tab {
+    id: exampleView
+    property string example
+    title: "Example %1".arg(example)
+    Row {
+        id: splitView
+        property string qml: Qt.resolvedUrl('../examples/u1db-qt-example-%1.qml'.arg(example))
+        property string html: 'file:////usr/share/u1db-qt/examples/u1db-qt-example-%1.html'.arg(example)
+        anchors.fill: parent
+        Loader {
+            width: parent.width / 3
+            source: splitView.qml
+            asynchronous: true
+        }
+        // TODO: syntax highlighting
+        // FIXME: switching tabs with web views may crash lp#1124065
+        WebView {
+            width: parent.width / 3
+            height: parent.height
+            url: splitView.qml
+            // FIXME: default font size is extremely small lp#1169989
+            experimental.preferences.minimumFontSize: units.dp(24)
+        }
+        WebView {
+            width: parent.width / 3
+            height: parent.height
+            url: splitView.html
+            experimental.preferences.minimumFontSize: units.dp(24)
+            // TODO: open help browser onNavigationRequested: { url }
+        }
+    }
+}
+
+

=== added file 'gallery/gallery.qml'
--- gallery/gallery.qml	1970-01-01 00:00:00 +0000
+++ gallery/gallery.qml	2013-04-22 09:55:31 +0000
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2013 Canonical, Ltd.
+ *
+ * Authors:
+ *  Christian Dywan <christian.dywan@xxxxxxxxxxxxx>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; version 3.
+ *
+ * This program 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+import QtQuick 2.0
+import Ubuntu.Components 0.1
+
+MainView {
+    width: units.gu(60)
+    height: units.gu(80)
+
+    Page {
+       Tabs {
+            /* FIXME: lp#1167568 Repeater {
+                model: ["1", "2", "2b", "3", "4", "5"]
+                SplitView {
+                    example: modelData
+                }
+            } */
+            SplitView { example: "1" }
+            SplitView { example: "2" }
+            SplitView { example: "2b" }
+            SplitView { example: "3" }
+            SplitView { example: "4" }
+            SplitView { example: "5" }
+        }
+    }
+}
+

=== added file 'gallery/u1db-qt-gallery.desktop'
--- gallery/u1db-qt-gallery.desktop	1970-01-01 00:00:00 +0000
+++ gallery/u1db-qt-gallery.desktop	2013-04-22 09:55:31 +0000
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Encoding=UTF-8
+Type=Application
+Exec=qmlscene /usr/share/u1db-qt/gallery/gallery.qml
+Path=/usr/share/u1db-qt/gallery
+Name=U1Db QML Example Gallery
+Icon=/usr/share/icons/unity-icon-theme/places/svg/service-u1.svg
+Terminal=false
+


Follow ups