KVIrc  4.9.2
DeveloperAPIs
EventEditorWindow.h
Go to the documentation of this file.
1 #ifndef _EVENTEDITOR_H_
2 #define _EVENTEDITOR_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 "KviCString.h"
29 
30 #include <QWidget>
31 #include <QLineEdit>
32 #include <QTreeWidget>
33 #include <QMenu>
34 
35 class KviScriptEditor;
36 
37 class EventEditorEventTreeWidgetItem : public QTreeWidgetItem
38 {
39 public:
40  unsigned int m_uEventIdx;
41  QString m_szName;
42  QString m_szParams;
43 
44 public:
45  EventEditorEventTreeWidgetItem(QTreeWidget * par, unsigned int uEvIdx, const QString & name, const QString & params);
47 
48 public:
49  void setName(const QString & szName);
50  QString name() const { return m_szName; };
51 };
52 
53 class EventEditorHandlerTreeWidgetItem : public QTreeWidgetItem
54 {
55 public:
56  QString m_szName;
57  QString m_szBuffer;
58  bool m_bEnabled;
59  int m_cPos;
60 
61 public:
62  EventEditorHandlerTreeWidgetItem(QTreeWidgetItem * par, const QString & name, const QString & buffer, bool bEnabled);
64 
65 public:
66  const int & cursorPosition() { return m_cPos; };
67  void setCursorPosition(const int & cPos)
68  {
69  qDebug("set cursor to %d", cPos);
70  m_cPos = cPos;
71  };
72 
73  void setName(const QString & szName);
74  QString name() const { return m_szName; };
75  void setEnabled(const bool bEnabled);
76 };
77 
78 class EventEditorTreeWidget : public QTreeWidget
79 {
80  Q_OBJECT
81 public:
82  EventEditorTreeWidget(QWidget *);
84 
85 protected:
86  void mousePressEvent(QMouseEvent * e);
87 signals:
88  void rightButtonPressed(QTreeWidgetItem *, QPoint);
89 };
90 
91 class EventEditor : public QWidget
92 {
93  Q_OBJECT
94 public:
95  EventEditor(QWidget * par);
96  ~EventEditor();
97 
98 public:
101  QLineEdit * m_pNameEditor;
105 
106 public:
107  void commit();
108  void saveLastEditedItem();
109  void getUniqueHandlerName(EventEditorEventTreeWidgetItem * it, QString & buffer);
111 protected slots:
112  void currentItemChanged(QTreeWidgetItem * it, QTreeWidgetItem *);
113  void itemPressed(QTreeWidgetItem * it, const QPoint & pnt);
115  void removeCurrentHandler();
117  void exportAllEvents();
118  void exportCurrentHandler();
119  void eventHandlerDisabled(const QString & szName);
120 
121 protected:
122  void showEvent(QShowEvent * e);
123 
124 private:
125  void oneTimeSetup();
126 };
127 
129 {
130  Q_OBJECT
131 public:
134 
135 protected:
137 
138 protected:
139  virtual QPixmap * myIconPtr();
140  virtual void fillCaptionBuffers();
141  virtual void getConfigGroupName(QString & szName);
142  virtual void saveProperties(KviConfigurationFile *);
143  virtual void loadProperties(KviConfigurationFile *);
144 protected slots:
145  void cancelClicked();
146  void okClicked();
147  void applyClicked();
148 };
149 
150 #endif //_EVENTEDITOR_H_
EventEditor * m_pEditor
Definition: EventEditorWindow.h:136
QString name() const
Definition: EventEditorWindow.h:74
virtual void loadProperties(KviConfigurationFile *)
Definition: EventEditorWindow.cpp:596
void oneTimeSetup()
Definition: EventEditorWindow.cpp:127
~EventEditorWindow()
Definition: EventEditorWindow.cpp:556
virtual void getConfigGroupName(QString &szName)
Definition: EventEditorWindow.cpp:587
Definition: KviScriptEditor.h:43
EventEditor(QWidget *par)
Definition: EventEditorWindow.cpp:85
void rightButtonPressed(QTreeWidgetItem *, QPoint)
Definition: KviConfigurationFile.h:48
void itemPressed(QTreeWidgetItem *it, const QPoint &pnt)
Definition: EventEditorWindow.cpp:204
virtual void saveProperties(KviConfigurationFile *)
Definition: EventEditorWindow.cpp:592
QString m_szBuffer
Definition: EventEditorWindow.h:57
void mousePressEvent(QMouseEvent *e)
Definition: EventEditorWindow.cpp:193
unsigned int m_uEventIdx
Definition: EventEditorWindow.h:40
void applyClicked()
Definition: EventEditorWindow.cpp:567
void eventHandlerDisabled(const QString &szName)
Definition: EventEditorWindow.cpp:161
void exportCurrentHandler()
Definition: EventEditorWindow.cpp:457
~EventEditorTreeWidget()
Definition: EventEditorWindow.h:83
void setCursorPosition(const int &cPos)
Definition: EventEditorWindow.h:67
QString name() const
Definition: EventEditorWindow.h:50
#define e
Definition: detector.cpp:69
EventEditorEventTreeWidgetItem(QTreeWidget *par, unsigned int uEvIdx, const QString &name, const QString &params)
Definition: EventEditorWindow.cpp:53
void okClicked()
Definition: EventEditorWindow.cpp:561
Definition: EventEditorWindow.h:128
void removeCurrentHandler()
Definition: EventEditorWindow.cpp:297
virtual QPixmap * myIconPtr()
Definition: EventEditorWindow.cpp:577
void currentItemChanged(QTreeWidgetItem *it, QTreeWidgetItem *)
Definition: EventEditorWindow.cpp:385
void setName(const QString &szName)
Definition: EventEditorWindow.cpp:59
int m_cPos
Definition: EventEditorWindow.h:59
QString m_szName
Definition: EventEditorWindow.h:41
~EventEditorEventTreeWidgetItem()
Definition: EventEditorWindow.h:46
void getUniqueHandlerName(EventEditorEventTreeWidgetItem *it, QString &buffer)
Definition: EventEditorWindow.cpp:244
void showEvent(QShowEvent *e)
Definition: EventEditorWindow.cpp:424
QString m_szParams
Definition: EventEditorWindow.h:42
bool m_bOneTimeSetupDone
Definition: EventEditorWindow.h:104
~EventEditor()
Definition: EventEditorWindow.cpp:122
KviScriptEditor * m_pEditor
Definition: EventEditorWindow.h:99
Definition: EventEditorWindow.h:37
Base class for all windows in KVIrc.
Definition: KviWindow.h:74
QLineEdit * m_pNameEditor
Definition: EventEditorWindow.h:101
void getExportEventBuffer(QString &szBuffer, EventEditorHandlerTreeWidgetItem *it)
Definition: EventEditorWindow.cpp:430
EventEditorHandlerTreeWidgetItem(QTreeWidgetItem *par, const QString &name, const QString &buffer, bool bEnabled)
Definition: EventEditorWindow.cpp:65
Definition: EventEditorWindow.h:53
~EventEditorHandlerTreeWidgetItem()
Definition: EventEditorWindow.h:63
Definition: EventEditorWindow.h:91
virtual void fillCaptionBuffers()
Definition: EventEditorWindow.cpp:582
void toggleCurrentHandlerEnabled()
Definition: EventEditorWindow.cpp:318
Contains the KviWindow class.
EventEditorTreeWidget(QWidget *)
Definition: EventEditorWindow.cpp:182
Definition: EventEditorWindow.h:78
QMenu * m_pContextPopup
Definition: EventEditorWindow.h:102
char szBuffer[4096]
Definition: winamp.cpp:77
EventEditorWindow()
Definition: EventEditorWindow.cpp:527
QString m_szName
Definition: EventEditorWindow.h:56
void setName(const QString &szName)
Definition: EventEditorWindow.cpp:73
void addHandlerForCurrentEvent()
Definition: EventEditorWindow.cpp:275
void setEnabled(const bool bEnabled)
Definition: EventEditorWindow.cpp:79
void cancelClicked()
Definition: EventEditorWindow.cpp:572
void commit()
Definition: EventEditorWindow.cpp:329
void saveLastEditedItem()
Definition: EventEditorWindow.cpp:364
EventEditorHandlerTreeWidgetItem * m_pLastEditedItem
Definition: EventEditorWindow.h:103
bool m_bEnabled
Definition: EventEditorWindow.h:58
const int & cursorPosition()
Definition: EventEditorWindow.h:66
void exportAllEvents()
Definition: EventEditorWindow.cpp:487
EventEditorTreeWidget * m_pTreeWidget
Definition: EventEditorWindow.h:100