2017-12-20 14:39:09 +01:00
|
|
|
/* === This file is part of Calamares - <https://github.com/calamares> ===
|
2014-09-03 18:09:37 +02:00
|
|
|
*
|
2016-01-11 19:02:34 +01:00
|
|
|
* Copyright 2014-2016, Teo Mrnjavac <teo@kde.org>
|
2014-09-03 18:09:37 +02:00
|
|
|
*
|
|
|
|
* Calamares is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* Calamares is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef CHOICEPAGE_H
|
|
|
|
#define CHOICEPAGE_H
|
|
|
|
|
2015-09-30 17:24:37 +02:00
|
|
|
#include "ui_ChoicePage.h"
|
|
|
|
|
2014-09-03 18:09:37 +02:00
|
|
|
#include <QWidget>
|
|
|
|
|
2015-09-18 15:41:07 +02:00
|
|
|
#include "core/OsproberEntry.h"
|
2014-09-23 17:42:11 +02:00
|
|
|
|
2015-09-18 17:25:55 +02:00
|
|
|
#include <QMutex>
|
2015-12-17 15:39:52 +01:00
|
|
|
#include <QPointer>
|
2015-09-18 17:25:55 +02:00
|
|
|
|
2014-09-03 18:09:37 +02:00
|
|
|
class QBoxLayout;
|
2015-11-20 14:49:37 +01:00
|
|
|
class QComboBox;
|
2014-09-03 18:09:37 +02:00
|
|
|
class QLabel;
|
2015-09-18 17:25:55 +02:00
|
|
|
class QListView;
|
2014-09-03 18:09:37 +02:00
|
|
|
|
2015-12-17 15:39:52 +01:00
|
|
|
class PartitionBarsView;
|
2016-01-11 19:02:34 +01:00
|
|
|
class PartitionSplitterWidget;
|
2015-12-17 15:39:52 +01:00
|
|
|
class PartitionLabelsView;
|
2014-09-03 18:09:37 +02:00
|
|
|
class PartitionCoreModule;
|
2015-10-06 18:56:33 +02:00
|
|
|
class PrettyRadioButton;
|
2015-11-27 17:25:47 +01:00
|
|
|
class DeviceInfoWidget;
|
2014-09-03 18:09:37 +02:00
|
|
|
|
2015-10-23 17:45:28 +02:00
|
|
|
class Device;
|
|
|
|
|
2017-03-03 12:32:35 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief The ChoicePage class is the first page of the partitioning interface.
|
|
|
|
* It offers a choice between partitioning operations and initiates all automated
|
|
|
|
* partitioning modes. For manual partitioning, see PartitionPage.
|
|
|
|
*/
|
2015-09-30 17:24:37 +02:00
|
|
|
class ChoicePage : public QWidget, private Ui::ChoicePage
|
2014-09-03 18:09:37 +02:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
enum Choice
|
|
|
|
{
|
|
|
|
NoChoice,
|
|
|
|
Alongside,
|
|
|
|
Erase,
|
2014-12-16 17:04:09 +01:00
|
|
|
Replace,
|
2014-09-03 18:09:37 +02:00
|
|
|
Manual
|
|
|
|
};
|
|
|
|
|
2015-11-26 15:31:06 +01:00
|
|
|
explicit ChoicePage( QWidget* parent = nullptr );
|
2014-09-03 18:09:37 +02:00
|
|
|
virtual ~ChoicePage();
|
|
|
|
|
2017-03-03 12:32:35 +01:00
|
|
|
/**
|
|
|
|
* @brief init runs when the PartitionViewStep and the PartitionCoreModule are
|
|
|
|
* ready. Sets up the rest of the UI based on os-prober output.
|
|
|
|
* @param core the PartitionCoreModule pointer.
|
|
|
|
*/
|
2015-12-15 14:00:34 +01:00
|
|
|
void init( PartitionCoreModule* core );
|
2014-09-03 18:09:37 +02:00
|
|
|
|
2017-03-03 12:32:35 +01:00
|
|
|
/**
|
|
|
|
* @brief isNextEnabled answers whether the current state of the page is such
|
|
|
|
* that progressing to the next page should be allowed.
|
|
|
|
* @return true if next is allowed, otherwise false.
|
|
|
|
*/
|
2015-04-15 12:20:01 +02:00
|
|
|
bool isNextEnabled() const;
|
2014-09-03 18:09:37 +02:00
|
|
|
|
2017-03-03 12:32:35 +01:00
|
|
|
/**
|
|
|
|
* @brief currentChoice returns the enum Choice value corresponding to the
|
|
|
|
* currently selected partitioning mode (with a PrettyRadioButton).
|
|
|
|
* @return the enum Choice value.
|
|
|
|
*/
|
2015-04-15 12:20:01 +02:00
|
|
|
Choice currentChoice() const;
|
2014-09-03 18:09:37 +02:00
|
|
|
|
2017-03-03 12:32:35 +01:00
|
|
|
/**
|
|
|
|
* @brief onLeave runs when control passes from this page to another one.
|
|
|
|
*/
|
2016-02-19 16:33:19 +01:00
|
|
|
void onLeave();
|
2017-03-03 12:32:35 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief applyActionChoice reacts to a choice of partitioning mode.
|
|
|
|
* @param choice the partitioning action choice.
|
|
|
|
*/
|
2016-06-29 18:46:02 +02:00
|
|
|
void applyActionChoice( ChoicePage::Choice choice );
|
2016-01-13 17:49:36 +01:00
|
|
|
|
2014-09-03 18:09:37 +02:00
|
|
|
signals:
|
2014-09-04 19:37:30 +02:00
|
|
|
void nextStatusChanged( bool );
|
2015-10-29 17:34:59 +01:00
|
|
|
void actionChosen();
|
2015-12-17 18:02:14 +01:00
|
|
|
void deviceChosen();
|
2014-09-03 18:09:37 +02:00
|
|
|
|
2015-12-31 15:12:40 +01:00
|
|
|
private slots:
|
2016-07-15 11:25:47 +02:00
|
|
|
void onPartitionToReplaceSelected( const QModelIndex& current, const QModelIndex& previous );
|
|
|
|
void doReplaceSelectedPartition( const QModelIndex& current );
|
2016-01-12 14:04:25 +01:00
|
|
|
void doAlongsideSetupSplitter( const QModelIndex& current, const QModelIndex& previous );
|
2016-05-05 12:26:28 +02:00
|
|
|
void onEncryptWidgetStateChanged();
|
2016-07-15 11:25:47 +02:00
|
|
|
void onHomeCheckBoxStateChanged();
|
2015-12-31 15:12:40 +01:00
|
|
|
|
2014-09-03 18:09:37 +02:00
|
|
|
private:
|
2016-04-22 16:02:07 +02:00
|
|
|
void updateNextEnabled();
|
2015-10-06 18:56:33 +02:00
|
|
|
void setupChoices();
|
2016-01-28 18:43:35 +01:00
|
|
|
QComboBox* createBootloaderComboBox( QWidget* parentButton );
|
2015-10-29 17:34:59 +01:00
|
|
|
Device* selectedDevice();
|
2018-01-09 11:09:24 +01:00
|
|
|
|
|
|
|
/* Change the UI depending on the device selected. */
|
|
|
|
void hideButtons(); // Hide everything when no device
|
|
|
|
void applyDeviceChoice(); // Start scanning new device
|
|
|
|
void continueApplyDeviceChoice(); // .. called after scan
|
|
|
|
|
2015-12-17 18:02:14 +01:00
|
|
|
void updateDeviceStatePreview();
|
|
|
|
void updateActionChoicePreview( ChoicePage::Choice choice );
|
|
|
|
void setupActions();
|
2015-11-27 14:47:52 +01:00
|
|
|
OsproberEntryList getOsproberEntriesForDevice( Device* device ) const;
|
2016-02-19 16:33:19 +01:00
|
|
|
void doAlongsideApply();
|
2016-02-19 16:57:49 +01:00
|
|
|
void setupEfiSystemPartitionSelector();
|
2014-09-03 18:09:37 +02:00
|
|
|
|
|
|
|
bool m_nextEnabled;
|
|
|
|
PartitionCoreModule* m_core;
|
|
|
|
|
2015-09-18 17:25:55 +02:00
|
|
|
QMutex m_previewsMutex;
|
|
|
|
|
2014-09-03 18:09:37 +02:00
|
|
|
Choice m_choice;
|
2015-10-06 18:56:33 +02:00
|
|
|
|
2015-11-06 17:57:05 +01:00
|
|
|
bool m_isEfi;
|
2015-11-26 15:31:06 +01:00
|
|
|
QComboBox* m_drivesCombo;
|
2015-10-06 18:56:33 +02:00
|
|
|
|
2016-01-08 16:35:50 +01:00
|
|
|
QButtonGroup* m_grp;
|
2015-10-06 18:56:33 +02:00
|
|
|
PrettyRadioButton* m_alongsideButton;
|
2016-01-28 18:43:35 +01:00
|
|
|
PrettyRadioButton* m_eraseButton;
|
2015-12-22 13:15:13 +01:00
|
|
|
PrettyRadioButton* m_replaceButton;
|
2015-10-06 18:56:33 +02:00
|
|
|
PrettyRadioButton* m_somethingElseButton;
|
2015-10-30 17:32:00 +01:00
|
|
|
|
2015-11-27 17:25:47 +01:00
|
|
|
DeviceInfoWidget* m_deviceInfoWidget;
|
|
|
|
|
2015-12-17 15:39:52 +01:00
|
|
|
QPointer< PartitionBarsView > m_beforePartitionBarsView;
|
|
|
|
QPointer< PartitionLabelsView > m_beforePartitionLabelsView;
|
2015-12-24 13:06:35 +01:00
|
|
|
QPointer< PartitionBarsView > m_afterPartitionBarsView;
|
|
|
|
QPointer< PartitionLabelsView > m_afterPartitionLabelsView;
|
2016-01-11 19:02:34 +01:00
|
|
|
QPointer< PartitionSplitterWidget > m_afterPartitionSplitterWidget;
|
2016-01-29 17:07:08 +01:00
|
|
|
QPointer< QComboBox > m_bootloaderComboBox;
|
2016-02-19 16:33:19 +01:00
|
|
|
QPointer< QLabel > m_efiLabel;
|
|
|
|
QPointer< QComboBox > m_efiComboBox;
|
2015-12-17 15:39:52 +01:00
|
|
|
|
2015-10-30 17:32:00 +01:00
|
|
|
int m_lastSelectedDeviceIndex;
|
2015-12-24 17:02:50 +01:00
|
|
|
|
2016-06-10 15:22:21 +02:00
|
|
|
QString m_defaultFsType;
|
2016-09-26 13:14:54 +02:00
|
|
|
bool m_enableEncryptionWidget;
|
2016-06-10 15:22:21 +02:00
|
|
|
|
2015-12-24 17:02:50 +01:00
|
|
|
QMutex m_coreMutex;
|
2014-09-03 18:09:37 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CHOICEPAGE_H
|