1 /***************************************************************************
2 **                                                                        **
3 **  Polyphone, a soundfont editor                                         **
4 **  Copyright (C) 2013-2019 Davy Triponney                                **
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 **           Author: Davy Triponney                                       **
21 **  Website/Contact: https://www.polyphone-soundfonts.com                 **
22 **             Date: 01.01.2013                                           **
23 ***************************************************************************/
24 
25 #ifndef HTMLEDITOR_H
26 #define HTMLEDITOR_H
27 
28 #include <QWidget>
29 class SoundfontDescriptionData;
30 
31 namespace Ui {
32 class HtmlEditor;
33 }
34 
35 class HtmlEditor : public QWidget
36 {
37     Q_OBJECT
38 
39 public:
40     explicit HtmlEditor(QWidget *parent = nullptr);
41     ~HtmlEditor();
42 
43     // Initialize the description
44     void initialize(SoundfontDescriptionData *data);
45 
46     // Get the edited text
47     QString getPlainText();
48 
49 private slots:
50     void on_pushHtml_clicked(bool checked);
51     void on_textEdit_cursorPositionChanged();
52 
53     void setStyleNormal();
54     void setStyleQuote();
55     void setStyleCode();
56     void setStyleHeader1();
57     void setStyleHeader2();
58     void setStyleHeader3();
59     void setStyleHeader4();
60 
61     void on_pushBold_clicked(bool checked);
62     void on_pushItalic_clicked(bool checked);
63     void on_pushUnderline_clicked(bool checked);
64     void on_pushStrikeThrough_clicked(bool checked);
65 
66     void on_pushUl_clicked(bool checked);
67     void on_pushOl_clicked(bool checked);
68     void setAlignLeft();
69     void setAlignCenter();
70     void setAlignRight();
71     void setAlignJustify();
72 
73     void on_pushImage_clicked();
74     void insertImage(QString url);
75     void on_pushVideo_clicked();
76     void insertYouTubeVideo(QString videoId);
77     void insertTable();
78     void insertTable(int rows, int columns);
79     void addRowAbove();
80     void addRowBelow();
81     void addColumnLeft();
82     void addColumnRight();
83     void deleteRow();
84     void deleteColumn();
85     void deleteTable();
86     void link();
87     void link(QString text, QString link);
88     void unlink();
89 
90     void on_pushHr_clicked();
91 
92 private:
93     Ui::HtmlEditor *ui;
94 };
95 
96 #endif // HTMLEDITOR_H
97