project: improved loading and footage importing
This commit is contained in:
@@ -124,7 +124,7 @@ void ProjectImportTask::Import(Folder *folder, QFileInfoList import, int &counte
|
||||
FootagePtr footage = std::static_pointer_cast<Footage>(item);
|
||||
|
||||
footage->set_filename(file_path);
|
||||
footage->set_timestamp(file_info.lastModified());
|
||||
footage->set_timestamp(file_info.lastModified().toMSecsSinceEpoch());
|
||||
|
||||
// See if this footage is an image sequence
|
||||
ValidateImageSequence(footage, import, i);
|
||||
@@ -223,7 +223,6 @@ void ProjectImportTask::ValidateImageSequence(ItemPtr item, QFileInfoList& info_
|
||||
rational default_timebase = Config::Current()["DefaultSequenceFrameRate"].value<rational>();
|
||||
video_stream->set_timebase(default_timebase);
|
||||
video_stream->set_frame_rate(default_timebase.flipped());
|
||||
video_stream->set_image_sequence(true);
|
||||
|
||||
video_stream->set_start_time(start_index);
|
||||
video_stream->set_duration(end_index - start_index + 1);
|
||||
|
||||
@@ -46,22 +46,18 @@ bool ProjectLoadTask::Run()
|
||||
while(XMLReadNextStartElement(&reader)) {
|
||||
if (reader.name() == QStringLiteral("version")) {
|
||||
qDebug() << "Project version:" << reader.readElementText();
|
||||
} else if (reader.name() == QStringLiteral("url")) {
|
||||
project_saved_url_ = reader.readElementText();
|
||||
} else if (reader.name() == QStringLiteral("project")) {
|
||||
ProjectPtr project = std::make_shared<Project>();
|
||||
project_ = std::make_shared<Project>();
|
||||
|
||||
project->set_filename(filename_);
|
||||
project_->set_filename(filename_);
|
||||
|
||||
MainWindowLayoutInfo layout;
|
||||
|
||||
project->Load(&reader, &layout, &IsCancelled());
|
||||
project_->Load(&reader, &layout_info_, &IsCancelled());
|
||||
|
||||
// Ensure project is in main thread
|
||||
project->moveToThread(qApp->thread());
|
||||
|
||||
if (!IsCancelled()) {
|
||||
projects_.append(project);
|
||||
layout_info_.append(layout);
|
||||
}
|
||||
project_->moveToThread(qApp->thread());
|
||||
break;
|
||||
} else {
|
||||
reader.skipCurrentElement();
|
||||
}
|
||||
|
||||
@@ -33,23 +33,35 @@ class ProjectLoadTask : public Task
|
||||
public:
|
||||
ProjectLoadTask(const QString& filename);
|
||||
|
||||
const QList<ProjectPtr>& GetLoadedProjects() const
|
||||
ProjectPtr GetLoadedProject() const
|
||||
{
|
||||
return projects_;
|
||||
return project_;
|
||||
}
|
||||
|
||||
const QList<MainWindowLayoutInfo>& GetLoadedLayouts() const
|
||||
MainWindowLayoutInfo GetLoadedLayout() const
|
||||
{
|
||||
return layout_info_;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the filename the project was saved as, but not necessarily where it is now
|
||||
*
|
||||
* May help for resolving relative paths.
|
||||
*/
|
||||
const QString& GetFilenameProjectWasSavedAs() const
|
||||
{
|
||||
return project_saved_url_;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual bool Run() override;
|
||||
|
||||
private:
|
||||
QList<ProjectPtr> projects_;
|
||||
ProjectPtr project_;
|
||||
|
||||
QList<MainWindowLayoutInfo> layout_info_;
|
||||
MainWindowLayoutInfo layout_info_;
|
||||
|
||||
QString project_saved_url_;
|
||||
|
||||
QString filename_;
|
||||
|
||||
|
||||
@@ -51,8 +51,14 @@ bool ProjectSaveTask::Run()
|
||||
|
||||
writer.writeTextElement("version", "0.2.0");
|
||||
|
||||
writer.writeTextElement("url", project_->filename());
|
||||
|
||||
writer.writeStartElement(QStringLiteral("project"));
|
||||
|
||||
project_->Save(&writer);
|
||||
|
||||
writer.writeEndElement(); // project
|
||||
|
||||
writer.writeEndElement(); // olive
|
||||
|
||||
writer.writeEndDocument();
|
||||
|
||||
Reference in New Issue
Block a user