KVIrc  4.9.2
DeveloperAPIs
ListWindow.h
Go to the documentation of this file.
1 #ifndef _LISTWINDOW_H_
2 #define _LISTWINDOW_H_
3 //=============================================================================
4 //
5 // File : ListWindow.h
6 // Creation date : Thu Oct 7 2001 13:27:55 CEST by Szymon Stefanek
7 //
8 // This file is part of the KVIrc IRC client distribution
9 // Copyright (C) 2001-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 lists 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 "KviCString.h"
29 #include "KviIrcSocket.h"
30 #include "KviPointerList.h"
31 #include "KviIrcServerParser.h"
32 #include "KviConsoleWindow.h"
33 #include "KviIrcContext.h"
34 #include "KviThemedTreeWidget.h"
35 
36 #include <QToolButton>
37 #include <QLineEdit>
38 #include <QItemDelegate>
39 #include <QMenu>
40 
41 class KviThemedLabel;
42 class KviThemedLineEdit;
43 
44 class ChannelTreeWidgetItemDelegate : public QItemDelegate
45 {
46 public:
47  ChannelTreeWidgetItemDelegate(QTreeWidget * pWidget = 0);
49  void paint(QPainter * pPainter, const QStyleOptionViewItem & option, const QModelIndex & index) const;
50  QSize sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const;
51 };
52 
54 {
55  friend class ChannelTreeWidgetItem;
56  friend class ListWindow;
58 
59 public:
60  ChannelTreeWidgetItemData(const QString & szChan, const QString & szUsers, const QString & szTopic);
62 
63 protected:
64  QString m_szChan;
65  QString m_szUsers;
66  QString m_szTopic;
68 };
69 
70 class ChannelTreeWidgetItem : public QTreeWidgetItem
71 {
72  friend class ListWindow;
73 
74 public:
77 
78 private:
80 
81 public:
82  bool operator<(const QTreeWidgetItem & other) const;
83  inline ChannelTreeWidgetItemData * itemData() { return m_pData; };
84 };
85 
87 {
88  friend class ChannelTreeWidgetItem;
90  Q_OBJECT
91 public:
92  ChannelTreeWidget(QWidget * par, KviWindow * pWindow, const char * name) : KviThemedTreeWidget(par, pWindow, name){};
94  ChannelTreeWidgetItem * itemFromIndex(const QModelIndex & index) const { return (ChannelTreeWidgetItem *)KviThemedTreeWidget::itemFromIndex(index); };
95 };
96 
98 {
99  Q_OBJECT
100 public:
101  ListWindow(KviConsoleWindow * lpConsole);
102  ~ListWindow();
103 
104 protected:
105  QSplitter * m_pVertSplitter;
106  QSplitter * m_pTopSplitter;
109  QToolButton * m_pRequestButton;
111  QToolButton * m_pOpenButton;
112  QToolButton * m_pSaveButton;
114  QTimer * m_pFlushTimer;
116 
117 public: // Methods
118  virtual void control(int iMsg);
119  virtual void processData(KviIrcMessage * pMsg);
120  virtual void die();
121  virtual QSize sizeHint() const;
122 
123 protected:
124  virtual QPixmap * myIconPtr();
125  virtual void fillCaptionBuffers();
126  virtual void applyOptions();
127  virtual void resizeEvent(QResizeEvent * e);
128  virtual void getBaseLogFileName(QString & szBuffer);
129 protected slots:
130  void flush();
131  void itemDoubleClicked(QTreeWidgetItem * it, int);
132  void requestList();
133  void stoplistdownload();
134  void connectionStateChange();
135  void exportList();
136  void importList();
137  void liveSearch(const QString & szText);
138 
139 private:
140  void reset();
141  void endOfList();
142  void startOfList();
143 };
144 
145 #endif //_KVI_LISTWINDOW_H_
QString m_szChan
Definition: ListWindow.h:64
ChannelTreeWidget(QWidget *par, KviWindow *pWindow, const char *name)
Definition: ListWindow.h:92
void flush()
Definition: ListWindow.cpp:546
KviPointerList< ChannelTreeWidgetItemData > * m_pItemList
Definition: ListWindow.h:115
virtual void resizeEvent(QResizeEvent *e)
Definition: ListWindow.cpp:335
Definition: KviConsoleWindow.h:75
~ListWindow()
Definition: ListWindow.cpp:264
QToolButton * m_pSaveButton
Definition: ListWindow.h:112
virtual void die()
Definition: ListWindow.cpp:354
virtual void getBaseLogFileName(QString &szBuffer)
Definition: ListWindow.cpp:275
Definition: ListWindow.h:70
Definition: KviIrcMessage.h:50
QToolButton * m_pOpenButton
Definition: ListWindow.h:111
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
Definition: ListWindow.cpp:106
virtual void applyOptions()
Definition: ListWindow.cpp:582
void itemDoubleClicked(QTreeWidgetItem *it, int)
Definition: ListWindow.cpp:566
Definition: KviThemedLineEdit.h:33
ChannelTreeWidgetItemDelegate(QTreeWidget *pWidget=0)
Definition: ListWindow.cpp:96
virtual QSize sizeHint() const
Definition: ListWindow.cpp:342
QSplitter * m_pVertSplitter
Definition: ListWindow.h:105
ListWindow(KviConsoleWindow *lpConsole)
Definition: ListWindow.cpp:168
Definition: ListWindow.h:86
#define e
Definition: detector.cpp:69
QToolButton * m_pRequestButton
Definition: ListWindow.h:109
void importList()
Definition: ListWindow.cpp:414
QToolButton * m_pStopListDownloadButton
Definition: ListWindow.h:110
ChannelTreeWidgetItem * itemFromIndex(const QModelIndex &index) const
Definition: ListWindow.h:94
virtual QPixmap * myIconPtr()
Definition: ListWindow.cpp:330
virtual void processData(KviIrcMessage *pMsg)
Definition: ListWindow.cpp:506
void endOfList()
Definition: ListWindow.cpp:464
void liveSearch(const QString &szText)
Definition: ListWindow.cpp:487
QString m_szStrippedTopic
Definition: ListWindow.h:67
Definition: ListWindow.h:53
~ChannelTreeWidget()
Definition: ListWindow.h:93
void stoplistdownload()
Definition: ListWindow.cpp:302
virtual void control(int iMsg)
Definition: ListWindow.cpp:443
Definition: KviThemedTreeWidget.h:34
void paint(QPainter *pPainter, const QStyleOptionViewItem &option, const QModelIndex &index) const
Definition: ListWindow.cpp:140
Definition: KviIrcServerParser.h:103
C++ Template based double linked pointer list class.
Base class for all windows in KVIrc.
Definition: KviWindow.h:74
QString m_szTopic
Definition: ListWindow.h:66
KviThemedLineEdit * m_pParamsEdit
Definition: ListWindow.h:108
Lower stack protocol for IRC connection.
ChannelTreeWidgetItem(ChannelTreeWidgetItemData *pData)
Definition: ListWindow.cpp:65
bool operator<(const QTreeWidgetItem &other) const
Definition: ListWindow.cpp:76
Definition: ListWindow.h:44
QTimer * m_pFlushTimer
Definition: ListWindow.h:114
void connectionStateChange()
Definition: ListWindow.cpp:315
ChannelTreeWidgetItemData * m_pData
Definition: ListWindow.h:79
ChannelTreeWidgetItemData(const QString &szChan, const QString &szUsers, const QString &szTopic)
Definition: ListWindow.cpp:55
Definition: KviThemedLabel.h:33
void startOfList()
Definition: ListWindow.cpp:476
QString name()
Definition: KviRuntimeInfo.cpp:655
Contains the KviWindow class.
QSplitter * m_pTopSplitter
Definition: ListWindow.h:106
void exportList()
Definition: ListWindow.cpp:359
ChannelTreeWidgetItemData * itemData()
Definition: ListWindow.h:83
char szBuffer[4096]
Definition: winamp.cpp:77
ChannelTreeWidget * m_pTreeWidget
Definition: ListWindow.h:107
void requestList()
Definition: ListWindow.cpp:280
KviThemedLabel * m_pInfoLabel
Definition: ListWindow.h:113
virtual void fillCaptionBuffers()
Definition: ListWindow.cpp:347
Definition: ListWindow.h:97
QString m_szUsers
Definition: ListWindow.h:65
void reset()
Definition: ListWindow.cpp:459