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

Proposed by Marcus Tomlinson
Status: Merged
Approved by: Zoltan Balogh
Approved revision: 396
Merged at revision: 400
Proposed branch: lp:~marcustomlinson/qtcreator-plugin-ubuntu/split-scope-template
Merge into: lp:qtcreator-plugin-ubuntu
Diff against target: 2759 lines (+2533/-1)
37 files modified
debian/qtcreator-plugin-ubuntu-common.install (+1/-0)
share/qtcreator/templates/wizards/ubuntu/scope-14.10/CMakeLists.txt (+116/-0)
share/qtcreator/templates/wizards/ubuntu/scope-14.10/cmake/FindGMock.cmake (+12/-0)
share/qtcreator/templates/wizards/ubuntu/scope-14.10/cmake/FindIntltool.cmake (+265/-0)
share/qtcreator/templates/wizards/ubuntu/scope-14.10/data/CMakeLists.txt (+10/-0)
share/qtcreator/templates/wizards/ubuntu/scope-14.10/data/displayName.ini.in (+9/-0)
share/qtcreator/templates/wizards/ubuntu/scope-14.10/displayName.apparmor (+6/-0)
share/qtcreator/templates/wizards/ubuntu/scope-14.10/include/api/client.h (+168/-0)
share/qtcreator/templates/wizards/ubuntu/scope-14.10/include/api/config.h (+27/-0)
share/qtcreator/templates/wizards/ubuntu/scope-14.10/include/scope/localization.h (+22/-0)
share/qtcreator/templates/wizards/ubuntu/scope-14.10/include/scope/preview.h (+37/-0)
share/qtcreator/templates/wizards/ubuntu/scope-14.10/include/scope/query.h (+36/-0)
share/qtcreator/templates/wizards/ubuntu/scope-14.10/include/scope/scope.h (+53/-0)
share/qtcreator/templates/wizards/ubuntu/scope-14.10/manifest.json.in (+19/-0)
share/qtcreator/templates/wizards/ubuntu/scope-14.10/po/CMakeLists.txt (+9/-0)
share/qtcreator/templates/wizards/ubuntu/scope-14.10/po/Makefile.in.in (+1/-0)
share/qtcreator/templates/wizards/ubuntu/scope-14.10/po/POTFILES.in (+11/-0)
share/qtcreator/templates/wizards/ubuntu/scope-14.10/readme.txt (+26/-0)
share/qtcreator/templates/wizards/ubuntu/scope-14.10/src/CMakeLists.txt (+84/-0)
share/qtcreator/templates/wizards/ubuntu/scope-14.10/src/api/client.cpp (+500/-0)
share/qtcreator/templates/wizards/ubuntu/scope-14.10/src/scope/preview.cpp (+67/-0)
share/qtcreator/templates/wizards/ubuntu/scope-14.10/src/scope/query.cpp (+269/-0)
share/qtcreator/templates/wizards/ubuntu/scope-14.10/src/scope/scope.cpp (+66/-0)
share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/CMakeLists.txt (+44/-0)
share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/server/forecast/daily/London,uk.json (+1/-0)
share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/server/forecast/daily/London,uk.xml (+89/-0)
share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/server/forecast/daily/Manchester,uk.json (+1/-0)
share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/server/forecast/daily/Manchester,uk.xml (+89/-0)
share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/server/server.py (+62/-0)
share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/server/weather/London,uk.json (+1/-0)
share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/server/weather/London,uk.xml (+20/-0)
share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/server/weather/Manchester,uk.json (+1/-0)
share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/server/weather/Manchester,uk.xml (+20/-0)
share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/unit/CMakeLists.txt (+31/-0)
share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/unit/scope/test-scope.cpp (+232/-0)
share/qtcreator/templates/wizards/ubuntu/scope-14.10/wizard.xml (+127/-0)
share/qtcreator/templates/wizards/ubuntu/scope/wizard.xml (+1/-1)
To merge this branch: bzr merge lp:~marcustomlinson/qtcreator-plugin-ubuntu/split-scope-template
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Benjamin Zeller Pending
Review via email: mp+261704@code.launchpad.net

Commit message

Split scope template into "14.10" and "Current" variations

Description of the change

Split scope template into "14.10" and "Current" variations

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
396. By Marcus Tomlinson

