[Merge] add some fixes

This commit is contained in:
Philip 2017-09-21 02:40:54 -04:00
commit 28931b32b5
77 changed files with 982 additions and 748 deletions

View File

@ -1 +1,2 @@
Teo Mrnjavac <teo@kde.org>
Adriaan de Groot <groot@kde.org>

View File

@ -1,4 +1,22 @@
### CMakeLists.txt for Calamares
# === This file is part of Calamares - <https://github.com/calamares> ===
#
# 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 <http://www.gnu.org/licenses/>.
#
# SPDX-License-Identifier: GPL-3.0+
# License-Filename: LICENSE
#
###
#
# Generally, this CMakeLists.txt will find all the dependencies for Calamares
# and complain appropriately. See below (later in this file) for CMake-level
@ -30,7 +48,30 @@ if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
set( CMAKE_C_FLAGS_RELEASE "-O4 -DNDEBUG" )
set( CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-padded -Wno-undefined-reinterpret-cast -Wno-global-constructors -Wno-exit-time-destructors" )
# Clang warnings: doing *everything* is counter-productive, since it warns
# about things which we can't fix (e.g. C++98 incompatibilities, but
# Calaares is C++14).
foreach( CLANG_WARNINGS
-Weverything
-Wno-c++98-compat
-Wno-c++98-compat-pedantic
-Wno-padded
-Wno-undefined-reinterpret-cast
-Wno-global-constructors
-Wno-exit-time-destructors
-Wno-missing-prototypes
-Wno-documentation-unknown-command
)
string( APPEND CMAKE_CXX_FLAGS " ${CLANG_WARNINGS}" )
endforeach()
# 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( <file>
# PROPERTIES COMPILE_FLAGS "${SUPPRESS_3RDPARTY_WARNINGS}" )
# to switch off warnings for those sources.
set( SUPPRESS_3RDPARTY_WARNINGS "-Wno-everything" )
set( CMAKE_CXX_FLAGS_DEBUG "-g" )
set( CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG" )
set( CMAKE_CXX_FLAGS_RELEASE "-O4 -DNDEBUG" )
@ -42,6 +83,8 @@ if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
else()
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--no-undefined" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--fatal-warnings -Wnon-virtual-dtor -Woverloaded-virtual -Werror=return-type" )
set( SUPPRESS_3RDPARTY_WARNINGS "" )
endif()
if( CMAKE_COMPILER_IS_GNUCXX )
@ -61,7 +104,6 @@ find_package( YAMLCPP 0.5.1 REQUIRED )
find_package( PolkitQt5-1 REQUIRED )
option( WITH_PYTHON "Enable Python modules API (requires Boost.Python)." ON )
# option( WITH_CRASHREPORTER "Build with CrashReporter" OFF )
option( INSTALL_CONFIG "Install configuration files" ON )
option( WITH_PYTHONQT "Enable next generation Python modules API (experimental, requires PythonQt)." OFF )
option( BUILD_TESTING "Build the testing tree." ON )
@ -70,11 +112,6 @@ if( BUILD_TESTING )
enable_testing()
endif ()
# if( CMAKE_SYSTEM_PROCESSOR MATCHES "arm" OR NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libcrashreporter-qt/CMakeLists.txt" )
# message( STATUS "Build of crashreporter disabled." )
# set( WITH_CRASHREPORTER OFF )
# endif()
find_package( PythonLibs 3.3 )
set_package_properties(
PYTHONLIBS PROPERTIES

View File

@ -0,0 +1,16 @@
/*
* Copyright 2012, Christian Muehlhaeuser <muesli@tomahawk-player.org>
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, either version 3 of the License, or
(at your option) any later version.
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 <http://www.gnu.org/licenses/>.
*/

View File

@ -0,0 +1,18 @@
/***********************************************
Copyright (C) 2014 Schutz Sacha
This file is part of QJsonModel (https://github.com/dridk/QJsonmodel).
QJsonModel 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.
QJsonModel 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 QJsonModel. If not, see <http://www.gnu.org/licenses/>.
**********************************************/

View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Original Work Copyright (c) 2012-2015 Alexander Turkin
Modified 2014 by William Hallatt
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -11,6 +11,8 @@ Icon=calamares
Terminal=false
StartupNotify=true
Categories=Qt;System;
# Translations
Name[ca]=Calamares
Icon[ca]=calamares
GenericName[ca]=Instal·lador de sistema

View File

@ -43,6 +43,14 @@ BOILERPLATE="Automatic merge of Transifex translations"
git add --verbose lang/calamares*.ts
git commit "$AUTHOR" --message="[core] $BOILERPLATE" | true
rm -f lang/desktop*.desktop
awk '
BEGIN {skip=0;}
/^# Translations/ {skip=1;}
{if (!skip || (length($0)>1 && $0 != "# Translations")) {
skip=0; print $0;
}}' < calamares.desktop > calamares.desktop.new
mv calamares.desktop.new calamares.desktop
git add --verbose calamares.desktop
git commit "$AUTHOR" --message="[desktop] $BOILERPLATE" | true

View File

@ -71,18 +71,18 @@
<message>
<location filename="../src/libcalamaresui/utils/DebugWindow.ui" line="57"/>
<source>Type:</source>
<translation type="unfinished"/>
<translation>Tipo:</translation>
</message>
<message>
<location filename="../src/libcalamaresui/utils/DebugWindow.ui" line="64"/>
<location filename="../src/libcalamaresui/utils/DebugWindow.ui" line="78"/>
<source>none</source>
<translation type="unfinished"/>
<translation>Non</translation>
</message>
<message>
<location filename="../src/libcalamaresui/utils/DebugWindow.ui" line="71"/>
<source>Interface:</source>
<translation type="unfinished"/>
<translation>Interface</translation>
</message>
<message>
<location filename="../src/libcalamaresui/utils/DebugWindow.ui" line="93"/>
@ -241,7 +241,7 @@ Saída:
<location filename="../src/libcalamaresui/ViewManager.cpp" line="76"/>
<location filename="../src/libcalamaresui/ViewManager.cpp" line="310"/>
<source>Cancel installation without changing the system.</source>
<translation type="unfinished"/>
<translation>Cancela-la instalación sen cambia-lo sistema</translation>
</message>
<message>
<location filename="../src/libcalamaresui/ViewManager.cpp" line="99"/>
@ -258,17 +258,17 @@ O instalador pecharase e perderanse todos os cambios.</translation>
<message>
<location filename="../src/libcalamaresui/ViewManager.cpp" line="105"/>
<source>&amp;Yes</source>
<translation type="unfinished"/>
<translation>&amp;Si</translation>
</message>
<message>
<location filename="../src/libcalamaresui/ViewManager.cpp" line="106"/>
<source>&amp;No</source>
<translation type="unfinished"/>
<translation>&amp;Non</translation>
</message>
<message>
<location filename="../src/libcalamaresui/ViewManager.cpp" line="186"/>
<source>&amp;Close</source>
<translation type="unfinished"/>
<translation>&amp;Pechar</translation>
</message>
<message>
<location filename="../src/libcalamaresui/ViewManager.cpp" line="238"/>
@ -293,12 +293,12 @@ O instalador pecharase e perderanse todos os cambios.</translation>
<message>
<location filename="../src/libcalamaresui/ViewManager.cpp" line="276"/>
<source>&amp;Done</source>
<translation type="unfinished"/>
<translation>&amp;Feito</translation>
</message>
<message>
<location filename="../src/libcalamaresui/ViewManager.cpp" line="277"/>
<source>The installation is complete. Close the installer.</source>
<translation type="unfinished"/>
<translation>Completouse a instalacion. Peche o instalador</translation>
</message>
<message>
<location filename="../src/libcalamaresui/ViewManager.cpp" line="183"/>
@ -554,7 +554,7 @@ O instalador pecharase e perderanse todos os cambios.</translation>
<message>
<location filename="../src/modules/partition/gui/CreatePartitionDialog.ui" line="48"/>
<source> MiB</source>
<translation type="unfinished"/>
<translation>MiB</translation>
</message>
<message>
<location filename="../src/modules/partition/gui/CreatePartitionDialog.ui" line="55"/>
@ -614,7 +614,7 @@ O instalador pecharase e perderanse todos os cambios.</translation>
<message>
<location filename="../src/modules/partition/gui/CreatePartitionDialog.cpp" line="269"/>
<source>Mountpoint already in use. Please select another one.</source>
<translation type="unfinished"/>
<translation>Punto de montaxe xa en uso. Faga o favor de escoller outro</translation>
</message>
</context>
<context>
@ -827,32 +827,32 @@ O instalador pecharase e perderanse todos os cambios.</translation>
<message>
<location filename="../src/modules/partition/gui/DeviceInfoWidget.cpp" line="150"/>
<source>The type of &lt;strong&gt;partition table&lt;/strong&gt; on the selected storage device.&lt;br&gt;&lt;br&gt;The only way to change the partition table type is to erase and recreate the partition table from scratch, which destroys all data on the storage device.&lt;br&gt;This installer will keep the current partition table unless you explicitly choose otherwise.&lt;br&gt;If unsure, on modern systems GPT is preferred.</source>
<translation type="unfinished"/>
<translation>O tipo de &lt;strong&gt;táboa de partición&lt;/strong&gt;no dispositivo de almacenamento escollido.&lt;br&gt;&lt;br&gt;O único xeito de cambia-lo tipo de partición é borrar e volver a crear a táboa de partición dende o comenzo, isto destrúe todolos datos no dispositivo de almacenamento. &lt;br&gt; Este instalador manterá a táboa de partición actúal agás que escolla outra cousa explicitamente. &lt;br&gt; Se non está seguro, en sistemas modernos é preferibel GPT.</translation>
</message>
<message>
<location filename="../src/modules/partition/gui/DeviceInfoWidget.cpp" line="107"/>
<source>This device has a &lt;strong&gt;%1&lt;/strong&gt; partition table.</source>
<translation type="unfinished"/>
<translation>O dispositivo ten &lt;strong&gt;%1&lt;/strong&gt; una táboa de partición.</translation>
</message>
<message>
<location filename="../src/modules/partition/gui/DeviceInfoWidget.cpp" line="114"/>
<source>This is a &lt;strong&gt;loop&lt;/strong&gt; device.&lt;br&gt;&lt;br&gt;It is a pseudo-device with no partition table that makes a file accessible as a block device. This kind of setup usually only contains a single filesystem.</source>
<translation type="unfinished"/>
<translation>Este é un dispositivo de tipo &lt;strong&gt;loop&lt;/strong&gt;. &lt;br&gt;&lt;br&gt; É un pseudo-dispositivo que non ten táboa de partición que permita acceder aos ficheiros como un dispositivo de bloques. Este,modo de configuración normalmente so contén un sistema de ficheiros individual.</translation>
</message>
<message>
<location filename="../src/modules/partition/gui/DeviceInfoWidget.cpp" line="121"/>
<source>This installer &lt;strong&gt;cannot detect a partition table&lt;/strong&gt; on the selected storage device.&lt;br&gt;&lt;br&gt;The device either has no partition table, or the partition table is corrupted or of an unknown type.&lt;br&gt;This installer can create a new partition table for you, either automatically, or through the manual partitioning page.</source>
<translation type="unfinished"/>
<translation>Este instalador &lt;strong&gt;non pode detectar unha táboa de partición &lt;/strong&gt;no sistema de almacenamento seleccionado. &lt;br&gt;&lt;br&gt;O dispositivo non ten táboa de particion ou a táboa de partición está corrompida ou é dun tipo descoñecido.&lt;br&gt;Este instalador poder crear una táboa de partición nova por vóstede, ben automaticamente ou a través de páxina de particionamento a man. </translation>
</message>
<message>
<location filename="../src/modules/partition/gui/DeviceInfoWidget.cpp" line="131"/>
<source>&lt;br&gt;&lt;br&gt;This is the recommended partition table type for modern systems which start from an &lt;strong&gt;EFI&lt;/strong&gt; boot environment.</source>
<translation type="unfinished"/>
<translation>&lt;br&gt;&lt;br&gt;Este é o tipo de táboa de partición recomendada para sistema modernos que empezan dende un sistema de arranque &lt;strong&gt;EFI&lt;/strong&gt;.</translation>
</message>
<message>
<location filename="../src/modules/partition/gui/DeviceInfoWidget.cpp" line="137"/>
<source>&lt;br&gt;&lt;br&gt;This partition table type is only advisable on older systems which start from a &lt;strong&gt;BIOS&lt;/strong&gt; boot environment. GPT is recommended in most other cases.&lt;br&gt;&lt;br&gt;&lt;strong&gt;Warning:&lt;/strong&gt; the MBR partition table is an obsolete MS-DOS era standard.&lt;br&gt;Only 4 &lt;em&gt;primary&lt;/em&gt; partitions may be created, and of those 4, one can be an &lt;em&gt;extended&lt;/em&gt; partition, which may in turn contain many &lt;em&gt;logical&lt;/em&gt; partitions.</source>
<translation type="unfinished"/>
<translation>&lt;br&gt;&lt;br&gt;Esta táboa de partición so é recomendabel en sistemas vellos que empezan dende un sistema de arranque &lt;strong&gt;BIOS&lt;/strong&gt;. GPT é recomendabel na meirande parte dos outros casos.&lt;br&gt;&lt;br&gt;&lt;strong&gt;Atención:&lt;/strong&gt;A táboa de partición MBR é un estándar obsoleto da época do MS-DOS.&lt;br&gt;So pódense crear 4 particións &lt;em&gt;primarias&lt;/em&gt;, e desas 4, una pode ser unha partición&lt;em&gt;extensa&lt;/em&gt;, que pode conter muitas particións &lt;em&gt;lóxicas&lt;/em&gt;.</translation>
</message>
</context>
<context>
@ -868,17 +868,17 @@ O instalador pecharase e perderanse todos os cambios.</translation>
<message>
<location filename="../src/modules/dracutlukscfg/DracutLuksCfgJob.cpp" line="131"/>
<source>Write LUKS configuration for Dracut to %1</source>
<translation type="unfinished"/>
<translation>Escribila configuración LUKS para Dracut en %1</translation>
</message>
<message>
<location filename="../src/modules/dracutlukscfg/DracutLuksCfgJob.cpp" line="133"/>
<source>Skip writing LUKS configuration for Dracut: &quot;/&quot; partition is not encrypted</source>
<translation type="unfinished"/>
<translation>Saltando escribila configuración LUKS para Dracut: A partición &quot;/&quot; non está encriptada</translation>
</message>
<message>
<location filename="../src/modules/dracutlukscfg/DracutLuksCfgJob.cpp" line="149"/>
<source>Failed to open %1</source>
<translation type="unfinished"/>
<translation>Fallou ao abrir %1</translation>
</message>
</context>
<context>
@ -894,27 +894,27 @@ O instalador pecharase e perderanse todos os cambios.</translation>
<message>
<location filename="../src/modules/partition/gui/EditExistingPartitionDialog.ui" line="20"/>
<source>Edit Existing Partition</source>
<translation type="unfinished"/>
<translation>Editar unha partición existente</translation>
</message>
<message>
<location filename="../src/modules/partition/gui/EditExistingPartitionDialog.ui" line="50"/>
<source>Content:</source>
<translation type="unfinished"/>
<translation>Contido:</translation>
</message>
<message>
<location filename="../src/modules/partition/gui/EditExistingPartitionDialog.ui" line="60"/>
<source>&amp;Keep</source>
<translation type="unfinished"/>
<translation>&amp;Gardar</translation>
</message>
<message>
<location filename="../src/modules/partition/gui/EditExistingPartitionDialog.ui" line="70"/>
<source>Format</source>
<translation type="unfinished"/>
<translation>Formato</translation>
</message>
<message>
<location filename="../src/modules/partition/gui/EditExistingPartitionDialog.ui" line="89"/>
<source>Warning: Formatting the partition will erase all existing data.</source>
<translation type="unfinished"/>
<translation>Atención: Dar formato á partición borrará tódolos datos existentes.</translation>
</message>
<message>
<location filename="../src/modules/partition/gui/EditExistingPartitionDialog.ui" line="99"/>
@ -929,22 +929,22 @@ O instalador pecharase e perderanse todos os cambios.</translation>
<message>
<location filename="../src/modules/partition/gui/EditExistingPartitionDialog.ui" line="129"/>
<source> MiB</source>
<translation type="unfinished"/>
<translation>MiB</translation>
</message>
<message>
<location filename="../src/modules/partition/gui/EditExistingPartitionDialog.ui" line="136"/>
<source>Fi&amp;le System:</source>
<translation type="unfinished"/>
<translation>Sistema de Ficheiros:</translation>
</message>
<message>
<location filename="../src/modules/partition/gui/EditExistingPartitionDialog.ui" line="149"/>
<source>Flags:</source>
<translation type="unfinished"/>
<translation>Bandeiras:</translation>
</message>
<message>
<location filename="../src/modules/partition/gui/EditExistingPartitionDialog.cpp" line="307"/>
<source>Mountpoint already in use. Please select another one.</source>
<translation type="unfinished"/>
<translation>Punto de montaxe xa en uso. Faga o favor de escoller outro.</translation>
</message>
</context>
<context>
@ -952,27 +952,27 @@ O instalador pecharase e perderanse todos os cambios.</translation>
<message>
<location filename="../src/modules/partition/gui/EncryptWidget.ui" line="14"/>
<source>Form</source>
<translation type="unfinished"/>
<translation>Formulario</translation>
</message>
<message>
<location filename="../src/modules/partition/gui/EncryptWidget.ui" line="32"/>
<source>En&amp;crypt system</source>
<translation type="unfinished"/>
<translation>En&amp;criptar sistema</translation>
</message>
<message>
<location filename="../src/modules/partition/gui/EncryptWidget.ui" line="42"/>
<source>Passphrase</source>
<translation type="unfinished"/>
<translation>Frase de contrasinal</translation>
</message>
<message>
<location filename="../src/modules/partition/gui/EncryptWidget.ui" line="52"/>
<source>Confirm passphrase</source>
<translation type="unfinished"/>
<translation>Confirme a frase de contrasinal</translation>
</message>
<message>
<location filename="../src/modules/partition/gui/EncryptWidget.cpp" line="151"/>
<source>Please enter the same passphrase in both boxes.</source>
<translation type="unfinished"/>
<translation>Faga o favor de introducila a misma frase de contrasinal námbalas dúas caixas.</translation>
</message>
</context>
<context>
@ -980,37 +980,37 @@ O instalador pecharase e perderanse todos os cambios.</translation>
<message>
<location filename="../src/modules/partition/jobs/FillGlobalStorageJob.cpp" line="123"/>
<source>Set partition information</source>
<translation type="unfinished"/>
<translation>Poñela información da partición</translation>
</message>
<message>
<location filename="../src/modules/partition/jobs/FillGlobalStorageJob.cpp" line="147"/>
<source>Install %1 on &lt;strong&gt;new&lt;/strong&gt; %2 system partition.</source>
<translation type="unfinished"/>
<translation>Instalar %1 nunha &lt;strong&gt;nova&lt;/strong&gt; partición do sistema %2</translation>
</message>
<message>
<location filename="../src/modules/partition/jobs/FillGlobalStorageJob.cpp" line="151"/>
<source>Set up &lt;strong&gt;new&lt;/strong&gt; %2 partition with mount point &lt;strong&gt;%1&lt;/strong&gt;.</source>
<translation type="unfinished"/>
<translation>Configure unha &lt;strong&gt;nova&lt;/strong&gt; partición %2 con punto de montaxe &lt;strong&gt;%1&lt;/strong&gt;.</translation>
</message>
<message>
<location filename="../src/modules/partition/jobs/FillGlobalStorageJob.cpp" line="159"/>
<source>Install %2 on %3 system partition &lt;strong&gt;%1&lt;/strong&gt;.</source>
<translation type="unfinished"/>
<translation>Instalar %2 na partición do sistema %3 &lt;strong&gt;%1&lt;/strong&gt;.</translation>
</message>
<message>
<location filename="../src/modules/partition/jobs/FillGlobalStorageJob.cpp" line="164"/>
<source>Set up %3 partition &lt;strong&gt;%1&lt;/strong&gt; with mount point &lt;strong&gt;%2&lt;/strong&gt;.</source>
<translation type="unfinished"/>
<translation>Configurala partición %3 &lt;strong&gt;%1&lt;/strong&gt; con punto de montaxe &lt;strong&gt;%2&lt;/strong&gt;.</translation>
</message>
<message>
<location filename="../src/modules/partition/jobs/FillGlobalStorageJob.cpp" line="176"/>
<source>Install boot loader on &lt;strong&gt;%1&lt;/strong&gt;.</source>
<translation type="unfinished"/>
<translation>Instalar o cargador de arranque en &lt;strong&gt;%1&lt;/strong&gt;.</translation>
</message>
<message>
<location filename="../src/modules/partition/jobs/FillGlobalStorageJob.cpp" line="186"/>
<source>Setting up mount points.</source>
<translation type="unfinished"/>
<translation>Configuralos puntos de montaxe.</translation>
</message>
</context>
<context>
@ -1023,17 +1023,17 @@ O instalador pecharase e perderanse todos os cambios.</translation>
<message>
<location filename="../src/modules/finished/FinishedPage.ui" line="77"/>
<source>&amp;Restart now</source>
<translation type="unfinished"/>
<translation>&amp;Reiniciar agora.</translation>
</message>
<message>
<location filename="../src/modules/finished/FinishedPage.cpp" line="52"/>
<source>&lt;h1&gt;All done.&lt;/h1&gt;&lt;br/&gt;%1 has been installed on your computer.&lt;br/&gt;You may now restart into your new system, or continue using the %2 Live environment.</source>
<translation type="unfinished"/>
<translation>&lt;h1&gt;Todo feito.&lt;/h1&gt;&lt;br/&gt;%1 foi instalado na súa computadora.&lt;br/&gt;Agora pode reiniciar no seu novo sistema ou continuar a usalo entorno Live %2.</translation>
</message>
<message>
<location filename="../src/modules/finished/FinishedPage.cpp" line="110"/>
<source>&lt;h1&gt;Installation Failed&lt;/h1&gt;&lt;br/&gt;%1 has not been installed on your computer.&lt;br/&gt;The error message was: %2.</source>
<translation type="unfinished"/>
<translation>&lt;h1&gt;Fallou a instalación&lt;/h1&gt;&lt;br/&gt;%1 non se pudo instalar na sua computadora. &lt;br/&gt;A mensaxe de erro foi: %2.</translation>
</message>
</context>
<context>
@ -1041,17 +1041,17 @@ O instalador pecharase e perderanse todos os cambios.</translation>
<message>
<location filename="../src/modules/finished/FinishedViewStep.cpp" line="60"/>
<source>Finish</source>
<translation type="unfinished"/>
<translation>Fin</translation>
</message>
<message>
<location filename="../src/modules/finished/FinishedViewStep.cpp" line="126"/>
<source>Installation Complete</source>
<translation type="unfinished"/>
<translation>Instalacion completa</translation>
</message>
<message>
<location filename="../src/modules/finished/FinishedViewStep.cpp" line="127"/>
<source>The installation of %1 is complete.</source>
<translation type="unfinished"/>
<translation>Completouse a instalación de %1</translation>
</message>
</context>
<context>
@ -1059,22 +1059,22 @@ O instalador pecharase e perderanse todos os cambios.</translation>
<message>
<location filename="../src/modules/partition/jobs/FormatPartitionJob.cpp" line="49"/>
<source>Format partition %1 (file system: %2, size: %3 MB) on %4.</source>
<translation type="unfinished"/>
<translation>Formato da partición %1 (sistema de ficheiros: %2, tamaño: %3 MB) en %4.</translation>
</message>
<message>
<location filename="../src/modules/partition/jobs/FormatPartitionJob.cpp" line="60"/>
<source>Format &lt;strong&gt;%3MB&lt;/strong&gt; partition &lt;strong&gt;%1&lt;/strong&gt; with file system &lt;strong&gt;%2&lt;/strong&gt;.</source>
<translation type="unfinished"/>
<translation>Formato &lt;strong&gt;%3MB&lt;/strong&gt; partición &lt;strong&gt;%1&lt;/strong&gt; con sistema de ficheiros &lt;strong&gt;%2&lt;/strong&gt;.</translation>
</message>
<message>
<location filename="../src/modules/partition/jobs/FormatPartitionJob.cpp" line="71"/>
<source>Formatting partition %1 with file system %2.</source>
<translation type="unfinished"/>
<translation>Dando formato a %1 con sistema de ficheiros %2.</translation>
</message>
<message>
<location filename="../src/modules/partition/jobs/FormatPartitionJob.cpp" line="83"/>
<source>The installer failed to format partition %1 on disk &apos;%2&apos;.</source>
<translation type="unfinished"/>
<translation>O instalador fallou cando formateaba a partición %1 no disco &apos;%2&apos;.</translation>
</message>
<message>
<location filename="../src/modules/partition/jobs/FormatPartitionJob.cpp" line="91"/>
@ -1104,19 +1104,19 @@ O instalador pecharase e perderanse todos os cambios.</translation>
<location filename="../src/modules/interactiveterminal/InteractiveTerminalPage.cpp" line="84"/>
<location filename="../src/modules/interactiveterminal/InteractiveTerminalPage.cpp" line="96"/>
<source>Konsole not installed</source>
<translation type="unfinished"/>
<translation>Konsole non está instalado</translation>
</message>
<message>
<location filename="../src/modules/interactiveterminal/InteractiveTerminalPage.cpp" line="70"/>
<location filename="../src/modules/interactiveterminal/InteractiveTerminalPage.cpp" line="85"/>
<location filename="../src/modules/interactiveterminal/InteractiveTerminalPage.cpp" line="97"/>
<source>Please install the kde konsole and try again!</source>
<translation type="unfinished"/>
<translation>Faga o favor de instalar konsole (de kde) e probe de novo!</translation>
</message>
<message>
<location filename="../src/modules/interactiveterminal/InteractiveTerminalPage.cpp" line="122"/>
<source>Executing script: &amp;nbsp;&lt;code&gt;%1&lt;/code&gt;</source>
<translation type="unfinished"/>
<translation>Executando o script: &amp;nbsp; &lt;code&gt;%1&lt;/code&gt;</translation>
</message>
</context>
<context>
@ -1132,12 +1132,12 @@ O instalador pecharase e perderanse todos os cambios.</translation>
<message>
<location filename="../src/modules/keyboard/KeyboardPage.cpp" line="208"/>
<source>Set keyboard model to %1.&lt;br/&gt;</source>
<translation type="unfinished"/>
<translation>Seleccionado modelo de teclado a %1.&lt;br/&gt;</translation>
</message>
<message>
<location filename="../src/modules/keyboard/KeyboardPage.cpp" line="210"/>
<source>Set keyboard layout to %1/%2.</source>
<translation type="unfinished"/>
<translation>Seleccionada a disposición do teclado a %1/%2.</translation>
</message>
</context>
<context>
@ -1145,7 +1145,7 @@ O instalador pecharase e perderanse todos os cambios.</translation>
<message>
<location filename="../src/modules/keyboard/KeyboardViewStep.cpp" line="50"/>
<source>Keyboard</source>
<translation type="unfinished"/>
<translation>Teclado</translation>
</message>
</context>
<context>
@ -1153,22 +1153,22 @@ O instalador pecharase e perderanse todos os cambios.</translation>
<message>
<location filename="../src/modules/locale/LCLocaleDialog.cpp" line="34"/>
<source>System locale setting</source>
<translation type="unfinished"/>
<translation>Configuración da localización</translation>
</message>
<message>
<location filename="../src/modules/locale/LCLocaleDialog.cpp" line="41"/>
<source>The system locale setting affects the language and character set for some command line user interface elements.&lt;br/&gt;The current setting is &lt;strong&gt;%1&lt;/strong&gt;.</source>
<translation type="unfinished"/>
<translation>A configuración de localización afecta a linguaxe e o conxunto de caracteres dalgúns elementos da interface de usuario de liña de comandos. &lt;br/&gt;A configuración actúal é &lt;strong&gt;%1&lt;/strong&gt;.</translation>
</message>
<message>
<location filename="../src/modules/locale/LCLocaleDialog.cpp" line="66"/>
<source>&amp;Cancel</source>
<translation type="unfinished"/>
<translation>&amp;Cancelar</translation>
</message>
<message>
<location filename="../src/modules/locale/LCLocaleDialog.cpp" line="67"/>
<source>&amp;OK</source>
<translation type="unfinished"/>
<translation>&amp;Ok</translation>
</message>
</context>
<context>
@ -1181,33 +1181,33 @@ O instalador pecharase e perderanse todos os cambios.</translation>
<message>
<location filename="../src/modules/license/LicensePage.cpp" line="88"/>
<source>I accept the terms and conditions above.</source>
<translation type="unfinished"/>
<translation>Acepto os termos e condicións anteriores.</translation>
</message>
<message>
<location filename="../src/modules/license/LicensePage.cpp" line="115"/>
<source>&lt;h1&gt;License Agreement&lt;/h1&gt;This setup procedure will install proprietary software that is subject to licensing terms.</source>
<translation type="unfinished"/>
<translation>&lt;h1&gt;Acordo de licencia&lt;/h1&gt;Este proceso de configuración instalará programas privativos suxeito a termos de licencia.</translation>
</message>
<message>
<location filename="../src/modules/license/LicensePage.cpp" line="118"/>
<source>Please review the End User License Agreements (EULAs) above.&lt;br/&gt;If you do not agree with the terms, the setup procedure cannot continue.</source>
<translation type="unfinished"/>
<translation>Faga o favor de revisalos Acordos de Licencia de Usuario Final (ALUF) seguintes. &lt;br/&gt;De non estar dacordo cos termos non se pode seguir co proceso de configuración.</translation>
</message>
<message>
<location filename="../src/modules/license/LicensePage.cpp" line="124"/>
<source>&lt;h1&gt;License Agreement&lt;/h1&gt;This setup procedure can install proprietary software that is subject to licensing terms in order to provide additional features and enhance the user experience.</source>
<translation type="unfinished"/>
<translation>&lt;h1&gt;Acordo de licencia&lt;/h1&gt;Este proceso de configuración pode instalar programas privativos suxeito a termos de licencia para fornecer características adicionaís e mellorala experiencia do usuario.</translation>
</message>
<message>
<location filename="../src/modules/license/LicensePage.cpp" line="129"/>
<source>Please review the End User License Agreements (EULAs) above.&lt;br/&gt;If you do not agree with the terms, proprietary software will not be installed, and open source alternatives will be used instead.</source>
<translation type="unfinished"/>
<translation>Faga o favor de revisalos Acordos de Licencia de Usuario Final (ALUF) seguintes. &lt;br/&gt;De non estar dacordo cos termos non se instalará o programa privativo e no seu lugar usaranse alternativas de código aberto.</translation>
</message>
<message>
<location filename="../src/modules/license/LicensePage.cpp" line="159"/>
<source>&lt;strong&gt;%1 driver&lt;/strong&gt;&lt;br/&gt;by %2</source>
<extracomment>%1 is an untranslatable product name, example: Creative Audigy driver</extracomment>
<translation type="unfinished"/>
<translation>&lt;strong&gt;dispositivo %1&lt;/strong&gt;&lt;br/&gt;por %2</translation>
</message>
<message>
<location filename="../src/modules/license/LicensePage.cpp" line="166"/>

View File

@ -1050,7 +1050,7 @@ Uppsetningarforritið mun hætta og allar breytingar tapast.</translation>
<message>
<location filename="../src/modules/finished/FinishedViewStep.cpp" line="127"/>
<source>The installation of %1 is complete.</source>
<translation type="unfinished"/>
<translation>Uppsetningu af %1 er lokið.</translation>
</message>
</context>
<context>
@ -1162,12 +1162,12 @@ Uppsetningarforritið mun hætta og allar breytingar tapast.</translation>
<message>
<location filename="../src/modules/locale/LCLocaleDialog.cpp" line="66"/>
<source>&amp;Cancel</source>
<translation type="unfinished"/>
<translation>&amp;Hætta við</translation>
</message>
<message>
<location filename="../src/modules/locale/LCLocaleDialog.cpp" line="67"/>
<source>&amp;OK</source>
<translation type="unfinished"/>
<translation>&amp;Í lagi</translation>
</message>
</context>
<context>
@ -1857,7 +1857,7 @@ Uppsetningarforritið mun hætta og allar breytingar tapast.</translation>
<message>
<location filename="../src/modules/welcome/checker/RequirementsChecker.cpp" line="153"/>
<source>The screen is too small to display the installer.</source>
<translation type="unfinished"/>
<translation>Skjárinn er of lítill til birta uppsetningarforritið.</translation>
</message>
</context>
<context>

View File

@ -1162,12 +1162,12 @@ Instalator zostanie zamknięty i wszystkie zmiany zostaną utracone.</translatio
<message>
<location filename="../src/modules/locale/LCLocaleDialog.cpp" line="66"/>
<source>&amp;Cancel</source>
<translation type="unfinished"/>
<translation>&amp;Anuluj</translation>
</message>
<message>
<location filename="../src/modules/locale/LCLocaleDialog.cpp" line="67"/>
<source>&amp;OK</source>
<translation type="unfinished"/>
<translation>&amp;OK</translation>
</message>
</context>
<context>

View File

@ -1164,12 +1164,12 @@ A instalação pode continuar, mas alguns recursos podem ser desativados.</trans
<message>
<location filename="../src/modules/locale/LCLocaleDialog.cpp" line="66"/>
<source>&amp;Cancel</source>
<translation type="unfinished"/>
<translation>&amp;Cancelar</translation>
</message>
<message>
<location filename="../src/modules/locale/LCLocaleDialog.cpp" line="67"/>
<source>&amp;OK</source>
<translation type="unfinished"/>
<translation>&amp;OK</translation>
</message>
</context>
<context>

View File

@ -1165,12 +1165,12 @@ Kuruluma devam edebilirsiniz fakat bazı özellikler devre dışı kalabilir.</t
<message>
<location filename="../src/modules/locale/LCLocaleDialog.cpp" line="66"/>
<source>&amp;Cancel</source>
<translation type="unfinished"/>
<translation>&amp;Vazgeç</translation>
</message>
<message>
<location filename="../src/modules/locale/LCLocaleDialog.cpp" line="67"/>
<source>&amp;OK</source>
<translation type="unfinished"/>
<translation>&amp;TAMAM</translation>
</message>
</context>
<context>

Binary file not shown.

View File

@ -33,22 +33,22 @@ msgstr "Dummy python step {}"
#: src/modules/packages/main.py:59
#, python-format
msgid "Processing packages (%(count)d / %(total)d)"
msgstr ""
msgstr "Vinnslupakkar (%(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[1] ""
msgstr[0] "Setja upp einn pakka."
msgstr[1] "Setur upp %(num)d pakka."
#: src/modules/packages/main.py:64
#, python-format
msgid "Removing one package."
msgid_plural "Removing %(num)d packages."
msgstr[0] ""
msgstr[1] ""
msgstr[0] "Fjarlægi einn pakka."
msgstr[1] "Fjarlægi %(num)d pakka."
#: src/modules/packages/main.py:68
msgid "Install packages."
msgstr ""
msgstr "Setja upp pakka."

Binary file not shown.

View File

@ -33,26 +33,26 @@ msgstr "Krok dummy python {}"
#: src/modules/packages/main.py:59
#, python-format
msgid "Processing packages (%(count)d / %(total)d)"
msgstr ""
msgstr "Przetwarzanie pakietów (%(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[1] ""
msgstr[2] ""
msgstr[3] ""
msgstr[0] "Instalowanie jednego pakietu."
msgstr[1] "Instalowanie %(num)d pakietów."
msgstr[2] "Instalowanie %(num)d pakietów."
msgstr[3] "Instalowanie pakietów (%(num)d)."
#: src/modules/packages/main.py:64
#, python-format
msgid "Removing one package."
msgid_plural "Removing %(num)d packages."
msgstr[0] ""
msgstr[1] ""
msgstr[2] ""
msgstr[3] ""
msgstr[0] "Usuwanie jednego pakietu."
msgstr[1] "Usuwanie %(num)d pakietów."
msgstr[2] "Usuwanie %(num)d pakietów."
msgstr[3] "Usuwanie pakietów (%(num)d)."
#: src/modules/packages/main.py:68
msgid "Install packages."
msgstr ""
msgstr "Zainstaluj pakiety."

View File

@ -3,17 +3,18 @@ include( CalamaresAddModuleSubdirectory )
include( CalamaresAddLibrary )
include( CalamaresAddBrandingSubdirectory )
include_directories( ${CMAKE_CURRENT_BINARY_DIR}/libcalamares )
include_directories( ${CMAKE_CURRENT_LIST_DIR}/libcalamares )
include_directories( ${CMAKE_CURRENT_BINARY_DIR} )
include_directories( ${CMAKE_CURRENT_LIST_DIR} )
include_directories(
${CMAKE_CURRENT_LIST_DIR}
${CMAKE_CURRENT_LIST_DIR}/libcalamares
${CMAKE_CURRENT_LIST_DIR}/libcalamaresui
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR}/libcalamares
${CMAKE_CURRENT_BINARY_DIR}/libcalamaresui
)
# library
add_subdirectory( libcalamares )
include_directories( ${CMAKE_CURRENT_BINARY_DIR}/libcalamaresui )
include_directories( ${CMAKE_CURRENT_LIST_DIR}/libcalamaresui )
add_subdirectory( libcalamaresui )
# all things qml
@ -27,7 +28,3 @@ add_subdirectory( modules )
# branding components
add_subdirectory( branding )
if( WITH_CRASHREPORTER )
add_subdirectory( crashreporter )
endif()

View File

@ -1,6 +1,7 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,7 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,7 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,9 +1,11 @@
project( libcalamares )
project( libcalamares CXX )
add_definitions( ${QT_DEFINITIONS} )
add_definitions( -DQT_SHARED )
add_definitions( -DQT_SHAREDPOINTER_TRACK_POINTERS )
add_definitions( -DDLLEXPORT_PRO )
add_definitions(
${QT_DEFINITIONS}
-DQT_SHARED
-DQT_SHAREDPOINTER_TRACK_POINTERS
-DDLLEXPORT_PRO
)
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/CalamaresConfig.h.in
${CMAKE_CURRENT_BINARY_DIR}/CalamaresConfig.h )
@ -16,27 +18,28 @@ set( libSources
Job.cpp
JobQueue.cpp
ProcessJob.cpp
kdsingleapplicationguard/kdsingleapplicationguard.cpp
kdsingleapplicationguard/kdsharedmemorylocker.cpp
kdsingleapplicationguard/kdtoolsglobal.cpp
kdsingleapplicationguard/kdlockedsharedmemorypointer.cpp
)
set( utilsSources
utils/CalamaresUtils.cpp
utils/CalamaresUtilsSystem.cpp
utils/Logger.cpp
utils/PluginFactory.cpp
utils/Retranslator.cpp
)
set( kdsagSources
kdsingleapplicationguard/kdsingleapplicationguard.cpp
kdsingleapplicationguard/kdsharedmemorylocker.cpp
kdsingleapplicationguard/kdtoolsglobal.cpp
kdsingleapplicationguard/kdlockedsharedmemorypointer.cpp
)
set_source_files_properties( ${kdsagSources}
PROPERTIES COMPILE_FLAGS "${SUPPRESS_3RDPARTY_WARNINGS}" )
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${QT_INCLUDE_DIR}
)
if( WITH_PYTHON )
set( libSources
${libSources}
@ -73,7 +76,7 @@ if( WITH_PYTHONQT )
endif()
add_library( calamares SHARED ${libSources} )
add_library( calamares SHARED ${libSources} ${kdsagSources} ${utilsSources} )
set_target_properties( calamares
PROPERTIES
AUTOMOC TRUE

View File

@ -1,6 +1,7 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,7 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -26,6 +27,15 @@
#include <QProcess>
#include <QRegularExpression>
#ifdef Q_OS_LINUX
#include <sys/sysinfo.h>
#endif
#ifdef Q_OS_FREEBSD
#include <sys/types.h>
#include <sys/sysctl.h>
#endif
namespace CalamaresUtils
{
@ -221,50 +231,29 @@ System::targetEnvOutput( const QString& command,
}
qint64
System::getPhysicalMemoryB()
{
QProcess p;
p.start( "dmidecode", { "-t", "17" } );
p.waitForFinished();
QStringList lines = QString::fromLocal8Bit( p.readAllStandardOutput() ).split( '\n' );
lines = lines.filter( QRegularExpression( "^\\W*Size:\\W\\d*\\WMB" ) );
if ( !lines.isEmpty() )
return 0;
qint64 availableRamMb = 0;
foreach( const QString& line, lines )
{
bool ok = false;
availableRamMb += line.simplified()
.split( ' ' )
.value( 1 )
.toInt( &ok );
if ( !ok )
return 0;
}
qint64 availableRam = availableRamMb * 1024 * 1024;
return availableRam;
}
qint64
QPair<quint64, float>
System::getTotalMemoryB()
{
// A line in meminfo looks like this, with {print $2} we grab the second column.
// MemTotal: 8133432 kB
#ifdef Q_OS_LINUX
struct sysinfo i;
int r = sysinfo( &i );
QProcess p;
p.start( "awk", { "/MemTotal/ {print $2}", "/proc/meminfo" } );
p.waitForFinished();
QString memoryLine = p.readAllStandardOutput().simplified();
if (r)
return qMakePair(0, 0.0);
bool ok = false;
qint64 availableRam = memoryLine.toLongLong( &ok ) * 1024;
if ( !ok )
return 0;
return qMakePair(quint64( i.mem_unit ) * quint64( i.totalram ), 1.1);
#elif defined( Q_OS_FREEBSD )
unsigned long memsize;
size_t s = sizeof(memsize);
return availableRam;
int r = sysctlbyname("vm.kmem_size", &memsize, &s, NULL, 0);
if (r)
return qMakePair(0, 0.0);
return qMakePair(memsize, 1.01);
#else
return qMakePair(0, 0.0); // Unsupported
#endif
}

View File

@ -100,9 +100,19 @@ public:
/**
* @brief getTotalMemoryB returns the total main memory, in bytes.
*
* Since it is difficult to get the RAM memory size exactly -- either
* by reading information from the DIMMs, which may fail on virtual hosts
* or from asking the kernel, which doesn't report some memory areas --
* this returns a pair of guessed-size (in bytes) and a "guesstimate factor"
* which says how good the guess is. Generally, assume the *real* memory
* available is size * guesstimate.
*
* If nothing can be found, returns a 0 size and 0 guesstimate.
*
* @return size, guesstimate-factor
*/
DLLEXPORT qint64 getTotalMemoryB(); //Always underguessed, but always works on Linux
DLLEXPORT qint64 getPhysicalMemoryB(); //Better guess, doesn't work in VirualBox
DLLEXPORT QPair<quint64, float> getTotalMemoryB();
private:
static System* s_instance;

View File

@ -1,6 +1,7 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2015, Teo Mrnjavac <teo@kde.org>
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Based on KPluginFactory from KCoreAddons, KDE project
* Copyright 2007, Matthias Kretz <kretz@kde.org>
@ -34,7 +35,7 @@ namespace Calamares
{
PluginFactory::PluginFactory()
: d_ptr_p(new PluginFactoryPrivate)
: d_ptr( new PluginFactoryPrivate )
{
Q_D( PluginFactory );
d->q_ptr = this;
@ -43,14 +44,14 @@ PluginFactory::PluginFactory()
}
PluginFactory::PluginFactory( PluginFactoryPrivate& d )
: d_ptr_p(&d)
: d_ptr( &d )
{
factorycleanup()->add( this );
}
PluginFactory::~PluginFactory()
{
delete d_ptr_p;
delete d_ptr;
}
void PluginFactory::doRegisterPlugin( const QString& keyword, const QMetaObject* metaObject, CreateInstanceFunction instanceFunction )
@ -60,35 +61,41 @@ void PluginFactory::doRegisterPlugin(const QString &keyword, const QMetaObject *
Q_ASSERT( metaObject );
// we allow different interfaces to be registered without keyword
if (!keyword.isEmpty()) {
if (d->createInstanceHash.contains(keyword)) {
if ( !keyword.isEmpty() )
{
if ( d->createInstanceHash.contains( keyword ) )
qWarning() << "A plugin with the keyword" << keyword << "was already registered. A keyword must be unique!";
}
d->createInstanceHash.insert( keyword, PluginFactoryPrivate::Plugin( metaObject, instanceFunction ) );
} else {
}
else
{
const QList<PluginFactoryPrivate::Plugin> clashes( d->createInstanceHash.values( keyword ) );
const QMetaObject* superClass = metaObject->superClass();
if (superClass) {
for (const PluginFactoryPrivate::Plugin &plugin : clashes) {
if ( superClass )
{
for ( const PluginFactoryPrivate::Plugin& plugin : clashes )
{
for ( const QMetaObject* otherSuper = plugin.first->superClass(); otherSuper;
otherSuper = otherSuper->superClass()) {
if (superClass == otherSuper) {
otherSuper = otherSuper->superClass() )
{
if ( superClass == otherSuper )
qWarning() << "Two plugins with the same interface(" << superClass->className() << ") were registered. Use keywords to identify the plugins.";
}
}
}
}
for (const PluginFactoryPrivate::Plugin &plugin : clashes) {
for ( const PluginFactoryPrivate::Plugin& plugin : clashes )
{
superClass = plugin.first->superClass();
if (superClass) {
if ( superClass )
{
for ( const QMetaObject* otherSuper = metaObject->superClass(); otherSuper;
otherSuper = otherSuper->superClass()) {
if (superClass == otherSuper) {
otherSuper = otherSuper->superClass() )
{
if ( superClass == otherSuper )
qWarning() << "Two plugins with the same interface(" << superClass->className() << ") were registered. Use keywords to identify the plugins.";
}
}
}
}
d->createInstanceHash.insertMulti( keyword, PluginFactoryPrivate::Plugin( metaObject, instanceFunction ) );
}
}
@ -97,26 +104,27 @@ QObject *PluginFactory::create(const char *iface, QWidget *parentWidget, QObject
{
Q_D( PluginFactory );
QObject *obj( nullptr );
QObject* obj = nullptr;
const QList<PluginFactoryPrivate::Plugin> candidates( d->createInstanceHash.values( keyword ) );
// for !keyword.isEmpty() candidates.count() is 0 or 1
for (const PluginFactoryPrivate::Plugin &plugin : candidates) {
for (const QMetaObject *current = plugin.first; current; current = current->superClass()) {
if (0 == qstrcmp(iface, current->className())) {
if (obj) {
for ( const PluginFactoryPrivate::Plugin& plugin : candidates )
{
for ( const QMetaObject* current = plugin.first; current; current = current->superClass() )
{
if ( 0 == qstrcmp( iface, current->className() ) )
{
if ( obj )
qWarning() << "ambiguous interface requested from a DSO containing more than one plugin";
}
obj = plugin.second( parentWidget, parent );
break;
}
}
}
if (obj) {
if ( obj )
emit objectCreated( obj );
}
return obj;
}

View File

@ -1,6 +1,7 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2015, Teo Mrnjavac <teo@kde.org>
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Based on KPluginFactory from KCoreAddons, KDE project
* Copyright 2007, Matthias Kretz <kretz@kde.org>
@ -300,7 +301,7 @@ protected:
doRegisterPlugin( keyword, &T::staticMetaObject, instanceFunction );
}
PluginFactoryPrivate* const d_ptr_p;
PluginFactoryPrivate* const d_ptr;
/**
* This function is called when the factory asked to create an Object.
@ -321,7 +322,7 @@ protected:
static QObject* createInstance( QWidget* parentWidget, QObject* parent )
{
Q_UNUSED( parentWidget );
ParentType* p( nullptr );
ParentType* p = nullptr;
if ( parent )
{
p = qobject_cast<ParentType*>( parent );

View File

@ -1,6 +1,6 @@
set( CALAMARESUI_LIBRARY_TARGET calamaresui )
project( libcalamaresui CXX )
list( APPEND ${CALAMARESUI_LIBRARY_TARGET}_SOURCES
list( APPEND calamaresui_SOURCES
modulesystem/CppJobModule.cpp
modulesystem/Module.cpp
modulesystem/ModuleManager.cpp
@ -20,7 +20,7 @@ list( APPEND ${CALAMARESUI_LIBRARY_TARGET}_SOURCES
widgets/ClickableLabel.cpp
widgets/FixedAspectRatioLabel.cpp
widgets/QtWaitingSpinner.cpp
widgets/waitingspinnerwidget.cpp
widgets/WaitingWidget.cpp
ExecutionViewStep.cpp
@ -29,12 +29,12 @@ list( APPEND ${CALAMARESUI_LIBRARY_TARGET}_SOURCES
ViewManager.cpp
)
list( APPEND ${CALAMARESUI_LIBRARY_TARGET}_UI
list( APPEND calamaresui_UI
utils/DebugWindow.ui
)
if( WITH_PYTHON )
list( APPEND ${CALAMARESUI_LIBRARY_TARGET}_SOURCES
list( APPEND calamaresui_SOURCES
modulesystem/PythonJobModule.cpp
)
endif()
@ -43,7 +43,7 @@ if( WITH_PYTHONQT )
include_directories(${PYTHON_INCLUDE_DIRS})
include_directories(${PYTHONQT_INCLUDE_DIR})
list( APPEND ${CALAMARESUI_LIBRARY_TARGET}_SOURCES
list( APPEND calamaresui_SOURCES
modulesystem/PythonQtViewModule.cpp
utils/PythonQtUtils.cpp
viewpages/PythonQtJob.cpp
@ -58,9 +58,9 @@ if( WITH_PYTHONQT )
)
endif()
calamares_add_library( ${CALAMARESUI_LIBRARY_TARGET}
SOURCES ${${CALAMARESUI_LIBRARY_TARGET}_SOURCES}
UI ${${CALAMARESUI_LIBRARY_TARGET}_UI}
calamares_add_library( calamaresui
SOURCES ${calamaresui_SOURCES}
UI ${calamaresui_UI}
EXPORT_MACRO UIDLLEXPORT_PRO
LINK_PRIVATE_LIBRARIES
${YAMLCPP_LIBRARY}

View File

@ -2,6 +2,7 @@
*
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
* Copyright 2016, Kevin Kofler <kevin.kofler@chello.at>
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -25,7 +26,8 @@
class QPluginLoader;
namespace Calamares {
namespace Calamares
{
class UIDLLEXPORT CppJobModule : public Module
{

View File

@ -1,6 +1,7 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -23,7 +24,8 @@
#include "UiDllMacro.h"
namespace Calamares {
namespace Calamares
{
class UIDLLEXPORT ProcessJobModule : public Module
{

View File

@ -1,6 +1,7 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -24,7 +25,8 @@
class QPluginLoader;
namespace Calamares {
namespace Calamares
{
class ViewStep;

View File

@ -1,35 +1,34 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
/* === This file is part of Calamares - <https://github.com/calamares> ===
*
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Originally from Tomahawk,
* SPDX-License-Identifier: GPLv3+
* License-Filename: LICENSES/GPLv3+-ImageRegistry
*/
/*
* Copyright 2012, Christian Muehlhaeuser <muesli@tomahawk-player.org>
*
* 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 <http://www.gnu.org/licenses/>.
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, either version 3 of the License, or
(at your option) any later version.
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 <http://www.gnu.org/licenses/>.
*/
#include "ImageRegistry.h"
#include <QSvgRenderer>
#include <QPainter>
#include <QIcon>
#include "utils/Logger.h"
#include <qicon.h>
static QHash< QString, QHash< int, QHash< qint64, QPixmap > > > s_cache;
ImageRegistry* ImageRegistry::s_instance = nullptr;
ImageRegistry* ImageRegistry::s_instance = 0;
ImageRegistry*
@ -53,15 +52,21 @@ ImageRegistry::icon( const QString& image, CalamaresUtils::ImageMode mode )
qint64
ImageRegistry::cacheKey( const QSize& size, qreal opacity, QColor tint )
ImageRegistry::cacheKey( const QSize& size, float opacity, QColor tint )
{
return size.width() * 100 + size.height() * 10 + int( opacity * 100.0 ) + tint.value();
return size.width() * 100 + size.height() * 10 + ( opacity * 100.0 ) + tint.value();
}
QPixmap
ImageRegistry::pixmap( const QString& image, const QSize& size, CalamaresUtils::ImageMode mode, qreal opacity, QColor tint )
ImageRegistry::pixmap( const QString& image, const QSize& size, CalamaresUtils::ImageMode mode, float opacity, QColor tint )
{
if ( size.width() < 0 || size.height() < 0 )
{
Q_ASSERT( false );
return QPixmap();
}
QHash< qint64, QPixmap > subsubcache;
QHash< int, QHash< qint64, QPixmap > > subcache;
@ -83,11 +88,10 @@ ImageRegistry::pixmap( const QString& image, const QSize& size, CalamaresUtils::
// Image not found in cache. Let's load it.
QPixmap pixmap;
if ( image.toLower().endsWith( ".svg" ) ||
image.toLower().endsWith( ".svgz" ) )
if ( image.toLower().endsWith( ".svg" ) )
{
QSvgRenderer svgRenderer( image );
QPixmap p( size.isNull() ? svgRenderer.defaultSize() : size );
QPixmap p( size.isNull() || size.height() == 0 || size.width() == 0 ? svgRenderer.defaultSize() : size );
p.fill( Qt::transparent );
QPainter pixPainter( &p );
@ -126,7 +130,18 @@ ImageRegistry::pixmap( const QString& image, const QSize& size, CalamaresUtils::
}
if ( !size.isNull() && pixmap.size() != size )
{
if ( size.width() == 0 )
{
pixmap = pixmap.scaledToHeight( size.height(), Qt::SmoothTransformation );
}
else if ( size.height() == 0 )
{
pixmap = pixmap.scaledToWidth( size.width(), Qt::SmoothTransformation );
}
else
pixmap = pixmap.scaled( size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation );
}
putInCache( image, size, mode, opacity, pixmap, tint );
}
@ -136,10 +151,8 @@ ImageRegistry::pixmap( const QString& image, const QSize& size, CalamaresUtils::
void
ImageRegistry::putInCache( const QString& image, const QSize& size, CalamaresUtils::ImageMode mode, qreal opacity, const QPixmap& pixmap, QColor tint )
ImageRegistry::putInCache( const QString& image, const QSize& size, CalamaresUtils::ImageMode mode, float opacity, const QPixmap& pixmap, QColor tint )
{
// cDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Adding to image cache:" << image << size << mode;
QHash< qint64, QPixmap > subsubcache;
QHash< int, QHash< qint64, QPixmap > > subcache;

View File

@ -1,22 +1,24 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
/* === This file is part of Calamares - <https://github.com/calamares> ===
*
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
*
* Originally from Tomahawk,
* SPDX-License-Identifier: GPLv3+
* License-Filename: LICENSES/GPLv3+-ImageRegistry
*/
/*
* Copyright 2012, Christian Muehlhaeuser <muesli@tomahawk-player.org>
*
* 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 <http://www.gnu.org/licenses/>.
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, either version 3 of the License, or
(at your option) any later version.
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 <http://www.gnu.org/licenses/>.
*/
#ifndef IMAGE_REGISTRY_H
@ -35,11 +37,11 @@ public:
explicit ImageRegistry();
QIcon icon( const QString& image, CalamaresUtils::ImageMode mode = CalamaresUtils::Original );
QPixmap pixmap( const QString& image, const QSize& size, CalamaresUtils::ImageMode mode = CalamaresUtils::Original, qreal opacity = 1.0, QColor tint = QColor( 0, 0, 0, 0 ) );
QPixmap pixmap( const QString& image, const QSize& size, CalamaresUtils::ImageMode mode = CalamaresUtils::Original, float opacity = 1.0, QColor tint = QColor( 0, 0, 0, 0 ) );
private:
qint64 cacheKey( const QSize& size, qreal opacity, QColor tint );
void putInCache( const QString& image, const QSize& size, CalamaresUtils::ImageMode mode, qreal opacity, const QPixmap& pixmap, QColor tint );
qint64 cacheKey( const QSize& size, float opacity, QColor tint );
void putInCache( const QString& image, const QSize& size, CalamaresUtils::ImageMode mode, float opacity, const QPixmap& pixmap, QColor tint );
static ImageRegistry* s_instance;
};

View File

@ -1,27 +1,31 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
/* === This file is part of Calamares - <https://github.com/calamares> ===
*
* Originally from QJsonModel <https://github.com/dridk/QJsonmodel>
* Copyright 2015, Sacha Schutz <sacha@labsquare.org>
*
* 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 <http://www.gnu.org/licenses/>.
* SPDX-License-Identifier: GPL-3.0+
* License-Filename: LICENSES/GPLv3+-QJsonModel
*/
/***********************************************
Copyright (C) 2014 Schutz Sacha
This file is part of QJsonModel (https://github.com/dridk/QJsonmodel).
QJsonModel 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.
QJsonModel 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 QJsonModel. If not, see <http://www.gnu.org/licenses/>.
**********************************************/
#include "qjsonitem.h"
QJsonTreeItem::QJsonTreeItem(QJsonTreeItem *parent)
: mType( QJsonValue::Null )
{
mParent = parent;
@ -104,8 +108,7 @@ QJsonTreeItem* QJsonTreeItem::load(const QJsonValue& value, QJsonTreeItem* paren
{
//Get all QJsonValue childs
const auto keys = value.toObject().keys();
for (const QString &key : keys){
foreach (QString key , value.toObject().keys()){
QJsonValue v = value.toObject().value(key);
QJsonTreeItem * child = load(v,rootItem);
child->setKey(key);
@ -120,8 +123,7 @@ QJsonTreeItem* QJsonTreeItem::load(const QJsonValue& value, QJsonTreeItem* paren
{
//Get all QJsonValue childs
int index = 0;
const auto valueArray = value.toArray();
for (const QJsonValue &v : valueArray) {
foreach (QJsonValue v , value.toArray()){
QJsonTreeItem * child = load(v,rootItem);
child->setKey(QString::number(index));

View File

@ -1,20 +1,7 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
/* === This file is part of Calamares - <https://github.com/calamares> ===
*
* Originally from QJsonModel <https://github.com/dridk/QJsonmodel>
* Copyright 2015, Sacha Schutz <sacha@labsquare.org>
*
* 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 <http://www.gnu.org/licenses/>.
* SPDX-License-Identifier: GPL-3.0+
* License-Filename: LICENSES/GPLv3+-QJsonModel
*/
#ifndef JSONITEM_H
@ -26,8 +13,8 @@
class QJsonTreeItem
{
public:
QJsonTreeItem(QJsonTreeItem * parent = nullptr);
virtual ~QJsonTreeItem();
QJsonTreeItem(QJsonTreeItem * parent = 0);
~QJsonTreeItem();
void appendChild(QJsonTreeItem * item);
QJsonTreeItem *child(int row);
QJsonTreeItem *parent();
@ -41,7 +28,7 @@ public:
QJsonValue::Type type() const;
static QJsonTreeItem* load(const QJsonValue& value, QJsonTreeItem * parent = nullptr);
static QJsonTreeItem* load(const QJsonValue& value, QJsonTreeItem * parent = 0);
protected:

View File

@ -1,22 +1,27 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
/* === This file is part of Calamares - <https://github.com/calamares> ===
*
* Originally from QJsonModel <https://github.com/dridk/QJsonmodel>
* Copyright 2015, Sacha Schutz <sacha@labsquare.org>
*
* 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 <http://www.gnu.org/licenses/>.
* SPDX-License-Identifier: GPL-3.0+
* License-Filename: LICENSES/GPLv3+-QJsonModel
*/
/***********************************************
Copyright (C) 2014 Schutz Sacha
This file is part of QJsonModel (https://github.com/dridk/QJsonmodel).
QJsonModel 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.
QJsonModel 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 QJsonModel. If not, see <http://www.gnu.org/licenses/>.
**********************************************/
#include "qjsonmodel.h"
#include <QFile>
@ -36,13 +41,6 @@ QJsonModel::QJsonModel(QObject *parent) :
}
QJsonModel::~QJsonModel()
{
delete mRootItem;
}
bool QJsonModel::load(const QString &fileName)
{
QFile file(fileName);
@ -68,7 +66,11 @@ bool QJsonModel::loadJson(const QByteArray &json)
if (!mDocument.isNull())
{
beginResetModel();
if (mDocument.isArray()) {
mRootItem = QJsonTreeItem::load(QJsonValue(mDocument.array()));
} else {
mRootItem = QJsonTreeItem::load(QJsonValue(mDocument.object()));
}
endResetModel();
return true;
}

View File

@ -1,23 +1,9 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
/* === This file is part of Calamares - <https://github.com/calamares> ===
*
* Originally from QJsonModel <https://github.com/dridk/QJsonmodel>
* Copyright 2015, Sacha Schutz <sacha@labsquare.org>
*
* 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 <http://www.gnu.org/licenses/>.
* SPDX-License-Identifier: GPL-3.0+
* License-Filename: LICENSES/GPLv3+-QJsonModel
*/
#ifndef QJSONMODEL_H
#define QJSONMODEL_H
@ -30,8 +16,7 @@ class QJsonModel : public QAbstractItemModel
{
Q_OBJECT
public:
explicit QJsonModel(QObject *parent = nullptr);
virtual ~QJsonModel();
explicit QJsonModel(QObject *parent = 0);
bool load(const QString& fileName);
bool load(QIODevice * device);
bool loadJson(const QByteArray& json);

View File

@ -1,6 +1,7 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,7 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,7 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2015, Teo Mrnjavac <teo@kde.org>
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,176 +0,0 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
*
* Originally from https://github.com/snowwlex/QtWaitingSpinner
* Copyright 2012, Alex Turkin
*
* 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 <http://www.gnu.org/licenses/>.
*/
#include <cmath>
#include <algorithm>
#include <QPainter>
#include "QtWaitingSpinner.h"
QtWaitingSpinner::QtWaitingSpinner(int linesNumber, int length, int width, int radius, QWidget* parent) : QWidget(parent),
myLinesNumber(linesNumber),
myLength(length + width),
myWidth(width),
myRadius(radius),
myRoundness(70.0),
myColor(Qt::black),
mySpeed(1),
myTrail(70),
myOpacity(15)
{
myCurrentCounter = 0;
myTimer = new QTimer(this);
connect(myTimer,SIGNAL(timeout()), this, SLOT(rotate()));
updateSize();
updateTimer();
this->hide();
}
void QtWaitingSpinner::paintEvent(QPaintEvent* /*ev*/) {
QPainter painter(this);
painter.fillRect(this->rect(), Qt::transparent);
painter.setRenderHint(QPainter::Antialiasing, true);
if (myCurrentCounter >= myLinesNumber) {
myCurrentCounter = 0;
}
painter.setPen(Qt::NoPen);
for (int i = 0; i < myLinesNumber; ++i) {
painter.save();
painter.translate(myRadius + myLength, myRadius + myLength);
qreal rotateAngle = 360.0 * qreal(i) / qreal(myLinesNumber);
painter.rotate(rotateAngle);
painter.translate(myRadius, 0);
int distance = lineDistance(i, myCurrentCounter, myLinesNumber);
QColor color = countTrailColor(distance, myLinesNumber, myTrail, myOpacity, myColor);
painter.setBrush(color);
//TODO improve the way rounded rect is painted
painter.drawRoundedRect(QRect(0, -myWidth/2, myLength, myWidth), myRoundness, myRoundness, Qt::RelativeSize);
painter.restore();
}
}
void QtWaitingSpinner::start() {
this->show();
if (!myTimer->isActive()) {
myTimer->start();
myCurrentCounter = 0;
}
}
void QtWaitingSpinner::finish() {
this->hide();
if (myTimer->isActive()) {
myTimer->stop();
myCurrentCounter = 0;
}
}
void QtWaitingSpinner::setLinesNumber(int linesNumber) {
myLinesNumber = linesNumber;
myCurrentCounter = 0;
updateTimer();
}
void QtWaitingSpinner::setLength(int length){
myLength = length;
updateSize();
}
void QtWaitingSpinner::setWidth(int width) {
myWidth = width;
updateSize();
}
void QtWaitingSpinner::setRadius(int radius) {
myRadius = radius;
updateSize();
}
void QtWaitingSpinner::setRoundness(qreal roundness) {
myRoundness = std::max(0.0, std::min(100.0, roundness));
}
void QtWaitingSpinner::setColor(QColor color) {
myColor = color;
}
void QtWaitingSpinner::setSpeed(qreal speed) {
mySpeed = speed;
updateTimer();
}
void QtWaitingSpinner::setTrail(int trail) {
myTrail = trail;
}
void QtWaitingSpinner::setOpacity(int minOpacity) {
myOpacity = minOpacity;
}
void QtWaitingSpinner::rotate() {
++myCurrentCounter;
if (myCurrentCounter >= myLinesNumber) {
myCurrentCounter = 0;
}
update();
}
void QtWaitingSpinner::updateSize() {
int size = (myRadius + myLength) * 2;
setFixedSize(size, size);
}
void QtWaitingSpinner::updateTimer() {
myTimer->setInterval(countTimeout(myLinesNumber, mySpeed));
}
int QtWaitingSpinner::countTimeout(int lines, qreal speed) {
return int( 1000.0 / (lines * speed) );
}
int QtWaitingSpinner::lineDistance(int from, int to, int lines) {
int result = to - from;
if (result < 0) {
result += lines;
}
return result;
}
QColor QtWaitingSpinner::countTrailColor(int distance, int lines, int trail, int minOpacity, QColor color) {
if (distance == 0) {
return color;
}
const qreal minAlphaF = qreal(minOpacity) / 100.0;
int distanceThreshold = int( ceil( (lines - 1) * qreal(trail) / 100.0) );
if (distance > distanceThreshold) {
color.setAlphaF(minAlphaF);
return color;
}
qreal alphaDiff = color.alphaF() - minAlphaF;
qreal gradation = alphaDiff / qreal(distanceThreshold + 1);
qreal resultAlpha = color.alphaF() - gradation * distance;
resultAlpha = std::min(1.0, std::max(0.0, resultAlpha)); //if alpha is out of bound, force it to bounds
color.setAlphaF(resultAlpha);
return color;
}

View File

@ -1,82 +0,0 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
*
* Originally from https://github.com/snowwlex/QtWaitingSpinner
* Copyright 2012, Alex Turkin
*
* 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 <http://www.gnu.org/licenses/>.
*/
#ifndef QTWAITINGSPINNER_H
#define QTWAITINGSPINNER_H
#include "UiDllMacro.h"
#include <QtCore/QTimer>
#include <QWidget>
#include <QColor>
class UIDLLEXPORT QtWaitingSpinner : public QWidget {
Q_OBJECT
public:
explicit QtWaitingSpinner(int linesNumber = 12, int length = 7, int width = 5, int radius = 10, QWidget* parent = nullptr);
public Q_SLOTS:
void start();
void finish();
public:
void setLinesNumber(int linesNumber);
void setLength(int length);
void setWidth(int width);
void setRadius(int radius);
void setRoundness(qreal roundness);
void setColor(QColor color);
void setSpeed(qreal speed);
void setTrail(int trail);
void setOpacity(int minOpacity);
private Q_SLOTS:
void rotate();
void updateSize();
void updateTimer();
protected:
void paintEvent(QPaintEvent* ev);
private:
static int countTimeout(int lines, qreal speed);
static int lineDistance(int from, int to, int lines);
static QColor countTrailColor(int distance, int lines, int trail, int minOpacity, QColor color);
private:
int myLinesNumber;
int myLength;
int myWidth;
int myRadius;
qreal myRoundness; //0..100
QColor myColor;
qreal mySpeed; // in rounds per second
int myTrail;
int myOpacity;
private:
QTimer* myTimer;
int myCurrentCounter;
};
#endif // QTWAITINGSPINNER_H

View File

@ -1,6 +1,7 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -19,7 +20,7 @@
#include "WaitingWidget.h"
#include "utils/CalamaresUtilsGui.h"
#include "QtWaitingSpinner.h"
#include "waitingspinnerwidget.h"
#include <QBoxLayout>
#include <QLabel>
@ -34,7 +35,7 @@ WaitingWidget::WaitingWidget( const QString& text, QWidget* parent )
waitingLayout->addLayout( pbLayout );
pbLayout->addStretch();
QtWaitingSpinner* spnr = new QtWaitingSpinner();
WaitingSpinnerWidget* spnr = new WaitingSpinnerWidget();
pbLayout->addWidget( spnr );
pbLayout->addStretch();
@ -43,9 +44,9 @@ WaitingWidget::WaitingWidget( const QString& text, QWidget* parent )
int spnrSize = m_waitingLabel->fontMetrics().height() * 4;
spnr->setFixedSize( spnrSize, spnrSize );
spnr->setRadius( spnrSize / 2 );
spnr->setLength( spnrSize / 2 );
spnr->setWidth( spnrSize / 8 );
spnr->setInnerRadius( spnrSize / 2 );
spnr->setLineLength( spnrSize / 2 );
spnr->setLineWidth( spnrSize / 8 );
spnr->start();
m_waitingLabel->setAlignment( Qt::AlignCenter );

View File

@ -0,0 +1,283 @@
/* === This file is part of Calamares - <https://github.com/calamares> ===
*
* SPDX-License-Identifier: MIT
* License-Filename: LICENSES/MIT-QtWaitingSpinner
*/
/* Original Work Copyright (c) 2012-2014 Alexander Turkin
Modified 2014 by William Hallatt
Modified 2015 by Jacob Dawid
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// Own includes
#include "waitingspinnerwidget.h"
// Standard includes
#include <cmath>
#include <algorithm>
// Qt includes
#include <QPainter>
#include <QTimer>
WaitingSpinnerWidget::WaitingSpinnerWidget(QWidget *parent,
bool centerOnParent,
bool disableParentWhenSpinning)
: QWidget(parent),
_centerOnParent(centerOnParent),
_disableParentWhenSpinning(disableParentWhenSpinning) {
initialize();
}
WaitingSpinnerWidget::WaitingSpinnerWidget(Qt::WindowModality modality,
QWidget *parent,
bool centerOnParent,
bool disableParentWhenSpinning)
: QWidget(parent, Qt::Dialog | Qt::FramelessWindowHint),
_centerOnParent(centerOnParent),
_disableParentWhenSpinning(disableParentWhenSpinning){
initialize();
// We need to set the window modality AFTER we've hidden the
// widget for the first time since changing this property while
// the widget is visible has no effect.
setWindowModality(modality);
setAttribute(Qt::WA_TranslucentBackground);
}
void WaitingSpinnerWidget::initialize() {
_color = Qt::black;
_roundness = 100.0;
_minimumTrailOpacity = 3.14159265358979323846;
_trailFadePercentage = 80.0;
_revolutionsPerSecond = 1.57079632679489661923;
_numberOfLines = 20;
_lineLength = 10;
_lineWidth = 2;
_innerRadius = 10;
_currentCounter = 0;
_isSpinning = false;
_timer = new QTimer(this);
connect(_timer, SIGNAL(timeout()), this, SLOT(rotate()));
updateSize();
updateTimer();
hide();
}
void WaitingSpinnerWidget::paintEvent(QPaintEvent *) {
updatePosition();
QPainter painter(this);
painter.fillRect(this->rect(), Qt::transparent);
painter.setRenderHint(QPainter::Antialiasing, true);
if (_currentCounter >= _numberOfLines) {
_currentCounter = 0;
}
painter.setPen(Qt::NoPen);
for (int i = 0; i < _numberOfLines; ++i) {
painter.save();
painter.translate(_innerRadius + _lineLength,
_innerRadius + _lineLength);
qreal rotateAngle =
static_cast<qreal>(360 * i) / static_cast<qreal>(_numberOfLines);
painter.rotate(rotateAngle);
painter.translate(_innerRadius, 0);
int distance =
lineCountDistanceFromPrimary(i, _currentCounter, _numberOfLines);
QColor color =
currentLineColor(distance, _numberOfLines, _trailFadePercentage,
_minimumTrailOpacity, _color);
painter.setBrush(color);
// TODO improve the way rounded rect is painted
painter.drawRoundedRect(
QRect(0, -_lineWidth / 2, _lineLength, _lineWidth), _roundness,
_roundness, Qt::RelativeSize);
painter.restore();
}
}
void WaitingSpinnerWidget::start() {
updatePosition();
_isSpinning = true;
show();
if(parentWidget() && _disableParentWhenSpinning) {
parentWidget()->setEnabled(false);
}
if (!_timer->isActive()) {
_timer->start();
_currentCounter = 0;
}
}
void WaitingSpinnerWidget::stop() {
_isSpinning = false;
hide();
if(parentWidget() && _disableParentWhenSpinning) {
parentWidget()->setEnabled(true);
}
if (_timer->isActive()) {
_timer->stop();
_currentCounter = 0;
}
}
void WaitingSpinnerWidget::setNumberOfLines(int lines) {
_numberOfLines = lines;
_currentCounter = 0;
updateTimer();
}
void WaitingSpinnerWidget::setLineLength(int length) {
_lineLength = length;
updateSize();
}
void WaitingSpinnerWidget::setLineWidth(int width) {
_lineWidth = width;
updateSize();
}
void WaitingSpinnerWidget::setInnerRadius(int radius) {
_innerRadius = radius;
updateSize();
}
QColor WaitingSpinnerWidget::color() {
return _color;
}
qreal WaitingSpinnerWidget::roundness() {
return _roundness;
}
qreal WaitingSpinnerWidget::minimumTrailOpacity() {
return _minimumTrailOpacity;
}
qreal WaitingSpinnerWidget::trailFadePercentage() {
return _trailFadePercentage;
}
qreal WaitingSpinnerWidget::revolutionsPersSecond() {
return _revolutionsPerSecond;
}
int WaitingSpinnerWidget::numberOfLines() {
return _numberOfLines;
}
int WaitingSpinnerWidget::lineLength() {
return _lineLength;
}
int WaitingSpinnerWidget::lineWidth() {
return _lineWidth;
}
int WaitingSpinnerWidget::innerRadius() {
return _innerRadius;
}
bool WaitingSpinnerWidget::isSpinning() const {
return _isSpinning;
}
void WaitingSpinnerWidget::setRoundness(qreal roundness) {
_roundness = std::max(0.0, std::min(100.0, roundness));
}
void WaitingSpinnerWidget::setColor(QColor color) {
_color = color;
}
void WaitingSpinnerWidget::setRevolutionsPerSecond(qreal revolutionsPerSecond) {
_revolutionsPerSecond = revolutionsPerSecond;
updateTimer();
}
void WaitingSpinnerWidget::setTrailFadePercentage(qreal trail) {
_trailFadePercentage = trail;
}
void WaitingSpinnerWidget::setMinimumTrailOpacity(qreal minimumTrailOpacity) {
_minimumTrailOpacity = minimumTrailOpacity;
}
void WaitingSpinnerWidget::rotate() {
++_currentCounter;
if (_currentCounter >= _numberOfLines) {
_currentCounter = 0;
}
update();
}
void WaitingSpinnerWidget::updateSize() {
int size = (_innerRadius + _lineLength) * 2;
setFixedSize(size, size);
}
void WaitingSpinnerWidget::updateTimer() {
_timer->setInterval(1000 / (_numberOfLines * _revolutionsPerSecond));
}
void WaitingSpinnerWidget::updatePosition() {
if (parentWidget() && _centerOnParent) {
move(parentWidget()->width() / 2 - width() / 2,
parentWidget()->height() / 2 - height() / 2);
}
}
int WaitingSpinnerWidget::lineCountDistanceFromPrimary(int current, int primary,
int totalNrOfLines) {
int distance = primary - current;
if (distance < 0) {
distance += totalNrOfLines;
}
return distance;
}
QColor WaitingSpinnerWidget::currentLineColor(int countDistance, int totalNrOfLines,
qreal trailFadePerc, qreal minOpacity,
QColor color) {
if (countDistance == 0) {
return color;
}
const qreal minAlphaF = minOpacity / 100.0;
int distanceThreshold =
static_cast<int>(ceil((totalNrOfLines - 1) * trailFadePerc / 100.0));
if (countDistance > distanceThreshold) {
color.setAlphaF(minAlphaF);
} else {
qreal alphaDiff = color.alphaF() - minAlphaF;
qreal gradient = alphaDiff / static_cast<qreal>(distanceThreshold + 1);
qreal resultAlpha = color.alphaF() - gradient * countDistance;
// If alpha is out of bounds, clip it.
resultAlpha = std::min(1.0, std::max(0.0, resultAlpha));
color.setAlphaF(resultAlpha);
}
return color;
}

View File

@ -0,0 +1,120 @@
/* === This file is part of Calamares - <https://github.com/calamares> ===
*
* SPDX-License-Identifier: MIT
* License-Filename: LICENSES/MIT-QtWaitingSpinner
*/
/* Original Work Copyright (c) 2012-2014 Alexander Turkin
Modified 2014 by William Hallatt
Modified 2015 by Jacob Dawid
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#pragma once
// Qt includes
#include <QWidget>
#include <QTimer>
#include <QColor>
class WaitingSpinnerWidget : public QWidget {
Q_OBJECT
public:
/*! Constructor for "standard" widget behaviour - use this
* constructor if you wish to, e.g. embed your widget in another. */
WaitingSpinnerWidget(QWidget *parent = 0,
bool centerOnParent = true,
bool disableParentWhenSpinning = true);
/*! Constructor - use this constructor to automatically create a modal
* ("blocking") spinner on top of the calling widget/window. If a valid
* parent widget is provided, "centreOnParent" will ensure that
* QtWaitingSpinner automatically centres itself on it, if not,
* "centreOnParent" is ignored. */
WaitingSpinnerWidget(Qt::WindowModality modality,
QWidget *parent = 0,
bool centerOnParent = true,
bool disableParentWhenSpinning = true);
public slots:
void start();
void stop();
public:
void setColor(QColor color);
void setRoundness(qreal roundness);
void setMinimumTrailOpacity(qreal minimumTrailOpacity);
void setTrailFadePercentage(qreal trail);
void setRevolutionsPerSecond(qreal revolutionsPerSecond);
void setNumberOfLines(int lines);
void setLineLength(int length);
void setLineWidth(int width);
void setInnerRadius(int radius);
void setText(QString text);
QColor color();
qreal roundness();
qreal minimumTrailOpacity();
qreal trailFadePercentage();
qreal revolutionsPersSecond();
int numberOfLines();
int lineLength();
int lineWidth();
int innerRadius();
bool isSpinning() const;
private slots:
void rotate();
protected:
void paintEvent(QPaintEvent *paintEvent);
private:
static int lineCountDistanceFromPrimary(int current, int primary,
int totalNrOfLines);
static QColor currentLineColor(int distance, int totalNrOfLines,
qreal trailFadePerc, qreal minOpacity,
QColor color);
void initialize();
void updateSize();
void updateTimer();
void updatePosition();
private:
QColor _color;
qreal _roundness; // 0..100
qreal _minimumTrailOpacity;
qreal _trailFadePercentage;
qreal _revolutionsPerSecond;
int _numberOfLines;
int _lineLength;
int _lineWidth;
int _innerRadius;
private:
WaitingSpinnerWidget(const WaitingSpinnerWidget&);
WaitingSpinnerWidget& operator=(const WaitingSpinnerWidget&);
QTimer *_timer;
bool _centerOnParent;
bool _disableParentWhenSpinning;
int _currentCounter;
bool _isSpinning;
};

View File

@ -8,6 +8,7 @@
# Copyright 2014, Kevin Kofler <kevin.kofler@chello.at>
# Copyright 2017, Alf Gaida <agaida@siduction.org>
# Copyright 2017, Bernhard Landauer <oberon@manjaro.org>
# Copyright 2017, Adriaan de Groot <groot@kde.org>
#
# Calamares is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -484,12 +485,9 @@ def run():
)
if (os.path.exists(greeter_path)):
greeter_configured = False
# configure first found lightdm-greeter
for entry in os.scandir(greeter_path):
if entry.name.endswith('.desktop') \
and not greeter_configured:
for entry in os.listdir(greeter_path):
if entry.name.endswith('.desktop'):
greeter = entry.name.split('.')[0]
libcalamares.utils.debug(
"found greeter {!s}".format(greeter)
@ -504,9 +502,8 @@ def run():
libcalamares.utils.debug(
"{!s} configured as greeter.".format(greeter)
)
greeter_configured = True
if not greeter_configured:
break
else:
return ("No lightdm greeter installed.")
else:
libcalamares.utils.debug("lightdm selected but not installed")

View File

@ -1,6 +1,7 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2016, Kevin Kofler <kevin.kofler@chello.at>
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,7 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2016, Kevin Kofler <kevin.kofler@chello.at>
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -34,7 +35,7 @@ class PLUGINDLLEXPORT DummyCppJob : public Calamares::CppJob
public:
explicit DummyCppJob( QObject* parent = nullptr );
virtual ~DummyCppJob();
virtual ~DummyCppJob() override;
QString prettyName() const override;

View File

@ -34,7 +34,7 @@ class PLUGINDLLEXPORT FinishedViewStep : public Calamares::ViewStep
public:
explicit FinishedViewStep( QObject* parent = nullptr );
virtual ~FinishedViewStep();
virtual ~FinishedViewStep() override;
QString prettyName() const override;

View File

@ -1,6 +1,7 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,7 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -36,7 +36,7 @@ class PLUGINDLLEXPORT LicenseViewStep : public Calamares::ViewStep
public:
explicit LicenseViewStep( QObject* parent = nullptr );
virtual ~LicenseViewStep();
virtual ~LicenseViewStep() override;
QString prettyName() const override;

View File

@ -37,7 +37,7 @@ class PLUGINDLLEXPORT LocaleViewStep : public Calamares::ViewStep
public:
explicit LocaleViewStep( QObject* parent = nullptr );
virtual ~LocaleViewStep();
virtual ~LocaleViewStep() override;
QString prettyName() const override;
QString prettyStatus() const override;

View File

@ -1,6 +1,7 @@
/*
* Copyright 2016, Luca Giambonini <almack@chakraos.org>
* Copyright 2016, Lisa Vitolo <shainer@chakraos.org>
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,7 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright (c) 2017, Kyle Robbertze <kyle@aims.ac.za>
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,7 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright (c) 2017, Kyle Robbertze <kyle@aims.ac.za>
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,7 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright (c) 2017, Kyle Robbertze <kyle@aims.ac.za>
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,7 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright (c) 2017, Kyle Robbertze <kyle@aims.ac.za>
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -39,7 +39,7 @@ public:
};
BootLoaderModel( QObject* parent = 0 );
~BootLoaderModel();
~BootLoaderModel() override;
/**
* Init the model with the list of devices. Does *not* take ownership of the

View File

@ -1,6 +1,7 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014, Aurélien Gâteau <agateau@kde.org>
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -45,19 +45,21 @@ using CalamaresUtils::operator""_MiB;
qint64
swapSuggestion( const qint64 availableSpaceB )
{
// swap(mem) = max(2, 2 * mem), if mem < 2 GiB
// = mem, if 2 GiB <= mem < 8 GiB
// = mem / 2, if 8 GIB <= mem < 64 GiB
// = 4 GiB, if mem >= 64 GiB
/* If suspend-to-disk is demanded, then we always need enough
* swap to write the whole memory to disk -- between 2GB and 8GB
* RAM give proportionally more swap, and from 8GB RAM keep
* swap = RAM.
*
* If suspend-to-disk is not demanded, then ramp up more slowly,
* to 8GB swap at 16GB memory, and then drop to 4GB for "large
* memory" machines, on the assumption that those don't need swap
* because they have tons of memory (or whatever they are doing,
* had better not run into swap).
*/
qint64 suggestedSwapSizeB = 0;
qint64 availableRamB = CalamaresUtils::System::instance()->getPhysicalMemoryB();
qreal overestimationFactor = 1.01;
if ( !availableRamB )
{
availableRamB = CalamaresUtils::System::instance()->getTotalMemoryB();
overestimationFactor = 1.10;
}
auto memory = CalamaresUtils::System::instance()->getTotalMemoryB();
qint64 availableRamB = memory.first;
qreal overestimationFactor = memory.second;
bool ensureSuspendToDisk =
Calamares::JobQueue::instance()->globalStorage()->
@ -80,8 +82,8 @@ swapSuggestion( const qint64 availableSpaceB )
suggestedSwapSizeB = qMax( 2_GiB, availableRamB * 2 );
else if ( availableRamB >= 2_GiB && availableRamB < 8_GiB )
suggestedSwapSizeB = availableRamB;
else if ( availableRamB >= 8_GiB && availableRamB < 64_GiB )
suggestedSwapSizeB = availableRamB / 2;
else if ( availableRamB >= 8_GiB && availableRamB < 16_GiB )
suggestedSwapSizeB = 8_GiB;
else
suggestedSwapSizeB = 4_GiB;

View File

@ -1,6 +1,7 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014, Aurélien Gâteau <agateau@kde.org>
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -2,6 +2,7 @@
*
* Copyright 2014, Aurélien Gâteau <agateau@kde.org>
* Copyright 2015-2016, Teo Mrnjavac <teo@kde.org>
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -2,6 +2,7 @@
*
* Copyright 2014, Aurélien Gâteau <agateau@kde.org>
* Copyright 2015-2016, Teo Mrnjavac <teo@kde.org>
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -2,6 +2,7 @@
*
* Copyright 2014, Aurélien Gâteau <agateau@kde.org>
* Copyright 2014-2016, Teo Mrnjavac <teo@kde.org>
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,7 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2015, Teo Mrnjavac <teo@kde.org>
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -18,7 +19,7 @@
#include "ScanningDialog.h"
#include "widgets/QtWaitingSpinner.h"
#include "widgets/waitingspinnerwidget.h"
#include <QBoxLayout>
#include <QLabel>
@ -37,7 +38,7 @@ ScanningDialog::ScanningDialog( const QString& text,
QHBoxLayout* dialogLayout = new QHBoxLayout;
setLayout( dialogLayout );
QtWaitingSpinner* spinner = new QtWaitingSpinner;
WaitingSpinnerWidget* spinner = new WaitingSpinnerWidget();
dialogLayout->addWidget( spinner );
spinner->start();

View File

@ -2,6 +2,7 @@
*
* Copyright 2014, Aurélien Gâteau <agateau@kde.org>
* Copyright 2015, Teo Mrnjavac <teo@kde.org>
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -2,6 +2,7 @@
*
* Copyright 2014, Aurélien Gâteau <agateau@kde.org>
* Copyright 2015, Teo Mrnjavac <teo@kde.org>
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -2,6 +2,7 @@
*
* Copyright 2014, Aurélien Gâteau <agateau@kde.org>
* Copyright 2015, Teo Mrnjavac <teo@kde.org>
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -2,6 +2,7 @@
*
* Copyright 2014, Aurélien Gâteau <agateau@kde.org>
* Copyright 2015-2016, Teo Mrnjavac <teo@kde.org>
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -34,7 +34,7 @@ class PLUGINDLLEXPORT SummaryViewStep : public Calamares::ViewStep
public:
explicit SummaryViewStep( QObject* parent = nullptr );
virtual ~SummaryViewStep();
virtual ~SummaryViewStep() override;
QString prettyName() const override;

View File

@ -1,85 +0,0 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Portions from the Manjaro Installation Framework
* by Roland Singer <roland@manjaro.org>
* Copyright (C) 2007 Free Software Foundation, Inc.
*
* 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 <http://www.gnu.org/licenses/>.
*/
#ifndef USERSPAGE_H
#define USERSPAGE_H
#include "Typedefs.h"
#include <QWidget>
namespace Ui {
class Page_UserSetup;
}
class UsersPage : public QWidget
{
Q_OBJECT
public:
explicit UsersPage( QWidget* parent = nullptr );
virtual ~UsersPage();
bool isReady();
QList< Calamares::job_ptr > createJobs( const QStringList& defaultGroupsList );
void onActivate();
void setWriteRootPassword( bool show );
void setAutologinDefault( bool checked );
void setReusePasswordDefault( bool checked );
protected slots:
void onFullNameTextEdited( const QString& );
void fillSuggestions();
void onUsernameTextEdited( const QString& );
void validateUsernameText( const QString& );
void onHostnameTextEdited( const QString& );
void validateHostnameText( const QString& );
void onPasswordTextChanged( const QString& );
void onRootPasswordTextChanged( const QString& );
signals:
void checkReady( bool );
private:
Ui::Page_UserSetup* ui;
const QRegExp USERNAME_RX = QRegExp( "^[a-z_][a-z0-9_-]*[$]?$" );
const QRegExp HOSTNAME_RX = QRegExp( "^[a-zA-Z0-9][-a-zA-Z0-9_]*$" );
const int USERNAME_MAX_LENGTH = 31;
const int HOSTNAME_MIN_LENGTH = 2;
const int HOSTNAME_MAX_LENGTH = 63;
bool m_readyFullName;
bool m_readyUsername;
bool m_customUsername;
bool m_readyHostname;
bool m_customHostname;
bool m_readyPassword;
bool m_readyRootPassword;
bool m_writeRootPassword;
};
#endif // USERSPAGE_H

View File

@ -1,6 +1,7 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -20,6 +21,7 @@
#include "gui/UsersPage.h"
#include "utils/Logger.h"
#include "JobQueue.h"
#include "GlobalStorage.h"
#include "utils/Logger.h"
@ -172,9 +174,26 @@ UsersViewStep::setConfigurationMap( const QVariantMap& configurationMap )
m_widget->setAvailableShells(shells);
}
<<<<<<< HEAD
if ( configurationMap.contains( "avatarFilePath" ) &&
configurationMap.value( "avatarFilePath").type() == QVariant::String )
=======
if ( configurationMap.contains( "doReusePassword" ) &&
configurationMap.value( "doReusePassword" ).type() == QVariant::Bool )
>>>>>>> 34761c4214e95d877f0f1b2f29d479169885d646
{
m_widget->setAvatarFilePath( configurationMap.value( "avatarFilePath" ).toString() );
}
if ( configurationMap.contains( "passwordRequirements" ) &&
configurationMap.value( "passwordRequirements" ).type() == QVariant::Map )
{
auto pr_checks( configurationMap.value( "passwordRequirements" ).toMap() );
for (decltype(pr_checks)::const_iterator i = pr_checks.constBegin();
i != pr_checks.constEnd(); ++i)
{
m_widget->addPasswordCheck( i.key(), i.value() );
}
}
}

View File

@ -1,6 +1,7 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -25,5 +25,24 @@ doAutologin: false
# remove the following line to avoid creating /etc/sudoers.d/10-installer
sudoersGroup: wheel
<<<<<<< HEAD
setRootPassword: false
availableShells: /bin/bash, /bin/zsh
=======
setRootPassword: true
doReusePassword: true
# These are optional password-requirements that a distro can enforce
# on the user. The values given in this sample file disable each check,
# as if the check was not listed at all.
#
# Checks may be listed multiple times; each is checked separately,
# and no effort is done to ensure that the checks are consistent
# (e.g. specifying a maximum length less than the minimum length
# will annoy users).
#
# (additional checks may be implemented in UsersPage.cpp)
passwordRequirements:
minLength: -1 # Password at least this many characters
maxLength: -1 # Password at most this many characters
>>>>>>> 34761c4214e95d877f0f1b2f29d479169885d646

View File

@ -2,6 +2,7 @@
*
* Copyright 2015, Rohan Garg <rohan@garg.io>
* Copyright 2016, Teo Mrnjavac <teo@kde.org>
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -37,7 +37,7 @@ class PLUGINDLLEXPORT WelcomeViewStep : public Calamares::ViewStep
public:
explicit WelcomeViewStep( QObject* parent = nullptr );
virtual ~WelcomeViewStep();
virtual ~WelcomeViewStep() override;
QString prettyName() const override;

View File

@ -310,9 +310,9 @@ RequirementsChecker::checkEnoughStorage( qint64 requiredSpace )
bool
RequirementsChecker::checkEnoughRam( qint64 requiredRam )
{
qint64 availableRam = CalamaresUtils::System::instance()->getPhysicalMemoryB();
if ( !availableRam )
availableRam = CalamaresUtils::System::instance()->getTotalMemoryB();
// Ignore the guesstimate-factor; we get an under-estimate
// which is probably the usable RAM for programs.
quint64 availableRam = CalamaresUtils::System::instance()->getTotalMemoryB().first;
return availableRam >= requiredRam * 0.95; // because MemTotal is variable
}
@ -357,7 +357,7 @@ RequirementsChecker::checkHasPower()
QDBusInterface upowerIntf( UPOWER_SVC_NAME,
UPOWER_PATH,
UPOWER_INTF_NAME,
QDBusConnection::systemBus(), 0 );
QDBusConnection::systemBus() );
bool onBattery = upowerIntf.property( "OnBattery" ).toBool();