Welcome to mirror list, hosted at ThFree Co, Russian Federation.

RichTextEditor.h « mumble « src - github.com/mumble-voip/mumble.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8829ac1b1c44b73504369f8519c281c36541795d (plain)
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
83
84
85
// Copyright 2005-2016 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.

#ifndef MUMBLE_MUMBLE_RICHTEXTEDITOR_H_
#define MUMBLE_MUMBLE_RICHTEXTEDITOR_H_

#include <QtCore/QtGlobal>
#if QT_VERSION >= 0x050000
# include <QtWidgets/QTextEdit>
#else
# include <QtGui/QTextEdit>
#endif

class LogDocument;

class RichTextHtmlEdit : public QTextEdit {
	private:
		Q_OBJECT
		Q_DISABLE_COPY(RichTextHtmlEdit)
	protected:
		void insertFromMimeData(const QMimeData *source);
	public:
		RichTextHtmlEdit(QWidget *p);
	private:
		LogDocument *m_document;
};

#include "ui_RichTextEditor.h"
#include "ui_RichTextEditorLink.h"


class RichTextEditorLink : public QDialog, Ui::RichTextEditorLink {
	private:
		Q_OBJECT
		Q_DISABLE_COPY(RichTextEditorLink)
	public:
		RichTextEditorLink(const QString &text = QString(), QWidget *p = NULL);
		QString text() const;
};

class RichTextEditor : public QTabWidget, Ui::RichTextEditor {
	private:
		Q_OBJECT
		Q_DISABLE_COPY(RichTextEditor)
	protected:
		bool bModified;
		bool bChanged;
		bool bReadOnly;
		void richToPlain();
		QColor qcColor;
		bool eventFilter(QObject *obj, QEvent *event) Q_DECL_OVERRIDE;
	public:
		RichTextEditor(QWidget *p = NULL);
		QString text();
		bool isModified() const;
	signals:
		/// The accept signal is emitted when Ctrl-Enter is pressed inside the RichTextEditor.
		void accept();
	public slots:
		void setText(const QString &text, bool readonly = false);
		void updateColor(const QColor &);
		void updateActions();
	protected slots:
		void on_qaBold_triggered(bool);
		void on_qaItalic_triggered(bool);
		void on_qaUnderline_triggered(bool);
		void on_qaColor_triggered();
		void on_qaLink_triggered();
		void on_qaImage_triggered();

		void on_qptePlainText_textChanged();
		void on_qteRichText_textChanged();
		void on_qteRichText_cursorPositionChanged();
		void on_qteRichText_currentCharFormatChanged();
		void onCurrentChanged(int);
};

class RichTextImage {
	public:
		static bool isValidImage(const QByteArray &buf, QByteArray &fmt);
};

#endif