1
#ifndef _ACTIONEDITOR_H_
2
#define _ACTIONEDITOR_H_
3
//=============================================================================
5
// File : ActionEditor.h
6
// Creation date : Tue Dec 29 2004 02:40:55 CEST by Szymon Stefanek
8
// This file is part of the KVIrc irc client distribution
9
// Copyright (C) 2004-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 <QTreeWidget>
31
#include <QTextDocument>
32
#include <QToolButton>
38
class QSimpleRichText;
41
class ActionEditorTreeWidgetItem;
42
class KviScriptEditor;
50
QString m_szScriptCode;
51
QString m_szVisibleName;
52
QString m_szDescription;
55
QString m_szSmallIcon;
56
QString m_szKeySequence;
57
unsigned int m_uFlags;
58
ActionEditorTreeWidgetItem * m_pItem; // ummigarba tanto...
60
ActionData(const QString &szName,
61
const QString &szScriptCode,
62
const QString &szVisibleName,
63
const QString &szDescription,
64
const QString &szCategory,
65
const QString &szBigIcon,
66
const QString &szSmallIcon,
68
const QString &szKeySequence,
69
ActionEditorTreeWidgetItem * pItem)
70
: m_szName(szName), m_szScriptCode(szScriptCode), m_szVisibleName(szVisibleName),
71
m_szDescription(szDescription), m_szCategory(szCategory), m_szBigIcon(szBigIcon),
72
m_szSmallIcon(szSmallIcon), m_szKeySequence(szKeySequence), m_uFlags(uFlags),
78
class ActionEditorTreeWidgetItem : public QTreeWidgetItem
81
ActionEditorTreeWidgetItem(QTreeWidget * v,ActionData * a);
82
~ActionEditorTreeWidgetItem();
84
ActionData * m_pActionData;
85
//QSimpleRichText * m_pText;
86
QTextDocument * m_pText;
88
QTreeWidget * m_pTreeWidget;
91
ActionData * actionData(){ return m_pActionData; };
92
//void setupForActionData();
94
//virtual void paintCell(QPainter * p,const QColorGroup & cg,int column,int width,int align);
95
//virtual void setup();
96
virtual QString key(int,bool) const;
100
class ActionEditorTreeView : public QTreeWidget
104
ActionEditorTreeView(QWidget * pParent);
105
~ActionEditorTreeView();
107
virtual void resizeEvent(QResizeEvent * e);
111
class SingleActionEditor : public QWidget
115
SingleActionEditor(QWidget * par,ActionEditor * ed);
116
~SingleActionEditor();
118
ActionEditor * m_pActionEditor;
119
ActionData * m_pActionData;
120
QLineEdit * m_pNameEdit;
121
QLineEdit * m_pVisibleNameEdit;
122
QComboBox * m_pCategoryCombo;
123
KviScriptEditor * m_pScriptEditor;
124
QLineEdit * m_pKeySequenceEdit;
125
QLineEdit * m_pDescriptionEdit;
126
QLineEdit * m_pSmallIconEdit;
127
QLineEdit * m_pBigIconEdit;
128
QToolButton * m_pSmallIconButton;
129
QToolButton * m_pBigIconButton;
130
QCheckBox * m_pNeedsContextCheck;
131
QCheckBox * m_pNeedsConnectionCheck;
132
QCheckBox * m_pEnableAtLoginCheck;
133
QCheckBox * m_pSpecificWindowsCheck;
134
QCheckBox * m_pWindowConsoleCheck;
135
QCheckBox * m_pWindowChannelCheck;
136
QCheckBox * m_pWindowQueryCheck;
137
QCheckBox * m_pWindowDccChatCheck;
138
QCheckBox * m_pConsoleOnlyIfUsersSelectedCheck;
139
QCheckBox * m_pChannelOnlyIfUsersSelectedCheck;
140
QCheckBox * m_pQueryOnlyIfUsersSelectedCheck;
142
ActionData * actionData(){ return m_pActionData; };
143
void setActionData(ActionData * d);
146
void chooseSmallIcon();
147
void chooseBigIcon();
148
void displaySmallIcon(const QString &szIconId);
149
void displayBigIcon(const QString &szIconId);
150
void needsContextCheckToggled(bool);
151
void needsConnectionCheckToggled(bool);
152
void specificWindowsCheckToggled(bool);
153
void channelQueryOrConsoleWindowCheckToggled(bool);
157
class ActionEditor : public QWidget
159
friend class ActionEditorWindow;
162
ActionEditor(QWidget * par);
165
ActionEditorTreeView * m_pTreeWidget;
166
SingleActionEditor * m_pSingleActionEditor;
167
QSplitter * m_pSplitter;
168
QPushButton * m_pNewActionButton;
169
QPushButton * m_pDeleteActionsButton;
170
QPushButton * m_pExportActionsButton;
173
bool actionExists(const QString &szName);
176
QString nameForAutomaticAction(const QString &szTemplate);
178
void currentItemChanged(QTreeWidgetItem * it,QTreeWidgetItem *prev);
180
void deleteActions();
181
void exportActions();
185
class ActionEditorWindow : public KviWindow
189
ActionEditorWindow(KviMainWindow * lpFrm);
190
~ActionEditorWindow();
192
ActionEditor * m_pEditor;
194
virtual QPixmap * myIconPtr();
195
virtual void getConfigGroupName(QString &szName);
196
virtual void saveProperties(KviConfigurationFile *);
197
virtual void loadProperties(KviConfigurationFile *);
199
void cancelClicked();
204
#endif //_ACTIONEDITOR_H_