further import process progress

This commit is contained in:
itsmattkc
2019-06-25 10:08:46 -07:00
parent 2e349323f0
commit dcf779e83f
4 changed files with 57 additions and 13 deletions
+39 -8
View File
@@ -22,18 +22,18 @@
#include <QApplication>
#include <QCommandLineParser>
#include <QFileDialog>
#include <QDebug>
#include <QFileDialog>
#include <QFileInfo>
#include <QMessageBox>
#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;i<urls.size();i++) {
//const QString& url = urls.at(i);
QString error_capt = tr("Import error");
//qDebug() << olive::panel_focus_manager->MostRecentlyFocused<ViewerPanel>();
if (urls.isEmpty()) {
QMessageBox::critical(main_window_, error_capt, tr("Nothing to import"));
return;
}
ProjectPanel* active_project_panel = olive::panel_focus_manager->MostRecentlyFocused<ProjectPanel>();
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;i<urls.size();i++) {
const QString& url = urls.at(i);
Footage* f = new Footage();
QFileInfo file_info(url);
f->set_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);
}
}
-3
View File
@@ -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) :
+10
View File
@@ -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;
+8 -2
View File
@@ -22,12 +22,13 @@
#ifndef FOOTAGE_H
#define FOOTAGE_H
#include <QList>
#include <QDateTime>
#include "project/item/item.h"
#include "project/item/footage/audiostream.h"
#include "project/item/footage/videostream.h"
#include <QList>
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<VideoStream> video_streams_;
QList<AudioStream> audio_streams_;
};