Added "Editor" dialog for custom parameters.

This commit is contained in:
LoRd_MuldeR 2012-02-16 02:08:46 +01:00
parent c66376096d
commit 83e51e6a17
11 changed files with 293 additions and 2 deletions

View File

@ -953,6 +953,9 @@
<family>Lucida Console</family> <family>Lucida Console</family>
</font> </font>
</property> </property>
<property name="contextMenuPolicy">
<enum>Qt::ActionsContextMenu</enum>
</property>
<property name="toolTip"> <property name="toolTip">
<string>&lt;nobr&gt;All command&amp;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.&lt;br&gt;The following macros can be used:&lt;tt&gt; $(INPUT)&lt;/tt&gt; expands to the current source file path and&lt;tt&gt; $(OUTPUT)&lt;/tt&gt; expands to the current output file path.&lt;/nobr&gt;</string> <string>&lt;nobr&gt;All command&amp;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.&lt;br&gt;The following macros can be used:&lt;tt&gt; $(INPUT)&lt;/tt&gt; expands to the current source file path and&lt;tt&gt; $(OUTPUT)&lt;/tt&gt; expands to the current output file path.&lt;/nobr&gt;</string>
</property> </property>
@ -1164,6 +1167,9 @@
<family>Lucida Console</family> <family>Lucida Console</family>
</font> </font>
</property> </property>
<property name="contextMenuPolicy">
<enum>Qt::ActionsContextMenu</enum>
</property>
<property name="toolTip"> <property name="toolTip">
<string>All command-line parameters you enter here will be passed to Avs2YUV unmodified and unchecked. Only relevant for Avisynth input!</string> <string>All command-line parameters you enter here will be passed to Avs2YUV unmodified and unchecked. Only relevant for Avisynth input!</string>
</property> </property>

117
gui/win_editor.ui Normal file
View File

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>EditorDialog</class>
<widget class="QDialog" name="EditorDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>690</width>
<height>147</height>
</rect>
</property>
<property name="windowTitle">
<string>Editor</string>
</property>
<property name="modal">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QPlainTextEdit" name="plainTextEdit">
<property name="font">
<font>
<family>Lucida Console</family>
</font>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="acceptButton">
<property name="minimumSize">
<size>
<width>96</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>OK</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cancelButton">
<property name="minimumSize">
<size>
<width>96</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<tabstops>
<tabstop>plainTextEdit</tabstop>
<tabstop>acceptButton</tabstop>
<tabstop>cancelButton</tabstop>
</tabstops>
<resources/>
<connections>
<connection>
<sender>acceptButton</sender>
<signal>clicked()</signal>
<receiver>EditorDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>455</x>
<y>304</y>
</hint>
<hint type="destinationlabel">
<x>307</x>
<y>162</y>
</hint>
</hints>
</connection>
<connection>
<sender>cancelButton</sender>
<signal>clicked()</signal>
<receiver>EditorDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>557</x>
<y>304</y>
</hint>
<hint type="destinationlabel">
<x>307</x>
<y>162</y>
</hint>
</hints>
</connection>
</connections>
</ui>

BIN
res/buttons/page_edit.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 807 B

View File

@ -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_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>
<file>buttons/play.png</file> <file>buttons/play.png</file>

View 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 202 #define VER_X264_BUILD 209
#define VER_X264_MINIMUM_REV 2146 #define VER_X264_MINIMUM_REV 2146
#define VER_X264_CURRENT_API 120 #define VER_X264_CURRENT_API 120

View File

