Rev 23652 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4430 | cbradney | 1 | /* |
2 | For general Scribus (>=1.3.2) copyright and licensing information please refer |
||
3 | to the COPYING file provided with the program. Following this notice may exist |
||
4 | a copyright and/or license notice that predates the release of Scribus 1.3.2 |
||
5 | for which a new license (GPL+exception) is in place. |
||
6 | */ |
||
4521 | subik | 7 | #ifndef FONTPREVIEW_UI_H |
8 | #define FONTPREVIEW_UI_H |
||
288 | Franz | 9 | |
8529 | subik | 10 | #include "ui_fontpreview.h" |
288 | Franz | 11 | |
4521 | subik | 12 | class PrefsContext; |
13 | class SampleItem; |
||
5781 | cbradney | 14 | class ScribusDoc; |
11234 | subik | 15 | class FontListModel; |
9475 | subik | 16 | class QSortFilterProxyModel; |
4521 | subik | 17 | |
18 | |||
19 | /*! \brief Main window for "Font Preview" plugin. It's only gui. |
||
20 | Constructs a FontPreview as a child of 'parent', with the |
||
21 | name 'name' and widget flags set to 'f'. |
||
22 | The dialog will by default be modeless, unless you set 'modal' to |
||
23 | true to construct a modal dialog. |
||
24 | */ |
||
8529 | subik | 25 | class FontPreview : public QDialog, Ui::FontPreview |
3207 | craig | 26 | { |
27 | Q_OBJECT |
||
288 | Franz | 28 | |
4521 | subik | 29 | public: |
30 | /*! \brief Create Font Preview window, |
||
31 | \param fontName Optional name of the font to init/select on start. |
||
32 | */ |
||
23210 | craig | 33 | FontPreview(const QString& fontName = QString(), QWidget* parent = nullptr, ScribusDoc* doc=nullptr); |
4521 | subik | 34 | ~FontPreview(); |
288 | Franz | 35 | |
4521 | subik | 36 | /*! \brief Get the current selected font name. |
37 | \retval QString the font name. */ |
||
38 | QString getCurrentFont(); |
||
39 | |||
40 | protected: |
||
41 | /** \brief Pixmaps for each font type */ |
||
42 | QPixmap ttfFont; |
||
43 | QPixmap otfFont; |
||
44 | QPixmap psFont; |
||
45 | QPixmap okIcon; |
||
46 | //! \brief Default "blue quartz" text |
||
24736 | jghali | 47 | QString m_defaultStr; |
4521 | subik | 48 | /** \brief Configuration structure */ |
24736 | jghali | 49 | PrefsContext* m_prefs { nullptr }; |
4521 | subik | 50 | /*! \brief window size */ |
24736 | jghali | 51 | uint m_xsize { 640 }; |
52 | uint m_ysize { 480 }; |
||
9475 | subik | 53 | |
24736 | jghali | 54 | ScribusDoc* m_Doc { nullptr }; |
55 | |||
4521 | subik | 56 | //! \brief Sample text frame to render the preview |
24736 | jghali | 57 | SampleItem *m_sampleItem { nullptr }; |
4701 | subik | 58 | |
9475 | subik | 59 | //! \brief Store fonts in the Qt4 MVC model part. |
24736 | jghali | 60 | FontListModel * m_fontModel { nullptr }; |
9475 | subik | 61 | |
62 | /*! \brief A model for searching in the font set. |
||
12534 | subik | 63 | see searchEdit_textChanged() for more. */ |
24736 | jghali | 64 | QSortFilterProxyModel * m_proxyModel { nullptr }; |
9475 | subik | 65 | |
4838 | subik | 66 | /*! \brief Create a pixmap sample with font preview. |
9475 | subik | 67 | With GUI oprions. */ |
19104 | jghali | 68 | void paintSample(); |
9475 | subik | 69 | |
4838 | subik | 70 | /*! \brief Check if is there any item in list to prevent crashes. |
71 | It allows not to paint the sample if there could be memory leak. |
||
72 | \retval bool true if you can paint sample safely. */ |
||
73 | bool allowSample(); |
||
9475 | subik | 74 | |
11921 | subik | 75 | //! \brief Paint sample on the dialog opening. |
76 | void showEvent(QShowEvent * event); |
||
77 | void resizeEvent(QResizeEvent * event); |
||
78 | |||
4521 | subik | 79 | protected slots: |
9475 | subik | 80 | /*! \brief Sets the strings of the subwidgets using the current |
81 | language. */ |
||
23652 | craig | 82 | void languageChange(); |
9475 | subik | 83 | |
4521 | subik | 84 | /** \brief Called after each text change. |
9475 | subik | 85 | It calls paintSample(). |
86 | \param s non-used string*/ |
||
4521 | subik | 87 | virtual void searchEdit_textChanged(const QString &s); |
9475 | subik | 88 | |
89 | //! \brief Slot to handle row changes in the table view. |
||
90 | void fontList_currentChanged(const QModelIndex &, const QModelIndex &); |
||
91 | |||
4521 | subik | 92 | //! \brief Setup the preview phrase instead of "blue quartz..." |
93 | void displayButton_clicked(); |
||
9475 | subik | 94 | |
4521 | subik | 95 | //! \brief Reset the sample phrase to the standard "blue quartz" |
96 | void resetDisplayButton_clicked(); |
||
9475 | subik | 97 | |
98 | //! \brief Font size change. |
||
4959 | subik | 99 | void sizeSpin_valueChanged( int ); |
9475 | subik | 100 | |
4521 | subik | 101 | void cancelButton_clicked(); |
11921 | subik | 102 | |
103 | //! \brief Show/hide "advanced" columns in the view |
||
104 | void setExtendedView(bool state); |
||
3207 | craig | 105 | }; |
288 | Franz | 106 | |
4521 | subik | 107 | #endif // FONTPREVIEW_H |
288 | Franz | 108 |