~ubuntu-branches/ubuntu/trusty/kvirc/trusty

« back to all changes in this revision

Viewing changes to src/modules/actioneditor/ActionEditor.h

  • Committer: Bazaar Package Importer
  • Author(s): Kai Wasserbäch, Kai Wasserbäch, Raúl Sánchez Siles
  • Date: 2011-02-12 10:40:21 UTC
  • mfrom: (14.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20110212104021-5mh4f75jlku20mnt
The combined "Twisted Experiment" and "Nocturnal Raid" release.

[ Kai Wasserbäch ]
* Synced to upstream's SVN revision 5467.
* debian/rules:
  - Added .PHONY line.
  - Resurrect -DMANUAL_REVISION, got lost somewhere and we build SVN
    revisions again.
  - Replace "-DWITH_NO_EMBEDDED_CODE=YES" with "-DWANT_CRYPTOPP=YES".
  - Change the remaining -DWITH/-DWITHOUT to the new -DWANT syntax.
* debian/control:
  - Removed DMUA, I'm a DD now.
  - Changed my e-mail address.
  - Removed unneeded relationships (no upgrades over two releases are
    supported).
  - Fix Suggests for kvirc-dbg.
  - kvirc-data: Make the "Suggests: kvirc" a Recommends, doesn't make much
    sense to install the -data package without the program.
* debian/source/local-options: Added with "unapply-patches".
* debian/kvirc.lintian-overrides: Updated to work for 4.1.1.
* debian/patches/21_make_shared-mime-info_B-D_superfluous.patch: Updated.
* debian/kvirc-data.install: Added .notifyrc.

[ Raúl Sánchez Siles ]
* Stating the right version where kvirc-data break and replace should happen.
* Fixing link to license file.
* Added French and Portuguese man pages.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 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.
 
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
 
 
36
class QLineEdit;
 
37
class QComboBox;
 
38
class QSimpleRichText;
 
39
class QPushButton;
 
40
class QSplitter;
 
41
class ActionEditorTreeWidgetItem;
 
42
class KviScriptEditor;
 
43
class ActionEditor;
 
44
 
 
45
 
 
46
class ActionData
 
47
{
 
48
public:
 
49
        QString m_szName;
 
50
        QString m_szScriptCode;
 
51
        QString m_szVisibleName;
 
52
        QString m_szDescription;
 
53
        QString m_szCategory;
 
54
        QString m_szBigIcon;
 
55
        QString m_szSmallIcon;
 
56
        QString m_szKeySequence;
 
57
        unsigned int m_uFlags;
 
58
        ActionEditorTreeWidgetItem * m_pItem; // ummigarba tanto...
 
59
public:
 
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,
 
67
                unsigned int uFlags,
 
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),
 
73
                m_pItem(pItem)
 
74
        {};
 
75
};
 
76
 
 
77
 
 
78
class ActionEditorTreeWidgetItem : public QTreeWidgetItem
 
79
{
 
80
public:
 
81
        ActionEditorTreeWidgetItem(QTreeWidget * v,ActionData * a);
 
82
        ~ActionEditorTreeWidgetItem();
 
83
protected:
 
84
        ActionData * m_pActionData;
 
85
        //QSimpleRichText * m_pText;
 
86
        QTextDocument * m_pText;
 
87
        QPixmap * m_pIcon;
 
88
        QTreeWidget * m_pTreeWidget;
 
89
        QString m_szKey;
 
90
public:
 
91
        ActionData * actionData(){ return m_pActionData; };
 
92
        //void setupForActionData();
 
93
public:
 
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;
 
97
};
 
98
 
 
99
 
 
100
class ActionEditorTreeView : public QTreeWidget
 
101
{
 
102
        Q_OBJECT
 
103
public:
 
104
        ActionEditorTreeView(QWidget * pParent);
 
105
        ~ActionEditorTreeView();
 
106
protected:
 
107
        virtual void resizeEvent(QResizeEvent * e);
 
108
};
 
109
 
 
110
 
 
111
class SingleActionEditor : public QWidget
 
112
{
 
113
        Q_OBJECT
 
114
public:
 
115
        SingleActionEditor(QWidget * par,ActionEditor * ed);
 
116
        ~SingleActionEditor();
 
117
protected:
 
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;
 
141
public:
 
142
        ActionData * actionData(){ return m_pActionData; };
 
143
        void setActionData(ActionData * d);
 
144
        void commit();
 
145
protected slots:
 
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);
 
154
};
 
155
 
 
156
 
 
157
class ActionEditor : public QWidget
 
158
{
 
159
        friend class ActionEditorWindow;
 
160
        Q_OBJECT
 
161
public:
 
162
        ActionEditor(QWidget * par);
 
163
        ~ActionEditor();
 
164
protected:
 
165
        ActionEditorTreeView * m_pTreeWidget;
 
166
        SingleActionEditor * m_pSingleActionEditor;
 
167
        QSplitter * m_pSplitter;
 
168
        QPushButton * m_pNewActionButton;
 
169
        QPushButton * m_pDeleteActionsButton;
 
170
        QPushButton * m_pExportActionsButton;
 
171
public:
 
172
        void commit();
 
173
        bool actionExists(const QString &szName);
 
174
protected:
 
175
        int selectedCount();
 
176
        QString nameForAutomaticAction(const QString &szTemplate);
 
177
protected slots:
 
178
        void currentItemChanged(QTreeWidgetItem * it,QTreeWidgetItem *prev);
 
179
        void newAction();
 
180
        void deleteActions();
 
181
        void exportActions();
 
182
};
 
183
 
 
184
 
 
185
class ActionEditorWindow : public KviWindow
 
186
{
 
187
        Q_OBJECT
 
188
public:
 
189
        ActionEditorWindow(KviMainWindow * lpFrm);
 
190
        ~ActionEditorWindow();
 
191
protected:
 
192
        ActionEditor * m_pEditor;
 
193
protected:
 
194
        virtual QPixmap * myIconPtr();
 
195
        virtual void getConfigGroupName(QString &szName);
 
196
        virtual void saveProperties(KviConfigurationFile *);
 
197
        virtual void loadProperties(KviConfigurationFile *);
 
198
protected slots:
 
199
        void cancelClicked();
 
200
        void okClicked();
 
201
        void applyClicked();
 
202
};
 
203
 
 
204
#endif //_ACTIONEDITOR_H_