KVIrc 5.2.6
Developer APIs
KviTopicWidget.h
Go to the documentation of this file.
1#ifndef _KVI_TOPICW_H_
2#define _KVI_TOPICW_H_
3//============================================================================
4//
5// File : KviTopicWidget.h
6// Creation date : Fri Aug 4 2000 12:03:12 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 "KviCString.h"
29#include "KviApplication.h"
30#include "KviInputEditor.h"
31#include "KviTalListWidget.h"
33
34#include <QString>
35
38class KviThemedLabel;
39class KviTalHBox;
40class QComboBox;
41class QMenu;
42class QPushButton;
43class QStackedWidget;
44
46{
47 Q_OBJECT
48public:
49 KviTopicListBoxItemDelegate(QAbstractItemView * pWidget = nullptr);
51
52public:
53 QSize sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const;
54 void paint(QPainter * pPainter, const QStyleOptionViewItem & option, const QModelIndex & index) const;
55};
56
58{
59public:
60 KviTopicListBoxItem(KviTalListWidget * pListBox = nullptr, const QString & text = QString());
62
63public:
64 virtual int width(const KviTalListWidget * pList) const;
65};
66
67class KVIRC_API KviTopicWidget : public QWidget
68{
69 Q_OBJECT
70 Q_PROPERTY(int TransparencyCapable READ dummyRead)
71 friend class KviChannelWindow;
72 friend class KviTalListWidget;
73
74public:
75 KviTopicWidget(QWidget * pParent, KviChannelWindow * pChannel, const char * name);
77
78private:
79 QString m_szTopic;
80 QString m_szSetBy;
81 QString m_szSetAt;
82 QPushButton * m_pAccept;
83 QPushButton * m_pDiscard;
84 QPushButton * m_pHistory;
86 QAbstractItemDelegate * m_pItemDelegate;
89 QStackedWidget * m_pLabelAndInputBoxStack;
93
94protected:
96
97private:
98 QChar getSubstituteChar(unsigned short uControlCode);
99
100protected:
101 void updateToolTip();
102 void deactivate();
104 bool eventFilter(QObject * o, QEvent * e) override;
105 void mousePressEvent(QMouseEvent * e) override;
106 void keyPressEvent(QKeyEvent * e) override;
107 void resizeEvent(QResizeEvent * e) override;
108
109public:
110 void insertChar(QChar c);
111 void insertText(const QString & szText);
112 int dummyRead() const { return 0; };
113 void reset();
114
115 void setTopic(const QString & szTopic);
116 void setTopicSetBy(const QString & szSetBy);
117 void setTopicSetAt(const QString & szSetAt);
118
119 const QString & topic() { return m_szTopic; };
120 const QString & topicSetBy() { return m_szSetBy; };
121 const QString & topicSetAt() { return m_szSetAt; };
122 QSize sizeHint() const override;
123 void applyOptions();
124
125 static void paintColoredText(QPainter * p, QString szText, const QPalette & palette, const QRect & rect);
126protected slots:
127 void acceptClicked();
128 void discardClicked();
129 void historyClicked();
130 void contextPopupAboutToShow();
131 void copy();
132 void complete();
133 void popDownListBox();
134 void switchMode();
135signals:
136 void topicSelected(const QString & szTopic);
137};
138
139#endif //_KVI_TOPICW_H_
Input editor.
Class for item delegates.
The class which manages a channel.
Definition KviChannelWindow.h:108
Input editor class.
Definition KviInputEditor.h:84
An abstraction of a connection to an IRC server.
Definition KviIrcConnection.h:97
Toolkit Abstraction Layer: hbox class.
Definition KviTalHBox.h:44
KviTalIconAndRichTextItemDelegate(QAbstractItemView *pWidget=nullptr)
Constructs the icon and rich text item delegate object.
Definition KviTalIconAndRichTextItemDelegate.cpp:34
void paint(QPainter *pPainter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
Paints the view.
Definition KviTalIconAndRichTextItemDelegate.cpp:42
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override
Returns the size hint for the view.
Definition KviTalIconAndRichTextItemDelegate.cpp:98
KviTalListWidgetText(KviTalListWidget *listbox, const QString &text=QString())
Definition KviTalListWidget.cpp:82
Definition KviTalListWidget.h:35
Definition KviThemedLabel.h:34
KviTopicListBoxItemDelegate(QAbstractItemView *pWidget=nullptr)
Definition KviTopicWidget.cpp:62
virtual int width(const KviTalListWidget *pList) const
Definition KviTopicWidget.cpp:95
KviTopicListBoxItem(KviTalListWidget *pListBox=nullptr, const QString &text=QString())
Definition KviTopicWidget.cpp:87
QPushButton * m_pHistory
Definition KviTopicWidget.h:84
int TransparencyCapable
Definition KviTopicWidget.h:70
int dummyRead() const
Definition KviTopicWidget.h:112
QString m_szSetBy
Definition KviTopicWidget.h:80
void mousePressEvent(QMouseEvent *e) override
Definition KviTopicWidget.cpp:562
KviTopicWidget(QWidget *pParent, KviChannelWindow *pChannel, const char *name)
Definition KviTopicWidget.cpp:100
QMenu * m_pContextPopup
Definition KviTopicWidget.h:85
bool eventFilter(QObject *o, QEvent *e) override
Definition KviTopicWidget.cpp:593
KviTalListWidget * m_pCompletionBox
Definition KviTopicWidget.h:91
const QString & topic()
Definition KviTopicWidget.h:119
KviChannelWindow * m_pKviChannelWindow
Definition KviTopicWidget.h:92
void deactivate()
Definition KviTopicWidget.cpp:668
void iconButtonClicked()
QPushButton * m_pAccept
Definition KviTopicWidget.h:82
KviTalHBox * m_pInputBox
Definition KviTopicWidget.h:88
QStackedWidget * m_pLabelAndInputBoxStack
Definition KviTopicWidget.h:89
void updateToolTip()
Definition KviTopicWidget.cpp:447
void keyPressEvent(QKeyEvent *e) override
Definition KviTopicWidget.cpp:657
void insertChar(QChar c)
Definition KviTopicWidget.cpp:719
QString m_szTopic
Definition KviTopicWidget.h:79
QChar getSubstituteChar(unsigned short uControlCode)
Definition KviTopicWidget.cpp:740
KviThemedLabel * m_pLabel
Definition KviTopicWidget.h:87
void topicSelected(const QString &szTopic)
friend class KviTalListWidget
Definition KviTopicWidget.h:72
QPushButton * m_pDiscard
Definition KviTopicWidget.h:83
const QString & topicSetBy()
Definition KviTopicWidget.h:120
void resizeEvent(QResizeEvent *e) override
Definition KviTopicWidget.cpp:663
void insertText(const QString &szText)
Definition KviTopicWidget.cpp:724
int m_iCursorPosition
Definition KviTopicWidget.h:95
KviInputEditor * m_pInput
Definition KviTopicWidget.h:90
QString m_szSetAt
Definition KviTopicWidget.h:81
const QString & topicSetAt()
Definition KviTopicWidget.h:121
friend class KviChannelWindow
Definition KviTopicWidget.h:71
QAbstractItemDelegate * m_pItemDelegate
Definition KviTopicWidget.h:86
#define e
Definition detector.cpp:70
#define o
Definition detector.cpp:80
#define p
Definition detector.cpp:81
This file contains compile time settings.
#define KVIRC_API
Definition kvi_settings.h:127