3
//=============================================================================
5
// File : EventEditorWindow.h
6
// Creation date : Mon Dec 23 2002 20:24:55 CEST by Szymon Stefanek
8
// This file is part of the KVIrc irc client distribution
9
// Copyright (C) 2002-2010 Szymon Stefanek (pragma at kvirc dot net)
11
// This program is FREE software. You can redistribute it and/or
12
// modify it under the linkss of the GNU General Public License
13
// as published by the Free Software Foundation; either version 2
14
// of the License, or (at your opinion) any later version.
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.
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.
25
//=============================================================================
27
#include "KviWindow.h"
28
#include "KviQString.h"
29
#include <QTreeWidget>
30
#include "KviIconManager.h"
35
class KviScriptEditor;
36
class KviTalPopupMenu;
38
class RawTreeWidget : public QTreeWidget
41
RawTreeWidget(QWidget *par)
43
void updateItem(QTreeWidgetItem *item)
45
update(indexFromItem(item,0));
50
class RawTreeWidgetItem : public QTreeWidgetItem
55
RawTreeWidgetItem(QTreeWidget * par,int idx,bool bEnabled);
56
~RawTreeWidgetItem() {};
58
void setEnabled(bool bEnabled)
60
if (bEnabled) setIcon(0,QIcon(*g_pIconManager->getSmallIcon(KviIconManager::RawEvent)));
61
else setIcon(0,QIcon(*g_pIconManager->getSmallIcon(KviIconManager::RawEventNoHandlers)));
62
((RawTreeWidget*)treeWidget())->updateItem(this);
66
class RawHandlerTreeWidgetItem : public QTreeWidgetItem
69
RawHandlerTreeWidgetItem(QTreeWidgetItem * par,const QString & name,const QString & buffer,bool bEnabled)
70
: QTreeWidgetItem(par), m_szBuffer(buffer), m_bEnabled(bEnabled)
75
~RawHandlerTreeWidgetItem() {};
77
void setEnabled(bool bEnabled)
79
if (bEnabled) setIcon(0,QIcon(*g_pIconManager->getSmallIcon(KviIconManager::Handler)));
80
else setIcon(0,QIcon(*g_pIconManager->getSmallIcon(KviIconManager::HandlerDisabled)));
81
((RawTreeWidget*)treeWidget())->updateItem(this);
85
void setName(const QString &szName);
88
class RawEditorWidget : public QWidget
92
RawEditorWidget(QWidget * par);
95
KviScriptEditor * m_pEditor;
96
RawTreeWidget * m_pTreeWidget;
97
QLineEdit * m_pNameEditor;
98
KviTalPopupMenu * m_pContextPopup;
99
RawHandlerTreeWidgetItem * m_pLastEditedItem;
100
bool m_bOneTimeSetupDone;
103
void saveLastEditedItem();
104
void getUniqueHandlerName(RawTreeWidgetItem *it,QString &buffer);
105
void getExportEventBuffer(QString &szBuffer,RawHandlerTreeWidgetItem * it);
107
void currentItemChanged(QTreeWidgetItem *it,QTreeWidgetItem *);
108
void customContextMenuRequested(const QPoint &pnt);
109
void toggleCurrentHandlerEnabled();
110
void removeCurrentHandler();
111
void addHandlerForCurrentRaw();
113
void exportAllEvents();
114
void exportCurrentHandler();
116
void showEvent(QShowEvent *e);
121
class RawEditorWindow : public KviWindow
125
RawEditorWindow(KviMainWindow * lpFrm);
128
RawEditorWidget * m_pEditor;
130
virtual QPixmap * myIconPtr();
131
virtual void fillCaptionBuffers();
132
virtual void getConfigGroupName(QString &szName);
133
virtual void saveProperties(KviConfigurationFile *);
134
virtual void loadProperties(KviConfigurationFile *);
136
void cancelClicked();
141
#endif //_RAWEDITOR_H_