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).
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!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>
<data>
<variable>EnvironmentId</variable>
+39 -33
View File
@@ -18,6 +18,8 @@
#include <QDebug>
#include <QCharRef>
#include <QMessageBox>
#include <QDropEvent>
#include <QMimeData>
#include <QXmlStreamReader>
#include <QXmlStreamWriter>
@@ -33,7 +35,7 @@ Project::Project(QWidget *parent) :
QDockWidget(parent),
ui(new Ui::Project)
{
ui->setupUi(this);
ui->setupUi(this);
}
Project::~Project()
@@ -166,44 +168,48 @@ Media* Project::import_file(QString file) {
return m;
}
void Project::import_dialog() {
QStringList files = QFileDialog::getOpenFileNames(this, "Import media...", "", "All Files (*.*)");
for (int i=0;i<files.count();i++) {
QString file(files.at(i));
void Project::process_file_list(QStringList& files) {
for (int i=0;i<files.count();i++) {
QString file(files.at(i));
// heuristic to determine whether file is part of an image sequence
int lastcharindex = file.lastIndexOf(".")-1;
if (file[lastcharindex].isDigit()) {
bool is_img_sequence = false;
QString sequence_test(file);
char lastchar = sequence_test.at(lastcharindex).toLatin1();
// heuristic to determine whether file is part of an image sequence
int lastcharindex = file.lastIndexOf(".")-1;
if (file[lastcharindex].isDigit()) {
bool is_img_sequence = false;
QString sequence_test(file);
char lastchar = sequence_test.at(lastcharindex).toLatin1();
sequence_test[lastcharindex] = lastchar + 1;
if (QFileInfo::exists(sequence_test)) is_img_sequence = true;
sequence_test[lastcharindex] = lastchar + 1;
if (QFileInfo::exists(sequence_test)) is_img_sequence = true;
sequence_test[lastcharindex] = lastchar - 1;
if (QFileInfo::exists(sequence_test)) is_img_sequence = true;
sequence_test[lastcharindex] = lastchar - 1;
if (QFileInfo::exists(sequence_test)) is_img_sequence = true;
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) {
// change url to an image sequence instead
int digit_count = 0;
QString ext = file.mid(lastcharindex+1);
while (file[lastcharindex].isDigit()) {
digit_count++;
lastcharindex--;
}
QString new_filename = file.left(lastcharindex+1) + "%";
if (digit_count < 10) {
new_filename += "0";
}
new_filename += QString::number(digit_count) + "d" + ext;
file = new_filename;
}
}
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) {
// change url to an image sequence instead
int digit_count = 0;
QString ext = file.mid(lastcharindex+1);
while (file[lastcharindex].isDigit()) {
digit_count++;
lastcharindex--;
}
QString new_filename = file.left(lastcharindex+1) + "%";
if (digit_count < 10) {
new_filename += "0";
}
new_filename += QString::number(digit_count) + "d" + ext;
file = new_filename;
}
}
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) {
+1 -1
View File
@@ -31,6 +31,7 @@ public:
void new_sequence(Sequence* s);
QString get_next_sequence_name();
void remove_item(int i);
void process_file_list(QStringList& files);
void new_project();
void load_project();
@@ -40,7 +41,6 @@ public:
void set_media_of_tree(QTreeWidgetItem* item, Media* media);
SourceTable* source_table;
private:
Ui::Project *ui;
};
+1 -1
View File
@@ -42,7 +42,7 @@
<bool>false</bool>
</property>
<property name="dragDropMode">
<enum>QAbstractItemView::DragOnly</enum>
<enum>QAbstractItemView::DragDrop</enum>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
+35 -4
View File
@@ -8,9 +8,11 @@
#include "playback/playback.h"
#include <QDragEnterEvent>
#include <QMimeData>
SourceTable::SourceTable(QWidget* parent) : QTreeWidget(parent) {
this->sortByColumn(0, Qt::AscendingOrder);
sortByColumn(0, Qt::AscendingOrder);
setAcceptDrops(true);
}
void SourceTable::mouseDoubleClickEvent(QMouseEvent* )
@@ -25,6 +27,35 @@ void SourceTable::mouseDoubleClickEvent(QMouseEvent* )
}
}
//void SourceTable::dragEnterEvent(QDragEnterEvent *event) {
// event->accept();
//}
void SourceTable::dragEnterEvent(QDragEnterEvent *event) {
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);
protected:
void mouseDoubleClickEvent(QMouseEvent *event);
// void dragEnterEvent(QDragEnterEvent *event) override;
void dragEnterEvent(QDragEnterEvent *event);
void dragMoveEvent(QDragMoveEvent *event);
void dropEvent(QDropEvent *event);
private:
};
+1 -1
View File
@@ -1033,7 +1033,7 @@ void TimelineWidget::paintEvent(QPaintEvent*) {
}
bool TimelineWidget::is_track_visible(int track) {
return ((bottom_align && track < 0) || (!bottom_align && track >= 0));
return (bottom_align == (track < 0));
}
// **************************************