2020-09-16 00:35:12 +01:00
|
|
|
/*
|
|
|
|
SPDX-FileCopyrightText: 2008-2010 Volker Lanz <vl@fidra.de>
|
|
|
|
SPDX-FileCopyrightText: 2010 Hugo Pereira Da Costa <hugo@oxygen-icons.org>
|
|
|
|
SPDX-FileCopyrightText: 2014-2017 Andrius Štikonas <andrius@stikonas.eu>
|
|
|
|
SPDX-FileCopyrightText: 2019 Yuri Chornoivan <yurchor@ukr.net>
|
|
|
|
|
|
|
|
SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
*/
|
2008-09-24 20:32:01 +01:00
|
|
|
|
2017-09-11 16:27:51 +01:00
|
|
|
#if !defined(PARTTABLEWIDGET_H)
|
2008-09-24 20:32:01 +01:00
|
|
|
|
2017-09-11 16:27:51 +01:00
|
|
|
#define PARTTABLEWIDGET_H
|
2008-09-24 20:32:01 +01:00
|
|
|
|
2016-01-12 00:12:49 +00:00
|
|
|
#include <gui/partwidgetbase.h>
|
2008-09-24 20:32:01 +01:00
|
|
|
|
2008-10-06 10:18:31 +01:00
|
|
|
#include <QLabel>
|
2008-09-24 20:32:01 +01:00
|
|
|
|
|
|
|
class PartWidget;
|
|
|
|
class PartitionTable;
|
|
|
|
|
|
|
|
class QResizeEvent;
|
|
|
|
class QMouseEvent;
|
|
|
|
|
2010-05-18 23:27:30 +01:00
|
|
|
/** Widget that represents a PartitionTable.
|
2015-07-13 15:17:41 +01:00
|
|
|
@author Volker Lanz <vl@fidra.de>
|
2008-09-24 20:32:01 +01:00
|
|
|
*/
|
2010-04-12 17:14:10 +01:00
|
|
|
class PartTableWidget : public PartWidgetBase
|
2008-09-24 20:32:01 +01:00
|
|
|
{
|
2015-07-13 15:17:41 +01:00
|
|
|
Q_OBJECT
|
|
|
|
Q_DISABLE_COPY(PartTableWidget)
|
|
|
|
|
|
|
|
public:
|
2019-12-09 16:33:04 +00:00
|
|
|
explicit PartTableWidget(QWidget* parent);
|
2016-05-17 18:03:28 +01:00
|
|
|
qint32 borderWidth() const override {
|
2015-07-13 15:17:41 +01:00
|
|
|
return 0; /**< @return border width */
|
|
|
|
}
|
2016-05-17 18:03:28 +01:00
|
|
|
qint32 borderHeight() const override {
|
2015-07-13 15:17:41 +01:00
|
|
|
return 0; /**< @return border height */
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
void setPartitionTable(const PartitionTable* ptable);
|
|
|
|
|
2016-04-14 19:18:36 +01:00
|
|
|
PartWidget* activeWidget(); /**< @return the active widget or nullptr if none */
|
|
|
|
const PartWidget* activeWidget() const; /**< @return the active widget or nullptr if none */
|
2015-07-13 15:17:41 +01:00
|
|
|
|
|
|
|
void setActiveWidget(PartWidget* partWidget);
|
|
|
|
void setActivePartition(const Partition* p);
|
|
|
|
void clear();
|
|
|
|
void setReadOnly(bool b) {
|
|
|
|
m_ReadOnly = b; /**< @param b the new value for read only */
|
|
|
|
}
|
|
|
|
bool isReadOnly() const {
|
|
|
|
return m_ReadOnly; /** @return true if the widget is read only */
|
|
|
|
}
|
|
|
|
|
|
|
|
Q_SIGNALS:
|
|
|
|
void itemSelectionChanged(PartWidget*);
|
|
|
|
void itemDoubleClicked(const PartWidget*);
|
|
|
|
|
|
|
|
protected:
|
2016-04-28 00:17:47 +01:00
|
|
|
void resizeEvent(QResizeEvent* event) override;
|
|
|
|
void mousePressEvent(QMouseEvent* event) override;
|
|
|
|
void mouseDoubleClickEvent(QMouseEvent* event) override;
|
2015-07-13 15:17:41 +01:00
|
|
|
|
|
|
|
const PartitionTable* partitionTable() const {
|
|
|
|
return m_PartitionTable;
|
|
|
|
}
|
|
|
|
|
|
|
|
QLabel& labelEmpty() {
|
|
|
|
return m_LabelEmpty;
|
|
|
|
}
|
|
|
|
const QLabel& labelEmpty() const {
|
|
|
|
return m_LabelEmpty;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
const PartitionTable* m_PartitionTable;
|
|
|
|
QLabel m_LabelEmpty;
|
|
|
|
bool m_ReadOnly;
|
2008-09-24 20:32:01 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|