KVIrc 5.2.0
Developer APIs
KviDefaultScript.h
Go to the documentation of this file.
1#ifndef _KVI_DEFAULTSCRIPT_H_
2#define _KVI_DEFAULTSCRIPT_H_
3//=============================================================================
4//
5// File : KviDefaultScript.h
6// Creation date : Fri Oct 01 2010 19:14:48 by Elvio Basello
7//
8// This file is part of the KVIrc IRC client distribution
9// Copyright (C) 2010 Elvio Basello (hell at hellvis69 dot netsons dot org)
10//
11// This program is FREE software. You can redistribute it and/or
12// modify it under the terms of the GNU General Public License
13// as published by the Free Software Foundation; either version 2
14// of the License, or (at your option) any later version.
15//
16// This program is distributed in the HOPE that it will be USEFUL,
17// but WITHOUT ANY WARRANTY; without even the implied warranty of
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19// See the GNU General Public License for more details.
20//
21// You should have received a copy of the GNU General Public License
22// along with this program. If not, write to the Free Software Foundation,
23// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24//
25//=============================================================================
26
33#include "kvi_settings.h"
34
35#include <QDialog>
36#include <QObject>
37
38class QCheckBox;
39class QGroupBox;
42
47class KVIRC_API KviDefaultScriptManager : public QObject
48{
49 Q_OBJECT
50public:
56
61
62private:
64 static unsigned int m_uCount;
65 bool m_bNoNeedToRestore = false;
66 bool m_bConfigFileMissing = false;
67 KviDefaultScriptDialog * m_pDialog = nullptr;
68 QString m_szVersion;
69 QString m_szDate;
70 QString m_szAction;
71 QString m_szAddon;
72 QString m_szAlias;
73 QString m_szClass;
74 QString m_szEvent;
75 QString m_szPopup;
76 QString m_szRaw;
77 QString m_szToolbar;
78
79public:
84 static void init();
85
90 static void done();
91
96 static inline KviDefaultScriptManager * instance() { return m_pSelf; }
97
102 unsigned int count() const { return m_uCount; }
103
108 bool isDefscriptUpToDate();
109
120 void restore();
121
129 void load(const QString & szConfigFile);
130
136 void loadEmptyConfig();
137
145 void save(const QString & szConfigFile);
146
147private:
155 void restoreInternal();
156
164 void loadInternal(KviConfigurationFile * pCfg);
165
173 void saveInternal(KviConfigurationFile * pCfg);
174
181 bool compareVersions(QString & szConfig, QString * pszError);
182};
183
188class KVIRC_API KviDefaultScriptDialog : public QDialog
189{
190 Q_OBJECT
192
193public:
199
204
205protected:
206 QGroupBox * m_pAdvanced;
207 QCheckBox * m_pAll;
208 QCheckBox * m_pData;
209 QCheckBox * m_pAction;
210 QCheckBox * m_pAddon;
211 QCheckBox * m_pAlias;
212 QCheckBox * m_pClass;
213 QCheckBox * m_pEvent;
214 QCheckBox * m_pPopup;
215 QCheckBox * m_pRaw;
216 QCheckBox * m_pToolbar;
217 QPushButton * m_pAdvancedButton;
218protected slots:
225 void toggleAll(bool);
226
233 void advanced();
234
241 void accept() override;
242
250 void reject() override;
251};
252
253#endif // _KVI_DEFAULTSCRIPT_H_
Definition KviConfigurationFile.h:50
A dialog which allow the user to choose which elements to restore.
Definition KviDefaultScript.h:189
QCheckBox * m_pToolbar
Definition KviDefaultScript.h:216
QCheckBox * m_pAll
Definition KviDefaultScript.h:207
~KviDefaultScriptDialog()
Destroys the default script dialog.
QCheckBox * m_pPopup
Definition KviDefaultScript.h:214
QGroupBox * m_pAdvanced
Definition KviDefaultScript.h:206
QCheckBox * m_pEvent
Definition KviDefaultScript.h:213
QCheckBox * m_pAlias
Definition KviDefaultScript.h:211
QCheckBox * m_pAddon
Definition KviDefaultScript.h:210
QCheckBox * m_pRaw
Definition KviDefaultScript.h:215
QCheckBox * m_pAction
Definition KviDefaultScript.h:209
QCheckBox * m_pData
Definition KviDefaultScript.h:208
QCheckBox * m_pClass
Definition KviDefaultScript.h:212
QPushButton * m_pAdvancedButton
Definition KviDefaultScript.h:217
The manager who handles the restoring of the default script.
Definition KviDefaultScript.h:48
QString m_szAction
Definition KviDefaultScript.h:70
QString m_szRaw
Definition KviDefaultScript.h:76
QString m_szAddon
Definition KviDefaultScript.h:71
QString m_szPopup
Definition KviDefaultScript.h:75
unsigned int count() const
Returns the number of instances of the class.
Definition KviDefaultScript.h:102
static KviDefaultScriptManager * instance()
Returns the instance of the class.
Definition KviDefaultScript.h:96
~KviDefaultScriptManager()
Destroys the default script manager.
static unsigned int m_uCount
Definition KviDefaultScript.h:64
QString m_szEvent
Definition KviDefaultScript.h:74
QString m_szToolbar
Definition KviDefaultScript.h:77
QString m_szAlias
Definition KviDefaultScript.h:72
QString m_szClass
Definition KviDefaultScript.h:73
static KviDefaultScriptManager * m_pSelf
Definition KviDefaultScript.h:63
QString m_szDate
Definition KviDefaultScript.h:69
QString m_szVersion
Definition KviDefaultScript.h:68
This file contains compile time settings.
#define KVIRC_API
Definition kvi_settings.h:127
int init()
Definition winamp.cpp:118