Merge branch 'master' of https://github.com/olive-editor/olive into bezierkeys

This commit is contained in:
itsmattkc
2018-12-29 11:31:13 +11:00
8 changed files with 91 additions and 76 deletions
+1 -7
View File
@@ -7,14 +7,8 @@
QString real_app_dir;
QString get_effects_dir() {
QString env_path(qgetenv("OLIVE_EFFECTS_PATH"));
if (!env_path.isEmpty()) return env_path;
return get_app_dir() + "/effects";
}
QString get_app_dir() {
if (real_app_dir.isEmpty()) {
if (real_app_dir.isEmpty()) {
QString app_path = QCoreApplication::applicationFilePath();
real_app_dir = app_path.left(app_path.lastIndexOf('/'));
}
-1
View File
@@ -5,6 +5,5 @@
QString get_app_dir();
QString get_data_path();
QString get_effects_dir();
#endif // PATH_H
+12 -1
View File
@@ -227,6 +227,17 @@ unix:!mac {
RESOURCES += \
icons/icons.qrc
unix:!mac:isEmpty(PREFIX) {
PREFIX = /usr/local
}
unix:!mac:target.path = $$PREFIX/bin
effects.files = $$PWD/effects/*.frag $$PWD/effects/*.xml $$PWD/effects/*.vert
unix:!mac:effects.path = $$PREFIX/share/olive-editor/effects
INSTALLS += target effects
unix:!mac {
metainfo.files = $$PWD/packaging/linux/org.olivevideoeditor.Olive.appdata.xml
metainfo.path = $$PREFIX/share/metainfo
@@ -251,4 +262,4 @@ unix:!mac {
icon1024.files = $$PWD/packaging/linux/icons/1024x1024/org.olivevideoeditor.Olive.png
icon1024.path = $$PREFIX/share/icons/hicolor/1024x1024/apps
INSTALLS += metainfo desktop mime icon16 icon32 icon48 icon64 icon128 icon256 icon512 icon1024
}
}
+7 -7
View File
@@ -41,7 +41,7 @@ EffectControls::EffectControls(QWidget *parent) :
ui->effects_area->header = ui->headers;
ui->keyframeView->header = ui->headers;
ui->label_2->setVisible(false);
ui->lblMultipleClipsSelected->setVisible(false);
connect(ui->horizontalScrollBar, SIGNAL(valueChanged(int)), ui->headers, SLOT(set_scroll(int)));
connect(ui->horizontalScrollBar, SIGNAL(resize_move(double)), ui->keyframeView, SLOT(resize_move(double)));
@@ -219,7 +219,7 @@ void EffectControls::clear_effects(bool clear_cache) {
item->widget()->setParent(NULL);
disconnect(static_cast<CollapsibleWidget*>(item->widget()), SIGNAL(deselect_others(QWidget*)), this, SLOT(deselect_all_effects(QWidget*)));
}
ui->label_2->setVisible(false);
ui->lblMultipleClipsSelected->setVisible(false);
ui->vcontainer->setVisible(false);
ui->acontainer->setVisible(false);
ui->headers->setVisible(false);
@@ -247,7 +247,7 @@ void EffectControls::open_effect(QVBoxLayout* layout, Effect* e) {
}
void EffectControls::load_effects() {
ui->label_2->setVisible(multiple);
ui->lblMultipleClipsSelected->setVisible(multiple);
if (!multiple) {
// load in new clips
@@ -319,19 +319,19 @@ void EffectControls::set_clips(QVector<int>& clips, int m) {
load_effects();
}
void EffectControls::on_add_video_effect_button_clicked() {
void EffectControls::on_btnAddVideoEffect_clicked() {
show_effect_menu(EFFECT_TYPE_EFFECT, EFFECT_TYPE_VIDEO);
}
void EffectControls::on_add_audio_effect_button_clicked() {
void EffectControls::on_btnAddAudioEffect_clicked() {
show_effect_menu(EFFECT_TYPE_EFFECT, EFFECT_TYPE_AUDIO);
}
void EffectControls::on_add_video_transition_button_clicked() {
void EffectControls::on_btnAddVideoTransition_clicked() {
show_effect_menu(EFFECT_TYPE_TRANSITION, EFFECT_TYPE_VIDEO);
}
void EffectControls::on_add_audio_transition_button_clicked() {
void EffectControls::on_btnAddAudioTransition_clicked() {
show_effect_menu(EFFECT_TYPE_TRANSITION, EFFECT_TYPE_AUDIO);
}
+6 -5
View File
@@ -52,12 +52,13 @@ public slots:
void update_keyframes();
private slots:
void menu_select(QAction* q);
void on_add_video_effect_button_clicked();
void on_add_audio_effect_button_clicked();
void deselect_all_effects(QWidget*);
void on_add_video_transition_button_clicked();
void on_add_audio_transition_button_clicked();
void on_btnAddVideoEffect_clicked();
void on_btnAddAudioEffect_clicked();
void on_btnAddVideoTransition_clicked();
void on_btnAddAudioTransition_clicked();
void deselect_all_effects(QWidget*);
protected:
void resizeEvent(QResizeEvent *event);
private:
+11 -11
View File
@@ -151,7 +151,7 @@
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="add_video_effect_button">
<widget class="QPushButton" name="btnAddVideoEffect">
<property name="toolTip">
<string>Add Video Effect</string>
</property>
@@ -166,7 +166,7 @@
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<spacer name="hsLeftVideoEffects">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@@ -179,7 +179,7 @@
</spacer>
</item>
<item>
<widget class="QLabel" name="label">
<widget class="QLabel" name="lblVideoEffects">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
@@ -200,7 +200,7 @@
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<spacer name="hsRightVideoEffects">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@@ -213,7 +213,7 @@
</spacer>
</item>
<item>
<widget class="QPushButton" name="add_video_transition_button">
<widget class="QPushButton" name="btnAddVideoTransition">
<property name="toolTip">
<string>Add Video Transition</string>
</property>
@@ -296,7 +296,7 @@
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="add_audio_effect_button">
<widget class="QPushButton" name="btnAddAudioEffect">
<property name="toolTip">
<string>Add Audio Effect</string>
</property>
@@ -311,7 +311,7 @@
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<spacer name="hsLeftAudioEffects">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@@ -324,7 +324,7 @@
</spacer>
</item>
<item>
<widget class="QLabel" name="label_3">
<widget class="QLabel" name="lblAudioEffects">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
@@ -345,7 +345,7 @@
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<spacer name="hsRightAudioEffects">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@@ -358,7 +358,7 @@
</spacer>
</item>
<item>
<widget class="QPushButton" name="add_audio_transition_button">
<widget class="QPushButton" name="btnAddAudioTransition">
<property name="toolTip">
<string>Add Audio Transition</string>
</property>
@@ -400,7 +400,7 @@
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<widget class="QLabel" name="lblMultipleClipsSelected">
<property name="text">
<string>(Multiple clips selected)</string>
</property>
+53 -44
View File
@@ -156,48 +156,57 @@ void load_internal_effects() {
}
void load_shader_effects() {
QString effects_path = get_effects_dir();
QDir effects_dir(effects_path);
if (effects_dir.exists()) {
QList<QString> entries = effects_dir.entryList(QStringList("*.xml"), QDir::Files);
for (int i=0;i<entries.size();i++) {
QFile file(effects_path + "/" + entries.at(i));
if (!file.open(QIODevice::ReadOnly)) {
dout << "[ERROR] Could not open" << entries.at(i);
return;
}
QList<QString> effects_paths;
effects_paths.append(get_app_dir() + "/effects");
effects_paths.append(get_app_dir() + "/../share/olive-editor/effects");
QString env_path(qgetenv("OLIVE_EFFECTS_PATH"));
if (!env_path.isEmpty()) effects_paths.append(env_path);
QXmlStreamReader reader(&file);
while (!reader.atEnd()) {
if (reader.name() == "effect") {
QString effect_name = "";
QString effect_cat = "";
const QXmlStreamAttributes attr = reader.attributes();
for (int j=0;j<attr.size();j++) {
if (attr.at(j).name() == "name") {
effect_name = attr.at(j).value().toString();
} else if (attr.at(j).name() == "category") {
effect_cat = attr.at(j).value().toString();
}
}
if (!effect_name.isEmpty()) {
EffectMeta em;
em.type = EFFECT_TYPE_EFFECT;
em.subtype = EFFECT_TYPE_VIDEO;
em.name = effect_name;
em.category = effect_cat;
em.filename = entries.at(i);
em.internal = -1;
effects.append(em);
} else {
dout << "[ERROR] Invalid effect found in" << entries.at(i);
}
break;
for (int h=0;h<effects_paths.size();h++) {
const QString& effects_path = effects_paths.at(h);
QDir effects_dir(effects_path);
if (effects_dir.exists()) {
QList<QString> entries = effects_dir.entryList(QStringList("*.xml"), QDir::Files);
for (int i=0;i<entries.size();i++) {
QFile file(effects_path + "/" + entries.at(i));
if (!file.open(QIODevice::ReadOnly)) {
dout << "[ERROR] Could not open" << entries.at(i);
return;
}
reader.readNext();
}
file.close();
QXmlStreamReader reader(&file);
while (!reader.atEnd()) {
if (reader.name() == "effect") {
QString effect_name = "";
QString effect_cat = "";
const QXmlStreamAttributes attr = reader.attributes();
for (int j=0;j<attr.size();j++) {
if (attr.at(j).name() == "name") {
effect_name = attr.at(j).value().toString();
} else if (attr.at(j).name() == "category") {
effect_cat = attr.at(j).value().toString();
}
}
if (!effect_name.isEmpty()) {
EffectMeta em;
em.type = EFFECT_TYPE_EFFECT;
em.subtype = EFFECT_TYPE_VIDEO;
em.name = effect_name;
em.category = effect_cat;
em.filename = file.fileName();
em.path = effects_path;
em.internal = -1;
effects.append(em);
} else {
dout << "[ERROR] Invalid effect found in" << entries.at(i);
}
break;
}
reader.readNext();
}
file.close();
}
}
}
}
@@ -253,7 +262,7 @@ Effect::Effect(Clip* c, const EffectMeta *em) :
container->setText(em->name);
if (!em->filename.isEmpty()) {
QFile effect_file(get_effects_dir() + "/" + em->filename);
QFile effect_file(em->filename);
if (effect_file.open(QFile::ReadOnly)) {
QXmlStreamReader reader(&effect_file);
@@ -401,7 +410,7 @@ Effect::Effect(Clip* c, const EffectMeta *em) :
fragPath = attr.value().toString();
}
}
} else if (reader.name() == "superimpose" && reader.isStartElement()) {
}/* else if (reader.name() == "superimpose" && reader.isStartElement()) {
enable_superimpose = true;
const QXmlStreamAttributes& attributes = reader.attributes();
for (int i=0;i<attributes.size();i++) {
@@ -417,7 +426,7 @@ Effect::Effect(Clip* c, const EffectMeta *em) :
break;
}
}
}
}*/
reader.readNext();
}
@@ -734,8 +743,8 @@ void Effect::open() {
dout << "[WARNING] No current context to create a shader program for - will retry next repaint";
} else {
glslProgram = new QOpenGLShaderProgram();
if (!vertPath.isEmpty()) glslProgram->addShaderFromSourceFile(QOpenGLShader::Vertex, get_effects_dir() + "/" + vertPath);
if (!fragPath.isEmpty()) glslProgram->addShaderFromSourceFile(QOpenGLShader::Fragment, get_effects_dir() + "/" + fragPath);
if (!vertPath.isEmpty()) glslProgram->addShaderFromSourceFile(QOpenGLShader::Vertex, meta->path + "/" + vertPath);
if (!fragPath.isEmpty()) glslProgram->addShaderFromSourceFile(QOpenGLShader::Fragment, meta->path + "/" + fragPath);
glslProgram->link();
isOpen = true;
}
+1
View File
@@ -29,6 +29,7 @@ struct EffectMeta {
QString name;
QString category;
QString filename;
QString path;
int internal;
int type;
int subtype;