Updated copyright year.
[simple-x264-launcher.git] / src / win_addJob.h
blob3a23adefa62e8b446127202655a5012fe1f90e57
1 ///////////////////////////////////////////////////////////////////////////////
2 // Simple x264 Launcher
3 // Copyright (C) 2004-2023 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.
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 ///////////////////////////////////////////////////////////////////////////////
22 #pragma once
24 #include <QDialog>
26 class OptionsModel;
27 class RecentlyUsed;
28 class SysinfoModel;
29 class PreferencesModel;
30 class AbstractEncoderInfo;
31 class QComboBox;
33 namespace Ui
35 class AddJobDialog;
38 class AddJobDialog : public QDialog
40 Q_OBJECT
42 public:
43 AddJobDialog(QWidget *parent, OptionsModel *const options, RecentlyUsed *const recentlyUsed, const SysinfoModel *const sysinfo, const PreferencesModel *const preferences);
44 ~AddJobDialog(void);
46 QString sourceFile(void);
47 QString outputFile(void);
49 bool runImmediately(void);
50 bool applyToAll(void);
51 void setRunImmediately(bool run);
52 void setSourceFile(const QString &path);
53 void setOutputFile(const QString &path);
54 void setSourceEditable(const bool editable);
55 void setApplyToAllVisible(const bool visible);
57 static QString generateOutputFileName(const QString &sourceFilePath, const QString &destinationDirectory, const int filterIndex, const bool saveToSourceDir);
58 static int getFilterIdx(const QString &fileExt);
59 static QString getFilterExt(const int filterIndex);
60 static QString AddJobDialog::getFilterStr(const int filterIndex);
61 static QString getFilterLst(void);
62 static QString getInputFilterLst(void);
64 protected:
65 OptionsModel *const m_options;
66 RecentlyUsed *const m_recentlyUsed;
68 const SysinfoModel *const m_sysinfo;
69 const PreferencesModel *const m_preferences;
70 const OptionsModel *m_defaults;
72 virtual void showEvent(QShowEvent *event);
73 virtual bool eventFilter(QObject *o, QEvent *e);
74 virtual void dragEnterEvent(QDragEnterEvent *event);
75 virtual void dropEvent(QDropEvent *event);
77 private slots:
78 void encoderIndexChanged(int index);
79 void variantIndexChanged(int index);
80 void modeIndexChanged(int index);
81 void browseButtonClicked(void);
82 void configurationChanged(void);
83 void templateSelected(void);
84 void saveTemplateButtonClicked(void);
85 void deleteTemplateButtonClicked(void);
86 void editorActionTriggered(void);
87 void copyActionTriggered(void);
88 void pasteActionTriggered(void);
90 virtual void accept(void);
92 private:
93 Ui::AddJobDialog *const ui;
94 bool m_monitorConfigChanges;
95 QString m_lastTemplateName;
97 void loadTemplateList(void);
98 void restoreOptions(const OptionsModel *options);
99 void saveOptions(OptionsModel *options);
100 void updateComboBox(QComboBox *const cbox, const QString &text);
101 void updateComboBox(QComboBox *const cbox, const int &data);
102 void updateComboBox(QComboBox *const cbox, const quint32 &data);
104 QString currentSourcePath(const bool bWithName = false);
105 QString currentOutputPath(const bool bWithName = false);
106 int currentOutputIndx(void);