Merge branch 'remove-star'
Branding API too clever by half. Make it simpler.
This commit is contained in:
commit
e023adc9b2
@ -277,9 +277,10 @@ CalamaresWindow::CalamaresWindow( QWidget* parent )
|
||||
setWindowFlag( Qt::WindowCloseButtonHint, false );
|
||||
}
|
||||
|
||||
CALAMARES_RETRANSLATE( setWindowTitle( Calamares::Settings::instance()->isSetupMode()
|
||||
? tr( "%1 Setup Program" ).arg( *Calamares::Branding::ProductName )
|
||||
: tr( "%1 Installer" ).arg( *Calamares::Branding::ProductName ) ); )
|
||||
CALAMARES_RETRANSLATE( const auto* branding = Calamares::Branding::instance();
|
||||
setWindowTitle( Calamares::Settings::instance()->isSetupMode()
|
||||
? tr( "%1 Setup Program" ).arg( branding->productName() )
|
||||
: tr( "%1 Installer" ).arg( branding->productName() ) ); )
|
||||
|
||||
const Calamares::Branding* const branding = Calamares::Branding::instance();
|
||||
using ImageEntry = Calamares::Branding::ImageEntry;
|
||||
|
@ -209,6 +209,11 @@ public:
|
||||
|
||||
public slots:
|
||||
QString string( StringEntry stringEntry ) const;
|
||||
QString versionedName() const { return string( VersionedName ); }
|
||||
QString productName() const { return string( ProductName ); }
|
||||
QString shortProductName() const { return string( ShortProductName ); }
|
||||
QString shortVersionedName() const { return string( ShortVersionedName ); }
|
||||
|
||||
QString styleString( StyleEntry styleEntry ) const;
|
||||
QString imagePath( ImageEntry imageEntry ) const;
|
||||
|
||||
@ -249,13 +254,6 @@ private:
|
||||
PanelSide m_navigationSide = PanelSide::Bottom;
|
||||
};
|
||||
|
||||
template < typename U >
|
||||
inline QString
|
||||
operator*( U e )
|
||||
{
|
||||
return Branding::instance()->string( e );
|
||||
}
|
||||
|
||||
} // namespace Calamares
|
||||
|
||||
#endif // BRANDING_H
|
||||
|
@ -226,7 +226,9 @@ ViewManager::onInitFailed( const QStringList& modules )
|
||||
detailString = details.join( QString() );
|
||||
}
|
||||
|
||||
insertViewStep( 0, new BlankViewStep( title, description.arg( *Calamares::Branding::ProductName ), detailString ) );
|
||||
insertViewStep(
|
||||
0,
|
||||
new BlankViewStep( title, description.arg( Calamares::Branding::instance()->productName() ), detailString ) );
|
||||
}
|
||||
|
||||
void
|
||||
@ -335,15 +337,16 @@ ViewManager::next()
|
||||
"to undo these changes.</strong>" );
|
||||
QString confirm = settings->isSetupMode() ? tr( "&Set up now" ) : tr( "&Install now" );
|
||||
|
||||
int reply = QMessageBox::question(
|
||||
m_widget,
|
||||
title,
|
||||
question.arg( *Calamares::Branding::ShortProductName, *Calamares::Branding::ShortVersionedName ),
|
||||
confirm,
|
||||
tr( "Go &back" ),
|
||||
QString(),
|
||||
0 /* default first button, i.e. confirm */,
|
||||
1 /* escape is second button, i.e. cancel */ );
|
||||
const auto* branding = Calamares::Branding::instance();
|
||||
int reply
|
||||
= QMessageBox::question( m_widget,
|
||||
title,
|
||||
question.arg( branding->shortProductName(), branding->shortVersionedName() ),
|
||||
confirm,
|
||||
tr( "Go &back" ),
|
||||
QString(),
|
||||
0 /* default first button, i.e. confirm */,
|
||||
1 /* escape is second button, i.e. cancel */ );
|
||||
if ( reply == 1 )
|
||||
{
|
||||
return;
|
||||
|
@ -20,12 +20,12 @@
|
||||
|
||||
#include "FinishedPage.h"
|
||||
|
||||
#include "ui_FinishedPage.h"
|
||||
#include "CalamaresVersion.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/CalamaresUtilsGui.h"
|
||||
#include "utils/Retranslator.h"
|
||||
#include "ViewManager.h"
|
||||
#include "ui_FinishedPage.h"
|
||||
#include "utils/CalamaresUtilsGui.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/Retranslator.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QBoxLayout>
|
||||
@ -48,33 +48,29 @@ FinishedPage::FinishedPage( QWidget* parent )
|
||||
ui->mainText->setOpenExternalLinks( true );
|
||||
|
||||
CALAMARES_RETRANSLATE(
|
||||
ui->retranslateUi( this );
|
||||
if ( Calamares::Settings::instance()->isSetupMode() )
|
||||
{
|
||||
const auto* branding = Calamares::Branding::instance(); ui->retranslateUi( this );
|
||||
if ( Calamares::Settings::instance()->isSetupMode() ) {
|
||||
ui->mainText->setText( tr( "<h1>All done.</h1><br/>"
|
||||
"%1 has been set up on your computer.<br/>"
|
||||
"You may now start using your new system." )
|
||||
.arg( *Calamares::Branding::VersionedName ) );
|
||||
ui->restartCheckBox->setToolTip( tr ( "<html><head/><body>"
|
||||
"<p>When this box is checked, your system will "
|
||||
"restart immediately when you click on "
|
||||
"<span style=\"font-style:italic;\">Done</span> "
|
||||
"or close the setup program.</p></body></html>" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
.arg( branding->versionedName() ) );
|
||||
ui->restartCheckBox->setToolTip( tr( "<html><head/><body>"
|
||||
"<p>When this box is checked, your system will "
|
||||
"restart immediately when you click on "
|
||||
"<span style=\"font-style:italic;\">Done</span> "
|
||||
"or close the setup program.</p></body></html>" ) );
|
||||
} else {
|
||||
ui->mainText->setText( tr( "<h1>All done.</h1><br/>"
|
||||
"%1 has been installed on your computer.<br/>"
|
||||
"You may now restart into your new system, or continue "
|
||||
"using the %2 Live environment." )
|
||||
.arg( *Calamares::Branding::VersionedName, *Calamares::Branding::ProductName ) );
|
||||
ui->restartCheckBox->setToolTip( tr ( "<html><head/><body>"
|
||||
"<p>When this box is checked, your system will "
|
||||
"restart immediately when you click on "
|
||||
"<span style=\"font-style:italic;\">Done</span> "
|
||||
"or close the installer.</p></body></html>" ) );
|
||||
}
|
||||
)
|
||||
.arg( branding->versionedName(), branding->productName() ) );
|
||||
ui->restartCheckBox->setToolTip( tr( "<html><head/><body>"
|
||||
"<p>When this box is checked, your system will "
|
||||
"restart immediately when you click on "
|
||||
"<span style=\"font-style:italic;\">Done</span> "
|
||||
"or close the installer.</p></body></html>" ) );
|
||||
} )
|
||||
}
|
||||
|
||||
|
||||
@ -102,20 +98,15 @@ void
|
||||
FinishedPage::setUpRestart()
|
||||
{
|
||||
cDebug() << "FinishedPage::setUpRestart(), Quit button"
|
||||
<< "setup=" << FinishedViewStep::modeName( m_mode )
|
||||
<< "command=" << m_restartNowCommand;
|
||||
<< "setup=" << FinishedViewStep::modeName( m_mode ) << "command=" << m_restartNowCommand;
|
||||
|
||||
connect( qApp, &QApplication::aboutToQuit,
|
||||
[this]()
|
||||
{
|
||||
if ( ui->restartCheckBox->isVisible() &&
|
||||
ui->restartCheckBox->isChecked() )
|
||||
{
|
||||
cDebug() << "Running restart command" << m_restartNowCommand;
|
||||
QProcess::execute( "/bin/sh", { "-c", m_restartNowCommand } );
|
||||
}
|
||||
}
|
||||
);
|
||||
connect( qApp, &QApplication::aboutToQuit, [ this ]() {
|
||||
if ( ui->restartCheckBox->isVisible() && ui->restartCheckBox->isChecked() )
|
||||
{
|
||||
cDebug() << "Running restart command" << m_restartNowCommand;
|
||||
QProcess::execute( "/bin/sh", { "-c", m_restartNowCommand } );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
|
||||
@ -128,18 +119,19 @@ FinishedPage::focusInEvent( QFocusEvent* e )
|
||||
void
|
||||
FinishedPage::onInstallationFailed( const QString& message, const QString& details )
|
||||
{
|
||||
const auto* branding = Calamares::Branding::instance();
|
||||
Q_UNUSED( details )
|
||||
if ( Calamares::Settings::instance()->isSetupMode() )
|
||||
ui->mainText->setText( tr( "<h1>Setup Failed</h1><br/>"
|
||||
"%1 has not been set up on your computer.<br/>"
|
||||
"The error message was: %2." )
|
||||
.arg( *Calamares::Branding::VersionedName )
|
||||
.arg( message ) );
|
||||
.arg( branding->versionedName() )
|
||||
.arg( message ) );
|
||||
else
|
||||
ui->mainText->setText( tr( "<h1>Installation Failed</h1><br/>"
|
||||
"%1 has not been installed on your computer.<br/>"
|
||||
"The error message was: %2." )
|
||||
.arg( *Calamares::Branding::VersionedName )
|
||||
.arg( message ) );
|
||||
.arg( branding->versionedName() )
|
||||
.arg( message ) );
|
||||
setRestart( FinishedViewStep::RestartMode::Never );
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ public slots:
|
||||
void onInstallationFailed( const QString& message, const QString& details );
|
||||
|
||||
protected:
|
||||
void focusInEvent( QFocusEvent* e ) override; //choose the child widget to focus
|
||||
void focusInEvent( QFocusEvent* e ) override; //choose the child widget to focus
|
||||
|
||||
private:
|
||||
Ui::FinishedPage* ui;
|
||||
@ -53,4 +53,4 @@ private:
|
||||
QString m_restartNowCommand;
|
||||
};
|
||||
|
||||
#endif // FINISHEDPAGE_H
|
||||
#endif // FINISHEDPAGE_H
|
||||
|
@ -29,22 +29,20 @@
|
||||
#include "utils/NamedEnum.h"
|
||||
#include "utils/Variant.h"
|
||||
|
||||
#include <QVariantMap>
|
||||
#include <QtDBus/QDBusConnection>
|
||||
#include <QtDBus/QDBusInterface>
|
||||
#include <QtDBus/QDBusReply>
|
||||
#include <QVariantMap>
|
||||
|
||||
static const NamedEnumTable< FinishedViewStep::RestartMode >&
|
||||
modeNames()
|
||||
{
|
||||
using Mode = FinishedViewStep::RestartMode;
|
||||
|
||||
static const NamedEnumTable< Mode > names{
|
||||
{ QStringLiteral( "never" ), Mode::Never },
|
||||
{ QStringLiteral( "user-unchecked" ), Mode::UserUnchecked },
|
||||
{ QStringLiteral( "user-checked" ), Mode::UserChecked },
|
||||
{ QStringLiteral( "always" ), Mode::Always }
|
||||
} ;
|
||||
static const NamedEnumTable< Mode > names { { QStringLiteral( "never" ), Mode::Never },
|
||||
{ QStringLiteral( "user-unchecked" ), Mode::UserUnchecked },
|
||||
{ QStringLiteral( "user-checked" ), Mode::UserChecked },
|
||||
{ QStringLiteral( "always" ), Mode::Always } };
|
||||
|
||||
return names;
|
||||
}
|
||||
@ -56,10 +54,8 @@ FinishedViewStep::FinishedViewStep( QObject* parent )
|
||||
, m_notifyOnFinished( false )
|
||||
{
|
||||
auto jq = Calamares::JobQueue::instance();
|
||||
connect( jq, &Calamares::JobQueue::failed,
|
||||
m_widget, &FinishedPage::onInstallationFailed );
|
||||
connect( jq, &Calamares::JobQueue::failed,
|
||||
this, &FinishedViewStep::onInstallationFailed );
|
||||
connect( jq, &Calamares::JobQueue::failed, m_widget, &FinishedPage::onInstallationFailed );
|
||||
connect( jq, &Calamares::JobQueue::failed, this, &FinishedViewStep::onInstallationFailed );
|
||||
|
||||
emit nextStatusChanged( true );
|
||||
}
|
||||
@ -68,7 +64,9 @@ FinishedViewStep::FinishedViewStep( QObject* parent )
|
||||
FinishedViewStep::~FinishedViewStep()
|
||||
{
|
||||
if ( m_widget && m_widget->parent() == nullptr )
|
||||
{
|
||||
m_widget->deleteLater();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -119,30 +117,36 @@ FinishedViewStep::sendNotification()
|
||||
// If the installation failed, don't send notification popup;
|
||||
// there's a (modal) dialog popped up with the failure notice.
|
||||
if ( installFailed )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QDBusInterface notify( "org.freedesktop.Notifications", "/org/freedesktop/Notifications", "org.freedesktop.Notifications" );
|
||||
QDBusInterface notify(
|
||||
"org.freedesktop.Notifications", "/org/freedesktop/Notifications", "org.freedesktop.Notifications" );
|
||||
if ( notify.isValid() )
|
||||
{
|
||||
QDBusReply<uint> r = notify.call( "Notify",
|
||||
QString( "Calamares" ),
|
||||
QVariant( 0U ),
|
||||
QString( "calamares" ),
|
||||
Calamares::Settings::instance()->isSetupMode()
|
||||
? tr( "Setup Complete" )
|
||||
: tr( "Installation Complete" ),
|
||||
Calamares::Settings::instance()->isSetupMode()
|
||||
? tr( "The setup of %1 is complete." ).arg( *Calamares::Branding::VersionedName )
|
||||
: tr( "The installation of %1 is complete." ).arg( *Calamares::Branding::VersionedName ),
|
||||
QStringList(),
|
||||
QVariantMap(),
|
||||
QVariant( 0 )
|
||||
);
|
||||
const auto* branding = Calamares::Branding::instance();
|
||||
QDBusReply< uint > r = notify.call(
|
||||
"Notify",
|
||||
QString( "Calamares" ),
|
||||
QVariant( 0U ),
|
||||
QString( "calamares" ),
|
||||
Calamares::Settings::instance()->isSetupMode() ? tr( "Setup Complete" ) : tr( "Installation Complete" ),
|
||||
Calamares::Settings::instance()->isSetupMode()
|
||||
? tr( "The setup of %1 is complete." ).arg( branding->versionedName() )
|
||||
: tr( "The installation of %1 is complete." ).arg( branding->versionedName() ),
|
||||
QStringList(),
|
||||
QVariantMap(),
|
||||
QVariant( 0 ) );
|
||||
if ( !r.isValid() )
|
||||
{
|
||||
cWarning() << "Could not call org.freedesktop.Notifications.Notify at end of installation." << r.error();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cWarning() << "Could not get dbus interface for notifications at end of installation." << notify.lastError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -152,7 +156,9 @@ FinishedViewStep::onActivate()
|
||||
m_widget->setUpRestart();
|
||||
|
||||
if ( m_notifyOnFinished )
|
||||
{
|
||||
sendNotification();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -179,22 +185,30 @@ FinishedViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
if ( restartMode.isEmpty() )
|
||||
{
|
||||
if ( configurationMap.contains( "restartNowEnabled" ) )
|
||||
{
|
||||
cWarning() << "Configuring the finished module with deprecated restartNowEnabled settings";
|
||||
}
|
||||
|
||||
bool restartNowEnabled = CalamaresUtils::getBool( configurationMap, "restartNowEnabled", false );
|
||||
bool restartNowChecked = CalamaresUtils::getBool( configurationMap, "restartNowChecked", false );
|
||||
|
||||
if ( !restartNowEnabled )
|
||||
{
|
||||
mode = RestartMode::Never;
|
||||
}
|
||||
else
|
||||
{
|
||||
mode = restartNowChecked ? RestartMode::UserChecked : RestartMode::UserUnchecked;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bool ok = false;
|
||||
mode = modeNames().find( restartMode, ok );
|
||||
if ( !ok )
|
||||
{
|
||||
cWarning() << "Configuring the finished module with bad restartNowMode" << restartMode;
|
||||
}
|
||||
}
|
||||
|
||||
m_widget->setRestart( mode );
|
||||
@ -203,18 +217,21 @@ FinishedViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
{
|
||||
QString restartNowCommand = CalamaresUtils::getString( configurationMap, "restartNowCommand" );
|
||||
if ( restartNowCommand.isEmpty() )
|
||||
{
|
||||
restartNowCommand = QStringLiteral( "shutdown -r now" );
|
||||
}
|
||||
m_widget->setRestartNowCommand( restartNowCommand );
|
||||
}
|
||||
|
||||
m_notifyOnFinished = CalamaresUtils::getBool( configurationMap, "notifyOnFinished", false );
|
||||
}
|
||||
|
||||
QString FinishedViewStep::modeName(FinishedViewStep::RestartMode m)
|
||||
QString
|
||||
FinishedViewStep::modeName( FinishedViewStep::RestartMode m )
|
||||
{
|
||||
bool ok = false;
|
||||
return modeNames().find( m, ok ); // May be QString()
|
||||
}
|
||||
|
||||
|
||||
CALAMARES_PLUGIN_FACTORY_DEFINITION( FinishedViewStepFactory, registerPlugin<FinishedViewStep>(); )
|
||||
CALAMARES_PLUGIN_FACTORY_DEFINITION( FinishedViewStepFactory, registerPlugin< FinishedViewStep >(); )
|
||||
|
@ -36,10 +36,10 @@ class PLUGINDLLEXPORT FinishedViewStep : public Calamares::ViewStep
|
||||
public:
|
||||
enum class RestartMode
|
||||
{
|
||||
Never=0, ///< @brief Don't show button, just exit
|
||||
UserUnchecked, ///< @brief Show button, starts unchecked
|
||||
UserChecked, ///< @brief Show button, starts checked
|
||||
Always ///< @brief Show button, can't change, checked
|
||||
Never = 0, ///< @brief Don't show button, just exit
|
||||
UserUnchecked, ///< @brief Show button, starts unchecked
|
||||
UserChecked, ///< @brief Show button, starts checked
|
||||
Always ///< @brief Show button, can't change, checked
|
||||
};
|
||||
/// @brief Returns the config-name of the given restart-mode @p m
|
||||
static QString modeName( RestartMode m );
|
||||
|
@ -832,7 +832,7 @@ ChoicePage::doReplaceSelectedPartition( const QModelIndex& current )
|
||||
if ( !homePartitionPath->isEmpty() )
|
||||
m_reuseHomeCheckBox->setText( tr( "Reuse %1 as home partition for %2." )
|
||||
.arg( *homePartitionPath )
|
||||
.arg( *Calamares::Branding::ShortProductName ) );
|
||||
.arg( Calamares::Branding::instance()->shortProductName() ) );
|
||||
delete homePartitionPath;
|
||||
|
||||
if ( m_isEfi )
|
||||
@ -975,7 +975,7 @@ ChoicePage::updateActionChoicePreview( ChoicePage::InstallChoice choice )
|
||||
.arg( m_beforePartitionBarsView->selectionModel()->currentIndex().data().toString() )
|
||||
.arg( CalamaresUtils::BytesToMiB( size ) )
|
||||
.arg( CalamaresUtils::BytesToMiB( sizeNext ) )
|
||||
.arg( *Calamares::Branding::ShortProductName ) );
|
||||
.arg( Calamares::Branding::instance()->shortProductName() ) );
|
||||
}
|
||||
);
|
||||
|
||||
@ -1004,7 +1004,7 @@ ChoicePage::updateActionChoicePreview( ChoicePage::InstallChoice choice )
|
||||
m_afterPartitionBarsView->setNestedPartitionsMode( mode );
|
||||
m_afterPartitionLabelsView = new PartitionLabelsView( m_previewAfterFrame );
|
||||
m_afterPartitionLabelsView->setExtendedPartitionHidden( mode == PartitionBarsView::NoNestedPartitions );
|
||||
m_afterPartitionLabelsView->setCustomNewRootLabel( *Calamares::Branding::BootloaderEntryName );
|
||||
m_afterPartitionLabelsView->setCustomNewRootLabel( Calamares::Branding::instance()->string(Calamares::Branding::BootloaderEntryName) );
|
||||
|
||||
PartitionModel* model = m_core->partitionModelForDevice( selectedDevice() );
|
||||
|
||||
@ -1135,7 +1135,7 @@ ChoicePage::setupEfiSystemPartitionSelector()
|
||||
tr( "An EFI system partition cannot be found anywhere "
|
||||
"on this system. Please go back and use manual "
|
||||
"partitioning to set up %1." )
|
||||
.arg( *Calamares::Branding::ShortProductName ) );
|
||||
.arg( Calamares::Branding::instance()->shortProductName() ) );
|
||||
updateNextEnabled();
|
||||
}
|
||||
else if ( efiSystemPartitions.count() == 1 ) //probably most usual situation
|
||||
@ -1144,7 +1144,7 @@ ChoicePage::setupEfiSystemPartitionSelector()
|
||||
tr( "The EFI system partition at %1 will be used for "
|
||||
"starting %2." )
|
||||
.arg( efiSystemPartitions.first()->partitionPath() )
|
||||
.arg( *Calamares::Branding::ShortProductName ) );
|
||||
.arg( Calamares::Branding::instance()->shortProductName() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1278,11 +1278,11 @@ ChoicePage::setupActions()
|
||||
|
||||
m_alongsideButton->setText( tr( "<strong>Install alongside</strong><br/>"
|
||||
"The installer will shrink a partition to make room for %1." )
|
||||
.arg( *Calamares::Branding::ShortVersionedName ) );
|
||||
.arg( Calamares::Branding::instance()->shortVersionedName() ) );
|
||||
|
||||
m_replaceButton->setText( tr( "<strong>Replace a partition</strong><br/>"
|
||||
"Replaces a partition with %1." )
|
||||
.arg( *Calamares::Branding::ShortVersionedName ) );
|
||||
.arg( Calamares::Branding::instance()->shortVersionedName() ) );
|
||||
)
|
||||
|
||||
m_replaceButton->hide();
|
||||
@ -1308,7 +1308,7 @@ ChoicePage::setupActions()
|
||||
|
||||
m_alongsideButton->setText( tr( "<strong>Install alongside</strong><br/>"
|
||||
"The installer will shrink a partition to make room for %1." )
|
||||
.arg( *Calamares::Branding::ShortVersionedName ) );
|
||||
.arg( Calamares::Branding::instance()->shortVersionedName() ) );
|
||||
|
||||
m_eraseButton->setText( tr( "<strong>Erase disk</strong><br/>"
|
||||
"This will <font color=\"red\">delete</font> all data "
|
||||
@ -1317,7 +1317,7 @@ ChoicePage::setupActions()
|
||||
|
||||
m_replaceButton->setText( tr( "<strong>Replace a partition</strong><br/>"
|
||||
"Replaces a partition with %1." )
|
||||
.arg( *Calamares::Branding::ShortVersionedName ) );
|
||||
.arg( Calamares::Branding::instance()->shortVersionedName() ) );
|
||||
)
|
||||
}
|
||||
else
|
||||
@ -1331,7 +1331,7 @@ ChoicePage::setupActions()
|
||||
|
||||
m_alongsideButton->setText( tr( "<strong>Install alongside</strong><br/>"
|
||||
"The installer will shrink a partition to make room for %1." )
|
||||
.arg( *Calamares::Branding::ShortVersionedName ) );
|
||||
.arg( Calamares::Branding::instance()->shortVersionedName() ) );
|
||||
|
||||
m_eraseButton->setText( tr( "<strong>Erase disk</strong><br/>"
|
||||
"This will <font color=\"red\">delete</font> all data "
|
||||
@ -1339,7 +1339,7 @@ ChoicePage::setupActions()
|
||||
|
||||
m_replaceButton->setText( tr( "<strong>Replace a partition</strong><br/>"
|
||||
"Replaces a partition with %1." )
|
||||
.arg( *Calamares::Branding::ShortVersionedName ) );
|
||||
.arg( Calamares::Branding::instance()->shortVersionedName() ) );
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -1357,7 +1357,7 @@ ChoicePage::setupActions()
|
||||
|
||||
m_alongsideButton->setText( tr( "<strong>Install alongside</strong><br/>"
|
||||
"The installer will shrink a partition to make room for %1." )
|
||||
.arg( *Calamares::Branding::ShortVersionedName ) );
|
||||
.arg( Calamares::Branding::instance()->shortVersionedName() ) );
|
||||
|
||||
m_eraseButton->setText( tr( "<strong>Erase disk</strong><br/>"
|
||||
"This will <font color=\"red\">delete</font> all data "
|
||||
@ -1365,7 +1365,7 @@ ChoicePage::setupActions()
|
||||
|
||||
m_replaceButton->setText( tr( "<strong>Replace a partition</strong><br/>"
|
||||
"Replaces a partition with %1." )
|
||||
.arg( *Calamares::Branding::ShortVersionedName ) );
|
||||
.arg( Calamares::Branding::instance()->shortVersionedName() ) );
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -154,6 +154,7 @@ PartitionViewStep::createSummaryWidget() const
|
||||
formLayout->setContentsMargins( MARGIN, 0, MARGIN, MARGIN );
|
||||
mainLayout->addLayout( formLayout );
|
||||
|
||||
const auto* branding = Calamares::Branding::instance();
|
||||
QList< PartitionCoreModule::SummaryInfo > list = m_core->createSummaryInfo();
|
||||
if ( list.length() > 1 ) // There are changes on more than one disk
|
||||
{
|
||||
@ -166,15 +167,15 @@ PartitionViewStep::createSummaryWidget() const
|
||||
{
|
||||
case ChoicePage::Alongside:
|
||||
modeText = tr( "Install %1 <strong>alongside</strong> another operating system." )
|
||||
.arg( *Calamares::Branding::ShortVersionedName );
|
||||
.arg( branding->shortVersionedName() );
|
||||
break;
|
||||
case ChoicePage::Erase:
|
||||
modeText
|
||||
= tr( "<strong>Erase</strong> disk and install %1." ).arg( *Calamares::Branding::ShortVersionedName );
|
||||
= tr( "<strong>Erase</strong> disk and install %1." ).arg( branding->shortVersionedName() );
|
||||
break;
|
||||
case ChoicePage::Replace:
|
||||
modeText
|
||||
= tr( "<strong>Replace</strong> a partition with %1." ).arg( *Calamares::Branding::ShortVersionedName );
|
||||
= tr( "<strong>Replace</strong> a partition with %1." ).arg( branding->shortVersionedName() );
|
||||
break;
|
||||
case ChoicePage::NoChoice:
|
||||
case ChoicePage::Manual:
|
||||
@ -193,19 +194,19 @@ PartitionViewStep::createSummaryWidget() const
|
||||
case ChoicePage::Alongside:
|
||||
modeText = tr( "Install %1 <strong>alongside</strong> another operating system on disk "
|
||||
"<strong>%2</strong> (%3)." )
|
||||
.arg( *Calamares::Branding::ShortVersionedName )
|
||||
.arg( branding->shortVersionedName() )
|
||||
.arg( info.deviceNode )
|
||||
.arg( info.deviceName );
|
||||
break;
|
||||
case ChoicePage::Erase:
|
||||
modeText = tr( "<strong>Erase</strong> disk <strong>%2</strong> (%3) and install %1." )
|
||||
.arg( *Calamares::Branding::ShortVersionedName )
|
||||
.arg( branding->shortVersionedName() )
|
||||
.arg( info.deviceNode )
|
||||
.arg( info.deviceName );
|
||||
break;
|
||||
case ChoicePage::Replace:
|
||||
modeText = tr( "<strong>Replace</strong> a partition on disk <strong>%2</strong> (%3) with %1." )
|
||||
.arg( *Calamares::Branding::ShortVersionedName )
|
||||
.arg( branding->shortVersionedName() )
|
||||
.arg( info.deviceNode )
|
||||
.arg( info.deviceName );
|
||||
break;
|
||||
@ -256,7 +257,7 @@ PartitionViewStep::createSummaryWidget() const
|
||||
previewLabels->setModel( info.partitionModelAfter );
|
||||
preview->setSelectionMode( QAbstractItemView::NoSelection );
|
||||
previewLabels->setSelectionMode( QAbstractItemView::NoSelection );
|
||||
previewLabels->setCustomNewRootLabel( *Calamares::Branding::BootloaderEntryName );
|
||||
previewLabels->setCustomNewRootLabel( Calamares::Branding::instance()->string( Calamares::Branding::BootloaderEntryName ));
|
||||
info.partitionModelAfter->setParent( widget );
|
||||
field = new QVBoxLayout;
|
||||
CalamaresUtils::unmarginLayout( field );
|
||||
@ -411,6 +412,7 @@ PartitionViewStep::onLeave()
|
||||
return;
|
||||
}
|
||||
|
||||
const auto* branding = Calamares::Branding::instance();
|
||||
if ( m_widget->currentWidget() == m_manualPartitionPage )
|
||||
{
|
||||
if ( PartUtils::isEfiSystem() )
|
||||
@ -438,7 +440,7 @@ PartitionViewStep::onLeave()
|
||||
"<strong>%2</strong>.<br/><br/>"
|
||||
"You can continue without setting up an EFI system "
|
||||
"partition but your system may fail to start." )
|
||||
.arg( *Calamares::Branding::ShortProductName )
|
||||
.arg( branding->shortProductName() )
|
||||
.arg( espMountPoint, espFlagName );
|
||||
}
|
||||
else if ( esp && !PartUtils::isEfiBootable( esp ) )
|
||||
@ -453,7 +455,7 @@ PartitionViewStep::onLeave()
|
||||
"<br/><br/>"
|
||||
"You can continue without setting the flag but your "
|
||||
"system may fail to start." )
|
||||
.arg( *Calamares::Branding::ShortProductName )
|
||||
.arg( branding->shortProductName() )
|
||||
.arg( espMountPoint, espFlagName );
|
||||
}
|
||||
|
||||
@ -482,7 +484,7 @@ PartitionViewStep::onLeave()
|
||||
"<strong>bios_grub</strong> flag enabled.<br/><br/>"
|
||||
"An unformatted 8 MB partition is necessary "
|
||||
"to start %1 on a BIOS system with GPT." )
|
||||
.arg( *Calamares::Branding::ShortProductName );
|
||||
.arg( branding->shortProductName() );
|
||||
|
||||
QMessageBox::information( m_manualPartitionPage, message, description );
|
||||
}
|
||||
|
@ -133,13 +133,14 @@ ReplaceWidget::onPartitionSelected()
|
||||
if ( Calamares::JobQueue::instance()->globalStorage()->value( "firmwareType" ) == "efi" )
|
||||
m_isEfi = true;
|
||||
|
||||
const auto* branding = Calamares::Branding::instance();
|
||||
if ( m_ui->partitionTreeView->currentIndex() == QModelIndex() )
|
||||
{
|
||||
updateStatus( CalamaresUtils::PartitionPartition,
|
||||
tr( "Select where to install %1.<br/>"
|
||||
"<font color=\"red\">Warning: </font>this will delete all files "
|
||||
"on the selected partition." )
|
||||
.arg( *Calamares::Branding::VersionedName ) );
|
||||
.arg( branding->versionedName() ) );
|
||||
setNextEnabled( false );
|
||||
return;
|
||||
}
|
||||
@ -172,7 +173,7 @@ ReplaceWidget::onPartitionSelected()
|
||||
updateStatus( CalamaresUtils::Fail,
|
||||
tr( "%1 cannot be installed on empty space. Please select an "
|
||||
"existing partition." )
|
||||
.arg( *Calamares::Branding::VersionedName ) );
|
||||
.arg( branding->versionedName() ) );
|
||||
setNextEnabled( false );
|
||||
return;
|
||||
}
|
||||
@ -182,7 +183,7 @@ ReplaceWidget::onPartitionSelected()
|
||||
updateStatus( CalamaresUtils::Fail,
|
||||
tr( "%1 cannot be installed on an extended partition. Please select an "
|
||||
"existing primary or logical partition." )
|
||||
.arg( *Calamares::Branding::VersionedName ) );
|
||||
.arg( branding->versionedName() ) );
|
||||
setNextEnabled( false );
|
||||
return;
|
||||
}
|
||||
@ -191,7 +192,7 @@ ReplaceWidget::onPartitionSelected()
|
||||
{
|
||||
updateStatus( CalamaresUtils::Fail,
|
||||
tr( "%1 cannot be installed on this partition." )
|
||||
.arg( *Calamares::Branding::VersionedName ) );
|
||||
.arg( branding->versionedName() ) );
|
||||
setNextEnabled( false );
|
||||
return;
|
||||
}
|
||||
@ -233,7 +234,7 @@ ReplaceWidget::onPartitionSelected()
|
||||
"The partition %1 is too small for %2. Please select a partition "
|
||||
"with capacity at least %3 GiB." )
|
||||
.arg( partition->partitionPath() )
|
||||
.arg( *Calamares::Branding::VersionedName )
|
||||
.arg( branding->versionedName() )
|
||||
.arg( requiredSpaceB / ( 1024. * 1024. * 1024. ),
|
||||
0, 'f', 1 )
|
||||
.arg( prettyName ) );
|
||||
@ -256,7 +257,7 @@ ReplaceWidget::onPartitionSelected()
|
||||
"An EFI system partition cannot be found anywhere "
|
||||
"on this system. Please go back and use manual "
|
||||
"partitioning to set up %1." )
|
||||
.arg( *Calamares::Branding::ShortProductName )
|
||||
.arg( branding->shortProductName() )
|
||||
.arg( prettyName ) );
|
||||
setNextEnabled( false );
|
||||
}
|
||||
@ -267,14 +268,14 @@ ReplaceWidget::onPartitionSelected()
|
||||
"%1 will be installed on %2.<br/>"
|
||||
"<font color=\"red\">Warning: </font>all data on partition "
|
||||
"%2 will be lost.")
|
||||
.arg( *Calamares::Branding::VersionedName )
|
||||
.arg( branding->versionedName() )
|
||||
.arg( partition->partitionPath() )
|
||||
.arg( prettyName ) );
|
||||
m_ui->bootStatusLabel->show();
|
||||
m_ui->bootStatusLabel->setText(
|
||||
tr( "The EFI system partition at %1 will be used for starting %2." )
|
||||
.arg( efiSystemPartitions.first()->partitionPath() )
|
||||
.arg( *Calamares::Branding::ShortProductName ) );
|
||||
.arg( branding->shortProductName() ) );
|
||||
setNextEnabled( true );
|
||||
}
|
||||
else
|
||||
@ -284,7 +285,7 @@ ReplaceWidget::onPartitionSelected()
|
||||
"%1 will be installed on %2.<br/>"
|
||||
"<font color=\"red\">Warning: </font>all data on partition "
|
||||
"%2 will be lost.")
|
||||
.arg( *Calamares::Branding::VersionedName )
|
||||
.arg( branding->versionedName() )
|
||||
.arg( partition->partitionPath() )
|
||||
.arg( prettyName ) );
|
||||
m_ui->bootStatusLabel->show();
|
||||
@ -308,7 +309,7 @@ ReplaceWidget::onPartitionSelected()
|
||||
"%1 will be installed on %2.<br/>"
|
||||
"<font color=\"red\">Warning: </font>all data on partition "
|
||||
"%2 will be lost.")
|
||||
.arg( *Calamares::Branding::VersionedName )
|
||||
.arg( branding->versionedName() )
|
||||
.arg( partition->partitionPath() )
|
||||
.arg( prettyName ) );
|
||||
setNextEnabled( true );
|
||||
|
@ -163,7 +163,7 @@ FillGlobalStorageJob::prettyDescription() const
|
||||
if ( mountPoint == "/" )
|
||||
{
|
||||
lines.append( tr( "Install %1 on <strong>new</strong> %2 system partition." )
|
||||
.arg( *Calamares::Branding::ShortProductName )
|
||||
.arg( Calamares::Branding::instance()->shortProductName() )
|
||||
.arg( fsType ) );
|
||||
}
|
||||
else
|
||||
@ -180,7 +180,7 @@ FillGlobalStorageJob::prettyDescription() const
|
||||
{
|
||||
lines.append( tr( "Install %2 on %3 system partition <strong>%1</strong>." )
|
||||
.arg( path )
|
||||
.arg( *Calamares::Branding::ShortProductName )
|
||||
.arg( Calamares::Branding::instance()->shortProductName() )
|
||||
.arg( fsType ) );
|
||||
}
|
||||
else
|
||||
|
@ -32,9 +32,7 @@ TrackingInstallJob::TrackingInstallJob( const QString& url )
|
||||
{
|
||||
}
|
||||
|
||||
TrackingInstallJob::~TrackingInstallJob()
|
||||
{
|
||||
}
|
||||
TrackingInstallJob::~TrackingInstallJob() { }
|
||||
|
||||
QString
|
||||
TrackingInstallJob::prettyName() const
|
||||
|
@ -36,24 +36,23 @@ TrackingPage::TrackingPage( QWidget* parent )
|
||||
: QWidget( parent )
|
||||
, ui( new Ui::TrackingPage )
|
||||
{
|
||||
using StringEntry = Calamares::Branding::StringEntry;
|
||||
|
||||
ui->setupUi( this );
|
||||
CALAMARES_RETRANSLATE(
|
||||
ui->retranslateUi( this ); ui->generalExplanation->setText(
|
||||
QString product = Calamares::Branding::instance()->shortProductName(); ui->retranslateUi( this );
|
||||
ui->generalExplanation->setText(
|
||||
tr( "Install tracking helps %1 to see how many users they have, what hardware they install %1 to and (with "
|
||||
"the last two options below), get continuous information about preferred applications. To see what "
|
||||
"will be sent, please click the help icon next to each area." )
|
||||
.arg( *StringEntry::ShortProductName ) );
|
||||
.arg( product ) );
|
||||
ui->installExplanation->setText(
|
||||
tr( "By selecting this you will send information about your installation and hardware. This information "
|
||||
"will <b>only be sent once</b> after the installation finishes." ) );
|
||||
ui->machineExplanation->setText( tr( "By selecting this you will <b>periodically</b> send information about "
|
||||
"your installation, hardware and applications, to %1." )
|
||||
.arg( *StringEntry::ShortProductName ) );
|
||||
.arg( product ) );
|
||||
ui->userExplanation->setText( tr( "By selecting this you will <b>regularly</b> send information about your "
|
||||
"installation, hardware, applications and usage patterns, to %1." )
|
||||
.arg( *StringEntry::ShortProductName ) ); )
|
||||
.arg( product ) ); )
|
||||
|
||||
QButtonGroup* group = new QButtonGroup( this );
|
||||
group->setExclusive( true );
|
||||
@ -147,7 +146,7 @@ TrackingPage::setTrackingPolicy( TrackingType t, QString url )
|
||||
}
|
||||
else
|
||||
{
|
||||
connect( button, &QToolButton::clicked, [url] { QDesktopServices::openUrl( url ); } );
|
||||
connect( button, &QToolButton::clicked, [ url ] { QDesktopServices::openUrl( url ); } );
|
||||
cDebug() << "Tracking policy" << int( t ) << "set to" << url;
|
||||
}
|
||||
else
|
||||
@ -168,7 +167,7 @@ TrackingPage::setGeneralPolicy( QString url )
|
||||
ui->generalPolicyLabel->show();
|
||||
ui->generalPolicyLabel->setTextInteractionFlags( Qt::TextBrowserInteraction );
|
||||
ui->generalPolicyLabel->show();
|
||||
connect( ui->generalPolicyLabel, &QLabel::linkActivated, [url] { QDesktopServices::openUrl( url ); } );
|
||||
connect( ui->generalPolicyLabel, &QLabel::linkActivated, [ url ] { QDesktopServices::openUrl( url ); } );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ Config::Config( QObject* parent )
|
||||
void
|
||||
Config::retranslate()
|
||||
{
|
||||
m_genericWelcomeMessage = genericWelcomeMessage().arg( *Calamares::Branding::VersionedName );
|
||||
m_genericWelcomeMessage = genericWelcomeMessage().arg( Calamares::Branding::instance()->versionedName() );
|
||||
emit genericWelcomeMessageChanged( m_genericWelcomeMessage );
|
||||
|
||||
if ( !m_requirementsModel->satisfiedRequirements() )
|
||||
@ -72,13 +72,13 @@ Config::retranslate()
|
||||
"might be disabled." );
|
||||
}
|
||||
|
||||
m_warningMessage = message.arg( *Calamares::Branding::ShortVersionedName );
|
||||
m_warningMessage = message.arg( Calamares::Branding::instance()->shortVersionedName() );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_warningMessage = tr( "This program will ask you some questions and "
|
||||
"set up %2 on your computer." )
|
||||
.arg( *Calamares::Branding::ProductName );
|
||||
.arg( Calamares::Branding::instance()->productName() );
|
||||
}
|
||||
|
||||
emit warningMessageChanged( m_warningMessage );
|
||||
@ -103,7 +103,7 @@ Config::initLanguages()
|
||||
QLocale defaultLocale = QLocale( QLocale::system().name() );
|
||||
|
||||
cDebug() << "Matching locale" << defaultLocale;
|
||||
int matchedLocaleIndex = m_languages->find( [&]( const QLocale& x ) {
|
||||
int matchedLocaleIndex = m_languages->find( [ & ]( const QLocale& x ) {
|
||||
return x.language() == defaultLocale.language() && x.country() == defaultLocale.country();
|
||||
} );
|
||||
|
||||
@ -112,7 +112,7 @@ Config::initLanguages()
|
||||
cDebug() << Logger::SubEntry << "Matching approximate locale" << defaultLocale.language();
|
||||
|
||||
matchedLocaleIndex
|
||||
= m_languages->find( [&]( const QLocale& x ) { return x.language() == defaultLocale.language(); } );
|
||||
= m_languages->find( [ & ]( const QLocale& x ) { return x.language() == defaultLocale.language(); } );
|
||||
}
|
||||
|
||||
if ( matchedLocaleIndex < 0 )
|
||||
|
@ -56,9 +56,7 @@ WelcomePage::WelcomePage( Config* conf, QWidget* parent )
|
||||
const int defaultFontHeight = CalamaresUtils::defaultFontHeight();
|
||||
ui->setupUi( this );
|
||||
ui->aboutButton->setIcon( CalamaresUtils::defaultPixmap(
|
||||
CalamaresUtils::Information,
|
||||
CalamaresUtils::Original,
|
||||
2 * QSize( defaultFontHeight, defaultFontHeight ) ) );
|
||||
CalamaresUtils::Information, CalamaresUtils::Original, 2 * QSize( defaultFontHeight, defaultFontHeight ) ) );
|
||||
|
||||
// insert system-check widget below welcome text
|
||||
const int welcome_text_idx = ui->verticalLayout->indexOf( ui->mainText );
|
||||
@ -85,8 +83,6 @@ WelcomePage::WelcomePage( Config* conf, QWidget* parent )
|
||||
|
||||
initLanguages();
|
||||
|
||||
cDebug() << "Welcome string" << Calamares::Branding::instance()->welcomeStyleCalamares()
|
||||
<< *Calamares::Branding::VersionedName;
|
||||
CALAMARES_RETRANSLATE_SLOT( &WelcomePage::retranslate )
|
||||
|
||||
connect( ui->aboutButton, &QPushButton::clicked, this, &WelcomePage::showAboutBox );
|
||||
@ -177,7 +173,7 @@ WelcomePage::setupButton( Button role, const QString& url )
|
||||
{
|
||||
auto size = 2 * QSize( CalamaresUtils::defaultFontHeight(), CalamaresUtils::defaultFontHeight() );
|
||||
button->setIcon( CalamaresUtils::defaultPixmap( icon, CalamaresUtils::Original, size ) );
|
||||
connect( button, &QPushButton::clicked, [u]() { QDesktopServices::openUrl( u ); } );
|
||||
connect( button, &QPushButton::clicked, [ u ]() { QDesktopServices::openUrl( u ); } );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -235,9 +231,9 @@ WelcomePage::retranslate()
|
||||
: tr( "<h1>Welcome to the %1 installer.</h1>" );
|
||||
}
|
||||
|
||||
ui->mainText->setText( message.arg( *Calamares::Branding::VersionedName ) );
|
||||
ui->mainText->setText( message.arg( Calamares::Branding::instance()->versionedName() ) );
|
||||
ui->retranslateUi( this );
|
||||
ui->supportButton->setText( tr( "%1 support" ).arg( *Calamares::Branding::ShortProductName ) );
|
||||
ui->supportButton->setText( tr( "%1 support" ).arg( Calamares::Branding::instance()->shortProductName() ) );
|
||||
}
|
||||
|
||||
void
|
||||
@ -261,7 +257,7 @@ WelcomePage::showAboutBox()
|
||||
"Liberating Software." )
|
||||
.arg( CALAMARES_APPLICATION_NAME )
|
||||
.arg( CALAMARES_VERSION )
|
||||
.arg( *Calamares::Branding::VersionedName ),
|
||||
.arg( Calamares::Branding::instance()->versionedName() ),
|
||||
QMessageBox::Ok,
|
||||
this );
|
||||
mb.setIconPixmap( CalamaresUtils::defaultPixmap(
|
||||
|
@ -129,7 +129,7 @@ jobOrBrandingSetting( Calamares::Branding::StringEntry e, const QVariantMap& map
|
||||
auto v = map.value( key );
|
||||
if ( v.type() == QVariant::Bool )
|
||||
{
|
||||
return v.toBool() ? ( *e ) : QString();
|
||||
return v.toBool() ? ( Calamares::Branding::instance()->string( e ) ) : QString();
|
||||
}
|
||||
if ( v.type() == QVariant::String )
|
||||
{
|
||||
@ -174,7 +174,7 @@ WelcomeViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
if ( handler->type() != CalamaresUtils::GeoIP::Handler::Type::None )
|
||||
{
|
||||
auto* future = new FWString();
|
||||
connect( future, &FWString::finished, [view = this, f = future, h = handler]() {
|
||||
connect( future, &FWString::finished, [ view = this, f = future, h = handler ]() {
|
||||
QString countryResult = f->future().result();
|
||||
cDebug() << "GeoIP result for welcome=" << countryResult;
|
||||
view->setCountry( countryResult, h );
|
||||
|
@ -278,13 +278,13 @@ ResultsListWidget::retranslate()
|
||||
"Installation can continue, but some features "
|
||||
"might be disabled." );
|
||||
}
|
||||
m_explanation->setText( message.arg( *Calamares::Branding::ShortVersionedName ) );
|
||||
m_explanation->setText( message.arg( Calamares::Branding::instance()->shortVersionedName() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_explanation->setText( tr( "This program will ask you some questions and "
|
||||
"set up %2 on your computer." )
|
||||
.arg( *Calamares::Branding::ProductName ) );
|
||||
.arg( Calamares::Branding::instance()->productName() ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ jobOrBrandingSetting( Calamares::Branding::StringEntry e, const QVariantMap& map
|
||||
auto v = map.value( key );
|
||||
if ( v.type() == QVariant::Bool )
|
||||
{
|
||||
return v.toBool() ? ( *e ) : QString();
|
||||
return v.toBool() ? ( Calamares::Branding::instance()->string( e ) ) : QString();
|
||||
}
|
||||
if ( v.type() == QVariant::String )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user