[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.
This commit is contained in:
Adriaan de Groot 2022-04-20 16:19:34 +02:00
parent 7650795f48
commit e102e2630e
3 changed files with 18 additions and 96 deletions

View File

@ -54,12 +54,10 @@ Config::retranslate()
{
message = setup ? tr( "This computer does not satisfy the minimum "
"requirements for setting up %1.<br/>"
"Setup cannot continue. "
"<a href=\"#details\">Details...</a>" )
"Setup cannot continue." )
: tr( "This computer does not satisfy the minimum "
"requirements for installing %1.<br/>"
"Installation cannot continue. "
"<a href=\"#details\">Details...</a>" );
"Installation cannot continue." );
}
else
{
@ -124,9 +122,9 @@ 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 )
{
@ -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,7 +366,10 @@ 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]() {
QObject::connect( future,
&FWString::finished,
[ config, future, handler ]()
{
QString countryResult = future->future().result();
cDebug() << "GeoIP result for welcome=" << countryResult;
::setCountry( config, countryResult, handler );

View File

@ -27,71 +27,6 @@
#include <QListView>
#include <QVBoxLayout>
/** @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

View File

@ -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();