From e102e2630ec03c1fe6dea6b9c75b5c3d79598474 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 20 Apr 2022 16:19:34 +0200 Subject: [PATCH] [welcome] Rip out the "details" dialog for requirements - The dialog gave very little extra information - The text descriptions from the dialog are already available as tooltips in the existing list view. --- src/modules/welcome/Config.cpp | 34 ++++---- .../welcome/checker/ResultsListWidget.cpp | 78 ------------------- .../welcome/checker/ResultsListWidget.h | 2 - 3 files changed, 18 insertions(+), 96 deletions(-) diff --git a/src/modules/welcome/Config.cpp b/src/modules/welcome/Config.cpp index 94f2192c2..c1b13fc69 100644 --- a/src/modules/welcome/Config.cpp +++ b/src/modules/welcome/Config.cpp @@ -54,12 +54,10 @@ Config::retranslate() { message = setup ? tr( "This computer does not satisfy the minimum " "requirements for setting up %1.
" - "Setup cannot continue. " - "Details..." ) + "Setup cannot continue." ) : tr( "This computer does not satisfy the minimum " "requirements for installing %1.
" - "Installation cannot continue. " - "Details..." ); + "Installation cannot continue." ); } else { @@ -124,16 +122,16 @@ Config::initLanguages() QLocale defaultLocale = QLocale( QLocale::system().name() ); cDebug() << "Matching locale" << defaultLocale; - int matchedLocaleIndex = m_languages->find( [&]( const QLocale& x ) { - return x.language() == defaultLocale.language() && x.country() == defaultLocale.country(); - } ); + int matchedLocaleIndex = m_languages->find( + [ & ]( const QLocale& x ) + { return x.language() == defaultLocale.language() && x.country() == defaultLocale.country(); } ); if ( matchedLocaleIndex < 0 ) { cDebug() << Logger::SubEntry << "Matching approximate locale" << defaultLocale.language(); matchedLocaleIndex - = m_languages->find( [&]( const QLocale& x ) { return x.language() == defaultLocale.language(); } ); + = m_languages->find( [ & ]( const QLocale& x ) { return x.language() == defaultLocale.language(); } ); } if ( matchedLocaleIndex < 0 ) @@ -191,7 +189,8 @@ Config::setLocaleIndex( int index ) QLocale::setDefault( selectedTranslation.locale() ); const auto* branding = Calamares::Branding::instance(); - CalamaresUtils::installTranslator( selectedTranslation.id(), branding ? branding->translationsDirectory() : QString() ); + CalamaresUtils::installTranslator( selectedTranslation.id(), + branding ? branding->translationsDirectory() : QString() ); if ( Calamares::JobQueue::instance() && Calamares::JobQueue::instance()->globalStorage() ) { CalamaresUtils::Locale::insertGS( *Calamares::JobQueue::instance()->globalStorage(), @@ -367,13 +366,16 @@ setGeoIP( Config* config, const QVariantMap& configurationMap ) if ( handler->type() != CalamaresUtils::GeoIP::Handler::Type::None ) { auto* future = new FWString(); - QObject::connect( future, &FWString::finished, [config, future, handler]() { - QString countryResult = future->future().result(); - cDebug() << "GeoIP result for welcome=" << countryResult; - ::setCountry( config, countryResult, handler ); - future->deleteLater(); - delete handler; - } ); + QObject::connect( future, + &FWString::finished, + [ config, future, handler ]() + { + QString countryResult = future->future().result(); + cDebug() << "GeoIP result for welcome=" << countryResult; + ::setCountry( config, countryResult, handler ); + future->deleteLater(); + delete handler; + } ); future->setFuture( handler->queryRaw() ); } else diff --git a/src/modules/welcome/checker/ResultsListWidget.cpp b/src/modules/welcome/checker/ResultsListWidget.cpp index e97d7833d..e26859135 100644 --- a/src/modules/welcome/checker/ResultsListWidget.cpp +++ b/src/modules/welcome/checker/ResultsListWidget.cpp @@ -27,71 +27,6 @@ #include #include -/** @brief A "details" dialog for the results-list - * - * This displays the same RequirementsList as ResultsListWidget, - * but the *details* part rather than the show description. - * - * This is an internal-to-the-widget class. - */ -class ResultsListDialog : public QDialog -{ - Q_OBJECT -public: - /** @brief Create a dialog for the given @p checkEntries list of requirements. - * - * The list must continue to exist for the lifetime of the dialog, - * or UB happens. - */ - ResultsListDialog( QAbstractItemModel* model, QWidget* parent ); - ~ResultsListDialog() override; - -private: - QLabel* m_title; - - void retranslate(); -}; - -ResultsListDialog::ResultsListDialog( QAbstractItemModel* model, QWidget* parent ) - : QDialog( parent ) -{ - auto* mainLayout = new QVBoxLayout; - - m_title = new QLabel( this ); - m_title->setObjectName( "resultDialogTitle" ); - - QDialogButtonBox* buttonBox = new QDialogButtonBox( QDialogButtonBox::Close, Qt::Horizontal, this ); - buttonBox->setObjectName( "resultDialogButtons" ); - - mainLayout->addWidget( m_title ); - - auto* listview = new QListView( this ); - listview->setSelectionMode( QAbstractItemView::NoSelection ); - listview->setDragDropMode( QAbstractItemView::NoDragDrop ); - listview->setAcceptDrops( false ); - listview->setItemDelegate( new ResultDelegate( this, Calamares::RequirementsModel::Details ) ); - listview->setModel( model ); - - mainLayout->addWidget( listview ); - mainLayout->addWidget( buttonBox ); - - setLayout( mainLayout ); - - connect( buttonBox, &QDialogButtonBox::clicked, this, &QDialog::close ); - - CALAMARES_RETRANSLATE_SLOT( &ResultsListDialog::retranslate ); -} - -ResultsListDialog::~ResultsListDialog() {} - -void -ResultsListDialog::retranslate() -{ - m_title->setText( tr( "For best results, please ensure that this computer:" ) ); - setWindowTitle( tr( "System requirements" ) ); -} - - ResultsListWidget::ResultsListWidget( Config* config, QWidget* parent ) : QWidget( parent ) , m_config( config ) @@ -129,19 +64,6 @@ ResultsListWidget::ResultsListWidget( Config* config, QWidget* parent ) mainLayout->addStretch(); connect( config, &Config::warningMessageChanged, m_explanation, &QLabel::setText ); - connect( m_explanation, &QLabel::linkActivated, this, &ResultsListWidget::linkClicked ); -} - - -void -ResultsListWidget::linkClicked( const QString& link ) -{ - if ( link == "#details" ) - { - auto* dialog = new ResultsListDialog( m_config->requirementsModel(), this ); - dialog->exec(); - dialog->deleteLater(); - } } void diff --git a/src/modules/welcome/checker/ResultsListWidget.h b/src/modules/welcome/checker/ResultsListWidget.h index d83a4bd96..3bbed1090 100644 --- a/src/modules/welcome/checker/ResultsListWidget.h +++ b/src/modules/welcome/checker/ResultsListWidget.h @@ -27,8 +27,6 @@ public: explicit ResultsListWidget( Config* config, QWidget* parent ); private: - /// @brief A link in the explanatory text has been clicked - void linkClicked( const QString& link ); /// @brief The model of requirements changed void requirementsChanged();