OSDN Git Service

a6ab1f53c5a8f2135ea7a70524f13202e7d5348d
[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         bool m_abortOnTimeout;
58         bool m_initialized;
59
60         QLabel *m_label;
61         IPCThread *m_ipcThread;
62
63         JobListModel *m_jobList;
64         OptionsModel *m_options;
65         QStringList *m_droppedFiles;
66         QList<QFile*> m_toolsList;
67         
68         PreferencesModel *m_preferences;
69         RecentlyUsed *m_recentlyUsed;
70
71         QString m_vapoursynthPath;
72
73         const x264_cpu_t *const m_cpuFeatures;
74         const QString m_appDir;
75         
76         bool createJob(QString &sourceFileName, QString &outputFileName, OptionsModel *options, bool &runImmediately, const bool restart = false, int fileNo = -1, int fileTotal = 0, bool *applyToAll = NULL);
77         bool createJobMultiple(const QStringList &filePathIn);
78
79         bool appendJob(const QString &sourceFileName, const QString &outputFileName, OptionsModel *options, const bool runImmediately);
80         void updateButtons(JobStatus status);
81         void updateTaskbar(JobStatus status, const QIcon &icon);
82         unsigned int countPendingJobs(void);
83         unsigned int countRunningJobs(void);
84
85 private slots:
86         void addButtonPressed();
87         void openActionTriggered();
88         void abortButtonPressed(void);
89         void browseButtonPressed(void);
90         void deleteButtonPressed(void);
91         void copyLogToClipboard(bool checked);
92         void handleDroppedFiles(void);
93         void init(void);
94         void instanceCreated(unsigned int pid);
95         void jobSelected(const QModelIndex & current, const QModelIndex & previous);
96         void jobChangedData(const  QModelIndex &top, const  QModelIndex &bottom);
97         void jobLogExtended(const QModelIndex & parent, int start, int end);
98         void launchNextJob();
99         void pauseButtonPressed(bool checked);
100         void restartButtonPressed(void);
101         void saveLogFile(const QModelIndex &index);
102         void showAbout(void);
103         void showPreferences(void);
104         void showWebLink(void);
105         void shutdownComputer(void);
106         void startButtonPressed(void);
107         void updateLabelPos(void);
108 };