diff --git a/effects/effect.cpp b/effects/effect.cpp
index 4b1ff407a..64386d2ff 100644
--- a/effects/effect.cpp
+++ b/effects/effect.cpp
@@ -415,9 +415,14 @@ void Effect::delete_self() {
}
void Effect::move_up() {
+ int index_of_effect = parent_clip->IndexOfEffect(this);
+ if (index_of_effect == 0) {
+ return;
+ }
+
MoveEffectCommand* command = new MoveEffectCommand();
command->clip = parent_clip;
- command->from = parent_clip->IndexOfEffect(this);
+ command->from = index_of_effect;
command->to = command->from - 1;
olive::UndoStack.push(command);
panel_effect_controls->Reload();
@@ -425,9 +430,14 @@ void Effect::move_up() {
}
void Effect::move_down() {
+ int index_of_effect = parent_clip->IndexOfEffect(this);
+ if (index_of_effect == parent_clip->effects.size()-1) {
+ return;
+ }
+
MoveEffectCommand* command = new MoveEffectCommand();
command->clip = parent_clip;
- command->from = parent_clip->IndexOfEffect(this);
+ command->from = index_of_effect;
command->to = command->from + 1;
olive::UndoStack.push(command);
panel_effect_controls->Reload();
diff --git a/global/debug.cpp b/global/debug.cpp
index e948b5e51..b64e38ecd 100644
--- a/global/debug.cpp
+++ b/global/debug.cpp
@@ -34,79 +34,79 @@ QFile debug_file;
QTextStream debug_stream;
void open_debug_file() {
- QDir debug_dir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation);
- debug_dir.mkpath(".");
- if (debug_dir.exists()) {
- debug_file.setFileName(debug_dir.path() + "/debug_log");
- if (debug_file.open(QFile::WriteOnly)) {
- debug_stream.setDevice(&debug_file);
- } else {
- qWarning() << "Couldn't open debug log file, debug log will not be saved";
- }
+ QDir debug_dir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation);
+ debug_dir.mkpath(".");
+ if (debug_dir.exists()) {
+ debug_file.setFileName(debug_dir.path() + "/debug_log");
+ if (debug_file.open(QFile::WriteOnly)) {
+ debug_stream.setDevice(&debug_file);
+ } else {
+ qWarning() << "Couldn't open debug log file, debug log will not be saved";
}
+ }
}
void close_debug_file()
{
- if (debug_file.isOpen()) {
- debug_file.close();
- }
+ if (debug_file.isOpen()) {
+ debug_file.close();
+ }
}
void debug_message_handler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
- debug_mutex.lock();
- const QByteArray localMsg = msg.toLocal8Bit();
- const QDateTime now = QDateTime::currentDateTime();
- const QByteArray timeRepr(now.toString(Qt::ISODate).toLocal8Bit());
- QString msgTag;
- QString fontColor;
- switch (type) {
- case QtDebugMsg:
- msgTag = "DEBUG";
- fontColor = "grey";
- break;
- case QtInfoMsg:
- msgTag = "INFO";
- fontColor = "blue";
- break;
- case QtWarningMsg:
- msgTag = "WARNING";
- fontColor = "yellow";
- break;
- case QtCriticalMsg:
- msgTag = "ERROR";
- fontColor = "red";
- break;
- case QtFatalMsg:
- msgTag = "FATAL";
- fontColor = "red";
- break;
- default:
- fprintf(stderr, "Unknown debug msg type");
- fflush(stderr);
- break;
- }//switch
+ debug_mutex.lock();
+ const QByteArray localMsg = msg.toLocal8Bit();
+ const QDateTime now = QDateTime::currentDateTime();
+ const QByteArray timeRepr(now.toString(Qt::ISODate).toLocal8Bit());
+ QString msgTag;
+ QString fontColor;
+ switch (type) {
+ case QtDebugMsg:
+ msgTag = "DEBUG";
+ fontColor = "grey";
+ break;
+ case QtInfoMsg:
+ msgTag = "INFO";
+ fontColor = "blue";
+ break;
+ case QtWarningMsg:
+ msgTag = "WARNING";
+ fontColor = "yellow";
+ break;
+ case QtCriticalMsg:
+ msgTag = "ERROR";
+ fontColor = "red";
+ break;
+ case QtFatalMsg:
+ msgTag = "FATAL";
+ fontColor = "red";
+ break;
+ default:
+ fprintf(stderr, "Unknown debug msg type");
+ fflush(stderr);
+ break;
+ }//switch
- /*fprintf(stderr, "%s [%s] %s (%s:%u, %s)\n", timeRepr.data(), msgTag.toLocal8Bit().constData(), localMsg.data(),
+ /*fprintf(stderr, "%s [%s] %s (%s:%u, %s)\n", timeRepr.data(), msgTag.toLocal8Bit().constData(), localMsg.data(),
context.file, context.line, context.function);*/
- fprintf(stderr, "%s [%s] %s\n", timeRepr.data(), msgTag.toLocal8Bit().constData(), localMsg.data());
+ fprintf(stderr, "%s [%s] %s\n", timeRepr.data(), msgTag.toLocal8Bit().constData(), localMsg.data());
- if (debug_file.isOpen()) {
- debug_stream << QString("[%1] %2 (%3:%4, %5)\n")
- .arg(msgTag, localMsg, context.file, QString::number(context.line), context.function);
- }
- debug_info.prepend(QString("[%2] %3 (%4:%5, %6)
")
- .arg(fontColor, msgTag, localMsg, context.file, QString::number(context.line), context.function));
- fflush(stderr);
- if (olive::DebugDialog != nullptr && olive::DebugDialog->isVisible()) {
- QMetaObject::invokeMethod(olive::DebugDialog, "update_log", Qt::QueuedConnection);
- }
- debug_mutex.unlock();
+ if (debug_file.isOpen()) {
+ debug_stream << QString("[%1] %2 (%3:%4, %5)\n")
+ .arg(msgTag, localMsg, context.file, QString::number(context.line), context.function);
+ }
+ debug_info.prepend(QString("[%2] %3 (%4:%5, %6)
")
+ .arg(fontColor, msgTag, localMsg, context.file, QString::number(context.line), context.function));
+ fflush(stderr);
+ if (olive::DebugDialog != nullptr && olive::DebugDialog->isVisible()) {
+ QMetaObject::invokeMethod(olive::DebugDialog, "update_log", Qt::QueuedConnection);
+ }
+ debug_mutex.unlock();
}
const QString &get_debug_str()
{
- return debug_info;
+ return debug_info;
}
diff --git a/ui/effectui.cpp b/ui/effectui.cpp
index 4cbee4fa7..feeb0334b 100644
--- a/ui/effectui.cpp
+++ b/ui/effectui.cpp
@@ -289,23 +289,39 @@ void EffectUI::show_context_menu(const QPoint& pos) {
menu.addSeparator();
+ QAction* move_up_action = nullptr;
+ QAction* move_down_action = nullptr;
+
if (index > 0) {
- menu.addAction(tr("Move &Up"), this, SLOT(move_up()));
+ move_up_action = menu.addAction(tr("Move &Up"), GetEffect(), SLOT(move_up()));
}
if (index < c->effects.size() - 1) {
- menu.addAction(tr("Move &Down"), this, SLOT(move_down()));
+ move_down_action = menu.addAction(tr("Move &Down"), GetEffect(), SLOT(move_down()));
}
menu.addSeparator();
- menu.addAction(tr("D&elete"), this, SLOT(delete_self()));
+ QAction* delete_action = menu.addAction(tr("D&elete"), GetEffect(), SLOT(delete_self()));
+
+ // Loop through additional effects and link these too
+ for (int i=0;imapToGlobal(pos));
}