From 83e51e6a17ec61d69bdbc12ce603310ee90649a0 Mon Sep 17 00:00:00 2001 From: lordmulder Date: Thu, 16 Feb 2012 02:08:46 +0100 Subject: [PATCH] Added "Editor" dialog for custom parameters. --- gui/win_addJob.ui | 6 ++ gui/win_editor.ui | 117 ++++++++++++++++++++++++++++++++++ res/buttons/page_edit.png | Bin 0 -> 807 bytes res/resources.qrc | 1 + src/version.h | 2 +- src/win_addJob.cpp | 33 +++++++++- src/win_addJob.h | 1 + src/win_editor.cpp | 60 +++++++++++++++++ src/win_editor.h | 44 +++++++++++++ x264_launcher.vcxproj | 19 ++++++ x264_launcher.vcxproj.filters | 12 ++++ 11 files changed, 293 insertions(+), 2 deletions(-) create mode 100644 gui/win_editor.ui create mode 100644 res/buttons/page_edit.png create mode 100644 src/win_editor.cpp create mode 100644 src/win_editor.h diff --git a/gui/win_addJob.ui b/gui/win_addJob.ui index 8189820..bfe29f7 100644 --- a/gui/win_addJob.ui +++ b/gui/win_addJob.ui @@ -953,6 +953,9 @@ Lucida Console + + Qt::ActionsContextMenu + <nobr>All command&minus;line parameters you enter here will be passed to x264 unmodified and unchecked. Some parameters are forbidden, as they are reserved for the GUI.<br>The following macros can be used:<tt> $(INPUT)</tt> expands to the current source file path and<tt> $(OUTPUT)</tt> expands to the current output file path.</nobr> @@ -1164,6 +1167,9 @@ Lucida Console + + Qt::ActionsContextMenu + All command-line parameters you enter here will be passed to Avs2YUV unmodified and unchecked. Only relevant for Avisynth input! diff --git a/gui/win_editor.ui b/gui/win_editor.ui new file mode 100644 index 0000000..533f6a7 --- /dev/null +++ b/gui/win_editor.ui @@ -0,0 +1,117 @@ + + + EditorDialog + + + + 0 + 0 + 690 + 147 + + + + Editor + + + true + + + + + + + Lucida Console + + + + Qt::ScrollBarAlwaysOff + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 96 + 0 + + + + OK + + + + + + + + 96 + 0 + + + + Cancel + + + + + + + + + plainTextEdit + acceptButton + cancelButton + + + + + acceptButton + clicked() + EditorDialog + accept() + + + 455 + 304 + + + 307 + 162 + + + + + cancelButton + clicked() + EditorDialog + reject() + + + 557 + 304 + + + 307 + 162 + + + + + diff --git a/res/buttons/page_edit.png b/res/buttons/page_edit.png new file mode 100644 index 0000000000000000000000000000000000000000..046811ed7a6ef16be1a54bb860e1f22c6dacdacf GIT binary patch literal 807 zcmV+?1K9kDP)iHtsh1EzPArg^Q zIZrOk#rNsfjaSbMAL;<4h;Z=jvu8dzyz8N&Nb7=z03ZUw?9z%8KQEa6yM5=kUnka& z3?FJk2}L7q>na=T#;<7U*P91xfF`;`6%pVgWgRy0?1ZryL@%z52=-!fGXWGEn4M351L4<+7eDgwo|moqXT+s1&Kmn>-uQQ8mL7XY)w5Zk*(g+<3Y3tmkR!bL zOUKaUtj_pX26sH+=Iorwu}MGd`_%O-_sS}8VpG#fJA)Fcs#ezwtZf?q?Ac70mDv`rVs{$od?VPKeqf<-kUjNtS6ecB*mq<&M97K^6IVsDO zt2$Ru!b+>2S<}_H>$RcInusU_8PMNdf(W{sNlJ3FkrwMJPeBPO#d}Y^a{9TH(#{Y) l0D?dWAV4eUJX#h`!2gmISk&ZKd4B)^002ovPDHLkV1g&sd|Lnj literal 0 HcmV?d00001 diff --git a/res/resources.qrc b/res/resources.qrc index 0d710e4..20d1920 100644 --- a/res/resources.qrc +++ b/res/resources.qrc @@ -21,6 +21,7 @@ buttons/hourglass.png buttons/information.png buttons/lightning.png + buttons/page_edit.png buttons/page_paste.png buttons/pause.png buttons/play.png diff --git a/src/version.h b/src/version.h index b18fcd1..51d670b 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 202 +#define VER_X264_BUILD 209 #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 6b26743..2ebb55c 100644 --- a/src/win_addJob.cpp +++ b/src/win_addJob.cpp @@ -24,6 +24,7 @@ #include "global.h" #include "model_options.h" #include "win_help.h" +#include "win_editor.h" #include #include @@ -36,6 +37,7 @@ #include #include #include +#include #define VALID_DIR(PATH) ((!(PATH).isEmpty()) && QFileInfo(PATH).exists() && QFileInfo(PATH).isDir()) @@ -150,7 +152,7 @@ public: virtual State validate(QString &input, int &pos) const { - static const char* p[] = {"o", "frames", "seek", "raw", "hfyu", NULL}; + static const char* p[] = {"o", "frames", "seek", "raw", "hfyu", "slave", NULL}; bool invalid = false; @@ -219,6 +221,16 @@ AddJobDialog::AddJobDialog(QWidget *parent, OptionsModel *options, bool x64suppo connect(editCustomX264Params, SIGNAL(textChanged(QString)), this, SLOT(configurationChanged())); 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())); + //Setup template selector loadTemplateList(); connect(cbxTemplate, SIGNAL(currentIndexChanged(int)), this, SLOT(templateSelected())); @@ -637,6 +649,25 @@ void AddJobDialog::deleteTemplateButtonClicked(void) X264_DELETE(item); } +void AddJobDialog::editorActionTriggered(void) +{ + + if(QAction *action = dynamic_cast(QObject::sender())) + { + QLineEdit *lineEdit = reinterpret_cast(action->data().value()); + + EditorDialog *editor = new EditorDialog(this); + editor->setEditText(lineEdit->text()); + + if(editor->exec() == QDialog::Accepted) + { + lineEdit->setText(editor->getEditText()); + } + + X264_DELETE(editor); + } +} + /////////////////////////////////////////////////////////////////////////////// // Public functions /////////////////////////////////////////////////////////////////////////////// diff --git a/src/win_addJob.h b/src/win_addJob.h index 99dd1e2..fd43e37 100644 --- a/src/win_addJob.h +++ b/src/win_addJob.h @@ -67,6 +67,7 @@ private slots: void templateSelected(void); void saveTemplateButtonClicked(void); void deleteTemplateButtonClicked(void); + void editorActionTriggered(void); virtual void accept(void); diff --git a/src/win_editor.cpp b/src/win_editor.cpp new file mode 100644 index 0000000..1f305aa --- /dev/null +++ b/src/win_editor.cpp @@ -0,0 +1,60 @@ +/////////////////////////////////////////////////////////////////////////////// +// Simple x264 Launcher +// Copyright (C) 2004-2012 LoRd_MuldeR +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +// http://www.gnu.org/licenses/gpl-2.0.txt +/////////////////////////////////////////////////////////////////////////////// + +#include "win_editor.h" +#include "global.h" + +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////////// +// Constructor & Destructor +/////////////////////////////////////////////////////////////////////////////// + +EditorDialog::EditorDialog(QWidget *parent) +: + QDialog(parent) +{ + //Init the dialog, from the .ui file + setupUi(this); + setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint)); + + //Fix size + setMinimumSize(size()); +} + +EditorDialog::~EditorDialog(void) +{ +} + +/////////////////////////////////////////////////////////////////////////////// +// Events +/////////////////////////////////////////////////////////////////////////////// + +/*None*/ + +/////////////////////////////////////////////////////////////////////////////// +// Slots +/////////////////////////////////////////////////////////////////////////////// + +/*None*/ + diff --git a/src/win_editor.h b/src/win_editor.h new file mode 100644 index 0000000..bd678f2 --- /dev/null +++ b/src/win_editor.h @@ -0,0 +1,44 @@ +/////////////////////////////////////////////////////////////////////////////// +// Simple x264 Launcher +// Copyright (C) 2004-2012 LoRd_MuldeR +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +// http://www.gnu.org/licenses/gpl-2.0.txt +/////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "uic_win_editor.h" + +class QProcess; + +class EditorDialog : public QDialog, private Ui::EditorDialog +{ + Q_OBJECT + +public: + EditorDialog(QWidget *parent); + ~EditorDialog(void); + + QString getEditText(void) { return plainTextEdit->toPlainText().simplified(); } + + void setEditText(const QString &text) + { + plainTextEdit->clear(); + plainTextEdit->appendPlainText(text.simplified()); + } +}; + diff --git a/x264_launcher.vcxproj b/x264_launcher.vcxproj index be31702..299f221 100644 --- a/x264_launcher.vcxproj +++ b/x264_launcher.vcxproj @@ -164,6 +164,15 @@ copy "$(SolutionDir)res\toolset\*.exe" "$(SolutionDir)bin\$(Configuration)\tools $(SolutionDir)tmp\uic\uic_%(Filename).h;%(Outputs) $(SolutionDir)tmp\uic\uic_%(Filename).h;%(Outputs) + + Document + "$(QTDIR)\bin\uic.exe" -o "$(SolutionDir)tmp\uic\uic_%(Filename).h" "%(FullPath)" + "$(QTDIR)\bin\uic.exe" -o "$(SolutionDir)tmp\uic\uic_%(Filename).h" "%(FullPath)" + UIC "$(SolutionDir)tmp\uic\uic_%(Filename).h" + UIC "$(SolutionDir)tmp\uic\uic_%(Filename).h" + $(SolutionDir)tmp\uic\uic_%(Filename).h;%(Outputs) + $(SolutionDir)tmp\uic\uic_%(Filename).h;%(Outputs) + Document @@ -178,6 +187,14 @@ copy "$(SolutionDir)res\toolset\*.exe" "$(SolutionDir)bin\$(Configuration)\tools + + "$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\moc\moc_%(Filename).cpp" "%(FullPath)" + "$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\moc\moc_%(Filename).cpp" "%(FullPath)" + MOC "$(SolutionDir)tmp\moc\moc_%(Filename).cpp" + MOC "$(SolutionDir)tmp\moc\moc_%(Filename).cpp" + $(SolutionDir)tmp\moc\moc_%(Filename).cpp;%(Outputs) + $(SolutionDir)tmp\moc\moc_%(Filename).cpp;%(Outputs) + "$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\moc\moc_%(Filename).cpp" "%(FullPath)" "$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\moc\moc_%(Filename).cpp" "%(FullPath)" @@ -250,6 +267,7 @@ copy "$(SolutionDir)res\toolset\*.exe" "$(SolutionDir)bin\$(Configuration)\tools + @@ -257,6 +275,7 @@ copy "$(SolutionDir)res\toolset\*.exe" "$(SolutionDir)bin\$(Configuration)\tools + diff --git a/x264_launcher.vcxproj.filters b/x264_launcher.vcxproj.filters index a0724a8..74ebb9e 100644 --- a/x264_launcher.vcxproj.filters +++ b/x264_launcher.vcxproj.filters @@ -107,6 +107,12 @@ Source Files + + Source Files + + + Generated Files + @@ -145,6 +151,12 @@ Dialogs + + Dialogs + + + Header Files +