| 1 | /**************************************************************************** |
| 2 | ** |
| 3 | ** Copyright (C) 2018 The Qt Company Ltd. |
| 4 | ** Contact: https://www.qt.io/licensing/ |
| 5 | ** |
| 6 | ** This file is part of the tools applications of the Qt Toolkit. |
| 7 | ** |
| 8 | ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ |
| 9 | ** Commercial License Usage |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in |
| 11 | ** accordance with the commercial license agreement provided with the |
| 12 | ** Software or, alternatively, in accordance with the terms contained in |
| 13 | ** a written agreement between you and The Qt Company. For licensing terms |
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
| 15 | ** information use the contact form at https://www.qt.io/contact-us. |
| 16 | ** |
| 17 | ** GNU General Public License Usage |
| 18 | ** Alternatively, this file may be used under the terms of the GNU |
| 19 | ** General Public License version 3 as published by the Free Software |
| 20 | ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT |
| 21 | ** included in the packaging of this file. Please review the following |
| 22 | ** information to ensure the GNU General Public License requirements will |
| 23 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. |
| 24 | ** |
| 25 | ** $QT_END_LICENSE$ |
| 26 | ** |
| 27 | ****************************************************************************/ |
| 28 | |
| 29 | #ifndef MAINWINDOW_H |
| 30 | #define MAINWINDOW_H |
| 31 | |
| 32 | #include <QMainWindow> |
| 33 | #include <QSettings> |
| 34 | |
| 35 | QT_BEGIN_NAMESPACE |
| 36 | |
| 37 | namespace Ui { |
| 38 | class MainWindow; |
| 39 | } |
| 40 | |
| 41 | class QLabel; |
| 42 | class QProgressBar; |
| 43 | class DistanceFieldModel; |
| 44 | class QListWidgetItem; |
| 45 | class MainWindow : public QMainWindow |
| 46 | { |
| 47 | Q_OBJECT |
| 48 | public: |
| 49 | explicit MainWindow(QWidget *parent = 0); |
| 50 | ~MainWindow(); |
| 51 | |
| 52 | void open(const QString &path); |
| 53 | |
| 54 | protected: |
| 55 | void closeEvent(QCloseEvent *event) override; |
| 56 | |
| 57 | private slots: |
| 58 | void openFont(); |
| 59 | void startProgressBar(quint16 glyphCount); |
| 60 | void stopProgressBar(); |
| 61 | void updateProgressBar(); |
| 62 | void selectAll(); |
| 63 | void updateSelection(); |
| 64 | void updateUnicodeRanges(); |
| 65 | void populateUnicodeRanges(); |
| 66 | void save(); |
| 67 | void saveAs(); |
| 68 | void displayError(const QString &errorString); |
| 69 | void selectString(); |
| 70 | void about(); |
| 71 | |
| 72 | private: |
| 73 | void setupConnections(); |
| 74 | void writeFile(); |
| 75 | QByteArray createSfntTable(); |
| 76 | |
| 77 | Ui::MainWindow *ui; |
| 78 | QString m_fontDir; |
| 79 | QString m_fontFile; |
| 80 | QSettings m_settings; |
| 81 | DistanceFieldModel *m_model; |
| 82 | QLabel *m_statusBarLabel; |
| 83 | QProgressBar *m_statusBarProgressBar; |
| 84 | QString m_fileName; |
| 85 | }; |
| 86 | |
| 87 | QT_END_NAMESPACE |
| 88 | |
| 89 | #endif // MAINWINDOW_H |
| 90 | |