diff --git a/src/modules/README.md b/src/modules/README.md index bf74506ee..89085e54e 100644 --- a/src/modules/README.md +++ b/src/modules/README.md @@ -1,5 +1,10 @@ # Calamares modules + + Calamares modules are plugins that provide features like installer pages, batch jobs, etc. An installer page (visible to the user) is called a "view", while other modules are "jobs". diff --git a/src/modules/contextualprocess/Binding.h b/src/modules/contextualprocess/Binding.h index 25b5c7547..5b6f09087 100644 --- a/src/modules/contextualprocess/Binding.h +++ b/src/modules/contextualprocess/Binding.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2017-2020, Adriaan de Groot + * SPDX-FileCopyrightText: 2017-2020 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/contextualprocess/ContextualProcessJob.cpp b/src/modules/contextualprocess/ContextualProcessJob.cpp index 1173a3071..f970740ca 100644 --- a/src/modules/contextualprocess/ContextualProcessJob.cpp +++ b/src/modules/contextualprocess/ContextualProcessJob.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2017-2020, Adriaan de Groot + * SPDX-FileCopyrightText: 2017-2020 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -77,7 +78,7 @@ fetch( QString& value, QStringList& selector, int index, const QVariant& v ) } const QVariantMap map = v.toMap(); const QString& key = selector.at( index ); - if ( index == selector.length() - 1) + if ( index == selector.length() - 1 ) { value = map.value( key ).toString(); return map.contains( key ); diff --git a/src/modules/contextualprocess/ContextualProcessJob.h b/src/modules/contextualprocess/ContextualProcessJob.h index 5ab4b935e..e926f699d 100644 --- a/src/modules/contextualprocess/ContextualProcessJob.h +++ b/src/modules/contextualprocess/ContextualProcessJob.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2017-2018, Adriaan de Groot + * SPDX-FileCopyrightText: 2017-2018 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/contextualprocess/Tests.cpp b/src/modules/contextualprocess/Tests.cpp index 50ce9f400..97277dfce 100644 --- a/src/modules/contextualprocess/Tests.cpp +++ b/src/modules/contextualprocess/Tests.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2017-2018, Adriaan de Groot + * SPDX-FileCopyrightText: 2017-2018 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/contextualprocess/Tests.h b/src/modules/contextualprocess/Tests.h index fd705a103..5b27d497d 100644 --- a/src/modules/contextualprocess/Tests.h +++ b/src/modules/contextualprocess/Tests.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2018, Adriaan de Groot + * SPDX-FileCopyrightText: 2018 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/dracutlukscfg/DracutLuksCfgJob.cpp b/src/modules/dracutlukscfg/DracutLuksCfgJob.cpp index e151acc0c..18bbcae88 100644 --- a/src/modules/dracutlukscfg/DracutLuksCfgJob.cpp +++ b/src/modules/dracutlukscfg/DracutLuksCfgJob.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2016, Kevin Kofler + * SPDX-FileCopyrightText: 2016 Kevin Kofler + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/dracutlukscfg/DracutLuksCfgJob.h b/src/modules/dracutlukscfg/DracutLuksCfgJob.h index 52b290d1c..b10a8647e 100644 --- a/src/modules/dracutlukscfg/DracutLuksCfgJob.h +++ b/src/modules/dracutlukscfg/DracutLuksCfgJob.h @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2016, Kevin Kofler - * Copyright 2017, Adriaan de Groot + * SPDX-FileCopyrightText: 2016 Kevin Kofler + * SPDX-FileCopyrightText: 2017 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/dummycpp/DummyCppJob.cpp b/src/modules/dummycpp/DummyCppJob.cpp index 5a2ca1803..b9765ac01 100644 --- a/src/modules/dummycpp/DummyCppJob.cpp +++ b/src/modules/dummycpp/DummyCppJob.cpp @@ -1,8 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Teo Mrnjavac (original dummypython code) - * Copyright 2016, Kevin Kofler - * Copyright 2018, Adriaan de Groot + * SPDX-FileCopyrightText: 2014 Teo Mrnjavac (original dummypython code) + * SPDX-FileCopyrightText: 2016 Kevin Kofler + * SPDX-FileCopyrightText: 2018 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/dummycpp/DummyCppJob.h b/src/modules/dummycpp/DummyCppJob.h index bf8625950..1b6f0eeb5 100644 --- a/src/modules/dummycpp/DummyCppJob.h +++ b/src/modules/dummycpp/DummyCppJob.h @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2016, Kevin Kofler - * Copyright 2017, Adriaan de Groot + * SPDX-FileCopyrightText: 2016 Kevin Kofler + * SPDX-FileCopyrightText: 2017 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/finished/FinishedPage.cpp b/src/modules/finished/FinishedPage.cpp index e2ad4a24f..bdcbb9a85 100644 --- a/src/modules/finished/FinishedPage.cpp +++ b/src/modules/finished/FinishedPage.cpp @@ -1,8 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2015, Teo Mrnjavac - * Copyright 2017-2018, Adriaan de Groot - * Copyright 2019, Collabora Ltd + * SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac + * SPDX-FileCopyrightText: 2017-2018 Adriaan de Groot + * SPDX-FileCopyrightText: 2019 Collabora Ltd + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -100,7 +101,7 @@ FinishedPage::setUpRestart() cDebug() << "FinishedPage::setUpRestart(), Quit button" << "setup=" << FinishedViewStep::modeName( m_mode ) << "command=" << m_restartNowCommand; - connect( qApp, &QApplication::aboutToQuit, [ this ]() { + connect( qApp, &QApplication::aboutToQuit, [this]() { if ( ui->restartCheckBox->isVisible() && ui->restartCheckBox->isChecked() ) { cDebug() << "Running restart command" << m_restartNowCommand; diff --git a/src/modules/finished/FinishedPage.h b/src/modules/finished/FinishedPage.h index 40f437e07..90ce9383a 100644 --- a/src/modules/finished/FinishedPage.h +++ b/src/modules/finished/FinishedPage.h @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2015, Teo Mrnjavac - * Copyright 2017, Adriaan de Groot + * SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac + * SPDX-FileCopyrightText: 2017 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/finished/FinishedViewStep.cpp b/src/modules/finished/FinishedViewStep.cpp index 7e4cf1c6b..0ea2bbe4c 100644 --- a/src/modules/finished/FinishedViewStep.cpp +++ b/src/modules/finished/FinishedViewStep.cpp @@ -1,8 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2015, Teo Mrnjavac - * Copyright 2017, 2019, Adriaan de Groot - * Copyright 2019, Collabora Ltd + * SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac + * SPDX-FileCopyrightText: 2017 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2019 Collabora Ltd + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/finished/FinishedViewStep.h b/src/modules/finished/FinishedViewStep.h index 8f57d0210..f19304935 100644 --- a/src/modules/finished/FinishedViewStep.h +++ b/src/modules/finished/FinishedViewStep.h @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2015, Teo Mrnjavac - * Copyright 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac + * SPDX-FileCopyrightText: 2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/fsresizer/ResizeFSJob.cpp b/src/modules/fsresizer/ResizeFSJob.cpp index 217f1315e..d7003c76d 100644 --- a/src/modules/fsresizer/ResizeFSJob.cpp +++ b/src/modules/fsresizer/ResizeFSJob.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2018, Adriaan de Groot + * SPDX-FileCopyrightText: 2018 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * 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,8 +27,8 @@ #include "utils/Units.h" #include "utils/Variant.h" -#include #include +#include #include #include @@ -46,9 +47,7 @@ ResizeFSJob::ResizeFSJob( QObject* parent ) } -ResizeFSJob::~ResizeFSJob() -{ -} +ResizeFSJob::~ResizeFSJob() {} QString @@ -62,7 +61,8 @@ ResizeFSJob::findPartition() { using DeviceList = QList< Device* >; #if defined( WITH_KPMCORE4API ) - DeviceList devices = m_kpmcore.backend()->scanDevices( /* not includeReadOnly, not includeLoopback */ ScanFlag(0) ); + DeviceList devices + = m_kpmcore.backend()->scanDevices( /* not includeReadOnly, not includeLoopback */ ScanFlag( 0 ) ); #else DeviceList devices = m_kpmcore.backend()->scanDevices( /* excludeReadOnly */ true ); #endif @@ -70,14 +70,17 @@ ResizeFSJob::findPartition() cDebug() << "ResizeFSJob found" << devices.count() << "devices."; for ( DeviceList::iterator dev_it = devices.begin(); dev_it != devices.end(); ++dev_it ) { - if ( ! ( *dev_it ) ) - continue; - cDebug() << "ResizeFSJob found" << ( *dev_it )->deviceNode(); - for ( auto part_it = PartitionIterator::begin( *dev_it ); part_it != PartitionIterator::end( *dev_it ); ++part_it ) + if ( !( *dev_it ) ) { - cDebug() << Logger::SubEntry << ( *part_it )->mountPoint() << "on" << ( *part_it )->deviceNode(); - if ( ( !m_fsname.isEmpty() && ( *part_it )->mountPoint() == m_fsname ) || - ( !m_devicename.isEmpty() && ( *part_it )->deviceNode() == m_devicename ) ) + continue; + } + cDebug() << "ResizeFSJob found" << ( *dev_it )->deviceNode(); + for ( auto part_it = PartitionIterator::begin( *dev_it ); part_it != PartitionIterator::end( *dev_it ); + ++part_it ) + { + cDebug() << Logger::SubEntry << ( *part_it )->mountPoint() << "on" << ( *part_it )->deviceNode(); + if ( ( !m_fsname.isEmpty() && ( *part_it )->mountPoint() == m_fsname ) + || ( !m_devicename.isEmpty() && ( *part_it )->deviceNode() == m_devicename ) ) { cDebug() << Logger::SubEntry << "matched configuration dev=" << m_devicename << "fs=" << m_fsname; return PartitionMatch( *dev_it, *part_it ); @@ -101,11 +104,17 @@ qint64 ResizeFSJob::findGrownEnd( ResizeFSJob::PartitionMatch m ) { if ( !m.first || !m.second ) + { return -1; // Missing device data + } if ( !ResizeOperation::canGrow( m.second ) ) + { return -1; // Operation is doomed + } if ( !m_size.isValid() ) + { return -1; // Must have a grow-size + } cDebug() << "Containing device size" << m.first->totalLogical(); qint64 last_available = m.first->totalLogical() - 1; // Numbered from 0 @@ -170,12 +179,11 @@ ResizeFSJob::exec() tr( "Invalid configuration" ), tr( "The file-system resize job has an invalid configuration and will not run." ) ); - if ( !m_kpmcore) + if ( !m_kpmcore ) { cWarning() << "Could not load KPMCore backend (2)."; - return Calamares::JobResult::error( - tr( "KPMCore not Available" ), - tr( "Calamares cannot start KPMCore for the file-system resize job." ) ); + return Calamares::JobResult::error( tr( "KPMCore not Available" ), + tr( "Calamares cannot start KPMCore for the file-system resize job." ) ); } m_kpmcore.backend()->initFSSupport(); // Might not be enough, see below @@ -184,34 +192,32 @@ ResizeFSJob::exec() if ( !m.first || !m.second ) return Calamares::JobResult::error( tr( "Resize Failed" ), - !m_fsname.isEmpty() ? tr( "The filesystem %1 could not be found in this system, and cannot be resized." ).arg( m_fsname ) - : tr( "The device %1 could not be found in this system, and cannot be resized." ).arg( m_devicename ) ); + !m_fsname.isEmpty() + ? tr( "The filesystem %1 could not be found in this system, and cannot be resized." ).arg( m_fsname ) + : tr( "The device %1 could not be found in this system, and cannot be resized." ).arg( m_devicename ) ); m.second->fileSystem().init(); // Initialize support for specific FS if ( !ResizeOperation::canGrow( m.second ) ) { cDebug() << "canGrow() returned false."; - return Calamares::JobResult::error( - tr( "Resize Failed" ), - !m_fsname.isEmpty() ? tr( "The filesystem %1 cannot be resized." ).arg( m_fsname ) - : tr( "The device %1 cannot be resized." ).arg( m_devicename ) ); + return Calamares::JobResult::error( tr( "Resize Failed" ), + !m_fsname.isEmpty() + ? tr( "The filesystem %1 cannot be resized." ).arg( m_fsname ) + : tr( "The device %1 cannot be resized." ).arg( m_devicename ) ); } qint64 new_end = findGrownEnd( m ); - cDebug() << "Resize from" - << m.second->firstSector() << '-' << m.second->lastSector() - << '(' << m.second->length() << ')' - << "to -" << new_end; + cDebug() << "Resize from" << m.second->firstSector() << '-' << m.second->lastSector() << '(' << m.second->length() + << ')' << "to -" << new_end; if ( new_end < 0 ) - return Calamares::JobResult::error( - tr( "Resize Failed" ), - !m_fsname.isEmpty() ? tr( "The filesystem %1 cannot be resized." ).arg( m_fsname ) - : tr( "The device %1 cannot be resized." ).arg( m_devicename ) ); + return Calamares::JobResult::error( tr( "Resize Failed" ), + !m_fsname.isEmpty() + ? tr( "The filesystem %1 cannot be resized." ).arg( m_fsname ) + : tr( "The device %1 cannot be resized." ).arg( m_devicename ) ); if ( new_end == 0 ) { - cWarning() << "Resize operation on" << m_fsname << m_devicename - << "skipped as not-useful."; + cWarning() << "Resize operation on" << m_fsname << m_devicename << "skipped as not-useful."; if ( m_required ) return Calamares::JobResult::error( tr( "Resize Failed" ), @@ -226,13 +232,13 @@ ResizeFSJob::exec() ResizeOperation op( *m.first, *m.second, m.second->firstSector(), new_end ); Report op_report( nullptr ); if ( op.execute( op_report ) ) + { cDebug() << "Resize operation OK."; + } else { cDebug() << "Resize failed." << op_report.output(); - return Calamares::JobResult::error( - tr( "Resize Failed" ), - op_report.toText() ); + return Calamares::JobResult::error( tr( "Resize Failed" ), op_report.toText() ); } } @@ -243,8 +249,8 @@ ResizeFSJob::exec() void ResizeFSJob::setConfigurationMap( const QVariantMap& configurationMap ) { - m_fsname = configurationMap["fs"].toString(); - m_devicename = configurationMap["dev"].toString(); + m_fsname = configurationMap[ "fs" ].toString(); + m_devicename = configurationMap[ "dev" ].toString(); if ( m_fsname.isEmpty() && m_devicename.isEmpty() ) { @@ -252,10 +258,10 @@ ResizeFSJob::setConfigurationMap( const QVariantMap& configurationMap ) return; } - m_size = PartitionSize( configurationMap["size"].toString() ); - m_atleast = PartitionSize( configurationMap["atleast"].toString() ); + m_size = PartitionSize( configurationMap[ "size" ].toString() ); + m_atleast = PartitionSize( configurationMap[ "atleast" ].toString() ); m_required = CalamaresUtils::getBool( configurationMap, "required", false ); } -CALAMARES_PLUGIN_FACTORY_DEFINITION( ResizeFSJobFactory, registerPlugin(); ) +CALAMARES_PLUGIN_FACTORY_DEFINITION( ResizeFSJobFactory, registerPlugin< ResizeFSJob >(); ) diff --git a/src/modules/fsresizer/ResizeFSJob.h b/src/modules/fsresizer/ResizeFSJob.h index f7ff676cd..5bc810370 100644 --- a/src/modules/fsresizer/ResizeFSJob.h +++ b/src/modules/fsresizer/ResizeFSJob.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2018, Adriaan de Groot + * SPDX-FileCopyrightText: 2018 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -51,26 +52,13 @@ public: void setConfigurationMap( const QVariantMap& configurationMap ) override; /** @brief Is the configuration of this job valid? */ - bool isValid() const - { - return ( !m_fsname.isEmpty() || !m_devicename.isEmpty() ) && - m_size.isValid(); - } + bool isValid() const { return ( !m_fsname.isEmpty() || !m_devicename.isEmpty() ) && m_size.isValid(); } - QString name() const - { - return m_fsname.isEmpty() ? m_devicename : m_fsname; - } + QString name() const { return m_fsname.isEmpty() ? m_devicename : m_fsname; } - PartitionSize size() const - { - return m_size; - } + PartitionSize size() const { return m_size; } - PartitionSize minimumSize() const - { - return m_atleast; - } + PartitionSize minimumSize() const { return m_atleast; } private: CalamaresUtils::Partition::KPMManager m_kpmcore; @@ -80,7 +68,7 @@ private: QString m_devicename; bool m_required; - using PartitionMatch = QPair; + using PartitionMatch = QPair< Device*, Partition* >; /** @brief Find the configured FS */ PartitionMatch findPartition(); @@ -90,4 +78,4 @@ private: CALAMARES_PLUGIN_FACTORY_DECLARATION( ResizeFSJobFactory ) -#endif // RESIZEFSJOB_H +#endif // RESIZEFSJOB_H diff --git a/src/modules/fsresizer/Tests.cpp b/src/modules/fsresizer/Tests.cpp index 42d587631..a7be5dab8 100644 --- a/src/modules/fsresizer/Tests.cpp +++ b/src/modules/fsresizer/Tests.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2017-2018, Adriaan de Groot + * SPDX-FileCopyrightText: 2017-2018 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -36,20 +37,17 @@ using SizeUnit = CalamaresUtils::Partition::SizeUnit; QTEST_GUILESS_MAIN( FSResizerTests ) -FSResizerTests::FSResizerTests() -{ -} +FSResizerTests::FSResizerTests() {} -FSResizerTests::~FSResizerTests() -{ -} +FSResizerTests::~FSResizerTests() {} void FSResizerTests::initTestCase() { } -void FSResizerTests::testConfigurationRobust() +void +FSResizerTests::testConfigurationRobust() { ResizeFSJob j; @@ -72,7 +70,8 @@ atleast: 600MiB QCOMPARE( j.minimumSize().value(), 0 ); } -void FSResizerTests::testConfigurationValues() +void +FSResizerTests::testConfigurationValues() { ResizeFSJob j; @@ -84,7 +83,7 @@ atleast: 600MiB )" ); j.setConfigurationMap( CalamaresUtils::yamlMapToVariant( doc0 ) ); QVERIFY( !j.name().isEmpty() ); - QCOMPARE( j.name(), QString("/") ); + QCOMPARE( j.name(), QString( "/" ) ); QCOMPARE( j.size().unit(), SizeUnit::Percent ); QCOMPARE( j.minimumSize().unit(), SizeUnit::MiB ); QCOMPARE( j.size().value(), 100 ); @@ -99,7 +98,7 @@ atleast: 127 % )" ); j.setConfigurationMap( CalamaresUtils::yamlMapToVariant( doc0 ) ); QVERIFY( !j.name().isEmpty() ); - QCOMPARE( j.name(), QString("/") ); + QCOMPARE( j.name(), QString( "/" ) ); QCOMPARE( j.size().unit(), SizeUnit::MiB ); QCOMPARE( j.minimumSize().unit(), SizeUnit::None ); QCOMPARE( j.size().value(), 72 ); @@ -113,7 +112,7 @@ atleast: 127 % )" ); j.setConfigurationMap( CalamaresUtils::yamlMapToVariant( doc0 ) ); QVERIFY( !j.name().isEmpty() ); - QCOMPARE( j.name(), QString("/dev/m00") ); + QCOMPARE( j.name(), QString( "/dev/m00" ) ); QCOMPARE( j.size().unit(), SizeUnit::MiB ); QCOMPARE( j.minimumSize().unit(), SizeUnit::None ); QCOMPARE( j.size().value(), 72 ); @@ -128,7 +127,7 @@ size: 71MiB )" ); j.setConfigurationMap( CalamaresUtils::yamlMapToVariant( doc0 ) ); QVERIFY( !j.name().isEmpty() ); - QCOMPARE( j.name(), QString("/") ); + QCOMPARE( j.name(), QString( "/" ) ); QCOMPARE( j.size().unit(), SizeUnit::MiB ); QCOMPARE( j.minimumSize().unit(), SizeUnit::None ); QCOMPARE( j.size().value(), 71 ); diff --git a/src/modules/fsresizer/Tests.h b/src/modules/fsresizer/Tests.h index 958c0e655..24ac0bc8a 100644 --- a/src/modules/fsresizer/Tests.h +++ b/src/modules/fsresizer/Tests.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2018, Adriaan de Groot + * SPDX-FileCopyrightText: 2018 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/hostinfo/HostInfoJob.cpp b/src/modules/hostinfo/HostInfoJob.cpp index 90c9cd515..02320c7ac 100644 --- a/src/modules/hostinfo/HostInfoJob.cpp +++ b/src/modules/hostinfo/HostInfoJob.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -123,7 +124,7 @@ hostCPUmatchARM( const QString& s ) * silicon. For instance, a list from lscpu-arm.c (Linux kernel) * shows this: * -static const struct hw_impl hw_implementer[] = { + static const struct hw_impl hw_implementer[] = { { 0x41, arm_part, "ARM" }, { 0x42, brcm_part, "Broadcom" }, { 0x43, cavium_part, "Cavium" }, @@ -137,7 +138,7 @@ static const struct hw_impl hw_implementer[] = { { 0x66, faraday_part, "Faraday" }, { 0x69, intel_part, "Intel" }, { -1, unknown_part, "unknown" }, -}; + }; * * Since the specific implementor isn't interesting, just * map everything to "ARM". diff --git a/src/modules/hostinfo/HostInfoJob.h b/src/modules/hostinfo/HostInfoJob.h index 5db169b0e..bf519e953 100644 --- a/src/modules/hostinfo/HostInfoJob.h +++ b/src/modules/hostinfo/HostInfoJob.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/hostinfo/Tests.cpp b/src/modules/hostinfo/Tests.cpp index 7ab797ed4..883bddf28 100644 --- a/src/modules/hostinfo/Tests.cpp +++ b/src/modules/hostinfo/Tests.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -63,8 +64,8 @@ HostInfoTests::testHostOS() // This is a lousy test, too: the implementation reads /proc/cpuinfo // and that's the only way we could use, too, to find what the "right" // answer is. - QStringList x86cpunames{ QStringLiteral( "Intel" ), QStringLiteral( "AMD" ) }; - QStringList armcpunames{ QStringLiteral( "ARM" ) }; + QStringList x86cpunames { QStringLiteral( "Intel" ), QStringLiteral( "AMD" ) }; + QStringList armcpunames { QStringLiteral( "ARM" ) }; const QString cpu = hostCPU(); QVERIFY( x86cpunames.contains( cpu ) || armcpunames.contains( cpu ) ); @@ -83,7 +84,7 @@ HostInfoTests::testHostOS() } else { - QCOMPARE( cpu, QString( "Unknown CPU modalias '%1'" ).arg(cpumodalias) ); + QCOMPARE( cpu, QString( "Unknown CPU modalias '%1'" ).arg( cpumodalias ) ); } } } diff --git a/src/modules/initcpio/InitcpioJob.cpp b/src/modules/initcpio/InitcpioJob.cpp index 38f3a8961..ae910995c 100644 --- a/src/modules/initcpio/InitcpioJob.cpp +++ b/src/modules/initcpio/InitcpioJob.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -88,8 +89,11 @@ InitcpioJob::setConfigurationMap( const QVariantMap& configurationMap ) } else if ( m_kernel == "$uname" ) { - auto r = CalamaresUtils::System::runCommand( - CalamaresUtils::System::RunLocation::RunInHost, { "/bin/uname", "-r" }, QString(), QString(), std::chrono::seconds( 3 ) ); + auto r = CalamaresUtils::System::runCommand( CalamaresUtils::System::RunLocation::RunInHost, + { "/bin/uname", "-r" }, + QString(), + QString(), + std::chrono::seconds( 3 ) ); if ( r.getExitCode() == 0 ) { m_kernel = r.getOutput(); diff --git a/src/modules/initcpio/InitcpioJob.h b/src/modules/initcpio/InitcpioJob.h index cdc48f6ce..ae8ff47c3 100644 --- a/src/modules/initcpio/InitcpioJob.h +++ b/src/modules/initcpio/InitcpioJob.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/initcpio/Tests.cpp b/src/modules/initcpio/Tests.cpp index e0590ba25..83b10388d 100644 --- a/src/modules/initcpio/Tests.cpp +++ b/src/modules/initcpio/Tests.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,23 +32,20 @@ #include extern void fixPermissions( const QDir& d ); - + QTEST_GUILESS_MAIN( InitcpioTests ) -InitcpioTests::InitcpioTests() -{ -} +InitcpioTests::InitcpioTests() {} -InitcpioTests::~InitcpioTests() -{ -} +InitcpioTests::~InitcpioTests() {} void InitcpioTests::initTestCase() { } -void InitcpioTests::testFixPermissions() +void +InitcpioTests::testFixPermissions() { Logger::setupLogLevel( Logger::LOGDEBUG ); cDebug() << "Fixing up /boot"; @@ -56,4 +54,3 @@ void InitcpioTests::testFixPermissions() fixPermissions( QDir( "/nonexistent/nonexistent" ) ); QVERIFY( true ); } - diff --git a/src/modules/initcpio/Tests.h b/src/modules/initcpio/Tests.h index 5bab26d3f..bebab408a 100644 --- a/src/modules/initcpio/Tests.h +++ b/src/modules/initcpio/Tests.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/initramfs/InitramfsJob.cpp b/src/modules/initramfs/InitramfsJob.cpp index 468047c45..05ee4bde8 100644 --- a/src/modules/initramfs/InitramfsJob.cpp +++ b/src/modules/initramfs/InitramfsJob.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -78,8 +79,11 @@ InitramfsJob::setConfigurationMap( const QVariantMap& configurationMap ) } else if ( m_kernel == "$uname" ) { - auto r = CalamaresUtils::System::runCommand( - CalamaresUtils::System::RunLocation::RunInHost, { "/bin/uname", "-r" }, QString(), QString(), std::chrono::seconds( 3 ) ); + auto r = CalamaresUtils::System::runCommand( CalamaresUtils::System::RunLocation::RunInHost, + { "/bin/uname", "-r" }, + QString(), + QString(), + std::chrono::seconds( 3 ) ); if ( r.getExitCode() == 0 ) { m_kernel = r.getOutput(); diff --git a/src/modules/initramfs/InitramfsJob.h b/src/modules/initramfs/InitramfsJob.h index 3239c6929..b1b3fb397 100644 --- a/src/modules/initramfs/InitramfsJob.h +++ b/src/modules/initramfs/InitramfsJob.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/initramfs/Tests.cpp b/src/modules/initramfs/Tests.cpp index 2a236e64b..955d9b8bf 100644 --- a/src/modules/initramfs/Tests.cpp +++ b/src/modules/initramfs/Tests.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -33,32 +34,30 @@ QTEST_GUILESS_MAIN( InitramfsTests ) -InitramfsTests::InitramfsTests() -{ -} +InitramfsTests::InitramfsTests() {} -InitramfsTests::~InitramfsTests() -{ -} +InitramfsTests::~InitramfsTests() {} void InitramfsTests::initTestCase() { Logger::setupLogLevel( Logger::LOGDEBUG ); - (void) new Calamares::JobQueue(); - (void) new CalamaresUtils::System( true ); + (void)new Calamares::JobQueue(); + (void)new CalamaresUtils::System( true ); } static const char contents[] = "UMASK=0077\n"; static const char confFile[] = "/tmp/calamares-safe-umask"; -void InitramfsTests::cleanup() +void +InitramfsTests::cleanup() { QFile::remove( confFile ); } -void InitramfsTests::testCreateTargetFile() +void +InitramfsTests::testCreateTargetFile() { static const char short_confFile[] = "/calamares-safe-umask"; @@ -79,8 +78,7 @@ void InitramfsTests::testCreateTargetFile() QFileInfo fi( path ); QVERIFY( fi.exists() ); - QCOMPARE( ulong( fi.size() ), sizeof( contents )-1 ); // don't count trailing NUL + QCOMPARE( ulong( fi.size() ), sizeof( contents ) - 1 ); // don't count trailing NUL QFile::remove( path ); - } diff --git a/src/modules/initramfs/Tests.h b/src/modules/initramfs/Tests.h index 715c90169..11d0fd1d0 100644 --- a/src/modules/initramfs/Tests.h +++ b/src/modules/initramfs/Tests.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/initramfscfg/encrypt_hook b/src/modules/initramfscfg/encrypt_hook index 257097303..70d661a98 100755 --- a/src/modules/initramfscfg/encrypt_hook +++ b/src/modules/initramfscfg/encrypt_hook @@ -1,4 +1,7 @@ #!/bin/sh +# +# SPDX-FileCopyrightText: 2016 David McKinney +# SPDX-License-Identifier: GPL-3.0-or-later PREREQ="" diff --git a/src/modules/initramfscfg/encrypt_hook_nokey b/src/modules/initramfscfg/encrypt_hook_nokey index db51475bd..8ee669c30 100755 --- a/src/modules/initramfscfg/encrypt_hook_nokey +++ b/src/modules/initramfscfg/encrypt_hook_nokey @@ -1,4 +1,7 @@ #!/bin/sh +# +# SPDX-FileCopyrightText: 2016 David McKinney +# SPDX-License-Identifier: GPL-3.0-or-later PREREQ="" diff --git a/src/modules/interactiveterminal/InteractiveTerminalPage.cpp b/src/modules/interactiveterminal/InteractiveTerminalPage.cpp index 5b2f81bfa..9d5f76724 100644 --- a/src/modules/interactiveterminal/InteractiveTerminalPage.cpp +++ b/src/modules/interactiveterminal/InteractiveTerminalPage.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2015, Teo Mrnjavac + * SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac + * SPDX-License-Identifier: GPL-3.0-or-later * * 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,14 +19,14 @@ #include "InteractiveTerminalPage.h" -#include "viewpages/ViewStep.h" -#include "utils/Retranslator.h" #include "utils/CalamaresUtilsGui.h" #include "utils/Logger.h" +#include "utils/Retranslator.h" +#include "viewpages/ViewStep.h" -#include -#include #include +#include +#include #include #include @@ -49,17 +50,17 @@ InteractiveTerminalPage::InteractiveTerminalPage( QWidget* parent ) void InteractiveTerminalPage::errorKonsoleNotInstalled() { - QMessageBox::critical( this, - tr( "Konsole not installed"), - tr( "Please install KDE Konsole and try again!" ), - QMessageBox::Ok ); + QMessageBox::critical( + this, tr( "Konsole not installed" ), tr( "Please install KDE Konsole and try again!" ), QMessageBox::Ok ); } void InteractiveTerminalPage::onActivate() { if ( m_termHostWidget ) + { return; + } // For whatever reason, instead of simply linking against a library we // need to do a runtime query to KService just to get a sodding terminal // widget. @@ -69,14 +70,11 @@ InteractiveTerminalPage::onActivate() // And all of this hoping the Konsole application is installed. If not, // tough cookies. errorKonsoleNotInstalled(); - return ; + return; } // Create one instance of konsolepart. - KParts::ReadOnlyPart* p = - service->createInstance< KParts::ReadOnlyPart >( this, - this, - {} ); + KParts::ReadOnlyPart* p = service->createInstance< KParts::ReadOnlyPart >( this, this, {} ); if ( !p ) { // One more opportunity for the loading operation to fail. @@ -100,8 +98,7 @@ InteractiveTerminalPage::onActivate() m_termHostWidget = p->widget(); m_layout->addWidget( m_termHostWidget ); - cDebug() << "Part widget ought to be" - << m_termHostWidget->metaObject()->className(); + cDebug() << "Part widget ought to be" << m_termHostWidget->metaObject()->className(); t->showShellInDir( QDir::home().path() ); t->sendInput( QString( "%1\n" ).arg( m_command ) ); @@ -112,8 +109,5 @@ void InteractiveTerminalPage::setCommand( const QString& command ) { m_command = command; - CALAMARES_RETRANSLATE( - m_headerLabel->setText( tr( "Executing script:  %1" ) - .arg( m_command ) ); - ) + CALAMARES_RETRANSLATE( m_headerLabel->setText( tr( "Executing script:  %1" ).arg( m_command ) ); ) } diff --git a/src/modules/interactiveterminal/InteractiveTerminalPage.h b/src/modules/interactiveterminal/InteractiveTerminalPage.h index 503a53756..20ab0d651 100644 --- a/src/modules/interactiveterminal/InteractiveTerminalPage.h +++ b/src/modules/interactiveterminal/InteractiveTerminalPage.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2015, Teo Mrnjavac + * SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -43,4 +44,4 @@ private: void errorKonsoleNotInstalled(); }; -#endif // INTERACTIVETERMINALPAGE_H +#endif // INTERACTIVETERMINALPAGE_H diff --git a/src/modules/interactiveterminal/InteractiveTerminalViewStep.cpp b/src/modules/interactiveterminal/InteractiveTerminalViewStep.cpp index 874c8a9cc..45019cf4a 100644 --- a/src/modules/interactiveterminal/InteractiveTerminalViewStep.cpp +++ b/src/modules/interactiveterminal/InteractiveTerminalViewStep.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2015, Teo Mrnjavac + * SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac + * SPDX-License-Identifier: GPL-3.0-or-later * * 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 @@ #include -CALAMARES_PLUGIN_FACTORY_DEFINITION( InteractiveTerminalViewStepFactory, registerPlugin(); ) +CALAMARES_PLUGIN_FACTORY_DEFINITION( InteractiveTerminalViewStepFactory, + registerPlugin< InteractiveTerminalViewStep >(); ) InteractiveTerminalViewStep::InteractiveTerminalViewStep( QObject* parent ) : Calamares::ViewStep( parent ) @@ -37,7 +39,9 @@ InteractiveTerminalViewStep::InteractiveTerminalViewStep( QObject* parent ) InteractiveTerminalViewStep::~InteractiveTerminalViewStep() { if ( m_widget && m_widget->parent() == nullptr ) + { m_widget->deleteLater(); + } } @@ -102,8 +106,8 @@ InteractiveTerminalViewStep::onActivate() void InteractiveTerminalViewStep::setConfigurationMap( const QVariantMap& configurationMap ) { - if ( configurationMap.contains( "command" ) && - configurationMap.value( "command").type() == QVariant::String ) + if ( configurationMap.contains( "command" ) && configurationMap.value( "command" ).type() == QVariant::String ) + { m_widget->setCommand( configurationMap.value( "command" ).toString() ); + } } - diff --git a/src/modules/interactiveterminal/InteractiveTerminalViewStep.h b/src/modules/interactiveterminal/InteractiveTerminalViewStep.h index bf26ba91e..d91fc07cc 100644 --- a/src/modules/interactiveterminal/InteractiveTerminalViewStep.h +++ b/src/modules/interactiveterminal/InteractiveTerminalViewStep.h @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2015, Teo Mrnjavac - * Copyright 2017, Adriaan de Groot + * SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac + * SPDX-FileCopyrightText: 2017 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -60,4 +61,4 @@ private: CALAMARES_PLUGIN_FACTORY_DECLARATION( InteractiveTerminalViewStepFactory ) -#endif // INTERACTIVETERMINALPAGEPLUGIN_H +#endif // INTERACTIVETERMINALPAGEPLUGIN_H diff --git a/src/modules/keyboard/Config.cpp b/src/modules/keyboard/Config.cpp index 64b253835..bd2c41780 100644 --- a/src/modules/keyboard/Config.cpp +++ b/src/modules/keyboard/Config.cpp @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2019-2020, Adriaan de Groot - * Copyright 2020, Camilo Higuita * + * SPDX-FileCopyrightText: 2019-2020 Adriaan de Groot + * SPDX-FileCopyrightText: 2020 Camilo Higuita * + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/keyboard/Config.h b/src/modules/keyboard/Config.h index a05a5ab86..a7e9c621b 100644 --- a/src/modules/keyboard/Config.h +++ b/src/modules/keyboard/Config.h @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2019-2020, Adriaan de Groot - * Copyright 2020, Camilo Higuita + * SPDX-FileCopyrightText: 2019-2020 Adriaan de Groot + * SPDX-FileCopyrightText: 2020 Camilo Higuita + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/keyboard/KeyboardLayoutModel.cpp b/src/modules/keyboard/KeyboardLayoutModel.cpp index 7e24df570..9077ea60e 100644 --- a/src/modules/keyboard/KeyboardLayoutModel.cpp +++ b/src/modules/keyboard/KeyboardLayoutModel.cpp @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2016, Teo Mrnjavac - * Copyright 2017, Adriaan de Groot + * SPDX-FileCopyrightText: 2016 Teo Mrnjavac + * SPDX-FileCopyrightText: 2017 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/keyboard/KeyboardLayoutModel.h b/src/modules/keyboard/KeyboardLayoutModel.h index e0007fdbc..eeb0666fa 100644 --- a/src/modules/keyboard/KeyboardLayoutModel.h +++ b/src/modules/keyboard/KeyboardLayoutModel.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2016, Teo Mrnjavac + * SPDX-FileCopyrightText: 2016 Teo Mrnjavac + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/keyboard/KeyboardPage.cpp b/src/modules/keyboard/KeyboardPage.cpp index e8997b915..6ab472446 100644 --- a/src/modules/keyboard/KeyboardPage.cpp +++ b/src/modules/keyboard/KeyboardPage.cpp @@ -1,7 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2016, Teo Mrnjavac - * Copyright 2017-2018, Adriaan de Groot + * SPDX-FileCopyrightText: 2007 Free Software Foundation, Inc. + * SPDX-FileCopyrightText: 2014-2016 Teo Mrnjavac + * SPDX-FileCopyrightText: 2017-2018 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Portions from the Manjaro Installation Framework * by Roland Singer diff --git a/src/modules/keyboard/KeyboardPage.h b/src/modules/keyboard/KeyboardPage.h index 1ce21787c..73896923a 100644 --- a/src/modules/keyboard/KeyboardPage.h +++ b/src/modules/keyboard/KeyboardPage.h @@ -1,7 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2016, Teo Mrnjavac - * Copyright 2017, Adriaan de Groot + * SPDX-FileCopyrightText: 2007 Free Software Foundation, Inc. + * SPDX-FileCopyrightText: 2014-2016 Teo Mrnjavac + * SPDX-FileCopyrightText: 2017 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Portions from the Manjaro Installation Framework * by Roland Singer diff --git a/src/modules/keyboard/KeyboardViewStep.cpp b/src/modules/keyboard/KeyboardViewStep.cpp index e6e89eb1c..b424653f7 100644 --- a/src/modules/keyboard/KeyboardViewStep.cpp +++ b/src/modules/keyboard/KeyboardViewStep.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2015, Teo Mrnjavac + * SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/keyboard/KeyboardViewStep.h b/src/modules/keyboard/KeyboardViewStep.h index 208d50686..8de05d0af 100644 --- a/src/modules/keyboard/KeyboardViewStep.h +++ b/src/modules/keyboard/KeyboardViewStep.h @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2015, Teo Mrnjavac - * Copyright 2017, Adriaan de Groot + * SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac + * SPDX-FileCopyrightText: 2017 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/keyboard/README.md b/src/modules/keyboard/README.md deleted file mode 100644 index cf4ce3994..000000000 --- a/src/modules/keyboard/README.md +++ /dev/null @@ -1,5 +0,0 @@ -Keyboard layout configuration viewmodule ---- -Requires ckbcomp script. - * Debian package console-setup or - * Manjaro package keyboardctl https://github.com/manjaro/packages-core/tree/master/keyboardctl diff --git a/src/modules/keyboard/SetKeyboardLayoutJob.cpp b/src/modules/keyboard/SetKeyboardLayoutJob.cpp index 537feeb8c..e9c20e0aa 100644 --- a/src/modules/keyboard/SetKeyboardLayoutJob.cpp +++ b/src/modules/keyboard/SetKeyboardLayoutJob.cpp @@ -1,7 +1,10 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2016, Teo Mrnjavac - * Copyright 2014, Kevin Kofler + * SPDX-FileCopyrightText: 2011 Lennart Poettering + * SPDX-FileCopyrightText: Kay Sievers + * SPDX-FileCopyrightText: 2014-2016 Teo Mrnjavac + * SPDX-FileCopyrightText: 2014 Kevin Kofler + * SPDX-License-Identifier: GPL-3.0-or-later * * Portions from systemd (localed.c): * Copyright 2011 Lennart Poettering diff --git a/src/modules/keyboard/SetKeyboardLayoutJob.h b/src/modules/keyboard/SetKeyboardLayoutJob.h index 599642b19..ee0cd0a99 100644 --- a/src/modules/keyboard/SetKeyboardLayoutJob.h +++ b/src/modules/keyboard/SetKeyboardLayoutJob.h @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2016, Teo Mrnjavac - * Copyright 2014, Kevin Kofler + * SPDX-FileCopyrightText: 2014-2016 Teo Mrnjavac + * SPDX-FileCopyrightText: 2014 Kevin Kofler + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/keyboard/images/restore.png.license b/src/modules/keyboard/images/restore.png.license new file mode 100644 index 000000000..cc08e1f9f --- /dev/null +++ b/src/modules/keyboard/images/restore.png.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: 2014 Teo Mrnjavac +SPDX-License-Identifier: GPL-3.0-or-later diff --git a/src/modules/keyboard/kbd-model-map b/src/modules/keyboard/kbd-model-map index 49ec4ad75..e113c92ba 100644 --- a/src/modules/keyboard/kbd-model-map +++ b/src/modules/keyboard/kbd-model-map @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2015 Systemd authors and contributors +# SPDX-FileCopyrightText: 2018 Adriaan de Groot +# SPDX-License-Identifier: GPL-3.0-or-later +# # Copied from systemd-localed # # https://cgit.freedesktop.org/systemd/systemd/log/src/locale/kbd-model-map diff --git a/src/modules/keyboard/keyboardwidget/keyboardglobal.cpp b/src/modules/keyboard/keyboardwidget/keyboardglobal.cpp index f363ea844..d5f6984d4 100644 --- a/src/modules/keyboard/keyboardwidget/keyboardglobal.cpp +++ b/src/modules/keyboard/keyboardwidget/keyboardglobal.cpp @@ -1,7 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Teo Mrnjavac - * Copyright 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2007 Free Software Foundation, Inc. + * SPDX-FileCopyrightText: 2014 Teo Mrnjavac + * SPDX-FileCopyrightText: 2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Originally from the Manjaro Installation Framework * by Roland Singer @@ -43,18 +45,22 @@ static const char XKB_FILE[] = "/usr/share/X11/xkb/rules/base.lst"; * or hits end-of-file. Returns true if the section is found. The * @p name must include the "! " section marker as well. */ -static bool findSection( QFile& fh, const char* name ) +static bool +findSection( QFile& fh, const char* name ) { while ( !fh.atEnd() ) { QByteArray line = fh.readLine(); if ( line.startsWith( name ) ) + { return true; + } } return false; } -static KeyboardGlobal::ModelsMap parseKeyboardModels( const char* filepath ) +static KeyboardGlobal::ModelsMap +parseKeyboardModels( const char* filepath ) { KeyboardGlobal::ModelsMap models; @@ -75,7 +81,9 @@ static KeyboardGlobal::ModelsMap parseKeyboardModels( const char* filepath ) // check if we start a new section if ( line.startsWith( '!' ) ) + { break; + } // here we are in the model section, otherwhise we would continue or break QRegExp rx; @@ -88,7 +96,9 @@ static KeyboardGlobal::ModelsMap parseKeyboardModels( const char* filepath ) QString model = rx.cap( 1 ); if ( model == "pc105" ) + { modelDesc += " - " + QObject::tr( "Default Keyboard Model" ); + } models.insert( modelDesc, model ); } @@ -98,7 +108,8 @@ static KeyboardGlobal::ModelsMap parseKeyboardModels( const char* filepath ) } -KeyboardGlobal::LayoutsMap parseKeyboardLayouts( const char* filepath ) +KeyboardGlobal::LayoutsMap +parseKeyboardLayouts( const char* filepath ) { KeyboardGlobal::LayoutsMap layouts; @@ -120,7 +131,9 @@ KeyboardGlobal::LayoutsMap parseKeyboardLayouts( const char* filepath ) QByteArray line = fh.readLine(); if ( line.startsWith( '!' ) ) + { break; + } QRegExp rx; rx.setPattern( "^\\s+(\\S+)\\s+(\\w.*)\n$" ); @@ -147,7 +160,9 @@ KeyboardGlobal::LayoutsMap parseKeyboardLayouts( const char* filepath ) QByteArray line = fh.readLine(); if ( line.startsWith( '!' ) ) + { break; + } QRegExp rx; rx.setPattern( "^\\s+(\\S+)\\s+(\\S+): (\\w.*)\n$" ); @@ -176,14 +191,15 @@ KeyboardGlobal::LayoutsMap parseKeyboardLayouts( const char* filepath ) } -KeyboardGlobal::LayoutsMap KeyboardGlobal::getKeyboardLayouts() +KeyboardGlobal::LayoutsMap +KeyboardGlobal::getKeyboardLayouts() { return parseKeyboardLayouts( XKB_FILE ); } -KeyboardGlobal::ModelsMap KeyboardGlobal::getKeyboardModels() +KeyboardGlobal::ModelsMap +KeyboardGlobal::getKeyboardModels() { return parseKeyboardModels( XKB_FILE ); } - diff --git a/src/modules/keyboard/keyboardwidget/keyboardglobal.h b/src/modules/keyboard/keyboardwidget/keyboardglobal.h index 1732dc913..9e03c05e5 100644 --- a/src/modules/keyboard/keyboardwidget/keyboardglobal.h +++ b/src/modules/keyboard/keyboardwidget/keyboardglobal.h @@ -1,7 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Teo Mrnjavac - * Copyright 2017, 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2007 Free Software Foundation, Inc. + * SPDX-FileCopyrightText: 2014 Teo Mrnjavac + * SPDX-FileCopyrightText: 2017 2019, Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Originally from the Manjaro Installation Framework * by Roland Singer @@ -24,21 +26,22 @@ #ifndef KEYBOARDGLOBAL_H #define KEYBOARDGLOBAL_H -#include -#include -#include +#include #include -#include -#include +#include #include +#include #include #include -#include +#include +#include +#include class KeyboardGlobal { public: - struct KeyboardInfo { + struct KeyboardInfo + { QString description; QMap< QString, QString > variants; }; @@ -50,4 +53,4 @@ public: static ModelsMap getKeyboardModels(); }; -#endif // KEYBOARDGLOBAL_H +#endif // KEYBOARDGLOBAL_H diff --git a/src/modules/keyboard/keyboardwidget/keyboardpreview.cpp b/src/modules/keyboard/keyboardwidget/keyboardpreview.cpp index 02ddd4186..6cc306526 100644 --- a/src/modules/keyboard/keyboardwidget/keyboardpreview.cpp +++ b/src/modules/keyboard/keyboardwidget/keyboardpreview.cpp @@ -1,7 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Teo Mrnjavac - * Copyright 2018, Adriaan de Groot + * SPDX-FileCopyrightText: 2007 Free Software Foundation, Inc. + * SPDX-FileCopyrightText: 2014 Teo Mrnjavac + * SPDX-FileCopyrightText: 2018 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Portions from the Manjaro Installation Framework * by Roland Singer @@ -33,96 +35,126 @@ KeyBoardPreview::KeyBoardPreview( QWidget* parent ) , usable_width( 0 ) , key_w( 0 ) { - setMinimumSize(700, 191); + setMinimumSize( 700, 191 ); // We must set up the font size in pixels to fit the keys - lowerFont = QFont("Helvetica", 10, QFont::DemiBold); - lowerFont.setPixelSize(16); - upperFont = QFont("Helvetica", 8); - upperFont.setPixelSize(13); + lowerFont = QFont( "Helvetica", 10, QFont::DemiBold ); + lowerFont.setPixelSize( 16 ); + upperFont = QFont( "Helvetica", 8 ); + upperFont.setPixelSize( 13 ); // Setup keyboard types - kbList[KB_104].kb_extended_return = false; - kbList[KB_104].keys.append(QList() << 0x29 << 0x2 << 0x3 << 0x4 << 0x5 << 0x6 << 0x7 << 0x8 << 0x9 << 0xa << 0xb << 0xc << 0xd); - kbList[KB_104].keys.append(QList() << 0x10 << 0x11 << 0x12 << 0x13 << 0x14 << 0x15 << 0x16 << 0x17 << 0x18 << 0x19 << 0x1a << 0x1b << 0x2b); - kbList[KB_104].keys.append(QList() << 0x1e << 0x1f << 0x20 << 0x21 << 0x22 << 0x23 << 0x24 << 0x25 << 0x26 << 0x27 << 0x28); - kbList[KB_104].keys.append(QList() << 0x2c << 0x2d << 0x2e << 0x2f << 0x30 << 0x31 << 0x32 << 0x33 << 0x34 << 0x35); + kbList[ KB_104 ].kb_extended_return = false; + kbList[ KB_104 ].keys.append( QList< int >() << 0x29 << 0x2 << 0x3 << 0x4 << 0x5 << 0x6 << 0x7 << 0x8 << 0x9 << 0xa + << 0xb << 0xc << 0xd ); + kbList[ KB_104 ].keys.append( QList< int >() << 0x10 << 0x11 << 0x12 << 0x13 << 0x14 << 0x15 << 0x16 << 0x17 << 0x18 + << 0x19 << 0x1a << 0x1b << 0x2b ); + kbList[ KB_104 ].keys.append( QList< int >() << 0x1e << 0x1f << 0x20 << 0x21 << 0x22 << 0x23 << 0x24 << 0x25 << 0x26 + << 0x27 << 0x28 ); + kbList[ KB_104 ].keys.append( QList< int >() + << 0x2c << 0x2d << 0x2e << 0x2f << 0x30 << 0x31 << 0x32 << 0x33 << 0x34 << 0x35 ); - kbList[KB_105].kb_extended_return = true; - kbList[KB_105].keys.append(QList() << 0x29 << 0x2 << 0x3 << 0x4 << 0x5 << 0x6 << 0x7 << 0x8 << 0x9 << 0xa << 0xb << 0xc << 0xd); - kbList[KB_105].keys.append(QList() << 0x10 << 0x11 << 0x12 << 0x13 << 0x14 << 0x15 << 0x16 << 0x17 << 0x18 << 0x19 << 0x1a << 0x1b); - kbList[KB_105].keys.append(QList() << 0x1e << 0x1f << 0x20 << 0x21 << 0x22 << 0x23 << 0x24 << 0x25 << 0x26 << 0x27 << 0x28 << 0x2b); - kbList[KB_105].keys.append(QList() << 0x54 << 0x2c << 0x2d << 0x2e << 0x2f << 0x30 << 0x31 << 0x32 << 0x33 << 0x34 << 0x35); + kbList[ KB_105 ].kb_extended_return = true; + kbList[ KB_105 ].keys.append( QList< int >() << 0x29 << 0x2 << 0x3 << 0x4 << 0x5 << 0x6 << 0x7 << 0x8 << 0x9 << 0xa + << 0xb << 0xc << 0xd ); + kbList[ KB_105 ].keys.append( QList< int >() << 0x10 << 0x11 << 0x12 << 0x13 << 0x14 << 0x15 << 0x16 << 0x17 << 0x18 + << 0x19 << 0x1a << 0x1b ); + kbList[ KB_105 ].keys.append( QList< int >() << 0x1e << 0x1f << 0x20 << 0x21 << 0x22 << 0x23 << 0x24 << 0x25 << 0x26 + << 0x27 << 0x28 << 0x2b ); + kbList[ KB_105 ].keys.append( QList< int >() << 0x54 << 0x2c << 0x2d << 0x2e << 0x2f << 0x30 << 0x31 << 0x32 << 0x33 + << 0x34 << 0x35 ); - kbList[KB_106].kb_extended_return = true; - kbList[KB_106].keys.append(QList() << 0x29 << 0x2 << 0x3 << 0x4 << 0x5 << 0x6 << 0x7 << 0x8 << 0x9 << 0xa << 0xb << 0xc << 0xd << 0xe); - kbList[KB_106].keys.append(QList() << 0x10 << 0x11 << 0x12 << 0x13 << 0x14 << 0x15 << 0x16 << 0x17 << 0x18 << 0x19 << 0x1a << 0x1b); - kbList[KB_106].keys.append(QList() << 0x1e << 0x1f << 0x20 << 0x21 << 0x22 << 0x23 << 0x24 << 0x25 << 0x26 << 0x27 << 0x28 << 0x29); - kbList[KB_106].keys.append(QList() << 0x2c << 0x2d << 0x2e << 0x2f << 0x30 << 0x31 << 0x32 << 0x33 << 0x34 << 0x35 << 0x36); + kbList[ KB_106 ].kb_extended_return = true; + kbList[ KB_106 ].keys.append( QList< int >() << 0x29 << 0x2 << 0x3 << 0x4 << 0x5 << 0x6 << 0x7 << 0x8 << 0x9 << 0xa + << 0xb << 0xc << 0xd << 0xe ); + kbList[ KB_106 ].keys.append( QList< int >() << 0x10 << 0x11 << 0x12 << 0x13 << 0x14 << 0x15 << 0x16 << 0x17 << 0x18 + << 0x19 << 0x1a << 0x1b ); + kbList[ KB_106 ].keys.append( QList< int >() << 0x1e << 0x1f << 0x20 << 0x21 << 0x22 << 0x23 << 0x24 << 0x25 << 0x26 + << 0x27 << 0x28 << 0x29 ); + kbList[ KB_106 ].keys.append( QList< int >() << 0x2c << 0x2d << 0x2e << 0x2f << 0x30 << 0x31 << 0x32 << 0x33 << 0x34 + << 0x35 << 0x36 ); - kb = &kbList[KB_104]; + kb = &kbList[ KB_104 ]; } - -void KeyBoardPreview::setLayout(QString _layout) { +void +KeyBoardPreview::setLayout( QString _layout ) +{ layout = _layout; } - -void KeyBoardPreview::setVariant(QString _variant) { +void +KeyBoardPreview::setVariant( QString _variant ) +{ variant = _variant; - if (!loadCodes()) + if ( !loadCodes() ) + { return; + } loadInfo(); repaint(); } - //### //### Private //### - -void KeyBoardPreview::loadInfo() { +void +KeyBoardPreview::loadInfo() +{ // kb_104 - if (layout == "us" || layout == "th") - kb = &kbList[KB_104]; + if ( layout == "us" || layout == "th" ) + { + kb = &kbList[ KB_104 ]; + } // kb_106 - else if (layout == "jp") - kb = &kbList[KB_106]; + else if ( layout == "jp" ) + { + kb = &kbList[ KB_106 ]; + } // most keyboards are 105 key so default to that else - kb = &kbList[KB_105]; + { + kb = &kbList[ KB_105 ]; + } } - -bool KeyBoardPreview::loadCodes() { - if (layout.isEmpty()) +bool +KeyBoardPreview::loadCodes() +{ + if ( layout.isEmpty() ) + { return false; + } QStringList param; - param << "-model" << "pc106" << "-layout" << layout << "-compact"; - if (!variant.isEmpty()) + param << "-model" + << "pc106" + << "-layout" << layout << "-compact"; + if ( !variant.isEmpty() ) + { param << "-variant" << variant; + } QProcess process; - process.setEnvironment(QStringList() << "LANG=C" << "LC_MESSAGES=C"); - process.start("ckbcomp", param); - if (!process.waitForStarted()) + process.setEnvironment( QStringList() << "LANG=C" + << "LC_MESSAGES=C" ); + process.start( "ckbcomp", param ); + if ( !process.waitForStarted() ) { cWarning() << "ckbcomp not found , keyboard preview disabled"; return false; } - if (!process.waitForFinished()) + if ( !process.waitForFinished() ) { cWarning() << "ckbcomp failed, keyboard preview disabled"; return false; @@ -131,209 +163,247 @@ bool KeyBoardPreview::loadCodes() { // Clear codes codes.clear(); - const QStringList list = QString(process.readAll()).split("\n", SplitSkipEmptyParts); + const QStringList list = QString( process.readAll() ).split( "\n", SplitSkipEmptyParts ); - for (const QString &line : list) { - if (!line.startsWith("keycode") || !line.contains('=')) + for ( const QString& line : list ) + { + if ( !line.startsWith( "keycode" ) || !line.contains( '=' ) ) + { continue; + } - QStringList split = line.split('=').at(1).trimmed().split(' '); - if (split.size() < 4) + QStringList split = line.split( '=' ).at( 1 ).trimmed().split( ' ' ); + if ( split.size() < 4 ) + { continue; + } Code code; - code.plain = fromUnicodeString(split.at(0)); - code.shift = fromUnicodeString(split.at(1)); - code.ctrl = fromUnicodeString(split.at(2)); - code.alt = fromUnicodeString(split.at(3)); + code.plain = fromUnicodeString( split.at( 0 ) ); + code.shift = fromUnicodeString( split.at( 1 ) ); + code.ctrl = fromUnicodeString( split.at( 2 ) ); + code.alt = fromUnicodeString( split.at( 3 ) ); - if (code.ctrl == code.plain) + if ( code.ctrl == code.plain ) + { code.ctrl = ""; + } - if (code.alt == code.plain) + if ( code.alt == code.plain ) + { code.alt = ""; + } - codes.append(code); + codes.append( code ); } return true; } - -QString KeyBoardPreview::fromUnicodeString(QString raw) { - if (raw.startsWith("U+")) - return QChar(raw.mid(2).toInt(nullptr, 16)); - else if (raw.startsWith("+U")) - return QChar(raw.mid(3).toInt(nullptr, 16)); +QString +KeyBoardPreview::fromUnicodeString( QString raw ) +{ + if ( raw.startsWith( "U+" ) ) + { + return QChar( raw.mid( 2 ).toInt( nullptr, 16 ) ); + } + else if ( raw.startsWith( "+U" ) ) + { + return QChar( raw.mid( 3 ).toInt( nullptr, 16 ) ); + } return ""; } - -QString KeyBoardPreview::regular_text(int index) { - if (index < 0 || index >= codes.size()) +QString +KeyBoardPreview::regular_text( int index ) +{ + if ( index < 0 || index >= codes.size() ) + { return ""; + } - return codes.at(index - 1).plain; + return codes.at( index - 1 ).plain; } - -QString KeyBoardPreview::shift_text(int index) { - if (index < 0 || index >= codes.size()) +QString +KeyBoardPreview::shift_text( int index ) +{ + if ( index < 0 || index >= codes.size() ) + { return ""; + } - return codes.at(index - 1).shift; + return codes.at( index - 1 ).shift; } - -QString KeyBoardPreview::ctrl_text(int index) { - if (index < 0 || index >= codes.size()) +QString +KeyBoardPreview::ctrl_text( int index ) +{ + if ( index < 0 || index >= codes.size() ) + { return ""; + } - return codes.at(index - 1).ctrl; + return codes.at( index - 1 ).ctrl; } - -QString KeyBoardPreview::alt_text(int index) { - if (index < 0 || index >= codes.size()) +QString +KeyBoardPreview::alt_text( int index ) +{ + if ( index < 0 || index >= codes.size() ) + { return ""; + } - return codes.at(index - 1).alt; + return codes.at( index - 1 ).alt; } - -void KeyBoardPreview::resizeEvent(QResizeEvent *) { +void +KeyBoardPreview::resizeEvent( QResizeEvent* ) +{ space = 6; - usable_width = width()-7; - key_w = (usable_width - 14 * space)/15; + usable_width = width() - 7; + key_w = ( usable_width - 14 * space ) / 15; - setMaximumHeight(key_w*4 + space*5 + 1); + setMaximumHeight( key_w * 4 + space * 5 + 1 ); } +void +KeyBoardPreview::paintEvent( QPaintEvent* event ) +{ + QPainter p( this ); + p.setRenderHint( QPainter::Antialiasing ); -void KeyBoardPreview::paintEvent(QPaintEvent* event) { - QPainter p(this); - p.setRenderHint(QPainter::Antialiasing); - - p.setBrush(QColor(0xd6, 0xd6, 0xd6)); - p.drawRect(rect()); + p.setBrush( QColor( 0xd6, 0xd6, 0xd6 ) ); + p.drawRect( rect() ); QPen pen; - pen.setWidth(1); - pen.setColor(QColor(0x58, 0x58, 0x58)); - p.setPen(pen); + pen.setWidth( 1 ); + pen.setColor( QColor( 0x58, 0x58, 0x58 ) ); + p.setPen( pen ); - p.setBrush(QColor(0x58, 0x58, 0x58)); + p.setBrush( QColor( 0x58, 0x58, 0x58 ) ); - p.setBackgroundMode(Qt::TransparentMode); - p.translate(0.5, 0.5); + p.setBackgroundMode( Qt::TransparentMode ); + p.translate( 0.5, 0.5 ); int rx = 3; - int x=6; - int y=6; + int x = 6; + int y = 6; int first_key_w = 0; - int remaining_x[] = {0,0,0,0}; - int remaining_widths[] = {0,0,0,0}; + int remaining_x[] = { 0, 0, 0, 0 }; + int remaining_widths[] = { 0, 0, 0, 0 }; - for (int i = 0; i < 4; i++) { - if (first_key_w > 0) { - first_key_w = int(first_key_w * 1.375); + for ( int i = 0; i < 4; i++ ) + { + if ( first_key_w > 0 ) + { + first_key_w = int( first_key_w * 1.375 ); - if (kb == &kbList[KB_105] && i == 3) - first_key_w = int(key_w * 1.275); + if ( kb == &kbList[ KB_105 ] && i == 3 ) + { + first_key_w = int( key_w * 1.275 ); + } - p.drawRoundedRect(QRectF(6, y, first_key_w, key_w), rx, rx); + p.drawRoundedRect( QRectF( 6, y, first_key_w, key_w ), rx, rx ); x = 6 + first_key_w + space; } - else { + else + { first_key_w = key_w; } + bool last_end = ( i == 1 && !kb->kb_extended_return ); + int rw = usable_width - x; + int ii = 0; - bool last_end = (i==1 && ! kb->kb_extended_return); - int rw=usable_width-x; - int ii=0; + for ( int k : kb->keys.at( i ) ) + { + QRectF rect = QRectF( x, y, key_w, key_w ); - for (int k : kb->keys.at(i)) { - QRectF rect = QRectF(x, y, key_w, key_w); + if ( ii == kb->keys.at( i ).size() - 1 && last_end ) + { + rect.setWidth( rw ); + } - if (ii == kb->keys.at(i).size()-1 && last_end) - rect.setWidth(rw); + p.drawRoundedRect( rect, rx, rx ); - p.drawRoundedRect(rect, rx, rx); + rect.adjust( 5, 1, 0, 0 ); - rect.adjust(5, 1, 0, 0); + p.setPen( QColor( 0x9e, 0xde, 0x00 ) ); + p.setFont( upperFont ); + p.drawText( rect, Qt::AlignLeft | Qt::AlignTop, shift_text( k ) ); - p.setPen(QColor(0x9e, 0xde, 0x00)); - p.setFont(upperFont); - p.drawText(rect, Qt::AlignLeft | Qt::AlignTop, shift_text(k)); + rect.setBottom( rect.bottom() - 2.5 ); - rect.setBottom(rect.bottom() - 2.5); - - p.setPen(QColor(0xff, 0xff, 0xff)); - p.setFont(lowerFont); - p.drawText(rect, Qt::AlignLeft | Qt::AlignBottom, regular_text(k)); + p.setPen( QColor( 0xff, 0xff, 0xff ) ); + p.setFont( lowerFont ); + p.drawText( rect, Qt::AlignLeft | Qt::AlignBottom, regular_text( k ) ); rw = rw - space - key_w; x = x + space + key_w; - ii = ii+1; + ii = ii + 1; - p.setPen(pen); + p.setPen( pen ); } + remaining_x[ i ] = x; + remaining_widths[ i ] = rw; - remaining_x[i] = x; - remaining_widths[i] = rw; - - if (i != 1 && i != 2) - p.drawRoundedRect(QRectF(x, y, rw, key_w), rx, rx); + if ( i != 1 && i != 2 ) + { + p.drawRoundedRect( QRectF( x, y, rw, key_w ), rx, rx ); + } y = y + space + key_w; } - if (kb->kb_extended_return) { - rx=rx*2; - int x1 = remaining_x[1]; - int y1 = 6 + key_w*1 + space*1; - int w1 = remaining_widths[1]; - int x2 = remaining_x[2]; - int y2 = 6 + key_w*2 + space*2; + if ( kb->kb_extended_return ) + { + rx = rx * 2; + int x1 = remaining_x[ 1 ]; + int y1 = 6 + key_w * 1 + space * 1; + int w1 = remaining_widths[ 1 ]; + int x2 = remaining_x[ 2 ]; + int y2 = 6 + key_w * 2 + space * 2; // this is some serious crap... but it has to be so // maybe one day keyboards won't look like this... // one can only hope QPainterPath pp; - pp.moveTo(x1, y1+rx); - pp.arcTo(x1, y1, rx, rx, 180, -90); - pp.lineTo(x1+w1-rx, y1); - pp.arcTo(x1+w1-rx, y1, rx, rx, 90, -90); - pp.lineTo(x1+w1, y2+key_w-rx); - pp.arcTo(x1+w1-rx, y2+key_w-rx, rx, rx, 0, -90); - pp.lineTo(x2+rx, y2+key_w); - pp.arcTo(x2, y2+key_w-rx, rx, rx, -90, -90); - pp.lineTo(x2, y1+key_w); - pp.lineTo(x1+rx, y1+key_w); - pp.arcTo(x1, y1+key_w-rx, rx, rx, -90, -90); + pp.moveTo( x1, y1 + rx ); + pp.arcTo( x1, y1, rx, rx, 180, -90 ); + pp.lineTo( x1 + w1 - rx, y1 ); + pp.arcTo( x1 + w1 - rx, y1, rx, rx, 90, -90 ); + pp.lineTo( x1 + w1, y2 + key_w - rx ); + pp.arcTo( x1 + w1 - rx, y2 + key_w - rx, rx, rx, 0, -90 ); + pp.lineTo( x2 + rx, y2 + key_w ); + pp.arcTo( x2, y2 + key_w - rx, rx, rx, -90, -90 ); + pp.lineTo( x2, y1 + key_w ); + pp.lineTo( x1 + rx, y1 + key_w ); + pp.arcTo( x1, y1 + key_w - rx, rx, rx, -90, -90 ); pp.closeSubpath(); - p.drawPath(pp); + p.drawPath( pp ); } - else { - x= remaining_x[2]; - y = 6 + key_w*2 + space*2; - p.drawRoundedRect(QRectF(x, y, remaining_widths[2], key_w), rx, rx); + else + { + x = remaining_x[ 2 ]; + y = 6 + key_w * 2 + space * 2; + p.drawRoundedRect( QRectF( x, y, remaining_widths[ 2 ], key_w ), rx, rx ); } - QWidget::paintEvent(event); + QWidget::paintEvent( event ); } diff --git a/src/modules/keyboard/keyboardwidget/keyboardpreview.h b/src/modules/keyboard/keyboardwidget/keyboardpreview.h index 881866147..f09f9b5f5 100644 --- a/src/modules/keyboard/keyboardwidget/keyboardpreview.h +++ b/src/modules/keyboard/keyboardwidget/keyboardpreview.h @@ -1,6 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Teo Mrnjavac + * SPDX-FileCopyrightText: 2007 Free Software Foundation, Inc. + * SPDX-FileCopyrightText: 2014 Teo Mrnjavac + * SPDX-License-Identifier: GPL-3.0-or-later * * Portions from the Manjaro Installation Framework * by Roland Singer @@ -23,17 +25,17 @@ #ifndef KEYBOARDPREVIEW_H #define KEYBOARDPREVIEW_H -#include -#include +#include #include #include -#include #include -#include +#include #include #include +#include #include #include +#include class KeyBoardPreview : public QWidget @@ -41,40 +43,46 @@ class KeyBoardPreview : public QWidget Q_OBJECT public: explicit KeyBoardPreview( QWidget* parent = nullptr ); - - void setLayout(QString layout); - void setVariant(QString variant); + + void setLayout( QString layout ); + void setVariant( QString variant ); private: - enum KB_TYPE { KB_104, KB_105, KB_106 }; - - struct KB { - bool kb_extended_return; - QList > keys; + enum KB_TYPE + { + KB_104, + KB_105, + KB_106 }; - struct Code { + struct KB + { + bool kb_extended_return; + QList< QList< int > > keys; + }; + + struct Code + { QString plain, shift, ctrl, alt; }; QString layout, variant; QFont lowerFont, upperFont; - KB* kb, kbList[3]; - QList codes; + KB *kb, kbList[ 3 ]; + QList< Code > codes; int space, usable_width, key_w; void loadInfo(); bool loadCodes(); - QString regular_text(int index); - QString shift_text(int index); - QString ctrl_text(int index); - QString alt_text(int index); - QString fromUnicodeString(QString raw); + QString regular_text( int index ); + QString shift_text( int index ); + QString ctrl_text( int index ); + QString alt_text( int index ); + QString fromUnicodeString( QString raw ); protected: - void paintEvent(QPaintEvent* event); - void resizeEvent(QResizeEvent* event); - + void paintEvent( QPaintEvent* event ); + void resizeEvent( QResizeEvent* event ); }; -#endif // KEYBOARDPREVIEW_H +#endif // KEYBOARDPREVIEW_H diff --git a/src/modules/keyboardq/KeyboardQmlViewStep.cpp b/src/modules/keyboardq/KeyboardQmlViewStep.cpp index 783349075..a5c1f9435 100644 --- a/src/modules/keyboardq/KeyboardQmlViewStep.cpp +++ b/src/modules/keyboardq/KeyboardQmlViewStep.cpp @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2015, Teo Mrnjavac - * Copyright 2020, Camilo Higuita + * SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac + * SPDX-FileCopyrightText: 2020 Camilo Higuita + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/keyboardq/KeyboardQmlViewStep.h b/src/modules/keyboardq/KeyboardQmlViewStep.h index 22826f2cd..b1e7e15e7 100644 --- a/src/modules/keyboardq/KeyboardQmlViewStep.h +++ b/src/modules/keyboardq/KeyboardQmlViewStep.h @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2015, Teo Mrnjavac - * Copyright 2017, Adriaan de Groot + * SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac + * SPDX-FileCopyrightText: 2017 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/license/LicensePage.cpp b/src/modules/license/LicensePage.cpp index f2b1f4a50..411032404 100644 --- a/src/modules/license/LicensePage.cpp +++ b/src/modules/license/LicensePage.cpp @@ -1,9 +1,10 @@ /* === This file is part of Calamares - === * - * Copyright 2015, Anke Boersma - * Copyright 2015, Alexandre Arnt - * Copyright 2015, Teo Mrnjavac - * Copyright 2018, Adriaan de Groot + * SPDX-FileCopyrightText: 2015 Anke Boersma + * SPDX-FileCopyrightText: 2015 Alexandre Arnt + * SPDX-FileCopyrightText: 2015 Teo Mrnjavac + * SPDX-FileCopyrightText: 2018 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/license/LicensePage.h b/src/modules/license/LicensePage.h index dcd3ea7b4..8493825b5 100644 --- a/src/modules/license/LicensePage.h +++ b/src/modules/license/LicensePage.h @@ -1,9 +1,10 @@ /* === This file is part of Calamares - === * - * Copyright 2015, Anke Boersma - * Copyright 2015, Alexandre Arnt - * Copyright 2015, Teo Mrnjavac - * Copyright 2018, Adriaan de Groot + * SPDX-FileCopyrightText: 2015 Anke Boersma + * SPDX-FileCopyrightText: 2015 Alexandre Arnt + * SPDX-FileCopyrightText: 2015 Teo Mrnjavac + * SPDX-FileCopyrightText: 2018 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/license/LicenseViewStep.cpp b/src/modules/license/LicenseViewStep.cpp index 89cddf27f..24ae5652a 100644 --- a/src/modules/license/LicenseViewStep.cpp +++ b/src/modules/license/LicenseViewStep.cpp @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2015, Anke Boersma - * Copyright 2015, Teo Mrnjavac + * SPDX-FileCopyrightText: 2015 Anke Boersma + * SPDX-FileCopyrightText: 2015 Teo Mrnjavac + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/license/LicenseViewStep.h b/src/modules/license/LicenseViewStep.h index 6bfab4246..3aef1f7f3 100644 --- a/src/modules/license/LicenseViewStep.h +++ b/src/modules/license/LicenseViewStep.h @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2015, Anke Boersma - * Copyright 2015, Teo Mrnjavac + * SPDX-FileCopyrightText: 2015 Anke Boersma + * SPDX-FileCopyrightText: 2015 Teo Mrnjavac + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/license/LicenseWidget.cpp b/src/modules/license/LicenseWidget.cpp index 09d2230e5..a5f6d688a 100644 --- a/src/modules/license/LicenseWidget.cpp +++ b/src/modules/license/LicenseWidget.cpp @@ -1,9 +1,10 @@ /* === This file is part of Calamares - === * - * Copyright 2015, Anke Boersma - * Copyright 2015, Alexandre Arnt - * Copyright 2015, Teo Mrnjavac - * Copyright 2018, Adriaan de Groot + * SPDX-FileCopyrightText: 2015 Anke Boersma + * SPDX-FileCopyrightText: 2015 Alexandre Arnt + * SPDX-FileCopyrightText: 2015 Teo Mrnjavac + * SPDX-FileCopyrightText: 2018 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/license/LicenseWidget.h b/src/modules/license/LicenseWidget.h index a386ae353..08aa031c5 100644 --- a/src/modules/license/LicenseWidget.h +++ b/src/modules/license/LicenseWidget.h @@ -1,9 +1,10 @@ /* === This file is part of Calamares - === * - * Copyright 2015, Anke Boersma - * Copyright 2015, Alexandre Arnt - * Copyright 2015, Teo Mrnjavac - * Copyright 2018, Adriaan de Groot + * SPDX-FileCopyrightText: 2015 Anke Boersma + * SPDX-FileCopyrightText: 2015 Alexandre Arnt + * SPDX-FileCopyrightText: 2015 Teo Mrnjavac + * SPDX-FileCopyrightText: 2018 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/license/README.md b/src/modules/license/README.md index 4c9862c8a..0ad7a636e 100644 --- a/src/modules/license/README.md +++ b/src/modules/license/README.md @@ -1,11 +1,25 @@ ### License Approval Module ---------- -For distributions shipping proprietary software, this module creates a globalstorage entry when the user accepts or declines one or more presented End User License Agreements files. -The number of licenses shown are configurable. The license.conf file has a few examples of how to add URLs. -If you do not want to include this module in your Calamares build, add ```-DSKIP_MODULES="license"``` to your build settings (CMake call). + + +For distributions shipping proprietary software, this module creates a +Global Storage entry when the user accepts or declines one or more of +the End User License Agreements files that are presented here. + +The number of licenses shown are configurable. The `license.conf` file +has a few examples of how to add URLs. + +If you do not want to include this module in your Calamares build, +add `-DSKIP_MODULES="license"` to your build settings (CMake call). + +How to implement the removal or not installing of proprietary software is +up to any distribution to implement. For example, proprietary graphics +drivers cannot simply be removed in the packages module, a free version +will need to be installed. -How to implement the removal or not installing of proprietary software is up to any distribution to implement. For example, proprietary graphics drivers cannot simply be removed in the packages module, a free version will need to be installed. An example of where the licenseAgree globalstorage entry is used: https://github.com/KaOSx/calamares/blob/master/src/modules/nonfree_drivers/main.py diff --git a/src/modules/locale/Config.cpp b/src/modules/locale/Config.cpp index 5bbe20038..ae4f772ad 100644 --- a/src/modules/locale/Config.cpp +++ b/src/modules/locale/Config.cpp @@ -2,7 +2,6 @@ * * SPDX-FileCopyrightText: 2020 Adriaan de Groot * SPDX-License-Identifier: GPL-3.0-or-later - * License-Filename: LICENSE * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/locale/Config.h b/src/modules/locale/Config.h index d95606d99..cbebf9844 100644 --- a/src/modules/locale/Config.h +++ b/src/modules/locale/Config.h @@ -2,7 +2,6 @@ * * SPDX-FileCopyrightText: 2020 Adriaan de Groot * SPDX-License-Identifier: GPL-3.0-or-later - * License-Filename: LICENSE * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/locale/LCLocaleDialog.cpp b/src/modules/locale/LCLocaleDialog.cpp index db33f0c3d..a3b0a4d2c 100644 --- a/src/modules/locale/LCLocaleDialog.cpp +++ b/src/modules/locale/LCLocaleDialog.cpp @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Teo Mrnjavac - * Copyright 2017, Adriaan de Groot + * SPDX-FileCopyrightText: 2014 Teo Mrnjavac + * SPDX-FileCopyrightText: 2017 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/locale/LCLocaleDialog.h b/src/modules/locale/LCLocaleDialog.h index 81e4cb547..389c98ba6 100644 --- a/src/modules/locale/LCLocaleDialog.h +++ b/src/modules/locale/LCLocaleDialog.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Teo Mrnjavac + * SPDX-FileCopyrightText: 2014 Teo Mrnjavac + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/locale/LocaleConfiguration.cpp b/src/modules/locale/LocaleConfiguration.cpp index 055907228..41f315f0b 100644 --- a/src/modules/locale/LocaleConfiguration.cpp +++ b/src/modules/locale/LocaleConfiguration.cpp @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2016, Teo Mrnjavac - * Copyright 2017-2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2016 Teo Mrnjavac + * SPDX-FileCopyrightText: 2017-2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/locale/LocaleConfiguration.h b/src/modules/locale/LocaleConfiguration.h index 2e02bc02a..de3da1d74 100644 --- a/src/modules/locale/LocaleConfiguration.h +++ b/src/modules/locale/LocaleConfiguration.h @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2016, Teo Mrnjavac - * Copyright 2017-2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2016 Teo Mrnjavac + * SPDX-FileCopyrightText: 2017-2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/locale/LocalePage.h b/src/modules/locale/LocalePage.h index 4f2d321b5..57dbfe540 100644 --- a/src/modules/locale/LocalePage.h +++ b/src/modules/locale/LocalePage.h @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Teo Mrnjavac - * Copyright 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2014 Teo Mrnjavac + * SPDX-FileCopyrightText: 2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/locale/LocaleViewStep.cpp b/src/modules/locale/LocaleViewStep.cpp index 9ffb96c25..34f4d783b 100644 --- a/src/modules/locale/LocaleViewStep.cpp +++ b/src/modules/locale/LocaleViewStep.cpp @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2016, Teo Mrnjavac - * Copyright 2018, Adriaan de Groot + * SPDX-FileCopyrightText: 2014-2016 Teo Mrnjavac + * SPDX-FileCopyrightText: 2018 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/locale/LocaleViewStep.h b/src/modules/locale/LocaleViewStep.h index 0a40da861..735e5d2ce 100644 --- a/src/modules/locale/LocaleViewStep.h +++ b/src/modules/locale/LocaleViewStep.h @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2016, Teo Mrnjavac - * Copyright 2018, Adriaan de Groot + * SPDX-FileCopyrightText: 2014-2016 Teo Mrnjavac + * SPDX-FileCopyrightText: 2018 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/locale/SetTimezoneJob.cpp b/src/modules/locale/SetTimezoneJob.cpp index aa8c4c241..2d90a6609 100644 --- a/src/modules/locale/SetTimezoneJob.cpp +++ b/src/modules/locale/SetTimezoneJob.cpp @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Teo Mrnjavac - * Copyright 2015, Rohan Garg + * SPDX-FileCopyrightText: 2014 Teo Mrnjavac + * SPDX-FileCopyrightText: 2015 Rohan Garg + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/locale/SetTimezoneJob.h b/src/modules/locale/SetTimezoneJob.h index 7b93770bb..b4e04edf2 100644 --- a/src/modules/locale/SetTimezoneJob.h +++ b/src/modules/locale/SetTimezoneJob.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Teo Mrnjavac + * SPDX-FileCopyrightText: 2014 Teo Mrnjavac + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/locale/images/bg.png.license b/src/modules/locale/images/bg.png.license new file mode 100644 index 000000000..cc08e1f9f --- /dev/null +++ b/src/modules/locale/images/bg.png.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: 2014 Teo Mrnjavac +SPDX-License-Identifier: GPL-3.0-or-later diff --git a/src/modules/locale/images/pin.png.license b/src/modules/locale/images/pin.png.license new file mode 100644 index 000000000..cc08e1f9f --- /dev/null +++ b/src/modules/locale/images/pin.png.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: 2014 Teo Mrnjavac +SPDX-License-Identifier: GPL-3.0-or-later diff --git a/src/modules/locale/timezonewidget/TimeZoneImage.cpp b/src/modules/locale/timezonewidget/TimeZoneImage.cpp index 22bd263d6..1d1c1f806 100644 --- a/src/modules/locale/timezonewidget/TimeZoneImage.cpp +++ b/src/modules/locale/timezonewidget/TimeZoneImage.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2020, Adriaan de Groot + * SPDX-FileCopyrightText: 2020 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/locale/timezonewidget/TimeZoneImage.h b/src/modules/locale/timezonewidget/TimeZoneImage.h index ee02bfbfd..6c77303a5 100644 --- a/src/modules/locale/timezonewidget/TimeZoneImage.h +++ b/src/modules/locale/timezonewidget/TimeZoneImage.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2020, Adriaan de Groot + * SPDX-FileCopyrightText: 2020 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/locale/timezonewidget/timezonewidget.cpp b/src/modules/locale/timezonewidget/timezonewidget.cpp index 778f0535d..b2c0efc5b 100644 --- a/src/modules/locale/timezonewidget/timezonewidget.cpp +++ b/src/modules/locale/timezonewidget/timezonewidget.cpp @@ -1,7 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2015, Teo Mrnjavac - * Copyright 2017-2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2007 Free Software Foundation, Inc. + * SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac + * SPDX-FileCopyrightText: 2017-2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Originally from the Manjaro Installation Framework * by Roland Singer diff --git a/src/modules/locale/timezonewidget/timezonewidget.h b/src/modules/locale/timezonewidget/timezonewidget.h index c15570b52..dc95429de 100644 --- a/src/modules/locale/timezonewidget/timezonewidget.h +++ b/src/modules/locale/timezonewidget/timezonewidget.h @@ -1,7 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Teo Mrnjavac - * Copyright 2018, Adriaan de Groot + * SPDX-FileCopyrightText: 2007 Free Software Foundation, Inc. + * SPDX-FileCopyrightText: 2014 Teo Mrnjavac + * SPDX-FileCopyrightText: 2018 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Originally from the Manjaro Installation Framework * by Roland Singer diff --git a/src/modules/localeq/LocaleQmlViewStep.cpp b/src/modules/localeq/LocaleQmlViewStep.cpp index d60664a8f..6531e59a2 100644 --- a/src/modules/localeq/LocaleQmlViewStep.cpp +++ b/src/modules/localeq/LocaleQmlViewStep.cpp @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2015, Teo Mrnjavac - * Copyright 2018,2020 Adriaan de Groot + * SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac + * SPDX-FileCopyrightText: 20182020 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/localeq/LocaleQmlViewStep.h b/src/modules/localeq/LocaleQmlViewStep.h index bbafd5abb..261c1cfc2 100644 --- a/src/modules/localeq/LocaleQmlViewStep.h +++ b/src/modules/localeq/LocaleQmlViewStep.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2019-2020 Adriaan de Groot + * SPDX-FileCopyrightText: 2019-2020 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/localeq/Map.qml b/src/modules/localeq/Map.qml index d414825dd..3a2041bc0 100644 --- a/src/modules/localeq/Map.qml +++ b/src/modules/localeq/Map.qml @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2020, Anke Boersma + * SPDX-FileCopyrightText: 2020 Anke Boersma + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/localeq/Offline.qml b/src/modules/localeq/Offline.qml index 8e9d91280..72170711d 100644 --- a/src/modules/localeq/Offline.qml +++ b/src/modules/localeq/Offline.qml @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2020, Anke Boersma + * SPDX-FileCopyrightText: 2020 Anke Boersma + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/localeq/i18n.qml b/src/modules/localeq/i18n.qml index 6907b1ba8..06f871b28 100644 --- a/src/modules/localeq/i18n.qml +++ b/src/modules/localeq/i18n.qml @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2020, Anke Boersma + * SPDX-FileCopyrightText: 2020 Anke Boersma + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/localeq/img/chevron-left-solid.svg.license b/src/modules/localeq/img/chevron-left-solid.svg.license new file mode 100644 index 000000000..5a578a8a2 --- /dev/null +++ b/src/modules/localeq/img/chevron-left-solid.svg.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: 2020 https://github.com/FortAwesome/Font-Awesome +SPDX-License-Identifier: CC-BY-4.0 diff --git a/src/modules/localeq/img/locale.svg.license b/src/modules/localeq/img/locale.svg.license new file mode 100644 index 000000000..5f43e650d --- /dev/null +++ b/src/modules/localeq/img/locale.svg.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: 2020 demmm +SPDX-License-Identifier: GPL-3.0-or-later diff --git a/src/modules/localeq/img/minus.png.license b/src/modules/localeq/img/minus.png.license new file mode 100644 index 000000000..5f43e650d --- /dev/null +++ b/src/modules/localeq/img/minus.png.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: 2020 demmm +SPDX-License-Identifier: GPL-3.0-or-later diff --git a/src/modules/localeq/img/pin.svg.license b/src/modules/localeq/img/pin.svg.license new file mode 100644 index 000000000..5f43e650d --- /dev/null +++ b/src/modules/localeq/img/pin.svg.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: 2020 demmm +SPDX-License-Identifier: GPL-3.0-or-later diff --git a/src/modules/localeq/img/plus.png.license b/src/modules/localeq/img/plus.png.license new file mode 100644 index 000000000..5f43e650d --- /dev/null +++ b/src/modules/localeq/img/plus.png.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: 2020 demmm +SPDX-License-Identifier: GPL-3.0-or-later diff --git a/src/modules/localeq/img/worldmap.png.license b/src/modules/localeq/img/worldmap.png.license new file mode 100644 index 000000000..5f43e650d --- /dev/null +++ b/src/modules/localeq/img/worldmap.png.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: 2020 demmm +SPDX-License-Identifier: GPL-3.0-or-later diff --git a/src/modules/localeq/localeq.qml b/src/modules/localeq/localeq.qml index a2013f5de..f862e2d08 100644 --- a/src/modules/localeq/localeq.qml +++ b/src/modules/localeq/localeq.qml @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2020, Adriaan de Groot - * Copyright 2020, Anke Boersma + * SPDX-FileCopyrightText: 2020 Adriaan de Groot + * SPDX-FileCopyrightText: 2020 Anke Boersma + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/luksbootkeyfile/LuksBootKeyFileJob.cpp b/src/modules/luksbootkeyfile/LuksBootKeyFileJob.cpp index 90d64d5a6..63b5d753d 100644 --- a/src/modules/luksbootkeyfile/LuksBootKeyFileJob.cpp +++ b/src/modules/luksbootkeyfile/LuksBootKeyFileJob.cpp @@ -1,19 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * - * Calamares is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Calamares is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Calamares. If not, see . */ #include "LuksBootKeyFileJob.h" diff --git a/src/modules/luksbootkeyfile/LuksBootKeyFileJob.h b/src/modules/luksbootkeyfile/LuksBootKeyFileJob.h index de9b9c677..780f90883 100644 --- a/src/modules/luksbootkeyfile/LuksBootKeyFileJob.h +++ b/src/modules/luksbootkeyfile/LuksBootKeyFileJob.h @@ -1,19 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * - * 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 . */ #ifndef LUKSBOOTKEYFILEJOB_H diff --git a/src/modules/machineid/MachineIdJob.cpp b/src/modules/machineid/MachineIdJob.cpp index fc535e356..d70b0fed4 100644 --- a/src/modules/machineid/MachineIdJob.cpp +++ b/src/modules/machineid/MachineIdJob.cpp @@ -1,9 +1,10 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Kevin Kofler - * Copyright 2016, Philip Müller - * Copyright 2017, Alf Gaida - * Copyright 2019-2020, Adriaan de Groot + * SPDX-FileCopyrightText: 2014 Kevin Kofler + * SPDX-FileCopyrightText: 2016 Philip Müller + * SPDX-FileCopyrightText: 2017 Alf Gaida + * SPDX-FileCopyrightText: 2019-2020 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/machineid/MachineIdJob.h b/src/modules/machineid/MachineIdJob.h index 08943392a..91d091b16 100644 --- a/src/modules/machineid/MachineIdJob.h +++ b/src/modules/machineid/MachineIdJob.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/machineid/Tests.cpp b/src/modules/machineid/Tests.cpp index 2b6a9b1d1..af2dcee3f 100644 --- a/src/modules/machineid/Tests.cpp +++ b/src/modules/machineid/Tests.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -130,7 +131,7 @@ MachineIdTests::testJob() // Prepare part of the target filesystem { - QVERIFY( system->createTargetDirs("/etc") ); + QVERIFY( system->createTargetDirs( "/etc" ) ); auto r = system->createTargetFile( "/etc/machine-id", "Hello" ); QVERIFY( !r.failed() ); QVERIFY( r ); @@ -164,7 +165,7 @@ MachineIdTests::testJob() QFileInfo fi( "/tmp/var/lib/dbus/machine-id" ); QVERIFY( fi.exists() ); QVERIFY( fi.isSymLink() ); - QCOMPARE( fi.size(), 5); + QCOMPARE( fi.size(), 5 ); #endif } tempRoot.setAutoRemove( true ); // All tests succeeded diff --git a/src/modules/machineid/Workers.cpp b/src/modules/machineid/Workers.cpp index 76e466435..67910ce9a 100644 --- a/src/modules/machineid/Workers.cpp +++ b/src/modules/machineid/Workers.cpp @@ -1,9 +1,10 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Kevin Kofler - * Copyright 2016, Philip Müller - * Copyright 2017, Alf Gaida - * Copyright 2019-2020, Adriaan de Groot + * SPDX-FileCopyrightText: 2014 Kevin Kofler + * SPDX-FileCopyrightText: 2016 Philip Müller + * SPDX-FileCopyrightText: 2017 Alf Gaida + * SPDX-FileCopyrightText: 2019-2020 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/machineid/Workers.h b/src/modules/machineid/Workers.h index 8cb8d74ff..8e6926760 100644 --- a/src/modules/machineid/Workers.h +++ b/src/modules/machineid/Workers.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/netinstall/Config.cpp b/src/modules/netinstall/Config.cpp index 062518221..8383b51af 100644 --- a/src/modules/netinstall/Config.cpp +++ b/src/modules/netinstall/Config.cpp @@ -1,9 +1,10 @@ /* - * Copyright 2016, Luca Giambonini - * Copyright 2016, Lisa Vitolo - * Copyright 2017, Kyle Robbertze - * Copyright 2017-2018, 2020, Adriaan de Groot - * Copyright 2017, Gabriel Craciunescu + * SPDX-FileCopyrightText: 2016 Luca Giambonini + * SPDX-FileCopyrightText: 2016 Lisa Vitolo + * SPDX-FileCopyrightText: 2017 Kyle Robbertze + * SPDX-FileCopyrightText: 2017-2018 2020, Adriaan de Groot + * SPDX-FileCopyrightText: 2017 Gabriel Craciunescu + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/netinstall/Config.h b/src/modules/netinstall/Config.h index 781c9be5d..a7e979827 100644 --- a/src/modules/netinstall/Config.h +++ b/src/modules/netinstall/Config.h @@ -1,8 +1,9 @@ /* - * Copyright 2016, Luca Giambonini - * Copyright 2016, Lisa Vitolo - * Copyright 2017, Kyle Robbertze - * Copyright 2017-2018, 2020, Adriaan de Groot + * SPDX-FileCopyrightText: 2016 Luca Giambonini + * SPDX-FileCopyrightText: 2016 Lisa Vitolo + * SPDX-FileCopyrightText: 2017 Kyle Robbertze + * SPDX-FileCopyrightText: 2017-2018 2020, Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/netinstall/NetInstallPage.cpp b/src/modules/netinstall/NetInstallPage.cpp index 755b17999..309adc490 100644 --- a/src/modules/netinstall/NetInstallPage.cpp +++ b/src/modules/netinstall/NetInstallPage.cpp @@ -1,9 +1,10 @@ /* - * Copyright 2016, Luca Giambonini - * Copyright 2016, Lisa Vitolo - * Copyright 2017, Kyle Robbertze - * Copyright 2017-2018, 2020, Adriaan de Groot - * Copyright 2017, Gabriel Craciunescu + * SPDX-FileCopyrightText: 2016 Luca Giambonini + * SPDX-FileCopyrightText: 2016 Lisa Vitolo + * SPDX-FileCopyrightText: 2017 Kyle Robbertze + * SPDX-FileCopyrightText: 2017-2018 2020, Adriaan de Groot + * SPDX-FileCopyrightText: 2017 Gabriel Craciunescu + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/netinstall/NetInstallPage.h b/src/modules/netinstall/NetInstallPage.h index 13a106eaf..c680360d4 100644 --- a/src/modules/netinstall/NetInstallPage.h +++ b/src/modules/netinstall/NetInstallPage.h @@ -1,8 +1,9 @@ /* - * Copyright 2016, Luca Giambonini - * Copyright 2016, Lisa Vitolo - * Copyright 2017, Kyle Robbertze - * Copyright 2017-2018, 2020, Adriaan de Groot + * SPDX-FileCopyrightText: 2016 Luca Giambonini + * SPDX-FileCopyrightText: 2016 Lisa Vitolo + * SPDX-FileCopyrightText: 2017 Kyle Robbertze + * SPDX-FileCopyrightText: 2017-2018 2020, Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/netinstall/NetInstallViewStep.cpp b/src/modules/netinstall/NetInstallViewStep.cpp index e99b43830..3b82ff5e0 100644 --- a/src/modules/netinstall/NetInstallViewStep.cpp +++ b/src/modules/netinstall/NetInstallViewStep.cpp @@ -1,8 +1,9 @@ /* - * Copyright 2016, Luca Giambonini - * Copyright 2016, Lisa Vitolo - * Copyright 2017, Kyle Robbertze - * Copyright 2017-2018, 2020, Adriaan de Groot + * SPDX-FileCopyrightText: 2016 Luca Giambonini + * SPDX-FileCopyrightText: 2016 Lisa Vitolo + * SPDX-FileCopyrightText: 2017 Kyle Robbertze + * SPDX-FileCopyrightText: 2017-2018 2020, Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/netinstall/NetInstallViewStep.h b/src/modules/netinstall/NetInstallViewStep.h index d2114a346..44299632c 100644 --- a/src/modules/netinstall/NetInstallViewStep.h +++ b/src/modules/netinstall/NetInstallViewStep.h @@ -1,7 +1,8 @@ /* - * Copyright 2016, Luca Giambonini - * Copyright 2016, Lisa Vitolo - * Copyright 2017, Adriaan de Groot + * SPDX-FileCopyrightText: 2016 Luca Giambonini + * SPDX-FileCopyrightText: 2016 Lisa Vitolo + * SPDX-FileCopyrightText: 2017 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/netinstall/PackageModel.cpp b/src/modules/netinstall/PackageModel.cpp index dd5047129..b5e6103c8 100644 --- a/src/modules/netinstall/PackageModel.cpp +++ b/src/modules/netinstall/PackageModel.cpp @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright (c) 2017, Kyle Robbertze - * Copyright 2017-2018, 2020, Adriaan de Groot + * SPDX-FileCopyrightText: 2017 Kyle Robbertze + * SPDX-FileCopyrightText: 2017-2018 2020, Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/netinstall/PackageModel.h b/src/modules/netinstall/PackageModel.h index b4e8fc102..35bc11354 100644 --- a/src/modules/netinstall/PackageModel.h +++ b/src/modules/netinstall/PackageModel.h @@ -1,8 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright (c) 2017, Kyle Robbertze - * Copyright 2017, Adriaan de Groot + * SPDX-FileCopyrightText: 2017 Kyle Robbertze + * SPDX-FileCopyrightText: 2017 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/netinstall/PackageTreeItem.cpp b/src/modules/netinstall/PackageTreeItem.cpp index 30a57ac2a..32fcf4296 100644 --- a/src/modules/netinstall/PackageTreeItem.cpp +++ b/src/modules/netinstall/PackageTreeItem.cpp @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright (c) 2017, Kyle Robbertze - * Copyright 2017, 2020, Adriaan de Groot + * SPDX-FileCopyrightText: 2017 Kyle Robbertze + * SPDX-FileCopyrightText: 2017 2020, Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/netinstall/PackageTreeItem.h b/src/modules/netinstall/PackageTreeItem.h index 0b2d506d7..5df703a29 100644 --- a/src/modules/netinstall/PackageTreeItem.h +++ b/src/modules/netinstall/PackageTreeItem.h @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright (c) 2017, Kyle Robbertze - * Copyright 2017, 2020, Adriaan de Groot + * SPDX-FileCopyrightText: 2017 Kyle Robbertze + * SPDX-FileCopyrightText: 2017 2020, Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/netinstall/README.md b/src/modules/netinstall/README.md deleted file mode 100644 index 0a9db2f22..000000000 --- a/src/modules/netinstall/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# Netinstall module - -All of the actual documentation of the netinstall module has moved -into the `netinstall.conf` file; since the configuration file **may** -contain the groups-and-packages list itself, that format is -also described there. diff --git a/src/modules/netinstall/Tests.cpp b/src/modules/netinstall/Tests.cpp index c74e6aafe..1ffc72f3f 100644 --- a/src/modules/netinstall/Tests.cpp +++ b/src/modules/netinstall/Tests.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2020, Adriaan de Groot + * SPDX-FileCopyrightText: 2020 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/netinstall/netinstall.yaml b/src/modules/netinstall/netinstall.yaml index 6a93d84ea..e55bc1b24 100644 --- a/src/modules/netinstall/netinstall.yaml +++ b/src/modules/netinstall/netinstall.yaml @@ -1,5 +1,8 @@ # Example configuration with groups and packages, taken from Chakra Linux. # +# SPDX-FileCopyrightText: no +# SPDX-License-Identifier: CC0-1.0 +# # This example is rather limited. See `netinstall.conf` for full documentation # on the configuration format. The module configuration file `netinstall.conf` # **may** contain the package-list, but that is only useful for static diff --git a/src/modules/notesqml/NotesQmlViewStep.cpp b/src/modules/notesqml/NotesQmlViewStep.cpp index 5a6bbc494..4d0430e95 100644 --- a/src/modules/notesqml/NotesQmlViewStep.cpp +++ b/src/modules/notesqml/NotesQmlViewStep.cpp @@ -1,20 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2020, Adriaan de Groot - * Copyright 2020, Anke Boersma + * SPDX-FileCopyrightText: 2020 Adriaan de Groot + * SPDX-FileCopyrightText: 2020 Anke Boersma + * SPDX-License-Identifier: GPL-3.0-or-later * - * Calamares is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Calamares is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Calamares. If not, see . */ #include "NotesQmlViewStep.h" @@ -45,7 +34,7 @@ NotesQmlViewStep::setConfigurationMap( const QVariantMap& configurationMap ) m_notesName = new CalamaresUtils::Locale::TranslatedString( qmlLabel, "notes" ); } - Calamares::QmlViewStep::setConfigurationMap( configurationMap ); // call parent implementation last + Calamares::QmlViewStep::setConfigurationMap( configurationMap ); // call parent implementation last } CALAMARES_PLUGIN_FACTORY_DEFINITION( NotesQmlViewStepFactory, registerPlugin< NotesQmlViewStep >(); ) diff --git a/src/modules/notesqml/NotesQmlViewStep.h b/src/modules/notesqml/NotesQmlViewStep.h index 5ffd4598e..8545b47b9 100644 --- a/src/modules/notesqml/NotesQmlViewStep.h +++ b/src/modules/notesqml/NotesQmlViewStep.h @@ -1,20 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2020, Adriaan de Groot - * Copyright 2020, Anke Boersma + * SPDX-FileCopyrightText: 2020 Adriaan de Groot + * SPDX-FileCopyrightText: 2020 Anke Boersma + * SPDX-License-Identifier: GPL-3.0-or-later * - * 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 . */ #ifndef NOTESQMLVIEWSTEP_H @@ -23,8 +12,8 @@ #include "DllMacro.h" #include "locale/TranslatableConfiguration.h" #include "utils/CalamaresUtilsSystem.h" -#include "utils/Variant.h" #include "utils/PluginFactory.h" +#include "utils/Variant.h" #include "viewpages/QmlViewStep.h" class PLUGINDLLEXPORT NotesQmlViewStep : public Calamares::QmlViewStep @@ -36,7 +25,7 @@ public: virtual ~NotesQmlViewStep() override; QString prettyName() const override; - + void setConfigurationMap( const QVariantMap& configurationMap ) override; private: diff --git a/src/modules/notesqml/examples/notesqml.qml.example b/src/modules/notesqml/examples/notesqml.qml.example index a41fa98fd..b3094f447 100644 --- a/src/modules/notesqml/examples/notesqml.qml.example +++ b/src/modules/notesqml/examples/notesqml.qml.example @@ -1,20 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2020, Anke Boersma - * Copyright 2020, Adriaan de Groot + * SPDX-FileCopyrightText: 2020 Anke Boersma + * SPDX-FileCopyrightText: 2020 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * - * 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 . */ /* Some Calamares internals are available to all QML modules. @@ -25,60 +14,61 @@ */ import calamares.ui 1.0 -import QtQuick 2.7 -import QtQuick.Controls 2.2 -import QtQuick.Window 2.2 -import QtQuick.Layouts 1.3 -import QtQuick.Controls.Material 2.1 + import QtQuick 2.7 import QtQuick.Controls 2.2 import QtQuick.Window 2.2 import QtQuick.Layouts 1.3 import QtQuick.Controls.Material 2.1 -Item { - width: 740 - height: 420 + Item +{ +width: + 740 height : 420 - Flickable { - id: flick - anchors.fill: parent - contentHeight: 800 + Flickable + { + id: + flick anchors + .fill : parent contentHeight : 800 - ScrollBar.vertical: ScrollBar { - id: fscrollbar - width: 10 - policy: ScrollBar.AlwaysOn - } + ScrollBar.vertical : ScrollBar { id : fscrollbar width : 10 policy : ScrollBar.AlwaysOn } - TextArea { - id: intro + TextArea + { + id: + intro x: 1 y: 0 - width: parent.width - fscrollbar.width +width: + parent.width - fscrollbar.width font.pointSize: 14 - textFormat: Text.RichText - antialiasing: true - activeFocusOnPress: false - wrapMode: Text.WordWrap +textFormat: + Text.RichText +antialiasing: + true +activeFocusOnPress: + false +wrapMode: + Text.WordWrap - text: qsTr("

%1

-

This an example QML file, showing options in RichText with Flickable content.

+text: + qsTr( "

%1

+

This an example QML file, showing options in RichText with Flickable content.

-

QML with RichText can use HTML tags, Flickable content is useful for touchscreens.

+

QML with RichText can use HTML tags, Flickable content is useful for touchscreens.

-

This is bold text

-

This is italic text

-

This is underlined text

-

This text will be center-aligned.

-

This is strikethrough

+

This is bold text

+

This is italic text

+

This is underlined text

+

This text will be center-aligned.

+

This is strikethrough

-

Code example: - ls -l /home

+

Code example: + ls -l /home

-

Lists:

-
    -
  • Intel CPU systems
  • -
  • AMD CPU systems
  • -
- -

The vertical scrollbar is adjustable, current width set to 10.

").arg(Branding.string(Branding.VersionedName)) +

Lists:

+
    +
  • Intel CPU systems
  • +
  • AMD CPU systems
  • +
+

The vertical scrollbar is adjustable, current width set to 10.

").arg(Branding.string(Branding.VersionedName)) } } } diff --git a/src/modules/notesqml/notesqml.qml b/src/modules/notesqml/notesqml.qml index 374d9c399..7be5cffa9 100644 --- a/src/modules/notesqml/notesqml.qml +++ b/src/modules/notesqml/notesqml.qml @@ -2,19 +2,8 @@ * * Copyright 2020, Anke Boersma * Copyright 2020, Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * - * 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 . */ /* Some Calamares internals are available to all QML modules. diff --git a/src/modules/oemid/IDJob.cpp b/src/modules/oemid/IDJob.cpp index 16461b191..19ad85cc9 100644 --- a/src/modules/oemid/IDJob.cpp +++ b/src/modules/oemid/IDJob.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27,52 +28,54 @@ #include #include -IDJob::IDJob(const QString& id, QObject* parent) +IDJob::IDJob( const QString& id, QObject* parent ) : Job( parent ) , m_batchIdentifier( id ) { } -QString IDJob::prettyName() const +QString +IDJob::prettyName() const { return tr( "OEM Batch Identifier" ); } -Calamares::JobResult IDJob::writeId( const QString& dirs, const QString& filename, const QString& contents ) +Calamares::JobResult +IDJob::writeId( const QString& dirs, const QString& filename, const QString& contents ) { if ( !QDir().mkpath( dirs ) ) { cError() << "Could not create directories" << dirs; - return Calamares::JobResult::error( - tr( "OEM Batch Identifier" ), - tr( "Could not create directories %1." ).arg( dirs ) ); + return Calamares::JobResult::error( tr( "OEM Batch Identifier" ), + tr( "Could not create directories %1." ).arg( dirs ) ); } QFile output( QDir( dirs ).filePath( filename ) ); if ( output.exists() ) + { cWarning() << "Existing OEM Batch ID" << output.fileName() << "overwritten."; + } if ( !output.open( QIODevice::WriteOnly ) ) { cError() << "Could not write to" << output.fileName(); - return Calamares::JobResult::error( - tr( "OEM Batch Identifier" ), - tr( "Could not open file %1." ).arg( output.fileName() ) ); + return Calamares::JobResult::error( tr( "OEM Batch Identifier" ), + tr( "Could not open file %1." ).arg( output.fileName() ) ); } if ( output.write( contents.toUtf8() ) < 0 ) { cError() << "Write error on" << output.fileName(); - return Calamares::JobResult::error( - tr( "OEM Batch Identifier" ), - tr( "Could not write to file %1." ).arg( output.fileName() ) ); + return Calamares::JobResult::error( tr( "OEM Batch Identifier" ), + tr( "Could not write to file %1." ).arg( output.fileName() ) ); } output.write( "\n" ); // Ignore error on this one return Calamares::JobResult::ok(); } -Calamares::JobResult IDJob::exec() +Calamares::JobResult +IDJob::exec() { cDebug() << "Setting OEM Batch ID to" << m_batchIdentifier; @@ -84,10 +87,11 @@ Calamares::JobResult IDJob::exec() // Don't bother translating internal errors if ( rootMount.isEmpty() && Calamares::Settings::instance()->doChroot() ) - return Calamares::JobResult::internalError( - "OEM Batch Identifier", - "No rootMountPoint is set, but a chroot is required. " - "Is there a module before oemid that sets up the partitions?", - Calamares::JobResult::InvalidConfiguration ); - return writeId( Calamares::Settings::instance()->doChroot() ? rootMount + targetDir : targetDir, targetFile, m_batchIdentifier ); + return Calamares::JobResult::internalError( "OEM Batch Identifier", + "No rootMountPoint is set, but a chroot is required. " + "Is there a module before oemid that sets up the partitions?", + Calamares::JobResult::InvalidConfiguration ); + return writeId( Calamares::Settings::instance()->doChroot() ? rootMount + targetDir : targetDir, + targetFile, + m_batchIdentifier ); } diff --git a/src/modules/oemid/IDJob.h b/src/modules/oemid/IDJob.h index 845a3f451..dd8bd5e24 100644 --- a/src/modules/oemid/IDJob.h +++ b/src/modules/oemid/IDJob.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -36,7 +37,7 @@ private: Calamares::JobResult writeId( const QString&, const QString&, const QString& ); QString m_batchIdentifier; -} ; +}; #endif diff --git a/src/modules/oemid/OEMViewStep.cpp b/src/modules/oemid/OEMViewStep.cpp index 8a12bd17c..85de722dc 100644 --- a/src/modules/oemid/OEMViewStep.cpp +++ b/src/modules/oemid/OEMViewStep.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -38,22 +39,18 @@ public: { m_ui->setupUi( this ); - CALAMARES_RETRANSLATE( - m_ui->retranslateUi( this ); - ) + CALAMARES_RETRANSLATE( m_ui->retranslateUi( this ); ) } virtual ~OEMPage() override; - + Ui_OEMPage* m_ui; -} ; +}; -OEMPage::~OEMPage() -{ -} +OEMPage::~OEMPage() {} -OEMViewStep::OEMViewStep(QObject* parent) +OEMViewStep::OEMViewStep( QObject* parent ) : Calamares::ViewStep( parent ) , m_widget( nullptr ) , m_visited( false ) @@ -63,86 +60,106 @@ OEMViewStep::OEMViewStep(QObject* parent) OEMViewStep::~OEMViewStep() { if ( m_widget && m_widget->parent() == nullptr ) + { m_widget->deleteLater(); + } } -bool OEMViewStep::isBackEnabled() const +bool +OEMViewStep::isBackEnabled() const { return true; } -bool OEMViewStep::isNextEnabled() const +bool +OEMViewStep::isNextEnabled() const { return true; } -bool OEMViewStep::isAtBeginning() const +bool +OEMViewStep::isAtBeginning() const { return true; } -bool OEMViewStep::isAtEnd() const +bool +OEMViewStep::isAtEnd() const { return true; } -static QString substitute( QString s ) +static QString +substitute( QString s ) { QString t_date = QStringLiteral( "@@DATE@@" ); if ( s.contains( t_date ) ) { auto date = QDate::currentDate(); - s = s.replace( t_date, date.toString( Qt::ISODate )); + s = s.replace( t_date, date.toString( Qt::ISODate ) ); } return s; } -void OEMViewStep::onActivate() +void +OEMViewStep::onActivate() { if ( !m_widget ) - (void) widget(); + { + (void)widget(); + } if ( !m_visited && m_widget ) + { m_widget->m_ui->batchIdentifier->setText( m_user_batchIdentifier ); + } m_visited = true; ViewStep::onActivate(); } -void OEMViewStep::onLeave() +void +OEMViewStep::onLeave() { m_user_batchIdentifier = m_widget->m_ui->batchIdentifier->text(); ViewStep::onLeave(); } -QString OEMViewStep::prettyName() const +QString +OEMViewStep::prettyName() const { return tr( "OEM Configuration" ); } -QString OEMViewStep::prettyStatus() const +QString +OEMViewStep::prettyStatus() const { return tr( "Set the OEM Batch Identifier to %1." ).arg( m_user_batchIdentifier ); } -QWidget * OEMViewStep::widget() +QWidget* +OEMViewStep::widget() { - if (!m_widget) + if ( !m_widget ) + { m_widget = new OEMPage; + } return m_widget; } -Calamares::JobList OEMViewStep::jobs() const +Calamares::JobList +OEMViewStep::jobs() const { return Calamares::JobList() << Calamares::job_ptr( new IDJob( m_user_batchIdentifier ) ); } -void OEMViewStep::setConfigurationMap(const QVariantMap& configurationMap) +void +OEMViewStep::setConfigurationMap( const QVariantMap& configurationMap ) { m_conf_batchIdentifier = CalamaresUtils::getString( configurationMap, "batch-identifier" ); m_user_batchIdentifier = substitute( m_conf_batchIdentifier ); } -CALAMARES_PLUGIN_FACTORY_DEFINITION( OEMViewStepFactory, registerPlugin(); ) +CALAMARES_PLUGIN_FACTORY_DEFINITION( OEMViewStepFactory, registerPlugin< OEMViewStep >(); ) diff --git a/src/modules/oemid/OEMViewStep.h b/src/modules/oemid/OEMViewStep.h index 1f0e58915..342c62d60 100644 --- a/src/modules/oemid/OEMViewStep.h +++ b/src/modules/oemid/OEMViewStep.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/packagechooser/ItemAppData.cpp b/src/modules/packagechooser/ItemAppData.cpp index ed0ba9223..4adebb5c3 100644 --- a/src/modules/packagechooser/ItemAppData.cpp +++ b/src/modules/packagechooser/ItemAppData.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/packagechooser/ItemAppData.h b/src/modules/packagechooser/ItemAppData.h index 72617ff0c..c811ae4d5 100644 --- a/src/modules/packagechooser/ItemAppData.h +++ b/src/modules/packagechooser/ItemAppData.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/packagechooser/ItemAppStream.cpp b/src/modules/packagechooser/ItemAppStream.cpp index 83837a9ca..e397f8a15 100644 --- a/src/modules/packagechooser/ItemAppStream.cpp +++ b/src/modules/packagechooser/ItemAppStream.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/packagechooser/ItemAppStream.h b/src/modules/packagechooser/ItemAppStream.h index c44b84b06..cbfccdc90 100644 --- a/src/modules/packagechooser/ItemAppStream.h +++ b/src/modules/packagechooser/ItemAppStream.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/packagechooser/PackageChooserPage.cpp b/src/modules/packagechooser/PackageChooserPage.cpp index 16f50abab..ac59f929c 100644 --- a/src/modules/packagechooser/PackageChooserPage.cpp +++ b/src/modules/packagechooser/PackageChooserPage.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/packagechooser/PackageChooserPage.h b/src/modules/packagechooser/PackageChooserPage.h index b4ef2169b..a5ce6d2e5 100644 --- a/src/modules/packagechooser/PackageChooserPage.h +++ b/src/modules/packagechooser/PackageChooserPage.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/packagechooser/PackageChooserViewStep.cpp b/src/modules/packagechooser/PackageChooserViewStep.cpp index 759c6eeab..fb64727f7 100644 --- a/src/modules/packagechooser/PackageChooserViewStep.cpp +++ b/src/modules/packagechooser/PackageChooserViewStep.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/packagechooser/PackageChooserViewStep.h b/src/modules/packagechooser/PackageChooserViewStep.h index 9e9087971..f74abe376 100644 --- a/src/modules/packagechooser/PackageChooserViewStep.h +++ b/src/modules/packagechooser/PackageChooserViewStep.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/packagechooser/PackageModel.cpp b/src/modules/packagechooser/PackageModel.cpp index 12995fad5..dd8903fc9 100644 --- a/src/modules/packagechooser/PackageModel.cpp +++ b/src/modules/packagechooser/PackageModel.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/packagechooser/PackageModel.h b/src/modules/packagechooser/PackageModel.h index ee3b30185..2dff3834a 100644 --- a/src/modules/packagechooser/PackageModel.h +++ b/src/modules/packagechooser/PackageModel.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/packagechooser/Tests.cpp b/src/modules/packagechooser/Tests.cpp index da355dc96..0e9968814 100644 --- a/src/modules/packagechooser/Tests.cpp +++ b/src/modules/packagechooser/Tests.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -77,7 +78,8 @@ PackageChooserTests::testAppData() QCOMPARE( p1.description.get(), QStringLiteral( "Calamares is an installer program for Linux distributions." ) ); // .. but en_GB doesn't have an entry in description, so uses QCOMPARE( p1.description.get( QLocale( "en_GB" ) ), QStringLiteral( "Calamares Linux Installer" ) ); - QCOMPARE( p1.description.get( QLocale( "nl" ) ), QStringLiteral( "Calamares is een installatieprogramma voor Linux distributies." ) ); + QCOMPARE( p1.description.get( QLocale( "nl" ) ), + QStringLiteral( "Calamares is een installatieprogramma voor Linux distributies." ) ); QVERIFY( p1.screenshot.isNull() ); m.insert( "id", "calamares" ); @@ -85,7 +87,8 @@ PackageChooserTests::testAppData() PackageItem p2 = fromAppData( m ); QVERIFY( p2.isValid() ); QCOMPARE( p2.id, QStringLiteral( "calamares" ) ); - QCOMPARE( p2.description.get( QLocale( "nl" ) ), QStringLiteral( "Calamares is een installatieprogramma voor Linux distributies." ) ); + QCOMPARE( p2.description.get( QLocale( "nl" ) ), + QStringLiteral( "Calamares is een installatieprogramma voor Linux distributies." ) ); QVERIFY( !p2.screenshot.isNull() ); #endif } diff --git a/src/modules/packagechooser/Tests.h b/src/modules/packagechooser/Tests.h index 62efe92cc..716f930e3 100644 --- a/src/modules/packagechooser/Tests.h +++ b/src/modules/packagechooser/Tests.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/packagechooser/images/calamares.png.license b/src/modules/packagechooser/images/calamares.png.license new file mode 100644 index 000000000..cc08e1f9f --- /dev/null +++ b/src/modules/packagechooser/images/calamares.png.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: 2014 Teo Mrnjavac +SPDX-License-Identifier: GPL-3.0-or-later diff --git a/src/modules/packagechooser/images/no-selection.png.license b/src/modules/packagechooser/images/no-selection.png.license new file mode 100644 index 000000000..ef0e9d7cd --- /dev/null +++ b/src/modules/packagechooser/images/no-selection.png.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: 2014 Uri Herrera and others +SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/modules/partition/README.md b/src/modules/partition/README.md index 3491b309b..cbebd589e 100644 --- a/src/modules/partition/README.md +++ b/src/modules/partition/README.md @@ -1,5 +1,11 @@ # Architecture + + ## Overview The heart of the module is the PartitionCoreModule class. It holds Qt models for diff --git a/src/modules/partition/core/BootLoaderModel.cpp b/src/modules/partition/core/BootLoaderModel.cpp index 10b88be76..13ce2a379 100644 --- a/src/modules/partition/core/BootLoaderModel.cpp +++ b/src/modules/partition/core/BootLoaderModel.cpp @@ -1,8 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Aurélien Gâteau - * Copyright 2015, Teo Mrnjavac - * Copyright 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2014 Aurélien Gâteau + * SPDX-FileCopyrightText: 2015 Teo Mrnjavac + * SPDX-FileCopyrightText: 2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/core/BootLoaderModel.h b/src/modules/partition/core/BootLoaderModel.h index 8daa8ca04..1157879ef 100644 --- a/src/modules/partition/core/BootLoaderModel.h +++ b/src/modules/partition/core/BootLoaderModel.h @@ -1,8 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Aurélien Gâteau - * Copyright 2015, Teo Mrnjavac - * Copyright 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2014 Aurélien Gâteau + * SPDX-FileCopyrightText: 2015 Teo Mrnjavac + * SPDX-FileCopyrightText: 2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/core/ColorUtils.cpp b/src/modules/partition/core/ColorUtils.cpp index d04c4110d..9b86cdb46 100644 --- a/src/modules/partition/core/ColorUtils.cpp +++ b/src/modules/partition/core/ColorUtils.cpp @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Aurélien Gâteau - * Copyright 2015-2016, Teo Mrnjavac + * SPDX-FileCopyrightText: 2014 Aurélien Gâteau + * SPDX-FileCopyrightText: 2015-2016 Teo Mrnjavac + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/core/ColorUtils.h b/src/modules/partition/core/ColorUtils.h index 3c65b75b2..ab4e86481 100644 --- a/src/modules/partition/core/ColorUtils.h +++ b/src/modules/partition/core/ColorUtils.h @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Aurélien Gâteau - * Copyright 2016, Teo Mrnjavac + * SPDX-FileCopyrightText: 2014 Aurélien Gâteau + * SPDX-FileCopyrightText: 2016 Teo Mrnjavac + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/core/Config.cpp b/src/modules/partition/core/Config.cpp index 086d87da5..00b896724 100644 --- a/src/modules/partition/core/Config.cpp +++ b/src/modules/partition/core/Config.cpp @@ -125,7 +125,8 @@ Config::setConfigurationMap( const QVariantMap& configurationMap ) m_swapChoices = getSwapChoices( configurationMap ); bool nameFound = false; // In the name table (ignored, falls back to first entry in table) - m_initialInstallChoice = PartitionActions::Choices::installChoiceNames().find( CalamaresUtils::getString( configurationMap, "initialPartitioningChoice" ), nameFound ); + m_initialInstallChoice = PartitionActions::Choices::installChoiceNames().find( + CalamaresUtils::getString( configurationMap, "initialPartitioningChoice" ), nameFound ); } void diff --git a/src/modules/partition/core/DeviceList.cpp b/src/modules/partition/core/DeviceList.cpp index 041801b9e..dfba17523 100644 --- a/src/modules/partition/core/DeviceList.cpp +++ b/src/modules/partition/core/DeviceList.cpp @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2015-2016, Teo Mrnjavac - * Copyright 2018-2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2015-2016 Teo Mrnjavac + * SPDX-FileCopyrightText: 2018-2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/core/DeviceList.h b/src/modules/partition/core/DeviceList.h index 306d90739..986c6b05f 100644 --- a/src/modules/partition/core/DeviceList.h +++ b/src/modules/partition/core/DeviceList.h @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2017, Teo Mrnjavac - * Copyright 2017, Adriaan de Groot + * SPDX-FileCopyrightText: 2014-2017 Teo Mrnjavac + * SPDX-FileCopyrightText: 2017 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/core/DeviceModel.cpp b/src/modules/partition/core/DeviceModel.cpp index f881d265b..3e42ab029 100644 --- a/src/modules/partition/core/DeviceModel.cpp +++ b/src/modules/partition/core/DeviceModel.cpp @@ -1,8 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Aurélien Gâteau - * Copyright 2014, Teo Mrnjavac - * Copyright 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2014 Aurélien Gâteau + * SPDX-FileCopyrightText: 2014 Teo Mrnjavac + * SPDX-FileCopyrightText: 2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/core/DeviceModel.h b/src/modules/partition/core/DeviceModel.h index 29d1598ad..a03405cb6 100644 --- a/src/modules/partition/core/DeviceModel.h +++ b/src/modules/partition/core/DeviceModel.h @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Aurélien Gâteau - * Copyright 2017, 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2014 Aurélien Gâteau + * SPDX-FileCopyrightText: 2017 2019, Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/core/KPMHelpers.cpp b/src/modules/partition/core/KPMHelpers.cpp index 730d1d9af..ba8238531 100644 --- a/src/modules/partition/core/KPMHelpers.cpp +++ b/src/modules/partition/core/KPMHelpers.cpp @@ -1,8 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Aurélien Gâteau - * Copyright 2015-2016, Teo Mrnjavac + * SPDX-FileCopyrightText: 2014 Aurélien Gâteau + * SPDX-FileCopyrightText: 2015-2016 Teo Mrnjavac * Copyright 2018-2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/core/KPMHelpers.h b/src/modules/partition/core/KPMHelpers.h index 326993362..743dcc790 100644 --- a/src/modules/partition/core/KPMHelpers.h +++ b/src/modules/partition/core/KPMHelpers.h @@ -1,8 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Aurélien Gâteau - * Copyright 2015-2016, Teo Mrnjavac - * Copyright 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2014 Aurélien Gâteau + * SPDX-FileCopyrightText: 2015-2016 Teo Mrnjavac + * SPDX-FileCopyrightText: 2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/core/OsproberEntry.h b/src/modules/partition/core/OsproberEntry.h index 1e1fd0eca..9313a6bb5 100644 --- a/src/modules/partition/core/OsproberEntry.h +++ b/src/modules/partition/core/OsproberEntry.h @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2016, Teo Mrnjavac - * Copyright 2018, Adriaan de Groot + * SPDX-FileCopyrightText: 2014-2016 Teo Mrnjavac + * SPDX-FileCopyrightText: 2018 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/core/PartUtils.cpp b/src/modules/partition/core/PartUtils.cpp index 4dd3dcbf3..1d5484671 100644 --- a/src/modules/partition/core/PartUtils.cpp +++ b/src/modules/partition/core/PartUtils.cpp @@ -1,8 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2015-2016, Teo Mrnjavac + * SPDX-FileCopyrightText: 2015-2016 Teo Mrnjavac * Copyright 2018-2019 Adriaan de Groot - * Copyright 2019, Collabora Ltd + * SPDX-FileCopyrightText: 2019 Collabora Ltd + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -459,7 +460,7 @@ isEfiBootable( const Partition* candidate ) while ( root && !root->isRoot() ) { root = root->parent(); - cDebug() << Logger::SubEntry << "moved towards root" << Logger::Pointer(root); + cDebug() << Logger::SubEntry << "moved towards root" << Logger::Pointer( root ); } // Strange case: no root found, no partition table node? @@ -469,7 +470,7 @@ isEfiBootable( const Partition* candidate ) } const PartitionTable* table = dynamic_cast< const PartitionTable* >( root ); - cDebug() << Logger::SubEntry << "partition table" << Logger::Pointer(table) << "type" + cDebug() << Logger::SubEntry << "partition table" << Logger::Pointer( table ) << "type" << ( table ? table->type() : PartitionTable::TableType::unknownTableType ); return table && ( table->type() == PartitionTable::TableType::gpt ) && flags.testFlag( KPM_PARTITION_FLAG( Boot ) ); } diff --git a/src/modules/partition/core/PartUtils.h b/src/modules/partition/core/PartUtils.h index 0db49d043..a56cb8a60 100644 --- a/src/modules/partition/core/PartUtils.h +++ b/src/modules/partition/core/PartUtils.h @@ -1,8 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2015-2016, Teo Mrnjavac - * Copyright 2018-2019 Adriaan de Groot - * Copyright 2019, Collabora Ltd + * SPDX-FileCopyrightText: 2015-2016 Teo Mrnjavac + * SPDX-FileCopyrightText: 2018-2019 Adriaan de Groot + * SPDX-FileCopyrightText: 2019 Collabora Ltd + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/core/PartitionActions.cpp b/src/modules/partition/core/PartitionActions.cpp index cae5025bf..dba02318e 100644 --- a/src/modules/partition/core/PartitionActions.cpp +++ b/src/modules/partition/core/PartitionActions.cpp @@ -1,8 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2017, Teo Mrnjavac - * Copyright 2017-2019, Adriaan de Groot - * Copyright 2019, Collabora Ltd + * SPDX-FileCopyrightText: 2014-2017 Teo Mrnjavac + * SPDX-FileCopyrightText: 2017-2019 Adriaan de Groot + * SPDX-FileCopyrightText: 2019 Collabora Ltd + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/core/PartitionActions.h b/src/modules/partition/core/PartitionActions.h index 6f4b41cc8..63dfccb11 100644 --- a/src/modules/partition/core/PartitionActions.h +++ b/src/modules/partition/core/PartitionActions.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2016, Teo Mrnjavac + * SPDX-FileCopyrightText: 2014-2016 Teo Mrnjavac + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/core/PartitionCoreModule.cpp b/src/modules/partition/core/PartitionCoreModule.cpp index 8856778b3..370caebfb 100644 --- a/src/modules/partition/core/PartitionCoreModule.cpp +++ b/src/modules/partition/core/PartitionCoreModule.cpp @@ -1,10 +1,11 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Aurélien Gâteau - * Copyright 2014-2015, Teo Mrnjavac - * Copyright 2017-2019, Adriaan de Groot - * Copyright 2018, Caio Carvalho - * Copyright 2019, Collabora Ltd + * SPDX-FileCopyrightText: 2014 Aurélien Gâteau + * SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac + * SPDX-FileCopyrightText: 2017-2019 Adriaan de Groot + * SPDX-FileCopyrightText: 2018 Caio Carvalho + * SPDX-FileCopyrightText: 2019 Collabora Ltd + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/core/PartitionCoreModule.h b/src/modules/partition/core/PartitionCoreModule.h index f88544ae8..b75f67d75 100644 --- a/src/modules/partition/core/PartitionCoreModule.h +++ b/src/modules/partition/core/PartitionCoreModule.h @@ -1,8 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Aurélien Gâteau - * Copyright 2014-2016, Teo Mrnjavac - * Copyright 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2014 Aurélien Gâteau + * SPDX-FileCopyrightText: 2014-2016 Teo Mrnjavac + * SPDX-FileCopyrightText: 2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/core/PartitionInfo.cpp b/src/modules/partition/core/PartitionInfo.cpp index fe38bf2d6..415fdc5c1 100644 --- a/src/modules/partition/core/PartitionInfo.cpp +++ b/src/modules/partition/core/PartitionInfo.cpp @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Aurélien Gâteau - * Copyright 2018, Adriaan de Groot + * SPDX-FileCopyrightText: 2014 Aurélien Gâteau + * SPDX-FileCopyrightText: 2018 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/core/PartitionInfo.h b/src/modules/partition/core/PartitionInfo.h index 9f9cd2d1e..3ddbe192b 100644 --- a/src/modules/partition/core/PartitionInfo.h +++ b/src/modules/partition/core/PartitionInfo.h @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Aurélien Gâteau - * Copyright 2018, Adriaan de Groot + * SPDX-FileCopyrightText: 2014 Aurélien Gâteau + * SPDX-FileCopyrightText: 2018 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/core/PartitionLayout.cpp b/src/modules/partition/core/PartitionLayout.cpp index 367b7487a..3df9b21c2 100644 --- a/src/modules/partition/core/PartitionLayout.cpp +++ b/src/modules/partition/core/PartitionLayout.cpp @@ -1,8 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2017, Teo Mrnjavac - * Copyright 2017-2018, Adriaan de Groot - * Copyright 2018-2019, Collabora Ltd + * SPDX-FileCopyrightText: 2014-2017 Teo Mrnjavac + * SPDX-FileCopyrightText: 2017-2018 Adriaan de Groot + * SPDX-FileCopyrightText: 2018-2019 Collabora Ltd + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/core/PartitionLayout.h b/src/modules/partition/core/PartitionLayout.h index da691d200..52bd96e42 100644 --- a/src/modules/partition/core/PartitionLayout.h +++ b/src/modules/partition/core/PartitionLayout.h @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2018-2019, Collabora Ltd - * Copyright 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2018-2019 Collabora Ltd + * SPDX-FileCopyrightText: 2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/core/PartitionModel.cpp b/src/modules/partition/core/PartitionModel.cpp index 1135f5719..662e26032 100644 --- a/src/modules/partition/core/PartitionModel.cpp +++ b/src/modules/partition/core/PartitionModel.cpp @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Aurélien Gâteau - * Copyright 2018-2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2014 Aurélien Gâteau + * SPDX-FileCopyrightText: 2018-2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/core/PartitionModel.h b/src/modules/partition/core/PartitionModel.h index 7066aa5a5..9d1e40f20 100644 --- a/src/modules/partition/core/PartitionModel.h +++ b/src/modules/partition/core/PartitionModel.h @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Aurélien Gâteau - * Copyright 2017, 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2014 Aurélien Gâteau + * SPDX-FileCopyrightText: 2017 2019, Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/gui/BootInfoWidget.cpp b/src/modules/partition/gui/BootInfoWidget.cpp index 696628c37..d1df9ae33 100644 --- a/src/modules/partition/gui/BootInfoWidget.cpp +++ b/src/modules/partition/gui/BootInfoWidget.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2015-2016, Teo Mrnjavac + * SPDX-FileCopyrightText: 2015-2016 Teo Mrnjavac + * SPDX-License-Identifier: GPL-3.0-or-later * * 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,16 +25,16 @@ #include "utils/Retranslator.h" #include -#include #include +#include BootInfoWidget::BootInfoWidget( QWidget* parent ) : QWidget( parent ) , m_bootIcon( new QLabel ) , m_bootLabel( new QLabel ) { - m_bootIcon->setObjectName("bootInfoIcon"); - m_bootLabel->setObjectName("bootInfoLabel"); + m_bootIcon->setObjectName( "bootInfoIcon" ); + m_bootLabel->setObjectName( "bootInfoLabel" ); QHBoxLayout* mainLayout = new QHBoxLayout; setLayout( mainLayout ); @@ -46,16 +47,15 @@ BootInfoWidget::BootInfoWidget( QWidget* parent ) m_bootIcon->setMargin( 0 ); m_bootIcon->setFixedSize( iconSize ); - m_bootIcon->setPixmap( CalamaresUtils::defaultPixmap( CalamaresUtils::BootEnvironment, - CalamaresUtils::Original, - iconSize ) ); - + m_bootIcon->setPixmap( + CalamaresUtils::defaultPixmap( CalamaresUtils::BootEnvironment, CalamaresUtils::Original, iconSize ) ); + QFontMetrics fm = QFontMetrics( QFont() ); m_bootLabel->setMinimumWidth( fm.boundingRect( "BIOS" ).width() + CalamaresUtils::defaultFontHeight() / 2 ); m_bootLabel->setAlignment( Qt::AlignCenter ); QPalette palette; - palette.setBrush( QPalette::Foreground, QColor( "#4D4D4D" ) ); //dark grey + palette.setBrush( QPalette::Foreground, QColor( "#4D4D4D" ) ); //dark grey m_bootIcon->setAutoFillBackground( true ); m_bootLabel->setAutoFillBackground( true ); @@ -100,7 +100,6 @@ BootInfoWidget::retranslateUi() "This is automatic, unless " "you choose manual partitioning, in which case you must " "set it up on your own." ); - } m_bootLabel->setToolTip( bootToolTip ); } diff --git a/src/modules/partition/gui/BootInfoWidget.h b/src/modules/partition/gui/BootInfoWidget.h index 257b3904a..5865a3b9c 100644 --- a/src/modules/partition/gui/BootInfoWidget.h +++ b/src/modules/partition/gui/BootInfoWidget.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2015-2016, Teo Mrnjavac + * SPDX-FileCopyrightText: 2015-2016 Teo Mrnjavac + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -38,4 +39,4 @@ private: QLabel* m_bootLabel; }; -#endif // BOOTINFOWIDGET_H +#endif // BOOTINFOWIDGET_H diff --git a/src/modules/partition/gui/ChoicePage.cpp b/src/modules/partition/gui/ChoicePage.cpp index d7b5e497e..b032065cf 100644 --- a/src/modules/partition/gui/ChoicePage.cpp +++ b/src/modules/partition/gui/ChoicePage.cpp @@ -1,8 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2017, Teo Mrnjavac - * Copyright 2017-2019, Adriaan de Groot - * Copyright 2019, Collabora Ltd + * SPDX-FileCopyrightText: 2014-2017 Teo Mrnjavac + * SPDX-FileCopyrightText: 2017-2019 Adriaan de Groot + * SPDX-FileCopyrightText: 2019 Collabora Ltd + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -59,16 +60,16 @@ #include #include #include +#include #include #include -#include #include -using PartitionActions::Choices::SwapChoice; -using CalamaresUtils::Partition::PartitionIterator; -using CalamaresUtils::Partition::isPartitionFreeSpace; -using CalamaresUtils::Partition::findPartitionByPath; using Calamares::PrettyRadioButton; +using CalamaresUtils::Partition::findPartitionByPath; +using CalamaresUtils::Partition::isPartitionFreeSpace; +using CalamaresUtils::Partition::PartitionIterator; +using PartitionActions::Choices::SwapChoice; /** * @brief ChoicePage::ChoicePage is the default constructor. Called on startup as part of @@ -107,7 +108,9 @@ ChoicePage::ChoicePage( Config* config, QWidget* parent ) m_allowManualPartitioning = gs->value( "allowManualPartitioning" ).toBool(); if ( FileSystem::typeForName( m_defaultFsType ) == FileSystem::Unknown ) + { m_defaultFsType = "ext4"; + } // Set up drives combo m_mainLayout->setDirection( QBoxLayout::TopToBottom ); @@ -134,12 +137,9 @@ ChoicePage::ChoicePage( Config* config, QWidget* parent ) CalamaresUtils::unmarginLayout( m_itemsLayout ); // Drive selector + preview - CALAMARES_RETRANSLATE( - retranslateUi( this ); - m_drivesLabel->setText( tr( "Select storage de&vice:" ) ); - m_previewBeforeLabel->setText( tr( "Current:" ) ); - m_previewAfterLabel->setText( tr( "After:" ) ); - ) + CALAMARES_RETRANSLATE( retranslateUi( this ); m_drivesLabel->setText( tr( "Select storage de&vice:" ) ); + m_previewBeforeLabel->setText( tr( "Current:" ) ); + m_previewAfterLabel->setText( tr( "After:" ) ); ) m_previewBeforeFrame->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Expanding ); m_previewAfterFrame->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Expanding ); @@ -151,8 +151,7 @@ ChoicePage::ChoicePage( Config* config, QWidget* parent ) } -ChoicePage::~ChoicePage() -{} +ChoicePage::~ChoicePage() {} void @@ -165,9 +164,7 @@ ChoicePage::init( PartitionCoreModule* core ) // We need to do this because a PCM revert invalidates the deviceModel. - connect( core, &PartitionCoreModule::reverted, - this, [=] - { + connect( core, &PartitionCoreModule::reverted, this, [=] { m_drivesCombo->setModel( core->deviceModel() ); m_drivesCombo->setCurrentIndex( m_lastSelectedDeviceIndex ); } ); @@ -175,12 +172,11 @@ ChoicePage::init( PartitionCoreModule* core ) connect( m_drivesCombo, static_cast< void ( QComboBox::* )( int ) >( &QComboBox::currentIndexChanged ), - this, &ChoicePage::applyDeviceChoice ); + this, + &ChoicePage::applyDeviceChoice ); - connect( m_encryptWidget, &EncryptWidget::stateChanged, - this, &ChoicePage::onEncryptWidgetStateChanged ); - connect( m_reuseHomeCheckBox, &QCheckBox::stateChanged, - this, &ChoicePage::onHomeCheckBoxStateChanged ); + connect( m_encryptWidget, &EncryptWidget::stateChanged, this, &ChoicePage::onEncryptWidgetStateChanged ); + connect( m_reuseHomeCheckBox, &QCheckBox::stateChanged, this, &ChoicePage::onHomeCheckBoxStateChanged ); ChoicePage::applyDeviceChoice(); } @@ -195,13 +191,21 @@ static inline QComboBox* createCombo( const QSet< SwapChoice >& s, SwapChoice dflt ) { QComboBox* box = new QComboBox; - for ( SwapChoice c : { SwapChoice::NoSwap, SwapChoice::SmallSwap, SwapChoice::FullSwap, SwapChoice::ReuseSwap, SwapChoice::SwapFile } ) + for ( SwapChoice c : { SwapChoice::NoSwap, + SwapChoice::SmallSwap, + SwapChoice::FullSwap, + SwapChoice::ReuseSwap, + SwapChoice::SwapFile } ) if ( s.contains( c ) ) + { box->addItem( QString(), c ); + } int dfltIndex = box->findData( dflt ); if ( dfltIndex >= 0 ) + { box->setCurrentIndex( dfltIndex ); + } return box; } @@ -233,30 +237,26 @@ ChoicePage::setupChoices() // 3) Manual // TBD: upgrade option? - QSize iconSize( CalamaresUtils::defaultIconSize().width() * 2, - CalamaresUtils::defaultIconSize().height() * 2 ); + QSize iconSize( CalamaresUtils::defaultIconSize().width() * 2, CalamaresUtils::defaultIconSize().height() * 2 ); m_grp = new QButtonGroup( this ); m_alongsideButton = new PrettyRadioButton; m_alongsideButton->setIconSize( iconSize ); - m_alongsideButton->setIcon( CalamaresUtils::defaultPixmap( CalamaresUtils::PartitionAlongside, - CalamaresUtils::Original, - iconSize ) ); + m_alongsideButton->setIcon( + CalamaresUtils::defaultPixmap( CalamaresUtils::PartitionAlongside, CalamaresUtils::Original, iconSize ) ); m_alongsideButton->addToGroup( m_grp, InstallChoice::Alongside ); m_eraseButton = new PrettyRadioButton; m_eraseButton->setIconSize( iconSize ); - m_eraseButton->setIcon( CalamaresUtils::defaultPixmap( CalamaresUtils::PartitionEraseAuto, - CalamaresUtils::Original, - iconSize ) ); + m_eraseButton->setIcon( + CalamaresUtils::defaultPixmap( CalamaresUtils::PartitionEraseAuto, CalamaresUtils::Original, iconSize ) ); m_eraseButton->addToGroup( m_grp, InstallChoice::Erase ); m_replaceButton = new PrettyRadioButton; m_replaceButton->setIconSize( iconSize ); - m_replaceButton->setIcon( CalamaresUtils::defaultPixmap( CalamaresUtils::PartitionReplaceOs, - CalamaresUtils::Original, - iconSize ) ); + m_replaceButton->setIcon( + CalamaresUtils::defaultPixmap( CalamaresUtils::PartitionReplaceOs, CalamaresUtils::Original, iconSize ) ); m_replaceButton->addToGroup( m_grp, InstallChoice::Replace ); // Fill up swap options @@ -273,17 +273,14 @@ ChoicePage::setupChoices() m_somethingElseButton = new PrettyRadioButton; m_somethingElseButton->setIconSize( iconSize ); - m_somethingElseButton->setIcon( CalamaresUtils::defaultPixmap( CalamaresUtils::PartitionManual, - CalamaresUtils::Original, - iconSize ) ); + m_somethingElseButton->setIcon( + CalamaresUtils::defaultPixmap( CalamaresUtils::PartitionManual, CalamaresUtils::Original, iconSize ) ); m_itemsLayout->addWidget( m_somethingElseButton ); m_somethingElseButton->addToGroup( m_grp, InstallChoice::Manual ); m_itemsLayout->addStretch(); - connect( m_grp, QOverload::of( &QButtonGroup::buttonToggled ), - this, [ this ]( int id, bool checked ) - { + connect( m_grp, QOverload< int, bool >::of( &QButtonGroup::buttonToggled ), this, [this]( int id, bool checked ) { if ( checked ) // An action was picked. { m_choice = static_cast< InstallChoice >( id ); @@ -291,10 +288,11 @@ ChoicePage::setupChoices() emit actionChosen(); } - else // An action was unpicked, either on its own or because of another selection. + else // An action was unpicked, either on its own or because of another selection. { if ( m_grp->checkedButton() == nullptr ) // If no other action is chosen, we must - { // set m_choice to NoChoice and reset previews. + { + // set m_choice to NoChoice and reset previews. m_choice = InstallChoice::NoChoice; updateNextEnabled(); @@ -307,17 +305,16 @@ ChoicePage::setupChoices() m_rightLayout->setStretchFactor( m_previewBeforeFrame, 0 ); m_rightLayout->setStretchFactor( m_previewAfterFrame, 0 ); - connect( this, &ChoicePage::actionChosen, - this, &ChoicePage::onActionChanged ); + connect( this, &ChoicePage::actionChosen, this, &ChoicePage::onActionChanged ); if ( m_eraseSwapChoiceComboBox ) - connect( m_eraseSwapChoiceComboBox, QOverload::of(&QComboBox::currentIndexChanged), - this, &ChoicePage::onEraseSwapChoiceChanged ); + connect( m_eraseSwapChoiceComboBox, + QOverload< int >::of( &QComboBox::currentIndexChanged ), + this, + &ChoicePage::onEraseSwapChoiceChanged ); - CALAMARES_RETRANSLATE( - m_somethingElseButton->setText( tr( "Manual partitioning
" - "You can create or resize partitions yourself." ) ); - updateSwapChoicesTr( m_eraseSwapChoiceComboBox ); - ) + CALAMARES_RETRANSLATE( m_somethingElseButton->setText( tr( "Manual partitioning
" + "You can create or resize partitions yourself." ) ); + updateSwapChoicesTr( m_eraseSwapChoiceComboBox ); ) } @@ -331,9 +328,8 @@ Device* ChoicePage::selectedDevice() { Device* currentDevice = nullptr; - currentDevice = m_core->deviceModel()->deviceForIndex( - m_core->deviceModel()->index( - m_drivesCombo->currentIndex() ) ); + currentDevice + = m_core->deviceModel()->deviceForIndex( m_core->deviceModel()->index( m_drivesCombo->currentIndex() ) ); return currentDevice; } @@ -367,16 +363,13 @@ ChoicePage::applyDeviceChoice() if ( m_core->isDirty() ) { - ScanningDialog::run( QtConcurrent::run( [ = ] - { - QMutexLocker locker( &m_coreMutex ); - m_core->revertAllDevices(); - } ), - [ this ] - { - continueApplyDeviceChoice(); - }, - this ); + ScanningDialog::run( + QtConcurrent::run( [=] { + QMutexLocker locker( &m_coreMutex ); + m_core->revertAllDevices(); + } ), + [this] { continueApplyDeviceChoice(); }, + this ); } else { @@ -426,7 +419,8 @@ ChoicePage::onEraseSwapChoiceChanged() { if ( m_eraseSwapChoiceComboBox ) { - m_eraseSwapChoice = static_cast( m_eraseSwapChoiceComboBox->currentData().toInt() ); + m_eraseSwapChoice + = static_cast< PartitionActions::Choices::SwapChoice >( m_eraseSwapChoiceComboBox->currentData().toInt() ); onActionChanged(); } } @@ -434,85 +428,85 @@ ChoicePage::onEraseSwapChoiceChanged() void ChoicePage::applyActionChoice( ChoicePage::InstallChoice choice ) { - m_beforePartitionBarsView->selectionModel()-> - disconnect( SIGNAL( currentRowChanged( QModelIndex, QModelIndex ) ) ); + m_beforePartitionBarsView->selectionModel()->disconnect( SIGNAL( currentRowChanged( QModelIndex, QModelIndex ) ) ); m_beforePartitionBarsView->selectionModel()->clearSelection(); m_beforePartitionBarsView->selectionModel()->clearCurrentIndex(); switch ( choice ) { case InstallChoice::Erase: + { + auto gs = Calamares::JobQueue::instance()->globalStorage(); + + PartitionActions::Choices::AutoPartitionOptions options { gs->value( "defaultFileSystemType" ).toString(), + m_encryptWidget->passphrase(), + gs->value( "efiSystemPartition" ).toString(), + CalamaresUtils::GiBtoBytes( + gs->value( "requiredStorageGiB" ).toDouble() ), + m_eraseSwapChoice }; + + if ( m_core->isDirty() ) { - auto gs = Calamares::JobQueue::instance()->globalStorage(); - - PartitionActions::Choices::AutoPartitionOptions options { - gs->value( "defaultFileSystemType" ).toString(), - m_encryptWidget->passphrase(), - gs->value( "efiSystemPartition" ).toString(), - CalamaresUtils::GiBtoBytes( gs->value( "requiredStorageGiB" ).toDouble() ), - m_eraseSwapChoice - }; - - if ( m_core->isDirty() ) - { - ScanningDialog::run( QtConcurrent::run( [ = ] - { + ScanningDialog::run( + QtConcurrent::run( [=] { QMutexLocker locker( &m_coreMutex ); m_core->revertDevice( selectedDevice() ); } ), - [ = ] - { + [=] { PartitionActions::doAutopartition( m_core, selectedDevice(), options ); emit deviceChosen(); }, this ); - } - else - { - PartitionActions::doAutopartition( m_core, selectedDevice(), options ); - emit deviceChosen(); - } } - break; + else + { + PartitionActions::doAutopartition( m_core, selectedDevice(), options ); + emit deviceChosen(); + } + } + break; case InstallChoice::Replace: if ( m_core->isDirty() ) { - ScanningDialog::run( QtConcurrent::run( [ = ] - { - QMutexLocker locker( &m_coreMutex ); - m_core->revertDevice( selectedDevice() ); - } ), - []{}, - this ); + ScanningDialog::run( + QtConcurrent::run( [=] { + QMutexLocker locker( &m_coreMutex ); + m_core->revertDevice( selectedDevice() ); + } ), + [] {}, + this ); } updateNextEnabled(); - connect( m_beforePartitionBarsView->selectionModel(), SIGNAL( currentRowChanged( QModelIndex, QModelIndex ) ), - this, SLOT( onPartitionToReplaceSelected( QModelIndex, QModelIndex ) ), + connect( m_beforePartitionBarsView->selectionModel(), + SIGNAL( currentRowChanged( QModelIndex, QModelIndex ) ), + this, + SLOT( onPartitionToReplaceSelected( QModelIndex, QModelIndex ) ), Qt::UniqueConnection ); break; case InstallChoice::Alongside: if ( m_core->isDirty() ) { - ScanningDialog::run( QtConcurrent::run( [ = ] - { - QMutexLocker locker( &m_coreMutex ); - m_core->revertDevice( selectedDevice() ); - } ), - [this] - { - // We need to reupdate after reverting because the splitter widget is - // not a true view. - updateActionChoicePreview( currentChoice() ); - updateNextEnabled(); - }, - this ); + ScanningDialog::run( + QtConcurrent::run( [=] { + QMutexLocker locker( &m_coreMutex ); + m_core->revertDevice( selectedDevice() ); + } ), + [this] { + // We need to reupdate after reverting because the splitter widget is + // not a true view. + updateActionChoicePreview( currentChoice() ); + updateNextEnabled(); + }, + this ); } updateNextEnabled(); - connect( m_beforePartitionBarsView->selectionModel(), SIGNAL( currentRowChanged( QModelIndex, QModelIndex ) ), - this, SLOT( doAlongsideSetupSplitter( QModelIndex, QModelIndex ) ), + connect( m_beforePartitionBarsView->selectionModel(), + SIGNAL( currentRowChanged( QModelIndex, QModelIndex ) ), + this, + SLOT( doAlongsideSetupSplitter( QModelIndex, QModelIndex ) ), Qt::UniqueConnection ); break; case InstallChoice::NoChoice: @@ -524,19 +518,24 @@ ChoicePage::applyActionChoice( ChoicePage::InstallChoice choice ) void -ChoicePage::doAlongsideSetupSplitter( const QModelIndex& current, - const QModelIndex& previous ) +ChoicePage::doAlongsideSetupSplitter( const QModelIndex& current, const QModelIndex& previous ) { Q_UNUSED( previous ) if ( !current.isValid() ) + { return; + } if ( !m_afterPartitionSplitterWidget ) + { return; + } const PartitionModel* modl = qobject_cast< const PartitionModel* >( current.model() ); if ( !modl ) + { return; + } Partition* part = modl->partitionForIndex( current ); if ( !part ) @@ -545,21 +544,20 @@ ChoicePage::doAlongsideSetupSplitter( const QModelIndex& current, return; } - double requiredStorageGB = Calamares::JobQueue::instance() - ->globalStorage() - ->value( "requiredStorageGiB" ) - .toDouble(); + double requiredStorageGB + = Calamares::JobQueue::instance()->globalStorage()->value( "requiredStorageGiB" ).toDouble(); qint64 requiredStorageB = CalamaresUtils::GiBtoBytes( requiredStorageGB + 0.1 + 2.0 ); - m_afterPartitionSplitterWidget->setSplitPartition( - part->partitionPath(), - qRound64( part->used() * 1.1 ), - part->capacity() - requiredStorageB, - part->capacity() / 2 ); + m_afterPartitionSplitterWidget->setSplitPartition( part->partitionPath(), + qRound64( part->used() * 1.1 ), + part->capacity() - requiredStorageB, + part->capacity() / 2 ); if ( m_isEfi ) + { setupEfiSystemPartitionSelector(); + } cDebug() << "Partition selected for Alongside."; @@ -573,20 +571,17 @@ ChoicePage::onEncryptWidgetStateChanged() EncryptWidget::Encryption state = m_encryptWidget->state(); if ( m_choice == InstallChoice::Erase ) { - if ( state == EncryptWidget::Encryption::Confirmed || - state == EncryptWidget::Encryption::Disabled ) + if ( state == EncryptWidget::Encryption::Confirmed || state == EncryptWidget::Encryption::Disabled ) + { applyActionChoice( m_choice ); + } } else if ( m_choice == InstallChoice::Replace ) { - if ( m_beforePartitionBarsView && - m_beforePartitionBarsView->selectionModel()->currentIndex().isValid() && - ( state == EncryptWidget::Encryption::Confirmed || - state == EncryptWidget::Encryption::Disabled ) ) + if ( m_beforePartitionBarsView && m_beforePartitionBarsView->selectionModel()->currentIndex().isValid() + && ( state == EncryptWidget::Encryption::Confirmed || state == EncryptWidget::Encryption::Disabled ) ) { - doReplaceSelectedPartition( m_beforePartitionBarsView-> - selectionModel()-> - currentIndex() ); + doReplaceSelectedPartition( m_beforePartitionBarsView->selectionModel()->currentIndex() ); } } updateNextEnabled(); @@ -596,12 +591,10 @@ ChoicePage::onEncryptWidgetStateChanged() void ChoicePage::onHomeCheckBoxStateChanged() { - if ( currentChoice() == InstallChoice::Replace && - m_beforePartitionBarsView->selectionModel()->currentIndex().isValid() ) + if ( currentChoice() == InstallChoice::Replace + && m_beforePartitionBarsView->selectionModel()->currentIndex().isValid() ) { - doReplaceSelectedPartition( m_beforePartitionBarsView-> - selectionModel()-> - currentIndex() ); + doReplaceSelectedPartition( m_beforePartitionBarsView->selectionModel()->currentIndex() ); } } @@ -610,7 +603,9 @@ void ChoicePage::onLeave() { if ( m_choice == InstallChoice::Alongside ) + { doAlongsideApply(); + } if ( m_isEfi && ( m_choice == InstallChoice::Alongside || m_choice == InstallChoice::Replace ) ) { @@ -618,27 +613,22 @@ ChoicePage::onLeave() if ( efiSystemPartitions.count() == 1 ) { PartitionInfo::setMountPoint( - efiSystemPartitions.first(), - Calamares::JobQueue::instance()-> - globalStorage()-> - value( "efiSystemPartition" ).toString() ); + efiSystemPartitions.first(), + Calamares::JobQueue::instance()->globalStorage()->value( "efiSystemPartition" ).toString() ); } else if ( efiSystemPartitions.count() > 1 && m_efiComboBox ) { PartitionInfo::setMountPoint( - efiSystemPartitions.at( m_efiComboBox->currentIndex() ), - Calamares::JobQueue::instance()-> - globalStorage()-> - value( "efiSystemPartition" ).toString() ); + efiSystemPartitions.at( m_efiComboBox->currentIndex() ), + Calamares::JobQueue::instance()->globalStorage()->value( "efiSystemPartition" ).toString() ); } else { - cError() << "cannot set up EFI system partition.\nESP count:" - << efiSystemPartitions.count() << "\nm_efiComboBox:" - << m_efiComboBox; + cError() << "cannot set up EFI system partition.\nESP count:" << efiSystemPartitions.count() + << "\nm_efiComboBox:" << m_efiComboBox; } } - else // installPath is then passed to the bootloader module for MBR setup + else // installPath is then passed to the bootloader module for MBR setup { if ( !m_isEfi ) { @@ -646,15 +636,21 @@ ChoicePage::onLeave() { auto d_p = selectedDevice(); if ( d_p ) + { m_core->setBootLoaderInstallPath( d_p->deviceNode() ); + } else + { cWarning() << "No device selected for bootloader."; + } } else { QVariant var = m_bootloaderComboBox->currentData( BootLoaderModel::BootLoaderPathRole ); if ( !var.isValid() ) + { return; + } m_core->setBootLoaderInstallPath( var.toString() ); } } @@ -666,13 +662,14 @@ void ChoicePage::doAlongsideApply() { Q_ASSERT( m_afterPartitionSplitterWidget->splitPartitionSize() >= 0 ); - Q_ASSERT( m_afterPartitionSplitterWidget->newPartitionSize() >= 0 ); + Q_ASSERT( m_afterPartitionSplitterWidget->newPartitionSize() >= 0 ); QMutexLocker locker( &m_coreMutex ); - QString path = m_beforePartitionBarsView-> - selectionModel()-> - currentIndex().data( PartitionModel::PartitionPathRole ).toString(); + QString path = m_beforePartitionBarsView->selectionModel() + ->currentIndex() + .data( PartitionModel::PartitionPathRole ) + .toString(); DeviceModel* dm = m_core->deviceModel(); for ( int i = 0; i < dm->rowCount(); ++i ) @@ -683,15 +680,16 @@ ChoicePage::doAlongsideApply() { qint64 firstSector = candidate->firstSector(); qint64 oldLastSector = candidate->lastSector(); - qint64 newLastSector = firstSector + - m_afterPartitionSplitterWidget->splitPartitionSize() / - dev->logicalSize(); + qint64 newLastSector + = firstSector + m_afterPartitionSplitterWidget->splitPartitionSize() / dev->logicalSize(); m_core->resizePartition( dev, candidate, firstSector, newLastSector ); - m_core->layoutApply( dev, newLastSector + 2, oldLastSector, - m_encryptWidget->passphrase(), candidate->parent(), - candidate->roles() - ); + m_core->layoutApply( dev, + newLastSector + 2, + oldLastSector, + m_encryptWidget->passphrase(), + candidate->parent(), + candidate->roles() ); m_core->dumpQueue(); break; @@ -701,12 +699,13 @@ ChoicePage::doAlongsideApply() void -ChoicePage::onPartitionToReplaceSelected( const QModelIndex& current, - const QModelIndex& previous ) +ChoicePage::onPartitionToReplaceSelected( const QModelIndex& current, const QModelIndex& previous ) { Q_UNUSED( previous ) if ( !current.isValid() ) + { return; + } // Reset state on selection regardless of whether this will be used. m_reuseHomeCheckBox->setChecked( false ); @@ -719,111 +718,114 @@ void ChoicePage::doReplaceSelectedPartition( const QModelIndex& current ) { if ( !current.isValid() ) + { return; + } QString* homePartitionPath = new QString(); bool doReuseHomePartition = m_reuseHomeCheckBox->isChecked(); // NOTE: using by-ref captures because we need to write homePartitionPath and // doReuseHomePartition *after* the device revert, for later use. - ScanningDialog::run( QtConcurrent::run( - [ this, current ]( QString* homePartitionPath, bool doReuseHomePartition ) - { - QMutexLocker locker( &m_coreMutex ); + ScanningDialog::run( + QtConcurrent::run( + [this, current]( QString* homePartitionPath, bool doReuseHomePartition ) { + QMutexLocker locker( &m_coreMutex ); - if ( m_core->isDirty() ) - { - m_core->revertDevice( selectedDevice() ); - } - - // if the partition is unallocated(free space), we don't replace it but create new one - // with the same first and last sector - Partition* selectedPartition = - static_cast< Partition* >( current.data( PartitionModel::PartitionPtrRole ) - .value< void* >() ); - if ( isPartitionFreeSpace( selectedPartition ) ) - { - //NOTE: if the selected partition is free space, we don't deal with - // a separate /home partition at all because there's no existing - // rootfs to read it from. - PartitionRole newRoles = PartitionRole( PartitionRole::Primary ); - PartitionNode* newParent = selectedDevice()->partitionTable(); - - if ( selectedPartition->parent() ) - { - Partition* parent = dynamic_cast< Partition* >( selectedPartition->parent() ); - if ( parent && parent->roles().has( PartitionRole::Extended ) ) + if ( m_core->isDirty() ) { - newRoles = PartitionRole( PartitionRole::Logical ); - newParent = findPartitionByPath( { selectedDevice() }, parent->partitionPath() ); + m_core->revertDevice( selectedDevice() ); } - } - m_core->layoutApply( selectedDevice(), selectedPartition->firstSector(), - selectedPartition->lastSector(), - m_encryptWidget->passphrase(), newParent, newRoles - ); - } - else - { - // We can't use the PartitionPtrRole because we need to make changes to the - // main DeviceModel, not the immutable copy. - QString partPath = current.data( PartitionModel::PartitionPathRole ).toString(); - selectedPartition = findPartitionByPath( { selectedDevice() }, - partPath ); - if ( selectedPartition ) - { - // Find out is the selected partition has a rootfs. If yes, then make the - // m_reuseHomeCheckBox visible and set its text to something meaningful. - homePartitionPath->clear(); - for ( const OsproberEntry& osproberEntry : m_core->osproberEntries() ) - if ( osproberEntry.path == partPath ) - *homePartitionPath = osproberEntry.homePath; - if ( homePartitionPath->isEmpty() ) - doReuseHomePartition = false; - - Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage(); - - PartitionActions::doReplacePartition( - m_core, - selectedDevice(), - selectedPartition, - { - gs->value( "defaultFileSystemType" ).toString(), - m_encryptWidget->passphrase() - } ); - Partition* homePartition = findPartitionByPath( { selectedDevice() }, - *homePartitionPath ); - - if ( homePartition && doReuseHomePartition ) + // if the partition is unallocated(free space), we don't replace it but create new one + // with the same first and last sector + Partition* selectedPartition + = static_cast< Partition* >( current.data( PartitionModel::PartitionPtrRole ).value< void* >() ); + if ( isPartitionFreeSpace( selectedPartition ) ) { - PartitionInfo::setMountPoint( homePartition, "/home" ); - gs->insert( "reuseHome", true ); + //NOTE: if the selected partition is free space, we don't deal with + // a separate /home partition at all because there's no existing + // rootfs to read it from. + PartitionRole newRoles = PartitionRole( PartitionRole::Primary ); + PartitionNode* newParent = selectedDevice()->partitionTable(); + + if ( selectedPartition->parent() ) + { + Partition* parent = dynamic_cast< Partition* >( selectedPartition->parent() ); + if ( parent && parent->roles().has( PartitionRole::Extended ) ) + { + newRoles = PartitionRole( PartitionRole::Logical ); + newParent = findPartitionByPath( { selectedDevice() }, parent->partitionPath() ); + } + } + + m_core->layoutApply( selectedDevice(), + selectedPartition->firstSector(), + selectedPartition->lastSector(), + m_encryptWidget->passphrase(), + newParent, + newRoles ); } else { - gs->insert( "reuseHome", false ); + // We can't use the PartitionPtrRole because we need to make changes to the + // main DeviceModel, not the immutable copy. + QString partPath = current.data( PartitionModel::PartitionPathRole ).toString(); + selectedPartition = findPartitionByPath( { selectedDevice() }, partPath ); + if ( selectedPartition ) + { + // Find out is the selected partition has a rootfs. If yes, then make the + // m_reuseHomeCheckBox visible and set its text to something meaningful. + homePartitionPath->clear(); + for ( const OsproberEntry& osproberEntry : m_core->osproberEntries() ) + if ( osproberEntry.path == partPath ) + { + *homePartitionPath = osproberEntry.homePath; + } + if ( homePartitionPath->isEmpty() ) + { + doReuseHomePartition = false; + } + + Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage(); + + PartitionActions::doReplacePartition( + m_core, + selectedDevice(), + selectedPartition, + { gs->value( "defaultFileSystemType" ).toString(), m_encryptWidget->passphrase() } ); + Partition* homePartition = findPartitionByPath( { selectedDevice() }, *homePartitionPath ); + + if ( homePartition && doReuseHomePartition ) + { + PartitionInfo::setMountPoint( homePartition, "/home" ); + gs->insert( "reuseHome", true ); + } + else + { + gs->insert( "reuseHome", false ); + } + } } - } - } - }, homePartitionPath, doReuseHomePartition ), - [ = ] - { - m_reuseHomeCheckBox->setVisible( !homePartitionPath->isEmpty() ); - if ( !homePartitionPath->isEmpty() ) - m_reuseHomeCheckBox->setText( tr( "Reuse %1 as home partition for %2." ) - .arg( *homePartitionPath ) - .arg( Calamares::Branding::instance()->shortProductName() ) ); - delete homePartitionPath; + }, + homePartitionPath, + doReuseHomePartition ), + [=] { + m_reuseHomeCheckBox->setVisible( !homePartitionPath->isEmpty() ); + if ( !homePartitionPath->isEmpty() ) + m_reuseHomeCheckBox->setText( tr( "Reuse %1 as home partition for %2." ) + .arg( *homePartitionPath ) + .arg( Calamares::Branding::instance()->shortProductName() ) ); + delete homePartitionPath; - if ( m_isEfi ) - setupEfiSystemPartitionSelector(); + if ( m_isEfi ) + setupEfiSystemPartitionSelector(); - updateNextEnabled(); - if ( !m_bootloaderComboBox.isNull() && - m_bootloaderComboBox->currentIndex() < 0 ) - m_bootloaderComboBox->setCurrentIndex( m_lastSelectedDeviceIndex ); - }, this ); + updateNextEnabled(); + if ( !m_bootloaderComboBox.isNull() && m_bootloaderComboBox->currentIndex() < 0 ) + m_bootloaderComboBox->setCurrentIndex( m_lastSelectedDeviceIndex ); + }, + this ); } @@ -847,17 +849,19 @@ ChoicePage::updateDeviceStatePreview() auto layout = m_previewBeforeFrame->layout(); if ( layout ) + { layout->deleteLater(); // Doesn't like nullptr + } layout = new QVBoxLayout; m_previewBeforeFrame->setLayout( layout ); CalamaresUtils::unmarginLayout( layout ); layout->setSpacing( 6 ); - PartitionBarsView::NestedPartitionsMode mode = Calamares::JobQueue::instance()->globalStorage()-> - value( "drawNestedPartitions" ).toBool() ? - PartitionBarsView::DrawNestedPartitions : - PartitionBarsView::NoNestedPartitions; + PartitionBarsView::NestedPartitionsMode mode + = Calamares::JobQueue::instance()->globalStorage()->value( "drawNestedPartitions" ).toBool() + ? PartitionBarsView::DrawNestedPartitions + : PartitionBarsView::NoNestedPartitions; m_beforePartitionBarsView = new PartitionBarsView( m_previewBeforeFrame ); m_beforePartitionBarsView->setNestedPartitionsMode( mode ); m_beforePartitionLabelsView = new PartitionLabelsView( m_previewBeforeFrame ); @@ -875,7 +879,9 @@ ChoicePage::updateDeviceStatePreview() auto sm = m_beforePartitionLabelsView->selectionModel(); m_beforePartitionLabelsView->setSelectionModel( m_beforePartitionBarsView->selectionModel() ); if ( sm ) + { sm->deleteLater(); + } switch ( m_choice ) { @@ -914,17 +920,19 @@ ChoicePage::updateActionChoicePreview( ChoicePage::InstallChoice choice ) auto oldlayout = m_previewAfterFrame->layout(); if ( oldlayout ) + { oldlayout->deleteLater(); + } QVBoxLayout* layout = new QVBoxLayout; m_previewAfterFrame->setLayout( layout ); CalamaresUtils::unmarginLayout( layout ); layout->setSpacing( 6 ); - PartitionBarsView::NestedPartitionsMode mode = Calamares::JobQueue::instance()->globalStorage()-> - value( "drawNestedPartitions" ).toBool() ? - PartitionBarsView::DrawNestedPartitions : - PartitionBarsView::NoNestedPartitions; + PartitionBarsView::NestedPartitionsMode mode + = Calamares::JobQueue::instance()->globalStorage()->value( "drawNestedPartitions" ).toBool() + ? PartitionBarsView::DrawNestedPartitions + : PartitionBarsView::NoNestedPartitions; m_reuseHomeCheckBox->hide(); Calamares::JobQueue::instance()->globalStorage()->insert( "reuseHome", false ); @@ -932,136 +940,142 @@ ChoicePage::updateActionChoicePreview( ChoicePage::InstallChoice choice ) switch ( choice ) { case InstallChoice::Alongside: + { + if ( m_enableEncryptionWidget ) { - if ( m_enableEncryptionWidget ) - m_encryptWidget->show(); - m_previewBeforeLabel->setText( tr( "Current:" ) ); - m_selectLabel->setText( tr( "Select a partition to shrink, " - "then drag the bottom bar to resize" ) ); - m_selectLabel->show(); + m_encryptWidget->show(); + } + m_previewBeforeLabel->setText( tr( "Current:" ) ); + m_selectLabel->setText( tr( "Select a partition to shrink, " + "then drag the bottom bar to resize" ) ); + m_selectLabel->show(); - m_afterPartitionSplitterWidget = new PartitionSplitterWidget( m_previewAfterFrame ); - m_afterPartitionSplitterWidget->init( selectedDevice(), mode == PartitionBarsView::DrawNestedPartitions ); - layout->addWidget( m_afterPartitionSplitterWidget ); + m_afterPartitionSplitterWidget = new PartitionSplitterWidget( m_previewAfterFrame ); + m_afterPartitionSplitterWidget->init( selectedDevice(), mode == PartitionBarsView::DrawNestedPartitions ); + layout->addWidget( m_afterPartitionSplitterWidget ); - QLabel* sizeLabel = new QLabel( m_previewAfterFrame ); - layout->addWidget( sizeLabel ); - sizeLabel->setWordWrap( true ); - connect( m_afterPartitionSplitterWidget, &PartitionSplitterWidget::partitionResized, this, - [ this, sizeLabel ]( const QString& path, qint64 size, qint64 sizeNext ) + QLabel* sizeLabel = new QLabel( m_previewAfterFrame ); + layout->addWidget( sizeLabel ); + sizeLabel->setWordWrap( true ); + connect( m_afterPartitionSplitterWidget, + &PartitionSplitterWidget::partitionResized, + this, + [this, sizeLabel]( const QString& path, qint64 size, qint64 sizeNext ) { + Q_UNUSED( path ) + sizeLabel->setText( + tr( "%1 will be shrunk to %2MiB and a new " + "%3MiB partition will be created for %4." ) + .arg( m_beforePartitionBarsView->selectionModel()->currentIndex().data().toString() ) + .arg( CalamaresUtils::BytesToMiB( size ) ) + .arg( CalamaresUtils::BytesToMiB( sizeNext ) ) + .arg( Calamares::Branding::instance()->shortProductName() ) ); + } ); + + m_previewAfterFrame->show(); + m_previewAfterLabel->show(); + + SelectionFilter filter = [this]( const QModelIndex& index ) { + return PartUtils::canBeResized( + static_cast< Partition* >( index.data( PartitionModel::PartitionPtrRole ).value< void* >() ) ); + }; + m_beforePartitionBarsView->setSelectionFilter( filter ); + m_beforePartitionLabelsView->setSelectionFilter( filter ); + + break; + } + case InstallChoice::Erase: + case InstallChoice::Replace: + { + if ( m_enableEncryptionWidget ) + { + m_encryptWidget->show(); + } + m_previewBeforeLabel->setText( tr( "Current:" ) ); + m_afterPartitionBarsView = new PartitionBarsView( m_previewAfterFrame ); + m_afterPartitionBarsView->setNestedPartitionsMode( mode ); + m_afterPartitionLabelsView = new PartitionLabelsView( m_previewAfterFrame ); + m_afterPartitionLabelsView->setExtendedPartitionHidden( mode == PartitionBarsView::NoNestedPartitions ); + m_afterPartitionLabelsView->setCustomNewRootLabel( + Calamares::Branding::instance()->string( Calamares::Branding::BootloaderEntryName ) ); + + PartitionModel* model = m_core->partitionModelForDevice( selectedDevice() ); + + // The QObject parents tree is meaningful for memory management here, + // see qDeleteAll above. + m_afterPartitionBarsView->setModel( model ); + m_afterPartitionLabelsView->setModel( model ); + m_afterPartitionBarsView->setSelectionMode( QAbstractItemView::NoSelection ); + m_afterPartitionLabelsView->setSelectionMode( QAbstractItemView::NoSelection ); + + layout->addWidget( m_afterPartitionBarsView ); + layout->addWidget( m_afterPartitionLabelsView ); + + if ( !m_isEfi ) + { + QWidget* eraseWidget = new QWidget; + + QHBoxLayout* eraseLayout = new QHBoxLayout; + eraseWidget->setLayout( eraseLayout ); + eraseLayout->setContentsMargins( 0, 0, 0, 0 ); + QLabel* eraseBootloaderLabel = new QLabel( eraseWidget ); + eraseLayout->addWidget( eraseBootloaderLabel ); + eraseBootloaderLabel->setText( tr( "Boot loader location:" ) ); + + m_bootloaderComboBox = createBootloaderComboBox( eraseWidget ); + connect( m_core->bootLoaderModel(), &QAbstractItemModel::modelReset, [this]() { + if ( !m_bootloaderComboBox.isNull() ) { - Q_UNUSED( path ) - sizeLabel->setText( tr( "%1 will be shrunk to %2MiB and a new " - "%3MiB partition will be created for %4." ) - .arg( m_beforePartitionBarsView->selectionModel()->currentIndex().data().toString() ) - .arg( CalamaresUtils::BytesToMiB( size ) ) - .arg( CalamaresUtils::BytesToMiB( sizeNext ) ) - .arg( Calamares::Branding::instance()->shortProductName() ) ); + Calamares::restoreSelectedBootLoader( *m_bootloaderComboBox, m_core->bootLoaderInstallPath() ); } - ); + } ); + connect( + m_core, + &PartitionCoreModule::deviceReverted, + this, + [this]( Device* dev ) { + Q_UNUSED( dev ) + if ( !m_bootloaderComboBox.isNull() ) + { + if ( m_bootloaderComboBox->model() != m_core->bootLoaderModel() ) + { + m_bootloaderComboBox->setModel( m_core->bootLoaderModel() ); + } - m_previewAfterFrame->show(); - m_previewAfterLabel->show(); + m_bootloaderComboBox->setCurrentIndex( m_lastSelectedDeviceIndex ); + } + }, + Qt::QueuedConnection ); + // ^ Must be Queued so it's sure to run when the widget is already visible. - SelectionFilter filter = [ this ]( const QModelIndex& index ) - { - return PartUtils::canBeResized( - static_cast< Partition* >( - index.data( PartitionModel::PartitionPtrRole ) - .value< void* >() ) ); + eraseLayout->addWidget( m_bootloaderComboBox ); + eraseBootloaderLabel->setBuddy( m_bootloaderComboBox ); + eraseLayout->addStretch(); + + layout->addWidget( eraseWidget ); + } + + m_previewAfterFrame->show(); + m_previewAfterLabel->show(); + + if ( m_choice == InstallChoice::Erase ) + { + m_selectLabel->hide(); + } + else + { + SelectionFilter filter = [this]( const QModelIndex& index ) { + return PartUtils::canBeReplaced( + static_cast< Partition* >( index.data( PartitionModel::PartitionPtrRole ).value< void* >() ) ); }; m_beforePartitionBarsView->setSelectionFilter( filter ); m_beforePartitionLabelsView->setSelectionFilter( filter ); - break; + m_selectLabel->show(); + m_selectLabel->setText( tr( "Select a partition to install on" ) ); } - case InstallChoice::Erase: - case InstallChoice::Replace: - { - if ( m_enableEncryptionWidget ) - m_encryptWidget->show(); - m_previewBeforeLabel->setText( tr( "Current:" ) ); - m_afterPartitionBarsView = new PartitionBarsView( m_previewAfterFrame ); - m_afterPartitionBarsView->setNestedPartitionsMode( mode ); - m_afterPartitionLabelsView = new PartitionLabelsView( m_previewAfterFrame ); - m_afterPartitionLabelsView->setExtendedPartitionHidden( mode == PartitionBarsView::NoNestedPartitions ); - m_afterPartitionLabelsView->setCustomNewRootLabel( Calamares::Branding::instance()->string(Calamares::Branding::BootloaderEntryName) ); - PartitionModel* model = m_core->partitionModelForDevice( selectedDevice() ); - - // The QObject parents tree is meaningful for memory management here, - // see qDeleteAll above. - m_afterPartitionBarsView->setModel( model ); - m_afterPartitionLabelsView->setModel( model ); - m_afterPartitionBarsView->setSelectionMode( QAbstractItemView::NoSelection ); - m_afterPartitionLabelsView->setSelectionMode( QAbstractItemView::NoSelection ); - - layout->addWidget( m_afterPartitionBarsView ); - layout->addWidget( m_afterPartitionLabelsView ); - - if ( !m_isEfi ) - { - QWidget* eraseWidget = new QWidget; - - QHBoxLayout* eraseLayout = new QHBoxLayout; - eraseWidget->setLayout( eraseLayout ); - eraseLayout->setContentsMargins( 0, 0, 0, 0 ); - QLabel* eraseBootloaderLabel = new QLabel( eraseWidget ); - eraseLayout->addWidget( eraseBootloaderLabel ); - eraseBootloaderLabel->setText( tr( "Boot loader location:" ) ); - - m_bootloaderComboBox = createBootloaderComboBox( eraseWidget ); - connect( m_core->bootLoaderModel(), &QAbstractItemModel::modelReset, - [ this ]() - { - if ( !m_bootloaderComboBox.isNull() ) - Calamares::restoreSelectedBootLoader( *m_bootloaderComboBox, m_core->bootLoaderInstallPath() ); - } - ); - connect( m_core, &PartitionCoreModule::deviceReverted, this, - [ this ]( Device* dev ) - { - Q_UNUSED( dev ) - if ( !m_bootloaderComboBox.isNull() ) - { - if ( m_bootloaderComboBox->model() != m_core->bootLoaderModel() ) - m_bootloaderComboBox->setModel( m_core->bootLoaderModel() ); - - m_bootloaderComboBox->setCurrentIndex( m_lastSelectedDeviceIndex ); - } - }, Qt::QueuedConnection ); - // ^ Must be Queued so it's sure to run when the widget is already visible. - - eraseLayout->addWidget( m_bootloaderComboBox ); - eraseBootloaderLabel->setBuddy( m_bootloaderComboBox ); - eraseLayout->addStretch(); - - layout->addWidget( eraseWidget ); - } - - m_previewAfterFrame->show(); - m_previewAfterLabel->show(); - - if ( m_choice == InstallChoice::Erase ) - m_selectLabel->hide(); - else - { - SelectionFilter filter = [ this ]( const QModelIndex& index ) - { - return PartUtils::canBeReplaced( - static_cast< Partition* >( - index.data( PartitionModel::PartitionPtrRole ) - .value< void* >() ) ); - }; - m_beforePartitionBarsView->setSelectionFilter( filter ); - m_beforePartitionLabelsView->setSelectionFilter( filter ); - - m_selectLabel->show(); - m_selectLabel->setText( tr( "Select a partition to install on" ) ); - } - - break; - } + break; + } case InstallChoice::NoChoice: case InstallChoice::Manual: m_selectLabel->hide(); @@ -1110,22 +1124,20 @@ ChoicePage::setupEfiSystemPartitionSelector() // Only the already existing ones: QList< Partition* > efiSystemPartitions = m_core->efiSystemPartitions(); - if ( efiSystemPartitions.count() == 0 ) //should never happen + if ( efiSystemPartitions.count() == 0 ) //should never happen { - m_efiLabel->setText( - tr( "An EFI system partition cannot be found anywhere " - "on this system. Please go back and use manual " - "partitioning to set up %1." ) - .arg( Calamares::Branding::instance()->shortProductName() ) ); + m_efiLabel->setText( tr( "An EFI system partition cannot be found anywhere " + "on this system. Please go back and use manual " + "partitioning to set up %1." ) + .arg( Calamares::Branding::instance()->shortProductName() ) ); updateNextEnabled(); } - else if ( efiSystemPartitions.count() == 1 ) //probably most usual situation + else if ( efiSystemPartitions.count() == 1 ) //probably most usual situation { - m_efiLabel->setText( - tr( "The EFI system partition at %1 will be used for " - "starting %2." ) - .arg( efiSystemPartitions.first()->partitionPath() ) - .arg( Calamares::Branding::instance()->shortProductName() ) ); + m_efiLabel->setText( tr( "The EFI system partition at %1 will be used for " + "starting %2." ) + .arg( efiSystemPartitions.first()->partitionPath() ) + .arg( Calamares::Branding::instance()->shortProductName() ) ); } else { @@ -1137,9 +1149,10 @@ ChoicePage::setupEfiSystemPartitionSelector() m_efiComboBox->addItem( efiPartition->partitionPath(), i ); // We pick an ESP on the currently selected device, if possible - if ( efiPartition->devicePath() == selectedDevice()->deviceNode() && - efiPartition->number() == 1 ) + if ( efiPartition->devicePath() == selectedDevice()->deviceNode() && efiPartition->number() == 1 ) + { m_efiComboBox->setCurrentIndex( i ); + } } } } @@ -1152,15 +1165,15 @@ ChoicePage::createBootloaderComboBox( QWidget* parent ) bcb->setModel( m_core->bootLoaderModel() ); // When the chosen bootloader device changes, we update the choice in the PCM - connect( bcb, QOverload::of( &QComboBox::currentIndexChanged ), - this, [this]( int newIndex ) - { + connect( bcb, QOverload< int >::of( &QComboBox::currentIndexChanged ), this, [this]( int newIndex ) { QComboBox* bcb = qobject_cast< QComboBox* >( sender() ); if ( bcb ) { QVariant var = bcb->itemData( newIndex, BootLoaderModel::BootLoaderPathRole ); if ( !var.isValid() ) + { return; + } m_core->setBootLoaderInstallPath( var.toString() ); } } ); @@ -1170,7 +1183,7 @@ ChoicePage::createBootloaderComboBox( QWidget* parent ) static inline void -force_uncheck(QButtonGroup* grp, PrettyRadioButton* button) +force_uncheck( QButtonGroup* grp, PrettyRadioButton* button ) { button->hide(); grp->setExclusive( false ); @@ -1179,7 +1192,7 @@ force_uncheck(QButtonGroup* grp, PrettyRadioButton* button) } static inline QDebug& -operator <<( QDebug& s, PartitionIterator& it ) +operator<<( QDebug& s, PartitionIterator& it ) { s << ( ( *it ) ? ( *it )->deviceNode() : QString( "" ) ); return s; @@ -1195,21 +1208,28 @@ void ChoicePage::setupActions() { Device* currentDevice = selectedDevice(); - OsproberEntryList osproberEntriesForCurrentDevice = - getOsproberEntriesForDevice( currentDevice ); + OsproberEntryList osproberEntriesForCurrentDevice = getOsproberEntriesForDevice( currentDevice ); - cDebug() << "Setting up actions for" << currentDevice->deviceNode() - << "with" << osproberEntriesForCurrentDevice.count() << "entries."; + cDebug() << "Setting up actions for" << currentDevice->deviceNode() << "with" + << osproberEntriesForCurrentDevice.count() << "entries."; if ( currentDevice->partitionTable() ) + { m_deviceInfoWidget->setPartitionTableType( currentDevice->partitionTable()->type() ); + } else + { m_deviceInfoWidget->setPartitionTableType( PartitionTable::unknownTableType ); + } if ( m_allowManualPartitioning ) + { m_somethingElseButton->show(); + } else + { force_uncheck( m_grp, m_somethingElseButton ); + } bool atLeastOneCanBeResized = false; bool atLeastOneCanBeReplaced = false; @@ -1217,16 +1237,15 @@ ChoicePage::setupActions() bool isInactiveRAID = false; #ifdef WITH_KPMCORE4API - if ( currentDevice->type() == Device::Type::SoftwareRAID_Device && - static_cast< SoftwareRAID* >(currentDevice)->status() == SoftwareRAID::Status::Inactive ) + if ( currentDevice->type() == Device::Type::SoftwareRAID_Device + && static_cast< SoftwareRAID* >( currentDevice )->status() == SoftwareRAID::Status::Inactive ) { cDebug() << Logger::SubEntry << "part of an inactive RAID device"; isInactiveRAID = true; } #endif - for ( auto it = PartitionIterator::begin( currentDevice ); - it != PartitionIterator::end( currentDevice ); ++it ) + for ( auto it = PartitionIterator::begin( currentDevice ); it != PartitionIterator::end( currentDevice ); ++it ) { if ( PartUtils::canBeResized( *it ) ) { @@ -1238,7 +1257,7 @@ ChoicePage::setupActions() cDebug() << Logger::SubEntry << "contains replaceable" << it; atLeastOneCanBeReplaced = true; } - if ( (*it)->isMounted() ) + if ( ( *it )->isMounted() ) { atLeastOneIsMounted = true; } @@ -1259,12 +1278,11 @@ ChoicePage::setupActions() m_alongsideButton->setText( tr( "Install alongside
" "The installer will shrink a partition to make room for %1." ) - .arg( Calamares::Branding::instance()->shortVersionedName() ) ); + .arg( Calamares::Branding::instance()->shortVersionedName() ) ); m_replaceButton->setText( tr( "Replace a partition
" "Replaces a partition with %1." ) - .arg( Calamares::Branding::instance()->shortVersionedName() ) ); - ) + .arg( Calamares::Branding::instance()->shortVersionedName() ) ); ) m_replaceButton->hide(); m_alongsideButton->hide(); @@ -1285,11 +1303,11 @@ ChoicePage::setupActions() "What would you like to do?
" "You will be able to review and confirm your choices " "before any change is made to the storage device." ) - .arg( osName ) ); + .arg( osName ) ); m_alongsideButton->setText( tr( "Install alongside
" "The installer will shrink a partition to make room for %1." ) - .arg( Calamares::Branding::instance()->shortVersionedName() ) ); + .arg( Calamares::Branding::instance()->shortVersionedName() ) ); m_eraseButton->setText( tr( "Erase disk
" "This will delete all data " @@ -1298,8 +1316,7 @@ ChoicePage::setupActions() m_replaceButton->setText( tr( "Replace a partition
" "Replaces a partition with %1." ) - .arg( Calamares::Branding::instance()->shortVersionedName() ) ); - ) + .arg( Calamares::Branding::instance()->shortVersionedName() ) ); ) } else { @@ -1312,7 +1329,7 @@ ChoicePage::setupActions() m_alongsideButton->setText( tr( "Install alongside
" "The installer will shrink a partition to make room for %1." ) - .arg( Calamares::Branding::instance()->shortVersionedName() ) ); + .arg( Calamares::Branding::instance()->shortVersionedName() ) ); m_eraseButton->setText( tr( "Erase disk
" "This will delete all data " @@ -1320,8 +1337,7 @@ ChoicePage::setupActions() m_replaceButton->setText( tr( "Replace a partition
" "Replaces a partition with %1." ) - .arg( Calamares::Branding::instance()->shortVersionedName() ) ); - ) + .arg( Calamares::Branding::instance()->shortVersionedName() ) ); ) } } else @@ -1338,7 +1354,7 @@ ChoicePage::setupActions() m_alongsideButton->setText( tr( "Install alongside
" "The installer will shrink a partition to make room for %1." ) - .arg( Calamares::Branding::instance()->shortVersionedName() ) ); + .arg( Calamares::Branding::instance()->shortVersionedName() ) ); m_eraseButton->setText( tr( "Erase disk
" "This will delete all data " @@ -1346,8 +1362,7 @@ ChoicePage::setupActions() m_replaceButton->setText( tr( "Replace a partition
" "Replaces a partition with %1." ) - .arg( Calamares::Branding::instance()->shortVersionedName() ) ); - ) + .arg( Calamares::Branding::instance()->shortVersionedName() ) ); ) } #ifdef DEBUG_PARTITION_UNSAFE @@ -1361,7 +1376,9 @@ ChoicePage::setupActions() #endif if ( atLeastOneCanBeReplaced ) + { m_replaceButton->show(); + } else { cDebug() << "Replace button suppressed because none can be replaced."; @@ -1369,7 +1386,9 @@ ChoicePage::setupActions() } if ( atLeastOneCanBeResized ) + { m_alongsideButton->show(); + } else { cDebug() << "Alongside button suppressed because none can be resized."; @@ -1377,12 +1396,13 @@ ChoicePage::setupActions() } if ( !atLeastOneIsMounted && !isInactiveRAID ) + { m_eraseButton->show(); // None mounted + } else { cDebug() << "Erase button suppressed" - << "mount?" << atLeastOneIsMounted - << "raid?" << isInactiveRAID; + << "mount?" << atLeastOneIsMounted << "raid?" << isInactiveRAID; force_uncheck( m_grp, m_eraseButton ); } @@ -1392,7 +1412,7 @@ ChoicePage::setupActions() if ( isEfi && !efiSystemPartitionFound ) { cWarning() << "System is EFI but there's no EFI system partition, " - "DISABLING alongside and replace features."; + "DISABLING alongside and replace features."; m_alongsideButton->hide(); m_replaceButton->hide(); } @@ -1406,7 +1426,9 @@ ChoicePage::getOsproberEntriesForDevice( Device* device ) const for ( const OsproberEntry& entry : m_core->osproberEntries() ) { if ( entry.path.startsWith( device->deviceNode() ) ) + { eList.append( entry ); + } } return eList; } @@ -1450,7 +1472,7 @@ ChoicePage::calculateNextEnabled() const enabled = true; } - if (!enabled) + if ( !enabled ) { cDebug() << "No valid choice made"; return false; @@ -1470,13 +1492,13 @@ ChoicePage::calculateNextEnabled() const { switch ( m_encryptWidget->state() ) { - case EncryptWidget::Encryption::Unconfirmed: - cDebug() << "No passphrase provided"; - return false; - case EncryptWidget::Encryption::Disabled: - case EncryptWidget::Encryption::Confirmed: - // Checkbox not checked, **or** passphrases match - break; + case EncryptWidget::Encryption::Unconfirmed: + cDebug() << "No passphrase provided"; + return false; + case EncryptWidget::Encryption::Disabled: + case EncryptWidget::Encryption::Confirmed: + // Checkbox not checked, **or** passphrases match + break; } } @@ -1497,12 +1519,14 @@ ChoicePage::updateNextEnabled() } void -ChoicePage::updateSwapChoicesTr(QComboBox* box) +ChoicePage::updateSwapChoicesTr( QComboBox* box ) { if ( !box ) + { return; + } - static_assert(SwapChoice::NoSwap == 0, "Enum values out-of-sync"); + static_assert( SwapChoice::NoSwap == 0, "Enum values out-of-sync" ); for ( int index = 0; index < box->count(); ++index ) { bool ok = false; @@ -1510,28 +1534,32 @@ ChoicePage::updateSwapChoicesTr(QComboBox* box) switch ( value = box->itemData( index ).toInt( &ok ) ) { - // case 0: - case SwapChoice::NoSwap: - // toInt() returns 0 on failure, so check for ok - if ( ok ) // It was explicitly set to 0 - box->setItemText( index, tr( "No Swap" ) ); - else - cWarning() << "Box item" << index << box->itemText( index ) << "has non-integer role."; - break; - case SwapChoice::ReuseSwap: - box->setItemText( index, tr( "Reuse Swap" ) ); - break; - case SwapChoice::SmallSwap: - box->setItemText( index, tr( "Swap (no Hibernate)" ) ); - break; - case SwapChoice::FullSwap: - box->setItemText( index, tr( "Swap (with Hibernate)" ) ); - break; - case SwapChoice::SwapFile: - box->setItemText( index, tr( "Swap to file" ) ); - break; - default: - cWarning() << "Box item" << index << box->itemText( index ) << "has role" << value; + // case 0: + case SwapChoice::NoSwap: + // toInt() returns 0 on failure, so check for ok + if ( ok ) // It was explicitly set to 0 + { + box->setItemText( index, tr( "No Swap" ) ); + } + else + { + cWarning() << "Box item" << index << box->itemText( index ) << "has non-integer role."; + } + break; + case SwapChoice::ReuseSwap: + box->setItemText( index, tr( "Reuse Swap" ) ); + break; + case SwapChoice::SmallSwap: + box->setItemText( index, tr( "Swap (no Hibernate)" ) ); + break; + case SwapChoice::FullSwap: + box->setItemText( index, tr( "Swap (with Hibernate)" ) ); + break; + case SwapChoice::SwapFile: + box->setItemText( index, tr( "Swap to file" ) ); + break; + default: + cWarning() << "Box item" << index << box->itemText( index ) << "has role" << value; } } } diff --git a/src/modules/partition/gui/ChoicePage.h b/src/modules/partition/gui/ChoicePage.h index af8ee9060..9aa8befed 100644 --- a/src/modules/partition/gui/ChoicePage.h +++ b/src/modules/partition/gui/ChoicePage.h @@ -1,8 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2016, Teo Mrnjavac - * Copyright 2018-2019, Adriaan de Groot - * Copyright 2019, Collabora Ltd + * SPDX-FileCopyrightText: 2014-2016 Teo Mrnjavac + * SPDX-FileCopyrightText: 2018-2019 Adriaan de Groot + * SPDX-FileCopyrightText: 2019 Collabora Ltd + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/gui/CreatePartitionDialog.cpp b/src/modules/partition/gui/CreatePartitionDialog.cpp index a73441bc3..ae500c500 100644 --- a/src/modules/partition/gui/CreatePartitionDialog.cpp +++ b/src/modules/partition/gui/CreatePartitionDialog.cpp @@ -1,10 +1,11 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Aurélien Gâteau - * Copyright 2016, Teo Mrnjavac - * Copyright 2018, 2020, Adriaan de Groot - * Copyright 2018, Andrius Štikonas - * Copyright 2018, Caio Carvalho + * SPDX-FileCopyrightText: 2014 Aurélien Gâteau + * SPDX-FileCopyrightText: 2016 Teo Mrnjavac + * SPDX-FileCopyrightText: 2018 2020, Adriaan de Groot + * SPDX-FileCopyrightText: 2018 Andrius Štikonas + * SPDX-FileCopyrightText: 2018 Caio Carvalho + * SPDX-License-Identifier: GPL-3.0-or-later * * 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,16 +25,16 @@ #include "ui_CreatePartitionDialog.h" #include "core/ColorUtils.h" -#include "core/PartitionInfo.h" -#include "core/PartUtils.h" #include "core/KPMHelpers.h" +#include "core/PartUtils.h" +#include "core/PartitionInfo.h" #include "gui/PartitionDialogHelpers.h" #include "gui/PartitionSizeController.h" #include "GlobalStorage.h" #include "JobQueue.h" -#include "partition/PartitionQuery.h" #include "partition/FileSystem.h" +#include "partition/PartitionQuery.h" #include "utils/Logger.h" #include @@ -53,16 +54,17 @@ using CalamaresUtils::Partition::untranslatedFS; using CalamaresUtils::Partition::userVisibleFS; -static QSet< FileSystem::Type > s_unmountableFS( -{ - FileSystem::Unformatted, - FileSystem::LinuxSwap, - FileSystem::Extended, - FileSystem::Unknown, - FileSystem::Lvm2_PV -} ); +static QSet< FileSystem::Type > s_unmountableFS( { FileSystem::Unformatted, + FileSystem::LinuxSwap, + FileSystem::Extended, + FileSystem::Unknown, + FileSystem::Lvm2_PV } ); -CreatePartitionDialog::CreatePartitionDialog( Device* device, PartitionNode* parentPartition, Partition* partition, const QStringList& usedMountPoints, QWidget* parentWidget ) +CreatePartitionDialog::CreatePartitionDialog( Device* device, + PartitionNode* parentPartition, + Partition* partition, + const QStringList& usedMountPoints, + QWidget* parentWidget ) : QDialog( parentWidget ) , m_ui( new Ui_CreatePartitionDialog ) , m_partitionSizeController( new PartitionSizeController( this ) ) @@ -74,33 +76,38 @@ CreatePartitionDialog::CreatePartitionDialog( Device* device, PartitionNode* par m_ui->encryptWidget->setText( tr( "En&crypt" ) ); m_ui->encryptWidget->hide(); - if (m_device->type() != Device::Type::LVM_Device) { + if ( m_device->type() != Device::Type::LVM_Device ) + { m_ui->lvNameLabel->hide(); m_ui->lvNameLineEdit->hide(); } - if (m_device->type() == Device::Type::LVM_Device) { + if ( m_device->type() == Device::Type::LVM_Device ) + { /* LVM logical volume name can consist of: letters numbers _ . - + * It cannot start with underscore _ and must not be equal to . or .. or any entry in /dev/ * QLineEdit accepts QValidator::Intermediate, so we just disable . at the beginning */ - QRegularExpression re(QStringLiteral(R"(^(?!_|\.)[\w\-.+]+)")); - QRegularExpressionValidator *validator = new QRegularExpressionValidator(re, this); - m_ui->lvNameLineEdit->setValidator(validator); + QRegularExpression re( QStringLiteral( R"(^(?!_|\.)[\w\-.+]+)" ) ); + QRegularExpressionValidator* validator = new QRegularExpressionValidator( re, this ); + m_ui->lvNameLineEdit->setValidator( validator ); } - standardMountPoints( *(m_ui->mountPointComboBox), partition ? PartitionInfo::mountPoint( partition ) : QString() ); + standardMountPoints( *( m_ui->mountPointComboBox ), + partition ? PartitionInfo::mountPoint( partition ) : QString() ); - if ( device->partitionTable()->type() == PartitionTable::msdos || - device->partitionTable()->type() == PartitionTable::msdos_sectorbased ) + if ( device->partitionTable()->type() == PartitionTable::msdos + || device->partitionTable()->type() == PartitionTable::msdos_sectorbased ) + { initMbrPartitionTypeUi(); + } else + { initGptPartitionTypeUi(); + } // File system; the config value is translated (best-effort) to a type FileSystem::Type defaultFSType; QString untranslatedFSName = PartUtils::findFS( - Calamares::JobQueue::instance()-> - globalStorage()-> - value( "defaultFileSystemType" ).toString(), &defaultFSType ); + Calamares::JobQueue::instance()->globalStorage()->value( "defaultFileSystemType" ).toString(), &defaultFSType ); if ( defaultFSType == FileSystem::Type::Unknown ) { defaultFSType = FileSystem::Type::Ext4; @@ -111,12 +118,13 @@ CreatePartitionDialog::CreatePartitionDialog( Device* device, PartitionNode* par QStringList fsNames; for ( auto fs : FileSystemFactory::map() ) { - if ( fs->supportCreate() != FileSystem::cmdSupportNone && - fs->type() != FileSystem::Extended ) + if ( fs->supportCreate() != FileSystem::cmdSupportNone && fs->type() != FileSystem::Extended ) { fsNames << userVisibleFS( fs ); // This is put into the combobox if ( fs->type() == defaultFSType ) + { defaultFsIndex = fsCounter; + } fsCounter++; } } @@ -126,26 +134,30 @@ CreatePartitionDialog::CreatePartitionDialog( Device* device, PartitionNode* par connect( m_ui->fsComboBox, SIGNAL( activated( int ) ), SLOT( updateMountPointUi() ) ); connect( m_ui->extendedRadioButton, SIGNAL( toggled( bool ) ), SLOT( updateMountPointUi() ) ); - connect( m_ui->mountPointComboBox, &QComboBox::currentTextChanged, this, &CreatePartitionDialog::checkMountPointSelection ); + connect( m_ui->mountPointComboBox, + &QComboBox::currentTextChanged, + this, + &CreatePartitionDialog::checkMountPointSelection ); // Select a default m_ui->fsComboBox->setCurrentIndex( defaultFsIndex ); updateMountPointUi(); - setFlagList( *(m_ui->m_listFlags), static_cast< PartitionTable::Flags >( ~PartitionTable::Flags::Int(0) ), partition ? PartitionInfo::flags( partition ) : PartitionTable::Flags() ); + setFlagList( *( m_ui->m_listFlags ), + static_cast< PartitionTable::Flags >( ~PartitionTable::Flags::Int( 0 ) ), + partition ? PartitionInfo::flags( partition ) : PartitionTable::Flags() ); // Checks the initial selection. checkMountPointSelection(); } -CreatePartitionDialog::~CreatePartitionDialog() -{} +CreatePartitionDialog::~CreatePartitionDialog() {} PartitionTable::Flags CreatePartitionDialog::newFlags() const { - return flagsFromList( *(m_ui->m_listFlags) ); + return flagsFromList( *( m_ui->m_listFlags ) ); } void @@ -165,7 +177,9 @@ CreatePartitionDialog::initMbrPartitionTypeUi() } if ( fixedPartitionString.isEmpty() ) + { m_ui->fixedPartitionLabel->hide(); + } else { m_ui->fixedPartitionLabel->setText( fixedPartitionString ); @@ -188,44 +202,33 @@ CreatePartitionDialog::createPartition() { if ( m_role.roles() == PartitionRole::None ) { - m_role = PartitionRole( - m_ui->extendedRadioButton->isChecked() - ? PartitionRole::Extended - : PartitionRole::Primary - ); + m_role = PartitionRole( m_ui->extendedRadioButton->isChecked() ? PartitionRole::Extended + : PartitionRole::Primary ); } qint64 first = m_partitionSizeController->firstSector(); qint64 last = m_partitionSizeController->lastSector(); FileSystem::Type fsType = m_role.has( PartitionRole::Extended ) - ? FileSystem::Extended - : FileSystem::typeForName( m_ui->fsComboBox->currentText() ); + ? FileSystem::Extended + : FileSystem::typeForName( m_ui->fsComboBox->currentText() ); Partition* partition = nullptr; QString luksPassphrase = m_ui->encryptWidget->passphrase(); - if ( m_ui->encryptWidget->state() == EncryptWidget::Encryption::Confirmed && - !luksPassphrase.isEmpty() ) + if ( m_ui->encryptWidget->state() == EncryptWidget::Encryption::Confirmed && !luksPassphrase.isEmpty() ) { partition = KPMHelpers::createNewEncryptedPartition( - m_parent, - *m_device, - m_role, - fsType, first, last, luksPassphrase, newFlags() - ); + m_parent, *m_device, m_role, fsType, first, last, luksPassphrase, newFlags() ); } else { - partition = KPMHelpers::createNewPartition( - m_parent, - *m_device, - m_role, - fsType, first, last, newFlags() - ); + partition = KPMHelpers::createNewPartition( m_parent, *m_device, m_role, fsType, first, last, newFlags() ); } - if (m_device->type() == Device::Type::LVM_Device) { - partition->setPartitionPath(m_device->deviceNode() + QStringLiteral("/") + m_ui->lvNameLineEdit->text().trimmed()); + if ( m_device->type() == Device::Type::LVM_Device ) + { + partition->setPartitionPath( m_device->deviceNode() + QStringLiteral( "/" ) + + m_ui->lvNameLineEdit->text().trimmed() ); } PartitionInfo::setMountPoint( partition, selectedMountPoint( m_ui->mountPointComboBox ) ); @@ -244,9 +247,8 @@ CreatePartitionDialog::updateMountPointUi() FileSystem::Type type = FileSystem::typeForName( m_ui->fsComboBox->currentText() ); enabled = !s_unmountableFS.contains( type ); - if ( FileSystemFactory::map()[FileSystem::Type::Luks]->supportCreate() && - FS::luks::canEncryptType( type ) && - !m_role.has( PartitionRole::Extended ) ) + if ( FileSystemFactory::map()[ FileSystem::Type::Luks ]->supportCreate() && FS::luks::canEncryptType( type ) + && !m_role.has( PartitionRole::Extended ) ) { m_ui->encryptWidget->show(); m_ui->encryptWidget->reset(); @@ -260,7 +262,9 @@ CreatePartitionDialog::updateMountPointUi() m_ui->mountPointLabel->setEnabled( enabled ); m_ui->mountPointComboBox->setEnabled( enabled ); if ( !enabled ) + { m_ui->mountPointComboBox->setCurrentText( QString() ); + } } void @@ -282,8 +286,8 @@ void CreatePartitionDialog::initPartResizerWidget( Partition* partition ) { QColor color = CalamaresUtils::Partition::isPartitionFreeSpace( partition ) - ? ColorUtils::colorForPartitionInFreeSpace( partition ) - : ColorUtils::colorForPartition( partition ); + ? ColorUtils::colorForPartitionInFreeSpace( partition ) + : ColorUtils::colorForPartition( partition ); m_partitionSizeController->init( m_device, partition, color ); m_partitionSizeController->setPartResizerWidget( m_ui->partResizerWidget ); m_partitionSizeController->setSpinBox( m_ui->sizeSpinBox ); diff --git a/src/modules/partition/gui/CreatePartitionDialog.h b/src/modules/partition/gui/CreatePartitionDialog.h index 2f3cc14a5..6991d1fa5 100644 --- a/src/modules/partition/gui/CreatePartitionDialog.h +++ b/src/modules/partition/gui/CreatePartitionDialog.h @@ -1,8 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Aurélien Gâteau - * Copyright 2016, Teo Mrnjavac - * Copyright 2018, Adriaan de Groot + * SPDX-FileCopyrightText: 2014 Aurélien Gâteau + * SPDX-FileCopyrightText: 2016 Teo Mrnjavac + * SPDX-FileCopyrightText: 2018 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -49,7 +50,11 @@ public: * For the (unlikely) case that a newly created partition is being re-edited, * pass a pointer to that @p partition, otherwise pass nullptr. */ - CreatePartitionDialog( Device* device, PartitionNode* parentPartition, Partition* partition, const QStringList& usedMountPoints, QWidget* parentWidget = nullptr ); + CreatePartitionDialog( Device* device, + PartitionNode* parentPartition, + Partition* partition, + const QStringList& usedMountPoints, + QWidget* parentWidget = nullptr ); ~CreatePartitionDialog(); /** diff --git a/src/modules/partition/gui/CreateVolumeGroupDialog.cpp b/src/modules/partition/gui/CreateVolumeGroupDialog.cpp index a255e9902..2f5984301 100644 --- a/src/modules/partition/gui/CreateVolumeGroupDialog.cpp +++ b/src/modules/partition/gui/CreateVolumeGroupDialog.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2018, Caio Jordão Carvalho + * SPDX-FileCopyrightText: 2018 Caio Jordão Carvalho + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/gui/CreateVolumeGroupDialog.h b/src/modules/partition/gui/CreateVolumeGroupDialog.h index 02ca6410c..3c3d5cc1b 100644 --- a/src/modules/partition/gui/CreateVolumeGroupDialog.h +++ b/src/modules/partition/gui/CreateVolumeGroupDialog.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2018, Caio Jordão Carvalho + * SPDX-FileCopyrightText: 2018 Caio Jordão Carvalho + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -39,4 +40,4 @@ private: qint64& m_peSize; }; -#endif // CREATEVOLUMEGROUPDIALOG_H +#endif // CREATEVOLUMEGROUPDIALOG_H diff --git a/src/modules/partition/gui/DeviceInfoWidget.cpp b/src/modules/partition/gui/DeviceInfoWidget.cpp index ea318e85c..d7059c71e 100644 --- a/src/modules/partition/gui/DeviceInfoWidget.cpp +++ b/src/modules/partition/gui/DeviceInfoWidget.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2015-2016, Teo Mrnjavac + * SPDX-FileCopyrightText: 2015-2016 Teo Mrnjavac + * SPDX-License-Identifier: GPL-3.0-or-later * * 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,15 +20,15 @@ #include "DeviceInfoWidget.h" +#include "GlobalStorage.h" +#include "JobQueue.h" #include "utils/CalamaresUtilsGui.h" #include "utils/Logger.h" #include "utils/Retranslator.h" -#include "JobQueue.h" -#include "GlobalStorage.h" #include -#include #include +#include DeviceInfoWidget::DeviceInfoWidget( QWidget* parent ) : QWidget( parent ) @@ -39,8 +40,8 @@ DeviceInfoWidget::DeviceInfoWidget( QWidget* parent ) setLayout( mainLayout ); CalamaresUtils::unmarginLayout( mainLayout ); - m_ptLabel->setObjectName("deviceInfoLabel"); - m_ptIcon->setObjectName("deviceInfoIcon"); + m_ptLabel->setObjectName( "deviceInfoLabel" ); + m_ptIcon->setObjectName( "deviceInfoIcon" ); mainLayout->addWidget( m_ptIcon ); mainLayout->addWidget( m_ptLabel ); @@ -49,16 +50,14 @@ DeviceInfoWidget::DeviceInfoWidget( QWidget* parent ) m_ptIcon->setMargin( 0 ); m_ptIcon->setFixedSize( iconSize ); m_ptIcon->setPixmap( - CalamaresUtils::defaultPixmap( CalamaresUtils::PartitionTable, - CalamaresUtils::Original, - iconSize ) ); + CalamaresUtils::defaultPixmap( CalamaresUtils::PartitionTable, CalamaresUtils::Original, iconSize ) ); QFontMetrics fm = QFontMetrics( QFont() ); m_ptLabel->setMinimumWidth( fm.boundingRect( "Amiga" ).width() + CalamaresUtils::defaultFontHeight() / 2 ); m_ptLabel->setAlignment( Qt::AlignCenter ); QPalette palette; - palette.setBrush( QPalette::Foreground, QColor( "#4D4D4D" ) ); //dark grey + palette.setBrush( QPalette::Foreground, QColor( "#4D4D4D" ) ); //dark grey m_ptIcon->setAutoFillBackground( true ); m_ptLabel->setAutoFillBackground( true ); @@ -107,7 +106,7 @@ DeviceInfoWidget::retranslateUi() QString toolTipString = tr( "This device has a %1 partition " "table." ) - .arg( typeString ); + .arg( typeString ); switch ( m_tableType ) { @@ -149,11 +148,11 @@ DeviceInfoWidget::retranslateUi() m_ptLabel->setToolTip( toolTipString ); m_ptIcon->setToolTip( tr( "The type of partition table on the " - "selected storage device.

" - "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.
" - "This installer will keep the current partition table " - "unless you explicitly choose otherwise.
" - "If unsure, on modern systems GPT is preferred." ) ); + "selected storage device.

" + "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.
" + "This installer will keep the current partition table " + "unless you explicitly choose otherwise.
" + "If unsure, on modern systems GPT is preferred." ) ); } diff --git a/src/modules/partition/gui/DeviceInfoWidget.h b/src/modules/partition/gui/DeviceInfoWidget.h index b1769c19d..38a0309f3 100644 --- a/src/modules/partition/gui/DeviceInfoWidget.h +++ b/src/modules/partition/gui/DeviceInfoWidget.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2015-2016, Teo Mrnjavac + * SPDX-FileCopyrightText: 2015-2016 Teo Mrnjavac + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -43,4 +44,4 @@ private: PartitionTable::TableType m_tableType; }; -#endif // DEVICEINFOWIDGET_H +#endif // DEVICEINFOWIDGET_H diff --git a/src/modules/partition/gui/EditExistingPartitionDialog.cpp b/src/modules/partition/gui/EditExistingPartitionDialog.cpp index 37868c7ff..633418ec3 100644 --- a/src/modules/partition/gui/EditExistingPartitionDialog.cpp +++ b/src/modules/partition/gui/EditExistingPartitionDialog.cpp @@ -1,12 +1,13 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Aurélien Gâteau - * Copyright 2016, Teo Mrnjavac - * Copyright 2018, 2020, Adriaan de Groot + * SPDX-FileCopyrightText: 2008-2009 Volker Lanz + * SPDX-FileCopyrightText: 2014 Aurélien Gâteau + * SPDX-FileCopyrightText: 2016 Andrius Štikonas + * SPDX-FileCopyrightText: 2016 Teo Mrnjavac + * SPDX-FileCopyrightText: 2018 2020, Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * - * Flags handling originally from KDE Partition Manager, - * Copyright 2008-2009, Volker Lanz - * Copyright 2016, Andrius Štikonas + * Flags handling originally from KDE Partition Manager. * * 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,9 +27,9 @@ #include "ui_EditExistingPartitionDialog.h" #include "core/ColorUtils.h" +#include "core/PartUtils.h" #include "core/PartitionCoreModule.h" #include "core/PartitionInfo.h" -#include "core/PartUtils.h" #include "gui/PartitionDialogHelpers.h" #include "gui/PartitionSizeController.h" @@ -48,7 +49,10 @@ using CalamaresUtils::Partition::untranslatedFS; using CalamaresUtils::Partition::userVisibleFS; -EditExistingPartitionDialog::EditExistingPartitionDialog( Device* device, Partition* partition, const QStringList& usedMountPoints, QWidget* parentWidget ) +EditExistingPartitionDialog::EditExistingPartitionDialog( Device* device, + Partition* partition, + const QStringList& usedMountPoints, + QWidget* parentWidget ) : QDialog( parentWidget ) , m_ui( new Ui_EditExistingPartitionDialog ) , m_device( device ) @@ -57,51 +61,50 @@ EditExistingPartitionDialog::EditExistingPartitionDialog( Device* device, Partit , m_usedMountPoints( usedMountPoints ) { m_ui->setupUi( this ); - standardMountPoints( *(m_ui->mountPointComboBox), PartitionInfo::mountPoint( partition ) ); + standardMountPoints( *( m_ui->mountPointComboBox ), PartitionInfo::mountPoint( partition ) ); QColor color = ColorUtils::colorForPartition( m_partition ); m_partitionSizeController->init( m_device, m_partition, color ); m_partitionSizeController->setSpinBox( m_ui->sizeSpinBox ); - connect( m_ui->mountPointComboBox, &QComboBox::currentTextChanged, - this, &EditExistingPartitionDialog::checkMountPointSelection ); + connect( m_ui->mountPointComboBox, + &QComboBox::currentTextChanged, + this, + &EditExistingPartitionDialog::checkMountPointSelection ); replacePartResizerWidget(); - connect( m_ui->formatRadioButton, &QAbstractButton::toggled, - [ this ]( bool doFormat ) - { + connect( m_ui->formatRadioButton, &QAbstractButton::toggled, [this]( bool doFormat ) { replacePartResizerWidget(); m_ui->fileSystemLabel->setEnabled( doFormat ); m_ui->fileSystemComboBox->setEnabled( doFormat ); if ( !doFormat ) + { m_ui->fileSystemComboBox->setCurrentText( userVisibleFS( m_partition->fileSystem() ) ); + } updateMountPointPicker(); } ); - connect( m_ui->fileSystemComboBox, &QComboBox::currentTextChanged, - [ this ]( QString ) - { - updateMountPointPicker(); - } ); + connect( + m_ui->fileSystemComboBox, &QComboBox::currentTextChanged, [this]( QString ) { updateMountPointPicker(); } ); // File system QStringList fsNames; for ( auto fs : FileSystemFactory::map() ) { if ( fs->supportCreate() != FileSystem::cmdSupportNone && fs->type() != FileSystem::Extended ) - fsNames << userVisibleFS( fs ); // For the combo box + { + fsNames << userVisibleFS( fs ); // For the combo box + } } m_ui->fileSystemComboBox->addItems( fsNames ); FileSystem::Type defaultFSType; QString untranslatedFSName = PartUtils::findFS( - Calamares::JobQueue::instance()-> - globalStorage()-> - value( "defaultFileSystemType" ).toString(), &defaultFSType ); + Calamares::JobQueue::instance()->globalStorage()->value( "defaultFileSystemType" ).toString(), &defaultFSType ); if ( defaultFSType == FileSystem::Type::Unknown ) { defaultFSType = FileSystem::Type::Ext4; @@ -109,39 +112,40 @@ EditExistingPartitionDialog::EditExistingPartitionDialog( Device* device, Partit QString thisFSNameForUser = userVisibleFS( m_partition->fileSystem() ); if ( fsNames.contains( thisFSNameForUser ) ) + { m_ui->fileSystemComboBox->setCurrentText( thisFSNameForUser ); + } else + { m_ui->fileSystemComboBox->setCurrentText( FileSystem::nameForType( defaultFSType ) ); + } m_ui->fileSystemLabel->setEnabled( m_ui->formatRadioButton->isChecked() ); m_ui->fileSystemComboBox->setEnabled( m_ui->formatRadioButton->isChecked() ); - setFlagList( *(m_ui->m_listFlags), m_partition->availableFlags(), PartitionInfo::flags( m_partition ) ); + setFlagList( *( m_ui->m_listFlags ), m_partition->availableFlags(), PartitionInfo::flags( m_partition ) ); } -EditExistingPartitionDialog::~EditExistingPartitionDialog() -{} +EditExistingPartitionDialog::~EditExistingPartitionDialog() {} PartitionTable::Flags EditExistingPartitionDialog::newFlags() const { - return flagsFromList( *(m_ui->m_listFlags) ); + return flagsFromList( *( m_ui->m_listFlags ) ); } void EditExistingPartitionDialog::applyChanges( PartitionCoreModule* core ) { - PartitionInfo::setMountPoint( m_partition, selectedMountPoint(m_ui->mountPointComboBox) ); + PartitionInfo::setMountPoint( m_partition, selectedMountPoint( m_ui->mountPointComboBox ) ); qint64 newFirstSector = m_partitionSizeController->firstSector(); - qint64 newLastSector = m_partitionSizeController->lastSector(); - bool partResizedMoved = newFirstSector != m_partition->firstSector() || - newLastSector != m_partition->lastSector(); + qint64 newLastSector = m_partitionSizeController->lastSector(); + bool partResizedMoved = newFirstSector != m_partition->firstSector() || newLastSector != m_partition->lastSector(); - cDebug() << "old boundaries:" << m_partition->firstSector() - << m_partition->lastSector() << m_partition->length(); + cDebug() << "old boundaries:" << m_partition->firstSector() << m_partition->lastSector() << m_partition->length(); cDebug() << "new boundaries:" << newFirstSector << newLastSector; cDebug() << "dirty status:" << m_partitionSizeController->isDirty(); @@ -149,22 +153,21 @@ EditExistingPartitionDialog::applyChanges( PartitionCoreModule* core ) if ( m_ui->formatRadioButton->isChecked() ) { fsType = m_partition->roles().has( PartitionRole::Extended ) - ? FileSystem::Extended - : FileSystem::typeForName( m_ui->fileSystemComboBox->currentText() ); + ? FileSystem::Extended + : FileSystem::typeForName( m_ui->fileSystemComboBox->currentText() ); } if ( partResizedMoved ) { if ( m_ui->formatRadioButton->isChecked() ) { - Partition* newPartition = KPMHelpers::createNewPartition( - m_partition->parent(), - *m_device, - m_partition->roles(), - fsType, - newFirstSector, - newLastSector, - newFlags() ); + Partition* newPartition = KPMHelpers::createNewPartition( m_partition->parent(), + *m_device, + m_partition->roles(), + fsType, + newFirstSector, + newLastSector, + newFlags() ); PartitionInfo::setMountPoint( newPartition, PartitionInfo::mountPoint( m_partition ) ); PartitionInfo::setFormat( newPartition, true ); @@ -174,12 +177,11 @@ EditExistingPartitionDialog::applyChanges( PartitionCoreModule* core ) } else { - core->resizePartition( m_device, - m_partition, - newFirstSector, - newLastSector ); + core->resizePartition( m_device, m_partition, newFirstSector, newLastSector ); if ( m_partition->activeFlags() != newFlags() ) + { core->setPartitionFlags( m_device, m_partition, newFlags() ); + } } } else @@ -192,18 +194,19 @@ EditExistingPartitionDialog::applyChanges( PartitionCoreModule* core ) { core->formatPartition( m_device, m_partition ); if ( m_partition->activeFlags() != newFlags() ) + { core->setPartitionFlags( m_device, m_partition, newFlags() ); + } } - else // otherwise, we delete and recreate the partition with new fs type + else // otherwise, we delete and recreate the partition with new fs type { - Partition* newPartition = KPMHelpers::createNewPartition( - m_partition->parent(), - *m_device, - m_partition->roles(), - fsType, - m_partition->firstSector(), - m_partition->lastSector(), - newFlags() ); + Partition* newPartition = KPMHelpers::createNewPartition( m_partition->parent(), + *m_device, + m_partition->roles(), + fsType, + m_partition->firstSector(), + m_partition->lastSector(), + newFlags() ); PartitionInfo::setMountPoint( newPartition, PartitionInfo::mountPoint( m_partition ) ); PartitionInfo::setFormat( newPartition, true ); @@ -216,7 +219,9 @@ EditExistingPartitionDialog::applyChanges( PartitionCoreModule* core ) { core->refreshPartition( m_device, m_partition ); if ( m_partition->activeFlags() != newFlags() ) + { core->setPartitionFlags( m_device, m_partition, newFlags() ); + } } } } @@ -255,11 +260,8 @@ EditExistingPartitionDialog::updateMountPointPicker() fsType = m_partition->fileSystem().type(); } bool canMount = true; - if ( fsType == FileSystem::Extended || - fsType == FileSystem::LinuxSwap || - fsType == FileSystem::Unformatted || - fsType == FileSystem::Unknown || - fsType == FileSystem::Lvm2_PV ) + if ( fsType == FileSystem::Extended || fsType == FileSystem::LinuxSwap || fsType == FileSystem::Unformatted + || fsType == FileSystem::Unknown || fsType == FileSystem::Lvm2_PV ) { canMount = false; } @@ -267,7 +269,9 @@ EditExistingPartitionDialog::updateMountPointPicker() m_ui->mountPointLabel->setEnabled( canMount ); m_ui->mountPointComboBox->setEnabled( canMount ); if ( !canMount ) + { setSelectedMountPoint( m_ui->mountPointComboBox, QString() ); + } } void diff --git a/src/modules/partition/gui/EditExistingPartitionDialog.h b/src/modules/partition/gui/EditExistingPartitionDialog.h index e98563bc0..7788305fc 100644 --- a/src/modules/partition/gui/EditExistingPartitionDialog.h +++ b/src/modules/partition/gui/EditExistingPartitionDialog.h @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Aurélien Gâteau - * Copyright 2018, Adriaan de Groot + * SPDX-FileCopyrightText: 2014 Aurélien Gâteau + * SPDX-FileCopyrightText: 2018 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -41,7 +42,10 @@ class EditExistingPartitionDialog : public QDialog { Q_OBJECT public: - EditExistingPartitionDialog( Device* device, Partition* partition, const QStringList& usedMountPoints, QWidget* parentWidget = nullptr ); + EditExistingPartitionDialog( Device* device, + Partition* partition, + const QStringList& usedMountPoints, + QWidget* parentWidget = nullptr ); ~EditExistingPartitionDialog(); void applyChanges( PartitionCoreModule* module ); diff --git a/src/modules/partition/gui/EncryptWidget.cpp b/src/modules/partition/gui/EncryptWidget.cpp index 5e44c15fd..cf9a0c922 100644 --- a/src/modules/partition/gui/EncryptWidget.cpp +++ b/src/modules/partition/gui/EncryptWidget.cpp @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2016, Teo Mrnjavac - * Copyright 2020, Adriaan de Groot + * SPDX-FileCopyrightText: 2016 Teo Mrnjavac + * SPDX-FileCopyrightText: 2020 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/gui/EncryptWidget.h b/src/modules/partition/gui/EncryptWidget.h index 79beb1fa7..c3f7928fe 100644 --- a/src/modules/partition/gui/EncryptWidget.h +++ b/src/modules/partition/gui/EncryptWidget.h @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2016, Teo Mrnjavac - * Copyright 2020, Adriaan de Groot + * SPDX-FileCopyrightText: 2016 Teo Mrnjavac + * SPDX-FileCopyrightText: 2020 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * 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,7 @@ namespace Ui { - class EncryptWidget; +class EncryptWidget; } class EncryptWidget : public QWidget diff --git a/src/modules/partition/gui/ListPhysicalVolumeWidgetItem.cpp b/src/modules/partition/gui/ListPhysicalVolumeWidgetItem.cpp index cd480aa55..f9f1b9c6b 100644 --- a/src/modules/partition/gui/ListPhysicalVolumeWidgetItem.cpp +++ b/src/modules/partition/gui/ListPhysicalVolumeWidgetItem.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2018, Caio Jordão Carvalho + * SPDX-FileCopyrightText: 2018 Caio Jordão Carvalho + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,11 +22,12 @@ #include ListPhysicalVolumeWidgetItem::ListPhysicalVolumeWidgetItem( const Partition* partition, bool checked ) - : QListWidgetItem(QString("%1 | %2").arg( partition->deviceNode(), Capacity::formatByteSize( partition->capacity() ))) - , m_partition(partition) + : QListWidgetItem( + QString( "%1 | %2" ).arg( partition->deviceNode(), Capacity::formatByteSize( partition->capacity() ) ) ) + , m_partition( partition ) { setToolTip( partition->deviceNode() ); - setSizeHint( QSize(0, 32) ); + setSizeHint( QSize( 0, 32 ) ); setCheckState( checked ? Qt::Checked : Qt::Unchecked ); } diff --git a/src/modules/partition/gui/ListPhysicalVolumeWidgetItem.h b/src/modules/partition/gui/ListPhysicalVolumeWidgetItem.h index 44ba8c3bf..7d8e8faf0 100644 --- a/src/modules/partition/gui/ListPhysicalVolumeWidgetItem.h +++ b/src/modules/partition/gui/ListPhysicalVolumeWidgetItem.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2018, Caio Jordão Carvalho + * SPDX-FileCopyrightText: 2018 Caio Jordão Carvalho + * SPDX-License-Identifier: GPL-3.0-or-later * * 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,4 +35,4 @@ private: const Partition* m_partition; }; -#endif // LISTPHYSICALVOLUMEWIDGETITEM_H +#endif // LISTPHYSICALVOLUMEWIDGETITEM_H diff --git a/src/modules/partition/gui/PartitionBarsView.cpp b/src/modules/partition/gui/PartitionBarsView.cpp index b7c21473c..6799b26f0 100644 --- a/src/modules/partition/gui/PartitionBarsView.cpp +++ b/src/modules/partition/gui/PartitionBarsView.cpp @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Aurélien Gâteau - * Copyright 2015-2016, Teo Mrnjavac + * SPDX-FileCopyrightText: 2014 Aurélien Gâteau + * SPDX-FileCopyrightText: 2015-2016 Teo Mrnjavac + * SPDX-License-Identifier: GPL-3.0-or-later * * 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,8 +19,8 @@ */ #include "gui/PartitionBarsView.h" -#include "core/PartitionModel.h" #include "core/ColorUtils.h" +#include "core/PartitionModel.h" #include "utils/CalamaresUtilsGui.h" #include "utils/Logger.h" @@ -32,8 +33,9 @@ #include -static const int VIEW_HEIGHT = qMax( CalamaresUtils::defaultFontHeight() + 8, // wins out with big fonts - int( CalamaresUtils::defaultFontHeight() * 0.6 ) + 22 ); // wins out with small fonts +static const int VIEW_HEIGHT + = qMax( CalamaresUtils::defaultFontHeight() + 8, // wins out with big fonts + int( CalamaresUtils::defaultFontHeight() * 0.6 ) + 22 ); // wins out with small fonts static constexpr int CORNER_RADIUS = 3; static const int EXTENDED_PARTITION_MARGIN = qMax( 4, VIEW_HEIGHT / 6 ); @@ -45,8 +47,8 @@ static const int EXTENDED_PARTITION_MARGIN = qMax( 4, VIEW_HEIGHT / 6 ); // and the extended partition box (the "- 2" part). // At worst, on low DPI systems, this will mean in order: // 1px outer rect, 1 px gap, 1px selection rect, 1px gap, 1px extended partition rect. -static const int SELECTION_MARGIN = qMin( ( EXTENDED_PARTITION_MARGIN - 2 ) / 2, - ( EXTENDED_PARTITION_MARGIN - 2 ) - 2 ); +static const int SELECTION_MARGIN + = qMin( ( EXTENDED_PARTITION_MARGIN - 2 ) / 2, ( EXTENDED_PARTITION_MARGIN - 2 ) - 2 ); PartitionBarsView::PartitionBarsView( QWidget* parent ) @@ -55,25 +57,21 @@ PartitionBarsView::PartitionBarsView( QWidget* parent ) , canBeSelected( []( const QModelIndex& ) { return true; } ) , m_hoveredIndex( QModelIndex() ) { - this->setObjectName("partitionBarView"); + this->setObjectName( "partitionBarView" ); setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); setFrameStyle( QFrame::NoFrame ); setSelectionBehavior( QAbstractItemView::SelectRows ); setSelectionMode( QAbstractItemView::SingleSelection ); // Debug - connect( this, &PartitionBarsView::clicked, - this, [=]( const QModelIndex& index ) - { + connect( this, &PartitionBarsView::clicked, this, [=]( const QModelIndex& index ) { cDebug() << "Clicked row" << index.row(); } ); setMouseTracking( true ); } -PartitionBarsView::~PartitionBarsView() -{ -} +PartitionBarsView::~PartitionBarsView() {} void @@ -117,12 +115,9 @@ PartitionBarsView::paintEvent( QPaintEvent* event ) void PartitionBarsView::drawSection( QPainter* painter, const QRect& rect_, int x, int width, const QModelIndex& index ) { - QColor color = index.isValid() ? - index.data( Qt::DecorationRole ).value< QColor >() : - ColorUtils::unknownDisklabelColor(); - bool isFreeSpace = index.isValid() ? - index.data( PartitionModel::IsFreeSpaceRole ).toBool() : - true; + QColor color + = index.isValid() ? index.data( Qt::DecorationRole ).value< QColor >() : ColorUtils::unknownDisklabelColor(); + bool isFreeSpace = index.isValid() ? index.data( PartitionModel::IsFreeSpaceRole ).toBool() : true; QRect rect = rect_; const int y = rect.y(); @@ -134,14 +129,17 @@ PartitionBarsView::drawSection( QPainter* painter, const QRect& rect_, int x, in rect.adjust( 0, 0, -1, -1 ); - if ( selectionMode() != QAbstractItemView::NoSelection && // no hover without selection - m_hoveredIndex.isValid() && - index == m_hoveredIndex ) + if ( selectionMode() != QAbstractItemView::NoSelection && // no hover without selection + m_hoveredIndex.isValid() && index == m_hoveredIndex ) { if ( canBeSelected( index ) ) + { painter->setBrush( color.lighter( 115 ) ); + } else + { painter->setBrush( color ); + } } else { @@ -156,7 +154,9 @@ PartitionBarsView::drawSection( QPainter* painter, const QRect& rect_, int x, in // Draw shade if ( !isFreeSpace ) + { rect.adjust( 2, 2, -2, -2 ); + } QLinearGradient gradient( 0, 0, 0, height / 2 ); @@ -169,11 +169,8 @@ PartitionBarsView::drawSection( QPainter* painter, const QRect& rect_, int x, in painter->setBrush( gradient ); painter->drawRoundedRect( rect, radius, radius ); - if ( selectionMode() != QAbstractItemView::NoSelection && - index.isValid() && - selectionModel() && - !selectionModel()->selectedIndexes().isEmpty() && - selectionModel()->selectedIndexes().first() == index ) + if ( selectionMode() != QAbstractItemView::NoSelection && index.isValid() && selectionModel() + && !selectionModel()->selectedIndexes().isEmpty() && selectionModel()->selectedIndexes().first() == index ) { painter->setPen( QPen( borderColor, 1 ) ); QColor highlightColor = QPalette().highlight().color(); @@ -183,22 +180,21 @@ PartitionBarsView::drawSection( QPainter* painter, const QRect& rect_, int x, in QRect selectionRect = rect; selectionRect.setX( x + 1 ); - selectionRect.setWidth( width - 3 ); //account for the previous rect.adjust + selectionRect.setWidth( width - 3 ); //account for the previous rect.adjust - if ( rect.x() > selectionRect.x() ) //hack for first item + if ( rect.x() > selectionRect.x() ) //hack for first item + { selectionRect.adjust( rect.x() - selectionRect.x(), 0, 0, 0 ); + } - if ( rect.right() < selectionRect.right() ) //hack for last item - selectionRect.adjust( 0, 0, - ( selectionRect.right() - rect.right() ), 0 ); + if ( rect.right() < selectionRect.right() ) //hack for last item + { + selectionRect.adjust( 0, 0, -( selectionRect.right() - rect.right() ), 0 ); + } - selectionRect.adjust( SELECTION_MARGIN, - SELECTION_MARGIN, - -SELECTION_MARGIN, - -SELECTION_MARGIN ); + selectionRect.adjust( SELECTION_MARGIN, SELECTION_MARGIN, -SELECTION_MARGIN, -SELECTION_MARGIN ); - painter->drawRoundedRect( selectionRect, - radius - 1, - radius - 1 ); + painter->drawRoundedRect( selectionRect, radius - 1, radius - 1 ); } painter->translate( -0.5, -0.5 ); @@ -210,7 +206,9 @@ PartitionBarsView::drawPartitions( QPainter* painter, const QRect& rect, const Q { PartitionModel* modl = qobject_cast< PartitionModel* >( model() ); if ( !modl ) + { return; + } const int totalWidth = rect.width(); auto pair = computeItemsVector( parent ); @@ -222,29 +220,29 @@ PartitionBarsView::drawPartitions( QPainter* painter, const QRect& rect, const Q const auto& item = items[ row ]; int width; if ( row < items.count() - 1 ) + { width = totalWidth * ( item.size / total ); + } else - // Make sure we fill the last pixel column + // Make sure we fill the last pixel column + { width = rect.right() - x + 1; + } drawSection( painter, rect, x, width, item.index ); - if ( m_nestedPartitionsMode == DrawNestedPartitions && - modl->hasChildren( item.index ) ) + if ( m_nestedPartitionsMode == DrawNestedPartitions && modl->hasChildren( item.index ) ) { - QRect subRect( - x + EXTENDED_PARTITION_MARGIN, - rect.y() + EXTENDED_PARTITION_MARGIN, - width - 2 * EXTENDED_PARTITION_MARGIN, - rect.height() - 2 * EXTENDED_PARTITION_MARGIN - ); + QRect subRect( x + EXTENDED_PARTITION_MARGIN, + rect.y() + EXTENDED_PARTITION_MARGIN, + width - 2 * EXTENDED_PARTITION_MARGIN, + rect.height() - 2 * EXTENDED_PARTITION_MARGIN ); drawPartitions( painter, subRect, item.index ); } x += width; } - if ( !items.count() && - !modl->device()->partitionTable() ) // No disklabel or unknown + if ( !items.count() && !modl->device()->partitionTable() ) // No disklabel or unknown { int width = rect.right() - rect.x() + 1; drawSection( painter, rect, rect.x(), width, QModelIndex() ); @@ -260,13 +258,13 @@ PartitionBarsView::indexAt( const QPoint& point ) const QModelIndex -PartitionBarsView::indexAt( const QPoint &point, - const QRect &rect, - const QModelIndex& parent ) const +PartitionBarsView::indexAt( const QPoint& point, const QRect& rect, const QModelIndex& parent ) const { PartitionModel* modl = qobject_cast< PartitionModel* >( model() ); if ( !modl ) + { return QModelIndex(); + } const int totalWidth = rect.width(); auto pair = computeItemsVector( parent ); @@ -278,23 +276,24 @@ PartitionBarsView::indexAt( const QPoint &point, const auto& item = items[ row ]; int width; if ( row < items.count() - 1 ) + { width = totalWidth * ( item.size / total ); + } else - // Make sure we fill the last pixel column + // Make sure we fill the last pixel column + { width = rect.right() - x + 1; + } QRect thisItemRect( x, rect.y(), width, rect.height() ); if ( thisItemRect.contains( point ) ) { - if ( m_nestedPartitionsMode == DrawNestedPartitions && - modl->hasChildren( item.index ) ) + if ( m_nestedPartitionsMode == DrawNestedPartitions && modl->hasChildren( item.index ) ) { - QRect subRect( - x + EXTENDED_PARTITION_MARGIN, - rect.y() + EXTENDED_PARTITION_MARGIN, - width - 2 * EXTENDED_PARTITION_MARGIN, - rect.height() - 2 * EXTENDED_PARTITION_MARGIN - ); + QRect subRect( x + EXTENDED_PARTITION_MARGIN, + rect.y() + EXTENDED_PARTITION_MARGIN, + width - 2 * EXTENDED_PARTITION_MARGIN, + rect.height() - 2 * EXTENDED_PARTITION_MARGIN ); if ( subRect.contains( point ) ) { @@ -302,7 +301,7 @@ PartitionBarsView::indexAt( const QPoint &point, } return item.index; } - else // contains but no children, we win + else // contains but no children, we win { return item.index; } @@ -322,13 +321,13 @@ PartitionBarsView::visualRect( const QModelIndex& index ) const QRect -PartitionBarsView::visualRect( const QModelIndex& index, - const QRect& rect, - const QModelIndex& parent ) const +PartitionBarsView::visualRect( const QModelIndex& index, const QRect& rect, const QModelIndex& parent ) const { PartitionModel* modl = qobject_cast< PartitionModel* >( model() ); if ( !modl ) + { return QRect(); + } const int totalWidth = rect.width(); auto pair = computeItemsVector( parent ); @@ -340,29 +339,34 @@ PartitionBarsView::visualRect( const QModelIndex& index, const auto& item = items[ row ]; int width; if ( row < items.count() - 1 ) + { width = totalWidth * ( item.size / total ); + } else - // Make sure we fill the last pixel column + // Make sure we fill the last pixel column + { width = rect.right() - x + 1; + } QRect thisItemRect( x, rect.y(), width, rect.height() ); if ( item.index == index ) - return thisItemRect; - - if ( m_nestedPartitionsMode == DrawNestedPartitions && - modl->hasChildren( item.index ) && - index.parent() == item.index ) { - QRect subRect( - x + EXTENDED_PARTITION_MARGIN, - rect.y() + EXTENDED_PARTITION_MARGIN, - width - 2 * EXTENDED_PARTITION_MARGIN, - rect.height() - 2 * EXTENDED_PARTITION_MARGIN - ); + return thisItemRect; + } + + if ( m_nestedPartitionsMode == DrawNestedPartitions && modl->hasChildren( item.index ) + && index.parent() == item.index ) + { + QRect subRect( x + EXTENDED_PARTITION_MARGIN, + rect.y() + EXTENDED_PARTITION_MARGIN, + width - 2 * EXTENDED_PARTITION_MARGIN, + rect.height() - 2 * EXTENDED_PARTITION_MARGIN ); QRect candidateVisualRect = visualRect( index, subRect, item.index ); if ( !candidateVisualRect.isNull() ) + { return candidateVisualRect; + } } x += width; @@ -405,23 +409,18 @@ void PartitionBarsView::setSelectionModel( QItemSelectionModel* selectionModel ) { QAbstractItemView::setSelectionModel( selectionModel ); - connect( selectionModel, &QItemSelectionModel::selectionChanged, - this, [=] - { - viewport()->repaint(); - } ); + connect( selectionModel, &QItemSelectionModel::selectionChanged, this, [=] { viewport()->repaint(); } ); } void -PartitionBarsView::setSelectionFilter( std::function< bool ( const QModelIndex& ) > canBeSelected ) +PartitionBarsView::setSelectionFilter( std::function< bool( const QModelIndex& ) > canBeSelected ) { this->canBeSelected = canBeSelected; } -QModelIndex -PartitionBarsView::moveCursor( CursorAction, Qt::KeyboardModifiers ) +QModelIndex PartitionBarsView::moveCursor( CursorAction, Qt::KeyboardModifiers ) { return QModelIndex(); } @@ -456,7 +455,9 @@ PartitionBarsView::setSelection( const QRect& rect, QItemSelectionModel::Selecti QModelIndex eventIndex = indexAt( QPoint( x2, y2 ) ); if ( canBeSelected( eventIndex ) ) + { selectionModel()->select( eventIndex, flags ); + } viewport()->repaint(); } @@ -480,9 +481,13 @@ PartitionBarsView::mouseMoveEvent( QMouseEvent* event ) if ( oldHoveredIndex != m_hoveredIndex ) { if ( m_hoveredIndex.isValid() && !canBeSelected( m_hoveredIndex ) ) + { QGuiApplication::setOverrideCursor( Qt::ForbiddenCursor ); + } else + { QGuiApplication::restoreOverrideCursor(); + } viewport()->repaint(); } @@ -506,16 +511,20 @@ PartitionBarsView::mousePressEvent( QMouseEvent* event ) { QModelIndex candidateIndex = indexAt( event->pos() ); if ( canBeSelected( candidateIndex ) ) + { QAbstractItemView::mousePressEvent( event ); + } else + { event->accept(); + } } void PartitionBarsView::updateGeometries() { - updateGeometry(); //get a new rect() for redrawing all the labels + updateGeometry(); //get a new rect() for redrawing all the labels } @@ -529,11 +538,9 @@ PartitionBarsView::computeItemsVector( const QModelIndex& parent ) const for ( int row = 0; row < count; ++row ) { QModelIndex index = model()->index( row, 0, parent ); - if ( m_nestedPartitionsMode == NoNestedPartitions && - model()->hasChildren( index ) ) + if ( m_nestedPartitionsMode == NoNestedPartitions && model()->hasChildren( index ) ) { - QPair< QVector< PartitionBarsView::Item >, qreal > childVect = - computeItemsVector( index ); + QPair< QVector< PartitionBarsView::Item >, qreal > childVect = computeItemsVector( index ); items += childVect.first; total += childVect.second; } @@ -552,8 +559,9 @@ PartitionBarsView::computeItemsVector( const QModelIndex& parent ) const qreal adjustedTotal = total; for ( int row = 0; row < count; ++row ) { - if ( items[ row ].size < 0.01 * total ) // If this item is smaller than 1% of everything, - { // force its width to 1%. + if ( items[ row ].size < 0.01 * total ) // If this item is smaller than 1% of everything, + { + // force its width to 1%. adjustedTotal -= items[ row ].size; items[ row ].size = 0.01 * total; adjustedTotal += items[ row ].size; @@ -562,4 +570,3 @@ PartitionBarsView::computeItemsVector( const QModelIndex& parent ) const return qMakePair( items, adjustedTotal ); } - diff --git a/src/modules/partition/gui/PartitionBarsView.h b/src/modules/partition/gui/PartitionBarsView.h index 0d5051b41..1f0100ffa 100644 --- a/src/modules/partition/gui/PartitionBarsView.h +++ b/src/modules/partition/gui/PartitionBarsView.h @@ -1,8 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Aurélien Gâteau - * Copyright 2015-2016, Teo Mrnjavac - * Copyright 2017, Adriaan de Groot + * SPDX-FileCopyrightText: 2014 Aurélien Gâteau + * SPDX-FileCopyrightText: 2015-2016 Teo Mrnjavac + * SPDX-FileCopyrightText: 2017 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/gui/PartitionDialogHelpers.cpp b/src/modules/partition/gui/PartitionDialogHelpers.cpp index 112d12cea..8ab1f38d7 100644 --- a/src/modules/partition/gui/PartitionDialogHelpers.cpp +++ b/src/modules/partition/gui/PartitionDialogHelpers.cpp @@ -1,8 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Aurélien Gâteau - * Copyright 2016, Teo Mrnjavac - * Copyright 2018-2019 Adriaan de Groot + * SPDX-FileCopyrightText: 2014 Aurélien Gâteau + * SPDX-FileCopyrightText: 2016 Teo Mrnjavac + * SPDX-FileCopyrightText: 2018-2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -32,16 +33,18 @@ QStringList standardMountPoints() { - QStringList mountPoints{ "/", "/boot", "/home", "/opt", "/srv", "/usr", "/var" }; + QStringList mountPoints { "/", "/boot", "/home", "/opt", "/srv", "/usr", "/var" }; if ( PartUtils::isEfiSystem() ) + { mountPoints << Calamares::JobQueue::instance()->globalStorage()->value( "efiSystemPartition" ).toString(); + } mountPoints.removeDuplicates(); mountPoints.sort(); return mountPoints; } void -standardMountPoints(QComboBox& combo) +standardMountPoints( QComboBox& combo ) { combo.clear(); combo.addItem( QObject::tr( "(no mount point)" ) ); @@ -49,25 +52,29 @@ standardMountPoints(QComboBox& combo) } void -standardMountPoints(QComboBox& combo, const QString& selected) +standardMountPoints( QComboBox& combo, const QString& selected ) { standardMountPoints( combo ); setSelectedMountPoint( combo, selected ); } QString -selectedMountPoint(QComboBox& combo) +selectedMountPoint( QComboBox& combo ) { if ( combo.currentIndex() == 0 ) + { return QString(); + } return combo.currentText(); } void -setSelectedMountPoint(QComboBox& combo, const QString& selected) +setSelectedMountPoint( QComboBox& combo, const QString& selected ) { if ( selected.isEmpty() ) + { combo.setCurrentIndex( 0 ); // (no mount point) + } else { for ( int i = 0; i < combo.count(); ++i ) @@ -77,7 +84,7 @@ setSelectedMountPoint(QComboBox& combo, const QString& selected) return; } combo.addItem( selected ); - combo.setCurrentIndex( combo.count() - 1); + combo.setCurrentIndex( combo.count() - 1 ); } } @@ -89,8 +96,9 @@ flagsFromList( const QListWidget& list ) for ( int i = 0; i < list.count(); i++ ) if ( list.item( i )->checkState() == Qt::Checked ) - flags |= static_cast< PartitionTable::Flag >( - list.item( i )->data( Qt::UserRole ).toInt() ); + { + flags |= static_cast< PartitionTable::Flag >( list.item( i )->data( Qt::UserRole ).toInt() ); + } return flags; } @@ -108,9 +116,7 @@ setFlagList( QListWidget& list, PartitionTable::Flags available, PartitionTable: list.addItem( item ); item->setFlags( Qt::ItemIsUserCheckable | Qt::ItemIsEnabled ); item->setData( Qt::UserRole, f ); - item->setCheckState( ( checked & f ) ? - Qt::Checked : - Qt::Unchecked ); + item->setCheckState( ( checked & f ) ? Qt::Checked : Qt::Unchecked ); } f <<= 1; diff --git a/src/modules/partition/gui/PartitionDialogHelpers.h b/src/modules/partition/gui/PartitionDialogHelpers.h index 594142993..fd485a690 100644 --- a/src/modules/partition/gui/PartitionDialogHelpers.h +++ b/src/modules/partition/gui/PartitionDialogHelpers.h @@ -1,8 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Aurélien Gâteau - * Copyright 2016, Teo Mrnjavac - * Copyright 2018, Adriaan de Groot + * SPDX-FileCopyrightText: 2014 Aurélien Gâteau + * SPDX-FileCopyrightText: 2016 Teo Mrnjavac + * SPDX-FileCopyrightText: 2018 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -54,10 +55,18 @@ void standardMountPoints( QComboBox&, const QString& selected ); * to blank, to allow easy detection of no-mount-selected. */ QString selectedMountPoint( QComboBox& combo ); -static inline QString selectedMountPoint(QComboBox* combo) { return selectedMountPoint(*combo); } +static inline QString +selectedMountPoint( QComboBox* combo ) +{ + return selectedMountPoint( *combo ); +} void setSelectedMountPoint( QComboBox& combo, const QString& selected ); -static inline void setSelectedMountPoint(QComboBox* combo, const QString& selected) { setSelectedMountPoint( *combo, selected); } +static inline void +setSelectedMountPoint( QComboBox* combo, const QString& selected ) +{ + setSelectedMountPoint( *combo, selected ); +} /** * Get the flags that have been checked in the list widget. diff --git a/src/modules/partition/gui/PartitionLabelsView.cpp b/src/modules/partition/gui/PartitionLabelsView.cpp index 270710e02..e42e9de89 100644 --- a/src/modules/partition/gui/PartitionLabelsView.cpp +++ b/src/modules/partition/gui/PartitionLabelsView.cpp @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Aurélien Gâteau - * Copyright 2015-2016, Teo Mrnjavac + * SPDX-FileCopyrightText: 2014 Aurélien Gâteau + * SPDX-FileCopyrightText: 2015-2016 Teo Mrnjavac + * SPDX-License-Identifier: GPL-3.0-or-later * * 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,8 +20,8 @@ #include "PartitionLabelsView.h" -#include "core/PartitionModel.h" #include "core/ColorUtils.h" +#include "core/PartitionModel.h" #include "utils/CalamaresUtilsGui.h" #include "utils/Logger.h" @@ -39,8 +40,7 @@ using CalamaresUtils::operator""_MiB; static const int LAYOUT_MARGIN = 4; -static const int LABEL_PARTITION_SQUARE_MARGIN = - qMax( QFontMetrics( CalamaresUtils::defaultFont() ).ascent() - 2, 18 ); +static const int LABEL_PARTITION_SQUARE_MARGIN = qMax( QFontMetrics( CalamaresUtils::defaultFont() ).ascent() - 2, 18 ); static const int LABELS_MARGIN = LABEL_PARTITION_SQUARE_MARGIN; static const int CORNER_RADIUS = 2; @@ -63,14 +63,12 @@ PartitionLabelsView::PartitionLabelsView( QWidget* parent ) setFrameStyle( QFrame::NoFrame ); setSelectionBehavior( QAbstractItemView::SelectRows ); setSelectionMode( QAbstractItemView::SingleSelection ); - this->setObjectName("partitionLabel"); + this->setObjectName( "partitionLabel" ); setMouseTracking( true ); } -PartitionLabelsView::~PartitionLabelsView() -{ -} +PartitionLabelsView::~PartitionLabelsView() {} QSize @@ -80,7 +78,6 @@ PartitionLabelsView::minimumSizeHint() const } - QSize PartitionLabelsView::sizeHint() const { @@ -150,7 +147,9 @@ PartitionLabelsView::getIndexesToDraw( const QModelIndex& parent ) const QAbstractItemModel* modl = model(); if ( !modl ) + { return list; + } for ( int row = 0; row < modl->rowCount( parent ); ++row ) { @@ -160,15 +159,21 @@ PartitionLabelsView::getIndexesToDraw( const QModelIndex& parent ) const // To save vertical space, we choose to hide short instances of free space. // Arbitrary limit: 10MiB. const qint64 maxHiddenB = 10_MiB; - if ( index.data( PartitionModel::IsFreeSpaceRole ).toBool() && - index.data( PartitionModel::SizeRole ).toLongLong() < maxHiddenB ) + if ( index.data( PartitionModel::IsFreeSpaceRole ).toBool() + && index.data( PartitionModel::SizeRole ).toLongLong() < maxHiddenB ) + { continue; + } if ( !modl->hasChildren( index ) || !m_extendedPartitionHidden ) + { list.append( index ); + } if ( modl->hasChildren( index ) ) + { list.append( getIndexesToDraw( index ) ); + } } return list; } @@ -189,64 +194,74 @@ PartitionLabelsView::buildTexts( const QModelIndex& index ) const } else { - QString mountPoint = index.sibling( index.row(), - PartitionModel::MountPointColumn ) - .data().toString(); + QString mountPoint = index.sibling( index.row(), PartitionModel::MountPointColumn ).data().toString(); if ( mountPoint == "/" ) - firstLine = m_customNewRootLabel.isEmpty() ? - tr( "Root" ) : - m_customNewRootLabel; + { + firstLine = m_customNewRootLabel.isEmpty() ? tr( "Root" ) : m_customNewRootLabel; + } else if ( mountPoint == "/home" ) + { firstLine = tr( "Home" ); + } else if ( mountPoint == "/boot" ) + { firstLine = tr( "Boot" ); - else if ( mountPoint.contains( "/efi" ) && - index.data( PartitionModel::FileSystemTypeRole ).toInt() == FileSystem::Fat32 ) + } + else if ( mountPoint.contains( "/efi" ) + && index.data( PartitionModel::FileSystemTypeRole ).toInt() == FileSystem::Fat32 ) + { firstLine = tr( "EFI system" ); + } else if ( index.data( PartitionModel::FileSystemTypeRole ).toInt() == FileSystem::LinuxSwap ) + { firstLine = tr( "Swap" ); + } else if ( !mountPoint.isEmpty() ) + { firstLine = tr( "New partition for %1" ).arg( mountPoint ); + } else + { firstLine = tr( "New partition" ); + } } } else if ( index.data( PartitionModel::OsproberNameRole ).toString().isEmpty() ) { firstLine = index.data().toString(); if ( firstLine.startsWith( "/dev/" ) ) - firstLine.remove( 0, 5 ); // "/dev/" + { + firstLine.remove( 0, 5 ); // "/dev/" + } } else + { firstLine = index.data( PartitionModel::OsproberNameRole ).toString(); + } - if ( index.data( PartitionModel::IsFreeSpaceRole ).toBool() || - index.data( PartitionModel::FileSystemTypeRole ).toInt() == FileSystem::Extended ) - secondLine = index.sibling( index.row(), - PartitionModel::SizeColumn ) - .data().toString(); + if ( index.data( PartitionModel::IsFreeSpaceRole ).toBool() + || index.data( PartitionModel::FileSystemTypeRole ).toInt() == FileSystem::Extended ) + { + secondLine = index.sibling( index.row(), PartitionModel::SizeColumn ).data().toString(); + } else //: size[number] filesystem[name] secondLine = tr( "%1 %2" ) - .arg( index.sibling( index.row(), - PartitionModel::SizeColumn ) - .data().toString() ) - .arg( index.sibling( index.row(), - PartitionModel::FileSystemColumn ) - .data().toString() ); + .arg( index.sibling( index.row(), PartitionModel::SizeColumn ).data().toString() ) + .arg( index.sibling( index.row(), PartitionModel::FileSystemColumn ).data().toString() ); return { firstLine, secondLine }; } void -PartitionLabelsView::drawLabels( QPainter* painter, - const QRect& rect, - const QModelIndex& parent ) +PartitionLabelsView::drawLabels( QPainter* painter, const QRect& rect, const QModelIndex& parent ) { PartitionModel* modl = qobject_cast< PartitionModel* >( model() ); if ( !modl ) + { return; + } const QModelIndexList indexesToDraw = getIndexesToDraw( parent ); @@ -260,20 +275,19 @@ PartitionLabelsView::drawLabels( QPainter* painter, QColor labelColor = index.data( Qt::DecorationRole ).value< QColor >(); - if ( label_x + labelSize.width() > rect.width() ) //wrap to new line if overflow + if ( label_x + labelSize.width() > rect.width() ) //wrap to new line if overflow { label_x = rect.x(); label_y += labelSize.height() + labelSize.height() / 4; } // Draw hover - if ( selectionMode() != QAbstractItemView::NoSelection && // no hover without selection - m_hoveredIndex.isValid() && - index == m_hoveredIndex ) + if ( selectionMode() != QAbstractItemView::NoSelection && // no hover without selection + m_hoveredIndex.isValid() && index == m_hoveredIndex ) { painter->save(); QRect labelRect( QPoint( label_x, label_y ), labelSize ); - labelRect.adjust( 0, -LAYOUT_MARGIN, 0, -2*LAYOUT_MARGIN ); + labelRect.adjust( 0, -LAYOUT_MARGIN, 0, -2 * LAYOUT_MARGIN ); painter->translate( 0.5, 0.5 ); QRect hoverRect = labelRect.adjusted( 0, 0, -1, -1 ); painter->setBrush( QPalette().window().color().lighter( 102 ) ); @@ -285,19 +299,15 @@ PartitionLabelsView::drawLabels( QPainter* painter, } // Is this element the selected one? - bool sel = selectionMode() != QAbstractItemView::NoSelection && - index.isValid() && - selectionModel() && - !selectionModel()->selectedIndexes().isEmpty() && - selectionModel()->selectedIndexes().first() == index; + bool sel = selectionMode() != QAbstractItemView::NoSelection && index.isValid() && selectionModel() + && !selectionModel()->selectedIndexes().isEmpty() && selectionModel()->selectedIndexes().first() == index; drawLabel( painter, texts, labelColor, QPoint( label_x, label_y ), sel ); label_x += labelSize.width() + LABELS_MARGIN; } - if ( !modl->rowCount() && - !modl->device()->partitionTable() ) // No disklabel or unknown + if ( !modl->rowCount() && !modl->device()->partitionTable() ) // No disklabel or unknown { QStringList texts = buildUnknownDisklabelTexts( modl->device() ); QColor labelColor = ColorUtils::unknownDisklabelColor(); @@ -311,7 +321,9 @@ PartitionLabelsView::sizeForAllLabels( int maxLineWidth ) const { PartitionModel* modl = qobject_cast< PartitionModel* >( model() ); if ( !modl ) + { return QSize(); + } const QModelIndexList indexesToDraw = getIndexesToDraw( QModelIndex() ); @@ -337,15 +349,12 @@ PartitionLabelsView::sizeForAllLabels( int maxLineWidth ) const singleLabelHeight = qMax( singleLabelHeight, labelSize.height() ); } - if ( !modl->rowCount() && - !modl->device()->partitionTable() ) // Unknown or no disklabel + if ( !modl->rowCount() && !modl->device()->partitionTable() ) // Unknown or no disklabel { - singleLabelHeight = sizeForLabel( buildUnknownDisklabelTexts( modl->device() ) ) - .height(); + singleLabelHeight = sizeForLabel( buildUnknownDisklabelTexts( modl->device() ) ).height(); } - int totalHeight = numLines * singleLabelHeight + - ( numLines - 1 ) * singleLabelHeight / 4; //spacings + int totalHeight = numLines * singleLabelHeight + ( numLines - 1 ) * singleLabelHeight / 4; //spacings return QSize( maxLineWidth, totalHeight ); } @@ -363,7 +372,7 @@ PartitionLabelsView::sizeForLabel( const QStringList& text ) const vertOffset += textSize.height(); width = qMax( width, textSize.width() ); } - width += LABEL_PARTITION_SQUARE_MARGIN; //for the color square + width += LABEL_PARTITION_SQUARE_MARGIN; //for the color square return QSize( width, vertOffset ); } @@ -381,22 +390,21 @@ PartitionLabelsView::drawLabel( QPainter* painter, for ( const QString& textLine : text ) { QSize textSize = painter->fontMetrics().size( Qt::TextSingleLine, textLine ); - painter->drawText( pos.x()+LABEL_PARTITION_SQUARE_MARGIN, - pos.y() + vertOffset + textSize.height() / 2, - textLine ); + painter->drawText( + pos.x() + LABEL_PARTITION_SQUARE_MARGIN, pos.y() + vertOffset + textSize.height() / 2, textLine ); vertOffset += textSize.height(); painter->setPen( Qt::gray ); width = qMax( width, textSize.width() ); } - QRect partitionSquareRect( pos.x(), - pos.y() - 3, - LABEL_PARTITION_SQUARE_MARGIN - 5, - LABEL_PARTITION_SQUARE_MARGIN - 5 ); + QRect partitionSquareRect( + pos.x(), pos.y() - 3, LABEL_PARTITION_SQUARE_MARGIN - 5, LABEL_PARTITION_SQUARE_MARGIN - 5 ); drawPartitionSquare( painter, partitionSquareRect, color ); if ( selected ) + { drawSelectionSquare( painter, partitionSquareRect.adjusted( 2, 2, -2, -2 ), color ); + } painter->setPen( Qt::black ); } @@ -407,7 +415,9 @@ PartitionLabelsView::indexAt( const QPoint& point ) const { PartitionModel* modl = qobject_cast< PartitionModel* >( model() ); if ( !modl ) + { return QModelIndex(); + } const QModelIndexList indexesToDraw = getIndexesToDraw( QModelIndex() ); @@ -420,7 +430,7 @@ PartitionLabelsView::indexAt( const QPoint& point ) const QSize labelSize = sizeForLabel( texts ); - if ( label_x + labelSize.width() > rect.width() ) //wrap to new line if overflow + if ( label_x + labelSize.width() > rect.width() ) //wrap to new line if overflow { label_x = rect.x(); label_y += labelSize.height() + labelSize.height() / 4; @@ -428,7 +438,9 @@ PartitionLabelsView::indexAt( const QPoint& point ) const QRect labelRect( QPoint( label_x, label_y ), labelSize ); if ( labelRect.contains( point ) ) + { return index; + } label_x += labelSize.width() + LABELS_MARGIN; } @@ -442,7 +454,9 @@ PartitionLabelsView::visualRect( const QModelIndex& idx ) const { PartitionModel* modl = qobject_cast< PartitionModel* >( model() ); if ( !modl ) + { return QRect(); + } const QModelIndexList indexesToDraw = getIndexesToDraw( QModelIndex() ); @@ -455,14 +469,16 @@ PartitionLabelsView::visualRect( const QModelIndex& idx ) const QSize labelSize = sizeForLabel( texts ); - if ( label_x + labelSize.width() > rect.width() ) //wrap to new line if overflow + if ( label_x + labelSize.width() > rect.width() ) //wrap to new line if overflow { label_x = rect.x(); label_y += labelSize.height() + labelSize.height() / 4; } if ( idx.isValid() && idx == index ) + { return QRect( QPoint( label_x, label_y ), labelSize ); + } label_x += labelSize.width() + LABELS_MARGIN; } @@ -514,11 +530,7 @@ void PartitionLabelsView::setSelectionModel( QItemSelectionModel* selectionModel ) { QAbstractItemView::setSelectionModel( selectionModel ); - connect( selectionModel, &QItemSelectionModel::selectionChanged, - this, [=] - { - viewport()->repaint(); - } ); + connect( selectionModel, &QItemSelectionModel::selectionChanged, this, [=] { viewport()->repaint(); } ); } @@ -560,7 +572,9 @@ PartitionLabelsView::setSelection( const QRect& rect, QItemSelectionModel::Selec { QModelIndex eventIndex = indexAt( rect.topLeft() ); if ( m_canBeSelected( eventIndex ) ) + { selectionModel()->select( eventIndex, flags ); + } } @@ -582,9 +596,13 @@ PartitionLabelsView::mouseMoveEvent( QMouseEvent* event ) if ( oldHoveredIndex != m_hoveredIndex ) { if ( m_hoveredIndex.isValid() && !m_canBeSelected( m_hoveredIndex ) ) + { QGuiApplication::setOverrideCursor( Qt::ForbiddenCursor ); + } else + { QGuiApplication::restoreOverrideCursor(); + } viewport()->repaint(); } @@ -610,14 +628,18 @@ PartitionLabelsView::mousePressEvent( QMouseEvent* event ) { QModelIndex candidateIndex = indexAt( event->pos() ); if ( m_canBeSelected( candidateIndex ) ) + { QAbstractItemView::mousePressEvent( event ); + } else + { event->accept(); + } } void PartitionLabelsView::updateGeometries() { - updateGeometry(); //get a new rect() for redrawing all the labels + updateGeometry(); //get a new rect() for redrawing all the labels } diff --git a/src/modules/partition/gui/PartitionLabelsView.h b/src/modules/partition/gui/PartitionLabelsView.h index e461a8dd8..45b2b3407 100644 --- a/src/modules/partition/gui/PartitionLabelsView.h +++ b/src/modules/partition/gui/PartitionLabelsView.h @@ -1,8 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Aurélien Gâteau - * Copyright 2015-2016, Teo Mrnjavac - * Copyright 2017, Adriaan de Groot + * SPDX-FileCopyrightText: 2014 Aurélien Gâteau + * SPDX-FileCopyrightText: 2015-2016 Teo Mrnjavac + * SPDX-FileCopyrightText: 2017 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -79,8 +80,7 @@ private: void drawLabels( QPainter* painter, const QRect& rect, const QModelIndex& parent ); QSize sizeForAllLabels( int maxLineWidth ) const; QSize sizeForLabel( const QStringList& text ) const; - void drawLabel( QPainter* painter, const QStringList& text, const QColor& color, - const QPoint& pos , bool selected ); + void drawLabel( QPainter* painter, const QStringList& text, const QColor& color, const QPoint& pos, bool selected ); QModelIndexList getIndexesToDraw( const QModelIndex& parent ) const; QStringList buildTexts( const QModelIndex& index ) const; @@ -91,4 +91,4 @@ private: QPersistentModelIndex m_hoveredIndex; }; -#endif // PARTITIONLABELSVIEW_H +#endif // PARTITIONLABELSVIEW_H diff --git a/src/modules/partition/gui/PartitionPage.cpp b/src/modules/partition/gui/PartitionPage.cpp index d2ad49c23..3b73f061e 100644 --- a/src/modules/partition/gui/PartitionPage.cpp +++ b/src/modules/partition/gui/PartitionPage.cpp @@ -1,11 +1,12 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Aurélien Gâteau - * Copyright 2015-2016, Teo Mrnjavac - * Copyright 2018-2019, Adriaan de Groot - * Copyright 2018, Andrius Štikonas - * Copyright 2018, Caio Jordão Carvalho - * Copyright 2019, Collabora Ltd + * SPDX-FileCopyrightText: 2014 Aurélien Gâteau + * SPDX-FileCopyrightText: 2015-2016 Teo Mrnjavac + * SPDX-FileCopyrightText: 2018-2019 Adriaan de Groot + * SPDX-FileCopyrightText: 2018 Andrius Štikonas + * SPDX-FileCopyrightText: 2018 Caio Jordão Carvalho + * SPDX-FileCopyrightText: 2019 Collabora Ltd + * SPDX-License-Identifier: GPL-3.0-or-later * * 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,19 +27,19 @@ // Local #include "core/BootLoaderModel.h" #include "core/DeviceModel.h" +#include "core/KPMHelpers.h" +#include "core/PartUtils.h" #include "core/PartitionCoreModule.h" #include "core/PartitionInfo.h" #include "core/PartitionModel.h" -#include "core/PartUtils.h" -#include "core/KPMHelpers.h" #include "gui/CreatePartitionDialog.h" #include "gui/CreateVolumeGroupDialog.h" #include "gui/EditExistingPartitionDialog.h" #include "gui/ResizeVolumeGroupDialog.h" #include "gui/ScanningDialog.h" -#include "ui_PartitionPage.h" #include "ui_CreatePartitionTableDialog.h" +#include "ui_PartitionPage.h" #include "GlobalStorage.h" #include "JobQueue.h" @@ -58,34 +59,34 @@ #include // Qt +#include +#include #include #include #include #include -#include -#include #include PartitionPage::PartitionPage( PartitionCoreModule* core, QWidget* parent ) : QWidget( parent ) , m_ui( new Ui_PartitionPage ) , m_core( core ) - , m_lastSelectedBootLoaderIndex(-1) + , m_lastSelectedBootLoaderIndex( -1 ) , m_isEfi( false ) { m_isEfi = PartUtils::isEfiSystem(); m_ui->setupUi( this ); m_ui->partitionLabelsView->setVisible( - Calamares::JobQueue::instance()->globalStorage()-> - value( "alwaysShowPartitionLabels" ).toBool() ); + Calamares::JobQueue::instance()->globalStorage()->value( "alwaysShowPartitionLabels" ).toBool() ); m_ui->deviceComboBox->setModel( m_core->deviceModel() ); m_ui->bootLoaderComboBox->setModel( m_core->bootLoaderModel() ); - connect( m_core->bootLoaderModel(), &QAbstractItemModel::modelReset, this, &PartitionPage::restoreSelectedBootLoader ); - PartitionBarsView::NestedPartitionsMode mode = Calamares::JobQueue::instance()->globalStorage()-> - value( "drawNestedPartitions" ).toBool() ? - PartitionBarsView::DrawNestedPartitions : - PartitionBarsView::NoNestedPartitions; + connect( + m_core->bootLoaderModel(), &QAbstractItemModel::modelReset, this, &PartitionPage::restoreSelectedBootLoader ); + PartitionBarsView::NestedPartitionsMode mode + = Calamares::JobQueue::instance()->globalStorage()->value( "drawNestedPartitions" ).toBool() + ? PartitionBarsView::DrawNestedPartitions + : PartitionBarsView::NoNestedPartitions; m_ui->partitionBarsView->setNestedPartitionsMode( mode ); updateButtons(); updateBootLoaderInstallPath(); @@ -93,23 +94,35 @@ PartitionPage::PartitionPage( PartitionCoreModule* core, QWidget* parent ) updateFromCurrentDevice(); connect( m_ui->deviceComboBox, &QComboBox::currentTextChanged, this, &PartitionPage::updateFromCurrentDevice ); - connect( m_ui->bootLoaderComboBox, QOverload::of(&QComboBox::activated), this, &PartitionPage::updateSelectedBootLoaderIndex ); - connect( m_ui->bootLoaderComboBox, &QComboBox::currentTextChanged, this, &PartitionPage::updateBootLoaderInstallPath ); + connect( m_ui->bootLoaderComboBox, + QOverload< int >::of( &QComboBox::activated ), + this, + &PartitionPage::updateSelectedBootLoaderIndex ); + connect( + m_ui->bootLoaderComboBox, &QComboBox::currentTextChanged, this, &PartitionPage::updateBootLoaderInstallPath ); connect( m_core, &PartitionCoreModule::isDirtyChanged, m_ui->revertButton, &QWidget::setEnabled ); - connect( m_ui->partitionTreeView, &QAbstractItemView::doubleClicked, this, &PartitionPage::onPartitionViewActivated ); + connect( + m_ui->partitionTreeView, &QAbstractItemView::doubleClicked, this, &PartitionPage::onPartitionViewActivated ); connect( m_ui->revertButton, &QAbstractButton::clicked, this, &PartitionPage::onRevertClicked ); connect( m_ui->newVolumeGroupButton, &QAbstractButton::clicked, this, &PartitionPage::onNewVolumeGroupClicked ); - connect( m_ui->resizeVolumeGroupButton, &QAbstractButton::clicked, this, &PartitionPage::onResizeVolumeGroupClicked ); - connect( m_ui->deactivateVolumeGroupButton, &QAbstractButton::clicked, this, &PartitionPage::onDeactivateVolumeGroupClicked ); - connect( m_ui->removeVolumeGroupButton, &QAbstractButton::clicked, this, &PartitionPage::onRemoveVolumeGroupClicked ); - connect( m_ui->newPartitionTableButton, &QAbstractButton::clicked, this, &PartitionPage::onNewPartitionTableClicked ); + connect( + m_ui->resizeVolumeGroupButton, &QAbstractButton::clicked, this, &PartitionPage::onResizeVolumeGroupClicked ); + connect( m_ui->deactivateVolumeGroupButton, + &QAbstractButton::clicked, + this, + &PartitionPage::onDeactivateVolumeGroupClicked ); + connect( + m_ui->removeVolumeGroupButton, &QAbstractButton::clicked, this, &PartitionPage::onRemoveVolumeGroupClicked ); + connect( + m_ui->newPartitionTableButton, &QAbstractButton::clicked, this, &PartitionPage::onNewPartitionTableClicked ); connect( m_ui->createButton, &QAbstractButton::clicked, this, &PartitionPage::onCreateClicked ); connect( m_ui->editButton, &QAbstractButton::clicked, this, &PartitionPage::onEditClicked ); connect( m_ui->deleteButton, &QAbstractButton::clicked, this, &PartitionPage::onDeleteClicked ); - if ( m_isEfi ) { + if ( m_isEfi ) + { m_ui->bootLoaderComboBox->hide(); m_ui->label_3->hide(); } @@ -117,14 +130,13 @@ PartitionPage::PartitionPage( PartitionCoreModule* core, QWidget* parent ) CALAMARES_RETRANSLATE( m_ui->retranslateUi( this ); ) } -PartitionPage::~PartitionPage() -{ -} +PartitionPage::~PartitionPage() {} void PartitionPage::updateButtons() { - bool create = false, createTable = false, edit = false, del = false, currentDeviceIsVG = false, isDeactivable = false; + bool create = false, createTable = false, edit = false, del = false, currentDeviceIsVG = false, + isDeactivable = false; bool isRemovable = false, isVGdeactivated = false; QModelIndex index = m_ui->partitionTreeView->currentIndex(); @@ -157,16 +169,20 @@ PartitionPage::updateButtons() Device* device = nullptr; QModelIndex deviceIndex = m_core->deviceModel()->index( m_ui->deviceComboBox->currentIndex(), 0 ); if ( deviceIndex.isValid() ) + { device = m_core->deviceModel()->deviceForIndex( deviceIndex ); + } if ( !device ) + { cWarning() << "Device for updateButtons is nullptr"; + } else if ( device->type() != Device::Type::LVM_Device ) { createTable = true; #ifdef WITH_KPMCORE4API - if ( device->type() == Device::Type::SoftwareRAID_Device && - static_cast< SoftwareRAID* >(device)->status() == SoftwareRAID::Status::Inactive ) + if ( device->type() == Device::Type::SoftwareRAID_Device + && static_cast< SoftwareRAID* >( device )->status() == SoftwareRAID::Status::Inactive ) { createTable = false; create = false; @@ -177,7 +193,7 @@ PartitionPage::updateButtons() { currentDeviceIsVG = true; - LvmDevice* lvmDevice = dynamic_cast(m_core->deviceModel()->deviceForIndex( deviceIndex )); + LvmDevice* lvmDevice = dynamic_cast< LvmDevice* >( m_core->deviceModel()->deviceForIndex( deviceIndex ) ); isDeactivable = DeactivateVolumeGroupOperation::isDeactivatable( lvmDevice ); isRemovable = RemoveVolumeGroupOperation::isRemovable( lvmDevice ); @@ -185,7 +201,9 @@ PartitionPage::updateButtons() isVGdeactivated = m_core->isVGdeactivated( lvmDevice ); if ( isVGdeactivated ) + { m_ui->revertButton->setEnabled( true ); + } } } @@ -205,14 +223,18 @@ PartitionPage::onNewPartitionTableClicked() Q_ASSERT( index.isValid() ); Device* device = m_core->deviceModel()->deviceForIndex( index ); - QPointer dlg = new QDialog( this ); + QPointer< QDialog > dlg = new QDialog( this ); Ui_CreatePartitionTableDialog ui; ui.setupUi( dlg.data() ); QString areYouSure = tr( "Are you sure you want to create a new partition table on %1?" ).arg( device->name() ); if ( PartUtils::isEfiSystem() ) + { ui.gptRadioButton->setChecked( true ); + } else + { ui.mbrRadioButton->setChecked( true ); + } ui.areYouSureLabel->setText( areYouSure ); if ( dlg->exec() == QDialog::Accepted ) @@ -231,22 +253,27 @@ PartitionPage::checkCanCreate( Device* device ) { auto table = device->partitionTable(); - if ( table->type() == PartitionTable::msdos ||table->type() == PartitionTable::msdos_sectorbased ) + if ( table->type() == PartitionTable::msdos || table->type() == PartitionTable::msdos_sectorbased ) { cDebug() << "Checking MSDOS partition" << table->numPrimaries() << "primaries, max" << table->maxPrimaries(); if ( ( table->numPrimaries() >= table->maxPrimaries() ) && !table->hasExtended() ) { - QMessageBox::warning( this, tr( "Can not create new partition" ), + QMessageBox::warning( + this, + tr( "Can not create new partition" ), tr( "The partition table on %1 already has %2 primary partitions, and no more can be added. " - "Please remove one primary partition and add an extended partition, instead." ).arg( device->name() ).arg( table->numPrimaries() ) - ); + "Please remove one primary partition and add an extended partition, instead." ) + .arg( device->name() ) + .arg( table->numPrimaries() ) ); return false; } return true; } else + { return true; // GPT is fine + } } void @@ -260,13 +287,12 @@ PartitionPage::onNewVolumeGroupClicked() for ( const Partition* p : m_core->lvmPVs() ) if ( !m_core->isInVG( p ) ) + { availablePVs << p; + } - QPointer< CreateVolumeGroupDialog > dlg = new CreateVolumeGroupDialog( vgName, - selectedPVs, - availablePVs, - peSize, - this ); + QPointer< CreateVolumeGroupDialog > dlg + = new CreateVolumeGroupDialog( vgName, selectedPVs, availablePVs, peSize, this ); if ( dlg->exec() == QDialog::Accepted ) { @@ -282,7 +308,9 @@ PartitionPage::onNewVolumeGroupClicked() // Disable delete button if current partition was selected to be in VG // TODO: Should Calamares edit LVM PVs which are in VGs? if ( selectedPVs.contains( partition ) ) + { m_ui->deleteButton->setEnabled( false ); + } } QModelIndex deviceIndex = m_core->deviceModel()->index( m_ui->deviceComboBox->currentIndex(), 0 ); @@ -297,7 +325,7 @@ PartitionPage::onNewVolumeGroupClicked() // is needed to set the current index in deviceComboBox as the previous one int previousIndex = m_ui->deviceComboBox->findData( previousIndexDeviceData, Qt::ToolTipRole ); - m_ui->deviceComboBox->setCurrentIndex( ( previousIndex < 0 ) ? 0 : previousIndex ); + m_ui->deviceComboBox->setCurrentIndex( ( previousIndex < 0 ) ? 0 : previousIndex ); updateFromCurrentDevice(); } @@ -317,15 +345,16 @@ PartitionPage::onResizeVolumeGroupClicked() for ( const Partition* p : m_core->lvmPVs() ) if ( !m_core->isInVG( p ) ) + { availablePVs << p; + } - QPointer< ResizeVolumeGroupDialog > dlg = new ResizeVolumeGroupDialog( device, - availablePVs, - selectedPVs, - this ); + QPointer< ResizeVolumeGroupDialog > dlg = new ResizeVolumeGroupDialog( device, availablePVs, selectedPVs, this ); if ( dlg->exec() == QDialog::Accepted ) + { m_core->resizeVolumeGroup( device, selectedPVs ); + } delete dlg; } @@ -368,14 +397,11 @@ PartitionPage::onCreateClicked() Q_ASSERT( partition ); if ( !checkCanCreate( model->device() ) ) + { return; + } - CreatePartitionDialog dlg( - model->device(), - partition->parent(), - nullptr, - getCurrentUsedMountpoints(), - this ); + CreatePartitionDialog dlg( model->device(), partition->parent(), nullptr, getCurrentUsedMountpoints(), this ); dlg.initFromFreeSpace( partition ); if ( dlg.exec() == QDialog::Accepted ) { @@ -395,10 +421,13 @@ PartitionPage::onEditClicked() Q_ASSERT( partition ); if ( CalamaresUtils::Partition::isPartitionNew( partition ) ) + { updatePartitionToCreate( model->device(), partition ); + } else + { editExistingPartition( model->device(), partition ); - + } } void @@ -419,18 +448,18 @@ void PartitionPage::onRevertClicked() { ScanningDialog::run( - QtConcurrent::run( [ this ] - { + QtConcurrent::run( [this] { QMutexLocker locker( &m_revertMutex ); int oldIndex = m_ui->deviceComboBox->currentIndex(); m_core->revertAllDevices(); - m_ui->deviceComboBox->setCurrentIndex( ( oldIndex < 0 ) ? 0 : oldIndex ); + m_ui->deviceComboBox->setCurrentIndex( ( oldIndex < 0 ) ? 0 : oldIndex ); updateFromCurrentDevice(); } ), - [ this ]{ + [this] { m_lastSelectedBootLoaderIndex = -1; - if( m_ui->bootLoaderComboBox->currentIndex() < 0 ) { + if ( m_ui->bootLoaderComboBox->currentIndex() < 0 ) + { m_ui->bootLoaderComboBox->setCurrentIndex( 0 ); } }, @@ -442,7 +471,9 @@ PartitionPage::onPartitionViewActivated() { QModelIndex index = m_ui->partitionTreeView->currentIndex(); if ( !index.isValid() ) + { return; + } const PartitionModel* model = static_cast< const PartitionModel* >( index.model() ); Q_ASSERT( model ); @@ -455,9 +486,13 @@ PartitionPage::onPartitionViewActivated() // action from multiple UI elements in this page, so it does not feel worth // the price. if ( CalamaresUtils::Partition::isPartitionFreeSpace( partition ) ) + { m_ui->createButton->click(); + } else + { m_ui->editButton->click(); + } } void @@ -466,11 +501,8 @@ PartitionPage::updatePartitionToCreate( Device* device, Partition* partition ) QStringList mountPoints = getCurrentUsedMountpoints(); mountPoints.removeOne( PartitionInfo::mountPoint( partition ) ); - QPointer< CreatePartitionDialog > dlg = new CreatePartitionDialog( device, - partition->parent(), - partition, - mountPoints, - this ); + QPointer< CreatePartitionDialog > dlg + = new CreatePartitionDialog( device, partition->parent(), partition, mountPoints, this ); dlg->initFromPartitionToCreate( partition ); if ( dlg->exec() == QDialog::Accepted ) { @@ -487,9 +519,12 @@ PartitionPage::editExistingPartition( Device* device, Partition* partition ) QStringList mountPoints = getCurrentUsedMountpoints(); mountPoints.removeOne( PartitionInfo::mountPoint( partition ) ); - QPointer dlg = new EditExistingPartitionDialog( device, partition, mountPoints, this ); + QPointer< EditExistingPartitionDialog > dlg + = new EditExistingPartitionDialog( device, partition, mountPoints, this ); if ( dlg->exec() == QDialog::Accepted ) + { dlg->applyChanges( m_core ); + } delete dlg; } @@ -497,11 +532,15 @@ void PartitionPage::updateBootLoaderInstallPath() { if ( m_isEfi || !m_ui->bootLoaderComboBox->isVisible() ) + { return; + } QVariant var = m_ui->bootLoaderComboBox->currentData( BootLoaderModel::BootLoaderPathRole ); if ( !var.isValid() ) + { return; + } cDebug() << "PartitionPage::updateBootLoaderInstallPath" << var.toString(); m_core->setBootLoaderInstallPath( var.toString() ); } @@ -516,7 +555,7 @@ PartitionPage::updateSelectedBootLoaderIndex() void PartitionPage::restoreSelectedBootLoader() { - Calamares::restoreSelectedBootLoader( *(m_ui->bootLoaderComboBox), m_core->bootLoaderInstallPath() ); + Calamares::restoreSelectedBootLoader( *( m_ui->bootLoaderComboBox ), m_core->bootLoaderInstallPath() ); } @@ -525,13 +564,17 @@ PartitionPage::updateFromCurrentDevice() { QModelIndex index = m_core->deviceModel()->index( m_ui->deviceComboBox->currentIndex(), 0 ); if ( !index.isValid() ) + { return; + } Device* device = m_core->deviceModel()->deviceForIndex( index ); QAbstractItemModel* oldModel = m_ui->partitionTreeView->model(); if ( oldModel ) + { disconnect( oldModel, nullptr, this, nullptr ); + } PartitionModel* model = m_core->partitionModelForDevice( device ); m_ui->partitionBarsView->setModel( model ); @@ -540,10 +583,8 @@ PartitionPage::updateFromCurrentDevice() m_ui->partitionTreeView->expandAll(); // Make all views use the same selection model. - if ( m_ui->partitionBarsView->selectionModel() != - m_ui->partitionTreeView->selectionModel() || - m_ui->partitionBarsView->selectionModel() != - m_ui->partitionLabelsView->selectionModel() ) + if ( m_ui->partitionBarsView->selectionModel() != m_ui->partitionTreeView->selectionModel() + || m_ui->partitionBarsView->selectionModel() != m_ui->partitionLabelsView->selectionModel() ) { // Tree view QItemSelectionModel* selectionModel = m_ui->partitionTreeView->selectionModel(); @@ -559,14 +600,17 @@ PartitionPage::updateFromCurrentDevice() // This is necessary because even with the same selection model it might happen that // a !=0 column is selected in the tree view, which for some reason doesn't trigger a // timely repaint in the bars view. - connect( m_ui->partitionBarsView->selectionModel(), &QItemSelectionModel::currentChanged, - this, [=] - { - QModelIndex selectedIndex = m_ui->partitionBarsView->selectionModel()->currentIndex(); - selectedIndex = selectedIndex.sibling( selectedIndex.row(), 0 ); - m_ui->partitionBarsView->setCurrentIndex( selectedIndex ); - m_ui->partitionLabelsView->setCurrentIndex( selectedIndex ); - }, Qt::UniqueConnection ); + connect( + m_ui->partitionBarsView->selectionModel(), + &QItemSelectionModel::currentChanged, + this, + [=] { + QModelIndex selectedIndex = m_ui->partitionBarsView->selectionModel()->currentIndex(); + selectedIndex = selectedIndex.sibling( selectedIndex.row(), 0 ); + m_ui->partitionBarsView->setCurrentIndex( selectedIndex ); + m_ui->partitionLabelsView->setCurrentIndex( selectedIndex ); + }, + Qt::UniqueConnection ); // Must be done here because we need to have a model set to define // individual column resize mode @@ -577,11 +621,9 @@ PartitionPage::updateFromCurrentDevice() updateButtons(); // Establish connection here because selection model is destroyed when // model changes - connect( m_ui->partitionTreeView->selectionModel(), &QItemSelectionModel::currentChanged, - [ this ]( const QModelIndex&, const QModelIndex& ) - { - updateButtons(); - } ); + connect( m_ui->partitionTreeView->selectionModel(), + &QItemSelectionModel::currentChanged, + [this]( const QModelIndex&, const QModelIndex& ) { updateButtons(); } ); connect( model, &QAbstractItemModel::modelReset, this, &PartitionPage::onPartitionModelReset ); } @@ -597,7 +639,8 @@ void PartitionPage::updateBootLoaderIndex() { // set bootloader back to user selected index - if ( m_lastSelectedBootLoaderIndex >= 0 && m_ui->bootLoaderComboBox->count() ) { + if ( m_lastSelectedBootLoaderIndex >= 0 && m_ui->bootLoaderComboBox->count() ) + { m_ui->bootLoaderComboBox->setCurrentIndex( m_lastSelectedBootLoaderIndex ); } } @@ -605,10 +648,11 @@ PartitionPage::updateBootLoaderIndex() QStringList PartitionPage::getCurrentUsedMountpoints() { - QModelIndex index = m_core->deviceModel()->index( - m_ui->deviceComboBox->currentIndex(), 0 ); + QModelIndex index = m_core->deviceModel()->index( m_ui->deviceComboBox->currentIndex(), 0 ); if ( !index.isValid() ) + { return QStringList(); + } Device* device = m_core->deviceModel()->deviceForIndex( index ); QStringList mountPoints; @@ -617,7 +661,9 @@ PartitionPage::getCurrentUsedMountpoints() { const QString& mountPoint = PartitionInfo::mountPoint( partition ); if ( !mountPoint.isEmpty() ) + { mountPoints << mountPoint; + } } return mountPoints; @@ -630,7 +676,7 @@ PartitionPage::selectedDeviceIndex() } void -PartitionPage::selectDeviceByIndex ( int index ) +PartitionPage::selectDeviceByIndex( int index ) { - m_ui->deviceComboBox->setCurrentIndex( index ); + m_ui->deviceComboBox->setCurrentIndex( index ); } diff --git a/src/modules/partition/gui/PartitionPage.h b/src/modules/partition/gui/PartitionPage.h index e8a96a4cf..d23879e15 100644 --- a/src/modules/partition/gui/PartitionPage.h +++ b/src/modules/partition/gui/PartitionPage.h @@ -1,8 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Aurélien Gâteau - * Copyright 2018-2019, Adriaan de Groot - * Copyright 2019, Collabora Ltd + * SPDX-FileCopyrightText: 2014 Aurélien Gâteau + * SPDX-FileCopyrightText: 2018-2019 Adriaan de Groot + * SPDX-FileCopyrightText: 2019 Collabora Ltd + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,9 +22,9 @@ #ifndef PARTITIONPAGE_H #define PARTITIONPAGE_H -#include -#include #include +#include +#include class PartitionCoreModule; class Ui_PartitionPage; @@ -90,8 +91,8 @@ private: QStringList getCurrentUsedMountpoints(); QMutex m_revertMutex; - int m_lastSelectedBootLoaderIndex; - bool m_isEfi; + int m_lastSelectedBootLoaderIndex; + bool m_isEfi; }; -#endif // PARTITIONPAGE_H +#endif // PARTITIONPAGE_H diff --git a/src/modules/partition/gui/PartitionSizeController.cpp b/src/modules/partition/gui/PartitionSizeController.cpp index 39879dab9..aefc13992 100644 --- a/src/modules/partition/gui/PartitionSizeController.cpp +++ b/src/modules/partition/gui/PartitionSizeController.cpp @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Aurélien Gâteau - * Copyright 2016, Teo Mrnjavac + * SPDX-FileCopyrightText: 2014 Aurélien Gâteau + * SPDX-FileCopyrightText: 2016 Teo Mrnjavac + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -36,7 +37,8 @@ PartitionSizeController::PartitionSizeController( QObject* parent ) : QObject( parent ) -{} +{ +} void PartitionSizeController::init( Device* device, Partition* partition, const QColor& color ) @@ -58,7 +60,9 @@ PartitionSizeController::setPartResizerWidget( PartResizerWidget* widget, bool f Q_ASSERT( m_device ); if ( m_partResizerWidget ) + { disconnect( m_partResizerWidget, nullptr, this, nullptr ); + } m_dirty = false; m_currentSpinBoxValue = -1; @@ -108,7 +112,9 @@ void PartitionSizeController::setSpinBox( QSpinBox* spinBox ) { if ( m_spinBox ) + { disconnect( m_spinBox, nullptr, this, nullptr ); + } m_spinBox = spinBox; m_spinBox->setMaximum( std::numeric_limits< int >::max() ); connectWidgets(); @@ -118,7 +124,9 @@ void PartitionSizeController::connectWidgets() { if ( !m_spinBox || !m_partResizerWidget ) + { return; + } connect( m_spinBox, SIGNAL( editingFinished() ), SLOT( updatePartResizerWidget() ) ); connect( m_partResizerWidget, SIGNAL( firstSectorChanged( qint64 ) ), SLOT( updateSpinBox() ) ); @@ -132,9 +140,13 @@ void PartitionSizeController::updatePartResizerWidget() { if ( m_updating ) + { return; + } if ( m_spinBox->value() == m_currentSpinBoxValue ) + { return; + } m_updating = true; qint64 sectorSize = qint64( m_spinBox->value() ) * 1024 * 1024 / m_device->logicalSize(); @@ -148,8 +160,7 @@ PartitionSizeController::updatePartResizerWidget() } void -PartitionSizeController::doAlignAndUpdatePartResizerWidget( qint64 firstSector, - qint64 lastSector ) +PartitionSizeController::doAlignAndUpdatePartResizerWidget( qint64 firstSector, qint64 lastSector ) { if ( lastSector > m_partResizerWidget->maximumLastSector() ) { @@ -176,7 +187,9 @@ void PartitionSizeController::updateSpinBox() { if ( m_updating ) + { return; + } m_updating = true; doUpdateSpinBox(); m_updating = false; @@ -186,12 +199,16 @@ void PartitionSizeController::doUpdateSpinBox() { if ( !m_spinBox ) + { return; + } int mbSize = CalamaresUtils::BytesToMiB( m_partition->length() * m_device->logicalSize() ); m_spinBox->setValue( mbSize ); - if ( m_currentSpinBoxValue != -1 && //if it's not the first time we're setting it - m_currentSpinBoxValue != mbSize ) //and the operation changes the SB value + if ( m_currentSpinBoxValue != -1 && //if it's not the first time we're setting it + m_currentSpinBoxValue != mbSize ) //and the operation changes the SB value + { m_dirty = true; + } m_currentSpinBoxValue = mbSize; } diff --git a/src/modules/partition/gui/PartitionSizeController.h b/src/modules/partition/gui/PartitionSizeController.h index 7337968f5..1353404c5 100644 --- a/src/modules/partition/gui/PartitionSizeController.h +++ b/src/modules/partition/gui/PartitionSizeController.h @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Aurélien Gâteau - * Copyright 2016, Teo Mrnjavac + * SPDX-FileCopyrightText: 2014 Aurélien Gâteau + * SPDX-FileCopyrightText: 2016 Teo Mrnjavac + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/gui/PartitionSplitterWidget.cpp b/src/modules/partition/gui/PartitionSplitterWidget.cpp index b8a8017ab..08543756c 100644 --- a/src/modules/partition/gui/PartitionSplitterWidget.cpp +++ b/src/modules/partition/gui/PartitionSplitterWidget.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2016, Teo Mrnjavac + * SPDX-FileCopyrightText: 2014-2016 Teo Mrnjavac + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/gui/PartitionSplitterWidget.h b/src/modules/partition/gui/PartitionSplitterWidget.h index ed4f0d112..36bd96559 100644 --- a/src/modules/partition/gui/PartitionSplitterWidget.h +++ b/src/modules/partition/gui/PartitionSplitterWidget.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2016, Teo Mrnjavac + * SPDX-FileCopyrightText: 2014-2016 Teo Mrnjavac + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -57,10 +58,7 @@ public: void init( Device* dev, bool drawNestedPartitions ); - void setSplitPartition( const QString& path, - qint64 minSize, - qint64 maxSize, - qint64 preferredSize ); + void setSplitPartition( const QString& path, qint64 minSize, qint64 maxSize, qint64 preferredSize ); qint64 splitPartitionSize() const; qint64 newPartitionSize() const; @@ -80,20 +78,15 @@ protected: private: void setupItems( const QVector< PartitionSplitterItem >& items ); - void drawPartitions( QPainter* painter, - const QRect& rect, - const QVector< PartitionSplitterItem >& itemList ); - void drawSection( QPainter* painter, const QRect& rect_, int x, int width, - const PartitionSplitterItem& item ); - void drawResizeHandle( QPainter* painter, - const QRect& rect_, - int x ); + void drawPartitions( QPainter* painter, const QRect& rect, const QVector< PartitionSplitterItem >& itemList ); + void drawSection( QPainter* painter, const QRect& rect_, int x, int width, const PartitionSplitterItem& item ); + void drawResizeHandle( QPainter* painter, const QRect& rect_, int x ); PartitionSplitterItem _findItem( QVector< PartitionSplitterItem >& items, - std::function< bool ( PartitionSplitterItem& ) > condition ) const; + std::function< bool( PartitionSplitterItem& ) > condition ) const; int _eachItem( QVector< PartitionSplitterItem >& items, - std::function< bool ( PartitionSplitterItem& ) > operation ) const; + std::function< bool( PartitionSplitterItem& ) > operation ) const; QPair< QVector< PartitionSplitterItem >, qreal > computeItemsVector( const QVector< PartitionSplitterItem >& originalItems ) const; @@ -114,4 +107,4 @@ private: bool m_drawNestedPartitions; }; -#endif // PARTITIONSPLITTERWIDGET_H +#endif // PARTITIONSPLITTERWIDGET_H diff --git a/src/modules/partition/gui/PartitionViewSelectionFilter.h b/src/modules/partition/gui/PartitionViewSelectionFilter.h index 75572a5bb..078999f31 100644 --- a/src/modules/partition/gui/PartitionViewSelectionFilter.h +++ b/src/modules/partition/gui/PartitionViewSelectionFilter.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2016, Teo Mrnjavac + * SPDX-FileCopyrightText: 2016 Teo Mrnjavac + * SPDX-License-Identifier: GPL-3.0-or-later * * 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,4 +26,4 @@ typedef std::function< bool( const QModelIndex& ) > SelectionFilter; -#endif // PARTITIONVIEWSELECTIONFILTER_H +#endif // PARTITIONVIEWSELECTIONFILTER_H diff --git a/src/modules/partition/gui/PartitionViewStep.cpp b/src/modules/partition/gui/PartitionViewStep.cpp index c05ed3177..59f117b26 100644 --- a/src/modules/partition/gui/PartitionViewStep.cpp +++ b/src/modules/partition/gui/PartitionViewStep.cpp @@ -1,10 +1,11 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Aurélien Gâteau - * Copyright 2014-2017, Teo Mrnjavac - * Copyright 2018-2019, 2020, Adriaan de Groot - * Copyright 2019, Collabora Ltd - * Copyright 2020, Anke Boersma + * SPDX-FileCopyrightText: 2014-2017 Teo Mrnjavac + * SPDX-FileCopyrightText: 2018-2019 2020, Adriaan de Groot + * SPDX-FileCopyrightText: 2019 Collabora Ltd + * SPDX-FileCopyrightText: 2020 Anke Boersma shortVersionedName() ); break; case ChoicePage::InstallChoice::Erase: - modeText - = tr( "Erase disk and install %1." ).arg( branding->shortVersionedName() ); + modeText = tr( "Erase disk and install %1." ).arg( branding->shortVersionedName() ); break; case ChoicePage::InstallChoice::Replace: - modeText - = tr( "Replace a partition with %1." ).arg( branding->shortVersionedName() ); + modeText = tr( "Replace a partition with %1." ).arg( branding->shortVersionedName() ); break; case ChoicePage::InstallChoice::NoChoice: case ChoicePage::InstallChoice::Manual: @@ -259,7 +258,8 @@ PartitionViewStep::createSummaryWidget() const previewLabels->setModel( info.partitionModelAfter ); preview->setSelectionMode( QAbstractItemView::NoSelection ); previewLabels->setSelectionMode( QAbstractItemView::NoSelection ); - previewLabels->setCustomNewRootLabel( Calamares::Branding::instance()->string( Calamares::Branding::BootloaderEntryName )); + previewLabels->setCustomNewRootLabel( + Calamares::Branding::instance()->string( Calamares::Branding::BootloaderEntryName ) ); info.partitionModelAfter->setParent( widget ); field = new QVBoxLayout; CalamaresUtils::unmarginLayout( field ); @@ -350,7 +350,7 @@ PartitionViewStep::isNextEnabled() const } void -PartitionViewStep::nextPossiblyChanged(bool) +PartitionViewStep::nextPossiblyChanged( bool ) { emit nextStatusChanged( isNextEnabled() ); } @@ -378,7 +378,8 @@ PartitionViewStep::isAtEnd() const { if ( m_widget->currentWidget() == m_choicePage ) { - if ( m_choicePage->currentChoice() == ChoicePage::InstallChoice::Erase || m_choicePage->currentChoice() == ChoicePage::InstallChoice::Replace + if ( m_choicePage->currentChoice() == ChoicePage::InstallChoice::Erase + || m_choicePage->currentChoice() == ChoicePage::InstallChoice::Replace || m_choicePage->currentChoice() == ChoicePage::InstallChoice::Alongside ) { return true; @@ -395,7 +396,8 @@ PartitionViewStep::onActivate() m_config->updateGlobalStorage(); // if we're coming back to PVS from the next VS - if ( m_widget->currentWidget() == m_choicePage && m_choicePage->currentChoice() == ChoicePage::InstallChoice::Alongside ) + if ( m_widget->currentWidget() == m_choicePage + && m_choicePage->currentChoice() == ChoicePage::InstallChoice::Alongside ) { m_choicePage->applyActionChoice( ChoicePage::InstallChoice::Alongside ); // m_choicePage->reset(); @@ -475,17 +477,17 @@ PartitionViewStep::onLeave() QString message = tr( "Option to use GPT on BIOS" ); QString description = tr( "A GPT partition table is the best option for all " - "systems. This installer supports such a setup for " - "BIOS systems too." - "

" - "To configure a GPT partition table on BIOS, " - "(if not done so already) go back " - "and set the partition table to GPT, next create a 8 MB " - "unformatted partition with the " - "bios_grub flag enabled.

" - "An unformatted 8 MB partition is necessary " - "to start %1 on a BIOS system with GPT." ) - .arg( branding->shortProductName() ); + "systems. This installer supports such a setup for " + "BIOS systems too." + "

" + "To configure a GPT partition table on BIOS, " + "(if not done so already) go back " + "and set the partition table to GPT, next create a 8 MB " + "unformatted partition with the " + "bios_grub flag enabled.

" + "An unformatted 8 MB partition is necessary " + "to start %1 on a BIOS system with GPT." ) + .arg( branding->shortProductName() ); QMessageBox::information( m_manualPartitionPage, message, description ); } diff --git a/src/modules/partition/gui/PartitionViewStep.h b/src/modules/partition/gui/PartitionViewStep.h index 1b0baf142..da1ec5255 100644 --- a/src/modules/partition/gui/PartitionViewStep.h +++ b/src/modules/partition/gui/PartitionViewStep.h @@ -1,8 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Aurélien Gâteau - * Copyright 2014-2016, Teo Mrnjavac - * Copyright 2017, Adriaan de Groot + * SPDX-FileCopyrightText: 2014 Aurélien Gâteau + * SPDX-FileCopyrightText: 2014-2016 Teo Mrnjavac + * SPDX-FileCopyrightText: 2017 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -36,7 +37,8 @@ class PartitionCoreModule; class QStackedWidget; class WaitingWidget; -template class QFutureWatcher; +template < typename T > +class QFutureWatcher; /** * The starting point of the module. Instantiates PartitionCoreModule, @@ -83,14 +85,14 @@ private: Config* m_config; PartitionCoreModule* m_core; - QStackedWidget* m_widget; - ChoicePage* m_choicePage; - PartitionPage* m_manualPartitionPage; + QStackedWidget* m_widget; + ChoicePage* m_choicePage; + PartitionPage* m_manualPartitionPage; WaitingWidget* m_waitingWidget; - QFutureWatcher* m_future; + QFutureWatcher< void >* m_future; }; CALAMARES_PLUGIN_FACTORY_DECLARATION( PartitionViewStepFactory ) -#endif // PARTITIONVIEWSTEP_H +#endif // PARTITIONVIEWSTEP_H diff --git a/src/modules/partition/gui/ReplaceWidget.cpp b/src/modules/partition/gui/ReplaceWidget.cpp index 8594a3e15..6c4d800dd 100644 --- a/src/modules/partition/gui/ReplaceWidget.cpp +++ b/src/modules/partition/gui/ReplaceWidget.cpp @@ -1,8 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2015, Teo Mrnjavac - * Copyright 2014, Aurélien Gâteau - * Copyright 2019-2020, Adriaan de Groot + * SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac + * SPDX-FileCopyrightText: 2014 Aurélien Gâteau + * SPDX-FileCopyrightText: 2019-2020 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,8 +23,8 @@ #include "ui_ReplaceWidget.h" #include "core/DeviceModel.h" -#include "core/PartitionCoreModule.h" #include "core/PartitionActions.h" +#include "core/PartitionCoreModule.h" #include "core/PartitionInfo.h" #include "Branding.h" @@ -41,9 +42,7 @@ using CalamaresUtils::Partition::untranslatedFS; using CalamaresUtils::Partition::userVisibleFS; -ReplaceWidget::ReplaceWidget( PartitionCoreModule* core, - QComboBox* devicesComboBox, - QWidget* parent ) +ReplaceWidget::ReplaceWidget( PartitionCoreModule* core, QComboBox* devicesComboBox, QWidget* parent ) : QWidget( parent ) , m_ui( new Ui_ReplaceWidget ) , m_core( core ) @@ -57,20 +56,15 @@ ReplaceWidget::ReplaceWidget( PartitionCoreModule* core, m_ui->bootStatusLabel->clear(); updateFromCurrentDevice( devicesComboBox ); - connect( devicesComboBox, &QComboBox::currentTextChanged, - this, [=]( const QString& /* text */ ) - { + connect( devicesComboBox, &QComboBox::currentTextChanged, this, [=]( const QString& /* text */ ) { updateFromCurrentDevice( devicesComboBox ); } ); - CALAMARES_RETRANSLATE( - onPartitionSelected(); - ) + CALAMARES_RETRANSLATE( onPartitionSelected(); ) } -ReplaceWidget::~ReplaceWidget() -{} +ReplaceWidget::~ReplaceWidget() {} bool @@ -101,23 +95,20 @@ ReplaceWidget::applyChanges() Device* dev = model->device(); PartitionActions::doReplacePartition( - m_core, dev, partition, - { gs->value( "defaultFileSystemType" ).toString(), QString() } ); + m_core, dev, partition, { gs->value( "defaultFileSystemType" ).toString(), QString() } ); if ( m_isEfi ) { QList< Partition* > efiSystemPartitions = m_core->efiSystemPartitions(); if ( efiSystemPartitions.count() == 1 ) { - PartitionInfo::setMountPoint( - efiSystemPartitions.first(), - gs->value( "efiSystemPartition" ).toString() ); + PartitionInfo::setMountPoint( efiSystemPartitions.first(), + gs->value( "efiSystemPartition" ).toString() ); } else if ( efiSystemPartitions.count() > 1 ) { - PartitionInfo::setMountPoint( - efiSystemPartitions.at( m_ui->bootComboBox->currentIndex() ), - gs->value( "efiSystemPartition" ).toString() ); + PartitionInfo::setMountPoint( efiSystemPartitions.at( m_ui->bootComboBox->currentIndex() ), + gs->value( "efiSystemPartition" ).toString() ); } } @@ -131,7 +122,9 @@ void ReplaceWidget::onPartitionSelected() { if ( Calamares::JobQueue::instance()->globalStorage()->value( "firmwareType" ) == "efi" ) + { m_isEfi = true; + } const auto* branding = Calamares::Branding::instance(); if ( m_ui->partitionTreeView->currentIndex() == QModelIndex() ) @@ -146,24 +139,20 @@ ReplaceWidget::onPartitionSelected() } bool ok = false; - double requiredSpaceB = Calamares::JobQueue::instance() - ->globalStorage() - ->value( "requiredStorageGiB" ) - .toDouble( &ok ) * 1024 * 1024 * 1024; + double requiredSpaceB + = Calamares::JobQueue::instance()->globalStorage()->value( "requiredStorageGiB" ).toDouble( &ok ) * 1024 * 1024 + * 1024; PartitionModel* model = qobject_cast< PartitionModel* >( m_ui->partitionTreeView->model() ); if ( model && ok ) { - const QStringList osproberLines = Calamares::JobQueue::instance() - ->globalStorage() - ->value( "osproberLines" ).toStringList(); + const QStringList osproberLines + = Calamares::JobQueue::instance()->globalStorage()->value( "osproberLines" ).toStringList(); Partition* partition = model->partitionForIndex( m_ui->partitionTreeView->currentIndex() ); - if ( !partition || - partition->state() != KPM_PARTITION_STATE(None) ) + if ( !partition || partition->state() != KPM_PARTITION_STATE( None ) ) { - updateStatus( CalamaresUtils::Fail, - tr( "The selected item does not appear to be a valid partition." ) ); + updateStatus( CalamaresUtils::Fail, tr( "The selected item does not appear to be a valid partition." ) ); setNextEnabled( false ); return; } @@ -173,7 +162,7 @@ ReplaceWidget::onPartitionSelected() updateStatus( CalamaresUtils::Fail, tr( "%1 cannot be installed on empty space. Please select an " "existing partition." ) - .arg( branding->versionedName() ) ); + .arg( branding->versionedName() ) ); setNextEnabled( false ); return; } @@ -183,7 +172,7 @@ ReplaceWidget::onPartitionSelected() updateStatus( CalamaresUtils::Fail, tr( "%1 cannot be installed on an extended partition. Please select an " "existing primary or logical partition." ) - .arg( branding->versionedName() ) ); + .arg( branding->versionedName() ) ); setNextEnabled( false ); return; } @@ -191,8 +180,7 @@ ReplaceWidget::onPartitionSelected() if ( partition->partitionPath().isEmpty() ) { updateStatus( CalamaresUtils::Fail, - tr( "%1 cannot be installed on this partition." ) - .arg( branding->versionedName() ) ); + tr( "%1 cannot be installed on this partition." ).arg( branding->versionedName() ) ); setNextEnabled( false ); return; } @@ -208,20 +196,23 @@ ReplaceWidget::onPartitionSelected() { QString osName; if ( !lineColumns.value( 1 ).simplified().isEmpty() ) + { osName = lineColumns.value( 1 ).simplified(); + } else if ( !lineColumns.value( 2 ).simplified().isEmpty() ) + { osName = lineColumns.value( 2 ).simplified(); + } if ( osName.isEmpty() ) { - prettyName = tr( "Unknown system partition (%1)" ) - .arg( fsNameForUser ); + prettyName = tr( "Unknown system partition (%1)" ).arg( fsNameForUser ); } else { - prettyName = tr ( "%1 system partition (%2)" ) - .arg( osName.replace( 0, 1, osName.at( 0 ).toUpper() ) ) - .arg( fsNameForUser ); + prettyName = tr( "%1 system partition (%2)" ) + .arg( osName.replace( 0, 1, osName.at( 0 ).toUpper() ) ) + .arg( fsNameForUser ); } break; } @@ -233,11 +224,10 @@ ReplaceWidget::onPartitionSelected() tr( "%4

" "The partition %1 is too small for %2. Please select a partition " "with capacity at least %3 GiB." ) - .arg( partition->partitionPath() ) - .arg( branding->versionedName() ) - .arg( requiredSpaceB / ( 1024. * 1024. * 1024. ), - 0, 'f', 1 ) - .arg( prettyName ) ); + .arg( partition->partitionPath() ) + .arg( branding->versionedName() ) + .arg( requiredSpaceB / ( 1024. * 1024. * 1024. ), 0, 'f', 1 ) + .arg( prettyName ) ); setNextEnabled( false ); return; } @@ -257,8 +247,8 @@ ReplaceWidget::onPartitionSelected() "An EFI system partition cannot be found anywhere " "on this system. Please go back and use manual " "partitioning to set up %1." ) - .arg( branding->shortProductName() ) - .arg( prettyName ) ); + .arg( branding->shortProductName() ) + .arg( prettyName ) ); setNextEnabled( false ); } else if ( efiSystemPartitions.count() == 1 ) @@ -267,15 +257,14 @@ ReplaceWidget::onPartitionSelected() tr( "%3

" "%1 will be installed on %2.
" "Warning: all data on partition " - "%2 will be lost.") - .arg( branding->versionedName() ) - .arg( partition->partitionPath() ) - .arg( prettyName ) ); + "%2 will be lost." ) + .arg( branding->versionedName() ) + .arg( partition->partitionPath() ) + .arg( prettyName ) ); m_ui->bootStatusLabel->show(); - m_ui->bootStatusLabel->setText( - tr( "The EFI system partition at %1 will be used for starting %2." ) - .arg( efiSystemPartitions.first()->partitionPath() ) - .arg( branding->shortProductName() ) ); + m_ui->bootStatusLabel->setText( tr( "The EFI system partition at %1 will be used for starting %2." ) + .arg( efiSystemPartitions.first()->partitionPath() ) + .arg( branding->shortProductName() ) ); setNextEnabled( true ); } else @@ -284,10 +273,10 @@ ReplaceWidget::onPartitionSelected() tr( "%3

" "%1 will be installed on %2.
" "Warning: all data on partition " - "%2 will be lost.") - .arg( branding->versionedName() ) - .arg( partition->partitionPath() ) - .arg( prettyName ) ); + "%2 will be lost." ) + .arg( branding->versionedName() ) + .arg( partition->partitionPath() ) + .arg( prettyName ) ); m_ui->bootStatusLabel->show(); m_ui->bootStatusLabel->setText( tr( "EFI system partition:" ) ); m_ui->bootComboBox->show(); @@ -295,9 +284,10 @@ ReplaceWidget::onPartitionSelected() { Partition* efiPartition = efiSystemPartitions.at( i ); m_ui->bootComboBox->addItem( efiPartition->partitionPath(), i ); - if ( efiPartition->devicePath() == partition->devicePath() && - efiPartition->number() == 1 ) + if ( efiPartition->devicePath() == partition->devicePath() && efiPartition->number() == 1 ) + { m_ui->bootComboBox->setCurrentIndex( i ); + } } setNextEnabled( true ); } @@ -308,10 +298,10 @@ ReplaceWidget::onPartitionSelected() tr( "%3

" "%1 will be installed on %2.
" "Warning: all data on partition " - "%2 will be lost.") - .arg( branding->versionedName() ) - .arg( partition->partitionPath() ) - .arg( prettyName ) ); + "%2 will be lost." ) + .arg( branding->versionedName() ) + .arg( partition->partitionPath() ) + .arg( prettyName ) ); setNextEnabled( true ); } } @@ -322,7 +312,9 @@ void ReplaceWidget::setNextEnabled( bool enabled ) { if ( enabled == m_nextEnabled ) + { return; + } m_nextEnabled = enabled; emit nextStatusChanged( enabled ); @@ -333,27 +325,29 @@ void ReplaceWidget::updateStatus( CalamaresUtils::ImageType imageType, const QString& text ) { int iconSize = CalamaresUtils::defaultFontHeight() * 6; - m_ui->selectedIconLabel->setPixmap( CalamaresUtils::defaultPixmap( imageType, - CalamaresUtils::Original, - QSize( iconSize, iconSize ) ) ); + m_ui->selectedIconLabel->setPixmap( + CalamaresUtils::defaultPixmap( imageType, CalamaresUtils::Original, QSize( iconSize, iconSize ) ) ); m_ui->selectedIconLabel->setFixedHeight( iconSize ); m_ui->selectedStatusLabel->setText( text ); } - void ReplaceWidget::updateFromCurrentDevice( QComboBox* devicesComboBox ) { QModelIndex index = m_core->deviceModel()->index( devicesComboBox->currentIndex(), 0 ); if ( !index.isValid() ) + { return; + } Device* device = m_core->deviceModel()->deviceForIndex( index ); QAbstractItemModel* oldModel = m_ui->partitionTreeView->model(); if ( oldModel ) + { disconnect( oldModel, nullptr, this, nullptr ); + } PartitionModel* model = m_core->partitionModelForDevice( device ); m_ui->partitionTreeView->setModel( model ); @@ -368,8 +362,10 @@ ReplaceWidget::updateFromCurrentDevice( QComboBox* devicesComboBox ) //updateButtons(); // Establish connection here because selection model is destroyed when // model changes - connect( m_ui->partitionTreeView->selectionModel(), &QItemSelectionModel::currentRowChanged, - this, &ReplaceWidget::onPartitionViewActivated ); + connect( m_ui->partitionTreeView->selectionModel(), + &QItemSelectionModel::currentRowChanged, + this, + &ReplaceWidget::onPartitionViewActivated ); connect( model, &QAbstractItemModel::modelReset, this, &ReplaceWidget::onPartitionModelReset ); } @@ -380,7 +376,9 @@ ReplaceWidget::onPartitionViewActivated() { QModelIndex index = m_ui->partitionTreeView->currentIndex(); if ( !index.isValid() ) + { return; + } const PartitionModel* model = static_cast< const PartitionModel* >( index.model() ); Q_ASSERT( model ); diff --git a/src/modules/partition/gui/ReplaceWidget.h b/src/modules/partition/gui/ReplaceWidget.h index c09c604b1..e30b57bb3 100644 --- a/src/modules/partition/gui/ReplaceWidget.h +++ b/src/modules/partition/gui/ReplaceWidget.h @@ -1,8 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2015, Teo Mrnjavac - * Copyright 2014, Aurélien Gâteau - * Copyright 2018, Adriaan de Groot + * SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac + * SPDX-FileCopyrightText: 2014 Aurélien Gâteau + * SPDX-FileCopyrightText: 2018 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * 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,8 +24,8 @@ #include "utils/CalamaresUtilsGui.h" -#include #include +#include class Ui_ReplaceWidget; class QComboBox; @@ -35,9 +36,7 @@ class ReplaceWidget : public QWidget { Q_OBJECT public: - explicit ReplaceWidget( PartitionCoreModule* core, - QComboBox* devicesComboBox, - QWidget* parent = nullptr ); + explicit ReplaceWidget( PartitionCoreModule* core, QComboBox* devicesComboBox, QWidget* parent = nullptr ); virtual ~ReplaceWidget(); bool isNextEnabled() const; @@ -69,4 +68,4 @@ private: void onPartitionModelReset(); }; -#endif // REPLACEWIDGET_H +#endif // REPLACEWIDGET_H diff --git a/src/modules/partition/gui/ResizeVolumeGroupDialog.cpp b/src/modules/partition/gui/ResizeVolumeGroupDialog.cpp index 2de999360..1aae5f49b 100644 --- a/src/modules/partition/gui/ResizeVolumeGroupDialog.cpp +++ b/src/modules/partition/gui/ResizeVolumeGroupDialog.cpp @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2018, Caio Jordão Carvalho - * Copyright 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2018 Caio Jordão Carvalho + * SPDX-FileCopyrightText: 2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,7 +30,7 @@ #include #include -ResizeVolumeGroupDialog::ResizeVolumeGroupDialog( LvmDevice *device, +ResizeVolumeGroupDialog::ResizeVolumeGroupDialog( LvmDevice* device, const PartitionVector& availablePVs, PartitionVector& selectedPVs, QWidget* parent ) @@ -39,12 +40,17 @@ ResizeVolumeGroupDialog::ResizeVolumeGroupDialog( LvmDevice *device, setWindowTitle( tr( "Resize Volume Group" ) ); for ( int i = 0; i < pvList()->count(); i++ ) - pvList()->item(i)->setCheckState( Qt::Checked ); + { + pvList()->item( i )->setCheckState( Qt::Checked ); + } for ( const Partition* p : availablePVs ) + { pvList()->addItem( new ListPhysicalVolumeWidgetItem( p, false ) ); + } - peSize()->setValue( static_cast( device->peSize() / Capacity::unitFactor(Capacity::Unit::Byte, Capacity::Unit::MiB) ) ); + peSize()->setValue( + static_cast< int >( device->peSize() / Capacity::unitFactor( Capacity::Unit::Byte, Capacity::Unit::MiB ) ) ); vgName()->setEnabled( false ); peSize()->setEnabled( false ); diff --git a/src/modules/partition/gui/ResizeVolumeGroupDialog.h b/src/modules/partition/gui/ResizeVolumeGroupDialog.h index bc088de4d..af5a29ae6 100644 --- a/src/modules/partition/gui/ResizeVolumeGroupDialog.h +++ b/src/modules/partition/gui/ResizeVolumeGroupDialog.h @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2018, Caio Jordão Carvalho - * Copyright 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2018 Caio Jordão Carvalho + * SPDX-FileCopyrightText: 2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,7 +31,7 @@ class ResizeVolumeGroupDialog : public VolumeGroupBaseDialog public: using PartitionVector = QVector< const Partition* >; - ResizeVolumeGroupDialog( LvmDevice *device, + ResizeVolumeGroupDialog( LvmDevice* device, const PartitionVector& availablePVs, PartitionVector& selectedPVs, QWidget* parent ); @@ -41,4 +42,4 @@ private: PartitionVector& m_selectedPVs; }; -#endif // RESIZEVOLUMEGROUPDIALOG_H +#endif // RESIZEVOLUMEGROUPDIALOG_H diff --git a/src/modules/partition/gui/ScanningDialog.cpp b/src/modules/partition/gui/ScanningDialog.cpp index 85479fbb3..5099484d9 100644 --- a/src/modules/partition/gui/ScanningDialog.cpp +++ b/src/modules/partition/gui/ScanningDialog.cpp @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2015, Teo Mrnjavac - * Copyright 2017, Adriaan de Groot + * SPDX-FileCopyrightText: 2015 Teo Mrnjavac + * SPDX-FileCopyrightText: 2017 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,14 +23,12 @@ #include "3rdparty/waitingspinnerwidget.h" #include -#include #include +#include #include -ScanningDialog::ScanningDialog( const QString& text, - const QString& windowTitle, - QWidget* parent ) +ScanningDialog::ScanningDialog( const QString& text, const QString& windowTitle, QWidget* parent ) : QDialog( parent ) { setModal( true ); @@ -42,8 +41,7 @@ ScanningDialog::ScanningDialog( const QString& text, dialogLayout->addWidget( spinner ); spinner->start(); - QLabel* rescanningLabel = new QLabel( text, - this ); + QLabel* rescanningLabel = new QLabel( text, this ); dialogLayout->addWidget( rescanningLabel ); } @@ -55,16 +53,11 @@ ScanningDialog::run( const QFuture< void >& future, const std::function< void() >& callback, QWidget* parent ) { - ScanningDialog* theDialog = - new ScanningDialog( text, - windowTitle, - parent ); + ScanningDialog* theDialog = new ScanningDialog( text, windowTitle, parent ); theDialog->show(); QFutureWatcher< void >* watcher = new QFutureWatcher< void >(); - connect( watcher, &QFutureWatcher< void >::finished, - theDialog, [ watcher, theDialog, callback ] - { + connect( watcher, &QFutureWatcher< void >::finished, theDialog, [watcher, theDialog, callback] { watcher->deleteLater(); theDialog->hide(); theDialog->deleteLater(); @@ -76,18 +69,13 @@ ScanningDialog::run( const QFuture< void >& future, void -ScanningDialog::run( const QFuture< void >& future, - const std::function< void() >& callback, - QWidget* parent ) +ScanningDialog::run( const QFuture< void >& future, const std::function< void() >& callback, QWidget* parent ) { - ScanningDialog::run( future, - tr( "Scanning storage devices..." ), - tr( "Partitioning" ), - callback, - parent ); + ScanningDialog::run( future, tr( "Scanning storage devices..." ), tr( "Partitioning" ), callback, parent ); } -void ScanningDialog::setVisible(bool visible) +void +ScanningDialog::setVisible( bool visible ) { QDialog::setVisible( visible ); emit visibilityChanged(); diff --git a/src/modules/partition/gui/ScanningDialog.h b/src/modules/partition/gui/ScanningDialog.h index 4f5254590..25cd36227 100644 --- a/src/modules/partition/gui/ScanningDialog.h +++ b/src/modules/partition/gui/ScanningDialog.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2015, Teo Mrnjavac + * SPDX-FileCopyrightText: 2015 Teo Mrnjavac + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,19 +29,19 @@ class ScanningDialog : public QDialog { Q_OBJECT public: - explicit ScanningDialog( const QString& text, - const QString& windowTitle, - QWidget* parent = nullptr ); + explicit ScanningDialog( const QString& text, const QString& windowTitle, QWidget* parent = nullptr ); - static void run( const QFuture< void >& future, - const QString& text, - const QString& windowTitle, - const std::function< void() >& callback = []{}, - QWidget* parent = nullptr ); + static void run( + const QFuture< void >& future, + const QString& text, + const QString& windowTitle, + const std::function< void() >& callback = [] {}, + QWidget* parent = nullptr ); - static void run( const QFuture< void >& future, - const std::function< void() >& callback = []{}, - QWidget* parent = nullptr ); + static void run( + const QFuture< void >& future, + const std::function< void() >& callback = [] {}, + QWidget* parent = nullptr ); public slots: void setVisible( bool visible ) override; @@ -49,4 +50,4 @@ signals: void visibilityChanged(); }; -#endif // SCANNINGDIALOG_H +#endif // SCANNINGDIALOG_H diff --git a/src/modules/partition/gui/VolumeGroupBaseDialog.cpp b/src/modules/partition/gui/VolumeGroupBaseDialog.cpp index 8078253b3..95aa75ac2 100644 --- a/src/modules/partition/gui/VolumeGroupBaseDialog.cpp +++ b/src/modules/partition/gui/VolumeGroupBaseDialog.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2018, Caio Jordão Carvalho + * SPDX-FileCopyrightText: 2018 Caio Jordão Carvalho + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,46 +31,42 @@ #include #include -VolumeGroupBaseDialog::VolumeGroupBaseDialog( QString& vgName, - QVector< const Partition* > pvList, - QWidget *parent ) - : QDialog(parent) - , ui(new Ui::VolumeGroupBaseDialog) - , m_vgNameValue(vgName) - , m_totalSizeValue(0) - , m_usedSizeValue(0) +VolumeGroupBaseDialog::VolumeGroupBaseDialog( QString& vgName, QVector< const Partition* > pvList, QWidget* parent ) + : QDialog( parent ) + , ui( new Ui::VolumeGroupBaseDialog ) + , m_vgNameValue( vgName ) + , m_totalSizeValue( 0 ) + , m_usedSizeValue( 0 ) { - ui->setupUi(this); + ui->setupUi( this ); for ( const Partition* p : pvList ) + { ui->pvList->addItem( new ListPhysicalVolumeWidgetItem( p, false ) ); + } - ui->vgType->addItems( QStringList() << "LVM" << "RAID" ); - ui->vgType->setCurrentIndex(0); + ui->vgType->addItems( QStringList() << "LVM" + << "RAID" ); + ui->vgType->setCurrentIndex( 0 ); - QRegularExpression re(R"(^(?!_|\.)[\w\-.+]+)"); + QRegularExpression re( R"(^(?!_|\.)[\w\-.+]+)" ); ui->vgName->setValidator( new QRegularExpressionValidator( re, this ) ); ui->vgName->setText( m_vgNameValue ); updateOkButton(); updateTotalSize(); - connect( ui->pvList, &QListWidget::itemChanged, this, - [&](QListWidgetItem*) { - updateTotalSize(); - updateOkButton(); - } ); + connect( ui->pvList, &QListWidget::itemChanged, this, [&]( QListWidgetItem* ) { + updateTotalSize(); + updateOkButton(); + } ); - connect( ui->peSize, qOverload(&QSpinBox::valueChanged), this, - [&](int) { - updateTotalSectors(); - updateOkButton(); - }); + connect( ui->peSize, qOverload< int >( &QSpinBox::valueChanged ), this, [&]( int ) { + updateTotalSectors(); + updateOkButton(); + } ); - connect( ui->vgName, &QLineEdit::textChanged, this, - [&](const QString&) { - updateOkButton(); - }); + connect( ui->vgName, &QLineEdit::textChanged, this, [&]( const QString& ) { updateOkButton(); } ); } VolumeGroupBaseDialog::~VolumeGroupBaseDialog() @@ -82,11 +79,14 @@ VolumeGroupBaseDialog::checkedItems() const { QVector< const Partition* > items; - for ( int i = 0; i < ui->pvList->count(); i++) { - ListPhysicalVolumeWidgetItem* item = dynamic_cast< ListPhysicalVolumeWidgetItem* >( ui->pvList->item(i) ); + for ( int i = 0; i < ui->pvList->count(); i++ ) + { + ListPhysicalVolumeWidgetItem* item = dynamic_cast< ListPhysicalVolumeWidgetItem* >( ui->pvList->item( i ) ); if ( item && item->checkState() == Qt::Checked ) + { items << item->partition(); + } } return items; @@ -101,10 +101,8 @@ VolumeGroupBaseDialog::isSizeValid() const void VolumeGroupBaseDialog::updateOkButton() { - okButton()->setEnabled(isSizeValid() && - !checkedItems().empty() && - !ui->vgName->text().isEmpty() && - ui->peSize->value() > 0); + okButton()->setEnabled( isSizeValid() && !checkedItems().empty() && !ui->vgName->text().isEmpty() + && ui->peSize->value() > 0 ); } void @@ -112,7 +110,7 @@ VolumeGroupBaseDialog::setUsedSizeValue( qint64 usedSize ) { m_usedSizeValue = usedSize; - ui->usedSize->setText( Capacity::formatByteSize(m_usedSizeValue) ); + ui->usedSize->setText( Capacity::formatByteSize( m_usedSizeValue ) ); } void @@ -126,10 +124,14 @@ VolumeGroupBaseDialog::updateTotalSize() { m_totalSizeValue = 0; - for ( const Partition *p : checkedItems()) - m_totalSizeValue += p->capacity() - p->capacity() % (ui->peSize->value() * Capacity::unitFactor(Capacity::Unit::Byte, Capacity::Unit::MiB)); + for ( const Partition* p : checkedItems() ) + { + m_totalSizeValue += p->capacity() + - p->capacity() + % ( ui->peSize->value() * Capacity::unitFactor( Capacity::Unit::Byte, Capacity::Unit::MiB ) ); + } - ui->totalSize->setText(Capacity::formatByteSize(m_totalSizeValue)); + ui->totalSize->setText( Capacity::formatByteSize( m_totalSizeValue ) ); updateTotalSectors(); } @@ -139,10 +141,12 @@ VolumeGroupBaseDialog::updateTotalSectors() { qint64 totalSectors = 0; - qint64 extentSize = ui->peSize->value() * Capacity::unitFactor(Capacity::Unit::Byte, Capacity::Unit::MiB); + qint64 extentSize = ui->peSize->value() * Capacity::unitFactor( Capacity::Unit::Byte, Capacity::Unit::MiB ); if ( extentSize > 0 ) + { totalSectors = m_totalSizeValue / extentSize; + } ui->totalSectors->setText( QString::number( totalSectors ) ); } diff --git a/src/modules/partition/gui/VolumeGroupBaseDialog.h b/src/modules/partition/gui/VolumeGroupBaseDialog.h index e6011ce62..7c7b43e48 100644 --- a/src/modules/partition/gui/VolumeGroupBaseDialog.h +++ b/src/modules/partition/gui/VolumeGroupBaseDialog.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2018, Caio Jordão Carvalho + * SPDX-FileCopyrightText: 2018 Caio Jordão Carvalho + * SPDX-License-Identifier: GPL-3.0-or-later * * 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 -namespace Ui { +namespace Ui +{ class VolumeGroupBaseDialog; } @@ -37,9 +39,7 @@ class VolumeGroupBaseDialog : public QDialog Q_OBJECT public: - explicit VolumeGroupBaseDialog( QString& vgName, - QVector< const Partition* > pvList, - QWidget* parent = nullptr ); + explicit VolumeGroupBaseDialog( QString& vgName, QVector< const Partition* > pvList, QWidget* parent = nullptr ); ~VolumeGroupBaseDialog(); protected: @@ -78,4 +78,4 @@ private: qint64 m_usedSizeValue; }; -#endif // VOLUMEGROUPBASEDIALOG_H +#endif // VOLUMEGROUPBASEDIALOG_H diff --git a/src/modules/partition/jobs/ClearMountsJob.cpp b/src/modules/partition/jobs/ClearMountsJob.cpp index 29f00ebd2..c51a784c1 100644 --- a/src/modules/partition/jobs/ClearMountsJob.cpp +++ b/src/modules/partition/jobs/ClearMountsJob.cpp @@ -1,8 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2015, Teo Mrnjavac - * Copyright 2018, Adriaan de Groot - * Copyright 2019, Kevin Kofler + * SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac + * SPDX-FileCopyrightText: 2018 Adriaan de Groot + * SPDX-FileCopyrightText: 2019 Kevin Kofler + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/jobs/ClearMountsJob.h b/src/modules/partition/jobs/ClearMountsJob.h index 2accc652d..7d9df270a 100644 --- a/src/modules/partition/jobs/ClearMountsJob.h +++ b/src/modules/partition/jobs/ClearMountsJob.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2015, Teo Mrnjavac + * SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/jobs/ClearTempMountsJob.cpp b/src/modules/partition/jobs/ClearTempMountsJob.cpp index cf2c71f0c..36b83f56c 100644 --- a/src/modules/partition/jobs/ClearTempMountsJob.cpp +++ b/src/modules/partition/jobs/ClearTempMountsJob.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2015, Teo Mrnjavac + * SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/jobs/ClearTempMountsJob.h b/src/modules/partition/jobs/ClearTempMountsJob.h index 433cfd8ad..6f29f197c 100644 --- a/src/modules/partition/jobs/ClearTempMountsJob.h +++ b/src/modules/partition/jobs/ClearTempMountsJob.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2015, Teo Mrnjavac + * SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/jobs/CreatePartitionJob.cpp b/src/modules/partition/jobs/CreatePartitionJob.cpp index fd322a94e..ac61518f8 100644 --- a/src/modules/partition/jobs/CreatePartitionJob.cpp +++ b/src/modules/partition/jobs/CreatePartitionJob.cpp @@ -1,8 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Aurélien Gâteau - * Copyright 2015, Teo Mrnjavac - * Copyright 2017, 2020, Adriaan de Groot + * SPDX-FileCopyrightText: 2014 Aurélien Gâteau + * SPDX-FileCopyrightText: 2015 Teo Mrnjavac + * SPDX-FileCopyrightText: 2017 2020, Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/jobs/CreatePartitionJob.h b/src/modules/partition/jobs/CreatePartitionJob.h index f315e24fb..b11874fad 100644 --- a/src/modules/partition/jobs/CreatePartitionJob.h +++ b/src/modules/partition/jobs/CreatePartitionJob.h @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Aurélien Gâteau - * Copyright 2015, Teo Mrnjavac + * SPDX-FileCopyrightText: 2014 Aurélien Gâteau + * SPDX-FileCopyrightText: 2015 Teo Mrnjavac + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/jobs/CreatePartitionTableJob.cpp b/src/modules/partition/jobs/CreatePartitionTableJob.cpp index 79675c324..a585c094a 100644 --- a/src/modules/partition/jobs/CreatePartitionTableJob.cpp +++ b/src/modules/partition/jobs/CreatePartitionTableJob.cpp @@ -1,8 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Aurélien Gâteau - * Copyright 2015, Teo Mrnjavac - * Copyright 2017, Adriaan de Groot + * SPDX-FileCopyrightText: 2014 Aurélien Gâteau + * SPDX-FileCopyrightText: 2015 Teo Mrnjavac + * SPDX-FileCopyrightText: 2017 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/jobs/CreatePartitionTableJob.h b/src/modules/partition/jobs/CreatePartitionTableJob.h index e0ed6f918..02f23d169 100644 --- a/src/modules/partition/jobs/CreatePartitionTableJob.h +++ b/src/modules/partition/jobs/CreatePartitionTableJob.h @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Aurélien Gâteau - * Copyright 2015, Teo Mrnjavac + * SPDX-FileCopyrightText: 2014 Aurélien Gâteau + * SPDX-FileCopyrightText: 2015 Teo Mrnjavac + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/jobs/CreateVolumeGroupJob.cpp b/src/modules/partition/jobs/CreateVolumeGroupJob.cpp index 28a08f5ad..6d9c9d6e0 100644 --- a/src/modules/partition/jobs/CreateVolumeGroupJob.cpp +++ b/src/modules/partition/jobs/CreateVolumeGroupJob.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2018, Caio Jordão Carvalho + * SPDX-FileCopyrightText: 2018 Caio Jordão Carvalho + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/jobs/CreateVolumeGroupJob.h b/src/modules/partition/jobs/CreateVolumeGroupJob.h index 9ed5e24e2..0e73c52fa 100644 --- a/src/modules/partition/jobs/CreateVolumeGroupJob.h +++ b/src/modules/partition/jobs/CreateVolumeGroupJob.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2018, Caio Jordão Carvalho + * SPDX-FileCopyrightText: 2018 Caio Jordão Carvalho + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/jobs/DeactivateVolumeGroupJob.cpp b/src/modules/partition/jobs/DeactivateVolumeGroupJob.cpp index 77df64e3d..3adce640c 100644 --- a/src/modules/partition/jobs/DeactivateVolumeGroupJob.cpp +++ b/src/modules/partition/jobs/DeactivateVolumeGroupJob.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2018, Caio Jordão Carvalho + * SPDX-FileCopyrightText: 2018 Caio Jordão Carvalho + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/jobs/DeactivateVolumeGroupJob.h b/src/modules/partition/jobs/DeactivateVolumeGroupJob.h index 7b1c9c473..13b60069e 100644 --- a/src/modules/partition/jobs/DeactivateVolumeGroupJob.h +++ b/src/modules/partition/jobs/DeactivateVolumeGroupJob.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2018, Caio Jordão Carvalho + * SPDX-FileCopyrightText: 2018 Caio Jordão Carvalho + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/jobs/DeletePartitionJob.cpp b/src/modules/partition/jobs/DeletePartitionJob.cpp index 9b2d4f37d..8a9fedce2 100644 --- a/src/modules/partition/jobs/DeletePartitionJob.cpp +++ b/src/modules/partition/jobs/DeletePartitionJob.cpp @@ -1,8 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Aurélien Gâteau - * Copyright 2015, Teo Mrnjavac - * Copyright 2017, Adriaan de Groot + * SPDX-FileCopyrightText: 2014 Aurélien Gâteau + * SPDX-FileCopyrightText: 2015 Teo Mrnjavac + * SPDX-FileCopyrightText: 2017 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/jobs/DeletePartitionJob.h b/src/modules/partition/jobs/DeletePartitionJob.h index f68a4ea8f..5a0332bf4 100644 --- a/src/modules/partition/jobs/DeletePartitionJob.h +++ b/src/modules/partition/jobs/DeletePartitionJob.h @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Aurélien Gâteau - * Copyright 2015, Teo Mrnjavac + * SPDX-FileCopyrightText: 2014 Aurélien Gâteau + * SPDX-FileCopyrightText: 2015 Teo Mrnjavac + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/jobs/FillGlobalStorageJob.cpp b/src/modules/partition/jobs/FillGlobalStorageJob.cpp index e3f696bbc..a0b229d45 100644 --- a/src/modules/partition/jobs/FillGlobalStorageJob.cpp +++ b/src/modules/partition/jobs/FillGlobalStorageJob.cpp @@ -1,8 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Aurélien Gâteau - * Copyright 2015-2016, Teo Mrnjavac - * Copyright 2017, 2019-2020, Adriaan de Groot + * SPDX-FileCopyrightText: 2014 Aurélien Gâteau + * SPDX-FileCopyrightText: 2015-2016 Teo Mrnjavac + * SPDX-FileCopyrightText: 2017 2019-2020, Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/jobs/FillGlobalStorageJob.h b/src/modules/partition/jobs/FillGlobalStorageJob.h index e3850da37..823f64f2f 100644 --- a/src/modules/partition/jobs/FillGlobalStorageJob.h +++ b/src/modules/partition/jobs/FillGlobalStorageJob.h @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Aurélien Gâteau - * Copyright 2015, Teo Mrnjavac + * SPDX-FileCopyrightText: 2014 Aurélien Gâteau + * SPDX-FileCopyrightText: 2015 Teo Mrnjavac + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/jobs/FormatPartitionJob.cpp b/src/modules/partition/jobs/FormatPartitionJob.cpp index 45e851baf..d12c89022 100644 --- a/src/modules/partition/jobs/FormatPartitionJob.cpp +++ b/src/modules/partition/jobs/FormatPartitionJob.cpp @@ -1,8 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Aurélien Gâteau - * Copyright 2015-2016, Teo Mrnjavac - * Copyright 2020, Adriaan de Groot + * SPDX-FileCopyrightText: 2014 Aurélien Gâteau + * SPDX-FileCopyrightText: 2015-2016 Teo Mrnjavac + * SPDX-FileCopyrightText: 2020 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/jobs/FormatPartitionJob.h b/src/modules/partition/jobs/FormatPartitionJob.h index 2031efc78..f3a721187 100644 --- a/src/modules/partition/jobs/FormatPartitionJob.h +++ b/src/modules/partition/jobs/FormatPartitionJob.h @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Aurélien Gâteau - * Copyright 2015, Teo Mrnjavac + * SPDX-FileCopyrightText: 2014 Aurélien Gâteau + * SPDX-FileCopyrightText: 2015 Teo Mrnjavac + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/jobs/PartitionJob.cpp b/src/modules/partition/jobs/PartitionJob.cpp index 6b8dc9034..de96ef950 100644 --- a/src/modules/partition/jobs/PartitionJob.cpp +++ b/src/modules/partition/jobs/PartitionJob.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Aurélien Gâteau + * SPDX-FileCopyrightText: 2014 Aurélien Gâteau + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/jobs/PartitionJob.h b/src/modules/partition/jobs/PartitionJob.h index eef6aaa4c..66b9704a1 100644 --- a/src/modules/partition/jobs/PartitionJob.h +++ b/src/modules/partition/jobs/PartitionJob.h @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Aurélien Gâteau - * Copyright 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2014 Aurélien Gâteau + * SPDX-FileCopyrightText: 2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/jobs/RemoveVolumeGroupJob.cpp b/src/modules/partition/jobs/RemoveVolumeGroupJob.cpp index ed8353e72..7c4b2ea31 100644 --- a/src/modules/partition/jobs/RemoveVolumeGroupJob.cpp +++ b/src/modules/partition/jobs/RemoveVolumeGroupJob.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2018, Caio Jordão Carvalho + * SPDX-FileCopyrightText: 2018 Caio Jordão Carvalho + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/jobs/RemoveVolumeGroupJob.h b/src/modules/partition/jobs/RemoveVolumeGroupJob.h index 0a52a837e..06ed2ab2a 100644 --- a/src/modules/partition/jobs/RemoveVolumeGroupJob.h +++ b/src/modules/partition/jobs/RemoveVolumeGroupJob.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2018, Caio Jordão Carvalho + * SPDX-FileCopyrightText: 2018 Caio Jordão Carvalho + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/jobs/ResizePartitionJob.cpp b/src/modules/partition/jobs/ResizePartitionJob.cpp index 9ebd4ce7e..c71078dc1 100644 --- a/src/modules/partition/jobs/ResizePartitionJob.cpp +++ b/src/modules/partition/jobs/ResizePartitionJob.cpp @@ -1,8 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Aurélien Gâteau - * Copyright 2015, Teo Mrnjavac - * Copyright 2017, Andrius Štikonas + * SPDX-FileCopyrightText: 2014 Aurélien Gâteau + * SPDX-FileCopyrightText: 2015 Teo Mrnjavac + * SPDX-FileCopyrightText: 2017 Andrius Štikonas + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/jobs/ResizePartitionJob.h b/src/modules/partition/jobs/ResizePartitionJob.h index f8413f214..f86b792fc 100644 --- a/src/modules/partition/jobs/ResizePartitionJob.h +++ b/src/modules/partition/jobs/ResizePartitionJob.h @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Aurélien Gâteau - * Copyright 2015, Teo Mrnjavac + * SPDX-FileCopyrightText: 2014 Aurélien Gâteau + * SPDX-FileCopyrightText: 2015 Teo Mrnjavac + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/jobs/ResizeVolumeGroupJob.cpp b/src/modules/partition/jobs/ResizeVolumeGroupJob.cpp index b44fd017b..b9828ccb4 100644 --- a/src/modules/partition/jobs/ResizeVolumeGroupJob.cpp +++ b/src/modules/partition/jobs/ResizeVolumeGroupJob.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2018, Caio Jordão Carvalho + * SPDX-FileCopyrightText: 2018 Caio Jordão Carvalho + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/jobs/ResizeVolumeGroupJob.h b/src/modules/partition/jobs/ResizeVolumeGroupJob.h index 808c39d32..e77098184 100644 --- a/src/modules/partition/jobs/ResizeVolumeGroupJob.h +++ b/src/modules/partition/jobs/ResizeVolumeGroupJob.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2018, Caio Jordão Carvalho + * SPDX-FileCopyrightText: 2018 Caio Jordão Carvalho + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/jobs/SetPartitionFlagsJob.cpp b/src/modules/partition/jobs/SetPartitionFlagsJob.cpp index 3c9403b50..cf8aabd35 100644 --- a/src/modules/partition/jobs/SetPartitionFlagsJob.cpp +++ b/src/modules/partition/jobs/SetPartitionFlagsJob.cpp @@ -1,10 +1,11 @@ /* === This file is part of Calamares - === * - * Copyright 2016, Teo Mrnjavac - * Copyright 2020, Adriaan de Groot + * SPDX-FileCopyrightText: 2008 2010, Volker Lanz + * SPDX-FileCopyrightText: 2016 Teo Mrnjavac + * SPDX-FileCopyrightText: 2020 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * - * Based on the SetPartFlagsJob class from KDE Partition Manager, - * Copyright 2008, 2010, Volker Lanz + * Based on the SetPartFlagsJob class from KDE Partition Manager * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/jobs/SetPartitionFlagsJob.h b/src/modules/partition/jobs/SetPartitionFlagsJob.h index 41b01ecde..957c6893f 100644 --- a/src/modules/partition/jobs/SetPartitionFlagsJob.h +++ b/src/modules/partition/jobs/SetPartitionFlagsJob.h @@ -1,9 +1,10 @@ /* === This file is part of Calamares - === * - * Copyright 2016, Teo Mrnjavac + * SPDX-FileCopyrightText: 2016 Teo Mrnjavac + * SPDX-License-Identifier: GPL-3.0-or-later * * Based on the SetPartFlagsJob class from KDE Partition Manager, - * Copyright 2008, 2010, Volker Lanz + * SPDX-FileCopyrightText: 2008 2010, Volker Lanz * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/tests/ClearMountsJobTests.cpp b/src/modules/partition/tests/ClearMountsJobTests.cpp index bdccc1bc4..69d34c848 100644 --- a/src/modules/partition/tests/ClearMountsJobTests.cpp +++ b/src/modules/partition/tests/ClearMountsJobTests.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/tests/ClearMountsJobTests.h b/src/modules/partition/tests/ClearMountsJobTests.h index 0cc2b5c78..27dfca8b9 100644 --- a/src/modules/partition/tests/ClearMountsJobTests.h +++ b/src/modules/partition/tests/ClearMountsJobTests.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/tests/PartitionJobTests.cpp b/src/modules/partition/tests/PartitionJobTests.cpp index ae40215db..9aa58ff58 100644 --- a/src/modules/partition/tests/PartitionJobTests.cpp +++ b/src/modules/partition/tests/PartitionJobTests.cpp @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Aurélien Gâteau - * Copyright 2017, 2019 Adriaan de Groot + * SPDX-FileCopyrightText: 2014 Aurélien Gâteau + * SPDX-FileCopyrightText: 2017, 2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/partition/tests/PartitionJobTests.h b/src/modules/partition/tests/PartitionJobTests.h index 4ce064ec7..d2f0eb16c 100644 --- a/src/modules/partition/tests/PartitionJobTests.h +++ b/src/modules/partition/tests/PartitionJobTests.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Aurélien Gâteau + * SPDX-FileCopyrightText: 2014 Aurélien Gâteau + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/plasmalnf/PlasmaLnfJob.cpp b/src/modules/plasmalnf/PlasmaLnfJob.cpp index 44bdb5cc7..b4ffadcd8 100644 --- a/src/modules/plasmalnf/PlasmaLnfJob.cpp +++ b/src/modules/plasmalnf/PlasmaLnfJob.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2017, Adriaan de Groot + * SPDX-FileCopyrightText: 2017 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,9 +31,7 @@ PlasmaLnfJob::PlasmaLnfJob( const QString& lnfPath, const QString& id ) } -PlasmaLnfJob::~PlasmaLnfJob() -{ -} +PlasmaLnfJob::~PlasmaLnfJob() {} QString @@ -41,7 +40,8 @@ PlasmaLnfJob::prettyName() const return tr( "Plasma Look-and-Feel Job" ); } -QString PlasmaLnfJob::prettyStatusMessage() const +QString +PlasmaLnfJob::prettyStatusMessage() const { return prettyName(); } @@ -55,18 +55,22 @@ PlasmaLnfJob::exec() auto system = CalamaresUtils::System::instance(); Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage(); - QStringList command( - { - "sudo", "-E", "-H", "-u", gs->value( "username" ).toString(), - m_lnfPath, "-platform", "minimal", "--resetLayout", "--apply", m_id - } ); + QStringList command( { "sudo", + "-E", + "-H", + "-u", + gs->value( "username" ).toString(), + m_lnfPath, + "-platform", + "minimal", + "--resetLayout", + "--apply", + m_id } ); int r = system->targetEnvCall( command ); if ( r ) - return Calamares::JobResult::error( - tr( "Could not select KDE Plasma Look-and-Feel package" ), - tr( "Could not select KDE Plasma Look-and-Feel package" ) ); + return Calamares::JobResult::error( tr( "Could not select KDE Plasma Look-and-Feel package" ), + tr( "Could not select KDE Plasma Look-and-Feel package" ) ); return Calamares::JobResult::ok(); } - diff --git a/src/modules/plasmalnf/PlasmaLnfJob.h b/src/modules/plasmalnf/PlasmaLnfJob.h index 9c52f2c8d..9462f66ac 100644 --- a/src/modules/plasmalnf/PlasmaLnfJob.h +++ b/src/modules/plasmalnf/PlasmaLnfJob.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2017, Adriaan de Groot + * SPDX-FileCopyrightText: 2017 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -42,4 +43,4 @@ private: QString m_id; }; -#endif // PLASMALNFJOB_H +#endif // PLASMALNFJOB_H diff --git a/src/modules/plasmalnf/PlasmaLnfPage.cpp b/src/modules/plasmalnf/PlasmaLnfPage.cpp index 7e2ef8aa6..f3bcc09c8 100644 --- a/src/modules/plasmalnf/PlasmaLnfPage.cpp +++ b/src/modules/plasmalnf/PlasmaLnfPage.cpp @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2017-2018, Adriaan de Groot - * Copyright 2019, Collabora Ltd + * SPDX-FileCopyrightText: 2017-2018 Adriaan de Groot + * SPDX-FileCopyrightText: 2019 Collabora Ltd + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,9 +22,9 @@ #include "ui_page_plasmalnf.h" +#include "Settings.h" #include "utils/Logger.h" #include "utils/Retranslator.h" -#include "Settings.h" #include @@ -38,17 +39,18 @@ ThemeInfo::ThemeInfo( const KPluginMetaData& data ) { } -static ThemeInfoList plasma_themes() +static ThemeInfoList +plasma_themes() { ThemeInfoList packages; - QList pkgs = KPackage::PackageLoader::self()->listPackages( "Plasma/LookAndFeel" ); + QList< KPluginMetaData > pkgs = KPackage::PackageLoader::self()->listPackages( "Plasma/LookAndFeel" ); for ( const KPluginMetaData& data : pkgs ) { if ( data.isValid() && !data.isHidden() && !data.name().isEmpty() ) { - packages << ThemeInfo{ data }; + packages << ThemeInfo { data }; } } @@ -63,25 +65,21 @@ PlasmaLnfPage::PlasmaLnfPage( QWidget* parent ) , m_buttonGroup( nullptr ) { ui->setupUi( this ); - CALAMARES_RETRANSLATE( - { + CALAMARES_RETRANSLATE( { ui->retranslateUi( this ); if ( Calamares::Settings::instance()->isSetupMode() ) - ui->generalExplanation->setText( tr( - "Please choose a look-and-feel for the KDE Plasma Desktop. " - "You can also skip this step and configure the look-and-feel " - "once the system is set up. Clicking on a look-and-feel " - "selection will give you a live preview of that look-and-feel.") ); + ui->generalExplanation->setText( tr( "Please choose a look-and-feel for the KDE Plasma Desktop. " + "You can also skip this step and configure the look-and-feel " + "once the system is set up. Clicking on a look-and-feel " + "selection will give you a live preview of that look-and-feel." ) ); else - ui->generalExplanation->setText( tr( - "Please choose a look-and-feel for the KDE Plasma Desktop. " - "You can also skip this step and configure the look-and-feel " - "once the system is installed. Clicking on a look-and-feel " - "selection will give you a live preview of that look-and-feel.") ); + ui->generalExplanation->setText( tr( "Please choose a look-and-feel for the KDE Plasma Desktop. " + "You can also skip this step and configure the look-and-feel " + "once the system is installed. Clicking on a look-and-feel " + "selection will give you a live preview of that look-and-feel." ) ); updateThemeNames(); fillUi(); - } - ) + } ) } void @@ -91,7 +89,7 @@ PlasmaLnfPage::setLnfPath( const QString& path ) } void -PlasmaLnfPage::setEnabledThemes(const ThemeInfoList& themes, bool showAll ) +PlasmaLnfPage::setEnabledThemes( const ThemeInfoList& themes, bool showAll ) { m_enabledThemes = themes; @@ -100,7 +98,9 @@ PlasmaLnfPage::setEnabledThemes(const ThemeInfoList& themes, bool showAll ) auto plasmaThemes = plasma_themes(); for ( auto& installed_theme : plasmaThemes ) if ( !m_enabledThemes.findById( installed_theme.id ) ) + { m_enabledThemes.append( installed_theme ); + } } updateThemeNames(); @@ -121,10 +121,13 @@ PlasmaLnfPage::setPreselect( const QString& id ) { m_preselect = id; if ( !m_enabledThemes.isEmpty() ) + { fillUi(); + } } -void PlasmaLnfPage::updateThemeNames() +void +PlasmaLnfPage::updateThemeNames() { auto plasmaThemes = plasma_themes(); for ( auto& enabled_theme : m_enabledThemes ) @@ -138,7 +141,8 @@ void PlasmaLnfPage::updateThemeNames() } } -void PlasmaLnfPage::winnowThemes() +void +PlasmaLnfPage::winnowThemes() { auto plasmaThemes = plasma_themes(); bool winnowed = true; @@ -167,7 +171,8 @@ void PlasmaLnfPage::winnowThemes() } } -void PlasmaLnfPage::fillUi() +void +PlasmaLnfPage::fillUi() { if ( m_enabledThemes.isEmpty() ) { @@ -180,7 +185,7 @@ void PlasmaLnfPage::fillUi() m_buttonGroup->setExclusive( true ); } - int c = 1; // After the general explanation + int c = 1; // After the general explanation for ( auto& theme : m_enabledThemes ) { if ( !theme.widget ) @@ -188,7 +193,7 @@ void PlasmaLnfPage::fillUi() ThemeWidget* w = new ThemeWidget( theme ); m_buttonGroup->addButton( w->button() ); ui->verticalLayout->insertWidget( c, w ); - connect( w, &ThemeWidget::themeSelected, this, &PlasmaLnfPage::plasmaThemeSelected); + connect( w, &ThemeWidget::themeSelected, this, &PlasmaLnfPage::plasmaThemeSelected ); theme.widget = w; } else diff --git a/src/modules/plasmalnf/PlasmaLnfPage.h b/src/modules/plasmalnf/PlasmaLnfPage.h index 5a4c68b4e..286a10418 100644 --- a/src/modules/plasmalnf/PlasmaLnfPage.h +++ b/src/modules/plasmalnf/PlasmaLnfPage.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2017-2018, Adriaan de Groot + * SPDX-FileCopyrightText: 2017-2018 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -75,8 +76,8 @@ private: bool m_showAll; // If true, don't winnow according to enabledThemes ThemeInfoList m_enabledThemes; - QButtonGroup *m_buttonGroup; + QButtonGroup* m_buttonGroup; QList< ThemeWidget* > m_widgets; }; -#endif //PLASMALNFPAGE_H +#endif //PLASMALNFPAGE_H diff --git a/src/modules/plasmalnf/PlasmaLnfViewStep.cpp b/src/modules/plasmalnf/PlasmaLnfViewStep.cpp index ec5258c64..e9d1c3f61 100644 --- a/src/modules/plasmalnf/PlasmaLnfViewStep.cpp +++ b/src/modules/plasmalnf/PlasmaLnfViewStep.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2017-2018, Adriaan de Groot + * SPDX-FileCopyrightText: 2017-2018 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -32,7 +33,7 @@ #include #endif -CALAMARES_PLUGIN_FACTORY_DEFINITION( PlasmaLnfViewStepFactory, registerPlugin(); ) +CALAMARES_PLUGIN_FACTORY_DEFINITION( PlasmaLnfViewStepFactory, registerPlugin< PlasmaLnfViewStep >(); ) static QString currentPlasmaTheme() @@ -58,7 +59,9 @@ PlasmaLnfViewStep::PlasmaLnfViewStep( QObject* parent ) PlasmaLnfViewStep::~PlasmaLnfViewStep() { if ( m_widget && m_widget->parent() == nullptr ) + { m_widget->deleteLater(); + } } @@ -104,7 +107,8 @@ PlasmaLnfViewStep::isAtEnd() const } -void PlasmaLnfViewStep::onLeave() +void +PlasmaLnfViewStep::onLeave() { } @@ -118,9 +122,13 @@ PlasmaLnfViewStep::jobs() const if ( !m_themeId.isEmpty() ) { if ( !m_lnfPath.isEmpty() ) + { l.append( Calamares::job_ptr( new PlasmaLnfJob( m_lnfPath, m_themeId ) ) ); + } else + { cWarning() << "no lnftool given for plasmalnf module."; + } } return l; } @@ -133,20 +141,25 @@ PlasmaLnfViewStep::setConfigurationMap( const QVariantMap& configurationMap ) m_widget->setLnfPath( m_lnfPath ); if ( m_lnfPath.isEmpty() ) + { cWarning() << "no lnftool given for plasmalnf module."; + } m_liveUser = CalamaresUtils::getString( configurationMap, "liveuser" ); QString preselect = CalamaresUtils::getString( configurationMap, "preselect" ); if ( preselect == QStringLiteral( "*" ) ) + { preselect = currentPlasmaTheme(); + } if ( !preselect.isEmpty() ) + { m_widget->setPreselect( preselect ); + } bool showAll = CalamaresUtils::getBool( configurationMap, "showAll", false ); - if ( configurationMap.contains( "themes" ) && - configurationMap.value( "themes" ).type() == QVariant::List ) + if ( configurationMap.contains( "themes" ) && configurationMap.value( "themes" ).type() == QVariant::List ) { ThemeInfoList listedThemes; auto themeList = configurationMap.value( "themes" ).toList(); @@ -160,14 +173,20 @@ PlasmaLnfViewStep::setConfigurationMap( const QVariantMap& configurationMap ) listedThemes.append( ThemeInfo( iv.value( "theme" ).toString(), iv.value( "image" ).toString() ) ); } else if ( i.type() == QVariant::String ) + { listedThemes.append( ThemeInfo( i.toString() ) ); + } if ( listedThemes.length() == 1 ) + { cWarning() << "only one theme enabled in plasmalnf"; + } m_widget->setEnabledThemes( listedThemes, showAll ); } else + { m_widget->setEnabledThemesAll(); // All of them + } } void @@ -182,9 +201,9 @@ PlasmaLnfViewStep::themeSelected( const QString& id ) QProcess lnftool; if ( !m_liveUser.isEmpty() ) - lnftool.start( "sudo", {"-E", "-H", "-u", m_liveUser, m_lnfPath, "--resetLayout", "--apply", id} ); + lnftool.start( "sudo", { "-E", "-H", "-u", m_liveUser, m_lnfPath, "--resetLayout", "--apply", id } ); else - lnftool.start( m_lnfPath, {"--resetLayout", "--apply", id} ); + lnftool.start( m_lnfPath, { "--resetLayout", "--apply", id } ); if ( !lnftool.waitForStarted( 1000 ) ) { @@ -198,7 +217,11 @@ PlasmaLnfViewStep::themeSelected( const QString& id ) } if ( ( lnftool.exitCode() == 0 ) && ( lnftool.exitStatus() == QProcess::NormalExit ) ) + { cDebug() << "Plasma look-and-feel applied" << id; + } else + { cWarning() << "could not apply look-and-feel" << id; + } } diff --git a/src/modules/plasmalnf/PlasmaLnfViewStep.h b/src/modules/plasmalnf/PlasmaLnfViewStep.h index 0bf76934c..c2ecf9ddd 100644 --- a/src/modules/plasmalnf/PlasmaLnfViewStep.h +++ b/src/modules/plasmalnf/PlasmaLnfViewStep.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2017-2018, Adriaan de Groot + * SPDX-FileCopyrightText: 2017-2018 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * 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,9 +20,9 @@ #ifndef PLASMALNFVIEWSTEP_H #define PLASMALNFVIEWSTEP_H +#include "DllMacro.h" #include "utils/PluginFactory.h" #include "viewpages/ViewStep.h" -#include "DllMacro.h" #include #include @@ -60,9 +61,9 @@ private: PlasmaLnfPage* m_widget; QString m_lnfPath; // Path to the lnf tool QString m_themeId; // Id of selected theme - QString m_liveUser; // Name of the live user (for OEM mode) + QString m_liveUser; // Name of the live user (for OEM mode) }; CALAMARES_PLUGIN_FACTORY_DECLARATION( PlasmaLnfViewStepFactory ) -#endif // PLASMALNFVIEWSTEP_H +#endif // PLASMALNFVIEWSTEP_H diff --git a/src/modules/plasmalnf/ThemeInfo.h b/src/modules/plasmalnf/ThemeInfo.h index 982064073..432738e17 100644 --- a/src/modules/plasmalnf/ThemeInfo.h +++ b/src/modules/plasmalnf/ThemeInfo.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2017, Adriaan de Groot + * SPDX-FileCopyrightText: 2017 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -42,7 +43,8 @@ struct ThemeInfo ThemeInfo() : widget( nullptr ) - {} + { + } explicit ThemeInfo( const QString& _id ) : id( _id ) @@ -54,13 +56,14 @@ struct ThemeInfo : id( _id ) , imagePath( image ) , widget( nullptr ) - {} + { + } // Defined in PlasmaLnfPage.cpp explicit ThemeInfo( const KPluginMetaData& ); bool isValid() const { return !id.isEmpty(); } -} ; +}; class ThemeInfoList : public QList< ThemeInfo > { @@ -71,7 +74,9 @@ public: for ( ThemeInfo& i : *this ) { if ( i.id == id ) + { return &i; + } } return nullptr; } @@ -82,16 +87,15 @@ public: for ( const ThemeInfo& i : *this ) { if ( i.id == id ) + { return &i; + } } return nullptr; } /** @brief Checks if a given @p id is in the list of themes. */ - bool contains( const QString& id ) const - { - return findById( id ) != nullptr; - } -} ; + bool contains( const QString& id ) const { return findById( id ) != nullptr; } +}; #endif diff --git a/src/modules/plasmalnf/ThemeWidget.cpp b/src/modules/plasmalnf/ThemeWidget.cpp index 92a88197f..896b28772 100644 --- a/src/modules/plasmalnf/ThemeWidget.cpp +++ b/src/modules/plasmalnf/ThemeWidget.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2017-2018, Adriaan de Groot + * SPDX-FileCopyrightText: 2017-2018 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * 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,9 +21,9 @@ #include "ThemeInfo.h" +#include "Branding.h" #include "utils/CalamaresUtilsGui.h" #include "utils/Logger.h" -#include "Branding.h" #include #include @@ -38,33 +39,41 @@ * empty screenshot. Returns blank if the path * doesn't exist anywhere in the search paths. */ -static QString _munge_imagepath( const QString& path ) +static QString +_munge_imagepath( const QString& path ) { if ( path.isEmpty() ) + { return ":/view-preview.png"; + } if ( path.startsWith( '/' ) ) + { return path; + } if ( QFileInfo::exists( path ) ) + { return path; + } QFileInfo fi( QDir( Calamares::Branding::instance()->componentDirectory() ), path ); if ( fi.exists() ) + { return fi.absoluteFilePath(); + } return QString(); } -ThemeWidget::ThemeWidget(const ThemeInfo& info, QWidget* parent) +ThemeWidget::ThemeWidget( const ThemeInfo& info, QWidget* parent ) : QWidget( parent ) , m_id( info.id ) , m_check( new QRadioButton( info.name.isEmpty() ? info.id : info.name, parent ) ) , m_description( new QLabel( info.description, parent ) ) { - const QSize image_size{ - qMax(12 * CalamaresUtils::defaultFontHeight(), 120), - qMax(8 * CalamaresUtils::defaultFontHeight(), 80) }; + const QSize image_size { qMax( 12 * CalamaresUtils::defaultFontHeight(), 120 ), + qMax( 8 * CalamaresUtils::defaultFontHeight(), 80 ) }; QHBoxLayout* layout = new QHBoxLayout( this ); this->setLayout( layout ); @@ -99,7 +108,9 @@ void ThemeWidget::clicked( bool checked ) { if ( checked ) + { emit themeSelected( m_id ); + } } QAbstractButton* @@ -108,7 +119,8 @@ ThemeWidget::button() const return m_check; } -void ThemeWidget::updateThemeName(const ThemeInfo& info) +void +ThemeWidget::updateThemeName( const ThemeInfo& info ) { m_check->setText( info.name ); m_description->setText( info.description ); diff --git a/src/modules/plasmalnf/ThemeWidget.h b/src/modules/plasmalnf/ThemeWidget.h index 83294cc77..e3574dfac 100644 --- a/src/modules/plasmalnf/ThemeWidget.h +++ b/src/modules/plasmalnf/ThemeWidget.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2017, Adriaan de Groot + * SPDX-FileCopyrightText: 2017 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -47,7 +48,6 @@ private: QString m_id; QRadioButton* m_check; QLabel* m_description; -} ; +}; #endif - diff --git a/src/modules/plasmalnf/view-preview.png.license b/src/modules/plasmalnf/view-preview.png.license new file mode 100644 index 000000000..ef0e9d7cd --- /dev/null +++ b/src/modules/plasmalnf/view-preview.png.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: 2014 Uri Herrera and others +SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/modules/plasmalnf/view-preview.svg.license b/src/modules/plasmalnf/view-preview.svg.license new file mode 100644 index 000000000..ef0e9d7cd --- /dev/null +++ b/src/modules/plasmalnf/view-preview.svg.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: 2014 Uri Herrera and others +SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/modules/removeuser/RemoveUserJob.cpp b/src/modules/removeuser/RemoveUserJob.cpp index 0488d19a4..221f4f5ec 100644 --- a/src/modules/removeuser/RemoveUserJob.cpp +++ b/src/modules/removeuser/RemoveUserJob.cpp @@ -1,8 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2015, Teo Mrnjavac - * Copyright 2017. Alf Gaida - * Copyright 2019-2020, Adriaan de Groot + * SPDX-FileCopyrightText: 2015 Teo Mrnjavac + * SPDX-FileCopyrightText: 2017 Alf Gaida + * SPDX-FileCopyrightText: 2019-2020 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/removeuser/RemoveUserJob.h b/src/modules/removeuser/RemoveUserJob.h index d13e834f0..25c5c8e73 100644 --- a/src/modules/removeuser/RemoveUserJob.h +++ b/src/modules/removeuser/RemoveUserJob.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2020, Adriaan de Groot + * SPDX-FileCopyrightText: 2020 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/shellprocess/ShellProcessJob.cpp b/src/modules/shellprocess/ShellProcessJob.cpp index d0507a732..bbc79934c 100644 --- a/src/modules/shellprocess/ShellProcessJob.cpp +++ b/src/modules/shellprocess/ShellProcessJob.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2018, Adriaan de Groot + * SPDX-FileCopyrightText: 2018 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/shellprocess/ShellProcessJob.h b/src/modules/shellprocess/ShellProcessJob.h index 708a43087..956f7b0c8 100644 --- a/src/modules/shellprocess/ShellProcessJob.h +++ b/src/modules/shellprocess/ShellProcessJob.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2018, Adriaan de Groot + * SPDX-FileCopyrightText: 2018 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/shellprocess/Tests.cpp b/src/modules/shellprocess/Tests.cpp index caf9800c9..434520cca 100644 --- a/src/modules/shellprocess/Tests.cpp +++ b/src/modules/shellprocess/Tests.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2017-2018, Adriaan de Groot + * SPDX-FileCopyrightText: 2017-2018 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/shellprocess/Tests.h b/src/modules/shellprocess/Tests.h index 5b4ebebbb..76b05563b 100644 --- a/src/modules/shellprocess/Tests.h +++ b/src/modules/shellprocess/Tests.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2018, Adriaan de Groot + * SPDX-FileCopyrightText: 2018 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/summary/SummaryPage.cpp b/src/modules/summary/SummaryPage.cpp index 2885b1d61..ebcde6a2c 100644 --- a/src/modules/summary/SummaryPage.cpp +++ b/src/modules/summary/SummaryPage.cpp @@ -1,8 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2015, Teo Mrnjavac - * Copyright 2017, 2019, Adriaan de Groot - * Copyright 2019, Collabora Ltd + * SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac + * SPDX-FileCopyrightText: 2017 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2019 Collabora Ltd + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -45,21 +46,18 @@ SummaryPage::SummaryPage( const SummaryViewStep* thisViewStep, QWidget* parent ) { Q_UNUSED( parent ) - this->setObjectName("summaryStep"); + this->setObjectName( "summaryStep" ); Q_ASSERT( m_thisViewStep ); QVBoxLayout* layout = new QVBoxLayout( this ); layout->setContentsMargins( 0, 0, 0, 0 ); QLabel* headerLabel = new QLabel( this ); - CALAMARES_RETRANSLATE( - if ( Calamares::Settings::instance()->isSetupMode() ) - headerLabel->setText( tr( "This is an overview of what will happen once you start " - "the setup procedure." ) ); - else - headerLabel->setText( tr( "This is an overview of what will happen once you start " - "the install procedure." ) ); - ) + CALAMARES_RETRANSLATE( if ( Calamares::Settings::instance()->isSetupMode() ) + headerLabel->setText( tr( "This is an overview of what will happen once you start " + "the setup procedure." ) ); + else headerLabel->setText( tr( "This is an overview of what will happen once you start " + "the install procedure." ) ); ) layout->addWidget( headerLabel ); layout->addWidget( m_scrollArea ); m_scrollArea->setWidgetResizable( true ); @@ -81,8 +79,7 @@ SummaryPage::onActivate() createContentWidget(); bool first = true; - const Calamares::ViewStepList steps = - stepsForSummary( Calamares::ViewManager::instance()->viewSteps() ); + const Calamares::ViewStepList steps = stepsForSummary( Calamares::ViewManager::instance()->viewSteps() ); for ( Calamares::ViewStep* step : steps ) { @@ -90,12 +87,18 @@ SummaryPage::onActivate() QWidget* widget = step->createSummaryWidget(); if ( text.isEmpty() && !widget ) + { continue; + } if ( first ) + { first = false; + } else + { m_layout->addSpacing( SECTION_SPACING ); + } m_layout->addWidget( createTitleLabel( step->prettyName() ) ); QHBoxLayout* itemBodyLayout = new QHBoxLayout; @@ -106,9 +109,13 @@ SummaryPage::onActivate() itemBodyLayout->addLayout( itemBodyCoreLayout ); CalamaresUtils::unmarginLayout( itemBodyLayout ); if ( !text.isEmpty() ) + { itemBodyCoreLayout->addWidget( createBodyLabel( text ) ); + } if ( widget ) + { itemBodyCoreLayout->addWidget( widget ); + } itemBodyLayout->addSpacing( CalamaresUtils::defaultFontHeight() * 2 ); } m_layout->addStretch(); @@ -147,7 +154,9 @@ SummaryPage::stepsForSummary( const Calamares::ViewStepList& allSteps ) const // If we reach the parent step of this page, we're done collecting the list of // steps to summarize. if ( m_thisViewStep == step ) + { break; + } steps.append( step ); } diff --git a/src/modules/summary/SummaryPage.h b/src/modules/summary/SummaryPage.h index b9a98f2a1..6d0148760 100644 --- a/src/modules/summary/SummaryPage.h +++ b/src/modules/summary/SummaryPage.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2015, Teo Mrnjavac + * SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -70,4 +71,4 @@ private: QScrollArea* m_scrollArea; }; -#endif // SUMMARYPAGE_H +#endif // SUMMARYPAGE_H diff --git a/src/modules/summary/SummaryViewStep.cpp b/src/modules/summary/SummaryViewStep.cpp index 6835b2b05..da0e10e1e 100644 --- a/src/modules/summary/SummaryViewStep.cpp +++ b/src/modules/summary/SummaryViewStep.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2015, Teo Mrnjavac + * SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac + * SPDX-License-Identifier: GPL-3.0-or-later * * 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,7 +21,7 @@ #include "SummaryPage.h" -CALAMARES_PLUGIN_FACTORY_DEFINITION( SummaryViewStepFactory, registerPlugin(); ) +CALAMARES_PLUGIN_FACTORY_DEFINITION( SummaryViewStepFactory, registerPlugin< SummaryViewStep >(); ) SummaryViewStep::SummaryViewStep( QObject* parent ) : Calamares::ViewStep( parent ) @@ -33,7 +34,9 @@ SummaryViewStep::SummaryViewStep( QObject* parent ) SummaryViewStep::~SummaryViewStep() { if ( m_widget && m_widget->parent() == nullptr ) + { m_widget->deleteLater(); + } } @@ -98,4 +101,3 @@ SummaryViewStep::onLeave() { m_widget->createContentWidget(); } - diff --git a/src/modules/summary/SummaryViewStep.h b/src/modules/summary/SummaryViewStep.h index 5b2f49b8e..3e23199ca 100644 --- a/src/modules/summary/SummaryViewStep.h +++ b/src/modules/summary/SummaryViewStep.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2015, Teo Mrnjavac + * SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -57,4 +58,4 @@ private: CALAMARES_PLUGIN_FACTORY_DECLARATION( SummaryViewStepFactory ) -#endif // SUMMARYPAGEPLUGIN_H +#endif // SUMMARYPAGEPLUGIN_H diff --git a/src/modules/tracking/Config.cpp b/src/modules/tracking/Config.cpp index 9e8179905..c840d541c 100644 --- a/src/modules/tracking/Config.cpp +++ b/src/modules/tracking/Config.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2020, Adriaan de Groot + * SPDX-FileCopyrightText: 2020 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/tracking/Config.h b/src/modules/tracking/Config.h index ad7d1d4f2..787a92dc5 100644 --- a/src/modules/tracking/Config.h +++ b/src/modules/tracking/Config.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2020, Adriaan de Groot + * SPDX-FileCopyrightText: 2020 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/tracking/Tests.cpp b/src/modules/tracking/Tests.cpp index b7ed57ab1..0fed06947 100644 --- a/src/modules/tracking/Tests.cpp +++ b/src/modules/tracking/Tests.cpp @@ -2,7 +2,6 @@ * * SPDX-FileCopyrightText: 2020 Adriaan de Groot * SPDX-License-Identifier: GPL-3.0-or-later - * License-Filename: LICENSE */ #include "Config.h" diff --git a/src/modules/tracking/TrackingJobs.cpp b/src/modules/tracking/TrackingJobs.cpp index 2df3a66a0..f4ee504e2 100644 --- a/src/modules/tracking/TrackingJobs.cpp +++ b/src/modules/tracking/TrackingJobs.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2017-2018, Adriaan de Groot + * SPDX-FileCopyrightText: 2017-2018 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/tracking/TrackingJobs.h b/src/modules/tracking/TrackingJobs.h index 33b8eceb1..d87deb412 100644 --- a/src/modules/tracking/TrackingJobs.h +++ b/src/modules/tracking/TrackingJobs.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2017-2018, Adriaan de Groot + * SPDX-FileCopyrightText: 2017-2018 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/tracking/TrackingPage.cpp b/src/modules/tracking/TrackingPage.cpp index 76b4a6f95..2644b0cd0 100644 --- a/src/modules/tracking/TrackingPage.cpp +++ b/src/modules/tracking/TrackingPage.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2017-2018, Adriaan de Groot + * SPDX-FileCopyrightText: 2017-2018 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/tracking/TrackingPage.h b/src/modules/tracking/TrackingPage.h index 7df43b846..7600019bd 100644 --- a/src/modules/tracking/TrackingPage.h +++ b/src/modules/tracking/TrackingPage.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2017, Adriaan de Groot + * SPDX-FileCopyrightText: 2017 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/tracking/TrackingType.h b/src/modules/tracking/TrackingType.h index 22e3157d6..15c9cc792 100644 --- a/src/modules/tracking/TrackingType.h +++ b/src/modules/tracking/TrackingType.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2017, Adriaan de Groot + * SPDX-FileCopyrightText: 2017 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/tracking/TrackingViewStep.cpp b/src/modules/tracking/TrackingViewStep.cpp index da5d9108d..ce32bb2e6 100644 --- a/src/modules/tracking/TrackingViewStep.cpp +++ b/src/modules/tracking/TrackingViewStep.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2017, Adriaan de Groot + * SPDX-FileCopyrightText: 2017 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/tracking/TrackingViewStep.h b/src/modules/tracking/TrackingViewStep.h index b05f1b053..335fc77d0 100644 --- a/src/modules/tracking/TrackingViewStep.h +++ b/src/modules/tracking/TrackingViewStep.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2017, Adriaan de Groot + * SPDX-FileCopyrightText: 2017 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/tracking/level-install.svg.license b/src/modules/tracking/level-install.svg.license new file mode 100644 index 000000000..ef0e9d7cd --- /dev/null +++ b/src/modules/tracking/level-install.svg.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: 2014 Uri Herrera and others +SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/modules/tracking/level-machine.svg.license b/src/modules/tracking/level-machine.svg.license new file mode 100644 index 000000000..ef0e9d7cd --- /dev/null +++ b/src/modules/tracking/level-machine.svg.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: 2014 Uri Herrera and others +SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/modules/tracking/level-none.svg.license b/src/modules/tracking/level-none.svg.license new file mode 100644 index 000000000..ef0e9d7cd --- /dev/null +++ b/src/modules/tracking/level-none.svg.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: 2014 Uri Herrera and others +SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/modules/tracking/level-user.svg.license b/src/modules/tracking/level-user.svg.license new file mode 100644 index 000000000..ef0e9d7cd --- /dev/null +++ b/src/modules/tracking/level-user.svg.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: 2014 Uri Herrera and others +SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/modules/users/CheckPWQuality.h b/src/modules/users/CheckPWQuality.h index 1aeb34ba8..80dc809fe 100644 --- a/src/modules/users/CheckPWQuality.h +++ b/src/modules/users/CheckPWQuality.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2018, Adriaan de Groot + * SPDX-FileCopyrightText: 2018 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/users/Config.cpp b/src/modules/users/Config.cpp index de246950f..322884c0e 100644 --- a/src/modules/users/Config.cpp +++ b/src/modules/users/Config.cpp @@ -2,7 +2,6 @@ * * SPDX-FileCopyrightText: 2020 Adriaan de Groot * SPDX-License-Identifier: GPL-3.0-or-later - * License-Filename: LICENSE * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/users/Config.h b/src/modules/users/Config.h index 133f59c05..1e2a4c639 100644 --- a/src/modules/users/Config.h +++ b/src/modules/users/Config.h @@ -2,7 +2,6 @@ * * SPDX-FileCopyrightText: 2020 Adriaan de Groot * SPDX-License-Identifier: GPL-3.0-or-later - * License-Filename: LICENSE * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/users/CreateUserJob.cpp b/src/modules/users/CreateUserJob.cpp index 9a61c5d9e..0f08b1700 100644 --- a/src/modules/users/CreateUserJob.cpp +++ b/src/modules/users/CreateUserJob.cpp @@ -3,7 +3,6 @@ * SPDX-FileCopyrightText: 2014-2016 Teo Mrnjavac * SPDX-FileCopyrightText: 2018 Adriaan de Groot * SPDX-License-Identifier: GPL-3.0-or-later - * License-Filename: LICENSE */ #include "CreateUserJob.h" diff --git a/src/modules/users/CreateUserJob.h b/src/modules/users/CreateUserJob.h index f2239307e..b5d3e9490 100644 --- a/src/modules/users/CreateUserJob.h +++ b/src/modules/users/CreateUserJob.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2015, Teo Mrnjavac + * SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/users/SetHostNameJob.cpp b/src/modules/users/SetHostNameJob.cpp index a4cfa0268..ff69c64a9 100644 --- a/src/modules/users/SetHostNameJob.cpp +++ b/src/modules/users/SetHostNameJob.cpp @@ -1,8 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Rohan Garg - * Copyright 2015, Teo Mrnjavac - * Copyright 2018, 2020, Adriaan de Groot + * SPDX-FileCopyrightText: 2014 Rohan Garg + * SPDX-FileCopyrightText: 2015 Teo Mrnjavac + * SPDX-FileCopyrightText: 2018 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/users/SetHostNameJob.h b/src/modules/users/SetHostNameJob.h index 5d52b545b..4cc29c9ac 100644 --- a/src/modules/users/SetHostNameJob.h +++ b/src/modules/users/SetHostNameJob.h @@ -1,8 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Rohan Garg - * Copyright 2015, Teo Mrnjavac - * Copyright 2020, Adriaan de Groot + * SPDX-FileCopyrightText: 2014 Rohan Garg + * SPDX-FileCopyrightText: 2015 Teo Mrnjavac + * SPDX-FileCopyrightText: 2020 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/users/SetPasswordJob.cpp b/src/modules/users/SetPasswordJob.cpp index 3199a0a76..78efd3efc 100644 --- a/src/modules/users/SetPasswordJob.cpp +++ b/src/modules/users/SetPasswordJob.cpp @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2017, Teo Mrnjavac - * Copyright 2017, Adriaan de Groot + * SPDX-FileCopyrightText: 2014-2017 Teo Mrnjavac + * SPDX-FileCopyrightText: 2017 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/users/SetPasswordJob.h b/src/modules/users/SetPasswordJob.h index cf5b2f585..aa1af0417 100644 --- a/src/modules/users/SetPasswordJob.h +++ b/src/modules/users/SetPasswordJob.h @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2015, Teo Mrnjavac - * Copyright 2017, Adriaan de Groot + * SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac + * SPDX-FileCopyrightText: 2017 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/users/UsersPage.cpp b/src/modules/users/UsersPage.cpp index ad0c448d5..3e04ff7a7 100644 --- a/src/modules/users/UsersPage.cpp +++ b/src/modules/users/UsersPage.cpp @@ -1,9 +1,10 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2017, Teo Mrnjavac - * Copyright 2017-2018, Adriaan de Groot - * Copyright 2019, Collabora Ltd - * Copyright 2020, Gabriel Craciunescu + * SPDX-FileCopyrightText: 2014-2017 Teo Mrnjavac + * SPDX-FileCopyrightText: 2017-2018 Adriaan de Groot + * SPDX-FileCopyrightText: 2019 Collabora Ltd + * SPDX-FileCopyrightText: 2020 Gabriel Craciunescu + * SPDX-License-Identifier: GPL-3.0-or-later * * Portions from the Manjaro Installation Framework * by Roland Singer diff --git a/src/modules/users/UsersPage.h b/src/modules/users/UsersPage.h index 246a08083..9c3998feb 100644 --- a/src/modules/users/UsersPage.h +++ b/src/modules/users/UsersPage.h @@ -1,7 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2015, Teo Mrnjavac - * Copyright 2017-2018, Adriaan de Groot + * SPDX-FileCopyrightText: 2007 Free Software Foundation, Inc. + * SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac + * SPDX-FileCopyrightText: 2017-2018 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Portions from the Manjaro Installation Framework * by Roland Singer diff --git a/src/modules/users/UsersViewStep.cpp b/src/modules/users/UsersViewStep.cpp index df77da036..3b2b7152f 100644 --- a/src/modules/users/UsersViewStep.cpp +++ b/src/modules/users/UsersViewStep.cpp @@ -1,8 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2015, Teo Mrnjavac - * Copyright 2017-2018, Adriaan de Groot - * Copyright 2017, Gabriel Craciunescu + * SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac + * SPDX-FileCopyrightText: 2017-2018 Adriaan de Groot + * SPDX-FileCopyrightText: 2017 Gabriel Craciunescu + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/users/UsersViewStep.h b/src/modules/users/UsersViewStep.h index baf4e6292..6f6baf58b 100644 --- a/src/modules/users/UsersViewStep.h +++ b/src/modules/users/UsersViewStep.h @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2015, Teo Mrnjavac - * Copyright 2017, Adriaan de Groot + * SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac + * SPDX-FileCopyrightText: 2017 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/users/images/invalid.png.license b/src/modules/users/images/invalid.png.license new file mode 100644 index 000000000..cc08e1f9f --- /dev/null +++ b/src/modules/users/images/invalid.png.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: 2014 Teo Mrnjavac +SPDX-License-Identifier: GPL-3.0-or-later diff --git a/src/modules/users/images/valid.png.license b/src/modules/users/images/valid.png.license new file mode 100644 index 000000000..cc08e1f9f --- /dev/null +++ b/src/modules/users/images/valid.png.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: 2014 Teo Mrnjavac +SPDX-License-Identifier: GPL-3.0-or-later diff --git a/src/modules/usersq/UsersQmlViewStep.cpp b/src/modules/usersq/UsersQmlViewStep.cpp index 963383c10..1c011e9b6 100644 --- a/src/modules/usersq/UsersQmlViewStep.cpp +++ b/src/modules/usersq/UsersQmlViewStep.cpp @@ -1,9 +1,10 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2015, Teo Mrnjavac - * Copyright 2017-2018, Adriaan de Groot - * Copyright 2017, Gabriel Craciunescu - * Copyright 2020, Camilo Higuita + * SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac + * SPDX-FileCopyrightText: 2017-2018 Adriaan de Groot + * SPDX-FileCopyrightText: 2017 Gabriel Craciunescu + * SPDX-FileCopyrightText: 2020 Camilo Higuita + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/usersq/UsersQmlViewStep.h b/src/modules/usersq/UsersQmlViewStep.h index 463698199..2a3c1a6c5 100644 --- a/src/modules/usersq/UsersQmlViewStep.h +++ b/src/modules/usersq/UsersQmlViewStep.h @@ -1,8 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2015, Teo Mrnjavac - * Copyright 2017, Adriaan de Groot - * Copyright 2020, Camilo Higuita + * SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac + * SPDX-FileCopyrightText: 2017 Adriaan de Groot + * SPDX-FileCopyrightText: 2020 Camilo Higuita + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/webview/WebViewConfig.h.in b/src/modules/webview/WebViewConfig.h.in index 6611e44c0..ddc07b31c 100644 --- a/src/modules/webview/WebViewConfig.h.in +++ b/src/modules/webview/WebViewConfig.h.in @@ -1,3 +1,6 @@ +/* SPDX-FileCopyrightText: no + SPDX-License-Identifier: CC0-1.0 +*/ #ifndef CALAMARESWEBVIEWCONFIG_H #define CALAMARESWEBVIEWCONFIG_H diff --git a/src/modules/webview/WebViewStep.cpp b/src/modules/webview/WebViewStep.cpp index e1261433c..671156737 100644 --- a/src/modules/webview/WebViewStep.cpp +++ b/src/modules/webview/WebViewStep.cpp @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2015, Rohan Garg - * Copyright 2016, Teo Mrnjavac + * SPDX-FileCopyrightText: 2015 Rohan Garg + * SPDX-FileCopyrightText: 2016 Teo Mrnjavac + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,7 +30,7 @@ #include #endif -CALAMARES_PLUGIN_FACTORY_DEFINITION( WebViewStepFactory, registerPlugin(); ) +CALAMARES_PLUGIN_FACTORY_DEFINITION( WebViewStepFactory, registerPlugin< WebViewStep >(); ) WebViewStep::WebViewStep( QObject* parent ) : Calamares::ViewStep( parent ) @@ -41,13 +42,9 @@ WebViewStep::WebViewStep( QObject* parent ) m_view = new C_QWEBVIEW(); #ifdef WEBVIEW_WITH_WEBKIT m_view->settings()->setFontFamily( QWebSettings::StandardFont, - m_view->settings()-> - fontFamily( QWebSettings::SansSerifFont ) ); - m_view->setRenderHints( QPainter::Antialiasing | - QPainter::TextAntialiasing | - QPainter::HighQualityAntialiasing | - QPainter::SmoothPixmapTransform | - QPainter::NonCosmeticDefaultPen ); + m_view->settings()->fontFamily( QWebSettings::SansSerifFont ) ); + m_view->setRenderHints( QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::HighQualityAntialiasing + | QPainter::SmoothPixmapTransform | QPainter::NonCosmeticDefaultPen ); #endif } @@ -55,7 +52,9 @@ WebViewStep::WebViewStep( QObject* parent ) WebViewStep::~WebViewStep() { if ( m_view && m_view->parent() == nullptr ) + { m_view->deleteLater(); + } } @@ -100,10 +99,11 @@ WebViewStep::isAtEnd() const return true; } -void WebViewStep::onActivate() +void +WebViewStep::onActivate() { - m_view->load(QUrl(m_url)); - m_view->show(); + m_view->load( QUrl( m_url ) ); + m_view->show(); } QList< Calamares::job_ptr > @@ -116,11 +116,14 @@ WebViewStep::jobs() const void WebViewStep::setConfigurationMap( const QVariantMap& configurationMap ) { - if ( configurationMap.contains("url") && - configurationMap.value("url").type() == QVariant::String ) - m_url = configurationMap.value("url").toString(); + if ( configurationMap.contains( "url" ) && configurationMap.value( "url" ).type() == QVariant::String ) + { + m_url = configurationMap.value( "url" ).toString(); + } - if ( configurationMap.contains("prettyName") && - configurationMap.value("prettyName").type() == QVariant::String ) - m_prettyName = configurationMap.value("prettyName").toString(); + if ( configurationMap.contains( "prettyName" ) + && configurationMap.value( "prettyName" ).type() == QVariant::String ) + { + m_prettyName = configurationMap.value( "prettyName" ).toString(); + } } diff --git a/src/modules/webview/WebViewStep.h b/src/modules/webview/WebViewStep.h index a97d465de..9f6658cdc 100644 --- a/src/modules/webview/WebViewStep.h +++ b/src/modules/webview/WebViewStep.h @@ -1,8 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2015, Rohan Garg - * Copyright 2016, Teo Mrnjavac - * Copyright 2017, Adriaan de Groot + * SPDX-FileCopyrightText: 2015 Rohan Garg + * SPDX-FileCopyrightText: 2016 Teo Mrnjavac + * SPDX-FileCopyrightText: 2017 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,13 +22,10 @@ #ifndef WEBVIEWPLUGIN_H #define WEBVIEWPLUGIN_H -#include "WebViewConfig.h" - +#include "DllMacro.h" #include "utils/PluginFactory.h" #include "viewpages/ViewStep.h" -#include "DllMacro.h" - #include #ifdef WEBVIEW_WITH_WEBKIT @@ -63,11 +61,11 @@ public: void setConfigurationMap( const QVariantMap& configurationMap ) override; private: - C_QWEBVIEW *m_view; + C_QWEBVIEW* m_view; QString m_url; QString m_prettyName; }; CALAMARES_PLUGIN_FACTORY_DECLARATION( WebViewStepFactory ) -#endif // WEBVIEWPLUGIN_H +#endif // WEBVIEWPLUGIN_H diff --git a/src/modules/welcome/Config.cpp b/src/modules/welcome/Config.cpp index 2bf418ff1..d9f4ca19c 100644 --- a/src/modules/welcome/Config.cpp +++ b/src/modules/welcome/Config.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2019-2020, Adriaan de Groot + * SPDX-FileCopyrightText: 2019-2020 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/welcome/Config.h b/src/modules/welcome/Config.h index 6d14097c5..b248f81c8 100644 --- a/src/modules/welcome/Config.h +++ b/src/modules/welcome/Config.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2019-2020, Adriaan de Groot + * SPDX-FileCopyrightText: 2019-2020 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/welcome/WelcomePage.cpp b/src/modules/welcome/WelcomePage.cpp index 0c4f44c95..0f22631d3 100644 --- a/src/modules/welcome/WelcomePage.cpp +++ b/src/modules/welcome/WelcomePage.cpp @@ -1,8 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2015, Teo Mrnjavac - * Copyright 2015, Anke Boersma - * Copyright 2017-2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac + * SPDX-FileCopyrightText: 2015 Anke Boersma + * SPDX-FileCopyrightText: 2017-2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/welcome/WelcomePage.h b/src/modules/welcome/WelcomePage.h index 17fedc812..07bea6d76 100644 --- a/src/modules/welcome/WelcomePage.h +++ b/src/modules/welcome/WelcomePage.h @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Teo Mrnjavac - * Copyright 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2014 Teo Mrnjavac + * SPDX-FileCopyrightText: 2019 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/welcome/WelcomeViewStep.cpp b/src/modules/welcome/WelcomeViewStep.cpp index cad5349a9..7cf5e744a 100644 --- a/src/modules/welcome/WelcomeViewStep.cpp +++ b/src/modules/welcome/WelcomeViewStep.cpp @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2015, Teo Mrnjavac - * Copyright 2018, Adriaan de Groot + * SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac + * SPDX-FileCopyrightText: 2018 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/welcome/WelcomeViewStep.h b/src/modules/welcome/WelcomeViewStep.h index f4874dc16..c28dc335e 100644 --- a/src/modules/welcome/WelcomeViewStep.h +++ b/src/modules/welcome/WelcomeViewStep.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2015, Teo Mrnjavac + * SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/welcome/checker/CheckerContainer.cpp b/src/modules/welcome/checker/CheckerContainer.cpp index 11ae9c7c3..58c9396fa 100644 --- a/src/modules/welcome/checker/CheckerContainer.cpp +++ b/src/modules/welcome/checker/CheckerContainer.cpp @@ -1,8 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2017, Teo Mrnjavac - * Copyright 2017, 2019-2020, Adriaan de Groot - * Copyright 2017, Gabriel Craciunescu + * SPDX-FileCopyrightText: 2014-2017 Teo Mrnjavac + * SPDX-FileCopyrightText: 2017 Adriaan de Groot + * SPDX-FileCopyrightText: 2017 Gabriel Craciunescu + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/welcome/checker/CheckerContainer.h b/src/modules/welcome/checker/CheckerContainer.h index 9744ecc77..58358519f 100644 --- a/src/modules/welcome/checker/CheckerContainer.h +++ b/src/modules/welcome/checker/CheckerContainer.h @@ -1,8 +1,9 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2017, Teo Mrnjavac - * Copyright 2017, Adriaan de Groot - * Copyright 2017, Gabriel Craciunescu + * SPDX-FileCopyrightText: 2014-2017 Teo Mrnjavac + * SPDX-FileCopyrightText: 2017 Adriaan de Groot + * SPDX-FileCopyrightText: 2017 Gabriel Craciunescu + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/welcome/checker/GeneralRequirements.cpp b/src/modules/welcome/checker/GeneralRequirements.cpp index e7994f9a0..32d971b6d 100644 --- a/src/modules/welcome/checker/GeneralRequirements.cpp +++ b/src/modules/welcome/checker/GeneralRequirements.cpp @@ -1,9 +1,10 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2017, Teo Mrnjavac - * Copyright 2017-2018, 2020, Adriaan de Groot - * Copyright 2017, Gabriel Craciunescu - * Copyright 2019, Collabora Ltd + * SPDX-FileCopyrightText: 2014-2017 Teo Mrnjavac + * SPDX-FileCopyrightText: 2017-2018 2020, Adriaan de Groot + * SPDX-FileCopyrightText: 2017 Gabriel Craciunescu + * SPDX-FileCopyrightText: 2019 Collabora Ltd + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/welcome/checker/GeneralRequirements.h b/src/modules/welcome/checker/GeneralRequirements.h index ce3abec83..a0a302054 100644 --- a/src/modules/welcome/checker/GeneralRequirements.h +++ b/src/modules/welcome/checker/GeneralRequirements.h @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2017, Teo Mrnjavac - * Copyright 2017, Adriaan de Groot + * SPDX-FileCopyrightText: 2014-2017 Teo Mrnjavac + * SPDX-FileCopyrightText: 2017 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/welcome/checker/ResultWidget.cpp b/src/modules/welcome/checker/ResultWidget.cpp index 5da120a2a..b86cd23b0 100644 --- a/src/modules/welcome/checker/ResultWidget.cpp +++ b/src/modules/welcome/checker/ResultWidget.cpp @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2015, Teo Mrnjavac - * Copyright 2017, 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac + * SPDX-FileCopyrightText: 2017 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/welcome/checker/ResultWidget.h b/src/modules/welcome/checker/ResultWidget.h index f84310bb6..a56ed66e8 100644 --- a/src/modules/welcome/checker/ResultWidget.h +++ b/src/modules/welcome/checker/ResultWidget.h @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2015, Teo Mrnjavac - * Copyright 2017, 2019, Adriaan de Groot + * SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac + * SPDX-FileCopyrightText: 2017 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/welcome/checker/ResultsListWidget.cpp b/src/modules/welcome/checker/ResultsListWidget.cpp index afde9f08d..7286dd256 100644 --- a/src/modules/welcome/checker/ResultsListWidget.cpp +++ b/src/modules/welcome/checker/ResultsListWidget.cpp @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2015, Teo Mrnjavac - * Copyright 2017, 2019-2020, Adriaan de Groot + * SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac + * SPDX-FileCopyrightText: 2017 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/welcome/checker/ResultsListWidget.h b/src/modules/welcome/checker/ResultsListWidget.h index 3f21955ba..a93cc2371 100644 --- a/src/modules/welcome/checker/ResultsListWidget.h +++ b/src/modules/welcome/checker/ResultsListWidget.h @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2015, Teo Mrnjavac - * Copyright 2019-2020, Adriaan de Groot + * SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac + * SPDX-FileCopyrightText: 2019-2020 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/welcome/checker/partman_devices.c b/src/modules/welcome/checker/partman_devices.c index caee5759c..040c584ba 100644 --- a/src/modules/welcome/checker/partman_devices.c +++ b/src/modules/welcome/checker/partman_devices.c @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2015, Teo Mrnjavac + * SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac + * SPDX-License-Identifier: GPL-3.0-or-later * * Based on parted_devices.c, from partman-base. * diff --git a/src/modules/welcome/checker/partman_devices.h b/src/modules/welcome/checker/partman_devices.h index 9f7695ee9..9c14cda78 100644 --- a/src/modules/welcome/checker/partman_devices.h +++ b/src/modules/welcome/checker/partman_devices.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Teo Mrnjavac + * SPDX-FileCopyrightText: 2014 Teo Mrnjavac + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/welcome/language-icon-128px.png.license b/src/modules/welcome/language-icon-128px.png.license new file mode 100644 index 000000000..bc39975ae --- /dev/null +++ b/src/modules/welcome/language-icon-128px.png.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: 2011 Farhat Datta and Onur Mustak Cobanli, http://www.languageicon.org/ +SPDX-License-Identifier: GPL-3.0-or-later diff --git a/src/modules/welcome/language-icon-48px.png.license b/src/modules/welcome/language-icon-48px.png.license new file mode 100644 index 000000000..bc39975ae --- /dev/null +++ b/src/modules/welcome/language-icon-48px.png.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: 2011 Farhat Datta and Onur Mustak Cobanli, http://www.languageicon.org/ +SPDX-License-Identifier: GPL-3.0-or-later diff --git a/src/modules/welcomeq/Recommended.qml b/src/modules/welcomeq/Recommended.qml index 5a6c1316d..cc44c44a9 100644 --- a/src/modules/welcomeq/Recommended.qml +++ b/src/modules/welcomeq/Recommended.qml @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2020, Anke Boersma - * Copyright 2020, Adriaan de Groot + * SPDX-FileCopyrightText: 2020 Anke Boersma + * SPDX-FileCopyrightText: 2020 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/welcomeq/Requirements.qml b/src/modules/welcomeq/Requirements.qml index e7835d868..415b828d8 100644 --- a/src/modules/welcomeq/Requirements.qml +++ b/src/modules/welcomeq/Requirements.qml @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2020, Anke Boersma - * Copyright 2020, Adriaan de Groot + * SPDX-FileCopyrightText: 2020 Anke Boersma + * SPDX-FileCopyrightText: 2020 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/welcomeq/WelcomeQmlViewStep.cpp b/src/modules/welcomeq/WelcomeQmlViewStep.cpp index 42944f20d..e76ab3e00 100644 --- a/src/modules/welcomeq/WelcomeQmlViewStep.cpp +++ b/src/modules/welcomeq/WelcomeQmlViewStep.cpp @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2014-2015, Teo Mrnjavac - * Copyright 2018,2020 Adriaan de Groot + * SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac + * SPDX-FileCopyrightText: 2018 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/welcomeq/WelcomeQmlViewStep.h b/src/modules/welcomeq/WelcomeQmlViewStep.h index 78999986c..6dc06eef4 100644 --- a/src/modules/welcomeq/WelcomeQmlViewStep.h +++ b/src/modules/welcomeq/WelcomeQmlViewStep.h @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2019-2020 Adriaan de Groot + * SPDX-FileCopyrightText: 2019-2020 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/modules/welcomeq/about.qml b/src/modules/welcomeq/about.qml index 7fa6fb462..db8a80135 100644 --- a/src/modules/welcomeq/about.qml +++ b/src/modules/welcomeq/about.qml @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2020, Anke Boersma + * SPDX-FileCopyrightText: 2020 Anke Boersma + * SPDX-License-Identifier: GPL-3.0-or-later * * 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,7 +27,7 @@ Item { width: parent.width height: parent.height focus: true - + property var appName: "Calamares" property var appVersion: "3.2.24" @@ -36,19 +37,19 @@ Item { y: 14 anchors.fill: parent color: "#f2f2f2" - + Column { id: column x: 130 y: 40 - + Rectangle { width: 560 height: 250 radius: 10 border.width: 0 - + Text { width: 400 height: 250 @@ -58,25 +59,25 @@ Item { for %3

Copyright 2014-2017 Teo Mrnjavac <teo@kde.org>
Copyright 2017-2020 Adriaan de Groot <groot@kde.org>
- Thanks to the Calamares team - and the Calamares + Thanks to the Calamares team + and the Calamares translators team.

- Calamares + Calamares development is sponsored by
- Blue Systems - + Blue Systems - Liberating Software." ) .arg(appName) .arg(appVersion) .arg(Branding.string(Branding.VersionedName)) - + onLinkActivated: Qt.openUrlExternally(link) - + MouseArea { anchors.fill: parent acceptedButtons: Qt.NoButton cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor } - + font.pointSize: 10 anchors.verticalCenterOffset: 10 anchors.horizontalCenterOffset: 40 diff --git a/src/modules/welcomeq/img/chevron-left-solid.svg.license b/src/modules/welcomeq/img/chevron-left-solid.svg.license new file mode 100644 index 000000000..5f43e650d --- /dev/null +++ b/src/modules/welcomeq/img/chevron-left-solid.svg.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: 2020 demmm +SPDX-License-Identifier: GPL-3.0-or-later diff --git a/src/modules/welcomeq/img/language-icon-48px.png.license b/src/modules/welcomeq/img/language-icon-48px.png.license new file mode 100644 index 000000000..bc39975ae --- /dev/null +++ b/src/modules/welcomeq/img/language-icon-48px.png.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: 2011 Farhat Datta and Onur Mustak Cobanli, http://www.languageicon.org/ +SPDX-License-Identifier: GPL-3.0-or-later diff --git a/src/modules/welcomeq/img/squid.png.license b/src/modules/welcomeq/img/squid.png.license new file mode 100644 index 000000000..cc08e1f9f --- /dev/null +++ b/src/modules/welcomeq/img/squid.png.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: 2014 Teo Mrnjavac +SPDX-License-Identifier: GPL-3.0-or-later diff --git a/src/modules/welcomeq/release_notes.qml b/src/modules/welcomeq/release_notes.qml index ce9d1d4af..cd2ef257d 100644 --- a/src/modules/welcomeq/release_notes.qml +++ b/src/modules/welcomeq/release_notes.qml @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2020, Anke Boersma + * SPDX-FileCopyrightText: 2020 Anke Boersma + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -33,9 +34,9 @@ Rectangle { id: flick anchors.fill: parent contentHeight: 3500 - + ScrollBar.vertical: ScrollBar { - id: fscrollbar + id: fscrollbar width: 10 policy: ScrollBar.AlwaysOn } diff --git a/src/modules/welcomeq/welcomeq.qml b/src/modules/welcomeq/welcomeq.qml index 7ba8933c8..e749a621c 100644 --- a/src/modules/welcomeq/welcomeq.qml +++ b/src/modules/welcomeq/welcomeq.qml @@ -1,7 +1,8 @@ /* === This file is part of Calamares - === * - * Copyright 2020, Adriaan de Groot - * Copyright 2020, Anke Boersma + * SPDX-FileCopyrightText: 2020 Adriaan de Groot + * SPDX-FileCopyrightText: 2020 Anke Boersma + * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by