mirror of
https://github.com/iDescriptor/iDescriptor.git
synced 2026-06-22 03:45:51 +08:00
implement settings, fix bugs and enhance ui
- Added new settings keys in SettingsManager for download path, auto-check updates, auto-raise window, switch to new device, unmount iFuse on exit, theme, and connection timeout. - Implemented methods to get and set these new settings. - Updated SettingsWidget to include UI elements for the new settings, including checkboxes and a combo box for theme selection. - Refactored loadSettings and saveSettings methods to handle new settings. - Removed deprecated settings UI elements to streamline the interface. - Introduced VirtualLocation widget for managing virtual location settings with a map interface. - Integrated QML for map visualization and input handling for latitude and longitude. - Added functionality to apply virtual location settings to the connected device.
This commit is contained in:
+75
-41
@@ -1,85 +1,119 @@
|
||||
#include "servicemanager.h"
|
||||
|
||||
afc_error_t ServiceManager::safeAfcReadDirectory(iDescriptorDevice *device,
|
||||
const char *path, char ***dirs)
|
||||
afc_error_t
|
||||
ServiceManager::safeAfcReadDirectory(iDescriptorDevice *device,
|
||||
const char *path, char ***dirs,
|
||||
std::optional<afc_client_t> altAfc)
|
||||
{
|
||||
return executeAfcOperation(device, [device, path, dirs]() {
|
||||
return afc_read_directory(device->afcClient, path, dirs);
|
||||
});
|
||||
return executeAfcOperation(
|
||||
device,
|
||||
[path, dirs](afc_client_t client) {
|
||||
return afc_read_directory(client, path, dirs);
|
||||
},
|
||||
altAfc);
|
||||
}
|
||||
|
||||
afc_error_t ServiceManager::safeAfcGetFileInfo(iDescriptorDevice *device,
|
||||
const char *path, char ***info)
|
||||
afc_error_t
|
||||
ServiceManager::safeAfcGetFileInfo(iDescriptorDevice *device, const char *path,
|
||||
char ***info,
|
||||
std::optional<afc_client_t> altAfc)
|
||||
{
|
||||
return executeAfcOperation(device, [device, path, info]() {
|
||||
return afc_get_file_info(device->afcClient, path, info);
|
||||
});
|
||||
return executeAfcOperation(
|
||||
device,
|
||||
[path, info](afc_client_t client) {
|
||||
return afc_get_file_info(client, path, info);
|
||||
},
|
||||
altAfc);
|
||||
}
|
||||
|
||||
afc_error_t ServiceManager::safeAfcFileOpen(iDescriptorDevice *device,
|
||||
const char *path,
|
||||
afc_file_mode_t mode,
|
||||
uint64_t *handle)
|
||||
uint64_t *handle,
|
||||
std::optional<afc_client_t> altAfc)
|
||||
{
|
||||
return executeAfcOperation(device, [device, path, mode, handle]() {
|
||||
return afc_file_open(device->afcClient, path, mode, handle);
|
||||
});
|
||||
return executeAfcOperation(
|
||||
device,
|
||||
[path, mode, handle](afc_client_t client) {
|
||||
return afc_file_open(client, path, mode, handle);
|
||||
},
|
||||
altAfc);
|
||||
}
|
||||
|
||||
afc_error_t ServiceManager::safeAfcFileRead(iDescriptorDevice *device,
|
||||
uint64_t handle, char *data,
|
||||
uint32_t length,
|
||||
uint32_t *bytes_read)
|
||||
uint32_t *bytes_read,
|
||||
std::optional<afc_client_t> altAfc)
|
||||
{
|
||||
return executeAfcOperation(
|
||||
device, [device, handle, data, length, bytes_read]() {
|
||||
return afc_file_read(device->afcClient, handle, data, length,
|
||||
bytes_read);
|
||||
});
|
||||
device,
|
||||
[handle, data, length, bytes_read](afc_client_t client) {
|
||||
return afc_file_read(client, handle, data, length, bytes_read);
|
||||
},
|
||||
altAfc);
|
||||
}
|
||||
|
||||
afc_error_t ServiceManager::safeAfcFileWrite(iDescriptorDevice *device,
|
||||
uint64_t handle, const char *data,
|
||||
uint32_t length,
|
||||
uint32_t *bytes_written)
|
||||
uint32_t *bytes_written,
|
||||
std::optional<afc_client_t> altAfc)
|
||||
{
|
||||
return executeAfcOperation(
|
||||
device, [device, handle, data, length, bytes_written]() {
|
||||
return afc_file_write(device->afcClient, handle, data, length,
|
||||
bytes_written);
|
||||
});
|
||||
device,
|
||||
[handle, data, length, bytes_written](afc_client_t client) {
|
||||
return afc_file_write(client, handle, data, length, bytes_written);
|
||||
},
|
||||
altAfc);
|
||||
}
|
||||
|
||||
afc_error_t ServiceManager::safeAfcFileClose(iDescriptorDevice *device,
|
||||
uint64_t handle)
|
||||
uint64_t handle,
|
||||
std::optional<afc_client_t> altAfc)
|
||||
{
|
||||
return executeAfcOperation(device, [device, handle]() {
|
||||
return afc_file_close(device->afcClient, handle);
|
||||
});
|
||||
return executeAfcOperation(
|
||||
device,
|
||||
[handle](afc_client_t client) {
|
||||
return afc_file_close(client, handle);
|
||||
},
|
||||
altAfc);
|
||||
}
|
||||
|
||||
afc_error_t ServiceManager::safeAfcFileSeek(iDescriptorDevice *device,
|
||||
uint64_t handle, int64_t offset,
|
||||
int whence)
|
||||
int whence,
|
||||
std::optional<afc_client_t> altAfc)
|
||||
{
|
||||
return executeAfcOperation(device, [device, handle, offset, whence]() {
|
||||
return afc_file_seek(device->afcClient, handle, offset, whence);
|
||||
});
|
||||
return executeAfcOperation(
|
||||
device,
|
||||
[handle, offset, whence](afc_client_t client) {
|
||||
return afc_file_seek(client, handle, offset, whence);
|
||||
},
|
||||
altAfc);
|
||||
}
|
||||
|
||||
QByteArray ServiceManager::safeReadAfcFileToByteArray(iDescriptorDevice *device,
|
||||
const char *path)
|
||||
QByteArray
|
||||
ServiceManager::safeReadAfcFileToByteArray(iDescriptorDevice *device,
|
||||
const char *path,
|
||||
std::optional<afc_client_t> altAfc)
|
||||
{
|
||||
return executeOperation<QByteArray>(device, [device, path]() -> QByteArray {
|
||||
return read_afc_file_to_byte_array(device->afcClient, path);
|
||||
});
|
||||
return executeOperation<QByteArray>(
|
||||
device,
|
||||
[path](afc_client_t client) -> QByteArray {
|
||||
return read_afc_file_to_byte_array(client, path);
|
||||
},
|
||||
altAfc);
|
||||
}
|
||||
|
||||
AFCFileTree ServiceManager::safeGetFileTree(iDescriptorDevice *device,
|
||||
const std::string &path)
|
||||
const std::string &path,
|
||||
std::optional<afc_client_t> altAfc)
|
||||
{
|
||||
return executeOperation<AFCFileTree>(
|
||||
device, [device, path]() -> AFCFileTree {
|
||||
return get_file_tree(device->afcClient, path.c_str());
|
||||
});
|
||||
device,
|
||||
[path](afc_client_t client) -> AFCFileTree {
|
||||
return get_file_tree(client, path.c_str());
|
||||
},
|
||||
altAfc);
|
||||
}
|
||||
Reference in New Issue
Block a user