Merge lp:~marcustomlinson/qtcreator-plugin-ubuntu/refactor-scope-template into lp:qtcreator-plugin-ubuntu

Proposed by Marcus Tomlinson
Status: Merged
Approved by: Zoltan Balogh
Approved revision: 433
Merged at revision: 393
Proposed branch: lp:~marcustomlinson/qtcreator-plugin-ubuntu/refactor-scope-template
Merge into: lp:qtcreator-plugin-ubuntu
Diff against target: 1816 lines (+518/-788)
24 files modified
share/qtcreator/templates/wizards/ubuntu/scope/CMakeLists.txt (+20/-29)
share/qtcreator/templates/wizards/ubuntu/scope/cmake/FindGMock.cmake (+0/-12)
share/qtcreator/templates/wizards/ubuntu/scope/cmake/FindIntltool.cmake (+0/-265)
share/qtcreator/templates/wizards/ubuntu/scope/data/CMakeLists.txt (+0/-10)
share/qtcreator/templates/wizards/ubuntu/scope/include/api/config.h (+0/-27)
share/qtcreator/templates/wizards/ubuntu/scope/po/POTFILES.in (+11/-11)
share/qtcreator/templates/wizards/ubuntu/scope/src/CMakeLists.txt (+31/-33)
share/qtcreator/templates/wizards/ubuntu/scope/src/client.cpp (+2/-3)
share/qtcreator/templates/wizards/ubuntu/scope/src/client.h (+17/-9)
share/qtcreator/templates/wizards/ubuntu/scope/src/data/displayName-settings.ini.in (+21/-0)
share/qtcreator/templates/wizards/ubuntu/scope/src/data/displayName.ini.in (+1/-0)
share/qtcreator/templates/wizards/ubuntu/scope/src/localization.h (+3/-3)
share/qtcreator/templates/wizards/ubuntu/scope/src/preview.cpp (+20/-21)
share/qtcreator/templates/wizards/ubuntu/scope/src/preview.h (+3/-7)
share/qtcreator/templates/wizards/ubuntu/scope/src/query.cpp (+41/-41)
share/qtcreator/templates/wizards/ubuntu/scope/src/query.h (+6/-10)
share/qtcreator/templates/wizards/ubuntu/scope/src/scope.cpp (+5/-7)
share/qtcreator/templates/wizards/ubuntu/scope/src/scope.h (+5/-9)
share/qtcreator/templates/wizards/ubuntu/scope/tests/CMakeLists.txt (+15/-8)
share/qtcreator/templates/wizards/ubuntu/scope/tests/server/server.py (+1/-1)
share/qtcreator/templates/wizards/ubuntu/scope/tests/unit/CMakeLists.txt (+7/-25)
share/qtcreator/templates/wizards/ubuntu/scope/tests/unit/scope/test-scope.cpp (+0/-232)
share/qtcreator/templates/wizards/ubuntu/scope/tests/unit/test-scope.py (+290/-0)
share/qtcreator/templates/wizards/ubuntu/scope/wizard.xml (+19/-25)
To merge this branch: bzr merge lp:~marcustomlinson/qtcreator-plugin-ubuntu/refactor-scope-template
Reviewer Review Type Date Requested Status
Benjamin Zeller Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+259083@code.launchpad.net

Commit message

Refactored the scope templates to be more simplistic and comprehensible:
* Reduced directory structure to as few folders as possible
* Renamed scope ini file to <scope-name>.ini
* Added a <scope-name>-settings.ini
* Cleaned out unnecessary complexities from source and CMake files
* More descriptive comments and variable names
* Updated tests to use python3-scope-harness
* Removed cmake/ modules folder (SDK now includes cmake-extras)
* Allow scope template to build with gcc > 4.9
* Added "Keywords" key to scope ini

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:432
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~marcustomlinson/qtcreator-plugin-ubuntu/refactor-scope-template/+merge/259083/+edit-commit-message

http://jenkins.qa.ubuntu.com/job/qtcreator-plugin-ubuntu-ci/542/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/qtcreator-plugin-ubuntu-wily-amd64-ci/3
    SUCCESS: http://jenkins.qa.ubuntu.com/job/qtcreator-plugin-ubuntu-wily-armhf-ci/3

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/qtcreator-plugin-ubuntu-ci/542/rebuild

review: Needs Fixing (continuous-integration)
433. By Marcus Tomlinson

Fixed comment

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Benjamin Zeller (zeller-benjamin) wrote :

