2008-09-24 20:32:01 +01:00
|
|
|
/***************************************************************************
|
2010-02-23 16:30:05 +00:00
|
|
|
* Copyright (C) 2008,2009,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(MAINWINDOW__H)
|
|
|
|
|
|
|
|
#define MAINWINDOW__H
|
|
|
|
|
2010-02-23 16:30:05 +00:00
|
|
|
#include "core/operationrunner.h"
|
|
|
|
#include "core/operationstack.h"
|
|
|
|
#include "core/devicescanner.h"
|
|
|
|
|
2008-12-27 22:12:42 +00:00
|
|
|
#include "util/libpartitionmanagerexport.h"
|
|
|
|
|
2008-09-24 20:32:01 +01:00
|
|
|
#include "ui_mainwindowbase.h"
|
|
|
|
|
|
|
|
#include <kxmlguiwindow.h>
|
|
|
|
|
2010-02-23 16:30:05 +00:00
|
|
|
class ApplyProgressDialog;
|
|
|
|
class ScanProgressDialog;
|
|
|
|
class Device;
|
|
|
|
class Partition;
|
|
|
|
class InfoPane;
|
|
|
|
|
|
|
|
class KActionCollection;
|
|
|
|
|
2008-09-24 20:32:01 +01:00
|
|
|
class QWidget;
|
|
|
|
class QLabel;
|
|
|
|
class QCloseEvent;
|
|
|
|
class QEvent;
|
|
|
|
|
|
|
|
/** @brief The application's main window.
|
|
|
|
|
|
|
|
@author vl@fidra.de
|
|
|
|
*/
|
2008-12-27 22:12:42 +00:00
|
|
|
class LIBPARTITIONMANAGERPRIVATE_EXPORT MainWindow : public KXmlGuiWindow, public Ui::MainWindowBase
|
2008-09-24 20:32:01 +01:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
2009-11-09 13:51:08 +00:00
|
|
|
Q_DISABLE_COPY(MainWindow)
|
2008-09-24 20:32:01 +01:00
|
|
|
|
|
|
|
public:
|
2009-08-03 21:06:59 +01:00
|
|
|
explicit MainWindow(QWidget* parent = NULL, KActionCollection* coll = NULL);
|
2008-09-24 20:32:01 +01:00
|
|
|
|
|
|
|
protected:
|
2010-02-23 16:30:05 +00:00
|
|
|
void init();
|
|
|
|
void setupObjectNames();
|
2008-09-24 20:32:01 +01:00
|
|
|
void setupActions();
|
|
|
|
void setupConnections();
|
|
|
|
void setupStatusBar();
|
|
|
|
void loadConfig();
|
|
|
|
void saveConfig() const;
|
|
|
|
void updateWindowTitle();
|
|
|
|
|
2010-02-23 16:30:05 +00:00
|
|
|
void enableActions();
|
|
|
|
|
|
|
|
void closeEvent(QCloseEvent*);
|
|
|
|
void changeEvent(QEvent* event);
|
|
|
|
|
|
|
|
bool isKPart() const;
|
|
|
|
|
|
|
|
void setSavedSelectedDeviceNode(const QString& s) { m_SavedSelectedDeviceNode = s; }
|
|
|
|
const QString& savedSelectedDeviceNode() const { return m_SavedSelectedDeviceNode; }
|
|
|
|
|
2009-04-21 17:36:43 +01:00
|
|
|
KActionCollection* actionCollection() const { return m_ActionCollection != NULL ? m_ActionCollection : KXmlGuiWindow::actionCollection(); }
|
2008-12-27 22:12:42 +00:00
|
|
|
|
2008-09-24 20:32:01 +01:00
|
|
|
InfoPane& infoPane() { Q_ASSERT(m_InfoPane); return *m_InfoPane; }
|
2009-03-25 14:53:50 +00:00
|
|
|
|
2009-04-21 17:36:43 +01:00
|
|
|
PartitionManagerWidget& pmWidget() { Q_ASSERT(m_PartitionManagerWidget); return *m_PartitionManagerWidget; }
|
|
|
|
const PartitionManagerWidget& pmWidget() const { Q_ASSERT(m_PartitionManagerWidget); return *m_PartitionManagerWidget; }
|
2008-09-24 20:32:01 +01:00
|
|
|
|
2010-01-28 16:27:28 +00:00
|
|
|
ListDevices& listDevices() { Q_ASSERT(m_ListDevices); return *m_ListDevices; }
|
|
|
|
const ListDevices& listDevices() const { Q_ASSERT(m_ListDevices); return *m_ListDevices; }
|
|
|
|
|
2009-04-21 17:36:43 +01:00
|
|
|
ListOperations& listOperations() { Q_ASSERT(m_ListOperations); return *m_ListOperations; }
|
|
|
|
const ListOperations& listOperations() const { Q_ASSERT(m_ListOperations); return *m_ListOperations; }
|
2009-03-25 14:53:50 +00:00
|
|
|
|
2009-04-22 13:41:30 +01:00
|
|
|
TreeLog& treeLog() { Q_ASSERT(m_TreeLog); return *m_TreeLog; }
|
|
|
|
const TreeLog& treeLog() const { Q_ASSERT(m_TreeLog); return *m_TreeLog; }
|
|
|
|
|
2008-09-24 20:32:01 +01:00
|
|
|
QDockWidget& dockInformation() { Q_ASSERT(m_DockInformation); return *m_DockInformation; }
|
|
|
|
const QDockWidget& dockInformation() const { Q_ASSERT(m_DockInformation); return *m_DockInformation; }
|
|
|
|
|
2010-01-28 16:27:28 +00:00
|
|
|
QDockWidget& dockDevices() { Q_ASSERT(m_DockDevices); return *m_DockDevices; }
|
|
|
|
const QDockWidget& dockDevices() const { Q_ASSERT(m_DockDevices); return *m_DockDevices; }
|
|
|
|
|
2008-09-24 20:32:01 +01:00
|
|
|
QDockWidget& dockOperations() { Q_ASSERT(m_DockOperations); return *m_DockOperations; }
|
|
|
|
const QDockWidget& dockOperations() const { Q_ASSERT(m_DockOperations); return *m_DockOperations; }
|
|
|
|
|
|
|
|
QDockWidget& dockLog() { Q_ASSERT(m_DockLog); return *m_DockLog; }
|
|
|
|
const QDockWidget& dockLog() const { Q_ASSERT(m_DockLog); return *m_DockLog; }
|
|
|
|
|
|
|
|
QLabel& statusText() { Q_ASSERT(m_StatusText); return *m_StatusText; }
|
|
|
|
const QLabel& statusText() const { Q_ASSERT(m_StatusText); return *m_StatusText; }
|
|
|
|
|
2010-02-23 16:30:05 +00:00
|
|
|
OperationStack& operationStack() { Q_ASSERT(m_OperationStack); return *m_OperationStack; }
|
|
|
|
const OperationStack& operationStack() const { Q_ASSERT(m_OperationStack); return *m_OperationStack; }
|
2010-02-13 14:21:05 +00:00
|
|
|
|
2010-02-23 16:30:05 +00:00
|
|
|
OperationRunner& operationRunner() { Q_ASSERT(m_OperationRunner); return *m_OperationRunner; }
|
|
|
|
const OperationRunner& operationRunner() const { Q_ASSERT(m_OperationRunner); return *m_OperationRunner; }
|
2008-09-24 20:32:01 +01:00
|
|
|
|
2010-02-23 16:30:05 +00:00
|
|
|
DeviceScanner& deviceScanner() { Q_ASSERT(m_DeviceScanner); return *m_DeviceScanner; }
|
|
|
|
const DeviceScanner& deviceScanner() const { Q_ASSERT(m_DeviceScanner); return *m_DeviceScanner; }
|
2010-02-12 11:29:12 +00:00
|
|
|
|
2010-02-23 16:30:05 +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; }
|
|
|
|
|
|
|
|
protected slots:
|
2010-02-12 11:29:12 +00:00
|
|
|
void on_m_PartitionManagerWidget_selectedPartitionChanged(const Partition* p);
|
2010-02-23 16:30:05 +00:00
|
|
|
void on_m_PartitionManagerWidget_contextMenuRequested(const QPoint& pos);
|
|
|
|
void on_m_PartitionManagerWidget_deviceDoubleClicked(const Device*);
|
|
|
|
void on_m_PartitionManagerWidget_partitionDoubleClicked(const Partition*);
|
|
|
|
|
|
|
|
void on_m_DockInformation_dockLocationChanged(Qt::DockWidgetArea);
|
|
|
|
|
|
|
|
void on_m_OperationStack_operationsChanged();
|
|
|
|
void on_m_OperationStack_devicesChanged();
|
|
|
|
|
|
|
|
void on_m_DeviceScanner_finished();
|
2010-03-03 09:18:59 +00:00
|
|
|
void on_m_DeviceScanner_progress(const QString& device_node, int percent);
|
2010-02-23 16:30:05 +00:00
|
|
|
|
|
|
|
void on_m_ApplyProgressDialog_finished();
|
|
|
|
|
|
|
|
void on_m_ListDevices_contextMenuRequested(const QPoint& pos);
|
|
|
|
|
2010-03-07 19:02:02 +00:00
|
|
|
void on_m_TreeLog_contextMenuRequested(const QPoint& pos);
|
|
|
|
void on_m_ListOperations_contextMenuRequested(const QPoint& pos);
|
|
|
|
|
2010-02-21 16:58:27 +00:00
|
|
|
void onShowMenuBar();
|
2009-03-25 14:53:50 +00:00
|
|
|
|
2010-02-23 16:30:05 +00:00
|
|
|
void scanDevices();
|
|
|
|
|
|
|
|
void onRefreshDevices();
|
|
|
|
void onCreateNewPartitionTable();
|
2010-03-02 13:35:57 +00:00
|
|
|
void onExportPartitionTable();
|
2010-03-03 00:15:26 +00:00
|
|
|
void onImportPartitionTable();
|
2010-02-23 16:30:05 +00:00
|
|
|
|
|
|
|
void onApplyAllOperations();
|
|
|
|
void onUndoOperation();
|
|
|
|
void onClearAllOperations();
|
|
|
|
|
|
|
|
void onConfigureOptions();
|
2010-03-21 10:50:44 +00:00
|
|
|
void onSettingsChanged();
|
2010-02-23 16:30:05 +00:00
|
|
|
|
|
|
|
void onFileSystemSupport();
|
|
|
|
|
2010-03-27 13:47:32 +00:00
|
|
|
void onSmartStatusDevice();
|
2010-02-23 16:30:05 +00:00
|
|
|
void onPropertiesDevice(const QString& device_node = QString());
|
|
|
|
|
2008-09-24 20:32:01 +01:00
|
|
|
private:
|
2010-02-21 17:54:52 +00:00
|
|
|
KActionCollection* m_ActionCollection;
|
2010-02-23 16:30:05 +00:00
|
|
|
OperationStack* m_OperationStack;
|
|
|
|
OperationRunner* m_OperationRunner;
|
|
|
|
DeviceScanner* m_DeviceScanner;
|
|
|
|
ApplyProgressDialog* m_ApplyProgressDialog;
|
|
|
|
ScanProgressDialog* m_ScanProgressDialog;
|
2008-09-24 20:32:01 +01:00
|
|
|
QLabel* m_StatusText;
|
|
|
|
InfoPane* m_InfoPane;
|
2010-02-23 16:30:05 +00:00
|
|
|
QString m_SavedSelectedDeviceNode;
|
2008-09-24 20:32:01 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|