aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.bzrignore3
-rw-r--r--CMakeLists.txt29
-rw-r--r--cmake/Translations.cmake37
-rw-r--r--data/CMakeLists.txt41
-rw-r--r--data/indicator-display.desktop.in9
-rw-r--r--data/indicator-display.upstart.desktop.in9
-rw-r--r--debian/control4
-rw-r--r--debian/indicator-display.maintscript1
-rw-r--r--po/CMakeLists.txt15
-rw-r--r--po/POTFILES.in2
-rw-r--r--po/indicator-display.pot43
-rw-r--r--tests/CMakeLists.txt5
-rw-r--r--tests/integration/CMakeLists.txt6
-rw-r--r--tests/unit/CMakeLists.txt7
14 files changed, 92 insertions, 119 deletions
diff --git a/.bzrignore b/.bzrignore
new file mode 100644
index 0000000..4f05230
--- /dev/null
+++ b/.bzrignore
@@ -0,0 +1,3 @@
+build/
+po/Makefile.in.in
+po/POTFILES.in
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 77e2cbf..27a074b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -13,9 +13,6 @@ add_definitions(
set(SERVICE_LIB ${PACKAGE})
set(SERVICE_EXEC "${PACKAGE}-service")
-option(enable_tests "Build the package's automatic tests." ON)
-option(enable_coverage "Generate code coverage reports." ON)
-
##
## GNU standard paths
##
@@ -67,22 +64,22 @@ elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
list(APPEND CXX_WARNING_ARGS -Wall -Wextra -Wpedantic)
endif()
-add_compile_options(-std=c++14 -fPIC -g)
+add_compile_options(-std=c++14 -fPIC)
+
+add_subdirectory(src)
+add_subdirectory(data)
+add_subdirectory(po)
##
## Testing & Coverage
##
-if(${enable_tests})
- enable_testing()
- if(${enable_coverage})
- find_package(CoverageReport)
- endif()
-endif()
+enable_testing()
+add_subdirectory(tests)
+find_package(CoverageReport)
+ENABLE_COVERAGE_REPORT(
+ TARGETS ${SERVICE_LIB} ${SERVICE_EXEC}
+ TESTS ${COVERAGE_TEST_TARGETS}
+ FILTER /usr/include ${CMAKE_BINARY_DIR}/*
+)
-add_subdirectory(src)
-add_subdirectory(data)
-add_subdirectory(po)
-if (${enable_tests})
- add_subdirectory(tests)
-endif ()
diff --git a/cmake/Translations.cmake b/cmake/Translations.cmake
deleted file mode 100644
index b51c39d..0000000
--- a/cmake/Translations.cmake
+++ /dev/null
@@ -1,37 +0,0 @@
-# Translations.cmake, CMake macros written for Marlin, feel free to re-use them
-
-macro(add_translations_directory NLS_PACKAGE)
- add_custom_target (i18n ALL)
- find_program (MSGFMT_EXECUTABLE msgfmt)
- file (GLOB PO_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.po)
- foreach (PO_INPUT ${PO_FILES})
- get_filename_component (PO_INPUT_BASE ${PO_INPUT} NAME_WE)
- set (MO_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${PO_INPUT_BASE}.mo)
- add_custom_command (TARGET i18n COMMAND ${MSGFMT_EXECUTABLE} -o ${MO_OUTPUT} ${PO_INPUT})
-
- install (FILES ${MO_OUTPUT} DESTINATION
- ${CMAKE_INSTALL_LOCALEDIR}/${PO_INPUT_BASE}/LC_MESSAGES
- RENAME ${NLS_PACKAGE}.mo)
- endforeach (PO_INPUT ${PO_FILES})
-endmacro(add_translations_directory)
-
-
-macro(add_translations_catalog NLS_PACKAGE)
- add_custom_target (pot COMMENT “Building translation catalog.”)
- find_program (XGETTEXT_EXECUTABLE xgettext)
-
- # init this list, which will hold all the sources across all dirs
- set(SOURCES "")
-
- # add each directory's sources to the overall sources list
- foreach(FILES_INPUT ${ARGN})
- set (DIR ${CMAKE_CURRENT_SOURCE_DIR}/${FILES_INPUT})
- file (GLOB_RECURSE DIR_SOURCES ${DIR}/*.c ${DIR}/*.cc ${DIR}/*.cpp ${DIR}/*.cxx ${DIR}/*.vala)
- set (SOURCES ${SOURCES} ${DIR_SOURCES})
- endforeach()
-
- add_custom_command (TARGET pot COMMAND
- ${XGETTEXT_EXECUTABLE} -d ${NLS_PACKAGE} -o ${CMAKE_CURRENT_SOURCE_DIR}/${NLS_PACKAGE}.pot
- ${SOURCES} --keyword="_" --keyword="N_" --from-code=UTF-8
- )
-endmacro()
diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt
index 2e42eda..d74ca48 100644
--- a/data/CMakeLists.txt
+++ b/data/CMakeLists.txt
@@ -19,47 +19,6 @@ install (FILES "${UPSTART_JOB_FILE}"
DESTINATION "${UPSTART_JOBS_DIR}")
##
-## XDG Autostart File
-##
-
-# where to install
-set (XDG_AUTOSTART_DIR "/etc/xdg/autostart")
-message (STATUS "${XDG_AUTOSTART_DIR} is the XDG Autostart install dir")
-
-set (XDG_AUTOSTART_NAME "${CMAKE_PROJECT_NAME}.desktop")
-set (XDG_AUTOSTART_FILE "${CMAKE_CURRENT_BINARY_DIR}/${XDG_AUTOSTART_NAME}")
-set (XDG_AUTOSTART_FILE_IN "${CMAKE_CURRENT_SOURCE_DIR}/${XDG_AUTOSTART_NAME}.in")
-
-# build it
-set (pkglibexecdir "${CMAKE_INSTALL_FULL_PKGLIBEXECDIR}")
-configure_file ("${XDG_AUTOSTART_FILE_IN}" "${XDG_AUTOSTART_FILE}")
-
-# install it
-install (FILES "${XDG_AUTOSTART_FILE}"
- DESTINATION "${XDG_AUTOSTART_DIR}")
-
-##
-## Upstart XDG Autostart Override
-##
-
-# where to install
-set (UPSTART_XDG_AUTOSTART_DIR "${CMAKE_INSTALL_FULL_DATAROOTDIR}/upstart/xdg/autostart")
-message (STATUS "${UPSTART_XDG_AUTOSTART_DIR} is the Upstart XDG autostart override dir")
-
-set (UPSTART_XDG_AUTOSTART_NAME "${CMAKE_PROJECT_NAME}.upstart.desktop")
-set (UPSTART_XDG_AUTOSTART_FILE "${CMAKE_CURRENT_BINARY_DIR}/${UPSTART_XDG_AUTOSTART_NAME}")
-set (UPSTART_XDG_AUTOSTART_FILE_IN "${CMAKE_CURRENT_SOURCE_DIR}/${UPSTART_XDG_AUTOSTART_NAME}.in")
-
-# build it
-set (pkglibexecdir "${CMAKE_INSTALL_FULL_PKGLIBEXECDIR}")
-configure_file ("${UPSTART_XDG_AUTOSTART_FILE_IN}" "${UPSTART_XDG_AUTOSTART_FILE}")
-
-# install it
-install (FILES "${UPSTART_XDG_AUTOSTART_FILE}"
- DESTINATION "${UPSTART_XDG_AUTOSTART_DIR}"
- RENAME "${XDG_AUTOSTART_NAME}")
-
-##
## Systemd Unit File
##
diff --git a/data/indicator-display.desktop.in b/data/indicator-display.desktop.in
deleted file mode 100644
index b0017b1..0000000
--- a/data/indicator-display.desktop.in
+++ /dev/null
@@ -1,9 +0,0 @@
-[Desktop Entry]
-Type=Application
-Name=Indicator Display
-Exec=@pkglibexecdir@/indicator-display-service
-OnlyShowIn=Unity;GNOME;
-NoDisplay=true
-StartupNotify=false
-Terminal=false
-AutostartCondition=GNOME3 unless-session gnome
diff --git a/data/indicator-display.upstart.desktop.in b/data/indicator-display.upstart.desktop.in
deleted file mode 100644
index 7e6cfe6..0000000
--- a/data/indicator-display.upstart.desktop.in
+++ /dev/null
@@ -1,9 +0,0 @@
-[Desktop Entry]
-Type=Application
-Name=Indicator Display
-Exec=@pkglibexecdir@/indicator-display-service
-OnlyShowIn=Unity;
-NoDisplay=true
-StartupNotify=false
-Terminal=false
-Hidden=true
diff --git a/debian/control b/debian/control
index 6deae40..7871d0f 100644
--- a/debian/control
+++ b/debian/control
@@ -10,6 +10,7 @@ Build-Depends: cmake,
libgudev-1.0-dev,
libproperties-cpp-dev,
# for coverage reports
+ gcovr,
lcov,
# for tests
qt5-default,
@@ -17,8 +18,7 @@ Build-Depends: cmake,
libqtdbusmock1-dev,
libqtdbustest1-dev,
cppcheck,
- libgtest-dev,
- google-mock (>= 1.6.0+svn437),
+ googletest | google-mock (>= 1.6.0+svn437),
gsettings-ubuntu-schemas (>= 0.0.2+14.10.20140813),
# for packaging
debhelper (>= 9),
diff --git a/debian/indicator-display.maintscript b/debian/indicator-display.maintscript
new file mode 100644
index 0000000..2f6e7f6
--- /dev/null
+++ b/debian/indicator-display.maintscript
@@ -0,0 +1 @@
+rm_conffile /etc/xdg/autostart/indicator-display.desktop 0replaceme~
diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt
index 786573b..e78a9df 100644
--- a/po/CMakeLists.txt
+++ b/po/CMakeLists.txt
@@ -1,3 +1,12 @@
-include (Translations)
-add_translations_directory("${GETTEXT_PACKAGE}")
-add_translations_catalog("${GETTEXT_PACKAGE}" ../src/)
+find_package(Intltool REQUIRED)
+
+intltool_update_potfile(
+ KEYWORDS "_" "_:1,2" "N_" "N_:1,2"
+ GETTEXT_PACKAGE ${GETTEXT_PACKAGE}
+ COPYRIGHT_HOLDER "Canonical Ltd."
+)
+
+intltool_install_translations(
+ ALL
+ GETTEXT_PACKAGE ${GETTEXT_PACKAGE}
+)
diff --git a/po/POTFILES.in b/po/POTFILES.in
deleted file mode 100644
index 339765f..0000000
--- a/po/POTFILES.in
+++ /dev/null
@@ -1,2 +0,0 @@
-src/rotation-lock.cpp
-src/usb-snap.cpp
diff --git a/po/indicator-display.pot b/po/indicator-display.pot
new file mode 100644
index 0000000..26488a3
--- /dev/null
+++ b/po/indicator-display.pot
@@ -0,0 +1,43 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR Canonical Ltd.
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2017-02-07 13:08-0500\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../src/rotation-lock.cpp:125
+msgid "Rotation Lock"
+msgstr ""
+
+#: ../src/rotation-lock.cpp:136
+msgid "Rotation"
+msgstr ""
+
+#: ../src/usb-snap.cpp:107
+#, c-format
+msgid "The computer's RSA key fingerprint is: %s"
+msgstr ""
+
+#: ../src/usb-snap.cpp:112
+msgid "Allow"
+msgstr ""
+
+#: ../src/usb-snap.cpp:114
+msgid "Don't Allow"
+msgstr ""
+
+#: ../src/usb-snap.cpp:126
+msgid "Allow USB Debugging?"
+msgstr ""
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 7be2acd..d5fb909 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -33,3 +33,8 @@ add_test(cppcheck cppcheck --enable=all -USCHEMA_DIR --error-exitcode=2 --inline
add_subdirectory(integration)
add_subdirectory(unit)
add_subdirectory(utils)
+
+set(COVERAGE_TEST_TARGETS
+ ${COVERAGE_TEST_TARGETS}
+ PARENT_SCOPE
+)
diff --git a/tests/integration/CMakeLists.txt b/tests/integration/CMakeLists.txt
index 9ec6688..42d710e 100644
--- a/tests/integration/CMakeLists.txt
+++ b/tests/integration/CMakeLists.txt
@@ -16,9 +16,15 @@ set(TEST_LINK_LIBRARIES
function(add_qt_test_by_name name)
set(TEST_NAME ${name})
+ set(COVERAGE_TEST_TARGETS ${COVERAGE_TEST_TARGETS} ${TEST_NAME} PARENT_SCOPE)
add_executable (${TEST_NAME} ${TEST_NAME}.cpp)
add_test(${TEST_NAME} ${TEST_NAME})
set_property(TEST ${TEST_NAME} APPEND PROPERTY ENVIRONMENT ${CTEST_ENVIRONMENT})
target_link_libraries(${TEST_NAME} ${SERVICE_LINK_LIBRARIES} ${QT_LINK_LIBRARIES} ${TEST_LINK_LIBRARIES} ${THREAD_LINK_LIBRARIES})
endfunction()
add_qt_test_by_name(usb-manager-test)
+
+set(COVERAGE_TEST_TARGETS
+ ${COVERAGE_TEST_TARGETS}
+ PARENT_SCOPE
+)
diff --git a/tests/unit/CMakeLists.txt b/tests/unit/CMakeLists.txt
index 9d8cad2..87fab3a 100644
--- a/tests/unit/CMakeLists.txt
+++ b/tests/unit/CMakeLists.txt
@@ -20,6 +20,7 @@ add_definitions(
function(add_test_by_name name)
set(TEST_NAME ${name})
+ set(COVERAGE_TEST_TARGETS ${COVERAGE_TEST_TARGETS} ${TEST_NAME} PARENT_SCOPE)
add_executable (${TEST_NAME} ${TEST_NAME}.cpp)
add_test(${TEST_NAME} ${TEST_NAME})
set_property(TEST ${TEST_NAME} APPEND PROPERTY ENVIRONMENT ${CTEST_ENVIRONMENT})
@@ -30,6 +31,7 @@ add_test_by_name(rotation-lock-test)
function(add_qt_test_by_name name)
set(TEST_NAME ${name})
+ set(COVERAGE_TEST_TARGETS ${COVERAGE_TEST_TARGETS} ${TEST_NAME} PARENT_SCOPE)
add_executable (${TEST_NAME} ${TEST_NAME}.cpp)
add_test(${TEST_NAME} ${TEST_NAME})
set_property(TEST ${TEST_NAME} APPEND PROPERTY ENVIRONMENT ${CTEST_ENVIRONMENT})
@@ -37,3 +39,8 @@ function(add_qt_test_by_name name)
endfunction()
add_qt_test_by_name(greeter-test)
add_qt_test_by_name(usb-snap-test)
+
+set(COVERAGE_TEST_TARGETS
+ ${COVERAGE_TEST_TARGETS}
+ PARENT_SCOPE
+)