OSDN Git Service

Added "Editor" dialog for custom parameters.
authorlordmulder <mulder2@gmx.de>
Thu, 16 Feb 2012 01:08:46 +0000 (02:08 +0100)
committerlordmulder <mulder2@gmx.de>
Thu, 16 Feb 2012 01:08:46 +0000 (02:08 +0100)
gui/win_addJob.ui
gui/win_editor.ui [new file with mode: 0644]
res/buttons/page_edit.png [new file with mode: 0644]
res/resources.qrc
src/version.h
src/win_addJob.cpp
src/win_addJob.h
src/win_editor.cpp [new file with mode: 0644]
src/win_editor.h [new file with mode: 0644]
x264_launcher.vcxproj
x264_launcher.vcxproj.filters

index 8189820..bfe29f7 100644 (file)
                <family>Lucida Console</family>
               </font>
              </property>
+             <property name="contextMenuPolicy">
+              <enum>Qt::ActionsContextMenu</enum>
+             </property>
              <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>
              </property>
                <family>Lucida Console</family>
               </font>
              </property>
+             <property name="contextMenuPolicy">
+              <enum>Qt::ActionsContextMenu</enum>
+             </property>
              <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>
              </property>
diff --git a/gui/win_editor.ui b/gui/win_editor.ui
new file mode 100644 (file)
index 0000000..533f6a7
--- /dev/null
@@ -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>
diff --git a/res/buttons/page_edit.png b/res/buttons/page_edit.png
new file mode 100644 (file)
index 0000000..046811e
Binary files /dev/null and b/res/buttons/page_edit.png differ
index 0d710e4..20d1920 100644 (file)
@@ -21,6 +21,7 @@
     <file>buttons/hourglass.png</file>
     <file>buttons/information.png</file>
     <file>buttons/lightning.png</file>
+    <file>buttons/page_edit.png</file>
     <file>buttons/page_paste.png</file>
     <file>buttons/pause.png</file>
     <file>buttons/play.png</file>
index b18fcd1..51d670b 100644 (file)
@@ -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
index 6b26743..2ebb55c 100644 (file)
@@ -24,6 +24,7 @@
 #include "global.h"
 #include "model_options.h"
 #include "win_help.h"
+#include "win_editor.h"
 
 #include <QDate>
 #include <QTimer>
@@ -36,6 +37,7 @@
 #include <QInputDialog>
 #include <QSettings>
 #include <QUrl>
+#include <QAction>
 
 #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<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
        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<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
 ///////////////////////////////////////////////////////////////////////////////
index 99dd1e2..fd43e37 100644 (file)
@@ -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 (file)
index 0000000..1f305aa
--- /dev/null
@@ -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*/
+
diff --git a/src/win_editor.h b/src/win_editor.h
new file mode 100644 (file)
index 0000000..bd678f2
--- /dev/null
@@ -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());
+       }
+};
+
index be31702..299f221 100644 (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)'=='Release|Win32'">$(SolutionDir)tmp\uic\uic_%(Filename).h;%(Outputs)</Outputs>
     </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" />
     <CustomBuild Include="res\resources.qrc">
       <FileType>Document</FileType>
@@ -178,6 +187,14 @@ copy "$(SolutionDir)res\toolset\*.exe" "$(SolutionDir)bin\$(Configuration)\tools
     <None Include="res\icons\movie.ico" />
   </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">
       <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>
@@ -250,6 +267,7 @@ copy "$(SolutionDir)res\toolset\*.exe" "$(SolutionDir)bin\$(Configuration)\tools
     <ClCompile Include="src\global.cpp" />
     <ClCompile Include="src\main.cpp" />
     <ClCompile Include="src\win_addJob.cpp" />
+    <ClCompile Include="src\win_editor.cpp" />
     <ClCompile Include="src\win_help.cpp" />
     <ClCompile Include="src\win_main.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_thread_encode.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_main.cpp" />
     <ClCompile Include="tmp\moc\moc_win_preferences.cpp" />
index a0724a8..74ebb9e 100644 (file)
     <ClCompile Include="src\taskbar7.cpp">
       <Filter>Source Files</Filter>
     </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>
     <CustomBuild Include="src\win_main.h">
     <CustomBuild Include="gui\win_main.ui">
       <Filter>Dialogs</Filter>
     </CustomBuild>
+    <CustomBuild Include="gui\win_editor.ui">
+      <Filter>Dialogs</Filter>
+    </CustomBuild>
+    <CustomBuild Include="src\win_editor.h">
+      <Filter>Header Files</Filter>
+    </CustomBuild>
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="x264_launcher.rc">