diff --git a/res/buttons/page_copy.png b/res/buttons/page_copy.png
new file mode 100644
index 0000000..195dc6d
Binary files /dev/null and b/res/buttons/page_copy.png differ
diff --git a/res/resources.qrc b/res/resources.qrc
index 20d1920..193bb53 100644
--- a/res/resources.qrc
+++ b/res/resources.qrc
@@ -21,6 +21,7 @@
buttons/hourglass.png
buttons/information.png
buttons/lightning.png
+ buttons/page_copy.png
buttons/page_edit.png
buttons/page_paste.png
buttons/pause.png
diff --git a/src/version.h b/src/version.h
index 51d670b..68499d8 100644
--- a/src/version.h
+++ b/src/version.h
@@ -22,7 +22,7 @@
#define VER_X264_MAJOR 2
#define VER_X264_MINOR 0
#define VER_X264_PATCH 2
-#define VER_X264_BUILD 209
+#define VER_X264_BUILD 216
#define VER_X264_MINIMUM_REV 2146
#define VER_X264_CURRENT_API 120
diff --git a/src/win_addJob.cpp b/src/win_addJob.cpp
index 2ebb55c..48dbf9f 100644
--- a/src/win_addJob.cpp
+++ b/src/win_addJob.cpp
@@ -38,6 +38,7 @@
#include
#include
#include
+#include
#define VALID_DIR(PATH) ((!(PATH).isEmpty()) && QFileInfo(PATH).exists() && QFileInfo(PATH).isDir())
@@ -56,6 +57,21 @@
} \
}
+#define ADD_CONTEXTMENU_ACTION(WIDGET, ICON, TEXT, SLOTNAME) \
+{ \
+ QAction *_action = new QAction((ICON), (TEXT), this); \
+ _action->setData(QVariant::fromValue(WIDGET)); \
+ WIDGET->addAction(_action); \
+ connect(_action, SIGNAL(triggered(bool)), this, SLOT(SLOTNAME())); \
+}
+
+#define ADD_CONTEXTMENU_SEPARATOR(WIDGET) \
+{ \
+ QAction *_action = new QAction(this); \
+ _action->setSeparator(true); \
+ WIDGET->addAction(_action); \
+}
+
///////////////////////////////////////////////////////////////////////////////
// Validator
///////////////////////////////////////////////////////////////////////////////
@@ -222,14 +238,14 @@ AddJobDialog::AddJobDialog(QWidget *parent, OptionsModel *options, bool x64suppo
connect(editCustomAvs2YUVParams, SIGNAL(textChanged(QString)), this, SLOT(configurationChanged()));
//Create context menus
- QAction *editorActionX264 = new QAction(QIcon(":/buttons/page_edit.png"), tr("Open Editor"), this);
- editorActionX264->setData(QVariant::fromValue(editCustomX264Params));
- editCustomX264Params->addAction(editorActionX264);
- connect(editorActionX264, SIGNAL(triggered(bool)), this, SLOT(editorActionTriggered()));
- QAction *editorActionAvs2YUV = new QAction(QIcon(":/buttons/page_edit.png"), tr("Open Editor"), this);
- editorActionAvs2YUV->setData(QVariant::fromValue(editCustomAvs2YUVParams));
- editCustomAvs2YUVParams->addAction(editorActionAvs2YUV);
- connect(editorActionAvs2YUV, SIGNAL(triggered(bool)), this, SLOT(editorActionTriggered()));
+ ADD_CONTEXTMENU_ACTION(editCustomX264Params, QIcon(":/buttons/page_edit.png"), tr("Open the Text-Editor"), editorActionTriggered);
+ ADD_CONTEXTMENU_ACTION(editCustomAvs2YUVParams, QIcon(":/buttons/page_edit.png"), tr("Open the Text-Editor"), editorActionTriggered);
+ ADD_CONTEXTMENU_SEPARATOR(editCustomX264Params);
+ ADD_CONTEXTMENU_SEPARATOR(editCustomAvs2YUVParams);
+ ADD_CONTEXTMENU_ACTION(editCustomX264Params, QIcon(":/buttons/page_copy.png"), tr("Copy to Clipboard"), copyActionTriggered);
+ ADD_CONTEXTMENU_ACTION(editCustomAvs2YUVParams, QIcon(":/buttons/page_copy.png"), tr("Copy to Clipboard"), copyActionTriggered);
+ ADD_CONTEXTMENU_ACTION(editCustomX264Params, QIcon(":/buttons/page_paste.png"), tr("Paste from Clipboard"), pasteActionTriggered);
+ ADD_CONTEXTMENU_ACTION(editCustomAvs2YUVParams, QIcon(":/buttons/page_paste.png"), tr("Paste from Clipboard"), pasteActionTriggered);
//Setup template selector
loadTemplateList();
@@ -668,6 +684,28 @@ void AddJobDialog::editorActionTriggered(void)
}
}
+void AddJobDialog::copyActionTriggered(void)
+{
+ if(QAction *action = dynamic_cast(QObject::sender()))
+ {
+ QClipboard *clipboard = QApplication::clipboard();
+ QLineEdit *lineEdit = reinterpret_cast(action->data().value());
+ QString text = lineEdit->hasSelectedText() ? lineEdit->selectedText() : lineEdit->text();
+ clipboard->setText(text);
+ }
+}
+
+void AddJobDialog::pasteActionTriggered(void)
+{
+ if(QAction *action = dynamic_cast(QObject::sender()))
+ {
+ QClipboard *clipboard = QApplication::clipboard();
+ QLineEdit *lineEdit = reinterpret_cast(action->data().value());
+ QString text = clipboard->text();
+ if(!text.isEmpty()) lineEdit->setText(text);
+ }
+}
+
///////////////////////////////////////////////////////////////////////////////
// Public functions
///////////////////////////////////////////////////////////////////////////////
diff --git a/src/win_addJob.h b/src/win_addJob.h
index fd43e37..1217a92 100644
--- a/src/win_addJob.h
+++ b/src/win_addJob.h
@@ -68,6 +68,8 @@ private slots:
void saveTemplateButtonClicked(void);
void deleteTemplateButtonClicked(void);
void editorActionTriggered(void);
+ void copyActionTriggered(void);
+ void pasteActionTriggered(void);
virtual void accept(void);