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
cf39d312
Commit
cf39d312
authored
Feb 12, 2019
by
Adriaan de Groot
Browse files
Options
Downloads
Plain Diff
Merge branch 'fix-swap-choice-nullptr'
FIXES #1084
parents
ae714278
2a8960cd
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/modules/partition/gui/ChoicePage.cpp
+25
-10
25 additions, 10 deletions
src/modules/partition/gui/ChoicePage.cpp
src/modules/partition/gui/ChoicePage.h
+5
-3
5 additions, 3 deletions
src/modules/partition/gui/ChoicePage.h
with
30 additions
and
13 deletions
src/modules/partition/gui/ChoicePage.cpp
+
25
−
10
View file @
cf39d312
/* === This file is part of Calamares - <https://github.com/calamares> ===
*
* Copyright 2014-2017, Teo Mrnjavac <teo@kde.org>
* Copyright 2017-201
8
, Adriaan de Groot <groot@kde.org>
* Copyright 2017-201
9
, Adriaan de Groot <groot@kde.org>
* Copyright 2019, Collabora Ltd
*
* Calamares is free software: you can redistribute it and/or modify
...
...
@@ -100,7 +100,7 @@ ChoicePage::ChoicePage( const SwapChoiceSet& swapChoices, QWidget* parent )
,
m_eraseButton
(
nullptr
)
,
m_replaceButton
(
nullptr
)
,
m_somethingElseButton
(
nullptr
)
,
m_eraseSwapChoice
s
(
nullptr
)
,
m_eraseSwapChoice
ComboBox
(
nullptr
)
,
m_deviceInfoWidget
(
nullptr
)
,
m_beforePartitionBarsView
(
nullptr
)
,
m_beforePartitionLabelsView
(
nullptr
)
...
...
@@ -201,15 +201,21 @@ ChoicePage::init( PartitionCoreModule* core )
/** @brief Creates a combobox with the given choices in it.
*
* Pre-selects the choice given by @p dflt.
* No texts are set -- that happens later by the translator functions.
*/
static
inline
QComboBox
*
createCombo
(
const
QSet
<
SwapChoice
>&
s
)
createCombo
(
const
QSet
<
SwapChoice
>&
s
,
SwapChoice
dflt
)
{
QComboBox
*
box
=
new
QComboBox
;
for
(
SwapChoice
c
:
{
SwapChoice
::
NoSwap
,
SwapChoice
::
SmallSwap
,
SwapChoice
::
FullSwap
,
SwapChoice
::
ReuseSwap
,
SwapChoice
::
SwapFile
}
)
if
(
s
.
contains
(
c
)
)
box
->
addItem
(
QString
(),
c
);
int
dfltIndex
=
box
->
findData
(
dflt
);
if
(
dfltIndex
>=
0
)
box
->
setCurrentIndex
(
dfltIndex
);
return
box
;
}
...
...
@@ -270,8 +276,8 @@ ChoicePage::setupChoices()
// .. TODO: only if enabled in the config
if
(
m_availableSwapChoices
.
count
()
>
1
)
{
m_eraseSwapChoice
s
=
createCombo
(
m_availableSwapChoices
);
m_eraseButton
->
addOptionsComboBox
(
m_eraseSwapChoice
s
);
m_eraseSwapChoice
ComboBox
=
createCombo
(
m_availableSwapChoices
,
m_eraseSwapChoice
);
m_eraseButton
->
addOptionsComboBox
(
m_eraseSwapChoice
ComboBox
);
}
m_itemsLayout
->
addWidget
(
m_alongsideButton
);
...
...
@@ -316,14 +322,14 @@ ChoicePage::setupChoices()
connect
(
this
,
&
ChoicePage
::
actionChosen
,
this
,
&
ChoicePage
::
onActionChanged
);
if
(
m_eraseSwapChoice
s
)
connect
(
m_eraseSwapChoice
s
,
QOverload
<
int
>::
of
(
&
QComboBox
::
currentIndexChanged
),
this
,
&
ChoicePage
::
on
Action
Changed
);
if
(
m_eraseSwapChoice
ComboBox
)
connect
(
m_eraseSwapChoice
ComboBox
,
QOverload
<
int
>::
of
(
&
QComboBox
::
currentIndexChanged
),
this
,
&
ChoicePage
::
on
EraseSwapChoice
Changed
);
CALAMARES_RETRANSLATE
(
m_somethingElseButton
->
setText
(
tr
(
"<strong>Manual partitioning</strong><br/>"
"You can create or resize partitions yourself."
)
);
updateSwapChoicesTr
(
m_eraseSwapChoice
s
);
updateSwapChoicesTr
(
m_eraseSwapChoice
ComboBox
);
)
}
...
...
@@ -428,6 +434,15 @@ ChoicePage::onActionChanged()
}
}
void
ChoicePage
::
onEraseSwapChoiceChanged
()
{
if
(
m_eraseSwapChoiceComboBox
)
{
m_eraseSwapChoice
=
static_cast
<
PartitionActions
::
Choices
::
SwapChoice
>
(
m_eraseSwapChoiceComboBox
->
currentData
().
toInt
()
);
onActionChanged
();
}
}
void
ChoicePage
::
applyActionChoice
(
ChoicePage
::
InstallChoice
choice
)
...
...
@@ -448,7 +463,7 @@ ChoicePage::applyActionChoice( ChoicePage::InstallChoice choice )
m_encryptWidget
->
passphrase
(),
gs
->
value
(
"efiSystemPartition"
).
toString
(),
CalamaresUtils
::
GiBtoBytes
(
gs
->
value
(
"requiredStorageGB"
).
toDouble
()
),
static_cast
<
PartitionActions
::
Choices
::
SwapChoice
>
(
m_eraseSwapChoices
->
currentData
().
toInt
()
)
m_eraseSwapChoice
};
if
(
m_core
->
isDirty
()
)
...
...
This diff is collapsed.
Click to expand it.
src/modules/partition/gui/ChoicePage.h
+
5
−
3
View file @
cf39d312
/* === This file is part of Calamares - <https://github.com/calamares> ===
*
* Copyright 2014-2016, Teo Mrnjavac <teo@kde.org>
* Copyright 2018, Adriaan de Groot <groot@kde.org>
* Copyright 2018
-2019
, Adriaan de Groot <groot@kde.org>
* Copyright 2019, Collabora Ltd
*
* Calamares is free software: you can redistribute it and/or modify
...
...
@@ -116,8 +116,10 @@ private slots:
void
onEncryptWidgetStateChanged
();
void
onHomeCheckBoxStateChanged
();
/
**
@brief Calls applyActionChoice() as needed.
*/
/
//
@brief Calls applyActionChoice() as needed.
void
onActionChanged
();
/// @brief Calls onActionChanged() as needed.
void
onEraseSwapChoiceChanged
();
private
:
void
updateNextEnabled
();
...
...
@@ -155,7 +157,7 @@ private:
PrettyRadioButton
*
m_eraseButton
;
PrettyRadioButton
*
m_replaceButton
;
PrettyRadioButton
*
m_somethingElseButton
;
QComboBox
*
m_eraseSwapChoice
s
;
// UI, see also m_
s
wapChoice
s
QComboBox
*
m_eraseSwapChoice
ComboBox
;
// UI, see also m_
eraseS
wapChoice
DeviceInfoWidget
*
m_deviceInfoWidget
;
...
...
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