KVIrc  4.9.2
DeveloperAPIs
ActionEditor.h
Go to the documentation of this file.
1 #ifndef _ACTIONEDITOR_H_
2 #define _ACTIONEDITOR_H_
3 //=============================================================================
4 //
5 // File : ActionEditor.h
6 // Creation date : Tue Dec 29 2004 02:40:55 CEST by Szymon Stefanek
7 //
8 // This file is part of the KVIrc IRC client distribution
9 // Copyright (C) 2004-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 <QTreeWidget>
29 
30 #include <QWidget>
31 #include <QTextDocument>
32 #include <QToolButton>
33 #include <QCheckBox>
34 
35 class QLineEdit;
36 class QComboBox;
37 class QSimpleRichText;
38 class QPushButton;
39 class QSplitter;
41 class KviScriptEditor;
42 class ActionEditor;
43 
45 {
46 public:
47  QString m_szName;
48  QString m_szScriptCode;
49  QString m_szVisibleName;
50  QString m_szDescription;
51  QString m_szCategory;
52  QString m_szBigIcon;
53  QString m_szSmallIcon;
54  QString m_szKeySequence;
55  unsigned int m_uFlags;
56  ActionEditorTreeWidgetItem * m_pItem; // ummigarba tanto...
57 public:
58  ActionData(const QString & szName,
59  const QString & szScriptCode,
60  const QString & szVisibleName,
61  const QString & szDescription,
62  const QString & szCategory,
63  const QString & szBigIcon,
64  const QString & szSmallIcon,
65  unsigned int uFlags,
66  const QString & szKeySequence,
68  : m_szName(szName), m_szScriptCode(szScriptCode), m_szVisibleName(szVisibleName),
69  m_szDescription(szDescription), m_szCategory(szCategory), m_szBigIcon(szBigIcon),
70  m_szSmallIcon(szSmallIcon), m_szKeySequence(szKeySequence), m_uFlags(uFlags),
71  m_pItem(pItem){};
72 };
73 
74 class ActionEditorTreeWidgetItem : public QTreeWidgetItem
75 {
76 public:
77  ActionEditorTreeWidgetItem(QTreeWidget * v, ActionData * a);
79 
80 protected:
82  //QSimpleRichText * m_pText;
83  QTextDocument * m_pText;
84  QPixmap * m_pIcon;
85  QTreeWidget * m_pTreeWidget;
86  QString m_szKey;
87 
88 public:
90  //void setupForActionData();
91 public:
92  //virtual void paintCell(QPainter * p,const QColorGroup & cg,int column,int width,int align);
93  //virtual void setup();
94  virtual QString key(int, bool) const;
95 };
96 
97 class ActionEditorTreeView : public QTreeWidget
98 {
99  Q_OBJECT
100 public:
101  ActionEditorTreeView(QWidget * pParent);
103 
104 protected:
105  virtual void resizeEvent(QResizeEvent * e);
106 };
107 
108 class SingleActionEditor : public QWidget
109 {
110  Q_OBJECT
111 public:
112  SingleActionEditor(QWidget * par, ActionEditor * ed);
114 
115 protected:
118  QLineEdit * m_pNameEdit;
119  QLineEdit * m_pVisibleNameEdit;
120  QComboBox * m_pCategoryCombo;
122  QLineEdit * m_pKeySequenceEdit;
123  QLineEdit * m_pDescriptionEdit;
124  QLineEdit * m_pSmallIconEdit;
125  QLineEdit * m_pBigIconEdit;
126  QToolButton * m_pSmallIconButton;
127  QToolButton * m_pBigIconButton;
128  QCheckBox * m_pNeedsContextCheck;
134  QCheckBox * m_pWindowQueryCheck;
139 
140 public:
142  void setActionData(ActionData * d);
143  void commit();
144 protected slots:
145  void chooseSmallIcon();
146  void chooseBigIcon();
147  void displaySmallIcon(const QString & szIconId);
148  void displayBigIcon(const QString & szIconId);
149  void needsContextCheckToggled(bool);
150  void needsConnectionCheckToggled(bool);
151  void specificWindowsCheckToggled(bool);
153 };
154 
155 class ActionEditor : public QWidget
156 {
157  friend class ActionEditorWindow;
158  Q_OBJECT
159 public:
160  ActionEditor(QWidget * par);
161  ~ActionEditor();
162 
163 protected:
166  QSplitter * m_pSplitter;
167  QPushButton * m_pNewActionButton;
168  QPushButton * m_pDeleteActionsButton;
169  QPushButton * m_pExportActionsButton;
170 
171 public:
172  void commit();
173  bool actionExists(const QString & szName);
174 
175 protected:
176  int selectedCount();
177  QString nameForAutomaticAction(const QString & szTemplate);
178 protected slots:
179  void currentItemChanged(QTreeWidgetItem * it, QTreeWidgetItem * prev);
180  void newAction();
181  void deleteActions();
182  void exportActions();
183 };
184 
186 {
187  Q_OBJECT
188 public:
191 
192 protected:
194 
195 protected:
196  virtual QPixmap * myIconPtr();
197  virtual void getConfigGroupName(QString & szName);
198  virtual void saveProperties(KviConfigurationFile *);
199  virtual void loadProperties(KviConfigurationFile *);
200 protected slots:
201  void cancelClicked();
202  void okClicked();
203  void applyClicked();
204 };
205 
206 #endif //_ACTIONEDITOR_H_
QCheckBox * m_pChannelOnlyIfUsersSelectedCheck
Definition: ActionEditor.h:137
QPushButton * m_pDeleteActionsButton
Definition: ActionEditor.h:168
QCheckBox * m_pNeedsConnectionCheck
Definition: ActionEditor.h:129
Definition: ActionEditor.h:108
~ActionEditorWindow()
Definition: ActionEditor.cpp:907
ActionData * actionData()
Definition: ActionEditor.h:141
ActionEditor * m_pEditor
Definition: ActionEditor.h:193
virtual void getConfigGroupName(QString &szName)
Definition: ActionEditor.cpp:933
ActionData * m_pActionData
Definition: ActionEditor.h:117
#define a
Definition: detector.cpp:91
QString m_szScriptCode
Definition: ActionEditor.h:48
QCheckBox * m_pWindowConsoleCheck
Definition: ActionEditor.h:132
void commit()
Definition: ActionEditor.cpp:847
ActionEditor(QWidget *par)
Definition: ActionEditor.cpp:619
QLineEdit * m_pVisibleNameEdit
Definition: ActionEditor.h:119
virtual QString key(int, bool) const
Definition: ActionEditor.cpp:88
Definition: ActionEditor.h:185
QCheckBox * m_pEnableAtLoginCheck
Definition: ActionEditor.h:130
QString m_szSmallIcon
Definition: ActionEditor.h:53
QCheckBox * m_pQueryOnlyIfUsersSelectedCheck
Definition: ActionEditor.h:138
Definition: KviScriptEditor.h:43
void okClicked()
Definition: ActionEditor.cpp:912
QTextDocument * m_pText
Definition: ActionEditor.h:83
Definition: KviConfigurationFile.h:48
ActionEditorWindow()
Definition: ActionEditor.cpp:876
void specificWindowsCheckToggled(bool)
Definition: ActionEditor.cpp:319
QCheckBox * m_pWindowQueryCheck
Definition: ActionEditor.h:134
void setActionData(ActionData *d)
Definition: ActionEditor.cpp:398
virtual void saveProperties(KviConfigurationFile *)
Definition: ActionEditor.cpp:938
void channelQueryOrConsoleWindowCheckToggled(bool)
Definition: ActionEditor.cpp:295
QTreeWidget * m_pTreeWidget
Definition: ActionEditor.h:85
QString m_szName
Definition: ActionEditor.h:47
QToolButton * m_pSmallIconButton
Definition: ActionEditor.h:126
QComboBox * m_pCategoryCombo
Definition: ActionEditor.h:120
virtual void loadProperties(KviConfigurationFile *)
Definition: ActionEditor.cpp:944
QCheckBox * m_pNeedsContextCheck
Definition: ActionEditor.h:128
void exportActions()
Definition: ActionEditor.cpp:695
void displaySmallIcon(const QString &szIconId)
Definition: ActionEditor.cpp:338
#define e
Definition: detector.cpp:69
void chooseBigIcon()
Definition: ActionEditor.cpp:384
QLineEdit * m_pSmallIconEdit
Definition: ActionEditor.h:124
void needsConnectionCheckToggled(bool)
Definition: ActionEditor.cpp:313
ActionData(const QString &szName, const QString &szScriptCode, const QString &szVisibleName, const QString &szDescription, const QString &szCategory, const QString &szBigIcon, const QString &szSmallIcon, unsigned int uFlags, const QString &szKeySequence, ActionEditorTreeWidgetItem *pItem)
Definition: ActionEditor.h:58
void newAction()
Definition: ActionEditor.cpp:785
void commit()
Definition: ActionEditor.cpp:522
Definition: ActionEditor.h:97
void deleteActions()
Definition: ActionEditor.cpp:743
QLineEdit * m_pDescriptionEdit
Definition: ActionEditor.h:123
int selectedCount()
char s d
Definition: KviIrcNumericCodes.h:391
SingleActionEditor(QWidget *par, ActionEditor *ed)
Definition: ActionEditor.cpp:93
void displayBigIcon(const QString &szIconId)
Definition: ActionEditor.cpp:354
KviScriptEditor * m_pScriptEditor
Definition: ActionEditor.h:121
Definition: ActionEditor.h:44
ActionData * actionData()
Definition: ActionEditor.h:89
QLineEdit * m_pKeySequenceEdit
Definition: ActionEditor.h:122
QString m_szKey
Definition: ActionEditor.h:86
Definition: ActionEditor.h:74
QString m_szKeySequence
Definition: ActionEditor.h:54
~ActionEditorTreeWidgetItem()
Definition: ActionEditor.cpp:83
Definition: ActionEditor.h:155
ActionEditorTreeWidgetItem * m_pItem
Definition: ActionEditor.h:56
SingleActionEditor * m_pSingleActionEditor
Definition: ActionEditor.h:165
void applyClicked()
Definition: ActionEditor.cpp:918
ActionData * m_pActionData
Definition: ActionEditor.h:81
QString nameForAutomaticAction(const QString &szTemplate)
Definition: ActionEditor.cpp:768
QCheckBox * m_pWindowChannelCheck
Definition: ActionEditor.h:133
Base class for all windows in KVIrc.
Definition: KviWindow.h:74
ActionEditorTreeView * m_pTreeWidget
Definition: ActionEditor.h:164
QToolButton * m_pBigIconButton
Definition: ActionEditor.h:127
QPushButton * m_pExportActionsButton
Definition: ActionEditor.h:169
void chooseSmallIcon()
Definition: ActionEditor.cpp:370
Contains the KviWindow class.
void cancelClicked()
Definition: ActionEditor.cpp:923
bool actionExists(const QString &szName)
Definition: ActionEditor.cpp:813
ActionEditorTreeWidgetItem(QTreeWidget *v, ActionData *a)
Definition: ActionEditor.cpp:68
void currentItemChanged(QTreeWidgetItem *it, QTreeWidgetItem *prev)
Definition: ActionEditor.cpp:823
QPixmap * m_pIcon
Definition: ActionEditor.h:84
QString m_szCategory
Definition: ActionEditor.h:51
QCheckBox * m_pConsoleOnlyIfUsersSelectedCheck
Definition: ActionEditor.h:136
QString m_szVisibleName
Definition: ActionEditor.h:49
QSplitter * m_pSplitter
Definition: ActionEditor.h:166
ActionEditor * m_pActionEditor
Definition: ActionEditor.h:116
QLineEdit * m_pBigIconEdit
Definition: ActionEditor.h:125
#define v
Definition: detector.cpp:86
QCheckBox * m_pSpecificWindowsCheck
Definition: ActionEditor.h:131
QString m_szBigIcon
Definition: ActionEditor.h:52
QPushButton * m_pNewActionButton
Definition: ActionEditor.h:167
QLineEdit * m_pNameEdit
Definition: ActionEditor.h:118
QString m_szDescription
Definition: ActionEditor.h:50
void needsContextCheckToggled(bool)
Definition: ActionEditor.cpp:305
virtual QPixmap * myIconPtr()
Definition: ActionEditor.cpp:928
unsigned int m_uFlags
Definition: ActionEditor.h:55
virtual void resizeEvent(QResizeEvent *e)
Definition: ActionEditor.cpp:610
QCheckBox * m_pWindowDccChatCheck
Definition: ActionEditor.h:135
ActionEditorTreeView(QWidget *pParent)
Definition: ActionEditor.cpp:593