@ -24,6 +24,7 @@
#include "global.h" #include "global.h"
#include "model_options.h" #include "model_options.h"
#include "win_help.h" #include "win_help.h"
#include "win_editor.h"
#include <QDate> #include <QDate>
#include <QTimer> #include <QTimer>
@ -36,6 +37,7 @@
#include <QInputDialog> #include <QInputDialog>
#include <QSettings> #include <QSettings>
#include <QUrl> #include <QUrl>
#include <QAction>
#define VALID_DIR(PATH) ((!(PATH).isEmpty()) && QFileInfo(PATH).exists() && QFileInfo(PATH).isDir()) #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 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; bool invalid = false;
@ -219,6 +221,16 @@ AddJobDialog::AddJobDialog(QWidget *parent, OptionsModel *options, bool x64suppo
connect(editCustomX264Params, SIGNAL(textChanged(QString)), this, SLOT(configurationChanged())); connect(editCustomX264Params, SIGNAL(textChanged(QString)), this, SLOT(configurationChanged()));
connect(editCustomAvs2YUVParams, 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<void*>(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<void*>(editCustomAvs2YUVParams));
editCustomAvs2YUVParams->addAction(editorActionAvs2YUV);
connect(editorActionAvs2YUV, SIGNAL(triggered(bool)), this, SLOT(editorActionTriggered()));
//Setup template selector //Setup template selector
loadTemplateList(); loadTemplateList();
connect(cbxTemplate, SIGNAL(currentIndexChanged(int)), this, SLOT(templateSelected())); connect(cbxTemplate, SIGNAL(currentIndexChanged(int)), this, SLOT(templateSelected()));
@ -637,6 +649,25 @@ void AddJobDialog::deleteTemplateButtonClicked(void)
X264_DELETE(item); X264_DELETE(item);
} }
void AddJobDialog::editorActionTriggered(void)
{
if(QAction *action = dynamic_cast<QAction*>(QObject::sender()))
{
QLineEdit *lineEdit = reinterpret_cast<QLineEdit*>(action->data().value<void*>());
EditorDialog *editor = new EditorDialog(this);
editor->setEditText(lineEdit->text());
if(editor->exec() == QDialog::Accepted)
{
lineEdit->setText(editor->getEditText());
}
X264_DELETE(editor);
}
}
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Public functions // Public functions
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

View File

@ -67,6 +67,7 @@ private slots:
void templateSelected(void); void templateSelected(void);
void saveTemplateButtonClicked(void); void saveTemplateButtonClicked(void);
void deleteTemplateButtonClicked(void); void deleteTemplateButtonClicked(void);
void editorActionTriggered(void);
virtual void accept(void); virtual void accept(void);

60
src/win_editor.cpp Normal file
View File

@ -0,0 +1,60 @@
///////////////////////////////////////////////////////////////////////////////
// Simple x264 Launcher
// Copyright (C) 2004-2012 LoRd_MuldeR <MuldeR2@GMX.de>
//
// 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 <QProcess>
#include <QScrollBar>
#include <QTimer>
///////////////////////////////////////////////////////////////////////////////
// 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*/

44
src/win_editor.h Normal file
View File

@ -0,0 +1,44 @@
///////////////////////////////////////////////////////////////////////////////
// Simple x264 Launcher
// Copyright (C) 2004-2012 LoRd_MuldeR <MuldeR2@GMX.de>
//
// 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());
}
};

View File

