-
Notifications
You must be signed in to change notification settings - Fork 1
/
multitext.h
82 lines (68 loc) · 2.26 KB
/
multitext.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#ifndef MESSAGEEDITOR_H
#define MESSAGEEDITOR_H
#include <QTextEdit>
#include <QMovie>
#include "message.h"
class MultiText : public QTextEdit
{
Q_OBJECT
public:
MultiText(const Message& msg, QWidget *parent);
MultiText(QWidget *parent);
~MultiText();
void setMessage(const Message& msg);
Message message() const;
void clear();
QStringList pasteImgFilenames(){return m_pasteImgList;}
void setEmoticonsPath(QString path);
public slots:
void insertFace(int idx, bool addImgElement = true);
void insertHuhooFace(int idx, bool addImgElement = true);
void updateFaceFrame(int a);
void copyImage();
void saveImage();
void slotKeyPressed(QKeyEvent *e);
void slotTextChanged();
void textCharFormatChanged(bool bBold, bool bItalic, bool bUnderline, const QString& fontFamily, int fontSize, const QColor& color);
void setCopyAvailable(bool copyAvailable);
signals:
void createDataRequest(QMimeData *ADestination) const;
void canInsertDataRequest(const QMimeData *AData, bool &ACanInsert) const;
void insertDataRequest(const QMimeData *AData, QTextDocument *ADocument) const;
void sendMessage();
void sendFile(const QString &fileName);
public:
virtual QSize sizeHint() const;
virtual QSize minimumSizeHint() const;
protected:
int textHeight(int ALines = 0) const;
QString documentImagePath(QTextCharFormat tcf);
virtual bool canInsertFromMimeData(const QMimeData *ASource) const;
void mouseDoubleClickEvent(QMouseEvent *e);
void contextMenuEvent(QContextMenuEvent *event);
void keyPressEvent(QKeyEvent *e);
void resizeEvent(QResizeEvent * event);
protected slots:
void onTextChanged();
private:
void appendText(const QString& text);
void appendImage(const QString& src);
void appendBaseFace(int idx);
void appendHuhooFace(int idx);
private:
QAction* m_actionCopyImage;
QAction* m_actionSaveIamge;
QAction* m_actionCopy;
QAction* m_actionSelect;
QStringList m_pasteImgList;
QImage m_lastPasteImg;
QFont m_textFont;
QColor m_textColor;
QMap<int, QMovie*> m_facesMap;
bool m_copyAvailable;
QString m_emotionsPath;
QString m_baseFacesPath;
QString m_huhooFacesPath;
Message m_message;
};
#endif // MESSAGEEDITOR_H