Merge lp:~kalikiana/dee-qt/deevarianttext into lp:dee-qt/0.2
- deevarianttext
- Merge into trunk
Status: | Superseded |
---|---|
Proposed branch: | lp:~kalikiana/dee-qt/deevarianttext |
Merge into: | lp:dee-qt/0.2 |
Prerequisite: | lp:~unity-team/dee-qt/qt4-and-qt5 |
Diff against target: |
1252 lines (+589/-260) 29 files modified
.bzrignore (+16/-3) CMakeLists.txt (+30/-90) debian/changelog (+13/-0) debian/control (+9/-7) debian/libdee-qt-3.install (+3/-3) debian/libdee-qt-dev.install (+3/-3) debian/libdee-qt5-3.install (+3/-3) debian/libdee-qt5-dev.install (+3/-3) deelistmodel.cpp (+19/-21) deelistmodel.h (+3/-2) deeprivate.h (+23/-0) deevarianttext.cpp (+72/-0) deevarianttext.h (+49/-0) libdee-qt.pc.in (+5/-5) modules/CMakeLists.txt (+1/-0) modules/Dee/CMakeLists.txt (+46/-0) modules/Dee/plugin.cpp (+5/-3) modules/Dee/plugin.h (+1/-1) modules/Dee/qmldir (+1/-1) test.cpp (+0/-35) test.h (+0/-52) test_qtquick2.qml (+0/-15) tests/CMakeLists.txt (+57/-0) tests/conversiontest.cpp (+1/-0) tests/deevarianttexttest.cpp (+58/-0) tests/qtquick1plugintest.cpp (+48/-0) tests/test_qtquick1.qml (+38/-13) tests/tst_deelistmodel.qml (+22/-0) tests/tst_deevarianttext.qml (+60/-0) |
To merge this branch: | bzr merge lp:~kalikiana/dee-qt/deevarianttext |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Michał Sawicz | Pending | ||
Review via email: mp+137918@code.launchpad.net |
This proposal has been superseded by a proposal from 2012-12-04.
Commit message
Description of the change
- 97. By Cris Dywan
- 98. By Cris Dywan
-
Fix running deevarianttexttest
- 99. By Cris Dywan
-
Add insertRemoveTest (needs improvement)
- 100. By Cris Dywan
-
Fixup insertRemoveTest
- 101. By Cris Dywan
-
Use QSignalSpy instead of manual callbacks to verify signals
- 102. By Cris Dywan
-
Expose append/ remove to QML to allow hosting new models
For now only in test models and no API to set the schema.
- 103. By Cris Dywan
-
Emit layoutChanged in addition to countChanged
- 104. By Cris Dywan
-
Use SignalSpy in QML - preliminary text delegate testing
- 105. By Cris Dywan
-
Use QT_INSTALL_QML (QtQuick2) instead of QT_INSTALL_IMPORTS (QtQuick1)
See http://
doc-snapshot. qt-project. org/5.0/ qtcore/ qlibraryinfo. html#LibraryLoc ation-enum - 106. By Cris Dywan
-
Drop delegate test, the approach is wrong
- 107. By Cris Dywan
-
Drop remaining pieces of delegate approach as well
Unmerged revisions
- 107. By Cris Dywan
-
Drop remaining pieces of delegate approach as well
- 106. By Cris Dywan
-
Drop delegate test, the approach is wrong
- 105. By Cris Dywan
-
Use QT_INSTALL_QML (QtQuick2) instead of QT_INSTALL_IMPORTS (QtQuick1)
See http://
doc-snapshot. qt-project. org/5.0/ qtcore/ qlibraryinfo. html#LibraryLoc ation-enum - 104. By Cris Dywan
-
Use SignalSpy in QML - preliminary text delegate testing
- 103. By Cris Dywan
-
Emit layoutChanged in addition to countChanged
- 102. By Cris Dywan
-
Expose append/ remove to QML to allow hosting new models
For now only in test models and no API to set the schema.
- 101. By Cris Dywan
-
Use QSignalSpy instead of manual callbacks to verify signals
- 100. By Cris Dywan
-
Fixup insertRemoveTest
- 99. By Cris Dywan
-
Add insertRemoveTest (needs improvement)
- 98. By Cris Dywan
-
Fix running deevarianttexttest
Preview Diff
1 | === modified file '.bzrignore' | |||
2 | --- .bzrignore 2010-11-22 08:03:37 +0000 | |||
3 | +++ .bzrignore 2012-12-04 18:48:20 +0000 | |||
4 | @@ -2,7 +2,20 @@ | |||
5 | 2 | CMakeFiles | 2 | CMakeFiles |
6 | 3 | Makefile | 3 | Makefile |
7 | 4 | cmake_install.cmake | 4 | cmake_install.cmake |
8 | 5 | install_manifest.txt | ||
9 | 6 | libdee-qt.so* | ||
10 | 7 | libdee-qt5.so* | ||
11 | 5 | libQtDee.so* | 8 | libQtDee.so* |
15 | 6 | moc_*.cxx | 9 | moc_*.cpp |
16 | 7 | test | 10 | *.moc |
17 | 8 | install_manifest.txt | 11 | *_automoc.cpp |
18 | 12 | *.pc | ||
19 | 13 | CTestTestfile.cmake | ||
20 | 14 | *Test.log | ||
21 | 15 | Testing | ||
22 | 16 | conversiontest | ||
23 | 17 | deelistmodeltest | ||
24 | 18 | deevarianttexttest | ||
25 | 19 | plugintest | ||
26 | 20 | test-helper | ||
27 | 21 | *-xunit.xml | ||
28 | 9 | 22 | ||
29 | === modified file 'CMakeLists.txt' | |||
30 | --- CMakeLists.txt 2012-12-04 18:48:20 +0000 | |||
31 | +++ CMakeLists.txt 2012-12-04 18:48:20 +0000 | |||
32 | @@ -1,4 +1,4 @@ | |||
34 | 1 | project(libqtdee) | 1 | project(dee-qt) |
35 | 2 | cmake_minimum_required(VERSION 2.8.6) | 2 | cmake_minimum_required(VERSION 2.8.6) |
36 | 3 | 3 | ||
37 | 4 | # Instruct CMake to run moc automatically when needed. | 4 | # Instruct CMake to run moc automatically when needed. |
38 | @@ -10,22 +10,15 @@ | |||
39 | 10 | message("Building Qt5 version") | 10 | message("Building Qt5 version") |
40 | 11 | 11 | ||
41 | 12 | find_package(Qt5Core REQUIRED) | 12 | find_package(Qt5Core REQUIRED) |
42 | 13 | find_package(Qt5Quick REQUIRED) | ||
43 | 14 | find_package(Qt5Test REQUIRED) | ||
44 | 15 | find_package(Qt5DBus REQUIRED) | 13 | find_package(Qt5DBus REQUIRED) |
45 | 16 | 14 | ||
46 | 17 | add_definitions(-DWITHQT5=1) | 15 | add_definitions(-DWITHQT5=1) |
47 | 18 | 16 | ||
50 | 19 | set(QTDEE_LIBNAME QtDee-qt5) | 17 | set(DEE_QT_LIBNAME dee-qt5) |
51 | 20 | set(OUR_QT_INCLUDES ${Qt5Core_INCLUDE_DIRS} ${Qt5Quick_INCLUDE_DIRS} ${Qt5Test_INCLUDE_DIRS} ${Qt5DBus_INCLUDE_DIRS}) | 18 | set(OUR_QT_INCLUDES ${Qt5Core_INCLUDE_DIRS} ${Qt5DBus_INCLUDE_DIRS}) |
52 | 21 | set(OUR_QT_CORE_LIB ${Qt5Core_LIBRARIES}) | 19 | set(OUR_QT_CORE_LIB ${Qt5Core_LIBRARIES}) |
53 | 22 | set(OUR_QT_TEST_LIB ${Qt5Test_LIBRARIES}) | ||
54 | 23 | set(OUR_QT_QUICK_LIB ${Qt5Quick_LIBRARIES}) | ||
55 | 24 | set(OUR_QT_DBUS_LIB ${Qt5DBus_LIBRARIES}) | 20 | set(OUR_QT_DBUS_LIB ${Qt5DBus_LIBRARIES}) |
56 | 25 | # FIXME: find a way to deterime that | ||
57 | 26 | set(IMPORT_INSTALL_DIR /opt/qt5/imports/dee) | ||
58 | 27 | set(QT_PKGCONFIG_DEPENDENCIES "QtCore QtQuick") | 21 | set(QT_PKGCONFIG_DEPENDENCIES "QtCore QtQuick") |
59 | 28 | set(QT_DEE_PKGCONFIG_FILE libqtdee-qt5.pc) | ||
60 | 29 | else () | 22 | else () |
61 | 30 | message("Building Qt4 version") | 23 | message("Building Qt4 version") |
62 | 31 | 24 | ||
63 | @@ -33,94 +26,67 @@ | |||
64 | 33 | 26 | ||
65 | 34 | add_definitions(-DWITHQT5=0) | 27 | add_definitions(-DWITHQT5=0) |
66 | 35 | 28 | ||
69 | 36 | set(QTDEE_LIBNAME QtDee) | 29 | set(DEE_QT_LIBNAME dee-qt) |
70 | 37 | set(OUR_QT_INCLUDES ${QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR} ${QT_QTDECLARATIVE_INCLUDE_DIR} ${QT_QTTEST_INCLUDE_DIR} ${QT_QTDBUS_INCLUDE_DIR}) | 30 | set(OUR_QT_INCLUDES ${QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR} ${QT_QTDBUS_INCLUDE_DIR}) |
71 | 38 | set(OUR_QT_CORE_LIB ${QT_QTCORE_LIBRARIES}) | 31 | set(OUR_QT_CORE_LIB ${QT_QTCORE_LIBRARIES}) |
72 | 39 | set(OUR_QT_TEST_LIB ${QT_QTTEST_LIBRARIES}) | ||
73 | 40 | set(OUR_QT_QUICK_LIB ${QT_QTDECLARATIVE_LIBRARIES}) | ||
74 | 41 | set(OUR_QT_DBUS_LIB ${QT_QTDBUS_LIBRARIES}) | 32 | set(OUR_QT_DBUS_LIB ${QT_QTDBUS_LIBRARIES}) |
78 | 42 | set(IMPORT_INSTALL_DIR lib/qt4/imports/dee) | 33 | set(QT_PKGCONFIG_DEPENDENCIES "QtCore QtDBus") |
76 | 43 | set(QT_PKGCONFIG_DEPENDENCIES "QtCore QtDBus QtDeclarative") | ||
77 | 44 | set(QT_DEE_PKGCONFIG_FILE libqtdee.pc) | ||
79 | 45 | endif () | 34 | endif () |
80 | 35 | |||
81 | 36 | set(QT_DEE_PKGCONFIG_FILE lib${DEE_QT_LIBNAME}.pc) | ||
82 | 37 | |||
83 | 46 | pkg_check_modules(DEE REQUIRED dee-1.0) | 38 | pkg_check_modules(DEE REQUIRED dee-1.0) |
84 | 47 | 39 | ||
85 | 48 | # Build flags | 40 | # Build flags |
86 | 49 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -Wall -Wundef -std=c++0x") | 41 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -Wall -Wundef -std=c++0x") |
87 | 50 | 42 | ||
88 | 51 | # Sources | 43 | # Sources |
91 | 52 | ## QtDee | 44 | set(DEE_QT_SRCS |
90 | 53 | set(QtDee_SRCS | ||
92 | 54 | deelistmodel.cpp | 45 | deelistmodel.cpp |
99 | 55 | ) | 46 | deevarianttext.cpp |
100 | 56 | 47 | ) | |
95 | 57 | set(QtDee_MOC_HDRS | ||
96 | 58 | deelistmodel.h | ||
97 | 59 | ) | ||
98 | 60 | |||
101 | 61 | 48 | ||
102 | 62 | ## QtDeeQml | 49 | ## QtDeeQml |
103 | 63 | set(QtDeeQml_SRCS | 50 | set(QtDeeQml_SRCS |
104 | 64 | plugin.cpp | 51 | plugin.cpp |
105 | 65 | ) | 52 | ) |
106 | 66 | 53 | ||
107 | 67 | set(QtDeeQml_MOC_HDRS | ||
108 | 68 | plugin.h | ||
109 | 69 | ) | ||
110 | 70 | |||
111 | 71 | # Build | 54 | # Build |
112 | 72 | add_definitions(-DQT_NO_KEYWORDS) | 55 | add_definitions(-DQT_NO_KEYWORDS) |
113 | 73 | 56 | ||
114 | 74 | include_directories( | 57 | include_directories( |
115 | 58 | ${CMAKE_CURRENT_SOURCE_DIR} | ||
116 | 75 | ${CMAKE_CURRENT_BINARY_DIR} | 59 | ${CMAKE_CURRENT_BINARY_DIR} |
117 | 76 | ${OUR_QT_INCLUDES} | 60 | ${OUR_QT_INCLUDES} |
118 | 77 | ${DEE_INCLUDE_DIRS} | 61 | ${DEE_INCLUDE_DIRS} |
119 | 78 | ) | 62 | ) |
120 | 79 | 63 | ||
124 | 80 | ## QtDee | 64 | add_library(${DEE_QT_LIBNAME} SHARED ${DEE_QT_SRCS}) |
125 | 81 | add_library(${QTDEE_LIBNAME} SHARED ${QtDee_SRCS} ${QtDee_MOC_SRCS}) | 65 | target_link_libraries(${DEE_QT_LIBNAME} |
123 | 82 | target_link_libraries(${QTDEE_LIBNAME} | ||
126 | 83 | ${OUR_QT_CORE_LIB} | 66 | ${OUR_QT_CORE_LIB} |
127 | 84 | ${DEE_LDFLAGS} | 67 | ${DEE_LDFLAGS} |
128 | 85 | ) | 68 | ) |
129 | 86 | 69 | ||
157 | 87 | set_target_properties(${QTDEE_LIBNAME} PROPERTIES | 70 | set_target_properties(${DEE_QT_LIBNAME} PROPERTIES |
158 | 88 | SOVERSION 2 | 71 | SOVERSION 3 |
159 | 89 | VERSION 2.0.0 | 72 | VERSION 3.0.0 |
160 | 90 | ) | 73 | ) |
161 | 91 | 74 | ||
162 | 92 | ## QtDeeQml | 75 | # Unit-Test |
163 | 93 | add_library(QtDeeQml SHARED ${QtDeeQml_SRCS} ${QtDeeQml_MOC_SRCS}) | 76 | enable_testing() |
164 | 94 | 77 | ||
165 | 95 | target_link_libraries(QtDeeQml | 78 | add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} CTEST_OUTPUT_ON_FAILURE=1) |
166 | 96 | ${QTDEE_LIBNAME} | 79 | add_subdirectory(modules) |
167 | 97 | ${OUR_QT_QUICK_LIB} | 80 | add_subdirectory(tests) |
141 | 98 | ) | ||
142 | 99 | |||
143 | 100 | ## test | ||
144 | 101 | set(test_SRCS | ||
145 | 102 | test.cpp | ||
146 | 103 | ) | ||
147 | 104 | |||
148 | 105 | set(test_MOC_HDRS | ||
149 | 106 | test.h | ||
150 | 107 | ) | ||
151 | 108 | |||
152 | 109 | add_executable(test ${test_SRCS} ${test_MOC_SRCS}) | ||
153 | 110 | set_target_properties(test PROPERTIES COMPILE_FLAGS -fPIC) | ||
154 | 111 | target_link_libraries(test | ||
155 | 112 | ${QTDEE_LIBNAME} | ||
156 | 113 | ) | ||
168 | 114 | 81 | ||
169 | 115 | # Install | 82 | # Install |
171 | 116 | set(INCLUDE_INSTALL_DIR include/QtDee) | 83 | set(INCLUDE_INSTALL_DIR include/lib${DEE_QT_LIBNAME}) |
172 | 117 | 84 | ||
175 | 118 | ## QtDee | 85 | install(TARGETS ${DEE_QT_LIBNAME} |
174 | 119 | install(TARGETS ${QTDEE_LIBNAME} | ||
176 | 120 | LIBRARY DESTINATION lib${LIB_SUFFIX} | 86 | LIBRARY DESTINATION lib${LIB_SUFFIX} |
177 | 121 | ) | 87 | ) |
178 | 122 | 88 | ||
180 | 123 | install(FILES deelistmodel.h | 89 | install(FILES deelistmodel.h deevarianttext.h |
181 | 124 | DESTINATION ${INCLUDE_INSTALL_DIR} | 90 | DESTINATION ${INCLUDE_INSTALL_DIR} |
182 | 125 | ) | 91 | ) |
183 | 126 | 92 | ||
184 | @@ -128,36 +94,10 @@ | |||
185 | 128 | set (PREFIX "${CMAKE_INSTALL_PREFIX}") | 94 | set (PREFIX "${CMAKE_INSTALL_PREFIX}") |
186 | 129 | set (EXEC_PREFIX "${CMAKE_INSTALL_PREFIX}") | 95 | set (EXEC_PREFIX "${CMAKE_INSTALL_PREFIX}") |
187 | 130 | 96 | ||
189 | 131 | configure_file (libqtdee.pc.in | 97 | configure_file (libdee-qt.pc.in |
190 | 132 | ${CMAKE_CURRENT_BINARY_DIR}/${QT_DEE_PKGCONFIG_FILE} @ONLY) | 98 | ${CMAKE_CURRENT_BINARY_DIR}/${QT_DEE_PKGCONFIG_FILE} @ONLY) |
191 | 133 | 99 | ||
192 | 134 | install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${QT_DEE_PKGCONFIG_FILE} | 100 | install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${QT_DEE_PKGCONFIG_FILE} |
193 | 135 | DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig | 101 | DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig |
194 | 136 | ) | 102 | ) |
195 | 137 | 103 | ||
196 | 138 | ## QtDeeQml | ||
197 | 139 | install(TARGETS QtDeeQml | ||
198 | 140 | LIBRARY DESTINATION ${IMPORT_INSTALL_DIR} | ||
199 | 141 | ) | ||
200 | 142 | |||
201 | 143 | install(FILES qmldir | ||
202 | 144 | DESTINATION ${IMPORT_INSTALL_DIR} | ||
203 | 145 | ) | ||
204 | 146 | |||
205 | 147 | ## Unit-Test | ||
206 | 148 | enable_testing() | ||
207 | 149 | add_executable(conversiontest conversiontest.cpp) | ||
208 | 150 | target_link_libraries(conversiontest ${OUR_QT_TEST_LIB} ${QTDEE_LIBNAME}) | ||
209 | 151 | set_target_properties(conversiontest PROPERTIES COMPILE_FLAGS -fPIC) | ||
210 | 152 | add_test(NAME conversiontest COMMAND "dbus-test-runner" "--task" "${CMAKE_CURRENT_BINARY_DIR}/conversiontest" "-p" "-xunitxml" "-p" "-o" "-p" "conversiontest-xunit.xml") | ||
211 | 153 | set_property(TEST conversiontest PROPERTY ENVIRONMENT "LD_LIBRARY_PATH=.") | ||
212 | 154 | |||
213 | 155 | add_executable(test-helper test-helper.cpp) | ||
214 | 156 | target_link_libraries(test-helper ${OUR_QT_CORE_LIB} ${OUR_QT_DBUS_LIB} ${DEE_LDFLAGS}) | ||
215 | 157 | set_target_properties(test-helper PROPERTIES COMPILE_FLAGS -fPIC) | ||
216 | 158 | |||
217 | 159 | add_executable(deelistmodeltest deelistmodeltest.cpp) | ||
218 | 160 | target_link_libraries(deelistmodeltest ${OUR_QT_TEST_LIB} ${OUR_QT_DBUS_LIB} ${QTDEE_LIBNAME}) | ||
219 | 161 | set_target_properties(deelistmodeltest PROPERTIES COMPILE_FLAGS -fPIC) | ||
220 | 162 | add_test(NAME deelistmodeltest COMMAND "dbus-test-runner" "--task" "${CMAKE_CURRENT_BINARY_DIR}/test-helper" "--task" "${CMAKE_CURRENT_BINARY_DIR}/deelistmodeltest" "-p" "-xunitxml" "-p" "-o" "-p" "deelistmodeltest-xunit.xml") | ||
221 | 163 | set_property(TEST deelistmodeltest PROPERTY ENVIRONMENT "LD_LIBRARY_PATH=.") | ||
222 | 164 | 104 | ||
223 | === modified file 'debian/changelog' | |||
224 | --- debian/changelog 2012-12-04 18:48:20 +0000 | |||
225 | +++ debian/changelog 2012-12-04 18:48:20 +0000 | |||
226 | @@ -1,3 +1,16 @@ | |||
227 | 1 | dee-qt (3.0-0ubuntu1) quantal; urgency=low | ||
228 | 2 | |||
229 | 3 | * new release | ||
230 | 4 | * rename the source package to dee-qt | ||
231 | 5 | * rename libqtdee to libdee-qt | ||
232 | 6 | * rename libqtdee-qt5 to libdee-qt5 | ||
233 | 7 | * separate plugin out into "modules" directory | ||
234 | 8 | * separate tests out | ||
235 | 9 | * drop obsolete test.cpp | ||
236 | 10 | * rename dee 0.1 QML plugin to Dee 3.0 | ||
237 | 11 | |||
238 | 12 | -- Michał Sawicz <michal.sawicz@canonical.com> Fri, 30 Nov 2012 12:32:41 +0100 | ||
239 | 13 | |||
240 | 1 | libqtdee (0.2.4-0ubuntu4) quantal; urgency=low | 14 | libqtdee (0.2.4-0ubuntu4) quantal; urgency=low |
241 | 2 | 15 | ||
242 | 3 | * debian/rules | 16 | * debian/rules |
243 | 4 | 17 | ||
244 | === modified file 'debian/control' | |||
245 | --- debian/control 2012-12-04 18:48:20 +0000 | |||
246 | +++ debian/control 2012-12-04 18:48:20 +0000 | |||
247 | @@ -1,4 +1,4 @@ | |||
249 | 1 | Source: libqtdee | 1 | Source: dee-qt |
250 | 2 | Section: libs | 2 | Section: libs |
251 | 3 | Priority: optional | 3 | Priority: optional |
252 | 4 | Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> | 4 | Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> |
253 | @@ -15,7 +15,7 @@ | |||
254 | 15 | # just go ahead. ~unity-team will notice and sync up the code again. | 15 | # just go ahead. ~unity-team will notice and sync up the code again. |
255 | 16 | Vcs-Bzr: http://bazaar.launchpad.net/~unity-2d-team/dee-qt/trunk | 16 | Vcs-Bzr: http://bazaar.launchpad.net/~unity-2d-team/dee-qt/trunk |
256 | 17 | 17 | ||
258 | 18 | Package: libqtdee2 | 18 | Package: libdee-qt-3 |
259 | 19 | Architecture: any | 19 | Architecture: any |
260 | 20 | Depends: ${shlibs:Depends}, | 20 | Depends: ${shlibs:Depends}, |
261 | 21 | ${misc:Depends}, | 21 | ${misc:Depends}, |
262 | @@ -24,31 +24,33 @@ | |||
263 | 24 | Description: Qt binding and QML plugin for Dee - shared library | 24 | Description: Qt binding and QML plugin for Dee - shared library |
264 | 25 | Simple Qt binding and QML plugin for Dee (https://launchpad.net/dee). | 25 | Simple Qt binding and QML plugin for Dee (https://launchpad.net/dee). |
265 | 26 | 26 | ||
267 | 27 | Package: libqtdee-dev | 27 | Package: libdee-qt-dev |
268 | 28 | Section: libdevel | 28 | Section: libdevel |
269 | 29 | Architecture: any | 29 | Architecture: any |
270 | 30 | Depends: ${misc:Depends}, | 30 | Depends: ${misc:Depends}, |
272 | 31 | libqtdee2 (= ${binary:Version}), | 31 | libdee-qt-3 (= ${binary:Version}), |
273 | 32 | libqt4-dev (>= 4.7), | 32 | libqt4-dev (>= 4.7), |
274 | 33 | libdee-dev (>= 1.0.0), | ||
275 | 33 | Description: Qt binding and QML plugin for Dee - development files | 34 | Description: Qt binding and QML plugin for Dee - development files |
276 | 34 | Simple Qt binding and QML plugin for Dee (https://launchpad.net/dee). | 35 | Simple Qt binding and QML plugin for Dee (https://launchpad.net/dee). |
277 | 35 | . | 36 | . |
278 | 36 | This package contains the developer headers for the Qt binding for Dee | 37 | This package contains the developer headers for the Qt binding for Dee |
279 | 37 | 38 | ||
281 | 38 | Package: libqtdee-qt5 | 39 | Package: libdee-qt5-3 |
282 | 39 | Architecture: any | 40 | Architecture: any |
283 | 40 | Depends: ${shlibs:Depends}, | 41 | Depends: ${shlibs:Depends}, |
284 | 41 | ${misc:Depends}, | 42 | ${misc:Depends}, |
285 | 42 | Description: Qt5 binding and QtQuick2 plugin for Dee - shared library | 43 | Description: Qt5 binding and QtQuick2 plugin for Dee - shared library |
286 | 43 | Simple Qt5 binding and QtQuick2 plugin for Dee (https://launchpad.net/dee). | 44 | Simple Qt5 binding and QtQuick2 plugin for Dee (https://launchpad.net/dee). |
287 | 44 | 45 | ||
289 | 45 | Package: libqtdee-qt5-dev | 46 | Package: libdee-qt5-dev |
290 | 46 | Section: libdevel | 47 | Section: libdevel |
291 | 47 | Architecture: any | 48 | Architecture: any |
292 | 48 | Depends: ${misc:Depends}, | 49 | Depends: ${misc:Depends}, |
294 | 49 | libqtdee-qt5 (= ${binary:Version}), | 50 | libdee-qt5-3 (= ${binary:Version}), |
295 | 50 | qtbase, | 51 | qtbase, |
296 | 51 | qtdeclarative, | 52 | qtdeclarative, |
297 | 53 | libdee-dev (>= 1.0.0), | ||
298 | 52 | Description: Qt5 binding and QtQuick2 plugin for Dee - development files | 54 | Description: Qt5 binding and QtQuick2 plugin for Dee - development files |
299 | 53 | Simple Qt5 binding and QtQuick2 plugin for Dee (https://launchpad.net/dee). | 55 | Simple Qt5 binding and QtQuick2 plugin for Dee (https://launchpad.net/dee). |
300 | 54 | . | 56 | . |
301 | 55 | 57 | ||
302 | === renamed file 'debian/libqtdee2.install' => 'debian/libdee-qt-3.install' | |||
303 | --- debian/libqtdee2.install 2011-01-28 05:27:37 +0000 | |||
304 | +++ debian/libdee-qt-3.install 2012-12-04 18:48:20 +0000 | |||
305 | @@ -1,3 +1,3 @@ | |||
309 | 1 | usr/lib/libQtDee.so.* | 1 | usr/lib/libdee-qt.so.* |
310 | 2 | usr/lib/qt4/imports/dee/libQtDeeQml.so | 2 | usr/lib/*/qt4/imports/Dee/libDeePlugin.so |
311 | 3 | usr/lib/qt4/imports/dee/qmldir | 3 | usr/lib/*/qt4/imports/Dee/qmldir |
312 | 4 | 4 | ||
313 | === renamed file 'debian/libqtdee-dev.install' => 'debian/libdee-qt-dev.install' | |||
314 | --- debian/libqtdee-dev.install 2012-01-05 20:27:31 +0000 | |||
315 | +++ debian/libdee-qt-dev.install 2012-12-04 18:48:20 +0000 | |||
316 | @@ -1,3 +1,3 @@ | |||
320 | 1 | usr/lib/libQtDee.so | 1 | usr/lib/libdee-qt.so |
321 | 2 | usr/include/QtDee/*.h | 2 | usr/include/libdee-qt/*.h |
322 | 3 | usr/lib/pkgconfig/libqtdee.pc | 3 | usr/lib/pkgconfig/libdee-qt.pc |
323 | 4 | 4 | ||
324 | === renamed file 'debian/libqtdee-qt5.install' => 'debian/libdee-qt5-3.install' | |||
325 | --- debian/libqtdee-qt5.install 2012-12-04 18:48:20 +0000 | |||
326 | +++ debian/libdee-qt5-3.install 2012-12-04 18:48:20 +0000 | |||
327 | @@ -1,3 +1,3 @@ | |||
331 | 1 | usr/lib/libQtDee-qt5.so.* | 1 | usr/lib/libdee-qt5.so.* |
332 | 2 | opt/qt5/imports/dee/libQtDeeQml.so | 2 | opt/qt5/imports/Dee/libDeePlugin.so |
333 | 3 | opt/qt5/imports/dee/qmldir | 3 | opt/qt5/imports/Dee/qmldir |
334 | 4 | 4 | ||
335 | === renamed file 'debian/libqtdee-qt5-dev.install' => 'debian/libdee-qt5-dev.install' | |||
336 | --- debian/libqtdee-qt5-dev.install 2012-12-04 18:48:20 +0000 | |||
337 | +++ debian/libdee-qt5-dev.install 2012-12-04 18:48:20 +0000 | |||
338 | @@ -1,3 +1,3 @@ | |||
342 | 1 | usr/lib/libQtDee-qt5.so | 1 | usr/lib/libdee-qt5.so |
343 | 2 | usr/include/QtDee/*.h | 2 | usr/include/libdee-qt5/*.h |
344 | 3 | usr/lib/pkgconfig/libqtdee-qt5.pc | 3 | usr/lib/pkgconfig/libdee-qt5.pc |
345 | 4 | 4 | ||
346 | === modified file 'deelistmodel.cpp' | |||
347 | --- deelistmodel.cpp 2012-11-21 10:30:50 +0000 | |||
348 | +++ deelistmodel.cpp 2012-12-04 18:48:20 +0000 | |||
349 | @@ -21,13 +21,14 @@ | |||
350 | 21 | #include <QtCore/QByteArray> | 21 | #include <QtCore/QByteArray> |
351 | 22 | 22 | ||
352 | 23 | #include <dee.h> | 23 | #include <dee.h> |
353 | 24 | #include <glib-object.h> | ||
354 | 25 | 24 | ||
355 | 26 | #include "deelistmodel.h" | 25 | #include "deelistmodel.h" |
356 | 26 | #include "deeprivate.h" | ||
357 | 27 | 27 | ||
359 | 28 | static QVariant | 28 | QVariant |
360 | 29 | QVariantFromGVariant(GVariant *value) | 29 | QVariantFromGVariant(GVariant *value) |
361 | 30 | { | 30 | { |
362 | 31 | Q_ASSERT(value); | ||
363 | 31 | switch (g_variant_classify(value)) { | 32 | switch (g_variant_classify(value)) { |
364 | 32 | case G_VARIANT_CLASS_BOOLEAN: | 33 | case G_VARIANT_CLASS_BOOLEAN: |
365 | 33 | return QVariant((bool) g_variant_get_boolean(value)); | 34 | return QVariant((bool) g_variant_get_boolean(value)); |
366 | @@ -62,13 +63,14 @@ | |||
367 | 62 | } | 63 | } |
368 | 63 | return array; | 64 | return array; |
369 | 64 | } | 65 | } |
370 | 66 | case G_VARIANT_CLASS_VARIANT: | ||
371 | 67 | return QVariant(QVariantFromGVariant(g_variant_get_variant(value))); | ||
372 | 65 | default: | 68 | default: |
373 | 66 | /* Fallback on an empty QVariant. | 69 | /* Fallback on an empty QVariant. |
374 | 67 | FIXME: Missing conversion of following GVariant types: | 70 | FIXME: Missing conversion of following GVariant types: |
375 | 68 | - G_VARIANT_CLASS_HANDLE | 71 | - G_VARIANT_CLASS_HANDLE |
376 | 69 | - G_VARIANT_CLASS_OBJECT_PATH | 72 | - G_VARIANT_CLASS_OBJECT_PATH |
377 | 70 | - G_VARIANT_CLASS_SIGNATURE | 73 | - G_VARIANT_CLASS_SIGNATURE |
378 | 71 | - G_VARIANT_CLASS_VARIANT | ||
379 | 72 | - G_VARIANT_CLASS_MAYBE | 74 | - G_VARIANT_CLASS_MAYBE |
380 | 73 | - G_VARIANT_CLASS_DICT_ENTRY | 75 | - G_VARIANT_CLASS_DICT_ENTRY |
381 | 74 | */ | 76 | */ |
382 | @@ -84,7 +86,6 @@ | |||
383 | 84 | void connectToDeeModel(); | 86 | void connectToDeeModel(); |
384 | 85 | void connectToDeeModel(DeeModel *model); | 87 | void connectToDeeModel(DeeModel *model); |
385 | 86 | void disconnectFromDeeModel(); | 88 | void disconnectFromDeeModel(); |
386 | 87 | void createRoles(); | ||
387 | 88 | bool synchronized() const; | 89 | bool synchronized() const; |
388 | 89 | 90 | ||
389 | 90 | /* GObject signal handlers for m_deeModel */ | 91 | /* GObject signal handlers for m_deeModel */ |
390 | @@ -142,6 +143,7 @@ | |||
391 | 142 | void | 143 | void |
392 | 143 | DeeListModelPrivate::connectToDeeModel(DeeModel *model) | 144 | DeeListModelPrivate::connectToDeeModel(DeeModel *model) |
393 | 144 | { | 145 | { |
394 | 146 | m_parent->beginResetModel(); | ||
395 | 145 | disconnectFromDeeModel(); | 147 | disconnectFromDeeModel(); |
396 | 146 | 148 | ||
397 | 147 | m_deeModel = (DeeModel*)g_object_ref (model); | 149 | m_deeModel = (DeeModel*)g_object_ref (model); |
398 | @@ -150,15 +152,14 @@ | |||
399 | 150 | g_signal_connect(m_deeModel, "row-changed", G_CALLBACK(onRowChanged), m_parent); | 152 | g_signal_connect(m_deeModel, "row-changed", G_CALLBACK(onRowChanged), m_parent); |
400 | 151 | if (synchronized()) | 153 | if (synchronized()) |
401 | 152 | { | 154 | { |
402 | 153 | createRoles(); | ||
403 | 154 | m_count = dee_model_get_n_rows(m_deeModel); | 155 | m_count = dee_model_get_n_rows(m_deeModel); |
404 | 155 | m_parent->reset(); | ||
405 | 156 | Q_EMIT m_parent->countChanged(); | 156 | Q_EMIT m_parent->countChanged(); |
406 | 157 | } | 157 | } |
407 | 158 | else | 158 | else |
408 | 159 | { | 159 | { |
409 | 160 | g_signal_connect(m_deeModel, "notify::synchronized", G_CALLBACK(onSynchronizedChanged), m_parent); | 160 | g_signal_connect(m_deeModel, "notify::synchronized", G_CALLBACK(onSynchronizedChanged), m_parent); |
410 | 161 | } | 161 | } |
411 | 162 | m_parent->endResetModel(); | ||
412 | 162 | } | 163 | } |
413 | 163 | 164 | ||
414 | 164 | bool | 165 | bool |
415 | @@ -175,25 +176,24 @@ | |||
416 | 175 | } | 176 | } |
417 | 176 | } | 177 | } |
418 | 177 | 178 | ||
421 | 178 | void | 179 | QHash<int, QByteArray> |
422 | 179 | DeeListModelPrivate::createRoles() | 180 | DeeListModel::roleNames() |
423 | 180 | { | 181 | { |
424 | 181 | if (m_deeModel == NULL) { | ||
425 | 182 | return; | ||
426 | 183 | } | ||
427 | 184 | |||
428 | 185 | QHash<int, QByteArray> roles; | 182 | QHash<int, QByteArray> roles; |
429 | 183 | |||
430 | 184 | if (d->m_deeModel == NULL) { | ||
431 | 185 | return roles; | ||
432 | 186 | } | ||
433 | 187 | |||
434 | 186 | QString column; | 188 | QString column; |
436 | 187 | guint n_columns = dee_model_get_n_columns(m_deeModel); | 189 | guint n_columns = dee_model_get_n_columns(d->m_deeModel); |
437 | 188 | 190 | ||
438 | 189 | for (unsigned int index=0; index<n_columns; index++) | 191 | for (unsigned int index=0; index<n_columns; index++) |
439 | 190 | { | 192 | { |
440 | 191 | column = QString("column_%1").arg(index); | 193 | column = QString("column_%1").arg(index); |
442 | 192 | roles[index] = column.toAscii(); | 194 | roles[index] = column.toUtf8(); |
443 | 193 | } | 195 | } |
447 | 194 | 196 | return roles; | |
445 | 195 | m_parent->setRoleNames(roles); | ||
446 | 196 | Q_EMIT m_parent->roleNamesChanged(roles); | ||
448 | 197 | } | 197 | } |
449 | 198 | 198 | ||
450 | 199 | void | 199 | void |
451 | @@ -201,11 +201,11 @@ | |||
452 | 201 | GParamSpec *pspec, | 201 | GParamSpec *pspec, |
453 | 202 | DeeListModel *model) | 202 | DeeListModel *model) |
454 | 203 | { | 203 | { |
456 | 204 | model->d->createRoles(); | 204 | model->beginResetModel(); |
457 | 205 | model->d->m_count = dee_model_get_n_rows(model->d->m_deeModel); | 205 | model->d->m_count = dee_model_get_n_rows(model->d->m_deeModel); |
458 | 206 | model->synchronizedChanged(model->synchronized()); | 206 | model->synchronizedChanged(model->synchronized()); |
459 | 207 | model->reset(); | ||
460 | 208 | Q_EMIT model->countChanged(); | 207 | Q_EMIT model->countChanged(); |
461 | 208 | model->endResetModel(); | ||
462 | 209 | } | 209 | } |
463 | 210 | 210 | ||
464 | 211 | void | 211 | void |
465 | @@ -271,8 +271,6 @@ | |||
466 | 271 | Q_EMIT model->dataChanged(index, index); | 271 | Q_EMIT model->dataChanged(index, index); |
467 | 272 | } | 272 | } |
468 | 273 | 273 | ||
469 | 274 | |||
470 | 275 | |||
471 | 276 | DeeListModel::DeeListModel(QObject *parent) : | 274 | DeeListModel::DeeListModel(QObject *parent) : |
472 | 277 | QAbstractListModel(parent), d(new DeeListModelPrivate(this)) | 275 | QAbstractListModel(parent), d(new DeeListModelPrivate(this)) |
473 | 278 | { | 276 | { |
474 | 279 | 277 | ||
475 | === modified file 'deelistmodel.h' | |||
476 | --- deelistmodel.h 2012-01-31 17:49:00 +0000 | |||
477 | +++ deelistmodel.h 2012-12-04 18:48:20 +0000 | |||
478 | @@ -20,11 +20,12 @@ | |||
479 | 20 | #ifndef DEELISTMODEL_H | 20 | #ifndef DEELISTMODEL_H |
480 | 21 | #define DEELISTMODEL_H | 21 | #define DEELISTMODEL_H |
481 | 22 | 22 | ||
482 | 23 | #include <QtCore/QObject> | ||
483 | 23 | #include <QtCore/QAbstractListModel> | 24 | #include <QtCore/QAbstractListModel> |
484 | 24 | 25 | ||
485 | 25 | class DeeListModelPrivate; | 26 | class DeeListModelPrivate; |
486 | 26 | typedef struct _DeeModel DeeModel; | 27 | typedef struct _DeeModel DeeModel; |
488 | 27 | class __attribute__ ((visibility ("default"))) DeeListModel : public QAbstractListModel | 28 | class Q_DECL_EXPORT DeeListModel : public QAbstractListModel |
489 | 28 | { | 29 | { |
490 | 29 | friend class DeeListModelPrivate; | 30 | friend class DeeListModelPrivate; |
491 | 30 | 31 | ||
492 | @@ -52,11 +53,11 @@ | |||
493 | 52 | /* setters */ | 53 | /* setters */ |
494 | 53 | void setName(const QString& name); | 54 | void setName(const QString& name); |
495 | 54 | void setModel(DeeModel* model); | 55 | void setModel(DeeModel* model); |
496 | 56 | QHash<int, QByteArray> roleNames(); | ||
497 | 55 | 57 | ||
498 | 56 | Q_SIGNALS: | 58 | Q_SIGNALS: |
499 | 57 | void nameChanged(const QString&); | 59 | void nameChanged(const QString&); |
500 | 58 | void synchronizedChanged(bool); | 60 | void synchronizedChanged(bool); |
501 | 59 | void roleNamesChanged(const QHash<int,QByteArray> &); | ||
502 | 60 | void countChanged(); | 61 | void countChanged(); |
503 | 61 | 62 | ||
504 | 62 | private: | 63 | private: |
505 | 63 | 64 | ||
506 | === added file 'deeprivate.h' | |||
507 | --- deeprivate.h 1970-01-01 00:00:00 +0000 | |||
508 | +++ deeprivate.h 2012-12-04 18:48:20 +0000 | |||
509 | @@ -0,0 +1,23 @@ | |||
510 | 1 | /* | ||
511 | 2 | * Copyright (C) 2012 Canonical, Ltd. | ||
512 | 3 | * | ||
513 | 4 | * Authors: | ||
514 | 5 | * Christian Dywan <christian.dywan@canonical.com> | ||
515 | 6 | * | ||
516 | 7 | * This program is free software; you can redistribute it and/or modify | ||
517 | 8 | * it under the terms of the GNU General Public License as published by | ||
518 | 9 | * the Free Software Foundation; version 3. | ||
519 | 10 | * | ||
520 | 11 | * This program is distributed in the hope that it will be useful, | ||
521 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
522 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
523 | 14 | * GNU General Public License for more details. | ||
524 | 15 | * | ||
525 | 16 | * You should have received a copy of the GNU General Public License | ||
526 | 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
527 | 18 | */ | ||
528 | 19 | |||
529 | 20 | #include <glib-object.h> | ||
530 | 21 | |||
531 | 22 | QVariant QVariantFromGVariant(GVariant *value); | ||
532 | 23 | |||
533 | 0 | 24 | ||
534 | === added file 'deevarianttext.cpp' | |||
535 | --- deevarianttext.cpp 1970-01-01 00:00:00 +0000 | |||
536 | +++ deevarianttext.cpp 2012-12-04 18:48:20 +0000 | |||
537 | @@ -0,0 +1,72 @@ | |||
538 | 1 | /* | ||
539 | 2 | * Copyright (C) 2012 Canonical, Ltd. | ||
540 | 3 | * | ||
541 | 4 | * Authors: | ||
542 | 5 | * Christian Dywan <christian.dywan@canonical.com> | ||
543 | 6 | * | ||
544 | 7 | * This program is free software; you can redistribute it and/or modify | ||
545 | 8 | * it under the terms of the GNU General Public License as published by | ||
546 | 9 | * the Free Software Foundation; version 3. | ||
547 | 10 | * | ||
548 | 11 | * This program is distributed in the hope that it will be useful, | ||
549 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
550 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
551 | 14 | * GNU General Public License for more details. | ||
552 | 15 | * | ||
553 | 16 | * You should have received a copy of the GNU General Public License | ||
554 | 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
555 | 18 | */ | ||
556 | 19 | |||
557 | 20 | #include <QDebug> | ||
558 | 21 | |||
559 | 22 | #include "deevarianttext.h" | ||
560 | 23 | #include "deeprivate.h" | ||
561 | 24 | |||
562 | 25 | DeeVariantText::DeeVariantText(QObject *parent) : | ||
563 | 26 | m_text(""), | ||
564 | 27 | m_value(QVariant()), | ||
565 | 28 | m_type("") | ||
566 | 29 | { | ||
567 | 30 | } | ||
568 | 31 | |||
569 | 32 | void | ||
570 | 33 | DeeVariantText::setText(const QString& text) | ||
571 | 34 | { | ||
572 | 35 | if (m_text == text) | ||
573 | 36 | return; | ||
574 | 37 | |||
575 | 38 | m_text = text; | ||
576 | 39 | GVariant *gvariant = g_variant_parse(NULL, text.toUtf8(), NULL, NULL, NULL); | ||
577 | 40 | if (!gvariant) | ||
578 | 41 | { | ||
579 | 42 | qDebug() << "Failed to parse " << text << " to QVariant"; | ||
580 | 43 | m_value = QVariant(); | ||
581 | 44 | m_type = ""; | ||
582 | 45 | } | ||
583 | 46 | else | ||
584 | 47 | { | ||
585 | 48 | m_value = QVariantFromGVariant(gvariant); | ||
586 | 49 | m_type = g_variant_get_type_string(gvariant); | ||
587 | 50 | } | ||
588 | 51 | Q_EMIT textChanged(text); | ||
589 | 52 | Q_EMIT valueChanged(m_value); | ||
590 | 53 | } | ||
591 | 54 | |||
592 | 55 | QString | ||
593 | 56 | DeeVariantText::getText() | ||
594 | 57 | { | ||
595 | 58 | return m_text; | ||
596 | 59 | } | ||
597 | 60 | |||
598 | 61 | QVariant | ||
599 | 62 | DeeVariantText::getValue() | ||
600 | 63 | { | ||
601 | 64 | return m_value; | ||
602 | 65 | } | ||
603 | 66 | |||
604 | 67 | QVariant | ||
605 | 68 | DeeVariantText::getType() | ||
606 | 69 | { | ||
607 | 70 | return m_type; | ||
608 | 71 | } | ||
609 | 72 | |||
610 | 0 | 73 | ||
611 | === added file 'deevarianttext.h' | |||
612 | --- deevarianttext.h 1970-01-01 00:00:00 +0000 | |||
613 | +++ deevarianttext.h 2012-12-04 18:48:20 +0000 | |||
614 | @@ -0,0 +1,49 @@ | |||
615 | 1 | /* | ||
616 | 2 | * Copyright (C) 2012 Canonical, Ltd. | ||
617 | 3 | * | ||
618 | 4 | * Authors: | ||
619 | 5 | * Christian Dywan <christian.dywan@canonical.com> | ||
620 | 6 | * | ||
621 | 7 | * This program is free software; you can redistribute it and/or modify | ||
622 | 8 | * it under the terms of the GNU General Public License as published by | ||
623 | 9 | * the Free Software Foundation; version 3. | ||
624 | 10 | * | ||
625 | 11 | * This program is distributed in the hope that it will be useful, | ||
626 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
627 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
628 | 14 | * GNU General Public License for more details. | ||
629 | 15 | * | ||
630 | 16 | * You should have received a copy of the GNU General Public License | ||
631 | 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
632 | 18 | */ | ||
633 | 19 | |||
634 | 20 | #ifndef DEEVARIANTTEXT_H | ||
635 | 21 | #define DEEVARIANTTEXT_H | ||
636 | 22 | |||
637 | 23 | #include <QtCore/QObject> | ||
638 | 24 | #include <QtCore/QVariant> | ||
639 | 25 | |||
640 | 26 | class Q_DECL_EXPORT DeeVariantText : public QObject { | ||
641 | 27 | Q_OBJECT | ||
642 | 28 | Q_PROPERTY(QString text READ getText WRITE setText NOTIFY textChanged) | ||
643 | 29 | Q_PROPERTY(QVariant value READ getValue NOTIFY valueChanged) | ||
644 | 30 | public: | ||
645 | 31 | DeeVariantText(QObject* parent = 0); | ||
646 | 32 | ~DeeVariantText() { } | ||
647 | 33 | |||
648 | 34 | QString getText(); | ||
649 | 35 | QVariant getValue(); | ||
650 | 36 | QVariant getType(); | ||
651 | 37 | void setText(const QString& text); | ||
652 | 38 | Q_SIGNALS: | ||
653 | 39 | void textChanged(const QString& text); | ||
654 | 40 | void valueChanged(const QVariant& value); | ||
655 | 41 | private: | ||
656 | 42 | Q_DISABLE_COPY(DeeVariantText) | ||
657 | 43 | QString m_text; | ||
658 | 44 | QVariant m_value; | ||
659 | 45 | QString m_type; | ||
660 | 46 | }; | ||
661 | 47 | |||
662 | 48 | #endif // DEEVARIANTTEXT_H | ||
663 | 49 | |||
664 | 0 | 50 | ||
665 | === renamed file 'libqtdee.pc.in' => 'libdee-qt.pc.in' | |||
666 | --- libqtdee.pc.in 2012-12-04 18:48:20 +0000 | |||
667 | +++ libdee-qt.pc.in 2012-12-04 18:48:20 +0000 | |||
668 | @@ -1,12 +1,12 @@ | |||
669 | 1 | prefix=@PREFIX@ | 1 | prefix=@PREFIX@ |
670 | 2 | exec_prefix=@EXEC_PREFIX@ | 2 | exec_prefix=@EXEC_PREFIX@ |
671 | 3 | libdir=${exec_prefix}/lib | 3 | libdir=${exec_prefix}/lib |
673 | 4 | includedir=${prefix}/include | 4 | includedir=${prefix}/@INCLUDE_INSTALL_DIR@ |
674 | 5 | 5 | ||
676 | 6 | Name: libqtdee | 6 | Name: @DEE_QT_LIBNAME@ |
677 | 7 | Description: Qt binding and QML plugin for Dee. | 7 | Description: Qt binding and QML plugin for Dee. |
679 | 8 | Version: 0.2 | 8 | Version: 3.0 |
680 | 9 | 9 | ||
681 | 10 | Requires: @QT_PKGCONFIG_DEPENDENCIES@ dee-1.0 | 10 | Requires: @QT_PKGCONFIG_DEPENDENCIES@ dee-1.0 |
684 | 11 | Libs: -L${libdir} -l@QTDEE_LIBNAME@ | 11 | Libs: -L${libdir} -l@DEE_QT_LIBNAME@ |
685 | 12 | Cflags: -I${includedir}/QtDee | 12 | Cflags: -I${includedir} |
686 | 13 | 13 | ||
687 | === added directory 'modules' | |||
688 | === added file 'modules/CMakeLists.txt' | |||
689 | --- modules/CMakeLists.txt 1970-01-01 00:00:00 +0000 | |||
690 | +++ modules/CMakeLists.txt 2012-12-04 18:48:20 +0000 | |||
691 | @@ -0,0 +1,1 @@ | |||
692 | 1 | add_subdirectory(Dee) | ||
693 | 0 | 2 | ||
694 | === added directory 'modules/Dee' | |||
695 | === added file 'modules/Dee/CMakeLists.txt' | |||
696 | --- modules/Dee/CMakeLists.txt 1970-01-01 00:00:00 +0000 | |||
697 | +++ modules/Dee/CMakeLists.txt 2012-12-04 18:48:20 +0000 | |||
698 | @@ -0,0 +1,46 @@ | |||
699 | 1 | |||
700 | 2 | if (WITHQT5) | ||
701 | 3 | find_package(Qt5Quick REQUIRED) | ||
702 | 4 | set(OUR_QT_QUICK_LIB ${Qt5Quick_LIBRARIES}) | ||
703 | 5 | |||
704 | 6 | get_target_property(QMAKE_EXECUTABLE Qt5::qmake LOCATION) | ||
705 | 7 | exec_program(${QMAKE_EXECUTABLE} ARGS "-query QT_INSTALL_IMPORTS" OUTPUT_VARIABLE QT_IMPORTS_DIR) | ||
706 | 8 | file(TO_CMAKE_PATH "${QT_IMPORTS_DIR}" QT_IMPORTS_DIR) | ||
707 | 9 | |||
708 | 10 | set(OUR_QT_QUICK_INCLUDE ${Qt5Quick_INCLUDE_DIRS}) | ||
709 | 11 | LIST(APPEND QT_PKGCONFIG_DEPENDENCIES "QtQuick") | ||
710 | 12 | else () | ||
711 | 13 | set(OUR_QT_QUICK_LIB ${QT_QTDECLARATIVE_LIBRARIES}) | ||
712 | 14 | set(IMPORT_INSTALL_DIR lib/qt4/imports/Dee) | ||
713 | 15 | set(OUR_QT_QUICK_INCLUDE ${QT_QTDECLARATIVE_INCLUDE_DIR}) | ||
714 | 16 | LIST(APPEND QT_PKGCONFIG_DEPENDENCIES "QtDeclarative") | ||
715 | 17 | endif () | ||
716 | 18 | |||
717 | 19 | set(DeePlugin_SRCS | ||
718 | 20 | plugin.cpp | ||
719 | 21 | ) | ||
720 | 22 | |||
721 | 23 | add_library(DeePlugin SHARED ${DeePlugin_SRCS}) | ||
722 | 24 | |||
723 | 25 | target_link_libraries(DeePlugin | ||
724 | 26 | ${DEE_QT_LIBNAME} | ||
725 | 27 | ${OUR_QT_QUICK_LIB} | ||
726 | 28 | ) | ||
727 | 29 | |||
728 | 30 | include_directories( | ||
729 | 31 | ${CMAKE_CURRENT_BINARY_DIR} | ||
730 | 32 | ${OUR_QT_QUICK_INCLUDE} | ||
731 | 33 | ) | ||
732 | 34 | |||
733 | 35 | # copy qmldir file into build directory for shadow builds | ||
734 | 36 | file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/qmldir" | ||
735 | 37 | DESTINATION ${CMAKE_CURRENT_BINARY_DIR} | ||
736 | 38 | ) | ||
737 | 39 | |||
738 | 40 | install(TARGETS DeePlugin | ||
739 | 41 | LIBRARY DESTINATION ${QT_IMPORTS_DIR}/Dee | ||
740 | 42 | ) | ||
741 | 43 | |||
742 | 44 | install(FILES qmldir | ||
743 | 45 | DESTINATION ${QT_IMPORTS_DIR}/Dee | ||
744 | 46 | ) | ||
745 | 0 | 47 | ||
746 | === renamed file 'plugin.cpp' => 'modules/Dee/plugin.cpp' | |||
747 | --- plugin.cpp 2012-12-04 18:48:20 +0000 | |||
748 | +++ modules/Dee/plugin.cpp 2012-12-04 18:48:20 +0000 | |||
749 | @@ -18,6 +18,7 @@ | |||
750 | 18 | */ | 18 | */ |
751 | 19 | 19 | ||
752 | 20 | #include "deelistmodel.h" | 20 | #include "deelistmodel.h" |
753 | 21 | #include "deevarianttext.h" | ||
754 | 21 | #include "plugin.h" | 22 | #include "plugin.h" |
755 | 22 | #if WITHQT5 | 23 | #if WITHQT5 |
756 | 23 | #include <qqml.h> | 24 | #include <qqml.h> |
757 | @@ -25,11 +26,12 @@ | |||
758 | 25 | #include <QtDeclarative/qdeclarative.h> | 26 | #include <QtDeclarative/qdeclarative.h> |
759 | 26 | #endif | 27 | #endif |
760 | 27 | 28 | ||
762 | 28 | void QtDeePlugin::registerTypes(const char *uri) | 29 | void DeePlugin::registerTypes(const char *uri) |
763 | 29 | { | 30 | { |
765 | 30 | qmlRegisterType<DeeListModel>(uri, 0, 1, "DeeListModel"); | 31 | qmlRegisterType<DeeListModel>(uri, 3, 0, "DeeListModel"); |
766 | 32 | qmlRegisterType<DeeVariantText>(uri, 3, 0, "DeeVariantText"); | ||
767 | 31 | } | 33 | } |
768 | 32 | 34 | ||
769 | 33 | #if !WITHQT5 | 35 | #if !WITHQT5 |
771 | 34 | Q_EXPORT_PLUGIN2(QtDee, QtDeePlugin); | 36 | Q_EXPORT_PLUGIN2(Dee, DeePlugin); |
772 | 35 | #endif | 37 | #endif |
773 | 36 | 38 | ||
774 | === renamed file 'plugin.h' => 'modules/Dee/plugin.h' | |||
775 | --- plugin.h 2012-12-04 18:48:20 +0000 | |||
776 | +++ modules/Dee/plugin.h 2012-12-04 18:48:20 +0000 | |||
777 | @@ -26,7 +26,7 @@ | |||
778 | 26 | #include <QtDeclarative/QDeclarativeExtensionPlugin> | 26 | #include <QtDeclarative/QDeclarativeExtensionPlugin> |
779 | 27 | #endif | 27 | #endif |
780 | 28 | 28 | ||
782 | 29 | class QtDeePlugin : | 29 | class DeePlugin : |
783 | 30 | #if WITHQT5 | 30 | #if WITHQT5 |
784 | 31 | public QQmlExtensionPlugin | 31 | public QQmlExtensionPlugin |
785 | 32 | #else | 32 | #else |
786 | 33 | 33 | ||
787 | === renamed file 'qmldir' => 'modules/Dee/qmldir' | |||
788 | --- qmldir 2011-01-13 16:05:58 +0000 | |||
789 | +++ modules/Dee/qmldir 2012-12-04 18:48:20 +0000 | |||
790 | @@ -1,1 +1,1 @@ | |||
792 | 1 | plugin QtDeeQml | 1 | plugin DeePlugin |
793 | 2 | 2 | ||
794 | === removed file 'test.cpp' | |||
795 | --- test.cpp 2011-01-24 04:05:02 +0000 | |||
796 | +++ test.cpp 1970-01-01 00:00:00 +0000 | |||
797 | @@ -1,35 +0,0 @@ | |||
798 | 1 | /* | ||
799 | 2 | * Copyright (C) 2010 Canonical, Ltd. | ||
800 | 3 | * | ||
801 | 4 | * Authors: | ||
802 | 5 | * Florian Boucault <florian.boucault@canonical.com> | ||
803 | 6 | * | ||
804 | 7 | * This program is free software; you can redistribute it and/or modify | ||
805 | 8 | * it under the terms of the GNU General Public License as published by | ||
806 | 9 | * the Free Software Foundation; version 3. | ||
807 | 10 | * | ||
808 | 11 | * This program is distributed in the hope that it will be useful, | ||
809 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
810 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
811 | 14 | * GNU General Public License for more details. | ||
812 | 15 | * | ||
813 | 16 | * You should have received a copy of the GNU General Public License | ||
814 | 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
815 | 18 | */ | ||
816 | 19 | |||
817 | 20 | #include "test.h" | ||
818 | 21 | #include "deelistmodel.h" | ||
819 | 22 | |||
820 | 23 | int main(int argc, char *argv[]) | ||
821 | 24 | { | ||
822 | 25 | TestApplication application(argc, argv); | ||
823 | 26 | |||
824 | 27 | DeeListModel* model = new DeeListModel; | ||
825 | 28 | |||
826 | 29 | QObject::connect(model, SIGNAL(synchronizedChanged(bool)), &application, SLOT(onSynchronizedChanged(bool))); | ||
827 | 30 | QObject::connect(model, SIGNAL(rowsInserted(QModelIndex, int, int)), &application, SLOT(onRowsInserted())); | ||
828 | 31 | |||
829 | 32 | model->setName("com.canonical.Unity.ApplicationsPlace.ResultsModel"); | ||
830 | 33 | |||
831 | 34 | return application.exec(); | ||
832 | 35 | } | ||
833 | 36 | 0 | ||
834 | === removed file 'test.h' | |||
835 | --- test.h 2012-01-04 23:52:05 +0000 | |||
836 | +++ test.h 1970-01-01 00:00:00 +0000 | |||
837 | @@ -1,52 +0,0 @@ | |||
838 | 1 | /* | ||
839 | 2 | * Copyright (C) 2011 Canonical, Ltd. | ||
840 | 3 | * | ||
841 | 4 | * Authors: | ||
842 | 5 | * Florian Boucault <florian.boucault@canonical.com> | ||
843 | 6 | * | ||
844 | 7 | * This program is free software; you can redistribute it and/or modify | ||
845 | 8 | * it under the terms of the GNU General Public License as published by | ||
846 | 9 | * the Free Software Foundation; version 3. | ||
847 | 10 | * | ||
848 | 11 | * This program is distributed in the hope that it will be useful, | ||
849 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
850 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
851 | 14 | * GNU General Public License for more details. | ||
852 | 15 | * | ||
853 | 16 | * You should have received a copy of the GNU General Public License | ||
854 | 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
855 | 18 | */ | ||
856 | 19 | |||
857 | 20 | #ifndef TEST_H | ||
858 | 21 | #define TEST_H | ||
859 | 22 | |||
860 | 23 | #include <QtCore/QCoreApplication> | ||
861 | 24 | #include <QtCore/QDebug> | ||
862 | 25 | |||
863 | 26 | #include "deelistmodel.h" | ||
864 | 27 | |||
865 | 28 | class TestApplication : public QCoreApplication | ||
866 | 29 | { | ||
867 | 30 | Q_OBJECT | ||
868 | 31 | |||
869 | 32 | public: | ||
870 | 33 | TestApplication(int& argc, char** argv) : QCoreApplication(argc, argv) {} | ||
871 | 34 | |||
872 | 35 | public Q_SLOTS: | ||
873 | 36 | void onSynchronizedChanged(bool synchronized) { | ||
874 | 37 | DeeListModel* model = (DeeListModel*)sender(); | ||
875 | 38 | qDebug() << "Number of columns:" << model->roleNames().size(); | ||
876 | 39 | qDebug() << "Number of rows:" << model->rowCount(); | ||
877 | 40 | |||
878 | 41 | for(int i = 0; i < model->rowCount(); ++i) { | ||
879 | 42 | qDebug() << model->data(model->index(i)); | ||
880 | 43 | } | ||
881 | 44 | } | ||
882 | 45 | |||
883 | 46 | void onRowsInserted() { | ||
884 | 47 | DeeListModel* model = (DeeListModel*)sender(); | ||
885 | 48 | qDebug() << "Rows added, current number:" << model->rowCount(); | ||
886 | 49 | } | ||
887 | 50 | }; | ||
888 | 51 | |||
889 | 52 | #endif // TEST_H | ||
890 | 53 | 0 | ||
891 | === removed file 'test_qtquick2.qml' | |||
892 | --- test_qtquick2.qml 2012-12-04 18:48:20 +0000 | |||
893 | +++ test_qtquick2.qml 1970-01-01 00:00:00 +0000 | |||
894 | @@ -1,15 +0,0 @@ | |||
895 | 1 | import QtQuick 2.0 | ||
896 | 2 | import dee 0.1 | ||
897 | 3 | |||
898 | 4 | ListView { | ||
899 | 5 | width: 200 | ||
900 | 6 | height: 200 | ||
901 | 7 | delegate: Text { | ||
902 | 8 | x: 66 | ||
903 | 9 | y: 93 | ||
904 | 10 | text: column_4 | ||
905 | 11 | } | ||
906 | 12 | model: DeeListModel { | ||
907 | 13 | name: "com.canonical.Unity.Lens.applications.T1313498309.Results" | ||
908 | 14 | } | ||
909 | 15 | } | ||
910 | 16 | 0 | ||
911 | === added directory 'tests' | |||
912 | === added file 'tests/CMakeLists.txt' | |||
913 | --- tests/CMakeLists.txt 1970-01-01 00:00:00 +0000 | |||
914 | +++ tests/CMakeLists.txt 2012-12-04 18:48:20 +0000 | |||
915 | @@ -0,0 +1,57 @@ | |||
916 | 1 | if (WITHQT5) | ||
917 | 2 | find_package(Qt5Test REQUIRED) | ||
918 | 3 | set(OUR_QT_TEST_LIB ${Qt5Test_LIBRARIES}) | ||
919 | 4 | set(OUR_QT_TEST_INCLUDES ${Qt5Test_INCLUDE_DIRS}) | ||
920 | 5 | else () | ||
921 | 6 | set(OUR_QT_TEST_LIB ${QT_QTTEST_LIBRARIES}) | ||
922 | 7 | set(OUR_QT_TEST_INCLUDES ${QT_QTTEST_INCLUDE_DIR}) | ||
923 | 8 | set(OUR_QT_QUICK_LIB ${QT_QTDECLARATIVE_LIBRARIES}) | ||
924 | 9 | set(OUR_QT_QUICK_INCLUDE ${QT_QTDECLARATIVE_INCLUDE_DIR}) | ||
925 | 10 | endif () | ||
926 | 11 | |||
927 | 12 | if (WITHQT5) | ||
928 | 13 | add_test(NAME plugintest COMMAND "qmltestrunner" "-import" "../modules" "-xunitxml" "-o" "plugintest-xunit.xml" "-input" "${CMAKE_CURRENT_SOURCE_DIR}") | ||
929 | 14 | else () | ||
930 | 15 | add_executable(plugintest qtquick1plugintest.cpp) | ||
931 | 16 | target_link_libraries(plugintest ${OUR_QT_TEST_LIB} ${OUR_QT_QUICK_LIB}) | ||
932 | 17 | set_target_properties(plugintest PROPERTIES COMPILE_FLAGS -fPIC) | ||
933 | 18 | add_test(NAME plugintest WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" COMMAND "dbus-test-runner" "--task" "${CMAKE_CURRENT_BINARY_DIR}/plugintest" "-p" "-xunitxml" "-p" "-o" "-p" "${CMAKE_CURRENT_BINARY_DIR}/plugintest-xunit.xml") | ||
934 | 19 | set_property(TEST plugintest PROPERTY ENVIRONMENT "LD_LIBRARY_PATH=.") | ||
935 | 20 | set_property(TEST plugintest PROPERTY ENVIRONMENT "QT_GRAPHICSSYSTEM=raster") | ||
936 | 21 | set_property(TEST plugintest PROPERTY ENVIRONMENT "QML_IMPORT_PATH=${CMAKE_CURRENT_BINARY_DIR}/../modules") | ||
937 | 22 | add_dependencies(check plugintest) | ||
938 | 23 | endif () | ||
939 | 24 | |||
940 | 25 | include_directories( | ||
941 | 26 | ${CMAKE_CURRENT_BINARY_DIR} | ||
942 | 27 | ${OUR_QT_TEST_INCLUDES} | ||
943 | 28 | ${OUR_QT_QUICK_INCLUDE} | ||
944 | 29 | ) | ||
945 | 30 | |||
946 | 31 | add_executable(conversiontest conversiontest.cpp) | ||
947 | 32 | target_link_libraries(conversiontest ${OUR_QT_WIDGETS_LIB} ${OUR_QT_TEST_LIB} ${OUR_QT_QUICK_LIB} ${DEE_QT_LIBNAME}) | ||
948 | 33 | set_target_properties(conversiontest PROPERTIES COMPILE_FLAGS -fPIC) | ||
949 | 34 | add_test(NAME conversiontest COMMAND "dbus-test-runner" "--task" "${CMAKE_CURRENT_BINARY_DIR}/conversiontest" "-p" "-xunitxml" "-p" "-o" "-p" "conversiontest-xunit.xml") | ||
950 | 35 | set_property(TEST conversiontest PROPERTY ENVIRONMENT "LD_LIBRARY_PATH=.") | ||
951 | 36 | set_property(TEST conversiontest PROPERTY ENVIRONMENT "QT_QPA_PLATFORM=minimal") | ||
952 | 37 | add_dependencies(check conversiontest) | ||
953 | 38 | |||
954 | 39 | add_executable(test-helper test-helper.cpp) | ||
955 | 40 | target_link_libraries(test-helper ${OUR_QT_CORE_LIB} ${OUR_QT_DBUS_LIB} ${DEE_LDFLAGS}) | ||
956 | 41 | set_target_properties(test-helper PROPERTIES COMPILE_FLAGS -fPIC) | ||
957 | 42 | add_dependencies(conversiontest ${DEE_QT_LIBNAME} test-helper) | ||
958 | 43 | |||
959 | 44 | add_executable(deelistmodeltest deelistmodeltest.cpp) | ||
960 | 45 | target_link_libraries(deelistmodeltest ${OUR_QT_TEST_LIB} ${OUR_QT_DBUS_LIB} ${DEE_QT_LIBNAME}) | ||
961 | 46 | set_target_properties(deelistmodeltest PROPERTIES COMPILE_FLAGS -fPIC) | ||
962 | 47 | add_test(NAME deelistmodeltest COMMAND "dbus-test-runner" "--task" "${CMAKE_CURRENT_BINARY_DIR}/test-helper" "--task" "${CMAKE_CURRENT_BINARY_DIR}/deelistmodeltest" "-p" "-xunitxml" "-p" "-o" "-p" "deelistmodeltest-xunit.xml") | ||
963 | 48 | set_property(TEST deelistmodeltest PROPERTY ENVIRONMENT "LD_LIBRARY_PATH=.") | ||
964 | 49 | add_dependencies(check deelistmodeltest) | ||
965 | 50 | |||
966 | 51 | add_executable(deevarianttexttest deevarianttexttest.cpp) | ||
967 | 52 | target_link_libraries(deevarianttexttest ${OUR_QT_TEST_LIB} ${OUR_QT_DBUS_LIB} ${DEE_QT_LIBNAME}) | ||
968 | 53 | set_target_properties(deevarianttexttest PROPERTIES COMPILE_FLAGS -fPIC) | ||
969 | 54 | add_test(NAME deevarianttexttest COMMAND "dbus-test-runner" "--task" "${CMAKE_CURRENT_BINARY_DIR}/test-helper" "--task" "${CMAKE_CURRENT_BINARY_DIR}/deelistmodeltest" "-p" "-xunitxml" "-p" "-o" "-p" "deelistmodeltest-xunit.xml") | ||
970 | 55 | set_property(TEST deevarianttexttest PROPERTY ENVIRONMENT "LD_LIBRARY_PATH=.") | ||
971 | 56 | add_dependencies(check deevarianttexttest) | ||
972 | 57 | |||
973 | 0 | 58 | ||
974 | === renamed file 'conversiontest.cpp' => 'tests/conversiontest.cpp' | |||
975 | --- conversiontest.cpp 2012-11-21 12:09:44 +0000 | |||
976 | +++ tests/conversiontest.cpp 2012-12-04 18:48:20 +0000 | |||
977 | @@ -18,6 +18,7 @@ | |||
978 | 18 | #include <QObject> | 18 | #include <QObject> |
979 | 19 | 19 | ||
980 | 20 | #include "deelistmodel.h" | 20 | #include "deelistmodel.h" |
981 | 21 | #include "deevarianttext.h" | ||
982 | 21 | 22 | ||
983 | 22 | #include <dee.h> | 23 | #include <dee.h> |
984 | 23 | 24 | ||
985 | 24 | 25 | ||
986 | === renamed file 'deelistmodeltest.cpp' => 'tests/deelistmodeltest.cpp' | |||
987 | === added file 'tests/deevarianttexttest.cpp' | |||
988 | --- tests/deevarianttexttest.cpp 1970-01-01 00:00:00 +0000 | |||
989 | +++ tests/deevarianttexttest.cpp 2012-12-04 18:48:20 +0000 | |||
990 | @@ -0,0 +1,58 @@ | |||
991 | 1 | /* | ||
992 | 2 | * Copyright (C) 2012 Canonical, Ltd. | ||
993 | 3 | * | ||
994 | 4 | * This program is free software; you can redistribute it and/or modify | ||
995 | 5 | * it under the terms of the GNU General Public License as published by | ||
996 | 6 | * the Free Software Foundation; version 3. | ||
997 | 7 | * | ||
998 | 8 | * This program is distributed in the hope that it will be useful, | ||
999 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1000 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1001 | 11 | * GNU General Public License for more details. | ||
1002 | 12 | * | ||
1003 | 13 | * You should have received a copy of the GNU General Public License | ||
1004 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1005 | 15 | */ | ||
1006 | 16 | |||
1007 | 17 | #include <QtTest> | ||
1008 | 18 | #include <QObject> | ||
1009 | 19 | |||
1010 | 20 | #include "deevarianttext.h" | ||
1011 | 21 | |||
1012 | 22 | #include <dee.h> | ||
1013 | 23 | |||
1014 | 24 | class DeeVariantTextTest : public QObject | ||
1015 | 25 | { | ||
1016 | 26 | Q_OBJECT | ||
1017 | 27 | |||
1018 | 28 | private Q_SLOTS: | ||
1019 | 29 | void initTestCase() | ||
1020 | 30 | { | ||
1021 | 31 | g_type_init(); | ||
1022 | 32 | } | ||
1023 | 33 | |||
1024 | 34 | void GVariantParseTest() | ||
1025 | 35 | { | ||
1026 | 36 | QHash<QString, QVariant> hash; | ||
1027 | 37 | hash["[[1, 2, 3], [4, 5, 6]]"] = "aai"; | ||
1028 | 38 | hash["[[1, 2, 3], [4, 5, 6.0]]"] = "aad"; | ||
1029 | 39 | hash["[\"hello\", nothing]"] = "ams"; | ||
1030 | 40 | hash["{1: \"one\", 2: \"two\", 3: \"three\"}"] = "a{is}"; | ||
1031 | 41 | hash["[just 3, nothing]"] = "ami"; | ||
1032 | 42 | // hash["{\"title\": <\"frobit\">, \"enabled\": <true>, width: <800>}"] = ""; | ||
1033 | 43 | hash["@ms \"\""] = "ms"; | ||
1034 | 44 | QHashIterator<QString, QVariant> i(hash); | ||
1035 | 45 | while (i.hasNext()) { | ||
1036 | 46 | i.next(); | ||
1037 | 47 | QString input(i.key()); | ||
1038 | 48 | DeeVariantText dvariant; | ||
1039 | 49 | dvariant.setText(input); | ||
1040 | 50 | QCOMPARE(dvariant.getText(), input); | ||
1041 | 51 | QCOMPARE(dvariant.getType(), i.value()); | ||
1042 | 52 | } | ||
1043 | 53 | } | ||
1044 | 54 | }; | ||
1045 | 55 | |||
1046 | 56 | QTEST_MAIN(DeeVariantTextTest) | ||
1047 | 57 | |||
1048 | 58 | #include "deevarianttexttest.moc" | ||
1049 | 0 | 59 | ||
1050 | === added file 'tests/qtquick1plugintest.cpp' | |||
1051 | --- tests/qtquick1plugintest.cpp 1970-01-01 00:00:00 +0000 | |||
1052 | +++ tests/qtquick1plugintest.cpp 2012-12-04 18:48:20 +0000 | |||
1053 | @@ -0,0 +1,48 @@ | |||
1054 | 1 | /* | ||
1055 | 2 | * Copyright (C) 2012 Canonical, Ltd. | ||
1056 | 3 | * | ||
1057 | 4 | * This program is free software; you can redistribute it and/or modify | ||
1058 | 5 | * it under the terms of the GNU General Public License as published by | ||
1059 | 6 | * the Free Software Foundation; version 3. | ||
1060 | 7 | * | ||
1061 | 8 | * This program is distributed in the hope that it will be useful, | ||
1062 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1063 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1064 | 11 | * GNU General Public License for more details. | ||
1065 | 12 | * | ||
1066 | 13 | * You should have received a copy of the GNU General Public License | ||
1067 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1068 | 15 | */ | ||
1069 | 16 | |||
1070 | 17 | #include <QtTest> | ||
1071 | 18 | #include <QObject> | ||
1072 | 19 | #include <QtDeclarative> | ||
1073 | 20 | |||
1074 | 21 | class PluginTest : public QObject | ||
1075 | 22 | { | ||
1076 | 23 | Q_OBJECT | ||
1077 | 24 | |||
1078 | 25 | private Q_SLOTS: | ||
1079 | 26 | void initTestCase() | ||
1080 | 27 | { | ||
1081 | 28 | } | ||
1082 | 29 | |||
1083 | 30 | void GVariantQMLTest() | ||
1084 | 31 | { | ||
1085 | 32 | // Dummy argc/v to avoid GCC confusing int with Display* on some systems | ||
1086 | 33 | int argc = 0; | ||
1087 | 34 | char *argv[0]; | ||
1088 | 35 | QApplication app(argc, argv); | ||
1089 | 36 | QDeclarativeView view; | ||
1090 | 37 | view.setSource(QUrl::fromLocalFile("test_qtquick1.qml")); | ||
1091 | 38 | Q_ASSERT(view.errors().empty()); | ||
1092 | 39 | QObject *text2 = view.rootObject()->findChild<QObject*>("text2"); | ||
1093 | 40 | Q_ASSERT(text2); | ||
1094 | 41 | QVariant text2text(text2->metaObject()->property(text2->metaObject()->indexOfProperty("text")).read(text2)); | ||
1095 | 42 | QCOMPARE(text2text.toString(), QString("4,1.1,0.1,0,0.3,3.6")); | ||
1096 | 43 | } | ||
1097 | 44 | }; | ||
1098 | 45 | |||
1099 | 46 | QTEST_MAIN(PluginTest) | ||
1100 | 47 | |||
1101 | 48 | #include "qtquick1plugintest.moc" | ||
1102 | 0 | 49 | ||
1103 | === renamed file 'test-helper.cpp' => 'tests/test-helper.cpp' | |||
1104 | === renamed file 'test_qtquick1.qml' => 'tests/test_qtquick1.qml' | |||
1105 | --- test_qtquick1.qml 2012-02-08 15:02:19 +0000 | |||
1106 | +++ tests/test_qtquick1.qml 2012-12-04 18:48:20 +0000 | |||
1107 | @@ -1,15 +1,40 @@ | |||
1108 | 1 | import QtQuick 1.0 | 1 | import QtQuick 1.0 |
1122 | 2 | import dee 0.1 | 2 | import Dee 3.0 |
1123 | 3 | 3 | ||
1124 | 4 | ListView { | 4 | Item { |
1125 | 5 | width: 200 | 5 | |
1126 | 6 | height: 200 | 6 | ListView { |
1127 | 7 | delegate: Text { | 7 | width: 200 |
1128 | 8 | x: 66 | 8 | height: 200 |
1129 | 9 | y: 93 | 9 | delegate: Text { |
1130 | 10 | text: column_4 | 10 | x: 66 |
1131 | 11 | } | 11 | y: 93 |
1132 | 12 | model: DeeListModel { | 12 | text: column_4 |
1133 | 13 | name: "com.canonical.Unity.Lens.applications.T1313498309.Results" | 13 | } |
1134 | 14 | } | 14 | model: DeeListModel { |
1135 | 15 | name: "com.canonical.Unity.Lens.applications.T1313498309.Results" | ||
1136 | 16 | } | ||
1137 | 17 | } | ||
1138 | 18 | |||
1139 | 19 | DeeVariantText { | ||
1140 | 20 | id: arrayOfInt | ||
1141 | 21 | text: "[[1, 2, 3], [4, 5, 6]]" | ||
1142 | 22 | Component.onCompleted: { | ||
1143 | 23 | arrayOfInt.text = "[[4, 1.1, .1], [0, 0.3, 3.6]]" | ||
1144 | 24 | } | ||
1145 | 25 | onTextChanged: { | ||
1146 | 26 | text2.text = arrayOfInt.value.toString() | ||
1147 | 27 | } | ||
1148 | 28 | } | ||
1149 | 29 | |||
1150 | 30 | Text { | ||
1151 | 31 | text: arrayOfInt.value.toString() | ||
1152 | 32 | } | ||
1153 | 33 | |||
1154 | 34 | Text { | ||
1155 | 35 | id: text2 | ||
1156 | 36 | objectName: "text2" | ||
1157 | 37 | } | ||
1158 | 38 | |||
1159 | 15 | } | 39 | } |
1160 | 40 | |||
1161 | 16 | 41 | ||
1162 | === added file 'tests/tst_deelistmodel.qml' | |||
1163 | --- tests/tst_deelistmodel.qml 1970-01-01 00:00:00 +0000 | |||
1164 | +++ tests/tst_deelistmodel.qml 2012-12-04 18:48:20 +0000 | |||
1165 | @@ -0,0 +1,22 @@ | |||
1166 | 1 | import QtQuick 2.0 | ||
1167 | 2 | import QtTest 1.0 | ||
1168 | 3 | import Dee 3.0 | ||
1169 | 4 | |||
1170 | 5 | TestCase { | ||
1171 | 6 | name: "DeeListModel" | ||
1172 | 7 | |||
1173 | 8 | ListView { | ||
1174 | 9 | width: 200 | ||
1175 | 10 | height: 200 | ||
1176 | 11 | delegate: Text { | ||
1177 | 12 | x: 66 | ||
1178 | 13 | y: 93 | ||
1179 | 14 | text: column_4 | ||
1180 | 15 | } | ||
1181 | 16 | model: DeeListModel { | ||
1182 | 17 | name: "com.canonical.Unity.Lens.applications.T1313498309.Results" | ||
1183 | 18 | } | ||
1184 | 19 | } | ||
1185 | 20 | |||
1186 | 21 | } | ||
1187 | 22 | |||
1188 | 0 | 23 | ||
1189 | === added file 'tests/tst_deevarianttext.qml' | |||
1190 | --- tests/tst_deevarianttext.qml 1970-01-01 00:00:00 +0000 | |||
1191 | +++ tests/tst_deevarianttext.qml 2012-12-04 18:48:20 +0000 | |||
1192 | @@ -0,0 +1,60 @@ | |||
1193 | 1 | import QtQuick 2.0 | ||
1194 | 2 | import QtTest 1.0 | ||
1195 | 3 | import Dee 3.0 | ||
1196 | 4 | |||
1197 | 5 | TestCase { | ||
1198 | 6 | name: "DeeVariantText" | ||
1199 | 7 | |||
1200 | 8 | function test_1_initialText () { | ||
1201 | 9 | compare(arrayOfStr.value.toString(),"bar,foo") | ||
1202 | 10 | } | ||
1203 | 11 | |||
1204 | 12 | function test_3_textAssigned () { | ||
1205 | 13 | arrayOfInt.text = "[[4, 1.1, .1], [0, 0.3, 3.6]]" | ||
1206 | 14 | compare(arrayOfInt.value.toString(),"4,1.1,0.1,0,0.3,3.6") | ||
1207 | 15 | } | ||
1208 | 16 | |||
1209 | 17 | function test_4_textChanged () { | ||
1210 | 18 | arrayOfInt.didChange = false | ||
1211 | 19 | arrayOfInt.text = "@ams [nothing]" | ||
1212 | 20 | compare(arrayOfInt.didChange,true) | ||
1213 | 21 | } | ||
1214 | 22 | |||
1215 | 23 | function test_5_textNotChanged () { | ||
1216 | 24 | arrayOfInt.text = "@ams [nothing]" | ||
1217 | 25 | arrayOfInt.didChange = false | ||
1218 | 26 | arrayOfInt.text = "@ams [nothing]" | ||
1219 | 27 | compare(arrayOfInt.didChange,false) | ||
1220 | 28 | } | ||
1221 | 29 | |||
1222 | 30 | function test_6_invalid () { | ||
1223 | 31 | arrayOfInt.text = "[nothing]" | ||
1224 | 32 | compare(arrayOfInt.value,undefined) | ||
1225 | 33 | } | ||
1226 | 34 | |||
1227 | 35 | function test_7_unicode () { | ||
1228 | 36 | arrayOfStr.text = "[\"١٢٣٤٥٦٧٨٩٠\", \"道具箱\", \"Котята\"]" | ||
1229 | 37 | compare(arrayOfStr.value.toString(),"١٢٣٤٥٦٧٨٩٠,道具箱,Котята") | ||
1230 | 38 | } | ||
1231 | 39 | |||
1232 | 40 | function test_8_gvariant () { | ||
1233 | 41 | arrayOfStr.text = "[<\"test\">, <\"test2\">]" | ||
1234 | 42 | compare(arrayOfStr.value.toString(), "test,test2") | ||
1235 | 43 | } | ||
1236 | 44 | |||
1237 | 45 | DeeVariantText { | ||
1238 | 46 | id: arrayOfStr | ||
1239 | 47 | text: "[\"bar\", \"foo\"]" | ||
1240 | 48 | } | ||
1241 | 49 | |||
1242 | 50 | DeeVariantText { | ||
1243 | 51 | id: arrayOfInt | ||
1244 | 52 | text: "[[1, 2, 3], [4, 5, 6]]" | ||
1245 | 53 | property bool didChange: false | ||
1246 | 54 | onTextChanged: { | ||
1247 | 55 | didChange = true | ||
1248 | 56 | } | ||
1249 | 57 | } | ||
1250 | 58 | |||
1251 | 59 | } | ||
1252 | 60 |