OSDN Git Service

Initial multi-encoder support. This will allow adding support for x265 in a future...
[x264-launcher/x264-launcher.git] / src / win_addJob.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Simple x264 Launcher
3 // Copyright (C) 2004-2014 LoRd_MuldeR <MuldeR2@GMX.de>
4 //
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.
9 //
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.
14 //
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.
18 //
19 // http://www.gnu.org/licenses/gpl-2.0.txt
20 ///////////////////////////////////////////////////////////////////////////////
21
22 #pragma once
23
24 #include <QDialog>
25
26 class OptionsModel;
27 class RecentlyUsed;
28 class QComboBox;
29
30 namespace Ui
31 {
32         class AddJobDialog;
33 }
34
35 class AddJobDialog : public QDialog
36 {
37         Q_OBJECT
38
39 public:
40         AddJobDialog(QWidget *parent, OptionsModel *options, RecentlyUsed *recentlyUsed, bool x64supported, bool use10BitEncoding, bool saveToSourceFolder);
41         ~AddJobDialog(void);
42
43         QString sourceFile(void);
44         QString outputFile(void);
45
46         bool runImmediately(void);
47         bool applyToAll(void);
48         void setRunImmediately(bool run);
49         void setSourceFile(const QString &path);
50         void setOutputFile(const QString &path);
51         void setSourceEditable(const bool editable);
52         void setApplyToAllVisible(const bool visible);
53         
54         static QString generateOutputFileName(const QString &sourceFilePath, const QString &destinationDirectory, const int filterIndex, const bool saveToSourceDir);
55         static int getFilterIdx(const QString &fileExt);
56         static QString getFilterExt(const int filterIndex);
57         static QString AddJobDialog::getFilterStr(const int filterIndex);
58         static QString getFilterLst(void);
59         static QString getInputFilterLst(void);
60
61 protected:
62         OptionsModel *m_options;
63         OptionsModel *m_defaults;
64         RecentlyUsed *m_recentlyUsed;
65
66         const bool m_x64supported;
67         const bool m_use10BitEncoding;
68         const bool m_saveToSourceFolder;
69
70         virtual void showEvent(QShowEvent *event);
71         virtual bool eventFilter(QObject *o, QEvent *e);
72         virtual void dragEnterEvent(QDragEnterEvent *event);
73         virtual void dropEvent(QDropEvent *event);
74
75 private slots:
76         void encoderIndexChanged(int index);
77         void modeIndexChanged(int index);
78         void browseButtonClicked(void);
79         void configurationChanged(void);
80         void templateSelected(void);
81         void saveTemplateButtonClicked(void);
82         void deleteTemplateButtonClicked(void);
83         void editorActionTriggered(void);
84         void copyActionTriggered(void);
85         void pasteActionTriggered(void);
86         
87         virtual void accept(void);
88
89 private:
90         Ui::AddJobDialog *const ui;
91
92         void loadTemplateList(void);
93         void restoreOptions(OptionsModel *options);
94         void saveOptions(OptionsModel *options);
95         void updateComboBox(QComboBox *cbox, const QString &text);
96
97         QString currentSourcePath(const bool bWithName = false);
98         QString currentOutputPath(const bool bWithName = false);
99         int currentOutputIndx(void);
100 };