KVIrc  4.9.2
DeveloperAPIs
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 <QObject>
36 #include <QDialog>
37 
38 class QGroupBox;
39 class QCheckBox;
42 
47 class KVIRC_API KviDefaultScriptManager : public QObject
48 {
49  Q_OBJECT
50 public:
56 
61 
62 private:
64  static unsigned int m_uCount;
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 
79 public:
84  static void init();
85 
90  static void done();
91 
96  static inline KviDefaultScriptManager * instance() { return m_pSelf; }
97 
102  unsigned int count() { 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 
147 private:
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 
188 class KVIRC_API KviDefaultScriptDialog : public QDialog
189 {
190  Q_OBJECT
192 
193 public:
199 
204 
205 protected:
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;
218 protected slots:
225  void toggleAll(bool);
226 
233  void advanced();
234 
241  virtual void accept();
242 
250  virtual void reject();
251 };
252 
253 #endif // _KVI_DEFAULTSCRIPT_H_
QPushButton * m_pAdvancedButton
Definition: KviDefaultScript.h:217
A dialog which allow the user to choose which elements to restore.
Definition: KviDefaultScript.h:188
QString m_szToolbar
Definition: KviDefaultScript.h:77
KviDefaultScriptDialog * m_pDialog
Definition: KviDefaultScript.h:67
#define KVIRC_API
Definition: kvi_settings.h:128
QString m_szPopup
Definition: KviDefaultScript.h:75
QCheckBox * m_pPopup
Definition: KviDefaultScript.h:214
QString m_szAlias
Definition: KviDefaultScript.h:72
QCheckBox * m_pAll
Definition: KviDefaultScript.h:207
Definition: KviConfigurationFile.h:48
QString m_szClass
Definition: KviDefaultScript.h:73
QString m_szAddon
Definition: KviDefaultScript.h:71
QCheckBox * m_pToolbar
Definition: KviDefaultScript.h:216
QString m_szDate
Definition: KviDefaultScript.h:69
unsigned int count()
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
QCheckBox * m_pClass
Definition: KviDefaultScript.h:212
QString m_szVersion
Definition: KviDefaultScript.h:68
QCheckBox * m_pRaw
Definition: KviDefaultScript.h:215
void done()
Definition: KviKvs.cpp:50
static unsigned int m_uCount
Definition: KviDefaultScript.h:64
bool save(KviThemeInfo &options, bool bSaveIcons)
Definition: KviOptions.cpp:986
QCheckBox * m_pAlias
Definition: KviDefaultScript.h:211
int compareVersions(const QString &szVersion1, const QString &szVersion2)
Compares two x.y.z... version strings The function behaves like strcmp: it returns 0 when the version...
Definition: KviMiscUtils.cpp:31
The manager who handles the restoring of the default script.
Definition: KviDefaultScript.h:47
QString m_szAction
Definition: KviDefaultScript.h:70
QCheckBox * m_pData
Definition: KviDefaultScript.h:208
bool m_bConfigFileMissing
Definition: KviDefaultScript.h:66
QString m_szRaw
Definition: KviDefaultScript.h:76
QCheckBox * m_pEvent
Definition: KviDefaultScript.h:213
QString m_szEvent
Definition: KviDefaultScript.h:74
int init()
Definition: winamp.cpp:118
This file contains compile time settings.
QGroupBox * m_pAdvanced
Definition: KviDefaultScript.h:206
QCheckBox * m_pAddon
Definition: KviDefaultScript.h:210
bool m_bNoNeedToRestore
Definition: KviDefaultScript.h:65
static KviDefaultScriptManager * m_pSelf
Definition: KviDefaultScript.h:63
QCheckBox * m_pAction
Definition: KviDefaultScript.h:209