1 /*********************************************************************** 2 * 3 * Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2019 Graeme Gott <graeme@gottcode.org> 4 * 5 * This program is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, either version 3 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 * 18 ***********************************************************************/ 19 20 #ifndef THEME_DIALOG_H 21 #define THEME_DIALOG_H 22 23 class ColorButton; 24 class FontComboBox; 25 class ImageButton; 26 class Theme; 27 class ThemeRenderer; 28 29 #include <QDialog> 30 #include <QFuture> 31 class QCheckBox; 32 class QComboBox; 33 class QGroupBox; 34 class QLabel; 35 class QLineEdit; 36 class QPushButton; 37 class QSpinBox; 38 39 class ThemeDialog : public QDialog 40 { 41 Q_OBJECT 42 43 public: 44 ThemeDialog(Theme& theme, QWidget* parent = 0); 45 ~ThemeDialog(); 46 47 48 public slots: 49 virtual void accept(); 50 51 protected: 52 virtual void hideEvent(QHideEvent* event); 53 54 private slots: 55 void checkNameAvailable(); 56 void fontChanged(); 57 void imageChanged(); 58 void lineSpacingChanged(int index); 59 void positionChanged(int index); 60 void renderPreview(); 61 void renderText(const QImage& background, const QRect& foreground, const Theme& theme); 62 63 private: 64 void savePreview(); 65 void setValues(Theme& theme); 66 67 private: 68 Theme& m_theme; 69 70 QLineEdit* m_name; 71 QPushButton* m_ok; 72 73 ThemeRenderer* m_theme_renderer; 74 QLabel* m_preview; 75 QImage m_preview_icon; 76 QFuture<QColor> m_load_color; 77 78 ColorButton* m_text_color; 79 FontComboBox* m_font_names; 80 QComboBox* m_font_sizes; 81 ColorButton* m_misspelled_color; 82 83 ColorButton* m_background_color; 84 ImageButton* m_background_image; 85 QPushButton* m_clear_image; 86 QComboBox* m_background_type; 87 88 ColorButton* m_foreground_color; 89 QSpinBox* m_foreground_opacity; 90 QComboBox* m_foreground_position; 91 QSpinBox* m_foreground_width; 92 93 QGroupBox* m_round_corners; 94 QSpinBox* m_corner_radius; 95 96 QGroupBox* m_blur; 97 QSpinBox* m_blur_radius; 98 99 QGroupBox* m_shadow; 100 ColorButton* m_shadow_color; 101 QSpinBox* m_shadow_radius; 102 QSpinBox* m_shadow_offset; 103 104 QSpinBox* m_foreground_margin; 105 QSpinBox* m_foreground_padding; 106 107 QComboBox* m_line_spacing_type; 108 QSpinBox* m_line_spacing; 109 110 QSpinBox* m_tab_width; 111 QSpinBox* m_spacing_above_paragraph; 112 QSpinBox* m_spacing_below_paragraph; 113 QCheckBox* m_indent_first_line; 114 }; 115 116 #endif 117