OSDN Git Service

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