pax_global_header00006660000000000000000000000064144355006520014516gustar00rootroot0000000000000052 comment=bd128da2c2191c1a44eda9d8d1e113e26e7e88a7 lomiri-api-0.2.1/000077500000000000000000000000001443550065200135605ustar00rootroot00000000000000lomiri-api-0.2.1/.gitignore000066400000000000000000000002151443550065200155460ustar00rootroot00000000000000# default build dir /build* # QtCreator project files /*.user # Eclipse project files /.project /.cproject /.settings /.pydevproject *.qmlclomiri-api-0.2.1/AUTHORS000066400000000000000000000010131443550065200146230ustar00rootroot00000000000000Albert Astals Albert Astals Cid Andrea Azzarone Dalton Durst Daniel D'Andrada Didier Roche Florian Leeber Gerry Boland Ivan Semkin James Henstridge Jan Sprinz Jussi Pakkanen Lionel Duboeuf Luca Weiss Lukáš Tinkl Marcus Tomlinson Marius Gripsgard Michael Terry Michael Zanetti Michal Hruby Michał Sawicz Michi Henning Mike Gabriel Mirco Müller Nick Dedekind Pawel Stolowski Pete Woods Pino Toscano Ratchanan Srirattanamet Robert Bruce Park Rodney Rodney Dawes Sergey Chupligin Sergio Schvezov Stephen Kelly UBports Team lomiri-api-0.2.1/CMakeLists.txt000066400000000000000000000153171443550065200163270ustar00rootroot00000000000000cmake_minimum_required(VERSION 2.8.10) # Default install location. Must be set here, before setting the project. if (NOT DEFINED CMAKE_INSTALL_PREFIX) set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH "" FORCE) endif() project(lomiri-api C CXX) set(PROJECT_VERSION "0.2.1") if(${PROJECT_BINARY_DIR} STREQUAL ${PROJECT_SOURCE_DIR}) message(FATAL_ERROR "In-tree build attempt detected, aborting. Set your build dir outside your source dir, delete CMakeCache.txt from source root and try again.") endif() set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules) string(TOLOWER "${CMAKE_BUILD_TYPE}" cmake_build_type_lower) # Build types should always be lowercase but sometimes they are not. include(PrecompiledHeaders) find_package(CoverageReport) ##################################################################### # Enable code coverage calculation with gcov/gcovr/lcov # Usage: # * Switch build type to coverage (use ccmake or cmake-gui) # * Invoke make, make test, make coverage (or ninja if you use that backend) # * Find html report in subdir coveragereport # * Find xml report suitable for jenkins in coverage.xml ##################################################################### if(cmake_build_type_lower MATCHES coverage) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage" ) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage" ) set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} --coverage" ) set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage" ) # We add -g when building with coverage so valgrind reports line numbers. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g" ) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g" ) # This allows us to skip the file descriptor closing test in Daemon_test # when coverage is enabled. (Closing file descriptors # in the test messes with coverage reporting.) add_definitions(-DCOVERAGE_ENABLED) endif() # Make sure we have all the needed symbols set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,defs") set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-z,defs") # Static C++ checks find_program(CPPCHECK_COMMAND NAMES cppcheck) if (CPPCHECK_COMMAND) set(CPPCHECK_COMMAND_OPTIONS --check-config --inline-suppr --enable=all -q --error-exitcode=2) set(CPPCHECK_COMMAND_OPTIONS ${CPPCHECK_COMMAND_OPTIONS} --template "{file}({line}): {severity} ({id}): {message}") add_custom_target(cppcheck COMMAND ${CPPCHECK_COMMAND} ${CPPCHECK_COMMAND_OPTIONS} ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/test ${CMAKE_BINARY_DIR}/test VERBATIM ) else() message(WARNING "Cannot find cppcheck: cppcheck target will not be available") endif() # # Definitions for testing with valgrind. # configure_file(CTestCustom.cmake.in CTestCustom.cmake) # Tests in CTestCustom.cmake are skipped for valgrind find_program(MEMORYCHECK_COMMAND NAMES valgrind) if (MEMORYCHECK_COMMAND) set(MEMORYCHECK_COMMAND_OPTIONS "--suppressions=${CMAKE_SOURCE_DIR}/valgrind-suppress --leak-check=full --num-callers=40 --error-exitcode=3" ) add_custom_target(valgrind DEPENDS NightlyMemCheck) else() message(WARNING "Cannot find valgrind: valgrind target will not be available") endif() include(FindPkgConfig) pkg_check_modules(GLIB glib-2.0 REQUIRED) # Standard install paths include(GNUInstallDirs) # Shell install paths set(SHELL_PLUGINDIR ${CMAKE_INSTALL_LIBDIR}/lomiri/qml) include_directories( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/include ) # When building the library, we set the default symbol visibility # to "hidden", so we don't export things by default. # Exported functions and classes are prefixed by a LOMIRI_API macro, # which explicitly exports a symbol if LOMIRI_DLL_EXPORTS is defined. add_definitions(-DLOMIRI_DLL_EXPORTS) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -pedantic -Wall -Wextra") # -fno-permissive causes warnings with clang, so we only enable it for gcc if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-permissive") if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.0.0") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsuggest-override" ) endif() endif() if ("${CMAKE_BUILD_TYPE}" STREQUAL "release" OR "${CMAKE_BUILD_TYPE}" STREQUAL "relwithdebinfo") option(Werror "Treat warnings as errors" ON) else() option(Werror "Treat warnings as errors" OFF) endif() if (Werror) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror") endif() # API version set(LOMIRI_API_MAJOR 0) set(LOMIRI_API_MINOR 2) set(LOMIRI_API_MICRO 0) set(LOMIRI_API_VERSION "${LOMIRI_API_MAJOR}.${LOMIRI_API_MINOR}.${LOMIRI_API_MICRO}") # API library set(LOMIRI_API_LIB lomiri-api) # Static version for testing set(LOMIRI_API_STATIC_LIB lomiri-api-static) # Other libraries we depend on set(OTHER_API_LIBS) # All the libraries we need to link a normal executable that uses the Lomiri API set(LIBS ${LOMIRI_API_LIB} ${OTHER_API_LIBS}) # All the libraries we need to link a gtest executable. (We link the tests against a static version # so we can do whitebox testing on internal classes. set(TESTLIBS ${LOMIRI_API_STATIC_LIB} ${OTHER_API_LIBS}) # Library install prefix set(LIB_INSTALL_PREFIX lib/${CMAKE_LIBRARY_ARCHITECTURE}) # Tests if (NOT NO_TESTS) include(CTest) enable_testing() add_subdirectory(test) else() message(STATUS "Tests disabled") endif() # add subdirectories to build add_subdirectory(include) add_subdirectory(src) add_subdirectory(data) if (cmake_build_type_lower MATCHES coverage) ENABLE_COVERAGE_REPORT(TARGETS ${LOMIRI_API_LIB} FILTER /usr/include ${CMAKE_SOURCE_DIR}/test/* ${CMAKE_BINARY_DIR}/*) endif() # # Documentation # find_package(Doxygen) find_program(DOT_EXECUTABLE dot /usr/bin) if (NOT DOXYGEN_FOUND OR NOT DOT_EXECUTABLE) message(WARNING "Cannot generate documentation: doxygen and/or graphviz not found") else() configure_file(${PROJECT_SOURCE_DIR}/doc/Doxyfile.in ${PROJECT_BINARY_DIR}/doc/Doxyfile @ONLY IMMEDIATE) add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/doc/lib${LOMIRI_API_LIB}/index.html COMMAND ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/doc/Doxyfile DEPENDS ${PROJECT_BINARY_DIR}/doc/Doxyfile ${LOMIRI_API_LIB_SRC} ${LOMIRI_API_LIB_HDRS}) add_custom_target(doc ALL DEPENDS ${PROJECT_BINARY_DIR}/doc/lib${LOMIRI_API_LIB}/index.html) install(DIRECTORY ${PROJECT_BINARY_DIR}/doc/lib${LOMIRI_API_LIB} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/doc) endif() lomiri-api-0.2.1/COPYING000066400000000000000000000167431443550065200146260ustar00rootroot00000000000000 GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. lomiri-api-0.2.1/CTestCustom.cmake.in000066400000000000000000000011461443550065200174060ustar00rootroot00000000000000# # Tests listed here will not be run by the valgrind target. # SET(CTEST_CUSTOM_MEMCHECK_IGNORE cleanincludes stand-alone-lomiri-headers stand-alone-lomiri-internal-headers stand-alone-lomiri-api-headers stand-alone-lomiri-api-internal-headers stand-alone-lomiri-util-headers stand-alone-lomiri-util-internal-headers clean-public-lomiri-headers clean-public-lomiri-internal-headers clean-public-lomiri-api-headers clean-public-lomiri-api-internal-headers clean-public-lomiri-util-headers clean-public-lomiri-util-internal-headers copyright whitespace) lomiri-api-0.2.1/ChangeLog000066400000000000000000003032001443550065200153300ustar00rootroot000000000000002023-05-31 Marius Gripsgard * Release 0.2.1 (HEAD -> main, tag: 0.2.1) 2023-04-03 Lionel Duboeuf * Expose ready property (fb09560) 2023-02-12 Luca Weiss * Upgrade C++ standard to C++17 (3086077) 2023-01-20 Marius Gripsgard * Release 0.2.0 (1a49d1c) (tag: 0.2.0) 2023-01-16 Marius Gripsgard * Bump minor version to 0.2.0 (f5db96f) * applicationInfoInterface: Add serverSideDecoration property (bda48d5) * applicationInfoInterface: Add showSplash property (dea5f69) 2022-10-27 Mike Gabriel * test/whitespace/check_whitespace.py: Improve English grammar in comment. (b906e52) 2022-06-06 Sergey Chupligin * Don't check copyright in *.log and *.user files (6be8532) * Don't check autogenerated files in tests (156a4fb) 2021-11-26 Mike Gabriel * tests/copyright/check_copyright.sh: Exclude ChangeLog and lomiri-api/lomiri-api.qmlproject from license header checks. (105f7ec) 2021-04-13 Marius Gripsgard * api: shell: Add missing header (c727161) 2021-03-18 Ratchanan Srirattanamet * New Debian changelog entry; remove Debian revision part (a93a9cb) * Move jenkinsfile to debian/ per the guideline (880df4c) * Upgrade Jenkinsfile to use shared library (7bc5dd4) 2021-01-27 Ratchanan Srirattanamet * debian/*: Adopt DEB packaging from official Debian package where appropriate (bf2175f) 2020-09-28 Marius Gripsgard * [test/copyright] Ignore the NEWS file (a2d145b) 2020-09-26 Mike Gabriel * test/whitespace/CMakeLists.txt: Add debian/ folder as ignore_prefix when running the whitespace test. (737d7d1) * test/whitespace/check_whitespace.py: Support multiple ignore_prefix paths given on the command line. (73442c1) 2020-09-24 Mike Gabriel * release 0.1.1 (99963a5) (tag: 0.1.1) 2020-02-26 Mike Gabriel * NEWS: Fix project name. (188b8dc) 2020-09-22 Marius Gripsgard * Merge remote-tracking branch 'old-origin/xenial_-_edge' into HEAD (3672c8f) * Merge remote-tracking branch 'old-origin/xenial' into HEAD (5958f37) 2020-03-01 Marius Gripsgard * Fix api version to match package version (741638e) * Make sure to export dbus and snap apis (5f5fdf1) 2020-02-28 Marius Gripsgard * Add dbus sanitize helpers (4c1e6d3) 2020-09-22 Marius Gripsgard * Merge pull request #25 from z3ntu/xenial_-_giomemorytest (ad56344) * Merge pull request #15 from ubports/xenial_-_edge_-_multiscreen (a257177) 2019-04-23 Marius Gripsgard * Added Surface Manager signals and surfaceFor(window) (57f17b0) * API requirements for multiple screen support (e8d1779) 2020-05-12 Marius Gripsgard * Add AttachedState state enum (e2994d7) 2020-04-19 Luca Weiss * GioMemory_test: print error from glib (05c06dd) 2020-04-12 Pino Toscano * tests: do not hardcode errno values/texts (a207c22) 2020-02-27 Marius Gripsgard * Remove smart pointer for GRefString (c302d2c) 2020-02-28 Mike Gabriel * Set SOVERSION=0 (instead of 1). (8f90f3b) 2020-02-27 Marius Gripsgard * Fix changelog (967302f) * Fix changelog (20550b9) 2020-02-26 Dalton Durst * Update changelog (951e925) 2020-02-26 UBports Team * release 0.1.0 (8eb7057) (tag: 0.1.0) 2020-02-26 Mike Gabriel * debian/*: Pre-release packaging update. (f4a96ef) 2020-02-26 Marius Gripsgard * Rename to lomiri (eb6b5b4) 2019-12-28 Marius Gripsgard * Update old qml module packages (8252b92) 2020-02-26 Marius Gripsgard * Merge pull request #19 from z3ntu/xenial_-_bionic-merge (9893015) 2019-07-21 Luca Weiss * GlibMemory.h: Use the correct macro (#17) (b596010) Fixes: 58e1112 ("Replace re-import hack with manual listing. (#16)") 2019-07-21 Rodney * Replace re-import hack with manual listing. (#16) (c7e192c) 2019-01-29 Luca Weiss * Replace home-grown gtest config with cmake-extras (52f1e50) 2020-02-19 Rodney * Resolve file conflict with Conflicts/Replaces. (#21) (e2dbc86) 2019-02-10 Dalton Durst * Add empty folders to make header tests happy (84cfc45) * Remove PowerPC config (6e89931) 2019-01-27 Luca Weiss * Migrate to cmake-extras (f4466f1) 2019-06-30 Florian Leeber * Merge pull request #14 from ubports/xenial_-_edge_-_fclose (1dbfc73) 2019-06-29 Marius Gripsgard * Add forceClose method to mirSurface api (ec9636d) 2019-04-27 Marius Gripsgard * Kill scope api and clean up (#12) (98cb672) 2018-11-15 Marius Gripsgard * Ignore Jenkinsfile as part of test (ec799d7) * Build for xenial edge (c86e256) 2018-09-18 Ivan Semkin * Merge pull request #5 from dobey/fix-glib-autocleanup (588b667) 2018-09-17 Rodney Dawes * Add typedefs for the pointers to new type. (9646735) * Fix autoclean conflict with new glib. (9e7c453) 2018-06-12 Marius Gripsgard * Merge pull request #3 from vanyasem/bionic (31cad5a) 2018-06-07 Ivan Semkin * Fix build with Qt 5.11_beta3 (dropping qt5_use_modules) (02ae020) 2018-05-16 Jan Sprinz * Merge pull request #1 from dobey/fix-test (b56d9b0) 2018-05-15 Rodney Dawes * Only add internal header tests if exists. (89b77f9) 2018-02-21 Marius Gripsgard * Fix gcc 7 (16c324d) * Merge remote-tracking branch 'lp/master' into bionic (04a9aa4) 2018-02-20 Marius Gripsgard * Imported to UBports (159c67b) 2017-04-04 Bileto Bot * Releasing 8.7+17.04.20170404-0ubuntu1 (34d39f1) 2017-04-04 Rodney Dawes * Add utility function to prepend $SNAP to directory paths. (f092ac7) 2017-04-04 Pete Woods * unity::util - Add glib signal managers (581f5bd) 2017-04-04 Bileto Bot * Add Glib and GObject Assigner helpers. (4b38af0) 2017-04-04 Pete Woods * Fix whitespace error (de73853) * Add docs (e9c92ca) * Tweak docs (ea2a9fc) * Fix null assignment behaviour in assigner classes (7c070d6) 2017-04-04 Michael Zanetti * bump version numbers (babb590) 2017-04-03 Michael Zanetti * merge trunk (3b5d829) 2017-03-28 Rodney Dawes * Fixes per review. (a50e2b2) 2017-03-25 Pete Woods * Fix up tests, use libqtdbustest for temporary test bus (f6c06e3) 2017-03-24 Pete Woods * unity::util - Add signal management helpers (780ee42) * A bit more cleanup (84172f3) * Add changelog message (8d32e75) 2017-03-23 Pete Woods * More cleaning up (1036749) * Mix in James's Assigner ideas and clean up a little more (e59cc33) 2017-03-23 Michi Henning * Fixed typo in comment. (1be123c) * Using SFINAE now to avoid instantiating an uncalled member function. Minor style fixes. (e657f31) * Simplified templates. (470f645) 2017-03-22 Pete Woods * Respond to James' suggestion of adding factory methods to auto-deduce template arguments (f1032f7) * Use implementation from michi's review, adding separate uptr and sptr assigners (82d411a) 2017-03-21 Rodney Dawes * Add utility function to prepend $SNAP to directory paths. (f42b1c0) 2017-03-21 Pete Woods * Add GObject assigner (be6bce1) * Add gchar and gcharv management definitions (b082bc9) 2017-03-20 Pete Woods * Remove, apprently unreliable, string comparison (58100f9) * Add assigner class to support common GError usage pattern (d8ae99e) 2017-03-17 Bileto Bot * Releasing 8.6+17.04.20170317-0ubuntu1 (9f9652b) * MirSurfaceInterface::allowClientResize (2a0599d) 2017-03-17 Pete Woods * unity::util - unique_gobject and share_gobject now throw for floating references (LP: #1672657) (ff6c6b5) 2017-03-17 Bileto Bot * Add appId property to MirSurfaceInterface (18782f9) * Add RoleIsPrivate to launcher's quicklist entries (398e381) 2017-03-17 Pete Woods * Allow make_gobject to construct initially unowned objects (0740012) 2017-03-16 Pete Woods * unique_gobject and share_gobject now throw for floating references (dd047be) 2017-03-15 Michael Zanetti * Add appId property to MirSurfaceInterface (43fa413) 2017-03-13 Daniel d'Andrada * MirSurfaceInterface::allowClientResize (535c38b) * merge lp:~mzanetti/unity-api/private-quicklist-entries (2b8594d) 2017-02-27 Michael Zanetti * add popularity field to launcheritems (7023f64) * add some comment about the new role (9d0bb48) * Q_ENUMS -> Q_ENUM (35e9503) 2017-02-24 Michael Zanetti * merge prereq (49aa27e) * bump versions (a1b6c56) * add RoleIsPrivate to the launcher's quicklistmodel (d7a17b6) 2017-02-23 Bileto Bot * Releasing 8.4+17.04.20170223-0ubuntu1 (9f59015) * unity::util - Make Glib and GObject memory management utilities handle NULL quietly. (ba875d1) 2017-02-23 Pete Woods * Trying out the deleter methods as charles suggested, making CRITICAL be a fatal error so we know if the deleter logic worked (g_variant_unref logs CRITICAL on null) (50866fb) 2017-02-21 Pete Woods * Really fix the changelog this time (070dcb5) * Fix changelog (9e67507) 2017-02-20 Pete Woods * unity::util - Make Glib and GObject memory management utilities handle NULL quietly. (77f1594) 2017-02-17 Bileto Bot * Releasing 8.3+17.04.20170217-0ubuntu1 (964d9f5) * unity::util - Add typedef macros to GlibMemory to make method and member variable definitions easier. (4e5af19) 2017-02-17 Pete Woods * unity::util - Add typedef macros to GlibMemory to make method and member variable definitions easier. (aaa4747) 2017-02-06 Bileto Bot * Releasing 8.2+17.04.20170206-0ubuntu1 (a20b84b) * MirSurfaceInterface: add childSurfaceList and parentSurface (941fcf1) 2017-01-26 Daniel d'Andrada * MirSurfaceInterface: add childSurfaceList and parentSurface (8e5df5f) 2017-01-20 Bileto Bot * Releasing 8.1+17.04.20170120.1-0ubuntu1 (3dc2810) * Added Mir::currentKeymap (b52b165) 2017-01-19 Bileto Bot * Releasing 8.1+17.04.20170119.1-0ubuntu1 (5bd19f0) * unity::util - add Glib memory management utility functions. (5ddbb86) * unity::util - add GObject shared memory utility classes and helper methods. (148d780) 2017-01-19 Pete Woods * unity::util - add Glib memory management utility functions. (5705791) * unity::util - add GObject shared memory utility classes and helper methods. (1e01693) 2017-01-16 Lukáš Tinkl * merge trunk (0763822) 2017-01-10 Bileto Bot * Releasing 8.0+17.04.20170110.1-0ubuntu1 (d56c9a2) 2017-01-10 Albert Astals Cid * Use the new Q_ENUM (Qt 5.5) (f260564) * Enable -Wsuggest-override (ef542f1) 2017-01-10 Nick Dedekind * Fully qualify pointer type namespaces in signals so that the parameters can be used in qml. (de92270) 2017-01-02 Lukáš Tinkl * merge trunk (33ea21b) 2016-12-23 Nick Dedekind * fully qualify namespaces for use in qml (bcc2a8a) 2016-12-23 Albert Astals Cid * Q_FLAG is also the moderm way of Q_FLAGS (701c8a1) * Some more i missed somehow (b1498c3) * Use the new Q_ENUM (Qt 5.5) (18d05f5) * Merge (24d5952) 2016-12-15 Lukáš Tinkl * merge trunk (2ae7dfd) 2016-12-15 Bileto Bot * Releasing 8.0+17.04.20161215-0ubuntu1 (d54626f) * unity::shel::application - changes for the miral way of doing things (c9f2f28) 2016-12-14 Albert Astals Cid * remove useless commented out code (25fa845) * Enable -Wsuggest-override (052e8b8) 2016-12-12 Daniel d'Andrada * unity::shel::application - changes for the miral way of doing things (11a1941) 2016-12-07 Daniel d'Andrada * Update useless mock (3af6c49) * make it const (3794ab3) 2016-12-06 Lukáš Tinkl * merge trunk and bump (6a01e05) 2016-12-05 Bileto Bot * Releasing 7.121+17.04.20161205-0ubuntu1 (b29d57a) * Add AppDrawerModelInterface (b11f9ee) 2016-12-01 Daniel d'Andrada * Merge trunk (52636f1) 2016-11-30 Michael Zanetti * bump versions again after merging (9895c9e) * merge in 22022 as prereq (ccc16e7) 2016-11-24 Daniel d'Andrada * MirSurfaceInterface::activate (21d6030) 2016-11-23 Bileto Bot * Releasing 7.120+17.04.20161123-0ubuntu1 (dfbcfe8) 2016-11-23 Marcus Tomlinson * Don't rely on glib error message strings in IniParser_test (LP: #1642673) (70821bd) 2016-11-23 Bileto Bot * Add hasSeparator role to quicklistModel. (8439b32) 2016-11-22 Daniel d'Andrada * MirSurfaceInterface::activate (4a13fa5) 2016-11-18 Marcus Tomlinson * Check for parts of error string we output (792b08f) * Clean up (ee2dd4b) 2016-11-17 Marcus Tomlinson * Don't rely on glib error message strings in IniParser_test (fb24db9) 2016-11-17 Daniel d'Andrada * Add SurfaceManager and remove TopLevelWindowModel and Window (c3bc7f8) * Update useless tests (7cfe892) 2016-11-17 Michael Zanetti * include qstringlist manually to make it build on vivid (04c1294) 2016-11-16 Michael Zanetti * add support for keywords (b860bed) 2016-11-14 Daniel d'Andrada * Add SurfaceManager and remove TopLevelWindowModel and Window (53afea7) 2016-11-10 Michael Zanetti * bump versioning (40600c8) * add mocks and tests (9d4acc2) 2016-11-07 Daniel d'Andrada * Fix documentation (5aa28b7) 2016-11-04 Michael Zanetti * add virtual dtor (9cb5dc0) * add copyright header (6060088) * add usage role (b631dbe) 2016-11-03 Daniel d'Andrada * Bump to 8.0 (acaeee7) 2016-11-03 Michael Zanetti * add AppDrawerModelInterface.h (5d3a69a) 2016-11-03 Daniel d'Andrada * unity::shell::application - changes for the miral way of doing things (cc8aa80) 2016-11-01 Daniel d'Andrada * unity::shel::application - changes for the miral way of doing things (031b6a2) 2016-10-28 Andrea Azzarone * Bump API (b783c82) * Add a hasSeparator role to quicklistModel which determines if the entry should have a separator. (dac4944) 2016-10-06 Daniel d'Andrada * Changes for the miral way of doing things (28b4f18) 2016-09-30 Lukáš Tinkl * added Mir::currentKeymap (0af6b73) 2016-09-09 Bileto Bot * Releasing 7.119+16.10.20160909-0ubuntu1 (39a73d1) * Added MirSurfaceInterface::confinesMousePointer (c7a6a28) 2016-09-05 Daniel d'Andrada * Added MirSurfaceInterface::confinesMousePointer (4909c25) 2016-08-30 Bileto Bot * Releasing 7.118+16.10.20160830-0ubuntu1 (1727e16) * Added persistent Id property for MirSurface (780ea80) 2016-08-22 Nick Dedekind * Added persistent Id property for MirSurface (ff8112f) 2016-08-19 Bileto Bot * Releasing 7.117+16.10.20160819-0ubuntu1 (b14f0e4) 2016-08-19 Michi Henning * Removed empty unreleased entry from changelog. (LP: #1613563) (5b55d5e) 2016-08-17 Michi Henning * Fixed syntax error in changelog. (0126570) 2016-08-10 Bileto Bot * Releasing 7.117+16.10.20160810-0ubuntu1 (ffd8b1a) * ApplicationInfoInterface: remove "stage" propert. ApplicationManagerInterface: remove "stage" role (9fcc2c6) 2016-08-05 Bileto Bot * Releasing 7.116+16.10.20160805-0ubuntu1 (fd7afab) 2016-08-05 James Henstridge * Remove unnecessary Boost dependency from package. (0bda26b) 2016-08-02 James Henstridge * Remove unnecessary Boost dependency from package. (6be0f8b) 2016-07-30 Bileto Bot * Releasing 7.116+16.10.20160730-0ubuntu1 (d594a9f) 2016-07-30 Michał Sawicz * Don't run tests on powerpc (LP: #1606927) (77a8e30) 2016-07-30 Stephen Kelly * Silence some gcc warnings. (821f88e) 2016-07-29 Michał Sawicz * Don't run tests on powerpc (LP: #1606927) (5a952d9) 2016-07-25 Daniel d'Andrada * Update tests (c853dff) * Remove ApplicationInfoInterface.stage property (d197dc1) 2016-06-20 Stephen Kelly * Fix use of MockOptionSelectorFilter constructor (2561025) 2016-06-20 Bileto Bot * Releasing 7.116+16.10.20160620-0ubuntu1 (4ae2d15) * MirSurfaceInterface: add inputBounds property (1492ed4) 2016-06-20 Daniel d'Andrada * MirSurfaceInterface: add inputBounds property (0d299b2) 2016-06-14 Bileto Bot * Releasing 7.115+16.10.20160614-0ubuntu1 (aad7692) * Drop Launchermodel::setAlerting, it's not needed (27bdb31) * Add ApplicationInfoInterface::surfaceCount property (70987d7) 2016-06-09 Nick Dedekind * added MirSurfaceInterface::persistentId (1fc63fa) 2016-06-03 Michael Zanetti * bump debian changelog (fca8dc4) * that wasn't needed (5e91d72) * bump debian/changelog (58c865d) * merge trunk, bump version (3ebc1e7) * bump version once more (d165f30) * merge trunk (9797626) 2016-05-25 CI Train Bot * Releasing 7.113+16.10.20160525-0ubuntu1 (7d79d58) 2016-05-25 Albert Astals Cid * Mark roleNames as override (17939cd) 2016-05-25 Michi Henning * Re-enabled license/copyright test for xenial. Fixes: #1194867 Approved by: Marcus Tomlinson, Unity8 CI Bot (b6cc21d) 2016-05-25 Daniel d'Andrada * Remove hotspot property from MirMousePointerInterface (53d9cb9) 2016-05-19 Michael Zanetti * merge prereq (2ca18d4) * bump application API version again (0f6193d) * merge trunk (3b1a5be) 2016-05-18 Daniel d'Andrada * Remove hotspot property from MirMousePointerInterface (9c9cf24) 2016-05-18 Michael Zanetti * Drop Launchermodel::setAlerting, it's not needed (418f4a0) * merge prereq (111e80b) * update tests & mocks (68079c7) 2016-05-18 CI Train Bot * Releasing 7.112+16.04.20160518-0ubuntu1 (c77ee9e) 2016-05-18 Daniel d'Andrada * Moved prompt surfaces to ApplicationInfo and added MirSurfaceListInterface::first (3f800b4) 2016-05-17 Daniel d'Andrada * update application version (27f2459) * Added MirSurfaceListInterface::first property (95c1010) * Move promptSurfaceList from MirSurfaceInterface to ApplicationInfoInterface (435122f) 2016-05-13 Albert Astals Cid * Mark as override (a0618f9) 2016-05-11 Michael Zanetti * add forgotten property (ca7db7f) * fix typo in apidoc (ca0573c) 2016-05-10 Michael Zanetti * add missing file (21b4a17) * add missing change (50444b7) * bump launcher api too (968c4a8) 2016-05-09 Michael Zanetti * Add ApplicationInfoInterface::surfaceCount property (78c274d) 2016-04-26 CI Train Bot * Releasing 7.111+16.04.20160426.2-0ubuntu1 (3d540d4) 2016-04-26 Pawel Stolowski * Added ExpandableFilterWidgetInterface. Approved by: Albert Astals Cid (4ec3da4) * Added RoleSocialActions. Approved by: Marcus Tomlinson (6c650c8) * Merged social attr (197696f) * Fix version (968819a) * Merged social-attributes (26e7866) * Merged trunk (6ebdec8) 2016-04-19 Pawel Stolowski * Bump (a518ea6) * Merged trunk (b1365da) 2016-04-15 Pawel Stolowski * Merged trunk + bump (e8d2ef2) 2016-04-13 CI Train Bot * Releasing 7.110+16.04.20160413-0ubuntu1 (17998db) 2016-04-13 Daniel d'Andrada * Unity.Application: Surface-based window management Approved by: Unity8 CI Bot, Gerry Boland (06834a3) * MirSurfaceInterface: replace keymapLayout and keymapVariant with keymap (a653305) * Unity.Application: Added and refactored APIs for surface-based window management (437af44) * MirSurfaceInterface: replace keymapLayout and keymapVariant with keymap (e73a0f4) 2016-04-07 Michi Henning * Some more suppressions for copyright test. Added a missing license header. (5ce05ce) 2016-04-05 CI Train Bot * Releasing 7.109+16.04.20160405-0ubuntu1 (88adc47) 2016-04-05 Marcus Tomlinson * Add set*() methods to IniParser Fixes: #1552082 Approved by: Michi Henning, Unity8 CI Bot (f24f860) 2016-03-31 Michi Henning * Re-enabled license/copyright test for xenial. (d58454c) 2016-03-30 Marcus Tomlinson * Add "#include " for arm64 (ec2af6a) * Address review comments (4e6a519) 2016-03-29 Marcus Tomlinson * Append -0ubuntu1 to version in changelog (076c859) * Added tests for double-to-int and int-to-double conversions (efa12c9) * Merged trunk (356a7ff) * Clean up docs (664f2a9) * Added tests for remove_group and remove_key (f4ed357) * Added remove_group and remove_key methods (f7b8745) * Added tests for get_double_array and set_double_array (8c266f2) * Added missing get_double_array and set_double_array methods (3e01886) 2016-03-24 Pawel Stolowski * Merged trunk + bump (f58008f) 2016-03-22 CI Train Bot * Releasing 7.108+16.04.20160322-0ubuntu1 (81ff06a) 2016-03-22 Michał Sawicz * Bump changelog Approved by: Unity8 CI Bot, PS Jenkins bot, Lukáš Tinkl (ddfbaad) * Add API for setting keyboard layout+variant on a surface Fixes: #1491340, #1524400 Approved by: Unity8 CI Bot, Michael Terry (40dff5e) 2016-03-22 Nick Dedekind * Added support for low shell chrome Fixes: #1535397 Approved by: PS Jenkins bot, Unity8 CI Bot, Gerry Boland (1c230f9) * Added setStage for sidestage redesign. Approved by: Unity8 CI Bot, PS Jenkins bot, Daniel d'Andrada (1c5cdbd) 2016-03-22 Pawel Stolowski * ValueSliderFilter interface. Approved by: Unity8 CI Bot, Albert Astals Cid (8ad5c63) * Interface for RangeInputFilter. Approved by: Unity8 CI Bot, Albert Astals Cid (07c8b07) * Base interfaces for filters. Approved by: PS Jenkins bot, Unity8 CI Bot, Albert Astals Cid (d00b8f8) 2016-03-17 Marcus Tomlinson * Removed file locking (6c27e92) 2016-03-16 Pawel Stolowski * Merged filters (17d3414) 2016-03-15 Marcus Tomlinson * Removed extra whitespace (393090d) * Try to get a file lock before creating a new g_key_file to simplify memory management (50c90b1) * Fix memory leak (5838c5a) * Fixed error message for unity-scopes-api tests (45368eb) * Add file locking (293414d) * Add thread safety (4b9bc45) * Added test for sync() exception (2ab2bb3) 2016-03-14 Pawel Stolowski * Added filters property (a5b33c6) 2016-03-14 Marcus Tomlinson * Added double methods (9070fe4) * Bump (d09ee3c) * Small fix (4e280cc) * Update doc (4666d4e) * Add some special characters to string values (3d08a35) * Added tests (8989f4d) * Add dirty flag (bd48be1) * Fleshed out set_() methods (be47349) 2016-03-11 Michał Sawicz * Merge lp:~nick-dedekind/unity-api/shell_chrome (3d9b2ad) * Bump changelog (198303b) 2016-03-11 Pawel Stolowski * Merged range-input-filter-iface (748f7f8) * Merged filter-iface (5cab70a) * No changelog change: (144b930) 2016-03-11 Nick Dedekind * typo (4059102) 2016-03-10 Pawel Stolowski * Added ExpandableFilterWidgetInterface (fb82394) * Merge range-input-filter-iface (802af88) * Merged filter-iface (ec61bab) 2016-03-08 Marcus Tomlinson * Add new set_() method declarations (6cd524e) 2016-03-07 Pawel Stolowski * Fix role name in the test (e0f1843) * Bump (0193dec) * Merged trunk (cb8de4f) * Bump (1e493f2) * Merged trunk (bc08f54) 2016-03-03 Pawel Stolowski * Fix comment (dba5483) * Rename RoleSocialAttributes to RoleSocialActions (1198113) 2016-03-02 Pawel Stolowski * Added RoleSocialAttributes (f7e6b90) 2016-02-23 CI Train Bot * Releasing 7.107+16.04.20160223-0ubuntu1 (8e92c44) 2016-02-23 Pawel Stolowski * Removed PreviewStackInterface. Changed ScopeInterface to return single preview. Approved by: PS Jenkins bot, Albert Astals Cid (ac76df6) * Interface for activationInProgress flag. Fixes: #1537132 Approved by: PS Jenkins bot, Albert Astals Cid, Unity8 CI Bot (464877c) 2016-02-22 Pawel Stolowski * Merged trunk (bcfd36f) 2016-02-19 Pawel Stolowski * Merged range-input-filter-iface (67a111f) * Merged filters-iface (d0fff27) * Merged trunk (86af6b2) 2016-02-18 Pawel Stolowski * Merged activation-progress (c004d6e) 2016-02-17 Pawel Stolowski * Bump version (1314b82) * Merged trunk (ae5a615) 2016-02-17 Nick Dedekind * whitespace (a9a7070) * bump version (b13e5a7) * fixes (d37775e) 2016-02-16 Nick Dedekind * merged with trunk (02f2c58) * merged with trunk. bump abi (c854570) 2016-02-16 Michał Sawicz * Bump application API (3a902d4) * Merge trunk (e413265) 2016-02-12 Nick Dedekind * api bump (d43a229) * added ShellCrome (482d6a7) 2016-02-11 CI Train Bot * Releasing 7.106+16.04.20160211.1-0ubuntu1 (9859642) 2016-02-11 Michał Sawicz * Bump version for dependants Approved by: Michael Terry, PS Jenkins bot (67f05fc) 2016-02-11 Daniel d'Andrada * MirSurfaceInterface: added size hints Approved by: Unity8 CI Bot, Michał Sawicz (7779bcc) * Added ApplicationInfoInterface.initialSurfaceSize Fixes: #1532974 Approved by: Nick Dedekind, PS Jenkins bot, Gerry Boland (d235276) 2016-02-12 Michał Sawicz * Bump application API to 13 (c001f0d) 2016-02-11 Pawel Stolowski * Removed preview stack qml check (f31389b) * Remove PreviewStackInterface (f6aa327) 2016-02-03 Pawel Stolowski * Don't bump changelog (78b98ac) 2016-02-03 Daniel d'Andrada * MirSurfaceInterface: added size hints (49270bd) 2016-02-02 Daniel d'Andrada * Added ApplicationInfoInterface.initialSurfaceSize (742b8c7) 2016-02-02 Lukáš Tinkl * fixup docu (f5cbb75) * setKeymap() API (6160150) 2016-01-29 Pawel Stolowski * Added activationInProgress property (53baa3c) 2016-01-21 Nick Dedekind * merged with trunk (f2ca568) 2016-01-11 Pawel Stolowski * Merged range-input (bcc0bd8) * Merged filters-iface (1880dbc) * Bump (723fad8) * Merged range-input (60204c9) * Merged filters-iface (a172757) * Merged trunk (9dcf262) 2016-01-04 CI Train Bot * Releasing 7.105+16.04.20160104-0ubuntu1 (563ed0e) 2016-01-04 Pawel Stolowski * New properties to support more complex cards (5800a1a) 2015-12-15 Pawel Stolowski * Merged trunk (a96e544) * Merge range-input-iface (fcba3d1) * Merged filters-iface (97bad27) * Merged trunk (6394b7c) 2015-12-14 Nick Dedekind * version bump (b080652) * merged with parent (141a3b1) 2015-12-08 Pawel Stolowski * Merged range-input-filter-iface (10acdc0) * Merged main branch (d1b94dd) * Merged trunk (c964168) 2015-12-07 CI Train Bot * Releasing 7.104+16.04.20151207-0ubuntu1 (5c81291) 2015-12-07 Michael Terry * Added ApplicationInfoInterface::exemptFromLifecycle Fixes: #1518764 Approved by: PS Jenkins bot, Daniel d'Andrada (318cadf) 2015-12-07 Daniel d'Andrada * Add MirSurfaceItem.fillMode Approved by: Michael Zanetti (832f213) 2015-12-04 Pawel Stolowski * Use doubles for value slider (00145cc) 2015-12-03 Michael Terry * Merge in surfaceItemFillMode2 branch (4a0f358) * Fix documentation (4ae1e71) * Add new flag exemptFromLifecycle (5e94568) 2015-12-03 Nick Dedekind * bump api version (e01a312) * version bump (143c3f1) 2015-12-02 Nick Dedekind * merged with trunk (d0dbcc1) 2015-12-02 Pawel Stolowski * Renamed SoliderValueRoles enum to Roles (a7bbdaa) 2015-11-30 Daniel d'Andrada * Add MirSurfaceItem.fillMode (319c81f) 2015-11-30 Pawel Stolowski * Merged trunk (1fd3a36) 2015-11-25 CI Train Bot * Releasing 7.103+16.04.20151125-0ubuntu1 (c7069de) 2015-11-25 Michał Sawicz * Added MirMousePointerInterface::setCustomCursor Approved by: Michał Sawicz (c3fa30c) 2015-11-25 Daniel d'Andrada * Added MirMousePointerInterface::handleWheelEvent Approved by: Lukáš Tinkl, PS Jenkins bot (0ab58b3) 2015-11-25 Pawel Stolowski * Merged filters-iface (0c9efbb) * Merged trunk (d5fd1f7) 2015-11-24 Pawel Stolowski * Ooops again (76d137f) 2015-11-24 CI Train Bot * Releasing 7.102+16.04.20151124-0ubuntu1 (c7bd4c1) 2015-11-24 Pawel Stolowski * Depend on devscripts, needed by licensecheck. Disable licensecheck on xenial for now. Approved by: PS Jenkins bot, Michi Henning (73910fe) * Ooops again (eb931cf) * Ooops, forgot pure virtual methods (72eb3d9) * Fix wrong enum value (62b4689) * Added ValueSliderInterface (2b2cc6b) * Added licensecheck bug # in the comment (30a6de5) 2015-11-23 Nick Dedekind * merged with trunk (33fd2c7) * setStage (1e5ceb9) 2015-11-23 Pawel Stolowski * Merged filters-iface (5d2ecc2) * Merged trunk (0c1dc78) * Method for resetting filters to defaults (e8ca5e4) 2015-11-23 Michał Sawicz * Merge lp:~dandrader/unity-api/mouseWheel (67829ff) 2015-11-20 Pawel Stolowski * Merged trunk (09a7ae4) 2015-11-19 Daniel d'Andrada * Added MirMousePointerInterface::handleWheelEvent (8c92671) 2015-11-18 Pawel Stolowski * Also require lsb-release (d805315) 2015-11-17 Pawel Stolowski * Merged filters-iface branch (54f0c07) * Don't pass labels with label changed signals (2291079) * Added title to filter base (7f3f8e3) 2015-11-16 Pawel Stolowski * hasStartValue/hasEndValue as properties. Pass QString as const ref. (8d2bda6) * Merged filters-iface (22f8fe4) * Merged license-check (e5abed3) * Depend on devscripts, disable licensecheck on xenial for now (ed5dc43) 2015-11-13 Pawel Stolowski * has* and erase* value methods (9e5662f) * Getters should be const (35a9b8c) * Properties for labels (ba4607b) * Use double instead of variant (c73fb07) 2015-11-11 Daniel d'Andrada * Added MirMousePointerInterface::setCustomCursor (8ad064c) 2015-11-10 Pawel Stolowski * Merged filters interface branch (9e343ba) 2015-11-09 CI Train Bot * Releasing 7.102+16.04.20151109-0ubuntu1 (9292f71) 2015-11-09 Albert Astals Cid * New method for in-card actions. Remove obsolete special categories. Approved by: PS Jenkins bot, Albert Astals Cid (0f2a80d) 2015-11-06 Pawel Stolowski * Merged trunk (094ce1a) 2015-11-02 CI Train Bot * Releasing 7.102+16.04.20151102-0ubuntu1 (67679d4) 2015-11-02 Nick Dedekind * Support server->client visibility change to stop rendering (lp:#1475678) Fixes: #1475678 Approved by: PS Jenkins bot (f02a78b) 2015-11-02 Michael Terry * Add new isTouchApp property to ApplicationInfoInterface. (acb7fbb) 2015-11-02 Pawel Stolowski * Merged trunk (212cc98) * Bump (ee888e5) 2015-10-30 Michael Terry * Bump VERSION for unity-shell-application (77b724d) 2015-10-27 Nick Dedekind * merged no-touch-no-lifecycle (bc99441) 2015-10-27 Michael Terry * Merge from trunk (a8b8b75) 2015-10-27 Pawel Stolowski * Merged filters-iface (462cf26) * Merge trunk (665b545) 2015-10-26 Nick Dedekind * merge with trunk (7651a6e) 2015-10-26 Pawel Stolowski * Merged trunk (1da9df6) 2015-10-21 CI Train Bot * Releasing 7.101+15.10.20151021-0ubuntu1 (30deb62) 2015-10-21 Lukáš Tinkl * Notify about surface name changes Approved by: PS Jenkins bot, Daniel d'Andrada (b820130) 2015-10-21 Daniel d'Andrada * unity/shell/application: add some mouse cursor headers and properties (b5bf82d) 2015-10-16 Pawel Stolowski * Merged trunk (a1dfc15) 2015-10-13 Daniel d'Andrada * s/Qt::MouseButton/Qt::MouseButtons (24e2e54) 2015-10-12 Nick Dedekind * reverted enum (3bb4bb5) 2015-10-09 Pawel Stolowski * Fully-qualified filterType property (23a7bc7) * Removed addSpecialCategory (ae728ee) 2015-10-06 Pawel Stolowski * Bump version (b88899d) 2015-10-05 Pawel Stolowski * Merged trunk (3ea5f72) 2015-10-01 Michael Terry * Add isTouchApp to application manager roles (7db6fcc) * Remove canSuspend (49210d7) 2015-10-01 Michał Sawicz * Add changelog bit (bb7ae23) 2015-09-29 Michael Terry * Add canSuspend and isTouchApp to ApplicationInfoInterface (7430fb1) 2015-09-29 Lukáš Tinkl * rebase on top of lp:~dandrader/unity-api/mousePointer (4c428ac) * notify surface name changes, bump api version (8403aaf) 2015-09-29 Pawel Stolowski * Removed unused alt nav properties/methods (9a46d01) 2015-09-28 Pawel Stolowski * Merged all-label-role (2c62c2c) * Oops (fd476c1) * Added allLabel role to NavigationInterface (6c9315f) 2015-09-23 Nick Dedekind * removed enum (65176e9) * Added visibility to surface interface (4861561) 2015-09-18 Daniel d'Andrada * unity/shell/application: Added mouse pointer related interfaces and properties (b1290de) 2015-09-18 Michał Sawicz * Resync trunk (125370e) 2015-09-16 Albert Astals Cid * move the new enum value at the end (29f37f6) 2015-09-16 Pawel Stolowski * Merged trunk (88a3f3b) 2015-09-15 Pawel Stolowski * Merged 15.04 trunk (d8f1d43) 2015-09-03 CI Train Bot * Releasing 7.100+15.10.20150903-0ubuntu1 (d90d310) 2015-09-03 Michał Sawicz * No-change rebuild to resync vivid and wily Approved by: Michael Zanetti (57be0dd) * Add changelog entry (de1b8e7) 2015-09-02 Pawel Stolowski * Merged 15.04 trunk (472b987) 2015-09-01 Pawel Stolowski * primaryNavigationTag (38570b9) 2015-08-31 Pawel Stolowski * primaryNavigationFilterChanged signal (74f4d4c) 2015-08-28 Pawel Stolowski * New properties for filters (63541bf) * Merged trunk (b85aa00) 2015-08-27 CI Train Bot * Releasing 7.100+15.04.20150827-0ubuntu1 (99e3d3f) 2015-08-27 Daniel d'Andrada * Added MirSurface and MirSurfaceItem interfaces Approved by: Gerry Boland (3825d6f) 2015-08-26 CI Train Bot * Releasing 7.99+15.10.20150826-0ubuntu1 (1fca6ad) 2015-08-26 Pawel Stolowski * Change activate/preview methods to take categoryId. Fixes: #1428063 Approved by: PS Jenkins bot (e4b9d0a) 2015-08-19 Daniel d'Andrada * Added MirSurface and MirSurfaceItem interfaces (c6cdc9a) 2015-08-14 Pawel Stolowski * Updated changelog (712ef4b) * Change activate/preview methods to take categoryId. (9587f24) 2015-08-12 Pawel Stolowski * Merged 15.04 trunk. bumped version (aebc10c) 2015-08-11 CI Train Bot * Releasing 7.99+15.04.20150811-0ubuntu1 (bd68ddb) 2015-08-11 Pawel Stolowski * Change activate/preview methods to take categoryId. Fixes: #1428063 Approved by: Xavi Garcia (e69cf0b) * Merged trunk-15.04 (8430c02) * Merged 15.04 trunk (770af7d) * Updated changelog (a3d2f5c) * Merged trunk (3359eb2) 2015-08-10 Pawel Stolowski * Merged trunk-15.04 (4e83fb0) * Merged 15.04 trunk (68dcb1b) * Updated changelog (a0be53f) 2015-08-07 Albert Astals Cid * version on top (fa499c5) * Merge lp:unity-api (017ab92) 2015-08-06 Pawel Stolowski * Fix version (5353c2d) 2015-08-04 CI Train Bot * Releasing 7.99+15.10.20150804-0ubuntu1 (ec0f563) 2015-08-04 Daniel d'Andrada * Add a NO_TESTS options to cmake (517bd44) * Let users of the API suspend & resume individual apps at will (b8f8467) 2015-08-03 Daniel d'Andrada * Merge trunk (a1cbbd3) 2015-08-03 Pawel Stolowski * Bump (eb5fb53) * Merged trunk (290cecb) * Merged trunk (6e4adc3) 2015-07-24 CI Train Bot * Releasing 7.98+15.10.20150724-0ubuntu1 (fd9fccf) 2015-07-24 Mirco Müller * Added alert-API to LauncherItemInterface and LauncherModelInterface to allow applications to trigger a wiggle/peeking-animation on their launcher-icon to draw users attention. Approved by: PS Jenkins bot, Michael Zanetti (55b8f64) 2015-07-21 CI Train Bot * Releasing 7.97+15.10.20150721-0ubuntu1 (dca78db) 2015-07-21 Michi Henning * Remove dependency on gcc 4.9. Fixes: #1452342 Approved by: Marcus Tomlinson, PS Jenkins bot, Matthias Klose (a1ae451) 2015-07-20 Michi Henning * Remove dependency on gcc 4.9 from top-level CMakeLists.txt. (bc24844) * Removed g++ 4.9 dependency from debian/rules. (561bd02) * Remove explicit dependency on gcc 4.9. (2257b30) 2015-07-14 Pawel Stolowski * Take categoryId with activateAction (2e4bc90) 2015-07-08 Pawel Stolowski * Version bump (67b3592) 2015-07-07 Pawel Stolowski * Version bumpl (46e53dd) 2015-07-03 Daniel d'Andrada * Add a NO_TESTS options to cmake (299529c) 2015-07-02 Pawel Stolowski * Changed activate/preview methods to take category id (bcb30c2) 2015-06-23 Mirco Müller * Bumped ChangeLog (240610b) 2015-06-19 Mirco Müller * Small name-tweak and launcher-api version bump. (f78b316) 2015-06-19 Albert Astals Cid * Merge lp:unity-api (cbc0b46) 2015-06-19 Daniel d'Andrada * Changes to application lifecycle APIs (3eb304a) 2015-06-18 Mirco Müller * Forgot to add ::alert() and its api-doc. (1c2791e) * Merged with trunk. (e47906c) 2015-06-12 Mirco Müller * Clean up (dc2f123) 2015-06-11 CI Train Bot * Releasing 7.97+15.10.20150611-0ubuntu1 (80eb04a) 2015-06-11 Daniel d'Andrada * Add supportedOrientations and rotatesWindowContents to ApplicationInfo Approved by: PS Jenkins bot, Gerry Boland (f102ba6) 2015-06-05 Mirco Müller * Updated tests to include alerting-related API-changes. (1dbfe4d) 2015-06-02 Pawel Stolowski * Added activateAction virtual method (52b684d) 2015-06-02 Mirco Müller * Added alerting-api to allow apps to trigger an attention-grabbing animation of their launcher-icon. (7b9bafb) 2015-05-29 Michael Zanetti * merge trunk (4a88b35) * bump versions (8f6ba15) 2015-05-18 Albert Astals Cid * This is not a uri now but a "data" (9b30750) * Typo (59b6892) 2015-05-13 Albert Astals Cid * type will come as part of template/components (1dc6b4f) 2015-05-08 Albert Astals Cid * New property to support more complex cards (8a7f102) 2015-04-16 Daniel d'Andrada * Update debian/changelog date & time (c508572) * Merge trunk (0ee12d6) * Update copyright year (27a8d0e) * Add :native back again (d23820a) 2015-04-16 Pawel Stolowski * Fixes. (70bc4cf) * Added RangeInputFilterInterface. (26dde34) 2015-04-10 CI Train Bot * Releasing 7.96+15.04.20150410.2-0ubuntu1 (b7fc722) 2015-04-10 Michi Henning * Reverted commit 93 because it cost me a cool 1.5 hours today. Turns out that libmcheck is not thread-safe and causes the most amazing crashes in unpredictable ways :-( Approved by: Pawel Stolowski, PS Jenkins bot (c32ec40) 2015-04-02 Pawel Stolowski * Fix test failure. (84f3966) * More test cases. (3247f3e) * Change function order in the test. (83f0bc2) 2015-04-01 Pawel Stolowski * Verify filters model. Minor fixes. (73256ee) * Fixed filter type property. (4dcfdf7) 2015-03-31 Pawel Stolowski * Make properties that don't change CONSTANT> (abd5dd1) 2015-03-26 Pawel Stolowski * Renamed id property to filterId. Added optionsChanged signal. (e7925b8) 2015-03-25 Pawel Stolowski * Bumped version in the changelog. (0007ed5) * Use raw pointers in the mock model. (186cac2) * Bump version. (15a2fb5) * Added mocks. Don't expose update method which leaks scopes API types. (cc7ea53) 2015-03-24 Pawel Stolowski * Don't expose selector filter option as object, expose it via options model rows. (e7fa494) 2015-03-13 Pawel Stolowski * Declare filter base iface metatype (9dabd0d) * Fix (acc688f) * Fix (f06d80c) * Fix (ce1ba76) * Filter type as enum. (bbeba63) * Added filter type enum. (7ae9284) * Added base filter interfaces. (424477f) 2015-03-10 Michi Henning * Reverted commit 93 because it cost me a cool 1.5 hours today. Turns out that libmcheck is not threads-safe and causes the most amazing crashes in unpredictable ways :-( (207ddf7) 2015-02-18 Daniel d'Andrada * Merge trunk (b905ab4) 2015-02-13 CI Train Bot * Releasing 7.96+15.04.20150213-0ubuntu1 (14bd6b7) 2015-02-13 Pawel Stolowski * Added Scopes::closeScope abstract method. Fixes: #1410337 Approved by: Albert Astals Cid (29b986c) 2015-02-12 Daniel d'Andrada * Drop the ":native" part as PPA's can't handle it (cf7d0c1) * Merge trunk (3e6334b) 2015-02-12 Pawel Stolowski * Merged trunk (102112e) * Ups, added closeScope method to the mock. (0cda171) 2015-02-11 CI Train Bot * Releasing 7.95+15.04.20150211-0ubuntu1 (d5f2a27) 2015-02-11 Michał Sawicz * Add :native to g++ dependency for cross-building and wrap-and-sort for good measure. Python needs :any, too. Fixes: #1353855 Approved by: Michi Henning (d589dbc) 2015-02-11 Michael Zanetti * add an onlyPinned property to the launcher's api Approved by: Michael Terry, Michał Sawicz, PS Jenkins bot (de80221) * bump launcher api version (944c07e) 2015-02-10 Michał Sawicz * Python → any (77ca4dd) * Add :native to g++ dependency for cross-building and wrap-and-sort for good measure. (a5518d0) 2015-02-09 Michael Zanetti * add onlyPinned property to launcher model (285d172) 2015-02-04 Pawel Stolowski * Bumped version. (f6c997b) * Added closeScope to the Scopes iface. (3b06e90) 2014-12-08 Daniel d'Andrada * Merge trunk (f94de38) 2014-12-05 CI Train Bot * Releasing 7.94+15.04.20141205-0ubuntu1 (ce029a5) 2014-12-05 Albert Astals * API for setFavorite/moveFavoriteTo Fixes: #1368670 Approved by: Pawel Stolowski, Nick Dedekind, PS Jenkins bot (b4fffc4) 2014-11-05 Daniel d'Andrada * add supportedOrientations and rotatesWindowContents to ApplicationInfo (41ce54a) 2014-11-05 Albert Astals * Merge (e7c3b12) 2014-11-04 CI bot * Releasing 7.93+15.04.20141104-0ubuntu1 (2ab2cf4) 2014-11-04 Michael Zanetti * Add a signal to the launcher model to hint changes Approved by: Daniel d'Andrada, PS Jenkins bot (6952202) 2014-10-22 Albert Astals * For the third time i said no const! (b55c383) * I said no const (1576cdc) * not const! (78735f2) * changelog (bfb1e20) * Merge (be5295f) 2014-10-21 Michael Zanetti * rename signal (c68b6ec) 2014-10-20 Albert Astals * Increase version (1e251d3) * API for setFavorite/moveFavoriteTo (f0e37e5) 2014-10-09 Michael Zanetti * merge (4740f42) 2014-10-06 Michael Zanetti * merge prereq (5593b63) * bump version properly (aa634f4) * add a signal to the launcher to hint changes (9d36359) 2014-10-03 CI bot * Releasing 7.92+14.10.20141003.1-0ubuntu1 (f09b44b) 2014-10-03 Michael Zanetti * add a dashActive property to the application API Fixes: 1339883 Approved by: Gerry Boland, PS Jenkins bot, Albert Astals Cid (4576632) 2014-09-29 Michael Zanetti * improve comment (8d26fe3) * update mock and test (4beb536) * dashActive -> forceDashActive (593855d) * merge trunk (30f61ff) 2014-09-22 CI bot * Releasing 7.91+14.10.20140922.1-0ubuntu1 (6cede52) 2014-09-22 Gerry Boland * ApplicationInfoInterface: add splash screen data Fixes: 1254775 Approved by: Gerry Boland, PS Jenkins bot (99020c5) 2014-09-22 Daniel d'Andrada * Merge trunk (434ef13) * Updated changelog (b189558) 2014-09-19 Michael Zanetti * merge trunk (d32e463) * add dashActive property to application API (2aeeeb7) 2014-09-18 CI bot * Releasing 7.90+14.10.20140918-0ubuntu1 (e7196c7) 2014-09-18 Michael Zanetti * Add countVisible property to Launcher API Approved by: Michał Sawicz, PS Jenkins bot, Albert Astals Cid (df4e4f8) 2014-09-12 Daniel d'Andrada * now it will work (3e3bcf9) * Forgot to copy TestUtil's qmldir as well (ea97974) 2014-09-09 Gerry Boland * Improve documentation (7c25ff8) 2014-09-09 Daniel d'Andrada * Correctly test for url and color types (8523829) * Test for the existence of the new splash properties (f01a6c7) * Ensure TestUtil qml and js files are copied again whenever they're changed (2f2b00f) 2014-09-03 Daniel d'Andrada * ApplicationInfoInterface: add splash screen data (8df29c6) 2014-09-03 Michael Zanetti * fix property definition (9b719a4) * fix changelog entry (4fc7258) * proper changelog text (40ce8dd) 2014-09-02 Michael Zanetti * bump changelog (62f84cc) 2014-08-26 Michael Zanetti * update tests (fae81c9) * merge trunk (b08cd37) * bump launcher api version (50fbfcc) * add new requirements for LauncherItems (6e1bded) 2014-08-25 CI bot * Releasing 7.89+14.10.20140825-0ubuntu1 (3d85eb2) * Remove all mentions to screenshotting from the API (8343a90) 2014-08-21 Daniel d'Andrada * Updated debian/changelog (759bffa) * Don't touch this stuff, whatever it's used for (a439105) 2014-08-18 Daniel d'Andrada * Update tests (8a26623) 2014-08-13 Daniel d'Andrada * No mentions of screenshot anywhere (4d31d65) 2014-08-11 Daniel d'Andrada * Update unity-shell-application pkg-config version (3bc26fe) 2014-08-08 Daniel d'Andrada * ApplicationInfo - add updateScreenshot() and discardScreenshot() (08e0678) 2014-08-06 CI bot * Releasing 7.88+14.10.20140806-0ubuntu1 (ea7fb59) 2014-08-06 Pete Woods * Scopes interface v4. Approved by: Michał Sawicz, PS Jenkins bot, Albert Astals Cid (fd364df) 2014-08-04 Michal Hruby * Added Scope::refresh() method (cfedbf9) * Added setNavigationState (4187513) * Revert addition of the query properties (a129265) 2014-08-01 Michal Hruby * Added count property on the Scopes model (160ccc9) * Drop the visible role and property (036631e) * Bump version (4932987) 2014-07-31 Michal Hruby * Added hidden property to NavigationInterface (af8f7c9) * Change the favoriting to a single property (60bffb5) * Fix docs (7460de9) 2014-07-31 CI bot * Releasing 7.87+14.10.20140731-0ubuntu1 (4a41ffb) 2014-07-31 Michal Hruby * Added interface for scopes overview. Approved by: Albert Astals Cid (1e01165) 2014-07-30 Michal Hruby * Added parentQuery property (8cc5b97) * s/isFavorited/favorite/ (cff5f23) * Fix tests (a58fe6b) * Added interface for favouriting a scope (30188be) 2014-07-29 Pete Woods * Just the one status code, simplified list of statuses (93c8187) 2014-07-29 Michal Hruby * Merge status addition (bd41251) 2014-07-28 Michal Hruby * Added one more property (2a6f71d) 2014-07-28 Pete Woods * Add status and details properties to ScopeInterface (f588cd8) 2014-07-25 Michal Hruby * Fix tests (10cfcec) * Make things compile (9e3f750) * Define scopes interface v4 (27a1835) 2014-07-24 Michal Hruby * Bump changelog (12c2bec) * Merge trunk (390c9a1) 2014-07-18 CI bot * Releasing 7.86+14.10.20140718.1-0ubuntu1 (c47c96b) 2014-07-18 Michal Hruby * Require g++4.9 for build to avoid ABI breakage since 4.8. Approved by: PS Jenkins bot, Michi Henning (98ae611) * Allow different gcc micro versions (c166f85) * It's better when the tests pass (9743938) * Bump version (3f82184) * Added overlayColor role (1dc5a79) * Added overviewScope property (18a0dd8) * Fix changelog (cd23f38) 2014-07-11 Robert Bruce Park * Resolve merge conflicts. (8a327a2) 2014-07-08 CI bot * Releasing 7.85+14.10.20140708-0ubuntu1 (8aeeedd) 2014-07-08 Michal Hruby * Added definitions for expansion queries. Approved by: PS Jenkins bot, Michał Sawicz, PS Jenkins bot (0447335) 2014-07-08 Pete Woods * Add settings support for shell Approved by: PS Jenkins bot, PS Jenkins bot, PS Jenkins bot, Michał Sawicz, PS Jenkins bot, PS Jenkins bot, PS Jenkins bot, Michal Hruby (ad70bf4) 2014-07-08 Michi Henning * A few minor fixes to the doc comments for comparison operators. Approved by: PS Jenkins bot, PS Jenkins bot, Marcus Tomlinson (10503a7) 2014-07-08 Michal Hruby * Update changelog (6b7bf6d) * Rename expansionQuery to headerLink (e60c724) 2014-07-08 Pete Woods * Add count property to SettingsModelInterface (30ec9a5) 2014-07-08 Michal Hruby * Merge lp:~unity-api-team/unity-api/scope-settings-shell (07bd4c8) 2014-07-04 Michal Hruby * Added expansion queries (b08572d) 2014-07-03 Pete Woods * Remove dead code (7692696) * Add basic tests for settings interface (5fb8e9c) 2014-07-03 Marcus Tomlinson * Bumped correct API version (4149553) * Bumped versions (d56f7a0) * Formatted enum as per Michal's suggestion (91dbc92) * Merged trunk (1edb4a2) * Merged IniParser changes (2cee33a) 2014-07-02 CI bot * Releasing 7.84+14.10.20140702.2-0ubuntu1 (3168a51) 2014-07-02 Marcus Tomlinson * Add missing IniParser::get_locale_string_array() method (5def566) 2014-07-02 Michal Hruby * Fix the workaround (bf73535) * Workaround issue with arm64 compiler (7472d1b) * Bump versions (f0c6827) * Merge trunk (1f0a125) 2014-07-02 Marcus Tomlinson * Reverted unity::util changes (ade5c63) * Reverted unity::shell changes (7cd2a0d) 2014-07-01 Michi Henning * Set environment variables after all. (I mis-read Jussi's comments.) (eb10e1a) * Require g++ 4.9 for the build. (167300d) 2014-06-30 Michi Henning * Shorted some lines for readability. (b8de439) * Added support for localized string arrays to IniParser. Also fixed test to use correct order of actual and expected values. (1a53440) 2014-06-26 CI bot * Releasing 7.83+14.10.20140626-0ubuntu1 (ebe7088) 2014-06-26 Michal Hruby * Added customizations property to ScopeInterface. (6d8110e) * Revert the version bump, cause it's was not synced with debian anyway (01f8ba7) 2014-06-26 Michi Henning * Oops, a few more corresponding comment fixes. (b0501c4) * Fixed a few doc comments. (23f4389) 2014-06-23 Michal Hruby * Act on review comments (47a63b3) 2014-06-20 Michal Hruby * Added customizations property (0513d45) 2014-06-16 CI bot * Releasing 7.82+14.10.20140616-0ubuntu1 (34881c6) 2014-06-16 Michal Hruby * Add Departments interfaces Fixes: 1320847 (accaab3) 2014-06-12 Pete Woods * Use writable "value" property instead of explicit "setter" (c15f4c0) 2014-06-11 Pete Woods * Add SettingsModelInterface API (97dd2bf) 2014-05-29 Albert Astals * Add the two new methods to the test (8916340) * Changes due to review (8781022) * Merge (1769c94) * Fixed the tag name in case it fails we get a meaningful error (836fddf) * Forgot these files ^_^ (5d9e4d4) 2014-05-28 Albert Astals * Add interfaces for scope departments. (ddc668e) * docu (2aa4422) * Add tests (c952c3c) * Don't change this order (bfc5506) * compile (e6117f2) 2014-05-28 Michal Hruby * Added basics of Departments (77af39f) 2014-05-28 CI bot * Releasing 7.81+14.10.20140528-0ubuntu1 (4ff3e53) 2014-05-28 Michael Zanetti * properly parent MockApplicationInfo objects in the mock plugin. QML might delete them otherwise. (e9bf980) * properly parent mock items otherwise QML deletes them as of 5.2 Fixes: 1318889 (4b191e2) 2014-05-23 Michael Zanetti * also properly parent MockApplicationInfo objects (6943b7d) 2014-05-22 Michael Zanetti * properly parent mock items otherwise QML deletes them as of 5.2 (1480248) 2014-05-20 CI bot * Releasing 7.81+14.10.20140520-0ubuntu1 (cbdb72d) 2014-05-20 Michal Hruby * Scopes API for shell (62ef2af) 2014-05-20 Jussi Pakkanen * Add missing include so compilation works with pch disabled. (89a6e10) 2014-05-19 Albert Astals * better email (193eae3) * TODO (15eb6e1) * get -> getObject or remove if unneeded (ca9207a) * Sanitize gets (8246885) * Forgot to test this method (15fb7bf) * Row count is abstractlistmodel (0cb68d6) * Indentation pedanticness (87a1228) * Add the (e9f303a) * add a (d81a2e4) * Add some spaces to make reviewer happier :) (c1a87df) 2014-05-15 Albert Astals * Add interfaces for scopes. (3a7d7fd) 2014-05-15 Michal Hruby * Drop unneeded method from tests (100a085) * Added docstrings (23d5891) 2014-05-14 Albert Astals * Add chaining constructors (4d848d6) * Make sure the QHash doesn't go away (bd7ecbf) 2014-05-13 Albert Astals * Add mock + tests (35d2ca9) * put the rolenames map in the interface too (016f519) * These will be documented with the property (d159bf9) * Update to 2014 and remove Authors as suggested (84ccff3) 2014-05-12 Albert Astals * change to QString (07ebbf7) * API from unity-scopes-shell (443e3e2) 2014-05-05 CI bot * Releasing 7.80.8+14.10.20140505-0ubuntu1 (e4e9544) 2014-05-05 Mirco Müller * Bump notification interface version because of the added exposure of NotificationModel's Roles-enum. (e056ea2) * Merged with trunk. (291f79e) * Another version-bump was needed, because another branch was merged to trunk before this one. (87cdda8) 2014-04-29 Jussi Pakkanen * Added missing mutex. (0f763f9) 2014-04-28 CI bot * Releasing 7.80.7+14.10.20140428.1-0ubuntu1 (e04c491) 2014-04-28 Michal Hruby * Implemented IniParser::get_locale_string. (0e53607) 2014-04-28 Mirco Müller * Doh (76178b7) * Redone the version-bump for the unity-notification interface. (66b7b55) * Merged mhr3's localized-strings branch. (3b91de5) * Reverted all my changes. (63416dd) 2014-04-23 Michal Hruby * Add more tests (bc95444) * Implemented IniParser::get_locale_string (2dd1b1c) 2014-04-23 Mirco Müller * A upstream version-bump is needed too. (11498f1) 2014-04-16 Mirco Müller * Update debian/changelog entry (1d5f484) * Bumped the unity-api version from 0.1.2 to 0.1.3, because the added exposure of the NotificationModel's Roles-Enum in r126 needs to be trackable by the api-consumers outside. (0eb4603) 2014-04-02 CI bot * Releasing 7.80.6+14.04.20140402-0ubuntu1 (dad7fcb) 2014-04-02 Mirco Müller * The data-roles of the NotificationModel to should be exposed to QML. (cedfeb3) 2014-04-02 Michi Henning * Made calls to IniParser constructor and destructor thread-safe. Without this, if the destructor is called from a different thread than the constructor, we get complaints from thread sanitizer. (0151efc) 2014-04-01 CI bot * Releasing 7.80.6+14.04.20140401-0ubuntu1 (48f64e5) 2014-04-01 Michael Zanetti * Add API to allow unity8 to control the app focusing states a bit better and to move the screenshot logic into the ApplicationManager instead of doing that with QML. (575529a) 2014-04-01 Michał Sawicz * Tweak changelog to make the bump UNRELEASED. (2c024ad) 2014-03-31 Mirco Müller * Renamed enum to just Roles... added enum verification to NotificationModel test. (4ca2d47) 2014-03-25 Mirco Müller * Exposing the data-roles of the NotificationModel to QML... not used yet directly, but we want to keep things in sync as much as possible. (e601ff9) 2014-03-25 Michael Zanetti * bump it more (ff1ec10) * Bump version for Application api changes (9935d10) * merge trunk (ff87ae0) 2014-03-10 Michael Zanetti * fix docs after changing return type (431e3d9) * rename activateApplication() to requestFocusApplication(), also changing its return value to bool (1b279ad) * change updateScreenshot to return a bool instead of void (d824fdd) * fix typo (4cd6497) 2014-03-04 CI bot * Releasing 7.80.5+14.04.20140304-0ubuntu1 (f0f9e1b) * No change rebuild against Qt 5.2.1. (99f63d2) 2014-03-04 Michael Zanetti * bump version for app api (655f1ae) 2014-02-18 Michi Henning * Made calls to IniParser constructor and destructor thread-safe. Without this, if the destructor is called from a different thread than the constructor, we get complaints from thread sanitizer. (3dad3a5) 2014-02-06 Michael Zanetti * introduce suspended property to applicationmanager. (2459069) 2014-02-05 Michael Zanetti * merge trunk (7a09823) 2014-01-21 Automatic PS uploader * Releasing 7.80.5+14.04.20140120-0ubuntu1 (revision 119 from lp:unity-api). (d415cd1) 2014-01-20 Automatic PS uploader * Releasing 7.80.5+14.04.20140120-0ubuntu1, based on r119 (099923b) 2014-01-10 Michael Zanetti * merge trunk (971c106) 2014-01-02 Michi Henning * Removed final semicolon from NONCOPYABLE macro. This makes the usage consistent with the UNITY_DEFINES_PTRS macro, which also does not include the semicolon. (9418012) 2013-12-27 Jussi Pakkanen * Remove deprecated NonCopyable base class. (88a3860) 2013-12-27 Michi Henning * Removed final semicolon from NONCOPYABLE macro. This makes the usage consistent with the UNITY_DEFINES_PTRS macro, which also does not include the semicolon. (8024076) 2013-12-20 Jussi Pakkanen * X (9634a52) 2013-12-20 Michael Zanetti * update mocks and tests accordingly (e5aaf3b) 2013-12-20 Jussi Pakkanen * Remove deprecated noncopyable class. (5cd5567) 2013-12-20 Automatic PS uploader * Releasing 7.80.5+14.04.20131219.1-0ubuntu1 (revision 116 from lp:unity-api). (e3b28ac) 2013-12-19 Automatic PS uploader * Releasing 7.80.5+14.04.20131219.1-0ubuntu1, based on r116 (7dc8959) 2013-12-17 Michael Zanetti * add API for better controlling the app lifecycle flow from within unity (0dab331) 2013-12-17 Michal Hruby * Expose full version including micro version number in pc file. (f694ee3) * Remove extra whitespace (7d303d8) * Expose full version including micro version number in pc file (7c274a4) 2013-12-17 Michi Henning * Changed unity::Exception to return the same string as to_string(). This means that it is no longer necessary to treat unity::Exception differently from std::exception for structured exception handling: catching std::exception will catch unity::Exception as well, and call what() produces the correct result. The pointer returned from what() remains valid until the next call to what(), or until the exception is destroyed. (ffd8920) * Fixed email address in changelog. (91e2467) * Another attempt at getting Jenkins to accept the changelog. (37ec1c6) * Merged trunk and resolved conflict. (79b69e2) * Shortened changelog message. (9a51e7b) 2013-12-16 Jussi Pakkanen * Made noncopyable a macro. (f875680) 2013-12-16 Michi Henning * Updated changelog. (544904a) 2013-12-13 Jussi Pakkanen * Swith all classes to using the NONCOPYABLE macro. (510233b) * Added NONCOPYABLE macro. (7d82f21) 2013-12-13 Michi Henning * Changed unity::Exception to return the same string as to_string(). This means that it is no longer necessary to treat unity::Exception differently from std::exception for structured exception handling: catching std::exception will catch unity::Exception as well, and call what() produces the correct result. The pointer returned from what() remains valid until the next call to what(), or until the exception is destroyed. (7acf591) 2013-12-11 Michael Zanetti * update mocks and tests to reflect API change (819fe03) * add screenshotChanged signal (a1480e3) * revert unrelated whitespace change (a16336e) * proposal for new screenshots api (c3ff285) 2013-11-27 Automatic PS uploader * Releasing 7.80.4+14.04.20131126.2-0ubuntu1 (revision 112 from lp:unity-api). (5b3ccec) 2013-11-26 Automatic PS uploader * Releasing 7.80.4+14.04.20131126.2-0ubuntu1, based on r112 (701ce54) 2013-11-19 Michal Hruby * Added pkg-config variable for shell plugin directory. (7f671d1) 2013-11-18 Michal Hruby * Expose the plugindir suffix (1583b6f) * Add pkg-config variable to get plugin directory (89062b9) 2013-11-18 Albert Astals * Avoid cmake warnings (ac65d2e) 2013-11-06 Albert Astals * Avoid cmake warnings (d097a60) 2013-10-25 Michi Henning * Removed obsolete doxygen config variable that caused a warning during the build. (7ed6807) 2013-10-23 Michi Henning * Removed obsolete doxygen config variable. (5a031f2) 2013-10-21 Michi Henning * Fix warning from clang when building libgtest about unused field. (89610f7) * Fix warning from clang about unused field in gtest. (55b8656) 2013-10-18 Michi Henning * Don't set -fno-permissive when compiling with clang because clang produces an "ignored" warning for this flag. (0b33fa5) * Removed trailing whitespace from previous commit. (c1e72fb) * Don't -fno-permissive when compiling with clang because clang produces an "ignored" warning for this flag. (c0d77b7) 2013-09-27 Automatic PS uploader * Releasing 7.80.3+13.10.20130927.1-0ubuntu1 (revision 106 from lp:unity-api). (ce311fd) * Releasing 7.80.3+13.10.20130927.1-0ubuntu1, based on r106 (14fac90) 2013-09-26 Michi Henning * Reverting commit 89, which added -D_GLIBCXX_DEBUG. This has truly hideous consequences when calling cross-library and passing STL types. If not all libraries involved are compiled with the same flag, the code links and runs and, in many cases, will work, except in some cases, where suddenly the stack gets trashed, the code segfaults on a memory allocation, or similar. (92ce4e8) * Reverting commit 89, which added -D_GLIBCXX_DEBUG. This has truly hideous consequences when calling cross-library and passing STL types. If not all libraries involved are compiled with the same flag, the code links and runs and, in many cases, will work, except in some cases, where suddenly the stack gets trashed, the code segfaults on a memory allocation, or similar. (7b93e89) 2013-09-25 Michi Henning * Changed pkgconfig to use absolute path for Libs, so things will work if the package is installed in a non-standard location. (350cf9f) * Fixed bug from last commit. (9db69e5) * Merged proposed branch. (603db8d) * Addressed Jussi's comment about specifying libdir and includedir consistently for MR https://code.launchpad.net/~michihenning/unity-api/fix-pkgconfig/+merge/187433 (5d79d9e) * Changed pkgconfig to use absolute path for Libs, so things will work if the package is installed in a non-standard location. (141a610) 2013-09-12 Automatic PS uploader * Releasing 7.80.3+13.10.20130912-0ubuntu1 (revision 103 from lp:unity-api). (78c9f44) * Releasing 7.80.3+13.10.20130912-0ubuntu1, based on r103 (dea44f8) 2013-09-12 Michael Zanetti * update Launcher API to make use of the new ApplicationManager api. (7bc886a) 2013-09-11 Michael Zanetti * fix cond/endcond (81cc3f1) * update Launcher API to make use of the new ApplicationManager api (84db5d5) 2013-09-11 Automatic PS uploader * Releasing 7.80.3+13.10.20130911-0ubuntu1 (revision 101 from lp:unity-api). (4cc66e3) * Releasing 7.80.3+13.10.20130911-0ubuntu1, based on r101 (9753781) 2013-09-09 Gerry Boland * Shell::Application: Apply Q_ENUMS to the Roles enum so implementations can use it. (c49b1e0) * Shell::Application: Apply Q_ENUMS to the Roles enum so implementations can use it (b882d05) 2013-09-05 Automatic PS uploader * Releasing 7.80.3+13.10.20130905.2-0ubuntu1 (revision 99 from lp:unity-api). (c4cfbac) * Releasing 7.80.3+13.10.20130905.2-0ubuntu1, based on r99 (41dd5bf) 2013-09-05 Michael Zanetti * add focused role to model. (c60a723) 2013-09-04 Michael Zanetti * add focused role support to launchermodel (ef00cf1) * add applicationFocused method to LauncherModelInterface. (edfa933) 2013-09-04 Gerry Boland * AppManager: change startApplication to return ApplicationInfo, is useful for shell. (ca5d2a8) * AppManager: change startApplication to return ApplicationInfo, is useful for shell (8b5da36) 2013-09-04 Michael Zanetti * add applicationFocused method to launcher (10bdadf) 2013-09-04 Automatic PS uploader * Releasing 7.80.3+13.10.20130904-0ubuntu1 (revision 95 from lp:unity-api). (7fcc148) * Releasing 7.80.3+13.10.20130904-0ubuntu1, based on r95 (50b777d) 2013-09-03 Gerry Boland * ApplicationManagerInterface: adjust API to use appId for app start/stop/focus. Return ApplicationInfoInterface only in get(index) and the new findApplication(appId) methods. (c4e1d5e) * Rename property focusedApplication to focusedApplicationId (d79ab99) * Fix doc errors (b6655be) * Remove const from get(index) (b923e7c) * Missing full stop (cb6bbd5) * ApplicationManagerInterface: adjust API to use appId for app start/stop/focus. Return ApplicationInfoInterface only in get(index) and the new findApplication(appId) methods. (cc8f932) 2013-09-03 Automatic PS uploader * Releasing 7.80.3+13.10.20130903.1-0ubuntu1 (revision 93 from lp:unity-api). (2039284) * Releasing 7.80.3+13.10.20130903.1-0ubuntu1, based on r93 (6d874f3) 2013-09-02 Jussi Pakkanen * Use glibc's memory validator. (19addb9) * Use glibc's memory checker. (c359d50) 2013-09-02 Automatic PS uploader * Releasing 7.80.3+13.10.20130902-0ubuntu1 (revision 91 from lp:unity-api). (7b40707) * Releasing 7.80.3+13.10.20130902-0ubuntu1, based on r91 (7aebf0e) 2013-08-30 Michael Zanetti * Add Ubuntu.Application API, including tests and a mock implementation. (b19125f) 2013-08-29 Michael Zanetti * add moved plugins back (d69d1b6) * fixed a copy/paste mistake in comments (LauncherItem -> ApplicationInfo) (e45ba24) * move to Unity.Application, fix tests (b5bd5bc) * fix type, rename start/stopProcess (a23e002) * make it compile, add tests and a mock implementation (09b2856) * improve app manager's doc (e1d6634) * make focusedApplication a read only property (c416548) * worked in feedback from Gerry (4115eab) 2013-08-28 Michael Zanetti * add applicationmanager and applicationlistmodel (643c203) * applicationmanager -> application (472bb7d) 2013-08-26 Automatic PS uploader * Releasing 7.80.3+13.10.20130826.2-0ubuntu1 (revision 89 from lp:unity-api). (d9e4deb) * Releasing 7.80.3+13.10.20130826.2-0ubuntu1, based on r89 (470c42c) 2013-08-26 Jussi Pakkanen * Enable validating STL on debug builds. (99a4d10) * Enable validating STL on debug builds. (29a3cfa) 2013-08-26 Automatic PS uploader * Releasing 7.80.3+13.10.20130826.1-0ubuntu1 (revision 87 from lp:unity-api). (66b3de9) * Releasing 7.80.3+13.10.20130826.1-0ubuntu1, based on r87 (894f2fa) * Releasing 7.80.3+13.10.20130826-0ubuntu1 (revision 86 from lp:unity-api). (d0f0c04) * Releasing 7.80.3+13.10.20130826-0ubuntu1, based on r86 (33aceb0) 2013-08-22 Michael Zanetti * Add setUser method to LauncherModel. (5309228) * add setUser() to LauncherModel (a78be62) 2013-08-20 Automatic PS uploader * Releasing 7.80.3+13.10.20130820.2-0ubuntu1 (revision 84 from lp:unity-api). (1e9f8af) * Releasing 7.80.3+13.10.20130820.2-0ubuntu1, based on r84 (474dde9) * Releasing 7.80.3+13.10.20130820.1-0ubuntu1 (revision 82 from lp:unity-api). (93a6b95) * Releasing 7.80.3+13.10.20130820-0ubuntu1 (revision 82 from lp:unity-api). (742cee0) * Releasing 7.80.3+13.10.20130820.1-0ubuntu1, based on r82 (065098f) * Releasing 7.80.3+13.10.20130820-0ubuntu1, based on r82 (4c6ad5e) 2013-08-19 Michael Zanetti * Add a role, clickable to quicklistModel which determines if the entry can be clicked or not. (767d8a4) * HasAction -> Clickable (bdb7305) * add a role, hasAction to quicklistModel which determines if the entry can be clicked or not (dbdbf98) 2013-08-01 Automatic PS uploader * Releasing 7.80.3+13.10.20130801-0ubuntu1 (revision 80 from lp:unity-api). (363b609) * Releasing 7.80.3+13.10.20130801-0ubuntu1, based on r80 (1c66850) 2013-07-29 Automatic PS uploader * Releasing 7.80.3+13.10.20130729ubuntu.unity.next-0ubuntu1 (revision 79 from lp:unity-api). (aa240f5) * Releasing 7.80.3+13.10.20130729ubuntu.unity.next-0ubuntu1, based on r79 (50b54be) 2013-07-27 Michi Henning * Added UNITY_DEFINES_PTRS (needed by scopes). Added coverage suppresssion for unreachable line of code. (4bd65de) * Changed DefinesPtrs to a macro. That way, we don't need a virtual destructor, and the generated typedefs can be used with POD types. The macro also prevents ambiguous names that were caused by the template for classes in a derivation hierarchy. (dfe7cfa) 2013-07-23 Michi Henning * Added UNITY_DEFINES_PTRS (needed by scopes). Added coverage suppresssion for unreachable line of code. (4b88e52) * Changed DefinesPtrs to a macro. That way, we don't need a virtual destructor, and the generated typedefs can be used with POD types. The macro also prevents ambiguous names that were caused by the template for class in a derivation hierarchy. (e435238) 2013-07-09 Automatic PS uploader * Releasing 7.80.3+13.10.20130709ubuntu.unity.next-0ubuntu1 (revision 76 from lp:unity-api). (abb3c24) * Releasing 7.80.3+13.10.20130709ubuntu.unity.next-0ubuntu1, based on r76 (17472c2) 2013-07-08 Michael Zanetti * more work on launcher API (7e40860) * fix indentation in launcher tests (574823c) * fix comments (4b939dc) * fix comments for closing namespace braces (a22d1f6) * remove logic from mocks and tests for it (e276070) * make roleName maps static to save some CPU cycles (95174cc) * comment improvement++ (c7aa545) * improve some comments (dabb69f) * quickListIndex -> actionIndex (087260e) * fix typo in comment (0113068) * some more suggested fixes (27032b3) * introduce appId property for items and use that for write operations (28af9be) * bump only the launcher version, not the API's minor version (9b57c00) 2013-07-05 Michael Zanetti * bump it even more (2f6fbae) * bump the version a bit more (d1cc8af) * bump version numbers (3f7c39d) * move signal spy to top (c338e26) * fix header (78aa389) * that shouldn't have gone in (94c8de7) * remove the two future roles from the docs. Will come back in unity9. (e63f44f) * fix include guard (addb1b8) 2013-07-04 Michael Zanetti * added method triggerQuickListAction (c624af8) * more work on launcher API (a41a96c) 2013-07-03 Automatic PS uploader * Releasing 7.80.2+13.10.20130703ubuntu.unity.next-0ubuntu1 to ubuntu. (fb82776) * Releasing 7.80.2+13.10.20130703ubuntu.unity.next-0ubuntu1, based on r74 (ab1cc06) 2013-07-02 Michał Sawicz * Do not require any particular version of boost. (d17dd4d) * Do not require any particular boost version (eb0a539) 2013-07-02 Automatic PS uploader * Releasing 7.80.2+13.10.20130702ubuntu.unity.next-0ubuntu1 to ubuntu. (084c6d5) * Releasing 7.80.2+13.10.20130702ubuntu.unity.next-0ubuntu1, based on r72 (55000f3) 2013-06-28 Didier Roche * Add a better package description. (c0bb343) * better package description (de746b6) 2013-06-27 Automatic PS uploader * Releasing 7.80.2+13.10.20130627ubuntu.unity.next-0ubuntu1 to ubuntu. (b43179b) * Releasing 7.80.2+13.10.20130627ubuntu.unity.next-0ubuntu1, based on r70 (56e430c) 2013-06-27 Michi Henning * Renamed COPYING.LIB -> COPYING. Fixes: https://bugs.launchpad.net/bugs/1194867. (91b30e0) 2013-06-27 Didier Roche * Prepare the package to enter saucy. (c44be4e) 2013-06-27 Michi Henning * Renamed COPYING.LIB -> COPYING. (621747d) 2013-06-27 Didier Roche * really take trunk version for headers (2002f0e) * remerge with trunk and backout the license header change (e1da950) 2013-06-27 Michi Henning * Changed "Lesser GNU General Public License" to "GNU Lesser General Public License" throughout. Fixed five files that used GPL instead of LGPL. licensecheck comes up clean now, reporting LGPL v3 for everything. Fixes: https://bugs.launchpad.net/bugs/1194867. (34e924d) * Changed "Lesser GNU General Public License" to "GNU Lesser General Public License" throughout. Fixed five files that used GPL instead of LGPL. licensecheck comes up clean now, reporting LGPL v3 for everything. (7ecfa66) 2013-06-26 Didier Roche * add bootstrap commit (c83c198) * switch to format source 1, more compatible with dailies (14bfd12) * use CMAKE_INSTALL_LIB which already has the multiarch magic (661c9cb) * small debian/rules improvment (a52d82a) * add missing debian/copyright headers (45e7ce0) * control and some licenses fixing, but then, opening a bug for more license fix needed (f5d61ea) 2013-06-24 Michi Henning * Added astyle-config. (c8d83e2) 2013-06-20 Jussi Pakkanen * Added ini file parser. (7cdccf9) * Merged trunk. (2465881) * Surrendered to astyle. (dec972a) 2013-06-20 Michi Henning * Added astyle-config. (207f9d0) 2013-06-19 Michael Zanetti * Add Launcher API to unity-api. (59ec1a6) 2013-06-19 Jussi Pakkanen * Check for Clang in CMakeLists.txt. (9d23136) * Check clang from within CMakeLists.txt. (df06cb0) 2013-06-19 Michael Zanetti * added testcase that checks if the model is here and of correct type (05c9f50) * merge trunk (19f7861) 2013-06-19 Jussi Pakkanen * Added precompiled header support to unity-api target. (47dbf29) 2013-06-19 Michael Zanetti * merged saviq's suggestions (319c507) 2013-06-19 Jussi Pakkanen * Merged trunk. (bb09659) 2013-06-19 Michi Henning * This changes the build environment to link the tests against a static version of the library, allows us to write unit tests for internal classes that are not visible through the public API (support classes in the internal namespace that don't have a public pimple facade). (e159f47) 2013-06-19 Jussi Pakkanen * Merged trunk. (cb5f93c) * Moved stars and ampersands around. (c2666ac) * Added documentation to precompiled header module. (390b182) 2013-06-19 Michi Henning * Changed build to use -fPIC only for the source files that go into the .so and .a libraries. Improved comments and fixed some typos in comments. (f4e3547) 2013-06-18 Jussi Pakkanen * Added copyright header for the pch. (39b966d) * Made packaging CCache work nicely with pch. (7991aab) * Added precompiled header support for unity-api target. (fae200f) 2013-06-18 Michi Henning * Improved compliance with style guide: function and member function definitions now with return type, class name, and function name on one line. (ceeacc7) * This changes the build environment to link the tests against a static version of the library, allows us to write unit tests for internal classes that are not visible through the public API. (c72c9b4) * Improved compliance with style guide: function and member function definitions now with return type, class name, and function name on one line. (3d69812) 2013-06-17 Michi Henning * Added missing architecture directory to pkg-config file. (b501f5e) * Removed unity::internal::ExceptionImpl and replaced it with unity::ExceptionImplBase. This allows clients of unity-api to derive their own exceptions for unity::Exception without exposing any implementation details (so the ABI won't break) and still take advantage of implementation inheritance without having to reimplement all the functionality of the base class. (f6f3b17) * Merged trunk. (f393e6d) 2013-06-14 Michi Henning * Changed copyright headers to LGPLv3. (e7b5f8d) * Merged trunk. (01214d2) * Removed unity::internal::ExceptionImpl and replaced it with unity::ExceptionImplBase. (802ebb9) * Added COPYING.LIB with text for LGPLv3 from http://www.gnu.org/licenses/lgpl.txt (1fcbb08) * Changed include/unity/shell/notifications/CMakeLists.txt to use ${LIBDIR} to install the .pc file in the correct location. (ac710eb) 2013-06-13 Michi Henning * Added warning if cppcheck isn't found. Fixes: https://bugs.launchpad.net/bugs/1190374. (d495cd4) 2013-06-13 Jussi Pakkanen * Doxygen function grouping. (dced39c) 2013-06-13 Michi Henning * Trying to get the install working with jenkins... (528131e) * Added Multi-Arch to debian/rules as requested by didrocks. Removed redundant libdir variable from CMakeLists.txt. Adjusted libunity-api.pc.in to use LIBDIR. (784bf0d) * Changed copyright headers to LGPLv3. (dc7aca2) * Added warning if cppcheck isn't found. (ddcf744) 2013-06-12 Michi Henning * Renamed config.h -> DllExport.h. Removed Version.h.cmake, which is was moldy oldie, now called Version.h.in. Fixes: https://bugs.launchpad.net/bugs/1185319. (8d8645c) 2013-06-11 Jussi Pakkanen * Init count to 0 for extra explicitness. (3c52a66) 2013-06-11 Michael Zanetti * some more styling changes (0981a9e) * merge trunk (2cbd680) * "" -> <> (08dbae4) 2013-06-11 Jussi Pakkanen * Put group name in error message. (34547ad) * Added a space for better output message. (eb65e49) 2013-06-11 Michi Henning * Added --check-config to the cppcheck target, so we get better diagnostics. (af9cb56) * Added --check-config to the cppcheck target, so we get better diagnostics. (b11c234) 2013-06-10 Michael Zanetti * fix ret values (c1f86bf) * update tests (28dddc1) * fix some more warnings (6ae7121) * some more styling (90b6442) * whitespace-- (2143fd2) * made copyright headers consistent (9af0b1f) * add documentation for the interface (7e8aa7f) * suppress false positives from cppcheck (c809454) * fix ctor, add progress api (9511e45) 2013-06-10 Jussi Pakkanen * Removed fluff Doxygen comments that are no longer required. (8a251c6) 2013-06-10 Michi Henning * Changed doxygen config to ignore symbols in any internal namespace, so we don't need to add endless @cond/@endcond pairs . (40b22c1) 2013-06-08 Michi Henning * Changed doxygen config to ignore symbols in any internal namespace, so we don't need to add endless @cond/@endcond pairs. (c950da8) 2013-06-07 Jussi Pakkanen * Added suppressions for GKeyFile. (6214dbb) * Added Doxygen tags for every single function, even the painfully obvious ones. (ec3c60f) 2013-06-07 Michi Henning * Added -g to compile flags when building for coverage. That way, valgrind and gdb will report line numbers. (3d491f0) 2013-06-07 Jussi Pakkanen * Carry filename around and add it to exception descriptions. (bc07ca6) * Change exception type. (56f794e) * Added a few noexcepts. (b22214c) * More allmanisation. (00e53fe) * Changed exception type. (75e019c) * Changed exception type. (9b06ce9) * Moved private struct to internal namespace. (2d3fa0d) * Changed to Allman style because opening braces are special little snowflakes that _need_ a line of their own. (102cbe6) * Fix memory leak. (b447563) * Add file name to exception message. (fd05853) * Made_function_names_underscored. (3d169c0) 2013-06-07 Michi Henning * Added -g to compile flags when building for coverage. That way, valgrind and gdb will report line numbers. (950f088) 2013-06-06 Jussi Pakkanen * Check for glib and gtest in public headers. (e69f66f) * Removed some leftover code. (5ad6822) * Added missing newline. (56ffecd) * Some more tests and documentation. (0c66e8b) * More IniParser tests. (da7feb9) * First tests for IniParser. (1dd4b16) * Added test fixture for IniParser. (d51065f) * Added class to do ini file parsing. (7d76c86) 2013-06-06 Michi Henning * Removed Version class and hoisted version functions into unity::api namespace. Fixed doc accordingly. (070224f) * Removed Version class and hoisted version functions into unity/api namespace. Fixed doc accordingly. (cfe7792) 2013-06-05 Michael Zanetti * enable all sample data again (880d9cd) * fixed and extended tests (188831e) * added LauncherModelItem, mocks and tests (still failing) (32b4953) 2013-06-04 Sergio Schvezov * This project forked from lp:unity/phablet. Updating the versioning to reflect that. (fbccbea) * This project forked from lp:unity/phablet. Updating the versioning to reflect that. (0da2f16) * Releasing for saucy. (169cc8a) 2013-06-04 Michael Zanetti * merge trunk (83ccfa8) 2013-06-04 Michał Sawicz * Fix Verifier.qml for more reliable qmltests. (37384f5) * Fix Verifier.qml and tst_Notifications.qml to have more reliable tests (2d2ab45) * add some debugs (c9fee86) 2013-06-04 Sergio Schvezov * Releasing for saucy. (25e944c) 2013-05-30 Michi Henning * Renamed DllExport.h to SymbolExport.h (9d9de54) * Renamed config.h -> DllExport.h. Removed Version.h.cmake, which is was moldy oldie, now called Version.h.in. (8fde182) 2013-05-29 Michi Henning * Jenkins got upset about the libunity-api0.install instructions. Hopefully, this will fix it. (91d4185) * Updated the package config files as suggested by Jussi. (39eb773) * Moved ResourcePtr from internal namespace into public namespace, so it can be re-used by components outside libunity-api. (af7b470) * Moved ResourcePtr from internal namespace into public namespace, so it can be re-used by components outside libunity-api. (c478615) 2013-05-27 Michael Zanetti * second version of the launcher api draft (f14f7fc) 2013-05-27 Michi Henning * Added missing architecture directory to package config. (e5466b0) 2013-05-22 Michi Henning * Fixed check_copyright.sh to not generate bogus reports for generated files when building in release or coverage mode. Removed check_whitespace.sh, which is obsolete now. (Same job is now done by check_whitespace.py.). (bb1ac2a) * Fixed check_copyright.sh to not generate bogus reports for generated files when building in release or coverage mode. Removed check_whitespace.sh, which is obsolete now. (Same job is now done by check_whitespace.py.) (4dda452) 2013-05-21 Michi Henning * Made daemonize_me() more robust when called at the file descriptor limit and when memory is low. Provided strong exception guarantee for a few more corner cases. Fixed coverage test for this to not report nonsense. (Previous version had race conditions; depending on timing, coverage report was either OK or reported covered things as uncovered.) Improved test to make sure SIGHUP is correctly restored. Fixed build errors in release mode due to unused return values. (7440308) * Removed recovery if vector throws bad_alloc. If the process is sailing this close to the wind, it'll probably die in the next millisecond or so anyway, even if we recover here. The added complexity isn't worth it. (8be5f7b) * Replaced use of system() to create test files and directories with libc file I/O calls. (b0d100e) 2013-05-20 Michi Henning * Made daemonize_me() more robust when called at the file descriptor limit and when memory is low. Provided strong exception guarantee for a few more corner cases. Fixed coverage test for this to not report nonsense. (Previous version had race conditions; depending on timing, coverage report was either OK or reported covered things as uncovered.) Improved test to make sure SIGHUP is correctly restored. Fixed build errors in release mode due to unused return values. (5bd5284) 2013-05-17 Michael Zanetti * first draft of the launcher API. To be discussed. (bc211d6) 2013-05-17 Michi Henning * Added strong exception guarantee if working directory was changed and first fork fails. (7e4edb6) 2013-05-17 Michał Sawicz * add shell Notifications API and tests. (2690ac8) * add QmlTest.cmake and qml TestUtil module. (167b15e) 2013-05-16 Michał Sawicz * fix some packaging issues and enable multiarch. (89d1c2e) 2013-05-16 Michi Henning * Updated version semantics to state that only major version change indicates ABI incompatibility. (f96c9d7) * Updated version semantics to state that only major version change indicates ABI incompatibility. (e80b5b0) 2013-05-16 Michał Sawicz * protect ModelInterface and SourceInterface c'tors, too (7e2e35d) 2013-05-16 Jussi Pakkanen * Make line numbers start with 1 rather than 0. (2276afa) * Start line numbering at 1 rather than 0. (0540f18) 2013-05-16 Michi Henning * Added generated tests to cppcheck so we don't get bogus reports for unused functions. Enabled inline suppression of cppcheck errors. Changed formatting of cppcheck output to include the name of an error, which makes it easier to write inline suppressions. (713c1dd) 2013-05-16 Michał Sawicz * Protect NotificationInterface constructor and tweak doxygen comments (7c992ff) 2013-05-16 Michi Henning * doc fixes (85078af) * Added generated tests to cppcheck so we don't get bogus reports for unused functions. Enabled inline suppression of cppcheck errors. Changed formatting of cppcheck output to include the name of an error, which makes it easier to write inline suppressions. (2c006ce) 2013-05-16 Michał Sawicz * add cppcheck suppression to MockActionModel::rowCount (928a343) * merge trunk (c08d838) 2013-05-16 Michi Henning * Modified includechecker.py to permit a specified set of includes for a particular sub-tree. This makes it possible to #include things from Qt in the include files for the shell interface, but still flag them as illegal for other include files. Also moved includechecker.py to the test/headers directory because that's were the other header-related tests are. (9c96813) 2013-05-16 Michał Sawicz * merge add-qmltest-util (32372be) * fix import path (8748dbe) * rename "util" to "qmltest" (bca2c0e) 2013-05-15 Michi Henning * Removed include/unity/scopes subdirectory that shouldn't have been there. (If anywhere, that dir will eventually go into unity/api and unity/shell.). (a869ec5) 2013-05-16 Michi Henning * Fixed broken modifications to includecheck.py (thanks Sawicz!) (226dd25) * Removed left-behind line for now non-existent include directory. (83899d2) 2013-05-15 Michał Sawicz * convert the slots to signals to ensure asynchronicity (f877757) * send hovered and displayed values to onHovered / onDisplayed and add documentation (0b3df92) * merge add-qmltest-util (47b88b0) * fix passing PROPERTIES to add_qml_test (795f728) * merge add-testutil-module (f047692) * move TestUtil module under test/ (106eab0) 2013-05-15 Michi Henning * Changed build to build*, so things like buildcoverage and buildrelease will be ignored and won't cause complaints when trying to commit. (b9ac3c5) * Changed build to build*, so things like buildcoverage and buildrelease will be ignored and won't cause complaints when trying to commit. (38bb72e) * Removed stale directories that shouldn't have been there in the first place. (844693f) * Modified includechecker.py to permit a specified set of includes for a particular sub-tree. This makes it possible to #include things from Qt in the include files for the shell interface, but still flag them as illegal for other include fieles. Also moved includechecker.py to the test/headers directory because that's were the other header-related tests are. (f25f359) 2013-05-14 Michał Sawicz * use separate SOVERSION (3eb3de2) * merge add-qmltest-utils (4c91371) * add one more missed dep (2781802) * fix c++ and naming style (c1492bb) * merge add-qmltest-utils (2389eee) * add global -DQT_NO_KEYWORDS (8f66aad) * merge fix-packaging (c117274) * depend on python3 directly (bd63de5) * add missing dependencies (8f45da8) * fix style issues (2662e2d) 2013-05-14 Michi Henning * Updated CTestCustom.cmake.in to not run tests under valgrind for which valgrind doesn't make sense, such as all the scripts that test headers for various forbidden things. Also removed stale entries left over from the move from the phablet tree. (72a5e5c) 2013-05-14 Michał Sawicz * merge trunk (fa1f6f1) 2013-05-14 Michi Henning * Minor fixed to README and INSTALL files. (5a4ab1c) * Minor updates to build instructions. (67c4c98) * Removed tests for which valgrind doesn't make sense from the valgrind target. (e6077cd) 2013-05-13 Michał Sawicz * bring changes from lp:unity/phablet in bulk. (b5a5053) * add packaging, remove test failing in build environment and fix CMakeLists.txt. (b56e877) * merge fix-packaging (618fd01) * enable multiarch installation (967dbd1) * reduce lintian and dpkg warnings (318d3b6) * drop Qt define from base CMakeLists.txt (cfbc781) * packaging changes for shell API inclusion (699b55e) * add mock Notifications implementation (f5ec1d5) * add Notifications shell API headers (9f7f5be) * add Notifications shell API tests (bd8aeae) * add QmlTest and TestUtil module (b6367d8) * merge packaging (ad3f085) * dummy commit (892b498) * add packaging, remove test failing in build environment and fix CMakeLists.txt (33afde9) * bring changes from lp:unity/phablet in bulk (bb30f2f) 2013-04-03 Michi Henning * Improved doc for Version.h (6d7aa27) * Moved Exception.cpp and UnityExceptions.cpp into correct place in directory hierarchy. Minor fixes to cmake files. (60ab12d) * Fixed warnings from doxygen about undocumented methods. (47a0929) * Merged trunk. (c62f274) * Fixed doxygen config to include generated headers. Suppressed doxygen chatter on stdout during build. Improved documentation for Version.cpp. (d8617ba) * Removed dependency on boost threads library from ResourcePtr. Added LockAdopter helper class to ResourcePtr. (442fae3) 2013-04-02 Michi Henning * Added final and override keywords as appropriate. (bd82f79) * Improved tests for move constructor and move assignment operator. (3f24320) 2013-03-28 Michi Henning * Improved move copy and move assignment to use std::move. (add0fbc) 2013-03-27 Michi Henning * Fixed typo in doc. (a1c1f71) * Changed close_open_fiels() to not throw. (d5c7b1c) * Added TODO for hash. (9df57fe) * More doc improvements. (730e912) * Improved documentation. (bac5bb0) * Added coverage for DefinesPtrs. (484b16f) * Merged CMake work. (39f6ae6) 2013-03-26 Michi Henning * Changed FileIO to allow empty files to be read. (2a9f46d) 2013-03-26 Jussi Pakkanen * Use the REQUIRED flag instead of checking manually. (6f05f1d) 2013-03-18 Jussi Pakkanen * Build GTest directly instead of using ExternalProject. (f2d81b3) * Do not require Doxygen. (3248dc6) 2013-03-15 Jussi Pakkanen * Properly detect threading library instead of just using it blindly. (88579a8) 2013-03-15 Michi Henning * Changed location of output file for daemon test to current dir (used to be /tmp). (bd95e61) * More cleanup for cmake. (f8946ab) 2013-03-14 Michi Henning * Added new api namespace and adjusted tree structure. Many cleanups on the cmake files. (1f33e2f) * Moved a lot of Doxygen comments out of header file. (472ad29) * Fixed incorrect swap call. (Non-member swap() had no coverage.)` (4bf8667) * Removed redundant template<> lines. (9031876) * Removed left-behind #if 0. (a517384) * Backed out gcc 4.6 fix, we won't be using that compiler. Removed left-behind #if 0 section. (89686f2) * Some renaming in ResourcePtr and documentation improvements. More tests. (389c339) * Updated for new build directory naming convention. (2a36cd4) * More minor fixes to cmake files, mainly to add back missing dependency on libgtest.a. (616d5bb) 2013-03-13 Michi Henning * Fixed cmake issues with Jussi's help. (c86d2e1) 2013-03-10 Michi Henning * Minor renaming for clarity. Fixed race condition with get_deleter(). Added deleter to the members swapped by swap(). (8dc9ea1) 2013-03-08 Michi Henning * Moved doxygen comments out of line so the class definition is more readable. Reordered member functions to be group more logically. (0ba7c29) 2013-03-07 Michi Henning * Fixed ambiguous comment. (5e8cb5a) * Fixed off-by-one error. (e289c16) * Minor fix for bug in gcc 4.6. (ce369e5) * Initial check-in of build-environment skeleton. (1da3129) lomiri-api-0.2.1/INSTALL000066400000000000000000000100251443550065200146070ustar00rootroot00000000000000# # Copyright (C) 2013 Canonical Ltd # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License version 3 as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see . # # Authored by: Michi Henning # ------------------------------------------------------------------------------------- NOTE: Before making changes to the code, please read the README file in its entirety! ------------------------------------------------------------------------------------- Build dependencies ------------------ See debian/control for the list of packages required to build and test the code. Building the code ----------------- The simplest case is: $ mkdir build $ cd build $ cmake .. By default, the code is built in release mode. To build a debug version, use $ mkdir builddebug $ cd builddebug $ cmake -DCMAKE_BUILD_TYPE=debug .. $ make For a release version, use -DCMAKE_BUILD_TYPE=release To build with the flags for coverage testing enabled: $ mkdir buildcoverage $ cd buildcoverage $ cmake -DCMAKE_BUILD_TYPE=coverage $ make Running the tests ----------------- $ make $ make test Note that "make test" alone is dangerous because it does not rebuild any tests if either the library or the test files themselves need rebuilding. It's not possible to fix this with cmake because cmake cannot add build dependencies to built-in targets. To make sure that everything is up-to-date, run "make" before running "make test"! To run the tests with valgrind: $ make valgrind To get coverage output: $ make test $ make coverage-html This drops the coverage tests into the coveragereport directory. (The coverage-html target is available only if the code was built with -DCMAKE_BUILD_TYPE=coverage.) Note that, with gcc 4.7.2 and cmake 2.8.10, you may get a bunch of warnings. To fix this, you can build cmake 2.8.10 with the following patch: http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=61ace1df2616e472d056b302e4269cbf112fb020#patch1 Unfortunately, it is not possibly to get 100% coverage for some files, mainly due to gcc's generation of two destructors for dynamic and non- dynamic instances. For abstract base classes and for classes that prevent stack and static allocation, this causes one of the destructors to be reported as uncovered. There are also issues with some functions in header files that are incorrectly reported as uncovered due to inlining, as well as the impossibility of covering defensive assert(false) statements, such as an assert in the default branch of a switch, where the switch is meant to handle all possible cases explicitly. If you run a binary and get lots of warnings about a "merge mismatch for summaries", this is caused by having made changes to the source that add or remove code that was previously run, so the new coverage output cannot sensibly be merged into the old coverage output. You can get rid of this problem by running $ make clean-coverage This deletes all the .gcda files, allowing the merge to succeed again. If lcov complains about unrecognized lines involving '=====', you can patch geninfo and gcovr as explained here: https://bugs.launchpad.net/gcovr/+bug/1086695/comments/2 To run the static C++ checks: $ make cppcheck Installation ------------ To get files that form part of an installation, run a "make install" in the build directory. By default, this installs them in the "install" subdirectory of the build directory. If you want to install into a different directory, use $ cmake -DCMAKE_INSTALL_PREFIX=/usr/local # Or wherever... $ make release $ make install lomiri-api-0.2.1/NEWS000066400000000000000000000013731443550065200142630ustar00rootroot00000000000000Overview of changes in lomiri-api 0.2.1 - Expose ready property - Upgrade C++ standard to C++17 Overview of changes in lomiri-api 0.2.0 - Add showSplash property - Add serverSideDecoration property - Fixes around compiling and tests - Bump application shell api to 28 Overview of changes in lomiri-api 0.1.1 - Add multi monitor and workspace API. - Add AttachedState state enum. - Add D-Bus sanitize helpers. - Make sure to export D-Bus and Snap APIs. - GioMemory_test: print error from Glib - Remove smart pointer for GRefString. - Do not hardcode the actual values, and string representation of errno constants, as they are implementation-defined. Overview of changes in lomiri-api 0.1.0 - Fork / renamed from unity-api. lomiri-api-0.2.1/README000066400000000000000000000231441443550065200144440ustar00rootroot00000000000000# # Copyright (C) 2013 Canonical Ltd # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License version 3 as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see . # # Authored by: Michi Henning # This is an explanation of the layout of the source tree, and the conventions used by this library. Please read this before making changes to the source! For instructions on how to build the code, see the INSTALL file. Build targets ------------- The build produces the Lomiri API library (liblomiri-api). TODO: Flesh this out Source tree layout ------------------ At the top level, we have src, include, and test, which contain what they suggest. Underneath src and include, we have subdirectories that correspond to namespaces, that is, if we have src/internal, that automatically means that there is a namespace lomiri::scopes::internal. This one-to-one correspondence makes it easier to work out what is defined where. Namespaces ---------- The library maintains a compilation firewall, strictly separating external API and internal implementation. This reduces the chance of breaking the API, and it makes it clear what parts of the API are for public consumption. Anything that is not public is implemented in a namespace called "internal". TODO: More explanation of the namespaces used and for what. Header file conventions ----------------------- All header files are underneath include/lomiri. Source code always includes headers using the full pathname, for example: #include All source code uses angle brackets (<...>) for #include directives. Double quotes ("...") are never used because the lookup semantics can be surprising if there are any headers with the same name in the tree. (Not that this should happen, but it's better to be safe. If there are no duplicate names, inclusion with angle brackets behaves the same way as inclusion with double quotes.) All headers that are for public consumption appear in include/lomiri/* (provided the path does not include "internal"). Public header directories contain a private header directory called "internal". This directory contains all the headers that are private and specific to the implementation. No public header file is allowed to include any header from one of the internal directories. (Doing so would break the compilation firewall and also prevent API clients from compiling because the internal headers are not installed when lomiri is deployed. (This is enforced by the tests.) All header files, whether public or internal, compile stand-alone, that is, no header relies on another header being included first in order to compile. (This is enforced by the tests.) Compilation firewall -------------------- Public classes use the pimpl (pointer-to-implemtation) idiom, also known as "envelope-letter idiom", "Cheshire Cat", or "Compiler firewall idiom". This makes it less likely that an update to the code will break the ABI. Many classes that are part of the public API contain only one private data member, namely the pimpl. No other data members (public, protected, or private) are permitted. For public classes with shallow-copy semantics (classes that are immutable after instantiation), the code uses std::shared_ptr as the pimpl type because std::shared_ptr provides the correct semantics. (See lomiri::Exception and its derived classes for an example.) For classes that are non-copyable, std::unique_ptr is used as the pimpl type. If classes form derivation hierarchies, by convention, the pimpl is a private data member of the root base class. Derived classes can access the pimpl by calling the protected pimpl() method of the root base class. This avoids redundantly storing a separated pimpl to the derived type in each derived class. Instead, polymorphic dispatch to virtual methods in the derived classes is achieved by using a dynamic_cast to the derived type to forward an invocation to the corresponding virtual method in the derived implementation class. Error handling -------------- No error codes, period. All errors are reported via exceptions. All exceptions thrown by the library are derived from lomiri::Exception (which is abstract). lomiri::Exception provides a to_string() method. This method returns the exception history and prints all exceptions that were raised along a particular throw path, even if a low-level exception was caught and translated into a higher level exception. This works for exceptions derived from std::nested_exception. (The exception chaining ends when it encounters an exception that does not derive from std::nested_exception.) If API clients intercept lomiri exceptions and rethrow their own exceptions, it is recommended that API clients derive their exceptions from lomiri::Exception or, alternatively, derive them from std::nested_exception and implement a similar to_string() operation that, if it encounters a lomiri::Exception while following a chain, calls the to_string() method on lomiri::Exception. That way, the entire exception history will be returned from to_string(). Functions that throw exceptions should, if at all possible, provide the strong exception guarantee. Otherwise, they must provide the basic (weak) exception guarantee. If it is impossible to maintain even the basic guarantee, the code must call abort() instead of throwing an exception. Resource management ------------------- The code uses the RAII (resource acquisition is initialization) idiom extensively. If you find yourself writing free, delete, Xfree, XCloseResource, or any other kind of clean-up function, your code has a problem. Instead of explictly cleaning up in destructors, *immediately* assign the resource to a unique_ptr or shared_ptr with a custom deleter. This guarantees that the resource will be released without having to remember anything. In particular, it guarantees that the resource will be released even if allocated in a constructor near the beginning and something called by the constructor throws before the constructor completes. For resources that cannot be managed by unique_ptr or shared_ptr (because the allocator does not return a pointer or returns a pointer to an opaque type), use the RAII helper class in ResourcePtr.h. It does much the same thing as unique_ptr, but is more permissive in the types it can manage. Note the naming convention established by util/DefinesPtrs.h. All classes that return or accept smart pointers derive from DefinesPtrs, which is a code injection template that creates typedefs for Ptr and UPtr (shared_ptr and unique_ptr, respectively) as well as CPtr and UCPtr (shared_ptr and unique_ptr to constant instances). Ideally, classes are fully initialized by their constructor so it is impossible for a class to exist but not being in a usable state. For some classes, it is unavoidable to provide a default constructor (for example, if we want to put instances into an array). It is also sometimes impossible to fully construct an instance immediately, for example if the instance is member variable and the necessary initialization data is not available until some time afterwards. In this case, the default constructor must initialize the class to a fail-safe state, that is, it must behave sanely in the face of methods being invoked on it. This means that calling a method on a default-constructed instance should throw a logic exception to indicate to the caller that the instance is not fully initialized yet. Note that turning method calls on not-yet-initialized instances into no-ops is usually a bad idea: the caller thinks that everything worked fine when, in fact, it did nothing. If such no-op methods do something sensible (that is, they can do their job even on an incompletely initialized instance), this begs the question of why the instance wasn't default-constructible in the first place... To sum it up: try to enforce complete initialization from the constructor wherever possible. If it is impossible to do that, follow the principle of least surprise for the caller if a method is called on a not-yet-initialized instance. Loose ends ---------- Things that need fixing or checking are marked with a TODO comment in the code. Things that are work-arounds for bugs in the compiler or libraries are marked with a BUGFIX comment. Things that are dubious in some way with no better solution available are marked with a HACK comment. Style ----- Consider running astyle over the code before checking it in. See astyle-config for more details. Versioning ---------- When adding API, remember to both bump: - the debian/changelog version and - the VERSION field in the relevant CMakeLists.txt file Test suite ---------- The test suite lives underneath the test directory. test/headers contains tests relating to header file integrity. test/gtest contains the C++ tests (which use Google test). The Google gtest authors are adamant that it is a bad idea to just link with a pre-installed version of libgtest.a. Therefore, libgtest.a (and libgtest_main.a) are created as part of the build and can be found in test/gtest/libgtest. See the INSTALL file for how to run the tests, particularly the caveat about "make test" not rebuilding the tests! Building and installing the code -------------------------------- See the INSTALL file. lomiri-api-0.2.1/astyle-config000066400000000000000000000021661443550065200162540ustar00rootroot00000000000000# Options for formatting code with astyle. # # This helps to make code match the style guide. # # Use like this: # # astyle --options=astyle-config mfile.h myfile.cpp # # Occasionally, astyle does something silly (particularly with lambdas), so it's # still necessary to scan the changes for things that are wrong. # But, for most files, it does a good job. # # Please consider using this before checking code in for review. Code reviews shouldn't # have to deal with layout issues, they are just a distraction. It's better to be able # to focus on semantics in a code review, with style issues out of the way. --formatted --style=allman --min-conditional-indent=2 --indent-switches --max-instatement-indent=80 --pad-header --align-pointer=type --align-reference=type --add-brackets --convert-tabs --close-templates --max-code-length=132 # --pad-oper # # Commented out for now. It changes # # for (int i=0; i<10; ++i) # to # for (int i = 0; i < 10; ++i) # # Unfortunately, it also messes with rvalue references: # # ResourcePtr& operator=(ResourcePtr&& r); # # becomes: # # ResourcePtr& operator=(ResourcePtr && r); lomiri-api-0.2.1/cmake/000077500000000000000000000000001443550065200146405ustar00rootroot00000000000000lomiri-api-0.2.1/cmake/modules/000077500000000000000000000000001443550065200163105ustar00rootroot00000000000000lomiri-api-0.2.1/cmake/modules/PrecompiledHeaders.cmake000066400000000000000000000110201443550065200230430ustar00rootroot00000000000000# This module enables precompiled headers. To use: # # include(pch) # add_pch( ) # Optional # # For example: # # include(pch) # add_pch(pch/pch_sys_headers.hh mylibrary) # # pch_sys_headers.hh must contain a list of #includes for system headers # that should be precompiled, such as # # #include # #include # ... # # Due to various limitations this implementation only works # with C++. It is also strongly recommended that the suffix # of your pch file should be .hh rather than .h. function(get_gcc_flags target_name) # CMake does not provide an easy way to get all compiler switches, # so this function is a fishing expedition to get them. # http://public.kitware.com/Bug/view.php?id=1260 if(CMAKE_CXX_COMPILER_ARG1) set(compile_args ${CMAKE_CXX_COMPILER_ARG1}) else() set(compile_args "") endif() if(CMAKE_CXX_COMPILER_ARG2) list(APPEND compile_args ${CMAKE_CXX_COMPILER_ARG2}) endif() list(APPEND compile_args ${CMAKE_CXX_FLAGS}) string(TOUPPER "${CMAKE_BUILD_TYPE}" buildtype_name) if(CMAKE_CXX_FLAGS_${buildtype_name}) list(APPEND compile_args ${CMAKE_CXX_FLAGS_${buildtype_name}}) endif() get_directory_property(dir_inc INCLUDE_DIRECTORIES) foreach(item ${dir_inc}) LIST(APPEND compile_args "-I" ${item}) endforeach() get_directory_property(dir_defs COMPILE_DEFINITIONS) foreach(item ${dir_defs}) list(APPEND compile_args -D${item}) endforeach() get_directory_property(dir_buildtype_defs COMPILE_DEFINITIONS_${buildtype_name}) foreach(item ${dir_buildtype_defs}) list(APPEND compile_args -D${item}) endforeach() get_directory_property(buildtype_defs COMPILE_DEFINITIONS_${buildtype_name}) foreach(item ${buildtype_defs}) list(APPEND compile_args -D${item}) endforeach() get_target_property(target_type ${target_name} TYPE) if(${target_type} STREQUAL SHARED_LIBRARY) list(APPEND compile_args ${CMAKE_CXX_COMPILE_OPTIONS_PIC}) endif() get_target_property(target_defs ${target_name} COMPILE_DEFINITIONS) if(target_defs) foreach(item ${target_defs}) list(APPEND compile_args -D${item}) endforeach() endif() get_target_property(target_buildtype_defs ${target_name} COMPILE_DEFINITIONS_${buildtype_name}) if(target_buildtype_defs) foreach(item ${target_buildtype_defs}) list(APPEND compile_args -D${item}) endforeach() endif() get_target_property(target_flags ${target_name} COMPILE_FLAGS) if(target_flags) list(APPEND compile_args ${target_flags}) endif() set(compile_args ${compile_args} PARENT_SCOPE) #message(STATUS ${compile_args}) endfunction() function(add_pch_linux header_filename target_name pch_suffix) set(gch_target_name "${target_name}_pch") get_filename_component(header_basename ${header_filename} NAME) set(gch_filename "${CMAKE_CURRENT_BINARY_DIR}/${header_basename}.${pch_suffix}") get_gcc_flags(${target_name}) # Sets compile_args in this scope. It's even better than Intercal's COME FROM! #message(STATUS ${compile_args}) list(APPEND compile_args -c ${CMAKE_CURRENT_SOURCE_DIR}/${header_filename} -o ${gch_filename}) separate_arguments(compile_args) add_custom_command(OUTPUT ${gch_filename} COMMAND ${CMAKE_CXX_COMPILER} ${compile_args} DEPENDS ${header_filename}) add_custom_target(${gch_target_name} DEPENDS ${gch_filename}) add_dependencies(${target_name} ${gch_target_name}) # Add the PCH to every source file's include list. # This is the only way that is supported by both GCC and Clang. set_property(TARGET ${target_name} APPEND_STRING PROPERTY COMPILE_FLAGS " -include ${header_basename}") set_property(TARGET ${target_name} APPEND_STRING PROPERTY COMPILE_FLAGS " -Winvalid-pch") set_property(TARGET ${target_name} APPEND PROPERTY INCLUDE_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR}) endfunction() include(CheckCXXSourceCompiles) CHECK_CXX_SOURCE_COMPILES("#ifdef __clang__\n#else\n#error \"Not clang.\"\n#endif\nint main(int argc, char **argv) { return 0; }" IS_CLANG) if(UNIX) if(NOT APPLE) option(use_pch "Use precompiled headers." TRUE) endif() endif() if(use_pch) message(STATUS "Using precompiled headers.") if(IS_CLANG) set(precompiled_header_extension pch) else() set(precompiled_header_extension gch) endif() macro(add_pch _header_filename _target_name) add_pch_linux(${_header_filename} ${_target_name} ${precompiled_header_extension}) endmacro() else() message(STATUS "Not using precompiled headers.") macro(add_pch _header_filename _target_name) endmacro() endif() lomiri-api-0.2.1/cmake/modules/QmlTest.cmake000066400000000000000000000065421443550065200207120ustar00rootroot00000000000000# add_qml_test(path component_name [NO_ADD_TEST] [NO_TARGETS] # [TARGETS target1 [target2 [...]]] # [IMPORT_PATHS import_path1 [import_path2 [...]] # [PROPERTIES prop1 value1 [prop2 value2 [...]]]) # # NO_ADD_TEST will prevent adding the test to the "test" target # NO_TARGETS will prevent adding the test to any targets # TARGETS lists the targets the test should be added to # IMPORT_PATHS will pass those paths to qmltestrunner as "-import" arguments # PROPERTIES will be set on the target and test target. See CMake's set_target_properties() # # To change/set a default value for the whole test suite, prior to calling add_qml_test, set: # qmltest_DEFAULT_NO_ADD_TEST (default: FALSE) # qmltest_DEFAULT_TARGETS # qmltest_DEFAULT_IMPORT_PATHS # qmltest_DEFAULT_PROPERTIES find_program(qmltestrunner_exe qmltestrunner) if(NOT qmltestrunner_exe) message(FATAL_ERROR "Could not locate qmltestrunner.") endif() macro(add_qml_test SUBPATH COMPONENT_NAME) set(options NO_ADD_TEST NO_TARGETS) set(multi_value_keywords IMPORT_PATHS TARGETS PROPERTIES) cmake_parse_arguments(qmltest "${options}" "" "${multi_value_keywords}" ${ARGN}) set(qmltest_TARGET test${COMPONENT_NAME}) set(qmltest_FILE ${SUBPATH}/tst_${COMPONENT_NAME}) set(qmltestrunner_imports "") if(NOT "${qmltest_IMPORT_PATHS}" STREQUAL "") foreach(IMPORT_PATH ${qmltest_IMPORT_PATHS}) list(APPEND qmltestrunner_imports "-import") list(APPEND qmltestrunner_imports ${IMPORT_PATH}) endforeach(IMPORT_PATH) elseif(NOT "${qmltest_DEFAULT_IMPORT_PATHS}" STREQUAL "") foreach(IMPORT_PATH ${qmltest_DEFAULT_IMPORT_PATHS}) list(APPEND qmltestrunner_imports "-import") list(APPEND qmltestrunner_imports ${IMPORT_PATH}) endforeach(IMPORT_PATH) endif() set(qmltest_command ${qmltestrunner_exe} -input ${CMAKE_CURRENT_SOURCE_DIR}/${qmltest_FILE}.qml ${qmltestrunner_imports} -o ${CMAKE_BINARY_DIR}/${qmltest_TARGET}.xml,xunitxml -o -,txt ) add_custom_target(${qmltest_TARGET} ${qmltest_command}) if(NOT "${qmltest_PROPERTIES}" STREQUAL "") set_target_properties(${qmltest_TARGET} PROPERTIES ${qmltest_PROPERTIES}) elseif(NOT "${qmltest_DEFAULT_PROPERTIES}" STREQUAL "") set_target_properties(${qmltest_TARGET} PROPERTIES ${qmltest_DEFAULT_PROPERTIES}) endif() if("${qmltest_NO_ADD_TEST}" STREQUAL FALSE AND NOT "${qmltest_DEFAULT_NO_ADD_TEST}" STREQUAL "TRUE") add_test(${qmltest_TARGET} ${qmltest_command}) if(NOT "${qmltest_PROPERTIES}" STREQUAL "") set_tests_properties(${qmltest_TARGET} PROPERTIES ${qmltest_PROPERTIES}) elseif(NOT "${qmltest_DEFAULT_PROPERTIES}" STREQUAL "") set_tests_properties(${qmltest_TARGET} PROPERTIES ${qmltest_DEFAULT_PROPERTIES}) endif() endif() if("${qmltest_NO_TARGETS}" STREQUAL "FALSE") if(NOT "${qmltest_TARGETS}" STREQUAL "") foreach(TARGET ${qmltest_TARGETS}) add_dependencies(${TARGET} ${qmltest_TARGET}) endforeach(TARGET) elseif(NOT "${qmltest_DEFAULT_TARGETS}" STREQUAL "") foreach(TARGET ${qmltest_DEFAULT_TARGETS}) add_dependencies(${TARGET} ${qmltest_TARGET}) endforeach(TARGET) endif() endif() endmacro() lomiri-api-0.2.1/data/000077500000000000000000000000001443550065200144715ustar00rootroot00000000000000lomiri-api-0.2.1/data/CMakeLists.txt000066400000000000000000000010301443550065200172230ustar00rootroot00000000000000# Set up package config. set(PKGCONFIG_NAME "lomiri-shell-api") set(PKGCONFIG_DESCRIPTION "Lomiri shell APIs") set(PKGCONFIG_PLUGINDIR "${SHELL_PLUGINDIR}") set(VERSION "1.0") configure_file(lomiri-shell-api.pc.in lomiri-shell-api.pc @ONLY) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/lomiri-shell-api.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) configure_file(lib${LOMIRI_API_LIB}.pc.in lib${LOMIRI_API_LIB}.pc @ONLY) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${LOMIRI_API_LIB}.pc DESTINATION ${LIB_INSTALL_PREFIX}/pkgconfig) lomiri-api-0.2.1/data/liblomiri-api.pc.in000066400000000000000000000016571443550065200201640ustar00rootroot00000000000000# # Copyright (C) 2013 Canonical Ltd # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License version 3 as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see . # # Authored by: Michi Henning # prefix=@CMAKE_INSTALL_PREFIX@ includedir=${prefix}/include libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ Name: lib@LOMIRI_API_LIB@ Description: Lomiri API library Version: @LOMIRI_API_VERSION@ Libs: -L${libdir} -l@LOMIRI_API_LIB@ Cflags: -I${includedir} lomiri-api-0.2.1/data/lomiri-shell-api.pc.in000066400000000000000000000004131443550065200205670ustar00rootroot00000000000000prefix=@CMAKE_INSTALL_PREFIX@ includedir=${prefix}/include plugindir_suffix=@PKGCONFIG_PLUGINDIR@ plugindir=${prefix}/${plugindir_suffix} Name: @PKGCONFIG_NAME@ Description: @PKGCONFIG_NAME@ Version: @VERSION@ Requires: @PKGCONFIG_REQUIRES@ Cflags: -I${includedir} lomiri-api-0.2.1/debian/000077500000000000000000000000001443550065200150025ustar00rootroot00000000000000lomiri-api-0.2.1/debian/Jenkinsfile000066400000000000000000000006511443550065200171700ustar00rootroot00000000000000@Library('ubports-build-tools') _ buildAndProvideDebianPackage() // Or if the package consists entirely of arch-independent packages: // (optional optimization, will confuse BlueOcean's live view at build stage) // buildAndProvideDebianPackage(/* isArchIndependent */ true) // Optionally, to skip building on some architectures (amd64 is always built): // buildAndProvideDebianPackage(false, /* ignoredArchs */ ['arm64']) lomiri-api-0.2.1/debian/changelog000066400000000000000000000727311443550065200166660ustar00rootroot00000000000000lomiri-api (0.2.1) unstable; urgency=medium * Upstream-provided Debian package for lomiri-api. See upstream ChangeLog for recent changes. -- UBports developers Wed, 31 May 2023 01:07:22 +0200 lomiri-api (0.2.0) unstable; urgency=medium [ Ratchanan Srirattanamet ] * Upstream-provided Debian package for lomiri-api. See upstream ChangeLog for recent changes. [ UBports developers ] * Upstream-provided Debian package for lomiri-api. See upstream ChangeLog for recent changes. -- UBports developers Fri, 20 Jan 2023 08:15:08 +0000 lomiri-api (0.1.1-0) unstable; urgency=medium * Upstream-provided Debian package for lomiri-api. See upstream ChangeLog for recent changes. -- UBports Team Thu, 24 Sep 2020 13:42:51 +0200 lomiri-api (0.1.0+ubports) unstable; urgency=medium * Upstream-provided Debian package for lomiri-api. See upstream ChangeLog for recent changes. -- UBports Team Wed, 26 Feb 2020 21:09:48 +0100 unity-api (8.8+ubports) xenial; urgency=medium * Imported to UBports -- UBports auto importer Tue, 20 Feb 2018 23:53:49 +0100 unity-api (8.7+17.04.20170404-0ubuntu1) zesty; urgency=medium [ Pete ] * Add Glib and GObject Assigner helpers. [ Pete Woods ] * unity::util - Add glib signal managers [ Rodney Dawes ] * Add utility function to prepend $SNAP to directory paths. -- Pete Woods Tue, 04 Apr 2017 09:37:43 +0000 unity-api (8.7) UNRELEASED; urgency=medium * Add popularity field to LauncherItem -- Michael Zanetti Tue, 04 Apr 2017 10:26:39 +0200 unity-api (8.6+17.04.20170317-0ubuntu1) zesty; urgency=medium [ Michael Zanetti ] * Add appId property to MirSurfaceInterface [ Pete Woods ] * unity::util - unique_gobject and share_gobject now throw for floating references (LP: #1672657) -- Lukáš Tinkl Fri, 17 Mar 2017 11:08:20 +0000 unity-api (8.5) UNRELEASED; urgency=medium [ Michael Zanetti ] * Add RoleIsPrivate to launcher's quicklist entries [ Daniel d'Andrada ] * MirSurfaceInterface::allowClientResize -- Michael Zanetti Fri, 24 Feb 2017 13:57:12 +0000 unity-api (8.4+17.04.20170223-0ubuntu1) zesty; urgency=medium [ Pete Woods ] * unity::util - Make Glib and GObject memory management utilities handle NULL quietly. -- Pete Woods Thu, 23 Feb 2017 11:22:37 +0000 unity-api (8.3+17.04.20170217-0ubuntu1) zesty; urgency=medium [ Pete ] * unity::util - Add typedef macros to GlibMemory to make method and member variable definitions easier. -- Pete Woods Fri, 17 Feb 2017 14:12:04 +0000 unity-api (8.2+17.04.20170206-0ubuntu1) zesty; urgency=medium [ Daniel d'Andrada ] * MirSurfaceInterface: add childSurfaceList and parentSurface -- Albert Astals Cid Mon, 06 Feb 2017 09:11:03 +0000 unity-api (8.1+17.04.20170120.1-0ubuntu1) zesty; urgency=medium [ Pete ] * unity::util - add GObject shared memory utility classes and helper methods. * unity::util - add Glib memory management utility functions. -- Lukáš Tinkl Fri, 20 Jan 2017 17:08:56 +0000 unity-api (8.1) UNRELEASED; urgency=medium * Added Mir::currentKeymap -- Lukáš Tinkl Fri, 30 Sep 2016 13:20:00 +0200 unity-api (8.0+17.04.20170110.1-0ubuntu1) zesty; urgency=medium [ Albert Astals Cid ] * Enable -Wsuggest-override * Use the new Q_ENUM (Qt 5.5) [ Nick Dedekind ] * Fully qualify pointer type namespaces in signals so that the parameters can be used in qml. -- Timo Jyrinki Tue, 10 Jan 2017 06:42:45 +0000 unity-api (8.0+17.04.20161215-0ubuntu1) zesty; urgency=medium * unity::shel::application - changes for the miral way of doing things -- Daniel d'Andrada Thu, 15 Dec 2016 16:16:07 +0000 unity-api (7.121+17.04.20161205-0ubuntu1) zesty; urgency=medium * Add AppDrawerModelInterface -- Michael Zanetti Mon, 05 Dec 2016 15:20:31 +0000 unity-api (7.120+17.04.20161123-0ubuntu1) zesty; urgency=medium [ Andrea Azzarone ] * Add hasSeparator role to quicklistModel. [ Marcus Tomlinson ] * Don't rely on glib error message strings in IniParser_test (LP: #1642673) -- Andrea Cimitan Wed, 23 Nov 2016 12:11:04 +0000 unity-api (7.119+16.10.20160909-0ubuntu1) yakkety; urgency=medium [ Daniel d'Andrada ] * Added MirSurfaceInterface::confinesMousePointer -- Michał Sawicz Fri, 09 Sep 2016 14:39:28 +0000 unity-api (7.118+16.10.20160830-0ubuntu1) yakkety; urgency=medium [ Nick Dedekind ] * Added persistent Id property for MirSurface -- Ken VanDine Tue, 30 Aug 2016 13:40:30 +0000 unity-api (7.117+16.10.20160819-0ubuntu1) yakkety; urgency=medium * Removed empty unreleased entry from changelog. (LP: #1613563) -- Michi Henning Fri, 19 Aug 2016 22:16:23 +0000 unity-api (7.117+16.10.20160810-0ubuntu1) yakkety; urgency=medium [ Daniel d'Andrada ] * ApplicationInfoInterface: remove "stage" property * ApplicationManagerInterface: remove "stage" role -- Michał Sawicz Wed, 10 Aug 2016 08:20:08 +0000 unity-api (7.116+16.10.20160805-0ubuntu1) yakkety; urgency=medium * Remove unnecessary Boost dependency from package. -- James Henstridge Fri, 05 Aug 2016 04:08:06 +0000 unity-api (7.116+16.10.20160730-0ubuntu1) yakkety; urgency=medium [ Michał Sawicz ] * Don't run tests on powerpc (LP: #1606927) [ Stephen Kelly ] * Silence some gcc warnings. -- Lukáš Tinkl Sat, 30 Jul 2016 21:18:50 +0000 unity-api (7.116+16.10.20160620-0ubuntu1) yakkety; urgency=medium * MirSurfaceInterface: add inputBounds property -- Daniel d'Andrada Mon, 20 Jun 2016 14:39:15 +0000 unity-api (7.115+16.10.20160614-0ubuntu1) yakkety; urgency=medium [ Michael Zanetti ] * Drop Launchermodel::setAlerting, it's not needed -- Albert Astals Cid Tue, 14 Jun 2016 08:34:16 +0000 unity-api (7.114) UNRELEASED; urgency=medium * Add ApplicationInfoInterface::surfaceCount property -- Michael Zanetti Mon, 09 May 2016 18:43:38 +0200 unity-api (7.113+16.10.20160525-0ubuntu1) yakkety; urgency=medium [ Daniel d'Andrada ] * Remove hotspot property from MirMousePointerInterface [ Albert Astals Cid ] * Mark roleNames as override [ Michi Henning ] * Re-enabled license/copyright test for xenial. (LP: #1194867) -- Michael Terry Wed, 25 May 2016 06:02:38 +0000 unity-api (7.112+16.04.20160518-0ubuntu1) xenial; urgency=medium [ Daniel d'Andrada ] * Move promptSurfaceList from MirSurfaceInterface to ApplicationInfoInterface * Added MirSurfaceListInterface::first property [ CI Train Bot ] * No-change rebuild. -- Nick Dedekind Wed, 18 May 2016 09:31:07 +0000 unity-api (7.111+16.04.20160426.2-0ubuntu1) xenial; urgency=medium [ Pawel Stolowski ] * Added RoleSocialActions to ResultsModelInterface of scopes. * Added ExpandableFilterWidgetInterface. [ CI Train Bot ] * No-change rebuild. -- Pawel Stolowski Tue, 26 Apr 2016 15:31:50 +0000 unity-api (7.110+16.04.20160413-0ubuntu1) xenial; urgency=medium [ Daniel d'Andrada ] * MirSurfaceInterface: replace keymapLayout and keymapVariant with keymap * Unity.Application: Added and refactored APIs for surface-based window management [ CI Train Bot ] * No-change rebuild. -- Gerry Boland Wed, 13 Apr 2016 18:39:21 +0000 unity-api (7.109+16.04.20160405-0ubuntu1) xenial; urgency=medium [ Marcus Tomlinson ] * Add set*() methods to IniParser [ CI Train Bot ] * No-change rebuild. -- Marcus Tomlinson Tue, 05 Apr 2016 06:03:34 +0000 unity-api (7.108+16.04.20160322-0ubuntu1) xenial; urgency=medium [ Lukáš Tinkl, Michał Sawicz ] * Add API for setting keyboard layout+variant on a surface (LP: #1524400, #1491340) [ Nick Dedekind ] * Added setStage for sidestage redesign. * Added support for low shell chrome (LP: #1535397) [ Pawel Stolowski ] * Base interfaces for filters. * Interface for RangeInputFilter. * ValueSliderFilter interface. -- Michael Zanetti Tue, 22 Mar 2016 07:48:55 +0000 unity-api (7.107+16.04.20160223-0ubuntu1) xenial; urgency=medium * Removed PreviewStackInterface, modified ScopeInterface to return PreviewModelInterface on preview(). * Interface for activationInProgress flag. (LP: #1537132) -- Pawel Stolowski Tue, 23 Feb 2016 12:12:26 +0000 unity-api (7.106+16.04.20160211.1-0ubuntu1) xenial; urgency=medium [ Daniel d'Andrada ] * Added ApplicationInfoInterface.initialSurfaceSize (LP: #1532974) * MirSurfaceInterface: added size hints -- Michał Sawicz Thu, 11 Feb 2016 23:53:29 +0000 unity-api (7.105+16.04.20160104-0ubuntu1) xenial; urgency=medium [ Michael Zanetti ] [Albert Astals Cid ] * New property to support more complex cards [ CI Train Bot ] * No-change rebuild. -- CI Train Bot Mon, 04 Jan 2016 15:09:55 +0000 unity-api (7.104+16.04.20151207-0ubuntu1) xenial; urgency=medium [ Daniel d'Andrada ] * Add MirSurfaceItem.fillMode [ Michael Terry ] * Added ApplicationInfoInterface::exemptFromLifecycle [ CI Train Bot ] * No-change rebuild. -- Gerry Boland Mon, 07 Dec 2015 16:21:29 +0000 unity-api (7.103+16.04.20151125-0ubuntu1) xenial; urgency=medium [ Daniel d'Andrada ] * Added MirMousePointerInterface::setCustomCursor * Added MirMousePointerInterface::handleWheelEvent [ CI Train Bot ] * No-change rebuild. -- Michał Sawicz Wed, 25 Nov 2015 14:13:25 +0000 unity-api (7.102+16.04.20151124-0ubuntu1) xenial; urgency=medium * Depend on devscripts, needed by licensecheck. Disable licensecheck on xenial for now. -- Pawel Stolowski Tue, 24 Nov 2015 12:01:48 +0000 unity-api (7.102+16.04.20151109-0ubuntu1) xenial; urgency=medium [ CI Train Bot ] * New rebuild forced. -- Michael Zanetti Mon, 09 Nov 2015 14:40:51 +0000 unity-api (7.102+16.04.20151102-0ubuntu1) xenial; urgency=medium [ Nick Dedekind ] * Added visibility to surface interface. [ Michael Terry ] * Add isTouchApp to ApplicationInfoInterface [ CI Train Bot ] * New rebuild forced. -- Michał Sawicz Mon, 02 Nov 2015 11:23:42 +0000 unity-api (7.102-0ubuntu1) UNRELEASED; urgency=medium * New method for in-card actions. -- Pawel Stolowski Tue, 06 Oct 2015 18:06:37 +0200 unity-api (7.101+15.10.20151021-0ubuntu1) wily; urgency=medium [ Daniel d'Andrada ] * unity/shell/application: Add Mir.cursorName * unity/shell/application: Added MirMousePointerInterface.h * unity/shell/application: Added MirPlatformCursor.h [ Lukáš Tinkl ] * unity/shell/application: Add MirSurfaceInterface.nameChanged [ CI Train Bot ] * New rebuild forced. [ Michał Sawicz ] * Resync trunk -- Michał Sawicz Wed, 21 Oct 2015 11:48:38 +0000 unity-api (7.100+15.10.20150903-0ubuntu1) wily; urgency=medium [ Michal Sawicz ] * No change rebuild to resync vivid+overlay and wily [ CI Train Bot ] * No-change rebuild. -- CI Train Bot Thu, 03 Sep 2015 08:54:03 +0000 unity-api (7.100+15.04.20150827-0ubuntu1) vivid; urgency=medium [ Daniel d'Andrada ] * Added MirSurface and MirSurfaceItem interfaces [ CI Train Bot ] * No-change rebuild. -- CI Train Bot Thu, 27 Aug 2015 08:50:45 +0000 unity-api (7.99+15.04.20150811-0ubuntu1) vivid; urgency=medium * New rebuild forced. -- CI Train Bot Tue, 11 Aug 2015 14:05:55 +0000 unity-api (7.99+15.04.20150804-0ubuntu1) vivid; urgency=medium [ Daniel d'Andrada ] * Remove ApplicationManagerInterface.forceDashActive * Remove ApplicationManagerInterface.suspended * Add ApplicationInfoInterface.requestedState * Add a NO_TESTS options to cmake -- CI Train Bot Tue, 04 Aug 2015 15:26:16 +0000 unity-api (7.99-0ubuntu1) UNRELEASED; urgency=medium * Changes to activate and preview methods of ScopeInterface. -- Pawel Stolowski Mon, 03 Aug 2015 14:03:47 +0000 unity-api (7.98+15.04.20150724-0ubuntu1) vivid; urgency=medium [ Mirco Müller (MacSlow) ] * added alerting/setAlerting API to LauncherModel and LauncherItem interfaces -- CI Train Bot Fri, 24 Jul 2015 09:53:01 +0000 unity-api (7.97+15.10.20150721-0ubuntu1) wily; urgency=medium [ Michi Henning ] * Remove dependency on gcc 4.9. (LP: #1452342) -- CI Train Bot Tue, 21 Jul 2015 05:13:26 +0000 unity-api (7.97+15.10.20150611-0ubuntu1) wily; urgency=medium [ Daniel d'Andrada ] * add supportedOrientations and rotatesWindowContents to ApplicationInfo -- CI Train Bot Thu, 11 Jun 2015 09:11:57 +0000 unity-api (7.96+15.04.20150410.2-0ubuntu1) vivid; urgency=medium [ CI Train Bot ] * New rebuild forced. [ Michi Henning ] * Reverted commit 93 because it cost me a cool 1.5 hours today. Turns out that libmcheck is not thread-safe and causes the most amazing crashes in unpredictable ways :-( -- CI Train Bot Fri, 10 Apr 2015 16:07:39 +0000 unity-api (7.96+15.04.20150213-0ubuntu1) vivid; urgency=medium [ Pawel Stolowski ] * Added close method to scopes interface. -- CI Train Bot Fri, 13 Feb 2015 15:15:59 +0000 unity-api (7.95+15.04.20150211-0ubuntu1) vivid; urgency=medium [ Michael Zanetti ] * add onlyPinned property to launcher model [ Michał Sawicz ] * Add :native to g++ dependency for cross-building and wrap-and-sort for good measure. Python needs :any, too. (LP: #1353855) -- Ubuntu daily release Wed, 11 Feb 2015 16:28:29 +0000 unity-api (7.94+15.04.20141205-0ubuntu1) vivid; urgency=medium [ Albert Astals Cid ] * Add setFavorite/moveFavoriteTo -- Ubuntu daily release Fri, 05 Dec 2014 10:51:44 +0000 unity-api (7.93+15.04.20141104-0ubuntu1) vivid; urgency=medium [ Michael Zanetti ] * add a signal to the launcher model to hint changes -- Ubuntu daily release Tue, 04 Nov 2014 14:42:57 +0000 unity-api (7.92+14.10.20141003.1-0ubuntu1) utopic; urgency=medium [ Michael Zanetti ] * Add dashActive property to application api [ Ubuntu daily release ] * New rebuild forced -- Ubuntu daily release Fri, 03 Oct 2014 16:52:41 +0000 unity-api (7.91+14.10.20140922.1-0ubuntu1) utopic; urgency=medium [ Daniel d'Andrada ] * Added splash screen data do ApplicationInfoInterface -- Ubuntu daily release Mon, 22 Sep 2014 17:35:28 +0000 unity-api (7.90+14.10.20140918-0ubuntu1) utopic; urgency=medium [ Michael Zanetti ] * add countVisible property * allow updating item's name and icon properties. They might change in case of updates -- Ubuntu daily release Thu, 18 Sep 2014 16:42:26 +0000 unity-api (7.89+14.10.20140825-0ubuntu1) utopic; urgency=medium [ Daniel d'Andrada ] * Remove all mentions to screenshotting from the API -- Ubuntu daily release Mon, 25 Aug 2014 07:04:31 +0000 unity-api (7.88+14.10.20140806-0ubuntu1) utopic; urgency=medium [ Michal Hruby ] * Define scopes interface version 4 -- Ubuntu daily release Wed, 06 Aug 2014 19:32:56 +0000 unity-api (7.87+14.10.20140731-0ubuntu1) utopic; urgency=medium [ Michal Hruby ] * Added interface definition for scopes overview. -- Ubuntu daily release Thu, 31 Jul 2014 11:14:00 +0000 unity-api (7.86+14.10.20140718.1-0ubuntu1) utopic; urgency=medium [ Michi Henning ] * Explicitly select g++-4.9 to prevent ABI breakage. -- Ubuntu daily release Fri, 18 Jul 2014 16:20:15 +0000 unity-api (7.85+14.10.20140708-0ubuntu1) utopic; urgency=medium [ Marcus Tomlinson ] * Add settings support for shell [ Michal Hruby ] * Added header links CategoriesInterface and performQuery() to ScopeInterface [ Michi Henning ] * A few minor fixes to the doc comments for comparison operators. -- Ubuntu daily release Tue, 08 Jul 2014 15:06:24 +0000 unity-api (7.84+14.10.20140702.2-0ubuntu1) utopic; urgency=medium [ Michal Hruby ] * Added IniParser::get_locale_string_array -- Ubuntu daily release Wed, 02 Jul 2014 15:17:16 +0000 unity-api (7.83+14.10.20140626-0ubuntu1) utopic; urgency=medium [ Michal Hruby ] * Added customizations property to ScopeInterface. -- Ubuntu daily release Thu, 26 Jun 2014 11:05:05 +0000 unity-api (7.82+14.10.20140616-0ubuntu1) utopic; urgency=medium [ Albert Astals Cid ] * Add interfaces for scope departments. -- Ubuntu daily release Mon, 16 Jun 2014 14:45:10 +0000 unity-api (7.81+14.10.20140528-0ubuntu1) utopic; urgency=low [ Michael Zanetti ] * properly parent mock items otherwise QML deletes them as of 5.2 (LP: #1318889) * properly parent MockApplicationInfo objects in the mock plugin. QML might delete them otherwise. -- Ubuntu daily release Wed, 28 May 2014 10:38:05 +0000 unity-api (7.81+14.10.20140520-0ubuntu1) utopic; urgency=medium [ Albert Astals Cid ] * Add interfaces for scopes. [ Jussi Pakkanen ] * Add missing include so compilation works with pch disabled. -- Ubuntu daily release Tue, 20 May 2014 12:05:11 +0000 unity-api (7.80.8+14.10.20140505-0ubuntu1) utopic; urgency=medium [ Mirco Müller (MacSlow) ] * Bump unity-notification version due to exposure of NotificationModel's Roles-Enum. -- Ubuntu daily release Mon, 05 May 2014 12:02:22 +0000 unity-api (7.80.7+14.10.20140428.1-0ubuntu1) utopic; urgency=medium [ Michal Hruby ] * Added IniParser::get_locale_string() -- Ubuntu daily release Mon, 28 Apr 2014 17:28:16 +0000 unity-api (7.80.6+14.04.20140402-0ubuntu1) trusty; urgency=low [ Mirco Müller ] * The data-roles of the NotificationModel to should be exposed to QML. -- Ubuntu daily release Wed, 02 Apr 2014 17:42:41 +0000 unity-api (7.80.6+14.04.20140401-0ubuntu1) trusty; urgency=medium [ Michael Zanetti ] * Bump version for Application api changes -- Ubuntu daily release Tue, 01 Apr 2014 22:41:05 +0000 unity-api (7.80.5+14.04.20140304-0ubuntu1) trusty; urgency=low [ CI bot ] * No change rebuild against Qt 5.2.1. [ Ubuntu daily release ] * New rebuild forced -- Ubuntu daily release Tue, 04 Mar 2014 13:52:36 +0000 unity-api (7.80.5+14.04.20140120-0ubuntu2) UNRELEASED; urgency=medium * Made calls to IniParser constructor and destructor thread-safe. Without this, if the destructor is called from a different thread than the constructor, we get complaints from thread sanitizer. -- Michi Henning Tue, 18 Feb 2014 10:29:04 +1000 unity-api (7.80.5+14.04.20140120-0ubuntu1) trusty; urgency=low [ Jussi Pakkanen ] * Remove deprecated NonCopyable base class. [ Michi Henning ] * Removed final semicolon from NONCOPYABLE macro. This makes the usage consistent with the UNITY_DEFINES_PTRS macro, which also does not include the semicolon. [ Ubuntu daily release ] * Automatic snapshot from revision 119 -- Ubuntu daily release Mon, 20 Jan 2014 16:05:43 +0000 unity-api (7.80.5+14.04.20131219.1-0ubuntu1) trusty; urgency=low [ Michi Henning ] * Changed unity::Exception::what() to return the same text as unity::Exception::to_string(). [ Michal Hruby ] * Expose full version including micro version number in pc file. [ Jussi Pakkanen ] * Made noncopyable a macro. [ Ubuntu daily release ] * Automatic snapshot from revision 116 -- Ubuntu daily release Thu, 19 Dec 2013 21:07:55 +0000 unity-api (7.80.4+14.04.20131126.2-0ubuntu1) trusty; urgency=low [ Michal Hruby ] * Added pkg-config module unity-shell-api. [ Albert Astals ] * Avoid cmake warnings CMake Warning (dev) in CMakeLists.txt: Syntax Warning in cmake code at /home/tsdgeos_work/phablet/unity-api/unity- api/CMakeLists.txt:53:88 Argument not separated from preceding token by whitespace. This warning is for project developers. Use -Wno-dev to suppress it. CMake Warning (dev) in CMakeLists.txt: Syntax Warning in cmake code at /home/tsdgeos_work/phablet/unity-api/unity- api/CMakeLists.txt:53:107 Argument not separated from preceding token by whitespace. This warning is for project developers. Use - Wno-dev to suppress it. . [ Michi Henning ] * Don't set -fno-permissive when compiling with clang because clang produces an "ignored" warning for this flag. Set - DGTEST_USE_OWN_TR1_TUPLE=1 to make tests compile with clang. * Fix warning from clang when building libgtest about unused field. * Removed obsolete doxygen config variable that caused a warning during the build. [ Ubuntu daily release ] * Automatic snapshot from revision 112 -- Ubuntu daily release Tue, 26 Nov 2013 19:42:23 +0000 unity-api (7.80.3+13.10.20130927.1-0ubuntu1) saucy; urgency=low [ Michi Henning ] * Changed pkgconfig to use absolute path for Libs, so things will work if the package is installed in a non-standard location. * Reverting commit 89, which added -D_GLIBCXX_DEBUG. This has truly hideous consequences when calling cross-library and passing STL types. If not all libraries involved are compiled with the same flag, the code links and runs and, in many cases, will work, except in some cases, where suddenly the stack gets trashed, the code segfaults on a memory allocation, or similar. [ Ubuntu daily release ] * Automatic snapshot from revision 106 -- Ubuntu daily release Fri, 27 Sep 2013 10:32:57 +0000 unity-api (7.80.3+13.10.20130912-0ubuntu1) saucy; urgency=low [ Michael Zanetti ] * update Launcher API to make use of the new ApplicationManager api. [ Ubuntu daily release ] * Automatic snapshot from revision 103 -- Ubuntu daily release Thu, 12 Sep 2013 13:45:40 +0000 unity-api (7.80.3+13.10.20130911-0ubuntu1) saucy; urgency=low [ Gerry Boland ] * Shell::Application: Apply Q_ENUMS to the Roles enum so implementations can use it. [ Ubuntu daily release ] * Automatic snapshot from revision 101 -- Ubuntu daily release Wed, 11 Sep 2013 00:29:43 +0000 unity-api (7.80.3+13.10.20130905.2-0ubuntu1) saucy; urgency=low [ Gerry Boland ] * AppManager: change startApplication to return ApplicationInfo, is useful for shell. [ Michael Zanetti ] * add applicationFocused method to LauncherModelInterface. * add focused role to model. [ Ubuntu daily release ] * Automatic snapshot from revision 99 -- Ubuntu daily release Thu, 05 Sep 2013 10:47:48 +0000 unity-api (7.80.3+13.10.20130904-0ubuntu1) saucy; urgency=low [ Gerry Boland ] * ApplicationManagerInterface: adjust API to use appId for app start/stop/focus. Return ApplicationInfoInterface only in get(index) and the new findApplication(appId) methods. [ Ubuntu daily release ] * Automatic snapshot from revision 95 -- Ubuntu daily release Wed, 04 Sep 2013 03:02:27 +0000 unity-api (7.80.3+13.10.20130903.1-0ubuntu1) saucy; urgency=low [ Jussi Pakkanen ] * Use glibc's memory validator. [ Ubuntu daily release ] * Automatic snapshot from revision 93 -- Ubuntu daily release Tue, 03 Sep 2013 06:09:20 +0000 unity-api (7.80.3+13.10.20130902-0ubuntu1) saucy; urgency=low [ Michael Zanetti ] * Add Ubuntu.Application API, including tests and a mock implementation. [ Ubuntu daily release ] * Automatic snapshot from revision 91 -- Ubuntu daily release Mon, 02 Sep 2013 02:29:21 +0000 unity-api (7.80.3+13.10.20130826.2-0ubuntu1) saucy; urgency=low [ Jussi Pakkanen ] * Enable validating STL on debug builds. [ Ubuntu daily release ] * Automatic snapshot from revision 89 -- Ubuntu daily release Mon, 26 Aug 2013 10:08:34 +0000 unity-api (7.80.3+13.10.20130826.1-0ubuntu1) saucy; urgency=low * Automatic snapshot from revision 87 -- Ubuntu daily release Mon, 26 Aug 2013 06:08:18 +0000 unity-api (7.80.3+13.10.20130826-0ubuntu1) saucy; urgency=low [ Michael Zanetti ] * Add setUser method to LauncherModel. [ Ubuntu daily release ] * Automatic snapshot from revision 86 -- Ubuntu daily release Mon, 26 Aug 2013 02:31:24 +0000 unity-api (7.80.3+13.10.20130820.2-0ubuntu1) saucy; urgency=low * Automatic snapshot from revision 84 -- Ubuntu daily release Tue, 20 Aug 2013 10:09:27 +0000 unity-api (7.80.3+13.10.20130820.1-0ubuntu1) saucy; urgency=low [ Michael Zanetti ] * Add a role, clickable to quicklistModel which determines if the entry can be clicked or not. [ Ubuntu daily release ] * Automatic snapshot from revision 82 -- Ubuntu daily release Tue, 20 Aug 2013 06:08:22 +0000 unity-api (7.80.3+13.10.20130820-0ubuntu1) saucy; urgency=low [ Michael Zanetti ] * Add a role, clickable to quicklistModel which determines if the entry can be clicked or not. [ Ubuntu daily release ] * Automatic snapshot from revision 82 -- Ubuntu daily release Tue, 20 Aug 2013 02:08:23 +0000 unity-api (7.80.3+13.10.20130801-0ubuntu1) saucy; urgency=low * Automatic snapshot from revision 80 -- Ubuntu daily release Thu, 01 Aug 2013 14:30:16 +0000 unity-api (7.80.3+13.10.20130729ubuntu.unity.next-0ubuntu1) saucy; urgency=low [ Michi Henning ] * Changed DefinesPtrs to a macro. That way, we don't need a virtual destructor, and the generated typedefs can be used with POD types. The macro also prevents ambiguous names that were caused by the template for classes in a derivation hierarchy. * Added UNITY_DEFINES_PTRS (needed by scopes). Added coverage suppresssion for unreachable line of code. [ Ubuntu daily release ] * Automatic snapshot from revision 79 (ubuntu-unity/next) -- Ubuntu daily release Mon, 29 Jul 2013 03:40:54 +0000 unity-api (7.80.3+13.10.20130709ubuntu.unity.next-0ubuntu1) saucy; urgency=low [ Michael Zanetti ] * added quicklist support to launcher api [ Ubuntu daily release ] * Automatic snapshot from revision 76 (ubuntu-unity/next) -- Ubuntu daily release Tue, 09 Jul 2013 02:58:47 +0000 unity-api (7.80.2+13.10.20130703ubuntu.unity.next-0ubuntu1) saucy; urgency=low [ Michał Sawicz ] * Do not require any particular version of boost. [ Ubuntu daily release ] * Automatic snapshot from revision 74 (ubuntu-unity/next) -- Ubuntu daily release Wed, 03 Jul 2013 02:35:04 +0000 unity-api (7.80.2+13.10.20130702ubuntu.unity.next-0ubuntu1) saucy; urgency=low [ Didier Roche ] * Add a better package description. [ Ubuntu daily release ] * Automatic snapshot from revision 72 (ubuntu-unity/next) -- Ubuntu daily release Tue, 02 Jul 2013 02:31:07 +0000 unity-api (7.80.2+13.10.20130627ubuntu.unity.next-0ubuntu1) saucy; urgency=low [ Didier Roche ] * Fix packaging to follow daily release guidelines * Automatic snapshot from revision 67 (bootstrap) [ Michi Henning ] * Changed "Lesser GNU General Public License" to "GNU Lesser General Public License" throughout. Fixed five files that used GPL instead of LGPL. licensecheck comes up clean now, reporting LGPL v3 for everything. (LP: #1194867) * Renamed COPYING.LIB -> COPYING. (LP: #1194867) [ Ubuntu daily release ] * Automatic snapshot from revision 70 (ubuntu-unity/next) -- Ubuntu daily release Thu, 27 Jun 2013 09:48:56 +0000 unity-api (7.80.1) saucy; urgency=low * This project forked from lp:unity/phablet. Updating the versioning to reflect that. -- Sergio Schvezov Tue, 04 Jun 2013 16:06:54 -0300 unity-api (0.2) saucy; urgency=low * Releasing for saucy. -- Sergio Schvezov Tue, 04 Jun 2013 02:16:12 -0300 unity-api (0.1) raring; urgency=low * Initial release -- Michał Sawicz Fri, 10 May 2013 12:43:53 +0200 lomiri-api-0.2.1/debian/control000066400000000000000000000041161443550065200164070ustar00rootroot00000000000000Source: lomiri-api Priority: optional Section: libs Maintainer: UBports Team Build-Depends: cmake, cmake-extras, dbus-test-runner, debhelper-compat (= 12), devscripts, lsb-release, doxygen, graphviz, libglib2.0-dev, libgtest-dev, google-mock, libqtdbustest1-dev, pkg-config, python3:any, qtbase5-dev (>= 5.5), qtdeclarative5-dev, qtdeclarative5-dev-tools, qml-module-qtquick2, qml-module-qttest, symlinks, rdfind, Standards-Version: 4.5.0 Rules-Requires-Root: no Homepage: https://gitlab.com/ubports/core/lomiri-api/ Package: liblomiri-api0 Architecture: any Multi-Arch: same Pre-Depends: ${misc:Pre-Depends}, Depends: ${misc:Depends}, ${shlibs:Depends}, Description: API for Lomiri shell integration (shared library) Lomiri Operating Environment is a convergent work shell designed for use cases on phone, tablet or desktop devices. . Lomiri API Library for integrating with the Lomiri shell. . This package contains the shared library. Package: liblomiri-api-dev Section: libdevel Architecture: any Multi-Arch: same Depends: liblomiri-api0 (= ${binary:Version}), ${misc:Depends}, Description: API for Lomiri shell integration (development headers) Lomiri Operating Environment is a convergent work shell designed for use cases on phone, tablet or desktop devices. . Lomiri API Library for integrating with the Lomiri shell. . This package contains the development files. Package: liblomiri-api-doc Section: doc Architecture: all Multi-Arch: foreign Depends: ${misc:Depends}, Description: API for Lomiri shell integration (documentation) Lomiri Operating Environment is a convergent work shell designed for use cases on phone, tablet or desktop devices. . Lomiri API Library for integrating with the Lomiri shell. . This package contains the API documentation. lomiri-api-0.2.1/debian/copyright000066400000000000000000000247321443550065200167450ustar00rootroot00000000000000Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: lomiri-api Upstream-Contact: Marius Grispgard Source: https://gitlab.com/ubports/core/lomiri-api/ Files: .gitignore CMakeLists.txt ChangeLog CTestCustom.cmake.in Jenkinsfile NEWS astyle-config cmake/modules/PrecompiledHeaders.cmake cmake/modules/QmlTest.cmake data/CMakeLists.txt data/lomiri-shell-api.pc.in include/CMakeLists.txt include/lomiri/CMakeLists.txt include/lomiri/api/internal/.gitkeep include/lomiri/internal/.gitkeep include/lomiri/shell/CMakeLists.txt include/lomiri/shell/application/CMakeLists.txt include/lomiri/shell/launcher/CMakeLists.txt include/lomiri/shell/notifications/CMakeLists.txt include/lomiri/util/CMakeLists.txt src/CMakeLists.txt src/lomiri/CMakeLists.txt src/lomiri/api/CMakeLists.txt src/lomiri/api/internal/CMakeLists.txt src/lomiri/internal/CMakeLists.txt src/lomiri/util/CMakeLists.txt src/lomiri/util/internal/CMakeLists.txt test/CMakeLists.txt test/copyright/CMakeLists.txt test/data/sample.ini test/gtest/CMakeLists.txt test/gtest/lomiri/CMakeLists.txt test/gtest/lomiri/api/CMakeLists.txt test/gtest/lomiri/api/Version/CMakeLists.txt test/gtest/lomiri/util/CMakeLists.txt test/gtest/lomiri/util/Daemon/CMakeLists.txt test/gtest/lomiri/util/Dbus/CMakeLists.txt test/gtest/lomiri/util/DefinesPtrs/CMakeLists.txt test/gtest/lomiri/util/FileIO/CMakeLists.txt test/gtest/lomiri/util/GObjectMemory/CMakeLists.txt test/gtest/lomiri/util/GioMemory/CMakeLists.txt test/gtest/lomiri/util/GlibMemory/CMakeLists.txt test/gtest/lomiri/util/IniParser/CMakeLists.txt test/gtest/lomiri/util/ResourcePtr/CMakeLists.txt test/gtest/lomiri/util/SnapPath/CMakeLists.txt test/gtest/lomiri/util/internal/CMakeLists.txt test/headers/CMakeLists.txt test/lomiri-api-test-config.h.in test/qmltest/CMakeLists.txt test/qmltest/lomiri/CMakeLists.txt test/qmltest/lomiri/shell/CMakeLists.txt test/qmltest/mocks/CMakeLists.txt test/qmltest/mocks/plugins/Lomiri/Application/CMakeLists.txt test/qmltest/mocks/plugins/Lomiri/Application/qmldir test/qmltest/mocks/plugins/Lomiri/Launcher/CMakeLists.txt test/qmltest/mocks/plugins/Lomiri/Launcher/qmldir test/qmltest/mocks/plugins/Lomiri/Notifications/CMakeLists.txt test/qmltest/mocks/plugins/Lomiri/Notifications/Mocks/CMakeLists.txt test/qmltest/mocks/plugins/Lomiri/Notifications/Mocks/qmldir test/qmltest/mocks/plugins/Lomiri/Notifications/qmldir test/qmltest/modules/CMakeLists.txt test/qmltest/modules/TestUtil/CMakeLists.txt test/qmltest/modules/TestUtil/qmldir test/whitespace/CMakeLists.txt valgrind-suppress Copyright: 2012-2017, Canonical Ltd. License: LGPL-3 Comment: Files lack license headers. Assuming copyright holdership and license from rest of code files. Files: INSTALL README data/liblomiri-api.pc.in include/lomiri/Exception.h include/lomiri/LomiriExceptions.h include/lomiri/SymbolExport.h include/lomiri/shell/application/ApplicationInfoInterface.h include/lomiri/shell/application/ApplicationManagerInterface.h include/lomiri/shell/application/MirMousePointerInterface.h include/lomiri/shell/launcher/AppDrawerModelInterface.h include/lomiri/shell/launcher/LauncherItemInterface.h include/lomiri/shell/launcher/LauncherModelInterface.h include/lomiri/shell/launcher/QuickListModelInterface.h include/lomiri/shell/notifications/Enums.h include/lomiri/shell/notifications/ModelInterface.h include/lomiri/shell/notifications/NotificationInterface.h include/lomiri/shell/notifications/SourceInterface.h include/lomiri/util/Daemon.h include/lomiri/util/DefinesPtrs.h include/lomiri/util/FileIO.h include/lomiri/util/GObjectMemory.h include/lomiri/util/GioMemory.h include/lomiri/util/GlibMemory.h include/lomiri/util/IniParser.h include/lomiri/util/NonCopyable.h include/lomiri/util/ResourcePtr.h include/lomiri/util/SnapPath.h include/lomiri/util/internal/DaemonImpl.h src/lomiri/Exception.cpp src/lomiri/LomiriExceptions.cpp src/lomiri/api/Version.cpp src/lomiri/util/Daemon.cpp src/lomiri/util/FileIO.cpp src/lomiri/util/IniParser.cpp src/lomiri/util/SnapPath.cpp src/lomiri/util/internal/DaemonImpl.cpp src/pch/lomiriapi_pch.hh test/gtest/lomiri/Exceptions_test.cpp test/gtest/lomiri/api/Version/Version_test.cpp test/gtest/lomiri/util/Daemon/Daemon_test.cpp test/gtest/lomiri/util/Daemon/daemon-tester.py test/gtest/lomiri/util/DefinesPtrs/DefinesPtrs_test.cpp test/gtest/lomiri/util/FileIO/FileIO_test.cpp test/gtest/lomiri/util/GObjectMemory/GObjectMemory_test.cpp test/gtest/lomiri/util/GioMemory/GioMemory_test.cpp test/gtest/lomiri/util/GlibMemory/GlibMemory_test.cpp test/gtest/lomiri/util/IniParser/IniParser_test.cpp test/gtest/lomiri/util/ResourcePtr/ResourcePtr_test.cpp test/gtest/lomiri/util/SnapPath/SnapPath_test.cpp test/headers/check_public_headers.py test/headers/includechecker.py test/qmltest/lomiri/shell/application/tst_Application.qml test/qmltest/lomiri/shell/launcher/tst_Launcher.qml test/qmltest/lomiri/shell/notifications/tst_Notifications.qml test/qmltest/mocks/plugins/Lomiri/Application/Mocks/MockApplicationInfo.cpp test/qmltest/mocks/plugins/Lomiri/Application/Mocks/MockApplicationInfo.h test/qmltest/mocks/plugins/Lomiri/Application/Mocks/MockApplicationManager.cpp test/qmltest/mocks/plugins/Lomiri/Application/Mocks/MockApplicationManager.h test/qmltest/mocks/plugins/Lomiri/Application/TestApplicationPlugin.cpp test/qmltest/mocks/plugins/Lomiri/Application/TestApplicationPlugin.h test/qmltest/mocks/plugins/Lomiri/Launcher/Mocks/MockAppDrawerModel.cpp test/qmltest/mocks/plugins/Lomiri/Launcher/Mocks/MockAppDrawerModel.h test/qmltest/mocks/plugins/Lomiri/Launcher/Mocks/MockLauncherItem.cpp test/qmltest/mocks/plugins/Lomiri/Launcher/Mocks/MockLauncherItem.h test/qmltest/mocks/plugins/Lomiri/Launcher/Mocks/MockLauncherModel.cpp test/qmltest/mocks/plugins/Lomiri/Launcher/Mocks/MockLauncherModel.h test/qmltest/mocks/plugins/Lomiri/Launcher/Mocks/MockQuickListModel.cpp test/qmltest/mocks/plugins/Lomiri/Launcher/Mocks/MockQuickListModel.h test/qmltest/mocks/plugins/Lomiri/Launcher/TestLauncherPlugin.cpp test/qmltest/mocks/plugins/Lomiri/Launcher/TestLauncherPlugin.h test/qmltest/mocks/plugins/Lomiri/Notifications/Mocks/MockActionModel.cpp test/qmltest/mocks/plugins/Lomiri/Notifications/Mocks/MockActionModel.h test/qmltest/mocks/plugins/Lomiri/Notifications/Mocks/MockModel.cpp test/qmltest/mocks/plugins/Lomiri/Notifications/Mocks/MockModel.h test/qmltest/mocks/plugins/Lomiri/Notifications/Mocks/MockNotification.cpp test/qmltest/mocks/plugins/Lomiri/Notifications/Mocks/MockNotification.h test/qmltest/mocks/plugins/Lomiri/Notifications/Mocks/MockNotificationsPlugin.cpp test/qmltest/mocks/plugins/Lomiri/Notifications/Mocks/MockNotificationsPlugin.h test/qmltest/mocks/plugins/Lomiri/Notifications/Mocks/MockSource.cpp test/qmltest/mocks/plugins/Lomiri/Notifications/Mocks/MockSource.h test/qmltest/mocks/plugins/Lomiri/Notifications/TestNotificationsPlugin.cpp test/qmltest/mocks/plugins/Lomiri/Notifications/TestNotificationsPlugin.h test/qmltest/modules/TestUtil/TestUtil.cpp test/qmltest/modules/TestUtil/TestUtil.h test/qmltest/modules/TestUtil/TestUtilPlugin.cpp test/qmltest/modules/TestUtil/TestUtilPlugin.h test/qmltest/modules/TestUtil/Verifier.qml test/qmltest/modules/TestUtil/test/MockObjectForInstanceOfTest.qml test/qmltest/modules/TestUtil/test/MockObjectForInstanceOfTestChild.qml test/qmltest/modules/TestUtil/test/tst_TestUtil.qml Copyright: 2013, 2015, Canonical Ltd. 2013, 2015-2016, Canonical Ltd. 2013, 2016, Canonical Ltd. 2013, Canonical Ltd. 2013-2016, Canonical Ltd. 2013-2017, Canonical Ltd. 2013-2106, Canonical Ltd. 2016, Canonical Ltd. 2017, Canonical Ltd. 2012, Canonical Ltd 2013, Canonical Ltd 2016-2017, Canonical Ltd 2017, Canonical Ltd 2012-2013, Canonical, Ltd. 2013, Canonical, Ltd. 2015-2016, Canonical, Ltd. License: LGPL-3 Files: include/lomiri/shell/application/Mir.h include/lomiri/shell/application/MirPlatformCursor.h include/lomiri/shell/application/MirSurfaceInterface.h include/lomiri/shell/application/MirSurfaceItemInterface.h include/lomiri/shell/application/MirSurfaceListInterface.h include/lomiri/shell/application/SurfaceManagerInterface.h Copyright: 2015, Canonical, Ltd. 2015-2016, Canonical, Ltd. 2016, Canonical, Ltd. License: GPL-3 Files: include/lomiri/api/Version.h.in test/copyright/check_copyright.sh test/headers/compile_headers.py test/whitespace/check_whitespace.py Copyright: 2013, Canonical Ltd License: LGPL-3 Comment: Generated files. Files: doc/Doxyfile.in include/lomiri/api/CMakeLists.txt lomiri-api.qmlproject Copyright: 2012-2017, Canonical Ltd. License: LGPL-3 Comment: Generated files. . Assuming license as found in COPYING file. Assuming copyright holdership as found in the rest of the files. Files: include/lomiri/util/Dbus.h src/lomiri/util/Dbus.cpp test/gtest/lomiri/util/Dbus/Dbus_test.cpp Copyright: 2020, UBports foundation License: LGPL-3 Files: debian/* Copyright: 2013, Canonical Ltd. 2020, Mike Gabriel License: LGPL-3 or GPL-3 License: LGPL-3 This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, version 3 of the License. . This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. . You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . . On Debian systems, the full text of the GNU Lesser General Public License version 3 can be found in the file /usr/share/common-licenses/LGPL-3. License: GPL-3 This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. . This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. . You should have received a copy of the GNU General Public License along with this program. If not, see . . On Debian systems, the full text of the GNU General Public License version 3 can be found in the file /usr/share/common-licenses/GPL-3. lomiri-api-0.2.1/debian/liblomiri-api-dev.install000066400000000000000000000001111443550065200216700ustar00rootroot00000000000000usr/include/lomiri/* usr/lib/*/liblomiri-api.so usr/lib/*/pkgconfig/*.pc lomiri-api-0.2.1/debian/liblomiri-api-doc.doc-base000066400000000000000000000004231443550065200216740ustar00rootroot00000000000000Document: liblomiri-api-doc Title: Lomiri API Author: UBports.com Abstract: This document describes the Lomiri shell integration API Section: Programming/C++ Format: HTML Index: /usr/share/doc/liblomiri-api-doc/html/index.html Files: /usr/share/doc/liblomiri-api-doc/html/* lomiri-api-0.2.1/debian/liblomiri-api-doc.install000066400000000000000000000000461443550065200216660ustar00rootroot00000000000000usr/share/doc/liblomiri-api-doc/html/ lomiri-api-0.2.1/debian/liblomiri-api0.install000066400000000000000000000000351443550065200212010ustar00rootroot00000000000000usr/lib/*/liblomiri-api.so.* lomiri-api-0.2.1/debian/rules000077500000000000000000000025531443550065200160670ustar00rootroot00000000000000#!/usr/bin/make -f # -*- makefile -*- # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 export DPKG_GENSYMBOLS_CHECK_LEVEL=4 export CC=$(DEB_HOST_GNU_TYPE)-gcc export CXX=$(DEB_HOST_GNU_TYPE)-g++ # http://ccache.samba.org/manual.html#_precompiled_headers export CCACHE_SLOPPINESS=time_macros include /usr/share/dpkg/buildflags.mk # see FEATURE AREAS in dpkg-buildflags(1) export DEB_BUILD_MAINT_OPTIONS = hardening=+all export QT_SELECT := 5 %: dh $@ override_dh_install: mkdir -p "$(CURDIR)/debian/tmp/usr/share/doc/liblomiri-api-doc/html/" mv $(CURDIR)/debian/tmp/usr/share/doc/liblomiri-api/* $(CURDIR)/debian/tmp/usr/share/doc/liblomiri-api-doc/html/ find "$(CURDIR)/debian/tmp/usr/share/doc/liblomiri-api-doc/html/" -name *.md5 -delete; \ rdfind -makesymlinks true "$(CURDIR)/debian/tmp/usr/share/doc/liblomiri-api-doc/html/"; \ symlinks -rc "$(CURDIR)/debian/tmp/usr/share/doc/liblomiri-api-doc/html/"; \ dh_install override_dh_installchangelogs: dh_installchangelogs NEWS override_dh_missing: dh_missing --fail-missing override_dh_auto_test: mkdir -p $(CURDIR)/debian/test-home/.local/share export HOME=$(CURDIR)/debian/test-home \ && export XDG_DATA_HOME=$(CURDIR)/debian/test-home/.local/share \ && dbus-test-runner --keep-env --bus-type=both -m 300 -t dh_auto_test override_dh_clean: rm -Rfv $(CURDIR)/debian/test-home/ dh_clean lomiri-api-0.2.1/debian/source/000077500000000000000000000000001443550065200163025ustar00rootroot00000000000000lomiri-api-0.2.1/debian/source/format000066400000000000000000000000041443550065200175070ustar00rootroot000000000000001.0 lomiri-api-0.2.1/doc/000077500000000000000000000000001443550065200143255ustar00rootroot00000000000000lomiri-api-0.2.1/doc/Doxyfile.in000066400000000000000000002265451443550065200164560ustar00rootroot00000000000000# Doxyfile 1.8.1.2 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project # # All text after a hash (#) is considered a comment and will be ignored # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" ") #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # This tag specifies the encoding used for all characters in the config file # that follow. The default is UTF-8 which is also the encoding used for all # text before the first occurrence of this tag. Doxygen uses libiconv (or the # iconv built into libc) for the transcoding. See # http://www.gnu.org/software/libiconv for the list of possible encodings. DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or sequence of words) that should # identify the project. Note that if you do not use Doxywizard you need # to put quotes around the project name if it contains spaces. PROJECT_NAME = "My Project" # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer # a quick idea about the purpose of the project. Keep the description short. PROJECT_BRIEF = # With the PROJECT_LOGO tag one can specify an logo or icon that is # included in the documentation. The maximum height of the logo should not # exceed 55 pixels and the maximum width should not exceed 200 pixels. # Doxygen will copy the logo to the output directory. PROJECT_LOGO = # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = @PROJECT_BINARY_DIR@/doc # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output # format and will distribute the generated files over these directories. # Enabling this option can be useful when feeding doxygen a huge amount of # source files, where putting all generated files in the same directory would # otherwise cause performance problems for the file system. CREATE_SUBDIRS = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, # Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, # Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English # messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, # Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, # Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. OUTPUT_LANGUAGE = English # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator # that is used to form the text in various listings. Each string # in this list, if found as the leading text of the brief description, will be # stripped from the text and the result after processing the whole list, is # used as the annotated text. Otherwise, the brief description is used as-is. # If left blank, the following values are used ("$name" is automatically # replaced with the name of the entity): "The $name class" "The $name widget" # "The $name file" "is" "provides" "specifies" "contains" # "represents" "a" "an" "the" ABBREVIATE_BRIEF = "The $name class" \ "The $name widget" \ "The $name file" \ is \ provides \ specifies \ contains \ represents \ a \ an \ the # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = YES # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the # path to strip. STRIP_FROM_PATH = @PROJECT_SOURCE_DIR@ @PROJECT_BINARY_DIR@ # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells # the reader which header file to include in order to use a class. # If left blank only the name of the header file containing the class # definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. STRIP_FROM_INC_PATH = @PROJECT_SOURCE_DIR@/include @PROJECT_BINARY_DIR@/include # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful if your file system # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like regular Qt-style comments # (thus requiring an explicit @brief command for a brief description.) JAVADOC_AUTOBRIEF = NO # If the QT_AUTOBRIEF tag is set to YES then Doxygen will # interpret the first line (until the first dot) of a Qt-style # comment as the brief description. If set to NO, the comments # will behave just like regular Qt-style comments (thus requiring # an explicit \brief command for a brief description.) QT_AUTOBRIEF = NO # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// # comments) as a brief description. This used to be the default behaviour. # The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce # a new page for each member. If set to NO, the documentation of a member will # be part of the file/class/namespace that contains it. SEPARATE_MEMBER_PAGES = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 8 # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = "accessors=\par Accessors:\n" "notifier=\par Notifier:\n" # This tag can be used to specify a number of word-keyword mappings (TCL only). # A mapping has the form "name=value". For example adding # "class=itcl::class" will allow you to use the command class in the # itcl::class meaning. TCL_SUBST = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C # sources only. Doxygen will then generate output that is more tailored for C. # For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = NO # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java # sources only. Doxygen will then generate output that is more tailored for # Java. For instance, namespaces will be presented as packages, qualified # scopes will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources only. Doxygen will then generate output that is more tailored for # Fortran. OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL # sources. Doxygen will then generate output that is tailored for # VHDL. OPTIMIZE_OUTPUT_VHDL = NO # Doxygen selects the parser to use depending on the extension of the files it # parses. With this tag you can assign which parser to use for a given extension. # Doxygen has a built-in mapping, but you can override or extend it using this # tag. The format is ext=language, where ext is a file extension, and language # is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C, # C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make # doxygen treat .inc files as Fortran files (default is PHP), and .f files as C # (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions # you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. EXTENSION_MAPPING = # If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all # comments according to the Markdown format, which allows for more readable # documentation. See http://daringfireball.net/projects/markdown/ for details. # The output of markdown processing is further processed by doxygen, so you # can mix doxygen, HTML, and XML commands with Markdown formatting. # Disable only in case of backward compatibilities issues. MARKDOWN_SUPPORT = YES # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want # to include (a tag file for) the STL sources as input, then you should # set this tag to YES in order to let doxygen match functions declarations and # definitions whose arguments contain STL classes (e.g. func(std::string); v.s. # func(std::string) {}). This also makes the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. BUILTIN_STL_SUPPORT = NO # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. # Doxygen will parse them like normal C++ but will assume all classes use public # instead of private inheritance when no explicit protection keyword is present. SIP_SUPPORT = NO # For Microsoft's IDL there are propget and propput attributes to indicate getter # and setter methods for a property. Setting this option to YES (the default) # will make doxygen replace the get and set methods by a property in the # documentation. This will only work if the methods are indeed getting or # setting a simple type. If this is not the case, or you want to show the # methods anyway, you should set this option to NO. IDL_PROPERTY_SUPPORT = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO # Set the SUBGROUPING tag to YES (the default) to allow class member groups of # the same type (for instance a group of public functions) to be put as a # subgroup of that type (e.g. under the Public Functions section). Set it to # NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES # When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and # unions are shown inside the group in which they are included (e.g. using # @ingroup) instead of on a separate page (for HTML and Man pages) or # section (for LaTeX and RTF). INLINE_GROUPED_CLASSES = NO # When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and # unions with only public data fields will be shown inline in the documentation # of the scope in which they are defined (i.e. file, namespace, or group # documentation), provided this scope is documented. If set to NO (the default), # structs, classes, and unions are shown on a separate page (for HTML and Man # pages) or section (for LaTeX and RTF). INLINE_SIMPLE_STRUCTS = NO # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum # is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, # namespace, or class. And the struct will be named TypeS. This can typically # be useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. TYPEDEF_HIDES_STRUCT = NO # Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be # set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given # their name and scope. Since this can be an expensive process and often the # same symbol appear multiple times in the code, doxygen keeps a cache of # pre-resolved symbols. If the cache is too small doxygen will become slower. # If the cache is too large, memory is wasted. The cache size is given by this # formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0, # corresponding to a cache size of 2^16 = 65536 symbols. LOOKUP_CACHE_SIZE = 0 #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. # Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = NO # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = NO # If the EXTRACT_PACKAGE tag is set to YES all members with package or internal # scope will be included in the documentation. EXTRACT_PACKAGE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = NO # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = YES # This flag is only useful for Objective-C code. When set to YES local # methods, which are defined in the implementation section but not in # the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = NO # If this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called # 'anonymous_namespace{file}', where file will be replaced with the base # name of the file that contains the anonymous namespace. By default # anonymous namespaces are hidden. EXTRACT_ANON_NSPACES = NO # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the # various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. # If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all # friend (class|struct|union) declarations. # If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any # documentation blocks found inside the body of a function. # If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = NO # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. CASE_SENSE_NAMES = NO # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen # will list include files with double quotes in the documentation # rather than with sharp brackets. FORCE_LOCAL_INCLUDES = NO # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically # by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO # If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen # will sort the (brief and detailed) documentation of class members so that # constructors and destructors are listed first. If set to NO (the default) # the constructors will appear in the respective orders defined by # SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. # This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO # and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. SORT_MEMBERS_CTORS_1ST = NO # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the # hierarchy of group names into alphabetical order. If set to NO (the default) # the group names will appear in their defined order. SORT_GROUP_NAMES = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # sorted by fully-qualified names, including namespaces. If set to # NO (the default), the class list will be sorted only by class name, # not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = NO # If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to # do proper type resolution of all parameters of a function it will reject a # match between the prototype and the implementation of a member function even # if there is only one candidate or it is obvious which candidate to choose # by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen # will still accept a match between prototype and implementation in such cases. STRICT_PROTO_MATCHING = NO # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or macro consists of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and macros in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES # Set the SHOW_FILES tag to NO to disable the generation of the Files page. # This will remove the Files entry from the Quick Index and from the # Folder Tree View (if specified). The default is YES. SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the # Namespaces page. This will remove the Namespaces entry from the Quick Index # and from the Folder Tree View (if specified). The default is YES. SHOW_NAMESPACES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from # the version control system). Doxygen will invoke the program by executing (via # popen()) the command , where is the value of # the FILE_VERSION_FILTER tag, and is the name of an input file # provided by doxygen. Whatever the program writes to standard output # is used as the file version. See the manual for examples. FILE_VERSION_FILTER = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed # by doxygen. The layout file controls the global structure of the generated # output files in an output format independent way. To create the layout file # that represents doxygen's defaults, run doxygen with the -l option. # You can optionally specify a file name after the option, if omitted # DoxygenLayout.xml will be used as the name of the layout file. LAYOUT_FILE = # The CITE_BIB_FILES tag can be used to specify one or more bib files # containing the references data. This must be a list of .bib files. The # .bib extension is automatically appended if omitted. Using this command # requires the bibtex tool to be installed. See also # http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style # of the bibliography can be controlled using LATEX_BIB_STYLE. To use this # feature you need bibtex and perl available in the search path. CITE_BIB_FILES = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = YES # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = YES # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some # parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # The WARN_NO_PARAMDOC option can be enabled to get warnings for # functions that are documented, but have no documentation for their parameters # or return value. If set to NO (the default) doxygen will only warn about # wrong or incomplete parameter documentation, but not about the absence of # documentation. WARN_NO_PARAMDOC = NO # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. Optionally the format may contain # $version, which will be replaced by the version of the file (if it could # be obtained via FILE_VERSION_FILTER) WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = @PROJECT_BINARY_DIR@/include @PROJECT_SOURCE_DIR@/include @PROJECT_SOURCE_DIR@/src # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is # also the default input encoding. Doxygen uses libiconv (or the iconv built # into libc) for the transcoding. See http://www.gnu.org/software/libiconv for # the list of possible encodings. INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh # *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py # *.f90 *.f *.for *.vhd *.vhdl FILE_PATTERNS = *.c \ *.cc \ *.cxx \ *.cpp \ *.c++ \ *.d \ *.java \ *.ii \ *.ixx \ *.ipp \ *.i++ \ *.inl \ *.h \ *.hh \ *.hxx \ *.hpp \ *.h++ \ *.idl \ *.odl \ *.cs \ *.php \ *.php3 \ *.inc \ *.m \ *.markdown \ *.md \ *.mm \ *.dox \ *.py \ *.f90 \ *.f \ *.for \ *.vhd \ *.vhdl # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = YES # The EXCLUDE tag can be used to specify files and/or directories that should be # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. # Note that relative paths are relative to the directory from which doxygen is # run. EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system feature) are excluded # from the input. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. Note that the wildcards are matched # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* EXCLUDE_PATTERNS = */internal/* # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, # AClass::ANamespace, ANamespace::*Test EXCLUDE_SYMBOLS = *::internal::* # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = * # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. If FILTER_PATTERNS is specified, this tag will be # ignored. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. Doxygen will compare the file name with each pattern and apply the # filter if there is a match. The filters are a list of the form: # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further # info on how filters are used. If FILTER_PATTERNS is empty or if # non of the patterns match the file name, INPUT_FILTER is applied. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO # The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file # pattern. A pattern will override the setting for FILTER_PATTERN (if any) # and it is also possible to disable source filtering for a specific pattern # using *.ext= (so without naming a filter). This option only has effect when # FILTER_SOURCE_FILES is enabled. FILTER_SOURCE_PATTERNS = #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = NO # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C, C++ and Fortran comments will always remain visible. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = NO # If the REFERENCES_RELATION tag is set to YES # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = NO # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will # link to the source code. Otherwise they will link to the documentation. REFERENCES_LINK_SOURCE = YES # If the USE_HTAGS tag is set to YES then the references to source code # will point to the HTML generated by the htags(1) tool instead of doxygen # built-in source browser. The htags tool is part of GNU's global source # tagging system (see http://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = YES # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = lib@LOMIRI_API_LIB@ # The HTML_FILE_EXTENSION tag can be used to specify the file extension for # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. Note that when using a custom header you are responsible # for the proper inclusion of any scripts and style sheets that doxygen # needs, which is dependent on the configuration options used. # It is advised to generate a default header using "doxygen -w html # header.html footer.html stylesheet.css YourConfigFile" and then modify # that header. Note that the header is subject to change so you typically # have to redo this when upgrading to a newer version of doxygen or when # changing the value of configuration settings such as GENERATE_TREEVIEW! HTML_HEADER = # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet. Note that doxygen will try to copy # the style sheet file to the HTML output directory, so don't put your own # style sheet in the HTML output directory as well, or it will be erased! HTML_STYLESHEET = # The HTML_EXTRA_FILES tag can be used to specify one or more extra images or # other source files which should be copied to the HTML output directory. Note # that these files will be copied to the base HTML output directory. Use the # $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these # files. In the HTML_STYLESHEET file, use the file name only. Also note that # the files will be copied as-is; there are no commands or markers available. HTML_EXTRA_FILES = # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. # Doxygen will adjust the colors in the style sheet and background images # according to this color. Hue is specified as an angle on a colorwheel, # see http://en.wikipedia.org/wiki/Hue for more information. # For instance the value 0 represents red, 60 is yellow, 120 is green, # 180 is cyan, 240 is blue, 300 purple, and 360 is red again. # The allowed range is 0 to 359. HTML_COLORSTYLE_HUE = 220 # The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of # the colors in the HTML output. For a value of 0 the output will use # grayscales only. A value of 255 will produce the most vivid colors. HTML_COLORSTYLE_SAT = 100 # The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to # the luminance component of the colors in the HTML output. Values below # 100 gradually make the output lighter, whereas values above 100 make # the output darker. The value divided by 100 is the actual gamma applied, # so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, # and 100 does not change the gamma. HTML_COLORSTYLE_GAMMA = 80 # If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML # page will contain the date and time when the page was generated. Setting # this to NO can help when comparing the output of multiple runs. HTML_TIMESTAMP = YES # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. HTML_DYNAMIC_SECTIONS = NO # With HTML_INDEX_NUM_ENTRIES one can control the preferred number of # entries shown in the various tree structured indices initially; the user # can expand and collapse entries dynamically later on. Doxygen will expand # the tree to such a level that at most the specified number of entries are # visible (unless a fully collapsed tree already exceeds this amount). # So setting the number of entries 1 will produce a full collapsed tree by # default. 0 is a special value representing an infinite number of entries # and will result in a full expanded tree by default. HTML_INDEX_NUM_ENTRIES = 100 # If the GENERATE_DOCSET tag is set to YES, additional index files # will be generated that can be used as input for Apple's Xcode 3 # integrated development environment, introduced with OSX 10.5 (Leopard). # To create a documentation set, doxygen will generate a Makefile in the # HTML output directory. Running make will produce the docset in that # directory and running "make install" will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find # it at startup. # See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html # for more information. GENERATE_DOCSET = NO # When GENERATE_DOCSET tag is set to YES, this tag determines the name of the # feed. A documentation feed provides an umbrella under which multiple # documentation sets from a single provider (such as a company or product suite) # can be grouped. DOCSET_FEEDNAME = "Doxygen generated docs" # When GENERATE_DOCSET tag is set to YES, this tag specifies a string that # should uniquely identify the documentation set bundle. This should be a # reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen # will append .docset to the name. DOCSET_BUNDLE_ID = org.doxygen.Project # When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify # the documentation publisher. This should be a reverse domain-name style # string, e.g. com.mycompany.MyDocSet.documentation. DOCSET_PUBLISHER_ID = org.doxygen.Publisher # The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. DOCSET_PUBLISHER_NAME = Publisher # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compiled HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be # written to the html output directory. CHM_FILE = # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING # is used to encode HtmlHelp index (hhk), content (hhc) and project file # content. CHM_INDEX_ENCODING = # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and # QHP_VIRTUAL_FOLDER are set, an additional index file will be generated # that can be used as input for Qt's qhelpgenerator to generate a # Qt Compressed Help (.qch) of the generated HTML documentation. GENERATE_QHP = NO # If the QHG_LOCATION tag is specified, the QCH_FILE tag can # be used to specify the file name of the resulting .qch file. # The path specified is relative to the HTML output folder. QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#namespace QHP_NAMESPACE = org.doxygen.Project # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#virtual-folders QHP_VIRTUAL_FOLDER = doc # If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to # add. For more information please see # http://doc.trolltech.com/qthelpproject.html#custom-filters QHP_CUST_FILTER_NAME = # The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the # custom filter to add. For more information please see # # Qt Help Project / Custom Filters. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this # project's # filter section matches. # # Qt Help Project / Filter Attributes. QHP_SECT_FILTER_ATTRS = # If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can # be used to specify the location of Qt's qhelpgenerator. # If non-empty doxygen will try to run qhelpgenerator on the generated # .qhp file. QHG_LOCATION = # If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files # will be generated, which together with the HTML files, form an Eclipse help # plugin. To install this plugin and make it available under the help contents # menu in Eclipse, the contents of the directory containing the HTML and XML # files needs to be copied into the plugins directory of eclipse. The name of # the directory within the plugins directory should be the same as # the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before # the help appears. GENERATE_ECLIPSEHELP = NO # A unique identifier for the eclipse help plugin. When installing the plugin # the directory name containing the HTML and XML files should also have # this name. ECLIPSE_DOC_ID = org.doxygen.Project # The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) # at top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. Since the tabs have the same information as the # navigation tree you can set this option to NO if you already set # GENERATE_TREEVIEW to YES. DISABLE_INDEX = NO # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index # structure should be generated to display hierarchical information. # If the tag value is set to YES, a side panel will be generated # containing a tree-like index structure (just like the one that # is generated for HTML Help). For this to work a browser that supports # JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). # Windows users are probably better off using the HTML help feature. # Since the tree basically has the same information as the tab index you # could consider to set DISABLE_INDEX to NO when enabling this option. GENERATE_TREEVIEW = YES # The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values # (range [0,1..20]) that doxygen will group on one line in the generated HTML # documentation. Note that a value of 0 will completely suppress the enum # values from appearing in the overview section. ENUM_VALUES_PER_LINE = 4 # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 # When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open # links to external symbols imported via tag files in a separate window. EXT_LINKS_IN_WINDOW = NO # Use this tag to change the font size of Latex formulas included # as images in the HTML documentation. The default is 10. Note that # when you change the font size after a successful doxygen run you need # to manually remove any form_*.png images from the HTML output directory # to force them to be regenerated. FORMULA_FONTSIZE = 10 # Use the FORMULA_TRANPARENT tag to determine whether or not the images # generated for formulas are transparent PNGs. Transparent PNGs are # not supported properly for IE 6.0, but are supported on all modern browsers. # Note that when changing this option you need to delete any form_*.png files # in the HTML output before the changes have effect. FORMULA_TRANSPARENT = YES # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax # (see http://www.mathjax.org) which uses client side Javascript for the # rendering instead of using prerendered bitmaps. Use this if you do not # have LaTeX installed or if you want to formulas look prettier in the HTML # output. When enabled you may also need to install MathJax separately and # configure the path to it using the MATHJAX_RELPATH option. USE_MATHJAX = NO # When MathJax is enabled you need to specify the location relative to the # HTML output directory using the MATHJAX_RELPATH option. The destination # directory should contain the MathJax.js script. For instance, if the mathjax # directory is located at the same level as the HTML output directory, then # MATHJAX_RELPATH should be ../mathjax. The default value points to # the MathJax Content Delivery Network so you can quickly see the result without # installing MathJax. However, it is strongly recommended to install a local # copy of MathJax from http://www.mathjax.org before deployment. MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest # The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension # names that should be enabled during MathJax rendering. MATHJAX_EXTENSIONS = # When the SEARCHENGINE tag is enabled doxygen will generate a search box # for the HTML output. The underlying search engine uses javascript # and DHTML and should work on any modern browser. Note that when using # HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets # (GENERATE_DOCSET) there is already a search function so this one should # typically be disabled. For large projects the javascript based search engine # can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. SEARCHENGINE = YES # When the SERVER_BASED_SEARCH tag is enabled the search engine will be # implemented using a PHP enabled web server instead of at the web client # using Javascript. Doxygen will generate the search PHP script and index # file to put on the web server. The advantage of the server # based approach is that it scales better to large projects and allows # full text search. The disadvantages are that it is more difficult to setup # and does not have live searching capabilities. SERVER_BASED_SEARCH = NO #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = NO # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. # Note that when enabling USE_PDFLATEX this option is only used for # generating bitmaps for formulas in the HTML output, but not in the # Makefile that is written to the output directory. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4 # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for # the generated latex document. The footer should contain everything after # the last chapter. If it is left blank doxygen will generate a # standard footer. Notice: only use this tag if you know what you are doing! LATEX_FOOTER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = YES # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = YES # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO # If LATEX_HIDE_INDICES is set to YES then doxygen will not # include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO # If LATEX_SOURCE_CODE is set to YES then doxygen will include # source code with syntax highlighting in the LaTeX output. # Note that which sources are shown also depends on other settings # such as SOURCE_BROWSER. LATEX_SOURCE_CODE = NO # The LATEX_BIB_STYLE tag can be used to specify the style to use for the # bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See # http://en.wikipedia.org/wiki/BibTeX for more info. LATEX_BIB_STYLE = plain #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output # The RTF output is optimized for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load style sheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify an XML schema, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. This is useful # if you want to understand what is going on. On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = NO # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_DEFINED tags. EXPAND_ONLY_PREDEF = NO # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # pointed to by INCLUDE_PATH will be searched when a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. To prevent a macro definition from being # undefined via #undef or recursively expanded use the := operator # instead of the = operator. PREDEFINED = # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition that # overrules the definition found in the source code. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all references to function-like macros # that are alone on a line, have an all uppercase name, and do not end with a # semicolon, because these will confuse the parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- # The TAGFILES option can be used to specify one or more tagfiles. For each # tag file the location of the external documentation should be added. The # format of a tag file without this location is as follows: # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # TAGFILES = file1=loc1 "file2 = loc2" ... # where "loc1" and "loc2" can be relative or absolute paths # or URLs. Note that each tag file must have a unique name (where the name does # NOT include the path). If a tag file is not located in the directory in which # doxygen is run, you must also specify the path to the tagfile here. TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base # or super classes. Setting the tag to NO turns the diagrams off. Note that # this option also works with HAVE_DOT disabled, but it is recommended to # install and use dot, since it yields more powerful graphs. CLASS_DIAGRAMS = YES # You can define message sequence charts within doxygen comments using the \msc # command. Doxygen will then run the mscgen tool (see # http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the # documentation. The MSCGEN_PATH tag allows you to specify the directory where # the mscgen tool resides. If left empty the tool is assumed to be found in the # default search path. DOT_PATH = @DOXYGEN_DOT_PATH@ # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = YES # The DOT_NUM_THREADS specifies the number of dot invocations doxygen is # allowed to run in parallel. When set to 0 (the default) doxygen will # base this on the number of processors available in the system. You can set it # explicitly to a value larger than 0 to get control over the balance # between CPU load and processing speed. DOT_NUM_THREADS = 0 # By default doxygen will use the Helvetica font for all dot files that # doxygen generates. When you want a differently looking font you can specify # the font name using DOT_FONTNAME. You need to make sure dot is able to find # the font, which can be done by putting it in a standard location or by setting # the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the # directory containing the font. DOT_FONTNAME = Helvetica # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. # The default size is 10pt. DOT_FONTSIZE = 10 # By default doxygen will tell dot to use the Helvetica font. # If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to # set the path where dot can find it. DOT_FONTPATH = # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES # If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen # will generate a graph for groups, showing the direct groups dependencies GROUP_GRAPHS = YES # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. UML_LOOK = NO # If the UML_LOOK tag is enabled, the fields and methods are shown inside # the class node. If there are many fields or methods and many nodes the # graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS # threshold limits the number of items for each type to make the size more # managable. Set this to 0 for no limit. Note that the threshold may be # exceeded by 50% before the limit is enforced. UML_LIMIT_NUM_FIELDS = 10 # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = NO # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH and HAVE_DOT options are set to YES then # doxygen will generate a call dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable call graphs # for selected functions only using the \callgraph command. CALL_GRAPH = NO # If the CALLER_GRAPH and HAVE_DOT tags are set to YES then # doxygen will generate a caller dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable caller # graphs for selected functions only using the \callergraph command. CALLER_GRAPH = NO # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will generate a graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES # then doxygen will show the dependencies a directory has on other directories # in a graphical way. The dependency relations are determined by the #include # relations between the files in the directories. DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are svg, png, jpg, or gif. # If left blank png will be used. If you choose svg you need to set # HTML_FILE_EXTENSION to xhtml in order to make the SVG files # visible in IE 9+ (other browsers do not have this requirement). DOT_IMAGE_FORMAT = png # If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to # enable generation of interactive SVG images that allow zooming and panning. # Note that this requires a modern browser other than Internet Explorer. # Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you # need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files # visible. Older versions of IE do not have SVG support. INTERACTIVE_SVG = NO # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The MSCFILE_DIRS tag can be used to specify one or more directories that # contain msc files that are included in the documentation (see the # \mscfile command). MSCFILE_DIRS = # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of # nodes that will be shown in the graph. If the number of nodes in a graph # becomes larger than this value, doxygen will truncate the graph, which is # visualized by representing a node as a red box. Note that doxygen if the # number of direct children of the root node in a graph is already larger than # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. DOT_GRAPH_MAX_NODES = 50 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes # that lay further from the root node will be omitted. Note that setting this # option to 1 or 2 may greatly reduce the computation time needed for large # code bases. Also note that the size of a graph can be further restricted by # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. MAX_DOT_GRAPH_DEPTH = 0 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, because dot on Windows does not # seem to support this out of the box. Warning: Depending on the platform used, # enabling this option may lead to badly anti-aliased labels on the edges of # a graph (i.e. they become hard to read). DOT_TRANSPARENT = NO # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) # support this, this feature is disabled by default. DOT_MULTI_TARGETS = NO # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES lomiri-api-0.2.1/include/000077500000000000000000000000001443550065200152035ustar00rootroot00000000000000lomiri-api-0.2.1/include/CMakeLists.txt000066400000000000000000000001641443550065200177440ustar00rootroot00000000000000set(HDR_INSTALL_DIR include) add_subdirectory(lomiri) set(LOMIRI_API_LIB_HDRS ${LOMIRI_API_LIB_HDRS} PARENT_SCOPE) lomiri-api-0.2.1/include/lomiri/000077500000000000000000000000001443550065200164765ustar00rootroot00000000000000lomiri-api-0.2.1/include/lomiri/CMakeLists.txt000066400000000000000000000005401443550065200212350ustar00rootroot00000000000000add_subdirectory(api) add_subdirectory(shell) add_subdirectory(util) file(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h") file(GLOB internal_headers "${CMAKE_CURRENT_SOURCE_DIR}/internal/*.h") install(FILES ${headers} DESTINATION ${HDR_INSTALL_DIR}/lomiri) set(LOMIRI_API_LIB_HDRS ${LOMIRI_API_LIB_HDRS} ${headers} ${internal_headers} PARENT_SCOPE) lomiri-api-0.2.1/include/lomiri/Exception.h000066400000000000000000000101211443550065200206000ustar00rootroot00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Michi Henning */ #ifndef LOMIRI_EXCEPTION_H #define LOMIRI_EXCEPTION_H #include #include #include #include namespace lomiri { class ExceptionImplBase; /** \brief Abstract base class for all Lomiri exceptions. This class is the base class for all Lomiri exceptions. Besides providing a common base class for structured exception handling, this class provides features to capture nested exceptions (for exceptions that are re-thrown) and to chain exceptions into an exception history that allows a number of exceptions to be remembered before throwing a new exception. The exception nesting is provided by the derivation from std::nested_exception. If you catch an exception and throw another exception from the catch handler, the caught exception is automatically preserved; you can access nested exceptions by calling the nested_ptr() and rethrow_nested() member functions of std::nested_exception. In addition, you can remember one or more exceptions by calling remember(). This is useful in situations where you need to perform a number of actions that may fail with an error code, and you do not want to throw an exception until all of the actions have been attempted. This is particularly useful in shutdown scenarios, where it is often impossible to recover from an error, but it is still desirable to try to shut down as much as possible before reporting or logging the errors: ~~~ void shutdown() { using namespace std; exception_ptr ep; try { shutdown_action_1(); } catch (SomeException const&) { ep = make_exception_ptr(current_exception()); } try { shutdown_action_2(); } catch (SomeOtherException const&) { ep = e.remember(ep); } int err = shutdown_action_3(); if (err != 0) { try { throw YetAnotherException(err); } catch (YetAnotherException const& e) { ep = e.remember(ep); } } if (ep) { rethrow_exception(ep); } } ~~~ Calling what() on a caught exception returns a string with the entire exception history (both nested and chained). */ class LOMIRI_API Exception : public std::exception, public std::nested_exception { public: //! @cond Exception(Exception const&); Exception& operator=(Exception const&); virtual ~Exception() noexcept; //! @endcond char const* what() const noexcept override; /** \brief Returns a std::exception_ptr to this. \note Derived exceptions must implement this member function so the implemention of remember() (provided by this abstract base class) can return a std::exception_ptr to its own derived exception. */ virtual std::exception_ptr self() const = 0; std::string name() const; std::string reason() const; std::string to_string(std::string const& indent = " ") const; std::string to_string(int indent_level, std::string const& indent) const; std::exception_ptr remember(std::exception_ptr earlier_exception); std::exception_ptr get_earlier() const noexcept; protected: Exception(std::string const& name, std::string const& reason); private: std::string name_; std::string reason_; mutable std::string what_; std::exception_ptr earlier_; }; } // namespace lomiri #endif lomiri-api-0.2.1/include/lomiri/LomiriExceptions.h000066400000000000000000000134621443550065200221520ustar00rootroot00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Michi Henning */ #ifndef LOMIRI_EXCEPTIONS_H #define LOMIRI_EXCEPTIONS_H #include namespace lomiri { /** \brief Exception to indicate that an invalid argument was passed to a function, such as passing nullptr when the function expects the argument to be non-null. */ class LOMIRI_API InvalidArgumentException : public Exception { public: /** \brief Constructs the exception. \param reason Further details about the cause of the exception. */ explicit InvalidArgumentException(std::string const& reason); //! @cond InvalidArgumentException(InvalidArgumentException const&); InvalidArgumentException& operator=(InvalidArgumentException const&); virtual ~InvalidArgumentException() noexcept; //! @endcond /** \brief Returns a std::exception_ptr to this. */ virtual std::exception_ptr self() const override; }; /** \brief Exception to indicate a logic error, such as driving the API incorrectly, such as calling methods in the wrong worder. */ class LOMIRI_API LogicException : public Exception { public: /** \brief Constructs the exception. \param reason Further details about the cause of the exception. */ explicit LogicException(std::string const& reason); //! @cond LogicException(LogicException const&); LogicException& operator=(LogicException const&); virtual ~LogicException() noexcept; //! @endcond /** \brief Returns a std::exception_ptr to this. */ virtual std::exception_ptr self() const override; }; /** \brief Exception to indicate errors during shutdown. Usually, it is not possible to handle or recover from errors that arise during shutdown. This exception is thrown once all possible shutdown actions have been carried out and provides information about anything that went wrong via the exception chaining mechanism of the lomiri::Exception base class. */ class LOMIRI_API ShutdownException : public Exception { public: /** \brief Constructs the exception. \param reason Further details about the cause of the exception. */ explicit ShutdownException(std::string const& reason); //! @cond ShutdownException(ShutdownException const&); ShutdownException& operator=(ShutdownException const&); virtual ~ShutdownException() noexcept; //! @endcond /** \brief Returns a std::exception_ptr to this. */ virtual std::exception_ptr self() const override; }; /** \brief Exception to indicate file I/O errors, such as failure to open or write to a file. */ class LOMIRI_API FileException : public Exception { public: /** \brief Constructs the exception. */ /** \brief Constructs the exception from a reason string and and error number. \param reason Further details about the cause of the exception. \param err The UNIX errno value for the error. */ FileException(std::string const& reason, int err); //! @cond FileException(FileException const&); FileException& operator=(FileException const&); virtual ~FileException() noexcept; //! @endcond /** \brief Returns a std::exception_ptr to this. */ virtual std::exception_ptr self() const override; /** \return Returns the error number that was passed to the constructor. */ int error() const noexcept; private: int err_; }; /** \brief Exception to indicate system or library call errors that set errno. */ class LOMIRI_API SyscallException : public Exception { public: /** \brief Constructs the exception. */ /** \brief Constructs the exception from a reason string and and error number. \param reason Further details about the cause of the exception. \param err The UNIX errno value for the error. */ SyscallException(std::string const& reason, int err); //! @cond SyscallException(SyscallException const&); SyscallException& operator=(SyscallException const&); virtual ~SyscallException() noexcept; //! @endcond /** \brief Returns a std::exception_ptr to this. */ virtual std::exception_ptr self() const override; /** \return Returns the error number that was passed to the constructor. */ int error() const noexcept; private: int err_; }; /** \brief Exception for miscellaneous errors, such as failure of a third-party library or hitting resource limitations. */ class LOMIRI_API ResourceException : public Exception { public: /** \brief Constructs the exception. \param reason Further details about the cause of the exception. */ explicit ResourceException(std::string const& reason); //! @cond ResourceException(ResourceException const&); ResourceException& operator=(ResourceException const&); virtual ~ResourceException() noexcept; //! @endcond /** \brief Returns a std::exception_ptr to this. */ virtual std::exception_ptr self() const override; }; } // namespace lomiri #endif lomiri-api-0.2.1/include/lomiri/SymbolExport.h000066400000000000000000000020151443550065200213140ustar00rootroot00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Michi Henning */ #ifndef SYMBOL_EXPORT_H #define SYMBOL_EXPORT_H #define LOMIRI_HELPER_DLL_EXPORT __attribute__ ((visibility ("default"))) #ifdef LOMIRI_DLL_EXPORTS // Defined if we are building the Lomiri API library # define LOMIRI_API LOMIRI_HELPER_DLL_EXPORT #else # define LOMIRI_API /**/ #endif #endif lomiri-api-0.2.1/include/lomiri/api/000077500000000000000000000000001443550065200172475ustar00rootroot00000000000000lomiri-api-0.2.1/include/lomiri/api/CMakeLists.txt000066400000000000000000000006341443550065200220120ustar00rootroot00000000000000file(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h") file(GLOB internal_headers "${CMAKE_CURRENT_SOURCE_DIR}/internal/*.h") # # Generated headers # configure_file(Version.h.in Version.h) set(headers ${headers} ${CMAKE_CURRENT_BINARY_DIR}/Version.h) install(FILES ${headers} DESTINATION ${HDR_INSTALL_DIR}/lomiri/api) set(LOMIRI_API_LIB_HDRS ${LOMIRI_API_LIB_HDRS} ${headers} ${internal_headers} PARENT_SCOPE) lomiri-api-0.2.1/include/lomiri/api/Version.h.in000066400000000000000000000057051443550065200214610ustar00rootroot00000000000000// // DO NOT EDIT Version.h (this file)! It is generated from Version.h.in. // /* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Michi Henning */ #include #ifndef LOMIRI_API_VERSION_H #define LOMIRI_API_VERSION_H #define LOMIRI_API_VERSION_MAJOR @LOMIRI_API_MAJOR@ #define LOMIRI_API_VERSION_MINOR @LOMIRI_API_MINOR@ #define LOMIRI_API_VERSION_MICRO @LOMIRI_API_MICRO@ #define LOMIRI_API_VERSION_STRING "@LOMIRI_API_VERSION@" /** \brief Top-level namespace for all things Lomiri-related. */ namespace lomiri { /** \brief Top-level namespace for public functionality of the Lomiri API. */ namespace api { /** @name Version information Version information is represented as <major>.<minor>.<micro>. Releases that differ in the major version number are binary incompatible. Releases that differ in the minor or micro version number are binary compatible with older releases, so client code does not need to be recompiled to use the newer library version. Changes in the micro version number indicate bug fixes. Changes in the minor version indicate feature additions that are binary compatible. */ /** \brief Returns the major version number of the Lomiri API library. The major version number is also available as the macro LOMIRI_API_VERSION_MAJOR. */ /// @cond LOMIRI_API /// @endcond int major_version(); /** \brief Returns the minor version number of the Lomiri API library. The minor version number is also available as the macro LOMIRI_API_VERSION_MINOR. */ /// @cond LOMIRI_API /// @endcond int minor_version(); /** \brief Returns the micro version number of the Lomiri API library. The micro version number is also available as the macro LOMIRI_API_VERSION_MICRO. */ /// @cond LOMIRI_API /// @endcond int micro_version(); /** \brief Returns the Lomiri API version as a string in the format <major>.<minor>.<micro>. The version string is also available as the macro LOMIRI_API_VERSION_STRING. */ /// @cond LOMIRI_API /// @endcond const char* str(); // Returns "major.minor.micro" /// }@ // TODO: Add methods to report compiler version and compiler flags } // namespace api } // namespace lomiri #endif lomiri-api-0.2.1/include/lomiri/api/internal/000077500000000000000000000000001443550065200210635ustar00rootroot00000000000000lomiri-api-0.2.1/include/lomiri/api/internal/.gitkeep000066400000000000000000000000001443550065200225020ustar00rootroot00000000000000lomiri-api-0.2.1/include/lomiri/internal/000077500000000000000000000000001443550065200203125ustar00rootroot00000000000000lomiri-api-0.2.1/include/lomiri/internal/.gitkeep000066400000000000000000000000001443550065200217310ustar00rootroot00000000000000lomiri-api-0.2.1/include/lomiri/shell/000077500000000000000000000000001443550065200176055ustar00rootroot00000000000000lomiri-api-0.2.1/include/lomiri/shell/CMakeLists.txt000066400000000000000000000005721443550065200223510ustar00rootroot00000000000000add_subdirectory(notifications) add_subdirectory(launcher) add_subdirectory(application) file(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h") file(GLOB internal_headers "${CMAKE_CURRENT_SOURCE_DIR}/internal/*.h") install(FILES ${headers} DESTINATION ${HDR_INSTALL_DIR}/lomiri/shell) set(LOMIRI_API_LIB_HDRS ${LOMIRI_API_LIB_HDRS} ${headers} ${internal_headers} PARENT_SCOPE) lomiri-api-0.2.1/include/lomiri/shell/application/000077500000000000000000000000001443550065200221105ustar00rootroot00000000000000lomiri-api-0.2.1/include/lomiri/shell/application/ApplicationInfoInterface.h000066400000000000000000000277211443550065200271720ustar00rootroot00000000000000/* * Copyright 2013,2015,2016 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef LOMIRI_SHELL_APPLICATION_APPLICATIONINFOINTERFACE_H #define LOMIRI_SHELL_APPLICATION_APPLICATIONINFOINTERFACE_H #include #include #include #include #include namespace lomiri { namespace shell { namespace application { class MirSurfaceListInterface; /** * @brief A class that holds information about applications * * The items hold all the information required for the visual representation * in the launcher. */ class LOMIRI_API ApplicationInfoInterface: public QObject { Q_OBJECT /** * @brief The appId of the application. * * Holds the appId for the application. For example (com.ubuntu.camera-app). * The appId is derived from the filename of the .desktop file. */ Q_PROPERTY(QString appId READ appId CONSTANT) /** * @brief The name of the application. * * Holds the name of the application. Localized to current language. */ Q_PROPERTY(QString name READ name NOTIFY nameChanged) /** * @brief The comment for the application. * * Holds the comment of the application as obtained from the .desktop file. Localized * to current language. */ Q_PROPERTY(QString comment READ comment NOTIFY commentChanged) /** * @brief The application's icon. * * Holds a path to the icon for the application. Can be a file or a gicon url. */ Q_PROPERTY(QUrl icon READ icon NOTIFY iconChanged) /** * @brief The application's state. * * Holds the current application state. */ Q_PROPERTY(State state READ state NOTIFY stateChanged) /** * @brief The application's requested running state */ Q_PROPERTY(RequestedState requestedState READ requestedState WRITE setRequestedState NOTIFY requestedStateChanged) /** * @brief The application's focus state. * * Holds the current application focus state. True if focused, false otherwise. */ Q_PROPERTY(bool focused READ focused NOTIFY focusedChanged) /** * @brief Show Splash screen * * A splash screen is shown while the application is loading, * before it has drawn its first frame. This sets if it should be shown or not */ Q_PROPERTY(bool showSplash READ showSplash CONSTANT) /** * @brief Splash screen title * * @see splashShowHeader * Title of the splash screen, to be displayed on its header. * * A splash screen is shown while the application is loading, * before it has drawn its first frame. */ Q_PROPERTY(QString splashTitle READ splashTitle CONSTANT) /** * @brief Splash image * * Url of the splash image to be shown while the application is loading, * before it has drawn its first frame. * * The splash image is centered on the splash screen and displayed in * its actual size (ie, it's not stretched or shrinked and aspect ratio * is kept). */ Q_PROPERTY(QUrl splashImage READ splashImage CONSTANT) /** * @brief Whether an application header should be shown on the splash screen * * We offer 2 kinds of splash screens for applications: * 1. A splash with a gradient background and image * 2. A splash faking a MainView with header text set. So it is possible to * arrange things so that once the app starts up, this splash and the app's * first frame are identical. * * This property is the switch to select between these. * * The header will display the splashTitle, if defined, or the application * name otherwise. * * @see name, splashTitle */ Q_PROPERTY(bool splashShowHeader READ splashShowHeader CONSTANT) /** * @brief Background color of the splash screen * * Any color that is not fully opaque (having an alpha value of less than * 1.0) is ignored and the default background color will be used instead. * * A splash screen is shown while the application is loading, * before it has drawn its first frame. */ Q_PROPERTY(QColor splashColor READ splashColor CONSTANT) /** * @brief Color of the splash screen header * * Any color that is not fully opaque (having an alpha value of less than * 1.0) is ignored and the splashColor will be used instead. * * A splash screen is shown while the application is loading, * before it has drawn its first frame. * * @see splashColor */ Q_PROPERTY(QColor splashColorHeader READ splashColorHeader CONSTANT) /** * @brief Color of the splash screen footer * * Any color that is not fully opaque (having an alpha value of less than * 1.0) is ignored and the splashColor will be used instead. * * A splash screen is shown while the application is loading, * before it has drawn its first frame. * * @see splashColor */ Q_PROPERTY(QColor splashColorFooter READ splashColorFooter CONSTANT) /** * @brief The orientations supported by the application UI * @see rotatesContents */ Q_PROPERTY(Qt::ScreenOrientations supportedOrientations READ supportedOrientations CONSTANT) /** * @brief Whether the application UI will rotate itself to match the screen orientation * * Returns true if the application will rotate the UI in its windows to match the screen * orientation. * * If false, it means that the application never rotates its UI, so it will * rely on the window manager to appropriately rotate his windows to match the screen * orientation instead. * * @see supportedOrientations */ Q_PROPERTY(bool rotatesWindowContents READ rotatesWindowContents CONSTANT) /** * @brief Whether the application is an app targeting the Ubuntu Touch platform. */ Q_PROPERTY(bool isTouchApp READ isTouchApp CONSTANT) /** * @brief Whether this app is exempt from lifecycle management * * If true, this app will never entirely suspend its process. */ Q_PROPERTY(bool exemptFromLifecycle READ exemptFromLifecycle WRITE setExemptFromLifecycle NOTIFY exemptFromLifecycleChanged) /** * @brief The size to be given for new surfaces created by this application */ Q_PROPERTY(QSize initialSurfaceSize READ initialSurfaceSize WRITE setInitialSurfaceSize NOTIFY initialSurfaceSizeChanged) /** * @brief List of the top-level surfaces created by this application */ Q_PROPERTY(lomiri::shell::application::MirSurfaceListInterface* surfaceList READ surfaceList CONSTANT) /** * @brief The list of top-level prompt surfaces for this application */ Q_PROPERTY(lomiri::shell::application::MirSurfaceListInterface* promptSurfaceList READ promptSurfaceList CONSTANT) /** * @brief Count of application's surfaces * * This is a convenience property and will always be the same as surfaceList->count(). * It allows to connect to an application and listen for surface creations/removals for * that particular application without having to keep track of the * application <-> surfaceList relationship. */ Q_PROPERTY(int surfaceCount READ surfaceCount NOTIFY surfaceCountChanged) /** * @brief Whether the application wants server side decoration * * By default this will be true, but may be false if the application specifically requested it * to be off */ Q_PROPERTY(bool serverSideDecoration READ serverSideDecoration NOTIFY serverSideDecorationChanged) protected: /// @cond ApplicationInfoInterface(const QString &appId, QObject* parent = 0): QObject(parent) { Q_UNUSED(appId) } /// @endcond public: /** * @brief A enum that defines a stage. * * MainStage: The main stage, which is the normal place for applications in * traditional desktop environments. * SideStage: The side stage, a panel on the right to place phone form factor * applications. */ enum Stage { MainStage, SideStage }; Q_ENUM(Stage) /** * @brief An application's state. * * Starting: The application was launched and is currently starting up. * Running: The application is running and ready to be used. * Suspended: The application is in the background and has been suspended by * the system in order to save resources. * Stopped: The application is in the background and has been stopped by * the system in order to save resources. From a programmers point of view, * the application is closed, but it's state has been stored to disk and * can be restored upon next launch. */ enum State { Starting, Running, Suspended, Stopped }; Q_ENUM(State) /** * @brief The desired state of an application * * RequestedRunning: If state is Suspended or Stopped, the application will be resumed * or restarted, respectively. * RequestedSuspended: If state is Running, the application will be suspended. */ enum RequestedState { RequestedRunning = Running, RequestedSuspended = Suspended }; Q_ENUM(RequestedState) /** * @brief Closes the application */ virtual void close() = 0; /// @cond virtual ~ApplicationInfoInterface() {} virtual QString appId() const = 0; virtual QString name() const = 0; virtual QString comment() const = 0; virtual QUrl icon() const = 0; virtual State state() const = 0; virtual RequestedState requestedState() const = 0; virtual void setRequestedState(RequestedState) = 0; virtual bool focused() const = 0; virtual bool showSplash() const = 0; virtual QString splashTitle() const = 0; virtual QUrl splashImage() const = 0; virtual bool splashShowHeader() const = 0; virtual QColor splashColor() const = 0; virtual QColor splashColorHeader() const = 0; virtual QColor splashColorFooter() const = 0; virtual Qt::ScreenOrientations supportedOrientations() const = 0; virtual bool rotatesWindowContents() const = 0; virtual bool isTouchApp() const = 0; virtual bool exemptFromLifecycle() const = 0; virtual void setExemptFromLifecycle(bool) = 0; virtual QSize initialSurfaceSize() const = 0; virtual void setInitialSurfaceSize(const QSize &size) = 0; virtual MirSurfaceListInterface* surfaceList() const = 0; virtual MirSurfaceListInterface* promptSurfaceList() const = 0; virtual int surfaceCount() const = 0; virtual bool serverSideDecoration() const = 0; /// @endcond Q_SIGNALS: /// @cond void nameChanged(const QString &name); void commentChanged(const QString &comment); void iconChanged(const QUrl &icon); void stateChanged(State state); void requestedStateChanged(RequestedState value); void focusedChanged(bool focused); void exemptFromLifecycleChanged(bool exemptFromLifecycle); void initialSurfaceSizeChanged(const QSize &size); void surfaceCountChanged(int surfaceCount); void serverSideDecorationChanged(bool ssd); /// @endcond /** * @brief The application is requesting focus */ void focusRequested(); }; } // namespace application } // namespace shell } // namespace lomiri Q_DECLARE_METATYPE(lomiri::shell::application::ApplicationInfoInterface*) #endif // LOMIRI_SHELL_APPLICATIONMANAGER_APPLICATIONINFOINTERFACE_H lomiri-api-0.2.1/include/lomiri/shell/application/ApplicationManagerInterface.h000066400000000000000000000137331443550065200276470ustar00rootroot00000000000000/* * Copyright 2013,2016 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michael Zanetti */ #ifndef LOMIRI_SHELL_APPLICATION_APPLICATIONMANAGERINTERFACE_H #define LOMIRI_SHELL_APPLICATION_APPLICATIONMANAGERINTERFACE_H #include #include #include namespace lomiri { namespace shell { namespace application { class ApplicationInfoInterface; class MirSurfaceInterface; /** * @brief The Application manager * * This is the main class to interact with Applications */ class LOMIRI_API ApplicationManagerInterface: public QAbstractListModel { Q_OBJECT /** * @brief The count of the applications known to the manager. * * This is the same as rowCount, added in order to keep compatibility with QML ListModels. */ Q_PROPERTY(int count READ count NOTIFY countChanged) /** * @brief The currently focused application. * * Use focusApplication() and unfocusCurrentApplication() to modify this. */ Q_PROPERTY(QString focusedApplicationId READ focusedApplicationId NOTIFY focusedApplicationIdChanged) protected: /// @cond ApplicationManagerInterface(QObject* parent = 0): QAbstractListModel(parent) { m_roleNames.insert(RoleAppId, "appId"); m_roleNames.insert(RoleName, "name"); m_roleNames.insert(RoleComment, "comment"); m_roleNames.insert(RoleIcon, "icon"); m_roleNames.insert(RoleState, "state"); m_roleNames.insert(RoleFocused, "focused"); m_roleNames.insert(RoleIsTouchApp, "isTouchApp"); m_roleNames.insert(RoleExemptFromLifecycle, "exemptFromLifecycle"); m_roleNames.insert(RoleApplication, "application"); connect(this, SIGNAL(rowsInserted(QModelIndex, int, int)), SIGNAL(countChanged())); connect(this, SIGNAL(rowsRemoved(QModelIndex, int, int)), SIGNAL(countChanged())); connect(this, SIGNAL(modelReset()), SIGNAL(countChanged())); connect(this, SIGNAL(layoutChanged()), SIGNAL(countChanged())); } /// @endcond public: /** * @brief The Roles supported by the model * * See ApplicationInfoInterface properties for details. */ enum Roles { RoleAppId = Qt::UserRole, RoleName, RoleComment, RoleIcon, RoleState, RoleFocused, RoleIsTouchApp, RoleExemptFromLifecycle, RoleApplication, }; Q_ENUM(Roles) /// @cond virtual ~ApplicationManagerInterface() {} QHash roleNames() const override { return m_roleNames; } int count() const { return rowCount(); } virtual QString focusedApplicationId() const = 0; /// @endcond /** * @brief Get an ApplicationInfo item (using stack index). * * Note: QML requires the full namespace in the return value. * * @param index the index of the item to get * @returns The item, or null if not found. */ Q_INVOKABLE virtual lomiri::shell::application::ApplicationInfoInterface *get(int index) const = 0; /** * @brief Get an ApplicationInfo item (using the appId). * * Note: QML requires the full namespace in the return value. * * @param appId the appId of the item to get * @returns The item, or null if not found. */ Q_INVOKABLE virtual lomiri::shell::application::ApplicationInfoInterface *findApplication(const QString &appId) const = 0; /* * @brief Returns the AplicationInfo with the given surface */ virtual ApplicationInfoInterface *findApplicationWithSurface(MirSurfaceInterface* surface) const = 0; /** * @brief Request to focus a given application * * This will request the shell to focus the given application. * * @param appId The appId of the app to be focused. * @returns True if the request will processed, false if it was discarded (i.e. the given appid could not be found) */ Q_INVOKABLE virtual bool requestFocusApplication(const QString &appId) = 0; /** * @brief Start an application. * * @param appId The appId for the application to be spawned. * @param arguments Any arguments to be passed to the process. * @returns The created application item if start successful, else null. */ Q_INVOKABLE virtual lomiri::shell::application::ApplicationInfoInterface *startApplication(const QString &appId, const QStringList &arguments) = 0; /** * @brief Stops an application. * * @param appId The application to be stopped. * @returns True if application stop successful, else false (i.e. false if application was not running). */ Q_INVOKABLE virtual bool stopApplication(const QString &appId) = 0; Q_SIGNALS: /// @cond void countChanged(); /// @endcond /** * @brief Will be emitted right before the focused application changes. * * This can be used to prepare for an upcoming focus change. For example starting * an animation. */ void focusRequested(const QString &appId); /** * @brief Will be emitted whenever the focused application changes. */ void focusedApplicationIdChanged(); protected: /// @cond QHash m_roleNames; /// @endcond }; } // namespace application } // namespace shell } // namespace lomiri #endif // LOMIRI_SHELL_APPLICATIONMANAGER_APPLICATIONINFO_H lomiri-api-0.2.1/include/lomiri/shell/application/CMakeLists.txt000066400000000000000000000015261443550065200246540ustar00rootroot00000000000000set(INCLUDE_INSTALL_DIR include/lomiri/shell/application) file(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h") file(GLOB internal_headers "${CMAKE_CURRENT_SOURCE_DIR}/internal/*.h") add_custom_target(appheaders SOURCES ${headers} ${internal_headers}) install(FILES ${headers} DESTINATION ${INCLUDE_INSTALL_DIR}) set(LOMIRI_API_LIB_HDRS ${LOMIRI_API_LIB_HDRS} ${headers} ${internal_headers} PARENT_SCOPE) set(VERSION 28) set(PKGCONFIG_NAME "lomiri-shell-application") set(PKGCONFIG_DESCRIPTION "Lomiri shell Application APIs") set(PKGCONFIG_REQUIRES "Qt5Core") set(PKGCONFIG_FILE lomiri-shell-application.pc) configure_file(${CMAKE_SOURCE_DIR}/data/lomiri-shell-api.pc.in ${CMAKE_BINARY_DIR}/data/${PKGCONFIG_FILE} @ONLY ) install(FILES ${CMAKE_BINARY_DIR}/data/${PKGCONFIG_FILE} DESTINATION ${LIB_INSTALL_PREFIX}/pkgconfig ) lomiri-api-0.2.1/include/lomiri/shell/application/Mir.h000066400000000000000000000065361443550065200230220ustar00rootroot00000000000000/* * Copyright (C) 2015-2016 Canonical, Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef LOMIRI_SHELL_APPLICATION_MIR_H #define LOMIRI_SHELL_APPLICATION_MIR_H #include /** @brief Acting mostly as a namespace to hold enums and such for use in QML */ class Mir : public QObject { Q_OBJECT /** @brief Name of the mouse cursor to be used. Follows the X Cursor naming convention. Eg.: "left_ptr" is a left-sided pointer arrow */ Q_PROPERTY(QString cursorName READ cursorName WRITE setCursorName NOTIFY cursorNameChanged) /** * Current (global) keymap, to be applied on the keyboard device * * E.g.: "cz+qwerty" -> "cz" layout, "qwerty" variant */ Q_PROPERTY(QString currentKeymap READ currentKeymap WRITE setCurrentKeymap NOTIFY currentKeymapChanged) public: /** @brief Surface type */ enum Type { UnknownType, NormalType, UtilityType, DialogType, GlossType, FreeStyleType, MenuType, InputMethodType, SatelliteType, TipType, }; Q_ENUM(Type) /** @brief Surface state */ enum State { UnknownState, RestoredState, MinimizedState, MaximizedState, FullscreenState, MaximizedLeftState, MaximizedRightState, HorizMaximizedState, VertMaximizedState, MaximizedTopLeftState, MaximizedTopRightState, MaximizedBottomLeftState, MaximizedBottomRightState, HiddenState, AttachedState, }; Q_ENUM(State) /** @brief Surface orientation angle */ enum OrientationAngle { Angle0 = 0, Angle90 = 90, Angle180 = 180, Angle270 = 270 }; Q_ENUM(OrientationAngle) /** @brief Shell chrome */ enum ShellChrome { NormalChrome, LowChrome, }; Q_ENUM(ShellChrome) /** @brief Form Factor */ enum FormFactor { FormFactorUnknown, FormFactorPhone, FormFactorTablet, FormFactorMonitor, FormFactorTV, FormFactorProjector, }; Q_ENUM(FormFactor) /// @cond virtual void setCursorName(const QString &cursorName) = 0; virtual QString cursorName() const = 0; virtual QString currentKeymap() const = 0; virtual void setCurrentKeymap(const QString ¤tKeymap) = 0; /// @endcond Q_SIGNALS: /// @cond void cursorNameChanged(const QString &cursorName); void currentKeymapChanged(const QString ¤tKeymap); /// @endcond }; Q_DECLARE_METATYPE(Mir::Type) Q_DECLARE_METATYPE(Mir::State) Q_DECLARE_METATYPE(Mir::OrientationAngle) Q_DECLARE_METATYPE(Mir::ShellChrome) Q_DECLARE_METATYPE(Mir::FormFactor) #endif // LOMIRI_SHELL_APPLICATION_MIR_H lomiri-api-0.2.1/include/lomiri/shell/application/MirMousePointerInterface.h000066400000000000000000000044021443550065200272030ustar00rootroot00000000000000/* * Copyright (C) 2015-2016 Canonical, Ltd. * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License version 3, as published by * the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef MIR_MOUSE_POINTER_INTERFACE_H #define MIR_MOUSE_POINTER_INTERFACE_H #include /** * @brief The QML mouse pointer * * FIXME: Get this out of lomiri-api * * This QML item drives the position of the Mir mouse pointer on the scene */ class MirMousePointerInterface : public QQuickItem { Q_OBJECT /** * @brief Name of the cursor * Defines the look of the mouse pointer along with themeName */ Q_PROPERTY(QString cursorName READ cursorName NOTIFY cursorNameChanged) /** * @brief Name of the cursor theme * Defines the look of the mouse pointer along with cursorName * Its default value is "default". */ Q_PROPERTY(QString themeName READ themeName NOTIFY themeNameChanged) public: /** * @brief The constructor */ MirMousePointerInterface(QQuickItem *parent = nullptr) : QQuickItem(parent) {} /// @cond virtual void setCursorName(const QString &cursorName) = 0; virtual QString cursorName() const = 0; virtual void setThemeName(const QString &themeName) = 0; virtual QString themeName() const = 0; virtual void moveTo(const QPoint& position) = 0; /// @endcond /** * @brief Sets the custom cursor * * If it's not a pixmap cursor it will be ignored. * * To use it, cursorName must be set to "custom". themeName is ignored in this case. */ virtual void setCustomCursor(const QCursor &) = 0; Q_SIGNALS: /// @cond void cursorNameChanged(QString name); void themeNameChanged(QString name); /// @endcond }; #endif // MIR_MOUSE_POINTER_INTERFACE_H lomiri-api-0.2.1/include/lomiri/shell/application/MirPlatformCursor.h000066400000000000000000000024311443550065200257130ustar00rootroot00000000000000/* * Copyright (C) 2015 Canonical, Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef MIR_PLATFORM_CURSOR_H #define MIR_PLATFORM_CURSOR_H #include class MirMousePointerInterface; /** * @brief Cursor interface for Mir platform * * FIXME: Get this out of lomiri-api */ class MirPlatformCursor : public QPlatformCursor { public: /** * @brief Register a mouse pointer that this platform cursor will talk to */ virtual void registerMousePointer(MirMousePointerInterface *mousePointer) = 0; /** * @brief Unregister a mouse pointer that this platform cursor will talk to */ virtual void unregisterMousePointer(MirMousePointerInterface *mousePointer) = 0; }; #endif // MIR_PLATFORM_CURSOR_H lomiri-api-0.2.1/include/lomiri/shell/application/MirSurfaceInterface.h000066400000000000000000000226421443550065200261500ustar00rootroot00000000000000/* * Copyright (C) 2015-2016 Canonical, Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef LOMIRI_SHELL_APPLICATION_MIRSURFACE_H #define LOMIRI_SHELL_APPLICATION_MIRSURFACE_H #include #include #include #include "Mir.h" namespace lomiri { namespace shell { namespace application { class MirSurfaceListInterface; /** @brief Holds a Mir surface. Pretty much an opaque class. All surface manipulation is done by giving it to a MirSurfaceItem and then using MirSurfaceItem's properties. */ class MirSurfaceInterface : public QObject { Q_OBJECT /** * @brief The surface type */ Q_PROPERTY(Mir::Type type READ type NOTIFY typeChanged) /** * @brief Name of the surface, given by the client application */ Q_PROPERTY(QString name READ name NOTIFY nameChanged) /** * @brief Persistent Id of the surface */ Q_PROPERTY(QString persistentId READ persistentId CONSTANT) /** * @brief App Id of the app this surface belongs to */ Q_PROPERTY(QString appId READ appId CONSTANT) /** * @brief Position of the current surface buffer, in pixels. */ Q_PROPERTY(QPoint position READ position NOTIFY positionChanged) /** * @brief Requested position of the current surface buffer, in pixels. */ Q_PROPERTY(QPoint requestedPosition READ requestedPosition WRITE setRequestedPosition NOTIFY requestedPositionChanged) /** * @brief Size of the current surface buffer, in pixels. */ Q_PROPERTY(QSize size READ size NOTIFY sizeChanged) /** * @brief State of the surface */ Q_PROPERTY(Mir::State state READ state NOTIFY stateChanged) /** * @brief True if it has a mir client bound to it. * A "zombie" (live == false) surface never becomes alive again. */ Q_PROPERTY(bool live READ live NOTIFY liveChanged) /** * @brief True if surface is ready * MirAL decides surface ready when it swaps its first frame */ Q_PROPERTY(bool isReady READ isReady NOTIFY ready) /** * @brief Visibility of the surface */ Q_PROPERTY(bool visible READ visible NOTIFY visibleChanged) /** * @brief Orientation angle of the surface * * How many degrees, clockwise, the UI in the surface has to rotate to match shell's UI orientation */ Q_PROPERTY(Mir::OrientationAngle orientationAngle READ orientationAngle WRITE setOrientationAngle NOTIFY orientationAngleChanged DESIGNABLE false) /** * @brief The requested minimum width for the surface * Zero if not set */ Q_PROPERTY(int minimumWidth READ minimumWidth NOTIFY minimumWidthChanged) /** * @brief The requested minimum height for the surface * Zero if not set */ Q_PROPERTY(int minimumHeight READ minimumHeight NOTIFY minimumHeightChanged) /** * @brief The requested maximum width for the surface * Zero if not set */ Q_PROPERTY(int maximumWidth READ maximumWidth NOTIFY maximumWidthChanged) /** * @brief The requested maximum height for the surface * Zero if not set */ Q_PROPERTY(int maximumHeight READ maximumHeight NOTIFY maximumHeightChanged) /** * @brief The requested width increment for the surface * Zero if not set */ Q_PROPERTY(int widthIncrement READ widthIncrement NOTIFY widthIncrementChanged) /** * @brief The requested height increment for the surface * Zero if not set */ Q_PROPERTY(int heightIncrement READ heightIncrement NOTIFY heightIncrementChanged) /** * @brief The Shell chrome mode */ Q_PROPERTY(Mir::ShellChrome shellChrome READ shellChrome NOTIFY shellChromeChanged) /** * @brief The requested keymap for this surface * Its format is "layout+variant". */ Q_PROPERTY(QString keymap READ keymap WRITE setKeymap NOTIFY keymapChanged) /** * @brief Whether the surface is focused * * It will be true if this surface is MirFocusControllerInterface::focusedSurface */ Q_PROPERTY(bool focused READ focused NOTIFY focusedChanged) /** * @brief Input bounds * * Bounding rectangle of the surface region that accepts input. */ Q_PROPERTY(QRect inputBounds READ inputBounds NOTIFY inputBoundsChanged) /** * @brief Whether the surface wants to confine the mouse pointer within its boundaries * * If true, the surface doesn't want the mouse pointer to leave its boundaries while it's focused. */ Q_PROPERTY(bool confinesMousePointer READ confinesMousePointer NOTIFY confinesMousePointerChanged) /** * @brief Whether to comply to resize requests coming from the client side * * It's true by default */ Q_PROPERTY(bool allowClientResize READ allowClientResize WRITE setAllowClientResize NOTIFY allowClientResizeChanged) /** * @brief The parent MirSurface or null if this is a top-level surface */ Q_PROPERTY(MirSurfaceInterface* parentSurface READ parentSurface CONSTANT) /** * @brief The list of child surfaces * * Ordered from top-most (index=0) to bottom (index=count-1) * So the Z value for an item in this model would be z: count - index */ Q_PROPERTY(lomiri::shell::application::MirSurfaceListInterface* childSurfaceList READ childSurfaceList CONSTANT) public: /// @cond MirSurfaceInterface(QObject *parent = nullptr) : QObject(parent) {} virtual ~MirSurfaceInterface() {} virtual Mir::Type type() const = 0; virtual QString name() const = 0; virtual QString persistentId() const = 0; virtual QString appId() const = 0; virtual QPoint position() const = 0; virtual QSize size() const = 0; virtual void resize(int width, int height) = 0; virtual void resize(const QSize &size) = 0; virtual Mir::State state() const = 0; virtual bool live() const = 0; virtual bool isReady() const = 0; virtual bool visible() const = 0; virtual Mir::OrientationAngle orientationAngle() const = 0; virtual void setOrientationAngle(Mir::OrientationAngle angle) = 0; virtual int minimumWidth() const = 0; virtual int minimumHeight() const = 0; virtual int maximumWidth() const = 0; virtual int maximumHeight() const = 0; virtual int widthIncrement() const = 0; virtual int heightIncrement() const = 0; virtual void setKeymap(const QString &) = 0; virtual QString keymap() const = 0; virtual Mir::ShellChrome shellChrome() const = 0; virtual bool focused() const = 0; virtual QRect inputBounds() const = 0; virtual bool confinesMousePointer() const = 0; virtual bool allowClientResize() const = 0; virtual void setAllowClientResize(bool) = 0; virtual QPoint requestedPosition() const = 0; virtual void setRequestedPosition(const QPoint &) = 0; virtual MirSurfaceInterface* parentSurface() const = 0; virtual lomiri::shell::application::MirSurfaceListInterface* childSurfaceList() const = 0; /// @endcond /** * @brief Sends a close request * */ Q_INVOKABLE virtual void close() = 0; /** * @brief Sends a force close request * */ Q_INVOKABLE virtual void forceClose() = 0; /** * @brief Activates this surface * * It will get focused and raised */ Q_INVOKABLE virtual void activate() = 0; public Q_SLOTS: /** * @brief Requests a change to the specified state */ virtual void requestState(Mir::State state) = 0; Q_SIGNALS: /// @cond void ready(); void typeChanged(Mir::Type value); void liveChanged(bool value); void visibleChanged(bool visible); void stateChanged(Mir::State value); void orientationAngleChanged(Mir::OrientationAngle value); void positionChanged(QPoint position); void requestedPositionChanged(QPoint position); void sizeChanged(const QSize &value); void nameChanged(const QString &name); void minimumWidthChanged(int value); void minimumHeightChanged(int value); void maximumWidthChanged(int value); void maximumHeightChanged(int value); void widthIncrementChanged(int value); void heightIncrementChanged(int value); void shellChromeChanged(Mir::ShellChrome value); void keymapChanged(const QString &value); void focusedChanged(bool value); void inputBoundsChanged(QRect value); void confinesMousePointerChanged(bool value); void allowClientResizeChanged(bool value); /// @endcond /** * @brief Emitted in response to a requestFocus() call * * If shell agrees with it, it should call activate() on this surface */ void focusRequested(); /** * @brief Emitted when close() is called */ void closeRequested(); }; } // namespace application } // namespace shell } // namespace lomiri Q_DECLARE_METATYPE(lomiri::shell::application::MirSurfaceInterface*) #endif // LOMIRI_SHELL_APPLICATION_MIRSURFACE_H lomiri-api-0.2.1/include/lomiri/shell/application/MirSurfaceItemInterface.h000066400000000000000000000127021443550065200267630ustar00rootroot00000000000000/* * Copyright (C) 2015 Canonical, Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef LOMIRI_SHELL_APPLICATION_MIRSURFACEITEM_H #define LOMIRI_SHELL_APPLICATION_MIRSURFACEITEM_H #include "Mir.h" #include namespace lomiri { namespace shell { namespace application { class MirSurfaceInterface; /** @brief Renders a MirSurface in a QML scene and forwards the input events it receives to it. You can have multiple MirSurfaceItems displaying the same MirSurface. But care must be taken that only one of them feeds the MirSurface with input events and also only one resizes it. */ class MirSurfaceItemInterface : public QQuickItem { Q_OBJECT /** * @brief The surface to be displayed */ Q_PROPERTY(lomiri::shell::application::MirSurfaceInterface* surface READ surface WRITE setSurface NOTIFY surfaceChanged) /** * @brief Type of the given surface or Mir.UnknownType if no surface is set */ Q_PROPERTY(Mir::Type type READ type NOTIFY typeChanged) /** * @brief State of the given surface or Mir.UnknownState if no surface is set */ Q_PROPERTY(Mir::State surfaceState READ surfaceState NOTIFY surfaceStateChanged) /** * @brief Name of the given surface or an empty string if no surface is set */ Q_PROPERTY(QString name READ name NOTIFY nameChanged) /** * @brief True if the item has a surface and that surface has a mir client bound to it. * A "zombie" (live == false) surface never becomes alive again. */ Q_PROPERTY(bool live READ live NOTIFY liveChanged) /** * @brief Orientation angle of the given surface * * How many degrees, clockwise, the UI in the surface has to rotate to match shell's UI orientation */ Q_PROPERTY(Mir::OrientationAngle orientationAngle READ orientationAngle WRITE setOrientationAngle NOTIFY orientationAngleChanged DESIGNABLE false) /** * @brief Whether the item will forward activeFocus, touch events, mouse events and key events to its surface. * It's false by default. * Only one item should have this property enabled for a given surface. */ Q_PROPERTY(bool consumesInput READ consumesInput WRITE setConsumesInput NOTIFY consumesInputChanged) /** * @brief The desired width for the contained MirSurface. * It's ignored if set to zero or a negative number * The default value is zero */ Q_PROPERTY(int surfaceWidth READ surfaceWidth WRITE setSurfaceWidth NOTIFY surfaceWidthChanged) /** * @brief The desired height for the contained MirSurface. * It's ignored if set to zero or a negative number * The default value is zero */ Q_PROPERTY(int surfaceHeight READ surfaceHeight WRITE setSurfaceHeight NOTIFY surfaceHeightChanged) Q_PROPERTY(FillMode fillMode READ fillMode WRITE setFillMode NOTIFY fillModeChanged) /** * @brief The Shell chrome mode */ Q_PROPERTY(Mir::ShellChrome shellChrome READ shellChrome NOTIFY shellChromeChanged) public: enum FillMode { Stretch, PadOrCrop }; Q_ENUM(FillMode) /// @cond MirSurfaceItemInterface(QQuickItem *parent = 0) : QQuickItem(parent) {} virtual ~MirSurfaceItemInterface() {} virtual Mir::Type type() const = 0; virtual QString name() const = 0; virtual bool live() const = 0; virtual Mir::State surfaceState() const = 0; virtual Mir::OrientationAngle orientationAngle() const = 0; virtual void setOrientationAngle(Mir::OrientationAngle angle) = 0; virtual MirSurfaceInterface* surface() const = 0; virtual void setSurface(MirSurfaceInterface*) = 0; virtual bool consumesInput() const = 0; virtual void setConsumesInput(bool value) = 0; virtual int surfaceWidth() const = 0; virtual void setSurfaceWidth(int value) = 0; virtual int surfaceHeight() const = 0; virtual void setSurfaceHeight(int value) = 0; virtual FillMode fillMode() const = 0; virtual void setFillMode(FillMode value) = 0; virtual Mir::ShellChrome shellChrome() const = 0; /// @endcond Q_SIGNALS: /// @cond void typeChanged(Mir::Type); void surfaceStateChanged(Mir::State); void liveChanged(bool live); void orientationAngleChanged(Mir::OrientationAngle angle); void surfaceChanged(lomiri::shell::application::MirSurfaceInterface* surface); void consumesInputChanged(bool value); void surfaceWidthChanged(int value); void surfaceHeightChanged(int value); void nameChanged(const QString &name); void fillModeChanged(FillMode value); void shellChromeChanged(Mir::ShellChrome value); /// @endcond }; } // namespace application } // namespace shell } // namespace lomiri #endif // LOMIRI_SHELL_APPLICATION_MIRSURFACEITEM_H lomiri-api-0.2.1/include/lomiri/shell/application/MirSurfaceListInterface.h000066400000000000000000000054061443550065200270030ustar00rootroot00000000000000/* * Copyright (C) 2016 Canonical, Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef LOMIRI_SHELL_APPLICATION_MIRSURFACELISTINTERFACE_H #define LOMIRI_SHELL_APPLICATION_MIRSURFACELISTINTERFACE_H #include namespace lomiri { namespace shell { namespace application { class MirSurfaceInterface; /** * @brief Interface for a list model of MirSurfaces */ class MirSurfaceListInterface : public QAbstractListModel { Q_OBJECT /** * @brief Number of surfaces in this model * * This is the same as rowCount, added in order to keep compatibility with QML ListModels. */ Q_PROPERTY(int count READ count NOTIFY countChanged) /** * @brief The first (index 0) surface in this model * * Will always match the result of get(0). But being a property, it's more appropriate * for use in qml bindinds (JS expression gets reevaluated when it changes) */ Q_PROPERTY(lomiri::shell::application::MirSurfaceInterface* first READ first NOTIFY firstChanged) public: /** * @brief The Roles supported by the model * * SurfaceRole - A MirSurfaceInterface. */ enum Roles { SurfaceRole = Qt::UserRole, }; /// @cond MirSurfaceListInterface(QObject *parent = 0) : QAbstractListModel(parent) {} virtual ~MirSurfaceListInterface() {} /// @endcond /** * @brief Returns the surface at the specified index * */ Q_INVOKABLE virtual MirSurfaceInterface *get(int index) = 0; /// @cond // QAbstractItemModel methods QHash roleNames() const override { QHash roleNames; roleNames.insert(SurfaceRole, "surface"); return roleNames; } int count() const { return rowCount(); } MirSurfaceInterface *first() { if (rowCount() > 0) { return get(0); } else { return nullptr; } } /// @endcond Q_SIGNALS: /// @cond void countChanged(int count); void firstChanged(); /// @endcond }; } // namespace application } // namespace shell } // namespace lomiri Q_DECLARE_METATYPE(lomiri::shell::application::MirSurfaceListInterface*) #endif // LOMIRI_SHELL_APPLICATION_MIRSURFACELISTINTERFACE_H lomiri-api-0.2.1/include/lomiri/shell/application/SurfaceManagerInterface.h000066400000000000000000000063751443550065200270000ustar00rootroot00000000000000/* * Copyright (C) 2016 Canonical, Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef LOMIRI_SHELL_APPLICATION_SURFACEMANAGERINTERFACE_H #define LOMIRI_SHELL_APPLICATION_SURFACEMANAGERINTERFACE_H #include "Mir.h" #include #include #include #include namespace miral { class Window; class Workspace; } namespace lomiri { namespace shell { namespace application { class MirSurfaceInterface; class SurfaceManagerInterface : public QObject { Q_OBJECT public: virtual ~SurfaceManagerInterface() {} virtual void raise(MirSurfaceInterface *surface) = 0; virtual void activate(MirSurfaceInterface *surface) = 0; virtual void forEachSurfaceInWorkspace(const std::shared_ptr &workspace, const std::function &callback) = 0; virtual void moveSurfaceToWorkspace(lomiri::shell::application::MirSurfaceInterface* surface, const std::shared_ptr &workspace) = 0; virtual void moveWorkspaceContentToWorkspace(const std::shared_ptr &to, const std::shared_ptr &from) = 0; Q_SIGNALS: void surfaceCreated(lomiri::shell::application::MirSurfaceInterface *surface); void surfaceRemoved(lomiri::shell::application::MirSurfaceInterface *surface); void surfaceReady(lomiri::shell::application::MirSurfaceInterface *surface); void surfaceMoved(lomiri::shell::application::MirSurfaceInterface *surface, const QPoint &topLeft); void surfaceResized(lomiri::shell::application::MirSurfaceInterface *surface, const QSize &size); void surfaceStateChanged(lomiri::shell::application::MirSurfaceInterface *surface, Mir::State state); void surfaceFocusChanged(lomiri::shell::application::MirSurfaceInterface *surface, bool focused); void surfacesRaised(const QVector &surfaces); void surfaceRequestedRaise(lomiri::shell::application::MirSurfaceInterface *surface); void surfacesAddedToWorkspace(const std::shared_ptr &workspace, const QVector &surfaces); void surfacesAboutToBeRemovedFromWorkspace(const std::shared_ptr &workspace, const QVector &surfaces); void modificationsStarted(); void modificationsEnded(); }; } // namespace application } // namespace shell } // namespace lomiri #endif // LOMIRI_SHELL_APPLICATION_SURFACEMANAGERINTERFACE_H lomiri-api-0.2.1/include/lomiri/shell/launcher/000077500000000000000000000000001443550065200214065ustar00rootroot00000000000000lomiri-api-0.2.1/include/lomiri/shell/launcher/AppDrawerModelInterface.h000066400000000000000000000034311443550065200262470ustar00rootroot00000000000000/* * Copyright 2016 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #pragma once #include #include namespace lomiri { namespace shell { namespace launcher { /** * @brief A list of app drawer items to be displayed * * This model exposes all the items that should be shown in the app drawer. */ class LOMIRI_API AppDrawerModelInterface: public QAbstractListModel { Q_OBJECT public: /** * @brief The Roles supported by the model * * See LauncherItemInterface properties for details. */ enum Roles { RoleAppId, RoleName, RoleIcon, RoleKeywords, RoleUsage }; Q_ENUM(Roles) /// @cond AppDrawerModelInterface(QObject* parent = nullptr): QAbstractListModel(parent) {} /// @endcond virtual ~AppDrawerModelInterface() {} /// @cond QHash roleNames() const override { QHash roles; roles.insert(RoleAppId, "appId"); roles.insert(RoleName, "name"); roles.insert(RoleIcon, "icon"); roles.insert(RoleKeywords, "keywords"); roles.insert(RoleUsage, "usage"); return roles; } /// @endcond }; } } } lomiri-api-0.2.1/include/lomiri/shell/launcher/CMakeLists.txt000066400000000000000000000013621443550065200241500ustar00rootroot00000000000000set(INCLUDE_INSTALL_DIR include/lomiri/shell/launcher) file(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h") file(GLOB internal_headers "${CMAKE_CURRENT_SOURCE_DIR}/internal/*.h") install(FILES ${headers} DESTINATION ${INCLUDE_INSTALL_DIR}) set(LOMIRI_API_LIB_HDRS ${LOMIRI_API_LIB_HDRS} ${headers} ${internal_headers} PARENT_SCOPE) set(VERSION 13) set(PKGCONFIG_NAME "lomiri-shell-launcher") set(PKGCONFIG_DESCRIPTION "Lomiri shell Launcher APIs") set(PKGCONFIG_REQUIRES "Qt5Core") set(PKGCONFIG_FILE lomiri-shell-launcher.pc) configure_file(${CMAKE_SOURCE_DIR}/data/lomiri-shell-api.pc.in ${CMAKE_BINARY_DIR}/data/${PKGCONFIG_FILE} @ONLY ) install(FILES ${CMAKE_BINARY_DIR}/data/${PKGCONFIG_FILE} DESTINATION ${LIB_INSTALL_PREFIX}/pkgconfig ) lomiri-api-0.2.1/include/lomiri/shell/launcher/LauncherItemInterface.h000066400000000000000000000127401443550065200257640ustar00rootroot00000000000000/* * Copyright 2013-2106 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef LOMIRI_SHELL_LAUNCHER_LAUNCHERITEM_H #define LOMIRI_SHELL_LAUNCHER_LAUNCHERITEM_H #include #include namespace lomiri { namespace shell { namespace launcher { class QuickListModelInterface; /** * @brief An item presented in the launcher * * The items hold all the information required for the visual representation * in the launcher. */ class LOMIRI_API LauncherItemInterface: public QObject { Q_OBJECT /** * @brief The appId of the application associated with the item. */ Q_PROPERTY(QString appId READ appId CONSTANT) /** * @brief The user visible name of the item. */ Q_PROPERTY(QString name READ name NOTIFY nameChanged) /** * @brief The full path to the icon to be shown for the item. */ Q_PROPERTY(QString icon READ icon NOTIFY iconChanged) /** * @brief The keywords for this item. */ Q_PROPERTY(QStringList keywords READ keywords NOTIFY keywordsChanged) /** * @brief The popularity of this application, e.g. usage count given by Zeitgeist */ Q_PROPERTY(uint popularity READ popularity NOTIFY popularityChanged) /** * @brief A flag whether the item is pinned or not */ Q_PROPERTY(bool pinned READ pinned NOTIFY pinnedChanged) /** * @brief A flag whether the application belonging to the icon is currently running or not */ Q_PROPERTY(bool running READ running NOTIFY runningChanged) /** * @brief A flag wheter the application is in the recently used applications list */ Q_PROPERTY(bool recent READ recent NOTIFY recentChanged) /** * @brief The percentage of the progress bar shown on the item. * * For values from 0 and 100 this will present a progress bar on the item. * For values outside this range, no progress bar will be drawn. */ Q_PROPERTY(int progress READ progress NOTIFY progressChanged) /** * @brief The number for the count emblem on the item * * For values >0 this will paint an emblem containing the number. * For 0 and negative values, no count emblem will be drawn. */ Q_PROPERTY(int count READ count NOTIFY countChanged) /** * @brief The visibility of the count emblem. * * True if the count emblem should be visible, false otherwise. */ Q_PROPERTY(bool countVisible READ countVisible NOTIFY countVisibleChanged) /** * @brief The focused state of the item * * True if focused, false if not focused */ Q_PROPERTY(bool focused READ focused NOTIFY focusedChanged) /** * @brief The alerting state of the item * * True if alerting/wobbling, false if not alerting/wobbling */ Q_PROPERTY(bool alerting READ alerting NOTIFY alertingChanged) /** * @brief The number of surfaces that this application entry has opened * * The Launcher will display up to 3 pips, one for each surface */ Q_PROPERTY(int surfaceCount READ surfaceCount NOTIFY surfaceCountChanged) /** * @brief The quick list menu contents for the item * * Items can have a quick list menu. This property holds a model for * the contents of that menu. The pointer to the model will be * constant, but of course the contents of the model can change. */ Q_PROPERTY(lomiri::shell::launcher::QuickListModelInterface* quickList READ quickList CONSTANT) protected: /// @cond LauncherItemInterface(QObject *parent = 0): QObject(parent) {} public: virtual ~LauncherItemInterface() {} virtual QString appId() const = 0; virtual QString name() const = 0; virtual QString icon() const = 0; virtual QStringList keywords() const = 0; virtual uint popularity() const = 0; virtual bool pinned() const = 0; virtual bool running() const = 0; virtual bool recent() const = 0; virtual int progress() const = 0; virtual int count() const = 0; virtual bool countVisible() const = 0; virtual bool focused() const = 0; virtual bool alerting() const = 0; virtual int surfaceCount() const = 0; virtual lomiri::shell::launcher::QuickListModelInterface *quickList() const = 0; Q_SIGNALS: void nameChanged(const QString &name); void iconChanged(const QString &icon); void keywordsChanged(const QStringList &keywords); void popularityChanged(uint popularity); void pinnedChanged(bool pinned); void runningChanged(bool running); void recentChanged(bool running); void progressChanged(int progress); void countChanged(int count); void countVisibleChanged(bool countVisible); void focusedChanged(bool focused); void alertingChanged(bool alerting); void surfaceCountChanged(int surfaceCount); /// @endcond }; } // namespace launcher } // namespace shell } // namespace lomiri #endif // LOMIRI_SHELL_LAUNCHER_LAUNCHERITEMINTERFACE_H lomiri-api-0.2.1/include/lomiri/shell/launcher/LauncherModelInterface.h000066400000000000000000000142371443550065200261310ustar00rootroot00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michael Zanetti */ #ifndef LOMIRI_SHELL_LAUNCHER_LAUNCHERMODELINTERFACE_H #define LOMIRI_SHELL_LAUNCHER_LAUNCHERMODELINTERFACE_H #include #include #include namespace lomiri { namespace shell { namespace launcher { class LauncherItemInterface; /** * @brief A list of launcher items to be displayed * * This model exposes all the launcher items that should be shown in the launcher. */ class LOMIRI_API LauncherModelInterface: public QAbstractListModel { Q_OBJECT /** * @brief The ApplicationManager instance the launcher should be connected to * * The Launcher will display applications contained in the ApplicationManager as * running/recent apps and adjust the currently focused app highlight according * to this. */ Q_PROPERTY(lomiri::shell::application::ApplicationManagerInterface* applicationManager READ applicationManager WRITE setApplicationManager NOTIFY applicationManagerChanged) /** * @brief Only show pinned apps, hiding the unpinned running/recent ones. */ Q_PROPERTY(bool onlyPinned READ onlyPinned WRITE setOnlyPinned NOTIFY onlyPinnedChanged) protected: /// @cond LauncherModelInterface(QObject *parent = 0): QAbstractListModel(parent) { m_roleNames.insert(RoleAppId, "appId"); m_roleNames.insert(RoleName, "name"); m_roleNames.insert(RoleIcon, "icon"); m_roleNames.insert(RolePinned, "pinned"); m_roleNames.insert(RoleRunning, "running"); m_roleNames.insert(RoleRecent, "recent"); m_roleNames.insert(RoleProgress, "progress"); m_roleNames.insert(RoleCount, "count"); m_roleNames.insert(RoleCountVisible, "countVisible"); m_roleNames.insert(RoleFocused, "focused"); m_roleNames.insert(RoleAlerting, "alerting"); m_roleNames.insert(RoleSurfaceCount, "surfaceCount"); } /// @endcond public: /** * @brief The Roles supported by the model * * See LauncherItemInterface properties for details. */ enum Roles { RoleAppId = Qt::UserRole, RoleName, RoleIcon, RolePinned, RoleRunning, RoleRecent, RoleProgress, RoleCount, RoleCountVisible, RoleFocused, RoleAlerting, RoleSurfaceCount }; virtual ~LauncherModelInterface() {} /** * @brief Move an item in the model. * * @param oldIndex The current (old) index of the item to be moved. * @param newIndex The new index where the item should be moved to. */ Q_INVOKABLE virtual void move(int oldIndex, int newIndex) = 0; /** * @brief Get a launcher item. * * Note: QML requires the full namespace in the return value. * * @param index the index of the item to get * @returns The item. */ Q_INVOKABLE virtual lomiri::shell::launcher::LauncherItemInterface *get(int index) const = 0; /** * @brief Pin an item to the launcher. * * Recent and running applications will eventually disappear from the model * as the application is closed or new recent items appear. Pinning an item * to the launcher makes it persist until remove is called on it. * * @param appId The appId of the item to be pinned. * @param index The index where the item should be pinned to. This parameter is optional * and if not supplied, the item will be pinned to the current position. * Note: If an item is not contained in the launcher yet, calling this without an index * will pin the item to the end of the list. */ Q_INVOKABLE virtual void pin(const QString &appId, int index = -1) = 0; /** * @brief Request removal of an item from the model. * * Note: The actual removal of the item might be delayed in certain circumstances. * * @param appId The appId of the item to be removed. */ Q_INVOKABLE virtual void requestRemove(const QString &appId) = 0; /** * @brief Trigger an action from the QuickList * * @param appId The appId of the LauncherItem. * @param actionIndex The index of the triggered entry in the QuickListModel. */ Q_INVOKABLE virtual void quickListActionInvoked(const QString &appId, int actionIndex) = 0; /** * @brief Set the user for which the launcher should display items. * * @param username The user for which the launcher should display items. */ Q_INVOKABLE virtual void setUser(const QString &username) = 0; /// @cond virtual lomiri::shell::application::ApplicationManagerInterface *applicationManager() const = 0; virtual void setApplicationManager(lomiri::shell::application::ApplicationManagerInterface *applicationManager) = 0; virtual bool onlyPinned() const = 0; virtual void setOnlyPinned(bool onlyPinned) = 0; QHash roleNames() const override { return m_roleNames; } /// @endcond Q_SIGNALS: /// @cond void applicationManagerChanged(); void onlyPinnedChanged(); /// @endcond /** * @brief Emitted when the launcher should hint itself to the user, e.g. to indicate a * change the user should be made aware of. */ void hint(); protected: /// @cond QHash m_roleNames; /// @endcond }; } // namespace launcher } // namespace shell } // namespace lomiri #endif // LOMIRI_SHELL_LAUNCHER_LAUNCHERMODELINTERFACE_H lomiri-api-0.2.1/include/lomiri/shell/launcher/QuickListModelInterface.h000066400000000000000000000052171443550065200262760ustar00rootroot00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michael Zanetti */ #ifndef LOMIRI_SHELL_LAUNCHER_QUICKLISTMODELINTERFACE_H #define LOMIRI_SHELL_LAUNCHER_QUICKLISTMODELINTERFACE_H #include #include namespace lomiri { namespace shell { namespace launcher { /** * @brief A model containing QuickList actions for an application in the launcher. * * The model has the following roles: * - RoleLabel (label): The text entry in the QuickList menu (QString). * - RoleIcon (icon): The icon to be shown for this entry (QString). * - RoleClickable (clickable): Determines if the entry can be triggered or is just a static text (boolean) * - RoleHasSeparator (hasSeparator): Determines if the entry has a separator (boolean) * - RoleIsPrivate (isPrivate): Determines whether the entry should be shown or not in locked mode (e.g. greeter is locked) */ class LOMIRI_API QuickListModelInterface: public QAbstractListModel { Q_OBJECT protected: /// @cond explicit QuickListModelInterface(QObject *parent = 0) : QAbstractListModel(parent) { m_roleNames.insert(RoleLabel, "label"); m_roleNames.insert(RoleIcon, "icon"); m_roleNames.insert(RoleClickable, "clickable"); m_roleNames.insert(RoleHasSeparator, "hasSeparator"); m_roleNames.insert(RoleIsPrivate, "isPrivate"); } /// @endcond public: /** * @brief The Roles supported by the model * * See class description for details. */ enum Roles { RoleLabel, RoleIcon, RoleClickable, RoleHasSeparator, RoleIsPrivate }; Q_ENUM(Roles) /// @cond virtual ~QuickListModelInterface() {} /// @endcond /// @cond QHash roleNames() const override { return m_roleNames; } /// @endcond protected: /// @cond QHash m_roleNames; /// @endcond }; } // launcher } // shell } // lomiri #endif // LOMIRI_SHELL_LAUNCHER_QUICKLISTMODELINTERFACE_H lomiri-api-0.2.1/include/lomiri/shell/notifications/000077500000000000000000000000001443550065200224565ustar00rootroot00000000000000lomiri-api-0.2.1/include/lomiri/shell/notifications/CMakeLists.txt000066400000000000000000000014071443550065200252200ustar00rootroot00000000000000set(INCLUDE_INSTALL_DIR include/lomiri/shell/notifications) file(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h") file(GLOB internal_headers "${CMAKE_CURRENT_SOURCE_DIR}/internal/*.h") install(FILES ${headers} DESTINATION ${INCLUDE_INSTALL_DIR}) set(LOMIRI_API_LIB_HDRS ${LOMIRI_API_LIB_HDRS} ${headers} ${internal_headers} PARENT_SCOPE) set(VERSION 3) set(PKGCONFIG_NAME "lomiri-shell-notifications") set(PKGCONFIG_DESCRIPTION "Lomiri shell Notifications APIs") set(PKGCONFIG_REQUIRES "Qt5Core") set(PKGCONFIG_FILE lomiri-shell-notifications.pc) configure_file(${CMAKE_SOURCE_DIR}/data/lomiri-shell-api.pc.in ${CMAKE_BINARY_DIR}/data/${PKGCONFIG_FILE} @ONLY ) install(FILES ${CMAKE_BINARY_DIR}/data/${PKGCONFIG_FILE} DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig ) lomiri-api-0.2.1/include/lomiri/shell/notifications/Enums.h000066400000000000000000000055201443550065200237200ustar00rootroot00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michał Sawicz */ #ifndef LOMIRI_SHELL_NOTIFICATIONS_ENUMS_H #define LOMIRI_SHELL_NOTIFICATIONS_ENUMS_H #include #include namespace lomiri { namespace shell { namespace notifications { /** \brief Wraps NotificationInterface's urgency enumeration. */ class LOMIRI_API Urgency : public QObject { Q_OBJECT public: /** \brief NotificationInterface's urgency enumeration. This determines the order in which notifications are displayed. */ enum class UrgencyEnum { Invalid = 0, Low, /**< Displayed last. */ Normal, /**< Displayed before Low, after Critical. */ Critical /**< Displayed before Low and Normal. */ }; Q_ENUM(UrgencyEnum) }; /** \brief Wraps NotificationInterface's type enumeration. */ class LOMIRI_API Type : public QObject { Q_OBJECT public: /** \brief NotificationInterface's type enumeration. This determines the visual and interaction behavior of the displayed notification. */ enum class TypeEnum { Invalid = 0, Confirmation, /**< Confirmation (synchronous). */ Ephemeral, /**< Ephemeral (input-transparent). */ Interactive, /**< Interactive (clickable). */ SnapDecision, /**< Snap decision (multi-button). */ Placeholder /**< Non-visible placeholder of default size. */ }; Q_ENUM(TypeEnum) }; /** \brief Wraps NotificationInterface's hint flags. */ class LOMIRI_API Hint : public QObject { Q_OBJECT public: /** \brief NotificationInterface's hint flags. This modifies some visual and interactive behavior of the displayed notification. */ enum HintEnum { Invalid = 1 << 0, ButtonTint = 1 << 1, /**< Use a colour tint on the positive button in a snap decision. */ IconOnly = 1 << 2 /**< Only display the icon, no summary or body. */ }; Q_FLAG(HintEnum) Q_DECLARE_FLAGS(Hints, HintEnum) }; Q_DECLARE_OPERATORS_FOR_FLAGS(Hint::Hints) } // namespace notifications } // namespace shell } // namespace lomiri #endif // LOMIRI_SHELL_NOTIFICATIONS_ENUMS_H lomiri-api-0.2.1/include/lomiri/shell/notifications/ModelInterface.h000066400000000000000000000071141443550065200255130ustar00rootroot00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michał Sawicz */ #ifndef LOMIRI_SHELL_NOTIFICATIONS_MODELINTERFACE_H #define LOMIRI_SHELL_NOTIFICATIONS_MODELINTERFACE_H #include #include namespace lomiri { namespace shell { namespace notifications { /** \brief A list of notifications to be displayed This model exposes all the notifications that are currently supposed to be on screen. Not all of them might actually get on screen due to screen size, in which case the NotificationInterface::displayed() signal will only be emitted after the notification was actually displayed. */ class LOMIRI_API ModelInterface : public QAbstractListModel { Q_OBJECT /** \brief Whether a placeholder for confirmation should be kept at the beginning When this is true, the model should hold a Placeholder type notification at the top and update its data when an incoming Confirmation type notification is sent. \accessors %confirmationPlaceholder(), setConfirmationPlaceholder(bool confirmationPlaceholder) \notifier confirmationPlaceholderChanged(bool confirmationPlaceholder) */ Q_PROPERTY(bool confirmationPlaceholder READ confirmationPlaceholder WRITE setConfirmationPlaceholder NOTIFY confirmationPlaceholderChanged) protected: /// @cond explicit ModelInterface(QObject* parent = 0) : QAbstractListModel(parent) { } /// @endcond public: virtual ~ModelInterface() { } /// @cond virtual bool confirmationPlaceholder() const = 0; virtual void setConfirmationPlaceholder(bool confirmationPlaceholder) = 0; /// @endcond /** \brief NotificationModel's data-role enumeration. The different data-entries of a notification element in the model. */ enum Roles { RoleType = Qt::UserRole + 1, /** type of notification */ RoleUrgency = Qt::UserRole + 2, /** urgency of notification */ RoleId = Qt::UserRole + 3, /** internal id set by daemon */ RoleSummary = Qt::UserRole + 4, /** summary-text */ RoleBody = Qt::UserRole + 5, /** body-text */ RoleValue = Qt::UserRole + 6, /** 0..100 value */ RoleIcon = Qt::UserRole + 7, /** main icon */ RoleSecondaryIcon = Qt::UserRole + 8, /** optional 2nd icon */ RoleActions = Qt::UserRole + 9, /** attached optional actions */ RoleHints = Qt::UserRole + 10, /** attached hints */ RoleNotification = Qt::UserRole + 11 /** notification object */ }; Q_ENUM(Roles) Q_SIGNALS: /** Emitted when value of the confirmationPlaceholder property has changed. \param confirmationPlaceholder New value of the confirmationPlaceholder property. */ void confirmationPlaceholderChanged(bool confirmationPlaceholder); }; } // namespace notifications } // namespace shell } // namespace lomiri #endif // LOMIRI_SHELL_NOTIFICATIONS_MODELINTERFACE_H lomiri-api-0.2.1/include/lomiri/shell/notifications/NotificationInterface.h000066400000000000000000000043441443550065200271030ustar00rootroot00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michał Sawicz */ #ifndef LOMIRI_SHELL_NOTIFICATIONS_NOTIFICATIONINTERFACE_H #define LOMIRI_SHELL_NOTIFICATIONS_NOTIFICATIONINTERFACE_H #include #include namespace lomiri { namespace shell { namespace notifications { /** \brief A Notification object This class exposes signals used by the UI to communicate the state of a notification. */ class LOMIRI_API NotificationInterface : public QObject { Q_OBJECT protected: /// @cond explicit NotificationInterface(QObject* parent = 0) : QObject(parent) { } /// @endcond public: virtual ~NotificationInterface() { } Q_SIGNALS: /** Will be called whenever the mouse hover status of a notification changes. \param hovered Mouse hover status of this notification. */ void hovered(bool hovered); /** Will be called whenever the display status of a notification changes. \param displayed Visible/hidden status of this notification. */ void displayed(bool displayed); /** Will be called whenever the notification was dismissed. This can be called internally by the notification implementation (e.g. timeout) or from the UI when the user dismisses a notification. */ void dismissed(); /** Will be called whenever an action of this notification is to be invoked. \param id Id of the invoked action. */ void actionInvoked(const QString& id); }; } // namespace notifications } // namespace shell } // namespace lomiri #endif // LOMIRI_SHELL_NOTIFICATIONS_NOTIFICATIONINTERFACE_H lomiri-api-0.2.1/include/lomiri/shell/notifications/SourceInterface.h000066400000000000000000000040361443550065200257130ustar00rootroot00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michał Sawicz */ #ifndef LOMIRI_SHELL_NOTIFICATIONS_SOURCEINTERFACE_H #define LOMIRI_SHELL_NOTIFICATIONS_SOURCEINTERFACE_H #include #include namespace lomiri { namespace shell { namespace notifications { class ModelInterface; /** \brief A source of notifications This should feed the model with new notifications from an implementation-specific source. */ class LOMIRI_API SourceInterface : public QObject { Q_OBJECT /** \brief The model to which to send incoming notifications. \accessors %model(), setModel(ModelInterface* model) \notifier modelChanged(ModelInterface* model) */ Q_PROPERTY(lomiri::shell::notifications::ModelInterface* model READ model WRITE setModel NOTIFY modelChanged) protected: /// @cond explicit SourceInterface(QObject* parent = 0) : QObject(parent) { } /// @endcond public: virtual ~SourceInterface() { } /// @cond virtual ModelInterface* model() const = 0; virtual void setModel(ModelInterface* model) = 0; /// @endcond Q_SIGNALS: /** Emitted when value of the model property has changed. \param model New value of the model property. */ void modelChanged(ModelInterface* model); }; } // namespace notifications } // namespace shell } // namespace lomiri #endif // LOMIRI_SHELL_NOTIFICATIONS_SOURCEINTERFACE_H lomiri-api-0.2.1/include/lomiri/util/000077500000000000000000000000001443550065200174535ustar00rootroot00000000000000lomiri-api-0.2.1/include/lomiri/util/CMakeLists.txt000066400000000000000000000004371443550065200222170ustar00rootroot00000000000000file(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h") file(GLOB internal_headers "${CMAKE_CURRENT_SOURCE_DIR}/internal/*.h") install(FILES ${headers} DESTINATION ${HDR_INSTALL_DIR}/lomiri/util) set(LOMIRI_API_LIB_HDRS ${LOMIRI_API_LIB_HDRS} ${headers} ${internal_headers} PARENT_SCOPE) lomiri-api-0.2.1/include/lomiri/util/Daemon.h000066400000000000000000000112071443550065200210300ustar00rootroot00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Michi Henning */ #ifndef LOMIRI_UTIL_DAEMON_H #define LOMIRI_UTIL_DAEMON_H #include #include #include namespace lomiri { namespace util { namespace internal { class DaemonImpl; } /** \class Daemon \brief Helper class to turn a process into a daemon. To turn a process into a daemon, instantiate this class and call daemonize_me(). The new process becomes a session leader without a control terminal. The standard file descriptors (stdin, stdout, and stderr) are closed and re-opened to /dev/null. By default, any file descriptors (other than the standard three) that are open in the process remain open to the same destinations in the daemon. If you want to have other descriptors closed, call close_fds() before calling daemonize_me(). This will close all file descriptors > 2. By default, the signal disposition of the daemon is unchanged. To reset all signals to their default disposition, call reset_signals() before calling daemonize_me(). By default, the umask of the daemon is unchanged. To set a different umask, call set_umask() before calling daemonize_me(). By default, the working directory of the daemon is unchanged. To run the daemon with a different working directory, call set_working_dir() before calling daemonize_me(). Note that the working directory should be set to a path that is in the root file system. If the working directory is in any other file system, that file system cannot be unmounted while the daemon is running. Note: This class is not async signal-safe. Do not call daemonize_me() from a a signal handler. */ class LOMIRI_API Daemon final { public: /// @cond NONCOPYABLE(Daemon); LOMIRI_DEFINES_PTRS(Daemon); /// @endcond /** \brief Create a Daemon instance. \return A unique_ptr to the instance. */ static UPtr create(); /** \brief Causes daemonize_me() to close all open file descriptors other than the standard file descriptors (which are connected /dev/null). */ void close_fds() noexcept; /** \brief Causes daemonize_me() to reset all signals to their default behavior. */ void reset_signals() noexcept; /** \brief Causes daemonize_me() to set the umask. \param mask The umask for the daemon process. */ void set_umask(mode_t mask) noexcept; /** \brief Causes daemonize_me() to set the working directory. \param working_directory The working directory for the daemon process. \throws SyscallException The process could not change the working directory to the specified directory. \note Daemon processes should set their working to "/" or to a directory that is part of the root file system. Otherwise, the file system containing the daemon's working directory cannot be unmounted without first killing the daemon process. */ void set_working_directory(std::string const& working_directory); /** \brief Turns the calling process into a daemon. By default, daemonize_me() leaves open file descriptors, signal disposition, umask, and working directory unchanged. Call the corresponding member function before calling daemonize_me() to change this behavior as appropriate. \note Calling daemonize_me() more than once is safe; any changes to file descriptors, signal disposition, umask, or working directory as requested by calling the other member functions will be correctly set for the calling process. However, daemonize_me() is not a cheap call because it calls fork(); the normal use pattern is to create a Daemon instance, select the desired settings, call daemonize_me(), and let the instance go out of scope. */ void daemonize_me(); ~Daemon() noexcept; private: Daemon(); // Class is final, instantiation only via create() std::unique_ptr p_; }; } // namespace util } // namespace lomiri #endif lomiri-api-0.2.1/include/lomiri/util/Dbus.h000066400000000000000000000022111443550065200205150ustar00rootroot00000000000000/* * Copyright (C) 2020 UBports foundation * Author(s): Marius Gripsgard * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * */ #pragma once #include #include namespace lomiri { namespace util { LOMIRI_API std::string dbus_sanitize_str(const std::string& str); LOMIRI_API std::string dbus_sanitized_path(const std::string& base, const std::string& str); LOMIRI_API inline std::string dbus_sanitized_path(const std::string& str) { return dbus_sanitized_path("/", str); } } // namespace util } // namespace lomiri lomiri-api-0.2.1/include/lomiri/util/DefinesPtrs.h000066400000000000000000000033171443550065200220560ustar00rootroot00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Michi Henning */ #ifndef LOMIRI_UTIL_DEFINESPTRS_H #define LOMIRI_UTIL_DEFINESPTRS_H #include /** \file DefinesPtrs.h \def LOMIRI_DEFINES_PTRS(classname) \brief Macro to add smart pointer definitions to a class. This macro injects type definitions for smart pointer types into a class. It is useful to establish a common naming convention for smart pointers across a project. You can use the macro as follows. Note that the macro argument is the name of the class being defined. ~~~ * class MyClass * { * public: * LOMIRI_DEFINES_PTRS(MyClass); * // MyClass now provides public typedefs for SPtr, SCPtr, UPtr, and UCPtr. * // ... * }; ~~~ Callers of MyClass can now, for example, write ~~~ * MyClass::UPtr p(new MyClass); ~~~ */ #define LOMIRI_DEFINES_PTRS(classname) \ typedef std::shared_ptr SPtr; \ typedef std::shared_ptr SCPtr; \ typedef std::unique_ptr UPtr; \ typedef std::unique_ptr UCPtr #endif lomiri-api-0.2.1/include/lomiri/util/FileIO.h000066400000000000000000000020671443550065200207400ustar00rootroot00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Michi Henning */ #ifndef LOMIRI_UTIL_FILEIO_H #define LOMIRI_UTIL_FILEIO_H #include #include #include namespace lomiri { namespace util { LOMIRI_API std::string read_text_file(std::string const& filename); LOMIRI_API std::vector read_binary_file(std::string const& filename); } // namespace util } // namespace lomiri #endif lomiri-api-0.2.1/include/lomiri/util/GObjectMemory.h000066400000000000000000000130601443550065200223320ustar00rootroot00000000000000/* * Copyright (C) 2013-2017 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Jussi Pakkanen * Pete Woods */ #ifndef LOMIRI_UTIL_GOBJECTMEMORY_H #define LOMIRI_UTIL_GOBJECTMEMORY_H #include #include #include #include namespace lomiri { namespace util { namespace { inline static void check_floating_gobject(gpointer t) { if (G_IS_OBJECT(t) && g_object_is_floating(G_OBJECT(t))) { throw std::invalid_argument("cannot manage floating GObject reference - call g_object_ref_sink(o) first"); } } } /** \brief Used by the make_gobject, unique_gobject and share_gobject as the deleter. Useful if for some reason the normal helper methods are not suitable for your needs. Example: \code{.cpp} GObjectDeleter d; auto shared = shared_ptr(foo_bar_new("name"), d); auto unique = unique_ptr(foo_bar_new("name"), d); \endcode */ struct GObjectDeleter { void operator()(gpointer ptr) noexcept { if (G_IS_OBJECT(ptr)) { g_object_unref(ptr); } } }; template using GObjectSPtr = std::shared_ptr; template using GObjectUPtr = std::unique_ptr; namespace internal { template class GObjectAssigner { public: typedef typename SP::element_type ElementType; GObjectAssigner(SP& smart_ptr) noexcept: smart_ptr_(smart_ptr) { } GObjectAssigner(const GObjectAssigner& other) = delete; GObjectAssigner(GObjectAssigner&& other) noexcept: ptr_(other.ptr_), smart_ptr_(other.smart_ptr_) { other.ptr_ = nullptr; } ~GObjectAssigner() noexcept { smart_ptr_ = SP(ptr_, GObjectDeleter()); } GObjectAssigner& operator=(const GObjectAssigner& other) = delete; operator ElementType**() noexcept { return &ptr_; } private: ElementType* ptr_ = nullptr; SP& smart_ptr_; }; template struct GObjectSignalUnsubscriber { void operator()(gulong handle) noexcept { if (handle != 0 && G_IS_OBJECT(obj_.get())) { g_signal_handler_disconnect(obj_.get(), handle); } } GObjectSPtr obj_; }; } /** \brief Helper method to wrap a unique_ptr around an existing GObject. Useful if the GObject class you are constructing already has a dedicated factory from the C library it comes from, and you intend to have a unique instance of it. Example: \code{.cpp} auto obj = unique_gobject(foo_bar_new("name")); \endcode */ template inline GObjectUPtr unique_gobject(T* ptr) { check_floating_gobject(ptr); GObjectDeleter d; return GObjectUPtr(ptr, d); } /** \brief Helper method to wrap a shared_ptr around an existing GObject. Useful if the GObject class you are constructing already has a dedicated factory from the C library it comes from, and you intend to share it. Example: \code{.cpp} auto obj = share_gobject(foo_bar_new("name")); \endcode */ template inline GObjectSPtr share_gobject(T* ptr) { check_floating_gobject(ptr); GObjectDeleter d; return GObjectSPtr(ptr, d); } /** \brief Helper method to construct a gobj_ptr-wrapped GObject class. Uses the same signature as the g_object_new() method. Example: \code{.cpp} auto obj = make_gobject(FOO_TYPE_BAR, "name", "banana", nullptr); \endcode */ template inline GObjectUPtr make_gobject(GType object_type, const gchar *first_property_name, Args&&... args) noexcept { gpointer ptr = g_object_new(object_type, first_property_name, std::forward(args)...); if (G_IS_OBJECT(ptr) && g_object_is_floating(ptr)) { g_object_ref_sink(ptr); } return unique_gobject(G_TYPE_CHECK_INSTANCE_CAST(ptr, object_type, T)); } /** \brief Helper method to take ownership of GObjects assigned from a reference. Example: \code{.cpp} GObjectUPtr o; method_that_assigns_a_foobar(assign_gobject(o)); \endcode */ template inline internal::GObjectAssigner assign_gobject(SP& smart_ptr) noexcept { return internal::GObjectAssigner(smart_ptr); } template using GObjectSignalConnection = ResourcePtr>; /** \brief Simple wrapper to manage the lifecycle of GObject signal connections. When 'nameConnection_' goes out of scope or is dealloc'ed, the source will be removed: \code{.cpp} GObjectSignalConnection nameConnection_; nameConnection_ = gobject_signal_connection(g_signal_connect(o.get(), "notify::name", G_CALLBACK(on_notify_name), this), o); \endcode */ template inline GObjectSignalConnection gobject_signal_connection(gulong id, const GObjectSPtr& obj) { return GObjectSignalConnection(id, internal::GObjectSignalUnsubscriber{obj}); } } // namespace until } // namespace lomiri #endif lomiri-api-0.2.1/include/lomiri/util/GioMemory.h000066400000000000000000000037201443550065200215350ustar00rootroot00000000000000/* * Copyright (C) 2013-2017 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Pete Woods */ #ifndef LOMIRI_UTIL_GIOMEMORY_H #define LOMIRI_UTIL_GIOMEMORY_H #include #include namespace lomiri { namespace util { namespace internal { struct GDBusSignalUnsubscriber { public: void operator()(guint handle) noexcept { if (handle != 0 && G_IS_OBJECT(bus_.get())) { g_dbus_connection_signal_unsubscribe(bus_.get(), handle); } } GObjectSPtr bus_; }; } typedef ResourcePtr GDBusSignalConnection; /** \brief Simple wrapper to manage the lifecycle of manual GDBus signal connections. When 'signalConnection_' goes out of scope or is dealloc'ed, the connection will be removed: \code{.cpp} GDBusSignalConnection signalConnection_; signalConnection_ = gdbus_signal_connection( g_dbus_connection_signal_subscribe(bus.get(), nullptr, "org.does.not.exist", nullptr, "/does/not/exist", nullptr, G_DBUS_SIGNAL_FLAGS_NONE, on_dbus_signal, this, nullptr), bus); \endcode */ inline GDBusSignalConnection gdbus_signal_connection(guint id, GObjectSPtr bus) noexcept { return GDBusSignalConnection(id, internal::GDBusSignalUnsubscriber{bus}); } } // namespace until } // namespace lomiri #endif lomiri-api-0.2.1/include/lomiri/util/GlibMemory.h000066400000000000000000000174131443550065200217000ustar00rootroot00000000000000/* * Copyright (C) 2017 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Pete Woods * Michi Henning * James Henstridge */ #ifndef LOMIRI_UTIL_GLIBMEMORY_H #define LOMIRI_UTIL_GLIBMEMORY_H #include #include #include namespace lomiri { namespace util { namespace internal { template struct GlibDeleter; template using GlibSPtr = std::shared_ptr; template using GlibUPtr = std::unique_ptr>; /** * \brief Adapter class to assign to smart pointers from functions that take a reference. * * Adapter class that allows passing a shared_ptr or unique_ptr where glib * expects a parameter of type ElementType** (such as GError**), by providing * a default conversion operator to ElementType**. This allows the glib method * to assign to the ptr_ member. From the destructor, we assign to the * provided smart pointer. */ template class GlibAssigner { public: typedef typename SP::element_type ElementType; GlibAssigner(SP& smart_ptr) noexcept : smart_ptr_(smart_ptr) { } GlibAssigner(const GlibAssigner& other) = delete; GlibAssigner(GlibAssigner&& other) noexcept: ptr_(other.ptr_), smart_ptr_(other.smart_ptr_) { other.ptr_ = nullptr; } ~GlibAssigner() noexcept { smart_ptr_ = SP(ptr_, GlibDeleter()); } GlibAssigner& operator=(const GlibAssigner& other) = delete; operator ElementType**() noexcept { return &ptr_; } private: ElementType* ptr_ = nullptr; SP& smart_ptr_; }; struct GSourceUnsubscriber { void operator()(guint tag) noexcept { if (tag != 0) { g_source_remove(tag); } } }; } #define LOMIRI_UTIL_DEFINE_GLIB_SMART_POINTERS(TypeName, func) \ using TypeName##Deleter = internal::GlibDeleter; \ using TypeName##SPtr = internal::GlibSPtr; \ using TypeName##UPtr = internal::GlibUPtr; \ namespace internal \ { \ template<> struct GlibDeleter \ { \ void operator()(TypeName* ptr) noexcept \ { \ if (ptr) \ { \ ::func(ptr); \ } \ } \ }; \ } /** \brief Helper method to wrap a shared_ptr around a Glib type. Example: \code{.cpp} auto gkf = shared_glib(g_key_file_new()); \endcode */ template inline internal::GlibSPtr share_glib(T* ptr) noexcept { return internal::GlibSPtr(ptr, internal::GlibDeleter()); } /** \brief Helper method to wrap a unique_ptr around a Glib type. Example: \code{.cpp} auto gkf = unique_glib(g_key_file_new()); \endcode */ template inline internal::GlibUPtr unique_glib(T* ptr) noexcept { return internal::GlibUPtr(ptr, internal::GlibDeleter()); } /** \brief Helper method to take ownership of glib types assigned from a reference. Example: \code{.cpp} GErrorUPtr error; if (!g_key_file_get_boolean(gkf.get(), "group", "key", assign_glib(error))) { std::cerr << error->message << std::endl; throw some_exception(); } \endcode Another example: \code{.cpp} gcharUPtr name; g_object_get(obj, "name", assign_glib(name), nullptr); \endcode */ template inline internal::GlibAssigner assign_glib(SP& smart_ptr) noexcept { return internal::GlibAssigner(smart_ptr); } using GSourceManager = ResourcePtr; /** \brief Simple wrapper to manage the lifecycle of sources. When 'timer' goes out of scope or is dealloc'ed, the source will be removed: \code{.cpp} auto timer = g_source_manager(g_timeout_add(5000, on_timeout, nullptr)); \endcode */ inline GSourceManager g_source_manager(guint id) { return GSourceManager(id, internal::GSourceUnsubscriber()); } /** * As glib >= 2.60 has multilpe typedefs to void, we need to manually * declare the definitions for the unique types. */ LOMIRI_UTIL_DEFINE_GLIB_SMART_POINTERS(GAsyncQueue, g_async_queue_unref) LOMIRI_UTIL_DEFINE_GLIB_SMART_POINTERS(GBookmarkFile, g_bookmark_file_free) LOMIRI_UTIL_DEFINE_GLIB_SMART_POINTERS(GBytes, g_bytes_unref) LOMIRI_UTIL_DEFINE_GLIB_SMART_POINTERS(GChecksum, g_checksum_free) LOMIRI_UTIL_DEFINE_GLIB_SMART_POINTERS(GDateTime, g_date_time_unref) LOMIRI_UTIL_DEFINE_GLIB_SMART_POINTERS(GDir, g_dir_close) LOMIRI_UTIL_DEFINE_GLIB_SMART_POINTERS(GError, g_error_free) LOMIRI_UTIL_DEFINE_GLIB_SMART_POINTERS(GHashTable, g_hash_table_unref) LOMIRI_UTIL_DEFINE_GLIB_SMART_POINTERS(GHmac, g_hmac_unref) LOMIRI_UTIL_DEFINE_GLIB_SMART_POINTERS(GIOChannel, g_io_channel_unref) LOMIRI_UTIL_DEFINE_GLIB_SMART_POINTERS(GKeyFile, g_key_file_unref) LOMIRI_UTIL_DEFINE_GLIB_SMART_POINTERS(GList, g_list_free) LOMIRI_UTIL_DEFINE_GLIB_SMART_POINTERS(GArray, g_array_unref) LOMIRI_UTIL_DEFINE_GLIB_SMART_POINTERS(GPtrArray, g_ptr_array_unref) LOMIRI_UTIL_DEFINE_GLIB_SMART_POINTERS(GByteArray, g_byte_array_unref) LOMIRI_UTIL_DEFINE_GLIB_SMART_POINTERS(GMainContext, g_main_context_unref) LOMIRI_UTIL_DEFINE_GLIB_SMART_POINTERS(GMainLoop, g_main_loop_unref) LOMIRI_UTIL_DEFINE_GLIB_SMART_POINTERS(GSource, g_source_unref) LOMIRI_UTIL_DEFINE_GLIB_SMART_POINTERS(GMappedFile, g_mapped_file_unref) LOMIRI_UTIL_DEFINE_GLIB_SMART_POINTERS(GMarkupParseContext, g_markup_parse_context_unref) LOMIRI_UTIL_DEFINE_GLIB_SMART_POINTERS(GNode, g_node_destroy) LOMIRI_UTIL_DEFINE_GLIB_SMART_POINTERS(GOptionContext, g_option_context_free) LOMIRI_UTIL_DEFINE_GLIB_SMART_POINTERS(GOptionGroup, g_option_group_unref) LOMIRI_UTIL_DEFINE_GLIB_SMART_POINTERS(GPatternSpec, g_pattern_spec_free) LOMIRI_UTIL_DEFINE_GLIB_SMART_POINTERS(GQueue, g_queue_free) LOMIRI_UTIL_DEFINE_GLIB_SMART_POINTERS(GRand, g_rand_free) LOMIRI_UTIL_DEFINE_GLIB_SMART_POINTERS(GRegex, g_regex_unref) LOMIRI_UTIL_DEFINE_GLIB_SMART_POINTERS(GMatchInfo, g_match_info_unref) LOMIRI_UTIL_DEFINE_GLIB_SMART_POINTERS(GScanner, g_scanner_destroy) LOMIRI_UTIL_DEFINE_GLIB_SMART_POINTERS(GSequence, g_sequence_free) LOMIRI_UTIL_DEFINE_GLIB_SMART_POINTERS(GSList, g_slist_free) LOMIRI_UTIL_DEFINE_GLIB_SMART_POINTERS(GString, g_autoptr_cleanup_gstring_free) LOMIRI_UTIL_DEFINE_GLIB_SMART_POINTERS(GStringChunk, g_string_chunk_free) LOMIRI_UTIL_DEFINE_GLIB_SMART_POINTERS(GThread, g_thread_unref) LOMIRI_UTIL_DEFINE_GLIB_SMART_POINTERS(GMutex, g_mutex_clear) LOMIRI_UTIL_DEFINE_GLIB_SMART_POINTERS(GCond, g_cond_clear) LOMIRI_UTIL_DEFINE_GLIB_SMART_POINTERS(GTimer, g_timer_destroy) LOMIRI_UTIL_DEFINE_GLIB_SMART_POINTERS(GTimeZone, g_time_zone_unref) LOMIRI_UTIL_DEFINE_GLIB_SMART_POINTERS(GTree, g_tree_unref) LOMIRI_UTIL_DEFINE_GLIB_SMART_POINTERS(GVariant, g_variant_unref) LOMIRI_UTIL_DEFINE_GLIB_SMART_POINTERS(GVariantBuilder, g_variant_builder_unref) LOMIRI_UTIL_DEFINE_GLIB_SMART_POINTERS(GVariantIter, g_variant_iter_free) LOMIRI_UTIL_DEFINE_GLIB_SMART_POINTERS(GVariantDict, g_variant_dict_unref) LOMIRI_UTIL_DEFINE_GLIB_SMART_POINTERS(GVariantType, g_variant_type_free) /** * Manually add extra definitions for gchar* and gchar** */ LOMIRI_UTIL_DEFINE_GLIB_SMART_POINTERS(gchar, g_free) typedef gchar* gcharv; LOMIRI_UTIL_DEFINE_GLIB_SMART_POINTERS(gcharv, g_strfreev) } // namespace until } // namespace lomiri #endif lomiri-api-0.2.1/include/lomiri/util/IniParser.h000066400000000000000000000134161443550065200215250ustar00rootroot00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Jussi Pakkanen */ #ifndef LOMIRI_UTIL_INIPARSER_H #define LOMIRI_UTIL_INIPARSER_H #include #include #include #include namespace lomiri { namespace util { namespace internal { struct IniParserPrivate; } /** \brief Helper class to read and write configuration files. This class reads configuration files in the .ini format and provides for a simple and type safe way of extracting and inserting information. A typical ini file looks like this: ~~~ [group1] key1 = value1 key2 = value2 [group2] key1 = othervalue1 key2 = othervalue2 ~~~ To extract/insert a value, simply specify the group and key names to the get/set methods of this class, respectively. The array methods use a semicolon as a separator. To write unsaved changes back to the configuration file, call sync(). The sync() method will throw a FileException if it fails to write to file. The get methods indicate errors by throwing LogicException. All methods are thread-safe. */ class LOMIRI_API IniParser final { public: /** Parse the given file. */ IniParser(const char* filename); ~IniParser() noexcept; /// @cond LOMIRI_DEFINES_PTRS(IniParser); IniParser(const IniParser& ip) = delete; IniParser() = delete; /// @endcond //{@ /** @name Read Methods * These member functions provide read access to configuration entries by group and key.
* Attempts to retrieve a value as the wrong type (such as retrieving a string value as an * integer) or to retrieve a value for a non-existent group or key throw LogicException. **/ bool has_group(const std::string& group) const noexcept; bool has_key(const std::string& group, const std::string& key) const; std::string get_string(const std::string& group, const std::string& key) const; std::string get_locale_string(const std::string& group, const std::string& key, const std::string& locale = std::string()) const; bool get_boolean(const std::string& group, const std::string& key) const; int get_int(const std::string& group, const std::string& key) const; double get_double(const std::string& group, const std::string& key) const; std::vector get_string_array(const std::string& group, const std::string& key) const; std::vector get_locale_string_array(const std::string& group, const std::string& key, const std::string& locale = std::string()) const; std::vector get_boolean_array(const std::string& group, const std::string& key) const; std::vector get_int_array(const std::string& group, const std::string& key) const; std::vector get_double_array(const std::string& group, const std::string& key) const; std::string get_start_group() const; std::vector get_groups() const; std::vector get_keys(const std::string& group) const; /** @name Write Methods * These member functions provide write access to configuration entries by group and key.
* Attempts to remove groups or keys that do not exist throw LogicException.
* The set methods replace the value for a key if the key exists. Calling a set method for a * non-existent group and/or key creates the group and/or key. **/ bool remove_group(const std::string& group); bool remove_key(const std::string& group, const std::string& key); void set_string(const std::string& group, const std::string& key, const std::string& value); void set_locale_string(const std::string& group, const std::string& key, const std::string& value, const std::string& locale = std::string()); void set_boolean(const std::string& group, const std::string& key, bool value); void set_int(const std::string& group, const std::string& key, int value); void set_double(const std::string& group, const std::string& key, double value); void set_string_array(const std::string& group, const std::string& key, const std::vector& value); void set_locale_string_array(const std::string& group, const std::string& key, const std::vector& value, const std::string& locale = std::string()); void set_boolean_array(const std::string& group, const std::string& key, const std::vector& value); void set_int_array(const std::string& group, const std::string& key, const std::vector& value); void set_double_array(const std::string& group, const std::string& key, const std::vector& value); /** @name Sync Method * This member function writes unsaved changes back to the configuration file.
* A failure to write to the file throws a FileException. **/ void sync(); //@} private: internal::IniParserPrivate* p; }; } // namespace util } // namespace lomiri #endif lomiri-api-0.2.1/include/lomiri/util/NonCopyable.h000066400000000000000000000031011443550065200220300ustar00rootroot00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Michi Henning */ // // Simple class to disable copy and assignment. (Provided here to avoid having to use // the equivalent boost version.) // // Use like this: // // class MyClass : private util::NonCopyable // { // // ... // }; // #ifndef LOMIRI_UTIL_NONCOPYABLE_H #define LOMIRI_UTIL_NONCOPYABLE_H #include /** \brief Helper macro to prevent a class from being copied. This helper macro disables the copy constructor and assignment operator of a class to prevent it from being copied. This is a macro rather than a base class to reduce clutter on the class hierarchy. Use it like this: class MyClass { public: // not necessary, but the error message is more explicit with this NONCOPYABLE(MyClass) ... }; */ #define NONCOPYABLE(ClassName) /** Deleted */ ClassName(ClassName const&) = delete; /** Deleted */ ClassName& operator=(ClassName const&) = delete #endif lomiri-api-0.2.1/include/lomiri/util/ResourcePtr.h000066400000000000000000000531611443550065200221070ustar00rootroot00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Michi Henning */ #ifndef LOMIRI_UTIL_RESOURCEPTR_H #define LOMIRI_UTIL_RESOURCEPTR_H #include #include namespace lomiri { namespace util { namespace { // Simple helper class so we can adopt a lock without inconvenient syntax. template class LockAdopter { public: LockAdopter(T& mutex) noexcept : m_(mutex, std::adopt_lock) { assert(!mutex.try_lock()); // Mutex must be locked to be adoptable. } private: std::unique_lock m_; }; } // namespace /** \brief Class to guarantee deallocation of arbitrary resources. ResourcePtr is a generalized resource pointer that guarantees deallocation. It is intended for arbitrary pairs of allocate/deallocate functions, such as XCreateDisplay/XDestroyDisplay. The resource managed by this class must be default-constructible, copy-constructible, and assignable. ResourcePtr essentially does what std::unique_ptr does, but it works with opaque types and resource allocation functions that do not return a pointer type, such as open(). ResourcePtr is thread-safe. \note Do not use reset() to set the resource to the "no resource allocated" state. Instead, call dealloc() to do this. ResourcePtr has no idea what a "not allocated" resource value looks like and therefore cannot test for it. If you use reset() to install a "no resource allocated" value for for the resource, the deleter will eventually be called with this value as its argument. Whether this is benign or not depends on the deleter. For example, XFree() must not be called with a nullptr argument. \note Do not call get() or release() if no resource is currently allocated. Doing so throws std::logic_error. Here is an example that shows how to use this for a glXCreateContext/GLXDestroyContext pair. The returned GLXContext is a pointer to an opaque type; std::unique_ptr cannot be used for this, even with a custom deleter, because the signatures of the allocator and deallocator do not match unique_ptr's expectations. ~~~ ResourcePtr> context = std::bind(&glXDestroyContext, display_, std::placeholders::_1); ~~~ display_ is declared as ~~~ Display* display_; ~~~ in this case. The deleter for the resource can return any type (including int, such as returned by XDestroyWindow()), and it must accept a single argument of the resource type (GLXContext in this example). glXDestroyContext() expects the display pointer as the first argument so, for this example, std::bind converts the binary glXDestroyContext() function into a unary function suitable as the deleter. Rather than mucking around with std::bind, it is often easier to use a lambda. For example: ~~~ ResourcePtr> context = [this](GLXContext c) { this->dealloc_GLXContext(c); }; ~~~ This calls a member function dealloc_GLXContext() that, in turn calls glXDestroyContext() and supplies the display parameter. \note Even though you can use ResourcePtr to deallocate dynamic memory, doing so is discouraged. Use std::unique_ptr instead, which is better suited to the task. */ // TODO: Discuss throwing deleters and requirements (copy constructible, etc.) on deleter. template class ResourcePtr final { public: /** Deleted */ ResourcePtr(ResourcePtr const &) = delete; /** Deleted */ ResourcePtr& operator=(ResourcePtr const&) = delete; /** \typedef element_type The type of resource managed by this ResourcePtr. */ typedef R element_type; /** \typedef deleter_type A function object or lvalue reference to a function or function object. The ResourcePtr calls this to deallocate the resource. */ typedef D deleter_type; ResourcePtr(); explicit ResourcePtr(D d); ResourcePtr(R r, D d); ResourcePtr(ResourcePtr&& r); ResourcePtr& operator=(ResourcePtr&& r); ~ResourcePtr() noexcept; void swap(ResourcePtr& other); void reset(R r); R release(); void dealloc(); R get() const; bool has_resource() const noexcept; explicit operator bool() const noexcept; D& get_deleter() noexcept; D const& get_deleter() const noexcept; bool operator==(ResourcePtr const& rhs) const; bool operator!=(ResourcePtr const& rhs) const; bool operator<(ResourcePtr const& rhs) const; bool operator<=(ResourcePtr const& rhs) const; bool operator>(ResourcePtr const& rhs) const; bool operator>=(ResourcePtr const& rhs) const; private: R resource_; // The managed resource. D delete_; // The deleter to call. bool initialized_; // True while we have a resource assigned. mutable std::mutex m_; // Protects this instance. typedef std::lock_guard AutoLock; typedef LockAdopter AdoptLock; }; template ResourcePtr::ResourcePtr() : initialized_(false) { static_assert(!std::is_pointer::value, "constructed with null function pointer deleter"); } /** Constructs a ResourcePtr with the specified deleter. No resource is held, so a call to has_resource() after constructing a ResourcePtr this way returns false. */ template ResourcePtr::ResourcePtr(D d) : delete_(d), initialized_(false) { } /** Constructs a ResourcePtr with the specified resource and deleter. has_resource() returns true after calling this constructor. \note It is legal to pass a resource that represents the "not allocated" state. For example, the following code passes the value -1 to close() if the call to open() fails: ~~~ ResourcePtr fd(::open("/somefile", O_RDONLY), ::close); ~~~ When the ResourcePtr goes out of scope, this results in a call to close(-1). In this case, the call with an invalid file descriptor is harmless (but causes noise from diagnostic tools, such as valgrind). However, depending on the specific deleter, passing an invalid value to the deleter may have more serious consequences. To avoid the problem, you can delay initialization of the ResourcePtr until you know that the resource was successfully allocated, for example: ~~~ int tmp_fd = ::open(filename.c_str(), O_RDONLY); if (tmp_fd == -1) { throw FileException(filename.c_str()); } util::ResourcePtr fd(tmp_fd, ::close(fd)); ~~~ Alternatively, you can use a deleter function that tests the resource value for validity and avoids calling the deleter with an invalid value: ~~~ util::ResourcePtr> fd( ::open(filename.c_str(), O_RDONLY), [](int fd) { if (fd != -1) ::close(fd); } ); ~~~ Note that, with the second approach, a call to get() will succeed and return -1 rather than throwing an exception, so the first approach is the recommended one. */ template ResourcePtr::ResourcePtr(R r, D d) : resource_(r), delete_(d), initialized_(true) { } /** Constructs a ResourcePtr by transferring ownership from r to this. If the resource's move or copy constructor throws, the exception is propagated to the caller. The strong exception guarantee is preserved if it is provided by the resource. */ // TODO: Mark as nothrow if the resource has a nothrow move constructor or nothrow copy constructor template ResourcePtr::ResourcePtr(ResourcePtr&& r) : resource_(std::move(r.resource_)), delete_(r.delete_), initialized_(r.initialized_) { r.initialized_ = false; // Stop r from deleting its resource, if it held any. No need to lock: r is a temporary. } /** Assigns the resource held by r, transferring ownership. After the transfer, r.has_resource() returns false, and this.has_resource() returns the value of r.has_resource() prior to the assignment. */ // TODO: document exception safety behavior template ResourcePtr& ResourcePtr::operator=(ResourcePtr&& r) { AutoLock lock(m_); if (initialized_) // If we hold a resource, deallocate it first. { initialized_ = false; // If the deleter throws, we will not try it again for the same resource. delete_(resource_); // Delete our own resource. } // r is a temporary, so we don't need to lock it. resource_ = std::move(r.resource_); initialized_ = r.initialized_; r.initialized_ = false; // Stop r from deleting its resource, if it held any. delete_ = r.delete_; return *this; } /** Destroys the ResourcePtr. If a resource is held, it calls the deleter for the current resource (if any). */ template ResourcePtr::~ResourcePtr() noexcept { try { dealloc(); } catch (...) { } } /** Swaps the resource and deleter of this with the resource and deleter of other using argument dependent lookup (ADL). If the underlying swap throws an exception, that exception is propagated to the caller, and the resource held by the ResourcePtr is unchanged. */ // TODO Split this into throw and no-throw versions depending on the underlying swap? template void ResourcePtr::swap(ResourcePtr& other) { if (this == &other) // This is necessary to avoid deadlock for self-swap { return; } std::lock(m_, other.m_); AdoptLock left(m_); AdoptLock right(other.m_); using std::swap; // Enable ADL swap(resource_, other.resource_); swap(delete_, other.delete_); swap(initialized_, other.initialized_); } // The non-member swap() must be in the same namespace as ResourcePtr, so it will work with ADL. And, once it is // defined here, there is no point in adding a specialization to namespace std any longer, because ADL // will find it here anyway. /** Swaps the resource and deleter of lhs with the resource and deleter of rhs by calling lhs.swap(rhs). If the underlying swap throws an exception, that exception is propagated to the caller, and the resource held by the ResourcePtr is unchanged. */ // TODO Split this into throw and no-throw versions depending on the underlying swap? template void swap(lomiri::util::ResourcePtr& lhs, lomiri::util::ResourcePtr& rhs) { lhs.swap(rhs); } /** Assigns a new resource to this, first deallocating the current resource (if any). If the deleter for the current resource throws an exception, the exception is propagated to the caller. In this case, the transfer of r to this is still carried out so, after the call to reset(), this manages r, whether the deleter throws or not. (If the deleter does throw, no attempt is made to call the deleter again for the same resource.) */ template void ResourcePtr::reset(R r) { AutoLock lock(m_); bool has_old = initialized_; R old_resource; if (has_old) { old_resource = resource_; } resource_ = r; initialized_ = true; // If the deleter throws, we still satisfy the postcondition: resource_ == r. if (has_old) { delete_(old_resource); } } /** Releases ownership of the current resource without calling the deleter. \return The current resource. \throw std::logic_error if has_resource() is false. */ template inline R ResourcePtr::release() { AutoLock lock(m_); if (!initialized_) { throw std::logic_error("release() called on ResourcePtr without resource"); } initialized_ = false; return resource_; } /** Calls the deleter for the current resource. If the deleter throws, the resource is considered in the "not allocated" state, that is, no attempt is made to call the deleter again for this resource. */ template void ResourcePtr::dealloc() { AutoLock lock(m_); if (!initialized_) { return; } initialized_ = false; // If the deleter throws, we will not try it again for the same resource. delete_(resource_); } /** Returns the current resource. If no resource is currently held, get() throws std::logic_error. \return The current resource (if any). If the resource's copy constructor throws an exception, that exception is propagated to the caller. \throw std::logic_error if has_resource() is false. */ template inline R ResourcePtr::get() const { AutoLock lock(m_); if (!initialized_) { throw std::logic_error("get() called on ResourcePtr without resource"); } return resource_; } /** \return true if this currently manages a resource; false, otherwise. */ template inline bool ResourcePtr::has_resource() const noexcept { AutoLock lock(m_); return initialized_; } /** Synonym for has_resource(). */ template inline ResourcePtr::operator bool() const noexcept { return has_resource(); } /** \return The deleter for the resource. */ template inline D& ResourcePtr::get_deleter() noexcept { AutoLock lock(m_); return delete_; } /** \return The deleter for the resource. */ template inline D const& ResourcePtr::get_deleter() const noexcept { AutoLock lock(m_); return delete_; } /** \brief Compares two instances for equality. Two instances that do not hold a resource are equal. An instance that does not hold a resource is not equal to any instance that holds a resource. If the underlying operator== throws an exception, that exception is propagated to the caller. \note This operator is available only if the underlying resource provides operator==. */ template bool ResourcePtr::operator==(ResourcePtr const& rhs) const { if (this == &rhs) // This is necessary to avoid deadlock for self-comparison { return true; } std::lock(m_, rhs.m_); AdoptLock left(m_); AdoptLock right(rhs.m_); if (!initialized_) { return !rhs.initialized_; // Equal if both are not initialized } else if (!rhs.initialized_) { return false; // Not equal if lhs initialized, but rhs not initialized } else { return resource_ == rhs.resource_; } } /** \brief Compares two instances for inequality. If the underlying operator== throws an exception, that exception is propagated to the caller. \note This operator is available only if the underlying resource provides operator==. */ template inline bool ResourcePtr::operator!=(ResourcePtr const& rhs) const { return !(*this == rhs); } /** \brief Returns true if this is less than rhs. An instance that does not hold a resource is less than any instance that holds a resource. If the underlying operator\< throws an exception, that exception is propagated to the caller. \note This operator is available only if the underlying resource provides operator\<. */ template bool ResourcePtr::operator<(ResourcePtr const& rhs) const { if (this == &rhs) // This is necessary to avoid deadlock for self-comparison { return false; } std::lock(m_, rhs.m_); AdoptLock left(m_); AdoptLock right(rhs.m_); if (!initialized_) { return rhs.initialized_; // Not initialized is less than initialized } else if (!rhs.initialized_) // Initialized is not less than not initialized { return false; } else { return resource_ < rhs.resource_; } } /** \brief Returns true if this is less than or equal to rhs. An instance that does not hold a resource is less than any instance that holds a resource. Two instances that do not hold a resource are equal. If the underlying operator\< or operator== throws an exception, that exception is propagated to the caller. \note This operator is available only if the underlying resource provides operator\< and operator==. */ template bool ResourcePtr::operator<=(ResourcePtr const& rhs) const { if (this == &rhs) // This is necessary to avoid deadlock for self-comparison { return true; } // We can't just write: // // return *this < rhs || *this == rhs; // // because that creates a race condition: the locks would be released and // re-aquired in between the two comparisons. std::lock(m_, rhs.m_); AdoptLock left(m_); AdoptLock right(rhs.m_); return resource_ < rhs.resource_ || resource_ == rhs.resource_; } /** \brief Returns true if this is greater than rhs. An instance that holds a resource is greater than any instance that does not hold a resource. If the underlying operator\< or operator== throws an exception, that exception is propagated to the caller. \note This operator is available only if the underlying resource provides operator\< and operator==. */ template inline bool ResourcePtr::operator>(ResourcePtr const& rhs) const { return !(*this <= rhs); } /** \brief Returns true if this is greater than or equal to rhs. An instance that holds a resource is greater than any instance that does not hold a resource. Two instances that do not hold a resource are equal. If the underlying operator\< throws an exception, that exception is propagated to the caller. \note This operator is available only if the underlying resource provides operator\<. */ template inline bool ResourcePtr::operator>=(ResourcePtr const& rhs) const { return !(*this < rhs); } } // namespace util } // namespace lomiri // Specializations in namespace std, so we play nicely with STL and metaprogramming. namespace std { /** \brief Function object for equality comparison. */ template struct equal_to> { /** Invokes operator== on lhs. */ bool operator()(lomiri::util::ResourcePtr const& lhs, lomiri::util::ResourcePtr const& rhs) const { return lhs == rhs; } }; /** \brief Function object for inequality comparison. */ template struct not_equal_to> { /** Invokes operator!= on lhs. */ bool operator()(lomiri::util::ResourcePtr const& lhs, lomiri::util::ResourcePtr const& rhs) const { return lhs != rhs; } }; /** \brief Function object for less than comparison. */ template struct less> { /** Invokes operator\< on lhs. */ bool operator()(lomiri::util::ResourcePtr const& lhs, lomiri::util::ResourcePtr const& rhs) const { return lhs < rhs; } }; /** \brief Function object for less than or equal comparison. */ template struct less_equal> { /** Invokes operator\<= on lhs. */ bool operator()(lomiri::util::ResourcePtr const& lhs, lomiri::util::ResourcePtr const& rhs) const { return lhs <= rhs; } }; /** \brief Function object for greater than comparison. */ template struct greater> { /** Invokes operator\> on lhs. */ bool operator()(lomiri::util::ResourcePtr const& lhs, lomiri::util::ResourcePtr const& rhs) const { return lhs > rhs; } }; /** \brief Function object for less than or equal comparison. */ template struct greater_equal> { /** Invokes operator\>= on lhs. */ bool operator()(lomiri::util::ResourcePtr const& lhs, lomiri::util::ResourcePtr const& rhs) const { return lhs >= rhs; } }; // TODO: provide hash if std::hash exists. } // namespace std #endif lomiri-api-0.2.1/include/lomiri/util/SnapPath.h000066400000000000000000000015551443550065200213500ustar00rootroot00000000000000/* * Copyright (C) 2016-2017 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * */ #pragma once #include #include namespace lomiri { namespace util { LOMIRI_API std::string prepend_snap_path(const std::string& path); } // namespace util } // namespace lomiri lomiri-api-0.2.1/include/lomiri/util/internal/000077500000000000000000000000001443550065200212675ustar00rootroot00000000000000lomiri-api-0.2.1/include/lomiri/util/internal/DaemonImpl.h000066400000000000000000000027631443550065200234750ustar00rootroot00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Michi Henning */ #ifndef LOMIRI_UTIL_DAEMONIMPL_H #define LOMIRI_UTIL_DAEMONIMPL_H #include #include #include #include namespace lomiri { namespace util { namespace internal { class DaemonImpl final { public: NONCOPYABLE(DaemonImpl); DaemonImpl(); ~DaemonImpl() = default; void close_fds() noexcept; void reset_signals() noexcept; void set_umask(mode_t mask) noexcept; void set_working_directory(std::string const& working_directory); void daemonize_me(); private: bool close_fds_; bool reset_signals_; bool set_umask_; mode_t umask_; std::string working_directory_; void close_open_files() noexcept; }; } // namespace internal } // namespace util } // namespace lomiri #endif lomiri-api-0.2.1/lomiri-api.qmlproject000066400000000000000000000006601443550065200177260ustar00rootroot00000000000000/* File generated by Qt Creator, version 2.7.0 */ import QmlProject 1.1 Project { mainFile: "" /* Include .qml, .js, and image files from current directory and subdirectories */ QmlFiles { directory: "." } JavaScriptFiles { directory: "." } ImageFiles { directory: "." } /* List of plugin directories passed to QML runtime */ importPaths: [ "build/modules" ] } lomiri-api-0.2.1/src/000077500000000000000000000000001443550065200143475ustar00rootroot00000000000000lomiri-api-0.2.1/src/CMakeLists.txt000066400000000000000000000034721443550065200171150ustar00rootroot00000000000000add_subdirectory(lomiri) include_directories(${GLIB_INCLUDE_DIRS}) # Pseudo-library of object files. We need a dynamic version of the library for normal clients, # and a static version for the whitebox tests, so we can write unit tests for classes in the internal namespaces # (because, for the .so, non-public APIs are compiled with -fvisibility=hidden). # Everything is compiled with -fPIC, so the same object files are suitable for either library. # Here, we create an object library that then is used to link the static and dynamic # libraries, without having to compile each source file twice with different compile flags. set(LOMIRI_API_LIB_OBJ ${LOMIRI_API_LIB}-obj) add_library(${LOMIRI_API_LIB_OBJ} OBJECT ${LOMIRI_API_LIB_SRC}) set_target_properties(${LOMIRI_API_LIB_OBJ} PROPERTIES COMPILE_FLAGS "-fPIC") add_pch(pch/lomiriapi_pch.hh ${LOMIRI_API_LIB_OBJ}) # Use the object files to make the shared library. set(LOMIRI_API_SOVERSION 0) add_library(${LOMIRI_API_LIB} SHARED $) set_target_properties(${LOMIRI_API_LIB} PROPERTIES VERSION "${LOMIRI_API_MAJOR}.${LOMIRI_API_MINOR}" SOVERSION ${LOMIRI_API_SOVERSION} ) target_link_libraries(${LOMIRI_API_LIB} ${GLIB_LDFLAGS}) # Use the object files to make the static library. We add -fPIC to avoid compiling a second time. add_library(${LOMIRI_API_STATIC_LIB} STATIC $) set_target_properties(${LOMIRI_API_STATIC_LIB} PROPERTIES OUTPUT_NAME ${LOMIRI_API_LIB}) target_link_libraries(${LOMIRI_API_STATIC_LIB} ${GLIB_LDFLAGS}) # Only the dynamic library gets installed. install(TARGETS ${LOMIRI_API_LIB} LIBRARY DESTINATION ${LIB_INSTALL_PREFIX}) # Parent needs to know what all the source files are, for generating doc and the like. set(LOMIRI_API_LIB_SRC ${LOMIRI_API_LIB_SRC} ${LOMIRI_SRC} PARENT_SCOPE) lomiri-api-0.2.1/src/lomiri/000077500000000000000000000000001443550065200156425ustar00rootroot00000000000000lomiri-api-0.2.1/src/lomiri/CMakeLists.txt000066400000000000000000000004071443550065200204030ustar00rootroot00000000000000add_subdirectory(api) add_subdirectory(internal) add_subdirectory(util) set(LOMIRI_SRC ${CMAKE_CURRENT_SOURCE_DIR}/Exception.cpp ${CMAKE_CURRENT_SOURCE_DIR}/LomiriExceptions.cpp ) set(LOMIRI_API_LIB_SRC ${LOMIRI_API_LIB_SRC} ${LOMIRI_SRC} PARENT_SCOPE) lomiri-api-0.2.1/src/lomiri/Exception.cpp000066400000000000000000000224341443550065200203110ustar00rootroot00000000000000/* * Copyright (C) 2012 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Michi Henning */ #include #include using namespace std; namespace { // // Return the margin string for the indent level and indent. // string get_margin(int indent_level, string const& indent) { string margin; for (int i = 0; i < indent_level; ++i) { margin += indent; } return margin; } // // Follow the nested exceptions that were rethrown along the call stack, printing them into s. // void print_name_and_reason(string& s, nested_exception const* nested) { auto lomiri_exception = dynamic_cast(nested); auto std_exception = dynamic_cast(nested); if (lomiri_exception) { s += lomiri_exception->name(); string reason = lomiri_exception->reason(); if (!reason.empty()) { s += ": " + reason; } } else if (std_exception) { s += std_exception->what(); } // Append info about unknown std::exception and std::nested_exception. if (!lomiri_exception) { if (std_exception) { s += " (derived from std::exception and std::nested_exception)"; } else { s += "std::nested_exception"; } } } void follow_nested(string& s, nested_exception const* nested, int indent_level, std::string const& indent) { if (nested->nested_ptr()) { string margin = get_margin(indent_level, indent); s += ":\n"; try { nested->rethrow_nested(); } catch (std::nested_exception const& e) { auto lomiri_exception = dynamic_cast(&e); if (lomiri_exception) { s += lomiri_exception->to_string(indent_level + 1, indent); } else { s += margin + indent; print_name_and_reason(s, &e); follow_nested(s, &e, indent_level + 1, indent); } } catch (std::exception const& e) { s += margin + indent; s += e.what(); // Can show only what() for std::exception. } catch (...) { s += margin + indent; s += "unknown exception"; // Best we can do for an exception whose type we don't know. } } } // // Follow the history chain and print each exception in the chain. // void follow_history(string& s, int& count, lomiri::Exception const* e, int indent_level, std::string const& indent) { if (!e->get_earlier()) { count = 1; // We have reached the oldest exception; set exception generation count and terminate recursion. } else { try { rethrow_exception(e->get_earlier()); } catch (lomiri::Exception const& e) { // Recurse along the chain until we hit the end, then, as we pop back up the levels, we increment the // count and print it as a generation number for the exception information. // A bit like the "kicks" in "Inception", except that the deepest level is level 1... follow_history(s, count, &e, indent_level, indent); } ++count; } // Show info for this exception. s += "\n" + get_margin(indent_level, indent) + "Exception #"; s += to_string(count) + ":\n"; s += get_margin(indent_level, indent) + indent; print_name_and_reason(s, e); follow_nested(s, e, indent_level + 1, indent); } } // namespace namespace lomiri { /** \brief Constructs an exception instance. \param name The fully-qualified name of the exception, such as `"lomiri::SyscallException"`. The name must not be empty. \param reason Any additional details about the exception, such as an error message and the values of any members of the exception. */ Exception::Exception(string const& name, string const& reason) : name_(name) , reason_(reason) { assert(!name_.empty()); } //! @cond Exception::Exception(Exception const&) = default; Exception& Exception::operator=(Exception const&) = default; Exception::~Exception() noexcept = default; //! @endcond /** \brief Returns a string describing the exception, including any exceptions that were nested or chained. \return The return value is the same string that is returned by calling to_string(). The returned pointer remains valid until the next call to what(), or until the exception is destroyed. */ char const* Exception::what() const noexcept { try { what_ = to_string(); return what_.c_str(); } // LCOV_EXCL_START catch (std::exception const& e) // to_string() may throw (bad_alloc, in particular) { return e.what(); } catch (...) { return "unknown exception"; } // LCOV_EXCL_STOP } /** \brief Returns the name set by the derived class's constructor. */ string Exception::name() const { return name_; } /** \brief Returns the reason set by the derived class's constructor (empty string if none). Derived classes should include any other state information, such as the value of data members or other relevant detail in the reason string they pass to the protected constructor. */ string Exception::reason() const { return reason_; } /** \brief Returns a string describing the exception, including any exceptions that were nested or chained. Nested exceptions are indented according to their nesting level. If the exception contains chained exceptions, these are shown in oldest-to-newest order. \param indent This controls the amount of indenting per level. The default indent is four spaces. \return The string describing the exception. \note The default implementation of this member function calls to_string(0, indent). */ string Exception::to_string(std::string const& indent) const { return to_string(0, indent); } /** \brief Returns a string describing the exception, including any exceptions that were nested or chained. Nested exceptions are indented according to their nesting level. If the exception contains chained exceptions, these are shown in oldest-to-newest order. \param indent_level This controls the indent level. The value 0 indicates the outermost level (no indent). \param indent This controls the amount of indenting per level. The passed string is prependended indent_level times to each line. \return The string describing the exception. \note This member function has a default implementation, so derived classes do not need to override it unless they want to change the formatting of the returned string. */ string Exception::to_string(int indent_level, std::string const& indent) const { string margin = get_margin(indent_level, indent); string s = margin; s += name_; if (!reason_.empty()) { s += ": " + reason_; } // Check whether there is an exception history and print each exception in the history. if (get_earlier()) { s += "\n" + margin + indent + "Exception history:"; try { rethrow_exception(get_earlier()); } catch (lomiri::Exception const& e) { int count; follow_history(s, count, &e, indent_level + 2, indent); } } // Print this and any nested exceptions. follow_nested(s, this, indent_level, indent); return s; } /** \brief Adds an exception to the exception history chain. \param earlier_exception The parameter must be a nullptr or a std::exception_ptr to an exception that was remembered earlier. This allows a sequence of exceptions to be remembered without having to throw them and is useful, for example, in shutdown scenarios where any one of a sequence of steps can fail, but we want to continue and try all the following steps and only throw after all of them have been tried. In this case, each step that fails can add itself to the sequence of remembered exceptions, and finally throw something like ShutdownException. \return A std::exception_ptr to this. */ exception_ptr Exception::remember(exception_ptr earlier_exception) { // Doesn't prevent loops, but protects against accidental self-assignment. if (earlier_ != earlier_exception) { earlier_ = earlier_exception; } return self(); } /** \brief Returns the previous exception. \return Returns the next-older remembered exception, or nullptr, if none. */ exception_ptr Exception::get_earlier() const noexcept { return earlier_; } } // namespace lomiri lomiri-api-0.2.1/src/lomiri/LomiriExceptions.cpp000066400000000000000000000074061443550065200216520ustar00rootroot00000000000000/* * Copyright (C) 2012 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Michi Henning */ #include using namespace std; namespace lomiri { InvalidArgumentException::InvalidArgumentException(string const& reason) : Exception("lomiri::InvalidArgumentException", reason) { } InvalidArgumentException::InvalidArgumentException(InvalidArgumentException const&) = default; //! @cond InvalidArgumentException& InvalidArgumentException::operator=(InvalidArgumentException const&) = default; InvalidArgumentException::~InvalidArgumentException() noexcept = default; //! @endcond exception_ptr InvalidArgumentException::self() const { return make_exception_ptr(*this); } LogicException::LogicException(string const& reason) : Exception("lomiri::LogicException", reason) { } LogicException::LogicException(LogicException const&) = default; //! @cond LogicException& LogicException::operator=(LogicException const&) = default; LogicException::~LogicException() noexcept = default; //! @endcond exception_ptr LogicException::self() const { return make_exception_ptr(*this); } ShutdownException::ShutdownException(string const& reason) : Exception("lomiri::ShutdownException", reason) { } ShutdownException::ShutdownException(ShutdownException const&) = default; //! @cond ShutdownException& ShutdownException::operator=(ShutdownException const&) = default; ShutdownException::~ShutdownException() noexcept = default; //! @endcond exception_ptr ShutdownException::self() const { return make_exception_ptr(*this); } FileException::FileException(string const& reason, int err) : Exception("lomiri::FileException", reason + (reason.empty() ? "" : " ") + "(errno = " + std::to_string(err) + ")") , err_(err) { } FileException::FileException(FileException const&) = default; //! @cond FileException& FileException::operator=(FileException const&) = default; FileException::~FileException() noexcept = default; //! @endcond int FileException::error() const noexcept { return err_; } exception_ptr FileException::self() const { return make_exception_ptr(*this); } SyscallException::SyscallException(string const& reason, int err) : Exception("lomiri::SyscallException", reason + (reason.empty() ? "" : " ") + "(errno = " + std::to_string(err) + ")") , err_(err) { } SyscallException::SyscallException(SyscallException const&) = default; //! @cond SyscallException& SyscallException::operator=(SyscallException const&) = default; SyscallException::~SyscallException() noexcept = default; //! @endcond int SyscallException::error() const noexcept { return err_; } exception_ptr SyscallException::self() const { return make_exception_ptr(*this); } ResourceException::ResourceException(string const& reason) : Exception("lomiri::ResourceException", reason) { } ResourceException::ResourceException(ResourceException const&) = default; //! @cond ResourceException& ResourceException::operator=(ResourceException const&) = default; ResourceException::~ResourceException() noexcept = default; //! @endcond exception_ptr ResourceException::self() const { return make_exception_ptr(*this); } } // namespace lomiri lomiri-api-0.2.1/src/lomiri/api/000077500000000000000000000000001443550065200164135ustar00rootroot00000000000000lomiri-api-0.2.1/src/lomiri/api/CMakeLists.txt000066400000000000000000000002351443550065200211530ustar00rootroot00000000000000add_subdirectory(internal) set(API_SRC ${CMAKE_CURRENT_SOURCE_DIR}/Version.cpp ) set(LOMIRI_API_LIB_SRC ${LOMIRI_API_LIB_SRC} ${API_SRC} PARENT_SCOPE) lomiri-api-0.2.1/src/lomiri/api/Version.cpp000066400000000000000000000021051443550065200205420ustar00rootroot00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Michi Henning */ #include using namespace std; namespace lomiri { namespace api { int major_version() { return LOMIRI_API_VERSION_MAJOR; } int minor_version() { return LOMIRI_API_VERSION_MINOR; } int micro_version() { return LOMIRI_API_VERSION_MICRO; } char const* str() { return LOMIRI_API_VERSION_STRING; } } // namespace api } // namespace lomiri lomiri-api-0.2.1/src/lomiri/api/internal/000077500000000000000000000000001443550065200202275ustar00rootroot00000000000000lomiri-api-0.2.1/src/lomiri/api/internal/CMakeLists.txt000066400000000000000000000001471443550065200227710ustar00rootroot00000000000000set(API_INTERNAL_SRC ) set(LOMIRI_API_LIB_SRC ${LOMIRI_API_LIB_SRC} ${API_INTERNAL_SRC} PARENT_SCOPE) lomiri-api-0.2.1/src/lomiri/internal/000077500000000000000000000000001443550065200174565ustar00rootroot00000000000000lomiri-api-0.2.1/src/lomiri/internal/CMakeLists.txt000066400000000000000000000001551443550065200222170ustar00rootroot00000000000000set(LOMIRI_INTERNAL_SRC ) set(LOMIRI_API_LIB_SRC ${LOMIRI_API_LIB_SRC} ${LOMIRI_INTERNAL_SRC} PARENT_SCOPE) lomiri-api-0.2.1/src/lomiri/util/000077500000000000000000000000001443550065200166175ustar00rootroot00000000000000lomiri-api-0.2.1/src/lomiri/util/CMakeLists.txt000066400000000000000000000005151443550065200213600ustar00rootroot00000000000000add_subdirectory(internal) set(UTIL_SRC ${CMAKE_CURRENT_SOURCE_DIR}/Daemon.cpp ${CMAKE_CURRENT_SOURCE_DIR}/FileIO.cpp ${CMAKE_CURRENT_SOURCE_DIR}/IniParser.cpp ${CMAKE_CURRENT_SOURCE_DIR}/SnapPath.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Dbus.cpp ) set(LOMIRI_API_LIB_SRC ${LOMIRI_API_LIB_SRC} ${UTIL_SRC} PARENT_SCOPE) lomiri-api-0.2.1/src/lomiri/util/Daemon.cpp000066400000000000000000000035331443550065200205320ustar00rootroot00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Michi Henning */ #include #include using namespace std; namespace lomiri { namespace util { Daemon::UPtr Daemon::create() { return UPtr(new Daemon()); } // This is covered by tests, but only when we are not building for coverage. // (Closing all file descriptors interferes with the coverage reporting.) // LCOV_EXCL_START void Daemon::close_fds() noexcept { p_->close_fds(); } // LCOV_EXCL_STOP void Daemon::reset_signals() noexcept { p_->reset_signals(); } void Daemon::set_umask(mode_t mask) noexcept { p_->set_umask(mask); } void Daemon::set_working_directory(string const& working_directory) { p_->set_working_directory(working_directory); } // Turn this process into a proper daemon in its own session and without a control terminal. // Whether to close open file descriptors, reset signals to their defaults, change the umask, // or change the working directory is determined by the setters above. void Daemon::daemonize_me() { p_->daemonize_me(); } Daemon::Daemon() : p_(new internal::DaemonImpl()) { } Daemon::~Daemon() noexcept { } } // namespace util } // namespace lomiri lomiri-api-0.2.1/src/lomiri/util/Dbus.cpp000066400000000000000000000030221443550065200202150ustar00rootroot00000000000000/* * Copyright (C) 2020 UBports foundation * Author(s): Marius Gripsgard * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * */ #include "lomiri/util/Dbus.h" namespace lomiri { namespace util { std::string dbus_sanitize_str(const std::string& str) { std::string output; for (auto ch : str) { if (std::isalnum(ch, std::locale::classic())) { output.push_back(ch); } else { char buff[100]; snprintf(buff, sizeof(buff), "_%02x", ch); output.append(buff); } } output.shrink_to_fit(); return output; } std::string dbus_sanitized_path(const std::string& base, const std::string& path) { std::string output; if (base.front() != '/') output.push_back('/'); output += base; if (output.back() != '/') output.push_back('/'); output += dbus_sanitize_str(path); output.shrink_to_fit(); return output; } } // namespace util } // namespace lomiri lomiri-api-0.2.1/src/lomiri/util/FileIO.cpp000066400000000000000000000052351443550065200204370ustar00rootroot00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Michi Henning */ #include #include #include #include #include #include #include #include #include using namespace std; namespace lomiri { namespace util { namespace { // // It would be nice to use fstream for I/O, but the error reporting is so useless that it's better to step // down to system calls. At least then, when something goes wrong, we know what it was. // template vector read_file(string const& filename) { util::ResourcePtr> fd(::open(filename.c_str(), O_RDONLY), [](int fd) { if (fd != -1) ::close(fd); }); if (fd.get() == -1) { throw FileException("cannot open \"" + filename + "\": " + strerror(errno), errno); } struct stat st; if (fstat(fd.get(), &st) == -1) { throw FileException("cannot fstat \"" + filename + "\": " + strerror(errno), errno); // LCOV_EXCL_LINE } if (!S_ISREG(st.st_mode)) { throw FileException("\"" + filename + "\" is not a regular file", 0); } vector buf(st.st_size); if (st.st_size == 0) { return buf; } if (read(fd.get(), &buf[0], st.st_size) != st.st_size) { // LCOV_EXCL_START ostringstream msg; msg << "cannot read " << st.st_size << " byte"; if (st.st_size != 1) { msg << "s"; } msg << " from \"" << filename << "\": " << strerror(errno); throw FileException(msg.str(), errno); // LCOV_EXCL_STOP } return buf; } } // namespace string read_text_file(string const& filename) { vector buf(read_file(filename)); return string(buf.begin(), buf.end()); } vector read_binary_file(string const& filename) { return read_file(filename); } } // namespace util } // namespace lomiri lomiri-api-0.2.1/src/lomiri/util/IniParser.cpp000066400000000000000000000333021443550065200212200ustar00rootroot00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Jussi Pakkanen */ #include #include #include #include using namespace std; namespace lomiri { namespace util { namespace internal { struct IniParserPrivate { GKeyFile *k; string filename; bool dirty = false; }; static std::mutex parser_mutex; } using internal::IniParserPrivate; /* * This is not a private member function, because it takes * a GError and we don't want to leak that. */ static void inspect_error(GError* e, const char* prefix, const string& filename, const string& group) { if (e) { string message(prefix); message += " ("; message += filename; message += ", group: "; message += group; message += "): "; message += e->message; g_error_free(e); throw LogicException(message); } } IniParser::IniParser(const char* filename) { GKeyFile* kf = g_key_file_new(); GError* e = nullptr; if (!kf) { throw ResourceException("Could not create keyfile parser."); // LCOV_EXCL_LINE } if (!g_key_file_load_from_file(kf, filename, G_KEY_FILE_KEEP_TRANSLATIONS, &e)) { string message = "Could not load ini file "; message += filename; message += ": "; message += e->message; int errnum = e->code; g_error_free(e); g_key_file_free(kf); throw FileException(message, errnum); } p = new IniParserPrivate(); p->k = kf; p->filename = filename; } IniParser::~IniParser() noexcept { g_key_file_free(p->k); delete p; } bool IniParser::has_group(const std::string& group) const noexcept { lock_guard lock(internal::parser_mutex); gboolean rval; rval = g_key_file_has_group(p->k, group.c_str()); return rval; } bool IniParser::has_key(const std::string& group, const std::string& key) const { lock_guard lock(internal::parser_mutex); gboolean rval; GError* e = nullptr; rval = g_key_file_has_key(p->k, group.c_str(), key.c_str(), &e); inspect_error(e, "Error checking for key existence", p->filename, group); return rval; } std::string IniParser::get_string(const std::string& group, const std::string& key) const { lock_guard lock(internal::parser_mutex); gchar* value; GError* e = nullptr; string result; value = g_key_file_get_string(p->k, group.c_str(), key.c_str(), &e); inspect_error(e, "Could not get string value", p->filename, group); result = value; g_free(value); return result; } std::string IniParser::get_locale_string(const std::string& group, const std::string& key, const std::string& locale) const { lock_guard lock(internal::parser_mutex); gchar* value; GError* e = nullptr; string result; value = g_key_file_get_locale_string(p->k, group.c_str(), key.c_str(), locale.empty() ? nullptr : locale.c_str(), &e); inspect_error(e, "Could not get localized string value", p->filename, group); result = value; g_free(value); return result; } bool IniParser::get_boolean(const std::string& group, const std::string& key) const { lock_guard lock(internal::parser_mutex); bool rval; GError* e = nullptr; rval = g_key_file_get_boolean(p->k, group.c_str(), key.c_str(), &e); inspect_error(e, "Could not get boolean value", p->filename, group); return rval; } int IniParser::get_int(const std::string& group, const std::string& key) const { lock_guard lock(internal::parser_mutex); int rval; GError* e = nullptr; rval = g_key_file_get_integer(p->k, group.c_str(), key.c_str(), &e); inspect_error(e, "Could not get integer value", p->filename, group); return rval; } double IniParser::get_double(const std::string& group, const std::string& key) const { lock_guard lock(internal::parser_mutex); double rval; GError* e = nullptr; rval = g_key_file_get_double(p->k, group.c_str(), key.c_str(), &e); inspect_error(e, "Could not get double value", p->filename, group); return rval; } std::vector IniParser::get_string_array(const std::string& group, const std::string& key) const { lock_guard lock(internal::parser_mutex); vector result; GError* e = nullptr; gchar** strlist; gsize count; strlist = g_key_file_get_string_list(p->k, group.c_str(), key.c_str(), &count, &e); inspect_error(e, "Could not get string array", p->filename, group); for (gsize i = 0; i < count; i++) { result.push_back(strlist[i]); } g_strfreev(strlist); return result; } std::vector IniParser::get_locale_string_array(const std::string& group, const std::string& key, const std::string& locale) const { lock_guard lock(internal::parser_mutex); vector result; GError* e = nullptr; gchar** strlist; gsize count; strlist = g_key_file_get_locale_string_list(p->k, group.c_str(), key.c_str(), locale.empty() ? nullptr : locale.c_str(), &count, &e); inspect_error(e, "Could not get localized string array", p->filename, group); for (gsize i = 0; i < count; i++) { result.push_back(strlist[i]); } g_strfreev(strlist); return result; } vector IniParser::get_boolean_array(const std::string& group, const std::string& key) const { lock_guard lock(internal::parser_mutex); vector result; GError* e = nullptr; gboolean* bools; gsize count; bools = g_key_file_get_boolean_list(p->k, group.c_str(), key.c_str(), &count, &e); inspect_error(e, "Could not get boolean array", p->filename, group); for (gsize i = 0; i < count; i++) { result.push_back(bools[i]); } g_free(bools); return result; } vector IniParser::get_int_array(const std::string& group, const std::string& key) const { lock_guard lock(internal::parser_mutex); vector result; GError* e = nullptr; gint* ints; gsize count; ints = g_key_file_get_integer_list(p->k, group.c_str(), key.c_str(), &count, &e); inspect_error(e, "Could not get integer array", p->filename, group); for (gsize i = 0; i < count; i++) { result.push_back(ints[i]); } g_free(ints); return result; } vector IniParser::get_double_array(const std::string& group, const std::string& key) const { lock_guard lock(internal::parser_mutex); vector result; GError* e = nullptr; gdouble* doubles; gsize count; doubles = g_key_file_get_double_list(p->k, group.c_str(), key.c_str(), &count, &e); inspect_error(e, "Could not get double array", p->filename, group); for (gsize i = 0; i < count; i++) { result.push_back(doubles[i]); } g_free(doubles); return result; } string IniParser::get_start_group() const { lock_guard lock(internal::parser_mutex); gchar* sg = g_key_file_get_start_group(p->k); string result(sg); g_free(sg); return result; } vector IniParser::get_groups() const { lock_guard lock(internal::parser_mutex); vector result; gsize count; gchar** groups = g_key_file_get_groups(p->k, &count); for (gsize i = 0; i < count; i++) { result.push_back(groups[i]); } g_strfreev(groups); return result; } vector IniParser::get_keys(const std::string& group) const { lock_guard lock(internal::parser_mutex); vector result; GError* e = nullptr; gchar** strlist; gsize count = 0; IniParserPrivate f; strlist = g_key_file_get_keys(p->k, group.c_str(), &count, &e); inspect_error(e, "Could not get list of keys", p->filename, group); for (gsize i = 0; i < count; i++) { result.push_back(strlist[i]); } g_strfreev(strlist); return result; } bool IniParser::remove_group(const std::string& group) { lock_guard lock(internal::parser_mutex); gboolean rval; GError* e = nullptr; rval = g_key_file_remove_group(p->k, group.c_str(), &e); inspect_error(e, "Error removing group", p->filename, group); return rval; } bool IniParser::remove_key(const std::string& group, const std::string& key) { lock_guard lock(internal::parser_mutex); gboolean rval; GError* e = nullptr; rval = g_key_file_remove_key(p->k, group.c_str(), key.c_str(), &e); inspect_error(e, "Error removing key", p->filename, group); return rval; } void IniParser::set_string(const std::string& group, const std::string& key, const std::string& value) { lock_guard lock(internal::parser_mutex); g_key_file_set_string(p->k, group.c_str(), key.c_str(), value.c_str()); p->dirty = true; } void IniParser::set_locale_string(const std::string& group, const std::string& key, const std::string& value, const std::string& locale) { lock_guard lock(internal::parser_mutex); g_key_file_set_locale_string(p->k, group.c_str(), key.c_str(), locale.c_str(), value.c_str()); p->dirty = true; } void IniParser::set_boolean(const std::string& group, const std::string& key, bool value) { lock_guard lock(internal::parser_mutex); g_key_file_set_boolean(p->k, group.c_str(), key.c_str(), value); p->dirty = true; } void IniParser::set_int(const std::string& group, const std::string& key, int value) { lock_guard lock(internal::parser_mutex); g_key_file_set_integer(p->k, group.c_str(), key.c_str(), value); p->dirty = true; } void IniParser::set_double(const std::string& group, const std::string& key, double value) { lock_guard lock(internal::parser_mutex); g_key_file_set_double(p->k, group.c_str(), key.c_str(), value); p->dirty = true; } void IniParser::set_string_array(const std::string& group, const std::string& key, const std::vector& value) { lock_guard lock(internal::parser_mutex); int count = value.size(); gchar** strlist = g_new(gchar*, count+1); for (int i = 0; i < count; ++i) { strlist[i] = g_strdup(value[i].c_str()); } strlist[count] = nullptr; g_key_file_set_string_list(p->k, group.c_str(), key.c_str(), strlist, count); p->dirty = true; g_strfreev(strlist); } void IniParser::set_locale_string_array(const std::string& group, const std::string& key, const std::vector& value, const std::string& locale) { lock_guard lock(internal::parser_mutex); int count = value.size(); gchar** strlist = g_new(gchar*, count+1); for (int i = 0; i < count; ++i) { strlist[i] = g_strdup(value[i].c_str()); } strlist[count] = nullptr; g_key_file_set_locale_string_list(p->k, group.c_str(), key.c_str(), locale.c_str(), strlist, count); p->dirty = true; g_strfreev(strlist); } void IniParser::set_boolean_array(const std::string& group, const std::string& key, const std::vector& value) { lock_guard lock(internal::parser_mutex); int count = value.size(); gboolean* boollist = g_new(gboolean, count); for (int i = 0; i < count; ++i) { boollist[i] = value[i]; } g_key_file_set_boolean_list(p->k, group.c_str(), key.c_str(), boollist, count); p->dirty = true; g_free(boollist); } void IniParser::set_int_array(const std::string& group, const std::string& key, const std::vector& value) { lock_guard lock(internal::parser_mutex); int count = value.size(); gint* intlist = g_new(gint, count); for (int i = 0; i < count; ++i) { intlist[i] = value[i]; } g_key_file_set_integer_list(p->k, group.c_str(), key.c_str(), intlist, count); p->dirty = true; g_free(intlist); } void IniParser::set_double_array(const std::string& group, const std::string& key, const std::vector& value) { lock_guard lock(internal::parser_mutex); int count = value.size(); gdouble* doublelist = g_new(gdouble, count); for (int i = 0; i < count; ++i) { doublelist[i] = value[i]; } g_key_file_set_double_list(p->k, group.c_str(), key.c_str(), doublelist, count); p->dirty = true; g_free(doublelist); } void IniParser::sync() { lock_guard lock(internal::parser_mutex); if (p->dirty) { GError* e = nullptr; if (!g_key_file_save_to_file(p->k, p->filename.c_str(), &e)) { string message = "Could not write ini file "; message += p->filename; message += ": "; message += e->message; int errnum = e->code; g_error_free(e); throw FileException(message, errnum); } p->dirty = false; } } } // namespace util } // namespace lomiri lomiri-api-0.2.1/src/lomiri/util/SnapPath.cpp000066400000000000000000000017021443550065200210410ustar00rootroot00000000000000/* * Copyright (C) 2016-2017 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * */ #include "lomiri/util/SnapPath.h" namespace lomiri { namespace util { std::string prepend_snap_path(const std::string& path) { const char* env_snap = getenv("SNAP"); if (env_snap == nullptr) { return path; } return env_snap + path; } } // namespace util } // namespace lomiri lomiri-api-0.2.1/src/lomiri/util/internal/000077500000000000000000000000001443550065200204335ustar00rootroot00000000000000lomiri-api-0.2.1/src/lomiri/util/internal/CMakeLists.txt000066400000000000000000000002301443550065200231660ustar00rootroot00000000000000set(UTIL_INTERNAL_SRC ${CMAKE_CURRENT_SOURCE_DIR}/DaemonImpl.cpp ) set(LOMIRI_API_LIB_SRC ${LOMIRI_API_LIB_SRC} ${UTIL_INTERNAL_SRC} PARENT_SCOPE) lomiri-api-0.2.1/src/lomiri/util/internal/DaemonImpl.cpp000066400000000000000000000225021443550065200231650ustar00rootroot00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Michi Henning */ #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; namespace lomiri { namespace util { namespace internal { DaemonImpl::DaemonImpl() : close_fds_(false), reset_signals_(false), set_umask_(false) { } // LCOV_EXCL_START // This is tested, but only when coverage is disabled, because closing // file descriptors interferes with writing the coverage results. void DaemonImpl::close_fds() noexcept { close_fds_ = true; } // LCOV_EXCL_STOP void DaemonImpl::reset_signals() noexcept { reset_signals_ = true; } void DaemonImpl::set_umask(mode_t mask) noexcept { set_umask_ = true; umask_ = mask; } void DaemonImpl::set_working_directory(string const& working_directory) { working_directory_ = working_directory; } // Turn this process into a proper daemon in its own session and without a control terminal. // Whether to close open file descriptors, reset signals to their defaults, change the umask, // or change the working directory is determined by the setters above. void DaemonImpl::daemonize_me() { // Let's start by changing the working directory because that is the most likely thing to fail. If it does // fail, we have not modified any other properties of the calling process. // We save the current working dir in case we need to restore it if a fork fails. ResourcePtr> old_working_dir( [](int fd) { if (fd != -1) { int rc __attribute__((unused)) = fchdir(fd); close(fd); } } ); if (!working_directory_.empty()) { old_working_dir.reset(open(".", 0)); // Doesn't matter if this fails if (chdir(working_directory_.c_str()) == -1) { ostringstream msg; msg << "chdir(\"" << working_directory_.c_str() << "\") failed"; throw SyscallException(msg.str(), errno); } } // Fork and let the parent exit. switch (fork()) { case -1: { // Strong exception guarantee: if working dir was changed, the old_working_dir // destructor will try to restore it. This will work if at least one spare // descriptor was avalable to start with. (Otherwise, old_working_dir won't // be set and and we won't restore the previous working directory.) throw SyscallException("fork() failed", errno); // LCOV_EXCL_LINE } case 0: { break; // Child process } default: { exit(EXIT_SUCCESS); // Parent process, we are done. } } // Make us a process group leader, thereby losing the control terminal. // No error check needed here: the only possible error is EPERM which means we are a process // group leader already. But that's impossible because we just forked and are the child. setsid(); // Set the umask if the caller asked for that. No error checking here because umask() cannot fail. mode_t old_umask = 0; if (set_umask_) { old_umask = umask(umask_); } // We are about to fork a second time, to prevent the process from re-acquiring a control terminal if it // later opens a terminal device. Because we are a session leader now, we need to ignore SIGHUP, otherwise, // when the parent exits after the next fork, we'll receive SIGHUP and die. We remember the previous SIGHUP // disposition so we can restore it to what it was if the caller doesn't want all signals to be // reset to their default behavior. struct sigaction old_action; memset(&old_action, 0, sizeof(old_action)); // To stop valgrind complaints struct sigaction action; memset(&action, 0, sizeof(old_action)); // To stop valgrind complaints action.sa_handler = SIG_IGN; sigaction(SIGHUP, &action, &old_action); switch (fork()) { case -1: { // LCOV_EXCL_START if (set_umask_) { umask(old_umask); // Strong exception guarantee } sigaction(SIGHUP, &old_action, nullptr); // Strong exception guarantee // Strong exception guarantee: if working dir was changed, the old_working_dir // destructor will try to restore it. This will work if at least one spare // descriptor was avalable to start with. (Otherwise, old_working_dir won't // be set and and we won't restore the previous working directory.) throw SyscallException("fork() failed", errno); // LCOV_EXCL_STOP } case 0: { if (old_working_dir.has_resource()) { close(old_working_dir.get()); // Reclaim file descriptor straight away old_working_dir.release(); // Don't restore previous working dir once we are done } break; // Child process } default: { exit(EXIT_SUCCESS); // Parent process, we are done. } } // From here on, we do as much of the daemonizing as we can, ignoring errors from system calls. // That's because, now that the second fork has happened, we are committed. Any system call errors below // are effectively impossible anyway because things like closing open files and changing signal disposition // never fail unless the OS is seriously ill. if (!reset_signals_ && old_action.sa_handler != action.sa_handler) { sigaction(SIGHUP, &old_action, nullptr); // Restore previous disposition for SIGHUP. } // If the caller asked for it, we reset all signals to the default behavior. if (reset_signals_) { action.sa_handler = SIG_DFL; for (int sig = 1; sig < NSIG; ++sig) { sigaction(sig, &action, nullptr); } } // Close standard descriptors plus, if the caller asked for that, all others, and // connect the standard file descriptors to /dev/null. close_open_files(); int fd = open("/dev/null", O_RDWR); assert(fd == 0); fd = dup(fd); assert(fd == 1); fd = dup(fd); assert(fd == 2); } // Close all open file descriptors void DaemonImpl::close_open_files() noexcept { // We close the standard file descriptors first. This allows opendir() to work if we need to close // other files and are at the descriptor limit already. close(0); close(1); close(2); // LCOV_EXCL_START // Closing file descriptors interferes with coverage reporting if (close_fds_) { // Close all open files. We use /proc to figure out what files are open. // That's more efficient than calling close() potentially tens of thousands of times, // once for each possible descriptor up to the process limit. char const* proc_self_fd = "/proc/self/fd"; DIR* dirp; if ((dirp = opendir(proc_self_fd)) == nullptr) { return; // This should never happen but, for diligence, we handle it anyway. } ResourcePtr dir(dirp, closedir); vector descriptors; // We collect the file descriptors to close here struct dirent* result_p; while ((result_p = readdir(dir.get())) != nullptr) { // Try to treat the file name as a number. If it doesn't look like a number, we are looking at "." or ".." or, // otherwise, something is seriously wrong because /proc/self/fd is supposed to contain only open file // descriptor numbers. Rather than giving up in that case, we keep going, closing as many file descriptors as we can. size_t pos; int fd = std::stoi(result_p->d_name, &pos); if (result_p->d_name[pos] == '\0') // The file name did parse as a number { // We can't call close() here because that would modify the directory while we are iterating // over it, which has undefined behavior. descriptors.push_back(fd); } } for (auto fd : descriptors) { close(fd); } } // LCOV_EXCL_STOP } } // namespace internal } // namespace util } // namespace lomiri lomiri-api-0.2.1/src/pch/000077500000000000000000000000001443550065200151215ustar00rootroot00000000000000lomiri-api-0.2.1/src/pch/lomiriapi_pch.hh000066400000000000000000000020671443550065200202660ustar00rootroot00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Jussi Pakkanen */ /* * List of (system) headers to precompile. * This is not a fire-and-forget file, the list * of headers must be updated as includes change. * * Grepping for includes in include and src * will give a pretty good idea what to include. */ #include #include #include #include #include #include #include lomiri-api-0.2.1/test/000077500000000000000000000000001443550065200145375ustar00rootroot00000000000000lomiri-api-0.2.1/test/CMakeLists.txt000066400000000000000000000005041443550065200172760ustar00rootroot00000000000000set(LOMIRI_API_TEST_DATADIR "${CMAKE_CURRENT_SOURCE_DIR}/data") configure_file(lomiri-api-test-config.h.in lomiri-api-test-config.h @ONLY) include_directories(${CMAKE_CURRENT_BINARY_DIR}) add_subdirectory(gtest) add_subdirectory(headers) add_subdirectory(copyright) add_subdirectory(whitespace) add_subdirectory(qmltest) lomiri-api-0.2.1/test/copyright/000077500000000000000000000000001443550065200165475ustar00rootroot00000000000000lomiri-api-0.2.1/test/copyright/CMakeLists.txt000066400000000000000000000002551443550065200213110ustar00rootroot00000000000000# # Test that all source files contain a copyright header. # add_test(copyright ${CMAKE_CURRENT_SOURCE_DIR}/check_copyright.sh ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}) lomiri-api-0.2.1/test/copyright/check_copyright.sh000077500000000000000000000035621443550065200222610ustar00rootroot00000000000000#!/bin/sh # # Copyright (C) 2013 Canonical Ltd # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License version 3 as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see . # # Authored by: Michi Henning # # # Check that, somewhere in the first 30 lines of each file, the string "Copyright" (case independent) appears. # Print out a messsage for each file without a copyright notice and exit with non-zero status # if any such file is found. # usage() { echo "usage: check_copyright dir [ignore_dir]" >&2 exit 2 } [ $# -lt 1 ] && usage [ $# -gt 2 ] && usage ignore_pat="\\.sci$|\\.git|\\.txt$|ChangeLog|CMakeFiles|debian|qmldir|valgrind-suppress|lomiri-api\/lomiri-api.qmlproject$|astyle-config|\\.cmake$|\\.ini$|\\.in$|Jenkinsfile|NEWS|build|\\.qmlc|\\.user|\\.log$|" # # We don't use the -i option of licensecheck to add ignore_dir to the pattern because Jenkins creates directories # with names that contain regex meta-characters, such as "." and "+". Instead, if ingnore_dir is set, we post-filter # the output with grep -F, so we don't get false positives from licensecheck. # [ $# -eq 2 ] && ignore_dir="$2" if [ -n "$ignore_dir" ] then licensecheck -i "$ignore_pat" -r "$1" | grep -F "$ignore_dir" -v | grep -v 'GENERATED FILE' | grep 'No copyright' else licensecheck -i "$ignore_pat" -r "$1" | grep -v 'GENERATED FILE' | grep 'No copyright' fi [ $? -eq 0 ] && exit 1 exit 0 lomiri-api-0.2.1/test/data/000077500000000000000000000000001443550065200154505ustar00rootroot00000000000000lomiri-api-0.2.1/test/data/sample.ini000066400000000000000000000005601443550065200174330ustar00rootroot00000000000000[first] intvalue = 1 doublevalue = 2.345 boolvalue = true stringvalue = hello locstring = world locstring[en] = world locstring[pt_BR] = mundo array = foo;bar;baz boolarray = true;false;false stringarray = a;b;c locstringarray[pt_BR] = x;y;z [second] intvalue = 2 boolvalue = false stringvalue = there intarray = 4;5;6;78;8;9;9;345;3 doublearray = 4.5;6.78;9;10.11 lomiri-api-0.2.1/test/gtest/000077500000000000000000000000001443550065200156655ustar00rootroot00000000000000lomiri-api-0.2.1/test/gtest/CMakeLists.txt000066400000000000000000000013321443550065200204240ustar00rootroot00000000000000find_package(Threads REQUIRED) find_package(GMock REQUIRED) set(TESTLIBS ${TESTLIBS} ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) # gtest does weird things with its own implementation of tr1::tuple. For clang, we need to # set this macro, otherwise anything that includes gtest.h won't compile. if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGTEST_USE_OWN_TR1_TUPLE=1") endif() add_subdirectory(lomiri) set(TEST_SRC ) foreach(src ${TEST_SRC}) get_filename_component(name ${src} NAME_WE) add_executable(${name} ${src}) target_link_libraries(${name} ${TESTLIBS}) string(REPLACE "_test" "" test_name ${name}) add_test(${test_name} ${name}) endforeach(src) lomiri-api-0.2.1/test/gtest/lomiri/000077500000000000000000000000001443550065200171605ustar00rootroot00000000000000lomiri-api-0.2.1/test/gtest/lomiri/CMakeLists.txt000066400000000000000000000002731443550065200217220ustar00rootroot00000000000000add_subdirectory(api) add_subdirectory(util) add_executable(Exceptions_test Exceptions_test.cpp) target_link_libraries(Exceptions_test ${TESTLIBS}) add_test(Exceptions Exceptions_test) lomiri-api-0.2.1/test/gtest/lomiri/Exceptions_test.cpp000066400000000000000000000327031443550065200230510ustar00rootroot00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Michi Henning */ #include #include #include using namespace std; using namespace lomiri; // // Check Exception base class functionality (copy, assignment, accessor methods, etc.) // TEST(Exception, basic) { SyscallException e("Hello", 0); EXPECT_EQ("lomiri::SyscallException", e.name()); EXPECT_EQ("Hello (errno = 0)", e.reason()); EXPECT_STREQ("lomiri::SyscallException: Hello (errno = 0)", e.what()); SyscallException e2(e); EXPECT_EQ(e.name(), e2.name()); EXPECT_EQ(e.reason(), e2.reason()); EXPECT_STREQ(e.what(), e2.what()); SyscallException e3("blah", 1); e2 = e3; EXPECT_EQ(e3.name(), e2.name()); EXPECT_EQ(e3.reason(), e2.reason()); EXPECT_STREQ(e3.what(), e2.what()); EXPECT_EQ("lomiri::SyscallException: blah (errno = 1)", e3.to_string()); EXPECT_EQ("lomiri::SyscallException: blah (errno = 1)", e3.to_string(0, " ")); EXPECT_EQ(" lomiri::SyscallException: blah (errno = 1)", e3.to_string(1, " ")); EXPECT_EQ(" lomiri::SyscallException: blah (errno = 1)", e3.to_string(2, " ")); try { throw e; } catch (Exception& e) { EXPECT_STREQ("lomiri::SyscallException: Hello (errno = 0)", e.what()); } } TEST(Exception, empty_reason) { { InvalidArgumentException e(""); EXPECT_EQ("", e.reason()); EXPECT_STREQ("lomiri::InvalidArgumentException", e.what()); } { SyscallException e("", 0); EXPECT_EQ("(errno = 0)", e.reason()); EXPECT_STREQ("lomiri::SyscallException: (errno = 0)", e.what()); } } // // A few helper functions so we can test that the nesting works correctly. // void a() { throw bad_alloc(); } void b() { try { a(); } catch (...) { throw InvalidArgumentException("a() threw"); } } void c() { try { b(); } catch (nested_exception const&) { throw InvalidArgumentException("b() threw"); } } class E : public std::exception, public nested_exception { public: char const* what() const noexcept override { return "E"; } E() = default; ~E() noexcept {} }; void throw_E() { try { c(); } catch (...) { throw E(); } } void d() { try { throw_E(); } catch (...) { throw InvalidArgumentException("throw_E() threw"); } } struct N : public nested_exception { }; void throw_N() { try { b(); } catch (...) { throw N(); } } void f() { try { throw_N(); } catch (...) { throw InvalidArgumentException("throw_N() threw"); } } void throw_unknown() { throw 42; } void g() { try { throw_unknown(); } catch (...) { throw InvalidArgumentException("throw_unknown threw"); } } TEST(Exception, nesting) { // Check basic chaining works and terminates correctly on a std::exception. try { c(); } catch (Exception const& e) { EXPECT_EQ("lomiri::InvalidArgumentException: b() threw:\n" " lomiri::InvalidArgumentException: a() threw:\n" " std::bad_alloc", e.to_string()); } // Check that we follow the chain for exceptions we don't know, but that derive // from both std::exception and std::nested_exception. try { d(); } catch (Exception const& e) { EXPECT_EQ("lomiri::InvalidArgumentException: throw_E() threw:\n" " E (derived from std::exception and std::nested_exception):\n" " lomiri::InvalidArgumentException: b() threw:\n" " lomiri::InvalidArgumentException: a() threw:\n" " std::bad_alloc", e.to_string()); } // Check that we follow the chain for exceptions that are derived from std::nested_exception // but not std::exception. try { f(); } catch (lomiri::Exception const& e) { EXPECT_EQ("lomiri::InvalidArgumentException: throw_N() threw:\n" " std::nested_exception:\n" " lomiri::InvalidArgumentException: a() threw:\n" " std::bad_alloc", e.to_string()); } // Check that we are correctly dealing with unknown exceptions try { g(); } catch (lomiri::Exception const& e) { EXPECT_EQ("lomiri::InvalidArgumentException: throw_unknown threw:\n" " unknown exception", e.to_string()); } } // // Test the history chaining. // TEST(Exception, history) { // Check that remember() and get_earlier() return the correct exception. { InvalidArgumentException e(""); EXPECT_EQ(nullptr, e.get_earlier()); exception_ptr ep = make_exception_ptr(e); InvalidArgumentException e2(""); e2.remember(ep); EXPECT_EQ(e2.get_earlier(), ep); } // Check that we are following the history chain. { exception_ptr ep; try { throw InvalidArgumentException("Step 1"); } catch (Exception& e) { ep = e.remember(ep); } InvalidArgumentException e2("Step 2"); ep = e2.remember(ep); try { ShutdownException e("Finalization problem"); e.remember(ep); throw e; } catch (Exception const& e) { string reason = e.to_string(); EXPECT_EQ("lomiri::ShutdownException: Finalization problem\n" " Exception history:\n" " Exception #1:\n" " lomiri::InvalidArgumentException: Step 1\n" " Exception #2:\n" " lomiri::InvalidArgumentException: Step 2", e.to_string()); } } // Same test, but this time with nested exceptions in the history. { exception_ptr ep; try { c(); } catch (Exception& e) { ep = e.remember(ep); } try { f(); } catch (Exception &e) { ep = e.remember(ep); } try { ShutdownException e("Finalization problem"); e.remember(ep); throw e; } catch (Exception const& e) { string reason = e.to_string(); EXPECT_EQ("lomiri::ShutdownException: Finalization problem\n" " Exception history:\n" " Exception #1:\n" " lomiri::InvalidArgumentException: b() threw:\n" " lomiri::InvalidArgumentException: a() threw:\n" " std::bad_alloc\n" " Exception #2:\n" " lomiri::InvalidArgumentException: throw_N() threw:\n" " std::nested_exception:\n" " lomiri::InvalidArgumentException: a() threw:\n" " std::bad_alloc", e.to_string()); } } // Same test, but this time with history in a nested exception. { exception_ptr ep; try { c(); } catch (Exception& e) { ep = e.remember(ep); } try { f(); } catch (Exception &e) { ep = e.remember(ep); } try { try { ShutdownException e("Finalization problem"); e.remember(ep); throw e; } catch (Exception &e) { throw ShutdownException("Cannot finalize"); } } catch (Exception const& e) { EXPECT_EQ("lomiri::ShutdownException: Cannot finalize:\n" " lomiri::ShutdownException: Finalization problem\n" " Exception history:\n" " Exception #1:\n" " lomiri::InvalidArgumentException: b() threw:\n" " lomiri::InvalidArgumentException: a() threw:\n" " std::bad_alloc\n" " Exception #2:\n" " lomiri::InvalidArgumentException: throw_N() threw:\n" " std::nested_exception:\n" " lomiri::InvalidArgumentException: a() threw:\n" " std::bad_alloc", e.to_string()); } } } // // Tests for the state of concrete derived exceptions follow. // TEST(SyscallException, state) { // Check that we correctly mention the error code. { SyscallException e("without error", 0); EXPECT_EQ("lomiri::SyscallException: without error (errno = 0)", e.to_string()); SyscallException e2("blah", 0); e2 = e; EXPECT_EQ(e.reason(), e2.reason()); } { SyscallException e("with error code", 42); EXPECT_EQ("lomiri::SyscallException: with error code (errno = 42)", e.to_string()); EXPECT_EQ(e.error(), 42); EXPECT_THROW(rethrow_exception(e.self()), SyscallException); } { ostringstream s; s << "lomiri::SyscallException: with errno (errno = " << EPERM << ")"; SyscallException e("with errno", EPERM); EXPECT_EQ(s.str(), e.to_string()); EXPECT_EQ(e.error(), EPERM); EXPECT_THROW(rethrow_exception(e.self()), SyscallException); } } TEST(InvalidArgumentException, state) { { InvalidArgumentException e("bad arg"); EXPECT_STREQ("lomiri::InvalidArgumentException: bad arg", e.what()); EXPECT_THROW(rethrow_exception(e.self()), InvalidArgumentException); InvalidArgumentException e2("blah"); e2 = e; EXPECT_EQ(e.reason(), e2.reason()); } } TEST(LogicException, state) { { LogicException e("You shouldn't have done that!"); EXPECT_STREQ("lomiri::LogicException: You shouldn't have done that!", e.what()); EXPECT_THROW(rethrow_exception(e.self()), LogicException); LogicException e2("blah"); e2 = e; EXPECT_EQ(e.reason(), e2.reason()); } } TEST(ShutdownException, state) { { ShutdownException e("Need some kicks"); EXPECT_STREQ("lomiri::ShutdownException: Need some kicks", e.what()); EXPECT_THROW(rethrow_exception(e.self()), ShutdownException); ShutdownException e2("blah"); e2 = e; EXPECT_EQ(e.reason(), e2.reason()); } } TEST(FileException, state) { { FileException e("File error", 0); EXPECT_EQ("File error (errno = 0)", e.reason()); EXPECT_STREQ("lomiri::FileException: File error (errno = 0)", e.what()); EXPECT_EQ(0, e.error()); EXPECT_THROW(rethrow_exception(e.self()), FileException); FileException e2("blah", 0); e2 = e; EXPECT_EQ(e.reason(), e2.reason()); EXPECT_EQ(e.error(), e2.error()); } { FileException e("File error", 42); EXPECT_EQ("File error (errno = 42)", e.reason()); EXPECT_STREQ("lomiri::FileException: File error (errno = 42)", e.what()); EXPECT_EQ(42, e.error()); EXPECT_THROW(rethrow_exception(e.self()), FileException); FileException e2("blah", 0); e2 = e; EXPECT_EQ(e.reason(), e2.reason()); EXPECT_EQ(e.error(), e2.error()); } } TEST(ResourceException, state) { { ResourceException e("Need some kicks"); EXPECT_STREQ("lomiri::ResourceException: Need some kicks", e.what()); EXPECT_THROW(rethrow_exception(e.self()), ResourceException); ResourceException e2("blah"); e2 = e; EXPECT_EQ(e.reason(), e2.reason()); } } // Dynamic allocation to get around bogus function coverage reports by gcov. TEST(Exceptions, dynamic) { { SyscallException* ep = new SyscallException("Hello", 0); delete ep; } { InvalidArgumentException* ep = new InvalidArgumentException("Hello"); delete ep; } { LogicException* ep = new LogicException("Hello"); delete ep; } { ShutdownException* ep = new ShutdownException("Hello"); delete ep; } { FileException* ep = new FileException("Hello", 0); delete ep; } { ResourceException* ep = new ResourceException("Hello"); delete ep; } } lomiri-api-0.2.1/test/gtest/lomiri/api/000077500000000000000000000000001443550065200177315ustar00rootroot00000000000000lomiri-api-0.2.1/test/gtest/lomiri/api/CMakeLists.txt000066400000000000000000000000321443550065200224640ustar00rootroot00000000000000add_subdirectory(Version) lomiri-api-0.2.1/test/gtest/lomiri/api/Version/000077500000000000000000000000001443550065200213565ustar00rootroot00000000000000lomiri-api-0.2.1/test/gtest/lomiri/api/Version/CMakeLists.txt000066400000000000000000000002061443550065200241140ustar00rootroot00000000000000add_executable(Version_test Version_test.cpp) target_link_libraries(Version_test ${LIBS} ${TESTLIBS}) add_test(Version Version_test) lomiri-api-0.2.1/test/gtest/lomiri/api/Version/Version_test.cpp000066400000000000000000000020341443550065200245450ustar00rootroot00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Michi Henning */ #include #include using namespace lomiri::api; TEST(Version, basic) { EXPECT_EQ(major_version(), LOMIRI_API_VERSION_MAJOR); EXPECT_EQ(minor_version(), LOMIRI_API_VERSION_MINOR); EXPECT_EQ(micro_version(), LOMIRI_API_VERSION_MICRO); EXPECT_STREQ(str(), LOMIRI_API_VERSION_STRING); } lomiri-api-0.2.1/test/gtest/lomiri/util/000077500000000000000000000000001443550065200201355ustar00rootroot00000000000000lomiri-api-0.2.1/test/gtest/lomiri/util/CMakeLists.txt000066400000000000000000000004601443550065200226750ustar00rootroot00000000000000add_subdirectory(Daemon) add_subdirectory(DefinesPtrs) add_subdirectory(FileIO) add_subdirectory(GioMemory) add_subdirectory(GlibMemory) add_subdirectory(GObjectMemory) add_subdirectory(IniParser) add_subdirectory(ResourcePtr) add_subdirectory(SnapPath) add_subdirectory(Dbus) add_subdirectory(internal) lomiri-api-0.2.1/test/gtest/lomiri/util/Daemon/000077500000000000000000000000001443550065200213405ustar00rootroot00000000000000lomiri-api-0.2.1/test/gtest/lomiri/util/Daemon/CMakeLists.txt000066400000000000000000000003021443550065200240730ustar00rootroot00000000000000add_executable(Daemon_test Daemon_test.cpp) target_link_libraries(Daemon_test ${TESTLIBS}) add_test(Daemon ${CMAKE_CURRENT_SOURCE_DIR}/daemon-tester.py ${CMAKE_CURRENT_BINARY_DIR}/Daemon_test) lomiri-api-0.2.1/test/gtest/lomiri/util/Daemon/Daemon_test.cpp000066400000000000000000000233761443550065200243210ustar00rootroot00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Michi Henning */ #include #include #include #include #include using namespace std; using namespace lomiri; using namespace lomiri::util; // // The daemonize_me() method forks and lets the parent exit with zero exit status. In addition, it connects // the standard file descriptors to /dev/null. This means we cannot use gtest EXPECT macros to test because, // as far as gtest is concerned, everything worked just fine. // // To deal with this, we create a file Daemon_test.out in the directory the test runs in. If the file is // empty after the test, we know that the test succeeded. Otherwise, it contains messages // for any failure that were detected. // char const* error_file = "Daemon_test.out"; int clear_error_file() { mode_t old_umask = umask(0); // Make sure we have mode rw-rw-rw for the file, otherwise different // people running the test can have problems. int fd = open(error_file, O_CREAT | O_TRUNC | O_WRONLY, 0666); umask(old_umask); close(fd); return fd; } // Write the supplied message into the error file, preceded by file name and line number. // We open and close the file for each new line because daemonize_me() may close file descriptors, // so we cannot keep the error file open while the various tests are running. We use a raw write() system // call to write the messages, so there are no buffering issues, even if we crash unexpectedly. void error(string const& file, int line, string const& msg) { int fd = open(error_file, O_APPEND | O_WRONLY); if (fd == -1) { // Little we can do here, seeing that we are a daemon. abort(); } ostringstream s; s << file << ":" << line; if (!msg.empty()) { s << ": " << msg; } s << endl; string l = s.str(); int bytes __attribute__((unused)) = write(fd, l.c_str(), l.size()); // Need to use return value to stop warning from gcc. close(fd); } // Check that the standard three file descriptors are connected to /dev/null. void check_std_descriptors() { struct stat null_st; if (stat("/dev/null", &null_st) == -1) { error(__FILE__, __LINE__, "stat() failed"); } struct stat st; if (fstat(0, &st) == -1) { error(__FILE__, __LINE__, "fstat() failed"); } if (st.st_dev != null_st.st_dev || st.st_ino != null_st.st_ino) { error(__FILE__, __LINE__, "stdin not opened to /dev/null"); } if (fstat(1, &st) == -1) { error(__FILE__, __LINE__, "fstat() failed"); } if (st.st_dev != null_st.st_dev || st.st_ino != null_st.st_ino) { error(__FILE__, __LINE__, "stdout not opened to /dev/null"); } if (fstat(2, &st) == -1) { error(__FILE__, __LINE__, "fstat() failed"); } if (st.st_dev != null_st.st_dev || st.st_ino != null_st.st_ino) { error(__FILE__, __LINE__, "stderr not opened to /dev/null"); } } // Check if fd is a descriptor for an open file. bool is_open(int fd) { struct stat st; return fstat(fd, &st) != -1; } string get_cwd() { char* wd = get_current_dir_name(); if (wd == nullptr) { abort(); } string dir = wd; free(wd); return dir; } TEST(Daemon, basic) { // Clear the error file. We do this only once, for this first test, so we start out with an empty file. // Any test failures reported hereafter append to the file. if (clear_error_file() == -1) { cerr << "Daemon_test.cpp: cannot clear error file" << endl; abort(); } Daemon::UPtr d = Daemon::create(); int pid = getpid(); // Open a file so we can check that the file is still open after daemonizing. int fd = open(".", O_RDONLY); if (fd == -1) { abort(); } d->daemonize_me(); EXPECT_TRUE(pid != getpid()); // We really did fork... check_std_descriptors(); if (!is_open(fd)) { error(__FILE__, __LINE__, "test file closed, should be open"); } close(fd); } // Dummy signal handler void hup_handler(int) { } TEST(Daemon, signals) { // Check that signal mask is changed or left alone as appropriate. Daemon::UPtr d = Daemon::create(); // Set SIGUSR1 to be ignored and set SIGHUP to be caught. struct sigaction usr1_action; memset(&usr1_action, 0, sizeof(usr1_action)); // To stop valgrind complaints usr1_action.sa_handler = SIG_IGN; if (sigaction(SIGUSR1, &usr1_action, nullptr) == -1) { error(__FILE__, __LINE__, "cannot ignore SIGUSR1"); abort(); } struct sigaction hup_action; memset(&hup_action, 0, sizeof(hup_action)); // To stop valgrind complaints hup_action.sa_handler = hup_handler; if (sigaction(SIGHUP, &hup_action, nullptr) == -1) { error(__FILE__, __LINE__, "cannot catch SIGHUP"); abort(); } d->daemonize_me(); struct sigaction prev_action; if (sigaction(SIGUSR1, &usr1_action, &prev_action) == -1) { error(__FILE__, __LINE__, "cannot restore SIGUSR1"); abort(); } if (prev_action.sa_handler != usr1_action.sa_handler) { error(__FILE__, __LINE__, "SIGUSR1 should have been left alone, but wasn't"); } if (sigaction(SIGHUP, &hup_action, &prev_action) == -1) { error(__FILE__, __LINE__, "cannot restore SIGHUP"); abort(); } if (prev_action.sa_handler != hup_action.sa_handler) { error(__FILE__, __LINE__, "SIGHUP should have been left alone, but wasn't"); } // Daemonize again, resetting signals, so we can check that they are at the defaults. d->reset_signals(); d->daemonize_me(); if (sigaction(SIGUSR1, &usr1_action, &prev_action) == -1) { error(__FILE__, __LINE__, "cannot set SIGUSR1"); abort(); } if (prev_action.sa_handler != SIG_DFL) { error(__FILE__, __LINE__, "SIGUSR1 should have been reset, but wasn't"); } if (sigaction(SIGHUP, &hup_action, &prev_action) == -1) { error(__FILE__, __LINE__, "cannot set SIGHUP"); abort(); } if (prev_action.sa_handler != SIG_DFL) { error(__FILE__, __LINE__, "SIGHUP should have been reset, but wasn't"); } } TEST(Daemon, umask) { // Check that umask is changed or left alone as appropriate. Daemon::UPtr d = Daemon::create(); umask(027); d->daemonize_me(); mode_t new_umask = umask(022); if (new_umask != 027) { error(__FILE__, __LINE__, "umask was changed, but should not have been"); } // Daemonize again, changing umask, so we can check that the umask was indeed changed. d->set_umask(0); d->daemonize_me(); new_umask = umask(027); if (new_umask != 0) { error(__FILE__, __LINE__, "umask was not changed, but should have been"); } } TEST(Daemon, dir) { // Check that working directory is changed or left alone as appropriate. Daemon::UPtr d = Daemon::create(); string old_wd = get_cwd(); d->daemonize_me(); string new_wd = get_cwd(); if (new_wd != old_wd) { error(__FILE__, __LINE__, "working dir was changed, but should not have been"); } // Daemonize again, changing directory, so we can check that the directory was indeed changed. d->set_working_directory("/"); d->daemonize_me(); new_wd = get_cwd(); if (new_wd != "/") { error(__FILE__, __LINE__, "working dir was not changed, but should have been"); } // Check that errors in setting working directory are correctly diagnosed. d->set_working_directory("/no_such_directory"); try { d->daemonize_me(); error(__FILE__, __LINE__, "daemonize_me() should have thrown, but didn't"); FAIL(); } catch (SyscallException const& e) { if (e.to_string() != "lomiri::SyscallException: chdir(\"/no_such_directory\") failed (errno = 2)") { error(__FILE__, __LINE__, "wrong message for SyscallException"); } } } TEST(Daemon, tty) { // Check that the process cannot re-acquire a control terminal Daemon::UPtr d = Daemon::create(); d->daemonize_me(); int fd = open("/dev/tty", O_RDWR); if (fd != -1) { error(__FILE__, __LINE__, "re-acquired control terminal but should not have been able to"); } } // Test that file descriptors are closed. // We test this only when coverage is disabled because // closing descriptors interferes with coverage reporting. #if !defined(COVERAGE_ENABLED) TEST(Daemon, file_close) { Daemon::UPtr d = Daemon::create(); // Open a file so we can check that the file is closed after daemonizing. int fd = open(".", O_RDONLY); if (fd == -1) { abort(); } int fd2 = open(".", O_RDONLY); if (fd2 == -1) { abort(); } d->close_fds(); d->daemonize_me(); check_std_descriptors(); if (is_open(fd)) { error(__FILE__, __LINE__, "fd open, should be closed"); } if (is_open(fd2)) { error(__FILE__, __LINE__, "fd2 open, should be closed"); } } #endif lomiri-api-0.2.1/test/gtest/lomiri/util/Daemon/daemon-tester.py000077500000000000000000000032241443550065200244650ustar00rootroot00000000000000#! /usr/bin/env python3 # # Copyright (C) 2013 Canonical Ltd # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License version 3 as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see . # # Authored by: Michi Henning # # # Little test driver program to execute the Daemon_test binary, wait a little, and check # whether the test reported any errors. If the file /tmp/Daemon_test.out has non-zero size, # the test run produced errors. # import argparse import os import sys import subprocess import time def run_daemon(path): status = subprocess.call(path) if status != 0: exit("cannot run " + path) time.sleep(1) # Give process time to complete def run(): parser = argparse.ArgumentParser(description = 'Test driver for Daemon_test') parser.add_argument('Daemon_test', nargs = 1, help = 'Full path to Daemon_test executable') args = parser.parse_args() daemon = args.Daemon_test[0] run_daemon(daemon) size = os.stat("Daemon_test.out").st_size if size == 0: exit(0) with open("Daemon_test.out", 'r') as file: sys.stderr.write(file.read()) exit(1) if __name__ == '__main__': run() lomiri-api-0.2.1/test/gtest/lomiri/util/Dbus/000077500000000000000000000000001443550065200210325ustar00rootroot00000000000000lomiri-api-0.2.1/test/gtest/lomiri/util/Dbus/CMakeLists.txt000066400000000000000000000001671443550065200235760ustar00rootroot00000000000000add_executable(Dbus_test Dbus_test.cpp) target_link_libraries(Dbus_test ${LIBS} ${TESTLIBS}) add_test(Dbus Dbus_test) lomiri-api-0.2.1/test/gtest/lomiri/util/Dbus/Dbus_test.cpp000066400000000000000000000047341443550065200235020ustar00rootroot00000000000000/* * Copyright (C) 2020 UBports foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * */ #include "lomiri/util/Dbus.h" #include using namespace lomiri::util; namespace { TEST(Utilities, testBasicDbusStr) { EXPECT_EQ("bar", dbus_sanitize_str("bar")); EXPECT_EQ("foo_5fbar", dbus_sanitize_str("foo_bar")); EXPECT_EQ("foo_2ebar", dbus_sanitize_str("foo.bar")); EXPECT_EQ("foo_20bar", dbus_sanitize_str("foo bar")); EXPECT_EQ("foo_2fbar_2ebaz", dbus_sanitize_str("foo/bar.baz")); } TEST(Utilities, testBasicDbusPath) { EXPECT_EQ("/bar", dbus_sanitized_path("bar")); EXPECT_EQ("/foo_5fbar", dbus_sanitized_path("foo_bar")); EXPECT_EQ("/foo_2ebar", dbus_sanitized_path("foo.bar")); EXPECT_EQ("/foo_20bar", dbus_sanitized_path("foo bar")); EXPECT_EQ("/foo_2fbar_2ebaz", dbus_sanitized_path("foo/bar.baz")); } TEST(Utilities, testBasicDbusPathBase) { EXPECT_EQ("/com/blah/bar", dbus_sanitized_path("/com/blah/", "bar")); EXPECT_EQ("/com/blah/foo_5fbar", dbus_sanitized_path("/com/blah/", "foo_bar")); EXPECT_EQ("/com/blah/foo_2ebar", dbus_sanitized_path("/com/blah/", "foo.bar")); EXPECT_EQ("/com/blah/foo_20bar", dbus_sanitized_path("/com/blah/", "foo bar")); EXPECT_EQ("/com/blah/foo_2fbar_2ebaz", dbus_sanitized_path("/com/blah/", "foo/bar.baz")); } TEST(Utilities, testBasicDbusPathBaseMissingSlash) { EXPECT_EQ("/com/blah/bar", dbus_sanitized_path("com/blah", "bar")); EXPECT_EQ("/com/blah/bar", dbus_sanitized_path("com/blah/", "bar")); EXPECT_EQ("/com/blah/bar", dbus_sanitized_path("/com/blah", "bar")); EXPECT_EQ("/com/blah/foo_5fbar", dbus_sanitized_path("com/blah", "foo_bar")); EXPECT_EQ("/com/blah/foo_2ebar", dbus_sanitized_path("com/blah", "foo.bar")); EXPECT_EQ("/com/blah/foo_20bar", dbus_sanitized_path("com/blah", "foo bar")); EXPECT_EQ("/com/blah/foo_2fbar_2ebaz", dbus_sanitized_path("com/blah", "foo/bar.baz")); } } // namespace lomiri-api-0.2.1/test/gtest/lomiri/util/DefinesPtrs/000077500000000000000000000000001443550065200223635ustar00rootroot00000000000000lomiri-api-0.2.1/test/gtest/lomiri/util/DefinesPtrs/CMakeLists.txt000066400000000000000000000002221443550065200251170ustar00rootroot00000000000000add_executable(DefinesPtrs_test DefinesPtrs_test.cpp) target_link_libraries(DefinesPtrs_test ${TESTLIBS}) add_test(DefinesPtrs DefinesPtrs_test) lomiri-api-0.2.1/test/gtest/lomiri/util/DefinesPtrs/DefinesPtrs_test.cpp000066400000000000000000000026231443550065200263570ustar00rootroot00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Michi Henning */ #include #include #include class MyClass { public: NONCOPYABLE(MyClass); LOMIRI_DEFINES_PTRS(MyClass); static SPtr create() { return SPtr(new MyClass); } protected: MyClass() { } }; class MyDerivedClass : public MyClass { public: LOMIRI_DEFINES_PTRS(MyDerivedClass); static UPtr create() { return UPtr(new MyDerivedClass); } protected: MyDerivedClass() { } }; TEST(DefinesPtrs, basic) { // No real test here. This is just so we check that things compile. MyClass::SPtr p = MyClass::create(); MyDerivedClass::UPtr q = MyDerivedClass::create(); } lomiri-api-0.2.1/test/gtest/lomiri/util/FileIO/000077500000000000000000000000001443550065200212445ustar00rootroot00000000000000lomiri-api-0.2.1/test/gtest/lomiri/util/FileIO/CMakeLists.txt000066400000000000000000000001711443550065200240030ustar00rootroot00000000000000add_executable(FileIO_test FileIO_test.cpp) target_link_libraries(FileIO_test ${TESTLIBS}) add_test(FileIO FileIO_test) lomiri-api-0.2.1/test/gtest/lomiri/util/FileIO/FileIO_test.cpp000066400000000000000000000041701443550065200241200ustar00rootroot00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Michi Henning */ #include #include #include #include #include #include using namespace std; using namespace lomiri; using namespace lomiri::util; TEST(FileIO, basic) { FILE* f; remove("testfile"); f = fopen("testfile", "w"); EXPECT_NE(f, nullptr); fputs("some chars\n", f); fclose(f); string s = read_text_file("testfile"); EXPECT_EQ("some chars\n", s); vector v = read_binary_file("testfile"); string contents("some chars\n"); EXPECT_EQ(vector(contents.begin(), contents.end()), v); remove("empty"); f = fopen("empty", "w"); EXPECT_NE(f, nullptr); fclose(f); s = read_text_file("empty"); EXPECT_TRUE(s.empty()); } TEST(FileIO, exceptions) { try { read_text_file("no_such_file"); FAIL(); } catch (FileException const& e) { ostringstream s; s << "lomiri::FileException: cannot open \"no_such_file\": " << strerror(ENOENT) << " (errno = " << ENOENT << ")"; EXPECT_EQ(s.str(), e.to_string()); } try { remove("testdir"); int rc = mkdir("testdir", 0777); EXPECT_NE(-1, rc); read_text_file("testdir"); FAIL(); } catch (FileException const& e) { EXPECT_EQ("lomiri::FileException: \"testdir\" is not a regular file (errno = 0)", e.to_string()); } } lomiri-api-0.2.1/test/gtest/lomiri/util/GObjectMemory/000077500000000000000000000000001443550065200226435ustar00rootroot00000000000000lomiri-api-0.2.1/test/gtest/lomiri/util/GObjectMemory/CMakeLists.txt000066400000000000000000000004521443550065200254040ustar00rootroot00000000000000pkg_check_modules(GOBJECT REQUIRED gobject-2.0) include_directories(${GOBJECT_INCLUDE_DIRS}) add_executable(GObjectMemory_test GObjectMemory_test.cpp ) target_link_libraries(GObjectMemory_test ${TESTLIBS} ${GOBJECT_LDFLAGS} ) add_test(GObjectMemory_test GObjectMemory_test) lomiri-api-0.2.1/test/gtest/lomiri/util/GObjectMemory/GObjectMemory_test.cpp000066400000000000000000000365551443550065200271320ustar00rootroot00000000000000/* * Copyright (C) 2013-2017 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Jussi Pakkanen * Pete Woods */ #include #include #include #include #include #include using namespace std; using namespace lomiri::util; namespace { typedef pair Deleted; static list DELETED_OBJECTS; // // Below here is a basic implementation of a GObject type // // "public" header G_BEGIN_DECLS #define FOO_TYPE_BAR foo_bar_get_type() G_DECLARE_FINAL_TYPE (FooBar, foo_bar, FOO, BAR, GObject) FooBar *foo_bar_new(); void foo_bar_assigner(FooBar** in); FooBar *foo_bar_new_full(const gchar* const name, guint id); void foo_bar_assigner_full(const gchar* const name, guint id, FooBar** in); void foo_bar_assigner_null(FooBar** in); void foo_bar_set_name(FooBar* fooBar, const gchar* const name); G_END_DECLS // private implementation struct _FooBar { GObject parent_instance; gchar *name; guint id; }; G_DEFINE_TYPE (FooBar, foo_bar, G_TYPE_OBJECT) enum { PROP_NAME = 1, PROP_ID, N_PROPERTIES }; static GParamSpec *obj_properties[N_PROPERTIES] = { NULL, }; static void foo_bar_set_property(GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { FooBar *self = FOO_BAR(object); switch (property_id) { case PROP_NAME: g_free(self->name); self->name = g_value_dup_string(value); break; case PROP_ID: self->id = g_value_get_uint(value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec); break; } } static void foo_bar_get_property(GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { FooBar *self = FOO_BAR(object); switch (property_id) { case PROP_NAME: g_value_set_string(value, self->name); break; case PROP_ID: g_value_set_uint(value, self->id); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec); break; } } static void foo_bar_finalize(GObject *gobject) { FooBar* self = FOO_BAR(gobject); DELETED_OBJECTS.emplace_back(Deleted(string(self->name == NULL ? "" : self->name), self->id)); g_free(self->name); G_OBJECT_CLASS (foo_bar_parent_class)->finalize(gobject); } static void foo_bar_class_init(FooBarClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->set_property = foo_bar_set_property; object_class->get_property = foo_bar_get_property; object_class->finalize = foo_bar_finalize; obj_properties[PROP_NAME] = g_param_spec_string ("name", "Name", "Name of the file to load and display from.", "default-name" /* default value */, (GParamFlags) (G_PARAM_READWRITE)); obj_properties[PROP_ID] = g_param_spec_uint ("id", "ID", "ID of this dummy class", 0 /* minimum value */, 10 /* maximum value */, 2 /* default value */, (GParamFlags) G_PARAM_READWRITE); g_object_class_install_properties (object_class, N_PROPERTIES, obj_properties); } static void foo_bar_init(FooBar *) { } FooBar *foo_bar_new() { return FOO_BAR(g_object_new(FOO_TYPE_BAR, NULL)); } FooBar *foo_bar_new_full(const gchar* const name, guint id) { return FOO_BAR(g_object_new(FOO_TYPE_BAR, "name", name, "id", id, NULL)); } void foo_bar_assigner(FooBar** in) { if (in != nullptr) { *in = foo_bar_new(); } } void foo_bar_assigner_full(const gchar* const name, guint id, FooBar** in) { if (in != nullptr) { *in = foo_bar_new_full(name, id); } } void foo_bar_assigner_null(FooBar** in) { if (in != nullptr) { *in = nullptr; } } void foo_bar_set_name(FooBar* fooBar, const gchar* const name) { g_object_set(fooBar, "name", name, nullptr); } // // Test cases // class GObjectMemoryTest: public testing::Test { protected: static void SetUpTestCase() { g_log_set_always_fatal((GLogLevelFlags) (G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL)); } void SetUp() override { DELETED_OBJECTS.clear(); } static void on_notify_name(GObject *object, GParamSpec *, gpointer user_data) { static_cast(user_data)->onNotifyName(object); } void onNotifyName(GObject *object) { gcharUPtr name; g_object_get(object, "name", assign_glib(name), nullptr); nameChanges_.emplace_back(name.get()); } list nameChanges_; GObjectSignalConnection nameConnection_; }; TEST_F(GObjectMemoryTest, trivial) { auto basic = unique_gobject(foo_bar_new()); EXPECT_TRUE(bool(basic)); EXPECT_TRUE(G_IS_OBJECT(basic.get())); } TEST_F(GObjectMemoryTest, compare) { FooBar* o1 = foo_bar_new(); FooBar* o2 = foo_bar_new(); if (o1 > o2) { std::swap(o1, o2); } ASSERT_TRUE(o1 < o2); auto u1 = unique_gobject(o1); auto u2 = unique_gobject(o2); EXPECT_TRUE(!(u1 == nullptr)); EXPECT_TRUE(u1 != nullptr); EXPECT_TRUE(u1 != u2); EXPECT_TRUE(!(u1 == u2)); EXPECT_TRUE(u1 < u2); EXPECT_TRUE(!(u2 < u1)); EXPECT_TRUE(!(u1 == u2)); EXPECT_TRUE(!(u2 == u1)); EXPECT_TRUE(u1 <= u2); EXPECT_TRUE(!(u2 <= u1)); } // This is its own thing due to need to avoid double release. TEST_F(GObjectMemoryTest, equality) { FooBar* o = foo_bar_new(); auto u1 = unique_gobject(o); g_object_ref(o); auto u2 = unique_gobject(o); EXPECT_TRUE(u1 == u2); EXPECT_TRUE(u2 == u1); EXPECT_TRUE(!(u1 != u2)); EXPECT_TRUE(!(u2 != u1)); } TEST_F(GObjectMemoryTest, release) { FooBar* o = foo_bar_new(); auto u = unique_gobject(o); EXPECT_TRUE(u != nullptr); EXPECT_TRUE(u.get() != nullptr); EXPECT_TRUE(o == u.release()); EXPECT_TRUE(!u); EXPECT_TRUE(u.get() == nullptr); g_object_unref(o); } TEST_F(GObjectMemoryTest, refcount) { GObject* o = G_OBJECT(g_object_new(G_TYPE_OBJECT, nullptr)); EXPECT_EQ(1, o->ref_count); g_object_ref(o); { EXPECT_EQ(2, o->ref_count); auto u = unique_gobject(o); EXPECT_EQ(2, o->ref_count); // Now it dies and refcount is reduced. } EXPECT_EQ(1, o->ref_count); g_object_unref(o); } TEST_F(GObjectMemoryTest, swap) { FooBar* o1 = foo_bar_new(); FooBar* o2 = foo_bar_new(); auto u1 = unique_gobject(o1); auto u2 = unique_gobject(o2); u1.swap(u2); EXPECT_EQ(o2, u1.get()); EXPECT_EQ(o1, u2.get()); std::swap(u1, u2); EXPECT_EQ(o1, u1.get()); EXPECT_EQ(o2, u2.get()); } TEST_F(GObjectMemoryTest, floating) { { auto o = G_INITIALLY_UNOWNED(g_object_new(G_TYPE_INITIALLY_UNOWNED, nullptr)); EXPECT_THROW(unique_gobject(o), invalid_argument); g_object_ref_sink(G_OBJECT(o)); unique_gobject(o); } { auto o = G_INITIALLY_UNOWNED(g_object_new(G_TYPE_INITIALLY_UNOWNED, nullptr)); EXPECT_THROW(unique_gobject(o), invalid_argument); g_object_ref_sink(G_OBJECT(o)); unique_gobject(o); } { auto o = make_gobject(G_TYPE_INITIALLY_UNOWNED, nullptr); EXPECT_FALSE(g_object_is_floating(o.get())); } } TEST_F(GObjectMemoryTest, move) { GObject* o1 = G_OBJECT(g_object_new(G_TYPE_OBJECT, nullptr)); GObject* o2 = G_OBJECT(g_object_new(G_TYPE_OBJECT, nullptr)); g_object_ref(o1); auto u1 = unique_gobject(o1); auto u2 = unique_gobject(o2); u1 = std::move(u2); EXPECT_TRUE(u1.get() == o2); EXPECT_TRUE(!u2); EXPECT_TRUE(o1->ref_count == 1); g_object_unref(o1); } TEST_F(GObjectMemoryTest, null) { FooBar* o1 = NULL; FooBar* o3 = foo_bar_new(); auto u1 = unique_gobject(o1); auto u2 = unique_gobject(nullptr); auto u3 = unique_gobject(o3); auto u4 = unique_gobject((FooBar *) NULL); EXPECT_TRUE(!u1); EXPECT_TRUE(!u2); u3 = nullptr; EXPECT_TRUE(!u3); } TEST_F(GObjectMemoryTest, reset) { FooBar* o1 = foo_bar_new(); FooBar* o2 = foo_bar_new(); auto u = unique_gobject(o1); u.reset(o2); EXPECT_EQ(o2, u.get()); u.reset(nullptr); EXPECT_TRUE(!u); } TEST_F(GObjectMemoryTest, sizeoftest) { EXPECT_EQ(sizeof(FooBar*), sizeof(GObjectUPtr)); } TEST_F(GObjectMemoryTest, hash) { unordered_set> s; auto a = share_gobject(foo_bar_new()); auto b = share_gobject(foo_bar_new()); auto c = share_gobject(foo_bar_new()); s.emplace(a); EXPECT_EQ(1, s.size()); EXPECT_FALSE(s.end() == s.find(a)); s.emplace(b); EXPECT_EQ(2, s.size()); EXPECT_FALSE(s.end() == s.find(b)); s.emplace(c); EXPECT_EQ(3, s.size()); EXPECT_FALSE(s.end() == s.find(c)); // Shouldn't add the duplicates s.emplace(a); s.emplace(b); s.emplace(c); EXPECT_EQ(3, s.size()); s.erase(a); EXPECT_EQ(2, s.size()); s.erase(b); EXPECT_EQ(1, s.size()); s.erase(c); EXPECT_TRUE(s.empty()); } TEST_F(GObjectMemoryTest, uniquePtrDeletesGObjects) { { auto a = unique_gobject(foo_bar_new_full("a", 1)); auto b = unique_gobject(foo_bar_new_full("b", 2)); } EXPECT_EQ(list({{"b", 2}, {"a", 1}}), DELETED_OBJECTS); } TEST_F(GObjectMemoryTest, sharedPtrDeletesGObjects) { { auto a = share_gobject(foo_bar_new_full("a", 1)); auto b = share_gobject(foo_bar_new_full("b", 2)); } EXPECT_EQ(list({{"b", 2}, {"a", 1}}), DELETED_OBJECTS); } TEST_F(GObjectMemoryTest, makeGObjectDeletesGObjects) { { auto a = make_gobject(FOO_TYPE_BAR, "name", "a", "id", 1, nullptr); auto b = make_gobject(FOO_TYPE_BAR, "name", "b", "id", 2, nullptr); auto c = make_gobject(FOO_TYPE_BAR, "name", "c", "id", 3, nullptr); } EXPECT_EQ(list({{"c", 3}, {"b", 2}, {"a", 1}}), DELETED_OBJECTS); } TEST_F(GObjectMemoryTest, uptrAssignerDeletesGObjects) { { GObjectUPtr a, b; foo_bar_assigner_full("a", 1, assign_gobject(a)); foo_bar_assigner_full("b", 2, assign_gobject(b)); } EXPECT_EQ(list({{"b", 2}, {"a", 1}}), DELETED_OBJECTS); } TEST_F(GObjectMemoryTest, sptrAssignerDeletesGObjects) { { GObjectSPtr a, b, c; foo_bar_assigner_full("a", 3, assign_gobject(a)); foo_bar_assigner_full("b", 4, assign_gobject(b)); foo_bar_assigner_full("c", 5, assign_gobject(c)); } EXPECT_EQ(list({{"c", 5}, {"b", 4}, {"a", 3}}), DELETED_OBJECTS); } TEST_F(GObjectMemoryTest, uptrAssignerAssignsNull) { { GObjectUPtr o; foo_bar_assigner_full("o", 1, assign_gobject(o)); ASSERT_TRUE(bool(o)); foo_bar_assigner_null(assign_gobject(o)); ASSERT_FALSE(bool(o)); } EXPECT_EQ(list({{"o", 1}}), DELETED_OBJECTS); } TEST_F(GObjectMemoryTest, sptrAssignerAssignsNull) { { GObjectSPtr o; foo_bar_assigner_full("o", 1, assign_gobject(o)); ASSERT_TRUE(bool(o)); foo_bar_assigner_null(assign_gobject(o)); ASSERT_FALSE(bool(o)); } EXPECT_EQ(list({{"o", 1}}), DELETED_OBJECTS); } TEST_F(GObjectMemoryTest, moveUptrSptr) { { GObjectSPtr s; auto u = unique_gobject(foo_bar_new_full("hi", 6)); s = move(u); // unique instance has been stolen from EXPECT_FALSE(u); } EXPECT_EQ(list({{"hi", 6}}), DELETED_OBJECTS); { GObjectSPtr s(unique_gobject(foo_bar_new_full("bye", 7))); } EXPECT_EQ(list({{"hi", 6}, {"bye", 7}}), DELETED_OBJECTS); } TEST_F(GObjectMemoryTest, signals) { auto o(share_gobject(foo_bar_new_full("hi", 1))); nameConnection_ = gobject_signal_connection(g_signal_connect(o.get(), "notify::name", G_CALLBACK(on_notify_name), this), o); foo_bar_set_name(o.get(), "change1"); nameConnection_.dealloc(); foo_bar_set_name(o.get(), "change2"); EXPECT_EQ(list{"change1"}, nameChanges_); } typedef pair GObjectMemoryMakeSharedTestParam; class GObjectMemoryMakeHelperMethodsTest: public testing::TestWithParam { protected: /** * We test for multiple properties so that we can be sure the various * helper methods correctly pass through different data types and * multiple combinations of arguments correctly. */ static void checkProperties(gpointer obj, const char* expectedName, guint expectedId) { gcharUPtr name; guint id = 0; g_object_get(obj, "name", assign_glib(name), "id", &id, nullptr); EXPECT_STREQ(expectedName, name.get()); EXPECT_EQ(expectedId, id); } }; TEST_P(GObjectMemoryMakeHelperMethodsTest, make_gobject_passes_arguments) { auto p = GetParam(); auto obj = make_gobject(FOO_TYPE_BAR, "name", p.first, "id", p.second, nullptr); checkProperties(obj.get(), p.first, p.second); } TEST_P(GObjectMemoryMakeHelperMethodsTest, make_gobject_no_arguments) { auto p = GetParam(); auto obj = make_gobject(FOO_TYPE_BAR, nullptr); g_object_set(obj.get(), "name", p.first, "id", p.second, nullptr); checkProperties(obj.get(), p.first, p.second); } TEST_P(GObjectMemoryMakeHelperMethodsTest, unique_foo_bar_new) { auto p = GetParam(); auto obj = unique_gobject(foo_bar_new_full(p.first,p.second)); checkProperties(obj.get(), p.first, p.second); } TEST_P(GObjectMemoryMakeHelperMethodsTest, share_foo_bar_new) { auto p = GetParam(); auto obj = share_gobject(foo_bar_new_full(p.first, p.second)); checkProperties(obj.get(), p.first, p.second); } TEST_P(GObjectMemoryMakeHelperMethodsTest, assign_foo_bar_uptr_assigner) { auto p = GetParam(); GObjectUPtr obj; foo_bar_assigner_full(p.first, p.second, assign_gobject(obj)); checkProperties(obj.get(), p.first, p.second); } TEST_P(GObjectMemoryMakeHelperMethodsTest, assign_foo_bar_sptr_assigner) { auto p = GetParam(); GObjectSPtr obj; foo_bar_assigner_full(p.first, p.second, assign_gobject(obj)); checkProperties(obj.get(), p.first, p.second); } INSTANTIATE_TEST_CASE_P(BunchOfNames, GObjectMemoryMakeHelperMethodsTest, ::testing::Values(GObjectMemoryMakeSharedTestParam{"meeny", 1}, GObjectMemoryMakeSharedTestParam{"miny", 2}, GObjectMemoryMakeSharedTestParam{"moe", 3})); } lomiri-api-0.2.1/test/gtest/lomiri/util/GioMemory/000077500000000000000000000000001443550065200220445ustar00rootroot00000000000000lomiri-api-0.2.1/test/gtest/lomiri/util/GioMemory/CMakeLists.txt000066400000000000000000000010771443550065200246110ustar00rootroot00000000000000pkg_check_modules(GIO REQUIRED gio-2.0) pkg_check_modules(QDBUSTEST REQUIRED libqtdbustest-1) find_package(Qt5Core REQUIRED) find_package(Qt5DBus REQUIRED) include_directories( ${Qt5Core_INCLUDE_DIRS} ${Qt5DBus_INCLUDE_DIRS} ${GIO_INCLUDE_DIRS} ${QDBUSTEST_INCLUDE_DIRS} ) add_definitions( -DQT_NO_KEYWORDS=1 ) add_executable(GioMemory_test GioMemory_test.cpp ) target_link_libraries(GioMemory_test ${TESTLIBS} ${GIO_LDFLAGS} ${QDBUSTEST_LDFLAGS} Qt5::Core Qt5::DBus ) add_test(GioMemory_test GioMemory_test) lomiri-api-0.2.1/test/gtest/lomiri/util/GioMemory/GioMemory_test.cpp000066400000000000000000000072401443550065200255210ustar00rootroot00000000000000/* * Copyright (C) 2017 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Pete Woods */ #include #include #include #include #include #include using namespace std; using namespace lomiri::util; using namespace QtDBusTest; namespace { class GioMemoryTest: public testing::Test { protected: static void SetUpTestCase() { g_log_set_always_fatal((GLogLevelFlags) (G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL)); } static void on_dbus_signal(GDBusConnection *, const gchar *, const gchar *, const gchar *, const gchar *signal_name, GVariant *, gpointer user_data) { static_cast(user_data)->onDbusSignal(signal_name); } void onDbusSignal(const gchar *signal_name) { signals_.emplace_back(signal_name); g_main_loop_quit(mainloop_.get()); } static gboolean on_timeout(gpointer user_data) { return static_cast(user_data)->onTimeout(); } gboolean onTimeout() { g_main_loop_quit(mainloop_.get()); return G_SOURCE_CONTINUE; } static GObjectSPtr getSessionBus() { auto address = unique_glib(g_dbus_address_get_for_bus_sync(G_BUS_TYPE_SESSION, nullptr, nullptr)); GError *error = nullptr; auto bus = unique_gobject( g_dbus_connection_new_for_address_sync(address.get(), (GDBusConnectionFlags) (G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT | G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION), nullptr, nullptr, &error)); if (!bus) { g_printerr ("Error connecting to D-Bus address %s: %s\n", address.get(), error->message); g_error_free (error); } g_dbus_connection_set_exit_on_close(bus.get(), FALSE); return bus; } DBusTestRunner dbusTestRunner; GDBusSignalConnection signalConnection_; GMainLoopSPtr mainloop_; list signals_; }; TEST_F(GioMemoryTest, signals) { mainloop_ = share_glib(g_main_loop_new(nullptr, false)); auto bus = getSessionBus(); ASSERT_TRUE(bool(bus)); signalConnection_ = gdbus_signal_connection( g_dbus_connection_signal_subscribe(bus.get(), nullptr, "org.does.not.exist", nullptr, "/does/not/exist", nullptr, G_DBUS_SIGNAL_FLAGS_NONE, on_dbus_signal, this, nullptr), bus); g_dbus_connection_emit_signal(bus.get(), nullptr, "/does/not/exist", "org.does.not.exist", "hello", nullptr, nullptr); { auto timer = g_source_manager(g_timeout_add(5000, on_timeout, this)); g_main_loop_run(mainloop_.get()); EXPECT_EQ(list{"hello"}, signals_); } signals_.clear(); signalConnection_.dealloc(); g_dbus_connection_emit_signal(bus.get(), nullptr, "/does/not/exist", "org.does.not.exist", "hello", nullptr, nullptr); { auto timer = g_source_manager(g_timeout_add(5000, on_timeout, this)); g_main_loop_run(mainloop_.get()); EXPECT_TRUE(signals_.empty()); } } } lomiri-api-0.2.1/test/gtest/lomiri/util/GlibMemory/000077500000000000000000000000001443550065200222035ustar00rootroot00000000000000lomiri-api-0.2.1/test/gtest/lomiri/util/GlibMemory/CMakeLists.txt000066400000000000000000000003441443550065200247440ustar00rootroot00000000000000include_directories(${GLIB_INCLUDE_DIRS}) add_executable(GlibMemory_test GlibMemory_test.cpp ) target_link_libraries(GlibMemory_test ${TESTLIBS} ${GLIB_LDFLAGS} ) add_test(GlibMemory_test GlibMemory_test) lomiri-api-0.2.1/test/gtest/lomiri/util/GlibMemory/GlibMemory_test.cpp000066400000000000000000000155711443550065200260250ustar00rootroot00000000000000/* * Copyright (C) 2017 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Pete Woods */ #include #include #include #include #include using namespace std; using namespace lomiri; using namespace lomiri::util; namespace { static set keys; static set values; class GlibMemoryTest: public testing::Test { protected: static void SetUpTestCase() { g_log_set_always_fatal((GLogLevelFlags) (G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL)); } void SetUp() override { keys.clear(); values.clear(); } static void deleteKey(gpointer data) { // Note that we don't g_free the data, because it's a reference to a static string keys.emplace(string((gchar*) data)); } static void deleteValue(gpointer data) { // Note that we don't g_free the data, because it's a reference to a static string values.emplace(string((gchar*) data)); } static GKeyFileUPtr newGKeyFile() { return unique_glib(g_key_file_new()); } static GVariantUPtr newGVariant(const gchar* const value) { return unique_glib(g_variant_new_string(value)); } static GHashTableUPtr newGHashTable() { return unique_glib(g_hash_table_new_full(g_str_hash, g_str_equal, deleteKey, deleteValue)); } static GKeyFileSPtr sharedGKeyFile() { return share_glib(g_key_file_new()); } static GVariantSPtr sharedGVariant(const gchar* const value) { return share_glib(g_variant_new_string(value)); } static GHashTableSPtr sharedGHashTable() { return share_glib(g_hash_table_new_full(g_str_hash, g_str_equal, deleteKey, deleteValue)); } static void assignGChar(gchar** in) { if (in != nullptr) { *in = g_strdup("hi"); } } static void assignGError(GError** in) { if (in != nullptr) { *in = g_error_new_literal(g_key_file_error_quark(), 1, "hello"); } } static void assignEmptyGError(GError** in) { if (in != nullptr) { *in = nullptr; } } }; TEST_F(GlibMemoryTest, Unique) { { auto gkf = newGKeyFile(); g_key_file_set_boolean(gkf.get(), "group", "key", TRUE); EXPECT_EQ(TRUE, g_key_file_get_boolean(gkf.get(), "group", "key", NULL)); } { auto variant = newGVariant("hello"); EXPECT_STREQ("hello", g_variant_get_string(variant.get(), NULL)); } { { auto hash = newGHashTable(); g_hash_table_insert(hash.get(), (gpointer) "hello", (gpointer) "there"); g_hash_table_insert(hash.get(), (gpointer) "hash", (gpointer) "world"); } EXPECT_EQ(set({"hello", "hash"}), keys); EXPECT_EQ(set({"there", "world"}), values); } { auto emptyVariant = unique_glib((GVariant*) NULL); } } TEST_F(GlibMemoryTest, Share) { { auto gkf = sharedGKeyFile(); g_key_file_set_boolean(gkf.get(), "group", "key", TRUE); EXPECT_EQ(TRUE, g_key_file_get_boolean(gkf.get(), "group", "key", NULL)); } { auto variant = sharedGVariant("hello"); EXPECT_STREQ("hello", g_variant_get_string(variant.get(), NULL)); } { { auto hash = sharedGHashTable(); g_hash_table_insert(hash.get(), (gpointer) "hello", (gpointer) "there"); g_hash_table_insert(hash.get(), (gpointer) "hash", (gpointer) "world"); } EXPECT_EQ(set({"hello", "hash"}), keys); EXPECT_EQ(set({"there", "world"}), values); } { auto emptyVariant = share_glib((GVariant*) NULL); } } TEST_F(GlibMemoryTest, UPtrAssigner) { auto gkf = unique_glib(g_key_file_new()); { GErrorUPtr error; EXPECT_FALSE(g_key_file_get_boolean(gkf.get(), "group", "key", assign_glib(error))); ASSERT_TRUE(bool(error)); EXPECT_EQ(G_KEY_FILE_ERROR_GROUP_NOT_FOUND, error->code); } g_key_file_set_boolean(gkf.get(), "group", "key", TRUE); { GErrorUPtr error; EXPECT_TRUE(g_key_file_get_boolean(gkf.get(), "group", "key", assign_glib(error))); EXPECT_FALSE(bool(error)); } { gcharUPtr str; assignGChar(assign_glib(str)); ASSERT_TRUE(bool(str)); EXPECT_STREQ("hi", str.get()); } { GErrorUPtr error; assignGError(assign_glib(error)); ASSERT_TRUE(bool(error)); assignEmptyGError(assign_glib(error)); ASSERT_FALSE(bool(error)); } } TEST_F(GlibMemoryTest, SPtrAssigner) { auto gkf = share_glib(g_key_file_new()); { GErrorSPtr error; EXPECT_FALSE(g_key_file_get_boolean(gkf.get(), "group", "key", assign_glib(error))); ASSERT_TRUE(bool(error)); EXPECT_EQ(G_KEY_FILE_ERROR_GROUP_NOT_FOUND, error->code); } g_key_file_set_boolean(gkf.get(), "group", "key", TRUE); { GErrorSPtr error; EXPECT_TRUE(g_key_file_get_boolean(gkf.get(), "group", "key", assign_glib(error))); EXPECT_FALSE(bool(error)); } { gcharSPtr str; assignGChar(assign_glib(str)); ASSERT_TRUE(bool(str)); EXPECT_STREQ("hi", str.get()); } { GErrorSPtr error; assignGError(assign_glib(error)); ASSERT_TRUE(bool(error)); assignEmptyGError(assign_glib(error)); ASSERT_FALSE(bool(error)); } } TEST_F(GlibMemoryTest, GCharUPtr) { { auto strv = unique_glib(g_strsplit("a b c", " ", 0)); ASSERT_TRUE(bool(strv)); EXPECT_STREQ("a", strv.get()[0]); EXPECT_STREQ("b", strv.get()[1]); EXPECT_STREQ("c", strv.get()[2]); } { auto str = unique_glib(g_strdup("hello")); ASSERT_TRUE(bool(str)); EXPECT_STREQ("hello", str.get()); } } TEST_F(GlibMemoryTest, GCharSPtr) { { auto strv = share_glib(g_strsplit("a b c", " ", 0)); ASSERT_TRUE(bool(strv)); EXPECT_STREQ("a", strv.get()[0]); EXPECT_STREQ("b", strv.get()[1]); EXPECT_STREQ("c", strv.get()[2]); } { auto str = share_glib(g_strdup("hello")); ASSERT_TRUE(bool(str)); EXPECT_STREQ("hello", str.get()); } } } lomiri-api-0.2.1/test/gtest/lomiri/util/IniParser/000077500000000000000000000000001443550065200220315ustar00rootroot00000000000000lomiri-api-0.2.1/test/gtest/lomiri/util/IniParser/CMakeLists.txt000066400000000000000000000003241443550065200245700ustar00rootroot00000000000000add_executable(IniParser_test IniParser_test.cpp) target_link_libraries(IniParser_test ${LIBS} ${TESTLIBS}) add_definitions(-DTEST_RUNTIME_PATH="${CMAKE_CURRENT_BINARY_DIR}") add_test(IniParser IniParser_test) lomiri-api-0.2.1/test/gtest/lomiri/util/IniParser/IniParser_test.cpp000066400000000000000000000331011443550065200254660ustar00rootroot00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Jussi Pakkanen */ #include #include #include #include using namespace std; using namespace lomiri; using namespace lomiri::util; #define INI_FILE LOMIRI_API_TEST_DATADIR "/sample.ini" #define INI_TEMP_FILE TEST_RUNTIME_PATH "/temp.ini" TEST(IniParser, basic) { IniParser test(INI_FILE); } TEST(IniParser, missingFile) { try { IniParser("nonexistant"); FAIL(); } catch(const FileException &e) { } } TEST(IniParser, has) { IniParser conf(INI_FILE); ASSERT_FALSE(conf.has_key("first", "missingvalue")); ASSERT_FALSE(conf.has_group("nonexisting")); ASSERT_TRUE(conf.has_key("first", "stringvalue")); ASSERT_TRUE(conf.has_group("first")); ASSERT_TRUE(conf.remove_key("first", "stringvalue")); EXPECT_THROW(conf.remove_key("first", "missingvalue"), LogicException); ASSERT_FALSE(conf.has_key("first", "stringvalue")); ASSERT_TRUE(conf.has_group("first")); ASSERT_TRUE(conf.remove_group("first")); EXPECT_THROW(conf.remove_group("nonexisting"), LogicException); EXPECT_THROW(conf.has_key("first", "stringvalue"), LogicException); ASSERT_FALSE(conf.has_group("first")); } TEST(IniParser, simpleQueries) { IniParser conf(INI_FILE); vector groups = conf.get_groups(); ASSERT_EQ("first", conf.get_start_group()); ASSERT_EQ(2, groups.size()); ASSERT_EQ("first", groups[0]); ASSERT_EQ("second", groups[1]); vector firstKeys = conf.get_keys("first"); ASSERT_EQ(11, firstKeys.size()); ASSERT_EQ("boolvalue", firstKeys[2]); ASSERT_EQ(conf.get_string("first", "stringvalue"), "hello"); ASSERT_EQ(1, conf.get_int("first", "intvalue")); ASSERT_EQ(1, conf.get_double("first", "intvalue")); ASSERT_EQ(2.345, conf.get_double("first", "doublevalue")); ASSERT_FALSE(conf.get_boolean("second", "boolvalue")); ASSERT_EQ("world", conf.get_string("first", "locstring")); ASSERT_EQ("world", conf.get_locale_string("first", "locstring", "en")); ASSERT_EQ("mundo", conf.get_locale_string("first", "locstring", "pt_BR")); ASSERT_EQ("world", conf.get_locale_string("first", "locstring", "no_DF")); } TEST(IniParser, arrayQueries) { IniParser conf(INI_FILE); vector strArr = conf.get_string_array("first", "array"); ASSERT_EQ(3, strArr.size()); ASSERT_EQ("foo", strArr[0]); ASSERT_EQ("bar", strArr[1]); ASSERT_EQ("baz", strArr[2]); vector intArr = conf.get_int_array("second", "intarray"); ASSERT_EQ(9, intArr.size()); ASSERT_EQ(4, intArr[0]); ASSERT_EQ(3, intArr[8]); vector intToDblArr = conf.get_double_array("second", "intarray"); ASSERT_EQ(9, intToDblArr.size()); ASSERT_EQ(4, intToDblArr[0]); ASSERT_EQ(3, intToDblArr[8]); vector dblArr = conf.get_double_array("second", "doublearray"); ASSERT_EQ(4, dblArr.size()); ASSERT_EQ(4.5, dblArr[0]); ASSERT_EQ(6.78, dblArr[1]); ASSERT_EQ(9, dblArr[2]); ASSERT_EQ(10.11, dblArr[3]); vector boolArr = conf.get_boolean_array("first", "boolarray"); ASSERT_EQ(3, boolArr.size()); ASSERT_TRUE(boolArr[0]); ASSERT_FALSE(boolArr[1]); ASSERT_FALSE(boolArr[2]); strArr = conf.get_string_array("first", "stringarray"); ASSERT_EQ(3, strArr.size()); ASSERT_EQ("a", strArr[0]); ASSERT_EQ("b", strArr[1]); ASSERT_EQ("c", strArr[2]); strArr = conf.get_locale_string_array("first", "locstringarray", "pt_BR"); ASSERT_EQ(3, strArr.size()); ASSERT_EQ("x", strArr[0]); ASSERT_EQ("y", strArr[1]); ASSERT_EQ("z", strArr[2]); } TEST(IniParser, failingQueries) { IniParser conf(INI_FILE); try { conf.get_string("foo", "bar"); } catch (const LogicException& e) { EXPECT_NE(string::npos, string(e.what()).find("lomiri::LogicException: Could not get string value")); EXPECT_NE(string::npos, string(e.what()).find("group: foo")); } try { conf.get_locale_string("foo", "bar"); } catch (const LogicException& e) { EXPECT_NE(string::npos, string(e.what()).find("lomiri::LogicException: Could not get localized string value")); EXPECT_NE(string::npos, string(e.what()).find("group: foo")); } try { conf.get_int("foo", "bar"); } catch (const LogicException& e) { EXPECT_NE(string::npos, string(e.what()).find("lomiri::LogicException: Could not get integer value")); EXPECT_NE(string::npos, string(e.what()).find("group: foo")); } try { conf.get_int("first", "doublevalue"); } catch (const LogicException& e) { EXPECT_NE(string::npos, string(e.what()).find("lomiri::LogicException: Could not get integer value")); EXPECT_NE(string::npos, string(e.what()).find("group: first")); } try { conf.get_boolean("foo", "bar"); } catch (const LogicException& e) { EXPECT_NE(string::npos, string(e.what()).find("lomiri::LogicException: Could not get boolean value")); EXPECT_NE(string::npos, string(e.what()).find("group: foo")); } try { conf.get_int_array("first", "array"); } catch (const LogicException& e) { EXPECT_NE(string::npos, string(e.what()).find("lomiri::LogicException: Could not get integer array")); EXPECT_NE(string::npos, string(e.what()).find("group: first")); } try { conf.get_int_array("second", "doublearray"); } catch (const LogicException& e) { EXPECT_NE(string::npos, string(e.what()).find("lomiri::LogicException: Could not get integer array")); EXPECT_NE(string::npos, string(e.what()).find("group: second")); } try { conf.get_boolean_array("first", "array"); } catch (const LogicException& e) { EXPECT_NE(string::npos, string(e.what()).find("lomiri::LogicException: Could not get boolean array")); EXPECT_NE(string::npos, string(e.what()).find("group: first")); } } TEST(IniParser, writeValues) { // Create an empty ini file for writing auto f = fopen(INI_TEMP_FILE, "w"); fclose(f); IniParser conf(INI_TEMP_FILE); conf.set_string("g1", "k1", "s0;s1"); conf.set_locale_string("g1", "k2", "s2", "en"); conf.set_locale_string("g1", "k2", "s3", "pt_BR"); // Check temp file before sync() { IniParser conf2(INI_TEMP_FILE); EXPECT_EQ("s0;s1", conf.get_string("g1", "k1")); EXPECT_THROW(conf2.get_string("g1", "k1"), LogicException); EXPECT_EQ("s2", conf.get_locale_string("g1", "k2", "en")); EXPECT_THROW(conf2.get_locale_string("g1", "k2", "en"), LogicException); EXPECT_EQ("s3", conf.get_locale_string("g1", "k2", "pt_BR")); EXPECT_THROW(conf2.get_locale_string("g1", "k2", "pt_BR"), LogicException); } // Sync conf.sync(); // Write some post-sync values conf.set_boolean("g2", "k1", false); conf.set_int("g2", "k2", 123); conf.set_double("g3", "k3", 4.56789); // Check temp file after first sync() { IniParser conf2(INI_TEMP_FILE); EXPECT_EQ("s0;s1", conf.get_string("g1", "k1")); EXPECT_EQ("s0;s1", conf2.get_string("g1", "k1")); EXPECT_EQ("s2", conf.get_locale_string("g1", "k2", "en")); EXPECT_EQ("s2", conf2.get_locale_string("g1", "k2", "en")); EXPECT_EQ("s3", conf.get_locale_string("g1", "k2", "pt_BR")); EXPECT_EQ("s3", conf2.get_locale_string("g1", "k2", "pt_BR")); EXPECT_EQ(false, conf.get_boolean("g2", "k1")); EXPECT_THROW(conf2.get_boolean("g2", "k1"), LogicException); EXPECT_EQ(123, conf.get_int("g2", "k2")); EXPECT_THROW(conf2.get_int("g2", "k2"), LogicException); EXPECT_EQ(4.56789, conf.get_double("g3", "k3")); EXPECT_THROW(conf2.get_double("g3", "k3"), LogicException); } // Sync conf.sync(); // Check temp file after second sync() { IniParser conf2(INI_TEMP_FILE); EXPECT_EQ("s0;s1", conf.get_string("g1", "k1")); EXPECT_EQ("s0;s1", conf2.get_string("g1", "k1")); EXPECT_EQ("s2", conf.get_locale_string("g1", "k2", "en")); EXPECT_EQ("s2", conf2.get_locale_string("g1", "k2", "en")); EXPECT_EQ("s3", conf.get_locale_string("g1", "k2", "pt_BR")); EXPECT_EQ("s3", conf2.get_locale_string("g1", "k2", "pt_BR")); EXPECT_EQ(false, conf.get_boolean("g2", "k1")); EXPECT_EQ(false, conf2.get_boolean("g2", "k1")); EXPECT_EQ(123, conf.get_int("g2", "k2")); EXPECT_EQ(123, conf2.get_int("g2", "k2")); EXPECT_EQ(4.56789, conf.get_double("g3", "k3")); EXPECT_EQ(4.56789, conf2.get_double("g3", "k3")); } } template void EXPECT_ARRAY_EQ(const vector& expected, const vector& actual) { EXPECT_TRUE(expected == actual); } TEST(IniParser, writeArrays) { // Create an empty ini file for writing auto f = fopen(INI_TEMP_FILE, "w"); fclose(f); IniParser conf(INI_TEMP_FILE); conf.set_string_array("g1", "k1", {"s0;s1", "s2", "s3"}); conf.set_locale_string_array("g1", "k2", {"s4", "s5", "s6"}, "en"); conf.set_locale_string_array("g1", "k2", {"s7", "s8", "s9=s10"}, "pt_BR"); // Check temp file before sync() { IniParser conf2(INI_TEMP_FILE); EXPECT_ARRAY_EQ({"s0;s1", "s2", "s3"}, conf.get_string_array("g1", "k1")); EXPECT_THROW(conf2.get_string_array("g1", "k1"), LogicException); EXPECT_ARRAY_EQ({"s4", "s5", "s6"}, conf.get_locale_string_array("g1", "k2", "en")); EXPECT_THROW(conf2.get_locale_string_array("g1", "k2", "en"), LogicException); EXPECT_ARRAY_EQ({"s7", "s8", "s9=s10"}, conf.get_locale_string_array("g1", "k2", "pt_BR")); EXPECT_THROW(conf2.get_locale_string_array("g1", "k2", "pt_BR"), LogicException); } // Sync conf.sync(); // Write some post-sync values conf.set_boolean_array("g2", "k1", {true, false, false}); conf.set_int_array("g2", "k2", {123, 456789, 101112}); conf.set_double_array("g2", "k3", {13.14, 15.161718, 19.2}); // Check temp file after first sync() { IniParser conf2(INI_TEMP_FILE); EXPECT_ARRAY_EQ({"s0;s1", "s2", "s3"}, conf.get_string_array("g1", "k1")); EXPECT_ARRAY_EQ({"s0;s1", "s2", "s3"}, conf2.get_string_array("g1", "k1")); EXPECT_ARRAY_EQ({"s4", "s5", "s6"}, conf.get_locale_string_array("g1", "k2", "en")); EXPECT_ARRAY_EQ({"s4", "s5", "s6"}, conf2.get_locale_string_array("g1", "k2", "en")); EXPECT_ARRAY_EQ({"s7", "s8", "s9=s10"}, conf.get_locale_string_array("g1", "k2", "pt_BR")); EXPECT_ARRAY_EQ({"s7", "s8", "s9=s10"}, conf2.get_locale_string_array("g1", "k2", "pt_BR")); EXPECT_ARRAY_EQ({true, false, false}, conf.get_boolean_array("g2", "k1")); EXPECT_THROW(conf2.get_boolean_array("g2", "k1"), LogicException); EXPECT_ARRAY_EQ({123, 456789, 101112}, conf.get_int_array("g2", "k2")); EXPECT_THROW(conf2.get_int_array("g2", "k2"), LogicException); EXPECT_ARRAY_EQ({13.14, 15.161718, 19.2}, conf.get_double_array("g2", "k3")); EXPECT_THROW(conf2.get_double_array("g2", "k3"), LogicException); } // Sync conf.sync(); // Check temp file after second sync() { IniParser conf2(INI_TEMP_FILE); EXPECT_ARRAY_EQ({"s0;s1", "s2", "s3"}, conf.get_string_array("g1", "k1")); EXPECT_ARRAY_EQ({"s0;s1", "s2", "s3"}, conf2.get_string_array("g1", "k1")); EXPECT_ARRAY_EQ({"s4", "s5", "s6"}, conf.get_locale_string_array("g1", "k2", "en")); EXPECT_ARRAY_EQ({"s4", "s5", "s6"}, conf2.get_locale_string_array("g1", "k2", "en")); EXPECT_ARRAY_EQ({"s7", "s8", "s9=s10"}, conf.get_locale_string_array("g1", "k2", "pt_BR")); EXPECT_ARRAY_EQ({"s7", "s8", "s9=s10"}, conf2.get_locale_string_array("g1", "k2", "pt_BR")); EXPECT_ARRAY_EQ({true, false, false}, conf.get_boolean_array("g2", "k1")); EXPECT_ARRAY_EQ({true, false, false}, conf2.get_boolean_array("g2", "k1")); EXPECT_ARRAY_EQ({123, 456789, 101112}, conf.get_int_array("g2", "k2")); EXPECT_ARRAY_EQ({123, 456789, 101112}, conf2.get_int_array("g2", "k2")); EXPECT_ARRAY_EQ({13.14, 15.161718, 19.2}, conf.get_double_array("g2", "k3")); EXPECT_ARRAY_EQ({13.14, 15.161718, 19.2}, conf2.get_double_array("g2", "k3")); } } TEST(IniParser, writeError) { // Create an empty ini file for writing auto f = fopen(INI_TEMP_FILE, "w"); fclose(f); IniParser conf(INI_TEMP_FILE); // Replace ini file with a directory ASSERT_EQ(0, remove(INI_TEMP_FILE)); ASSERT_EQ(0, mkdir(INI_TEMP_FILE, 0700)); std::shared_ptr rmdir_raii(nullptr, [](void*) { rmdir(INI_TEMP_FILE); }); // Sync (no exception as config is not dirty) EXPECT_NO_THROW(conf.sync()); // Dirty the config conf.set_boolean("g1", "k1", true); // Sync (exception as target is a directory) EXPECT_THROW(conf.sync(), FileException); } lomiri-api-0.2.1/test/gtest/lomiri/util/ResourcePtr/000077500000000000000000000000001443550065200224125ustar00rootroot00000000000000lomiri-api-0.2.1/test/gtest/lomiri/util/ResourcePtr/CMakeLists.txt000066400000000000000000000002221443550065200251460ustar00rootroot00000000000000add_executable(ResourcePtr_test ResourcePtr_test.cpp) target_link_libraries(ResourcePtr_test ${TESTLIBS}) add_test(ResourcePtr ResourcePtr_test) lomiri-api-0.2.1/test/gtest/lomiri/util/ResourcePtr/ResourcePtr_test.cpp000066400000000000000000000321241443550065200264340ustar00rootroot00000000000000/* * Copyright (C) 2013 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authored by: Michi Henning */ #include #include #include #include #include using namespace std; using namespace lomiri; using namespace lomiri::util; namespace { std::set allocated; // Tracks allocated resources } // // Fake allocation and deallocation functions. // int* alloc_int(int p) { int* pointer = reinterpret_cast(p); allocated.insert(pointer); return pointer; } int dealloc_int(int* i) { auto it = allocated.find(i); EXPECT_NE(it, allocated.end()); allocated.erase(it); return 0; } // // Check that allocator and deallocator are called with the correct argument // and that get() returns the correct value. // TEST(ResourcePtr, basic) { { ResourcePtr rp(dealloc_int); EXPECT_FALSE(rp.has_resource()); } { ResourcePtr rp(alloc_int(99), dealloc_int); EXPECT_EQ(allocated.size(), 1); EXPECT_NE(allocated.find(rp.get()), allocated.end()); EXPECT_TRUE(rp.has_resource()); } EXPECT_TRUE(allocated.empty()); } // // A deallocator that expects two arguments. We use std::bind to call it as if it expected only one. // int dealloc_string_int(string const& s, int* i) { EXPECT_EQ(s, "Hello"); dealloc_int(i); return 0; } // // Check that calling with bind works as expected. // TEST(ResourcePtr, bind) { { auto call_dealloc = std::bind(&dealloc_string_int, "Hello", std::placeholders::_1); ResourcePtr rp(alloc_int(42), call_dealloc); EXPECT_EQ(allocated.size(), 1); EXPECT_NE(allocated.find(rp.get()), allocated.end()); } EXPECT_TRUE(allocated.empty()); } // // Check that reset assigns the new pointer value. // TEST(ResourcePtr, reset) { ResourcePtr rp(alloc_int(77), dealloc_int); EXPECT_EQ(allocated.size(), 1); EXPECT_NE(allocated.find(rp.get()), allocated.end()); rp.reset(alloc_int(33)); EXPECT_EQ(allocated.size(), 1); EXPECT_EQ(allocated.find((int*)77), allocated.end()); EXPECT_NE(allocated.find((int*)33), allocated.end()); rp.reset(alloc_int(10)); rp.reset(alloc_int(20)); // Will deallocate the previous resource, so this will not cause a leak. } // // Check that dealloc deallocates and can be called multiple times without ill effects. // TEST(ResourcePtr, dealloc) { ResourcePtr rp(dealloc_int); rp.reset(alloc_int(77)); EXPECT_EQ(allocated.size(), 1); EXPECT_NE(allocated.find(rp.get()), allocated.end()); rp.dealloc(); EXPECT_EQ(allocated.size(), 0); EXPECT_FALSE(rp.has_resource()); rp.dealloc(); EXPECT_EQ(allocated.size(), 0); EXPECT_FALSE(rp.has_resource()); rp.reset(alloc_int(33)); EXPECT_EQ(allocated.size(), 1); EXPECT_NE(allocated.find((int*)33), allocated.end()); EXPECT_TRUE(rp.has_resource()); rp.dealloc(); EXPECT_EQ(allocated.size(), 0); EXPECT_FALSE(rp.has_resource()); rp.dealloc(); EXPECT_EQ(allocated.size(), 0); EXPECT_FALSE(rp.has_resource()); } int dealloc_throw(int* i) { auto it = allocated.find(i); EXPECT_NE(it, allocated.end()); allocated.erase(it); throw 99; } // // Test that things work correctly if the deleter throws. // TEST(ResourcePtr, dealloc_throw) { { ResourcePtr rp(dealloc_throw); rp.reset(alloc_int(77)); try { rp.dealloc(); } catch (int i) { EXPECT_EQ(99, i); EXPECT_FALSE(rp.has_resource()); } } { // Same test again, but this time by causing the deallocation via reset(). ResourcePtr rp(dealloc_throw); rp.reset(alloc_int(77)); try { rp.reset(alloc_int(66)); } catch (int i) { EXPECT_EQ(99, i); EXPECT_TRUE(rp.has_resource()); // True because rp now owns the new resource } } { // Same test again, but this time by letting the destructor do // the deallocation. try { ResourcePtr rp(dealloc_throw); rp.reset(alloc_int(77)); } catch (...) { FAIL(); } } } // // get() without a resource throws. // TEST(ResourcePtr, get_throw) { ResourcePtr rp(dealloc_int); try { rp.get(); FAIL(); } catch (std::logic_error const& e) { EXPECT_STREQ("get() called on ResourcePtr without resource", e.what()); } rp.reset(alloc_int(99)); rp.dealloc(); try { rp.get(); FAIL(); } catch (std::logic_error const& e) { EXPECT_STREQ("get() called on ResourcePtr without resource", e.what()); } } // // Check that release() releases the resource and throws if there is no resource to release. // TEST(ResourcePtr, release) { ResourcePtr rp(dealloc_int); rp.reset(alloc_int(99)); EXPECT_TRUE(rp.has_resource()); rp.release(); EXPECT_FALSE(rp.has_resource()); try { rp.release(); FAIL(); } catch (std::logic_error const& e) { EXPECT_STREQ("release() called on ResourcePtr without resource", e.what()); } } // // operator bool() // TEST(ResourcePtr, operator_bool) { { ResourcePtr rp(dealloc_int); if (rp) { FAIL(); } } { ResourcePtr rp(alloc_int(99), dealloc_int); if (!rp) { FAIL(); } } } // // get_deleter() (two versions) // TEST(ResourcePtr, get_deleter) { ResourcePtr rp(dealloc_int); EXPECT_EQ(rp.get_deleter(), &dealloc_int); const ResourcePtr rp_const(dealloc_int); EXPECT_EQ(rp_const.get_deleter(), &dealloc_int); } class Comparable { public: Comparable() : i_(0) { } Comparable(int i) : i_(i) { } bool operator<(Comparable const& rhs) const { return i_ < rhs.i_; } bool operator==(Comparable const& rhs) const { return i_ == rhs.i_; } int get() const { return i_; } private: int i_; }; void no_op(Comparable) {} // Dummy deallocation function ResourcePtr make_comparable(int i) { return ResourcePtr(Comparable(i), no_op); } // // Check move constructor and move assignment operator // TEST(ResourcePtr, move) { { ResourcePtr rp(dealloc_int); ResourcePtr rp2(std::move(rp)); EXPECT_FALSE(rp.has_resource()); EXPECT_FALSE(rp2.has_resource()); } { ResourcePtr rp(dealloc_int); rp.reset(alloc_int(99)); ResourcePtr rp2(std::move(rp)); EXPECT_FALSE(rp.has_resource()); EXPECT_TRUE(rp2.has_resource()); EXPECT_EQ(allocated.size(), 1); EXPECT_NE(allocated.find((int*)99), allocated.end()); } { ResourcePtr rp(dealloc_int); rp = std::move(ResourcePtr(dealloc_int)); EXPECT_FALSE(rp.has_resource()); } { ResourcePtr rp(dealloc_int); rp.reset(alloc_int(99)); EXPECT_TRUE(rp.has_resource()); rp = std::move(ResourcePtr(dealloc_int)); EXPECT_FALSE(rp.has_resource()); EXPECT_TRUE(allocated.empty()); } { ResourcePtr rp(dealloc_int); rp.reset(alloc_int(99)); rp = std::move(ResourcePtr(alloc_int(42), dealloc_int)); EXPECT_TRUE(rp.has_resource()); EXPECT_EQ(allocated.size(), 1); EXPECT_NE(allocated.find((int*)42), allocated.end()); } { ResourcePtr r(make_comparable(53)); EXPECT_EQ(53, r.get().get()); } { ResourcePtr r(no_op); r = make_comparable(44); EXPECT_EQ(44, r.get().get()); } } TEST(ResourcePtr, comparisons) { { ResourcePtr zero(Comparable(0), no_op); ResourcePtr one(Comparable(1), no_op); ResourcePtr no_init(no_op); EXPECT_TRUE(no_init == no_init); EXPECT_FALSE(zero == no_init); EXPECT_FALSE(no_init == zero); EXPECT_FALSE(zero == one); EXPECT_TRUE(zero == zero); EXPECT_TRUE(zero != one); EXPECT_TRUE(no_init < zero); EXPECT_FALSE(no_init < no_init); EXPECT_FALSE(zero < no_init); EXPECT_TRUE(zero < one); EXPECT_FALSE(one < zero); EXPECT_FALSE(zero < zero); EXPECT_TRUE(zero <= one); EXPECT_TRUE(one <= one); EXPECT_FALSE(one <= zero); EXPECT_TRUE(one > zero); EXPECT_FALSE(zero > one); EXPECT_FALSE(one > one); EXPECT_TRUE(one >= zero); EXPECT_TRUE(one >= one); EXPECT_FALSE(zero >= one); } } TEST(ResourcePtr, swap) { { ResourcePtr zero(Comparable(0), no_op); ResourcePtr one(Comparable(1), no_op); ResourcePtr no_init(no_op); // Member swap zero.swap(one); EXPECT_EQ(zero.get(), 1); EXPECT_EQ(one.get(), 0); // Non-member swap lomiri::util::swap(one, no_init); EXPECT_TRUE(no_init.has_resource()); EXPECT_FALSE(one.has_resource()); // Self-swap zero.swap(zero); EXPECT_EQ(zero.get(), 1); } } TEST(ResourcePtr, std_specializations) { ResourcePtr nr1(no_op); ResourcePtr nr2(no_op); ResourcePtr zero(Comparable(0), no_op); ResourcePtr one(Comparable(1), no_op); std::equal_to> equal; std::not_equal_to> not_equal; std::less> less; std::less_equal> less_equal; std::greater> greater; std::greater_equal> greater_equal; EXPECT_TRUE(equal.operator()(nr1, nr2)); EXPECT_FALSE(equal.operator()(nr1, one)); EXPECT_FALSE(equal.operator()(one, nr1)); EXPECT_TRUE(equal.operator()(one, one)); EXPECT_FALSE(equal.operator()(zero, one)); EXPECT_FALSE(not_equal.operator()(nr1, nr2)); EXPECT_TRUE(not_equal.operator()(nr1, one)); EXPECT_TRUE(not_equal.operator()(one, nr1)); EXPECT_FALSE(not_equal.operator()(one, one)); EXPECT_TRUE(not_equal.operator()(zero, one)); EXPECT_FALSE(less.operator()(nr1, nr2)); EXPECT_TRUE(less.operator()(nr1, one)); EXPECT_FALSE(less.operator()(one, nr1)); EXPECT_FALSE(less.operator()(one, one)); EXPECT_TRUE(less.operator()(zero, one)); EXPECT_FALSE(less.operator()(one, zero)); EXPECT_TRUE(less_equal.operator()(nr1, nr2)); EXPECT_TRUE(less_equal.operator()(nr1, one)); EXPECT_FALSE(less_equal.operator()(one, nr1)); EXPECT_TRUE(less_equal.operator()(one, one)); EXPECT_TRUE(less_equal.operator()(zero, one)); EXPECT_FALSE(less_equal.operator()(one, zero)); EXPECT_FALSE(greater.operator()(nr1, nr2)); EXPECT_FALSE(greater.operator()(nr1, one)); EXPECT_TRUE(greater.operator()(one, nr1)); EXPECT_FALSE(greater.operator()(one, one)); EXPECT_FALSE(greater.operator()(zero, one)); EXPECT_TRUE(greater.operator()(one, zero)); EXPECT_TRUE(greater_equal.operator()(nr1, nr2)); EXPECT_FALSE(greater_equal.operator()(nr1, one)); EXPECT_TRUE(greater_equal.operator()(one, nr1)); EXPECT_TRUE(greater_equal.operator()(one, one)); EXPECT_FALSE(greater_equal.operator()(zero, one)); EXPECT_TRUE(greater_equal.operator()(one, zero)); } lomiri-api-0.2.1/test/gtest/lomiri/util/SnapPath/000077500000000000000000000000001443550065200216535ustar00rootroot00000000000000lomiri-api-0.2.1/test/gtest/lomiri/util/SnapPath/CMakeLists.txt000066400000000000000000000002131443550065200244070ustar00rootroot00000000000000add_executable(SnapPath_test SnapPath_test.cpp) target_link_libraries(SnapPath_test ${LIBS} ${TESTLIBS}) add_test(SnapPath SnapPath_test) lomiri-api-0.2.1/test/gtest/lomiri/util/SnapPath/SnapPath_test.cpp000066400000000000000000000021041443550065200251310ustar00rootroot00000000000000/* * Copyright (C) 2016-2017 Canonical Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * */ #include "lomiri/util/SnapPath.h" #include using namespace lomiri::util; namespace { TEST(Utilities, testPrependSnapPathSet) { ASSERT_EQ(0, setenv("SNAP", "/snap", 1)); EXPECT_EQ("/snap/bar", prepend_snap_path("/bar")); ASSERT_EQ(0, unsetenv("SNAP")); } TEST(Utilities, testPrependSnapPathUnset) { ASSERT_EQ(0, unsetenv("SNAP")); EXPECT_EQ("/bar", prepend_snap_path("/bar")); } } // namespace lomiri-api-0.2.1/test/gtest/lomiri/util/internal/000077500000000000000000000000001443550065200217515ustar00rootroot00000000000000lomiri-api-0.2.1/test/gtest/lomiri/util/internal/CMakeLists.txt000066400000000000000000000000001443550065200244770ustar00rootroot00000000000000lomiri-api-0.2.1/test/headers/000077500000000000000000000000001443550065200161525ustar00rootroot00000000000000lomiri-api-0.2.1/test/headers/CMakeLists.txt000066400000000000000000000027051443550065200207160ustar00rootroot00000000000000# # Test that all header files compile stand-alone and that no public header includes an internal one. # set(root_inc_dir ${CMAKE_SOURCE_DIR}/include) set(subdirs lomiri lomiri/api lomiri/util ) set(exclusions "GioMemory.h" "GlibMemory.h" "GObjectMemory.h" ) foreach(dir ${subdirs}) string(REPLACE "/" "-" location ${dir}) set(public_inc_dir ${root_inc_dir}/${dir}) set(internal_inc_dir ${public_inc_dir}/internal) # Test that each public header compiles stand-alone. add_test(stand-alone-${location}-headers ${CMAKE_CURRENT_SOURCE_DIR}/compile_headers.py ${public_inc_dir} ${CMAKE_CXX_COMPILER} "-I${root_inc_dir} -I${public_inc_dir} ${CMAKE_CXX_FLAGS}" "--exclusions" ${exclusions}) # Test that each internal header compiles stand-alone, # if internal headers exist. if(EXISTS ${internal_inc_dir}) add_test(stand-alone-${location}-internal-headers ${CMAKE_CURRENT_SOURCE_DIR}/compile_headers.py ${internal_inc_dir} ${CMAKE_CXX_COMPILER} "-I${root_inc_dir} -I${internal_inc_dir} ${CMAKE_CXX_FLAGS}" "--exclusions" ${exclusions}) endif(EXISTS ${internal_inc_dir}) # Test that no public header includes an internal header add_test(clean-public-${location}-headers ${CMAKE_CURRENT_SOURCE_DIR}/check_public_headers.py ${public_inc_dir}) endforeach(dir) add_test(cleanincludes ${CMAKE_CURRENT_SOURCE_DIR}/includechecker.py ${CMAKE_SOURCE_DIR}/include) lomiri-api-0.2.1/test/headers/check_public_headers.py000077500000000000000000000061761443550065200226470ustar00rootroot00000000000000#! /usr/bin/env python3 # # Copyright (C) 2013 Canonical Ltd # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License version 3 as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see . # # Authored by: Michi Henning # # # Little helper program to test that public header files don't include internal header files. # # Usage: check_public_headers.py directory # # The directory specifies the location of the header files. All files in that directory ending in .h (but not # in subdirectories) are tested. # import argparse import os import sys import re # # Write the supplied message to stderr, preceded by the program name. # def error(msg): print(os.path.basename(sys.argv[0]) + ": " + msg, file=sys.stderr) # # Write the supplied message to stdout, preceded by the program name. # def message(msg): print(os.path.basename(sys.argv[0]) + ": " + msg) # # For each of the supplied headers, check whether that header includes something in an internal directory. # Return the count of headers that do this. # def test_files(hdr_dir, hdrs): num_errs = 0 for hdr in hdrs: try: hdr_name = os.path.join(hdr_dir, hdr) file = open(hdr_name, "r") except OSError as e: error("cannot open \"" + hdr_name + "\": " + e.strerror) sys.exit(1) include_pat = re.compile(r'#[ \t]*include[ \t]+[<"](.*?)[>"]') lines = file.readlines() line_num = 0 for l in lines: line_num += 1 include_mo = include_pat.match(l) if include_mo: hdr_path = include_mo.group(1) if 'internal/' in hdr_path: num_errs += 1 # Yes, write to stdout because this is expected output message(hdr_name + " includes an internal header at line " + str(line_num) + ": " + hdr_path) return num_errs def run(): # # Parse arguments. # parser = argparse.ArgumentParser(description = 'Test that no public header includes an internal header.') parser.add_argument('dir', nargs = 1, help = 'The directory to look for header files ending in ".h"') args = parser.parse_args() # # Find all the .h files in specified directory and look for #include directives that mention "internal/". # hdr_dir = args.dir[0] try: files = os.listdir(hdr_dir) except OSError as e: error("cannot open \"" + hdr_dir + "\": " + e.strerror) sys.exit(1) hdrs = [hdr for hdr in files if hdr.endswith('.h')] if test_files(hdr_dir, hdrs) != 0: sys.exit(1) # Errors were reported earlier if __name__ == '__main__': run() lomiri-api-0.2.1/test/headers/compile_headers.py000077500000000000000000000140751443550065200216610ustar00rootroot00000000000000#! /usr/bin/env python3 # # Copyright (C) 2013 Canonical Ltd # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License version 3 as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see . # # Authored by: Michi Henning # # # Little helper program to test that header files are stand-alone compilable (and therefore don't depend on # other headers being included first). # # Usage: compile_headers.py directory compiler [compiler_flags] # # The directory specifies the location of the header files. All files in that directory ending in .h (but not # in subdirectories) are tested. # # The compiler argument specifies the compiler to use (such as "gcc"), and the compiler_flags argument (which # must be a single string argument, not a bunch of separate strings) specifies any additional flags, such # as "-I -g". The flags need not include "-c". # # For each header file in the specified directory, the script create a corresponding .cpp that includes the # header file. The .cpp file is created in the current directory (which isn't necessarily the same one as # the directory the header files are in). The script runs the compiler on the generated .cpp file and, if the # compiler returns non-zero exit status, it prints a message (on stdout) reporting the failure. # # The script does not stop if a file fails to compile. If all source files compile successfully, no output (other # than the output from the compiler) is written, and the exit status is zero. If one or more files do not compile, # or there are any other errors, such as not being able to open a file, exit status is non-zero. # # Messages about files that fail to compile are written to stdout. Message about other problems, such as non-existent # files and the like, are written to stderr. # # The compiler's output goes to whatever stream the compiler writes to and is left alone. # import argparse import os import re import shlex import subprocess import sys import tempfile # # Write the supplied message to stderr, preceded by the program name. # def error(msg): print(os.path.basename(sys.argv[0]) + ": " + msg, file=sys.stderr) # # Write the supplied message to stdout, preceded by the program name. # def message(msg): print(os.path.basename(sys.argv[0]) + ": " + msg) # # Create a source file in the current directory that includes the specified header, compile it, # and check exit status from the compiler. Throw if the compile command itself fails, # return False if the compile command worked but reported errors, True if the compile succeeded. # def run_compiler(hdr, compiler, copts, verbose): try: src = tempfile.NamedTemporaryFile(suffix='.cpp', dir='.') src.write(bytes("#include <" + hdr + ">" + "\n", 'UTF-8')) src.flush() # Need this to make the file visible src_name = os.path.join('.', src.name) if verbose: print(compiler + " -c " + src_name + " " + copts) status = subprocess.call([compiler, "-c", src_name] + shlex.split(copts)) if status != 0: message("cannot compile \"" + hdr + "\"") # Yes, write to stdout because this is expected output obj = os.path.splitext(src_name)[0] + ".o" try: os.unlink(obj) except: pass gcov = os.path.splitext(src_name)[0] + ".gcno" try: os.unlink(gcov) except: pass return status == 0 except OSError as e: error(e.strerror) raise # # For each of the supplied headers, create a source file in the current directory that includes the header # and then try to compile the header. Returns normally if all files could be compiled successfully and # throws, otherwise. # def test_files(hdrs, compiler, copts, verbose): num_errs = 0 for h in hdrs: try: if not run_compiler(h, compiler, copts, verbose): num_errs += 1 except OSError: num_errs += 1 pass # Error reported already if num_errs != 0: msg = str(num_errs) + " file" if num_errs != 1: msg += "s" msg += " failed to compile" message(msg) # Yes, write to stdout because this is expected output sys.exit(1) def run(): # # Parse arguments. # parser = argparse.ArgumentParser(description = 'Test that all headers in the passed directory compile stand-alone.') parser.add_argument('-v', '--verbose', action='store_true', help = 'Trace invocations of the compiler') parser.add_argument('dir', nargs = 1, help = 'The directory to look for header files ending in ".h"') parser.add_argument('compiler', nargs = 1, help = 'The compiler executable, such as "gcc"') parser.add_argument('copts', nargs = '?', default="", help = 'The compiler options (excluding -c), such as "-g -Wall -I." as a single string.') parser.add_argument('--exclusions', nargs = '*', help = 'Header files to ignore, e.g. "foo.h bar.h"') args = parser.parse_args() exclusions = args.exclusions # # Find all the .h files in specified directory and do the compilation for each one. # hdr_dir = args.dir[0] try: files = os.listdir(hdr_dir) except OSError as e: msg = "cannot open \"" + hdr_dir + "\": " + e.strerror error(msg) sys.exit(1) hdrs = [hdr for hdr in files if (hdr.endswith('.h') and hdr not in exclusions)] try: test_files(hdrs, args.compiler[0], args.copts, args.verbose) except OSError: sys.exit(1) # Errors were written earlier if __name__ == '__main__': run() lomiri-api-0.2.1/test/headers/includechecker.py000077500000000000000000000063451443550065200215070ustar00rootroot00000000000000#!/usr/bin/python3 -tt # Copyright (C) 2013 Canonical Ltd # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License version 3 as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see . # # Authored by: Jussi Pakkanen """A script that traverses all header files in a given directory and scans them for forbidden includes.""" import os, sys, stat forbidden = {'boost', 'gobject', 'gtk', 'Qt', 'dbus.h', 'glib', 'gtest', } # # List of exceptions. For each of the directory prefixes in the list, allow the #include directive to start # with one of the specified prefixes. # allowed = { 'lomiri/shell': { 'Qt' }, # Anything under lomiri/shell can include anything starting with Qt 'lomiri/util/GObjectMemory': { 'glib' }, # The lomiri/util/GObjectMemory header can include anything starting with glib 'lomiri/util/GlibMemory': { 'glib' }, # The lomiri/util/GlibMemory header can include anything starting with glib 'lomiri/util/GioMemory': { 'glib' }, # The lomiri/util/GioMemory header can include anything starting with glib } def check_file(filename, permitted_includes): errors_found = False linenum = 1 for line in open(filename, encoding='utf-8'): line = line.strip() if line.startswith('#include'): for f in (forbidden - permitted_includes): if f in line: msg = 'Forbidden include: %s:%d - %s'\ % (filename, linenum, line) print(msg) errors_found = True; linenum += 1 return errors_found def check_headers(incdir): errors_found = False suffixes = ('h', 'hpp', 'hh', 'hxx', 'H', 'h.in', ) for root, dirs, files in os.walk(incdir): if 'internal' in dirs: dirs.remove('internal') for filename in files: if filename.endswith(suffixes): fullname = os.path.join(root, filename) permitted_includes = set() for path, names in allowed.items(): if fullname.startswith(os.path.join(incdir, path)): permitted_includes = names break if check_file(fullname, permitted_includes): errors_found = True return errors_found if __name__ == '__main__': if len(sys.argv) != 2: print(sys.argv[0], '') sys.exit(1) incdir = sys.argv[1] if not stat.S_ISDIR(os.stat(incdir).st_mode): print("Argument", incdir, "is not a directory.") sys.exit(1) if check_headers(incdir): sys.exit(1) lomiri-api-0.2.1/test/lomiri-api-test-config.h.in000066400000000000000000000001771443550065200216040ustar00rootroot00000000000000#ifndef LOMIRI_TEST_CONFIG_H #define LOMIRI_TEST_CONFIG_H #define LOMIRI_API_TEST_DATADIR "@LOMIRI_API_TEST_DATADIR@" #endif lomiri-api-0.2.1/test/qmltest/000077500000000000000000000000001443550065200162305ustar00rootroot00000000000000lomiri-api-0.2.1/test/qmltest/CMakeLists.txt000066400000000000000000000001131443550065200207630ustar00rootroot00000000000000add_subdirectory(modules) add_subdirectory(mocks) add_subdirectory(lomiri) lomiri-api-0.2.1/test/qmltest/lomiri/000077500000000000000000000000001443550065200175235ustar00rootroot00000000000000lomiri-api-0.2.1/test/qmltest/lomiri/CMakeLists.txt000066400000000000000000000000301443550065200222540ustar00rootroot00000000000000add_subdirectory(shell) lomiri-api-0.2.1/test/qmltest/lomiri/shell/000077500000000000000000000000001443550065200206325ustar00rootroot00000000000000lomiri-api-0.2.1/test/qmltest/lomiri/shell/CMakeLists.txt000066400000000000000000000005101443550065200233660ustar00rootroot00000000000000include(QmlTest) set(qmltest_DEFAULT_IMPORT_PATHS ${CMAKE_BINARY_DIR}/test/qmltest/modules ${CMAKE_BINARY_DIR}/test/qmltest/mocks/plugins ) set(qmltest_DEFAULT_PROPERTIES ENVIRONMENT "QT_QPA_PLATFORM=minimal") add_qml_test(notifications Notifications) add_qml_test(launcher Launcher) add_qml_test(application Application) lomiri-api-0.2.1/test/qmltest/lomiri/shell/application/000077500000000000000000000000001443550065200231355ustar00rootroot00000000000000lomiri-api-0.2.1/test/qmltest/lomiri/shell/application/tst_Application.qml000066400000000000000000000162141443550065200270110ustar00rootroot00000000000000/* * Copyright 2013,2015 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michael Zanetti */ import QtQuick 2.0 import QtTest 1.0 import TestUtil 0.1 import Lomiri.Application 0.1 Item { SignalSpy { id: signalSpy } Verifier { id: checkModelVerifier property var model: ApplicationManager function test_model_data() { return [ { tag: "ApplicationManager[object]", type: "object" }, { tag: "ApplicationManager[ApplicationManagerInterface]", type: "lomiri::shell::application::ApplicationManagerInterface" }, ]; } function test_model(data) { object = model; name = "ApplicationManager" verifyData(data); } } Verifier { when: checkModelVerifier.completed Repeater { id: repeater model: ApplicationManager delegate: Item { property var roles: model } } /* make sure all the required roles are exposed on ApplicationManager */ function test_model_roles_enum_data() { return [ { enum: "RoleAppId" }, { enum: "RoleName" }, { enum: "RoleComment" }, { enum: "RoleIcon" }, { enum: "RoleState" }, { enum: "RoleFocused" }, { enum: "RoleIsTouchApp" }, { enum: "RoleExemptFromLifecycle" }, ]; } function test_model_roles_enum(data) { name = "ApplicationManager" object = ApplicationManager verifyData(data); } function test_model_roles_data() { return [ { tag: "ApplicationManager.roles[appId]", role: "appId", type: "string" }, { tag: "ApplicationManager.roles[name]", role: "name", type: "string" }, { tag: "ApplicationManager.roles[comment]", role: "comment", type: "string" }, { tag: "ApplicationManager.roles[icon]", role: "icon", type: "object" }, { tag: "ApplicationManager.roles[state]", role: "state", type: "number" }, { tag: "ApplicationManager.roles[focused]", role: "focused", type: "boolean" }, { tag: "ApplicationManager.roles[isTouchApp]", role: "isTouchApp", type: "boolean" }, { tag: "ApplicationManager.roles[exemptFromLifecycle]", role: "exemptFromLifecycle", type: "boolean" }, ]; } function test_model_roles(data) { name = "ApplicationManager" try { object = repeater.itemAt(0).roles; } catch(err) { object = undefined; } verifyData(data); } function test_model_methods_data() { return [ { tag: "ApplicationManager.methods[get]", method: "get" }, { tag: "ApplicationManager.methods[findApplication]", method: "findApplication" }, { tag: "ApplicationManager.methods[requestFocusApplication]", method: "requestFocusApplication" }, { tag: "ApplicationManager.methods[focusApplication]", method: "focusApplication" }, { tag: "ApplicationManager.methods[unfocusCurrentApplication]", method: "unfocusCurrentApplication" }, { tag: "ApplicationManager.methods[startApplication]", method: "startApplication" }, { tag: "ApplicationManager.methods[stopApplication]", method: "stopApplication" }, ]; } function test_model_methods(data) { name = "ApplicationManager"; object = ApplicationManager; verifyData(data); } function test_model_properties_data() { return [ { tag: "ApplicationManager.count", property: "count", type: "number" }, { tag: "ApplicationManager.focusedApplicationId", property: "focusedApplicationId", type: "string" }, ]; } function test_model_properties(data) { name = "ApplicationManager"; object = ApplicationManager; verifyData(data); } function test_item_properties_data() { return [ { tag: "ApplicationInfo.properties[appId]", constant: "appId", type: "string" }, { tag: "ApplicationInfo.properties[name]", property: "name", type: "string" }, { tag: "ApplicationInfo.properties[comment]", property: "comment", type: "string" }, { tag: "ApplicationInfo.properties[icon]", property: "icon", type: "object" }, { tag: "ApplicationInfo.properties[state]", property: "state", type: "number" }, { tag: "ApplicationInfo.properties[requestedState]", property: "requestedState", type: "number" }, { tag: "ApplicationInfo.properties[focused]", property: "focused", type: "boolean" }, { tag: "ApplicationInfo.properties[isTouchApp]", constant: "isTouchApp", type: "boolean" }, { tag: "ApplicationInfo.properties[exemptFromLifecycle]", constant: "exemptFromLifecycle", type: "boolean" }, { tag: "ApplicationInfo.properties[splashTitle]", constant: "splashTitle", type: "string" }, { tag: "ApplicationInfo.properties[splashImage]", constant: "splashImage", type: "url" }, { tag: "ApplicationInfo.properties[splashShowHeader]", constant: "splashShowHeader", type: "boolean"}, { tag: "ApplicationInfo.properties[splashColor]", constant: "splashColor", type: "color"}, { tag: "ApplicationInfo.properties[splashColorHeader]", constant: "splashColorHeader", type: "color"}, { tag: "ApplicationInfo.properties[splashColorFooter]", constant: "splashColorFooter", type: "color"}, { tag: "ApplicationInfo.properties[supportedOrientations]", constant: "supportedOrientations", type: "number"}, { tag: "ApplicationInfo.properties[rotatesWindowContents]", constant: "rotatesWindowContents", type: "boolean"}, ]; } function test_item_properties(data) { name = "ApplicationInfo" try { object = ApplicationManager.get(0) } catch(err) { object = undefined; print(err) } verifyData(data) } } } lomiri-api-0.2.1/test/qmltest/lomiri/shell/launcher/000077500000000000000000000000001443550065200224335ustar00rootroot00000000000000lomiri-api-0.2.1/test/qmltest/lomiri/shell/launcher/tst_Launcher.qml000066400000000000000000000177631443550065200256170ustar00rootroot00000000000000/* * Copyright 2013-2016 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ import QtQuick 2.0 import QtTest 1.0 import TestUtil 0.1 import Lomiri.Launcher 0.1 Item { SignalSpy { id: signalSpy } Verifier { id: checkModelVerifier property var model: LauncherModel function test_model_data() { return [ { tag: "LauncherModel[object]", type: "object" }, { tag: "LauncherModel[LauncherModelInterface]", type: "lomiri::shell::launcher::LauncherModelInterface" }, ]; } function test_model(data) { object = model; name = "LauncherModel" verifyData(data); } } Verifier { when: checkModelVerifier.completed Repeater { id: repeater model: LauncherModel delegate: Item { property var roles: model } } Repeater { id: quickListRepeater model: LauncherModel.get(0).quickList delegate: Item { property var roles: model } } Repeater { id: appDrawerRepeater model: AppDrawerModel {} delegate: Item { property var roles: model } } function initTestCase() { if (repeater.count < 5) { print("This Test Suite requires at least 5 items in the model.") fail() } } /* make sure all the required roles are exposed on Model */ function test_model_roles_data() { return [ { tag: "Model.roles[appId]", role: "appId", type: "string" }, { tag: "Model.roles[name]", role: "name", type: "string" }, { tag: "Model.roles[icon]", role: "icon", type: "string" }, { tag: "Model.roles[pinned]", role: "pinned", type: "boolean" }, { tag: "Model.roles[running]", role: "running", type: "boolean" }, { tag: "Model.roles[recent]", role: "recent", type: "boolean" }, { tag: "Model.roles[progress]", role: "progress", type: "number" }, { tag: "Model.roles[count]", role: "count", type: "number" }, { tag: "Model.roles[countVisible]", role: "countVisible", type: "boolean" }, { tag: "Model.roles[focused]", role: "focused", type: "boolean" }, { tag: "Model.roles[alerting]", role: "alerting", type: "boolean" }, { tag: "Model.roles[surfaceCount]", role: "surfaceCount", type: "number" }, ]; } function test_model_roles(data) { name = "LauncherModel" try { object = repeater.itemAt(0).roles; } catch(err) { object = undefined; } verifyData(data); } function test_model_methods_data() { return [ { tag: "Model.methods[get]", method: "get" }, { tag: "Model.methods[move]", method: "move" }, { tag: "Model.methods[pin]", method: "pin" }, { tag: "Model.methods[requestRemove]", method: "requestRemove" }, { tag: "Model.methods[quickListActionInvoked]", method: "quickListActionInvoked" }, { tag: "Model.methods[setUser]", method: "setUser" }, ]; } function test_model_methods(data) { name = "LauncherModel" object = LauncherModel; verifyData(data); } function test_model_properties_data() { return [ { tag: "Model.properties[applicationManager]", property: "applicationManager", type: "lomiri::shell::application::ApplicationManagerInterface" }, { tag: "Model.properties[onlyPinned]", property: "onlyPinned", type: "boolean" }, ]; } function test_model_properties(data) { name = "LauncherModel"; object = LauncherModel; verifyData(data); } function test_item_properties_data() { return [ { tag: "Item.properties[appId]", constant: "appId", type: "string" }, { tag: "Item.properties[name]", constant: "name", type: "string" }, { tag: "Item.properties[icon]", constant: "icon", type: "string" }, { tag: "Item.properties[keywords]", constant: "keywords", type: "object" }, { tag: "Item.properties[popularity]", constant: "popularity", type: "number" }, { tag: "Item.properties[pinned]", property: "pinned", type: "boolean" }, { tag: "Item.properties[recent]", property: "recent", type: "boolean" }, { tag: "Item.properties[running]", property: "running", type: "boolean" }, { tag: "Item.properties[progress]", property: "progress", type: "number" }, { tag: "Item.properties[count]", property: "count", type: "number" }, { tag: "Item.properties[countVisible]", property: "countVisible", type: "boolean" }, { tag: "Item.properties[focused]", property: "focused", type: "boolean" }, { tag: "Item.properties[alerting]", property: "alerting", type: "boolean" }, { tag: "Item.properties[surfaceCount]", property: "surfaceCount", type: "number" }, { tag: "Item.properties[quickList]", constant: "quickList", type: "object" }, ]; } function test_item_properties(data) { name = "LauncherItem" try { object = LauncherModel.get(0) } catch(err) { object = undefined; print(err) } verifyData(data) } function test_quicklist_model_roles_data() { return [ { tag: "Model.roles[label]", role: "label", type: "string" }, { tag: "Model.roles[icon]", role: "icon", type: "string" }, { tag: "Model.roles[clickable]", role: "clickable", type: "boolean" }, { tag: "Model.roles[hasSeparator]", role: "hasSeparator", type: "boolean" }, { tag: "Model.roles[isPrivate]", role: "isPrivate", type: "boolean" } ]; } function test_quicklist_model_roles(data) { name = "QuickListModel" try { object = quickListRepeater.itemAt(0).roles; } catch(err) { object = undefined; } verifyData(data); } function test_appdrawer_model_roles_data() { return [ { tag: "Model.roles[appId]", role: "appId", type: "string" }, { tag: "Model.roles[name]", role: "name", type: "string" }, { tag: "Model.roles[icon]", role: "icon", type: "string" }, { tag: "Model.roles[keywords]", role: "keywords", type: "object" }, { tag: "Model.roles[usage]", role: "usage", type: "number" }, ]; } function test_appdrawer_model_roles(data) { name = "AppDrawerModel" try { object = appDrawerRepeater.itemAt(0).roles; } catch(err) { object = undefined; } verifyData(data); } } } lomiri-api-0.2.1/test/qmltest/lomiri/shell/notifications/000077500000000000000000000000001443550065200235035ustar00rootroot00000000000000lomiri-api-0.2.1/test/qmltest/lomiri/shell/notifications/tst_Notifications.qml000066400000000000000000000236611443550065200277310ustar00rootroot00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ import QtQuick 2.0 import QtTest 1.0 import TestUtil 0.1 import Lomiri.Notifications 0.1 import Lomiri.Notifications.Mocks 0.1 as Mocks Item { Mocks.MockSource { id: mockSource } Verifier { id: typeTestCase property var model: Model property var source: Source function cleanup() { clear(); Source.model = null; Model.confirmationPlaceholder = false; } function test_types_data() { return [ { name: "Urgency", tag: "Urgency.Invalid", enum: "Invalid" }, { name: "Urgency", tag: "Urgency.Low", enum: "Low" }, { name: "Urgency", tag: "Urgency.Normal", enum: "Normal" }, { name: "Urgency", tag: "Urgency.Critical", enum: "Critical" }, { name: "Type", tag: "Type.Invalid", enum: "Invalid" }, { name: "Type", tag: "Type.Confirmation", enum: "Confirmation" }, { name: "Type", tag: "Type.Ephemeral", enum: "Ephemeral" }, { name: "Type", tag: "Type.Interactive", enum: "Ephemeral" }, { name: "Type", tag: "Type.SnapDecision", enum: "SnapDecision" }, { name: "Type", tag: "Type.Placeholder", enum: "Placeholder" }, { name: "Hint", tag: "Hint.Invalid", enum: "Invalid" }, { name: "Hint", tag: "Hint.ButtonTint", enum: "ButtonTint" }, { name: "Hint", tag: "Hint.IconOnly", enum: "IconOnly" }, { name: "Notification", tag: "Notification" }, ]; } function test_types(data) { try { object = eval(data.name); } catch(err) { object = undefined; } name = data.name; verifyData(data); } /* make sure all the required roles are exposed on the NotificationModel */ function test_model_roles_enum_data() { return [ { enum: "RoleType" }, { enum: "RoleUrgency" }, { enum: "RoleId" }, { enum: "RoleSummary" }, { enum: "RoleBody" }, { enum: "RoleValue" }, { enum: "RoleIcon" }, { enum: "RoleSecondaryIcon" }, { enum: "RoleActions" }, { enum: "RoleHints" }, { enum: "RoleNotification" }, ]; } function test_model_roles_enum(data) { object = model name = "Model" verifyData(data); } function test_model_data() { return [ { tag: "Model[object]", type: "object" }, { tag: "Model[ModelInterface]", type: "lomiri::shell::notifications::ModelInterface" }, { tag: "Model.confirmationPlaceholder", writable: "confirmationPlaceholder", type: "boolean", value: !Model.confirmationPlaceholder } ]; } function test_model(data) { object = model; name = "Model" verifyData(data); } function test_source_data() { return [ { tag: "Source[object]", type: "object" }, { tag: "Source[SourceInterface]", type: "lomiri::shell::notifications::SourceInterface" }, { tag: "Source.model", writable: "model", type: "object", value: model }, ]; } function test_source(data) { object = source; name = "Source" verifyData(data); } } Verifier { when: typeTestCase.completed optional: true Repeater { id: repeater delegate: Item { id: item property var roles: model property Repeater actionRepeater: actions Repeater { id: actions model: parent.roles.actions delegate: Item { property var roles: model } } } } SignalSpy { id: dataSpy signalName: "dataChanged" } function initTestCase() { repeater.model = Model; dataSpy.target = Model; mockSource.model = Model; } function init() { tryCompare(repeater, "count", 0); } function cleanup() { Model.confirmationPlaceholder = false; // dismiss all Notifications for (var i = 0; i < repeater.count; i++) { repeater.itemAt(i).roles.notification.dismissed() } dataSpy.clear() tryCompare(repeater, "count", 0); } /* make sure all the required roles are exposed on Model */ function test_model_roles_data() { return [ { tag: "Model.roles[notification]", role: "notification", type: "object" }, { tag: "Model.roles[type]", role: "type", type: "number" }, { tag: "Model.roles[urgency]", role: "urgency", type: "number" }, { tag: "Model.roles[id]", role: "id", type: "number" }, { tag: "Model.roles[summary]", role: "summary", type: "string" }, { tag: "Model.roles[body]", role: "body", type: "string" }, { tag: "Model.roles[value]", role: "value", type: "number" }, { tag: "Model.roles[icon]", role: "icon", type: "object" }, { tag: "Model.roles[secondaryIcon]", role: "secondaryIcon", type: "object" }, { tag: "Model.roles[actions]", role: "actions", type: "object" }, { tag: "Model.roles[hints]", role: "hints", type: "number" }, ]; } function test_model_roles(data) { mockSource.send({}); tryCompare(repeater, "count", 1); try { object = repeater.itemAt(0).roles; } catch(err) { object = undefined; } name = "Model"; verifyData(data); } /* make sure all the members of Notification objects are available */ function test_notification_members_data() { return [ { tag: "Notification.dismissed", signal: "dismissed" }, { tag: "Notification.hovered", signal: "hovered" }, { tag: "Notification.displayed", signal: "displayed" }, { tag: "Notification.actionInvoked", signal: "actionInvoked" } ]; } function test_notification_members(data) { mockSource.send({}); tryCompare(repeater, "count", 1); try { object = repeater.itemAt(0).roles.notification; } catch(err) { object = undefined; } name = "Notification"; verifyData(data); } /* make sure all the required roles for actions are exposed */ function test_action_members_data() { return [ { tag: "actions.roles[label]", role: "label", type: "string" }, { tag: "actions.roles[id]", role: "id", type: "string" } ]; } function test_action_members(data) { mockSource.send({ "actions": [ {"label": "test", "id": "test"} ] }); tryCompare(repeater, "count", 1); tryCompare(repeater.itemAt(0).actionRepeater, "count", 1); try { object = repeater.itemAt(0).actionRepeater.itemAt(0).roles; } catch(err) { object = undefined; } name = "actions"; verifyData(data); } /* make sure the model is empty by default */ function test_empty() { tryCompare(repeater, "count", 0); } /* make sure there is a placeholder item used as the first one when confirmationPlaceholder is true and that any additional notification is added after it */ function test_placeholder() { Model.confirmationPlaceholder = true; tryCompare(repeater, "count", 1); compare(repeater.itemAt(0).roles.type, Type.Placeholder, "the notification should be of Placeholder type"); mockSource.send({ type: Type.Ephemeral }) tryCompare(repeater, "count", 2); compare(repeater.itemAt(0).roles.type, Type.Placeholder, "the first notification should be of Placeholder type"); compare(repeater.itemAt(1).roles.type, Type.Ephemeral, "the second notification should be of Ephemeral type"); } /* make sure the placeholder item is updated with roles incoming in a Confirmation notification */ function test_confirmation() { Model.confirmationPlaceholder = true; tryCompare(repeater, "count", 1); mockSource.send({ "type": Type.Confirmation }); tryCompare(repeater, "count", 1); dataSpy.wait(); compare(repeater.count, 1, "there should be only one notification"); compare(repeater.itemAt(0).roles.type, Type.Confirmation, "the first notification should be of Confirmation type"); } } } lomiri-api-0.2.1/test/qmltest/mocks/000077500000000000000000000000001443550065200173445ustar00rootroot00000000000000lomiri-api-0.2.1/test/qmltest/mocks/CMakeLists.txt000066400000000000000000000002061443550065200221020ustar00rootroot00000000000000add_subdirectory(plugins/Lomiri/Notifications) add_subdirectory(plugins/Lomiri/Launcher) add_subdirectory(plugins/Lomiri/Application) lomiri-api-0.2.1/test/qmltest/mocks/plugins/000077500000000000000000000000001443550065200210255ustar00rootroot00000000000000lomiri-api-0.2.1/test/qmltest/mocks/plugins/Lomiri/000077500000000000000000000000001443550065200222605ustar00rootroot00000000000000lomiri-api-0.2.1/test/qmltest/mocks/plugins/Lomiri/Application/000077500000000000000000000000001443550065200245235ustar00rootroot00000000000000lomiri-api-0.2.1/test/qmltest/mocks/plugins/Lomiri/Application/CMakeLists.txt000066400000000000000000000021511443550065200272620ustar00rootroot00000000000000include_directories( ${CMAKE_SOURCE_DIR}/include/lomiri/shell/application ${CMAKE_CURRENT_SOURCE_DIR} ) add_definitions(-DQT_NO_KEYWORDS) set(CMAKE_AUTOMOC ON) find_package(Qt5Core REQUIRED) find_package(Qt5Gui REQUIRED) find_package(Qt5Quick REQUIRED) find_package(Qt5Qml REQUIRED) set(ApplicationMocks_SOURCES ${CMAKE_SOURCE_DIR}/include/lomiri/shell/application/ApplicationManagerInterface.h ${CMAKE_SOURCE_DIR}/include/lomiri/shell/application/ApplicationInfoInterface.h Mocks/MockApplicationManager.cpp Mocks/MockApplicationInfo.cpp ) add_library(ApplicationMocks SHARED ${ApplicationMocks_SOURCES}) target_link_libraries(ApplicationMocks Qt5::Core Qt5::Gui) set(TestApplicationPlugin_SOURCES TestApplicationPlugin.cpp ) add_library(TestApplicationPlugin MODULE ${TestApplicationPlugin_SOURCES}) target_link_libraries(TestApplicationPlugin Qt5::Core Qt5::Gui Qt5::Quick) target_link_libraries(TestApplicationPlugin ApplicationMocks) add_custom_target(TestApplicationPluginQmldir ALL COMMAND cp "${CMAKE_CURRENT_SOURCE_DIR}/qmldir" "${CMAKE_CURRENT_BINARY_DIR}" DEPENDS qmldir ) lomiri-api-0.2.1/test/qmltest/mocks/plugins/Lomiri/Application/Mocks/000077500000000000000000000000001443550065200255775ustar00rootroot00000000000000lomiri-api-0.2.1/test/qmltest/mocks/plugins/Lomiri/Application/Mocks/MockApplicationInfo.cpp000066400000000000000000000065701443550065200322040ustar00rootroot00000000000000/* * Copyright 2013,2016 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michael Zanetti */ #include using namespace lomiri::shell::application; MockApplicationInfo::MockApplicationInfo(const QString &appId, const QString& comment, const QString& name, const QUrl& icon, QObject* parent): ApplicationInfoInterface(appId, parent), m_appId(appId), m_name(name), m_comment(comment), m_icon(icon), m_state(Running), m_focused(false), m_exemptFromLifecycle(false) { } QString MockApplicationInfo::appId() const { return m_appId; } QString MockApplicationInfo::comment() const { return m_comment; } QString MockApplicationInfo::name() const { return m_name; } QUrl MockApplicationInfo::icon() const { return m_icon; } ApplicationInfoInterface::State MockApplicationInfo::state() const { return m_state; } void MockApplicationInfo::setState(ApplicationInfoInterface::State state) { if (m_state != state) { m_state = state; Q_EMIT stateChanged(m_state); } } bool MockApplicationInfo::focused() const { return m_focused; } void MockApplicationInfo::setFocused(bool focused) { if (m_focused != focused) { m_focused = focused; Q_EMIT focusedChanged(focused); } } bool MockApplicationInfo::showSplash() const { return true; } QString MockApplicationInfo::splashTitle() const { return "Foo Bar"; } QUrl MockApplicationInfo::splashImage() const { return QUrl(); } bool MockApplicationInfo::splashShowHeader() const { return true; } QColor MockApplicationInfo::splashColor() const { return QColor(0,0,0,0); } QColor MockApplicationInfo::splashColorHeader() const { return QColor(0,0,0,0); } QColor MockApplicationInfo::splashColorFooter() const { return QColor(0,0,0,0); } ApplicationInfoInterface::RequestedState MockApplicationInfo::requestedState() const { return RequestedRunning; } void MockApplicationInfo::setRequestedState(RequestedState) { } Qt::ScreenOrientations MockApplicationInfo::supportedOrientations() const { return Qt::PortraitOrientation | Qt::LandscapeOrientation; } bool MockApplicationInfo::rotatesWindowContents() const { return false; } bool MockApplicationInfo::isTouchApp() const { return true; } bool MockApplicationInfo::exemptFromLifecycle() const { return m_exemptFromLifecycle; } void MockApplicationInfo::setExemptFromLifecycle(bool exemptFromLifecycle) { if (m_exemptFromLifecycle != exemptFromLifecycle) { m_exemptFromLifecycle = exemptFromLifecycle; Q_EMIT exemptFromLifecycleChanged(m_exemptFromLifecycle); } } int MockApplicationInfo::surfaceCount() const { return 1; } bool MockApplicationInfo::serverSideDecoration() const { return true; }lomiri-api-0.2.1/test/qmltest/mocks/plugins/Lomiri/Application/Mocks/MockApplicationInfo.h000066400000000000000000000051671443550065200316520ustar00rootroot00000000000000/* * Copyright 2013,2015,2016 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef MOCKAPPLICATIONINFO_H #define MOCKAPPLICATIONINFO_H #include #include using namespace lomiri::shell::application; class LOMIRI_API MockApplicationInfo: public ApplicationInfoInterface { Q_OBJECT public: MockApplicationInfo(const QString &appId, const QString& name, const QString& comment, const QUrl& icon, QObject* parent = 0); void close() override {} QString appId() const override; QString name() const override; QString comment() const override; QUrl icon() const override; ApplicationInfoInterface::State state() const override; void setState(ApplicationInfoInterface::State state); bool focused() const override; void setFocused(bool focused); bool showSplash() const override; QString splashTitle() const override; QUrl splashImage() const override; bool splashShowHeader() const override; QColor splashColor() const override; QColor splashColorHeader() const override; QColor splashColorFooter() const override; RequestedState requestedState() const override; void setRequestedState(RequestedState) override; Qt::ScreenOrientations supportedOrientations() const override; bool rotatesWindowContents() const override; bool isTouchApp() const override; bool exemptFromLifecycle() const override; void setExemptFromLifecycle(bool exemptFromLifecycle) override; QSize initialSurfaceSize() const override { return QSize(); } void setInitialSurfaceSize(const QSize &) override {} MirSurfaceListInterface* surfaceList() const override { return nullptr; } MirSurfaceListInterface* promptSurfaceList() const override { return nullptr; } int surfaceCount() const override; bool serverSideDecoration() const override; private: QString m_appId; QString m_name; QString m_comment; QUrl m_icon; ApplicationInfoInterface::State m_state; bool m_focused; bool m_exemptFromLifecycle; }; #endif // MOCKAPPLICATIONINFO_H lomiri-api-0.2.1/test/qmltest/mocks/plugins/Lomiri/Application/Mocks/MockApplicationManager.cpp000066400000000000000000000072201443550065200326540ustar00rootroot00000000000000/* * Copyright 2013,2015 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michael Zanetti */ #include #include using namespace lomiri::shell::application; MockApplicationManager::MockApplicationManager(QObject* parent): ApplicationManagerInterface(parent) { MockApplicationInfo *item = new MockApplicationInfo("phone-app", "Phone App", "Telephony application", QUrl("/usr/share/pixmaps/some/icon.png"), this); m_list.append(item); item = new MockApplicationInfo("camera-app", "Camera App", "Lets you take pictures with the camera.", QUrl("/usr/share/pixmaps/some/icon.png"), this); m_list.append(item); item = new MockApplicationInfo("calendar-app", "Calendar App", "5 missed reminders", QUrl("/usr/share/pixmaps/some/icon.png"), this); m_list.append(item); } MockApplicationManager::~MockApplicationManager() { while (!m_list.empty()) { m_list.takeFirst()->deleteLater(); } } // cppcheck-suppress unusedFunction int MockApplicationManager::rowCount(const QModelIndex& parent) const { Q_UNUSED(parent) return m_list.count(); } QVariant MockApplicationManager::data(const QModelIndex& index, int role) const { ApplicationInfoInterface *item = m_list.at(index.row()); switch(role) { case RoleAppId: return item->appId(); case RoleName: return item->name(); case RoleComment: return item->comment(); case RoleIcon: return item->icon(); case RoleState: return item->state(); case RoleFocused: return item->focused(); case RoleIsTouchApp: return item->isTouchApp(); case RoleExemptFromLifecycle: return item->exemptFromLifecycle(); } return QVariant(); } lomiri::shell::application::ApplicationInfoInterface *MockApplicationManager::get(int index) const { if (index < 0 || index >= m_list.count()) { return nullptr; } return m_list.at(index); } lomiri::shell::application::ApplicationInfoInterface *MockApplicationManager::findApplication(const QString &appId) const { for (auto app : m_list) { if (app->appId() == appId) { return app; } } return nullptr; } QString MockApplicationManager::focusedApplicationId() const { auto first = m_list.first(); return (first) ? first->appId() : QString(); } bool MockApplicationManager::requestFocusApplication(const QString &appId) { Q_UNUSED(appId) return true; } bool MockApplicationManager::focusApplication(const QString &appId) { Q_UNUSED(appId) return true; } void MockApplicationManager::unfocusCurrentApplication() { } lomiri::shell::application::ApplicationInfoInterface *MockApplicationManager::startApplication(const QString &appId, const QStringList &arguments) { Q_UNUSED(arguments) MockApplicationInfo *item = new MockApplicationInfo(appId, "name", "comment", QUrl()); return item; } bool MockApplicationManager::stopApplication(const QString &appId) { Q_UNUSED(appId) return true; } lomiri-api-0.2.1/test/qmltest/mocks/plugins/Lomiri/Application/Mocks/MockApplicationManager.h000066400000000000000000000041041443550065200323170ustar00rootroot00000000000000/* * Copyright 2013,2015 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michael Zanetti */ #ifndef MOCKAPPLICATIONMANAGER_H #define MOCKAPPLICATIONMANAGER_H #include using namespace lomiri::shell::application; class MockApplicationInfo; class LOMIRI_API MockApplicationManager: public ApplicationManagerInterface { Q_OBJECT public: MockApplicationManager(QObject* parent = 0); ~MockApplicationManager(); int rowCount(const QModelIndex& parent) const override; QVariant data(const QModelIndex& index, int role) const override; QString focusedApplicationId() const override; Q_INVOKABLE lomiri::shell::application::ApplicationInfoInterface *get(const int index) const override; Q_INVOKABLE lomiri::shell::application::ApplicationInfoInterface *findApplication(const QString &appId) const override; ApplicationInfoInterface *findApplicationWithSurface(MirSurfaceInterface*) const override { return nullptr; } Q_INVOKABLE bool requestFocusApplication(const QString &appId) override; Q_INVOKABLE bool focusApplication(const QString &appId); Q_INVOKABLE void unfocusCurrentApplication(); Q_INVOKABLE lomiri::shell::application::ApplicationInfoInterface *startApplication(const QString &appId, const QStringList &arguments) override; Q_INVOKABLE bool stopApplication(const QString &appId) override; private: QList m_list; }; #endif // MOCKAPPLICATIONMANAGER_H lomiri-api-0.2.1/test/qmltest/mocks/plugins/Lomiri/Application/TestApplicationPlugin.cpp000066400000000000000000000033751443550065200315210ustar00rootroot00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michael Zanetti */ #include #include #include #include #include #include using namespace lomiri::shell::application; static QObject* modelProvider(QQmlEngine* /* engine */, QJSEngine* /* scriptEngine */) { return new MockApplicationManager(); } // cppcheck-suppress unusedFunction void TestApplicationPlugin::registerTypes(const char* uri) { // @uri Lomiri.Application qmlRegisterUncreatableType(uri, 0, 1, "ApplicationManagerInterface", "Interface for the ApplicationManager"); qmlRegisterUncreatableType(uri, 0, 1, "ApplicationInfoInterface", "Interface for the ApplicationInfo"); qmlRegisterSingletonType(uri, 0, 1, "ApplicationManager", modelProvider); qmlRegisterUncreatableType(uri, 0, 1, "ApplicationInfo", "Can't create ApplicationInfos in QML. Get them from the ApplicationManager"); } lomiri-api-0.2.1/test/qmltest/mocks/plugins/Lomiri/Application/TestApplicationPlugin.h000066400000000000000000000020501443550065200311530ustar00rootroot00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michael Zanetti */ #ifndef TESTAPPLICATION_PLUGIN_H #define TESTAPPLICATION_PLUGIN_H #include class TestApplicationPlugin : public QQmlExtensionPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") public: void registerTypes(const char* uri) override; }; #endif // TESTAPPLICATION_PLUGIN_H lomiri-api-0.2.1/test/qmltest/mocks/plugins/Lomiri/Application/qmldir000066400000000000000000000000671443550065200257410ustar00rootroot00000000000000module Lomiri.Application plugin TestApplicationPlugin lomiri-api-0.2.1/test/qmltest/mocks/plugins/Lomiri/Launcher/000077500000000000000000000000001443550065200240215ustar00rootroot00000000000000lomiri-api-0.2.1/test/qmltest/mocks/plugins/Lomiri/Launcher/CMakeLists.txt000066400000000000000000000032671443550065200265710ustar00rootroot00000000000000include_directories( ${CMAKE_SOURCE_DIR}/include/lomiri/shell/launcher ${CMAKE_SOURCE_DIR}/include/lomiri/shell/application ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../Application/ ) add_definitions(-DQT_NO_KEYWORDS) set(CMAKE_AUTOMOC ON) find_package(Qt5Core REQUIRED) find_package(Qt5Quick REQUIRED) find_package(Qt5Qml REQUIRED) set(LauncherMocks_SOURCES ${CMAKE_SOURCE_DIR}/include/lomiri/shell/launcher/LauncherModelInterface.h ${CMAKE_SOURCE_DIR}/include/lomiri/shell/launcher/LauncherItemInterface.h ${CMAKE_SOURCE_DIR}/include/lomiri/shell/launcher/QuickListModelInterface.h ${CMAKE_SOURCE_DIR}/include/lomiri/shell/launcher/AppDrawerModelInterface.h ${CMAKE_SOURCE_DIR}/include/lomiri/shell/application/ApplicationManagerInterface.h ${CMAKE_SOURCE_DIR}/include/lomiri/shell/application/ApplicationInfoInterface.h Mocks/MockLauncherModel.cpp Mocks/MockLauncherItem.cpp Mocks/MockQuickListModel.cpp Mocks/MockAppDrawerModel.cpp ${CMAKE_CURRENT_SOURCE_DIR}/../Application/Mocks/MockApplicationManager.cpp ${CMAKE_CURRENT_SOURCE_DIR}/../Application/Mocks/MockApplicationInfo.cpp ) add_library(LauncherMocks SHARED ${LauncherMocks_SOURCES}) #find_package(Qt5Gui REQUIRED) target_link_libraries(LauncherMocks Qt5::Core Qt5::Gui) set(TestLauncherPlugin_SOURCES TestLauncherPlugin.cpp ) add_library(TestLauncherPlugin MODULE ${TestLauncherPlugin_SOURCES}) target_link_libraries(TestLauncherPlugin Qt5::Core Qt5::Quick) target_link_libraries(TestLauncherPlugin LauncherMocks) add_custom_target(TestLauncherPluginQmldir ALL COMMAND cp "${CMAKE_CURRENT_SOURCE_DIR}/qmldir" "${CMAKE_CURRENT_BINARY_DIR}" DEPENDS qmldir ) lomiri-api-0.2.1/test/qmltest/mocks/plugins/Lomiri/Launcher/Mocks/000077500000000000000000000000001443550065200250755ustar00rootroot00000000000000lomiri-api-0.2.1/test/qmltest/mocks/plugins/Lomiri/Launcher/Mocks/MockAppDrawerModel.cpp000066400000000000000000000070211443550065200312610ustar00rootroot00000000000000/* * Copyright 2016 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include using namespace lomiri::shell::launcher; MockAppDrawerModel::MockAppDrawerModel(QObject* parent): AppDrawerModelInterface(parent) { MockLauncherItem *item = new MockLauncherItem("phone-app", "/usr/share/applications/phone-app.desktop", "Phone", "phone-app", this); item->setKeywords({"keyword1", "keyword2"}); m_list.append(item); item = new MockLauncherItem("camera-app", "/usr/share/applications/camera-app.desktop", "Camera", "camera", this); item->setKeywords({"keyword1", "keyword2"}); m_list.append(item); item = new MockLauncherItem("gallery-app", "/usr/share/applications/gallery-app.desktop", "Gallery", "gallery", this); item->setKeywords({"keyword1", "keyword2"}); m_list.append(item); item = new MockLauncherItem("facebook-webapp", "/usr/share/applications/facebook-webapp.desktop", "Facebook", "facebook", this); item->setKeywords({"keyword1", "keyword2"}); m_list.append(item); item = new MockLauncherItem("webbrowser-app", "/usr/share/applications/webbrowser-app.desktop", "Browser", "browser", this); item->setKeywords({"keyword1", "keyword2"}); m_list.append(item); item = new MockLauncherItem("twitter-webapp", "/usr/share/applications/twitter-webapp.desktop", "Twitter", "twitter", this); item->setKeywords({"keyword1", "keyword2"}); m_list.append(item); item = new MockLauncherItem("gmail-webapp", "/usr/share/applications/gmail-webapp.desktop", "GMail", "gmail", this); item->setKeywords({"keyword1", "keyword2"}); m_list.append(item); item = new MockLauncherItem("ubuntu-weather-app", "/usr/share/applications/ubuntu-weather-app.desktop", "Weather", "weather", this); item->setKeywords({"keyword1", "keyword2"}); m_list.append(item); item = new MockLauncherItem("notes-app", "/usr/share/applications/notes-app.desktop", "Notepad", "notepad", this); item->setKeywords({"keyword1", "keyword2"}); m_list.append(item); item = new MockLauncherItem("ubuntu-calendar-app", "/usr/share/applications/ubuntu-calendar-app.desktop","Calendar", "calendar", this); item->setKeywords({"keyword1", "keyword2"}); m_list.append(item); } MockAppDrawerModel::~MockAppDrawerModel() { while (!m_list.empty()) { m_list.takeFirst()->deleteLater(); } } // cppcheck-suppress unusedFunction int MockAppDrawerModel::rowCount(const QModelIndex& parent) const { Q_UNUSED(parent) return m_list.count(); } QVariant MockAppDrawerModel::data(const QModelIndex& index, int role) const { LauncherItemInterface *item = m_list.at(index.row()); switch(role) { case RoleAppId: return item->appId(); case RoleName: return item->name(); case RoleIcon: return item->icon(); case RoleKeywords: return item->keywords(); case RoleUsage: return 1; } return QVariant(); } lomiri-api-0.2.1/test/qmltest/mocks/plugins/Lomiri/Launcher/Mocks/MockAppDrawerModel.h000066400000000000000000000021261443550065200307270ustar00rootroot00000000000000/* * Copyright 2016 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #pragma once #include class MockLauncherItem; using namespace lomiri::shell::launcher; class LOMIRI_API MockAppDrawerModel: public AppDrawerModelInterface { Q_OBJECT public: MockAppDrawerModel(QObject* parent = 0); ~MockAppDrawerModel(); int rowCount(const QModelIndex& parent) const override; QVariant data(const QModelIndex& index, int role) const override; private: QList m_list; }; lomiri-api-0.2.1/test/qmltest/mocks/plugins/Lomiri/Launcher/Mocks/MockLauncherItem.cpp000066400000000000000000000076531443550065200310060ustar00rootroot00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michael Zanetti */ #include #include using namespace lomiri::shell::launcher; MockLauncherItem::MockLauncherItem(const QString &appId, const QString& desktopFile, const QString& name, const QString& icon, QObject* parent): LauncherItemInterface(parent), m_appId(appId), m_desktopFile(desktopFile), m_name(name), m_icon(icon), m_popularity(0), m_pinned(false), m_running(false), m_recent(false), m_progress(8), m_count(8), m_countVisible(false), m_alerting(false), m_surfaceCount(1), m_quickListModel(new MockQuickListModel(this)) { } QString MockLauncherItem::appId() const { return m_appId; } QString MockLauncherItem::desktopFile() const { return m_desktopFile; } QString MockLauncherItem::name() const { return m_name; } QString MockLauncherItem::icon() const { return m_icon; } QStringList MockLauncherItem::keywords() const { return m_keywords; } void MockLauncherItem::setKeywords(const QStringList &keywords) { if (m_keywords != keywords) { m_keywords = keywords; Q_EMIT keywordsChanged(m_keywords); } } uint MockLauncherItem::popularity() const { return m_popularity; } void MockLauncherItem::setPopularity(uint popularity) { if (m_popularity != popularity) { m_popularity = popularity; Q_EMIT popularityChanged(m_popularity); } } bool MockLauncherItem::pinned() const { return m_pinned; } void MockLauncherItem::setPinned(bool pinned) { if (m_pinned != pinned) { m_pinned = pinned; Q_EMIT pinnedChanged(m_pinned); } } bool MockLauncherItem::running() const { return m_running; } void MockLauncherItem::setRunning(bool running) { if (m_running != running) { m_running = running; Q_EMIT runningChanged(running); } } bool MockLauncherItem::recent() const { return m_recent; } void MockLauncherItem::setRecent(bool recent) { if (m_recent != recent) { m_recent = recent; Q_EMIT recentChanged(recent); } } int MockLauncherItem::progress() const { return m_progress; } void MockLauncherItem::setProgress(int progress) { if (m_progress != progress) { m_progress = progress; Q_EMIT progressChanged(progress); } } int MockLauncherItem::count() const { return m_count; } void MockLauncherItem::setCount(int count) { if (m_count != count) { m_count = count; Q_EMIT countChanged(count); } } bool MockLauncherItem::countVisible() const { return m_countVisible; } void MockLauncherItem::setCountVisible(bool countVisible) { if (m_countVisible != countVisible) { m_countVisible = countVisible; Q_EMIT countVisibleChanged(countVisible); } } bool MockLauncherItem::focused() const { return m_focused; } void MockLauncherItem::setFocused(bool focused) { if (m_focused != focused) { m_focused = focused; Q_EMIT focusedChanged(focused); } } bool MockLauncherItem::alerting() const { return m_alerting; } int MockLauncherItem::surfaceCount() const { return m_surfaceCount; } QuickListModelInterface *MockLauncherItem::quickList() const { return m_quickListModel; } lomiri-api-0.2.1/test/qmltest/mocks/plugins/Lomiri/Launcher/Mocks/MockLauncherItem.h000066400000000000000000000046651443550065200304530ustar00rootroot00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michael Zanetti */ #ifndef MOCKLAUNCHERITEM_H #define MOCKLAUNCHERITEM_H #include #include using namespace lomiri::shell::launcher; class LOMIRI_API MockLauncherItem: public LauncherItemInterface { Q_OBJECT public: MockLauncherItem(const QString &appId, const QString& desktopFile, const QString& name, const QString& icon, QObject* parent = 0); QString appId() const override; QString desktopFile() const; QString name() const override; QString icon() const override; QStringList keywords() const override; void setKeywords(const QStringList &keywords); uint popularity() const override; void setPopularity(uint popularity); bool pinned() const override; void setPinned(bool pinned); bool running() const override; void setRunning(bool running); bool recent() const override; void setRecent(bool recent); int progress() const override; void setProgress(int progress); int count() const override; void setCount(int count); bool countVisible() const override; void setCountVisible(bool countVisible); bool focused() const override; void setFocused(bool focused); bool alerting() const override; int surfaceCount() const override; lomiri::shell::launcher::QuickListModelInterface *quickList() const override; private: QString m_appId; QString m_desktopFile; QString m_name; QString m_icon; QStringList m_keywords; uint m_popularity; bool m_pinned; bool m_running; bool m_recent; int m_progress; int m_count; bool m_countVisible; bool m_focused; bool m_alerting; int m_surfaceCount; QuickListModelInterface *m_quickListModel; }; #endif // MOCKLAUNCHERITEM_H lomiri-api-0.2.1/test/qmltest/mocks/plugins/Lomiri/Launcher/Mocks/MockLauncherModel.cpp000066400000000000000000000114531443550065200311410ustar00rootroot00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michael Zanetti */ #include #include #include "../../Application/Mocks/MockApplicationManager.h" using namespace lomiri::shell::launcher; MockLauncherModel::MockLauncherModel(QObject* parent): LauncherModelInterface(parent) { MockLauncherItem *item = new MockLauncherItem("phone-app", "/usr/share/applications/phone-app.desktop", "Phone", "phone-app", this); m_list.append(item); item = new MockLauncherItem("camera-app", "/usr/share/applications/camera-app.desktop", "Camera", "camera", this); m_list.append(item); item = new MockLauncherItem("gallery-app", "/usr/share/applications/gallery-app.desktop", "Gallery", "gallery", this); m_list.append(item); item = new MockLauncherItem("facebook-webapp", "/usr/share/applications/facebook-webapp.desktop", "Facebook", "facebook", this); m_list.append(item); item = new MockLauncherItem("webbrowser-app", "/usr/share/applications/webbrowser-app.desktop", "Browser", "browser", this); m_list.append(item); item = new MockLauncherItem("twitter-webapp", "/usr/share/applications/twitter-webapp.desktop", "Twitter", "twitter", this); m_list.append(item); item = new MockLauncherItem("gmail-webapp", "/usr/share/applications/gmail-webapp.desktop", "GMail", "gmail", this); m_list.append(item); item = new MockLauncherItem("ubuntu-weather-app", "/usr/share/applications/ubuntu-weather-app.desktop", "Weather", "weather", this); m_list.append(item); item = new MockLauncherItem("notes-app", "/usr/share/applications/notes-app.desktop", "Notepad", "notepad", this); m_list.append(item); item = new MockLauncherItem("ubuntu-calendar-app", "/usr/share/applications/ubuntu-calendar-app.desktop","Calendar", "calendar", this); m_list.append(item); } MockLauncherModel::~MockLauncherModel() { while (!m_list.empty()) { m_list.takeFirst()->deleteLater(); } } // cppcheck-suppress unusedFunction int MockLauncherModel::rowCount(const QModelIndex& parent) const { Q_UNUSED(parent) return m_list.count(); } QVariant MockLauncherModel::data(const QModelIndex& index, int role) const { LauncherItemInterface *item = m_list.at(index.row()); switch(role) { case RoleAppId: return item->appId(); case RoleName: return item->name(); case RoleIcon: return item->icon(); case RolePinned: return item->pinned(); case RoleRunning: return item->running(); case RoleRecent: return item->recent(); case RoleProgress: return item->progress(); case RoleCount: return item->count(); case RoleCountVisible: return item->countVisible(); case RoleFocused: return item->focused(); case RoleAlerting: return item->alerting(); case RoleSurfaceCount: return item->surfaceCount(); } return QVariant(); } LauncherItemInterface *MockLauncherModel::get(int index) const { if (index < 0 || index >= m_list.count()) { return 0; } return m_list.at(index); } void MockLauncherModel::move(int oldIndex, int newIndex) { Q_UNUSED(oldIndex) Q_UNUSED(newIndex) } void MockLauncherModel::pin(const QString &appId, int index) { Q_UNUSED(appId) Q_UNUSED(index) } void MockLauncherModel::requestRemove(const QString &appId) { Q_UNUSED(appId) } void MockLauncherModel::quickListActionInvoked(const QString &appId, int actionIndex) { Q_UNUSED(appId) Q_UNUSED(actionIndex) } void MockLauncherModel::setUser(const QString &user) { Q_UNUSED(user) } lomiri::shell::application::ApplicationManagerInterface *MockLauncherModel::applicationManager() const { lomiri::shell::application::ApplicationManagerInterface* appManager = new MockApplicationManager(); appManager->deleteLater(); return appManager; } void MockLauncherModel::setApplicationManager(lomiri::shell::application::ApplicationManagerInterface *applicationManager) { Q_UNUSED(applicationManager) } bool MockLauncherModel::onlyPinned() const { return false; } void MockLauncherModel::setOnlyPinned(bool onlyPinned) { Q_UNUSED(onlyPinned) } lomiri-api-0.2.1/test/qmltest/mocks/plugins/Lomiri/Launcher/Mocks/MockLauncherModel.h000066400000000000000000000041151443550065200306030ustar00rootroot00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michael Zanetti */ #ifndef MOCKLAUNCHERMODEL_H #define MOCKLAUNCHERMODEL_H #include #include class MockLauncherItem; using namespace lomiri::shell::launcher; class LOMIRI_API MockLauncherModel: public LauncherModelInterface { Q_OBJECT public: MockLauncherModel(QObject* parent = 0); ~MockLauncherModel(); int rowCount(const QModelIndex& parent) const override; QVariant data(const QModelIndex& index, int role) const override; Q_INVOKABLE lomiri::shell::launcher::LauncherItemInterface *get(int index) const override; Q_INVOKABLE void move(int oldIndex, int newIndex) override; Q_INVOKABLE void pin(const QString &appId, int index = -1) override; Q_INVOKABLE void requestRemove(const QString &appId) override; Q_INVOKABLE void quickListActionInvoked(const QString &appId, int actionIndex) override; Q_INVOKABLE void setUser(const QString &user) override; lomiri::shell::application::ApplicationManagerInterface *applicationManager() const override; void setApplicationManager(lomiri::shell::application::ApplicationManagerInterface *applicationManager) override; bool onlyPinned() const override; void setOnlyPinned(bool onlyPinned) override; private: int findApp(const QString &appId); private: QList m_list; }; #endif // MOCKLAUNCHERMODEL_H lomiri-api-0.2.1/test/qmltest/mocks/plugins/Lomiri/Launcher/Mocks/MockQuickListModel.cpp000066400000000000000000000026371443550065200313140ustar00rootroot00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michael Zanetti */ #include using namespace lomiri::shell::launcher; MockQuickListModel::MockQuickListModel(QObject *parent) : QuickListModelInterface(parent) { } QVariant MockQuickListModel::data(const QModelIndex &index, int role) const { switch (role) { case RoleLabel: return QLatin1String("test menu entry ") + QString::number(index.row()); case RoleIcon: return QLatin1String("copy.png"); case RoleClickable: return true; case RoleHasSeparator: return true; case RoleIsPrivate: return false; } return QVariant(); } int MockQuickListModel::rowCount(const QModelIndex &parent) const { Q_UNUSED(parent) return 4; } lomiri-api-0.2.1/test/qmltest/mocks/plugins/Lomiri/Launcher/Mocks/MockQuickListModel.h000066400000000000000000000022301443550065200307460ustar00rootroot00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michael Zanetti */ #ifndef MOCKQUICKLISTMODEL_H #define MOCKQUICKLISTMODEL_H #include using namespace lomiri::shell::launcher; class LOMIRI_API MockQuickListModel: public QuickListModelInterface { Q_OBJECT public: MockQuickListModel(QObject *parent = 0); QVariant data(const QModelIndex &index, int role) const override; int rowCount(const QModelIndex &parent = QModelIndex()) const override; }; #endif // MOCKQUICKLISTMODEL_H lomiri-api-0.2.1/test/qmltest/mocks/plugins/Lomiri/Launcher/TestLauncherPlugin.cpp000066400000000000000000000051101443550065200303020ustar00rootroot00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michael Zanetti */ #include #include #include #include #include #include #include #include #include using namespace lomiri::shell::launcher; using namespace lomiri::shell::application; static QObject* modelProvider(QQmlEngine* /* engine */, QJSEngine* /* scriptEngine */) { return new MockLauncherModel(); } // cppcheck-suppress unusedFunction void TestLauncherPlugin::registerTypes(const char* uri) { // @uri Lomiri.Launcher qmlRegisterUncreatableType(uri, 0, 1, "LauncherModelInterface", "Interface for the LauncherModel"); qmlRegisterUncreatableType(uri, 0, 1, "LauncherItemInterface", "Interface for the LauncherItem"); qmlRegisterUncreatableType(uri, 0, 1, "QuickListModelInterface", "Interface for the QuickListModel"); qmlRegisterUncreatableType(uri, 0, 1, "AppDrawerModelInterface", "Interface for the AppDrawerModel"); qmlRegisterSingletonType(uri, 0, 1, "LauncherModel", modelProvider); qmlRegisterUncreatableType(uri, 0, 1, "LauncherItem", "Can't create LauncherItems in QML. Get them from the LauncherModel"); qmlRegisterUncreatableType(uri, 0, 1, "QuickListModel", "Can't create QuickListModels in QML. Get them from the LauncherItems"); qmlRegisterType(uri, 0, 1, "AppDrawerModel"); // Need to register the appmanager here ourselves as there won't be a real AppManager plugin in this test qmlRegisterUncreatableType(uri, 0, 1, "ApplicationManagerInterface", "Interface for the ApplicationManager"); } lomiri-api-0.2.1/test/qmltest/mocks/plugins/Lomiri/Launcher/TestLauncherPlugin.h000066400000000000000000000020341443550065200277510ustar00rootroot00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michael Zanetti */ #ifndef TESTLAUNCHER_PLUGIN_H #define TESTLAUNCHER_PLUGIN_H #include class TestLauncherPlugin : public QQmlExtensionPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") public: void registerTypes(const char* uri) override; }; #endif // TESTLAUNCHER_PLUGIN_H lomiri-api-0.2.1/test/qmltest/mocks/plugins/Lomiri/Launcher/qmldir000066400000000000000000000000611443550065200252310ustar00rootroot00000000000000module Lomiri.Launcher plugin TestLauncherPlugin lomiri-api-0.2.1/test/qmltest/mocks/plugins/Lomiri/Notifications/000077500000000000000000000000001443550065200250715ustar00rootroot00000000000000lomiri-api-0.2.1/test/qmltest/mocks/plugins/Lomiri/Notifications/CMakeLists.txt000066400000000000000000000022761443550065200276400ustar00rootroot00000000000000include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ) add_definitions(-DQT_NO_KEYWORDS) set(CMAKE_AUTOMOC ON) find_package(Qt5Core REQUIRED) find_package(Qt5Quick REQUIRED) set(NotificationsMocks_SOURCES ${CMAKE_SOURCE_DIR}/include/lomiri/shell/notifications/Enums.h ${CMAKE_SOURCE_DIR}/include/lomiri/shell/notifications/ModelInterface.h ${CMAKE_SOURCE_DIR}/include/lomiri/shell/notifications/SourceInterface.h ${CMAKE_SOURCE_DIR}/include/lomiri/shell/notifications/NotificationInterface.h Mocks/MockModel.cpp Mocks/MockSource.cpp Mocks/MockNotification.cpp Mocks/MockActionModel.cpp ) add_library(NotificationsMocks SHARED ${NotificationsMocks_SOURCES}) target_link_libraries(NotificationsMocks Qt5::Core) set(TestNotificationsPlugin_SOURCES TestNotificationsPlugin.cpp ) add_library(TestNotificationsPlugin MODULE ${TestNotificationsPlugin_SOURCES}) target_link_libraries(TestNotificationsPlugin Qt5::Core Qt5::Quick) target_link_libraries(TestNotificationsPlugin NotificationsMocks) add_custom_target(TestNotificationsPluginQmldir ALL COMMAND cp "${CMAKE_CURRENT_SOURCE_DIR}/qmldir" "${CMAKE_CURRENT_BINARY_DIR}" DEPENDS qmldir ) add_subdirectory(Mocks) lomiri-api-0.2.1/test/qmltest/mocks/plugins/Lomiri/Notifications/Mocks/000077500000000000000000000000001443550065200261455ustar00rootroot00000000000000lomiri-api-0.2.1/test/qmltest/mocks/plugins/Lomiri/Notifications/Mocks/CMakeLists.txt000066400000000000000000000007731443550065200307140ustar00rootroot00000000000000set(MockNotificationsPlugin_SOURCES MockNotificationsPlugin.cpp ) add_library(MockNotificationsPlugin MODULE ${MockNotificationsPlugin_SOURCES}) #find_package(Qt5Core REQUIRED) #find_package(Qt5Quick REQUIRED) target_link_libraries(MockNotificationsPlugin Qt5::Core Qt5::Quick) target_link_libraries(MockNotificationsPlugin NotificationsMocks) add_custom_target(MockNotificationsPluginQmldir ALL COMMAND cp "${CMAKE_CURRENT_SOURCE_DIR}/qmldir" "${CMAKE_CURRENT_BINARY_DIR}" DEPENDS qmldir ) lomiri-api-0.2.1/test/qmltest/mocks/plugins/Lomiri/Notifications/Mocks/MockActionModel.cpp000066400000000000000000000034711443550065200316660ustar00rootroot00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michał Sawicz */ #include #include #include #include MockActionModel::MockActionModel(QObject* parent) : QAbstractListModel(parent) , m_notification(qobject_cast(parent)) { m_roles.insert(Label, "label"); m_roles.insert(Id, "id"); } int // cppcheck-suppress unusedFunction MockActionModel::rowCount(const QModelIndex& /* parent */) const { if (m_notification && m_notification->m_data.contains("actions")) { QVariantList actions = m_notification->m_data["actions"].value(); return actions.count(); } return 0; } QVariant MockActionModel::data(const QModelIndex &index, int role) const { QVariantMap action = m_notification->m_data["actions"].value()[index.row()].value(); if (role == Label) { return action["label"]; } else if (role == Id) { return action["id"]; } else { return QVariant(); } } QHash MockActionModel::roleNames() const { return m_roles; } lomiri-api-0.2.1/test/qmltest/mocks/plugins/Lomiri/Notifications/Mocks/MockActionModel.h000066400000000000000000000026551443550065200313360ustar00rootroot00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michał Sawicz */ #ifndef MOCKACTIONMODEL_H #define MOCKACTIONMODEL_H #include #include class MockNotification; class LOMIRI_API MockActionModel : public QAbstractListModel { Q_OBJECT public: explicit MockActionModel(QObject *parent = 0); int rowCount(const QModelIndex& parent) const override; QVariant data(const QModelIndex &index, int role) const override; QHash roleNames() const override; enum RoleEnum { Label = Qt::DisplayRole, Id = Qt::UserRole }; Q_ENUM(RoleEnum) private: QHash m_roles; MockNotification* m_notification; }; Q_DECLARE_METATYPE(MockActionModel*) #endif // MOCKACTIONMODEL_H lomiri-api-0.2.1/test/qmltest/mocks/plugins/Lomiri/Notifications/Mocks/MockModel.cpp000066400000000000000000000135211443550065200305250ustar00rootroot00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michał Sawicz */ #include #include #include #include #include #include #include using namespace lomiri::shell::notifications; MockModel::MockModel(QObject* parent) : ModelInterface(parent) , m_confirmationPlaceholder(false) { m_roles.insert(Summary, "summary"); m_roles.insert(Notification, "notification"); m_roles.insert(Id, "id"); m_roles.insert(Type, "type"); m_roles.insert(Urgency, "urgency"); m_roles.insert(Body, "body"); m_roles.insert(Value, "value"); m_roles.insert(Icon, "icon"); m_roles.insert(SecondaryIcon, "secondaryIcon"); m_roles.insert(Hints, "hints"); m_roles.insert(Actions, "actions"); } int MockModel::rowCount(const QModelIndex &parent) const { Q_UNUSED(parent); return m_list.count(); } QVariant MockModel::data(const QModelIndex &index, int role) const { if (!index.isValid()) { return QVariant(); } MockNotification* notification = m_list.at(index.row()); if (role == Summary) { return QVariant(""); } else if (role == Notification) { return QVariant::fromValue(notification); } else if (role == Id) { return QVariant(index.row()); } else if (role == Type) { if (notification->m_data.contains("type")) { return notification->m_data["type"]; } else { return QVariant((int)lomiri::shell::notifications::Type::TypeEnum::Invalid); } } else if (role == Urgency) { return QVariant((int)lomiri::shell::notifications::Urgency::UrgencyEnum::Invalid); } else if (role == Body) { return QVariant(""); } else if (role == Value) { return QVariant(0); } else if (role == Icon) { return QVariant::fromValue(QUrl("")); } else if (role == SecondaryIcon) { return QVariant::fromValue(QUrl("")); } else if (role == Hints) { return QVariant(lomiri::shell::notifications::Hint::Invalid); } else if (role == Actions) { return QVariant::fromValue(notification->m_actions); } return QVariant(); } QHash MockModel::roleNames() const { return m_roles; } void MockModel::setConfirmationPlaceholder(bool confirmationPlaceholder) { if (m_confirmationPlaceholder != confirmationPlaceholder) { m_confirmationPlaceholder = confirmationPlaceholder; if (m_confirmationPlaceholder) { MockNotification* notification = new MockNotification(this); notification->m_data.insert("type", (int)lomiri::shell::notifications::Type::TypeEnum::Placeholder); connect(notification, SIGNAL(dismissed()), SLOT(onDismissed())); beginInsertRows(QModelIndex(), 0, 0); m_list.insert(0, notification); endInsertRows(); } else { if (m_list.count() > 0 && m_list.at(0)->m_data.contains("type") && m_list.at(0)->m_data["type"] == (int)lomiri::shell::notifications::Type::TypeEnum::Placeholder) { MockNotification* notification = m_list.at(0); beginRemoveRows(QModelIndex(), 0, 0); m_list.removeAt(0); endRemoveRows(); notification->deleteLater(); } } Q_EMIT confirmationPlaceholderChanged(m_confirmationPlaceholder); } } void MockModel::add(MockNotification* notification) { connect(notification, SIGNAL(dismissed()), SLOT(onDismissed())); int row = -1; if (m_confirmationPlaceholder && notification->m_data.contains("type") && notification->m_data["type"] == (int)lomiri::shell::notifications::Type::TypeEnum::Confirmation) { MockNotification* placeholder = m_list.at(0); placeholder->m_data["type"] = (int)lomiri::shell::notifications::Type::TypeEnum::Confirmation; Q_EMIT dataChanged(index(0), index(0)); } else if (m_confirmationPlaceholder) { row = 1; } else { row = 0; } if (row >= 0) { beginInsertRows(QModelIndex(), row, row); m_list.insert(row, notification); endInsertRows(); } } void MockModel::onDismissed() { MockNotification* notification = qobject_cast(sender()); int row = m_list.indexOf(notification); if (row >= 0) { if (m_confirmationPlaceholder && notification->m_data.contains("type") && notification->m_data["type"] == (int)lomiri::shell::notifications::Type::TypeEnum::Confirmation) { notification->m_data["type"] = (int)lomiri::shell::notifications::Type::TypeEnum::Placeholder; Q_EMIT dataChanged(index(0), index(0)); } else { beginRemoveRows(QModelIndex(), row, row); m_list.removeAt(row); endRemoveRows(); } } } lomiri-api-0.2.1/test/qmltest/mocks/plugins/Lomiri/Notifications/Mocks/MockModel.h000066400000000000000000000037021443550065200301720ustar00rootroot00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michał Sawicz */ #ifndef MOCKMODEL_H #define MOCKMODEL_H #include #include #include #include using namespace lomiri::shell::notifications; class MockNotification; class LOMIRI_API MockModel : public ModelInterface { Q_OBJECT public: MockModel(QObject* parent = 0); int rowCount(const QModelIndex &parent = QModelIndex()) const override; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; QHash roleNames() const override; bool confirmationPlaceholder() const override { return m_confirmationPlaceholder; } void setConfirmationPlaceholder(bool confirmationPlaceholder) override; void add(MockNotification* notification); enum RoleEnum { Summary = Qt::DisplayRole, Notification = Qt::UserRole, Id, Type, Urgency, Body, Value, Icon, SecondaryIcon, Hints, Actions }; Q_ENUM(RoleEnum) private: bool m_confirmationPlaceholder; QHash m_roles; QList m_list; private Q_SLOTS: void onDismissed(); }; #endif // MOCKMODEL_H lomiri-api-0.2.1/test/qmltest/mocks/plugins/Lomiri/Notifications/Mocks/MockNotification.cpp000066400000000000000000000017301443550065200321120ustar00rootroot00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michał Sawicz */ #include #include MockNotification::MockNotification(QObject* parent) : NotificationInterface(parent) , m_actions(new MockActionModel(this)) { connect(this, SIGNAL(dismissed()), SIGNAL(completed())); } lomiri-api-0.2.1/test/qmltest/mocks/plugins/Lomiri/Notifications/Mocks/MockNotification.h000066400000000000000000000026011443550065200315550ustar00rootroot00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michał Sawicz */ #ifndef MOCKNOTIFICATION_H #define MOCKNOTIFICATION_H #include #include #include using namespace lomiri::shell::notifications; class MockSource; class MockModel; class MockActionModel; class LOMIRI_API MockNotification : public NotificationInterface { friend class MockSource; friend class MockModel; friend class MockActionModel; Q_OBJECT public: explicit MockNotification(QObject *parent = 0); Q_SIGNALS: void completed(); private: QVariantMap m_data; MockActionModel* m_actions; }; Q_DECLARE_METATYPE(MockNotification*) #endif // MOCKNOTIFICATION_H lomiri-api-0.2.1/test/qmltest/mocks/plugins/Lomiri/Notifications/Mocks/MockNotificationsPlugin.cpp000066400000000000000000000022601443550065200334530ustar00rootroot00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michał Sawicz */ #include #include #include #include using namespace lomiri::shell::notifications; void MockNotificationsPlugin::registerTypes(const char *uri) { // @uri Lomiri.Notifications.Mocks qmlRegisterUncreatableType(uri, 0, 1, "SourceInterface", "SourceInterface is an abstract base class"); qmlRegisterType(uri, 0, 1, "MockSource"); } lomiri-api-0.2.1/test/qmltest/mocks/plugins/Lomiri/Notifications/Mocks/MockNotificationsPlugin.h000066400000000000000000000020441443550065200331200ustar00rootroot00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michał Sawicz */ #ifndef MOCKNOTIFICATIONSPLUGIN_H #define MOCKNOTIFICATIONSPLUGIN_H #include class MockNotificationsPlugin : public QQmlExtensionPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") public: void registerTypes(const char *uri) override; }; #endif // MOCKNOTIFICATIONSPLUGIN_H lomiri-api-0.2.1/test/qmltest/mocks/plugins/Lomiri/Notifications/Mocks/MockSource.cpp000066400000000000000000000031561443550065200307300ustar00rootroot00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michał Sawicz */ #include #include #include #include using namespace lomiri::shell::notifications; MockSource::MockSource(QObject *parent) : SourceInterface(parent) , m_model(0) { } ModelInterface* MockSource::model() const { return m_model; } void MockSource::setModel(ModelInterface* model) { MockModel* mockModel = qobject_cast(model); if (m_model != mockModel) { m_model = mockModel; Q_EMIT modelChanged(m_model); } } void MockSource::send(QVariantMap data) { MockNotification* notification = new MockNotification(this); notification->m_data = data; connect(notification, SIGNAL(completed()), SLOT(onCompleted())); if(m_model) { m_model->add(notification); } } void MockSource::onCompleted() { sender()->deleteLater(); } lomiri-api-0.2.1/test/qmltest/mocks/plugins/Lomiri/Notifications/Mocks/MockSource.h000066400000000000000000000027021443550065200303710ustar00rootroot00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michał Sawicz */ #ifndef MOCKSOURCE_H #define MOCKSOURCE_H #include #include #include namespace lomiri { namespace shell { namespace notifications { class ModelInterface; } // namespace notifications } // namespace shell } // namespace lomiri class MockModel; using namespace lomiri::shell::notifications; class LOMIRI_API MockSource : public SourceInterface { Q_OBJECT public: explicit MockSource(QObject *parent = 0); ModelInterface* model() const override; void setModel(ModelInterface* model) override; Q_INVOKABLE void send(QVariantMap data); private Q_SLOTS: void onCompleted(); private: MockModel* m_model; }; #endif // MOCKSOURCE_H lomiri-api-0.2.1/test/qmltest/mocks/plugins/Lomiri/Notifications/Mocks/qmldir000066400000000000000000000001011443550065200273500ustar00rootroot00000000000000module Lomiri.Notifications.Mocks plugin MockNotificationsPlugin lomiri-api-0.2.1/test/qmltest/mocks/plugins/Lomiri/Notifications/TestNotificationsPlugin.cpp000066400000000000000000000045721443550065200324350ustar00rootroot00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michał Sawicz */ #include #include #include #include #include #include #include #include #include using namespace lomiri::shell::notifications; static QObject* modelProvider(QQmlEngine* /* engine */, QJSEngine* /* scriptEngine */) { return new MockModel(); } static QObject* sourceProvider(QQmlEngine* /* engine */, QJSEngine* /* scriptEngine */) { return new MockSource(); } void TestNotificationsPlugin::registerTypes(const char *uri) { // @uri Lomiri.Notifications qmlRegisterUncreatableType(uri, 0, 1, "Urgency", "Urgency is just a enum wrapper"); qmlRegisterUncreatableType(uri, 0, 1, "Type", "Type is just a enum wrapper"); qmlRegisterUncreatableType(uri, 0, 1, "Hint", "Hint is just a enum wrapper"); qmlRegisterUncreatableType(uri, 0, 1, "NotificationInterface", "NotificationInterface is an abstract base class"); qmlRegisterUncreatableType(uri, 0, 1, "ModelInterface", "ModelInterface is an abstract base class"); qmlRegisterUncreatableType(uri, 0, 1, "SourceInterface", "SourceInterface is an abstract base class"); qmlRegisterUncreatableType(uri, 0, 1, "Notification", "Notification objects can only be created by the plugin"); qmlRegisterSingletonType(uri, 0, 1, "Source", sourceProvider); qmlRegisterSingletonType(uri, 0, 1, "Model", modelProvider); } lomiri-api-0.2.1/test/qmltest/mocks/plugins/Lomiri/Notifications/TestNotificationsPlugin.h000066400000000000000000000020471443550065200320750ustar00rootroot00000000000000/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: * Michał Sawicz */ #ifndef TESTNOTIFICATIONS_PLUGIN_H #define TESTNOTIFICATIONS_PLUGIN_H #include class TestNotificationsPlugin : public QQmlExtensionPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") public: void registerTypes(const char *uri) override; }; #endif // TESTNOTIFICATIONS_PLUGIN_H lomiri-api-0.2.1/test/qmltest/mocks/plugins/Lomiri/Notifications/qmldir000066400000000000000000000000731443550065200263040ustar00rootroot00000000000000module Lomiri.Notifications plugin TestNotificationsPlugin lomiri-api-0.2.1/test/qmltest/modules/000077500000000000000000000000001443550065200177005ustar00rootroot00000000000000lomiri-api-0.2.1/test/qmltest/modules/CMakeLists.txt000066400000000000000000000000331443550065200224340ustar00rootroot00000000000000add_subdirectory(TestUtil) lomiri-api-0.2.1/test/qmltest/modules/TestUtil/000077500000000000000000000000001443550065200214555ustar00rootroot00000000000000lomiri-api-0.2.1/test/qmltest/modules/TestUtil/CMakeLists.txt000066400000000000000000000014751443550065200242240ustar00rootroot00000000000000find_package(Qt5Core REQUIRED) find_package(Qt5Quick REQUIRED) set(CMAKE_AUTOMOC ON) add_definitions(-DQT_NO_KEYWORDS) set(TestUtilQML_SOURCES TestUtil.cpp TestUtilPlugin.cpp ) include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ) add_library(TestUtilQml MODULE ${TestUtilQML_SOURCES}) target_link_libraries(TestUtilQml Qt5::Core Qt5::Quick) # copy qmldir file into build directory for shadow builds file(GLOB QML_JS_FILES qmldir *.js *.qml) add_custom_target(TestUtil-qmlfiles ALL COMMAND cp ${QML_JS_FILES} ${CMAKE_CURRENT_BINARY_DIR} DEPENDS ${QML_JS_FILES} SOURCES ${QML_JS_FILES} ) # tests include(QmlTest) add_qml_test(test TestUtil IMPORT_PATHS ${CMAKE_BINARY_DIR}/test/qmltest/modules PROPERTIES ENVIRONMENT "QT_QPA_PLATFORM=minimal" ) lomiri-api-0.2.1/test/qmltest/modules/TestUtil/TestUtil.cpp000066400000000000000000000033421443550065200237400ustar00rootroot00000000000000/* * Copyright (C) 2012, 2013 Canonical, Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include TestUtil::TestUtil(QObject *parent) : QObject(parent) { } TestUtil::~TestUtil() { } bool TestUtil::isInstanceOf(QObject *obj, QString name) { if (!obj) return false; bool result = obj->inherits(name.toUtf8()); if (!result) { const QMetaObject *metaObject = obj->metaObject(); while (!result && metaObject) { const QString className = metaObject->className(); const QString qmlName = className.left(className.indexOf("_QMLTYPE_")); result = qmlName == name; metaObject = metaObject->superClass(); } } return result; } bool TestUtil::objectHasPropertyOfType(QObject *qmlObject, const QString &propertyName, const QString &expectedPropertyTypeName) { if (!qmlObject) return false; QQmlProperty property(qmlObject, propertyName); if (!property.isValid()) return false; if (!property.isProperty()) return false; return QString(property.propertyTypeName()) == expectedPropertyTypeName; } lomiri-api-0.2.1/test/qmltest/modules/TestUtil/TestUtil.h000066400000000000000000000022511443550065200234030ustar00rootroot00000000000000/* * Copyright (C) 2012, 2013 Canonical, Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef TESTUTIL_H #define TESTUTIL_H #include class TestUtil : public QObject { Q_OBJECT Q_DISABLE_COPY(TestUtil) public: TestUtil(QObject *parent = 0); ~TestUtil(); Q_INVOKABLE bool isInstanceOf(QObject*, QString); Q_INVOKABLE bool objectHasPropertyOfType(QObject *qmlObject, const QString &propertyName, const QString &propertyTypeName); }; QML_DECLARE_TYPE(TestUtil) #endif // TESTUTIL_H lomiri-api-0.2.1/test/qmltest/modules/TestUtil/TestUtilPlugin.cpp000066400000000000000000000020561443550065200251200ustar00rootroot00000000000000/* * Copyright (C) 2012, 2013 Canonical, Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include static QObject *testutil_provider(QQmlEngine* /* engine */, QJSEngine* /* scriptEngine */) { return new TestUtil(); } void TestUtilPlugin::registerTypes(const char *uri) { Q_ASSERT(QLatin1String(uri) == QLatin1String("TestUtil")); // @uri TestUtil qmlRegisterSingletonType(uri, 0, 1, "Util", testutil_provider); } lomiri-api-0.2.1/test/qmltest/modules/TestUtil/TestUtilPlugin.h000066400000000000000000000017121443550065200245630ustar00rootroot00000000000000/* * Copyright (C) 2012, 2013 Canonical, Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef TESTUTIL_PLUGIN_H #define TESTUTIL_PLUGIN_H #include class TestUtilPlugin : public QQmlExtensionPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") public: void registerTypes(const char *uri) override; }; #endif // TESTUTIL_PLUGIN_H lomiri-api-0.2.1/test/qmltest/modules/TestUtil/Verifier.qml000066400000000000000000000161551443550065200237530ustar00rootroot00000000000000/* * Copyright (C) 2012, 2013 Canonical, Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ import QtQuick 2.0 import QtTest 1.0 import TestUtil 0.1 TestCase { id: root /* object is the object on which the tests are carried out, name is used to identify the object in human-readable way */ property var object property string name /* these are the default fail strings used during verification they can be overriden here or via optional arguments to the methods below */ property string registeredMsg: strings.registeredMsg property string typeMsg: strings.typeMsg property string propTypeMsg: strings.propTypeMsg property string enumMsg: strings.enumMsg property string constantMsg: strings.constantMsg property string changedMsg: strings.changedMsg property string spyValidMsg: strings.spyValidMsg property string spyClearMsg: strings.spyClearMsg property string writableMsg: strings.writableMsg property string assignmentMsg: strings.assignmentMsg property string roleMsg: strings.roleMsg property string signalMsg: strings.signalMsg property string slotMsg: strings.slotMsg property string methodMsg: strings.methodMsg QtObject { id: strings readonly property string registeredMsg: "%1 should be a registered type" readonly property string typeMsg: "%1 should be of type %2" readonly property string propTypeMsg: "%1.%2 should be of type %3" readonly property string enumMsg: "there should be an %1::%2 enum" readonly property string constantMsg: "%1.%2 should be a property of type %3" readonly property string changedMsg: "%1 should have a %2Changed signal" readonly property string spyValidMsg: "connection to %1.%2Changed failed" readonly property string spyClearMsg: "%1.%2Changed signal emitted spuriously" readonly property string writableMsg: "%1.%2 should be writable" readonly property string assignmentMsg: "assignment to %1.%2 did not work" readonly property string roleMsg: "%1 should expose a \"%2\" role of type %3" readonly property string signalMsg: "there should be a %1.%2 signal" readonly property string slotMsg: "there should be a %1.%2 slot" readonly property string methodMsg: "there should be a %1.%2 method" } SignalSpy { id: spy target: root.object } /* verify that $value is of $type, otherwise fail with $msg */ function verifyType(value, type, msg) { if (value === undefined) { fail(msg); } var baseTypes = ["number", "boolean", "string", "function", "object"]; if (baseTypes.indexOf(type) >= 0) { compare(typeof value, type, msg); } else { compare(typeof value, "object", msg); verify(Util.isInstanceOf(value, type), msg); } } /* verify that $object has $member is of $type, otherwise fail with $msg */ function verifyMember(object, member, type, msg) { if (object === undefined) { fail(msg); } if (type === "url") { if (!Util.objectHasPropertyOfType(object, member, "QUrl")) { fail(msg); } } else if (type === "color") { if (!Util.objectHasPropertyOfType(object, member, "QColor")) { fail(msg); } } else { verifyType(object[member], type, msg); } } /* verify that the object is registered */ function registered(msg) { verifyType(object, "object", (msg || registeredMsg.arg(name))); } /* verify that the object is of $type */ function type(type, msg) { verifyType(object, type, (msg || typeMsg.arg(name).arg(type))); } /* verify that there's a $member of $type */ function propType(member, type, msg) { verifyMember(object, member, type, (msg || propTypeMsg.arg(name).arg(member).arg(type))); } /* verify that there's an enum named $name */ function enums(name, msg) { verifyMember(object, name, "number", (msg || enumMsg.arg(root.name).arg(name))); } /* verify that there's a $prop of $type */ function constant(prop, type, msg) { verifyMember(object, prop, type, (msg || constantMsg.arg(name).arg(prop).arg(type))); } /* verify that there's a $prop of $type and a corresponding $typeChanged signal */ function property(prop, type, msg1, msg2, msg3) { constant(prop, type); verifyMember(object, prop+"Changed", "function", (msg1 || changedMsg.arg(name).arg(prop))); spy.signalName = prop+"Changed"; verify(spy.valid, (msg2 || spyValidMsg.arg(name).arg(prop))); compare(spy.count, 0, (msg3 || spyClearMsg.arg(name).arg(prop))); } /* verify that there's a writable $prop of $type */ function writable(prop, type, value, msg1, msg2, msg3) { property(prop, type); var tmp = object[prop]; try { object[prop] = value; } catch(err) { fail((msg1 || writableMsg.arg(name).arg(prop))); } compare(object[prop], value, (msg2 || assignmentMsg.arg(name).arg(prop))); spy.wait(); object[prop] = tmp; } /* verify that there's a $role of $type exposed */ function role(role, type, msg) { constant(role, type, msg || roleMsg.arg(name).arg(role).arg(type)); } /* _data()-driven test helper */ function verifyData(data) { if (data.enum !== undefined) { enums(data.enum); } else if (data.constant !== undefined) { constant(data.constant, data.type); } else if (data.property !== undefined) { property(data.property, data.type); } else if (data.writable !== undefined) { writable(data.writable, data.type, data.value); } else if (data.role !== undefined) { role(data.role, data.type); } else if (data.signal !== undefined) { propType(data.signal, "function", signalMsg.arg(name).arg(data.signal)); } else if (data.slot !== undefined) { propType(data.slot, "function", slotMsg.arg(name).arg(data.slot)); } else if (data.method !== undefined) { propType(data.method, "function", methodMsg.arg(name).arg(data.method)); } else if (data.type !== undefined) { type(data.type); } else { registered(); } } /* clear the properties */ function clear() { object = undefined; name = ""; spy.signalName = ""; spy.clear(); } } lomiri-api-0.2.1/test/qmltest/modules/TestUtil/qmldir000066400000000000000000000000751443550065200226720ustar00rootroot00000000000000module TestUtil plugin TestUtilQml Verifier 0.1 Verifier.qml lomiri-api-0.2.1/test/qmltest/modules/TestUtil/test/000077500000000000000000000000001443550065200224345ustar00rootroot00000000000000lomiri-api-0.2.1/test/qmltest/modules/TestUtil/test/MockObjectForInstanceOfTest.qml000066400000000000000000000013051443550065200304470ustar00rootroot00000000000000/* * Copyright (C) 2013 Canonical, Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ import QtQuick 2.0 Rectangle { property int dummy } lomiri-api-0.2.1/test/qmltest/modules/TestUtil/test/MockObjectForInstanceOfTestChild.qml000066400000000000000000000013301443550065200314110ustar00rootroot00000000000000/* * Copyright (C) 2013 Canonical, Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ import QtQuick 2.0 MockObjectForInstanceOfTest { property int dummy2 } lomiri-api-0.2.1/test/qmltest/modules/TestUtil/test/tst_TestUtil.qml000066400000000000000000000047131443550065200256230ustar00rootroot00000000000000/* * Copyright (C) 2012, 2013 Canonical, Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ import QtQuick 2.0 import QtTest 1.0 import TestUtil 0.1 TestCase { Rectangle { id: rect } MockObjectForInstanceOfTestChild { id: testObject } // Singletons need to be bound to a property and not-named-imported // for them to be able to be properly passed back to C++. // See https://bugreports.qt-project.org/browse/QTBUG-30730 property var util: Util function test_direct() { compare(Util.isInstanceOf(rect, "QQuickRectangle"), true, "rect should be an instance of QQuickRectangle"); compare(Util.isInstanceOf(util, "TestUtil"), true, "Util should be an instance of TestUtil"); compare(Util.isInstanceOf(testObject, "MockObjectForInstanceOfTestChild"), true, "testObject should be an instance of MockObjectForInstanceOfTestChild"); } function test_inherited() { compare(Util.isInstanceOf(rect, "QQuickItem"), true, "rect should be an instance of QQuickItem"); compare(Util.isInstanceOf(rect, "QObject"), true, "rect should be an instance of QObject"); compare(Util.isInstanceOf(util, "QObject"), true, "Util should be an instance of QObject"); compare(Util.isInstanceOf(testObject, "MockObjectForInstanceOfTest"), true, "testObject should be an instance of MockObjectForInstanceOfTest"); compare(Util.isInstanceOf(testObject, "QQuickRectangle"), true, "testObject should be an instance of QQuickRectangle"); } function test_negative() { compare(Util.isInstanceOf(rect, "QQuickMouseArea"), false, "rect should not be an instance of MouseArea"); compare(Util.isInstanceOf(util, "QQuickItem"), false, "Util should not be an instance of QQuickItem"); } function test_undefined() { compare(Util.isInstanceOf(undefined, "QObject"), false, "passing undefined should fail"); } } lomiri-api-0.2.1/test/whitespace/000077500000000000000000000000001443550065200166735ustar00rootroot00000000000000lomiri-api-0.2.1/test/whitespace/CMakeLists.txt000066400000000000000000000003411443550065200214310ustar00rootroot00000000000000# # Test that all source files, cmakefiles, etc. do not contain trailing whitespace. # add_test(whitespace ${CMAKE_CURRENT_SOURCE_DIR}/check_whitespace.py ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/debian/) lomiri-api-0.2.1/test/whitespace/check_whitespace.py000077500000000000000000000100711443550065200225400ustar00rootroot00000000000000#! /usr/bin/env python3 # # Copyright (C) 2013 Canonical Ltd # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License version 3 as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see . # # Authored by: Michi Henning # # # Little helper program to test that source files do not contain trailing whitespace # or tab indentation. # # Usage: check_whitespace.py directory [ignore_prefix [ignore_prefix [...]]] # # The directory specifies the (recursive) location of the source files. Any # files with a path that starts with ignore_prefix are not checked. This is # useful to exclude files that are generated into the build directory. # # See the file_pat definition below for a list of files that are checked. # import argparse import os import re import sys # Print msg on stderr, preceded by program name and followed by newline def error(msg): print(os.path.basename(sys.argv[0]) + ": " + msg, file=sys.stderr) # Function to raise errors encountered by os.walk def raise_error(e): raise e # Scan lines in file_path for bad whitespace. For each file, # print the line numbers that have whitespace issues whitespace_pat = re.compile(r'.*[ \t]$') tab_indent_pat = re.compile(r'^ *\t') def scan_for_bad_whitespace(file_path): global tab_indent_pat, whitespace_pat errors = [] newlines_at_end = 0 with open(file_path, 'rt', encoding='utf-8') as ifile: for lino, line in enumerate(ifile, start=1): if whitespace_pat.match(line) or tab_indent_pat.match(line): errors.append(lino) if line == "\n": newlines_at_end += 1 else: newlines_at_end = 0 if 0 < len(errors) <= 10: if len(errors) > 1: plural = 's' else: plural = '' print("%s: bad whitespace in line%s %s" % (file_path, plural, ", ".join((str(i) for i in errors)))) elif errors: print("%s: bad whitespace in multiple lines" % file_path) if newlines_at_end: print("%s: multiple new lines at end of file" % file_path) return bool(errors) or newlines_at_end # Parse args parser = argparse.ArgumentParser(description = 'Test that source files do not contain trailing whitespace.') parser.add_argument('dir', nargs = 1, help = 'The directory to (recursively) search for source files') parser.add_argument('ignore_prefix', nargs = '*', default=None, help = 'Ignore source files with a path that starts with the given prefix.') args = parser.parse_args() # Files we want to check for trailing whitespace, excluding autogenerated files, though. file_pat = r'([^moc].*\.(c|cpp|h|hpp|hh|in|install|js|py|qml|sh)$)|(.*CMakeLists\.txt$)' pat = re.compile(file_pat) # Find all the files with matching file extension in the specified # directory and check them for trailing whitespace. directory = os.path.abspath(args.dir[0]) ignore_list = [ os.path.abspath(i_p) for i_p in args.ignore_prefix ] found_whitespace = False try: for root, dirs, files in os.walk(directory, onerror = raise_error): for file in files: path = os.path.join(root, file) path_ignored = False # ignore findings in ignored paths for ignore in ignore_list: if path.startswith(ignore): path_ignored = True # detected white spaces if not path_ignored and pat.match(file) and scan_for_bad_whitespace(path): found_whitespace = True except OSError as e: error("cannot create file list for \"" + dir + "\": " + e.strerror) sys.exit(1) if found_whitespace: sys.exit(1) lomiri-api-0.2.1/valgrind-suppress000066400000000000000000000007171443550065200172000ustar00rootroot00000000000000{ g_main_leak Memcheck:Leak fun:memalign fun:posix_memalign obj:/lib/x86_64-linux-gnu/libglib-2.0.so.0.3600.0 fun:g_slice_alloc fun:g_slice_alloc0 fun:g_thread_self fun:g_main_context_acquire fun:g_main_context_push_thread_default ... } { g_keyfile_new_leak Memcheck:Leak ... fun:g_key_file_new ... } { g_keyfile_load_leak Memcheck:Leak ... fun:g_key_file_load_from_file ... }