From 3db901bd09ab94e4123c316e908cd919a97cc4d3 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 16 Apr 2020 15:48:17 +0200 Subject: [PATCH 01/13] [locale] Expand tests to show overlapping locations - This isn't something that Calamares can acutally fix, so the test will be disabled later. After all, if Brazzaville and Kinshasa are close enough that on the map they are the same pixel, we can't move the cities. --- src/modules/locale/Tests.cpp | 70 ++++++++++++++++++++++++++++++++++-- src/modules/locale/Tests.h | 3 +- 2 files changed, 70 insertions(+), 3 deletions(-) diff --git a/src/modules/locale/Tests.cpp b/src/modules/locale/Tests.cpp index 8104966a4..daa585e3d 100644 --- a/src/modules/locale/Tests.cpp +++ b/src/modules/locale/Tests.cpp @@ -28,9 +28,9 @@ QTEST_MAIN( LocaleTests ) -LocaleTests::LocaleTests() { } +LocaleTests::LocaleTests() {} -LocaleTests::~LocaleTests() { } +LocaleTests::~LocaleTests() {} void LocaleTests::initTestCase() @@ -149,3 +149,69 @@ LocaleTests::testTZImages() QCOMPARE( overlapcount, 0 ); } + +bool +operator<( const QPoint& l, const QPoint& r ) +{ + if ( l.x() < r.x() ) + { + return true; + } + if ( l.x() > r.x() ) + { + return false; + } + return l.y() < r.y(); +} + +void +listAll( const QPoint& p, const CalamaresUtils::Locale::CStringPairList& zones ) +{ + using namespace CalamaresUtils::Locale; + for ( const auto* pz : zones ) + { + const TZZone* zone = dynamic_cast< const TZZone* >( pz ); + if ( p == TimeZoneImageList::getLocationPosition( zone->longitude(), zone->latitude() ) ) + { + cError() << Logger::SubEntry << zone->zone(); + } + } +} + +void +LocaleTests::testTZLocations() +{ + using namespace CalamaresUtils::Locale; + const CStringPairList& regions = TZRegion::fromZoneTab(); + + int overlapcount = 0; + for ( const auto* pr : regions ) + { + const TZRegion* region = dynamic_cast< const TZRegion* >( pr ); + QVERIFY( region ); + + Logger::setupLogLevel( Logger::LOGDEBUG ); + cDebug() << "Region" << region->region() << "zones #" << region->zones().count(); + Logger::setupLogLevel( Logger::LOGERROR ); + + std::set< QPoint > occupied; + + const auto zones = region->zones(); + QVERIFY( zones.count() > 0 ); + for ( const auto* pz : zones ) + { + const TZZone* zone = dynamic_cast< const TZZone* >( pz ); + QVERIFY( zone ); + + auto pos = TimeZoneImageList::getLocationPosition( zone->longitude(), zone->latitude() ); + if ( occupied.find( pos ) != occupied.end() ) + { + cError() << "Zone" << zone->zone() << "occupies same spot as .."; + listAll( pos, zones ); + overlapcount++; + } + occupied.insert( pos ); + } + } + QCOMPARE( overlapcount, 0 ); +} diff --git a/src/modules/locale/Tests.h b/src/modules/locale/Tests.h index e0ca7ad0b..20ef86442 100644 --- a/src/modules/locale/Tests.h +++ b/src/modules/locale/Tests.h @@ -37,7 +37,8 @@ private Q_SLOTS: void testSplitLocaleConfiguration(); // Check the TZ images for consistency - void testTZImages(); + void testTZImages(); // No overlaps in images + void testTZLocations(); // No overlaps in locations }; #endif From 82ba4be5e72bd89d23fd8b787be1531b298a7155 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 16 Apr 2020 17:59:12 +0200 Subject: [PATCH 02/13] [locale] Test for pixel-perfect location of Gibraltar and Ceuta - Can't get Gibraltar (and Ceuta) to be distinguished --- src/modules/locale/Tests.cpp | 46 ++++++++++++++++++++++++++++++++++++ src/modules/locale/Tests.h | 1 + 2 files changed, 47 insertions(+) diff --git a/src/modules/locale/Tests.cpp b/src/modules/locale/Tests.cpp index daa585e3d..53cae3fb4 100644 --- a/src/modules/locale/Tests.cpp +++ b/src/modules/locale/Tests.cpp @@ -215,3 +215,49 @@ LocaleTests::testTZLocations() } QCOMPARE( overlapcount, 0 ); } + +const CalamaresUtils::Locale::TZZone* +findZone( const QString& name ) +{ + using namespace CalamaresUtils::Locale; + const CStringPairList& regions = TZRegion::fromZoneTab(); + + for ( const auto* pr : regions ) + { + const TZRegion* region = dynamic_cast< const TZRegion* >( pr ); + if ( !region ) + { + continue; + } + const auto zones = region->zones(); + for ( const auto* pz : zones ) + { + const TZZone* zone = dynamic_cast< const TZZone* >( pz ); + if ( !zone ) + { + continue; + } + + if ( zone->zone() == name ) + { + return zone; + } + } + } + return nullptr; +} + +void +LocaleTests::testSpecificLocations() +{ + const auto* gibraltar = findZone( "Gibraltar" ); + const auto* ceuta = findZone( "Ceuta" ); + QVERIFY( gibraltar ); + QVERIFY( ceuta ); + + auto gpos = TimeZoneImageList::getLocationPosition( gibraltar->longitude(), gibraltar->latitude() ); + auto cpos = TimeZoneImageList::getLocationPosition( ceuta->longitude(), ceuta->latitude() ); + QVERIFY( gpos != cpos ); + QVERIFY( gibraltar->latitude() > ceuta->latitude() ); + QVERIFY( gpos.y() < cpos.y() ); // Gibraltar is north of Ceuta +} diff --git a/src/modules/locale/Tests.h b/src/modules/locale/Tests.h index 20ef86442..e01b1a25c 100644 --- a/src/modules/locale/Tests.h +++ b/src/modules/locale/Tests.h @@ -39,6 +39,7 @@ private Q_SLOTS: // Check the TZ images for consistency void testTZImages(); // No overlaps in images void testTZLocations(); // No overlaps in locations + void testSpecificLocations(); }; #endif From 7bce58f6f2dfb3c6aa54094596bab1e561cf547b Mon Sep 17 00:00:00 2001 From: bill-auger Date: Fri, 17 Apr 2020 22:24:33 -0400 Subject: [PATCH 03/13] [welcome] add optional branding banner to welcome page --- src/branding/default/branding.desc | 8 +++++++- src/libcalamaresui/Branding.cpp | 7 ++++--- src/libcalamaresui/Branding.h | 7 ++++--- src/modules/welcome/WelcomePage.cpp | 26 ++++++++++++++++++++++---- 4 files changed, 37 insertions(+), 11 deletions(-) diff --git a/src/branding/default/branding.desc b/src/branding/default/branding.desc index b6694d1f4..d9c9e1456 100644 --- a/src/branding/default/branding.desc +++ b/src/branding/default/branding.desc @@ -106,6 +106,11 @@ strings: # These images are loaded from the branding module directory. # +# productBanner is an optional image, which if present, will be shown +# on the welcome page of the application, above the welcome text. +# It is intended to have a width much greater than height. +# It is displayed at 64px height (also on HiDPI). +# Recommended size is 64px tall, and up to 460px wide. # productIcon is used as the window icon, and will (usually) be used # by the window manager to represent the application. This image # should be square, and may be displayed by the window manager @@ -121,8 +126,9 @@ strings: # # These filenames can also use substitutions from os-release (see above). images: - productLogo: "squid.png" + productBanner: "banner.png" productIcon: "squid.png" + productLogo: "squid.png" productWelcome: "languages.png" # The slideshow is displayed during execution steps (e.g. when the diff --git a/src/libcalamaresui/Branding.cpp b/src/libcalamaresui/Branding.cpp index ff7e43fb8..38dee24a8 100644 --- a/src/libcalamaresui/Branding.cpp +++ b/src/libcalamaresui/Branding.cpp @@ -73,10 +73,11 @@ const QStringList Branding::s_stringEntryStrings = const QStringList Branding::s_imageEntryStrings = { - "productLogo", + "productBanner", "productIcon", - "productWelcome", - "productWallpaper" + "productLogo", + "productWallpaper", + "productWelcome" }; const QStringList Branding::s_styleEntryStrings = diff --git a/src/libcalamaresui/Branding.h b/src/libcalamaresui/Branding.h index 023f1a511..847f28d89 100644 --- a/src/libcalamaresui/Branding.h +++ b/src/libcalamaresui/Branding.h @@ -67,10 +67,11 @@ public: enum ImageEntry : short { - ProductLogo, + ProductBanner, ProductIcon, - ProductWelcome, - ProductWallpaper + ProductLogo, + ProductWallpaper, + ProductWelcome }; Q_ENUM( ImageEntry ) diff --git a/src/modules/welcome/WelcomePage.cpp b/src/modules/welcome/WelcomePage.cpp index e4be00fe7..e77924f85 100644 --- a/src/modules/welcome/WelcomePage.cpp +++ b/src/modules/welcome/WelcomePage.cpp @@ -51,7 +51,6 @@ WelcomePage::WelcomePage( Config* conf, QWidget* parent ) , m_languages( nullptr ) , m_conf( conf ) { - connect( Calamares::ModuleManager::instance(), &Calamares::ModuleManager::requirementsComplete, m_checkingWidget, @@ -62,7 +61,8 @@ WelcomePage::WelcomePage( Config* conf, QWidget* parent ) &CheckerContainer::requirementsProgress ); ui->setupUi( this ); - ui->verticalLayout->insertSpacing( 1, CalamaresUtils::defaultFontHeight() * 2 ); + const int defaultFontHeight = CalamaresUtils::defaultFontHeight(); + ui->verticalLayout->insertSpacing( 1, defaultFontHeight * 2 ); initLanguages(); ui->mainText->setAlignment( Qt::AlignCenter ); @@ -77,11 +77,29 @@ WelcomePage::WelcomePage( Config* conf, QWidget* parent ) ui->aboutButton->setIcon( CalamaresUtils::defaultPixmap( CalamaresUtils::Information, CalamaresUtils::Original, - 2 * QSize( CalamaresUtils::defaultFontHeight(), CalamaresUtils::defaultFontHeight() ) ) ); + 2 * QSize( defaultFontHeight, defaultFontHeight ) ) ); connect( ui->aboutButton, &QPushButton::clicked, this, &WelcomePage::showAboutBox ); - int welcome_text_idx = ui->verticalLayout->indexOf( ui->mainText ); + // insert system-check widget below welcome text + const int welcome_text_idx = ui->verticalLayout->indexOf( ui->mainText ); ui->verticalLayout->insertWidget( welcome_text_idx + 1, m_checkingWidget ); + + // insert optional logo banner image above welcome text + Calamares::Branding::ImageEntry bannerImage = Calamares::Branding::ProductBanner; + QString bannerPath = Calamares::Branding::instance()->imagePath( bannerImage ); + if ( QFile::exists( bannerPath ) ) + { + QPixmap bannerPixmap = QPixmap( bannerPath ); + if ( !bannerPixmap.isNull() ) + { + QLabel* bannerLabel = new QLabel; + bannerLabel->setPixmap( bannerPixmap ); + bannerLabel->setMinimumHeight( 64 ); + bannerLabel->setAlignment( Qt::AlignCenter ); + ui->verticalLayout->insertSpacing( welcome_text_idx, defaultFontHeight ); + ui->verticalLayout->insertWidget( welcome_text_idx, bannerLabel ); + } + } } void From 69fae85fe88d949dd20c8e1daedc76336b2316d3 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 21 Apr 2020 12:43:45 +0200 Subject: [PATCH 04/13] [locale] Fix test-build - needs if it doesn't get pulled in implicitly - mark tests as expected-to-fail to not block release - SEE #1374 --- src/modules/locale/Tests.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/modules/locale/Tests.cpp b/src/modules/locale/Tests.cpp index 53cae3fb4..b24f37734 100644 --- a/src/modules/locale/Tests.cpp +++ b/src/modules/locale/Tests.cpp @@ -25,6 +25,8 @@ #include +#include + QTEST_MAIN( LocaleTests ) @@ -213,6 +215,8 @@ LocaleTests::testTZLocations() occupied.insert( pos ); } } + + QEXPECT_FAIL("", "TZ Images contain pixel-overlaps", Continue); QCOMPARE( overlapcount, 0 ); } @@ -257,7 +261,9 @@ LocaleTests::testSpecificLocations() auto gpos = TimeZoneImageList::getLocationPosition( gibraltar->longitude(), gibraltar->latitude() ); auto cpos = TimeZoneImageList::getLocationPosition( ceuta->longitude(), ceuta->latitude() ); + QEXPECT_FAIL("", "Gibraltar and Ceuta are really close", Continue); QVERIFY( gpos != cpos ); QVERIFY( gibraltar->latitude() > ceuta->latitude() ); + QEXPECT_FAIL("", "Gibraltar and Ceuta are really close", Continue); QVERIFY( gpos.y() < cpos.y() ); // Gibraltar is north of Ceuta } From f8df49e40f198c073f453735d5e42e7d102005ab Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 21 Apr 2020 13:35:01 +0200 Subject: [PATCH 05/13] [partition] Fix up tests - Although we long ago replaced the getPartitions implementation, the test is still there, and on a machine with no /dev/sda (e.g. because root is on nvme) the echo-awk-shell-pipeline can give an empty string; this is turned into a QStringList{""} which has one element, while the new version has 0 elements. - Special-case the test that empty strings should be empty lists, rather than 1-element lists with an empty element. --- src/modules/partition/tests/ClearMountsJobTests.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/modules/partition/tests/ClearMountsJobTests.cpp b/src/modules/partition/tests/ClearMountsJobTests.cpp index 1f01c4638..17ff48945 100644 --- a/src/modules/partition/tests/ClearMountsJobTests.cpp +++ b/src/modules/partition/tests/ClearMountsJobTests.cpp @@ -42,7 +42,11 @@ getPartitionsForDevice_other(const QString& deviceName) process.start(); process.waitForFinished(); - const QString partitions = process.readAllStandardOutput(); + const QString partitions = process.readAllStandardOutput().trimmed(); + if ( partitions.isEmpty() ) + { + return QStringList(); + } const QStringList partitionsList = partitions.simplified().split( ' ' ); return partitionsList; From d348977d07b37ddd87bd91aa44287db25c3c415f Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 21 Apr 2020 13:41:04 +0200 Subject: [PATCH 06/13] [libcalamares] Fix tests - the test checks that the default locale is C or en_US .. let's just make it so instead of relying on the environment. This fixes tests on my dev-laptop, which happens to be set to en_NL (with volapuk date format). --- src/libcalamares/locale/Tests.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libcalamares/locale/Tests.cpp b/src/libcalamares/locale/Tests.cpp index bf71fb0a2..6cbe980be 100644 --- a/src/libcalamares/locale/Tests.cpp +++ b/src/libcalamares/locale/Tests.cpp @@ -37,6 +37,7 @@ void LocaleTests::initTestCase() { // Otherwise plain get() is dubious in the TranslatableConfiguration tests + QLocale::setDefault( QLocale( QStringLiteral( "en_US" ) ) ); QVERIFY( ( QLocale().name() == "C" ) || ( QLocale().name() == "en_US" ) ); } From e51fbdc85110c7767560d725529a528505a175b7 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 21 Apr 2020 15:35:10 +0200 Subject: [PATCH 07/13] [locale] Apply coding style --- src/modules/locale/Tests.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/modules/locale/Tests.cpp b/src/modules/locale/Tests.cpp index fbc76fa9b..af37a664b 100644 --- a/src/modules/locale/Tests.cpp +++ b/src/modules/locale/Tests.cpp @@ -149,7 +149,7 @@ LocaleTests::testTZImages() } } - QEXPECT_FAIL("", "TZ Images not yet all fixed", Continue); + QEXPECT_FAIL( "", "TZ Images not yet all fixed", Continue ); QCOMPARE( overlapcount, 0 ); } @@ -217,7 +217,7 @@ LocaleTests::testTZLocations() } } - QEXPECT_FAIL("", "TZ Images contain pixel-overlaps", Continue); + QEXPECT_FAIL( "", "TZ Images contain pixel-overlaps", Continue ); QCOMPARE( overlapcount, 0 ); } @@ -262,9 +262,9 @@ LocaleTests::testSpecificLocations() auto gpos = TimeZoneImageList::getLocationPosition( gibraltar->longitude(), gibraltar->latitude() ); auto cpos = TimeZoneImageList::getLocationPosition( ceuta->longitude(), ceuta->latitude() ); - QEXPECT_FAIL("", "Gibraltar and Ceuta are really close", Continue); + QEXPECT_FAIL( "", "Gibraltar and Ceuta are really close", Continue ); QVERIFY( gpos != cpos ); QVERIFY( gibraltar->latitude() > ceuta->latitude() ); - QEXPECT_FAIL("", "Gibraltar and Ceuta are really close", Continue); + QEXPECT_FAIL( "", "Gibraltar and Ceuta are really close", Continue ); QVERIFY( gpos.y() < cpos.y() ); // Gibraltar is north of Ceuta } From c59af8881cfe787a185c0b01682e7f166dd54aff Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 21 Apr 2020 16:13:19 +0200 Subject: [PATCH 08/13] [umount] Avoid SIGPIPE - collect output from umount process, and then ignore it --- src/modules/umount/main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/modules/umount/main.py b/src/modules/umount/main.py index a337c481a..454222c5c 100644 --- a/src/modules/umount/main.py +++ b/src/modules/umount/main.py @@ -98,7 +98,9 @@ def run(): lst.sort(key=lambda x: x[1], reverse=True) for device, mount_point in lst: - subprocess.check_call(["umount", "-lv", mount_point]) + # On success, no output; if the command fails, its output is + # in the exception object. + subprocess.check_output(["umount", "-lv", mount_point], stderr=subprocess.STDOUT) os.rmdir(root_mount_point) From 6de82e6857ebabf47f50a4517ed5d69fde9044c7 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 21 Apr 2020 16:39:02 +0200 Subject: [PATCH 09/13] [libcalamares] Add convenience for QDebug.noquote() - Use << Logger::NoQuote{} to turn off quoting **and** the space - In practice, in Calamares we use this only around other processes' output, where we want neither quotes nor spaces. --- src/libcalamares/utils/Logger.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/libcalamares/utils/Logger.h b/src/libcalamares/utils/Logger.h index fe4b98fd4..24198e256 100644 --- a/src/libcalamares/utils/Logger.h +++ b/src/libcalamares/utils/Logger.h @@ -33,6 +33,9 @@ struct FuncSuppressor const char* m_s; }; +struct NoQuote {}; +struct Quote {}; + DLLEXPORT extern const FuncSuppressor Continuation; DLLEXPORT extern const FuncSuppressor SubEntry; @@ -74,6 +77,18 @@ operator<<( QDebug& s, const FuncSuppressor& f ) return s << f.m_s; } +inline QDebug& +operator<<( QDebug& s, const NoQuote& ) +{ + return s.noquote().nospace(); +} + +inline QDebug& +operator<<( QDebug& s, const Quote& ) +{ + return s.quote().space(); +} + /** * @brief The full path of the log file. */ From 86ffab18737b6f7ee1299786369841db36242269 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 21 Apr 2020 16:42:48 +0200 Subject: [PATCH 10/13] [libcalamares] Use convenience Logger::NoQuote --- src/libcalamares/utils/CalamaresUtilsSystem.cpp | 6 +++--- src/libcalamaresui/Branding.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libcalamares/utils/CalamaresUtilsSystem.cpp b/src/libcalamares/utils/CalamaresUtilsSystem.cpp index 651ac2c1e..327bece92 100644 --- a/src/libcalamares/utils/CalamaresUtilsSystem.cpp +++ b/src/libcalamares/utils/CalamaresUtilsSystem.cpp @@ -195,7 +195,7 @@ System::runCommand( System::RunLocation location, ? ( static_cast< int >( std::chrono::milliseconds( timeoutSec ).count() ) ) : -1 ) ) { - ( cWarning() << "Process" << args.first() << "timed out after" << timeoutSec.count() << "s. Output so far:\n" ).noquote().nospace() << process.readAllStandardOutput(); + cWarning() << "Process" << args.first() << "timed out after" << timeoutSec.count() << "s. Output so far:\n" << Logger::NoQuote{} << process.readAllStandardOutput(); return ProcessResult::Code::TimedOut; } @@ -203,7 +203,7 @@ System::runCommand( System::RunLocation location, if ( process.exitStatus() == QProcess::CrashExit ) { - ( cWarning() << "Process" << args.first() << "crashed. Output so far:\n" ).noquote().nospace() << output; + cWarning() << "Process" << args.first() << "crashed. Output so far:\n" << Logger::NoQuote{} << output; return ProcessResult::Code::Crashed; } @@ -212,7 +212,7 @@ System::runCommand( System::RunLocation location, bool showDebug = ( !Calamares::Settings::instance() ) || ( Calamares::Settings::instance()->debugMode() ); if ( ( r != 0 ) || showDebug ) { - ( cDebug() << "Target cmd:" << RedactedList( args ) << "output:\n" ).noquote().nospace() << output; + cDebug() << "Target cmd:" << RedactedList( args ) << "output:\n" << Logger::NoQuote{} << output; } return ProcessResult( r, output ); } diff --git a/src/libcalamaresui/Branding.cpp b/src/libcalamaresui/Branding.cpp index 38dee24a8..67054a902 100644 --- a/src/libcalamaresui/Branding.cpp +++ b/src/libcalamaresui/Branding.cpp @@ -538,7 +538,7 @@ Branding::initSimpleSettings( const YAML::Node& doc ) [[noreturn]] void Branding::bail( const QString& message ) { - cError() << "FATAL in" << m_descriptorPath << "\n" + message; + cError() << "FATAL in" << m_descriptorPath << Logger::Continuation << Logger::NoQuote{} << message; ::exit( EXIT_FAILURE ); } From be86561913f47a54b31c8fc949c17bdcec6ab6ff Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 22 Apr 2020 00:09:43 +0200 Subject: [PATCH 11/13] [branding] Example banner graphic that matches the default branding.desc - Bogus "CalaMinix" (maybe the example branding should be consistent with that) banner. - Turn off the (example) banner in the default branding. --- src/branding/default/banner.png | Bin 0 -> 5937 bytes src/branding/default/branding.desc | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 src/branding/default/banner.png diff --git a/src/branding/default/banner.png b/src/branding/default/banner.png new file mode 100644 index 0000000000000000000000000000000000000000..d1baeee85569fac787067c199f2dcb93738597da GIT binary patch literal 5937 zcmXw7Wmr^gv}Nc{3F(mT50Dh3r9))sVH^4yeN8fAMq(^1EHbTUYQ|Vt0Mz~WQ$qavC%pGF^8Q8S z_RQQ93yVtj?*TB)r)pqf(QRm{DVzA_9OnAvSiML`^j>uD?U9=YNL3LfC(}}@kaB8U zU1AYYLa2@C)LH1%&4=dIh9qN{_Ux0z!xQ^8?Ip#Dv>3RB*0HhiwFq?{WAmhFnaS&v z$uDcUo*mt|@BcX2>;5vkT-*6&;q*4}Pb%24?q)NjRl0v!%kvm#K`A}<`gf2VKCz3*$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)$NKZ11H)4&$YuwFRT% z3Z^Iciw#CK$2`>*i~0ms0A@#LyKlFGDbC5<2E(I7G&~-6c=Q0=ymAwLP9bcedo@x` zKZ|iP+4)-()f$ONPX8s10lcB=DV0lkr7($estWVp65aG21$L;*|2GO$=^&SceKjgB zulj;Lmfgeii7(qIt!t^#URt{Xc9Q;+vxohkS5nICpMrh89(1qRhTLYx%qzCN1U^aU z&U8AD(lH~nR**G0Qa{s(?705lUM!gNz@mSppCK*XTC-mej$nbRnC@x=2g(c-OR5I` zufUaIv}-B|#-7U?4UGim$b0x7i|mnXkLjK3S@xCb<(hb}lTb%+-={^&2@Y%QkdtqR z4jMOYusW2N*Vb;QT#+W-g&G8gMIcEqy;K*wduJ=aCZXm)-Wc;*Xk~o^=uZ zGbXZ>-Cr`7h)QtLVobTWGkn*T-iWn2Vy+s?ajK_s-;xZBxQ8V97c1GS+Ko}upQ!$- y#rQT Date: Wed, 22 Apr 2020 11:01:50 +0200 Subject: [PATCH 12/13] [welcome] Shuffle code - things that can be done in the designer file should be there, not weirdly repeated in code elsewhere - drop the insertion of an extra spacer (why not include it in the designer file?) - shuffle all the connect() calls down to the end of the constructor --- src/modules/welcome/WelcomePage.cpp | 40 ++++++++++++----------------- src/modules/welcome/WelcomePage.ui | 12 ++++++--- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/modules/welcome/WelcomePage.cpp b/src/modules/welcome/WelcomePage.cpp index e77924f85..d71ad70a8 100644 --- a/src/modules/welcome/WelcomePage.cpp +++ b/src/modules/welcome/WelcomePage.cpp @@ -51,34 +51,12 @@ WelcomePage::WelcomePage( Config* conf, QWidget* parent ) , m_languages( nullptr ) , m_conf( conf ) { - connect( Calamares::ModuleManager::instance(), - &Calamares::ModuleManager::requirementsComplete, - m_checkingWidget, - &CheckerContainer::requirementsComplete ); - connect( Calamares::ModuleManager::instance(), - &Calamares::ModuleManager::requirementsProgress, - m_checkingWidget, - &CheckerContainer::requirementsProgress ); - ui->setupUi( this ); - const int defaultFontHeight = CalamaresUtils::defaultFontHeight(); - ui->verticalLayout->insertSpacing( 1, defaultFontHeight * 2 ); - initLanguages(); - - ui->mainText->setAlignment( Qt::AlignCenter ); - ui->mainText->setWordWrap( true ); - ui->mainText->setOpenExternalLinks( true ); - - cDebug() << "Welcome string" << Calamares::Branding::instance()->welcomeStyleCalamares() - << *Calamares::Branding::VersionedName; - - CALAMARES_RETRANSLATE_SLOT( &WelcomePage::retranslate ) - + ui->setupUi( this ); ui->aboutButton->setIcon( CalamaresUtils::defaultPixmap( CalamaresUtils::Information, CalamaresUtils::Original, 2 * QSize( defaultFontHeight, defaultFontHeight ) ) ); - connect( ui->aboutButton, &QPushButton::clicked, this, &WelcomePage::showAboutBox ); // insert system-check widget below welcome text const int welcome_text_idx = ui->verticalLayout->indexOf( ui->mainText ); @@ -100,6 +78,22 @@ WelcomePage::WelcomePage( Config* conf, QWidget* parent ) ui->verticalLayout->insertWidget( welcome_text_idx, bannerLabel ); } } + + initLanguages(); + + cDebug() << "Welcome string" << Calamares::Branding::instance()->welcomeStyleCalamares() + << *Calamares::Branding::VersionedName; + CALAMARES_RETRANSLATE_SLOT( &WelcomePage::retranslate ) + + connect( ui->aboutButton, &QPushButton::clicked, this, &WelcomePage::showAboutBox ); + connect( Calamares::ModuleManager::instance(), + &Calamares::ModuleManager::requirementsComplete, + m_checkingWidget, + &CheckerContainer::requirementsComplete ); + connect( Calamares::ModuleManager::instance(), + &Calamares::ModuleManager::requirementsProgress, + m_checkingWidget, + &CheckerContainer::requirementsProgress ); } void diff --git a/src/modules/welcome/WelcomePage.ui b/src/modules/welcome/WelcomePage.ui index 590029558..6c0d4c338 100644 --- a/src/modules/welcome/WelcomePage.ui +++ b/src/modules/welcome/WelcomePage.ui @@ -43,6 +43,12 @@ <Calamares welcome text> + + Qt::AlignCenter + + + true + @@ -78,15 +84,15 @@ - - Select application and system language - 2 0 + + Select application and system language + From 1f6752307de1bd5050b525f188238ccff530ea20 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 22 Apr 2020 14:36:09 +0200 Subject: [PATCH 13/13] [welcome] Massage layout when banner is used - simplify handling of image loading (if the image doesn't exist, Branding will bail out on startup) - reduce space above the banner if it is in use --- src/modules/welcome/WelcomePage.cpp | 10 +++++++--- src/modules/welcome/WelcomePage.ui | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/modules/welcome/WelcomePage.cpp b/src/modules/welcome/WelcomePage.cpp index d71ad70a8..89fde33a0 100644 --- a/src/modules/welcome/WelcomePage.cpp +++ b/src/modules/welcome/WelcomePage.cpp @@ -51,6 +51,8 @@ WelcomePage::WelcomePage( Config* conf, QWidget* parent ) , m_languages( nullptr ) , m_conf( conf ) { + using Branding = Calamares::Branding; + const int defaultFontHeight = CalamaresUtils::defaultFontHeight(); ui->setupUi( this ); ui->aboutButton->setIcon( CalamaresUtils::defaultPixmap( @@ -63,10 +65,10 @@ WelcomePage::WelcomePage( Config* conf, QWidget* parent ) ui->verticalLayout->insertWidget( welcome_text_idx + 1, m_checkingWidget ); // insert optional logo banner image above welcome text - Calamares::Branding::ImageEntry bannerImage = Calamares::Branding::ProductBanner; - QString bannerPath = Calamares::Branding::instance()->imagePath( bannerImage ); - if ( QFile::exists( bannerPath ) ) + QString bannerPath = Branding::instance()->imagePath( Branding::ProductBanner ); + if ( !bannerPath.isEmpty() ) { + // If the name is not empty, the file exists -- Branding checks that at startup QPixmap bannerPixmap = QPixmap( bannerPath ); if ( !bannerPixmap.isNull() ) { @@ -74,6 +76,8 @@ WelcomePage::WelcomePage( Config* conf, QWidget* parent ) bannerLabel->setPixmap( bannerPixmap ); bannerLabel->setMinimumHeight( 64 ); bannerLabel->setAlignment( Qt::AlignCenter ); + ui->aboveTextSpacer->changeSize( 20, defaultFontHeight ); // Shrink it down + ui->aboveTextSpacer->invalidate(); ui->verticalLayout->insertSpacing( welcome_text_idx, defaultFontHeight ); ui->verticalLayout->insertWidget( welcome_text_idx, bannerLabel ); } diff --git a/src/modules/welcome/WelcomePage.ui b/src/modules/welcome/WelcomePage.ui index 6c0d4c338..04b89f256 100644 --- a/src/modules/welcome/WelcomePage.ui +++ b/src/modules/welcome/WelcomePage.ui @@ -17,7 +17,7 @@ - + Qt::Vertical