KVIrc  4.9.2
DeveloperAPIs
RawEditorWindow.h
Go to the documentation of this file.
1 #ifndef _RAWEDITOR_H_
2 #define _RAWEDITOR_H_
3 //=============================================================================
4 //
5 // File : EventEditorWindow.h
6 // Creation date : Mon Dec 23 2002 20:24:55 CEST by Szymon Stefanek
7 //
8 // This file is part of the KVIrc IRC client distribution
9 // Copyright (C) 2002-2010 Szymon Stefanek (pragma at kvirc dot net)
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 
27 #include "KviWindow.h"
28 #include "KviQString.h"
29 #include <QTreeWidget>
30 #include "KviIconManager.h"
31 
32 #include <QWidget>
33 #include <QLineEdit>
34 
35 class KviScriptEditor;
36 class QMenu;
37 
38 class RawTreeWidget : public QTreeWidget
39 {
40 public:
41  RawTreeWidget(QWidget * par)
42  : QTreeWidget(par){};
43  void updateItem(QTreeWidgetItem * item)
44  {
45  update(indexFromItem(item, 0));
46  };
48 };
49 
50 class RawTreeWidgetItem : public QTreeWidgetItem
51 {
52 public:
53  int m_iIdx;
54 
55 public:
56  RawTreeWidgetItem(QTreeWidget * par, int idx, bool bEnabled);
58 
59 public:
60  void setEnabled(bool bEnabled)
61  {
62  if(bEnabled)
64  else
66  ((RawTreeWidget *)treeWidget())->updateItem(this);
67  };
68 };
69 
70 class RawHandlerTreeWidgetItem : public QTreeWidgetItem
71 {
72 public:
73  RawHandlerTreeWidgetItem(QTreeWidgetItem * par, const QString & name, const QString & buffer, bool bEnabled)
74  : QTreeWidgetItem(par), m_szBuffer(buffer), m_bEnabled(bEnabled)
75  {
76  setText(0, name);
77  setEnabled(bEnabled);
78  };
80 
81 public:
82  void setEnabled(bool bEnabled)
83  {
84  if(bEnabled)
86  else
88  ((RawTreeWidget *)treeWidget())->updateItem(this);
89  };
90  QString m_szBuffer;
91  bool m_bEnabled;
92  void setName(const QString & szName);
93 };
94 
95 class RawEditorWidget : public QWidget
96 {
97  Q_OBJECT
98 public:
99  RawEditorWidget(QWidget * par);
101 
102 public:
105  QLineEdit * m_pNameEditor;
109 
110 public:
111  void commit();
112  void saveLastEditedItem();
113  void getUniqueHandlerName(RawTreeWidgetItem * it, QString & buffer);
115 protected slots:
116  void currentItemChanged(QTreeWidgetItem * it, QTreeWidgetItem *);
117  void customContextMenuRequested(const QPoint & pnt);
119  void removeCurrentHandler();
121  void addRaw();
122  void exportAllEvents();
123  void exportCurrentHandler();
124 
125 protected:
126  void showEvent(QShowEvent * e);
127 
128 private:
129  void oneTimeSetup();
130 };
131 
133 {
134  Q_OBJECT
135 public:
136  RawEditorWindow();
138 
139 protected:
141 
142 protected:
143  virtual QPixmap * myIconPtr();
144  virtual void fillCaptionBuffers();
145  virtual void getConfigGroupName(QString & szName);
146  virtual void saveProperties(KviConfigurationFile *);
147  virtual void loadProperties(KviConfigurationFile *);
148 protected slots:
149  void cancelClicked();
150  void okClicked();
151  void applyClicked();
152 };
153 
154 #endif //_RAWEDITOR_H_
QLineEdit * m_pNameEditor
Definition: RawEditorWindow.h:105
void setEnabled(bool bEnabled)
Definition: RawEditorWindow.h:60
Definition: KviIconManager.h:255
RawEditorWidget * m_pEditor
Definition: RawEditorWindow.h:140
void addHandlerForCurrentRaw()
Definition: RawEditorWindow.cpp:239
Definition: RawEditorWindow.h:50
void addRaw()
Definition: RawEditorWindow.cpp:208
void exportAllEvents()
Definition: RawEditorWindow.cpp:430
QPixmap * getSmallIcon(SmallIcon eIcon)
Returns the small icon.
Definition: KviIconManager.h:593
void saveLastEditedItem()
Definition: RawEditorWindow.cpp:322
Definition: KviScriptEditor.h:43
bool m_bEnabled
Definition: RawEditorWindow.h:91
~RawEditorWidget()
Definition: RawEditorWindow.cpp:108
Definition: KviConfigurationFile.h:48
void applyClicked()
Definition: RawEditorWindow.cpp:508
void showEvent(QShowEvent *e)
Definition: RawEditorWindow.cpp:366
void commit()
Definition: RawEditorWindow.cpp:287
RawHandlerTreeWidgetItem(QTreeWidgetItem *par, const QString &name, const QString &buffer, bool bEnabled)
Definition: RawEditorWindow.h:73
bool m_bOneTimeSetupDone
Definition: RawEditorWindow.h:108
virtual void fillCaptionBuffers()
Definition: RawEditorWindow.cpp:523
virtual QPixmap * myIconPtr()
Definition: RawEditorWindow.cpp:518
void oneTimeSetup()
Definition: RawEditorWindow.cpp:113
~RawHandlerTreeWidgetItem()
Definition: RawEditorWindow.h:79
#define e
Definition: detector.cpp:69
Definition: RawEditorWindow.h:95
RawEditorWidget(QWidget *par)
Definition: RawEditorWindow.cpp:68
Icon manager.
void toggleCurrentHandlerEnabled()
Definition: RawEditorWindow.cpp:276
void removeCurrentHandler()
Definition: RawEditorWindow.cpp:260
Definition: KviIconManager.h:356
QString m_szBuffer
Definition: RawEditorWindow.h:89
KviIconManager * g_pIconManager
Definition: KviIconManager.cpp:81
Definition: RawEditorWindow.h:38
void currentItemChanged(QTreeWidgetItem *it, QTreeWidgetItem *)
Definition: RawEditorWindow.cpp:343
QMenu * m_pContextPopup
Definition: RawEditorWindow.h:106
virtual void loadProperties(KviConfigurationFile *)
Definition: RawEditorWindow.cpp:537
RawTreeWidget(QWidget *par)
Definition: RawEditorWindow.h:41
void setEnabled(bool bEnabled)
Definition: RawEditorWindow.h:82
~RawTreeWidgetItem()
Definition: RawEditorWindow.h:57
Base class for all windows in KVIrc.
Definition: KviWindow.h:74
int m_iIdx
Definition: RawEditorWindow.h:53
virtual void saveProperties(KviConfigurationFile *)
Definition: RawEditorWindow.cpp:533
Definition: RawEditorWindow.h:132
Definition: KviIconManager.h:357
RawTreeWidgetItem(QTreeWidget *par, int idx, bool bEnabled)
Definition: RawEditorWindow.cpp:53
QString name()
Definition: KviRuntimeInfo.cpp:655
Contains the KviWindow class.
void setName(const QString &szName)
Definition: RawEditorWindow.cpp:63
RawEditorWindow()
Definition: RawEditorWindow.cpp:467
RawHandlerTreeWidgetItem * m_pLastEditedItem
Definition: RawEditorWindow.h:107
void cancelClicked()
Definition: RawEditorWindow.cpp:513
KviScriptEditor * m_pEditor
Definition: RawEditorWindow.h:103
char szBuffer[4096]
Definition: winamp.cpp:77
void getExportEventBuffer(QString &szBuffer, RawHandlerTreeWidgetItem *it)
Definition: RawEditorWindow.cpp:372
virtual void getConfigGroupName(QString &szName)
Definition: RawEditorWindow.cpp:528
Definition: KviIconManager.h:256
void customContextMenuRequested(const QPoint &pnt)
Definition: RawEditorWindow.cpp:140
void updateItem(QTreeWidgetItem *item)
Definition: RawEditorWindow.h:43
void exportCurrentHandler()
Definition: RawEditorWindow.cpp:399
~RawTreeWidget()
Definition: RawEditorWindow.h:47
void getUniqueHandlerName(RawTreeWidgetItem *it, QString &buffer)
Definition: RawEditorWindow.cpp:177
~RawEditorWindow()
Definition: RawEditorWindow.cpp:497
Helper functions for the QString class.
RawTreeWidget * m_pTreeWidget
Definition: RawEditorWindow.h:104
void okClicked()
Definition: RawEditorWindow.cpp:502
Definition: RawEditorWindow.h:70