Some initial work to use the MUtilities library.
[simple-x264-launcher.git] / src / win_main.h
blobf58b7110250609322ad546f4402b3cbb033933e6
1 ///////////////////////////////////////////////////////////////////////////////
2 // Simple x264 Launcher
3 // Copyright (C) 2004-2015 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.
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.
19 // http://www.gnu.org/licenses/gpl-2.0.txt
20 ///////////////////////////////////////////////////////////////////////////////
22 #pragma once
24 //Internal
25 #include "global.h"
27 //Qt
28 #include <QMainWindow>
30 class IPC;
31 class JobListModel;
32 class OptionsModel;
33 class SysinfoModel;
34 class QFile;
35 class QLibrary;
36 class PreferencesModel;
37 class RecentlyUsed;
38 class InputEventFilter;
39 class QModelIndex;
40 class QLabel;
41 class QSystemTrayIcon;
42 enum JobStatus;
44 namespace Ui
46 class MainWindow;
49 namespace MUtils
51 namespace CPUFetaures
53 struct _stuctName;
54 typedef struct _cpu_info_t cpu_info_t;
58 class MainWindow: public QMainWindow
60 Q_OBJECT
62 public:
63 MainWindow(const MUtils::CPUFetaures::cpu_info_t &cpuFeatures);
64 ~MainWindow(void);
66 protected:
67 virtual void closeEvent(QCloseEvent *e);
68 virtual void showEvent(QShowEvent *e);
69 virtual void resizeEvent(QResizeEvent *e);
70 virtual void dragEnterEvent(QDragEnterEvent *event);
71 virtual void dropEvent(QDropEvent *event);
72 virtual bool winEvent(MSG *message, long *result);
74 private:
75 Ui::MainWindow *const ui;
77 bool m_initialized;
78 QLabel *m_label;
79 QTimer *m_fileTimer;
81 IPC *const m_ipc;
82 QSystemTrayIcon *const m_sysTray;
84 InputEventFilter *m_inputFilter_jobList;
85 InputEventFilter *m_inputFilter_version;
86 InputEventFilter *m_inputFilter_checkUp;
88 JobListModel *m_jobList;
89 OptionsModel *m_options;
90 QStringList *m_pendingFiles;
91 QList<QFile*> m_toolsList;
93 SysinfoModel *m_sysinfo;
94 PreferencesModel *m_preferences;
95 RecentlyUsed *m_recentlyUsed;
97 bool createJob(QString &sourceFileName, QString &outputFileName, OptionsModel *options, bool &runImmediately, const bool restart = false, int fileNo = -1, int fileTotal = 0, bool *applyToAll = NULL);
98 bool createJobMultiple(const QStringList &filePathIn);
100 bool appendJob(const QString &sourceFileName, const QString &outputFileName, OptionsModel *options, const bool runImmediately);
101 void updateButtons(JobStatus status);
102 void updateTaskbar(JobStatus status, const QIcon &icon);
103 unsigned int countPendingJobs(void);
104 unsigned int countRunningJobs(void);
106 bool parseCommandLineArgs(void);
108 private slots:
109 void addButtonPressed();
110 void openActionTriggered();
111 void abortButtonPressed(void);
112 void browseButtonPressed(void);
113 void deleteButtonPressed(void);
114 void copyLogToClipboard(bool checked);
115 void checkUpdates(void);
116 void handlePendingFiles(void);
117 void init(void);
118 void handleCommand(const int &command, const QStringList &args, const quint32 &flags = 0);
119 void jobSelected(const QModelIndex &current, const QModelIndex &previous);
120 void jobChangedData(const QModelIndex &top, const QModelIndex &bottom);
121 void jobLogExtended(const QModelIndex & parent, int start, int end);
122 void jobListKeyPressed(const int &tag);
123 void launchNextJob();
124 void moveButtonPressed(void);
125 void pauseButtonPressed(bool checked);
126 void restartButtonPressed(void);
127 void saveLogFile(const QModelIndex &index);
128 void showAbout(void);
129 void showPreferences(void);
130 void showWebLink(void);
131 void shutdownComputer(void);
132 void startButtonPressed(void);
133 void sysTrayActived(void);
134 void updateLabelPos(void);
135 void versionLabelMouseClicked(const int &tag);