Olive
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
texteditdialog.h
Go to the documentation of this file.
1 /***
2 
3  Olive - Non-Linear Video Editor
4  Copyright (C) 2019 Olive Team
5 
6  This program is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 
19 ***/
20 
21 #ifndef TEXTEDITDIALOG_H
22 #define TEXTEDITDIALOG_H
23 
24 #include <QDialog>
25 #include <QPlainTextEdit>
26 #include <QFontComboBox>
27 
28 #include "ui/labelslider.h"
29 #include "ui/colorbutton.h"
30 
40 class TextEditDialog : public QDialog {
41  Q_OBJECT
42 public:
62  TextEditDialog(QWidget* parent = nullptr, const QString& s = nullptr, bool rich_text = true);
63 
76  const QString& get_string();
77 private slots:
81  virtual void accept() override;
82 
90  void SetFontWeight(int i);
91 
99 
108  void UpdateUIFromTextCursor();
109 private:
110 
117 
121  QString result_str;
122 
126  QTextEdit* textEdit;
127 
131  QPushButton* italic_button;
132 
136  QPushButton* underline_button;
137 
141  QFontComboBox* font_list;
142 
146  QComboBox* font_weight;
147 
152 
157 
161  QPushButton* left_align_button;
162 
166  QPushButton* center_align_button;
167 
171  QPushButton* right_align_button;
172 
176  QPushButton* justify_align_button;
177 };
178 
179 #endif // TEXTEDITDIALOG_H
QString result_str
Internal storage of text entered, saved when the user clicks OK.
Definition: texteditdialog.h:121
void UpdateUIFromTextCursor()
Slot for when the text edit widget&#39;s cursor moves so the rich text toolbar can stay up to date...
Definition: texteditdialog.cpp:189
Definition: colorbutton.h:28
QFontComboBox * font_list
ComboBox for the list of font families that the selected text can be set to.
Definition: texteditdialog.h:141
QPushButton * right_align_button
Button for setting the current text row(s) to right alignment.
Definition: texteditdialog.h:171
virtual void accept() override
Override of accept() to store the entered text string so it can be retrieved by get_string().
Definition: texteditdialog.cpp:173
The LabelSlider class.
Definition: labelslider.h:33
QPushButton * italic_button
Toggle button for setting the italic state of the currently selected text.
Definition: texteditdialog.h:131
QPushButton * center_align_button
Button for setting the current text row(s) to center alignment.
Definition: texteditdialog.h:166
bool rich_text_
Internal rich text mode value.
Definition: texteditdialog.h:116
QPushButton * underline_button
Toggle button for setting the underlined state of the currently selected text.
Definition: texteditdialog.h:136
TextEditDialog(QWidget *parent=nullptr, const QString &s=nullptr, bool rich_text=true)
TextEditDialog Constructor.
Definition: texteditdialog.cpp:31
QComboBox * font_weight
ComboBox for the list of font weights that the selected text can be set to.
Definition: texteditdialog.h:146
QTextEdit * textEdit
Main text editing widget.
Definition: texteditdialog.h:126
LabelSlider * font_size
A slider to set the current font size.
Definition: texteditdialog.h:151
The TextEditDialog class.
Definition: texteditdialog.h:40
void SetAlignmentFromProperty()
Slot for text alignment buttons to set alignment based on their properties.
Definition: texteditdialog.cpp:183
const QString & get_string()
Retrieve the current text in the dialog.
Definition: texteditdialog.cpp:169
QPushButton * left_align_button
Button for setting the current text row(s) to left alignment.
Definition: texteditdialog.h:161
QPushButton * justify_align_button
Button for setting the current text row(s) to justified alignment.
Definition: texteditdialog.h:176
ColorButton * font_color
A color selector for setting the current text color.
Definition: texteditdialog.h:156
void SetFontWeight(int i)
Slot for the font_weight combobox to set the font weight based on its data value. ...
Definition: texteditdialog.cpp:178