Merge branch 'calamares' of https://github.com/calamares/calamares into development

This commit is contained in:
Philip Müller 2021-10-28 13:37:58 +02:00
commit 0fbdaa5756
8 changed files with 64 additions and 8 deletions

12
CHANGES
View File

@ -7,6 +7,18 @@ contributors are listed. Note that Calamares does not have a historical
changelog -- this log starts with version 3.2.0. The release notes on the
website will have to do for older versions.
# 3.2.45 (unreleased) #
This release contains contributions from (alphabetically by first name):
- Dalto (new contributor, welcome!)
## Core ##
- No core changes yet
## Modules ##
- No module changes yet
# 3.2.44.3 (2021-10-04) #
This is not a hotfix release, but a tiny-tiny incremental improvement

View File

@ -41,7 +41,7 @@
# TODO:3.3: Require CMake 3.12
cmake_minimum_required( VERSION 3.3 FATAL_ERROR )
project( CALAMARES
VERSION 3.2.44.3
VERSION 3.2.45
LANGUAGES C CXX
)

View File

@ -65,6 +65,20 @@ getStringList( const QVariantMap& map, const QString& key, const QStringList& d
return d;
}
QList< QVariant >
getList( const QVariantMap& map, const QString& key, const QList< QVariant >& d )
{
if ( map.contains( key ) )
{
auto v = map.value( key );
if ( v.canConvert( QVariant::List ) )
{
return v.toList();
}
}
return d;
}
qint64
getInteger( const QVariantMap& map, const QString& key, qint64 d )
{

View File

@ -15,6 +15,7 @@
#include "DllMacro.h"
#include <QList>
#include <QString>
#include <QVariantMap>
@ -39,6 +40,12 @@ DLLEXPORT QString getString( const QVariantMap& map, const QString& key, const Q
*/
DLLEXPORT QStringList getStringList( const QVariantMap& map, const QString& key, const QStringList& d = QStringList() );
/**
* Get a list from a mapping with a given key; returns @p d if no value.
*/
DLLEXPORT QList< QVariant >
getList( const QVariantMap& map, const QString& key, const QList< QVariant >& d = QList< QVariant >() );
/**
* Get an integer value from a mapping with a given key; returns @p d if no value.
*/

View File

@ -67,7 +67,7 @@ KeyboardPage::KeyboardPage( Config* config, QWidget* parent )
auto* model = config->keyboardVariants();
ui->variantSelector->setModel( model );
ui->variantSelector->setCurrentIndex( model->index( model->currentIndex() ) );
cDebug() << "Variants now" << model->rowCount() << model->currentIndex();
cDebug() << "Variants now total=" << model->rowCount() << "selected=" << model->currentIndex();
}
connect(

View File

@ -74,7 +74,7 @@ smartClip( const QPixmap& pixmap, QSize size )
return pixmap.copy( x, y, new_width, new_height );
}
return pixmap.scaled( size, Qt::KeepAspectRatio );
return pixmap.scaled( size, Qt::KeepAspectRatio, Qt::SmoothTransformation );
}
void
@ -83,7 +83,7 @@ PackageChooserPage::currentChanged( const QModelIndex& index )
if ( !index.isValid() || !ui->products->selectionModel()->hasSelection() )
{
ui->productName->setText( m_introduction.name.get() );
ui->productScreenshot->setPixmap( m_introduction.screenshot );
ui->productScreenshot->setPixmap( smartClip( m_introduction.screenshot, ui->productScreenshot->size() ) );
ui->productDescription->setText( m_introduction.description.get() );
}
else
@ -96,7 +96,7 @@ PackageChooserPage::currentChanged( const QModelIndex& index )
QPixmap currentScreenshot = model->data( index, PackageListModel::ScreenshotRole ).value< QPixmap >();
if ( currentScreenshot.isNull() )
{
ui->productScreenshot->setPixmap( m_introduction.screenshot );
ui->productScreenshot->setPixmap( smartClip( m_introduction.screenshot, ui->productScreenshot->size() ) );
}
else
{
@ -136,8 +136,8 @@ PackageChooserPage::setSelection( const QModelIndex& index )
if ( index.isValid() )
{
ui->products->selectionModel()->select( index, QItemSelectionModel::Select );
currentChanged( index );
}
currentChanged( index );
}
bool

View File

@ -9,9 +9,28 @@
#include "PackageModel.h"
#include "Branding.h"
#include "utils/Logger.h"
#include "utils/Variant.h"
#include <QFileInfo>
static QPixmap
loadScreenshot( const QString& path )
{
if ( QFileInfo::exists( path ) )
{
return QPixmap( path );
}
const auto* branding = Calamares::Branding::instance();
if ( !branding )
{
return QPixmap();
}
return QPixmap( branding->componentDirectory() + QStringLiteral( "/" ) + path );
}
PackageItem::PackageItem() {}
PackageItem::PackageItem( const QString& a_id, const QString& a_name, const QString& a_description )
@ -36,7 +55,7 @@ PackageItem::PackageItem::PackageItem( const QVariantMap& item_map )
: id( CalamaresUtils::getString( item_map, "id" ) )
, name( CalamaresUtils::Locale::TranslatedString( item_map, "name" ) )
, description( CalamaresUtils::Locale::TranslatedString( item_map, "description" ) )
, screenshot( CalamaresUtils::getString( item_map, "screenshot" ) )
, screenshot( loadScreenshot( CalamaresUtils::getString( item_map, "screenshot" ) ) )
, packageNames( CalamaresUtils::getStringList( item_map, "packages" ) )
{
if ( name.isEmpty() && id.isEmpty() )

View File

@ -95,7 +95,11 @@ labels:
# Human-readable description. These can be translated as well.
# - *screenshot*
# Path to a single screenshot of the product. May be a filesystem
# path or a QRC path, e.g. ":/images/no-selection.png".
# path or a QRC path, e.g. ":/images/no-selection.png". If the path
# is not found (e.g. is a non-existent absolute path, or is a relative
# path that does not exist in the current working directory) then
# an additional attempt is made to load the image from the **branding**
# directory.
#
# The following field is **optional** for an item:
#