calamares/src/modules/partition/gui/ChoicePage.h

110 lines
2.8 KiB
C
Raw Normal View History

/* === 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>
*
* 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"
#include <QWidget>
#include "core/OsproberEntry.h"
#include <QMutex>
#include <QPointer>
class QBoxLayout;
2015-11-20 14:49:37 +01:00
class QComboBox;
class QLabel;
class QListView;
class ExpandableRadioButton;
class PartitionBarsView;
class PartitionLabelsView;
class PartitionCoreModule;
class PrettyRadioButton;
2015-11-27 17:25:47 +01:00
class DeviceInfoWidget;
class Device;
2015-09-30 17:24:37 +02:00
class ChoicePage : public QWidget, private Ui::ChoicePage
{
Q_OBJECT
public:
enum Choice
{
NoChoice,
Alongside,
Erase,
Replace,
Manual
};
explicit ChoicePage( QWidget* parent = nullptr );
virtual ~ChoicePage();
void init( PartitionCoreModule* core );
2015-04-15 12:20:01 +02:00
bool isNextEnabled() const;
2015-04-15 12:20:01 +02:00
Choice currentChoice() const;
signals:
2014-09-04 19:37:30 +02:00
void nextStatusChanged( bool );
void actionChosen();
void deviceChosen();
private:
void setNextEnabled( bool enabled );
void setupChoices();
2015-11-20 14:49:37 +01:00
QComboBox* createBootloaderComboBox( ExpandableRadioButton* parentButton );
ExpandableRadioButton* createEraseButton();
2015-11-20 14:49:37 +01:00
ExpandableRadioButton* createReplaceButton();
Device* selectedDevice();
void applyDeviceChoice();
void updateDeviceStatePreview();
void applyActionChoice( ChoicePage::Choice choice );
void updateActionChoicePreview( ChoicePage::Choice choice );
void setupActions();
OsproberEntryList getOsproberEntriesForDevice( Device* device ) const;
bool m_nextEnabled;
PartitionCoreModule* m_core;
QMutex m_previewsMutex;
Choice m_choice;
bool m_isEfi;
QComboBox* m_drivesCombo;
PrettyRadioButton* m_alongsideButton;
ExpandableRadioButton* m_eraseButton;
2015-11-20 14:49:37 +01:00
ExpandableRadioButton* m_replaceButton;
PrettyRadioButton* m_somethingElseButton;
2015-11-27 17:25:47 +01:00
DeviceInfoWidget* m_deviceInfoWidget;
QPointer< PartitionBarsView > m_beforePartitionBarsView;
QPointer< PartitionLabelsView > m_beforePartitionLabelsView;
int m_lastSelectedDeviceIndex;
};
#endif // CHOICEPAGE_H