1
/***************************************************************************
2
* Copyright (C) 2008 by Volker Lanz <vl@fidra.de> *
4
* This program is free software; you can redistribute it and/or modify *
5
* it under the terms of the GNU General Public License as published by *
6
* the Free Software Foundation; either version 2 of the License, or *
7
* (at your option) any later version. *
9
* This program is distributed in the hope that it will be useful, *
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12
* GNU General Public License for more details. *
14
* You should have received a copy of the GNU General Public License *
15
* along with this program; if not, write to the *
16
* Free Software Foundation, Inc., *
17
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18
***************************************************************************/
20
#if !defined(MAINWINDOW__H)
24
#include "util/libpartitionmanagerexport.h"
26
#include "ui_mainwindowbase.h"
28
#include "core/libparted.h"
29
#include "core/operationrunner.h"
30
#include "core/operationstack.h"
32
#include "util/globallog.h"
34
#include <kxmlguiwindow.h>
44
class KActionCollection;
46
/** @brief The application's main window.
50
class LIBPARTITIONMANAGERPRIVATE_EXPORT MainWindow : public KXmlGuiWindow, public Ui::MainWindowBase
55
MainWindow(QWidget* parent = NULL, KActionCollection* coll = NULL);
58
void devicesChanged();
62
void setupConnections();
63
void setupStatusBar();
64
void setupDevicesList();
66
void saveConfig() const;
67
void updateWindowTitle();
68
void updateStatusBar();
69
void updateOperations();
71
void showPartitionContextMenu(const QPoint& pos);
73
void updatePartitions();
75
bool showInsertDialog(Partition& insertPartition, qint64 sourceLength);
77
Device* selectedDevice();
78
Partition* selectedPartition();
80
KActionCollection* actionCollection() const;
82
InfoPane& infoPane() { Q_ASSERT(m_InfoPane); return *m_InfoPane; }
84
PartTableWidget& partTableWidget() { Q_ASSERT(m_PartTableWidget); return *m_PartTableWidget; }
85
const PartTableWidget& partTableWidget() const { Q_ASSERT(m_PartTableWidget); return *m_PartTableWidget; }
87
QListWidget& listDevices() { Q_ASSERT(m_ListDevices); return *m_ListDevices; }
88
const QListWidget& listDevices() const { Q_ASSERT(m_ListDevices); return *m_ListDevices; }
90
QListWidget& listOperations() { Q_ASSERT(m_ListOperations); return *m_ListOperations; }
91
const QListWidget& listOperations() const { Q_ASSERT(m_ListOperations); return *m_ListOperations; }
93
QTreeWidget& treePartitions() { Q_ASSERT(m_TreePartitions); return *m_TreePartitions; }
94
const QTreeWidget& treePartitions() const { Q_ASSERT(m_TreePartitions); return *m_TreePartitions; }
96
QDockWidget& dockInformation() { Q_ASSERT(m_DockInformation); return *m_DockInformation; }
97
const QDockWidget& dockInformation() const { Q_ASSERT(m_DockInformation); return *m_DockInformation; }
99
QDockWidget& dockDevices() { Q_ASSERT(m_DockDevices); return *m_DockDevices; }
100
const QDockWidget& dockDevices() const { Q_ASSERT(m_DockDevices); return *m_DockDevices; }
102
QDockWidget& dockOperations() { Q_ASSERT(m_DockOperations); return *m_DockOperations; }
103
const QDockWidget& dockOperations() const { Q_ASSERT(m_DockOperations); return *m_DockOperations; }
105
QDockWidget& dockLog() { Q_ASSERT(m_DockLog); return *m_DockLog; }
106
const QDockWidget& dockLog() const { Q_ASSERT(m_DockLog); return *m_DockLog; }
108
QTreeWidget& treeLog() { Q_ASSERT(m_TreeLog); return *m_TreeLog; }
109
const QTreeWidget& treeLog() const { Q_ASSERT(m_TreeLog); return *m_TreeLog; }
111
Partition* clipboardPartition() { return m_ClipboardPartition; }
112
const Partition* clipboardPartition() const { return m_ClipboardPartition; }
113
void setClipboardPartition(Partition* p) { m_ClipboardPartition = p; }
115
LibParted& libParted() { return m_LibParted; }
116
const LibParted& libParted() const { return m_LibParted; }
118
ProgressDialog& progressDialog() { Q_ASSERT(m_ProgressDialog); return *m_ProgressDialog; }
120
OperationRunner& operationRunner() { return m_OperationRunner; }
121
const OperationRunner& operationRunner() const { return m_OperationRunner; }
123
OperationStack& operationStack() { return m_OperationStack; }
124
const OperationStack& operationStack() const { return m_OperationStack; }
126
QLabel& statusText() { Q_ASSERT(m_StatusText); return *m_StatusText; }
127
const QLabel& statusText() const { Q_ASSERT(m_StatusText); return *m_StatusText; }
130
void on_m_ListDevices_itemSelectionChanged();
131
void on_m_ListDevices_customContextMenuRequested(const QPoint& pos);
132
void on_m_TreePartitions_currentItemChanged(QTreeWidgetItem* current, QTreeWidgetItem* previous);
133
void on_m_PartTableWidget_customContextMenuRequested(const QPoint& pos);
134
void on_m_TreePartitions_customContextMenuRequested(const QPoint& pos);
135
void on_m_TreePartitions_itemDoubleClicked(QTreeWidgetItem* item, int);
136
void on_m_PartTableWidget_itemSelectionChanged(PartWidget* item);
137
void on_m_ListDevices_itemClicked();
139
void onPropertiesPartition();
140
void onMountPartition();
141
void onNewPartition();
142
void onDeletePartition();
143
void onResizePartition();
144
void onCopyPartition();
145
void onPastePartition();
146
void onCheckPartition();
147
void onCreateNewPartitionTable();
148
void onRefreshDevices();
149
void onUndoOperation();
150
void onClearAllOperations();
151
void onApplyAllOperations();
152
void onFileSystemSupport();
153
void onBackupPartition();
154
void onRestorePartition();
156
void closeEvent(QCloseEvent*);
157
void changeEvent(QEvent* event);
159
void onNewLogMessage(log::Level logLevel, const QString& s);
164
LibParted m_LibParted;
165
OperationStack m_OperationStack;
166
OperationRunner m_OperationRunner;
167
QLabel* m_StatusText;
168
InfoPane* m_InfoPane;
169
Partition* m_ClipboardPartition;
170
ProgressDialog* m_ProgressDialog;
171
KActionCollection* m_ActionCollection;