File indexing completed on 2024-05-26 04:59:46
0001 /* 0002 SPDX-FileCopyrightText: 2007-2009 Sergio Pistone <sergio_pistone@yahoo.com.ar> 0003 SPDX-FileCopyrightText: 2010-2022 Mladen Milinkovic <max@smoothware.net> 0004 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 #ifndef TEXTOVERLAYWIDGET_H 0009 #define TEXTOVERLAYWIDGET_H 0010 0011 #include <QWidget> 0012 #include <QFont> 0013 #include <QPen> 0014 #include <QColor> 0015 #include <QImage> 0016 #include <QBitmap> 0017 0018 #include "videoplayer/subtitletextoverlay.h" 0019 0020 QT_FORWARD_DECLARE_CLASS(QTextDocument) 0021 0022 namespace SubtitleComposer { 0023 class TextOverlayWidget : public QWidget 0024 { 0025 Q_OBJECT 0026 0027 public: 0028 TextOverlayWidget(QWidget *parent = 0); 0029 virtual ~TextOverlayWidget(); 0030 0031 QString text() const { return m_overlay.text(); } 0032 0033 int alignment() const { return 0; } 0034 int fontSize() const { return m_overlay.fontSize(); } 0035 QString family() const { return m_overlay.fontFamily(); } 0036 QColor primaryColor() const { return m_overlay.textColor(); } 0037 int outlineWidth() const { return m_overlay.outlineWidth(); } 0038 QColor outlineColor() const { return m_overlay.outlineColor(); } 0039 0040 QSize minimumSizeHint() const override; 0041 QSize sizeHint() const override; 0042 0043 public slots: 0044 void setText(const QString &text) { m_overlay.setText(text); update(); } 0045 void setFontSize(int fontSize) { m_overlay.setFontSize(fontSize); update(); } 0046 void setFamily(const QString &family) { m_overlay.setFontFamily(family); update(); } 0047 void setPrimaryColor(const QColor &color) { m_overlay.setTextColor(color); update(); } 0048 void setOutlineWidth(int width) { m_overlay.setOutlineWidth(width); update(); } 0049 void setOutlineColor(const QColor &color) { m_overlay.setOutlineColor(color); update(); } 0050 0051 protected: 0052 void resizeEvent(QResizeEvent *event) override; 0053 void paintEvent(QPaintEvent *event) override; 0054 0055 private: 0056 mutable SubtitleTextOverlay m_overlay; 0057 }; 0058 } 0059 0060 #endif