OSDN Git Service

Updated RHash and UPX to the latest versions.
[x264-launcher/x264-launcher.git] / src / win_main.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Simple x264 Launcher
3 // Copyright (C) 2004-2016 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 //Internal
25 #include "global.h"
26
27 //Qt
28 #include <QMainWindow>
29
30 class JobListModel;
31 class OptionsModel;
32 class SysinfoModel;
33 class QFile;
34 class QLibrary;
35 class PreferencesModel;
36 class RecentlyUsed;
37 class InputEventFilter;
38 class QModelIndex;
39 class QLabel;
40 class QSystemTrayIcon;
41 class IPCThread_Recv;
42 enum JobStatus;
43
44 namespace Ui
45 {
46         class MainWindow;
47 }
48
49 namespace MUtils
50 {
51         namespace CPUFetaures
52         {
53                 struct _cpu_info_t;
54                 typedef struct _cpu_info_t cpu_info_t;
55         }
56
57         class IPCChannel;
58         class Taskbar7;
59 }
60
61 class MainWindow: public QMainWindow
62 {
63         Q_OBJECT
64
65 public:
66         MainWindow(const MUtils::CPUFetaures::cpu_info_t &cpuFeatures, MUtils::IPCChannel *const ipcChannel);
67         ~MainWindow(void);
68
69 protected:
70         virtual void closeEvent(QCloseEvent *e);
71         virtual void showEvent(QShowEvent *e);
72         virtual void resizeEvent(QResizeEvent *e);
73         virtual void dragEnterEvent(QDragEnterEvent *event);
74         virtual void dropEvent(QDropEvent *event);
75
76 private:
77         Ui::MainWindow *const ui;
78         MUtils::IPCChannel *const m_ipcChannel;
79
80         bool m_initialized;
81         QScopedPointer<QLabel> m_label[2];
82         QScopedPointer<QMovie> m_animation;
83         QScopedPointer<QTimer> m_fileTimer;
84
85         QScopedPointer<IPCThread_Recv>   m_ipcThread;
86         QScopedPointer<MUtils::Taskbar7> m_taskbar;
87         QScopedPointer<QSystemTrayIcon>  m_sysTray;
88
89         QScopedPointer<InputEventFilter> m_inputFilter_jobList;
90         QScopedPointer<InputEventFilter> m_inputFilter_version;
91         QScopedPointer<InputEventFilter> m_inputFilter_checkUp;
92
93         QScopedPointer<JobListModel> m_jobList;
94         QScopedPointer<OptionsModel> m_options;
95         QScopedPointer<QStringList> m_pendingFiles;
96         
97         QScopedPointer<SysinfoModel> m_sysinfo;
98         QScopedPointer<PreferencesModel> m_preferences;
99         QScopedPointer<RecentlyUsed> m_recentlyUsed;
100         
101         bool createJob(QString &sourceFileName, QString &outputFileName, OptionsModel *options, bool &runImmediately, const bool restart = false, int fileNo = -1, int fileTotal = 0, bool *applyToAll = NULL);
102         bool createJobMultiple(const QStringList &filePathIn);
103
104         bool appendJob(const QString &sourceFileName, const QString &outputFileName, OptionsModel *options, const bool runImmediately);
105         void updateButtons(JobStatus status);
106         void updateTaskbar(JobStatus status, const QIcon &icon);
107         unsigned int countPendingJobs(void);
108         unsigned int countRunningJobs(void);
109
110         bool parseCommandLineArgs(void);
111
112 private slots:
113         void addButtonPressed();
114         void openActionTriggered();
115         void cleanupActionTriggered(void);
116         void abortButtonPressed(void);
117         void browseButtonPressed(void);
118         void deleteButtonPressed(void);
119         void copyLogToClipboard(bool checked);
120         void saveLogToLocalFile(bool checked);
121         void toggleLineWrapping(bool checked);
122         void checkUpdates(void);
123         void handlePendingFiles(void);
124         void init(void);
125         void handleCommand(const int &command, const QStringList &args, const quint32 &flags = 0);
126         void jobSelected(const QModelIndex &current, const QModelIndex &previous);
127         void jobChangedData(const  QModelIndex &top, const  QModelIndex &bottom);
128         void jobLogExtended(const QModelIndex & parent, int start, int end);
129         void jobListKeyPressed(const int &tag);
130         void launchNextJob();
131         void moveButtonPressed(void);
132         void pauseButtonPressed(bool checked);
133         void restartButtonPressed(void);
134         void saveLogFile(const QModelIndex &index);
135         void showAbout(void);
136         void showPreferences(void);
137         void showWebLink(void);
138         void shutdownComputer(void);
139         void startButtonPressed(void);
140         void sysTrayActived(void);
141         void updateLabelPos(void);
142         void versionLabelMouseClicked(const int &tag);
143 };