diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index 296dc5a..45b6993 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -116,6 +116,15 @@ void MainWindow::setupObjectNames() m_ScanProgressDialog->setObjectName(QStringLiteral("m_ScanProgressDialog")); } +void MainWindow::setDisallowOtherDevices() +{ + // because of how Qt works, the user still can enable the + // dock widget via a mouse click, so we need to also set it to disabled. + // so that the user doesn't select it by mistake. + m_DockDevices->setVisible(false); + m_DockDevices->setEnabled(false); +} + void MainWindow::init() { treeLog().init(); diff --git a/src/gui/mainwindow.h b/src/gui/mainwindow.h index 960a4fb..fea5189 100644 --- a/src/gui/mainwindow.h +++ b/src/gui/mainwindow.h @@ -50,6 +50,13 @@ public: void setCurrentPartitionByName(const QString& partitionNumber); + // forbids the user to select another device. + // this is used in conjunction with --device + // rationale is that if the user specifies a device, + // we can't allow him to select another one by mistake while + // clicking in the UI. + void setDisallowOtherDevices(); + Q_SIGNALS: void settingsChanged(); void scanFinished(); diff --git a/src/main.cpp b/src/main.cpp index f733cef..c984096 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -131,6 +131,7 @@ int Q_DECL_IMPORT main(int argc, char* argv[]) if (partitionNr.length()) { mainWindow->setCurrentPartitionByName(selectedDevice); } + mainWindow->setDisallowOtherDevices(); } });