This repository has been archived on 2020-09-07. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
libs/qad/application/logview.h
Ivan Pelipenko e67c1925b1 version 1.4.0_alpha
add LogView
patch MatrixEdit for old Qt
2020-06-17 22:15:47 +03:00

95 lines
2.1 KiB
C++

/*
QAD - Qt ADvanced
Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LOGVIEW_H
#define LOGVIEW_H
#include <QWidget>
#include <QIcon>
#include <QImage>
#include <QDebug>
#include <QTextBlockFormat>
#include "qad_export.h"
class QTextEdit;
namespace Ui {
class LogView;
}
class QAD_EXPORT LogView: public QWidget
{
Q_OBJECT
Q_PROPERTY(bool filterVisible READ isFilterVisible WRITE setFilterVisible)
Q_PROPERTY(int linesLimit READ linesLimit WRITE setLinesLimit)
Q_PROPERTY(QFont logFont READ logFont WRITE setLogFont)
public:
explicit LogView(QWidget * parent = 0);
~LogView();
const QTextEdit * textEdit() const;
void setLogFont(QFont f);
QFont logFont() const;
bool isFilterVisible() const;
int linesLimit() const;
void registerCategory(const QString & label,
QString keyword = QString(),
const QImage & icon = QImage(),
QColor color = QColor(),
bool bold = false);
void addText(const QString & text, bool insert_newline = true);
private:
struct Category {
Category();
void makeIcon(QSize size, QSize size_icon);
QString label;
QString keyword;
QImage image, icon_image;
QIcon icon;
QColor color;
bool bold;
};
void changeEvent(QEvent * e);
void newLine();
QSize iconImageSize();
Ui::LogView * ui;
QMap<QString, Category> categories; // by keyword
QTextCharFormat def_cf;
public slots:
void setFilterVisible(bool yes);
void setLinesLimit(int l);
void clear();
private slots:
void filter();
signals:
};
#endif // LOGVIEW_H