OSDN Git Service

f8435aef52be9d9b3e49acb07beb87674efcf78c
[x264-launcher/x264-launcher.git] / src / win_main.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Simple x264 Launcher
3 // Copyright (C) 2004-2012 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 #include "thread_ipc.h"
26 #include "thread_encode.h"
27 #include "win_preferences.h"
28 #include "global.h"
29
30 class JobListModel;
31 class OptionsModel;
32 class QFile;
33 class QLibrary;
34
35 class MainWindow: public QMainWindow, private Ui::MainWindow
36 {
37         Q_OBJECT
38
39 public:
40         MainWindow(const x264_cpu_t *const cpuFeatures);
41         ~MainWindow(void);
42
43 protected:
44         virtual void closeEvent(QCloseEvent *e);
45         virtual void showEvent(QShowEvent *e);
46         virtual void resizeEvent(QResizeEvent *e);
47         virtual bool eventFilter(QObject *o, QEvent *e);
48         virtual void dragEnterEvent(QDragEnterEvent *event);
49         virtual void dropEvent(QDropEvent *event);
50         virtual bool winEvent(MSG *message, long *result);
51
52 private:
53         bool m_firstShow;
54         QLabel *m_label;
55         IPCThread *m_ipcThread;
56         QLibrary *m_avsLib;
57
58         JobListModel *m_jobList;
59         OptionsModel *m_options;
60         QStringList *m_droppedFiles;
61         QList<QFile*> m_toolsList;
62         
63         PreferencesDialog::Preferences m_preferences;
64
65         const x264_cpu_t *const m_cpuFeatures;
66         const QString m_appDir;
67         
68         void updateButtons(EncodeThread::JobStatus status);
69         void updateTaskbar(EncodeThread::JobStatus status, const QIcon &icon);
70         unsigned int countPendingJobs(void);
71         unsigned int countRunningJobs(void);
72         double detectAvisynthVersion(QLibrary *avsLib);
73
74 private slots:
75         void addButtonPressed(const QString &filePathIn = QString(), const QString &filePathOut = QString(), OptionsModel *options = NULL, int fileNo = -1, int fileTotal = 0, bool *ok = NULL);
76         void abortButtonPressed(void);
77         void browseButtonPressed(void);
78         void deleteButtonPressed(void);
79         void copyLogToClipboard(bool checked);
80         void handleDroppedFiles(void);
81         void init(void);
82         void instanceCreated(DWORD pid);
83         void jobSelected(const QModelIndex & current, const QModelIndex & previous);
84         void jobChangedData(const  QModelIndex &top, const  QModelIndex &bottom);
85         void jobLogExtended(const QModelIndex & parent, int start, int end);
86         void launchNextJob();
87         void pauseButtonPressed(bool checked);
88         void restartButtonPressed(void);
89         void showAbout(void);
90         void showPreferences(void);
91         void showWebLink(void);
92         void shutdownComputer(void);
93         void startButtonPressed(void);
94         void updateLabelPos(void);
95 };