ok

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'share/qtcreator/templates/wizards/ubuntu/scope/CMakeLists.txt'
2--- share/qtcreator/templates/wizards/ubuntu/scope/CMakeLists.txt 2015-01-07 10:50:28 +0000
3+++ share/qtcreator/templates/wizards/ubuntu/scope/CMakeLists.txt 2015-05-19 10:38:08 +0000
4@@ -1,12 +1,11 @@
5 project(%ProjectName:l% CXX)
6 cmake_minimum_required(VERSION 2.8.10)
7-set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" "${CMAKE_MODULE_PATH}")
8
9-# We require g++ 4.9, to avoid ABI breakage with earlier version.
10+# We require at least g++ 4.9, to avoid ABI breakage with earlier versions.
11 set(cxx_version_required 4.9)
12-if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
13- if (NOT CMAKE_CXX_COMPILER_VERSION MATCHES "^${cxx_version_required}")
14- message(FATAL_ERROR "g++ version must be ${cxx_version_required}!")
15+if (CMAKE_COMPILER_IS_GNUCXX)
16+ if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${cxx_version_required})
17+ message(FATAL_ERROR "g++ version must be at least ${cxx_version_required}!")
18 endif()
19 endif()
20
21@@ -21,17 +20,14 @@
22 -DQT_NO_KEYWORDS
23 )
24
25+# Search for our dependencies
26 include(GNUInstallDirs)
27 find_package(PkgConfig)
28 find_package(Intltool)
29-
30-# We depend on Boost for string trimming
31-find_package(
32- Boost
33- REQUIRED
34-)
35-
36-# Search for our dependencies
37+@if "%ContentType%".substring(0, "network-netcpp-q".length) === "network-netcpp-q"
38+find_package(Qt5Core REQUIRED)
39+@endif
40+
41 pkg_check_modules(
42 SCOPE
43 libunity-scopes>=0.6.0
44@@ -44,19 +40,16 @@
45 REQUIRED
46 )
47
48-@if "%ContentType%".substring(0, "network-netcpp-q".length) === "network-netcpp-q"
49-find_package(Qt5Core REQUIRED)
50-include_directories(${Qt5Core_INCLUDE_DIRS})
51-@endif
52-
53 # Add our dependencies to the include paths
54 include_directories(
55- "${CMAKE_SOURCE_DIR}/include"
56- ${Boost_INCLUDE_DIRS}
57+ "${CMAKE_SOURCE_DIR}/src"
58 ${SCOPE_INCLUDE_DIRS}
59+@if "%ContentType%".substring(0, "network-netcpp-q".length) === "network-netcpp-q"
60+ ${Qt5Core_INCLUDE_DIRS}
61+@endif
62 )
63
64-# Do not remove this line, its required for the correct functionality of the Ubuntu-SDK
65+# Do not remove these 2 lines, they are required for the correct functionality of the Ubuntu-SDK
66 set(UBUNTU_MANIFEST_PATH "manifest.json.in" CACHE INTERNAL "Tells QtCreator location and name of the manifest file")
67 set(UBUNTU_PROJECT_TYPE "Scope" CACHE INTERNAL "Tells QtCreator this is a Scope project")
68
69@@ -68,44 +61,42 @@
70 set(SCOPE_NAME "${PACKAGE_NAME}_%ClickHookName:l%")
71
72 # If we need to refer to the scope's name or package in code, these definitions will help
73-
74 add_definitions(-DPACKAGE_NAME="${PACKAGE_NAME}")
75 add_definitions(-DSCOPE_NAME="${SCOPE_NAME}")
76 add_definitions(-DGETTEXT_PACKAGE="${GETTEXT_PACKAGE}")
77
78-#This command figures out the target architecture and puts it into the manifest file
79+# This command figures out the target architecture and puts it into the manifest file
80 execute_process(
81 COMMAND dpkg-architecture -qDEB_HOST_ARCH
82 OUTPUT_VARIABLE CLICK_ARCH
83 OUTPUT_STRIP_TRAILING_WHITESPACE
84 )
85
86+# Configure and install the click manifest and apparmor files
87 configure_file(manifest.json.in ${CMAKE_CURRENT_BINARY_DIR}/manifest.json)
88-
89-# Install the click manifest
90 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/manifest.json DESTINATION "/")
91 install(FILES "%ClickHookName:l%.apparmor" DESTINATION "/")
92
93 # Make these files show up in QtCreator
94 file(GLOB_RECURSE
95 _PO_FILES
96- "po/*.po"
97+ "po/*.po"
98 )
99 add_custom_target(hidden_files
100 ALL
101 SOURCES
102 manifest.json.in
103 %ClickHookName:l%.apparmor
104- data/${SCOPE_NAME}.ini.in
105+ src/data/%ClickHookName:l%.ini.in
106+ src/data/%ClickHookName:l%-settings.ini.in
107 po/POTFILES.in
108 po/${GETTEXT_PACKAGE}.pot
109 ${_PO_FILES}
110 )
111
112 # Add our main directories
113+add_subdirectory(po)
114 add_subdirectory(src)
115-add_subdirectory(data)
116-add_subdirectory(po)
117
118 # Set up the tests
119 enable_testing()
120
121=== removed directory 'share/qtcreator/templates/wizards/ubuntu/scope/cmake'
122=== removed file 'share/qtcreator/templates/wizards/ubuntu/scope/cmake/FindGMock.cmake'
123--- share/qtcreator/templates/wizards/ubuntu/scope/cmake/FindGMock.cmake 2014-09-03 12:55:33 +0000
124+++ share/qtcreator/templates/wizards/ubuntu/scope/cmake/FindGMock.cmake 1970-01-01 00:00:00 +0000
125@@ -1,12 +0,0 @@
126-# Build with system gmock and embedded gtest
127-set (GMOCK_INCLUDE_DIRS "/usr/include/gmock/include" CACHE PATH "gmock source include directory")
128-set (GMOCK_SOURCE_DIR "/usr/src/gmock" CACHE PATH "gmock source directory")
129-set (GTEST_INCLUDE_DIRS "${GMOCK_SOURCE_DIR}/gtest/include" CACHE PATH "gtest source include directory")
130-
131-add_subdirectory(${GMOCK_SOURCE_DIR} "${CMAKE_CURRENT_BINARY_DIR}/gmock")
132-
133-set(GTEST_LIBRARIES gtest)
134-set(GTEST_MAIN_LIBRARIES gtest_main)
135-set(GMOCK_LIBRARIES gmock gmock_main)
136-
137-set(GTEST_BOTH_LIBRARIES ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES})
138
139=== removed file 'share/qtcreator/templates/wizards/ubuntu/scope/cmake/FindIntltool.cmake'
140--- share/qtcreator/templates/wizards/ubuntu/scope/cmake/FindIntltool.cmake 2015-04-13 09:11:18 +0000
141+++ share/qtcreator/templates/wizards/ubuntu/scope/cmake/FindIntltool.cmake 1970-01-01 00:00:00 +0000
142@@ -1,265 +0,0 @@
143-# Copyright (C) 2014 Canonical Ltd
144-#
145-# This program is free software: you can redistribute it and/or modify
146-# it under the terms of the GNU Lesser General Public License version 3 as
147-# published by the Free Software Foundation.
148-#
149-# This program is distributed in the hope that it will be useful,
150-# but WITHOUT ANY WARRANTY; without even the implied warranty of
151-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
152-# GNU Lesser General Public License for more details.
153-#
154-# You should have received a copy of the GNU Lesser General Public License
155-# along with this program. If not, see <http://www.gnu.org/licenses/>.
156-
157-# This package provides macros that wrap the intltool programs.
158-#
159-# An example of common usage is:
160-#
161-# For an ini file:
162-#
163-# intltool_merge_translations(
164-# "foo.ini.in"
165-# "${CMAKE_CURRENT_BINARY_DIR}/foo.ini"
166-# ALL
167-# UTF8
168-# )
169-#
170-# Inside po/CMakeLists.txt:
171-#
172-# intltool_update_potfile(
173-# ALL
174-# GETTEXT_PACKAGE ${GETTEXT_PACKAGE}
175-# )
176-#
177-# intltool_install_translations(
178-# ALL
179-# GETTEXT_PACKAGE ${GETTEXT_PACKAGE}
180-# )
181-
182-find_package(Gettext REQUIRED)
183-
184-find_program(INTLTOOL_UPDATE_EXECUTABLE intltool-update)
185-
186-if(INTLTOOL_UPDATE_EXECUTABLE)
187- execute_process(
188- COMMAND ${INTLTOOL_UPDATE_EXECUTABLE} --version
189- OUTPUT_VARIABLE intltool_update_version
190- ERROR_QUIET
191- OUTPUT_STRIP_TRAILING_WHITESPACE)
192- if (intltool_update_version MATCHES "^intltool-update \\(.*\\) [0-9]")
193- string(
194- REGEX REPLACE "^intltool-update \\([^\\)]*\\) ([0-9\\.]+[^ \n]*).*" "\\1"
195- INTLTOOL_UPDATE_VERSION_STRING "${intltool_update_version}"
196- )
197- endif()
198- unset(intltool_update_version)
199-endif()
200-
201-find_program(INTLTOOL_MERGE_EXECUTABLE intltool-merge)
202-
203-if(INTLTOOL_MERGE_EXECUTABLE)
204- execute_process(
205- COMMAND ${INTLTOOL_MERGE_EXECUTABLE} --version
206- OUTPUT_VARIABLE intltool_merge_version
207- ERROR_QUIET
208- OUTPUT_STRIP_TRAILING_WHITESPACE)
209- if (intltool_update_version MATCHES "^intltool-merge \\(.*\\) [0-9]")
210- string(
211- REGEX REPLACE "^intltool-merge \\([^\\)]*\\) ([0-9\\.]+[^ \n]*).*" "\\1"
212- INTLTOOL_MERGE_VERSION_STRING "${intltool_merge_version}"
213- )
214- endif()
215- unset(intltool_merge_version)
216-endif()
217-
218-include(FindPackageHandleStandardArgs)
219-
220-find_package_handle_standard_args(
221- Intltool
222- REQUIRED_VARS
223- INTLTOOL_UPDATE_EXECUTABLE
224- INTLTOOL_MERGE_EXECUTABLE
225- VERSION_VAR
226- INTLTOOL_UPDATE_VERSION_STRING
227- HANDLE_COMPONENTS
228-)
229-
230-function(APPEND_EACH LISTNAME GLUE OUTPUT)
231- set(_tmp_list "")
232- foreach(VAL ${${LISTNAME}})
233- list(APPEND _tmp_list "${GLUE}${VAL}")
234- endforeach(VAL ${${LISTNAME}})
235- set(${OUTPUT} "${_tmp_list}" PARENT_SCOPE)
236-endfunction()
237-
238-function(INTLTOOL_UPDATE_POTFILE)
239- set(_options ALL)
240- set(_oneValueArgs GETTEXT_PACKAGE OUTPUT_FILE PO_DIRECTORY)
241-
242- cmake_parse_arguments(_ARG "${_options}" "${_oneValueArgs}" "" ${ARGN})
243-
244- set(_POT_FILE "${PROJECT}.pot")
245-
246- set(_GETTEXT_PACKAGE "")
247- if(_ARG_GETTEXT_PACKAGE)
248- set(_POT_FILE "${_ARG_GETTEXT_PACKAGE}.pot")
249- set(_GETTEXT_PACKAGE --gettext-package="${_ARG_GETTEXT_PACKAGE}")
250- endif()
251-
252- set(_OUTPUT_FILE "")
253- if(_ARG_OUTPUT_FILE)
254- set(_POT_FILE "${_ARG_OUTPUT_FILE}")
255- set(_OUTPUT_FILE --output-file="${_ARG_OUTPUT_FILE}")
256- endif()
257-
258- set(_PO_DIRECTORY "${CMAKE_SOURCE_DIR}/po")
259- if(_ARG_PO_DIRECTORY)
260- set(_PO_DIRECTORY "${_ARG_PO_DIRECTORY}")
261- endif()
262-
263- file(
264- GLOB_RECURSE _CODE_SOURCES
265- ${CMAKE_SOURCE_DIR}/*.cpp
266- ${CMAKE_SOURCE_DIR}/*.cc
267- ${CMAKE_SOURCE_DIR}/*.cxx
268- ${CMAKE_SOURCE_DIR}/*.vala
269- ${CMAKE_SOURCE_DIR}/*.c
270- ${CMAKE_SOURCE_DIR}/*.h
271- ${CMAKE_SOURCE_DIR}/*.ini.in
272- )
273-
274- add_custom_command(
275- OUTPUT
276- "${_PO_DIRECTORY}/${_POT_FILE}"
277- COMMAND ${INTLTOOL_UPDATE_EXECUTABLE} --pot ${_OUTPUT_FILE} ${_GETTEXT_PACKAGE}
278- DEPENDS
279- "${_PO_DIRECTORY}/POTFILES.in"
280- ${_CODE_SOURCES}
281- WORKING_DIRECTORY ${_PO_DIRECTORY}
282- )
283-
284- _GETTEXT_GET_UNIQUE_TARGET_NAME(${_POT_FILE} _UNIQUE_TARGET_NAME)
285-
286- if(_ARG_ALL)
287- add_custom_target(
288- ${_UNIQUE_TARGET_NAME}
289- ALL
290- DEPENDS
291- "${_PO_DIRECTORY}/${_POT_FILE}"
292- )
293- else()
294- add_custom_target(
295- ${_UNIQUE_TARGET_NAME}
296- DEPENDS
297- "${_PO_DIRECTORY}/${_POT_FILE}"
298- )
299- endif()
300-endfunction()
301-
302-function(INTLTOOL_INSTALL_TRANSLATIONS)
303- set(_options ALL)
304- set(_oneValueArgs GETTEXT_PACKAGE POT_FILE)
305-
306- cmake_parse_arguments(_ARG "${_options}" "${_oneValueArgs}" "" ${ARGN})
307-
308- set(_POT_FILE "${PROJECT}.pot")
309-
310- if(_ARG_GETTEXT_PACKAGE)
311- set(_POT_FILE "${_ARG_GETTEXT_PACKAGE}.pot")
312- endif()
313-
314- if(_ARG_OUTPUT_FILE)
315- set(_POT_FILE "${_ARG_OUTPUT_FILE}")
316- endif()
317-
318- file(
319- GLOB _PO_FILES
320- ${CMAKE_CURRENT_SOURCE_DIR}/*.po
321- )
322-
323- get_filename_component(_ABS_POT_FILE ${_POT_FILE} ABSOLUTE)
324-
325- foreach(_PO_FILE ${_PO_FILES})
326- add_custom_command(
327- OUTPUT
328- ${_PO_FILE}
329- COMMAND
330- ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${_PO_FILE} ${_ABS_POT_FILE}
331- DEPENDS
332- ${_ABS_POT_FILE}
333- )
334- endforeach()
335-
336- if(_ARG_ALL)
337- gettext_create_translations(
338- ${_POT_FILE}
339- ALL
340- ${_PO_FILES}
341- )
342- else()
343- gettext_create_translations(
344- ${_POT_FILE}
345- ${_PO_FILES}
346- )
347- endif()
348-endfunction()
349-
350-function(INTLTOOL_MERGE_TRANSLATIONS FILENAME OUTPUT_FILE)
351- set(_options ALL UTF8 PASS_THROUGH)
352- set(_oneValueArgs PO_DIRECTORY)
353-
354- cmake_parse_arguments(_ARG "${_options}" "${_oneValueArgs}" "" ${ARGN})
355-
356- get_filename_component(_ABS_FILENAME ${FILENAME} ABSOLUTE)
357-
358- set(_PO_DIRECTORY "${CMAKE_SOURCE_DIR}/po")
359- if(_ARG_PO_DIRECTORY)
360- set(_PO_DIRECTORY "${_ARG_PO_DIRECTORY}")
361- endif()
362-
363- set(_UTF8 "")
364- if(_ARG_UTF8)
365- set(_UTF8 "--utf8")
366- endif()
367-
368- set(_PASS_THROUGH "")
369- if(_ARG_PASS_THROUGH)
370- set(_PASS_THROUGH "--pass-through")
371- endif()
372-
373- file(
374- GLOB_RECURSE _PO_FILES
375- ${_PO_DIRECTORY}/*.po
376- )
377-
378- add_custom_command(
379- OUTPUT
380- ${OUTPUT_FILE}
381- COMMAND
382- ${INTLTOOL_MERGE_EXECUTABLE} --desktop-style --quiet ${_UTF8} ${_PASS_THROUGH} ${_PO_DIRECTORY} ${FILENAME} ${OUTPUT_FILE}
383- DEPENDS
384- ${_ABS_FILENAME}
385- ${_PO_FILES}
386- WORKING_DIRECTORY
387- ${CMAKE_CURRENT_SOURCE_DIR}
388- )
389-
390- get_filename_component(_OUTPUT_NAME ${OUTPUT_FILE} NAME)
391- _GETTEXT_GET_UNIQUE_TARGET_NAME(${_OUTPUT_NAME} _UNIQUE_TARGET_NAME)
392-
393- if(_ARG_ALL)
394- add_custom_target(
395- ${_UNIQUE_TARGET_NAME}
396- ALL
397- DEPENDS
398- ${OUTPUT_FILE}
399- )
400- else()
401- add_custom_target(
402- ${_UNIQUE_TARGET_NAME}
403- DEPENDS
404- ${OUTPUT_FILE}
405- )
406- endif()
407-endfunction()
408
409=== removed directory 'share/qtcreator/templates/wizards/ubuntu/scope/data'
410=== removed file 'share/qtcreator/templates/wizards/ubuntu/scope/data/CMakeLists.txt'
411--- share/qtcreator/templates/wizards/ubuntu/scope/data/CMakeLists.txt 2014-11-21 14:45:30 +0000
412+++ share/qtcreator/templates/wizards/ubuntu/scope/data/CMakeLists.txt 1970-01-01 00:00:00 +0000
413@@ -1,10 +0,0 @@
414-
415-# Install the scope images
416-install(
417- FILES
418- "icon.png"
419- "logo.png"
420- "screenshot.png"
421- DESTINATION
422- "${SCOPE_INSTALL_DIR}"
423-)
424
425=== removed directory 'share/qtcreator/templates/wizards/ubuntu/scope/include'
426=== removed directory 'share/qtcreator/templates/wizards/ubuntu/scope/include/api'
427=== removed file 'share/qtcreator/templates/wizards/ubuntu/scope/include/api/config.h'
428--- share/qtcreator/templates/wizards/ubuntu/scope/include/api/config.h 2014-10-27 16:24:10 +0000
429+++ share/qtcreator/templates/wizards/ubuntu/scope/include/api/config.h 1970-01-01 00:00:00 +0000
430@@ -1,27 +0,0 @@
431-#ifndef API_CONFIG_H_
432-#define API_CONFIG_H_
433-
434-#include <memory>
435-#include <string>
436-
437-namespace api {
438-
439-struct Config {
440- typedef std::shared_ptr<Config> Ptr;
441-
442-@if "%ContentType%".substring(0, "network".length) === "network"
443- /*
444- * The root of all API request URLs
445- */
446- std::string apiroot { "http://api.openweathermap.org" };
447-
448- /*
449- * The custom HTTP user agent string for this library
450- */
451- std::string user_agent { "example-network-scope 0.1; (foo)" };
452-@endif
453-};
454-
455-}
456-
457-#endif /* API_CONFIG_H_ */
458
459=== removed directory 'share/qtcreator/templates/wizards/ubuntu/scope/include/scope'
460=== modified file 'share/qtcreator/templates/wizards/ubuntu/scope/po/POTFILES.in'
461--- share/qtcreator/templates/wizards/ubuntu/scope/po/POTFILES.in 2015-01-07 10:50:28 +0000
462+++ share/qtcreator/templates/wizards/ubuntu/scope/po/POTFILES.in 2015-05-19 10:38:08 +0000
463@@ -1,11 +1,11 @@
464-[type: gettext/ini] data/%ProjectName:l%.%ClickDomain:l%_%ClickHookName:l%.ini.in
465-include/api/config.h
466-include/api/client.h
467-include/scope/preview.h
468-include/scope/localization.h
469-include/scope/query.h
470-include/scope/scope.h
471-src/api/client.cpp
472-src/scope/query.cpp
473-src/scope/scope.cpp
474-src/scope/preview.cpp
475+[type: gettext/ini] src/data/%ClickHookName:l%.ini.in
476+[type: gettext/ini] src/data/%ClickHookName:l%-settings.ini.in
477+src/client.cpp
478+src/client.h
479+src/localization.h
480+src/preview.cpp
481+src/preview.h
482+src/query.cpp
483+src/query.h
484+src/scope.cpp
485+src/scope.h
486
487=== modified file 'share/qtcreator/templates/wizards/ubuntu/scope/src/CMakeLists.txt'
488--- share/qtcreator/templates/wizards/ubuntu/scope/src/CMakeLists.txt 2014-11-21 14:45:30 +0000
489+++ share/qtcreator/templates/wizards/ubuntu/scope/src/CMakeLists.txt 2015-05-19 10:38:08 +0000
490@@ -1,66 +1,64 @@
491
492-# Put the ini file in the build directory next to the scope
493-# .so file so test tools can find both easily.
494+# Put the ini files in the build directory next to the scope
495+# .so file so that the test tools can find them.
496 intltool_merge_translations(
497- "${CMAKE_SOURCE_DIR}/data/${SCOPE_NAME}.ini.in"
498+ "data/%ClickHookName:l%.ini.in"
499 "${CMAKE_CURRENT_BINARY_DIR}/${SCOPE_NAME}.ini"
500 ALL
501 UTF8
502 )
503+intltool_merge_translations(
504+ "data/%ClickHookName:l%-settings.ini.in"
505+ "${CMAKE_CURRENT_BINARY_DIR}/${SCOPE_NAME}-settings.ini"
506+ ALL
507+ UTF8
508+)
509
510-# Install the scope ini file
511+# Install the scope ini files
512 install(
513- FILES "${CMAKE_CURRENT_BINARY_DIR}/${SCOPE_NAME}.ini"
514- DESTINATION ${SCOPE_INSTALL_DIR}
515+ FILES
516+ "${CMAKE_CURRENT_BINARY_DIR}/${SCOPE_NAME}.ini"
517+ "${CMAKE_CURRENT_BINARY_DIR}/${SCOPE_NAME}-settings.ini"
518+ DESTINATION
519+ ${SCOPE_INSTALL_DIR}
520 )
521
522+# Put the logo file in the build directory next to the scope
523+# .ini file so that the test tools can find it.
524 configure_file(
525- "${CMAKE_SOURCE_DIR}/data/logo.png"
526+ "data/logo.png"
527 "${CMAKE_CURRENT_BINARY_DIR}/logo.png"
528 @ONLY
529 COPYONLY
530 )
531
532-# The sources to build the scope
533-set(SCOPE_SOURCES
534- api/client.cpp
535- scope/preview.cpp
536- scope/query.cpp
537- scope/scope.cpp
538+# Install the scope images
539+install(
540+ FILES
541+ "data/icon.png"
542+ "data/logo.png"
543+ "data/screenshot.png"
544+ DESTINATION
545+ ${SCOPE_INSTALL_DIR}
546 )
547
548-# Find all the headers
549+# Find all the sources
550 file(GLOB_RECURSE
551- SCOPE_HEADERS
552- "${CMAKE_SOURCE_DIR}/include/*.h"
553-)
554-
555-# Build an object library for the scope code
556-add_library(
557- scope-static OBJECT
558- ${SCOPE_SOURCES}
559- ${SCOPE_HEADERS}
560-)
561-
562-# Ensure we export all the symbols
563-set_target_properties(
564- scope-static
565- PROPERTIES
566- LINK_FLAGS "-Wl,--export-all-symbols"
567+ SCOPE_SOURCES
568+ "*.cpp"
569+ "*.h"
570 )
571
572 # Build a shared library containing our scope code.
573-# This will be the actual plugin that is loaded.
574 add_library(
575 scope SHARED
576- $<TARGET_OBJECTS:scope-static>
577+ ${SCOPE_SOURCES}
578 )
579
580 # Link against the object library and our external library dependencies
581 target_link_libraries(
582 scope
583 ${SCOPE_LDFLAGS}
584- ${Boost_LIBRARIES}
585 )
586
587 @if "%ContentType%".substring(0, "network-netcpp-q".length) === "network-netcpp-q"
588
589=== removed directory 'share/qtcreator/templates/wizards/ubuntu/scope/src/api'
590=== renamed file 'share/qtcreator/templates/wizards/ubuntu/scope/src/api/client.cpp' => 'share/qtcreator/templates/wizards/ubuntu/scope/src/client.cpp'
591--- share/qtcreator/templates/wizards/ubuntu/scope/src/api/client.cpp 2014-12-15 10:12:40 +0000
592+++ share/qtcreator/templates/wizards/ubuntu/scope/src/client.cpp 2015-05-19 10:38:08 +0000
593@@ -1,4 +1,4 @@
594-#include <api/client.h>
595+#include <client.h>
596
597 @if "%ContentType%".substring(0, "network-netcpp".length) === "network-netcpp"
598 #include <core/net/error.h>
599@@ -18,7 +18,6 @@
600 @endif
601 @endif
602
603-using namespace api;
604 using namespace std;
605
606 Client::Client(Config::Ptr config) :
607@@ -495,6 +494,6 @@
608 cancelled_ = true;
609 }
610
611-Config::Ptr Client::config() {
612+Client::Config::Ptr Client::config() {
613 return config_;
614 }
615
616=== renamed file 'share/qtcreator/templates/wizards/ubuntu/scope/include/api/client.h' => 'share/qtcreator/templates/wizards/ubuntu/scope/src/client.h'
617--- share/qtcreator/templates/wizards/ubuntu/scope/include/api/client.h 2014-10-29 15:28:52 +0000
618+++ share/qtcreator/templates/wizards/ubuntu/scope/src/client.h 2015-05-19 10:38:08 +0000
619@@ -1,11 +1,10 @@
620-#ifndef API_CLIENT_H_
621-#define API_CLIENT_H_
622-
623-#include <api/config.h>
624+#ifndef CLIENT_H_
625+#define CLIENT_H_
626
627 #include <atomic>
628 #include <deque>
629 #include <map>
630+#include <memory>
631 #include <string>
632 @if "%ContentType%".substring(0, "network".length) === "network"
633 #include <core/net/http/request.h>
634@@ -22,8 +21,6 @@
635 @endif
636 @endif
637
638-namespace api {
639-
640 /**
641 * Provide a nice way to access the HTTP API.
642 *
643@@ -32,6 +29,19 @@
644 class Client {
645 public:
646
647+ /**
648+ * Client configuration
649+ */
650+ struct Config {
651+ typedef std::shared_ptr<Config> Ptr;
652+
653+ // The root of all API request URLs
654+ std::string apiroot { "http://api.openweathermap.org" };
655+
656+ // The custom HTTP user agent string for this library
657+ std::string user_agent { "example-network-scope 0.1; (foo)" };
658+ };
659+
660 @if "%ContentType%" == "empty"
661 /**
662 * Result struct
663@@ -163,6 +173,4 @@
664 std::atomic<bool> cancelled_;
665 };
666
667-}
668-
669-#endif // API_CLIENT_H_
670+#endif // CLIENT_H_
671
672=== added directory 'share/qtcreator/templates/wizards/ubuntu/scope/src/data'
673=== added file 'share/qtcreator/templates/wizards/ubuntu/scope/src/data/displayName-settings.ini.in'
674--- share/qtcreator/templates/wizards/ubuntu/scope/src/data/displayName-settings.ini.in 1970-01-01 00:00:00 +0000
675+++ share/qtcreator/templates/wizards/ubuntu/scope/src/data/displayName-settings.ini.in 2015-05-19 10:38:08 +0000
676@@ -0,0 +1,21 @@
677+@if "%ContentType%".substring(0, "network".length) === "network"
678+# Below are some example settings. You can access your scope's
679+# settings by calling settings() from the Query::run() method.
680+# E.g. auto location = settings().at("location").get_string();
681+
682+#[location]
683+#type = string
684+#defaultValue = London,uk
685+#_displayName = Default Location
686+
687+#[units]
688+#type = list
689+#_displayName = Temperature Units
690+#_displayValues = Metric;Imperial
691+#defaultValue = 0
692+
693+#[forecast]
694+#type = boolean
695+#defaultValue = true
696+#_displayName = Show Forecast
697+@endif
698
699=== renamed file 'share/qtcreator/templates/wizards/ubuntu/scope/data/displayName.ini.in' => 'share/qtcreator/templates/wizards/ubuntu/scope/src/data/displayName.ini.in'
700--- share/qtcreator/templates/wizards/ubuntu/scope/data/displayName.ini.in 2014-11-21 14:45:30 +0000
701+++ share/qtcreator/templates/wizards/ubuntu/scope/src/data/displayName.ini.in 2015-05-19 10:38:08 +0000
702@@ -4,6 +4,7 @@
703 Art=screenshot.png
704 Author=Firstname Lastname
705 Icon=icon.png
706+Keywords=weather
707
708 [Appearance]
709 PageHeader.Logo=logo.png
710
711=== renamed file 'share/qtcreator/templates/wizards/ubuntu/scope/data/icon.png' => 'share/qtcreator/templates/wizards/ubuntu/scope/src/data/icon.png'
712=== renamed file 'share/qtcreator/templates/wizards/ubuntu/scope/data/logo.png' => 'share/qtcreator/templates/wizards/ubuntu/scope/src/data/logo.png'
713=== renamed file 'share/qtcreator/templates/wizards/ubuntu/scope/data/screenshot.png' => 'share/qtcreator/templates/wizards/ubuntu/scope/src/data/screenshot.png'
714=== renamed file 'share/qtcreator/templates/wizards/ubuntu/scope/include/scope/localization.h' => 'share/qtcreator/templates/wizards/ubuntu/scope/src/localization.h'
715--- share/qtcreator/templates/wizards/ubuntu/scope/include/scope/localization.h 2014-10-13 13:33:36 +0000
716+++ share/qtcreator/templates/wizards/ubuntu/scope/src/localization.h 2015-05-19 10:38:08 +0000
717@@ -1,5 +1,5 @@
718-#ifndef SCOPE_LOCALIZATION_H_
719-#define SCOPE_LOCALIZATION_H_
720+#ifndef LOCALIZATION_H_
721+#define LOCALIZATION_H_
722
723 #include <libintl.h>
724 #include <string>
725@@ -18,5 +18,5 @@
726 }
727 }
728
729-#endif // SCOPE_LOCALIZATION_H_
730+#endif // LOCALIZATION_H_
731
732
733=== renamed file 'share/qtcreator/templates/wizards/ubuntu/scope/src/scope/preview.cpp' => 'share/qtcreator/templates/wizards/ubuntu/scope/src/preview.cpp'
734--- share/qtcreator/templates/wizards/ubuntu/scope/src/scope/preview.cpp 2014-12-15 10:12:40 +0000
735+++ share/qtcreator/templates/wizards/ubuntu/scope/src/preview.cpp 2015-05-19 10:38:08 +0000
736@@ -1,4 +1,4 @@
737-#include <scope/preview.h>
738+#include <preview.h>
739
740 #include <unity/scopes/ColumnLayout.h>
741 #include <unity/scopes/PreviewWidget.h>
742@@ -11,10 +11,9 @@
743 namespace sc = unity::scopes;
744
745 using namespace std;
746-using namespace scope;
747
748 Preview::Preview(const sc::Result &result, const sc::ActionMetadata &metadata) :
749- sc::PreviewQueryBase(result, metadata) {
750+ sc::PreviewQueryBase(result, metadata) {
751 }
752
753 void Preview::cancelled() {
754@@ -32,36 +31,36 @@
755 // However, we recommend that scopes define layouts for the best visual appearance.
756
757 // Single column layout
758- layout1col.add_column( { "image", "header", "summary" });
759+ layout1col.add_column( { "image_widget", "header_widget", "summary_widget" } );
760
761 // Two column layout
762- layout2col.add_column( { "image" });
763- layout2col.add_column( { "header", "summary" });
764+ layout2col.add_column( { "image_widget" } );
765+ layout2col.add_column( { "header_widget", "summary_widget" } );
766
767 // Three cokumn layout
768- layout3col.add_column( { "image" });
769- layout3col.add_column( { "header", "summary" });
770- layout3col.add_column( { });
771+ layout3col.add_column( { "image_widget" });
772+ layout3col.add_column( { "header_widget", "summary_widget" } );
773+ layout3col.add_column( { } );
774
775 // Register the layouts we just created
776- reply->register_layout( { layout1col, layout2col, layout3col });
777+ reply->register_layout( { layout1col, layout2col, layout3col } );
778+
779+ // Define the image section
780+ sc::PreviewWidget image("image_widget", "image");
781+ // It has a single "source" property, mapped to the result's "art" property
782+ image.add_attribute_mapping("source", "art");
783
784 // Define the header section
785- sc::PreviewWidget header("header", "header");
786- // It has title and a subtitle properties
787+ sc::PreviewWidget header("header_widget", "header");
788+ // It has a "title" and a "subtitle" property
789 header.add_attribute_mapping("title", "title");
790 header.add_attribute_mapping("subtitle", "subtitle");
791
792- // Define the image section
793- sc::PreviewWidget image("image", "image");
794- // It has a single source property, mapped to the result's art property
795- image.add_attribute_mapping("source", "art");
796-
797 // Define the summary section
798- sc::PreviewWidget description("summary", "text");
799- // It has a text property, mapped to the result's description property
800- description.add_attribute_mapping("text", "description");
801+ sc::PreviewWidget summary("summary_widget", "text");
802+ // It has a "text" property, mapped to the result's "description" property
803+ summary.add_attribute_mapping("text", "description");
804
805 // Push each of the sections
806- reply->push( { image, header, description });
807+ reply->push( { image, header, summary } );
808 }
809
810=== renamed file 'share/qtcreator/templates/wizards/ubuntu/scope/include/scope/preview.h' => 'share/qtcreator/templates/wizards/ubuntu/scope/src/preview.h'
811--- share/qtcreator/templates/wizards/ubuntu/scope/include/scope/preview.h 2014-09-03 14:56:27 +0000
812+++ share/qtcreator/templates/wizards/ubuntu/scope/src/preview.h 2015-05-19 10:38:08 +0000
813@@ -1,5 +1,5 @@
814-#ifndef SCOPE_PREVIEW_H_
815-#define SCOPE_PREVIEW_H_
816+#ifndef PREVIEW_H_
817+#define PREVIEW_H_
818
819 #include <unity/scopes/PreviewQueryBase.h>
820
821@@ -9,8 +9,6 @@
822 }
823 }
824
825-namespace scope {
826-
827 /**
828 * Represents an individual preview request.
829 *
830@@ -32,6 +30,4 @@
831 void run(unity::scopes::PreviewReplyProxy const& reply) override;
832 };
833
834-}
835-
836-#endif // SCOPE_PREVIEW_H_
837+#endif // PREVIEW_H_
838
839=== renamed file 'share/qtcreator/templates/wizards/ubuntu/scope/src/scope/query.cpp' => 'share/qtcreator/templates/wizards/ubuntu/scope/src/query.cpp'
840--- share/qtcreator/templates/wizards/ubuntu/scope/src/scope/query.cpp 2014-12-15 10:12:40 +0000
841+++ share/qtcreator/templates/wizards/ubuntu/scope/src/query.cpp 2015-05-19 10:38:08 +0000
842@@ -1,7 +1,5 @@
843-#include <boost/algorithm/string/trim.hpp>
844-
845-#include <scope/localization.h>
846-#include <scope/query.h>
847+#include <query.h>
848+#include <localization.h>
849
850 #include <unity/scopes/Annotation.h>
851 #include <unity/scopes/CategorisedResult.h>
852@@ -10,18 +8,16 @@
853 #include <unity/scopes/SearchReply.h>
854
855 #include <iomanip>
856+#include <iostream>
857 #include <sstream>
858
859 namespace sc = unity::scopes;
860-namespace alg = boost::algorithm;
861
862 using namespace std;
863-using namespace api;
864-using namespace scope;
865
866 @if "%ContentType%" == "empty"
867 /**
868- * Define the layout for theresults
869+ * Define the layout for the results.
870 *
871 * The icon size is medium, and ask for the card layout
872 * itself to be horizontal. I.e. the text will be placed
873@@ -49,13 +45,36 @@
874
875 @if "%ContentType%".substring(0, "network".length) === "network"
876 /**
877- * Define the layout for the forecast results
878+ * Define the larger "current weather" layout.
879+ *
880+ * The icons are larger.
881+ */
882+const static string CURRENT_TEMPLATE =
883+ R"(
884+{
885+ "schema-version": 1,
886+ "template": {
887+ "category-layout": "grid",
888+ "card-size": "medium"
889+ },
890+ "components": {
891+ "title": "title",
892+ "art" : {
893+ "field": "art"
894+ },
895+ "subtitle": "subtitle"
896+ }
897+}
898+)";
899+
900+/**
901+ * Define the layout for the forecast results.
902 *
903 * The icon size is small, and ask for the card layout
904 * itself to be horizontal. I.e. the text will be placed
905 * next to the image.
906 */
907-const static string WEATHER_TEMPLATE =
908+const static string FORECAST_TEMPLATE =
909 R"(
910 {
911 "schema-version": 1,
912@@ -73,33 +92,10 @@
913 }
914 }
915 )";
916-
917-/**
918- * Define the larger "current weather" layout.
919- *
920- * The icons are larger.
921- */
922-const static string CITY_TEMPLATE =
923- R"(
924-{
925- "schema-version": 1,
926- "template": {
927- "category-layout": "grid",
928- "card-size": "medium"
929- },
930- "components": {
931- "title": "title",
932- "art" : {
933- "field": "art"
934- },
935- "subtitle": "subtitle"
936- }
937-}
938-)";
939 @endif
940
941 Query::Query(const sc::CannedQuery &query, const sc::SearchMetadata &metadata,
942- Config::Ptr config) :
943+ Client::Config::Ptr config) :
944 sc::SearchQueryBase(query, metadata), client_(config) {
945 }
946
947@@ -113,8 +109,8 @@
948 // Start by getting information about the query
949 const sc::CannedQuery &query(sc::SearchQueryBase::query());
950
951- // Trim the query string of whitespace
952- string query_string = alg::trim_copy(query.query_string());
953+ // Get the query string
954+ string query_string = query.query_string();
955
956 // the Client is the helper class that provides the results
957 // without mixing APIs and scopes code.
958@@ -168,8 +164,10 @@
959 // Start by getting information about the query
960 const sc::CannedQuery &query(sc::SearchQueryBase::query());
961
962- // Trim the query string of whitespace
963- string query_string = alg::trim_copy(query.query_string());
964+ // Get the query string
965+ string query_string = query.query_string();
966+
967+ /// Populate current weather category
968
969 // the Client is the helper class that provides the results
970 // without mixing APIs and scopes code.
971@@ -190,7 +188,7 @@
972
973 // Register a category for the current weather, with the title we just built
974 auto location_cat = reply->register_category("current", ss.str(), "",
975- sc::CategoryRenderer(CITY_TEMPLATE));
976+ sc::CategoryRenderer(CURRENT_TEMPLATE));
977
978 {
979 // Create a single result for the current weather category
980@@ -218,6 +216,8 @@
981 }
982 }
983
984+ /// Populate weather forecast category
985+
986 Client::Forecast forecast;
987 if (query_string.empty()) {
988 // If there is no search string, get the forecast for London
989@@ -228,8 +228,8 @@
990 }
991
992 // Register a category for the forecast
993- auto forecast_cat = reply->register_category("forecast",
994- _("7 day forecast"), "", sc::CategoryRenderer(WEATHER_TEMPLATE));
995+ auto forecast_cat = reply->register_category("forecast", _("7 day forecast"), "",
996+ sc::CategoryRenderer(FORECAST_TEMPLATE));
997
998 // For each of the forecast days
999 for (const auto &weather : forecast.weather) {
1000
1001=== renamed file 'share/qtcreator/templates/wizards/ubuntu/scope/include/scope/query.h' => 'share/qtcreator/templates/wizards/ubuntu/scope/src/query.h'
1002--- share/qtcreator/templates/wizards/ubuntu/scope/include/scope/query.h 2014-09-03 14:56:27 +0000
1003+++ share/qtcreator/templates/wizards/ubuntu/scope/src/query.h 2015-05-19 10:38:08 +0000
1004@@ -1,13 +1,11 @@
1005-#ifndef SCOPE_QUERY_H_
1006-#define SCOPE_QUERY_H_
1007+#ifndef QUERY_H_
1008+#define QUERY_H_
1009
1010-#include <api/client.h>
1011+#include <client.h>
1012
1013 #include <unity/scopes/SearchQueryBase.h>
1014 #include <unity/scopes/ReplyProxyFwd.h>
1015
1016-namespace scope {
1017-
1018 /**
1019 * Represents an individual query.
1020 *
1021@@ -18,7 +16,7 @@
1022 class Query: public unity::scopes::SearchQueryBase {
1023 public:
1024 Query(const unity::scopes::CannedQuery &query,
1025- const unity::scopes::SearchMetadata &metadata, api::Config::Ptr config);
1026+ const unity::scopes::SearchMetadata &metadata, Client::Config::Ptr config);
1027
1028 ~Query() = default;
1029
1030@@ -27,10 +25,8 @@
1031 void run(const unity::scopes::SearchReplyProxy &reply) override;
1032
1033 private:
1034- api::Client client_;
1035+ Client client_;
1036 };
1037
1038-}
1039-
1040-#endif // SCOPE_QUERY_H_
1041+#endif // QUERY_H_
1042
1043
1044=== removed directory 'share/qtcreator/templates/wizards/ubuntu/scope/src/scope'
1045=== renamed file 'share/qtcreator/templates/wizards/ubuntu/scope/src/scope/scope.cpp' => 'share/qtcreator/templates/wizards/ubuntu/scope/src/scope.cpp'
1046--- share/qtcreator/templates/wizards/ubuntu/scope/src/scope/scope.cpp 2014-10-27 16:24:10 +0000
1047+++ share/qtcreator/templates/wizards/ubuntu/scope/src/scope.cpp 2015-05-19 10:38:08 +0000
1048@@ -1,7 +1,7 @@
1049-#include <scope/localization.h>
1050-#include <scope/preview.h>
1051-#include <scope/query.h>
1052-#include <scope/scope.h>
1053+#include <preview.h>
1054+#include <query.h>
1055+#include <scope.h>
1056+#include <localization.h>
1057
1058 #include <iostream>
1059 #include <sstream>
1060@@ -9,11 +9,9 @@
1061
1062 namespace sc = unity::scopes;
1063 using namespace std;
1064-using namespace api;
1065-using namespace scope;
1066
1067 void Scope::start(string const&) {
1068- config_ = make_shared<Config>();
1069+ config_ = make_shared<Client::Config>();
1070
1071 setlocale(LC_ALL, "");
1072 string translation_directory = ScopeBase::scope_directory()
1073
1074=== renamed file 'share/qtcreator/templates/wizards/ubuntu/scope/include/scope/scope.h' => 'share/qtcreator/templates/wizards/ubuntu/scope/src/scope.h'
1075--- share/qtcreator/templates/wizards/ubuntu/scope/include/scope/scope.h 2014-09-03 14:56:27 +0000
1076+++ share/qtcreator/templates/wizards/ubuntu/scope/src/scope.h 2015-05-19 10:38:08 +0000
1077@@ -1,7 +1,7 @@
1078-#ifndef SCOPE_SCOPE_H_
1079-#define SCOPE_SCOPE_H_
1080+#ifndef SCOPE_H_
1081+#define SCOPE_H_
1082
1083-#include <api/config.h>
1084+#include <client.h>
1085
1086 #include <unity/scopes/ScopeBase.h>
1087 #include <unity/scopes/QueryBase.h>
1088@@ -9,8 +9,6 @@
1089 #include <unity/scopes/QueryBase.h>
1090 #include <unity/scopes/PreviewQueryBase.h>
1091
1092-namespace scope {
1093-
1094 /**
1095 * Defines the lifecycle of scope plugin, and acts as a factory
1096 * for Query and Preview objects.
1097@@ -45,9 +43,7 @@
1098 unity::scopes::SearchMetadata const&) override;
1099
1100 protected:
1101- api::Config::Ptr config_;
1102+ Client::Config::Ptr config_;
1103 };
1104
1105-}
1106-
1107-#endif // SCOPE_SCOPE_H_
1108+#endif // SCOPE_H_
1109
1110=== modified file 'share/qtcreator/templates/wizards/ubuntu/scope/tests/CMakeLists.txt'
1111--- share/qtcreator/templates/wizards/ubuntu/scope/tests/CMakeLists.txt 2014-10-27 16:24:10 +0000
1112+++ share/qtcreator/templates/wizards/ubuntu/scope/tests/CMakeLists.txt 2015-05-19 10:38:08 +0000
1113@@ -19,14 +19,22 @@
1114 )
1115
1116 # Where to find the scope ini file and .so
1117-add_definitions(
1118- -DTEST_SCOPE_DIRECTORY="${CMAKE_BINARY_DIR}/src"
1119-)
1120+set(TEST_SCOPE_DIRECTORY "${CMAKE_BINARY_DIR}/src")
1121
1122-@if "%ContentType%".substring(0, "network".length) === "network"
1123 file(GLOB_RECURSE
1124 TEST_FIXTURES
1125- "server/*"
1126+@if "%ContentType%" == "empty"
1127+ "unit/*.py"
1128+@elsif "%ContentType%" == "network-netcpp-json"
1129+ "server/*.json"
1130+ "*.py"
1131+@elsif "%ContentType%" == "network-netcpp-qjson"
1132+ "server/*.json"
1133+ "*.py"
1134+@elsif "%ContentType%" == "network-netcpp-qxml"
1135+ "server/*.xml"
1136+ "*.py"
1137+@endif
1138 )
1139
1140 # Make this file show up in QtCreator
1141@@ -34,10 +42,9 @@
1142 SOURCES ${TEST_FIXTURES}
1143 )
1144
1145+@if "%ContentType%".substring(0, "network".length) === "network"
1146 # Where to find the test server binary
1147-add_definitions(
1148- -DFAKE_SERVER="${CMAKE_CURRENT_SOURCE_DIR}/server/server.py"
1149-)
1150+set(FAKE_SERVER "${CMAKE_CURRENT_SOURCE_DIR}/server/server.py")
1151 @endif
1152
1153 # Add the unit tests
1154
1155=== renamed file 'share/qtcreator/templates/wizards/ubuntu/scope/tests/server/forecast/daily/London,uk.json' => 'share/qtcreator/templates/wizards/ubuntu/scope/tests/server/forecast/London,uk.json'
1156=== renamed file 'share/qtcreator/templates/wizards/ubuntu/scope/tests/server/forecast/daily/London,uk.xml' => 'share/qtcreator/templates/wizards/ubuntu/scope/tests/server/forecast/London,uk.xml'
1157=== renamed file 'share/qtcreator/templates/wizards/ubuntu/scope/tests/server/forecast/daily/Manchester,uk.json' => 'share/qtcreator/templates/wizards/ubuntu/scope/tests/server/forecast/Manchester,uk.json'
1158=== renamed file 'share/qtcreator/templates/wizards/ubuntu/scope/tests/server/forecast/daily/Manchester,uk.xml' => 'share/qtcreator/templates/wizards/ubuntu/scope/tests/server/forecast/Manchester,uk.xml'
1159=== removed directory 'share/qtcreator/templates/wizards/ubuntu/scope/tests/server/forecast/daily'
1160=== modified file 'share/qtcreator/templates/wizards/ubuntu/scope/tests/server/server.py'
1161--- share/qtcreator/templates/wizards/ubuntu/scope/tests/server/server.py 2014-10-29 16:46:30 +0000
1162+++ share/qtcreator/templates/wizards/ubuntu/scope/tests/server/server.py 2015-05-19 10:38:08 +0000
1163@@ -44,7 +44,7 @@
1164 if 'mode' in query:
1165 mode = query['mode'][0]
1166
1167- self.wfile.write(bytes(read_file('forecast/daily/%s.%s' % (query['q'][0], mode)), 'UTF-8'))
1168+ self.wfile.write(bytes(read_file('forecast/%s.%s' % (query['q'][0], mode)), 'UTF-8'))
1169 else:
1170 self.send_response(404)
1171 self.send_header("Content-type", "text/html")
1172
1173=== modified file 'share/qtcreator/templates/wizards/ubuntu/scope/tests/unit/CMakeLists.txt'
1174--- share/qtcreator/templates/wizards/ubuntu/scope/tests/unit/CMakeLists.txt 2014-10-29 15:28:52 +0000
1175+++ share/qtcreator/templates/wizards/ubuntu/scope/tests/unit/CMakeLists.txt 2015-05-19 10:38:08 +0000
1176@@ -1,31 +1,13 @@
1177
1178-# Our test executable.
1179-# It includes the object code from the scope
1180-add_executable(
1181- scope-unit-tests
1182- scope/test-scope.cpp
1183- $<TARGET_OBJECTS:scope-static>
1184-)
1185-
1186-# Link against the scope, and all of our test lib dependencies
1187-target_link_libraries(
1188- scope-unit-tests
1189- ${GTEST_BOTH_LIBRARIES}
1190- ${GMOCK_LIBRARIES}
1191- ${SCOPE_LDFLAGS}
1192- ${TEST_LDFLAGS}
1193- ${Boost_LIBRARIES}
1194-)
1195-
1196-@if "%ContentType%".substring(0, "network-netcpp-q".length) === "network-netcpp-q"
1197-qt5_use_modules(
1198- scope-unit-tests
1199- Core
1200-)
1201-@endif
1202+# This command ensures that test-scope.py has execute permission
1203+execute_process(COMMAND chmod +x "${CMAKE_CURRENT_SOURCE_DIR}/test-scope.py")
1204
1205 # Register the test with CTest
1206 add_test(
1207 scope-unit-tests
1208- scope-unit-tests
1209+@if "%ContentType%" == "empty"
1210+ "${CMAKE_CURRENT_SOURCE_DIR}/test-scope.py" "${SCOPE_NAME}" "${TEST_SCOPE_DIRECTORY}/${SCOPE_NAME}.ini"
1211+@elsif "%ContentType%".substring(0, "network".length) === "network"
1212+ "${CMAKE_CURRENT_SOURCE_DIR}/test-scope.py" "${SCOPE_NAME}" "${TEST_SCOPE_DIRECTORY}/${SCOPE_NAME}.ini" "${FAKE_SERVER}"
1213+@endif
1214 )
1215
1216=== removed directory 'share/qtcreator/templates/wizards/ubuntu/scope/tests/unit/scope'
1217=== removed file 'share/qtcreator/templates/wizards/ubuntu/scope/tests/unit/scope/test-scope.cpp'
1218--- share/qtcreator/templates/wizards/ubuntu/scope/tests/unit/scope/test-scope.cpp 2014-10-27 16:24:10 +0000
1219+++ share/qtcreator/templates/wizards/ubuntu/scope/tests/unit/scope/test-scope.cpp 1970-01-01 00:00:00 +0000
1220@@ -1,232 +0,0 @@
1221-#include <scope/scope.h>
1222-
1223-#include <core/posix/exec.h>
1224-#include <gtest/gtest.h>
1225-#include <gmock/gmock.h>
1226-#include <string>
1227-#include <unity/scopes/SearchReply.h>
1228-#include <unity/scopes/SearchReplyProxyFwd.h>
1229-#include <unity/scopes/Variant.h>
1230-#include <unity/scopes/testing/Category.h>
1231-#include <unity/scopes/testing/MockSearchReply.h>
1232-#include <unity/scopes/testing/TypedScopeFixture.h>
1233-
1234-using namespace std;
1235-using namespace testing;
1236-using namespace scope;
1237-
1238-namespace posix = core::posix;
1239-namespace sc = unity::scopes;
1240-namespace sct = unity::scopes::testing;
1241-
1242-/**
1243- * Keep the tests in an anonymous namespace
1244- */
1245-namespace {
1246-
1247-/**
1248- * Custom matcher to check the properties of search results
1249- */
1250-MATCHER_P2(ResultProp, prop, value, "") {
1251- if (arg.contains(prop)) {
1252- *result_listener << "result[" << prop << "] is " << arg[prop].serialize_json();
1253- } else {
1254- *result_listener << "result[" << prop << "] is not set";
1255- }
1256- return arg.contains(prop) && arg[prop] == sc::Variant(value);
1257-}
1258-
1259-/**
1260- * Custom matcher to check the presence of departments
1261- */
1262-MATCHER_P(IsDepartment, department, "") {
1263- return arg->serialize() == department->serialize();
1264-}
1265-
1266-typedef sct::TypedScopeFixture<Scope> TypedScopeFixtureScope;
1267-
1268-class TestScope: public TypedScopeFixtureScope {
1269-protected:
1270-@if "%ContentType%".substring(0, "network".length) === "network"
1271- void SetUp() override
1272- {
1273- // Start up Python-based fake OpenWeatherMap server
1274- fake_server_ = posix::exec("/usr/bin/python3", { FAKE_SERVER }, { },
1275- posix::StandardStream::stdout);
1276-
1277- // Check it's running
1278- ASSERT_GT(fake_server_.pid(), 0);
1279- string port;
1280- // The server will print out the random port it is using
1281- fake_server_.cout() >> port;
1282- // Check we have a port
1283- ASSERT_FALSE(port.empty());
1284-
1285- // Build up the API root
1286- string apiroot = "http://127.0.0.1:" + port;
1287- // Override the API root that the scope will use
1288- setenv("NETWORK_SCOPE_APIROOT", apiroot.c_str(), true);
1289-
1290- // Do the parent SetUp
1291- TypedScopeFixture::set_scope_directory(TEST_SCOPE_DIRECTORY);
1292- TypedScopeFixtureScope::SetUp();
1293- }
1294-
1295- /**
1296- * Start by assuming the server is invalid
1297- */
1298- posix::ChildProcess fake_server_ = posix::ChildProcess::invalid();
1299- @endif
1300-};
1301-
1302-TEST_F(TestScope, empty_search_string) {
1303-@if "%ContentType%".substring(0, "network".length) === "network"
1304- const sc::CategoryRenderer renderer;
1305- NiceMock<sct::MockSearchReply> reply;
1306-
1307- // Build a query with an empty search string
1308- sc::CannedQuery query(SCOPE_NAME, "", "");
1309-
1310- // Expect the current weather category
1311- EXPECT_CALL(reply, register_category("current", "London, GB", "", _)).Times(1)
1312- .WillOnce(Return(make_shared<sct::Category>("current", "London, GB", "", renderer)));
1313-
1314- // With one result
1315- EXPECT_CALL(reply, push(Matcher<sc::CategorisedResult const&>(AllOf(
1316- ResultProp("title", "21.8°C"),
1317- ResultProp("art", "http://openweathermap.org/img/w/02d.png"),
1318- ResultProp("subtitle", "few clouds")
1319- )))).WillOnce(
1320- Return(true));
1321-
1322- // Expect the forecast category
1323- EXPECT_CALL(reply, register_category("forecast", "7 day forecast", "", _)).Times(1)
1324- .WillOnce(Return(make_shared<sct::Category>("forecast", "7 day forecast", "", renderer)));
1325-
1326- // With seven results
1327- EXPECT_CALL(reply, push(Matcher<sc::CategorisedResult const&>(AllOf(
1328- ResultProp("title", "25.1°C to 18.8°C"),
1329- ResultProp("art", "http://openweathermap.org/img/w/10d.png"),
1330- ResultProp("subtitle", "light rain")
1331- )))).WillOnce(Return(true));
1332- EXPECT_CALL(reply, push(Matcher<sc::CategorisedResult const&>(AllOf(
1333- ResultProp("title", "20.9°C to 15.5°C"),
1334- ResultProp("art", "http://openweathermap.org/img/w/10d.png"),
1335- ResultProp("subtitle", "moderate rain")
1336- )))).WillOnce(Return(true));
1337- EXPECT_CALL(reply, push(Matcher<sc::CategorisedResult const&>(AllOf(
1338- ResultProp("title", "19.6°C to 13.2°C"),
1339- ResultProp("art", "http://openweathermap.org/img/w/03d.png"),
1340- ResultProp("subtitle", "scattered clouds")
1341- )))).WillOnce(Return(true));
1342- EXPECT_CALL(reply, push(Matcher<sc::CategorisedResult const&>(AllOf(
1343- ResultProp("title", "18.1°C to 13.5°C"),
1344- ResultProp("art", "http://openweathermap.org/img/w/10d.png"),
1345- ResultProp("subtitle", "moderate rain")
1346- )))).WillOnce(Return(true));
1347- EXPECT_CALL(reply, push(Matcher<sc::CategorisedResult const&>(AllOf(
1348- ResultProp("title", "17.4°C to 15.4°C"),
1349- ResultProp("art", "http://openweathermap.org/img/w/10d.png"),
1350- ResultProp("subtitle", "heavy intensity rain")
1351- )))).WillOnce(Return(true));
1352- EXPECT_CALL(reply, push(Matcher<sc::CategorisedResult const&>(AllOf(
1353- ResultProp("title", "18.4°C to 16.2°C"),
1354- ResultProp("art", "http://openweathermap.org/img/w/10d.png"),
1355- ResultProp("subtitle", "moderate rain")
1356- )))).WillOnce(Return(true));
1357- EXPECT_CALL(reply, push(Matcher<sc::CategorisedResult const&>(AllOf(
1358- ResultProp("title", "19°C to 16.7°C"),
1359- ResultProp("art", "http://openweathermap.org/img/w/10d.png"),
1360- ResultProp("subtitle", "light rain")
1361- )))).WillOnce(Return(true));
1362-
1363- sc::SearchReplyProxy reply_proxy(&reply, [](sc::SearchReply*) {}); // note: this is a std::shared_ptr with empty deleter
1364- sc::SearchMetadata meta_data("en_EN", "phone");
1365-
1366- // Create a query object
1367- auto search_query = scope->search(query, meta_data);
1368- ASSERT_NE(nullptr, search_query);
1369-
1370- // Run the search
1371- search_query->run(reply_proxy);
1372-
1373- // Google Mock will make assertions when the mocks are destructed.
1374-@endif
1375-}
1376-
1377-TEST_F(TestScope, search) {
1378-@if "%ContentType%".substring(0, "network".length) === "network"
1379- const sc::CategoryRenderer renderer;
1380- NiceMock<sct::MockSearchReply> reply;
1381-
1382- // Build a query with a non-empty search string
1383- sc::CannedQuery query(SCOPE_NAME, "Manchester,uk", "");
1384-
1385- // Expect the current weather category
1386- EXPECT_CALL(reply, register_category("current", "Manchester, GB", "", _)).Times(1)
1387- .WillOnce(Return(make_shared<sct::Category>("current", "Manchester, GB", "", renderer)));
1388-
1389- // With one result
1390- EXPECT_CALL(reply, push(Matcher<sc::CategorisedResult const&>(AllOf(
1391- ResultProp("title", "17.4°C"),
1392- ResultProp("art", "http://openweathermap.org/img/w/03d.png"),
1393- ResultProp("subtitle", "scattered clouds")
1394- )))).WillOnce(
1395- Return(true));
1396-
1397- // Expect the forecast category
1398- EXPECT_CALL(reply, register_category("forecast", "7 day forecast", "", _)).Times(1)
1399- .WillOnce(Return(make_shared<sct::Category>("forecast", "7 day forecast", "", renderer)));
1400-
1401- // With seven results
1402- EXPECT_CALL(reply, push(Matcher<sc::CategorisedResult const&>(AllOf(
1403- ResultProp("title", "18.8°C to 12°C"),
1404- ResultProp("art", "http://openweathermap.org/img/w/01d.png"),
1405- ResultProp("subtitle", "sky is clear")
1406- )))).WillOnce(Return(true));
1407- EXPECT_CALL(reply, push(Matcher<sc::CategorisedResult const&>(AllOf(
1408- ResultProp("title", "18.6°C to 12.3°C"),
1409- ResultProp("art", "http://openweathermap.org/img/w/10d.png"),
1410- ResultProp("subtitle", "moderate rain")
1411- )))).WillOnce(Return(true));
1412- EXPECT_CALL(reply, push(Matcher<sc::CategorisedResult const&>(AllOf(
1413- ResultProp("title", "17.1°C to 10.8°C"),
1414- ResultProp("art", "http://openweathermap.org/img/w/04d.png"),
1415- ResultProp("subtitle", "broken clouds")
1416- )))).WillOnce(Return(true));
1417- EXPECT_CALL(reply, push(Matcher<sc::CategorisedResult const&>(AllOf(
1418- ResultProp("title", "16°C to 12.2°C"),
1419- ResultProp("art", "http://openweathermap.org/img/w/10d.png"),
1420- ResultProp("subtitle", "moderate rain")
1421- )))).WillOnce(Return(true));
1422- EXPECT_CALL(reply, push(Matcher<sc::CategorisedResult const&>(AllOf(
1423- ResultProp("title", "15.7°C to 13°C"),
1424- ResultProp("art", "http://openweathermap.org/img/w/10d.png"),
1425- ResultProp("subtitle", "light rain")
1426- )))).WillOnce(Return(true));
1427- EXPECT_CALL(reply, push(Matcher<sc::CategorisedResult const&>(AllOf(
1428- ResultProp("title", "17.6°C to 14.1°C"),
1429- ResultProp("art", "http://openweathermap.org/img/w/10d.png"),
1430- ResultProp("subtitle", "moderate rain")
1431- )))).WillOnce(Return(true));
1432- EXPECT_CALL(reply, push(Matcher<sc::CategorisedResult const&>(AllOf(
1433- ResultProp("title", "15.5°C to 13.4°C"),
1434- ResultProp("art", "http://openweathermap.org/img/w/10d.png"),
1435- ResultProp("subtitle", "moderate rain")
1436- )))).WillOnce(Return(true));
1437-
1438- sc::SearchReplyProxy reply_proxy(&reply, [](sc::SearchReply*) {}); // note: this is a std::shared_ptr with empty deleter
1439- sc::SearchMetadata meta_data("en_EN", "phone");
1440-
1441- // Create a query object
1442- auto search_query = scope->search(query, meta_data);
1443- ASSERT_NE(nullptr, search_query);
1444-
1445- // Run the search
1446- search_query->run(reply_proxy);
1447-
1448- // Google Mock will make assertions when the mocks are destructed.
1449-@endif
1450-}
1451-
1452-} // namespace
1453
1454=== added file 'share/qtcreator/templates/wizards/ubuntu/scope/tests/unit/test-scope.py'
1455--- share/qtcreator/templates/wizards/ubuntu/scope/tests/unit/test-scope.py 1970-01-01 00:00:00 +0000
1456+++ share/qtcreator/templates/wizards/ubuntu/scope/tests/unit/test-scope.py 2015-05-19 10:38:08 +0000
1457@@ -0,0 +1,290 @@
1458+#!/usr/bin/env python3
1459+
1460+from scope_harness import *
1461+from scope_harness.testing import *
1462+import unittest, sys, os
1463+from subprocess import Popen, PIPE
1464+
1465+@if "%ContentType%".substring(0, "network".length) === "network"
1466+class AppsTest (ScopeHarnessTestCase):
1467+ @classmethod
1468+ def setUpClass(cls):
1469+ cls.process = Popen(["/usr/bin/python3", FAKE_SERVER], stdout=PIPE)
1470+ port = cls.process.stdout.readline().decode("utf-8").rstrip('\n')
1471+ os.environ["NETWORK_SCOPE_APIROOT"] = "http://127.0.0.1:" + port
1472+
1473+ @classmethod
1474+ def tearDownClass(cls):
1475+ cls.process.terminate()
1476+
1477+
1478+ def start_harness(self):
1479+ self.harness = ScopeHarness.new_from_scope_list(Parameters([SCOPE_INI]))
1480+ self.view = self.harness.results_view
1481+ self.view.active_scope = SCOPE_NAME
1482+
1483+
1484+@if "%ContentType%" == "network-netcpp-qxml"
1485+ def test_surfacing_results(self):
1486+ self.start_harness()
1487+ self.view.search_query = ''
1488+
1489+ match = CategoryListMatcher() \
1490+ .has_exactly(2) \
1491+ .mode(CategoryListMatcherMode.BY_ID) \
1492+ .category(CategoryMatcher("current") \
1493+ .title("London, GB") \
1494+ .has_at_least(1) \
1495+ .result(ResultMatcher("2643743") \
1496+ .title("21.8°C") \
1497+ .art("http://openweathermap.org/img/w/02d.png") \
1498+ .subtitle("few clouds") ) ) \
1499+ .category(CategoryMatcher("forecast") \
1500+ .title("7 day forecast") \
1501+ .has_at_least(7) \
1502+ .result(ResultMatcher("1000000") \
1503+ .title("25.1°C to 18.8°C") \
1504+ .art("http://openweathermap.org/img/w/10d.png") \
1505+ .subtitle("light rain") ) \
1506+ .result(ResultMatcher("1000001") \
1507+ .title("20.9°C to 15.5°C") \
1508+ .art("http://openweathermap.org/img/w/10d.png") \
1509+ .subtitle("moderate rain") ) \
1510+ .result(ResultMatcher("1000002") \
1511+ .title("19.6°C to 13.2°C") \
1512+ .art("http://openweathermap.org/img/w/03d.png") \
1513+ .subtitle("scattered clouds") ) \
1514+ .result(ResultMatcher("1000003") \
1515+ .title("18.1°C to 13.5°C") \
1516+ .art("http://openweathermap.org/img/w/10d.png") \
1517+ .subtitle("moderate rain") ) \
1518+ .result(ResultMatcher("1000004") \
1519+ .title("17.4°C to 15.4°C") \
1520+ .art("http://openweathermap.org/img/w/10d.png") \
1521+ .subtitle("heavy intensity rain") ) \
1522+ .result(ResultMatcher("1000005") \
1523+ .title("18.4°C to 16.2°C") \
1524+ .art("http://openweathermap.org/img/w/10d.png") \
1525+ .subtitle("moderate rain") ) \
1526+ .result(ResultMatcher("1000006") \
1527+ .title("19°C to 16.7°C") \
1528+ .art("http://openweathermap.org/img/w/10d.png") \
1529+ .subtitle("light rain") ) ) \
1530+ .match(self.view.categories)
1531+ self.assertMatchResult(match)
1532+@else
1533+ def test_surfacing_results(self):
1534+ self.start_harness()
1535+ self.view.search_query = ''
1536+
1537+ match = CategoryListMatcher() \
1538+ .has_exactly(2) \
1539+ .mode(CategoryListMatcherMode.BY_ID) \
1540+ .category(CategoryMatcher("current") \
1541+ .title("London, GB") \
1542+ .has_at_least(1) \
1543+ .result(ResultMatcher("5091") \
1544+ .title("21.8°C") \
1545+ .art("http://openweathermap.org/img/w/02d.png") \
1546+ .subtitle("few clouds") ) ) \
1547+ .category(CategoryMatcher("forecast") \
1548+ .title("7 day forecast") \
1549+ .has_at_least(7) \
1550+ .result(ResultMatcher("500") \
1551+ .title("25.1°C to 18.8°C") \
1552+ .art("http://openweathermap.org/img/w/10d.png") \
1553+ .subtitle("light rain") ) \
1554+ .result(ResultMatcher("501") \
1555+ .title("20.9°C to 15.5°C") \
1556+ .art("http://openweathermap.org/img/w/10d.png") \
1557+ .subtitle("moderate rain") ) \
1558+ .result(ResultMatcher("802") \
1559+ .title("19.6°C to 13.2°C") \
1560+ .art("http://openweathermap.org/img/w/03d.png") \
1561+ .subtitle("scattered clouds") ) \
1562+ .result(ResultMatcher("501") \
1563+ .title("18.1°C to 13.5°C") \
1564+ .art("http://openweathermap.org/img/w/10d.png") \
1565+ .subtitle("moderate rain") ) \
1566+ .result(ResultMatcher("502") \
1567+ .title("17.4°C to 15.4°C") \
1568+ .art("http://openweathermap.org/img/w/10d.png") \
1569+ .subtitle("heavy intensity rain") ) \
1570+ .result(ResultMatcher("501") \
1571+ .title("18.4°C to 16.2°C") \
1572+ .art("http://openweathermap.org/img/w/10d.png") \
1573+ .subtitle("moderate rain") ) \
1574+ .result(ResultMatcher("500") \
1575+ .title("19°C to 16.7°C") \
1576+ .art("http://openweathermap.org/img/w/10d.png") \
1577+ .subtitle("light rain") ) ) \
1578+ .match(self.view.categories)
1579+ self.assertMatchResult(match)
1580+@endif
1581+
1582+
1583+@if "%ContentType%" == "network-netcpp-qxml"
1584+ def test_search_results(self):
1585+ self.start_harness()
1586+ self.view.search_query = 'Manchester,uk'
1587+
1588+ match = CategoryListMatcher() \
1589+ .has_exactly(2) \
1590+ .mode(CategoryListMatcherMode.BY_ID) \
1591+ .category(CategoryMatcher("current") \
1592+ .title("Manchester, GB") \
1593+ .has_at_least(1) \
1594+ .result(ResultMatcher("2643123") \
1595+ .title("17.4°C") \
1596+ .art("http://openweathermap.org/img/w/03d.png") \
1597+ .subtitle("scattered clouds") ) ) \
1598+ .category(CategoryMatcher("forecast") \
1599+ .title("7 day forecast") \
1600+ .has_at_least(7) \
1601+ .result(ResultMatcher("1000000") \
1602+ .title("18.8°C to 12°C") \
1603+ .art("http://openweathermap.org/img/w/01d.png") \
1604+ .subtitle("sky is clear") ) \
1605+ .result(ResultMatcher("1000001") \
1606+ .title("18.6°C to 12.3°C") \
1607+ .art("http://openweathermap.org/img/w/10d.png") \
1608+ .subtitle("moderate rain") ) \
1609+ .result(ResultMatcher("1000002") \
1610+ .title("17.1°C to 10.8°C") \
1611+ .art("http://openweathermap.org/img/w/04d.png") \
1612+ .subtitle("broken clouds") ) \
1613+ .result(ResultMatcher("1000003") \
1614+ .title("16°C to 12.2°C") \
1615+ .art("http://openweathermap.org/img/w/10d.png") \
1616+ .subtitle("moderate rain") ) \
1617+ .result(ResultMatcher("1000004") \
1618+ .title("15.7°C to 13°C") \
1619+ .art("http://openweathermap.org/img/w/10d.png") \
1620+ .subtitle("light rain") ) \
1621+ .result(ResultMatcher("1000005") \
1622+ .title("17.6°C to 14.1°C") \
1623+ .art("http://openweathermap.org/img/w/10d.png") \
1624+ .subtitle("moderate rain") ) \
1625+ .result(ResultMatcher("1000006") \
1626+ .title("15.5°C to 13.4°C") \
1627+ .art("http://openweathermap.org/img/w/10d.png") \
1628+ .subtitle("moderate rain") ) ) \
1629+ .match(self.view.categories)
1630+ self.assertMatchResult(match)
1631+@else
1632+ def test_search_results(self):
1633+ self.start_harness()
1634+ self.view.search_query = 'Manchester,uk'
1635+
1636+ match = CategoryListMatcher() \
1637+ .has_exactly(2) \
1638+ .mode(CategoryListMatcherMode.BY_ID) \
1639+ .category(CategoryMatcher("current") \
1640+ .title("Manchester, GB") \
1641+ .has_at_least(1) \
1642+ .result(ResultMatcher("5060") \
1643+ .title("17.4°C") \
1644+ .art("http://openweathermap.org/img/w/03d.png") \
1645+ .subtitle("scattered clouds") ) ) \
1646+ .category(CategoryMatcher("forecast") \
1647+ .title("7 day forecast") \
1648+ .has_at_least(7) \
1649+ .result(ResultMatcher("800") \
1650+ .title("18.8°C to 12°C") \
1651+ .art("http://openweathermap.org/img/w/01d.png") \
1652+ .subtitle("sky is clear") ) \
1653+ .result(ResultMatcher("501") \
1654+ .title("18.6°C to 12.3°C") \
1655+ .art("http://openweathermap.org/img/w/10d.png") \
1656+ .subtitle("moderate rain") ) \
1657+ .result(ResultMatcher("803") \
1658+ .title("17.1°C to 10.8°C") \
1659+ .art("http://openweathermap.org/img/w/04d.png") \
1660+ .subtitle("broken clouds") ) \
1661+ .result(ResultMatcher("501") \
1662+ .title("16°C to 12.2°C") \
1663+ .art("http://openweathermap.org/img/w/10d.png") \
1664+ .subtitle("moderate rain") ) \
1665+ .result(ResultMatcher("500") \
1666+ .title("15.7°C to 13°C") \
1667+ .art("http://openweathermap.org/img/w/10d.png") \
1668+ .subtitle("light rain") ) \
1669+ .result(ResultMatcher("501") \
1670+ .title("17.6°C to 14.1°C") \
1671+ .art("http://openweathermap.org/img/w/10d.png") \
1672+ .subtitle("moderate rain") ) \
1673+ .result(ResultMatcher("501") \
1674+ .title("15.5°C to 13.4°C") \
1675+ .art("http://openweathermap.org/img/w/10d.png") \
1676+ .subtitle("moderate rain") ) ) \
1677+ .match(self.view.categories)
1678+ self.assertMatchResult(match)
1679+@endif
1680+
1681+
1682+if __name__ == '__main__':
1683+ SCOPE_NAME = sys.argv[1]
1684+ SCOPE_INI = sys.argv[2]
1685+ FAKE_SERVER = sys.argv[3]
1686+
1687+ unittest.main(argv = sys.argv[:1])
1688+
1689+@elsif "%ContentType%" == "empty"
1690+class AppsTest (ScopeHarnessTestCase):
1691+ def start_harness(self):
1692+ self.harness = ScopeHarness.new_from_scope_list(Parameters([SCOPE_INI]))
1693+ self.view = self.harness.results_view
1694+ self.view.active_scope = SCOPE_NAME
1695+
1696+
1697+ def test_surfacing_results(self):
1698+ self.start_harness()
1699+ self.view.search_query = ''
1700+
1701+ match = CategoryListMatcher() \
1702+ .has_exactly(1) \
1703+ .mode(CategoryListMatcherMode.BY_ID) \
1704+ .category(CategoryMatcher("results") \
1705+ .title("2 results") \
1706+ .has_at_least(2) \
1707+ .result(ResultMatcher("uri") \
1708+ .title("default") \
1709+ .art("art.png") \
1710+ .subtitle("subtitle") ) \
1711+ .result(ResultMatcher("uri2") \
1712+ .title("default") \
1713+ .art("art2.png") \
1714+ .subtitle("subtitle2") ) ) \
1715+ .match(self.view.categories)
1716+ self.assertMatchResult(match)
1717+
1718+
1719+ def test_search_results(self):
1720+ self.start_harness()
1721+ self.view.search_query = 'test'
1722+
1723+ match = CategoryListMatcher() \
1724+ .has_exactly(1) \
1725+ .mode(CategoryListMatcherMode.BY_ID) \
1726+ .category(CategoryMatcher("results") \
1727+ .title("2 results") \
1728+ .has_at_least(2) \
1729+ .result(ResultMatcher("uri") \
1730+ .title("test") \
1731+ .art("art.png") \
1732+ .subtitle("subtitle") ) \
1733+ .result(ResultMatcher("uri2") \
1734+ .title("test") \
1735+ .art("art2.png") \
1736+ .subtitle("subtitle2") ) ) \
1737+ .match(self.view.categories)
1738+ self.assertMatchResult(match)
1739+
1740+
1741+if __name__ == '__main__':
1742+ SCOPE_NAME = sys.argv[1]
1743+ SCOPE_INI = sys.argv[2]
1744+
1745+ unittest.main(argv = sys.argv[:1])
1746+
1747+@endif
1748
1749=== modified file 'share/qtcreator/templates/wizards/ubuntu/scope/wizard.xml'
1750--- share/qtcreator/templates/wizards/ubuntu/scope/wizard.xml 2015-01-15 12:51:26 +0000
1751+++ share/qtcreator/templates/wizards/ubuntu/scope/wizard.xml 2015-05-19 10:38:08 +0000
1752@@ -9,37 +9,31 @@
1753 <displayname>Unity Scope (cmake)</displayname>
1754 <displaycategory>Ubuntu</displaycategory>
1755 <files>
1756- <file source="cmake/FindGMock.cmake"/>
1757- <file source="cmake/FindIntltool.cmake"/>
1758-
1759- <file source="data/CMakeLists.txt"/>
1760- <file source="data/displayName.ini.in" target="data/%ProjectName:l%.%ClickDomain:l%_%ClickHookName:l%.ini.in"/>
1761- <file source="data/icon.png" binary="true"/>
1762- <file source="data/logo.png" binary="true"/>
1763- <file source="data/screenshot.png" binary="true"/>
1764-
1765- <file source="include/api/config.h"/>
1766- <file source="include/api/client.h"/>
1767- <file source="include/scope/localization.h"/>
1768- <file source="include/scope/preview.h"/>
1769- <file source="include/scope/query.h"/>
1770- <file source="include/scope/scope.h"/>
1771-
1772 <file source="src/CMakeLists.txt"/>
1773- <file source="src/api/client.cpp"/>
1774- <file source="src/scope/query.cpp"/>
1775- <file source="src/scope/scope.cpp" openeditor="true"/>
1776- <file source="src/scope/preview.cpp"/>
1777+ <file source="src/data/displayName.ini.in" target="src/data/%ClickHookName:l%.ini.in"/>
1778+ <file source="src/data/displayName-settings.ini.in" target="src/data/%ClickHookName:l%-settings.ini.in"/>
1779+ <file source="src/data/icon.png" binary="true"/>
1780+ <file source="src/data/logo.png" binary="true"/>
1781+ <file source="src/data/screenshot.png" binary="true"/>
1782+ <file source="src/client.cpp"/>
1783+ <file source="src/client.h"/>
1784+ <file source="src/localization.h"/>
1785+ <file source="src/preview.cpp"/>
1786+ <file source="src/preview.h"/>
1787+ <file source="src/query.cpp"/>
1788+ <file source="src/query.h"/>
1789+ <file source="src/scope.cpp" openeditor="true"/>
1790+ <file source="src/scope.h"/>
1791
1792 <file source="po/CMakeLists.txt"/>
1793 <file source="po/displayName.pot" target="po/%ProjectName:l%.pot"/>
1794 <file source="po/Makefile.in.in"/>
1795 <file source="po/POTFILES.in"/>
1796
1797- <file source="tests/server/forecast/daily/Manchester,uk.json"/>
1798- <file source="tests/server/forecast/daily/Manchester,uk.xml"/>
1799- <file source="tests/server/forecast/daily/London,uk.json"/>
1800- <file source="tests/server/forecast/daily/London,uk.xml"/>
1801+ <file source="tests/server/forecast/Manchester,uk.json"/>
1802+ <file source="tests/server/forecast/Manchester,uk.xml"/>
1803+ <file source="tests/server/forecast/London,uk.json"/>
1804+ <file source="tests/server/forecast/London,uk.xml"/>
1805 <file source="tests/server/weather/Manchester,uk.json"/>
1806 <file source="tests/server/weather/Manchester,uk.xml"/>
1807 <file source="tests/server/weather/London,uk.json"/>
1808@@ -47,7 +41,7 @@
1809 <file source="tests/server/server.py"/>
1810 <file source="tests/CMakeLists.txt"/>
1811 <file source="tests/unit/CMakeLists.txt"/>
1812- <file source="tests/unit/scope/test-scope.cpp"/>
1813+ <file source="tests/unit/test-scope.py"/>
1814
1815 <file source="CMakeLists.txt" openproject="true"/>
1816 <file source="displayName.apparmor" target="%ClickHookName:l%.apparmor"/>

Subscribers

People subscribed via source and target branches