From ac75c63001eb5a1ec24a53d4a0848088f1a0e2b2 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 26 Nov 2019 17:24:55 +0100 Subject: [PATCH 1/6] [libcalamares] Reduce warnings with Clang 9 (Boost::Python) - The boost headers fall foul of tons of Clang warnings, so introduce a mechanism like moc-headers for turning off most of those warnings. --- src/libcalamares/PythonHelper.cpp | 5 +++++ src/libcalamares/PythonHelper.h | 6 ++++++ src/libcalamares/PythonJobApi.cpp | 5 +++++ src/libcalamares/utils/boost-warnings.h | 8 ++++++++ 4 files changed, 24 insertions(+) create mode 100644 src/libcalamares/utils/boost-warnings.h diff --git a/src/libcalamares/PythonHelper.cpp b/src/libcalamares/PythonHelper.cpp index 670390d6c..26a57ec14 100644 --- a/src/libcalamares/PythonHelper.cpp +++ b/src/libcalamares/PythonHelper.cpp @@ -26,8 +26,13 @@ #include #undef slots +#include "utils/boost-warnings.h" #include +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + namespace bp = boost::python; namespace CalamaresPython diff --git a/src/libcalamares/PythonHelper.h b/src/libcalamares/PythonHelper.h index 667a08614..9035ba6d4 100644 --- a/src/libcalamares/PythonHelper.h +++ b/src/libcalamares/PythonHelper.h @@ -25,10 +25,16 @@ #include #undef slots +#include "utils/boost-warnings.h" + #include #include #include +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + namespace CalamaresPython { diff --git a/src/libcalamares/PythonJobApi.cpp b/src/libcalamares/PythonJobApi.cpp index 610003492..7b65e979c 100644 --- a/src/libcalamares/PythonJobApi.cpp +++ b/src/libcalamares/PythonJobApi.cpp @@ -32,8 +32,13 @@ #include #undef slots +#include "utils/boost-warnings.h" #include +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + namespace bp = boost::python; static int diff --git a/src/libcalamares/utils/boost-warnings.h b/src/libcalamares/utils/boost-warnings.h new file mode 100644 index 000000000..65a66b0f6 --- /dev/null +++ b/src/libcalamares/utils/boost-warnings.h @@ -0,0 +1,8 @@ +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wreserved-id-macro" +#pragma clang diagnostic ignored "-Wold-style-cast" +#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant" +#pragma clang diagnostic ignored "-Wextra-semi-stmt" +#pragma clang diagnostic ignored "-Wall" +#endif From 3c1b0e6730391a039e63c0334dca7248015ea6d7 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 26 Nov 2019 17:33:25 +0100 Subject: [PATCH 2/6] [libcalamares] Reduce warnings with Clang 9 (yaml.h) --- src/libcalamares/utils/Yaml.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libcalamares/utils/Yaml.h b/src/libcalamares/utils/Yaml.h index 6b786aef8..fd6537be6 100644 --- a/src/libcalamares/utils/Yaml.h +++ b/src/libcalamares/utils/Yaml.h @@ -34,6 +34,7 @@ class QFileInfo; #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant" #pragma clang diagnostic ignored "-Wshadow" +#pragma clang diagnostic ignored "-Wfloat-equal" #endif #include From c2ebfbf6aee64cc5156a3552d70b2717ddbb5672 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 28 Nov 2019 23:19:39 +0100 Subject: [PATCH 3/6] [users] Remove unused parameter (reduces warnings) --- src/modules/users/UsersPage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/users/UsersPage.cpp b/src/modules/users/UsersPage.cpp index 2a7516589..a7c72ce69 100644 --- a/src/modules/users/UsersPage.cpp +++ b/src/modules/users/UsersPage.cpp @@ -97,7 +97,7 @@ UsersPage::UsersPage( QWidget* parent ) connect( ui->textBoxUserVerifiedPassword, &QLineEdit::textChanged, this, &UsersPage::onPasswordTextChanged ); connect( ui->textBoxRootPassword, &QLineEdit::textChanged, this, &UsersPage::onRootPasswordTextChanged ); connect( ui->textBoxVerifiedRootPassword, &QLineEdit::textChanged, this, &UsersPage::onRootPasswordTextChanged ); - connect( ui->checkBoxValidatePassword, &QCheckBox::stateChanged, this, [this]( int checked ) + connect( ui->checkBoxValidatePassword, &QCheckBox::stateChanged, this, [this]( int ) { onPasswordTextChanged( ui->textBoxUserPassword->text() ); onRootPasswordTextChanged( ui->textBoxRootPassword->text() ); From a70b7ad89e09c712e44403b1e65b3c286465c18b Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 28 Nov 2019 23:29:09 +0100 Subject: [PATCH 4/6] [welcome] Chase deprecations in Qt (screen geometry) --- .../welcome/checker/GeneralRequirements.cpp | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/modules/welcome/checker/GeneralRequirements.cpp b/src/modules/welcome/checker/GeneralRequirements.cpp index 1881558b8..6e8e66d5d 100644 --- a/src/modules/welcome/checker/GeneralRequirements.cpp +++ b/src/modules/welcome/checker/GeneralRequirements.cpp @@ -48,6 +48,7 @@ #include #include #include +#include #include #include //geteuid @@ -59,9 +60,28 @@ GeneralRequirements::GeneralRequirements( QObject* parent ) { } +static QSize +biggestSingleScreen() +{ + QSize s; + for ( const auto* screen : QGuiApplication::screens() ) + { + QSize thisScreen = screen->availableSize(); + if ( !s.isValid() ) + { + s = thisScreen; + } + else if ( s.width() * s.height() < thisScreen.width() * thisScreen.height() ) + { + s = thisScreen; + } + } + return s; +} + Calamares::RequirementsList GeneralRequirements::checkRequirements() { - QSize availableSize = qApp->desktop()->availableGeometry().size(); + QSize availableSize = biggestSingleScreen(); bool enoughStorage = false; bool enoughRam = false; From bd5b63b02e013c0ee2d330821114836ef16b89d5 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 28 Nov 2019 23:31:00 +0100 Subject: [PATCH 5/6] [summary][calamares] Chase deprecations in Qt (QWidget::background()) --- src/calamares/progresstree/ProgressTreeDelegate.cpp | 2 +- src/modules/summary/SummaryPage.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calamares/progresstree/ProgressTreeDelegate.cpp b/src/calamares/progresstree/ProgressTreeDelegate.cpp index 5fb9dbf8b..9db508c6e 100644 --- a/src/calamares/progresstree/ProgressTreeDelegate.cpp +++ b/src/calamares/progresstree/ProgressTreeDelegate.cpp @@ -96,7 +96,7 @@ ProgressTreeDelegate::paintViewStep( QPainter* painter, = Calamares::Branding::instance()->styleString( Calamares::Branding::SidebarTextHighlight ); if ( textHighlight.isEmpty() ) { - painter->setBrush( CalamaresApplication::instance()->mainWindow()->palette().background() ); + painter->setBrush( CalamaresApplication::instance()->mainWindow()->palette().window() ); } else { diff --git a/src/modules/summary/SummaryPage.cpp b/src/modules/summary/SummaryPage.cpp index 997a7bb9f..61a9c2ec2 100644 --- a/src/modules/summary/SummaryPage.cpp +++ b/src/modules/summary/SummaryPage.cpp @@ -184,7 +184,7 @@ SummaryPage::createBodyLabel( const QString& text ) const QLabel* label = new QLabel; label->setMargin( CalamaresUtils::defaultFontHeight() / 2 ); QPalette pal( palette() ); - pal.setColor( QPalette::Background, palette().background().color().lighter( 108 ) ); + pal.setColor( QPalette::Background, palette().window().color().lighter( 108 ) ); label->setAutoFillBackground( true ); label->setPalette( pal ); label->setText( text ); From 8b4bd52a26fef01b9ff129b33d16f8fdafec3acc Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 28 Nov 2019 23:31:50 +0100 Subject: [PATCH 6/6] [machineid][hostinfo] Reduce warnings - stray ; - clang-tidy had re-ordered the moc-warnings.h header, needs to go **before** the .moc so split into its own group --- src/modules/hostinfo/Tests.cpp | 3 ++- src/modules/machineid/Tests.cpp | 3 ++- src/modules/machineid/Workers.cpp | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/modules/hostinfo/Tests.cpp b/src/modules/hostinfo/Tests.cpp index 32fce19ed..8241ef022 100644 --- a/src/modules/hostinfo/Tests.cpp +++ b/src/modules/hostinfo/Tests.cpp @@ -65,5 +65,6 @@ HostInfoTests::testHostOS() QTEST_GUILESS_MAIN( HostInfoTests ) -#include "Tests.moc" #include "utils/moc-warnings.h" + +#include "Tests.moc" diff --git a/src/modules/machineid/Tests.cpp b/src/modules/machineid/Tests.cpp index cfd96bbdd..273645e22 100644 --- a/src/modules/machineid/Tests.cpp +++ b/src/modules/machineid/Tests.cpp @@ -104,5 +104,6 @@ MachineIdTests::testPoolSize() QTEST_GUILESS_MAIN( MachineIdTests ) -#include "Tests.moc" #include "utils/moc-warnings.h" + +#include "Tests.moc" diff --git a/src/modules/machineid/Workers.cpp b/src/modules/machineid/Workers.cpp index e6379f3f1..178f03de5 100644 --- a/src/modules/machineid/Workers.cpp +++ b/src/modules/machineid/Workers.cpp @@ -192,7 +192,7 @@ createDBusMachineId( const QString& rootMountPoint, const QString& fileName ) Calamares::JobResult createDBusLink( const QString& rootMountPoint, const QString& fileName, const QString& systemdFileName ) { - Q_UNUSED( rootMountPoint ); + Q_UNUSED( rootMountPoint ) return runCmd( QStringList { QStringLiteral( "ln" ), QStringLiteral( "-s" ), systemdFileName, fileName } ); }