2014-09-03 18:09:37 +02:00
|
|
|
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
|
|
|
*
|
2015-04-15 12:20:01 +02:00
|
|
|
* Copyright 2014-2015, 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-11-06 17:57:05 +01:00
|
|
|
class ExpandableRadioButton;
|
2015-12-17 15:39:52 +01:00
|
|
|
class PartitionBarsView;
|
|
|
|
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;
|
|
|
|
|
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();
|
|
|
|
|
2015-12-15 14:00:34 +01:00
|
|
|
void init( PartitionCoreModule* core );
|
2014-09-03 18:09:37 +02:00
|
|
|
|
2015-04-15 12:20:01 +02:00
|
|
|
bool isNextEnabled() const;
|
2014-09-03 18:09:37 +02:00
|
|
|
|
2015-04-15 12:20:01 +02:00
|
|
|
Choice currentChoice() const;
|
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
|
|
|
|
|
|
|
private:
|
|
|
|
void setNextEnabled( bool enabled );
|
2015-10-06 18:56:33 +02:00
|
|
|
void setupChoices();
|
2015-11-20 14:49:37 +01:00
|
|
|
QComboBox* createBootloaderComboBox( ExpandableRadioButton* parentButton );
|
2015-11-12 18:17:21 +01:00
|
|
|
ExpandableRadioButton* createEraseButton();
|
2015-11-20 14:49:37 +01:00
|
|
|
ExpandableRadioButton* createReplaceButton();
|
2015-10-29 17:34:59 +01:00
|
|
|
Device* selectedDevice();
|
2015-10-06 18:56:33 +02:00
|
|
|
void applyDeviceChoice();
|
2015-12-17 18:02:14 +01:00
|
|
|
void updateDeviceStatePreview();
|
|
|
|
void applyActionChoice( ChoicePage::Choice choice );
|
|
|
|
void updateActionChoicePreview( ChoicePage::Choice choice );
|
|
|
|
void setupActions();
|
2015-11-27 14:47:52 +01:00
|
|
|
OsproberEntryList getOsproberEntriesForDevice( Device* device ) const;
|
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
|
|
|
|
|
|
|
PrettyRadioButton* m_alongsideButton;
|
2015-11-06 17:57:05 +01:00
|
|
|
ExpandableRadioButton* m_eraseButton;
|
2015-11-20 14:49:37 +01:00
|
|
|
ExpandableRadioButton* 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-10-30 17:32:00 +01:00
|
|
|
int m_lastSelectedDeviceIndex;
|
2014-09-03 18:09:37 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CHOICEPAGE_H
|