summaryrefslogtreecommitdiff
path: root/src/settingsdialog.h
blob: afe988bddf5462d8b6da1496b76cf397a3883a7e (plain)
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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
/*
Copyright (C) 2012 Sebastian Herbord. All rights reserved.

This file is part of Mod Organizer.

Mod Organizer is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Mod Organizer is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Mod Organizer.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef SETTINGSDIALOG_H
#define SETTINGSDIALOG_H

#include "tutorabledialog.h"
#include <iplugin.h>
#include <QComboBox>
#include <QDialog>
#include <QWebSocket>
#include <QListWidgetItem>
#include <QTimer>

class PluginContainer;

namespace Ui {
    class SettingsDialog;
}

/**
 * dialog used to change settings for Mod Organizer. On top of the
 * settings managed by the "Settings" class, this offers a button to open the
 * CategoriesDialog
 **/
class SettingsDialog : public MOBase::TutorableDialog
{
    Q_OBJECT

public:
  explicit SettingsDialog(PluginContainer *pluginContainer, QWidget *parent = 0);
  ~SettingsDialog();

  /**
  * @brief get stylesheet of settings buttons with colored background
  * @return string of stylesheet
  */
  QString getColoredButtonStyleSheet() const;

  void setButtonColor(QPushButton *button, const QColor &color);

public slots:

  virtual void accept();

signals:

  void resetDialogs();
  void processApiKey(const QString &);
  void closeApiConnection(QPushButton *);
  void revokeApiKey(QPushButton *);
  void retryApiConnection();

private:

  void storeSettings(QListWidgetItem *pluginItem);
  void normalizePath(QLineEdit *lineEdit);

public:

  QColor getOverwritingColor() { return m_OverwritingColor; }
  QColor getOverwrittenColor() { return m_OverwrittenColor; }
  QColor getOverwritingArchiveColor() { return m_OverwritingArchiveColor; }
  QColor getOverwrittenArchiveColor() { return m_OverwrittenArchiveColor; }
  QColor getContainsColor() { return m_ContainsColor; }
  QColor getContainedColor() { return m_ContainedColor; }
  QString getExecutableBlacklist() { return m_ExecutableBlacklist; }
  bool getResetGeometries();
  bool getApiKeyChanged();

  void setOverwritingColor(QColor col) { m_OverwritingColor = col; }
  void setOverwrittenColor(QColor col) { m_OverwrittenColor = col; }
  void setOverwritingArchiveColor(QColor col) { m_OverwritingArchiveColor = col; }
  void setOverwrittenArchiveColor(QColor col) { m_OverwrittenArchiveColor = col; }
  void setContainsColor(QColor col) { m_ContainsColor = col; }
  void setContainedColor(QColor col) { m_ContainedColor = col; }
  void setExecutableBlacklist(QString blacklist) { m_ExecutableBlacklist = blacklist; }


private slots:
  //void on_loginCheckBox_toggled(bool checked);

  void on_categoriesBtn_clicked();

  void on_execBlacklistBtn_clicked();

  void on_bsaDateBtn_clicked();

  void on_browseDownloadDirBtn_clicked();

  void on_browseModDirBtn_clicked();

  void on_browseCacheDirBtn_clicked();

  void on_resetDialogsButton_clicked();

  void on_pluginsList_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous);

  void deleteBlacklistItem();

  void on_associateButton_clicked();

  void on_clearCacheButton_clicked();

  void on_revokeNexusAuthButton_clicked();

  void on_browseBaseDirBtn_clicked();

  void on_browseOverwriteDirBtn_clicked();

  void on_browseProfilesDirBtn_clicked();

  void on_browseGameDirBtn_clicked();

  void on_overwritingBtn_clicked();

  void on_overwrittenBtn_clicked();

  void on_overwritingArchiveBtn_clicked();

  void on_overwrittenArchiveBtn_clicked();

  void on_containsBtn_clicked();

  void on_containedBtn_clicked();

  void on_resetColorsBtn_clicked();

  void on_baseDirEdit_editingFinished();

  void on_downloadDirEdit_editingFinished();

  void on_modDirEdit_editingFinished();

  void on_cacheDirEdit_editingFinished();

  void on_profilesDirEdit_editingFinished();

  void on_overwriteDirEdit_editingFinished();

  void on_nexusConnect_clicked();

  void dispatchLogin();

  void loginPing();

  void authError(QAbstractSocket::SocketError error);

  void receiveApiKey(const QString &apiKey);

  void completeApiConnection();

  void on_resetGeometryBtn_clicked();

private:
    Ui::SettingsDialog *ui;
    PluginContainer *m_PluginContainer;

    QColor m_OverwritingColor;
    QColor m_OverwrittenColor;
    QColor m_OverwritingArchiveColor;
    QColor m_OverwrittenArchiveColor;
    QColor m_ContainsColor;
    QColor m_ContainedColor;

    bool m_KeyReceived;
    bool m_KeyCleared;
    bool m_GeometriesReset;
    QString m_UUID;
    QString m_AuthToken;

    QString m_ExecutableBlacklist;
    QWebSocket *m_nexusLogin;
    QTimer m_loginTimer;
    int m_totalPings = 0;
};



#endif // SETTINGSDIALOG_H