Added scope-14.10 project wizard to qtcreator-plugin-ubuntu-common.install

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/qtcreator-plugin-ubuntu-common.install'
2--- debian/qtcreator-plugin-ubuntu-common.install 2015-01-16 22:15:55 +0000
3+++ debian/qtcreator-plugin-ubuntu-common.install 2015-06-11 10:48:39 +0000
4@@ -5,6 +5,7 @@
5 usr/share/qtcreator/templates/wizards/ubuntu/html5-simple
6 usr/share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake
7 usr/share/qtcreator/templates/wizards/ubuntu/scope
8+usr/share/qtcreator/templates/wizards/ubuntu/scope-14.10
9 usr/share/qtcreator/templates/wizards/ubuntu/share
10 usr/share/qtcreator/templates/wizards/ubuntu/simple-app-qmake
11 usr/share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject
12
13=== added directory 'share/qtcreator/templates/wizards/ubuntu/scope-14.10'
14=== added file 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/CMakeLists.txt'
15--- share/qtcreator/templates/wizards/ubuntu/scope-14.10/CMakeLists.txt 1970-01-01 00:00:00 +0000
16+++ share/qtcreator/templates/wizards/ubuntu/scope-14.10/CMakeLists.txt 2015-06-11 10:48:39 +0000
17@@ -0,0 +1,116 @@
18+project(%ProjectName:l% CXX)
19+cmake_minimum_required(VERSION 2.8.10)
20+set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" "${CMAKE_MODULE_PATH}")
21+
22+# We require g++ 4.9, to avoid ABI breakage with earlier version.
23+set(cxx_version_required 4.9)
24+if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
25+ if (NOT CMAKE_CXX_COMPILER_VERSION MATCHES "^${cxx_version_required}")
26+ message(FATAL_ERROR "g++ version must be ${cxx_version_required}!")
27+ endif()
28+endif()
29+
30+# Set strict and naggy C++ compiler flags, and enable C++11
31+add_definitions(
32+ -fno-permissive
33+ -std=c++11
34+ -pedantic
35+ -Wall
36+ -Wextra
37+ -fPIC
38+ -DQT_NO_KEYWORDS
39+)
40+
41+include(GNUInstallDirs)
42+find_package(PkgConfig)
43+find_package(Intltool)
44+
45+# We depend on Boost for string trimming
46+find_package(
47+ Boost
48+ REQUIRED
49+)
50+
51+# Search for our dependencies
52+pkg_check_modules(
53+ SCOPE
54+ libunity-scopes>=0.6.0
55+@if "%ContentType%" == "network-netcpp-json"
56+ jsoncpp
57+@endif
58+@if "%ContentType%".substring(0, "network-netcpp".length) === "network-netcpp"
59+ net-cpp>=1.1.0
60+@endif
61+ REQUIRED
62+)
63+
64+@if "%ContentType%".substring(0, "network-netcpp-q".length) === "network-netcpp-q"
65+find_package(Qt5Core REQUIRED)
66+include_directories(${Qt5Core_INCLUDE_DIRS})
67+@endif
68+
69+# Add our dependencies to the include paths
70+include_directories(
71+ "${CMAKE_SOURCE_DIR}/include"
72+ ${Boost_INCLUDE_DIRS}
73+ ${SCOPE_INCLUDE_DIRS}
74+)
75+
76+# Do not remove this line, its required for the correct functionality of the Ubuntu-SDK
77+set(UBUNTU_MANIFEST_PATH "manifest.json.in" CACHE INTERNAL "Tells QtCreator location and name of the manifest file")
78+set(UBUNTU_PROJECT_TYPE "Scope" CACHE INTERNAL "Tells QtCreator this is a Scope project")
79+
80+# Important project paths
81+set(CMAKE_INSTALL_PREFIX /)
82+set(SCOPE_INSTALL_DIR "/%ClickHookName:l%")
83+set(GETTEXT_PACKAGE "%ProjectName:l%")
84+set(PACKAGE_NAME "%ProjectName:l%.%ClickDomain:l%")
85+set(SCOPE_NAME "${PACKAGE_NAME}_%ClickHookName:l%")
86+
87+# If we need to refer to the scope's name or package in code, these definitions will help
88+
89+add_definitions(-DPACKAGE_NAME="${PACKAGE_NAME}")
90+add_definitions(-DSCOPE_NAME="${SCOPE_NAME}")
91+add_definitions(-DGETTEXT_PACKAGE="${GETTEXT_PACKAGE}")
92+
93+#This command figures out the target architecture and puts it into the manifest file
94+execute_process(
95+ COMMAND dpkg-architecture -qDEB_HOST_ARCH
96+ OUTPUT_VARIABLE CLICK_ARCH
97+ OUTPUT_STRIP_TRAILING_WHITESPACE
98+)
99+
100+configure_file(manifest.json.in ${CMAKE_CURRENT_BINARY_DIR}/manifest.json)
101+
102+# Install the click manifest
103+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/manifest.json DESTINATION "/")
104+install(FILES "%ClickHookName:l%.apparmor" DESTINATION "/")
105+
106+# Make these files show up in QtCreator
107+file(GLOB_RECURSE
108+ _PO_FILES
109+ "po/*.po"
110+)
111+add_custom_target(hidden_files
112+ ALL
113+ SOURCES
114+ manifest.json.in
115+ %ClickHookName:l%.apparmor
116+ data/${SCOPE_NAME}.ini.in
117+ po/POTFILES.in
118+ po/${GETTEXT_PACKAGE}.pot
119+ ${_PO_FILES}
120+)
121+
122+# Add our main directories
123+add_subdirectory(src)
124+add_subdirectory(data)
125+add_subdirectory(po)
126+
127+# Set up the tests
128+enable_testing()
129+add_subdirectory(tests)
130+add_custom_target(
131+ check
132+ ${CMAKE_CTEST_COMMAND} --force-new-ctest-process --output-on-failure
133+)
134
135=== added directory 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/cmake'
136=== added file 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/cmake/FindGMock.cmake'
137--- share/qtcreator/templates/wizards/ubuntu/scope-14.10/cmake/FindGMock.cmake 1970-01-01 00:00:00 +0000
138+++ share/qtcreator/templates/wizards/ubuntu/scope-14.10/cmake/FindGMock.cmake 2015-06-11 10:48:39 +0000
139@@ -0,0 +1,12 @@
140+# Build with system gmock and embedded gtest
141+set (GMOCK_INCLUDE_DIRS "/usr/include/gmock/include" CACHE PATH "gmock source include directory")
142+set (GMOCK_SOURCE_DIR "/usr/src/gmock" CACHE PATH "gmock source directory")
143+set (GTEST_INCLUDE_DIRS "${GMOCK_SOURCE_DIR}/gtest/include" CACHE PATH "gtest source include directory")
144+
145+add_subdirectory(${GMOCK_SOURCE_DIR} "${CMAKE_CURRENT_BINARY_DIR}/gmock")
146+
147+set(GTEST_LIBRARIES gtest)
148+set(GTEST_MAIN_LIBRARIES gtest_main)
149+set(GMOCK_LIBRARIES gmock gmock_main)
150+
151+set(GTEST_BOTH_LIBRARIES ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES})
152
153=== added file 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/cmake/FindIntltool.cmake'
154--- share/qtcreator/templates/wizards/ubuntu/scope-14.10/cmake/FindIntltool.cmake 1970-01-01 00:00:00 +0000
155+++ share/qtcreator/templates/wizards/ubuntu/scope-14.10/cmake/FindIntltool.cmake 2015-06-11 10:48:39 +0000
156@@ -0,0 +1,265 @@
157+# Copyright (C) 2014 Canonical Ltd
158+#
159+# This program is free software: you can redistribute it and/or modify
160+# it under the terms of the GNU Lesser General Public License version 3 as
161+# published by the Free Software Foundation.
162+#
163+# This program is distributed in the hope that it will be useful,
164+# but WITHOUT ANY WARRANTY; without even the implied warranty of
165+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
166+# GNU Lesser General Public License for more details.
167+#
168+# You should have received a copy of the GNU Lesser General Public License
169+# along with this program. If not, see <http://www.gnu.org/licenses/>.
170+
171+# This package provides macros that wrap the intltool programs.
172+#
173+# An example of common usage is:
174+#
175+# For an ini file:
176+#
177+# intltool_merge_translations(
178+# "foo.ini.in"
179+# "${CMAKE_CURRENT_BINARY_DIR}/foo.ini"
180+# ALL
181+# UTF8
182+# )
183+#
184+# Inside po/CMakeLists.txt:
185+#
186+# intltool_update_potfile(
187+# ALL
188+# GETTEXT_PACKAGE ${GETTEXT_PACKAGE}
189+# )
190+#
191+# intltool_install_translations(
192+# ALL
193+# GETTEXT_PACKAGE ${GETTEXT_PACKAGE}
194+# )
195+
196+find_package(Gettext REQUIRED)
197+
198+find_program(INTLTOOL_UPDATE_EXECUTABLE intltool-update)
199+
200+if(INTLTOOL_UPDATE_EXECUTABLE)
201+ execute_process(
202+ COMMAND ${INTLTOOL_UPDATE_EXECUTABLE} --version
203+ OUTPUT_VARIABLE intltool_update_version
204+ ERROR_QUIET
205+ OUTPUT_STRIP_TRAILING_WHITESPACE)
206+ if (intltool_update_version MATCHES "^intltool-update \\(.*\\) [0-9]")
207+ string(
208+ REGEX REPLACE "^intltool-update \\([^\\)]*\\) ([0-9\\.]+[^ \n]*).*" "\\1"
209+ INTLTOOL_UPDATE_VERSION_STRING "${intltool_update_version}"
210+ )
211+ endif()
212+ unset(intltool_update_version)
213+endif()
214+
215+find_program(INTLTOOL_MERGE_EXECUTABLE intltool-merge)
216+
217+if(INTLTOOL_MERGE_EXECUTABLE)
218+ execute_process(
219+ COMMAND ${INTLTOOL_MERGE_EXECUTABLE} --version
220+ OUTPUT_VARIABLE intltool_merge_version
221+ ERROR_QUIET
222+ OUTPUT_STRIP_TRAILING_WHITESPACE)
223+ if (intltool_update_version MATCHES "^intltool-merge \\(.*\\) [0-9]")
224+ string(
225+ REGEX REPLACE "^intltool-merge \\([^\\)]*\\) ([0-9\\.]+[^ \n]*).*" "\\1"
226+ INTLTOOL_MERGE_VERSION_STRING "${intltool_merge_version}"
227+ )
228+ endif()
229+ unset(intltool_merge_version)
230+endif()
231+
232+include(FindPackageHandleStandardArgs)
233+
234+find_package_handle_standard_args(
235+ Intltool
236+ REQUIRED_VARS
237+ INTLTOOL_UPDATE_EXECUTABLE
238+ INTLTOOL_MERGE_EXECUTABLE
239+ VERSION_VAR
240+ INTLTOOL_UPDATE_VERSION_STRING
241+ HANDLE_COMPONENTS
242+)
243+
244+function(APPEND_EACH LISTNAME GLUE OUTPUT)
245+ set(_tmp_list "")
246+ foreach(VAL ${${LISTNAME}})
247+ list(APPEND _tmp_list "${GLUE}${VAL}")
248+ endforeach(VAL ${${LISTNAME}})
249+ set(${OUTPUT} "${_tmp_list}" PARENT_SCOPE)
250+endfunction()
251+
252+function(INTLTOOL_UPDATE_POTFILE)
253+ set(_options ALL)
254+ set(_oneValueArgs GETTEXT_PACKAGE OUTPUT_FILE PO_DIRECTORY)
255+
256+ cmake_parse_arguments(_ARG "${_options}" "${_oneValueArgs}" "" ${ARGN})
257+
258+ set(_POT_FILE "${PROJECT}.pot")
259+
260+ set(_GETTEXT_PACKAGE "")
261+ if(_ARG_GETTEXT_PACKAGE)
262+ set(_POT_FILE "${_ARG_GETTEXT_PACKAGE}.pot")
263+ set(_GETTEXT_PACKAGE --gettext-package="${_ARG_GETTEXT_PACKAGE}")
264+ endif()
265+
266+ set(_OUTPUT_FILE "")
267+ if(_ARG_OUTPUT_FILE)
268+ set(_POT_FILE "${_ARG_OUTPUT_FILE}")
269+ set(_OUTPUT_FILE --output-file="${_ARG_OUTPUT_FILE}")
270+ endif()
271+
272+ set(_PO_DIRECTORY "${CMAKE_SOURCE_DIR}/po")
273+ if(_ARG_PO_DIRECTORY)
274+ set(_PO_DIRECTORY "${_ARG_PO_DIRECTORY}")
275+ endif()
276+
277+ file(
278+ GLOB_RECURSE _CODE_SOURCES
279+ ${CMAKE_SOURCE_DIR}/*.cpp
280+ ${CMAKE_SOURCE_DIR}/*.cc
281+ ${CMAKE_SOURCE_DIR}/*.cxx
282+ ${CMAKE_SOURCE_DIR}/*.vala
283+ ${CMAKE_SOURCE_DIR}/*.c
284+ ${CMAKE_SOURCE_DIR}/*.h
285+ ${CMAKE_SOURCE_DIR}/*.ini.in
286+ )
287+
288+ add_custom_command(
289+ OUTPUT
290+ "${_PO_DIRECTORY}/${_POT_FILE}"
291+ COMMAND ${INTLTOOL_UPDATE_EXECUTABLE} --pot ${_OUTPUT_FILE} ${_GETTEXT_PACKAGE}
292+ DEPENDS
293+ "${_PO_DIRECTORY}/POTFILES.in"
294+ ${_CODE_SOURCES}
295+ WORKING_DIRECTORY ${_PO_DIRECTORY}
296+ )
297+
298+ _GETTEXT_GET_UNIQUE_TARGET_NAME(${_POT_FILE} _UNIQUE_TARGET_NAME)
299+
300+ if(_ARG_ALL)
301+ add_custom_target(
302+ ${_UNIQUE_TARGET_NAME}
303+ ALL
304+ DEPENDS
305+ "${_PO_DIRECTORY}/${_POT_FILE}"
306+ )
307+ else()
308+ add_custom_target(
309+ ${_UNIQUE_TARGET_NAME}
310+ DEPENDS
311+ "${_PO_DIRECTORY}/${_POT_FILE}"
312+ )
313+ endif()
314+endfunction()
315+
316+function(INTLTOOL_INSTALL_TRANSLATIONS)
317+ set(_options ALL)
318+ set(_oneValueArgs GETTEXT_PACKAGE POT_FILE)
319+
320+ cmake_parse_arguments(_ARG "${_options}" "${_oneValueArgs}" "" ${ARGN})
321+
322+ set(_POT_FILE "${PROJECT}.pot")
323+
324+ if(_ARG_GETTEXT_PACKAGE)
325+ set(_POT_FILE "${_ARG_GETTEXT_PACKAGE}.pot")
326+ endif()
327+
328+ if(_ARG_OUTPUT_FILE)
329+ set(_POT_FILE "${_ARG_OUTPUT_FILE}")
330+ endif()
331+
332+ file(
333+ GLOB _PO_FILES
334+ ${CMAKE_CURRENT_SOURCE_DIR}/*.po
335+ )
336+
337+ get_filename_component(_ABS_POT_FILE ${_POT_FILE} ABSOLUTE)
338+
339+ foreach(_PO_FILE ${_PO_FILES})
340+ add_custom_command(
341+ OUTPUT
342+ ${_PO_FILE}
343+ COMMAND
344+ ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${_PO_FILE} ${_ABS_POT_FILE}
345+ DEPENDS
346+ ${_ABS_POT_FILE}
347+ )
348+ endforeach()
349+
350+ if(_ARG_ALL)
351+ gettext_create_translations(
352+ ${_POT_FILE}
353+ ALL
354+ ${_PO_FILES}
355+ )
356+ else()
357+ gettext_create_translations(
358+ ${_POT_FILE}
359+ ${_PO_FILES}
360+ )
361+ endif()
362+endfunction()
363+
364+function(INTLTOOL_MERGE_TRANSLATIONS FILENAME OUTPUT_FILE)
365+ set(_options ALL UTF8 PASS_THROUGH)
366+ set(_oneValueArgs PO_DIRECTORY)
367+
368+ cmake_parse_arguments(_ARG "${_options}" "${_oneValueArgs}" "" ${ARGN})
369+
370+ get_filename_component(_ABS_FILENAME ${FILENAME} ABSOLUTE)
371+
372+ set(_PO_DIRECTORY "${CMAKE_SOURCE_DIR}/po")
373+ if(_ARG_PO_DIRECTORY)
374+ set(_PO_DIRECTORY "${_ARG_PO_DIRECTORY}")
375+ endif()
376+
377+ set(_UTF8 "")
378+ if(_ARG_UTF8)
379+ set(_UTF8 "--utf8")
380+ endif()
381+
382+ set(_PASS_THROUGH "")
383+ if(_ARG_PASS_THROUGH)
384+ set(_PASS_THROUGH "--pass-through")
385+ endif()
386+
387+ file(
388+ GLOB_RECURSE _PO_FILES
389+ ${_PO_DIRECTORY}/*.po
390+ )
391+
392+ add_custom_command(
393+ OUTPUT
394+ ${OUTPUT_FILE}
395+ COMMAND
396+ ${INTLTOOL_MERGE_EXECUTABLE} --desktop-style --quiet ${_UTF8} ${_PASS_THROUGH} ${_PO_DIRECTORY} ${FILENAME} ${OUTPUT_FILE}
397+ DEPENDS
398+ ${_ABS_FILENAME}
399+ ${_PO_FILES}
400+ WORKING_DIRECTORY
401+ ${CMAKE_CURRENT_SOURCE_DIR}
402+ )
403+
404+ get_filename_component(_OUTPUT_NAME ${OUTPUT_FILE} NAME)
405+ _GETTEXT_GET_UNIQUE_TARGET_NAME(${_OUTPUT_NAME} _UNIQUE_TARGET_NAME)
406+
407+ if(_ARG_ALL)
408+ add_custom_target(
409+ ${_UNIQUE_TARGET_NAME}
410+ ALL
411+ DEPENDS
412+ ${OUTPUT_FILE}
413+ )
414+ else()
415+ add_custom_target(
416+ ${_UNIQUE_TARGET_NAME}
417+ DEPENDS
418+ ${OUTPUT_FILE}
419+ )
420+ endif()
421+endfunction()
422
423=== added directory 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/data'
424=== added file 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/data/CMakeLists.txt'
425--- share/qtcreator/templates/wizards/ubuntu/scope-14.10/data/CMakeLists.txt 1970-01-01 00:00:00 +0000
426+++ share/qtcreator/templates/wizards/ubuntu/scope-14.10/data/CMakeLists.txt 2015-06-11 10:48:39 +0000
427@@ -0,0 +1,10 @@
428+
429+# Install the scope images
430+install(
431+ FILES
432+ "icon.png"
433+ "logo.png"
434+ "screenshot.png"
435+ DESTINATION
436+ "${SCOPE_INSTALL_DIR}"
437+)
438
439=== added file 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/data/displayName.ini.in'
440--- share/qtcreator/templates/wizards/ubuntu/scope-14.10/data/displayName.ini.in 1970-01-01 00:00:00 +0000
441+++ share/qtcreator/templates/wizards/ubuntu/scope-14.10/data/displayName.ini.in 2015-06-11 10:48:39 +0000
442@@ -0,0 +1,9 @@
443+[ScopeConfig]
444+_DisplayName=%ProjectName:c% Scope
445+_Description=This is a %ProjectName:c% scope
446+Art=screenshot.png
447+Author=Firstname Lastname
448+Icon=icon.png
449+
450+[Appearance]
451+PageHeader.Logo=logo.png
452
453=== added file 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/data/icon.png'
454Binary files share/qtcreator/templates/wizards/ubuntu/scope-14.10/data/icon.png 1970-01-01 00:00:00 +0000 and share/qtcreator/templates/wizards/ubuntu/scope-14.10/data/icon.png 2015-06-11 10:48:39 +0000 differ
455=== added file 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/data/logo.png'
456Binary files share/qtcreator/templates/wizards/ubuntu/scope-14.10/data/logo.png 1970-01-01 00:00:00 +0000 and share/qtcreator/templates/wizards/ubuntu/scope-14.10/data/logo.png 2015-06-11 10:48:39 +0000 differ
457=== added file 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/data/screenshot.png'
458Binary files share/qtcreator/templates/wizards/ubuntu/scope-14.10/data/screenshot.png 1970-01-01 00:00:00 +0000 and share/qtcreator/templates/wizards/ubuntu/scope-14.10/data/screenshot.png 2015-06-11 10:48:39 +0000 differ
459=== added file 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/displayName.apparmor'
460--- share/qtcreator/templates/wizards/ubuntu/scope-14.10/displayName.apparmor 1970-01-01 00:00:00 +0000
461+++ share/qtcreator/templates/wizards/ubuntu/scope-14.10/displayName.apparmor 2015-06-11 10:48:39 +0000
462@@ -0,0 +1,6 @@
463+{
464+ "template": "%ConfinementType%",
465+ "policy_groups": [],
466+ "policy_version": %ClickAAPolicyVersion%
467+}
468+
469
470=== added directory 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/include'
471=== added directory 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/include/api'
472=== added file 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/include/api/client.h'
473--- share/qtcreator/templates/wizards/ubuntu/scope-14.10/include/api/client.h 1970-01-01 00:00:00 +0000
474+++ share/qtcreator/templates/wizards/ubuntu/scope-14.10/include/api/client.h 2015-06-11 10:48:39 +0000
475@@ -0,0 +1,168 @@
476+#ifndef API_CLIENT_H_
477+#define API_CLIENT_H_
478+
479+#include <api/config.h>
480+
481+#include <atomic>
482+#include <deque>
483+#include <map>
484+#include <string>
485+@if "%ContentType%".substring(0, "network".length) === "network"
486+#include <core/net/http/request.h>
487+#include <core/net/uri.h>
488+
489+@if "%ContentType%" == "network-netcpp-json"
490+namespace Json {
491+class Value;
492+}
493+@elsif "%ContentType%" == "network-netcpp-qjson"
494+#include <QJsonDocument>
495+@elsif "%ContentType%" == "network-netcpp-qxml"
496+#include <QXmlStreamReader>
497+@endif
498+@endif
499+
500+namespace api {
501+
502+/**
503+ * Provide a nice way to access the HTTP API.
504+ *
505+ * We don't want our scope's code to be mixed together with HTTP and JSON handling.
506+ */
507+class Client {
508+public:
509+
510+@if "%ContentType%" == "empty"
511+ /**
512+ * Result struct
513+ */
514+ struct Result {
515+ std::string uri;
516+ std::string title;
517+ std::string art;
518+ std::string subtitle;
519+ std::string description;
520+ };
521+
522+ /**
523+ * A list of weather information
524+ */
525+ typedef std::deque<Result> ResultList;
526+@endif
527+@if "%ContentType%".substring(0, "network".length) === "network"
528+ /**
529+ * Information about a City
530+ */
531+ struct City {
532+ unsigned int id;
533+ std::string name;
534+ std::string country;
535+ };
536+
537+ /**
538+ * Temperature information for a day.
539+ */
540+ struct Temp {
541+ double max;
542+ double min;
543+ double cur;
544+ };
545+
546+ /**
547+ * Weather information for a day.
548+ */
549+ struct Weather {
550+ unsigned int id;
551+ std::string main;
552+ std::string description;
553+ std::string icon;
554+ Temp temp;
555+ };
556+
557+ /**
558+ * A list of weather information
559+ */
560+ typedef std::deque<Weather> WeatherList;
561+
562+ /**
563+ * Weather information about the current day
564+ */
565+ struct Current {
566+ City city;
567+ Weather weather;
568+ };
569+
570+ /**
571+ * Forecast information about a city
572+ */
573+ struct Forecast {
574+ City city;
575+ WeatherList weather;
576+ };
577+@endif
578+
579+ Client(Config::Ptr config);
580+
581+ virtual ~Client() = default;
582+
583+@if "%ContentType%" == "empty"
584+ /**
585+ * Search for results
586+ */
587+ virtual ResultList search(const std::string &query);
588+@endif
589+@if "%ContentType%".substring(0, "network".length) === "network"
590+ /**
591+ * Get the current weather for the specified location
592+ */
593+ virtual Current weather(const std::string &query);
594+
595+ /**
596+ * Get the weather forecast for the specified location and duration
597+ */
598+ virtual Forecast forecast_daily(const std::string &query, unsigned int days = 7);
599+@endif
600+
601+ /**
602+ * Cancel any pending queries (this method can be called from a different thread)
603+ */
604+ virtual void cancel();
605+
606+ virtual Config::Ptr config();
607+
608+protected:
609+@if "%ContentType%" == "network-netcpp-json"
610+ void get(const core::net::Uri::Path &path,
611+ const core::net::Uri::QueryParameters &parameters,
612+ Json::Value &root);
613+@elsif "%ContentType%" == "network-netcpp-qjson"
614+ void get(const core::net::Uri::Path &path,
615+ const core::net::Uri::QueryParameters &parameters,
616+ QJsonDocument &root);
617+@elsif "%ContentType%" == "network-netcpp-qxml"
618+ void get(const core::net::Uri::Path &path,
619+ const core::net::Uri::QueryParameters &parameters,
620+ QXmlStreamReader &reader);
621+@endif
622+@if "%ContentType%".substring(0, "network".length) === "network"
623+ /**
624+ * Progress callback that allows the query to cancel pending HTTP requests.
625+ */
626+ core::net::http::Request::Progress::Next progress_report(
627+ const core::net::http::Request::Progress& progress);
628+@endif
629+
630+ /**
631+ * Hang onto the configuration information
632+ */
633+ Config::Ptr config_;
634+
635+ /**
636+ * Thread-safe cancelled flag
637+ */
638+ std::atomic<bool> cancelled_;
639+};
640+
641+}
642+
643+#endif // API_CLIENT_H_
644
645=== added file 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/include/api/config.h'
646--- share/qtcreator/templates/wizards/ubuntu/scope-14.10/include/api/config.h 1970-01-01 00:00:00 +0000
647+++ share/qtcreator/templates/wizards/ubuntu/scope-14.10/include/api/config.h 2015-06-11 10:48:39 +0000
648@@ -0,0 +1,27 @@
649+#ifndef API_CONFIG_H_
650+#define API_CONFIG_H_
651+
652+#include <memory>
653+#include <string>
654+
655+namespace api {
656+
657+struct Config {
658+ typedef std::shared_ptr<Config> Ptr;
659+
660+@if "%ContentType%".substring(0, "network".length) === "network"
661+ /*
662+ * The root of all API request URLs
663+ */
664+ std::string apiroot { "http://api.openweathermap.org" };
665+
666+ /*
667+ * The custom HTTP user agent string for this library
668+ */
669+ std::string user_agent { "example-network-scope 0.1; (foo)" };
670+@endif
671+};
672+
673+}
674+
675+#endif /* API_CONFIG_H_ */
676
677=== added directory 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/include/scope'
678=== added file 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/include/scope/localization.h'
679--- share/qtcreator/templates/wizards/ubuntu/scope-14.10/include/scope/localization.h 1970-01-01 00:00:00 +0000
680+++ share/qtcreator/templates/wizards/ubuntu/scope-14.10/include/scope/localization.h 2015-06-11 10:48:39 +0000
681@@ -0,0 +1,22 @@
682+#ifndef SCOPE_LOCALIZATION_H_
683+#define SCOPE_LOCALIZATION_H_
684+
685+#include <libintl.h>
686+#include <string>
687+
688+inline char * _(const char *__msgid) {
689+ return dgettext(GETTEXT_PACKAGE, __msgid);
690+}
691+
692+inline std::string _(const char *__msgid1, const char *__msgid2,
693+ unsigned long int __n) {
694+ char buffer [256];
695+ if (snprintf ( buffer, 256, dngettext(GETTEXT_PACKAGE, __msgid1, __msgid2, __n), __n ) >= 0) {
696+ return buffer;
697+ } else {
698+ return std::string();
699+ }
700+}
701+
702+#endif // SCOPE_LOCALIZATION_H_
703+
704
705=== added file 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/include/scope/preview.h'
706--- share/qtcreator/templates/wizards/ubuntu/scope-14.10/include/scope/preview.h 1970-01-01 00:00:00 +0000
707+++ share/qtcreator/templates/wizards/ubuntu/scope-14.10/include/scope/preview.h 2015-06-11 10:48:39 +0000
708@@ -0,0 +1,37 @@
709+#ifndef SCOPE_PREVIEW_H_
710+#define SCOPE_PREVIEW_H_
711+
712+#include <unity/scopes/PreviewQueryBase.h>
713+
714+namespace unity {
715+namespace scopes {
716+class Result;
717+}
718+}
719+
720+namespace scope {
721+
722+/**
723+ * Represents an individual preview request.
724+ *
725+ * Each time a result is previewed in the UI a new Preview
726+ * object is created.
727+ */
728+class Preview: public unity::scopes::PreviewQueryBase {
729+public:
730+ Preview(const unity::scopes::Result &result,
731+ const unity::scopes::ActionMetadata &metadata);
732+
733+ ~Preview() = default;
734+
735+ void cancelled() override;
736+
737+ /**
738+ * Populates the reply object with preview information.
739+ */
740+ void run(unity::scopes::PreviewReplyProxy const& reply) override;
741+};
742+
743+}
744+
745+#endif // SCOPE_PREVIEW_H_
746
747=== added file 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/include/scope/query.h'
748--- share/qtcreator/templates/wizards/ubuntu/scope-14.10/include/scope/query.h 1970-01-01 00:00:00 +0000
749+++ share/qtcreator/templates/wizards/ubuntu/scope-14.10/include/scope/query.h 2015-06-11 10:48:39 +0000
750@@ -0,0 +1,36 @@
751+#ifndef SCOPE_QUERY_H_
752+#define SCOPE_QUERY_H_
753+
754+#include <api/client.h>
755+
756+#include <unity/scopes/SearchQueryBase.h>
757+#include <unity/scopes/ReplyProxyFwd.h>
758+
759+namespace scope {
760+
761+/**
762+ * Represents an individual query.
763+ *
764+ * A new Query object will be constructed for each query. It is
765+ * given query information, metadata about the search, and
766+ * some scope-specific configuration.
767+ */
768+class Query: public unity::scopes::SearchQueryBase {
769+public:
770+ Query(const unity::scopes::CannedQuery &query,
771+ const unity::scopes::SearchMetadata &metadata, api::Config::Ptr config);
772+
773+ ~Query() = default;
774+
775+ void cancelled() override;
776+
777+ void run(const unity::scopes::SearchReplyProxy &reply) override;
778+
779+private:
780+ api::Client client_;
781+};
782+
783+}
784+
785+#endif // SCOPE_QUERY_H_
786+
787
788=== added file 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/include/scope/scope.h'
789--- share/qtcreator/templates/wizards/ubuntu/scope-14.10/include/scope/scope.h 1970-01-01 00:00:00 +0000
790+++ share/qtcreator/templates/wizards/ubuntu/scope-14.10/include/scope/scope.h 2015-06-11 10:48:39 +0000
791@@ -0,0 +1,53 @@
792+#ifndef SCOPE_SCOPE_H_
793+#define SCOPE_SCOPE_H_
794+
795+#include <api/config.h>
796+
797+#include <unity/scopes/ScopeBase.h>
798+#include <unity/scopes/QueryBase.h>
799+#include <unity/scopes/ReplyProxyFwd.h>
800+#include <unity/scopes/QueryBase.h>
801+#include <unity/scopes/PreviewQueryBase.h>
802+
803+namespace scope {
804+
805+/**
806+ * Defines the lifecycle of scope plugin, and acts as a factory
807+ * for Query and Preview objects.
808+ *
809+ * Note that the #preview and #search methods are each called on
810+ * different threads, so some form of interlocking is required
811+ * if shared data structures are used.
812+ */
813+class Scope: public unity::scopes::ScopeBase {
814+public:
815+ /**
816+ * Called once at startup
817+ */
818+ void start(std::string const&) override;
819+
820+ /**
821+ * Called at shutdown
822+ */
823+ void stop() override;
824+
825+ /**
826+ * Called each time a new preview is requested
827+ */
828+ unity::scopes::PreviewQueryBase::UPtr preview(const unity::scopes::Result&,
829+ const unity::scopes::ActionMetadata&) override;
830+
831+ /**
832+ * Called each time a new query is requested
833+ */
834+ unity::scopes::SearchQueryBase::UPtr search(
835+ unity::scopes::CannedQuery const& q,
836+ unity::scopes::SearchMetadata const&) override;
837+
838+protected:
839+ api::Config::Ptr config_;
840+};
841+
842+}
843+
844+#endif // SCOPE_SCOPE_H_
845
846=== added file 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/manifest.json.in'
847--- share/qtcreator/templates/wizards/ubuntu/scope-14.10/manifest.json.in 1970-01-01 00:00:00 +0000
848+++ share/qtcreator/templates/wizards/ubuntu/scope-14.10/manifest.json.in 2015-06-11 10:48:39 +0000
849@@ -0,0 +1,19 @@
850+{
851+@if "%ContentType%".substring(0, "network".length) === "network"
852+ "description": "A simple Unity scope that accesses the network",
853+@else
854+ "description": "A simple Unity scope that accesses local content",
855+@endif
856+ "maintainer": "%ClickMaintainer%",
857+ "architecture": "@CLICK_ARCH@",
858+ "name": "%ProjectName:l%.%ClickDomain:l%",
859+ "title": "%ProjectName:l%",
860+ "framework" : "%ClickFrameworkVersion%",
861+ "hooks": {
862+ "%ClickHookName:l%": {
863+ "scope": "%ClickHookName:l%",
864+ "apparmor": "%ClickHookName:l%.apparmor"
865+ }
866+ }
867+}
868+
869
870=== added directory 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/po'
871=== added file 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/po/CMakeLists.txt'
872--- share/qtcreator/templates/wizards/ubuntu/scope-14.10/po/CMakeLists.txt 1970-01-01 00:00:00 +0000
873+++ share/qtcreator/templates/wizards/ubuntu/scope-14.10/po/CMakeLists.txt 2015-06-11 10:48:39 +0000
874@@ -0,0 +1,9 @@
875+intltool_update_potfile(
876+ ALL
877+ GETTEXT_PACKAGE ${GETTEXT_PACKAGE}
878+)
879+
880+intltool_install_translations(
881+ ALL
882+ GETTEXT_PACKAGE ${GETTEXT_PACKAGE}
883+)
884
885=== added file 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/po/Makefile.in.in'
886--- share/qtcreator/templates/wizards/ubuntu/scope-14.10/po/Makefile.in.in 1970-01-01 00:00:00 +0000
887+++ share/qtcreator/templates/wizards/ubuntu/scope-14.10/po/Makefile.in.in 2015-06-11 10:48:39 +0000
888@@ -0,0 +1,1 @@
889+XGETTEXT_KEYWORDS=--c++ --keyword=_ --keyword=N_ --keyword=_:1,2
890\ No newline at end of file
891
892=== added file 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/po/POTFILES.in'
893--- share/qtcreator/templates/wizards/ubuntu/scope-14.10/po/POTFILES.in 1970-01-01 00:00:00 +0000
894+++ share/qtcreator/templates/wizards/ubuntu/scope-14.10/po/POTFILES.in 2015-06-11 10:48:39 +0000
895@@ -0,0 +1,11 @@
896+[type: gettext/ini] data/%ProjectName:l%.%ClickDomain:l%_%ClickHookName:l%.ini.in
897+include/api/config.h
898+include/api/client.h
899+include/scope/preview.h
900+include/scope/localization.h
901+include/scope/query.h
902+include/scope/scope.h
903+src/api/client.cpp
904+src/scope/query.cpp
905+src/scope/scope.cpp
906+src/scope/preview.cpp
907
908=== added file 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/po/displayName.pot'
909=== added file 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/readme.txt'
910--- share/qtcreator/templates/wizards/ubuntu/scope-14.10/readme.txt 1970-01-01 00:00:00 +0000
911+++ share/qtcreator/templates/wizards/ubuntu/scope-14.10/readme.txt 2015-06-11 10:48:39 +0000
912@@ -0,0 +1,26 @@
913+Unity scope template
914+
915+Building
916+--------
917+
918+To build this scope outside of QtCreator, please install phablet-tools and run click-buddy.
919+
920+Localization
921+------------
922+
923+intltool is used to perform localization of the scope. Ensure whenever you add / rename files
924+that contain localizable strings you update "po/POTFILES.in".
925+
926+When you want to add a new language to the translation catalogue:
927+
928+ * Copy the .pot file from the "po" directory and rename it to e.g. "zh_CN.po",
929+ where "zh_CN" is the language code for China.
930+ * Enter the language code in "Language:".
931+ * Enter the "UTF-8" as the "Content-Type:".
932+ * Enter the translations in the msgstr tags.
933+
934+For the new translation to show up, cmake needs to be re-run to enable the recusive search
935+macro to delect the new translation. In QtCreator this can be done with the "Build->Run Cmake"
936+menu entry.
937+
938+Remember! When you copy the .pot file, make sure you change the file extension to ".po".
939
940=== added directory 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/src'
941=== added file 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/src/CMakeLists.txt'
942--- share/qtcreator/templates/wizards/ubuntu/scope-14.10/src/CMakeLists.txt 1970-01-01 00:00:00 +0000
943+++ share/qtcreator/templates/wizards/ubuntu/scope-14.10/src/CMakeLists.txt 2015-06-11 10:48:39 +0000
944@@ -0,0 +1,84 @@
945+
946+# Put the ini file in the build directory next to the scope
947+# .so file so test tools can find both easily.
948+intltool_merge_translations(
949+ "${CMAKE_SOURCE_DIR}/data/${SCOPE_NAME}.ini.in"
950+ "${CMAKE_CURRENT_BINARY_DIR}/${SCOPE_NAME}.ini"
951+ ALL
952+ UTF8
953+)
954+
955+# Install the scope ini file
956+install(
957+ FILES "${CMAKE_CURRENT_BINARY_DIR}/${SCOPE_NAME}.ini"
958+ DESTINATION ${SCOPE_INSTALL_DIR}
959+)
960+
961+configure_file(
962+ "${CMAKE_SOURCE_DIR}/data/logo.png"
963+ "${CMAKE_CURRENT_BINARY_DIR}/logo.png"
964+ @ONLY
965+ COPYONLY
966+)
967+
968+# The sources to build the scope
969+set(SCOPE_SOURCES
970+ api/client.cpp
971+ scope/preview.cpp
972+ scope/query.cpp
973+ scope/scope.cpp
974+)
975+
976+# Find all the headers
977+file(GLOB_RECURSE
978+ SCOPE_HEADERS
979+ "${CMAKE_SOURCE_DIR}/include/*.h"
980+)
981+
982+# Build an object library for the scope code
983+add_library(
984+ scope-static OBJECT
985+ ${SCOPE_SOURCES}
986+ ${SCOPE_HEADERS}
987+)
988+
989+# Ensure we export all the symbols
990+set_target_properties(
991+ scope-static
992+ PROPERTIES
993+ LINK_FLAGS "-Wl,--export-all-symbols"
994+)
995+
996+# Build a shared library containing our scope code.
997+# This will be the actual plugin that is loaded.
998+add_library(
999+ scope SHARED
1000+ $<TARGET_OBJECTS:scope-static>
1001+)
1002+
1003+# Link against the object library and our external library dependencies
1004+target_link_libraries(
1005+ scope
1006+ ${SCOPE_LDFLAGS}
1007+ ${Boost_LIBRARIES}
1008+)
1009+
1010+@if "%ContentType%".substring(0, "network-netcpp-q".length) === "network-netcpp-q"
1011+qt5_use_modules(
1012+ scope
1013+ Core
1014+)
1015+@endif
1016+
1017+# Set the correct library output name to conform to the securiry policy
1018+set_target_properties(
1019+ scope
1020+ PROPERTIES
1021+ OUTPUT_NAME "${SCOPE_NAME}"
1022+)
1023+
1024+# Install the scope shared library
1025+install(
1026+ TARGETS scope
1027+ LIBRARY DESTINATION ${SCOPE_INSTALL_DIR}
1028+)
1029
1030=== added directory 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/src/api'
1031=== added file 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/src/api/client.cpp'
1032--- share/qtcreator/templates/wizards/ubuntu/scope-14.10/src/api/client.cpp 1970-01-01 00:00:00 +0000
1033+++ share/qtcreator/templates/wizards/ubuntu/scope-14.10/src/api/client.cpp 2015-06-11 10:48:39 +0000
1034@@ -0,0 +1,500 @@
1035+#include <api/client.h>
1036+
1037+@if "%ContentType%".substring(0, "network-netcpp".length) === "network-netcpp"
1038+#include <core/net/error.h>
1039+#include <core/net/http/client.h>
1040+#include <core/net/http/content_type.h>
1041+#include <core/net/http/response.h>
1042+@if "%ContentType%" == "network-netcpp-json"
1043+#include <json/json.h>
1044+@elsif "%ContentType%" == "network-netcpp-qjson"
1045+#include <QVariantMap>
1046+@endif
1047+
1048+namespace http = core::net::http;
1049+namespace net = core::net;
1050+@if "%ContentType%" == "network-netcpp-json"
1051+namespace json = Json;
1052+@endif
1053+@endif
1054+
1055+using namespace api;
1056+using namespace std;
1057+
1058+Client::Client(Config::Ptr config) :
1059+ config_(config), cancelled_(false) {
1060+}
1061+
1062+@if "%ContentType%" == "network-netcpp-qxml"
1063+namespace {
1064+static QString readText(QXmlStreamReader& xml)
1065+{
1066+ xml.readNext();
1067+
1068+ if (xml.tokenType() != QXmlStreamReader::Characters) {
1069+ return QString();
1070+ }
1071+
1072+ return xml.text().toString();
1073+}
1074+
1075+static void parseCity(Client::City& city, QXmlStreamReader& xml)
1076+{
1077+ QXmlStreamAttributes attributes = xml.attributes();
1078+ if (attributes.hasAttribute("id")) {
1079+ city.id = attributes.value("id").toUInt();
1080+ }
1081+ if (attributes.hasAttribute("name")) {
1082+ city.name = attributes.value("name").toString().toStdString();
1083+ }
1084+
1085+ xml.readNext();
1086+
1087+ while (!xml.atEnd() && !(xml.isEndElement() && xml.name() == "city")) {
1088+ if (xml.isStartElement()) {
1089+ if (xml.name() == "country") {
1090+ city.country = readText(xml).toStdString();
1091+ }
1092+ }
1093+ xml.readNext();
1094+ }
1095+}
1096+
1097+static void parseWeather(Client::Weather& weather, QXmlStreamReader& xml)
1098+{
1099+ QXmlStreamAttributes attributes = xml.attributes();
1100+ if (attributes.hasAttribute("id")) {
1101+ weather.id = attributes.value("id").toUInt();
1102+ }
1103+ if (attributes.hasAttribute("value")) {
1104+ weather.description = attributes.value("value").toString().toStdString();
1105+ }
1106+ if (attributes.hasAttribute("icon")) {
1107+ weather.icon = "http://openweathermap.org/img/w/"
1108+ + attributes.value("icon").toString().toStdString() + ".png";
1109+ }
1110+
1111+ xml.readNext();
1112+
1113+ while (!xml.atEnd() && !(xml.isEndElement() && xml.name() == "weather")) {
1114+ xml.readNext();
1115+ }
1116+}
1117+
1118+static void parseTemperature(Client::Temp& temp, QXmlStreamReader& xml)
1119+{
1120+ QXmlStreamAttributes attributes = xml.attributes();
1121+ if (attributes.hasAttribute("value")) {
1122+ temp.cur = attributes.value("value").toDouble();
1123+ }
1124+ if (attributes.hasAttribute("max")) {
1125+ temp.max = attributes.value("max").toDouble();
1126+ }
1127+ if (attributes.hasAttribute("min")) {
1128+ temp.min = attributes.value("min").toDouble();
1129+ }
1130+
1131+ xml.readNext();
1132+
1133+ while (!xml.atEnd() && !(xml.isEndElement() && xml.name() == "temperature")) {
1134+ xml.readNext();
1135+ }
1136+}
1137+
1138+static void parseLocation(Client::City& city, QXmlStreamReader& xml)
1139+{
1140+ xml.readNext();
1141+
1142+ while (!xml.atEnd() && !(xml.isEndElement() && xml.name() == "location")) {
1143+ if (xml.name() == "name") {
1144+ city.name = readText(xml).toStdString();
1145+ } else if (xml.name() == "country") {
1146+ city.country = readText(xml).toStdString();
1147+ }
1148+
1149+ xml.readNext();
1150+ }
1151+}
1152+
1153+static void parseTime(Client::Weather& weather, QXmlStreamReader& xml)
1154+{
1155+ xml.readNext();
1156+
1157+ while (!xml.atEnd() && !(xml.isEndElement() && xml.name() == "time"))
1158+ {
1159+ if (xml.name() == "symbol") {
1160+ QXmlStreamAttributes attributes = xml.attributes();
1161+ if (attributes.hasAttribute("name")) {
1162+ weather.description = attributes.value("name").toString().toStdString();
1163+ }
1164+ if (attributes.hasAttribute("var")) {
1165+ weather.icon = "http://openweathermap.org/img/w/"
1166+ + attributes.value("var").toString().toStdString() + ".png";
1167+ }
1168+ } else if (xml.name() == "temperature") {
1169+ QXmlStreamAttributes attributes = xml.attributes();
1170+ if (attributes.hasAttribute("max")) {
1171+ weather.temp.max = attributes.value("max").toDouble();
1172+ }
1173+ if (attributes.hasAttribute("min")) {
1174+ weather.temp.min = attributes.value("min").toDouble();
1175+ }
1176+ if (attributes.hasAttribute("day")) {
1177+ weather.temp.cur = attributes.value("day").toDouble();
1178+ }
1179+ }
1180+
1181+ xml.readNext();
1182+ }
1183+}
1184+
1185+static void parseForecast(Client::WeatherList& weather_list, QXmlStreamReader& xml)
1186+{
1187+ xml.readNext();
1188+
1189+ unsigned int weather_id = 1000000;
1190+
1191+ while (!xml.atEnd() && !(xml.isEndElement() && xml.name() == "forecast"))
1192+ {
1193+ if (xml.name() == "time") {
1194+ Client::Weather weather;
1195+ weather.id = weather_id++;
1196+ parseTime(weather, xml);
1197+ weather_list.emplace_back(weather);
1198+ }
1199+ xml.readNext();
1200+ }
1201+}
1202+
1203+}
1204+@endif
1205+
1206+@if "%ContentType%" == "empty"
1207+Client::ResultList Client::search(const string &query) {
1208+ ResultList results;
1209+
1210+ // This is the method that we will call from the Query class.
1211+ // It just returns some results.
1212+ // You can add here your code to get results from an http API, from your local disk
1213+ // or anywhere.
1214+
1215+ // In this case we just create some results withouth accessing any other source of
1216+ // data
1217+ {
1218+ Result result;
1219+ result.uri = "uri";
1220+ result.title = query;
1221+ result.art = "art.png";
1222+ result.subtitle = "subtitle";
1223+ result.description = "description";
1224+ results.emplace_back(result);
1225+ }
1226+ {
1227+ Result result;
1228+ result.uri = "uri2";
1229+ result.title = query;
1230+ result.art = "art2.png";
1231+ result.subtitle = "subtitle2";
1232+ result.description = "description2";
1233+ results.emplace_back(result);
1234+ }
1235+
1236+ return results;
1237+}
1238+@endif
1239+@if "%ContentType%".substring(0, "network-netcpp".length) === "network-netcpp"
1240+@if "%ContentType%" == "network-netcpp-json"
1241+void Client::get(const net::Uri::Path &path,
1242+ const net::Uri::QueryParameters &parameters, json::Value &root) {
1243+@elsif "%ContentType%" == "network-netcpp-qjson"
1244+void Client::get(const net::Uri::Path &path,
1245+ const net::Uri::QueryParameters &parameters, QJsonDocument &root) {
1246+@elsif "%ContentType%" == "network-netcpp-qxml"
1247+void Client::get(const net::Uri::Path &path,
1248+ const net::Uri::QueryParameters &parameters, QXmlStreamReader &reader) {
1249+@endif
1250+ // Create a new HTTP client
1251+ auto client = http::make_client();
1252+
1253+ // Start building the request configuration
1254+ http::Request::Configuration configuration;
1255+
1256+ // Build the URI from its components
1257+ net::Uri uri = net::make_uri(config_->apiroot, path, parameters);
1258+ configuration.uri = client->uri_to_string(uri);
1259+
1260+ // Give out a user agent string
1261+ configuration.header.add("User-Agent", config_->user_agent);
1262+
1263+ // Build a HTTP request object from our configuration
1264+ auto request = client->head(configuration);
1265+
1266+ try {
1267+ // Synchronously make the HTTP request
1268+ // We bind the cancellable callback to #progress_report
1269+ auto response = request->execute(
1270+ bind(&Client::progress_report, this, placeholders::_1));
1271+
1272+ // Check that we got a sensible HTTP status code
1273+ if (response.status != http::Status::ok) {
1274+ throw domain_error(response.body);
1275+ }
1276+@if "%ContentType%" == "network-netcpp-json"
1277+ // Parse the JSON from the response
1278+ json::Reader reader;
1279+ reader.parse(response.body, root);
1280+
1281+ // Open weather map API error code can either be a string or int
1282+ json::Value cod = root["cod"];
1283+ if ((cod.isString() && cod.asString() != "200")
1284+ || (cod.isUInt() && cod.asUInt() != 200)) {
1285+ throw domain_error(root["message"].asString());
1286+ }
1287+@elsif "%ContentType%" == "network-netcpp-qjson"
1288+ // Parse the JSON from the response
1289+ root = QJsonDocument::fromJson(response.body.c_str());
1290+
1291+ // Open weather map API error code can either be a string or int
1292+ QVariant cod = root.toVariant().toMap()["cod"];
1293+ if ((cod.canConvert<QString>() && cod.toString() != "200")
1294+ || (cod.canConvert<unsigned int>() && cod.toUInt() != 200)) {
1295+ throw domain_error(root.toVariant().toMap()["message"].toString().toStdString());
1296+ }
1297+@elsif "%ContentType%" == "network-netcpp-qxml"
1298+ // Parse the Xml from the response
1299+ reader.addData(response.body.c_str());
1300+@endif
1301+ } catch (net::Error &) {
1302+ }
1303+}
1304+
1305+Client::Current Client::weather(const string& query) {
1306+ // This is the method that we will call from the Query class.
1307+ // It connects to an HTTP source and returns the results.
1308+
1309+@if "%ContentType%" == "network-netcpp-json"
1310+
1311+ // In this case we are going to retrieve JSON data.
1312+ json::Value root;
1313+@elsif "%ContentType%" == "network-netcpp-qjson"
1314+
1315+ // In this case we are going to retrieve JSON data.
1316+ QJsonDocument root;
1317+@elsif "%ContentType%" == "network-netcpp-qxml"
1318+
1319+ // In this case we are going to retrieve XML data.
1320+ QXmlStreamReader root;
1321+@endif
1322+
1323+ // Build a URI and get the contents.
1324+ // The fist parameter forms the path part of the URI.
1325+ // The second parameter forms the CGI parameters.
1326+ get(
1327+ { "data", "2.5", "weather" },
1328+ { { "q", query }, { "units", "metric" }
1329+@if "%ContentType%" == "network-netcpp-qxml"
1330+ , { "mode", "xml" }
1331+@endif
1332+ },
1333+ root);
1334+ // e.g. http://api.openweathermap.org/data/2.5/weather?q=QUERY&units=metric
1335+
1336+ Current result;
1337+
1338+@if "%ContentType%" == "network-netcpp-json"
1339+ // Read out the city we found
1340+ json::Value sys = root["sys"];
1341+ result.city.id = sys["id"].asUInt();
1342+ result.city.name = root["name"].asString();
1343+ result.city.country = sys["country"].asString();
1344+
1345+ // Read the weather
1346+ json::Value weather = root["weather"].get(json::ArrayIndex(0),
1347+ json::Value());
1348+ result.weather.id = weather["id"].asUInt();
1349+ result.weather.main = weather["main"].asString();
1350+ result.weather.description = weather["description"].asString();
1351+ result.weather.icon = "http://openweathermap.org/img/w/"
1352+ + weather["icon"].asString() + ".png";
1353+
1354+ // Read the temps
1355+ json::Value main = root["main"];
1356+ result.weather.temp.cur = main["temp"].asDouble();
1357+ result.weather.temp.max = main["temp_max"].asDouble();
1358+ result.weather.temp.min = main["temp_min"].asDouble();
1359+@elsif "%ContentType%" == "network-netcpp-qjson"
1360+ // Read out the city we found
1361+ QVariantMap variant = root.toVariant().toMap();
1362+ QVariantMap sys = variant["sys"].toMap();
1363+ result.city.id = sys["id"].toUInt();
1364+ result.city.name = variant["name"].toString().toStdString();
1365+ result.city.country = sys["country"].toString().toStdString();
1366+
1367+ // Read the weather
1368+ QVariantMap weather = variant["weather"].toList().first().toMap();
1369+ result.weather.id = weather["id"].toUInt();
1370+ result.weather.main = weather["main"].toString().toStdString();
1371+ result.weather.description = weather["description"].toString().toStdString();
1372+ result.weather.icon = "http://openweathermap.org/img/w/"
1373+ + weather["icon"].toString().toStdString() + ".png";
1374+
1375+ // Read the temps
1376+ QVariantMap main = variant["main"].toMap();
1377+ result.weather.temp.cur = main["temp"].toDouble();
1378+ result.weather.temp.max = main["temp_max"].toDouble();
1379+ result.weather.temp.min = main["temp_min"].toDouble();
1380+@elsif "%ContentType%" == "network-netcpp-qxml"
1381+ while (!root.atEnd() && !root.hasError()) {
1382+ QXmlStreamReader::TokenType token = root.readNext();
1383+
1384+ /* If token is just StartDocument, we'll go to next.*/
1385+ if (token == QXmlStreamReader::StartDocument) {
1386+ continue;
1387+ }
1388+
1389+ /* If token is StartElement, we'll see if we can read it.*/
1390+ if (token == QXmlStreamReader::StartElement) {
1391+ if (root.name() == "current") {
1392+ root.readNext();
1393+ } else if (root.name() == "city") {
1394+ parseCity(result.city, root);
1395+ } else if (root.name() == "weather") {
1396+ parseWeather(result.weather, root);
1397+ } else if (root.name() == "temperature") {
1398+ parseTemperature(result.weather.temp, root);
1399+ }
1400+ }
1401+ }
1402+
1403+ if (root.hasError()) {
1404+ throw domain_error(root.errorString().toStdString());
1405+ }
1406+@endif
1407+ return result;
1408+}
1409+
1410+Client::Forecast Client::forecast_daily(const string& query, unsigned int cnt) {
1411+@if "%ContentType%" == "network-netcpp-json"
1412+ json::Value root;
1413+@elsif "%ContentType%" == "network-netcpp-qjson"
1414+ QJsonDocument root;
1415+@elsif "%ContentType%" == "network-netcpp-qxml"
1416+ QXmlStreamReader root;
1417+@endif
1418+
1419+ // Build a URI and get the contents
1420+ // The fist parameter forms the path part of the URI.
1421+ // The second parameter forms the CGI parameters.
1422+ get( { "data", "2.5", "forecast", "daily" }, { { "q", query }, { "units",
1423+ "metric" }, { "cnt", to_string(cnt) }
1424+@if "%ContentType%" == "network-netcpp-qxml"
1425+ , { "mode", "xml" }
1426+@endif
1427+ }, root);
1428+ // e.g. http://api.openweathermap.org/data/2.5/forecast/daily/?q=QUERY&units=metric&cnt=7
1429+
1430+ Forecast result;
1431+
1432+@if "%ContentType%" == "network-netcpp-json"
1433+ // Read out the city we found
1434+ json::Value city = root["city"];
1435+ result.city.id = city["id"].asUInt();
1436+ result.city.name = city["name"].asString();
1437+ result.city.country = city["country"].asString();
1438+
1439+ // Iterate through the weather data
1440+ json::Value list = root["list"];
1441+ for (json::ArrayIndex index = 0; index < list.size(); ++index) {
1442+ json::Value item = list.get(index, json::Value());
1443+
1444+ // Extract the first weather item
1445+ json::Value weather_list = item["weather"];
1446+ json::Value weather = weather_list.get(json::ArrayIndex(0),
1447+ json::Value());
1448+
1449+ // Extract the temperature data
1450+ json::Value temp = item["temp"];
1451+
1452+ // Add a result to the weather list
1453+ result.weather.emplace_back(
1454+ Weather { weather["id"].asUInt(), weather["main"].asString(),
1455+ weather["description"].asString(),
1456+ "http://openweathermap.org/img/w/"
1457+ + weather["icon"].asString() + ".png", Temp {
1458+ temp["max"].asDouble(), temp["min"].asDouble(),
1459+ 0.0 } });
1460+ }
1461+@elsif "%ContentType%" == "network-netcpp-qjson"
1462+ QVariantMap variant = root.toVariant().toMap();
1463+
1464+ // Read out the city we found
1465+ QVariantMap city = variant["city"].toMap();
1466+ result.city.id = city["id"].toUInt();
1467+ result.city.name = city["name"].toString().toStdString();
1468+ result.city.country = city["country"].toString().toStdString();
1469+
1470+ // Iterate through the weather data
1471+ for (const QVariant &i : variant["list"].toList()) {
1472+ QVariantMap item = i.toMap();
1473+
1474+ // Extract the first weather item
1475+ QVariantList weather_list = item["weather"].toList();
1476+ QVariantMap weather = weather_list.first().toMap();
1477+
1478+ // Extract the temperature data
1479+ QVariantMap temp = item["temp"].toMap();
1480+
1481+ // Add a result to the weather list
1482+ result.weather.emplace_back(
1483+ Weather { weather["id"].toUInt(), weather["main"].toString().toStdString(),
1484+ weather["description"].toString().toStdString(),
1485+ "http://openweathermap.org/img/w/"
1486+ + weather["icon"].toString().toStdString() + ".png", Temp {
1487+ temp["max"].toDouble(), temp["min"].toDouble(),
1488+ 0.0 } });
1489+ }
1490+@elsif "%ContentType%" == "network-netcpp-qxml"
1491+ while (!root.atEnd() && !root.hasError()) {
1492+ QXmlStreamReader::TokenType token = root.readNext();
1493+
1494+ /* If token is just StartDocument, we'll go to next.*/
1495+ if (token == QXmlStreamReader::StartDocument) {
1496+ continue;
1497+ }
1498+
1499+ /* If token is StartElement, we'll see if we can read it.*/
1500+ if (token == QXmlStreamReader::StartElement) {
1501+ if (root.name() == "weatherdata") {
1502+ root.readNext();
1503+ } else if (root.name() == "location") {
1504+ parseLocation(result.city, root);
1505+ } else if (root.name() == "forecast") {
1506+ parseForecast(result.weather, root);
1507+ }
1508+ }
1509+ }
1510+
1511+ if (root.hasError()) {
1512+ throw domain_error(root.errorString().toStdString());
1513+ }
1514+@endif
1515+
1516+ return result;
1517+}
1518+
1519+http::Request::Progress::Next Client::progress_report(
1520+ const http::Request::Progress&) {
1521+
1522+ return cancelled_ ?
1523+ http::Request::Progress::Next::abort_operation :
1524+ http::Request::Progress::Next::continue_operation;
1525+}
1526+@endif
1527+
1528+void Client::cancel() {
1529+ cancelled_ = true;
1530+}
1531+
1532+Config::Ptr Client::config() {
1533+ return config_;
1534+}
1535
1536=== added directory 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/src/scope'
1537=== added file 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/src/scope/preview.cpp'
1538--- share/qtcreator/templates/wizards/ubuntu/scope-14.10/src/scope/preview.cpp 1970-01-01 00:00:00 +0000
1539+++ share/qtcreator/templates/wizards/ubuntu/scope-14.10/src/scope/preview.cpp 2015-06-11 10:48:39 +0000
1540@@ -0,0 +1,67 @@
1541+#include <scope/preview.h>
1542+
1543+#include <unity/scopes/ColumnLayout.h>
1544+#include <unity/scopes/PreviewWidget.h>
1545+#include <unity/scopes/PreviewReply.h>
1546+#include <unity/scopes/Result.h>
1547+#include <unity/scopes/VariantBuilder.h>
1548+
1549+#include <iostream>
1550+
1551+namespace sc = unity::scopes;
1552+
1553+using namespace std;
1554+using namespace scope;
1555+
1556+Preview::Preview(const sc::Result &result, const sc::ActionMetadata &metadata) :
1557+ sc::PreviewQueryBase(result, metadata) {
1558+}
1559+
1560+void Preview::cancelled() {
1561+}
1562+
1563+void Preview::run(sc::PreviewReplyProxy const& reply) {
1564+ // Support three different column layouts
1565+ sc::ColumnLayout layout1col(1), layout2col(2), layout3col(3);
1566+
1567+ // We define 3 different layouts, that will be used depending on the
1568+ // device. The shell (view) will decide which layout fits best.
1569+ // If, for instance, we are executing in a tablet probably the view will use
1570+ // 2 or more columns.
1571+ // Column layout definitions are optional.
1572+ // However, we recommend that scopes define layouts for the best visual appearance.
1573+
1574+ // Single column layout
1575+ layout1col.add_column( { "image", "header", "summary" });
1576+
1577+ // Two column layout
1578+ layout2col.add_column( { "image" });
1579+ layout2col.add_column( { "header", "summary" });
1580+
1581+ // Three cokumn layout
1582+ layout3col.add_column( { "image" });
1583+ layout3col.add_column( { "header", "summary" });
1584+ layout3col.add_column( { });
1585+
1586+ // Register the layouts we just created
1587+ reply->register_layout( { layout1col, layout2col, layout3col });
1588+
1589+ // Define the header section
1590+ sc::PreviewWidget header("header", "header");
1591+ // It has title and a subtitle properties
1592+ header.add_attribute_mapping("title", "title");
1593+ header.add_attribute_mapping("subtitle", "subtitle");
1594+
1595+ // Define the image section
1596+ sc::PreviewWidget image("image", "image");
1597+ // It has a single source property, mapped to the result's art property
1598+ image.add_attribute_mapping("source", "art");
1599+
1600+ // Define the summary section
1601+ sc::PreviewWidget description("summary", "text");
1602+ // It has a text property, mapped to the result's description property
1603+ description.add_attribute_mapping("text", "description");
1604+
1605+ // Push each of the sections
1606+ reply->push( { image, header, description });
1607+}
1608
1609=== added file 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/src/scope/query.cpp'
1610--- share/qtcreator/templates/wizards/ubuntu/scope-14.10/src/scope/query.cpp 1970-01-01 00:00:00 +0000
1611+++ share/qtcreator/templates/wizards/ubuntu/scope-14.10/src/scope/query.cpp 2015-06-11 10:48:39 +0000
1612@@ -0,0 +1,269 @@
1613+#include <boost/algorithm/string/trim.hpp>
1614+
1615+#include <scope/localization.h>
1616+#include <scope/query.h>
1617+
1618+#include <unity/scopes/Annotation.h>
1619+#include <unity/scopes/CategorisedResult.h>
1620+#include <unity/scopes/CategoryRenderer.h>
1621+#include <unity/scopes/QueryBase.h>
1622+#include <unity/scopes/SearchReply.h>
1623+
1624+#include <iomanip>
1625+#include <sstream>
1626+
1627+namespace sc = unity::scopes;
1628+namespace alg = boost::algorithm;
1629+
1630+using namespace std;
1631+using namespace api;
1632+using namespace scope;
1633+
1634+@if "%ContentType%" == "empty"
1635+/**
1636+ * Define the layout for theresults
1637+ *
1638+ * The icon size is medium, and ask for the card layout
1639+ * itself to be horizontal. I.e. the text will be placed
1640+ * next to the image.
1641+ */
1642+const static string CATEGORY_TEMPLATE =
1643+ R"(
1644+{
1645+ "schema-version": 1,
1646+ "template": {
1647+ "category-layout": "grid",
1648+ "card-layout": "horizontal",
1649+ "card-size": "medium"
1650+ },
1651+ "components": {
1652+ "title": "title",
1653+ "art" : {
1654+ "field": "art"
1655+ },
1656+ "subtitle": "subtitle"
1657+ }
1658+}
1659+)";
1660+@endif
1661+
1662+@if "%ContentType%".substring(0, "network".length) === "network"
1663+/**
1664+ * Define the layout for the forecast results
1665+ *
1666+ * The icon size is small, and ask for the card layout
1667+ * itself to be horizontal. I.e. the text will be placed
1668+ * next to the image.
1669+ */
1670+const static string WEATHER_TEMPLATE =
1671+ R"(
1672+{
1673+ "schema-version": 1,
1674+ "template": {
1675+ "category-layout": "grid",
1676+ "card-layout": "horizontal",
1677+ "card-size": "small"
1678+ },
1679+ "components": {
1680+ "title": "title",
1681+ "art" : {
1682+ "field": "art"
1683+ },
1684+ "subtitle": "subtitle"
1685+ }
1686+}
1687+)";
1688+
1689+/**
1690+ * Define the larger "current weather" layout.
1691+ *
1692+ * The icons are larger.
1693+ */
1694+const static string CITY_TEMPLATE =
1695+ R"(
1696+{
1697+ "schema-version": 1,
1698+ "template": {
1699+ "category-layout": "grid",
1700+ "card-size": "medium"
1701+ },
1702+ "components": {
1703+ "title": "title",
1704+ "art" : {
1705+ "field": "art"
1706+ },
1707+ "subtitle": "subtitle"
1708+ }
1709+}
1710+)";
1711+@endif
1712+
1713+Query::Query(const sc::CannedQuery &query, const sc::SearchMetadata &metadata,
1714+ Config::Ptr config) :
1715+ sc::SearchQueryBase(query, metadata), client_(config) {
1716+}
1717+
1718+void Query::cancelled() {
1719+ client_.cancel();
1720+}
1721+
1722+@if "%ContentType%" == "empty"
1723+void Query::run(sc::SearchReplyProxy const& reply) {
1724+ try {
1725+ // Start by getting information about the query
1726+ const sc::CannedQuery &query(sc::SearchQueryBase::query());
1727+
1728+ // Trim the query string of whitespace
1729+ string query_string = alg::trim_copy(query.query_string());
1730+
1731+ // the Client is the helper class that provides the results
1732+ // without mixing APIs and scopes code.
1733+ // Add your code to retreive xml, json, or any other kind of result
1734+ // in the client.
1735+ Client::ResultList results;
1736+ if (query_string.empty()) {
1737+ // If the string is empty, pick a default
1738+ results = client_.search("default");
1739+ } else {
1740+ // otherwise, use the search string
1741+ results = client_.search(query_string);
1742+ }
1743+
1744+ // Register a category
1745+ auto cat = reply->register_category("results",
1746+ _("1 result", "%d results", results.size()), "",
1747+ sc::CategoryRenderer(CATEGORY_TEMPLATE));
1748+
1749+ for (const auto &result : results) {
1750+ sc::CategorisedResult res(cat);
1751+
1752+ // We must have a URI
1753+ res.set_uri(result.uri);
1754+
1755+ res.set_title(result.title);
1756+
1757+ // Set the rest of the attributes, art, description, etc
1758+ res.set_art(result.art);
1759+ res["subtitle"] = result.subtitle;
1760+ res["description"] = result.description;
1761+
1762+ // Push the result
1763+ if (!reply->push(res)) {
1764+ // If we fail to push, it means the query has been cancelled.
1765+ // So don't continue;
1766+ return;
1767+ }
1768+ }
1769+ } catch (domain_error &e) {
1770+ // Handle exceptions being thrown by the client API
1771+ cerr << e.what() << endl;
1772+ reply->error(current_exception());
1773+ }
1774+}
1775+@endif
1776+
1777+@if "%ContentType%".substring(0, "network".length) === "network"
1778+void Query::run(sc::SearchReplyProxy const& reply) {
1779+ try {
1780+ // Start by getting information about the query
1781+ const sc::CannedQuery &query(sc::SearchQueryBase::query());
1782+
1783+ // Trim the query string of whitespace
1784+ string query_string = alg::trim_copy(query.query_string());
1785+
1786+ // the Client is the helper class that provides the results
1787+ // without mixing APIs and scopes code.
1788+ // Add your code to retreive xml, json, or any other kind of result
1789+ // in the client.
1790+ Client::Current current;
1791+ if (query_string.empty()) {
1792+ // If the string is empty, get the current weather for London
1793+ current = client_.weather("London,uk");
1794+ } else {
1795+ // otherwise, get the current weather for the search string
1796+ current = client_.weather(query_string);
1797+ }
1798+
1799+ // Build up the description for the city
1800+ stringstream ss(stringstream::in | stringstream::out);
1801+ ss << current.city.name << ", " << current.city.country;
1802+
1803+ // Register a category for the current weather, with the title we just built
1804+ auto location_cat = reply->register_category("current", ss.str(), "",
1805+ sc::CategoryRenderer(CITY_TEMPLATE));
1806+
1807+ {
1808+ // Create a single result for the current weather category
1809+ sc::CategorisedResult res(location_cat);
1810+
1811+ // We must have a URI
1812+ res.set_uri(to_string(current.city.id));
1813+
1814+ // Build up the description for the current weather
1815+ stringstream ss(stringstream::in | stringstream::out);
1816+ ss << setprecision(3) << current.weather.temp.cur;
1817+ ss << "°C";
1818+ res.set_title(ss.str());
1819+
1820+ // Set the rest of the attributes, art, description, etc
1821+ res.set_art(current.weather.icon);
1822+ res["subtitle"] = current.weather.description;
1823+ res["description"] = "A description of the result";
1824+
1825+ // Push the result
1826+ if (!reply->push(res)) {
1827+ // If we fail to push, it means the query has been cancelled.
1828+ // So don't continue;
1829+ return;
1830+ }
1831+ }
1832+
1833+ Client::Forecast forecast;
1834+ if (query_string.empty()) {
1835+ // If there is no search string, get the forecast for London
1836+ forecast = client_.forecast_daily("London,uk");
1837+ } else {
1838+ // otherwise, get the forecast for the search string
1839+ forecast = client_.forecast_daily(query_string);
1840+ }
1841+
1842+ // Register a category for the forecast
1843+ auto forecast_cat = reply->register_category("forecast",
1844+ _("7 day forecast"), "", sc::CategoryRenderer(WEATHER_TEMPLATE));
1845+
1846+ // For each of the forecast days
1847+ for (const auto &weather : forecast.weather) {
1848+ // Create a result
1849+ sc::CategorisedResult res(forecast_cat);
1850+
1851+ // We must have a URI
1852+ res.set_uri(to_string(weather.id));
1853+
1854+ // Build the description for the result
1855+ stringstream ss(stringstream::in | stringstream::out);
1856+ ss << setprecision(3) << weather.temp.max;
1857+ ss << "°C to ";
1858+ ss << setprecision(3) << weather.temp.min;
1859+ ss << "°C";
1860+ res.set_title(ss.str());
1861+
1862+ // Set the rest of the attributes
1863+ res.set_art(weather.icon);
1864+ res["subtitle"] = weather.description;
1865+ res["description"] = "A description of the result";
1866+
1867+ // Push the result
1868+ if (!reply->push(res)) {
1869+ // If we fail to push, it means the query has been cancelled.
1870+ // So don't continue;
1871+ return;
1872+ }
1873+ }
1874+
1875+ } catch (domain_error &e) {
1876+ // Handle exceptions being thrown by the client API
1877+ cerr << e.what() << endl;
1878+ reply->error(current_exception());
1879+ }
1880+}
1881+@endif
1882
1883=== added file 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/src/scope/scope.cpp'
1884--- share/qtcreator/templates/wizards/ubuntu/scope-14.10/src/scope/scope.cpp 1970-01-01 00:00:00 +0000
1885+++ share/qtcreator/templates/wizards/ubuntu/scope-14.10/src/scope/scope.cpp 2015-06-11 10:48:39 +0000
1886@@ -0,0 +1,66 @@
1887+#include <scope/localization.h>
1888+#include <scope/preview.h>
1889+#include <scope/query.h>
1890+#include <scope/scope.h>
1891+
1892+#include <iostream>
1893+#include <sstream>
1894+#include <fstream>
1895+
1896+namespace sc = unity::scopes;
1897+using namespace std;
1898+using namespace api;
1899+using namespace scope;
1900+
1901+void Scope::start(string const&) {
1902+ config_ = make_shared<Config>();
1903+
1904+ setlocale(LC_ALL, "");
1905+ string translation_directory = ScopeBase::scope_directory()
1906+ + "/../share/locale/";
1907+ bindtextdomain(GETTEXT_PACKAGE, translation_directory.c_str());
1908+
1909+@if "%ContentType%".substring(0, "network".length) === "network"
1910+ // Under test we set a different API root
1911+ char *apiroot = getenv("NETWORK_SCOPE_APIROOT");
1912+ if (apiroot) {
1913+ config_->apiroot = apiroot;
1914+ }
1915+@endif
1916+}
1917+
1918+void Scope::stop() {
1919+}
1920+
1921+sc::SearchQueryBase::UPtr Scope::search(const sc::CannedQuery &query,
1922+ const sc::SearchMetadata &metadata) {
1923+ // Boilerplate construction of Query
1924+ return sc::SearchQueryBase::UPtr(new Query(query, metadata, config_));
1925+}
1926+
1927+sc::PreviewQueryBase::UPtr Scope::preview(sc::Result const& result,
1928+ sc::ActionMetadata const& metadata) {
1929+ // Boilerplate construction of Preview
1930+ return sc::PreviewQueryBase::UPtr(new Preview(result, metadata));
1931+}
1932+
1933+#define EXPORT __attribute__ ((visibility ("default")))
1934+
1935+// These functions define the entry points for the scope plugin
1936+extern "C" {
1937+
1938+EXPORT
1939+unity::scopes::ScopeBase*
1940+// cppcheck-suppress unusedFunction
1941+UNITY_SCOPE_CREATE_FUNCTION() {
1942+ return new Scope();
1943+}
1944+
1945+EXPORT
1946+void
1947+// cppcheck-suppress unusedFunction
1948+UNITY_SCOPE_DESTROY_FUNCTION(unity::scopes::ScopeBase* scope_base) {
1949+ delete scope_base;
1950+}
1951+
1952+}
1953
1954=== added directory 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests'
1955=== added file 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/CMakeLists.txt'
1956--- share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/CMakeLists.txt 1970-01-01 00:00:00 +0000
1957+++ share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/CMakeLists.txt 2015-06-11 10:48:39 +0000
1958@@ -0,0 +1,44 @@
1959+
1960+# Google Mock unfortunately has to be compiled from source
1961+include(FindGMock)
1962+
1963+@if "%ContentType%".substring(0, "network".length) === "network"
1964+# We need process-cpp to launch the python test server
1965+pkg_check_modules(
1966+ TEST
1967+ process-cpp
1968+ REQUIRED
1969+)
1970+@endif
1971+
1972+# Include our test library headers
1973+include_directories(
1974+ ${GTEST_INCLUDE_DIRS}
1975+ ${GMOCK_INCLUDE_DIRS}
1976+ ${TEST_INCLUDE_DIRS}
1977+)
1978+
1979+# Where to find the scope ini file and .so
1980+add_definitions(
1981+ -DTEST_SCOPE_DIRECTORY="${CMAKE_BINARY_DIR}/src"
1982+)
1983+
1984+@if "%ContentType%".substring(0, "network".length) === "network"
1985+file(GLOB_RECURSE
1986+ TEST_FIXTURES
1987+ "server/*"
1988+)
1989+
1990+# Make this file show up in QtCreator
1991+add_custom_target(hidden_test_fixtures ALL
1992+ SOURCES ${TEST_FIXTURES}
1993+)
1994+
1995+# Where to find the test server binary
1996+add_definitions(
1997+ -DFAKE_SERVER="${CMAKE_CURRENT_SOURCE_DIR}/server/server.py"
1998+)
1999+@endif
2000+
2001+# Add the unit tests
2002+add_subdirectory(unit)
2003
2004=== added directory 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/server'
2005=== added directory 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/server/forecast'
2006=== added directory 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/server/forecast/daily'
2007=== added file 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/server/forecast/daily/London,uk.json'
2008--- share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/server/forecast/daily/London,uk.json 1970-01-01 00:00:00 +0000
2009+++ share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/server/forecast/daily/London,uk.json 2015-06-11 10:48:39 +0000
2010@@ -0,0 +1,1 @@
2011+{"cod":"200","message":0.1117,"city":{"id":2643743,"name":"London","coord":{"lon":-0.12574,"lat":51.50853},"country":"GB","population":0,"sys":{"population":0}},"cnt":7,"list":[{"dt":1407412800,"temp":{"day":23.33,"min":18.84,"max":25.09,"night":18.84,"eve":24.17,"morn":20.76},"pressure":1018.23,"humidity":83,"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10d"}],"speed":1.87,"deg":295,"clouds":12,"rain":0.5},{"dt":1407499200,"temp":{"day":19.44,"min":15.54,"max":20.86,"night":15.54,"eve":18.28,"morn":16.21},"pressure":1010.57,"humidity":97,"weather":[{"id":501,"main":"Rain","description":"moderate rain","icon":"10d"}],"speed":4.01,"deg":143,"clouds":92,"rain":8},{"dt":1407585600,"temp":{"day":18.78,"min":13.19,"max":19.58,"night":13.19,"eve":18.95,"morn":14.03},"pressure":1010.78,"humidity":83,"weather":[{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03d"}],"speed":5.46,"deg":281,"clouds":32},{"dt":1407672000,"temp":{"day":18.09,"min":13.46,"max":18.09,"night":13.46,"eve":16.58,"morn":13.91},"pressure":1002.33,"humidity":67,"weather":[{"id":501,"main":"Rain","description":"moderate rain","icon":"10d"}],"speed":10.68,"deg":162,"clouds":92,"rain":4},{"dt":1407758400,"temp":{"day":17.38,"min":15.39,"max":17.38,"night":16.3,"eve":17.03,"morn":15.39},"pressure":1008.2,"humidity":0,"weather":[{"id":502,"main":"Rain","description":"heavy intensity rain","icon":"10d"}],"speed":13.52,"deg":245,"clouds":74,"rain":12.63},{"dt":1407844800,"temp":{"day":18.44,"min":16.17,"max":18.44,"night":16.83,"eve":18.02,"morn":16.17},"pressure":1009.94,"humidity":0,"weather":[{"id":501,"main":"Rain","description":"moderate rain","icon":"10d"}],"speed":10.93,"deg":251,"clouds":60,"rain":5.25},{"dt":1407931200,"temp":{"day":18.8,"min":16.67,"max":19.02,"night":16.77,"eve":19.02,"morn":16.67},"pressure":1013.17,"humidity":0,"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10d"}],"speed":9.88,"deg":275,"clouds":85,"rain":1.35}]}
2012
2013=== added file 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/server/forecast/daily/London,uk.xml'
2014--- share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/server/forecast/daily/London,uk.xml 1970-01-01 00:00:00 +0000
2015+++ share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/server/forecast/daily/London,uk.xml 2015-06-11 10:48:39 +0000
2016@@ -0,0 +1,89 @@
2017+<?xml version="1.0" encoding="utf-8"?>
2018+<weatherdata>
2019+ <location>
2020+ <name>London</name>
2021+ <type/>
2022+ <country>GB</country>
2023+ <timezone/>
2024+ <location altitude="0" latitude="51.50853" longitude="-0.12574" geobase="geonames" geobaseid="0"/>
2025+ </location>
2026+ <credit/>
2027+ <meta>
2028+ <lastupdate/>
2029+ <calctime>0.1469</calctime>
2030+ <nextupdate/>
2031+ </meta>
2032+ <sun rise="2014-10-29T06:49:36" set="2014-10-29T16:38:47"/>
2033+ <forecast>
2034+ <time day="2014-10-29">
2035+ <symbol number="500" name="light rain" var="10d"/>
2036+ <precipitation value="2" type="rain"/>
2037+ <windDirection deg="54" code="NE" name="NorthEast"/>
2038+ <windSpeed mps="4.21" name="Gentle Breeze"/>
2039+ <temperature day="23.33" min="18.84" max="25.09" night="18.84" eve="24.17" morn="20.76"/>
2040+ <pressure unit="hPa" value="1020.35"/>
2041+ <humidity value="98" unit="%"/>
2042+ <clouds value="overcast clouds" all="92" unit="%"/>
2043+ </time>
2044+ <time day="2014-10-30">
2045+ <symbol number="500" name="moderate rain" var="10d"/>
2046+ <precipitation value="0.29" type="rain"/>
2047+ <windDirection deg="202" code="SSW" name="South-southwest"/>
2048+ <windSpeed mps="4.28" name="Gentle Breeze"/>
2049+ <temperature day="19.44" min="15.54" max="20.86" night="15.54" eve="18.28" morn="16.21"/>
2050+ <pressure unit="hPa" value="1010.57"/>
2051+ <humidity value="97" unit="%"/>
2052+ <clouds value="clear sky" all="5" unit="%"/>
2053+ </time>
2054+ <time day="2014-10-31">
2055+ <symbol number="802" name="scattered clouds" var="03d"/>
2056+ <precipitation/>
2057+ <windDirection deg="168" code="SSE" name="South-southeast"/>
2058+ <windSpeed mps="5.63" name="Moderate breeze"/>
2059+ <temperature day="18.78" min="13.19" max="19.58" night="13.19" eve="18.95" morn="14.03"/>
2060+ <pressure unit="hPa" value="1010.78"/>
2061+ <humidity value="83" unit="%"/>
2062+ <clouds value="few clouds" all="13" unit="%"/>
2063+ </time>
2064+ <time day="2014-11-01">
2065+ <symbol number="501" name="moderate rain" var="10d"/>
2066+ <precipitation value="0.61" type="rain"/>
2067+ <windDirection deg="198" code="SSW" name="South-southwest"/>
2068+ <windSpeed mps="7.49" name="Moderate breeze"/>
2069+ <temperature day="18.09" min="13.46" max="18.09" night="13.46" eve="16.58" morn="13.91"/>
2070+ <pressure unit="hPa" value="1002.33"/>
2071+ <humidity value="67" unit="%"/>
2072+ <clouds value="scattered clouds" all="40" unit="%"/>
2073+ </time>
2074+ <time day="2014-11-02">
2075+ <symbol number="502" name="heavy intensity rain" var="10d"/>
2076+ <precipitation value="2.44" type="rain"/>
2077+ <windDirection deg="169" code="S" name="South"/>
2078+ <windSpeed mps="9.31" name="Fresh Breeze"/>
2079+ <temperature day="17.38" min="15.39" max="17.38" night="16.3" eve="17.03" morn="15.39"/>
2080+ <pressure unit="hPa" value="1008.2"/>
2081+ <humidity value="0" unit="%"/>
2082+ <clouds value="clear sky" all="9" unit="%"/>
2083+ </time>
2084+ <time day="2014-11-03">
2085+ <symbol number="501" name="moderate rain" var="10d"/>
2086+ <precipitation value="6.61" type="rain"/>
2087+ <windDirection deg="158" code="SSE" name="South-southeast"/>
2088+ <windSpeed mps="5.53" name="Moderate breeze"/>
2089+ <temperature day="18.44" min="16.17" max="18.44" night="16.83" eve="18.02" morn="16.17"/>
2090+ <pressure unit="hPa" value="1009.94"/>
2091+ <humidity value="0" unit="%"/>
2092+ <clouds value="overcast clouds" all="90" unit="%"/>
2093+ </time>
2094+ <time day="2014-11-04">
2095+ <symbol number="500" name="light rain" var="10d"/>
2096+ <precipitation value="0.5" type="rain"/>
2097+ <windDirection deg="296" code="WNW" name="West-northwest"/>
2098+ <windSpeed mps="5.03" name="Gentle Breeze"/>
2099+ <temperature day="18.8" min="16.67" max="19.02" night="16.77" eve="19.02" morn="16.67"/>
2100+ <pressure unit="hPa" value="1013.17"/>
2101+ <humidity value="0" unit="%"/>
2102+ <clouds value="broken clouds" all="75" unit="%"/>
2103+ </time>
2104+ </forecast>
2105+</weatherdata>
2106\ No newline at end of file
2107
2108=== added file 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/server/forecast/daily/Manchester,uk.json'
2109--- share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/server/forecast/daily/Manchester,uk.json 1970-01-01 00:00:00 +0000
2110+++ share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/server/forecast/daily/Manchester,uk.json 2015-06-11 10:48:39 +0000
2111@@ -0,0 +1,1 @@
2112+{"cod":"200","message":0.0056,"city":{"id":2643123,"name":"Manchester","coord":{"lon":-2.23743,"lat":53.480949},"country":"GB","population":0,"sys":{"population":0}},"cnt":7,"list":[{"dt":1407412800,"temp":{"day":17.91,"min":11.96,"max":18.83,"night":11.96,"eve":18.01,"morn":16.13},"pressure":1014.82,"humidity":77,"weather":[{"id":800,"main":"Clear","description":"sky is clear","icon":"01d"}],"speed":3.32,"deg":303,"clouds":0},{"dt":1407499200,"temp":{"day":18.59,"min":12.33,"max":18.59,"night":12.33,"eve":14.55,"morn":14.69},"pressure":1008.22,"humidity":79,"weather":[{"id":501,"main":"Rain","description":"moderate rain","icon":"10d"}],"speed":3.46,"deg":163,"clouds":92,"rain":11},{"dt":1407585600,"temp":{"day":15.8,"min":10.79,"max":17.11,"night":10.79,"eve":16.89,"morn":13.19},"pressure":1005.76,"humidity":92,"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],"speed":5.61,"deg":279,"clouds":56},{"dt":1407672000,"temp":{"day":15.29,"min":12.21,"max":15.98,"night":12.41,"eve":15.98,"morn":12.21},"pressure":995.36,"humidity":95,"weather":[{"id":501,"main":"Rain","description":"moderate rain","icon":"10d"}],"speed":10.75,"deg":137,"clouds":92,"rain":5},{"dt":1407758400,"temp":{"day":15.73,"min":12.99,"max":15.73,"night":13.8,"eve":15.23,"morn":12.99},"pressure":990.16,"humidity":0,"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10d"}],"speed":9.02,"deg":239,"clouds":99,"rain":1.15},{"dt":1407844800,"temp":{"day":17.64,"min":14.08,"max":17.64,"night":14.08,"eve":14.92,"morn":14.12},"pressure":992.52,"humidity":0,"weather":[{"id":501,"main":"Rain","description":"moderate rain","icon":"10d"}],"speed":10.36,"deg":240,"clouds":45,"rain":4.84},{"dt":1407931200,"temp":{"day":14.35,"min":13.37,"max":15.52,"night":13.77,"eve":15.52,"morn":13.37},"pressure":999.39,"humidity":0,"weather":[{"id":501,"main":"Rain","description":"moderate rain","icon":"10d"}],"speed":7.79,"deg":285,"clouds":92,"rain":5.98}]}
2113
2114=== added file 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/server/forecast/daily/Manchester,uk.xml'
2115--- share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/server/forecast/daily/Manchester,uk.xml 1970-01-01 00:00:00 +0000
2116+++ share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/server/forecast/daily/Manchester,uk.xml 2015-06-11 10:48:39 +0000
2117@@ -0,0 +1,89 @@
2118+<?xml version="1.0" encoding="utf-8"?>
2119+<weatherdata>
2120+ <location>
2121+ <name>Manchester</name>
2122+ <type/>
2123+ <country>GB</country>
2124+ <timezone/>
2125+ <location altitude="0" latitude="53.480949" longitude="-2.23743" geobase="geonames" geobaseid="0"/>
2126+ </location>
2127+ <credit/>
2128+ <meta>
2129+ <lastupdate/>
2130+ <calctime>0.0021</calctime>
2131+ <nextupdate/>
2132+ </meta>
2133+ <sun rise="2014-10-29T07:03:13" set="2014-10-29T16:42:04"/>
2134+ <forecast>
2135+ <time day="2014-10-29">
2136+ <symbol number="800" name="sky is clear" var="01d"/>
2137+ <precipitation value="1" type="rain"/>
2138+ <windDirection deg="113" code="ESE" name="East-southeast"/>
2139+ <windSpeed mps="3.86" name="Gentle Breeze"/>
2140+ <temperature day="17.91" min="11.96" max="18.83" night="11.96" eve="18.01" morn="16.13"/>
2141+ <pressure unit="hPa" value="1017.53"/>
2142+ <humidity value="92" unit="%"/>
2143+ <clouds value="broken clouds" all="80" unit="%"/>
2144+ </time>
2145+ <time day="2014-10-30">
2146+ <symbol number="501" name="moderate rain" var="10d"/>
2147+ <precipitation/>
2148+ <windDirection deg="182" code="S" name="South"/>
2149+ <windSpeed mps="5.01" name="Gentle Breeze"/>
2150+ <temperature day="18.59" min="12.33" max="18.59" night="12.33" eve="14.55" morn="14.69"/>
2151+ <pressure unit="hPa" value="1014.33"/>
2152+ <humidity value="97" unit="%"/>
2153+ <clouds value="overcast clouds" all="88" unit="%"/>
2154+ </time>
2155+ <time day="2014-10-31">
2156+ <symbol number="803" name="broken clouds" var="04d"/>
2157+ <precipitation value="1" type="rain"/>
2158+ <windDirection deg="178" code="S" name="South"/>
2159+ <windSpeed mps="7.01" name="Moderate breeze"/>
2160+ <temperature day="15.8" min="10.79" max="17.11" night="10.79" eve="16.89" morn="13.19"/>
2161+ <pressure unit="hPa" value="1012.52"/>
2162+ <humidity value="90" unit="%"/>
2163+ <clouds value="scattered clouds" all="36" unit="%"/>
2164+ </time>
2165+ <time day="2014-11-01">
2166+ <symbol number="501" name="moderate rain" var="10d"/>
2167+ <precipitation value="4" type="rain"/>
2168+ <windDirection deg="209" code="SSW" name="South-southwest"/>
2169+ <windSpeed mps="6.22" name="Moderate breeze"/>
2170+ <temperature day="15.29" min="12.21" max="15.98" night="12.41" eve="15.98" morn="12.21"/>
2171+ <pressure unit="hPa" value="1009.17"/>
2172+ <humidity value="97" unit="%"/>
2173+ <clouds value="overcast clouds" all="88" unit="%"/>
2174+ </time>
2175+ <time day="2014-11-02">
2176+ <symbol number="500" name="light rain" var="10d"/>
2177+ <precipitation value="8.18" type="rain"/>
2178+ <windDirection deg="166" code="SSE" name="South-southeast"/>
2179+ <windSpeed mps="9.75" name="Fresh Breeze"/>
2180+ <temperature day="15.73" min="12.99" max="15.73" night="13.8" eve="15.23" morn="12.99"/>
2181+ <pressure unit="hPa" value="997.47"/>
2182+ <humidity value="0" unit="%"/>
2183+ <clouds value="broken clouds" all="77" unit="%"/>
2184+ </time>
2185+ <time day="2014-11-03">
2186+ <symbol number="501" name="moderate rain" var="10d"/>
2187+ <precipitation value="17.57" type="rain"/>
2188+ <windDirection deg="349" code="" name=""/>
2189+ <windSpeed mps="1.66" name="Light breeze"/>
2190+ <temperature day="17.64" min="14.08" max="17.64" night="14.08" eve="14.92" morn="14.12"/>
2191+ <pressure unit="hPa" value="992"/>
2192+ <humidity value="0" unit="%"/>
2193+ <clouds value="overcast clouds" all="97" unit="%"/>
2194+ </time>
2195+ <time day="2014-11-04">
2196+ <symbol number="501" name="moderate rain" var="10d"/>
2197+ <precipitation/>
2198+ <windDirection deg="319" code="NW" name="Northwest"/>
2199+ <windSpeed mps="5.38" name="Gentle Breeze"/>
2200+ <temperature day="14.35" min="13.37" max="15.52" night="13.77" eve="15.52" morn="13.37"/>
2201+ <pressure unit="hPa" value="994.59"/>
2202+ <humidity value="0" unit="%"/>
2203+ <clouds value="broken clouds" all="56" unit="%"/>
2204+ </time>
2205+ </forecast>
2206+</weatherdata>
2207
2208=== added file 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/server/server.py'
2209--- share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/server/server.py 1970-01-01 00:00:00 +0000
2210+++ share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/server/server.py 2015-06-11 10:48:39 +0000
2211@@ -0,0 +1,62 @@
2212+#!/usr/bin/env python3
2213+
2214+import http.server
2215+import os
2216+import socketserver
2217+import sys
2218+from urllib.parse import urlparse,parse_qs
2219+
2220+def read_file(path):
2221+ file = os.path.join(os.path.dirname(__file__), path)
2222+ if os.path.isfile(file):
2223+ with open(file, 'r') as fp:
2224+ content = fp.read()
2225+ else:
2226+ content = ''
2227+
2228+ return content
2229+
2230+class MyRequestHandler(http.server.BaseHTTPRequestHandler):
2231+ def do_GET(self):
2232+ sys.stderr.write("GET: %s\n" % self.path)
2233+ sys.stderr.flush()
2234+
2235+ parse = urlparse(self.path)
2236+ path = parse.path
2237+ query = parse_qs(parse.query)
2238+
2239+ if path == '/data/2.5/weather':
2240+ self.send_response(200)
2241+ self.send_header("Content-type", "text/html")
2242+ self.end_headers()
2243+
2244+ mode = 'json'
2245+ if 'mode' in query:
2246+ mode = query['mode'][0]
2247+
2248+ self.wfile.write(bytes(read_file('weather/%s.%s' % (query['q'][0], mode)), 'UTF-8'))
2249+ elif path == '/data/2.5/forecast/daily':
2250+ self.send_response(200)
2251+ self.send_header("Content-type", "text/html")
2252+ self.end_headers()
2253+
2254+ mode = 'json'
2255+ if 'mode' in query:
2256+ mode = query['mode'][0]
2257+
2258+ self.wfile.write(bytes(read_file('forecast/daily/%s.%s' % (query['q'][0], mode)), 'UTF-8'))
2259+ else:
2260+ self.send_response(404)
2261+ self.send_header("Content-type", "text/html")
2262+ self.end_headers()
2263+ self.wfile.write(bytes('ERROR', 'UTF-8'))
2264+
2265+if __name__ == "__main__":
2266+ Handler = MyRequestHandler
2267+ httpd = socketserver.TCPServer(("127.0.0.1", 0), Handler)
2268+
2269+ sys.stdout.write('%d\n' % httpd.server_address[1])
2270+ sys.stdout.flush()
2271+
2272+ httpd.serve_forever()
2273+
2274
2275=== added directory 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/server/weather'
2276=== added file 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/server/weather/London,uk.json'
2277--- share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/server/weather/London,uk.json 1970-01-01 00:00:00 +0000
2278+++ share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/server/weather/London,uk.json 2015-06-11 10:48:39 +0000
2279@@ -0,0 +1,1 @@
2280+{"coord":{"lon":-0.13,"lat":51.51},"sys":{"type":1,"id":5091,"message":0.29,"country":"GB","sunrise":1407386057,"sunset":1407440289},"weather":[{"id":801,"main":"Clouds","description":"few clouds","icon":"02d"}],"base":"cmc stations","main":{"temp":21.83,"pressure":1014,"humidity":53,"temp_min":20,"temp_max":24},"wind":{"speed":1.5,"deg":0},"clouds":{"all":20},"dt":1407408276,"id":2643743,"name":"London","cod":200}
2281\ No newline at end of file
2282
2283=== added file 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/server/weather/London,uk.xml'
2284--- share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/server/weather/London,uk.xml 1970-01-01 00:00:00 +0000
2285+++ share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/server/weather/London,uk.xml 2015-06-11 10:48:39 +0000
2286@@ -0,0 +1,20 @@
2287+<?xml version="1.0" encoding="utf-8"?>
2288+<current>
2289+ <city id="2643743" name="London">
2290+ <coord lon="-0.13" lat="51.51"/>
2291+ <country>GB</country>
2292+ <sun rise="2014-10-29T06:49:37" set="2014-10-29T16:38:47"/>
2293+ </city>
2294+ <temperature value="21.83" min="20" max="24" unit="celsius"/>
2295+ <humidity value="53" unit="%"/>
2296+ <pressure value="1017" unit="hPa"/>
2297+ <wind>
2298+ <speed value="3.6" name="Gentle Breeze"/>
2299+ <direction value="90" code="E" name="East"/>
2300+ </wind>
2301+ <clouds value="75" name="broken clouds"/>
2302+ <visibility/>
2303+ <precipitation mode="no"/>
2304+ <weather number="801" value="few clouds" icon="02d"/>
2305+ <lastupdate value="2014-10-29T13:37:25"/>
2306+</current>
2307\ No newline at end of file
2308
2309=== added file 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/server/weather/Manchester,uk.json'
2310--- share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/server/weather/Manchester,uk.json 1970-01-01 00:00:00 +0000
2311+++ share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/server/weather/Manchester,uk.json 2015-06-11 10:48:39 +0000
2312@@ -0,0 +1,1 @@
2313+{"coord":{"lon":-2.24,"lat":53.48},"sys":{"type":1,"id":5060,"message":0.2423,"country":"GB","sunrise":1407386141,"sunset":1407441219},"weather":[{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03d"}],"base":"cmc stations","main":{"temp":17.35,"pressure":1016,"humidity":77,"temp_min":17,"temp_max":18},"wind":{"speed":2.6,"deg":20,"var_beg":330,"var_end":80},"clouds":{"all":40},"dt":1407408600,"id":2643123,"name":"Manchester","cod":200}
2314
2315=== added file 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/server/weather/Manchester,uk.xml'
2316--- share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/server/weather/Manchester,uk.xml 1970-01-01 00:00:00 +0000
2317+++ share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/server/weather/Manchester,uk.xml 2015-06-11 10:48:39 +0000
2318@@ -0,0 +1,20 @@
2319+<?xml version="1.0" encoding="utf-8"?>
2320+<current>
2321+<city id="2643123" name="Manchester">
2322+<coord lon="-2.24" lat="53.48"/>
2323+<country>GB</country>
2324+<sun rise="2014-10-29T07:03:13" set="2014-10-29T16:42:04"/>
2325+</city>
2326+<temperature value="17.35" min="17" max="18" unit="celsius"/>
2327+<humidity value="77" unit="%"/>
2328+<pressure value="1016" unit="hPa"/>
2329+<wind>
2330+<speed value="3.6" name="Gentle Breeze"/>
2331+<direction value="110" code="ESE" name="East-southeast"/>
2332+</wind>
2333+<clouds value="75" name="broken clouds"/>
2334+<visibility/>
2335+<precipitation mode="no"/>
2336+<weather number="802" value="scattered clouds" icon="03d"/>
2337+<lastupdate value="2014-10-29T15:59:18"/>
2338+</current>
2339\ No newline at end of file
2340
2341=== added directory 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/unit'
2342=== added file 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/unit/CMakeLists.txt'
2343--- share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/unit/CMakeLists.txt 1970-01-01 00:00:00 +0000
2344+++ share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/unit/CMakeLists.txt 2015-06-11 10:48:39 +0000
2345@@ -0,0 +1,31 @@
2346+
2347+# Our test executable.
2348+# It includes the object code from the scope
2349+add_executable(
2350+ scope-unit-tests
2351+ scope/test-scope.cpp
2352+ $<TARGET_OBJECTS:scope-static>
2353+)
2354+
2355+# Link against the scope, and all of our test lib dependencies
2356+target_link_libraries(
2357+ scope-unit-tests
2358+ ${GTEST_BOTH_LIBRARIES}
2359+ ${GMOCK_LIBRARIES}
2360+ ${SCOPE_LDFLAGS}
2361+ ${TEST_LDFLAGS}
2362+ ${Boost_LIBRARIES}
2363+)
2364+
2365+@if "%ContentType%".substring(0, "network-netcpp-q".length) === "network-netcpp-q"
2366+qt5_use_modules(
2367+ scope-unit-tests
2368+ Core
2369+)
2370+@endif
2371+
2372+# Register the test with CTest
2373+add_test(
2374+ scope-unit-tests
2375+ scope-unit-tests
2376+)
2377
2378=== added directory 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/unit/scope'
2379=== added file 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/unit/scope/test-scope.cpp'
2380--- share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/unit/scope/test-scope.cpp 1970-01-01 00:00:00 +0000
2381+++ share/qtcreator/templates/wizards/ubuntu/scope-14.10/tests/unit/scope/test-scope.cpp 2015-06-11 10:48:39 +0000
2382@@ -0,0 +1,232 @@
2383+#include <scope/scope.h>
2384+
2385+#include <core/posix/exec.h>
2386+#include <gtest/gtest.h>
2387+#include <gmock/gmock.h>
2388+#include <string>
2389+#include <unity/scopes/SearchReply.h>
2390+#include <unity/scopes/SearchReplyProxyFwd.h>
2391+#include <unity/scopes/Variant.h>
2392+#include <unity/scopes/testing/Category.h>
2393+#include <unity/scopes/testing/MockSearchReply.h>
2394+#include <unity/scopes/testing/TypedScopeFixture.h>
2395+
2396+using namespace std;
2397+using namespace testing;
2398+using namespace scope;
2399+
2400+namespace posix = core::posix;
2401+namespace sc = unity::scopes;
2402+namespace sct = unity::scopes::testing;
2403+
2404+/**
2405+ * Keep the tests in an anonymous namespace
2406+ */
2407+namespace {
2408+
2409+/**
2410+ * Custom matcher to check the properties of search results
2411+ */
2412+MATCHER_P2(ResultProp, prop, value, "") {
2413+ if (arg.contains(prop)) {
2414+ *result_listener << "result[" << prop << "] is " << arg[prop].serialize_json();
2415+ } else {
2416+ *result_listener << "result[" << prop << "] is not set";
2417+ }
2418+ return arg.contains(prop) && arg[prop] == sc::Variant(value);
2419+}
2420+
2421+/**
2422+ * Custom matcher to check the presence of departments
2423+ */
2424+MATCHER_P(IsDepartment, department, "") {
2425+ return arg->serialize() == department->serialize();
2426+}
2427+
2428+typedef sct::TypedScopeFixture<Scope> TypedScopeFixtureScope;
2429+
2430+class TestScope: public TypedScopeFixtureScope {
2431+protected:
2432+@if "%ContentType%".substring(0, "network".length) === "network"
2433+ void SetUp() override
2434+ {
2435+ // Start up Python-based fake OpenWeatherMap server
2436+ fake_server_ = posix::exec("/usr/bin/python3", { FAKE_SERVER }, { },
2437+ posix::StandardStream::stdout);
2438+
2439+ // Check it's running
2440+ ASSERT_GT(fake_server_.pid(), 0);
2441+ string port;
2442+ // The server will print out the random port it is using
2443+ fake_server_.cout() >> port;
2444+ // Check we have a port
2445+ ASSERT_FALSE(port.empty());
2446+
2447+ // Build up the API root
2448+ string apiroot = "http://127.0.0.1:" + port;
2449+ // Override the API root that the scope will use
2450+ setenv("NETWORK_SCOPE_APIROOT", apiroot.c_str(), true);
2451+
2452+ // Do the parent SetUp
2453+ TypedScopeFixture::set_scope_directory(TEST_SCOPE_DIRECTORY);
2454+ TypedScopeFixtureScope::SetUp();
2455+ }
2456+
2457+ /**
2458+ * Start by assuming the server is invalid
2459+ */
2460+ posix::ChildProcess fake_server_ = posix::ChildProcess::invalid();
2461+ @endif
2462+};
2463+
2464+TEST_F(TestScope, empty_search_string) {
2465+@if "%ContentType%".substring(0, "network".length) === "network"
2466+ const sc::CategoryRenderer renderer;
2467+ NiceMock<sct::MockSearchReply> reply;
2468+
2469+ // Build a query with an empty search string
2470+ sc::CannedQuery query(SCOPE_NAME, "", "");
2471+
2472+ // Expect the current weather category
2473+ EXPECT_CALL(reply, register_category("current", "London, GB", "", _)).Times(1)
2474+ .WillOnce(Return(make_shared<sct::Category>("current", "London, GB", "", renderer)));
2475+
2476+ // With one result
2477+ EXPECT_CALL(reply, push(Matcher<sc::CategorisedResult const&>(AllOf(
2478+ ResultProp("title", "21.8°C"),
2479+ ResultProp("art", "http://openweathermap.org/img/w/02d.png"),
2480+ ResultProp("subtitle", "few clouds")
2481+ )))).WillOnce(
2482+ Return(true));
2483+
2484+ // Expect the forecast category
2485+ EXPECT_CALL(reply, register_category("forecast", "7 day forecast", "", _)).Times(1)
2486+ .WillOnce(Return(make_shared<sct::Category>("forecast", "7 day forecast", "", renderer)));
2487+
2488+ // With seven results
2489+ EXPECT_CALL(reply, push(Matcher<sc::CategorisedResult const&>(AllOf(
2490+ ResultProp("title", "25.1°C to 18.8°C"),
2491+ ResultProp("art", "http://openweathermap.org/img/w/10d.png"),
2492+ ResultProp("subtitle", "light rain")
2493+ )))).WillOnce(Return(true));
2494+ EXPECT_CALL(reply, push(Matcher<sc::CategorisedResult const&>(AllOf(
2495+ ResultProp("title", "20.9°C to 15.5°C"),
2496+ ResultProp("art", "http://openweathermap.org/img/w/10d.png"),
2497+ ResultProp("subtitle", "moderate rain")
2498+ )))).WillOnce(Return(true));
2499+ EXPECT_CALL(reply, push(Matcher<sc::CategorisedResult const&>(AllOf(
2500+ ResultProp("title", "19.6°C to 13.2°C"),
2501+ ResultProp("art", "http://openweathermap.org/img/w/03d.png"),
2502+ ResultProp("subtitle", "scattered clouds")
2503+ )))).WillOnce(Return(true));
2504+ EXPECT_CALL(reply, push(Matcher<sc::CategorisedResult const&>(AllOf(
2505+ ResultProp("title", "18.1°C to 13.5°C"),
2506+ ResultProp("art", "http://openweathermap.org/img/w/10d.png"),
2507+ ResultProp("subtitle", "moderate rain")
2508+ )))).WillOnce(Return(true));
2509+ EXPECT_CALL(reply, push(Matcher<sc::CategorisedResult const&>(AllOf(
2510+ ResultProp("title", "17.4°C to 15.4°C"),
2511+ ResultProp("art", "http://openweathermap.org/img/w/10d.png"),
2512+ ResultProp("subtitle", "heavy intensity rain")
2513+ )))).WillOnce(Return(true));
2514+ EXPECT_CALL(reply, push(Matcher<sc::CategorisedResult const&>(AllOf(
2515+ ResultProp("title", "18.4°C to 16.2°C"),
2516+ ResultProp("art", "http://openweathermap.org/img/w/10d.png"),
2517+ ResultProp("subtitle", "moderate rain")
2518+ )))).WillOnce(Return(true));
2519+ EXPECT_CALL(reply, push(Matcher<sc::CategorisedResult const&>(AllOf(
2520+ ResultProp("title", "19°C to 16.7°C"),
2521+ ResultProp("art", "http://openweathermap.org/img/w/10d.png"),
2522+ ResultProp("subtitle", "light rain")
2523+ )))).WillOnce(Return(true));
2524+
2525+ sc::SearchReplyProxy reply_proxy(&reply, [](sc::SearchReply*) {}); // note: this is a std::shared_ptr with empty deleter
2526+ sc::SearchMetadata meta_data("en_EN", "phone");
2527+
2528+ // Create a query object
2529+ auto search_query = scope->search(query, meta_data);
2530+ ASSERT_NE(nullptr, search_query);
2531+
2532+ // Run the search
2533+ search_query->run(reply_proxy);
2534+
2535+ // Google Mock will make assertions when the mocks are destructed.
2536+@endif
2537+}
2538+
2539+TEST_F(TestScope, search) {
2540+@if "%ContentType%".substring(0, "network".length) === "network"
2541+ const sc::CategoryRenderer renderer;
2542+ NiceMock<sct::MockSearchReply> reply;
2543+
2544+ // Build a query with a non-empty search string
2545+ sc::CannedQuery query(SCOPE_NAME, "Manchester,uk", "");
2546+
2547+ // Expect the current weather category
2548+ EXPECT_CALL(reply, register_category("current", "Manchester, GB", "", _)).Times(1)
2549+ .WillOnce(Return(make_shared<sct::Category>("current", "Manchester, GB", "", renderer)));
2550+
2551+ // With one result
2552+ EXPECT_CALL(reply, push(Matcher<sc::CategorisedResult const&>(AllOf(
2553+ ResultProp("title", "17.4°C"),
2554+ ResultProp("art", "http://openweathermap.org/img/w/03d.png"),
2555+ ResultProp("subtitle", "scattered clouds")
2556+ )))).WillOnce(
2557+ Return(true));
2558+
2559+ // Expect the forecast category
2560+ EXPECT_CALL(reply, register_category("forecast", "7 day forecast", "", _)).Times(1)
2561+ .WillOnce(Return(make_shared<sct::Category>("forecast", "7 day forecast", "", renderer)));
2562+
2563+ // With seven results
2564+ EXPECT_CALL(reply, push(Matcher<sc::CategorisedResult const&>(AllOf(
2565+ ResultProp("title", "18.8°C to 12°C"),
2566+ ResultProp("art", "http://openweathermap.org/img/w/01d.png"),
2567+ ResultProp("subtitle", "sky is clear")
2568+ )))).WillOnce(Return(true));
2569+ EXPECT_CALL(reply, push(Matcher<sc::CategorisedResult const&>(AllOf(
2570+ ResultProp("title", "18.6°C to 12.3°C"),
2571+ ResultProp("art", "http://openweathermap.org/img/w/10d.png"),
2572+ ResultProp("subtitle", "moderate rain")
2573+ )))).WillOnce(Return(true));
2574+ EXPECT_CALL(reply, push(Matcher<sc::CategorisedResult const&>(AllOf(
2575+ ResultProp("title", "17.1°C to 10.8°C"),
2576+ ResultProp("art", "http://openweathermap.org/img/w/04d.png"),
2577+ ResultProp("subtitle", "broken clouds")
2578+ )))).WillOnce(Return(true));
2579+ EXPECT_CALL(reply, push(Matcher<sc::CategorisedResult const&>(AllOf(
2580+ ResultProp("title", "16°C to 12.2°C"),
2581+ ResultProp("art", "http://openweathermap.org/img/w/10d.png"),
2582+ ResultProp("subtitle", "moderate rain")
2583+ )))).WillOnce(Return(true));
2584+ EXPECT_CALL(reply, push(Matcher<sc::CategorisedResult const&>(AllOf(
2585+ ResultProp("title", "15.7°C to 13°C"),
2586+ ResultProp("art", "http://openweathermap.org/img/w/10d.png"),
2587+ ResultProp("subtitle", "light rain")
2588+ )))).WillOnce(Return(true));
2589+ EXPECT_CALL(reply, push(Matcher<sc::CategorisedResult const&>(AllOf(
2590+ ResultProp("title", "17.6°C to 14.1°C"),
2591+ ResultProp("art", "http://openweathermap.org/img/w/10d.png"),
2592+ ResultProp("subtitle", "moderate rain")
2593+ )))).WillOnce(Return(true));
2594+ EXPECT_CALL(reply, push(Matcher<sc::CategorisedResult const&>(AllOf(
2595+ ResultProp("title", "15.5°C to 13.4°C"),
2596+ ResultProp("art", "http://openweathermap.org/img/w/10d.png"),
2597+ ResultProp("subtitle", "moderate rain")
2598+ )))).WillOnce(Return(true));
2599+
2600+ sc::SearchReplyProxy reply_proxy(&reply, [](sc::SearchReply*) {}); // note: this is a std::shared_ptr with empty deleter
2601+ sc::SearchMetadata meta_data("en_EN", "phone");
2602+
2603+ // Create a query object
2604+ auto search_query = scope->search(query, meta_data);
2605+ ASSERT_NE(nullptr, search_query);
2606+
2607+ // Run the search
2608+ search_query->run(reply_proxy);
2609+
2610+ // Google Mock will make assertions when the mocks are destructed.
2611+@endif
2612+}
2613+
2614+} // namespace
2615
2616=== added file 'share/qtcreator/templates/wizards/ubuntu/scope-14.10/wizard.xml'
2617--- share/qtcreator/templates/wizards/ubuntu/scope-14.10/wizard.xml 1970-01-01 00:00:00 +0000
2618+++ share/qtcreator/templates/wizards/ubuntu/scope-14.10/wizard.xml 2015-06-11 10:48:39 +0000
2619@@ -0,0 +1,127 @@
2620+<?xml version="1.0" encoding="UTF-8"?>
2621+<wizard version="1" kind="project" firstpage="10" id="C_UbuntuUnityScope" category="A.UbuntuProject"
2622+ platformIndependent="true"
2623+ class="ubuntu-project-cmake"
2624+ featuresRequired=""
2625+ >
2626+ <icon>../share/ubuntu.png</icon>
2627+ <description>A simple C++ based Unity Scope</description>
2628+ <displayname>Unity Scope (14.10)</displayname>
2629+ <displaycategory>Ubuntu</displaycategory>
2630+ <files>
2631+ <file source="cmake/FindGMock.cmake"/>
2632+ <file source="cmake/FindIntltool.cmake"/>
2633+
2634+ <file source="data/CMakeLists.txt"/>
2635+ <file source="data/displayName.ini.in" target="data/%ProjectName:l%.%ClickDomain:l%_%ClickHookName:l%.ini.in"/>
2636+ <file source="data/icon.png" binary="true"/>
2637+ <file source="data/logo.png" binary="true"/>
2638+ <file source="data/screenshot.png" binary="true"/>
2639+
2640+ <file source="include/api/config.h"/>
2641+ <file source="include/api/client.h"/>
2642+ <file source="include/scope/localization.h"/>
2643+ <file source="include/scope/preview.h"/>
2644+ <file source="include/scope/query.h"/>
2645+ <file source="include/scope/scope.h"/>
2646+
2647+ <file source="src/CMakeLists.txt"/>
2648+ <file source="src/api/client.cpp"/>
2649+ <file source="src/scope/query.cpp"/>
2650+ <file source="src/scope/scope.cpp" openeditor="true"/>
2651+ <file source="src/scope/preview.cpp"/>
2652+
2653+ <file source="po/CMakeLists.txt"/>
2654+ <file source="po/displayName.pot" target="po/%ProjectName:l%.pot"/>
2655+ <file source="po/Makefile.in.in"/>
2656+ <file source="po/POTFILES.in"/>
2657+
2658+ <file source="tests/server/forecast/daily/Manchester,uk.json"/>
2659+ <file source="tests/server/forecast/daily/Manchester,uk.xml"/>
2660+ <file source="tests/server/forecast/daily/London,uk.json"/>
2661+ <file source="tests/server/forecast/daily/London,uk.xml"/>
2662+ <file source="tests/server/weather/Manchester,uk.json"/>
2663+ <file source="tests/server/weather/Manchester,uk.xml"/>
2664+ <file source="tests/server/weather/London,uk.json"/>
2665+ <file source="tests/server/weather/London,uk.xml"/>
2666+ <file source="tests/server/server.py"/>
2667+ <file source="tests/CMakeLists.txt"/>
2668+ <file source="tests/unit/CMakeLists.txt"/>
2669+ <file source="tests/unit/scope/test-scope.cpp"/>
2670+
2671+ <file source="CMakeLists.txt" openproject="true"/>
2672+ <file source="displayName.apparmor" target="%ClickHookName:l%.apparmor"/>
2673+ <file source="manifest.json.in" openeditor="true"/>
2674+ <file source="readme.txt"/>
2675+ </files>
2676+
2677+ <!-- Create a 2nd wizard page with click package parameters -->
2678+ <fieldpagetitle>Click package parameters</fieldpagetitle>
2679+ <fields>
2680+ <field mandatory="true" name="ClickDomain">
2681+ <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9-]+$'
2682+ defaulttext="" placeholdertext="Nickname"/>
2683+ <fielddescription>Nickname:</fielddescription>
2684+ </field>
2685+ <field mandatory="true" name="ClickMaintainer">
2686+ <fieldcontrol class="QLineEdit" validator='^[^"]+$'
2687+ defaulttext="" placeholdertext="Maintainer"/>
2688+ <fielddescription>Maintainer:</fielddescription>
2689+ </field>
2690+ <field mandatory="true" name="ClickHookName">
2691+ <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9.-]+$'
2692+ defaulttext="myscope" placeholdertext="scope hook name"/>
2693+ <fielddescription>Scope name:</fielddescription>
2694+ </field>
2695+ <field name="ClickFrameworkVersion">
2696+ <fieldcontrol class="QComboBox" defaultindex="0">
2697+ <comboentries>
2698+ <!-- Do not add any other frameworks here, they are populated at runtime, this is just a dummy framework to make sure we can find the combobox -->
2699+ <comboentry value="ubuntu-sdk-dummy-framework">
2700+ <comboentrytext>Dummy Framework</comboentrytext>
2701+ </comboentry>
2702+ </comboentries>
2703+ </fieldcontrol>
2704+ <fielddescription>Framework:</fielddescription>
2705+ </field>
2706+ <field name="ConfinementType">
2707+ <fieldcontrol class="QComboBox" defaultindex="0">
2708+ <comboentries>
2709+ <comboentry value="ubuntu-scope-network">
2710+ <comboentrytext>Scope with network access</comboentrytext>
2711+ </comboentry>
2712+ <!--
2713+ <comboentry value="ubuntu-scope-local-content">
2714+ <comboentrytext>Scope with local content</comboentrytext>
2715+ </comboentry>
2716+ -->
2717+ </comboentries>
2718+ </fieldcontrol>
2719+ <fielddescription>Confinement type:</fielddescription>
2720+ </field>
2721+ <field name="ContentType">
2722+ <fieldcontrol class="QComboBox" defaultindex="0">
2723+ <comboentries>
2724+ <comboentry value="network-netcpp-qjson">
2725+ <comboentrytext>Qt scope using HTTP+JSON API</comboentrytext>
2726+ </comboentry>
2727+ <comboentry value="network-netcpp-qxml">
2728+ <comboentrytext>Qt scope using HTTP+XML API</comboentrytext>
2729+ </comboentry>
2730+ <comboentry value="network-netcpp-json">
2731+ <comboentrytext>Pure C++ scope using HTTP+JSON API</comboentrytext>
2732+ </comboentry>
2733+ <comboentry value="empty">
2734+ <comboentrytext>Empty scope</comboentrytext>
2735+ </comboentry>
2736+ </comboentries>
2737+ </fieldcontrol>
2738+ <fielddescription>Template type:</fielddescription>
2739+ </field>
2740+ </fields>
2741+ <validationrules>
2742+ <validationrule condition='/^(.*)\s+&lt;(.*@.*)&gt;$/.test("%ClickMaintainer%")'>
2743+ <message>Invalid format for maintainer (should be like "Joe Bloggs &lt;joe.bloggs@isp.com&gt;")</message>
2744+ </validationrule>
2745+ </validationrules>
2746+</wizard>
2747
2748=== modified file 'share/qtcreator/templates/wizards/ubuntu/scope/wizard.xml'
2749--- share/qtcreator/templates/wizards/ubuntu/scope/wizard.xml 2015-05-14 10:48:33 +0000
2750+++ share/qtcreator/templates/wizards/ubuntu/scope/wizard.xml 2015-06-11 10:48:39 +0000
2751@@ -6,7 +6,7 @@
2752 >
2753 <icon>../share/ubuntu.png</icon>
2754 <description>A simple C++ based Unity Scope</description>
2755- <displayname>Unity Scope (cmake)</displayname>
2756+ <displayname>Unity Scope (Current)</displayname>
2757 <displaycategory>Ubuntu</displaycategory>
2758 <files>
2759 <file source="src/CMakeLists.txt"/>

Subscribers

People subscribed via source and target branches