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

« back to all changes in this revision

Viewing changes to src/modules/raweditor/RawEditorWindow.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 _RAWEDITOR_H_
 
2
#define _RAWEDITOR_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 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 "KviQString.h"
 
29
#include <QTreeWidget>
 
30
#include "KviIconManager.h"
 
31
 
 
32
#include <QWidget>
 
33
#include <QLineEdit>
 
34
 
 
35
class KviScriptEditor;
 
36
class KviTalPopupMenu;
 
37
 
 
38
class RawTreeWidget : public QTreeWidget
 
39
{
 
40
        public:
 
41
        RawTreeWidget(QWidget *par)
 
42
                : QTreeWidget(par){};
 
43
        void updateItem(QTreeWidgetItem *item)
 
44
        {
 
45
                update(indexFromItem(item,0));
 
46
        };
 
47
        ~RawTreeWidget() {};
 
48
};
 
49
 
 
50
class RawTreeWidgetItem : public QTreeWidgetItem
 
51
{
 
52
public:
 
53
        int m_iIdx;
 
54
public:
 
55
        RawTreeWidgetItem(QTreeWidget * par,int idx,bool bEnabled);
 
56
        ~RawTreeWidgetItem() {};
 
57
public:
 
58
        void setEnabled(bool bEnabled)
 
59
        {
 
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);
 
63
        };
 
64
};
 
65
 
 
66
class RawHandlerTreeWidgetItem : public QTreeWidgetItem
 
67
{
 
68
public:
 
69
        RawHandlerTreeWidgetItem(QTreeWidgetItem * par,const QString & name,const QString & buffer,bool bEnabled)
 
70
        : QTreeWidgetItem(par), m_szBuffer(buffer), m_bEnabled(bEnabled)
 
71
        {
 
72
                setText(0,name);
 
73
                setEnabled(bEnabled);
 
74
        };
 
75
        ~RawHandlerTreeWidgetItem() {};
 
76
public:
 
77
        void setEnabled(bool bEnabled)
 
78
        {
 
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);
 
82
        };
 
83
        QString m_szBuffer;
 
84
        bool   m_bEnabled;
 
85
        void setName(const QString &szName);
 
86
};
 
87
 
 
88
class RawEditorWidget : public QWidget
 
89
{
 
90
        Q_OBJECT
 
91
public:
 
92
        RawEditorWidget(QWidget * par);
 
93
        ~RawEditorWidget();
 
94
public:
 
95
        KviScriptEditor * m_pEditor;
 
96
        RawTreeWidget       * m_pTreeWidget;
 
97
        QLineEdit       * m_pNameEditor;
 
98
        KviTalPopupMenu      * m_pContextPopup;
 
99
        RawHandlerTreeWidgetItem * m_pLastEditedItem;
 
100
        bool              m_bOneTimeSetupDone;
 
101
public:
 
102
        void commit();
 
103
        void saveLastEditedItem();
 
104
        void getUniqueHandlerName(RawTreeWidgetItem *it,QString &buffer);
 
105
        void getExportEventBuffer(QString &szBuffer,RawHandlerTreeWidgetItem * it);
 
106
protected slots:
 
107
        void currentItemChanged(QTreeWidgetItem *it,QTreeWidgetItem *);
 
108
        void customContextMenuRequested(const QPoint &pnt);
 
109
        void toggleCurrentHandlerEnabled();
 
110
        void removeCurrentHandler();
 
111
        void addHandlerForCurrentRaw();
 
112
        void addRaw();
 
113
        void exportAllEvents();
 
114
        void exportCurrentHandler();
 
115
protected:
 
116
        void showEvent(QShowEvent *e);
 
117
private:
 
118
        void oneTimeSetup();
 
119
};
 
120
 
 
121
class RawEditorWindow : public KviWindow
 
122
{
 
123
        Q_OBJECT
 
124
public:
 
125
        RawEditorWindow(KviMainWindow * lpFrm);
 
126
        ~RawEditorWindow();
 
127
protected:
 
128
        RawEditorWidget * m_pEditor;
 
129
protected:
 
130
        virtual QPixmap * myIconPtr();
 
131
        virtual void fillCaptionBuffers();
 
132
        virtual void getConfigGroupName(QString &szName);
 
133
        virtual void saveProperties(KviConfigurationFile *);
 
134
        virtual void loadProperties(KviConfigurationFile *);
 
135
protected slots:
 
136
        void cancelClicked();
 
137
        void okClicked();
 
138
        void applyClicked();
 
139
};
 
140
 
 
141
#endif //_RAWEDITOR_H_