@ -164,6 +164,15 @@ copy "$(SolutionDir)res\toolset\*.exe" "$(SolutionDir)bin\$(Configuration)\tools
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)tmp\uic\uic_%(Filename).h;%(Outputs)</Outputs> <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)tmp\uic\uic_%(Filename).h;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\uic\uic_%(Filename).h;%(Outputs)</Outputs> <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\uic\uic_%(Filename).h;%(Outputs)</Outputs>
</CustomBuild> </CustomBuild>
<CustomBuild Include="gui\win_editor.ui">
<FileType>Document</FileType>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\uic.exe" -o "$(SolutionDir)tmp\uic\uic_%(Filename).h" "%(FullPath)"</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\uic.exe" -o "$(SolutionDir)tmp\uic\uic_%(Filename).h" "%(FullPath)"</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">UIC "$(SolutionDir)tmp\uic\uic_%(Filename).h"</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">UIC "$(SolutionDir)tmp\uic\uic_%(Filename).h"</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)tmp\uic\uic_%(Filename).h;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\uic\uic_%(Filename).h;%(Outputs)</Outputs>
</CustomBuild>
<None Include="ReadMe.txt" /> <None Include="ReadMe.txt" />
<CustomBuild Include="res\resources.qrc"> <CustomBuild Include="res\resources.qrc">
<FileType>Document</FileType> <FileType>Document</FileType>
@ -178,6 +187,14 @@ copy "$(SolutionDir)res\toolset\*.exe" "$(SolutionDir)bin\$(Configuration)\tools
<None Include="res\icons\movie.ico" /> <None Include="res\icons\movie.ico" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<CustomBuild Include="src\win_editor.h">
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\moc\moc_%(Filename).cpp" "%(FullPath)"</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\moc\moc_%(Filename).cpp" "%(FullPath)"</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">MOC "$(SolutionDir)tmp\moc\moc_%(Filename).cpp"</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MOC "$(SolutionDir)tmp\moc\moc_%(Filename).cpp"</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)tmp\moc\moc_%(Filename).cpp;%(Outputs)</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\moc\moc_%(Filename).cpp;%(Outputs)</Outputs>
</CustomBuild>
<CustomBuild Include="src\win_preferences.h"> <CustomBuild Include="src\win_preferences.h">
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\moc\moc_%(Filename).cpp" "%(FullPath)"</Command> <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\moc\moc_%(Filename).cpp" "%(FullPath)"</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\moc\moc_%(Filename).cpp" "%(FullPath)"</Command> <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\moc\moc_%(Filename).cpp" "%(FullPath)"</Command>
@ -250,6 +267,7 @@ copy "$(SolutionDir)res\toolset\*.exe" "$(SolutionDir)bin\$(Configuration)\tools
<ClCompile Include="src\global.cpp" /> <ClCompile Include="src\global.cpp" />
<ClCompile Include="src\main.cpp" /> <ClCompile Include="src\main.cpp" />
<ClCompile Include="src\win_addJob.cpp" /> <ClCompile Include="src\win_addJob.cpp" />
<ClCompile Include="src\win_editor.cpp" />
<ClCompile Include="src\win_help.cpp" /> <ClCompile Include="src\win_help.cpp" />
<ClCompile Include="src\win_main.cpp" /> <ClCompile Include="src\win_main.cpp" />
<ClCompile Include="src\win_preferences.cpp" /> <ClCompile Include="src\win_preferences.cpp" />
@ -257,6 +275,7 @@ copy "$(SolutionDir)res\toolset\*.exe" "$(SolutionDir)bin\$(Configuration)\tools
<ClCompile Include="tmp\moc\moc_model_logFile.cpp" /> <ClCompile Include="tmp\moc\moc_model_logFile.cpp" />
<ClCompile Include="tmp\moc\moc_thread_encode.cpp" /> <ClCompile Include="tmp\moc\moc_thread_encode.cpp" />
<ClCompile Include="tmp\moc\moc_win_addJob.cpp" /> <ClCompile Include="tmp\moc\moc_win_addJob.cpp" />
<ClCompile Include="tmp\moc\moc_win_editor.cpp" />
<ClCompile Include="tmp\moc\moc_win_help.cpp" /> <ClCompile Include="tmp\moc\moc_win_help.cpp" />
<ClCompile Include="tmp\moc\moc_win_main.cpp" /> <ClCompile Include="tmp\moc\moc_win_main.cpp" />
<ClCompile Include="tmp\moc\moc_win_preferences.cpp" /> <ClCompile Include="tmp\moc\moc_win_preferences.cpp" />

View File

@ -107,6 +107,12 @@
<ClCompile Include="src\taskbar7.cpp"> <ClCompile Include="src\taskbar7.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="src\win_editor.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="tmp\moc\moc_win_editor.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<CustomBuild Include="src\win_main.h"> <CustomBuild Include="src\win_main.h">
@ -145,6 +151,12 @@
<CustomBuild Include="gui\win_main.ui"> <CustomBuild Include="gui\win_main.ui">
<Filter>Dialogs</Filter> <Filter>Dialogs</Filter>
</CustomBuild> </CustomBuild>
<CustomBuild Include="gui\win_editor.ui">
<Filter>Dialogs</Filter>
</CustomBuild>
<CustomBuild Include="src\win_editor.h">
<Filter>Header Files</Filter>
</CustomBuild>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include="x264_launcher.rc"> <ResourceCompile Include="x264_launcher.rc">