2020-09-16 00:35:12 +01:00
|
|
|
/*
|
|
|
|
SPDX-FileCopyrightText: 2008-2012 Volker Lanz <vl@fidra.de>
|
|
|
|
SPDX-FileCopyrightText: 2014-2019 Andrius Štikonas <andrius@stikonas.eu>
|
|
|
|
SPDX-FileCopyrightText: 2015 Teo Mrnjavac <teo@kde.org>
|
|
|
|
SPDX-FileCopyrightText: 2016 Chantara Tith <tith.chantara@gmail.com>
|
|
|
|
|
|
|
|
SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
*/
|
2008-09-24 20:32:01 +01:00
|
|
|
|
2017-09-11 16:27:51 +01:00
|
|
|
#if !defined(MAINWINDOW_H)
|
2008-09-24 20:32:01 +01:00
|
|
|
|
2017-09-11 16:27:51 +01:00
|
|
|
#define MAINWINDOW_H
|
2008-09-24 20:32:01 +01:00
|
|
|
|
2016-01-12 00:12:49 +00:00
|
|
|
#include <core/operationrunner.h>
|
|
|
|
#include <core/operationstack.h>
|
|
|
|
#include <core/devicescanner.h>
|
2010-02-23 16:30:05 +00:00
|
|
|
|
2008-09-24 20:32:01 +01:00
|
|
|
#include "ui_mainwindowbase.h"
|
|
|
|
|
2015-06-04 01:51:56 +01:00
|
|
|
#include <KXmlGuiWindow>
|
2008-09-24 20:32:01 +01:00
|
|
|
|
2010-02-23 16:30:05 +00:00
|
|
|
class ApplyProgressDialog;
|
|
|
|
class ScanProgressDialog;
|
|
|
|
class Device;
|
|
|
|
class Partition;
|
|
|
|
class InfoPane;
|
|
|
|
|
2014-05-18 21:41:48 +01:00
|
|
|
class KActionCollection;
|
|
|
|
|
2008-09-24 20:32:01 +01:00
|
|
|
class QWidget;
|
|
|
|
class QLabel;
|
|
|
|
class QCloseEvent;
|
|
|
|
class QEvent;
|
|
|
|
|
2010-05-18 23:27:30 +01:00
|
|
|
/** The application's main window.
|
2008-09-24 20:32:01 +01:00
|
|
|
|
2015-07-13 15:17:41 +01:00
|
|
|
@author Volker Lanz <vl@fidra.de>
|
2008-09-24 20:32:01 +01:00
|
|
|
*/
|
2016-01-06 13:56:32 +00:00
|
|
|
class MainWindow : public KXmlGuiWindow, public Ui::MainWindowBase
|
2008-09-24 20:32:01 +01:00
|
|
|
{
|
2015-07-13 15:17:41 +01:00
|
|
|
Q_OBJECT
|
|
|
|
Q_DISABLE_COPY(MainWindow)
|
|
|
|
|
|
|
|
public:
|
2016-04-14 19:18:36 +01:00
|
|
|
explicit MainWindow(QWidget* parent = nullptr);
|
2015-07-13 15:17:41 +01:00
|
|
|
|
2015-07-17 12:37:30 +01:00
|
|
|
Q_SIGNALS:
|
|
|
|
void settingsChanged();
|
|
|
|
|
2015-07-13 15:17:41 +01:00
|
|
|
protected:
|
|
|
|
void init();
|
|
|
|
void setupObjectNames();
|
|
|
|
void setupActions();
|
|
|
|
void setupConnections();
|
|
|
|
void setupStatusBar();
|
|
|
|
void loadConfig();
|
|
|
|
void saveConfig() const;
|
|
|
|
void updateWindowTitle();
|
|
|
|
void updateSeletedDeviceMenu();
|
|
|
|
void checkFileSystemSupport();
|
|
|
|
|
|
|
|
void enableActions();
|
|
|
|
|
2019-02-28 00:16:32 +00:00
|
|
|
void closeEvent(QCloseEvent*) override;
|
|
|
|
void changeEvent(QEvent* event) override;
|
2015-07-13 15:17:41 +01:00
|
|
|
|
|
|
|
void setSavedSelectedDeviceNode(const QString& s) {
|
|
|
|
m_SavedSelectedDeviceNode = s;
|
|
|
|
}
|
|
|
|
const QString& savedSelectedDeviceNode() const {
|
|
|
|
return m_SavedSelectedDeviceNode;
|
|
|
|
}
|
|
|
|
|
|
|
|
InfoPane& infoPane() {
|
|
|
|
Q_ASSERT(m_InfoPane);
|
|
|
|
return *m_InfoPane;
|
|
|
|
}
|
|
|
|
|
|
|
|
PartitionManagerWidget& pmWidget() {
|
|
|
|
Q_ASSERT(m_PartitionManagerWidget);
|
|
|
|
return *m_PartitionManagerWidget;
|
|
|
|
}
|
|
|
|
const PartitionManagerWidget& pmWidget() const {
|
|
|
|
Q_ASSERT(m_PartitionManagerWidget);
|
|
|
|
return *m_PartitionManagerWidget;
|
|
|
|
}
|
|
|
|
|
|
|
|
ListDevices& listDevices() {
|
|
|
|
Q_ASSERT(m_ListDevices);
|
|
|
|
return *m_ListDevices;
|
|
|
|
}
|
|
|
|
const ListDevices& listDevices() const {
|
|
|
|
Q_ASSERT(m_ListDevices);
|
|
|
|
return *m_ListDevices;
|
|
|
|
}
|
|
|
|
|
|
|
|
ListOperations& listOperations() {
|
|
|
|
Q_ASSERT(m_ListOperations);
|
|
|
|
return *m_ListOperations;
|
|
|
|
}
|
|
|
|
const ListOperations& listOperations() const {
|
|
|
|
Q_ASSERT(m_ListOperations);
|
|
|
|
return *m_ListOperations;
|
|
|
|
}
|
|
|
|
|
|
|
|
TreeLog& treeLog() {
|
|
|
|
Q_ASSERT(m_TreeLog);
|
|
|
|
return *m_TreeLog;
|
|
|
|
}
|
|
|
|
const TreeLog& treeLog() const {
|
|
|
|
Q_ASSERT(m_TreeLog);
|
|
|
|
return *m_TreeLog;
|
|
|
|
}
|
|
|
|
|
|
|
|
QDockWidget& dockInformation() {
|
|
|
|
Q_ASSERT(m_DockInformation);
|
|
|
|
return *m_DockInformation;
|
|
|
|
}
|
|
|
|
const QDockWidget& dockInformation() const {
|
|
|
|
Q_ASSERT(m_DockInformation);
|
|
|
|
return *m_DockInformation;
|
|
|
|
}
|
|
|
|
|
|
|
|
QDockWidget& dockDevices() {
|
|
|
|
Q_ASSERT(m_DockDevices);
|
|
|
|
return *m_DockDevices;
|
|
|
|
}
|
|
|
|
const QDockWidget& dockDevices() const {
|
|
|
|
Q_ASSERT(m_DockDevices);
|
|
|
|
return *m_DockDevices;
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
OperationStack& operationStack() {
|
|
|
|
Q_ASSERT(m_OperationStack);
|
|
|
|
return *m_OperationStack;
|
|
|
|
}
|
|
|
|
const OperationStack& operationStack() const {
|
|
|
|
Q_ASSERT(m_OperationStack);
|
|
|
|
return *m_OperationStack;
|
|
|
|
}
|
|
|
|
|
|
|
|
OperationRunner& operationRunner() {
|
|
|
|
Q_ASSERT(m_OperationRunner);
|
|
|
|
return *m_OperationRunner;
|
|
|
|
}
|
|
|
|
const OperationRunner& operationRunner() const {
|
|
|
|
Q_ASSERT(m_OperationRunner);
|
|
|
|
return *m_OperationRunner;
|
|
|
|
}
|
|
|
|
|
|
|
|
DeviceScanner& deviceScanner() {
|
|
|
|
Q_ASSERT(m_DeviceScanner);
|
|
|
|
return *m_DeviceScanner;
|
|
|
|
}
|
|
|
|
const DeviceScanner& deviceScanner() const {
|
|
|
|
Q_ASSERT(m_DeviceScanner);
|
|
|
|
return *m_DeviceScanner;
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2016-05-18 22:23:59 +01:00
|
|
|
void onSelectedDeviceMenuTriggered(bool);
|
|
|
|
|
2015-07-13 15:17:41 +01:00
|
|
|
protected Q_SLOTS:
|
|
|
|
void on_m_PartitionManagerWidget_selectedPartitionChanged(const Partition* p);
|
|
|
|
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();
|
|
|
|
void on_m_DeviceScanner_progress(const QString& device_node, int percent);
|
|
|
|
|
|
|
|
void on_m_ApplyProgressDialog_finished();
|
|
|
|
|
2016-07-02 12:12:56 +01:00
|
|
|
void listDevicesContextMenuRequested(const QPoint& pos);
|
2015-07-13 15:17:41 +01:00
|
|
|
void on_m_ListDevices_selectionChanged(const QString& device_node);
|
|
|
|
|
2016-07-02 12:12:56 +01:00
|
|
|
void treeLogContextMenuRequested(const QPoint& pos);
|
|
|
|
void listOperationsContextMenuRequested(const QPoint& pos);
|
2015-07-13 15:17:41 +01:00
|
|
|
|
2016-07-01 15:42:12 +01:00
|
|
|
protected:
|
2015-07-13 15:17:41 +01:00
|
|
|
void scanDevices();
|
|
|
|
|
|
|
|
void onRefreshDevices();
|
|
|
|
void onCreateNewPartitionTable();
|
2016-06-30 00:17:05 +01:00
|
|
|
void onCreateNewVolumeGroup();
|
2016-07-03 18:02:16 +01:00
|
|
|
void onRemoveVolumeGroup();
|
|
|
|
void onResizeVolumeGroup();
|
2016-08-08 06:54:24 +01:00
|
|
|
void onDeactivateVolumeGroup();
|
2015-07-13 15:17:41 +01:00
|
|
|
void onExportPartitionTable();
|
|
|
|
void onImportPartitionTable();
|
|
|
|
|
|
|
|
void onApplyAllOperations();
|
|
|
|
void onUndoOperation();
|
|
|
|
void onClearAllOperations();
|
|
|
|
|
|
|
|
void onConfigureOptions();
|
|
|
|
void onSettingsChanged();
|
|
|
|
|
|
|
|
void onFileSystemSupport();
|
2016-08-25 00:15:07 +01:00
|
|
|
void onShowAboutKPMcore();
|
2015-07-13 15:17:41 +01:00
|
|
|
|
|
|
|
void onSmartStatusDevice();
|
2016-05-22 20:03:49 +01:00
|
|
|
void onPropertiesDevice(const QString& deviceNode = {});
|
2015-07-13 15:17:41 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
OperationStack* m_OperationStack;
|
|
|
|
OperationRunner* m_OperationRunner;
|
|
|
|
DeviceScanner* m_DeviceScanner;
|
|
|
|
ApplyProgressDialog* m_ApplyProgressDialog;
|
|
|
|
ScanProgressDialog* m_ScanProgressDialog;
|
|
|
|
QLabel* m_StatusText;
|
|
|
|
QString m_SavedSelectedDeviceNode;
|
2008-09-24 20:32:01 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|