KVIrc  4.9.2
DeveloperAPIs
KviMaskEditor.h
Go to the documentation of this file.
1 #ifndef _KVI_MASKEDITOR_H_
2 #define _KVI_MASKEDITOR_H_
3 //=============================================================================
4 //
5 // File : KviMaskEditor.h
6 // Creation date : Tue Aug 30 2000 12:20:10 by Szymon Stefanek
7 //
8 // This file is part of the KVIrc IRC client distribution
9 // Copyright (C) 2000-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 "kvi_settings.h"
28 #include "KviPointerList.h"
29 #include "KviCString.h"
30 #include "KviWindowToolWidget.h"
31 #include "KviIconManager.h"
32 
33 #include <QTreeWidget>
34 #include <QPushButton>
35 #include <QDialog>
36 #include <QLineEdit>
37 #include <QWidget>
38 
39 class KviMaskEditor;
40 class KviChannelWindow;
41 
42 typedef struct _KviMaskEntry
43 {
44  QString szMask;
45  QString szSetBy;
46  unsigned int uSetAt;
47 } KviMaskEntry;
48 
49 class KviMaskItem : public QTreeWidgetItem
50 {
51 public:
52  KviMaskItem(QTreeWidget * parent, KviMaskEntry * entry);
53  ~KviMaskItem();
54 
55  KviMaskEntry * mask() { return &m_Mask; };
56 protected:
58  bool operator<(const QTreeWidgetItem & other) const
59  {
60  // This is the sorting function for KviMaskItem
61  switch(treeWidget()->sortColumn())
62  {
63  case 0:
64  return m_Mask.szMask < ((KviMaskItem *)&other)->mask()->szMask;
65  break;
66  case 1:
67  return m_Mask.szSetBy < ((KviMaskItem *)&other)->mask()->szSetBy;
68  break;
69  case 2:
70  return m_Mask.uSetAt < ((KviMaskItem *)&other)->mask()->uSetAt;
71  break;
72  }
73  return 0; //make compiler happy
74  }
75 };
76 
77 class KviMaskInputDialog : public QDialog
78 {
79  Q_OBJECT
80 public:
81  KviMaskInputDialog(const QString & szMask, KviMaskEditor * pEditor, KviChannelWindow * pChannel);
83 
84 protected:
85  QLineEdit * m_pEdit;
86  QPushButton * m_pOkButton;
87  QPushButton * m_pChancelButton;
88  QString m_szOldMask;
91 protected slots:
92  virtual void accept();
93 };
94 
96 {
97  Q_OBJECT
98 public:
99  KviMaskEditor(QWidget * par, KviChannelWindow * pChannel, KviWindowToolPageButton * button, KviPointerList<KviMaskEntry> * maskList,
100  char cMode, const char * name);
101  ~KviMaskEditor();
102 
103 protected:
105  QTreeWidget * m_pMaskBox;
106  QPushButton * m_pRemoveMask;
107  QPushButton * m_pAddButton;
108  QLineEdit * m_pSearch;
109  char m_cFlag;
111 
112 public:
113  char flag() { return m_cFlag; };
114  void addMask(KviMaskEntry * e);
115  void removeMask(KviMaskEntry * e);
116  void clear();
117 protected slots:
118  void removeClicked();
119  void addClicked();
120  void itemDoubleClicked(QTreeWidgetItem *, int);
121  void searchTextChanged(const QString &);
122  void updateOpStatus();
123 signals:
124  void removeMasks(KviMaskEditor *, KviPointerList<KviMaskEntry> *);
125 };
126 
127 #endif //_KVI_MASKEDITOR_H_
Definition: KviMaskEditor.h:42
char m_cFlag
Definition: KviMaskEditor.h:109
bool operator<(const QTreeWidgetItem &other) const
Definition: KviMaskEditor.h:58
QPushButton * m_pAddButton
Definition: KviMaskEditor.h:107
#define KVIRC_API
Definition: kvi_settings.h:128
KviMaskItem(QTreeWidget *parent, KviMaskEntry *entry)
Definition: KviMaskEditor.cpp:39
Definition: KviMaskEditor.h:49
QString szSetBy
Definition: KviMaskEditor.h:45
unsigned int uSetAt
Definition: KviMaskEditor.h:46
KviMaskInputDialog(const QString &szMask, KviMaskEditor *pEditor, KviChannelWindow *pChannel)
Definition: KviMaskEditor.cpp:67
struct _KviMaskEntry KviMaskEntry
#define e
Definition: detector.cpp:69
QString m_szOldMask
Definition: KviMaskEditor.h:88
btnDict clear()
KviIconManager::SmallIcon m_eIcon
Definition: KviMaskEditor.h:110
Icon manager.
Definition: KviWindowToolWidget.h:36
SmallIcon
Contains all KVIrc's small icons.
Definition: KviIconManager.h:168
QLineEdit * m_pEdit
Definition: KviMaskEditor.h:85
QTreeWidget * m_pMaskBox
Definition: KviMaskEditor.h:105
KviMaskEditor * m_pEditor
Definition: KviMaskEditor.h:90
virtual void accept()
Definition: KviMaskEditor.cpp:99
Definition: KviWindowToolWidget.h:47
QPushButton * m_pRemoveMask
Definition: KviMaskEditor.h:106
char flag()
Definition: KviMaskEditor.h:113
KviMaskEntry m_Mask
Definition: KviMaskEditor.h:55
KviChannelWindow * m_pChannel
Definition: KviMaskEditor.h:89
C++ Template based double linked pointer list class.
A template double linked list of pointers.
Definition: KviPointerList.h:55
Definition: KviMaskEditor.h:95
KviMaskEntry * mask()
Definition: KviMaskEditor.h:55
QPushButton * m_pOkButton
Definition: KviMaskEditor.h:86
QString name()
Definition: KviRuntimeInfo.cpp:655
KviChannelWindow * m_pChannel
Definition: KviMaskEditor.h:104
This file contains compile time settings.
QPushButton * m_pChancelButton
Definition: KviMaskEditor.h:87
QString szMask
Definition: KviMaskEditor.h:44
Definition: KviMaskEditor.h:77
QLineEdit * m_pSearch
Definition: KviMaskEditor.h:108
The class which manages a channel.
Definition: KviChannelWindow.h:113