Blocks the user to select a different device if --device is specified

So the user can't select a different device by mistake.
This commit is contained in:
Tomaz Canabrava 2022-01-20 18:54:29 +00:00 committed by Andrius Štikonas
parent 87eb4cdadd
commit 90f6cb74d2
3 changed files with 17 additions and 0 deletions

View File

@ -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();

View File

@ -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();

View File

@ -131,6 +131,7 @@ int Q_DECL_IMPORT main(int argc, char* argv[])
if (partitionNr.length()) {
mainWindow->setCurrentPartitionByName(selectedDevice);
}
mainWindow->setDisallowOtherDevices();
}
});