diff --git a/src/modules/packagechooser/PackageChooserPage.cpp b/src/modules/packagechooser/PackageChooserPage.cpp index 246f59ec9..721329c1b 100644 --- a/src/modules/packagechooser/PackageChooserPage.cpp +++ b/src/modules/packagechooser/PackageChooserPage.cpp @@ -46,44 +46,13 @@ PackageChooserPage::PackageChooserPage( PackageChooserMode mode, QWidget* parent ui->products->setMinimumWidth( 10 * CalamaresUtils::defaultFontHeight() ); } -/** @brief size the given @p pixmap to @p size - * - * This is "smart" in the sense that it tries to keep the image un-scaled - * (if it's just a little too big) and otherwise scales as needed. - * - * Returns a copy if any modifications are done. - */ -static QPixmap -smartClip( const QPixmap& pixmap, QSize size ) -{ - auto pixSize = pixmap.size(); - if ( ( pixSize.width() <= size.width() ) && ( pixSize.height() <= size.height() ) ) - { - return pixmap; - } - - // only slightly bigger? Trim the edges - constexpr int margin = 16; - if ( ( pixSize.width() <= size.width() + margin ) && ( pixSize.height() <= size.height() + margin ) ) - { - int x = pixSize.width() <= size.width() ? 0 : ( pixSize.width() - size.width() / 2 ); - int new_width = pixSize.width() <= size.width() ? pixSize.width() : size.width(); - int y = pixSize.height() <= size.height() ? 0 : ( pixSize.height() - size.height() / 2 ); - int new_height = pixSize.height() <= size.height() ? pixSize.height() : size.height(); - - return pixmap.copy( x, y, new_width, new_height ); - } - - return pixmap.scaled( size, Qt::KeepAspectRatio, Qt::SmoothTransformation ); -} - void PackageChooserPage::currentChanged( const QModelIndex& index ) { if ( !index.isValid() || !ui->products->selectionModel()->hasSelection() ) { ui->productName->setText( m_introduction.name.get() ); - ui->productScreenshot->setPixmap( smartClip( m_introduction.screenshot, ui->productScreenshot->size() ) ); + ui->productScreenshot->setPixmap( m_introduction.screenshot ); ui->productDescription->setText( m_introduction.description.get() ); } else @@ -96,11 +65,11 @@ PackageChooserPage::currentChanged( const QModelIndex& index ) QPixmap currentScreenshot = model->data( index, PackageListModel::ScreenshotRole ).value< QPixmap >(); if ( currentScreenshot.isNull() ) { - ui->productScreenshot->setPixmap( smartClip( m_introduction.screenshot, ui->productScreenshot->size() ) ); + ui->productScreenshot->setPixmap( m_introduction.screenshot ); } else { - ui->productScreenshot->setPixmap( smartClip( currentScreenshot, ui->productScreenshot->size() ) ); + ui->productScreenshot->setPixmap( currentScreenshot ); } } } diff --git a/src/modules/packagechooser/page_package.ui b/src/modules/packagechooser/page_package.ui index 5cc98b126..d021b08b3 100644 --- a/src/modules/packagechooser/page_package.ui +++ b/src/modules/packagechooser/page_package.ui @@ -37,20 +37,26 @@ SPDX-License-Identifier: GPL-3.0-or-later - + + + + 0 + 0 + + Product Name - + 1 - 0 + 1 @@ -64,9 +70,9 @@ SPDX-License-Identifier: GPL-3.0-or-later - + 0 - 2 + 0 @@ -86,6 +92,13 @@ SPDX-License-Identifier: GPL-3.0-or-later + + + FixedAspectRatioLabel + QLabel +
widgets/FixedAspectRatioLabel.h
+
+