[gui] Move error handling into a separate function.
[ttfautohint.git] / frontend / maingui.h
blob468581905fe6ec2d696de802e9e3baf0327439bb
1 // maingui.h
3 // Copyright (C) 2012 by Werner Lemberg.
4 //
5 // This file is part of the ttfautohint library, and may only be used,
6 // modified, and distributed under the terms given in `COPYING'. By
7 // continuing to use, modify, or distribute this file you indicate that you
8 // have read `COPYING' and understand and accept it fully.
9 //
10 // The file `COPYING' mentioned in the previous paragraph is distributed
11 // with the ttfautohint library.
14 #ifndef __MAINGUI_H__
15 #define __MAINGUI_H__
17 #include <QMainWindow>
19 #include <ttfautohint.h>
21 class QAction;
22 class QLabel;
23 class QMenu;
24 class QLineEdit;
25 class QPushButton;
26 class QSpinBox;
27 class QComboBox;
28 class QCheckBox;
29 class QLocale;
30 class QFile;
32 class Main_GUI
33 : public QMainWindow
35 Q_OBJECT
37 public:
38 Main_GUI(int, int, bool, bool, int);
40 protected:
41 void closeEvent(QCloseEvent*);
43 private slots:
44 void about();
45 void browse_input();
46 void browse_output();
47 void check_min();
48 void check_max();
49 void absolute_input();
50 void absolute_output();
51 void check_run();
52 void run();
54 private:
55 int hinting_range_min;
56 int hinting_range_max;
57 int ignore_permissions;
58 int pre_hinting;
59 int latin_fallback;
61 void create_layout();
62 void create_connections();
63 void create_actions();
64 void create_menus();
65 void create_status_bar();
66 void read_settings();
67 void write_settings();
69 int check_filenames(const QString&, const QString&);
70 int open_files(const QString&, FILE**, const QString&, FILE**);
71 void handle_error(TA_Error, const unsigned char*, QString);
73 QMenu* file_menu;
74 QMenu* help_menu;
76 QLineEdit* input_line;
77 QPushButton* input_button;
79 QLineEdit* output_line;
80 QPushButton* output_button;
82 QSpinBox* min_box;
83 QSpinBox* max_box;
85 QComboBox* fallback_box;
87 QCheckBox* pre_box;
88 QCheckBox* ignore_box;
90 QPushButton* run_button;
92 QAction* exit_act;
93 QAction* about_act;
94 QAction* about_Qt_act;
96 QLocale* locale;
99 #endif /* __MAINGUI_H__ */
101 // end of maingui.h