2009-04-21 17:36:43 +01:00
|
|
|
/***************************************************************************
|
|
|
|
* Copyright (C) 2008,2009 by Volker Lanz <vl@fidra.de> *
|
|
|
|
* *
|
|
|
|
* 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 *
|
|
|
|
***************************************************************************/
|
|
|
|
|
2009-08-03 21:07:49 +01:00
|
|
|
#if !defined(PARTITIONMANAGERWIDGET__H)
|
2009-04-21 17:36:43 +01:00
|
|
|
|
2009-08-03 21:07:49 +01:00
|
|
|
#define PARTITIONMANAGERWIDGET__H
|
2009-04-21 17:36:43 +01:00
|
|
|
|
|
|
|
#include "util/libpartitionmanagerexport.h"
|
|
|
|
|
|
|
|
#include "core/operationrunner.h"
|
|
|
|
#include "core/operationstack.h"
|
2010-02-11 18:47:51 +00:00
|
|
|
#include "core/devicescanner.h"
|
2009-04-21 17:36:43 +01:00
|
|
|
|
|
|
|
#include "ui_partitionmanagerwidgetbase.h"
|
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
|
|
|
|
class QWidget;
|
|
|
|
class QLabel;
|
|
|
|
class PartWidget;
|
|
|
|
class KActionCollection;
|
|
|
|
class Device;
|
2010-02-11 18:47:51 +00:00
|
|
|
class ApplyProgressDialog;
|
|
|
|
class ScanProgressDialog;
|
2009-04-21 17:36:43 +01:00
|
|
|
|
|
|
|
/** @brief The central widget for the application.
|
|
|
|
|
|
|
|
@author vl@fidra.de
|
|
|
|
*/
|
|
|
|
class LIBPARTITIONMANAGERPRIVATE_EXPORT PartitionManagerWidget : public QWidget, Ui::PartitionManagerWidgetBase
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2009-11-09 13:51:08 +00:00
|
|
|
Q_DISABLE_COPY(PartitionManagerWidget)
|
2009-04-21 17:36:43 +01:00
|
|
|
|
|
|
|
public:
|
|
|
|
explicit PartitionManagerWidget(QWidget* parent, KActionCollection* coll = NULL);
|
|
|
|
virtual ~PartitionManagerWidget();
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void devicesChanged();
|
|
|
|
void operationsChanged();
|
2010-02-11 18:47:51 +00:00
|
|
|
void selectedPartitionChanged(const Partition*);
|
2009-04-21 17:36:43 +01:00
|
|
|
|
2009-04-22 08:59:33 +01:00
|
|
|
public slots:
|
|
|
|
void setSelectedDevice(Device* d);
|
2010-02-12 11:29:12 +00:00
|
|
|
void setSelectedDevice(const QString& device_node);
|
2009-04-22 08:59:33 +01:00
|
|
|
|
2009-04-21 17:36:43 +01:00
|
|
|
public:
|
2009-04-22 11:35:44 +01:00
|
|
|
void init(KActionCollection* coll, const QString& config_name);
|
2009-04-21 17:36:43 +01:00
|
|
|
KActionCollection* actionCollection() const { return m_ActionCollection; }
|
|
|
|
|
|
|
|
void clear();
|
2010-02-11 18:47:51 +00:00
|
|
|
void clearSelectedPartition();
|
2009-04-21 17:36:43 +01:00
|
|
|
void setPartitionTable(const PartitionTable* ptable);
|
|
|
|
void setSelection(const Partition* p);
|
|
|
|
void enableActions();
|
|
|
|
|
|
|
|
Device* selectedDevice() { return m_SelectedDevice; }
|
|
|
|
const Device* selectedDevice() const { return m_SelectedDevice; }
|
|
|
|
|
|
|
|
Partition* selectedPartition();
|
|
|
|
|
|
|
|
OperationStack::Devices& previewDevices() { return operationStack().previewDevices(); }
|
|
|
|
const OperationStack::Devices& previewDevices() const { return operationStack().previewDevices(); }
|
|
|
|
const OperationStack::Operations& operations() const { return operationStack().operations(); }
|
|
|
|
|
2010-02-13 11:25:56 +00:00
|
|
|
OperationStack& operationStack() { return m_OperationStack; }
|
|
|
|
const OperationStack& operationStack() const { return m_OperationStack; }
|
|
|
|
|
2009-04-21 17:36:43 +01:00
|
|
|
void updatePartitions();
|
|
|
|
|
|
|
|
Partition* clipboardPartition() { return m_ClipboardPartition; }
|
|
|
|
const Partition* clipboardPartition() const { return m_ClipboardPartition; }
|
|
|
|
void setClipboardPartition(Partition* p) { m_ClipboardPartition = p; }
|
|
|
|
|
2010-02-11 18:47:51 +00:00
|
|
|
ApplyProgressDialog& applyProgressDialog() { Q_ASSERT(m_ApplyProgressDialog); return *m_ApplyProgressDialog; }
|
|
|
|
const ApplyProgressDialog& applyProgressDialog() const { Q_ASSERT(m_ApplyProgressDialog); return *m_ApplyProgressDialog; }
|
|
|
|
|
|
|
|
ScanProgressDialog& scanProgressDialog() { Q_ASSERT(m_ScanProgressDialog); return *m_ScanProgressDialog; }
|
|
|
|
const ScanProgressDialog& scanProgressDialog() const { Q_ASSERT(m_ScanProgressDialog); return *m_ScanProgressDialog; }
|
2009-04-21 17:36:43 +01:00
|
|
|
|
|
|
|
quint32 numPendingOperations();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void setupActions();
|
|
|
|
void setupConnections();
|
|
|
|
void showPartitionContextMenu(const QPoint& pos);
|
|
|
|
void loadConfig();
|
|
|
|
void saveConfig() const;
|
|
|
|
bool showInsertDialog(Partition& insertPartition, qint64 sourceLength);
|
|
|
|
|
|
|
|
PartTableWidget& partTableWidget() { Q_ASSERT(m_PartTableWidget); return *m_PartTableWidget; }
|
|
|
|
const PartTableWidget& partTableWidget() const { Q_ASSERT(m_PartTableWidget); return *m_PartTableWidget; }
|
|
|
|
|
|
|
|
QTreeWidget& treePartitions() { Q_ASSERT(m_TreePartitions); return *m_TreePartitions; }
|
|
|
|
const QTreeWidget& treePartitions() const { Q_ASSERT(m_TreePartitions); return *m_TreePartitions; }
|
|
|
|
|
|
|
|
OperationRunner& operationRunner() { return m_OperationRunner; }
|
|
|
|
const OperationRunner& operationRunner() const { return m_OperationRunner; }
|
|
|
|
|
2010-02-11 18:47:51 +00:00
|
|
|
DeviceScanner& deviceScanner() { return m_DeviceScanner; }
|
|
|
|
const DeviceScanner& deviceScanner() const { return m_DeviceScanner; }
|
|
|
|
|
2009-04-21 17:36:43 +01:00
|
|
|
protected slots:
|
|
|
|
void on_m_TreePartitions_currentItemChanged(QTreeWidgetItem* current, QTreeWidgetItem* previous);
|
|
|
|
void on_m_PartTableWidget_customContextMenuRequested(const QPoint& pos);
|
|
|
|
void on_m_TreePartitions_customContextMenuRequested(const QPoint& pos);
|
|
|
|
void on_m_TreePartitions_itemDoubleClicked(QTreeWidgetItem* item, int);
|
|
|
|
void on_m_PartTableWidget_itemSelectionChanged(PartWidget* item);
|
|
|
|
|
|
|
|
void scanDevices();
|
2010-02-11 18:47:51 +00:00
|
|
|
void onScanDevicesFinished();
|
|
|
|
void onScanDevicesProgressChanged(const QString& device_node, int percent);
|
2009-04-21 17:36:43 +01:00
|
|
|
|
|
|
|
void onPropertiesPartition();
|
2010-02-18 00:06:36 +00:00
|
|
|
void onPropertiesDevice(const QString& device_node = QString());
|
2009-04-21 17:36:43 +01:00
|
|
|
void onMountPartition();
|
2010-01-15 18:08:01 +00:00
|
|
|
void onEditMountPoint();
|
2009-04-21 17:36:43 +01:00
|
|
|
void onNewPartition();
|
2010-01-18 12:31:00 +00:00
|
|
|
void onDeletePartition(bool shred = false);
|
|
|
|
void onShredPartition();
|
2009-04-21 17:36:43 +01:00
|
|
|
void onResizePartition();
|
|
|
|
void onCopyPartition();
|
|
|
|
void onPastePartition();
|
|
|
|
void onCheckPartition();
|
|
|
|
void onCreateNewPartitionTable();
|
|
|
|
void onRefreshDevices();
|
|
|
|
void onUndoOperation();
|
|
|
|
void onClearAllOperations();
|
|
|
|
void onApplyAllOperations();
|
|
|
|
void onFileSystemSupport();
|
|
|
|
void onBackupPartition();
|
|
|
|
void onRestorePartition();
|
2010-02-17 13:18:25 +00:00
|
|
|
void onConfigureOptions();
|
|
|
|
void onSettingsChanged(const QString&);
|
2010-02-16 20:07:33 +00:00
|
|
|
void onHeaderContextMenu(const QPoint& p);
|
2009-04-21 17:36:43 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
OperationStack m_OperationStack;
|
|
|
|
OperationRunner m_OperationRunner;
|
2010-02-11 18:47:51 +00:00
|
|
|
DeviceScanner m_DeviceScanner;
|
|
|
|
ApplyProgressDialog* m_ApplyProgressDialog;
|
|
|
|
ScanProgressDialog* m_ScanProgressDialog;
|
2009-04-21 17:36:43 +01:00
|
|
|
KActionCollection* m_ActionCollection;
|
|
|
|
Device* m_SelectedDevice;
|
|
|
|
Partition* m_ClipboardPartition;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|