merged with master
This commit is contained in:
@@ -77,17 +77,3 @@ FootageStream* Footage::get_stream_from_file_index(bool video, int index) {
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void FootageStream::make_square_thumb() {
|
||||
// generate square version for QListView?
|
||||
int square_size = qMax(video_preview.width(), video_preview.height());
|
||||
QPixmap pixmap(square_size, square_size);
|
||||
pixmap.fill(Qt::transparent);
|
||||
QPainter p(&pixmap);
|
||||
int diff = (video_preview.width() - video_preview.height())>>1;
|
||||
int sqx = (diff < 0) ? -diff : 0;
|
||||
int sqy = (diff > 0) ? diff : 0;
|
||||
p.drawImage(sqx, sqy, video_preview);
|
||||
p.end();
|
||||
video_preview_square = QIcon(pixmap);
|
||||
}
|
||||
|
||||
@@ -62,9 +62,7 @@ struct FootageStream {
|
||||
// preview thumbnail/waveform
|
||||
bool preview_done;
|
||||
QImage video_preview;
|
||||
QIcon video_preview_square;
|
||||
QVector<char> audio_preview;
|
||||
void make_square_thumb();
|
||||
};
|
||||
|
||||
struct Footage {
|
||||
|
||||
+5
-10
@@ -34,10 +34,9 @@
|
||||
#include <QFile>
|
||||
#include <QTreeWidgetItem>
|
||||
|
||||
LoadThread::LoadThread(const QString& filename, bool autorecovery, bool clear) :
|
||||
LoadThread::LoadThread(const QString& filename, bool autorecovery) :
|
||||
filename_(filename),
|
||||
autorecovery_(autorecovery),
|
||||
clear_(clear),
|
||||
cancelled_(false)
|
||||
{
|
||||
connect(this, SIGNAL(finished()), this, SLOT(deleteLater()));
|
||||
@@ -101,7 +100,7 @@ void LoadThread::load_effect(QXmlStreamReader& stream, Clip* c) {
|
||||
c->closing_transition = (sharing_clip->opening_transition);
|
||||
|
||||
// since this is the closed clip, make this clip the secondary
|
||||
c->opening_transition->secondary_clip = c;
|
||||
c->closing_transition->secondary_clip = c;
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -606,8 +605,6 @@ Media* LoadThread::find_loaded_folder_by_id(int id) {
|
||||
}
|
||||
|
||||
void LoadThread::OrganizeFolders(int folder) {
|
||||
qDebug() << "starting with" << folder;
|
||||
|
||||
for (int i=0;i<loaded_folders.size();i++) {
|
||||
MediaPtr item = loaded_folders.at(i);
|
||||
int parent_id = item->temp_id2;
|
||||
@@ -615,7 +612,7 @@ void LoadThread::OrganizeFolders(int folder) {
|
||||
if (parent_id == folder) {
|
||||
olive::project_model.appendChild(find_loaded_folder_by_id(parent_id), item);
|
||||
|
||||
OrganizeFolders(parent_id);
|
||||
OrganizeFolders(item->temp_id);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -776,14 +773,12 @@ void LoadThread::success_func() {
|
||||
counter++;
|
||||
}
|
||||
|
||||
if (clear_) {
|
||||
olive::Global->update_project_filename(orig_filename);
|
||||
}
|
||||
olive::Global->update_project_filename(orig_filename);
|
||||
} else {
|
||||
panel_project->add_recent_project(filename_);
|
||||
}
|
||||
|
||||
olive::Global->set_modified(autorecovery_ || !clear_);
|
||||
olive::Global->set_modified(autorecovery_);
|
||||
if (open_seq != nullptr) {
|
||||
olive::Global->set_sequence(open_seq);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ class LoadThread : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
LoadThread(const QString& filename, bool autorecovery, bool clear);
|
||||
LoadThread(const QString& filename, bool autorecovery);
|
||||
void run();
|
||||
public slots:
|
||||
void cancel();
|
||||
@@ -50,7 +50,6 @@ private slots:
|
||||
void success_func();
|
||||
private:
|
||||
bool autorecovery_;
|
||||
bool clear_;
|
||||
QString filename_;
|
||||
|
||||
bool load_worker(QFile& f, QXmlStreamReader& stream, int type);
|
||||
|
||||
+24
-15
@@ -284,6 +284,24 @@ int Media::columnCount() const {
|
||||
return 3;
|
||||
}
|
||||
|
||||
QString Media::GetStringDuration() {
|
||||
if (get_type() == MEDIA_TYPE_SEQUENCE) {
|
||||
Sequence* s = to_sequence().get();
|
||||
return frame_to_timecode(s->getEndFrame(), olive::CurrentConfig.timecode_view, s->frame_rate);
|
||||
}
|
||||
if (get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
Footage* f = to_footage();
|
||||
double r = 30;
|
||||
|
||||
if (f->video_tracks.size() > 0 && !qIsNull(f->video_tracks.at(0).video_frame_rate))
|
||||
r = f->video_tracks.at(0).video_frame_rate * f->speed;
|
||||
|
||||
long len = f->get_length_in_frames(r);
|
||||
if (len > 0) return frame_to_timecode(len, olive::CurrentConfig.timecode_view, r);
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
||||
QVariant Media::data(int column, int role) {
|
||||
switch (role) {
|
||||
case Qt::DecorationRole:
|
||||
@@ -292,7 +310,7 @@ QVariant Media::data(int column, int role) {
|
||||
Footage* f = to_footage();
|
||||
if (f->video_tracks.size() > 0
|
||||
&& f->video_tracks.at(0).preview_done) {
|
||||
return f->video_tracks.at(0).video_preview_square;
|
||||
return QIcon(QPixmap::fromImage(f->video_tracks.at(0).video_preview));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -304,20 +322,7 @@ QVariant Media::data(int column, int role) {
|
||||
case 0: return (root) ? QCoreApplication::translate("Media", "Name") : get_name();
|
||||
case 1:
|
||||
if (root) return QCoreApplication::translate("Media", "Duration");
|
||||
if (get_type() == MEDIA_TYPE_SEQUENCE) {
|
||||
Sequence* s = to_sequence().get();
|
||||
return frame_to_timecode(s->getEndFrame(), olive::CurrentConfig.timecode_view, s->frame_rate);
|
||||
}
|
||||
if (get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
Footage* f = to_footage();
|
||||
double r = 30;
|
||||
|
||||
if (f->video_tracks.size() > 0 && !qIsNull(f->video_tracks.at(0).video_frame_rate))
|
||||
r = f->video_tracks.at(0).video_frame_rate * f->speed;
|
||||
|
||||
long len = f->get_length_in_frames(r);
|
||||
if (len > 0) return frame_to_timecode(len, olive::CurrentConfig.timecode_view, r);
|
||||
}
|
||||
return GetStringDuration();
|
||||
break;
|
||||
case 2:
|
||||
if (root) return QCoreApplication::translate("Media", "Rate");
|
||||
@@ -336,6 +341,10 @@ QVariant Media::data(int column, int role) {
|
||||
break;
|
||||
case Qt::ToolTipRole:
|
||||
return tooltip;
|
||||
|
||||
case Qt::UserRole:
|
||||
// User role returns the duration
|
||||
return GetStringDuration();
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
@@ -87,6 +87,8 @@ private:
|
||||
int type;
|
||||
VoidPtr object;
|
||||
|
||||
QString GetStringDuration();
|
||||
|
||||
// item functions
|
||||
QList<MediaPtr> children;
|
||||
Media* parent;
|
||||
|
||||
@@ -153,8 +153,6 @@ bool PreviewGenerator::retrieve_preview(const QString& hash) {
|
||||
QString thumb_path = get_thumbnail_path(hash, ms);
|
||||
QFile f(thumb_path);
|
||||
if (f.exists() && ms.video_preview.load(thumb_path)) {
|
||||
//dout << "loaded thumb" << ms->file_index << "from" << thumb_path;
|
||||
ms.make_square_thumb();
|
||||
ms.preview_done = true;
|
||||
} else {
|
||||
found = false;
|
||||
@@ -364,8 +362,6 @@ void PreviewGenerator::generate_waveform() {
|
||||
&data,
|
||||
linesize);
|
||||
|
||||
s->make_square_thumb();
|
||||
|
||||
// is video interlaced?
|
||||
s->video_auto_interlacing = (temp_frame->interlaced_frame) ? ((temp_frame->top_field_first) ? VIDEO_TOP_FIELD_FIRST : VIDEO_BOTTOM_FIELD_FIRST) : VIDEO_PROGRESSIVE;
|
||||
s->video_interlacing = s->video_auto_interlacing;
|
||||
|
||||
@@ -44,10 +44,10 @@ void ProjectModel::make_root() {
|
||||
|
||||
void ProjectModel::destroy_root() {
|
||||
if (panel_sequence_viewer != nullptr) {
|
||||
panel_sequence_viewer->viewer_widget->delete_function();
|
||||
panel_sequence_viewer->set_media(nullptr);
|
||||
}
|
||||
if (panel_footage_viewer != nullptr) {
|
||||
panel_footage_viewer->viewer_widget->delete_function();
|
||||
panel_footage_viewer->set_media(nullptr);
|
||||
}
|
||||
|
||||
root_item_ = std::make_shared<Media>();
|
||||
|
||||
@@ -47,9 +47,10 @@
|
||||
#include "ui/menu.h"
|
||||
#include "undo/undostack.h"
|
||||
|
||||
SourcesCommon::SourcesCommon(Project* parent) :
|
||||
SourcesCommon::SourcesCommon(Project* parent, ProjectFilter &sort_filter) :
|
||||
editing_item(nullptr),
|
||||
project_parent(parent)
|
||||
project_parent(parent),
|
||||
sort_filter_(sort_filter)
|
||||
{
|
||||
rename_timer.setInterval(1000);
|
||||
connect(&rename_timer, SIGNAL(timeout()), this, SLOT(rename_interval()));
|
||||
@@ -57,7 +58,7 @@ SourcesCommon::SourcesCommon(Project* parent) :
|
||||
|
||||
void SourcesCommon::create_seq_from_selected() {
|
||||
if (!selected_items.isEmpty()) {
|
||||
QVector<Media*> media_list;
|
||||
QVector<olive::timeline::MediaImportData> media_list;
|
||||
for (int i=0;i<selected_items.size();i++) {
|
||||
media_list.append(project_parent->item_to_media(selected_items.at(i)));
|
||||
}
|
||||
@@ -97,13 +98,13 @@ void SourcesCommon::show_context_menu(QWidget* parent, const QModelIndexList& it
|
||||
|
||||
QAction* toolbar_action = view_menu->addAction(tr("Show Toolbar"));
|
||||
toolbar_action->setCheckable(true);
|
||||
toolbar_action->setChecked(project_parent->toolbar_widget->isVisible());
|
||||
connect(toolbar_action, SIGNAL(triggered(bool)), project_parent->toolbar_widget, SLOT(setVisible(bool)));
|
||||
toolbar_action->setChecked(project_parent->IsToolbarVisible());
|
||||
connect(toolbar_action, SIGNAL(triggered(bool)), project_parent, SLOT(SetToolbarVisible(bool)));
|
||||
|
||||
QAction* show_sequences = view_menu->addAction(tr("Show Sequences"));
|
||||
show_sequences->setCheckable(true);
|
||||
show_sequences->setChecked(panel_project->sorter->get_show_sequences());
|
||||
connect(show_sequences, SIGNAL(triggered(bool)), panel_project->sorter, SLOT(set_show_sequences(bool)));
|
||||
show_sequences->setChecked(sort_filter_.get_show_sequences());
|
||||
connect(show_sequences, SIGNAL(triggered(bool)), &sort_filter_, SLOT(set_show_sequences(bool)));
|
||||
|
||||
if (items.size() > 0) {
|
||||
if (items.size() == 1) {
|
||||
@@ -282,7 +283,7 @@ void SourcesCommon::dropEvent(QWidget* parent,
|
||||
bool replace = false;
|
||||
if (urls.size() == 1
|
||||
&& drop_item.isValid()
|
||||
&& (m != nullptr && m->get_type() == MEDIA_TYPE_FOOTAGE)
|
||||
&& m->get_type() == MEDIA_TYPE_FOOTAGE
|
||||
&& !QFileInfo(paths.at(0)).isDir()
|
||||
&& olive::CurrentConfig.drop_on_media_to_replace
|
||||
&& QMessageBox::question(
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <QVector>
|
||||
|
||||
#include "project/footage.h"
|
||||
#include "project/projectfilter.h"
|
||||
|
||||
class Project;
|
||||
class QMouseEvent;
|
||||
@@ -36,7 +37,7 @@ class QDropEvent;
|
||||
class SourcesCommon : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
SourcesCommon(Project *parent);
|
||||
SourcesCommon(Project *parent, ProjectFilter& sort_filter);
|
||||
QAbstractItemView* view;
|
||||
void show_context_menu(QWidget* parent, const QModelIndexList &items);
|
||||
|
||||
@@ -45,6 +46,8 @@ public:
|
||||
void dropEvent(QWidget *parent, QDropEvent* e, const QModelIndex& drop_item, const QModelIndexList &items);
|
||||
|
||||
void item_click(Media* m, const QModelIndex &index);
|
||||
public slots:
|
||||
void stop_rename_timer();
|
||||
private slots:
|
||||
void create_seq_from_selected();
|
||||
void reveal_in_browser();
|
||||
@@ -61,11 +64,12 @@ private:
|
||||
QModelIndex editing_index;
|
||||
QModelIndexList selected_items;
|
||||
Project* project_parent;
|
||||
void stop_rename_timer();
|
||||
QTimer rename_timer;
|
||||
|
||||
// we cache the selected footage items for open_create_proxy_dialog()
|
||||
QVector<Media*> cached_selected_footage;
|
||||
|
||||
ProjectFilter& sort_filter_;
|
||||
};
|
||||
|
||||
#endif // SOURCESCOMMON_H
|
||||
|
||||
Reference in New Issue
Block a user