[welcome] Hoist explanatory-label code
- Create the label once, and it's ok for it to respond to links even if there's none in the code. - Turn into a member variable in preparation for retranslation-refactor.
This commit is contained in:
parent
b476e4b386
commit
38d58e5b16
@ -29,6 +29,8 @@
|
|||||||
#include "utils/Retranslator.h"
|
#include "utils/Retranslator.h"
|
||||||
#include "widgets/WaitingWidget.h"
|
#include "widgets/WaitingWidget.h"
|
||||||
|
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
|
||||||
CheckerContainer::CheckerContainer( QWidget* parent )
|
CheckerContainer::CheckerContainer( QWidget* parent )
|
||||||
: QWidget( parent )
|
: QWidget( parent )
|
||||||
, m_waitingWidget( new WaitingWidget( QString(), this ) )
|
, m_waitingWidget( new WaitingWidget( QString(), this ) )
|
||||||
|
@ -29,10 +29,10 @@
|
|||||||
#include "widgets/FixedAspectRatioLabel.h"
|
#include "widgets/FixedAspectRatioLabel.h"
|
||||||
|
|
||||||
#include <QAbstractButton>
|
#include <QAbstractButton>
|
||||||
#include <QBoxLayout>
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
static void
|
static void
|
||||||
createResultWidgets( QLayout* layout,
|
createResultWidgets( QLayout* layout,
|
||||||
@ -157,6 +157,13 @@ ResultsListWidget::ResultsListWidget( QWidget* parent, const Calamares::Requirem
|
|||||||
spacerLayout->addSpacing( paddingSize );
|
spacerLayout->addSpacing( paddingSize );
|
||||||
CalamaresUtils::unmarginLayout( spacerLayout );
|
CalamaresUtils::unmarginLayout( spacerLayout );
|
||||||
|
|
||||||
|
m_explanation = new QLabel;
|
||||||
|
m_explanation->setWordWrap( true );
|
||||||
|
m_explanation->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
|
||||||
|
m_explanation->setOpenExternalLinks( false );
|
||||||
|
connect( m_explanation, &QLabel::linkActivated, this, &ResultsListWidget::linkClicked );
|
||||||
|
entriesLayout->addWidget( m_explanation );
|
||||||
|
|
||||||
// Check that all are satisfied (gives warnings if not) and
|
// Check that all are satisfied (gives warnings if not) and
|
||||||
// all *mandatory* entries are satisfied (gives errors if not).
|
// all *mandatory* entries are satisfied (gives errors if not).
|
||||||
auto isUnSatisfied = []( const Calamares::RequirementEntry& e ) { return !e.satisfied; };
|
auto isUnSatisfied = []( const Calamares::RequirementEntry& e ) { return !e.satisfied; };
|
||||||
@ -182,11 +189,6 @@ ResultsListWidget::ResultsListWidget( QWidget* parent, const Calamares::Requirem
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QLabel* textLabel = new QLabel;
|
|
||||||
|
|
||||||
textLabel->setWordWrap( true );
|
|
||||||
entriesLayout->insertWidget( 0, textLabel );
|
|
||||||
textLabel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
|
|
||||||
|
|
||||||
if ( !requirementsSatisfied )
|
if ( !requirementsSatisfied )
|
||||||
{
|
{
|
||||||
@ -203,9 +205,7 @@ ResultsListWidget::ResultsListWidget( QWidget* parent, const Calamares::Requirem
|
|||||||
"requirements for installing %1.<br/>"
|
"requirements for installing %1.<br/>"
|
||||||
"Installation cannot continue. "
|
"Installation cannot continue. "
|
||||||
"<a href=\"#details\">Details...</a>" );
|
"<a href=\"#details\">Details...</a>" );
|
||||||
textLabel->setText( message.arg( *Calamares::Branding::ShortVersionedName ) ); )
|
m_explanation->setText( message.arg( *Calamares::Branding::ShortVersionedName ) ); )
|
||||||
textLabel->setOpenExternalLinks( false );
|
|
||||||
connect( textLabel, &QLabel::linkActivated, this, &ResultsListWidget::linkClicked );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -218,7 +218,7 @@ ResultsListWidget::ResultsListWidget( QWidget* parent, const Calamares::Requirem
|
|||||||
"recommended requirements for installing %1.<br/>"
|
"recommended requirements for installing %1.<br/>"
|
||||||
"Installation can continue, but some features "
|
"Installation can continue, but some features "
|
||||||
"might be disabled." );
|
"might be disabled." );
|
||||||
textLabel->setText( message.arg( *Calamares::Branding::ShortVersionedName ) ); )
|
m_explanation->setText( message.arg( *Calamares::Branding::ShortVersionedName ) ); )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -249,10 +249,10 @@ ResultsListWidget::ResultsListWidget( QWidget* parent, const Calamares::Requirem
|
|||||||
imageLabel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
|
imageLabel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CALAMARES_RETRANSLATE( textLabel->setText( tr( "This program will ask you some questions and "
|
CALAMARES_RETRANSLATE( m_explanation->setText( tr( "This program will ask you some questions and "
|
||||||
"set up %2 on your computer." )
|
"set up %2 on your computer." )
|
||||||
.arg( *Calamares::Branding::ProductName ) );
|
.arg( *Calamares::Branding::ProductName ) );
|
||||||
textLabel->setAlignment( Qt::AlignCenter ); )
|
m_explanation->setAlignment( Qt::AlignCenter ); )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -22,9 +22,10 @@
|
|||||||
|
|
||||||
#include "modulesystem/Requirement.h"
|
#include "modulesystem/Requirement.h"
|
||||||
|
|
||||||
#include <QBoxLayout>
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
|
class QLabel;
|
||||||
|
|
||||||
class ResultsListWidget : public QWidget
|
class ResultsListWidget : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -36,6 +37,7 @@ private:
|
|||||||
void linkClicked( const QString& link );
|
void linkClicked( const QString& link );
|
||||||
void retranslate();
|
void retranslate();
|
||||||
|
|
||||||
|
QLabel* m_explanation = nullptr; ///< Explanatory text above the list, with link
|
||||||
const Calamares::RequirementsList& m_entries;
|
const Calamares::RequirementsList& m_entries;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user