diff --git a/CMakeLists.txt b/CMakeLists.txt index da33793c7..80d925b15 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,7 @@ # # cmake . -DSKIP_MODULES="partition luksbootkeycfg" -project( calamares CXX ) +project( calamares C CXX ) cmake_minimum_required( VERSION 3.2 ) @@ -67,10 +67,10 @@ if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) # Third-party code where we don't care so much about compiler warnings # (because it's uncomfortable to patch) get different flags; use - # set_source_files_properties( - # PROPERTIES COMPILE_FLAGS "${SUPPRESS_3RDPARTY_WARNINGS}" ) + # mark_thirdparty_code( [...] ) # to switch off warnings for those sources. set( SUPPRESS_3RDPARTY_WARNINGS "-Wno-everything" ) + set( SUPPRESS_BOOST_WARNINGS " -Wno-zero-as-null-pointer-constant -Wno-disabled-macro-expansion" ) set( CMAKE_CXX_FLAGS_DEBUG "-g" ) set( CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG" ) @@ -85,8 +85,17 @@ else() set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--fatal-warnings -Wnon-virtual-dtor -Woverloaded-virtual -Werror=return-type" ) set( SUPPRESS_3RDPARTY_WARNINGS "" ) + set( SUPPRESS_BOOST_WARNINGS "" ) endif() +macro(mark_thirdparty_code) + set_source_files_properties( ${ARGV} + PROPERTIES + COMPILE_FLAGS "${SUPPRESS_3RDPARTY_WARNINGS}" + COMPILE_DEFINITIONS "THIRDPARTY" + ) +endmacro() + if( CMAKE_COMPILER_IS_GNUCXX ) if( CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.9 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 4.9 ) @@ -103,8 +112,8 @@ find_package( Qt5 ${QT_VERSION} CONFIG REQUIRED Core Gui Widgets LinguistTools S find_package( YAMLCPP 0.5.1 REQUIRED ) find_package( PolkitQt5-1 REQUIRED ) -option( WITH_PYTHON "Enable Python modules API (requires Boost.Python)." ON ) option( INSTALL_CONFIG "Install configuration files" ON ) +option( WITH_PYTHON "Enable Python modules API (requires Boost.Python)." ON ) option( WITH_PYTHONQT "Enable next generation Python modules API (experimental, requires PythonQt)." OFF ) option( BUILD_TESTING "Build the testing tree." ON ) @@ -114,27 +123,25 @@ endif () find_package( PythonLibs 3.3 ) set_package_properties( - PYTHONLIBS PROPERTIES + PythonLibs PROPERTIES DESCRIPTION "C interface libraries for the Python 3 interpreter." URL "http://python.org" - PURPOSE "Python 3 is used for some Calamares job modules." + PURPOSE "Python 3 is used for Python job modules." ) if ( PYTHONLIBS_FOUND ) include( BoostPython3 ) find_boost_python3( 1.54.0 ${PYTHONLIBS_VERSION_STRING} CALAMARES_BOOST_PYTHON3_FOUND ) set_package_properties( - CALAMARES_BOOST_PYTHON3 PROPERTIES - DESCRIPTION "A C++ library which enables seamless interoperability between C++ and Python 3." - URL "http://www.boost.org" - PURPOSE "Boost.Python is used for interfacing with Calamares job modules written in Python 3." + Boost PROPERTIES + PURPOSE "Boost.Python is used for Python job modules." ) find_package( PythonQt ) - set_package_properties( PYTHONQT PROPERTIES + set_package_properties( PythonQt PROPERTIES DESCRIPTION "A Python embedding solution for Qt applications." URL "http://pythonqt.sourceforge.net" - PURPOSE "PythonQt is used for the Python modules API." + PURPOSE "PythonQt is used for Python view modules." ) endif() @@ -157,7 +164,7 @@ set( CALAMARES_TRANSLATION_LANGUAGES ar ast bg ca cs_CZ da de el en en_GB es_MX ### Bump version here set( CALAMARES_VERSION_MAJOR 3 ) set( CALAMARES_VERSION_MINOR 1 ) -set( CALAMARES_VERSION_PATCH 4 ) +set( CALAMARES_VERSION_PATCH 5 ) set( CALAMARES_VERSION_RC 0 ) set( CALAMARES_VERSION ${CALAMARES_VERSION_MAJOR}.${CALAMARES_VERSION_MINOR}.${CALAMARES_VERSION_PATCH} ) @@ -234,8 +241,8 @@ if( mksquashfs_PROGRAM ) set( src_fs ${CMAKE_SOURCE_DIR}/data/example-root/ ) set( dst_fs ${CMAKE_BINARY_DIR}/example.sqfs ) if( EXISTS ${src_fs} ) - # Collect directories needed for a minimal binary distro, # based on the build host. If /lib64 exists, assume it is needed. + # Collect directories needed for a minimal binary distro, # Note that the last path component is added to the root, so # if you add /usr/sbin here, it will be put into /sbin_1. # Add such paths to /etc/profile under ${src_fs}. @@ -268,20 +275,12 @@ set_package_properties( mksquashfs PROPERTIES # add_subdirectory( thirdparty ) add_subdirectory( src ) +add_feature_info(Python ${WITH_PYTHON} "Python job modules") +add_feature_info(PythonQt ${WITH_PYTHONQT} "Python view modules") +add_feature_info(Config ${INSTALL_CONFIG} "Install Calamares configuration") + feature_summary(WHAT ALL) -if( NOT WITH_PYTHON ) - message( "-- WARNING: Building Calamares without Python support. Legacy Python job modules will not work.\n" ) -endif() -if( NOT WITH_PYTHONQT ) - message( "-- WARNING: Building Calamares without PythonQt support. Python modules will not work.\n" ) -endif() - - -if( NOT INSTALL_CONFIG ) - message( "-- WARNING: Configuration files will not be installed.\n" ) -endif() - # Add all targets to the build-tree export set set( CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/Calamares" CACHE PATH "Installation directory for CMake files" ) set( CMAKE_INSTALL_FULL_CMAKEDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_CMAKEDIR}" ) diff --git a/CMakeModules/BoostPython3.cmake b/CMakeModules/BoostPython3.cmake index e708defa4..c128b58f1 100644 --- a/CMakeModules/BoostPython3.cmake +++ b/CMakeModules/BoostPython3.cmake @@ -20,38 +20,50 @@ # "python-$dotsuffix", where suffix is based on the `python_version` argument. # One can supply a custom component name by setting the # `CALAMARES_BOOST_PYTHON3_COMPONENT` variable at CMake time. - set( CALAMARES_BOOST_PYTHON3_COMPONENT python3 CACHE STRING "Name of the Boost.Python component. If Boost.Python is installed as libboost_python-foo.so then this variable should be set to 'python-foo'." ) -macro( find_boost_python3 boost_version python_version found_var ) - set( ${found_var} OFF ) +include(FindPackageHandleStandardArgs) - # turns "3.4.123abc" into "34" - string( REGEX REPLACE "([0-9]+)\\.([0-9]+)\\..*" "\\1\\2" _fbp_python_short_version ${python_version} ) - - foreach( _fbp_name ${CALAMARES_BOOST_PYTHON3_COMPONENT} python-py${_fbp_python_short_version} ) +macro( _find_boost_python3_int boost_version componentname found_var ) + foreach( _fbp_name ${CALAMARES_BOOST_PYTHON3_COMPONENT} ${componentname} ) find_package( Boost ${boost_version} QUIET COMPONENTS ${_fbp_name} ) string( TOUPPER ${_fbp_name} _fbp_uc_name ) if( Boost_${_fbp_uc_name}_FOUND ) - set( ${found_var} ON ) + set( ${found_var} ${_fbp_uc_name} ) break() endif() endforeach() +endmacro() - if (NOT ${found_var}) +macro( find_boost_python3 boost_version python_version found_var ) + set( ${found_var} OFF ) + set( _fbp_found OFF ) + + # turns "3.4.123abc" into "34" + string( REGEX REPLACE "([0-9]+)\\.([0-9]+)\\..*" "\\1\\2" _fbp_python_short_version ${python_version} ) + _find_boost_python3_int( ${boost_version} python-py${_fbp_python_short_version} _fbp_found ) + + if (NOT _fbp_found) # The following loop changes the searched name for Gentoo based distributions # turns "3.4.123abc" into "3.4" string( REGEX REPLACE "([0-9]+)\\.([0-9]+)\\..*" "\\1.\\2" _fbp_python_short_version ${python_version} ) - foreach( _fbp_name ${CALAMARES_BOOST_PYTHON3_COMPONENT} python-${_fbp_python_short_version} ) - find_package( Boost ${boost_version} QUIET COMPONENTS ${_fbp_name} ) - string( TOUPPER ${_fbp_name} _fbp_uc_name ) - if( Boost_${_fbp_uc_name}_FOUND ) - set( ${found_var} ON ) - break() - endif() - endforeach() + _find_boost_python3_int( ${boost_version} python-${_fbp_python_short_version} _fbp_found ) endif() + + set( ${found_var} ${_fbp_found} ) + + # This is superfluous, but allows proper reporting in the features list + if ( _fbp_found ) + find_package( Boost ${boost_version} COMPONENTS ${_fbp_found} ) + else() + find_package( Boost ${boost_version} COMPONENTS Python ) + endif() + set_package_properties( + Boost PROPERTIES + DESCRIPTION "A C++ library which enables seamless interoperability between C++ and Python 3." + URL "http://www.boost.org" + ) endmacro() diff --git a/LICENSES/LGPLv2.1-Presentation b/LICENSES/LGPLv2.1-Presentation new file mode 100644 index 000000000..1bb6461eb --- /dev/null +++ b/LICENSES/LGPLv2.1-Presentation @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QML Presentation System. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QML Presentation System. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + diff --git a/LICENSES/LGPLv2.1-Presentation-Exception b/LICENSES/LGPLv2.1-Presentation-Exception new file mode 100644 index 000000000..7e2e30ff9 --- /dev/null +++ b/LICENSES/LGPLv2.1-Presentation-Exception @@ -0,0 +1,22 @@ +Digia Qt LGPL Exception version 1.1 + +As an additional permission to the GNU Lesser General Public License version +2.1, the object code form of a "work that uses the Library" may incorporate +material from a header file that is part of the Library. You may distribute +such object code under terms of your choice, provided that: + (i) the header files of the Library have not been modified; and + (ii) the incorporated material is limited to numerical parameters, data + structure layouts, accessors, macros, inline functions and + templates; and + (iii) you comply with the terms of Section 6 of the GNU Lesser General + Public License version 2.1. + +Moreover, you may apply this exception to a modified version of the Library, +provided that such modification does not involve copying material from the +Library into the modified Library's header files unless such material is +limited to (i) numerical parameters; (ii) data structure layouts; +(iii) accessors; and (iv) small macros, templates and inline functions of +five lines or less in length. + +Furthermore, you are not required to apply this additional permission to a +modified version of the Library. diff --git a/README.md b/README.md index e30b67155..dcb5e3b67 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ [![Coverity Scan Build Status](https://scan.coverity.com/projects/5389/badge.svg)](https://scan.coverity.com/projects/5389) [![GitHub license](https://img.shields.io/github/license/calamares/calamares.svg)](https://github.com/calamares/calamares/blob/master/LICENSE) -| [Report a Bug](https://calamares.io/bugs/) | [Contribute](https://github.com/calamares/calamares/blob/master/HACKING.md) | [Translate](https://www.transifex.com/projects/p/calamares/) | Freenode (IRC): #calamares | [Wiki](https://github.com/calamares/calamares/wiki) | +| [Report a Bug](https://github.com/calamares/calamares/issues/new) | [Contribute](https://github.com/calamares/calamares/blob/master/ci/HACKING.md) | [Translate](https://www.transifex.com/projects/p/calamares/) | Freenode (IRC): #calamares | [Wiki](https://github.com/calamares/calamares/wiki) | |:-----------------------------------------:|:----------------------:|:-----------------------:|:--------------------------:|:--------------------------:| ### Dependencies diff --git a/calamares.desktop b/calamares.desktop index 8cae765df..2dcc78fd2 100644 --- a/calamares.desktop +++ b/calamares.desktop @@ -12,7 +12,7 @@ Terminal=false StartupNotify=true Categories=Qt;System; -# Translations + Name[ca]=Calamares Icon[ca]=calamares GenericName[ca]=Instal·lador de sistema diff --git a/ci/RELEASE.md b/ci/RELEASE.md index d462ae47b..640a91156 100644 --- a/ci/RELEASE.md +++ b/ci/RELEASE.md @@ -30,11 +30,6 @@ The Calamares release process * Check `README.md` and everything in `hacking`, make sure it's all still relevant. Run `hacking/calamaresstyle` to check the C++ code style. Python code is checked as part of the Travis CI builds. -* Update submodules. - ``` - git submodule # Note list of submodules - git submodule update thirdparty/libcrashreporter-qt - ``` * Check defaults in `settings.conf` and other configuration files. * Pull latest translations from Transifex. This is done nightly on Jenkins, so a manual pull is rarely necessary. @@ -43,8 +38,13 @@ The Calamares release process fairly complete translations. #### (2) Tarball -* Create tarball: `git-archive-all -v calamares-1.1-rc1.tar.gz` . Double check - that the tarball matches the version number. +* Create tarball: `git-archive-all -v calamares-1.1-rc1.tar.gz` or without + the helper script, + ``` + V=calamares-3.1.5 + git archive -o $V.tar.gz --prefix $V/ master + ``` + Double check that the tarball matches the version number. * Test tarball. #### (3) Tag diff --git a/lang/calamares_cs_CZ.ts b/lang/calamares_cs_CZ.ts index 3bc430080..1bf3c9ae0 100644 --- a/lang/calamares_cs_CZ.ts +++ b/lang/calamares_cs_CZ.ts @@ -1162,12 +1162,12 @@ Instalační program bude ukončen a všechny změny ztraceny. &Cancel - + &Zrušit &OK - + &OK diff --git a/lang/calamares_da.ts b/lang/calamares_da.ts index 6017dbb8c..5ce8ee77e 100644 --- a/lang/calamares_da.ts +++ b/lang/calamares_da.ts @@ -173,7 +173,7 @@ Output: External command finished with errors - Ekstern kommando blev færdiggjort uden fejl + Ekstern kommando blev færdiggjort med fejl @@ -702,7 +702,7 @@ Installationsprogrammet vil stoppe og alle ændringer vil gå tabt. Creating new %1 partition table on %2. - Opretter ny %1 partitionstabel på %2. + Opretter ny %1-partitionstabel på %2. @@ -984,7 +984,7 @@ Installationsprogrammet vil stoppe og alle ændringer vil gå tabt. Install %1 on <strong>new</strong> %2 system partition. - Installér %1 på den <strong>nye</strong> %2 systempartition. + Installér %1 på <strong>nye</strong> %2-systempartition. @@ -994,7 +994,7 @@ Installationsprogrammet vil stoppe og alle ændringer vil gå tabt. Install %2 on %3 system partition <strong>%1</strong>. - Installér %2 på %3 systempartition <strong>%1</strong>. + Installér %2 på %3-systempartition <strong>%1</strong>. @@ -1772,7 +1772,7 @@ Installationsprogrammet vil stoppe og alle ændringer vil gå tabt. %1 system partition (%2) - %1 systempartition (%2) + %1-systempartition (%2) diff --git a/lang/calamares_ja.ts b/lang/calamares_ja.ts index 11668390a..320cfa3b0 100644 --- a/lang/calamares_ja.ts +++ b/lang/calamares_ja.ts @@ -1163,12 +1163,12 @@ The installer will quit and all changes will be lost. &Cancel - + 中止(&C) &OK - + 了解(&O) diff --git a/lang/python/cs_CZ/LC_MESSAGES/python.mo b/lang/python/cs_CZ/LC_MESSAGES/python.mo index 26336e6c6..f98f7f8ee 100644 Binary files a/lang/python/cs_CZ/LC_MESSAGES/python.mo and b/lang/python/cs_CZ/LC_MESSAGES/python.mo differ diff --git a/lang/python/cs_CZ/LC_MESSAGES/python.po b/lang/python/cs_CZ/LC_MESSAGES/python.po index 7e93851dc..59616a830 100644 --- a/lang/python/cs_CZ/LC_MESSAGES/python.po +++ b/lang/python/cs_CZ/LC_MESSAGES/python.po @@ -53,4 +53,4 @@ msgstr[2] "" #: src/modules/packages/main.py:68 msgid "Install packages." -msgstr "" +msgstr "Instalovat balíčky." diff --git a/lang/python/ja/LC_MESSAGES/python.mo b/lang/python/ja/LC_MESSAGES/python.mo index 492de1bd4..828391d79 100644 Binary files a/lang/python/ja/LC_MESSAGES/python.mo and b/lang/python/ja/LC_MESSAGES/python.mo differ diff --git a/lang/python/ja/LC_MESSAGES/python.po b/lang/python/ja/LC_MESSAGES/python.po index 0a0b42d34..8e24320fb 100644 --- a/lang/python/ja/LC_MESSAGES/python.po +++ b/lang/python/ja/LC_MESSAGES/python.po @@ -33,20 +33,20 @@ msgstr "Dummy python step {}" #: src/modules/packages/main.py:59 #, python-format msgid "Processing packages (%(count)d / %(total)d)" -msgstr "" +msgstr "パッケージの処理中 (%(count)d / %(total)d)" #: src/modules/packages/main.py:61 #, python-format msgid "Installing one package." msgid_plural "Installing %(num)d packages." -msgstr[0] "" +msgstr[0] " %(num)d パッケージのインストール中。" #: src/modules/packages/main.py:64 #, python-format msgid "Removing one package." msgid_plural "Removing %(num)d packages." -msgstr[0] "" +msgstr[0] " %(num)d パッケージの削除中。" #: src/modules/packages/main.py:68 msgid "Install packages." -msgstr "" +msgstr "パッケージのインストール" diff --git a/src/calamares/CMakeLists.txt b/src/calamares/CMakeLists.txt index 62be0ed34..6129aa553 100644 --- a/src/calamares/CMakeLists.txt +++ b/src/calamares/CMakeLists.txt @@ -27,8 +27,6 @@ include_directories( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/../libcalamares - ${THIRDPARTY_DIR}/libcrashreporter-qt/src/ - ../libcalamares ../libcalamaresui ) @@ -51,10 +49,6 @@ SET_TARGET_PROPERTIES(calamares_bin RUNTIME_OUTPUT_NAME calamares ) -if( WITH_CRASHREPORTER ) - list( APPEND LINK_LIBRARIES ${LINK_LIBRARIES} pthread crashreporter-handler ) -endif() - target_link_libraries( calamares_bin PRIVATE ${CALAMARES_LIBRARIES} diff --git a/src/calamares/main.cpp b/src/calamares/main.cpp index ec6c233a1..a265d1e31 100644 --- a/src/calamares/main.cpp +++ b/src/calamares/main.cpp @@ -23,9 +23,6 @@ #include "utils/CalamaresUtils.h" #include "utils/Logger.h" #include "CalamaresConfig.h" -#ifdef WITH_CRASHREPORTER - #include "libcrashreporter-handler/Handler.h" -#endif #include #include @@ -36,13 +33,6 @@ main( int argc, char* argv[] ) { CalamaresApplication a( argc, argv ); -#ifdef WITH_CRASHREPORTER - CrashReporter::Handler* handler = - new CrashReporter::Handler( QDir::tempPath(), - true, - "calamares_crash_reporter" ); -#endif - QCommandLineParser parser; parser.setApplicationDescription( "Distribution-independent installer framework" ); parser.addHelpOption(); diff --git a/src/crashreporter/CMakeLists.txt b/src/crashreporter/CMakeLists.txt deleted file mode 100644 index 20f16575b..000000000 --- a/src/crashreporter/CMakeLists.txt +++ /dev/null @@ -1,47 +0,0 @@ -PROJECT( CrashReporter ) -cmake_policy(SET CMP0017 NEW) - -set(CALAMARES_CRASH_REPORTER_TARGET calamares_crash_reporter) - -list(APPEND crashreporter_SOURCES main.cpp) -list(APPEND crashreporter_RC resources.qrc) - -qt5_wrap_ui( crashreporter_UI_HEADERS ${crashreporter_UI} ) -qt5_add_resources( crashreporter_RC_RCC ${crashreporter_RC} ) - - -if(BUILD_RELEASE) - set(CRASHREPORTER_RELEASE_CHANNEL "release") -else() - set(CRASHREPORTER_RELEASE_CHANNEL "nightly") -endif() - -set(CRASHREPORTER_SUBMIT_URL "https://calamares.io/oops/addreport.php") -set(CRASHREPORTER_ICON ":/squid.svg") -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CrashReporterConfig.h.in - ${CMAKE_CURRENT_BINARY_DIR}/CrashReporterConfig.h) - - -include_directories(${CMAKE_CURRENT_BINARY_DIR} - ../../libcalamares - ../../libcalamaresui - ../../thirdparty/libcrashreporter-qt/src -) - -add_executable( ${CALAMARES_CRASH_REPORTER_TARGET} - ${crashreporter_SOURCES} - ${crashreporter_HEADERS_MOC} - ${crashreporter_UI_HEADERS} - ${crashreporter_RC_RCC} -) - -target_link_libraries( ${CALAMARES_CRASH_REPORTER_TARGET} - ${CALAMARES_LIBRARIES} - crashreporter-gui - ${QT_LIBRARIES} -) - -set_target_properties(${CALAMARES_CRASH_REPORTER_TARGET} PROPERTIES AUTOMOC ON) -install(TARGETS ${CALAMARES_CRASH_REPORTER_TARGET} RUNTIME DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}) - -qt5_use_modules(${CALAMARES_CRASH_REPORTER_TARGET} Widgets Network) diff --git a/src/crashreporter/CrashReporterConfig.h.in b/src/crashreporter/CrashReporterConfig.h.in deleted file mode 100644 index c1df8f8df..000000000 --- a/src/crashreporter/CrashReporterConfig.h.in +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef CRASHREPORTERCONFIG_H -#define CRASHREPORTERCONFIG_H - -// QCoreApplication settings for QSettings -#cmakedefine CALAMARES_ORGANIZATION_NAME "${CALAMARES_ORGANIZATION_NAME}" -#cmakedefine CALAMARES_ORGANIZATION_DOMAIN "${CALAMARES_ORGANIZATION_DOMAIN}" -#cmakedefine CALAMARES_APPLICATION_NAME "${CALAMARES_APPLICATION_NAME}" -#cmakedefine CALAMARES_VERSION "${CALAMARES_VERSION}" - - -#define CRASHREPORTER_BUILD_ID "@CMAKE_DATESTAMP_YEAR@@CMAKE_DATESTAMP_MONTH@@CMAKE_DATESTAMP_DAY@000000" - -#define CRASHREPORTER_RELEASE_CHANNEL "@CRASHREPORTER_RELEASE_CHANNEL@" - -#define CRASHREPORTER_PRODUCT_NAME "@CALAMARES_APPLICATION_NAME@" - -#define CRASHREPORTER_VERSION_STRING "@CALAMARES_VERSION_STRING@" - -#define CRASHREPORTER_SUBMIT_URL "@CRASHREPORTER_SUBMIT_URL@" - -#define CRASHREPORTER_ICON "@CRASHREPORTER_ICON@" - -#endif // CRASHREPORTERCONFIG_H diff --git a/src/crashreporter/main.cpp b/src/crashreporter/main.cpp deleted file mode 100644 index 8d7ef16e0..000000000 --- a/src/crashreporter/main.cpp +++ /dev/null @@ -1,166 +0,0 @@ -/* === This file is part of Calamares - === - * - * Copyright 2010-2011, Christian Muehlhaeuser - * Copyright 2015-2016, Teo Mrnjavac - * - * Calamares 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, either version 3 of the License, or - * (at your option) any later version. - * - * Calamares 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 Calamares. If not, see . - */ - -#include - -#include - -#include "CrashReporterConfig.h" - -#include -#include -#include -#include -#include - -#include "utils/CalamaresUtils.h" -#include "utils/Logger.h" - -#include - -#ifdef Q_OS_WIN - #include - #include -#endif - - -#ifdef Q_OS_LINUX -static const char k_usage[] = - "Usage:\n" - " CrashReporter \n"; -#else -static const char k_usage[] = - "Usage:\n" - " CrashReporter \n"; -#endif - -int main( int argc, char* argv[] ) -{ -#ifdef Q_OS_WIN // log to console window - if ( fileno( stdout ) != -1 && _get_osfhandle( fileno( stdout ) ) != -1 ) - { - /* stdout is fine, presumably redirected to a file or pipe */ - } - else - { - typedef BOOL (WINAPI * AttachConsole_t) (DWORD); - AttachConsole_t p_AttachConsole = (AttachConsole_t) GetProcAddress( GetModuleHandleW( L"kernel32.dll" ), "AttachConsole" ); - - if ( p_AttachConsole != NULL && p_AttachConsole( ATTACH_PARENT_PROCESS ) ) - { - _wfreopen ( L"CONOUT$", L"w", stdout ); - dup2( fileno( stdout ), 1 ); - _wfreopen ( L"CONOUT$", L"w", stderr ); - dup2( fileno( stderr ), 2 ); - } - } -#endif - - // used by some Qt stuff, eg QSettings - // leave first! As Settings object is created quickly - QCoreApplication::setOrganizationName( QLatin1String( CALAMARES_ORGANIZATION_NAME ) ); - QCoreApplication::setOrganizationDomain( QLatin1String( CALAMARES_ORGANIZATION_DOMAIN ) ); - QCoreApplication::setApplicationName( QLatin1String( CALAMARES_APPLICATION_NAME ) ); - QCoreApplication::setApplicationVersion( QLatin1String( CALAMARES_VERSION ) ); - - QApplication app( argc, argv ); - CalamaresUtils::installTranslator( QLocale::system(), QString(), &app ); - -#ifdef Q_OS_LINUX - if ( app.arguments().size() != 8 ) -#else - if ( app.arguments().size() != 2 ) -#endif - { - std::cout << k_usage; - return 1; - } - cDebug() << "Arguments list:" << app.arguments().join( ", " ); - - CrashReporter reporter( QUrl( CRASHREPORTER_SUBMIT_URL ), app.arguments() ); - - #ifdef CRASHREPORTER_ICON - reporter.setLogo( QPixmap( CRASHREPORTER_ICON ) ); - #endif - reporter.setWindowTitle( CRASHREPORTER_PRODUCT_NAME ); - reporter.setText("

