Make choice text refer to the currently selected device.
This commit is contained in:
parent
b31ac92d7e
commit
4c90a68241
@ -558,10 +558,13 @@ ChoicePage::updateActionChoicePreview( Device* currentDevice, ChoicePage::Choice
|
|||||||
void
|
void
|
||||||
ChoicePage::setupActions( Device *currentDevice )
|
ChoicePage::setupActions( Device *currentDevice )
|
||||||
{
|
{
|
||||||
if ( m_osproberEntries.count() == 0 )
|
OsproberEntryList osproberEntriesForCurrentDevice =
|
||||||
|
getOsproberEntriesForDevice( currentDevice );
|
||||||
|
|
||||||
|
if ( osproberEntriesForCurrentDevice.count() == 0 )
|
||||||
{
|
{
|
||||||
CALAMARES_RETRANSLATE(
|
CALAMARES_RETRANSLATE(
|
||||||
m_messageLabel->setText( tr( "This computer currently does not seem to have an operating system on it. "
|
m_messageLabel->setText( tr( "This storage device does not seem to have an operating system on it. "
|
||||||
"What would you like to do?" ) );
|
"What would you like to do?" ) );
|
||||||
|
|
||||||
m_eraseButton->setText( tr( "<strong>Erase disk and install %1</strong><br/>"
|
m_eraseButton->setText( tr( "<strong>Erase disk and install %1</strong><br/>"
|
||||||
@ -578,14 +581,14 @@ ChoicePage::setupActions( Device *currentDevice )
|
|||||||
m_replaceButton->hide();
|
m_replaceButton->hide();
|
||||||
m_alongsideButton->hide();
|
m_alongsideButton->hide();
|
||||||
}
|
}
|
||||||
else if ( m_osproberEntries.count() == 1 )
|
else if ( osproberEntriesForCurrentDevice.count() == 1 )
|
||||||
{
|
{
|
||||||
QString osName = m_osproberEntries.first().prettyName;
|
QString osName = osproberEntriesForCurrentDevice.first().prettyName;
|
||||||
|
|
||||||
if ( !osName.isEmpty() )
|
if ( !osName.isEmpty() )
|
||||||
{
|
{
|
||||||
CALAMARES_RETRANSLATE(
|
CALAMARES_RETRANSLATE(
|
||||||
m_messageLabel->setText( tr( "This computer currently has %1 on it. "
|
m_messageLabel->setText( tr( "This storage device has %1 on it. "
|
||||||
"What would you like to do?" )
|
"What would you like to do?" )
|
||||||
.arg( osName ) );
|
.arg( osName ) );
|
||||||
|
|
||||||
@ -618,7 +621,7 @@ ChoicePage::setupActions( Device *currentDevice )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
CALAMARES_RETRANSLATE(
|
CALAMARES_RETRANSLATE(
|
||||||
m_messageLabel->setText( tr( "This computer already has an operating system on it. "
|
m_messageLabel->setText( tr( "This storage device already has an operating system on it. "
|
||||||
"What would you like to do?" ) );
|
"What would you like to do?" ) );
|
||||||
|
|
||||||
m_alongsideButton->setText( tr( "<strong>Install %1 alongside your current operating system</strong><br/>"
|
m_alongsideButton->setText( tr( "<strong>Install %1 alongside your current operating system</strong><br/>"
|
||||||
@ -646,16 +649,16 @@ ChoicePage::setupActions( Device *currentDevice )
|
|||||||
string( Calamares::Branding::ShortVersionedName ) ) );
|
string( Calamares::Branding::ShortVersionedName ) ) );
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if ( !m_osproberEntries.first().canBeResized )
|
if ( !osproberEntriesForCurrentDevice.first().canBeResized )
|
||||||
m_alongsideButton->hide();
|
m_alongsideButton->hide();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// m_osproberLines has at least 2 items.
|
// osproberEntriesForCurrentDevice has at least 2 items.
|
||||||
|
|
||||||
bool atLeastOneCanBeResized = false;
|
bool atLeastOneCanBeResized = false;
|
||||||
|
|
||||||
foreach ( const OsproberEntry& entry, m_osproberEntries )
|
foreach ( const OsproberEntry& entry, osproberEntriesForCurrentDevice )
|
||||||
{
|
{
|
||||||
if ( entry.canBeResized )
|
if ( entry.canBeResized )
|
||||||
{
|
{
|
||||||
@ -665,7 +668,7 @@ ChoicePage::setupActions( Device *currentDevice )
|
|||||||
}
|
}
|
||||||
|
|
||||||
CALAMARES_RETRANSLATE(
|
CALAMARES_RETRANSLATE(
|
||||||
m_messageLabel->setText( tr( "This computer currently has multiple operating systems on it. "
|
m_messageLabel->setText( tr( "This storage device has multiple operating systems on it. "
|
||||||
"What would you like to do?" ) );
|
"What would you like to do?" ) );
|
||||||
|
|
||||||
m_alongsideButton->setText( tr( "<strong>Install %1 alongside your current operating systems</strong><br/>"
|
m_alongsideButton->setText( tr( "<strong>Install %1 alongside your current operating systems</strong><br/>"
|
||||||
@ -710,6 +713,19 @@ ChoicePage::setupActions( Device *currentDevice )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
OsproberEntryList
|
||||||
|
ChoicePage::getOsproberEntriesForDevice( Device* device ) const
|
||||||
|
{
|
||||||
|
OsproberEntryList eList;
|
||||||
|
foreach ( const OsproberEntry& entry, m_osproberEntries )
|
||||||
|
{
|
||||||
|
if ( entry.path.startsWith( device->deviceNode() ) )
|
||||||
|
eList.append( entry );
|
||||||
|
}
|
||||||
|
return eList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ChoicePage::isNextEnabled() const
|
ChoicePage::isNextEnabled() const
|
||||||
{
|
{
|
||||||
|
@ -78,6 +78,7 @@ private:
|
|||||||
void applyActionChoice( Device* currentDevice, ChoicePage::Choice choice );
|
void applyActionChoice( Device* currentDevice, ChoicePage::Choice choice );
|
||||||
void updateActionChoicePreview( Device* currentDevice, ChoicePage::Choice choice );
|
void updateActionChoicePreview( Device* currentDevice, ChoicePage::Choice choice );
|
||||||
void setupActions( Device* currentDevice );
|
void setupActions( Device* currentDevice );
|
||||||
|
OsproberEntryList getOsproberEntriesForDevice( Device* device ) const;
|
||||||
|
|
||||||
bool m_nextEnabled;
|
bool m_nextEnabled;
|
||||||
PartitionCoreModule* m_core;
|
PartitionCoreModule* m_core;
|
||||||
|
Loading…
Reference in New Issue
Block a user