mirror of
https://github.com/iDescriptor/iDescriptor.git
synced 2026-06-21 19:35:49 +08:00
refactor: simplify device check and remove unused variable
This commit is contained in:
@@ -50,7 +50,6 @@ ToolboxWidget *ToolboxWidget::sharedInstance()
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
||||
ToolboxWidget::ToolboxWidget(QWidget *parent) : QWidget{parent}
|
||||
{
|
||||
setupUI();
|
||||
@@ -402,11 +401,13 @@ void ToolboxWidget::onToolboxClicked(iDescriptorTool tool, bool requiresDevice)
|
||||
{
|
||||
// final check to make sure device is connected if required
|
||||
iDescriptorDevice *device = AppContext::sharedInstance()->getDevice(m_uuid);
|
||||
if (!device && m_requiresDevice[m_toolboxes.indexOf(sender())]) {
|
||||
QMessageBox::warning(this, "Device Disconnected ?",
|
||||
"Please select a device to use this tool.");
|
||||
if (!device && requiresDevice) {
|
||||
QMessageBox::warning(
|
||||
this, "Device Disconnected ?",
|
||||
"Device just disconnected, please select a device.");
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug() << "idevice exists:" << (device != nullptr) << m_uuid.c_str();
|
||||
switch (tool) {
|
||||
case iDescriptorTool::Airplayer: {
|
||||
@@ -646,7 +647,6 @@ void ToolboxWidget::_enterRecoveryMode(iDescriptorDevice *device)
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
void ToolboxWidget::restartAirPlayWindow()
|
||||
{
|
||||
if (!m_airplayWindow) {
|
||||
|
||||
@@ -68,7 +68,6 @@ private:
|
||||
QWidget *m_contentWidget;
|
||||
QGridLayout *m_gridLayout;
|
||||
QList<QWidget *> m_toolboxes;
|
||||
QList<bool> m_requiresDevice;
|
||||
std::string m_uuid;
|
||||
DevDiskImagesWidget *m_devDiskImagesWidget = nullptr;
|
||||
NetworkDevicesWidget *m_networkDevicesWidget = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user