1 ///////////////////////////////////////////////////////////////////////////////
2 // Simple x264 Launcher
3 // Copyright (C) 2004-2013 LoRd_MuldeR <MuldeR2@GMX.de>
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License along
16 // with this program; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 // http://www.gnu.org/licenses/gpl-2.0.txt
20 ///////////////////////////////////////////////////////////////////////////////
24 #include "uic_win_addJob.h"
31 class AddJobDialog : public QDialog, private Ui::AddJobDialog
36 AddJobDialog(QWidget *parent, OptionsModel *options, RecentlyUsed *recentlyUsed, bool x64supported, bool use10BitEncoding, bool saveToSourceFolder);
39 QString sourceFile(void);
40 QString outputFile(void);
41 QString preset(void) { return cbxPreset->itemText(cbxPreset->currentIndex()); }
42 QString tuning(void) { return cbxTuning->itemText(cbxTuning->currentIndex()); }
43 QString profile(void) { return cbxProfile->itemText(cbxProfile->currentIndex()); }
44 QString params(void) { return editCustomX264Params->text().simplified(); }
45 bool runImmediately(void) { return checkBoxRun->isChecked(); }
46 bool applyToAll(void) { return checkBoxApplyToAll->isChecked(); }
47 void setRunImmediately(bool run) { checkBoxRun->setChecked(run); }
48 void setSourceFile(const QString &path) { editSource->setText(QDir::toNativeSeparators(path)); }
49 void setOutputFile(const QString &path) { editOutput->setText(QDir::toNativeSeparators(path)); }
50 void setSourceEditable(const bool editable) { buttonBrowseSource->setEnabled(editable); }
51 void setApplyToAllVisible(const bool visible) { checkBoxApplyToAll->setVisible(visible); }
53 static QString generateOutputFileName(const QString &sourceFilePath, const QString &destinationDirectory, const int filterIndex, const bool saveToSourceDir);
54 static int getFilterIdx(const QString &fileExt);
55 static QString getFilterExt(const int filterIndex);
56 static QString AddJobDialog::getFilterStr(const int filterIndex);
57 static QString getFilterLst(void);
58 static QString getInputFilterLst(void);
61 OptionsModel *m_options;
62 OptionsModel *m_defaults;
63 RecentlyUsed *m_recentlyUsed;
65 const bool m_x64supported;
66 const bool m_use10BitEncoding;
67 const bool m_saveToSourceFolder;
69 virtual void showEvent(QShowEvent *event);
70 virtual bool eventFilter(QObject *o, QEvent *e);
71 virtual void dragEnterEvent(QDragEnterEvent *event);
72 virtual void dropEvent(QDropEvent *event);
75 void modeIndexChanged(int index);
76 void browseButtonClicked(void);
77 void configurationChanged(void);
78 void templateSelected(void);
79 void saveTemplateButtonClicked(void);
80 void deleteTemplateButtonClicked(void);
81 void editorActionTriggered(void);
82 void copyActionTriggered(void);
83 void pasteActionTriggered(void);
85 virtual void accept(void);
88 void loadTemplateList(void);
89 void restoreOptions(OptionsModel *options);
90 void saveOptions(OptionsModel *options);
91 void updateComboBox(QComboBox *cbox, const QString &text);
93 QString currentSourcePath(const bool bWithName = false);
94 QString currentOutputPath(const bool bWithName = false);
95 int currentOutputIndx(void);