This repository has been archived by the owner on Aug 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
controller.h
138 lines (121 loc) · 4.79 KB
/
controller.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
#ifndef CONTROLLER_H
#define CONTROLLER_H
#include "largefiledialog.h"
#include "mainwindow.h"
#include <QObject>
#include <QSettings>
#include <QTreeWidgetItem>
#include <QNetworkReply>
#include <QPushButton>
#include <QFile>
class Controller : public QObject
{
Q_OBJECT
public:
explicit Controller(QObject *parent = 0);
void bootStrap();
private:
void readSettings();
QString convertSlashes(QString str);
QStringList readVDF();
void populateScreenshotQueue(QStringList screenshotPathsList);
bool isUnixLikeOS;
const QString vdfFilename = "screenshots.vdf";
QString selectedUserID;
QString selectedGameID;
QString userDataDir;
QString defaultSteamDir;
QSettings *settings;
QString steamDir;
QStringList vdfPaths;
QString userID;
QString someID;
QHash<QString, QString> games;
QStringList screenshotPathsPool;
QStringList lines;
QString lastSelectedScreenshotDir;
QString lastSelectedUserID;
QString lastSelectedGameID;
quint32 selectedJpegQuality;
QStringList copiedGames;
QString copyDest;
qint32 opening;
qint32 closing;
qint32 lastEntryValue;
quint32 copiedScreenshotsNum = 0;
quint32 copiedDirsToNum = 0;
quint32 addedLines = 0;
LargeFileDialog *largeFileDialog;
QList<Screenshot> preparedScreenshotList;
const quint32 steamMaxSideSize = 16000;
const quint32 steamMaxResolution = 26210175;
QString offerUpdateSetting;
QTreeWidgetDragAndDrop *treeWidget;
const QStringList imageFormatsSupported = QStringList() << "jpg" << "jpeg" << "png" << "bmp" << "tif" << "tiff";
bool someScreenshotsWereNotPrepared;
void pushScreenshots(QList<Screenshot> screenshotList);
void resizeAndSaveLargeScreenshot(Screenshot screenshot);
void getUserDecisionAboutLargeScreenshots(QList<Screenshot> screenshotList, MainWindow *mainWindow);
void saveThumbnail(QString filename, QImage image, quint32 width, quint32 height);
void checkForUpdates();
QString getPersonalNameByUserID(QString userID);
void getShortcutNames();
QString getEncodingProcessOfJpeg(QFile *file);
const QString warningColor = "#ab4e52";
const quint32 defaultJpegQuality = 95;
#if defined(Q_OS_WIN32)
const QString os = "Windows";
#elif defined(Q_OS_LINUX)
const QString os = "Linux";
#elif defined(Q_OS_OSX)
const QString os = "macOS";
#endif
signals:
void adjustButtons(QList<QPushButton*> buttonList, QString os);
void addWidgetItemToScreenshotList(QTreeWidgetItem *item);
void resizeScreenshotListColumns();
void sendProgressBarLength(quint32 length);
void sendSteamDir(QString steamDir);
void sendLinesState(quint32 addedLines);
void moveWindow(QSize geometry, QPoint moveToPoint);
void setLabelStatusErrorVisible(bool visible);
void sendWidgetsDisabled(QStringList list, bool disable);
void sendLabelsCleared(QStringList list);
void sendLabelsVisible(QStringList list, bool visible);
void sendComboBoxesCleared(QStringList list);
void sendLabelsOnMissingStuff(bool userDataMissing, QString vdfFilename);
void sendLastSelectedScreenshotDir(QString lastSelectedScreenshotDir);
void sendProgressBarValue(quint32 value);
void deleteCopiedWidgetItem(QString path);
void sendToComboBox(QString name, QStringList items);
void sendIndexOfComboBox(QString name, QString text);
void sendLabelsText(QStringList list, QString text);
void sendScreenshotList(QList<Screenshot> screenshotList, QPoint center, QStringList steamLimits);
void sendStatusLabelText(QString text, QString color);
void setupStatusArea(quint32 progressBarMaximum);
void sendDirStatusLabelsVisible(bool visible);
void sendUpdateInfo(QString version, QString link);
void sendJpegQualityValue(quint32 jpegQualityValue);
public slots:
void getButtonList(QList<QPushButton *> buttonList);
void writeSettings(QSize size, QPoint pos, QString userID, QString gameID, quint32 jpegQuality);
void removeEntryFromScreenshotPathsPool(QString entry);
void returnLastSelectedScreenshotDir();
void clearScreenshotPathsPool();
void clearState();
void prepareScreenshots(QString userID, QString gameID, quint32 jpegQuality, MainWindow *mainWindow);
void setUserDataPaths(QString dir);
void returnSteamDir();
void writeVDF();
void returnLinesState();
void clearCopyingStatusLabels();
void addScreenshotsToPool(QStringList screenshotsSelected);
void prepareScreenshotListWithDecisions(QList<Screenshot> screenshotList);
void writeSettingNeverOfferUpdate();
void fillGameIDs(QString userIDCombined);
void receiveTreeWidgetPointer(QTreeWidgetDragAndDrop *receivedWidget);
private slots:
void handleUpdate(QNetworkReply *reply);
void getGameNames(QNetworkReply *reply);
};
#endif // CONTROLLER_H