mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-25 08:03:54 -07:00
context menu for a message sender's name in chat; also display the user level icon next to the name; minor consistency and type-safety changes
This commit is contained in:
parent
f9e0b6fe9e
commit
95cd293b9c
30 changed files with 283 additions and 195 deletions
|
|
@ -5,27 +5,35 @@
|
|||
#include <QTextFragment>
|
||||
#include <QTextCursor>
|
||||
#include <QColor>
|
||||
#include "user_level.h"
|
||||
|
||||
class QTextTable;
|
||||
class QMouseEvent;
|
||||
class UserContextMenu;
|
||||
class TabSupervisor;
|
||||
class TabGame;
|
||||
|
||||
class ChatView : public QTextBrowser {
|
||||
Q_OBJECT;
|
||||
Q_OBJECT
|
||||
protected:
|
||||
const TabSupervisor * const tabSupervisor;
|
||||
TabGame * const game;
|
||||
private:
|
||||
enum HoveredItemType { HoveredNothing, HoveredUrl, HoveredCard, HoveredUser };
|
||||
UserContextMenu *userContextMenu;
|
||||
QString lastSender;
|
||||
bool evenNumber;
|
||||
QString ownName;
|
||||
bool showTimestamps;
|
||||
HoveredItemType hoveredItemType;
|
||||
QString hoveredContent;
|
||||
QTextFragment getFragmentUnderMouse(const QPoint &pos) const;
|
||||
QString getCardNameUnderMouse(QTextFragment frag) const;
|
||||
QString getCardNameUnderMouse(const QPoint &pos) const;
|
||||
QTextCursor prepareBlock(bool same = false);
|
||||
private slots:
|
||||
void openLink(const QUrl &link);
|
||||
public:
|
||||
ChatView(const QString &_ownName, bool _showTimestamps, QWidget *parent = 0);
|
||||
ChatView(const TabSupervisor *_tabSupervisor, TabGame *_game, bool _showTimestamps, QWidget *parent = 0);
|
||||
void appendHtml(const QString &html);
|
||||
void appendMessage(QString sender, QString message, QColor playerColor = QColor(), bool playerBold = false);
|
||||
void appendMessage(QString message, QString sender = QString(), UserLevelFlags userLevel = UserLevelFlags(), bool playerBold = false);
|
||||
protected:
|
||||
void enterEvent(QEvent *event);
|
||||
void leaveEvent(QEvent *event);
|
||||
|
|
@ -33,6 +41,7 @@ protected:
|
|||
void mousePressEvent(QMouseEvent *event);
|
||||
void mouseReleaseEvent(QMouseEvent *event);
|
||||
signals:
|
||||
void openMessageDialog(const QString &userName, bool focus);
|
||||
void cardNameHovered(QString cardName);
|
||||
void showCardInfoPopup(QPoint pos, QString cardName);
|
||||
void deleteCardInfoPopup(QString cardName);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue