This commit is contained in:
itsmattkc
2018-07-01 15:40:08 +01:00
parent ab70f04617
commit d77e9db1ae
8 changed files with 82 additions and 43 deletions
+1 -1
View File
@@ -1,3 +1,3 @@
#Olive Video Editor # Olive Video Editor
Olive is a non-linear video editor for Windows, macOS, and Linux. Binaries are not available as of yet, but will be very soon. If you're building from source, you'll need Qt and FFmpeg (recommended versions are Qt 5.5 and FFmpeg 3.4.2). Olive is a non-linear video editor for Windows, macOS, and Linux. Binaries are not available as of yet, but will be very soon. If you're building from source, you'll need Qt and FFmpeg (recommended versions are Qt 5.5 and FFmpeg 3.4.2).
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.6.2, 2018-07-01T04:07:52. --> <!-- Written by QtCreator 4.6.2, 2018-07-01T04:18:56. -->
<qtcreator> <qtcreator>
<data> <data>
<variable>EnvironmentId</variable> <variable>EnvironmentId</variable>
+39 -33
View File
@@ -18,6 +18,8 @@
#include <QDebug> #include <QDebug>
#include <QCharRef> #include <QCharRef>
#include <QMessageBox> #include <QMessageBox>
#include <QDropEvent>
#include <QMimeData>
#include <QXmlStreamReader> #include <QXmlStreamReader>
#include <QXmlStreamWriter> #include <QXmlStreamWriter>
@@ -33,7 +35,7 @@ Project::Project(QWidget *parent) :
QDockWidget(parent), QDockWidget(parent),
ui(new Ui::Project) ui(new Ui::Project)
{ {
ui->setupUi(this); ui->setupUi(this);
} }
Project::~Project() Project::~Project()
@@ -166,44 +168,48 @@ Media* Project::import_file(QString file) {
return m; return m;
} }
void Project::import_dialog() { void Project::process_file_list(QStringList& files) {
QStringList files = QFileDialog::getOpenFileNames(this, "Import media...", "", "All Files (*.*)"); for (int i=0;i<files.count();i++) {
for (int i=0;i<files.count();i++) { QString file(files.at(i));
QString file(files.at(i));
// heuristic to determine whether file is part of an image sequence // heuristic to determine whether file is part of an image sequence
int lastcharindex = file.lastIndexOf(".")-1; int lastcharindex = file.lastIndexOf(".")-1;
if (file[lastcharindex].isDigit()) { if (file[lastcharindex].isDigit()) {
bool is_img_sequence = false; bool is_img_sequence = false;
QString sequence_test(file); QString sequence_test(file);
char lastchar = sequence_test.at(lastcharindex).toLatin1(); char lastchar = sequence_test.at(lastcharindex).toLatin1();
sequence_test[lastcharindex] = lastchar + 1; sequence_test[lastcharindex] = lastchar + 1;
if (QFileInfo::exists(sequence_test)) is_img_sequence = true; if (QFileInfo::exists(sequence_test)) is_img_sequence = true;
sequence_test[lastcharindex] = lastchar - 1; sequence_test[lastcharindex] = lastchar - 1;
if (QFileInfo::exists(sequence_test)) is_img_sequence = true; if (QFileInfo::exists(sequence_test)) is_img_sequence = true;
if (is_img_sequence && if (is_img_sequence &&
QMessageBox::question(this, "Image sequence detected", "The file '" + file + "' appears to be part of an image sequence. Would you like to import it as such?", QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) == QMessageBox::Yes) { QMessageBox::question(this, "Image sequence detected", "The file '" + file + "' appears to be part of an image sequence. Would you like to import it as such?", QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) == QMessageBox::Yes) {
// change url to an image sequence instead // change url to an image sequence instead
int digit_count = 0; int digit_count = 0;
QString ext = file.mid(lastcharindex+1); QString ext = file.mid(lastcharindex+1);
while (file[lastcharindex].isDigit()) { while (file[lastcharindex].isDigit()) {
digit_count++; digit_count++;
lastcharindex--; lastcharindex--;
} }
QString new_filename = file.left(lastcharindex+1) + "%"; QString new_filename = file.left(lastcharindex+1) + "%";
if (digit_count < 10) { if (digit_count < 10) {
new_filename += "0"; new_filename += "0";
} }
new_filename += QString::number(digit_count) + "d" + ext; new_filename += QString::number(digit_count) + "d" + ext;
file = new_filename; file = new_filename;
} }
} }
import_file(file); import_file(file);
} }
}
void Project::import_dialog() {
QStringList files = QFileDialog::getOpenFileNames(this, "Import media...", "", "All Files (*.*)");
process_file_list(files);
} }
Media* Project::get_media_from_tree(QTreeWidgetItem* item) { Media* Project::get_media_from_tree(QTreeWidgetItem* item) {
+1 -1
View File
@@ -31,6 +31,7 @@ public:
void new_sequence(Sequence* s); void new_sequence(Sequence* s);
QString get_next_sequence_name(); QString get_next_sequence_name();
void remove_item(int i); void remove_item(int i);
void process_file_list(QStringList& files);
void new_project(); void new_project();
void load_project(); void load_project();
@@ -40,7 +41,6 @@ public:
void set_media_of_tree(QTreeWidgetItem* item, Media* media); void set_media_of_tree(QTreeWidgetItem* item, Media* media);
SourceTable* source_table; SourceTable* source_table;
private: private:
Ui::Project *ui; Ui::Project *ui;
}; };
+1 -1
View File
@@ -42,7 +42,7 @@
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="dragDropMode"> <property name="dragDropMode">
<enum>QAbstractItemView::DragOnly</enum> <enum>QAbstractItemView::DragDrop</enum>
</property> </property>
<property name="selectionMode"> <property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum> <enum>QAbstractItemView::ExtendedSelection</enum>
+35 -4
View File
@@ -8,9 +8,11 @@
#include "playback/playback.h" #include "playback/playback.h"
#include <QDragEnterEvent> #include <QDragEnterEvent>
#include <QMimeData>
SourceTable::SourceTable(QWidget* parent) : QTreeWidget(parent) { SourceTable::SourceTable(QWidget* parent) : QTreeWidget(parent) {
this->sortByColumn(0, Qt::AscendingOrder); sortByColumn(0, Qt::AscendingOrder);
setAcceptDrops(true);
} }
void SourceTable::mouseDoubleClickEvent(QMouseEvent* ) void SourceTable::mouseDoubleClickEvent(QMouseEvent* )
@@ -25,6 +27,35 @@ void SourceTable::mouseDoubleClickEvent(QMouseEvent* )
} }
} }
//void SourceTable::dragEnterEvent(QDragEnterEvent *event) { void SourceTable::dragEnterEvent(QDragEnterEvent *event) {
// event->accept(); if (event->mimeData()->hasUrls()) {
//} event->acceptProposedAction();
} else {
QTreeWidget::dragEnterEvent(event);
}
}
void SourceTable::dragMoveEvent(QDragMoveEvent *event) {
if (event->mimeData()->hasUrls()) {
event->acceptProposedAction();
} else {
QTreeWidget::dragMoveEvent(event);
}
}
void SourceTable::dropEvent(QDropEvent* event) {
const QMimeData* mimeData = event->mimeData();
if (mimeData->hasUrls()) {
QList<QUrl> urls = mimeData->urls();
if (!urls.isEmpty()) {
QStringList paths;
for (int i=0;i<urls.size();i++) {
paths.append(urls.at(i).toLocalFile());
}
panel_project->process_file_list(paths);
}
event->acceptProposedAction();
}
QTreeWidget::dropEvent(event);
}
+3 -1
View File
@@ -11,7 +11,9 @@ public:
SourceTable(QWidget* parent = 0); SourceTable(QWidget* parent = 0);
protected: protected:
void mouseDoubleClickEvent(QMouseEvent *event); void mouseDoubleClickEvent(QMouseEvent *event);
// void dragEnterEvent(QDragEnterEvent *event) override; void dragEnterEvent(QDragEnterEvent *event);
void dragMoveEvent(QDragMoveEvent *event);
void dropEvent(QDropEvent *event);
private: private:
}; };
+1 -1
View File
@@ -1033,7 +1033,7 @@ void TimelineWidget::paintEvent(QPaintEvent*) {
} }
bool TimelineWidget::is_track_visible(int track) { bool TimelineWidget::is_track_visible(int track) {
return ((bottom_align && track < 0) || (!bottom_align && track >= 0)); return (bottom_align == (track < 0));
} }
// ************************************** // **************************************