projectmanagers: set title automatically and pass cancelled signal to sub functions
This commit is contained in:
@@ -16,6 +16,8 @@ ProjectImportManager::ProjectImportManager(ProjectViewModel *model, Folder *fold
|
|||||||
}
|
}
|
||||||
|
|
||||||
file_count_ = Core::CountFilesInFileList(filenames_);
|
file_count_ = Core::CountFilesInFileList(filenames_);
|
||||||
|
|
||||||
|
SetTitle(tr("Importing %1 files").arg(file_count_));
|
||||||
}
|
}
|
||||||
|
|
||||||
const int &ProjectImportManager::GetFileCount()
|
const int &ProjectImportManager::GetFileCount()
|
||||||
@@ -91,7 +93,7 @@ void ProjectImportManager::Import(Folder *folder, const QFileInfoList &import, i
|
|||||||
// FIXME: Perhaps re-think this approach at some point
|
// FIXME: Perhaps re-think this approach at some point
|
||||||
f->set_project(model_->project());
|
f->set_project(model_->project());
|
||||||
|
|
||||||
Decoder::ProbeMedia(f.get());
|
Decoder::ProbeMedia(f.get(), &IsCancelled());
|
||||||
|
|
||||||
f->set_project(nullptr);
|
f->set_project(nullptr);
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
ProjectLoadManager::ProjectLoadManager(const QString &filename) :
|
ProjectLoadManager::ProjectLoadManager(const QString &filename) :
|
||||||
filename_(filename)
|
filename_(filename)
|
||||||
{
|
{
|
||||||
|
SetTitle(tr("Loading '%1'").arg(filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectLoadManager::Action()
|
void ProjectLoadManager::Action()
|
||||||
@@ -29,22 +30,27 @@ void ProjectLoadManager::Action()
|
|||||||
|
|
||||||
project->set_filename(filename_);
|
project->set_filename(filename_);
|
||||||
|
|
||||||
project->Load(&reader);
|
project->Load(&reader, &IsCancelled());
|
||||||
|
|
||||||
// Ensure project is in main thread
|
// Ensure project is in main thread
|
||||||
moveToThread(qApp->thread());
|
moveToThread(qApp->thread());
|
||||||
|
|
||||||
emit ProjectLoaded(project);
|
if (!IsCancelled()) {
|
||||||
|
emit ProjectLoaded(project);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reader.hasError()) {
|
if (reader.hasError()) {
|
||||||
qDebug() << "Found XML error:" << reader.errorString();
|
qDebug() << "Found XML error:" << reader.errorString();
|
||||||
|
emit Failed(reader.errorString());
|
||||||
|
} else {
|
||||||
|
emit Succeeded();
|
||||||
}
|
}
|
||||||
|
|
||||||
project_file.close();
|
project_file.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
emit Succeeeded();
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
ProjectSaveManager::ProjectSaveManager(Project *project) :
|
ProjectSaveManager::ProjectSaveManager(Project *project) :
|
||||||
project_(project)
|
project_(project)
|
||||||
{
|
{
|
||||||
|
SetTitle(tr("Saving '%1'").arg(project->filename()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectSaveManager::Action()
|
void ProjectSaveManager::Action()
|
||||||
@@ -32,5 +32,5 @@ void ProjectSaveManager::Action()
|
|||||||
project_file.close();
|
project_file.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
emit Succeeeded();
|
emit Succeeded();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user