equal
deleted
inserted
replaced
25 #include <QString> |
25 #include <QString> |
26 #include <QGridLayout> |
26 #include <QGridLayout> |
27 #include <QList> |
27 #include <QList> |
28 #include <QPair> |
28 #include <QPair> |
29 #include <QRegExp> |
29 #include <QRegExp> |
|
30 #include <QHash> |
30 |
31 |
31 #include "SDLInteraction.h" |
32 #include "SDLInteraction.h" |
32 |
33 |
33 #include "SmartLineEdit.h" |
34 #include "SmartLineEdit.h" |
34 |
35 |
40 |
41 |
41 /// Class for custom nickname sorting |
42 /// Class for custom nickname sorting |
42 class ListWidgetNickItem : public QListWidgetItem |
43 class ListWidgetNickItem : public QListWidgetItem |
43 { |
44 { |
44 public: |
45 public: |
45 ListWidgetNickItem(const QString& nick, bool isFriend, bool isIgnored); |
46 enum StateFlag { |
46 bool operator<(const QListWidgetItem & other) const; |
47 Ready = Qt::UserRole, |
47 void setFriend(bool isFriend); |
48 ServerAdmin = Qt::UserRole + 1, |
48 void setIgnored(bool isIgnored); |
49 RoomAdmin = Qt::UserRole + 2, |
49 bool isFriend(); |
50 Registered = Qt::UserRole + 3, |
50 bool ignored(); |
51 Friend = Qt::UserRole + 4, |
|
52 Ignore = Qt::UserRole + 5 |
|
53 }; |
|
54 |
|
55 ListWidgetNickItem(const QString & nick, bool isFriend, bool isIgnored); |
|
56 void setData(StateFlag role, const QVariant &value); |
|
57 bool operator<(const QListWidgetItem & other) const; |
51 |
58 |
52 private: |
59 private: |
53 bool aFriend; |
60 QHash<quint32, QIcon> & m_icons(); |
54 bool isIgnored; |
61 void updateIcon(); |
55 }; |
62 }; |
56 |
63 |
57 |
64 |
58 /** |
65 /** |
59 * @brief Chat widget. |
66 * @brief Chat widget. |
71 public: |
78 public: |
72 HWChatWidget(QWidget* parent, QSettings * gameSettings, bool notify); |
79 HWChatWidget(QWidget* parent, QSettings * gameSettings, bool notify); |
73 void loadLists(const QString & nick); |
80 void loadLists(const QString & nick); |
74 void saveLists(const QString & nick); |
81 void saveLists(const QString & nick); |
75 void setIgnoreListKick(bool enabled); ///< automatically kick people on ignore list (if possible) |
82 void setIgnoreListKick(bool enabled); ///< automatically kick people on ignore list (if possible) |
76 void setShowReady(bool s); |
|
77 void setShowFollow(bool enabled); |
83 void setShowFollow(bool enabled); |
78 QStringList ignoreList, friendsList; |
84 QStringList ignoreList, friendsList; |
79 static const QString & styleSheet(); |
85 static const QString & styleSheet(); |
80 void displayError(const QString & message); |
86 void displayError(const QString & message); |
81 void displayNotice(const QString & message); |
87 void displayNotice(const QString & message); |
111 void onServerMessage(const QString& str); |
117 void onServerMessage(const QString& str); |
112 void nickAdded(const QString& nick, bool notifyNick); |
118 void nickAdded(const QString& nick, bool notifyNick); |
113 void nickRemoved(const QString& nick); |
119 void nickRemoved(const QString& nick); |
114 void clear(); |
120 void clear(); |
115 void setReadyStatus(const QString & nick, bool isReady); |
121 void setReadyStatus(const QString & nick, bool isReady); |
|
122 void setAdminStatus(const QString & nick, bool isAdmin); |
|
123 void setRoomMasterStatus(const QString & nick, bool isAdmin); |
|
124 void setRegisteredStatus(const QStringList & nicks, bool isRegistered); |
116 void adminAccess(bool); |
125 void adminAccess(bool); |
117 |
126 |
118 signals: |
127 signals: |
119 void chatLine(const QString& str); |
128 void chatLine(const QString& str); |
120 void kick(const QString & str); |
129 void kick(const QString & str); |
141 QString m_hilightSound; |
150 QString m_hilightSound; |
142 QString m_userNick; |
151 QString m_userNick; |
143 QString m_clickedNick; |
152 QString m_clickedNick; |
144 QList<QRegExp> m_highlights; ///< regular expressions used for highlighting |
153 QList<QRegExp> m_highlights; ///< regular expressions used for highlighting |
145 bool notify; |
154 bool notify; |
146 bool showReady; |
|
147 bool m_autoKickEnabled; |
155 bool m_autoKickEnabled; |
|
156 |
|
157 void setStatus(const QString & nick, ListWidgetNickItem::StateFlag flag, bool status); |
148 |
158 |
149 private slots: |
159 private slots: |
150 void returnPressed(); |
160 void returnPressed(); |
151 void onBan(); |
161 void onBan(); |
152 void onKick(); |
162 void onKick(); |