KVIrc 5.2.6
Developer APIs
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#include <QCheckBox>
35
36class KviScriptEditor;
37
38class EventEditorEventTreeWidgetItem : public QTreeWidgetItem
39{
40public:
41 unsigned int m_uEventIdx;
42 QString m_szName;
43 QString m_szParams;
44
45public:
46 EventEditorEventTreeWidgetItem(QTreeWidget * par, unsigned int uEvIdx, const QString & name, QString params);
48
49public:
50 void setName(const QString & szName);
51 QString name() const { return m_szName; };
52};
53
54class EventEditorHandlerTreeWidgetItem : public QTreeWidgetItem
55{
56public:
57 QString m_szName;
58 QString m_szBuffer;
60 int m_cPos;
61
62public:
63 EventEditorHandlerTreeWidgetItem(QTreeWidgetItem * par, const QString & name, QString buffer, bool bEnabled);
65
66public:
67 const int & cursorPosition() { return m_cPos; };
68 void setCursorPosition(const int & cPos)
69 {
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 bool isEnabled() { return m_bEnabled; };
77};
78
79class EventEditorTreeWidget : public QTreeWidget
80{
81 Q_OBJECT
82public:
83 EventEditorTreeWidget(QWidget *);
85
86protected:
87 void mousePressEvent(QMouseEvent * e) override;
88signals:
89 void rightButtonPressed(QTreeWidgetItem *, QPoint);
90};
91
92class EventEditor : public QWidget
93{
94 Q_OBJECT
95public:
96 EventEditor(QWidget * par);
98
99public:
102 QLineEdit * m_pNameEditor;
103 QCheckBox * m_pIsEnabled;
104 QMenu * m_pContextPopup = nullptr;
107
108public:
109 void commit();
110 void saveLastEditedItem();
111 void getUniqueHandlerName(EventEditorEventTreeWidgetItem * it, QString & buffer);
113protected slots:
114 void currentItemChanged(QTreeWidgetItem * it, QTreeWidgetItem *);
115 void itemPressed(QTreeWidgetItem * it, const QPoint & pnt);
119 void exportAllEvents();
121 void eventHandlerDisabled(const QString & szName);
122
123protected:
124 void showEvent(QShowEvent * e) override;
125
126private:
127 void oneTimeSetup();
128};
129
131{
132 Q_OBJECT
133public:
136
137protected:
139
140protected:
141 QPixmap * myIconPtr() override;
142 void fillCaptionBuffers() override;
143 void getConfigGroupName(QString & szName) override;
144 void saveProperties(KviConfigurationFile *) override;
145 void loadProperties(KviConfigurationFile *) override;
146protected slots:
147 void cancelClicked();
148 void okClicked();
149 void applyClicked();
150};
151
152#endif //_EVENTEDITOR_H_
Contains the KviWindow class.
Definition EventEditorWindow.h:39
QString name() const
Definition EventEditorWindow.h:51
QString m_szParams
Definition EventEditorWindow.h:43
QString m_szName
Definition EventEditorWindow.h:42
void setName(const QString &szName)
Definition EventEditorWindow.cpp:64
EventEditorEventTreeWidgetItem(QTreeWidget *par, unsigned int uEvIdx, const QString &name, QString params)
Definition EventEditorWindow.cpp:56
~EventEditorEventTreeWidgetItem()
Definition EventEditorWindow.h:47
unsigned int m_uEventIdx
Definition EventEditorWindow.h:41
Definition EventEditorWindow.h:55
QString m_szName
Definition EventEditorWindow.h:57
int m_cPos
Definition EventEditorWindow.h:60
QString name() const
Definition EventEditorWindow.h:74
void setName(const QString &szName)
Definition EventEditorWindow.cpp:79
void setCursorPosition(const int &cPos)
Definition EventEditorWindow.h:68
QString m_szBuffer
Definition EventEditorWindow.h:58
void setEnabled(const bool bEnabled)
Definition EventEditorWindow.cpp:85
bool isEnabled()
Definition EventEditorWindow.h:76
EventEditorHandlerTreeWidgetItem(QTreeWidgetItem *par, const QString &name, QString buffer, bool bEnabled)
Definition EventEditorWindow.cpp:70
const int & cursorPosition()
Definition EventEditorWindow.h:67
bool m_bEnabled
Definition EventEditorWindow.h:59
~EventEditorHandlerTreeWidgetItem()
Definition EventEditorWindow.h:64
Definition EventEditorWindow.h:80
~EventEditorTreeWidget()
Definition EventEditorWindow.h:84
void mousePressEvent(QMouseEvent *e) override
Definition EventEditorWindow.cpp:223
EventEditorTreeWidget(QWidget *)
Definition EventEditorWindow.cpp:212
void rightButtonPressed(QTreeWidgetItem *, QPoint)
Definition EventEditorWindow.h:131
void loadProperties(KviConfigurationFile *) override
Definition EventEditorWindow.cpp:631
void cancelClicked()
Definition EventEditorWindow.cpp:607
~EventEditorWindow()
Definition EventEditorWindow.cpp:591
void okClicked()
Definition EventEditorWindow.cpp:596
void saveProperties(KviConfigurationFile *) override
Definition EventEditorWindow.cpp:627
QPixmap * myIconPtr() override
Definition EventEditorWindow.cpp:612
void getConfigGroupName(QString &szName) override
Definition EventEditorWindow.cpp:622
EventEditorWindow()
Definition EventEditorWindow.cpp:562
void applyClicked()
Definition EventEditorWindow.cpp:602
void fillCaptionBuffers() override
Definition EventEditorWindow.cpp:617
EventEditor * m_pEditor
Definition EventEditorWindow.h:138
Definition EventEditorWindow.h:93
void oneTimeSetup()
Definition EventEditorWindow.cpp:147
void addHandlerForCurrentEvent()
Definition EventEditorWindow.cpp:305
void exportCurrentHandler()
Definition EventEditorWindow.cpp:492
void itemPressed(QTreeWidgetItem *it, const QPoint &pnt)
Definition EventEditorWindow.cpp:234
EventEditorTreeWidget * m_pTreeWidget
Definition EventEditorWindow.h:101
void getExportEventBuffer(QString &szBuffer, EventEditorHandlerTreeWidgetItem *it)
Definition EventEditorWindow.cpp:465
void currentItemChanged(QTreeWidgetItem *it, QTreeWidgetItem *)
Definition EventEditorWindow.cpp:416
void removeCurrentHandler()
Definition EventEditorWindow.cpp:327
void toggleCurrentHandlerEnabled()
Definition EventEditorWindow.cpp:349
bool m_bOneTimeSetupDone
Definition EventEditorWindow.h:106
void getUniqueHandlerName(EventEditorEventTreeWidgetItem *it, QString &buffer)
Definition EventEditorWindow.cpp:274
EventEditor(QWidget *par)
Definition EventEditorWindow.cpp:91
~EventEditor()
Definition EventEditorWindow.cpp:142
KviScriptEditor * m_pEditor
Definition EventEditorWindow.h:100
void commit()
Definition EventEditorWindow.cpp:361
void showEvent(QShowEvent *e) override
Definition EventEditorWindow.cpp:459
EventEditorHandlerTreeWidgetItem * m_pLastEditedItem
Definition EventEditorWindow.h:105
QMenu * m_pContextPopup
Definition EventEditorWindow.h:104
QLineEdit * m_pNameEditor
Definition EventEditorWindow.h:102
void saveLastEditedItem()
Definition EventEditorWindow.cpp:396
void eventHandlerDisabled(const QString &szName)
Definition EventEditorWindow.cpp:181
void exportAllEvents()
Definition EventEditorWindow.cpp:522
QCheckBox * m_pIsEnabled
Definition EventEditorWindow.h:103
Definition KviConfigurationFile.h:50
Definition KviScriptEditor.h:45
Base class for all windows in KVIrc.
Definition KviWindow.h:75
#define e
Definition detector.cpp:70
char szBuffer[4096]
Definition winamp.cpp:77