Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Calamares
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
osak
Calamares
Commits
70ddfa25
Commit
70ddfa25
authored
9 years ago
by
Teo Mrnjavac
Browse files
Options
Downloads
Patches
Plain Diff
Disable Alongside if primary partition limit reached on all devices.
parent
eabe0c68
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/modules/partition/gui/ChoicePage.cpp
+55
-0
55 additions, 0 deletions
src/modules/partition/gui/ChoicePage.cpp
with
55 additions
and
0 deletions
src/modules/partition/gui/ChoicePage.cpp
+
55
−
0
View file @
70ddfa25
...
...
@@ -22,6 +22,8 @@
#include
"core/DeviceModel.h"
#include
"core/PartitionModel.h"
#include
"OsproberEntry.h"
#include
"core/partitiontable.h"
#include
"core/device.h"
#include
"PrettyRadioButton.h"
...
...
@@ -111,6 +113,24 @@ ChoicePage::init( PartitionCoreModule* core, const OsproberEntryList& osproberEn
m_itemsLayout
->
addWidget
(
eraseButton
);
m_itemsLayout
->
setSpacing
(
CalamaresUtils
::
defaultFontHeight
()
/
2
);
// TODO 2.0: move this to a Utils namespace.
// Iterate over devices in devicemodel, foreach device, if it's DOS MBR and limit is
// reached and we have an osprober entry inside it, then disable alongside.
QStringList
pathsOfDevicesWithPrimariesLimitReached
;
for
(
int
row
=
0
;
row
<
m_core
->
deviceModel
()
->
rowCount
();
++
row
)
{
const
QModelIndex
&
deviceIndex
=
m_core
->
deviceModel
()
->
index
(
row
);
Device
*
dev
=
m_core
->
deviceModel
()
->
deviceForIndex
(
deviceIndex
);
if
(
(
dev
->
partitionTable
()
->
type
()
==
PartitionTable
::
msdos
||
dev
->
partitionTable
()
->
type
()
==
PartitionTable
::
msdos_sectorbased
)
&&
dev
->
partitionTable
()
->
numPrimaries
()
==
dev
->
partitionTable
()
->
maxPrimaries
()
)
{
// Primaries limit reached!
pathsOfDevicesWithPrimariesLimitReached
.
append
(
dev
->
deviceNode
()
);
}
}
if
(
osproberEntries
.
count
()
==
0
)
{
CALAMARES_RETRANSLATE
(
...
...
@@ -137,6 +157,18 @@ ChoicePage::init( PartitionCoreModule* core, const OsproberEntryList& osproberEn
{
QString
osName
=
osproberEntries
.
first
().
prettyName
;
// Find out if our osprober entry (which is the shrink candidate) is on a
// device that can accommodate more partitions.
bool
cantCreatePartitions
=
false
;
foreach
(
const
QString
&
devicePath
,
pathsOfDevicesWithPrimariesLimitReached
)
{
if
(
osproberEntries
.
first
().
path
.
startsWith
(
devicePath
)
)
{
cantCreatePartitions
=
true
;
break
;
}
}
if
(
!
osName
.
isEmpty
()
)
{
CALAMARES_RETRANSLATE
(
...
...
@@ -207,6 +239,8 @@ ChoicePage::init( PartitionCoreModule* core, const OsproberEntryList& osproberEn
}
if
(
!
osproberEntries
.
first
().
canBeResized
)
alongsideButton
->
hide
();
if
(
cantCreatePartitions
)
alongsideButton
->
hide
();
}
else
{
...
...
@@ -223,6 +257,27 @@ ChoicePage::init( PartitionCoreModule* core, const OsproberEntryList& osproberEn
}
}
// Find out if at least one of our osprober entries is on a
// device that can accommodate more partitions.
bool
atLeastOneCanCreatePartitions
=
false
;
foreach
(
const
OsproberEntry
&
entry
,
osproberEntries
)
{
bool
cantCreatePartitions
=
false
;
foreach
(
const
QString
&
devicePath
,
pathsOfDevicesWithPrimariesLimitReached
)
{
if
(
entry
.
path
.
startsWith
(
devicePath
)
)
{
cantCreatePartitions
=
true
;
break
;
}
}
if
(
!
cantCreatePartitions
)
{
atLeastOneCanCreatePartitions
=
true
;
break
;
}
}
CALAMARES_RETRANSLATE
(
m_messageLabel
->
setText
(
tr
(
"This computer currently has multiple operating systems on it. "
"What would you like to do?"
)
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment