|
|
|
@ -28,29 +28,51 @@
|
|
|
|
|
PackageChooserPage::PackageChooserPage( QWidget* parent )
|
|
|
|
|
: QWidget( parent )
|
|
|
|
|
, ui( new Ui::PackageChooserPage )
|
|
|
|
|
, m_introduction( QString(),
|
|
|
|
|
QString(),
|
|
|
|
|
tr( "Package Selection" ),
|
|
|
|
|
tr( "Please pick a product from the list. The selected product will be installed." ) )
|
|
|
|
|
{
|
|
|
|
|
ui->setupUi( this );
|
|
|
|
|
CALAMARES_RETRANSLATE( updateLabels(); )
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
PackageChooserPage::updateLabels()
|
|
|
|
|
PackageChooserPage::currentChanged( const QModelIndex& index )
|
|
|
|
|
{
|
|
|
|
|
ui->productName->setText( QString() );
|
|
|
|
|
ui->productScreenshot->hide();
|
|
|
|
|
ui->productDescription->setText( tr( "Please pick a product from the list." ) );
|
|
|
|
|
if ( !index.isValid() || !ui->products->selectionModel()->hasSelection() )
|
|
|
|
|
{
|
|
|
|
|
ui->productName->setText( m_introduction.name );
|
|
|
|
|
ui->productScreenshot->setPixmap( m_introduction.screenshot );
|
|
|
|
|
ui->productDescription->setText( m_introduction.description );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ui->productName->setText( QString::number( index.row() ) );
|
|
|
|
|
ui->productScreenshot->hide();
|
|
|
|
|
ui->productDescription->setText( "derp" );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
PackageChooserPage::setModel( QAbstractItemModel* model )
|
|
|
|
|
PackageChooserPage::updateLabels()
|
|
|
|
|
{
|
|
|
|
|
ui->products->setModel( model );
|
|
|
|
|
if ( ui && ui->products && ui->products->selectionModel() )
|
|
|
|
|
{
|
|
|
|
|
currentChanged( ui->products->selectionModel()->currentIndex() );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
currentChanged( QModelIndex() );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
PackageChooserPage::currentChanged( const QModelIndex& current )
|
|
|
|
|
PackageChooserPage::setModel( QAbstractItemModel* model )
|
|
|
|
|
{
|
|
|
|
|
updateLabels();
|
|
|
|
|
cDebug() << "Current updated to" << current.row();
|
|
|
|
|
cDebug() << ui->products->model()->data( current, Qt::DisplayRole );
|
|
|
|
|
ui->products->setModel( model );
|
|
|
|
|
connect( ui->products->selectionModel(),
|
|
|
|
|
&QItemSelectionModel::selectionChanged,
|
|
|
|
|
this,
|
|
|
|
|
&PackageChooserPage::updateLabels );
|
|
|
|
|
}
|
|
|
|
|