Convert devicemanager to QAbstractItemModel
This commit is contained in:
@@ -38,15 +38,24 @@ MtpConnection::MtpConnection(const QUrl &url) : device_(nullptr) {
|
||||
// Parse the URL
|
||||
QRegExp host_re("^usb-(\\d+)-(\\d+)$");
|
||||
|
||||
if (host_re.indexIn(hostname) == -1) {
|
||||
unsigned int bus_location = 0;
|
||||
unsigned int device_num = 0;
|
||||
|
||||
QUrlQuery url_query(url);
|
||||
|
||||
if (host_re.indexIn(hostname) >= 0) {
|
||||
bus_location = host_re.cap(1).toUInt();
|
||||
device_num = host_re.cap(2).toUInt();
|
||||
}
|
||||
else if (url_query.hasQueryItem("busnum")) {
|
||||
bus_location = url_query.queryItemValue("busnum").toUInt();
|
||||
device_num = url_query.queryItemValue("devnum").toUInt();
|
||||
}
|
||||
else {
|
||||
qLog(Warning) << "Invalid MTP device:" << hostname;
|
||||
return;
|
||||
}
|
||||
|
||||
const unsigned int bus_location = host_re.cap(1).toInt();
|
||||
const unsigned int device_num = host_re.cap(2).toInt();
|
||||
|
||||
QUrlQuery url_query(url);
|
||||
if (url_query.hasQueryItem("vendor")) {
|
||||
LIBMTP_raw_device_t *raw_device = (LIBMTP_raw_device_t*)malloc(sizeof(LIBMTP_raw_device_t));
|
||||
raw_device->device_entry.vendor = url_query.queryItemValue("vendor").toLatin1().data();
|
||||
|
||||
Reference in New Issue
Block a user