2017-09-28 21:53:59 +00:00
|
|
|
/* x64dbg RichTextPainter */
|
|
|
|
#ifndef RICHTEXTPAINTER_H
|
|
|
|
#define RICHTEXTPAINTER_H
|
|
|
|
|
|
|
|
#include <QString>
|
2018-02-01 14:51:03 +00:00
|
|
|
#include <QTextDocument>
|
2017-09-28 21:53:59 +00:00
|
|
|
#include <QColor>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
class CachedFontMetrics;
|
|
|
|
class QPainter;
|
|
|
|
|
|
|
|
class RichTextPainter
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
//structures
|
2018-03-21 20:32:32 +00:00
|
|
|
enum CustomRichTextFlags {
|
2017-09-28 21:53:59 +00:00
|
|
|
FlagNone,
|
|
|
|
FlagColor,
|
|
|
|
FlagBackground,
|
|
|
|
FlagAll
|
|
|
|
};
|
|
|
|
|
2018-03-21 20:32:32 +00:00
|
|
|
struct CustomRichText_t {
|
2017-09-28 21:53:59 +00:00
|
|
|
QString text;
|
|
|
|
QColor textColor;
|
|
|
|
QColor textBackground;
|
|
|
|
CustomRichTextFlags flags;
|
2018-01-31 09:17:06 +00:00
|
|
|
bool highlight = false;
|
2017-09-28 21:53:59 +00:00
|
|
|
QColor highlightColor;
|
|
|
|
int highlightWidth = 2;
|
|
|
|
bool highlightConnectPrev = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef std::vector<CustomRichText_t> List;
|
|
|
|
|
|
|
|
//functions
|
2018-03-21 20:32:32 +00:00
|
|
|
static void paintRichText(QPainter *painter, int x, int y, int w, int h, int xinc,
|
|
|
|
const List &richText, CachedFontMetrics *fontMetrics);
|
|
|
|
static void htmlRichText(const List &richText, QString &textHtml, QString &textPlain);
|
2017-12-19 16:00:42 +00:00
|
|
|
|
2018-02-01 14:51:03 +00:00
|
|
|
static List fromTextDocument(const QTextDocument &doc);
|
|
|
|
|
2018-03-21 20:32:32 +00:00
|
|
|
static List cropped(const List &richText, int maxCols, const QString &indicator = nullptr,
|
|
|
|
bool *croppedOut = nullptr);
|
2017-09-28 21:53:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // RICHTEXTPAINTER_H
|