From dcf779e83f091dbb672e6b1ee5fd6c3e4c24f6f3 Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Tue, 25 Jun 2019 10:08:46 -0700 Subject: [PATCH] further import process progress --- app/core.cpp | 47 +++++++++++++++++++++++----- app/panel/panelfocusmanager.cpp | 3 -- app/project/item/footage/footage.cpp | 10 ++++++ app/project/item/footage/footage.h | 10 ++++-- 4 files changed, 57 insertions(+), 13 deletions(-) diff --git a/app/core.cpp b/app/core.cpp index 392195d64..2785f1c17 100644 --- a/app/core.cpp +++ b/app/core.cpp @@ -22,18 +22,18 @@ #include #include -#include #include +#include +#include +#include #include "panel/panelfocusmanager.h" #include "panel/project/project.h" +#include "project/item/footage/footage.h" #include "ui/icons/icons.h" #include "ui/style/style.h" #include "widget/menu/menushared.h" - -#include "panel/viewer/viewer.h" - Core olive::core; Core::Core() : @@ -54,7 +54,8 @@ void Core::Start() parser.addVersionOption(); // Project from command line option - // FIXME: What's the correct way to make a visually "optional" positional argument? + // FIXME: What's the correct way to make a visually "optional" positional argument, or is manually adding square + // brackets like this correct? parser.addPositionalArgument("[project]", tr("Project to open on startup")); // Create fullscreen option @@ -123,10 +124,40 @@ olive::MainWindow *Core::main_window() void Core::ImportFiles(const QStringList &urls) { - for (int i=0;iMostRecentlyFocused(); + if (urls.isEmpty()) { + QMessageBox::critical(main_window_, error_capt, tr("Nothing to import")); + return; + } + + ProjectPanel* active_project_panel = olive::panel_focus_manager->MostRecentlyFocused(); + Project* active_project; + + if (active_project_panel == nullptr // Check that we found a Project panel + || (active_project = active_project_panel->project()) == nullptr) { // and that we could find an active Project + + QMessageBox::critical(main_window_, error_capt, tr("Failed to find active Project panel")); + + } else { + + for (int i=0;iset_filename(url); + f->set_name(file_info.fileName()); + //file_info.lastModified(); + + active_project->root()->add_child(f); + + } + + // FIXME: Dumb way of resetting the model to update for new information + active_project_panel->set_project(active_project); } } diff --git a/app/panel/panelfocusmanager.cpp b/app/panel/panelfocusmanager.cpp index cf8889255..c25e77245 100644 --- a/app/panel/panelfocusmanager.cpp +++ b/app/panel/panelfocusmanager.cpp @@ -20,9 +20,6 @@ #include "panelfocusmanager.h" -#include "panel/project/project.h" -#include "panel/viewer/viewer.h" - PanelFocusManager* olive::panel_focus_manager = nullptr; PanelFocusManager::PanelFocusManager(QObject *parent) : diff --git a/app/project/item/footage/footage.cpp b/app/project/item/footage/footage.cpp index 098600f51..a2d159488 100644 --- a/app/project/item/footage/footage.cpp +++ b/app/project/item/footage/footage.cpp @@ -35,6 +35,16 @@ void Footage::set_filename(const QString &s) filename_ = s; } +const QDateTime &Footage::timestamp() +{ + return timestamp_; +} + +void Footage::set_timestamp(const QDateTime &t) +{ + timestamp_ = t; +} + Item::Type Footage::type() const { return kFootage; diff --git a/app/project/item/footage/footage.h b/app/project/item/footage/footage.h index 0607177c9..183871554 100644 --- a/app/project/item/footage/footage.h +++ b/app/project/item/footage/footage.h @@ -22,12 +22,13 @@ #ifndef FOOTAGE_H #define FOOTAGE_H +#include +#include + #include "project/item/item.h" #include "project/item/footage/audiostream.h" #include "project/item/footage/videostream.h" -#include - class Footage : public Item { public: @@ -36,6 +37,9 @@ public: const QString& filename(); void set_filename(const QString& s); + const QDateTime& timestamp(); + void set_timestamp(const QDateTime& t); + void add_audio_stream(const AudioStream& as); void add_video_stream(const VideoStream& vs); @@ -47,6 +51,8 @@ public: private: QString filename_; + QDateTime timestamp_; + QList video_streams_; QList audio_streams_; };