| 1 | // Copyright (C) 2018 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 |
| 3 | |
| 4 | #ifndef MAINWINDOW_H |
| 5 | #define MAINWINDOW_H |
| 6 | |
| 7 | #include <QMainWindow> |
| 8 | #include <QSettings> |
| 9 | |
| 10 | QT_BEGIN_NAMESPACE |
| 11 | |
| 12 | namespace Ui { |
| 13 | class MainWindow; |
| 14 | } |
| 15 | |
| 16 | class QLabel; |
| 17 | class QProgressBar; |
| 18 | class DistanceFieldModel; |
| 19 | class QListWidgetItem; |
| 20 | class MainWindow : public QMainWindow |
| 21 | { |
| 22 | Q_OBJECT |
| 23 | public: |
| 24 | explicit MainWindow(QWidget *parent = 0); |
| 25 | ~MainWindow(); |
| 26 | |
| 27 | void open(const QString &path); |
| 28 | |
| 29 | protected: |
| 30 | void closeEvent(QCloseEvent *event) override; |
| 31 | |
| 32 | private slots: |
| 33 | void openFont(); |
| 34 | void startProgressBar(quint16 glyphCount); |
| 35 | void stopProgressBar(); |
| 36 | void updateProgressBar(); |
| 37 | void selectAll(); |
| 38 | void updateSelection(); |
| 39 | void updateUnicodeRanges(); |
| 40 | void populateUnicodeRanges(); |
| 41 | void save(); |
| 42 | void saveAs(); |
| 43 | void displayError(const QString &errorString); |
| 44 | void selectString(); |
| 45 | void about(); |
| 46 | |
| 47 | private: |
| 48 | void setupConnections(); |
| 49 | void writeFile(); |
| 50 | QByteArray createSfntTable(); |
| 51 | |
| 52 | Ui::MainWindow *ui; |
| 53 | QString m_fontDir; |
| 54 | QString m_fontFile; |
| 55 | QSettings m_settings; |
| 56 | DistanceFieldModel *m_model; |
| 57 | QLabel *m_statusBarLabel; |
| 58 | QProgressBar *m_statusBarProgressBar; |
| 59 | QString m_fileName; |
| 60 | }; |
| 61 | |
| 62 | QT_END_NAMESPACE |
| 63 | |
| 64 | #endif // MAINWINDOW_H |
| 65 | |