Sorry!" - " " CRASHREPORTER_PRODUCT_NAME " crashed. Please tell us " - "about it! " CRASHREPORTER_PRODUCT_NAME " has created an error " - "report for you that can help improve the stability in the " - "future. You can now send this report directly to the " - CRASHREPORTER_PRODUCT_NAME " developers.

Can you tell us " - "what you were doing when this happened?

"); - reporter.setBottomText(QString()); - - reporter.setReportData( "BuildID", CRASHREPORTER_BUILD_ID ); - reporter.setReportData( "ProductName", CRASHREPORTER_PRODUCT_NAME ); - reporter.setReportData( "Version", CRASHREPORTER_VERSION_STRING ); - reporter.setReportData( "ReleaseChannel", CRASHREPORTER_RELEASE_CHANNEL); - - //reporter.setReportData( "timestamp", QByteArray::number( QDateTime::currentDateTime().toTime_t() ) ); - - - - // add parameters - -// QList pairs; -// pairs //<< Pair( "BuildID", buildId.toUtf8() ) -// << Pair( ) -// //<< Pair( "Version", CalamaresUtils::appFriendlyVersion().toLocal8Bit() ) -// //<< Pair( "Vendor", "Tomahawk" ) -// //<< Pair( ) - - // << Pair("InstallTime", "1357622062") - // << Pair("Theme", "classic/1.0") - // << Pair("Version", "30") - // << Pair("id", "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}") - // << Pair("Vendor", "Mozilla") - // << Pair("EMCheckCompatibility", "true") - // << Pair("Throttleable", "0") - // << Pair("URL", "http://code.google.com/p/crashme/") - // << Pair("version", "20.0a1") - // << Pair("CrashTime", "1357770042") - // << Pair("submitted_timestamp", "2013-01-09T22:21:18.646733+00:00") - // << Pair("buildid", "20130107030932") - // << Pair("timestamp", "1357770078.646789") - // << Pair("Notes", "OpenGL: NVIDIA Corporation -- GeForce 8600M GT/PCIe/SSE2 -- 3.3.0 NVIDIA 313.09 -- texture_from_pixmap\r\n") - // << Pair("StartupTime", "1357769913") - // << Pair("FramePoisonSize", "4096") - // << Pair("FramePoisonBase", "7ffffffff0dea000") - // << Pair("Add-ons", "%7B972ce4c6-7e08-4474-a285-3208198ce6fd%7D:20.0a1,crashme%40ted.mielczarek.org:0.4") - // << Pair("SecondsSinceLastCrash", "1831736") - // << Pair("ProductName", "WaterWolf") - // << Pair("legacy_processing", "0") - // << Pair("ProductID", "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}") - - ; - - // send log - QFile logFile( CalamaresUtils::appLogDir().filePath( "Calamares.log" ) ); - logFile.open( QFile::ReadOnly ); - reporter.setReportData( "upload_file_calamareslog", - gzip_compress( logFile.readAll() ), - "application/x-gzip", - QFileInfo( logFile ).fileName().toUtf8()); - logFile.close(); - - reporter.show(); - - return app.exec(); -} diff --git a/src/crashreporter/resources.qrc b/src/crashreporter/resources.qrc deleted file mode 100644 index 4618c8f94..000000000 --- a/src/crashreporter/resources.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - ../../data/images/squid.svg - - diff --git a/src/libcalamares/CMakeLists.txt b/src/libcalamares/CMakeLists.txt index ba10fcc70..d52e60bfa 100644 --- a/src/libcalamares/CMakeLists.txt +++ b/src/libcalamares/CMakeLists.txt @@ -32,8 +32,7 @@ set( kdsagSources kdsingleapplicationguard/kdtoolsglobal.cpp kdsingleapplicationguard/kdlockedsharedmemorypointer.cpp ) -set_source_files_properties( ${kdsagSources} - PROPERTIES COMPILE_FLAGS "${SUPPRESS_3RDPARTY_WARNINGS}" ) +mark_thirdparty_code( ${kdsagSources} ) include_directories( ${CMAKE_CURRENT_BINARY_DIR} @@ -47,6 +46,9 @@ if( WITH_PYTHON ) PythonJob.cpp PythonJobApi.cpp ) + set_source_files_properties( PythonJob.cpp + PROPERTIES COMPILE_FLAGS "${SUPPRESS_BOOST_WARNINGS}" + ) include_directories(${PYTHON_INCLUDE_DIRS}) link_directories(${PYTHON_LIBRARIES}) diff --git a/src/libcalamares/CalamaresConfig.h.in b/src/libcalamares/CalamaresConfig.h.in index f278853a9..6fbab422c 100644 --- a/src/libcalamares/CalamaresConfig.h.in +++ b/src/libcalamares/CalamaresConfig.h.in @@ -10,7 +10,6 @@ //cmakedefines for CMake variables (e.g. for optdepends) go here #cmakedefine WITH_PYTHON -#cmakedefine WITH_CRASHREPORTER #cmakedefine WITH_PYTHONQT #endif // CALAMARESCONFIG_H diff --git a/src/libcalamares/PythonJob.h b/src/libcalamares/PythonJob.h index d13705ed8..2f0dbee07 100644 --- a/src/libcalamares/PythonJob.h +++ b/src/libcalamares/PythonJob.h @@ -39,7 +39,7 @@ public: const QString& workingPath, const QVariantMap& moduleConfiguration = QVariantMap(), QObject* parent = nullptr ); - virtual ~PythonJob(); + virtual ~PythonJob() override; QString prettyName() const override; QString prettyStatusMessage() const override; diff --git a/src/libcalamaresui/CMakeLists.txt b/src/libcalamaresui/CMakeLists.txt index 0021fbbfd..ccc46f2f3 100644 --- a/src/libcalamaresui/CMakeLists.txt +++ b/src/libcalamaresui/CMakeLists.txt @@ -1,6 +1,6 @@ project( libcalamaresui CXX ) -list( APPEND calamaresui_SOURCES +set( calamaresui_SOURCES modulesystem/CppJobModule.cpp modulesystem/Module.cpp modulesystem/ModuleManager.cpp @@ -29,7 +29,15 @@ list( APPEND calamaresui_SOURCES ViewManager.cpp ) -list( APPEND calamaresui_UI +# Don't warn about third-party sources +mark_thirdparty_code( + utils/ImageRegistry.cpp + utils/qjsonitem.cpp + utils/qjsonmodel.cpp + widgets/waitingspinnerwidget.cpp +) + +set( calamaresui_UI utils/DebugWindow.ui ) diff --git a/src/libcalamaresui/modulesystem/PythonJobModule.h b/src/libcalamaresui/modulesystem/PythonJobModule.h index e47d777c9..c82137cb8 100644 --- a/src/libcalamaresui/modulesystem/PythonJobModule.h +++ b/src/libcalamaresui/modulesystem/PythonJobModule.h @@ -40,7 +40,7 @@ protected: private: friend class Module; explicit PythonJobModule(); - virtual ~PythonJobModule(); + virtual ~PythonJobModule() override; QString m_scriptFileName; QString m_workingPath; diff --git a/src/modules/displaymanager/main.py b/src/modules/displaymanager/main.py index e16184d93..48248cb7c 100644 --- a/src/modules/displaymanager/main.py +++ b/src/modules/displaymanager/main.py @@ -487,8 +487,8 @@ def run(): if (os.path.exists(greeter_path)): # configure first found lightdm-greeter for entry in os.listdir(greeter_path): - if entry.name.endswith('.desktop'): - greeter = entry.name.split('.')[0] + if entry.endswith('.desktop'): + greeter = entry.split('.')[0] libcalamares.utils.debug( "found greeter {!s}".format(greeter) ) diff --git a/src/modules/finished/FinishedPage.cpp b/src/modules/finished/FinishedPage.cpp index bfaad165d..43e9f5329 100644 --- a/src/modules/finished/FinishedPage.cpp +++ b/src/modules/finished/FinishedPage.cpp @@ -50,11 +50,11 @@ FinishedPage::FinishedPage( QWidget* parent ) CALAMARES_RETRANSLATE( ui->retranslateUi( this ); ui->mainText->setText( tr( "

