OSDN Git Service

Added a new "--add-job <src_file> <out_file> <template>" command-line option. Also...
[x264-launcher/x264-launcher.git] / src / win_main.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Simple x264 Launcher
3 // Copyright (C) 2004-2013 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 "global.h"
25 #include <QMainWindow>
26
27 class JobListModel;
28 class OptionsModel;
29 class QFile;
30 class QLibrary;
31 class PreferencesModel;
32 class RecentlyUsed;
33 class IPCThread;
34 class QModelIndex;
35 class QLabel;
36 enum JobStatus;
37
38 namespace Ui
39 {
40         class MainWindow;
41 }
42
43 class MainWindow: public QMainWindow
44 {
45         Q_OBJECT
46
47 public:
48         MainWindow(const x264_cpu_t *const cpuFeatures);
49         ~MainWindow(void);
50
51 protected:
52         virtual void closeEvent(QCloseEvent *e);
53         virtual void showEvent(QShowEvent *e);
54         virtual void resizeEvent(QResizeEvent *e);
55         virtual bool eventFilter(QObject *o, QEvent *e);
56         virtual void dragEnterEvent(QDragEnterEvent *event);
57         virtual void dropEvent(QDropEvent *event);
58         virtual bool winEvent(MSG *message, long *result);
59
60 private:
61         Ui::MainWindow *const ui;
62
63         bool m_firstShow;
64         bool m_skipVersionTest;
65         bool m_abortOnTimeout;
66         bool m_initialized;
67
68         QLabel *m_label;
69         IPCThread *m_ipcThread;
70
71         JobListModel *m_jobList;
72         OptionsModel *m_options;
73         QStringList *m_droppedFiles;
74         QList<QFile*> m_toolsList;
75         
76         PreferencesModel *m_preferences;
77         RecentlyUsed *m_recentlyUsed;
78
79         QString m_vapoursynthPath;
80
81         const x264_cpu_t *const m_cpuFeatures;
82         const QString m_appDir;
83         
84         bool createJob(QString &sourceFileName, QString &outputFileName, OptionsModel *options, bool &runImmediately, const bool restart = false, int fileNo = -1, int fileTotal = 0, bool *applyToAll = NULL);
85         bool createJobMultiple(const QStringList &filePathIn);
86
87         bool appendJob(const QString &sourceFileName, const QString &outputFileName, OptionsModel *options, const bool runImmediately);
88         void updateButtons(JobStatus status);
89         void updateTaskbar(JobStatus status, const QIcon &icon);
90         unsigned int countPendingJobs(void);
91         unsigned int countRunningJobs(void);
92
93         void parseCommandLineArgs(void);
94
95 private slots:
96         void addButtonPressed();
97         void openActionTriggered();
98         void abortButtonPressed(void);
99         void browseButtonPressed(void);
100         void deleteButtonPressed(void);
101         void copyLogToClipboard(bool checked);
102         void checkUpdates(void);
103         void handleDroppedFiles(void);
104         void init(void);
105         void instanceCreated(unsigned int pid);
106         void jobSelected(const QModelIndex &current, const QModelIndex &previous);
107         void jobChangedData(const  QModelIndex &top, const  QModelIndex &bottom);
108         void jobLogExtended(const QModelIndex & parent, int start, int end);
109         void launchNextJob();
110         void pauseButtonPressed(bool checked);
111         void restartButtonPressed(void);
112         void saveLogFile(const QModelIndex &index);
113         void showAbout(void);
114         void showPreferences(void);
115         void showWebLink(void);
116         void shutdownComputer(void);
117         void startButtonPressed(void);
118         void updateLabelPos(void);
119 };