-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainwindow.h
166 lines (142 loc) · 4.74 KB
/
mainwindow.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QGraphicsScene>
#include <QModelIndex>
#include <QFile>
#include <QNetworkReply>
#include <QNetworkAccessManager>
#include <QNetworkConfigurationManager>
#include <QTreeWidgetItem>
#include <QFileInfo>
#include <QSettings>
#include <QMapIterator>
#include <QTranslator>
#include "filedownloader.h"
#include "epidownloader.h"
#include "aboutdialog.h"
#include "settingsdialog.h"
#include "Parsers/epiparser.h"
#include "Parsers/categoryparser.h"
#include "Parsers/authorparser.h"
#include "newtabdialog.h"
#include "Models/episode.h"
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
protected:
// this event is called, when a new translator is loaded or the system language is changed
void changeEvent(QEvent*);
protected slots:
// this slot is called by the language menu actions
void slotLanguageChanged(QAction* action);
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
bool init();
private:
AboutDialog *m_aboutDialog;
SettingsDialog *m_settingsDialog;
NewTabDialog *m_newTabDialog;
QGraphicsScene *scene;
Ui::MainWindow *ui;
QTranslator m_translator; // contains the translations for this application
QTranslator m_translatorQt; // contains the translations for qt
QString m_currLang; // contains the currently loaded language
QString m_langPath; // Path of language files. This is always fixed to /languages.
FileDownloader *downloader;
FileDownloader *categoryDownloader;
FileDownloader *authorDownloader;
FileDownloader *screenDownloader;
EpiDownloader *epidownloader;
QTreeWidget *currentTreeWidget;
EpiParser *epis = new EpiParser();
Episode *selectedEpisode = NULL;
CategoryParser *categories = new CategoryParser();
AuthorParser *authors = new AuthorParser();
QFile *downloadFile;
QFileInfo *downloadFileInfo;
QString downloadFileName;
QNetworkReply *downloadReply;
QFile *screenDownloadFile;
/*QTreeWidgetItem *catEpisodes;
QTreeWidgetItem *catSpecials;
QTreeWidgetItem *catTrailerDemo;*/
QTreeWidgetItem *catTrash;
QMap <int, QTreeWidgetItem*> treeCategories;
QSettings *settings;
QDir *epiDir;
QDir *screenDir;
bool updatingAny = false;
bool authorsUpdate = false;
bool categoriesUpdate = false;
bool episUpdate = false;
bool downloadingAll = false;
int downloadAllIndex = 0;
//QMapIterator<int, Episode*> downloadAllIterator();
void readingReadyBytes();
void setNoimage();
void unsetAktionsliste();
void setImage();
void noEpiSelected();
void setControlsDownloading();
void setControlsDownloadFinished();
QString getFileIconName(QFileInfo fileInfo);
void cleanUpDirectory(QDir *dir);
bool isUnneededDirectory(QDir *dir);
QString getFirstDirectory(QDir *dir);
void moveUp(QDir dir, QDir *destDir);
QString searchGameExe(QDir *dir);
void initUpdate();
void updateGames(QByteArray data);
void updateCategories(QByteArray data);
void updateAuthors(QByteArray data);
void cacheFile(QString filename, QByteArray data);
QByteArray loadCacheFile(QString filename);
void downloadCategories();
void downloadAuthors();
void downloadGames();
void addGameWidgetItem(Episode* episode);
void addGameWidgetItem(Episode* episode, QTreeWidgetItem* parent);
void addGameWidgetItem(Episode* episode, QTreeWidget* widget);
void setupTreewidget(QTreeWidget* widget);
void setCurrentTreeWidget();
void downloadEpisode(Episode* episode);
void downloadNext();
void updateSettings();
QNetworkConfigurationManager networkManager;
// loads a language by the given language shortcur (e.g. de, en)
void loadLanguage(const QString& rLanguage);
// creates the language menu dynamically from the content of m_langPath
void createLanguageMenu(void);
private slots:
void updateGames();
void updateCategories();
void updateAuthors();
void restartApp();
void checkIfUpdateNeeded();
void aboutMMMLauncher();
void destroyAboutDialog();
void settingsDialog();
void destroySettingsDialog();
void episodeSelected();
/*void episodeSelected(QModelIndex row);*/
void downloadEpisode();
void downloadAll();
void finishedDownload();
void readReady(QByteArray bytes);
void downloadProgress(qint64 bytesReceived, qint64 bytesToal/*, double speed, QString unit*/);
void extractDone();
void startEpisode();
void setupEpisode();
void newTabButton();
void openNewTab();
void onTabChanged();
void closeTab(int index);
void openAdditionalFile(QTreeWidgetItem* item);
void downloadedScreenshot();
};
#endif // MAINWINDOW_H