Added "Copy" and "Paste" to custom context menu.
This commit is contained in:
parent
83e51e6a17
commit
c91451069e
BIN
res/buttons/page_copy.png
Normal file
BIN
res/buttons/page_copy.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 663 B |
@ -21,6 +21,7 @@
|
|||||||
<file>buttons/hourglass.png</file>
|
<file>buttons/hourglass.png</file>
|
||||||
<file>buttons/information.png</file>
|
<file>buttons/information.png</file>
|
||||||
<file>buttons/lightning.png</file>
|
<file>buttons/lightning.png</file>
|
||||||
|
<file>buttons/page_copy.png</file>
|
||||||
<file>buttons/page_edit.png</file>
|
<file>buttons/page_edit.png</file>
|
||||||
<file>buttons/page_paste.png</file>
|
<file>buttons/page_paste.png</file>
|
||||||
<file>buttons/pause.png</file>
|
<file>buttons/pause.png</file>
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#define VER_X264_MAJOR 2
|
#define VER_X264_MAJOR 2
|
||||||
#define VER_X264_MINOR 0
|
#define VER_X264_MINOR 0
|
||||||
#define VER_X264_PATCH 2
|
#define VER_X264_PATCH 2
|
||||||
#define VER_X264_BUILD 209
|
#define VER_X264_BUILD 216
|
||||||
|
|
||||||
#define VER_X264_MINIMUM_REV 2146
|
#define VER_X264_MINIMUM_REV 2146
|
||||||
#define VER_X264_CURRENT_API 120
|
#define VER_X264_CURRENT_API 120
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
|
#include <QClipboard>
|
||||||
|
|
||||||
#define VALID_DIR(PATH) ((!(PATH).isEmpty()) && QFileInfo(PATH).exists() && QFileInfo(PATH).isDir())
|
#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<void*>(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
|
// Validator
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
@ -222,14 +238,14 @@ AddJobDialog::AddJobDialog(QWidget *parent, OptionsModel *options, bool x64suppo
|
|||||||
connect(editCustomAvs2YUVParams, SIGNAL(textChanged(QString)), this, SLOT(configurationChanged()));
|
connect(editCustomAvs2YUVParams, SIGNAL(textChanged(QString)), this, SLOT(configurationChanged()));
|
||||||
|
|
||||||
//Create context menus
|
//Create context menus
|
||||||
QAction *editorActionX264 = new QAction(QIcon(":/buttons/page_edit.png"), tr("Open Editor"), this);
|
ADD_CONTEXTMENU_ACTION(editCustomX264Params, QIcon(":/buttons/page_edit.png"), tr("Open the Text-Editor"), editorActionTriggered);
|
||||||
editorActionX264->setData(QVariant::fromValue<void*>(editCustomX264Params));
|
ADD_CONTEXTMENU_ACTION(editCustomAvs2YUVParams, QIcon(":/buttons/page_edit.png"), tr("Open the Text-Editor"), editorActionTriggered);
|
||||||
editCustomX264Params->addAction(editorActionX264);
|
ADD_CONTEXTMENU_SEPARATOR(editCustomX264Params);
|
||||||
connect(editorActionX264, SIGNAL(triggered(bool)), this, SLOT(editorActionTriggered()));
|
ADD_CONTEXTMENU_SEPARATOR(editCustomAvs2YUVParams);
|
||||||
QAction *editorActionAvs2YUV = new QAction(QIcon(":/buttons/page_edit.png"), tr("Open Editor"), this);
|
ADD_CONTEXTMENU_ACTION(editCustomX264Params, QIcon(":/buttons/page_copy.png"), tr("Copy to Clipboard"), copyActionTriggered);
|
||||||
editorActionAvs2YUV->setData(QVariant::fromValue<void*>(editCustomAvs2YUVParams));
|
ADD_CONTEXTMENU_ACTION(editCustomAvs2YUVParams, QIcon(":/buttons/page_copy.png"), tr("Copy to Clipboard"), copyActionTriggered);
|
||||||
editCustomAvs2YUVParams->addAction(editorActionAvs2YUV);
|
ADD_CONTEXTMENU_ACTION(editCustomX264Params, QIcon(":/buttons/page_paste.png"), tr("Paste from Clipboard"), pasteActionTriggered);
|
||||||
connect(editorActionAvs2YUV, SIGNAL(triggered(bool)), this, SLOT(editorActionTriggered()));
|
ADD_CONTEXTMENU_ACTION(editCustomAvs2YUVParams, QIcon(":/buttons/page_paste.png"), tr("Paste from Clipboard"), pasteActionTriggered);
|
||||||
|
|
||||||
//Setup template selector
|
//Setup template selector
|
||||||
loadTemplateList();
|
loadTemplateList();
|
||||||
@ -668,6 +684,28 @@ void AddJobDialog::editorActionTriggered(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AddJobDialog::copyActionTriggered(void)
|
||||||
|
{
|
||||||
|
if(QAction *action = dynamic_cast<QAction*>(QObject::sender()))
|
||||||
|
{
|
||||||
|
QClipboard *clipboard = QApplication::clipboard();
|
||||||
|
QLineEdit *lineEdit = reinterpret_cast<QLineEdit*>(action->data().value<void*>());
|
||||||
|
QString text = lineEdit->hasSelectedText() ? lineEdit->selectedText() : lineEdit->text();
|
||||||
|
clipboard->setText(text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AddJobDialog::pasteActionTriggered(void)
|
||||||
|
{
|
||||||
|
if(QAction *action = dynamic_cast<QAction*>(QObject::sender()))
|
||||||
|
{
|
||||||
|
QClipboard *clipboard = QApplication::clipboard();
|
||||||
|
QLineEdit *lineEdit = reinterpret_cast<QLineEdit*>(action->data().value<void*>());
|
||||||
|
QString text = clipboard->text();
|
||||||
|
if(!text.isEmpty()) lineEdit->setText(text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Public functions
|
// Public functions
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -68,6 +68,8 @@ private slots:
|
|||||||
void saveTemplateButtonClicked(void);
|
void saveTemplateButtonClicked(void);
|
||||||
void deleteTemplateButtonClicked(void);
|
void deleteTemplateButtonClicked(void);
|
||||||
void editorActionTriggered(void);
|
void editorActionTriggered(void);
|
||||||
|
void copyActionTriggered(void);
|
||||||
|
void pasteActionTriggered(void);
|
||||||
|
|
||||||
virtual void accept(void);
|
virtual void accept(void);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user