All done.


" - "%1 has been installed on your computer.
" - "You may now restart into your new system, or continue " - "using the %2 Live environment." ) - .arg( *Calamares::Branding::VersionedName ) - .arg( *Calamares::Branding::ProductName ) ); + "%1 has been installed on your computer.
" + "You may now restart into your new system, or continue " + "using the %2 Live environment." ) + .arg( *Calamares::Branding::VersionedName ) + .arg( *Calamares::Branding::ProductName ) ); ) } @@ -90,7 +90,7 @@ FinishedPage::setUpRestart() this, [this] { if ( ui->restartCheckBox->isVisible() && - ui->restartCheckBox->isChecked() ) + ui->restartCheckBox->isChecked() ) QProcess::execute( "/bin/sh", { "-c", m_restartNowCommand } ); } ); } @@ -108,9 +108,9 @@ FinishedPage::onInstallationFailed( const QString& message, const QString& detai { Q_UNUSED( details ); ui->mainText->setText( tr( "

Installation Failed


" - "%1 has not been installed on your computer.
" - "The error message was: %2." ) - .arg( *Calamares::Branding::VersionedName ) - .arg( message ) ); + "%1 has not been installed on your computer.
" + "The error message was: %2." ) + .arg( *Calamares::Branding::VersionedName ) + .arg( message ) ); setRestartNowEnabled( false ); } diff --git a/src/modules/finished/FinishedViewStep.cpp b/src/modules/finished/FinishedViewStep.cpp index a4cc5c734..d3beacb82 100644 --- a/src/modules/finished/FinishedViewStep.cpp +++ b/src/modules/finished/FinishedViewStep.cpp @@ -34,6 +34,7 @@ FinishedViewStep::FinishedViewStep( QObject* parent ) : Calamares::ViewStep( parent ) , m_widget( new FinishedPage() ) , installFailed( false ) + , m_notifyOnFinished( false ) { auto jq = Calamares::JobQueue::instance(); connect( jq, &Calamares::JobQueue::failed, @@ -110,7 +111,7 @@ FinishedViewStep::sendNotification() { // If the installation failed, don't send notification popup; // there's a (modal) dialog popped up with the failure notice. - if (installFailed) + if ( installFailed ) return; QDBusInterface notify( "org.freedesktop.Notifications", "/org/freedesktop/Notifications", "org.freedesktop.Notifications" ); @@ -139,7 +140,8 @@ FinishedViewStep::onActivate() { m_widget->setUpRestart(); - sendNotification(); + if ( m_notifyOnFinished ) + sendNotification(); } @@ -152,8 +154,8 @@ FinishedViewStep::jobs() const void FinishedViewStep::onInstallationFailed( const QString& message, const QString& details ) { - Q_UNUSED(message); - Q_UNUSED(details); + Q_UNUSED( message ); + Q_UNUSED( details ); installFailed = true; } @@ -179,6 +181,9 @@ FinishedViewStep::setConfigurationMap( const QVariantMap& configurationMap ) m_widget->setRestartNowCommand( "systemctl -i reboot" ); } } + if ( configurationMap.contains( "notifyOnFinished" ) && + configurationMap.value( "notifyOnFinished" ).type() == QVariant::Bool ) + m_notifyOnFinished = configurationMap.value( "notifyOnFinished" ).toBool(); } CALAMARES_PLUGIN_FACTORY_DEFINITION( FinishedViewStepFactory, registerPlugin(); ) diff --git a/src/modules/finished/FinishedViewStep.h b/src/modules/finished/FinishedViewStep.h index 6a11dc8a3..f13da9fb8 100644 --- a/src/modules/finished/FinishedViewStep.h +++ b/src/modules/finished/FinishedViewStep.h @@ -68,6 +68,7 @@ private: void sendNotification(); bool installFailed; + bool m_notifyOnFinished; }; CALAMARES_PLUGIN_FACTORY_DECLARATION( FinishedViewStepFactory ) diff --git a/src/modules/finished/finished.conf b/src/modules/finished/finished.conf index f93acb587..6bd8bb2d6 100644 --- a/src/modules/finished/finished.conf +++ b/src/modules/finished/finished.conf @@ -1,4 +1,17 @@ +Configuration for the "finished" page, which is usually shown only at +the end of the installation (successful or not). --- +# The finished page can hold a "restart system now" checkbox. +# If this is false, no checkbox is show and the system is not restarted +# when Calamares exits. restartNowEnabled: true +# Initial state of the checkbox "restart now". restartNowChecked: false +# If the checkbox is shown, and the checkbox is checked, then when +# Calamares exits from the finished-page it will run this command. restartNowCommand: "systemctl -i reboot" + +# When the last page is (successfully) reached, send a DBus notification +# to the desktop that the installation is done. This works only if the +# user as whom Calamares is run, can reach the regular desktop session bus. +notifyOnFinished: false diff --git a/src/modules/partition/core/BootLoaderModel.h b/src/modules/partition/core/BootLoaderModel.h index 2ef175e84..e911d9029 100644 --- a/src/modules/partition/core/BootLoaderModel.h +++ b/src/modules/partition/core/BootLoaderModel.h @@ -38,7 +38,7 @@ public: IsPartitionRole }; - BootLoaderModel( QObject* parent = 0 ); + BootLoaderModel( QObject* parent = nullptr ); ~BootLoaderModel() override; /** diff --git a/src/modules/partition/core/PartitionCoreModule.cpp b/src/modules/partition/core/PartitionCoreModule.cpp index 07c09c6d7..a40ca1035 100644 --- a/src/modules/partition/core/PartitionCoreModule.cpp +++ b/src/modules/partition/core/PartitionCoreModule.cpp @@ -270,8 +270,8 @@ PartitionCoreModule::deletePartition( Device* device, Partition* partition ) if ( !KPMHelpers::isPartitionFreeSpace( childPartition ) ) lst << childPartition; - for ( auto partition : lst ) - deletePartition( device, partition ); + for ( auto childPartition : lst ) + deletePartition( device, childPartition ); } QList< Calamares::job_ptr >& jobs = deviceInfo->jobs; @@ -441,7 +441,7 @@ PartitionCoreModule::osproberEntries() const } void -PartitionCoreModule::refreshPartition( Device* device, Partition* partition ) +PartitionCoreModule::refreshPartition( Device* device, Partition* ) { // Keep it simple for now: reset the model. This can be improved to cause // the model to emit dataChanged() for the affected row instead, avoiding diff --git a/src/modules/partition/gui/PartitionBarsView.cpp b/src/modules/partition/gui/PartitionBarsView.cpp index f1333da7c..a66420e1b 100644 --- a/src/modules/partition/gui/PartitionBarsView.cpp +++ b/src/modules/partition/gui/PartitionBarsView.cpp @@ -35,8 +35,8 @@ static const int VIEW_HEIGHT = qMax( CalamaresUtils::defaultFontHeight() + 8, // wins out with big fonts - (int)( CalamaresUtils::defaultFontHeight() * 0.6 ) + 22 ); // wins out with small fonts -static const int CORNER_RADIUS = 3; + int( CalamaresUtils::defaultFontHeight() * 0.6 ) + 22 ); // wins out with small fonts +static constexpr int CORNER_RADIUS = 3; static const int EXTENDED_PARTITION_MARGIN = qMax( 4, VIEW_HEIGHT / 6 ); // The SELECTION_MARGIN is applied within a hardcoded 2px padding anyway, so @@ -54,8 +54,8 @@ static const int SELECTION_MARGIN = qMin( ( EXTENDED_PARTITION_MARGIN - 2 ) / 2, PartitionBarsView::PartitionBarsView( QWidget* parent ) : QAbstractItemView( parent ) , m_nestedPartitionsMode( NoNestedPartitions ) - , m_hoveredIndex( QModelIndex() ) , canBeSelected( []( const QModelIndex& ) { return true; } ) + , m_hoveredIndex( QModelIndex() ) { setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); setFrameStyle( QFrame::NoFrame ); @@ -422,14 +422,14 @@ PartitionBarsView::setSelectionFilter( std::function< bool ( const QModelIndex& QModelIndex -PartitionBarsView::moveCursor( CursorAction cursorAction, Qt::KeyboardModifiers modifiers ) +PartitionBarsView::moveCursor( CursorAction, Qt::KeyboardModifiers ) { return QModelIndex(); } bool -PartitionBarsView::isIndexHidden( const QModelIndex& index ) const +PartitionBarsView::isIndexHidden( const QModelIndex& ) const { return false; } @@ -491,7 +491,7 @@ PartitionBarsView::mouseMoveEvent( QMouseEvent* event ) void -PartitionBarsView::leaveEvent( QEvent* event ) +PartitionBarsView::leaveEvent( QEvent* ) { QGuiApplication::restoreOverrideCursor(); if ( m_hoveredIndex.isValid() ) diff --git a/src/modules/partition/gui/PartitionSizeController.cpp b/src/modules/partition/gui/PartitionSizeController.cpp index 3cf915c7d..3bb9e758c 100644 --- a/src/modules/partition/gui/PartitionSizeController.cpp +++ b/src/modules/partition/gui/PartitionSizeController.cpp @@ -58,7 +58,7 @@ PartitionSizeController::setPartResizerWidget( PartResizerWidget* widget, bool f Q_ASSERT( m_device ); if ( m_partResizerWidget ) - disconnect( m_partResizerWidget, 0, this, 0 ); + disconnect( m_partResizerWidget, nullptr, this, nullptr ); m_dirty = false; m_currentSpinBoxValue = -1; @@ -108,7 +108,7 @@ void PartitionSizeController::setSpinBox( QSpinBox* spinBox ) { if ( m_spinBox ) - disconnect( m_spinBox, 0, this, 0 ); + disconnect( m_spinBox, nullptr, this, nullptr ); m_spinBox = spinBox; m_spinBox->setMaximum( std::numeric_limits< int >::max() ); connectWidgets(); diff --git a/src/modules/partition/gui/ReplaceWidget.cpp b/src/modules/partition/gui/ReplaceWidget.cpp index 1057127cd..f5a492809 100644 --- a/src/modules/partition/gui/ReplaceWidget.cpp +++ b/src/modules/partition/gui/ReplaceWidget.cpp @@ -347,7 +347,7 @@ ReplaceWidget::updateFromCurrentDevice( QComboBox* devicesComboBox ) QAbstractItemModel* oldModel = m_ui->partitionTreeView->model(); if ( oldModel ) - disconnect( oldModel, 0, this, 0 ); + disconnect( oldModel, nullptr, this, nullptr ); PartitionModel* model = m_core->partitionModelForDevice( device ); m_ui->partitionTreeView->setModel( model ); diff --git a/src/modules/partition/jobs/FormatPartitionJob.cpp b/src/modules/partition/jobs/FormatPartitionJob.cpp index 0ea9192db..162839ce7 100644 --- a/src/modules/partition/jobs/FormatPartitionJob.cpp +++ b/src/modules/partition/jobs/FormatPartitionJob.cpp @@ -78,7 +78,7 @@ FormatPartitionJob::prettyStatusMessage() const Calamares::JobResult FormatPartitionJob::exec() { - Report report( 0 ); + Report report( nullptr ); // Root of the report tree, no parent QString partitionPath = m_partition->partitionPath(); QString message = tr( "The installer failed to format partition %1 on disk '%2'." ).arg( partitionPath, m_device->name() ); diff --git a/src/modules/summary/SummaryPage.cpp b/src/modules/summary/SummaryPage.cpp index c13ec1ccd..bc0864775 100644 --- a/src/modules/summary/SummaryPage.cpp +++ b/src/modules/summary/SummaryPage.cpp @@ -36,9 +36,10 @@ static const int SECTION_SPACING = 12; SummaryPage::SummaryPage( const SummaryViewStep* thisViewStep, QWidget* parent ) : QWidget() , m_thisViewStep( thisViewStep ) - , m_scrollArea( new QScrollArea( this ) ) , m_contentWidget( nullptr ) + , m_scrollArea( new QScrollArea( this ) ) { + Q_UNUSED( parent ); Q_ASSERT( m_thisViewStep ); QVBoxLayout* layout = new QVBoxLayout( this ); layout->setContentsMargins( 0, 0, 0, 0 ); @@ -65,7 +66,6 @@ SummaryPage::onActivate() { createContentWidget(); - QString text; bool first = true; const Calamares::ViewStepList steps = stepsForSummary( Calamares::ViewManager::instance()->viewSteps() ); diff --git a/src/modules/welcome/CMakeLists.txt b/src/modules/welcome/CMakeLists.txt index f901a768e..f73d8850d 100644 --- a/src/modules/welcome/CMakeLists.txt +++ b/src/modules/welcome/CMakeLists.txt @@ -5,8 +5,6 @@ find_package( Qt5 ${QT_VERSION} CONFIG REQUIRED DBus Network ) include_directories( ${PROJECT_BINARY_DIR}/src/libcalamaresui ) -set_source_files_properties( checker/partman_devices.c PROPERTIES LANGUAGE CXX ) - set( CHECKER_SOURCES checker/CheckItemWidget.cpp checker/CheckerWidget.cpp diff --git a/src/modules/welcome/checker/partman_devices.h b/src/modules/welcome/checker/partman_devices.h index 8bc19e58b..8bf620a48 100644 --- a/src/modules/welcome/checker/partman_devices.h +++ b/src/modules/welcome/checker/partman_devices.h @@ -19,6 +19,14 @@ #ifndef PARTMAN_DEVICES_H #define PARTMAN_DEVICES_H +#ifdef __cplusplus +extern "C" { +#endif + int check_big_enough(long long required_space); +#ifdef __cplusplus +} // extern "C" +#endif + #endif // PARTMAN_DEVICES_H diff --git a/src/qml/calamares/slideshow/Presentation.qml b/src/qml/calamares/slideshow/Presentation.qml index 59878c644..b53b9fc55 100644 --- a/src/qml/calamares/slideshow/Presentation.qml +++ b/src/qml/calamares/slideshow/Presentation.qml @@ -1,29 +1,16 @@ -/* === This file is part of Calamares - === +/* === This file is part of Calamares - === * - * Copyright 2015, Teo Mrnjavac + * Copyright 2017, Adriaan de Groot + * - added looping, keys-instead-of-shortcut * - * Based on the QML Presentation System. - * Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). - * Header reproduced verbatim below. - * - * Calamares 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, either version 3 of the License, or - * (at your option) any later version. - * - * Calamares 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 Calamares. If not, see . + * SPDX-License-Identifier: LGPL-2.1 + * License-Filename: LICENSES/LGPLv2.1-Presentation */ /**************************************************************************** ** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QML Presentation System. ** @@ -62,18 +49,20 @@ ****************************************************************************/ -import QtQuick 2.0 +import QtQuick 2.5 import QtQuick.Window 2.0 Item { id: root property variant slides: [] - property int currentSlide; + property int currentSlide: 0 property bool showNotes: false; property bool allowDelay: true; - property bool loop: true; + property alias mouseNavigation: mouseArea.enabled + property bool arrowNavigation: true + property bool keyShortcutsEnabled: true property color titleColor: textColor; property color textColor: "black" @@ -83,6 +72,7 @@ Item { // Private API property bool _faded: false property int _userNum; + property int _lastShownSlide: 0 Component.onCompleted: { var slideCount = 0; @@ -98,10 +88,8 @@ Item { root._userNum = 0; // Make first slide visible... - if (root.slides.length > 0) { - root.currentSlide = 0; + if (root.slides.length > 0) root.slides[root.currentSlide].visible = true; - } } function switchSlides(from, to, forward) { @@ -110,6 +98,13 @@ Item { return true } + onCurrentSlideChanged: { + switchSlides(root.slides[_lastShownSlide], root.slides[currentSlide], currentSlide > _lastShownSlide) + _lastShownSlide = currentSlide + // Always keep focus on the slideshow + root.focus = true + } + function goToNextSlide() { root._userNum = 0 if (_faded) @@ -118,38 +113,18 @@ Item { if (root.slides[currentSlide]._advance()) return; } - if (root.currentSlide + 1 < root.slides.length) { - var from = slides[currentSlide] - var to = slides[currentSlide + 1] - if (switchSlides(from, to, true)) { - currentSlide = currentSlide + 1; - root.focus = true; - } - } - else { - if (root.loop) { - var from = slides[currentSlide] - var to = slides[0] - if (switchSlides(from, to, true)) { - currentSlide = 0; - root.focus = true; - } - } - } + if (currentSlide + 1 < root.slides.length) + ++currentSlide; + else + currentSlide = 0; // Loop at the end } function goToPreviousSlide() { root._userNum = 0 if (root._faded) return - if (root.currentSlide - 1 >= 0) { - var from = slides[currentSlide] - var to = slides[currentSlide - 1] - if (switchSlides(from, to, false)) { - currentSlide = currentSlide - 1; - root.focus = true; - } - } + if (currentSlide - 1 >= 0) + --currentSlide; } function goToUserSlide() { @@ -158,38 +133,45 @@ Item { return if (_userNum < 0) goToNextSlide() - else if (root.currentSlide != _userNum) { - var from = slides[currentSlide] - var to = slides[_userNum] - if (switchSlides(from, to, _userNum > currentSlide)) { - currentSlide = _userNum; - root.focus = true; - } + else { + currentSlide = _userNum; + root.focus = true; } } - focus: true - - Keys.onSpacePressed: goToNextSlide() - Keys.onRightPressed: goToNextSlide() - Keys.onDownPressed: goToNextSlide() - Keys.onLeftPressed: goToPreviousSlide() - Keys.onUpPressed: goToPreviousSlide() - Keys.onEscapePressed: Qt.quit() + // directly type in the slide number: depends on root having focus Keys.onPressed: { if (event.key >= Qt.Key_0 && event.key <= Qt.Key_9) _userNum = 10 * _userNum + (event.key - Qt.Key_0) else { if (event.key == Qt.Key_Return || event.key == Qt.Key_Enter) goToUserSlide(); - else if (event.key == Qt.Key_Backspace) - goToPreviousSlide(); - else if (event.key == Qt.Key_C) - root._faded = !root._faded; _userNum = 0; } } + focus: true // Keep focus + + // Navigation through key events, too + Keys.onSpacePressed: goToNextSlide() + Keys.onRightPressed: goToNextSlide() + Keys.onLeftPressed: goToPreviousSlide() + + // navigate with arrow keys + Shortcut { sequence: StandardKey.MoveToNextLine; enabled: root.arrowNavigation; onActivated: goToNextSlide() } + Shortcut { sequence: StandardKey.MoveToPreviousLine; enabled: root.arrowNavigation; onActivated: goToPreviousSlide() } + Shortcut { sequence: StandardKey.MoveToNextChar; enabled: root.arrowNavigation; onActivated: goToNextSlide() } + Shortcut { sequence: StandardKey.MoveToPreviousChar; enabled: root.arrowNavigation; onActivated: goToPreviousSlide() } + + // presentation-specific single-key shortcuts (which interfere with normal typing) + Shortcut { sequence: " "; enabled: root.keyShortcutsEnabled; onActivated: goToNextSlide() } + Shortcut { sequence: "c"; enabled: root.keyShortcutsEnabled; onActivated: root._faded = !root._faded } + + // standard shortcuts + Shortcut { sequence: StandardKey.MoveToNextPage; onActivated: goToNextSlide() } + Shortcut { sequence: StandardKey.MoveToPreviousPage; onActivated: goToPreviousSlide() } + Shortcut { sequence: StandardKey.Quit; onActivated: Qt.quit() } + Rectangle { z: 1000 color: "black" @@ -219,16 +201,61 @@ Item { title: "QML Presentation: Notes" visible: root.showNotes - Text { + Flickable { anchors.fill: parent - anchors.margins: parent.height * 0.1; + contentWidth: parent.width + contentHeight: textContainer.height - font.pixelSize: 16 - wrapMode: Text.WordWrap + Item { + id: textContainer + width: parent.width + height: notesText.height + 2 * notesText.padding - property string notes: root.slides[root.currentSlide].notes; - text: notes == "" ? "Slide has no notes..." : notes; - font.italic: notes == ""; + Text { + id: notesText + + property real padding: 16; + + x: padding + y: padding + width: parent.width - 2 * padding + + + font.pixelSize: 16 + wrapMode: Text.WordWrap + + property string notes: root.slides[root.currentSlide].notes; + + onNotesChanged: { + var result = ""; + + var lines = notes.split("\n"); + var beginNewLine = false + for (var i=0; i 0) + result += " "; + result += line; + } + } + + if (result.length == 0) { + font.italic = true; + text = "no notes.." + } else { + font.italic = false; + text = result; + } + } + } + } } } } diff --git a/src/qml/calamares/slideshow/Slide.qml b/src/qml/calamares/slideshow/Slide.qml index e46b5687d..e033e3c17 100644 --- a/src/qml/calamares/slideshow/Slide.qml +++ b/src/qml/calamares/slideshow/Slide.qml @@ -1,3 +1,9 @@ +/* === This file is part of Calamares - === + * + * SPDX-License-Identifier: LGPL-2.1 + * License-Filename: LICENSES/LGPLv2.1-Presentation + */ + /**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). @@ -167,20 +173,19 @@ Item { Rectangle { id: dot - y: baseFontSize * row.indentFactor / 2 - width: baseFontSize / 4 - height: baseFontSize / 4 + anchors.baseline: text.baseline + anchors.baselineOffset: -text.font.pixelSize / 2 + width: text.font.pixelSize / 3 + height: text.font.pixelSize / 3 color: slide.textColor radius: width / 2 - smooth: true opacity: text.text.length == 0 ? 0 : 1 } - Rectangle { + Item { id: space - width: dot.width * 2 + width: dot.width * 1.5 height: 1 - color: "#00ffffff" } Text {