OSDN Git Service

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