feat: add support for enabling Wi-Fi connections in toolbox

This commit is contained in:
uncor3
2026-04-09 18:51:57 +00:00
parent e631fa9ba3
commit 7f3ef29f01
8 changed files with 115 additions and 1 deletions
+1
View File
@@ -43,6 +43,7 @@
<file>resources/icons/MaterialSymbolsLightKeyboardArrowUp.png</file>
<file>resources/icons/MaterialSymbolsLightKeyboardArrowDown.png</file>
<file>resources/icons/IcOutlineRefresh.png</file>
<file>resources/icons/StreamlineFreehandChargingFlashWireless.png</file>
<file>qml/MapView.qml</file>
<file>resources/iphone.png</file>
<file>resources/ios-version.png</file>
Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

+2 -1
View File
@@ -367,6 +367,7 @@ enum class iDescriptorTool {
*/
NetworkDevices,
iFuse,
EnableWifiConnections,
Unknown
};
@@ -663,7 +664,7 @@ private:
if (m_animation)
return;
m_animation = new QPropertyAnimation(this, "shimmerOffset", this);
m_animation = new QPropertyAnimation(this, "shimmerOffset");
m_animation->setDuration(1200);
m_animation->setStartValue(0.0);
m_animation->setEndValue(1.0);
+68
View File
@@ -24,6 +24,8 @@
#include <QSettings>
#include <QStandardPaths>
const QString SEEN_DEVICE_PREFIX = "seenDevices/";
SettingsManager *SettingsManager::sharedInstance()
{
static SettingsManager instance;
@@ -133,6 +135,17 @@ void SettingsManager::setAutoConnectWirelessDevices(bool enabled)
m_settings->sync();
}
bool SettingsManager::autoEnableWifiConnections() const
{
return m_settings->value("autoEnableWifiConnections", true).toBool();
}
void SettingsManager::setAutoEnableWifiConnections(bool enabled)
{
m_settings->setValue("autoEnableWifiConnections", enabled);
m_settings->sync();
}
#ifndef __APPLE__
bool SettingsManager::unmountiFuseOnExit() const
{
@@ -250,6 +263,7 @@ void SettingsManager::resetToDefaults()
setAutoRaiseWindow(true);
setSwitchToNewDevice(true);
setAutoConnectWirelessDevices(true);
setAutoEnableWifiConnections(true);
#ifndef __APPLE__
setUnmountiFuseOnExit(false);
#endif
@@ -525,4 +539,58 @@ void SettingsManager::setIsSleepyDeviceWarningDismissed(bool dismissed)
{
m_settings->setValue("sleepyDeviceWarningDismissed", dismissed);
m_settings->sync();
}
bool SettingsManager::hasSeenDevice(const QString &udid) const
{
const QString trimmed = udid.trimmed();
if (trimmed.isEmpty()) {
return false;
}
return m_settings->value(SEEN_DEVICE_PREFIX + trimmed, false).toBool();
}
void SettingsManager::setHasSeenDevice(const QString &udid, bool seen)
{
const QString trimmed = udid.trimmed();
if (trimmed.isEmpty()) {
return;
}
const QString key = SEEN_DEVICE_PREFIX + trimmed;
if (seen) {
m_settings->setValue(key, true);
} else {
m_settings->remove(key);
}
m_settings->sync();
}
QStringList SettingsManager::seenDeviceUdids() const
{
QStringList udids;
const QStringList allKeys = m_settings->allKeys();
for (const QString &key : allKeys) {
if (!key.startsWith(SEEN_DEVICE_PREFIX)) {
continue;
}
if (m_settings->value(key, false).toBool()) {
udids.append(key.mid(SEEN_DEVICE_PREFIX.length()));
}
}
return udids;
}
void SettingsManager::clearSeenDevices()
{
const QStringList allKeys = m_settings->allKeys();
for (const QString &key : allKeys) {
if (key.startsWith(SEEN_DEVICE_PREFIX)) {
m_settings->remove(key);
}
}
m_settings->sync();
}
+8
View File
@@ -80,6 +80,9 @@ public:
bool autoConnectWirelessDevices() const;
void setAutoConnectWirelessDevices(bool enabled);
bool autoEnableWifiConnections() const;
void setAutoEnableWifiConnections(bool enabled);
#ifndef __APPLE__
bool unmountiFuseOnExit() const;
void setUnmountiFuseOnExit(bool enabled);
@@ -143,6 +146,11 @@ public:
void setIsSleepyDeviceWarningDismissed(bool dismissed);
void dismissSleepyDeviceWarning();
bool hasSeenDevice(const QString &udid) const;
void setHasSeenDevice(const QString &udid, bool seen = true);
QStringList seenDeviceUdids() const;
void clearSeenDevices();
signals:
void favoritePlacesChanged();
void recentLocationsChanged();
+8
View File
@@ -111,6 +111,10 @@ void SettingsWidget::setupUI()
m_autoUpdateCheck = new QCheckBox("Automatically check for updates");
generalLayout->addWidget(m_autoUpdateCheck);
m_autoEnableWifiConnections =
new QCheckBox("Automatically enable Wi-Fi connections");
generalLayout->addWidget(m_autoEnableWifiConnections);
// Theme selection
auto *themeLayout = new QHBoxLayout();
themeLayout->addWidget(new QLabel("Theme:"));
@@ -306,6 +310,7 @@ void SettingsWidget::loadSettings()
m_autoUpdateCheck->setChecked(sm->autoCheckUpdates());
m_autoRaiseWindow->setChecked(sm->autoRaiseWindow());
m_switchToNewDevice->setChecked(sm->switchToNewDevice());
m_autoEnableWifiConnections->setChecked(sm->autoEnableWifiConnections());
m_autoConnectWirelessDevices->setChecked(sm->autoConnectWirelessDevices());
m_wirelessFileServerPort->setValue(sm->wirelessFileServerPort());
@@ -357,6 +362,8 @@ void SettingsWidget::connectSignals()
&SettingsWidget::onSettingChanged);
connect(m_switchToNewDevice, &QCheckBox::toggled, this,
&SettingsWidget::onSettingChanged);
connect(m_autoEnableWifiConnections, &QCheckBox::toggled, this,
&SettingsWidget::onSettingChanged);
connect(m_autoConnectWirelessDevices, &QCheckBox::toggled, this,
&SettingsWidget::onSettingChanged);
#ifndef __APPLE__
@@ -493,6 +500,7 @@ void SettingsWidget::saveSettings()
sm->setAutoCheckUpdates(m_autoUpdateCheck->isChecked());
sm->setAutoRaiseWindow(m_autoRaiseWindow->isChecked());
sm->setSwitchToNewDevice(m_switchToNewDevice->isChecked());
sm->setAutoEnableWifiConnections(m_autoEnableWifiConnections->isChecked());
sm->setAutoConnectWirelessDevices(
m_autoConnectWirelessDevices->isChecked());
sm->setWirelessFileServerPort(m_wirelessFileServerPort->value());
+1
View File
@@ -57,6 +57,7 @@ private:
QComboBox *m_themeCombo;
QCheckBox *m_autoRaiseWindow;
QCheckBox *m_switchToNewDevice;
QCheckBox *m_autoEnableWifiConnections;
#ifndef __APPLE__
QCheckBox *m_unmount_iFuseDrives;
#endif
+27
View File
@@ -166,6 +166,8 @@ void ToolboxWidget::setupUI()
{iDescriptorTool::Shutdown, "Shut down the device", true, ""});
moreToolWidgets.append({iDescriptorTool::RecoveryMode,
"Enter device recovery mode", true, ""});
moreToolWidgets.append({iDescriptorTool::EnableWifiConnections,
"Make device connectable via Wi-Fi", true, ""});
for (int i = 0; i < moreToolWidgets.size(); ++i) {
const auto &tool = moreToolWidgets[i];
@@ -250,6 +252,11 @@ ToolboxItemWidget *ToolboxWidget::createToolbox(iDescriptorTool tool,
iconName =
":/resources/icons/StreamlineUltimateMultipleUsersNetwork.png";
break;
case iDescriptorTool::EnableWifiConnections:
title = "Enable Wi-Fi Connections";
iconName =
":/resources/icons/StreamlineFreehandChargingFlashWireless.png";
break;
default:
title = "Unknown Tool";
break;
@@ -515,6 +522,26 @@ void ToolboxWidget::onToolboxClicked(iDescriptorTool tool, bool requiresDevice)
m_networkDevicesWidget->activateWindow();
}
} break;
case iDescriptorTool::EnableWifiConnections: {
connect(
device->service_manager,
&CXX::ServiceManager::enable_wifi_connections_result, this,
[this](bool success) {
if (success) {
QMessageBox::information(
this, "Success",
"Wi-Fi connections enabled successfully. You can now "
"connect to this device wirelessly.");
} else {
QMessageBox::warning(this, "Failure",
"Failed to enable Wi-Fi connections.");
}
},
Qt::SingleShotConnection);
device->service_manager->enable_wifi_connections();
} break;
default:
qDebug() << "Clicked on unimplemented tool";
break;