2008-09-24 20:32:01 +01:00
|
|
|
/***************************************************************************
|
2010-02-23 16:30:05 +00:00
|
|
|
* Copyright (C) 2008,2010 by Volker Lanz <vl@fidra.de> *
|
2008-09-24 20:32:01 +01:00
|
|
|
* *
|
|
|
|
* This program 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 2 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program 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 this program; if not, write to the *
|
|
|
|
* Free Software Foundation, Inc., *
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#if !defined(PARTTABLEWIDGET__H)
|
|
|
|
|
|
|
|
#define PARTTABLEWIDGET__H
|
|
|
|
|
|
|
|
#include "gui/partwidgetbase.h"
|
|
|
|
|
|
|
|
#include <QList>
|
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;
|
|
|
|
|
|
|
|
/** @brief Widget that represents a PartitionTable.
|
|
|
|
@author vl@fidra.de
|
|
|
|
*/
|
2010-04-12 17:14:10 +01:00
|
|
|
class PartTableWidget : public PartWidgetBase
|
2008-09-24 20:32:01 +01:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
2009-11-09 13:51:08 +00:00
|
|
|
Q_DISABLE_COPY(PartTableWidget)
|
2008-09-24 20:32:01 +01:00
|
|
|
|
|
|
|
public:
|
|
|
|
PartTableWidget(QWidget* parent);
|
|
|
|
|
|
|
|
public:
|
|
|
|
void setPartitionTable(const PartitionTable* ptable);
|
2009-11-09 13:51:08 +00:00
|
|
|
|
2010-04-12 15:35:02 +01:00
|
|
|
PartWidget* activeWidget(); /**< @return the active widget or NULL if none */
|
|
|
|
const PartWidget* activeWidget() const; /**< @return the active widget or NULL if none */
|
2009-11-09 13:51:08 +00:00
|
|
|
|
2008-09-24 20:32:01 +01:00
|
|
|
void setActiveWidget(PartWidget* partWidget);
|
|
|
|
void setActivePartition(const Partition* p);
|
|
|
|
void clear();
|
2010-02-17 10:06:23 +00:00
|
|
|
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 */
|
2008-09-24 20:32:01 +01:00
|
|
|
|
|
|
|
signals:
|
|
|
|
void itemSelectionChanged(PartWidget*);
|
2010-02-23 16:30:05 +00:00
|
|
|
void itemDoubleClicked(const PartWidget*);
|
2008-09-24 20:32:01 +01:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void resizeEvent(QResizeEvent* event);
|
|
|
|
void mousePressEvent(QMouseEvent* event);
|
|
|
|
void mouseDoubleClickEvent(QMouseEvent* event);
|
2009-11-09 13:51:08 +00:00
|
|
|
|
2008-09-24 20:32:01 +01:00
|
|
|
const PartitionTable* partitionTable() const { return m_PartitionTable; }
|
2009-11-09 13:51:08 +00:00
|
|
|
|
2008-10-06 10:18:31 +01:00
|
|
|
QLabel& labelEmpty() { return m_LabelEmpty; }
|
|
|
|
const QLabel& labelEmpty() const { return m_LabelEmpty; }
|
2009-11-09 13:51:08 +00:00
|
|
|
|
2008-09-24 20:32:01 +01:00
|
|
|
private:
|
|
|
|
const PartitionTable* m_PartitionTable;
|
2008-10-06 10:18:31 +01:00
|
|
|
QLabel m_LabelEmpty;
|
2010-02-17 10:06:23 +00:00
|
|
|
bool m_ReadOnly;
|
2008-09-24 20:32:01 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|