OSDN Git Service

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