Convert devicemanager to QAbstractItemModel

This commit is contained in:
Jonas Kvinge
2018-12-29 02:57:22 +01:00
parent fc9f93791d
commit 404283be19
35 changed files with 574 additions and 379 deletions

View File

@@ -61,12 +61,17 @@ MtpDevice::MtpDevice(const QUrl &url, DeviceLister *lister, const QString &uniqu
MtpDevice::~MtpDevice() {}
void MtpDevice::Init() {
bool MtpDevice::Init() {
InitBackendDirectory("/", first_time_, false);
model_->Init();
loader_ = new MtpLoader(url_, app_->task_manager(), backend_, shared_from_this());
if (!loader_->Init()) {
delete loader_;
loader_ = nullptr;
return false;
}
model_->Init();
loader_->moveToThread(loader_thread_);
connect(loader_, SIGNAL(Error(QString)), SIGNAL(Error(QString)));
@@ -77,6 +82,8 @@ void MtpDevice::Init() {
db_busy_.lock();
loader_thread_->start();
return true;
}
void MtpDevice::LoadFinished() {