~ubuntu-branches/ubuntu/oneiric/partitionmanager/oneiric

« back to all changes in this revision

Viewing changes to src/gui/mainwindow.h

  • Committer: Bazaar Package Importer
  • Author(s): Anthony Mercatante
  • Date: 2009-01-23 17:57:36 UTC
  • Revision ID: james.westby@ubuntu.com-20090123175736-2ltrhgg3m55dokbm
Tags: upstream-1.0.0~beta1a
ImportĀ upstreamĀ versionĀ 1.0.0~beta1a

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
 *   Copyright (C) 2008 by Volker Lanz <vl@fidra.de>                       *
 
3
 *                                                                         *
 
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.                                   *
 
8
 *                                                                         *
 
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.                          *
 
13
 *                                                                         *
 
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
 ***************************************************************************/
 
19
 
 
20
#if !defined(MAINWINDOW__H)
 
21
 
 
22
#define MAINWINDOW__H
 
23
 
 
24
#include "util/libpartitionmanagerexport.h"
 
25
 
 
26
#include "ui_mainwindowbase.h"
 
27
 
 
28
#include "core/libparted.h"
 
29
#include "core/operationrunner.h"
 
30
#include "core/operationstack.h"
 
31
 
 
32
#include "util/globallog.h"
 
33
 
 
34
#include <kxmlguiwindow.h>
 
35
 
 
36
class QWidget;
 
37
class QLabel;
 
38
class PartWidget;
 
39
class InfoPane;
 
40
class QCloseEvent;
 
41
class QEvent;
 
42
class Device;
 
43
class ProgressDialog;
 
44
class KActionCollection;
 
45
 
 
46
/** @brief The application's main window.
 
47
 
 
48
        @author vl@fidra.de
 
49
*/
 
50
class LIBPARTITIONMANAGERPRIVATE_EXPORT MainWindow : public KXmlGuiWindow, public Ui::MainWindowBase
 
51
{
 
52
        Q_OBJECT
 
53
 
 
54
        public:
 
55
                MainWindow(QWidget* parent = NULL, KActionCollection* coll = NULL);
 
56
 
 
57
        signals:
 
58
                void devicesChanged();
 
59
 
 
60
        protected:
 
61
                void setupActions();
 
62
                void setupConnections();
 
63
                void setupStatusBar();
 
64
                void setupDevicesList();
 
65
                void loadConfig();
 
66
                void saveConfig() const;
 
67
                void updateWindowTitle();
 
68
                void updateStatusBar();
 
69
                void updateOperations();
 
70
                void enableActions();
 
71
                void showPartitionContextMenu(const QPoint& pos);
 
72
                void updateDevices();
 
73
                void updatePartitions();
 
74
 
 
75
                bool showInsertDialog(Partition& insertPartition, qint64 sourceLength);
 
76
 
 
77
                Device* selectedDevice();
 
78
                Partition* selectedPartition();
 
79
                
 
80
                KActionCollection* actionCollection() const;
 
81
 
 
82
                InfoPane& infoPane() { Q_ASSERT(m_InfoPane); return *m_InfoPane; }
 
83
                
 
84
                PartTableWidget& partTableWidget() { Q_ASSERT(m_PartTableWidget); return *m_PartTableWidget; }
 
85
                const PartTableWidget& partTableWidget() const { Q_ASSERT(m_PartTableWidget); return *m_PartTableWidget; }
 
86
 
 
87
                QListWidget& listDevices() { Q_ASSERT(m_ListDevices); return *m_ListDevices; }
 
88
                const QListWidget& listDevices() const { Q_ASSERT(m_ListDevices); return *m_ListDevices; }
 
89
 
 
90
                QListWidget& listOperations() { Q_ASSERT(m_ListOperations); return *m_ListOperations; }
 
91
                const QListWidget& listOperations() const { Q_ASSERT(m_ListOperations); return *m_ListOperations; }
 
92
                
 
93
                QTreeWidget& treePartitions() { Q_ASSERT(m_TreePartitions); return *m_TreePartitions; }
 
94
                const QTreeWidget& treePartitions() const { Q_ASSERT(m_TreePartitions); return *m_TreePartitions; }
 
95
                
 
96
                QDockWidget& dockInformation() { Q_ASSERT(m_DockInformation); return *m_DockInformation; }
 
97
                const QDockWidget& dockInformation() const { Q_ASSERT(m_DockInformation); return *m_DockInformation; }
 
98
 
 
99
                QDockWidget& dockDevices() { Q_ASSERT(m_DockDevices); return *m_DockDevices; }
 
100
                const QDockWidget& dockDevices() const { Q_ASSERT(m_DockDevices); return *m_DockDevices; }
 
101
 
 
102
                QDockWidget& dockOperations() { Q_ASSERT(m_DockOperations); return *m_DockOperations; }
 
103
                const QDockWidget& dockOperations() const { Q_ASSERT(m_DockOperations); return *m_DockOperations; }
 
104
 
 
105
                QDockWidget& dockLog() { Q_ASSERT(m_DockLog); return *m_DockLog; }
 
106
                const QDockWidget& dockLog() const { Q_ASSERT(m_DockLog); return *m_DockLog; }
 
107
 
 
108
                QTreeWidget& treeLog() { Q_ASSERT(m_TreeLog); return *m_TreeLog; }
 
109
                const QTreeWidget& treeLog() const { Q_ASSERT(m_TreeLog); return *m_TreeLog; }
 
110
                
 
111
                Partition* clipboardPartition() { return m_ClipboardPartition; }
 
112
                const Partition* clipboardPartition() const { return m_ClipboardPartition; }
 
113
                void setClipboardPartition(Partition* p) { m_ClipboardPartition = p; }
 
114
 
 
115
                LibParted& libParted() { return m_LibParted; }
 
116
                const LibParted& libParted() const { return m_LibParted; }
 
117
                
 
118
                ProgressDialog& progressDialog() { Q_ASSERT(m_ProgressDialog); return *m_ProgressDialog; }
 
119
                
 
120
                OperationRunner& operationRunner() { return m_OperationRunner; }
 
121
                const OperationRunner& operationRunner() const { return m_OperationRunner; }
 
122
 
 
123
                OperationStack& operationStack() { return m_OperationStack; }
 
124
                const OperationStack& operationStack() const { return m_OperationStack; }
 
125
 
 
126
                QLabel& statusText() { Q_ASSERT(m_StatusText); return *m_StatusText; }
 
127
                const QLabel& statusText() const { Q_ASSERT(m_StatusText); return *m_StatusText; }
 
128
 
 
129
        protected slots:
 
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();
 
138
 
 
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();
 
155
 
 
156
                void closeEvent(QCloseEvent*);
 
157
                void changeEvent(QEvent* event);
 
158
 
 
159
                void onNewLogMessage(log::Level logLevel, const QString& s);
 
160
                void onFinished();
 
161
                void scanDevices();
 
162
                
 
163
        private:
 
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;
 
172
};
 
173
 
 
174
#endif
 
175