Convert devicemanager to QAbstractItemModel
This commit is contained in:
@@ -40,7 +40,14 @@ MtpLoader::MtpLoader(const QUrl &url, TaskManager *task_manager, CollectionBacke
|
||||
original_thread_ = thread();
|
||||
}
|
||||
|
||||
MtpLoader::~MtpLoader() {}
|
||||
MtpLoader::~MtpLoader() {
|
||||
delete connection_;
|
||||
}
|
||||
|
||||
bool MtpLoader::Init() {
|
||||
connection_ = new MtpConnection(url_);
|
||||
return connection_->is_valid();
|
||||
}
|
||||
|
||||
void MtpLoader::LoadDatabase() {
|
||||
|
||||
@@ -58,15 +65,9 @@ void MtpLoader::LoadDatabase() {
|
||||
|
||||
bool MtpLoader::TryLoad() {
|
||||
|
||||
MtpConnection dev(url_);
|
||||
if (!dev.is_valid()) {
|
||||
emit Error(tr("Error connecting MTP device"));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Load the list of songs on the device
|
||||
SongList songs;
|
||||
LIBMTP_track_t *tracks = LIBMTP_Get_Tracklisting_With_Callback(dev.device(), nullptr, nullptr);
|
||||
LIBMTP_track_t* tracks = LIBMTP_Get_Tracklisting_With_Callback(connection_->device(), nullptr, nullptr);
|
||||
while (tracks) {
|
||||
LIBMTP_track_t *track = tracks;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user