s/lower_upper/upper_lower/.
[ttfautohint.git] / frontend / maingui.cpp
blob11404f786a1e3c0b630619bc0e6f46899a66dabd
1 // maingui.cpp
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 #include <config.h>
16 #include <string.h>
17 #include <stdio.h>
18 #include <errno.h>
20 #include <QtGui>
22 #include "info.h"
23 #include "maingui.h"
25 #include <ttfautohint.h>
28 // XXX Qt 4.8 bug: locale->quoteString("foo")
29 // inserts wrongly encoded quote characters
30 // into rich text QString
31 #if HAVE_QT_QUOTESTRING
32 # define QUOTE_STRING(x) locale->quoteString(x)
33 # define QUOTE_STRING_LITERAL(x) locale->quoteString(x)
34 #else
35 # define QUOTE_STRING(x) "\"" + x + "\""
36 # define QUOTE_STRING_LITERAL(x) "\"" x "\""
37 #endif
40 Main_GUI::Main_GUI(int range_min,
41 int range_max,
42 int limit,
43 bool ignore,
44 bool pre,
45 bool increase,
46 bool no,
47 int fallback,
48 bool symb)
49 : hinting_range_min(range_min),
50 hinting_range_max(range_max),
51 hinting_limit(limit),
52 ignore_permissions(ignore),
53 pre_hinting(pre),
54 increase_x_height(increase),
55 no_info(no),
56 latin_fallback(fallback),
57 symbol(symb)
59 create_layout();
60 create_connections();
61 create_actions();
62 create_menus();
63 create_status_bar();
65 read_settings();
67 setUnifiedTitleAndToolBarOnMac(true);
69 // XXX register translations somewhere and loop over them
70 if (QLocale::system().name() == "en_US")
71 locale = new QLocale;
72 else
73 locale = new QLocale(QLocale::C);
77 // overloading
79 void
80 Main_GUI::closeEvent(QCloseEvent* event)
82 write_settings();
83 event->accept();
87 void
88 Main_GUI::about()
90 QMessageBox::about(this,
91 tr("About TTFautohint"),
92 tr("<p>This is <b>TTFautohint</b> version %1<br>"
93 " Copyright %2 2011-2012<br>"
94 " by Werner Lemberg <tt>&lt;wl@gnu.org&gt;</tt></p>"
96 "<p><b>TTFautohint</b> adds new auto-generated hints"
97 " to a TrueType font or TrueType collection.</p>"
99 "<p>License:"
100 " <a href='http://www.freetype.org/FTL.TXT'>FreeType"
101 " License (FTL)</a> or"
102 " <a href='http://www.freetype.org/GPL.TXT'>GNU"
103 " GPLv2</a></p>")
104 .arg(VERSION)
105 .arg(QChar(0xA9)));
109 void
110 Main_GUI::browse_input()
112 // XXX remember last directory
113 QString file = QFileDialog::getOpenFileName(
114 this,
115 tr("Open Input File"),
116 QDir::homePath(),
117 "");
118 if (!file.isEmpty())
119 input_line->setText(QDir::toNativeSeparators(file));
123 void
124 Main_GUI::browse_output()
126 // XXX remember last directory
127 QString file = QFileDialog::getSaveFileName(
128 this,
129 tr("Open Output File"),
130 QDir::homePath(),
131 "");
133 if (!file.isEmpty())
134 output_line->setText(QDir::toNativeSeparators(file));
138 void
139 Main_GUI::check_min()
141 int min = min_box->value();
142 int max = max_box->value();
143 int limit = limit_box->value();
144 if (min > max)
145 max_box->setValue(min);
146 if (min > limit)
147 limit_box->setValue(min);
151 void
152 Main_GUI::check_max()
154 int min = min_box->value();
155 int max = max_box->value();
156 int limit = limit_box->value();
157 if (max < min)
158 min_box->setValue(max);
159 if (max > limit)
160 limit_box->setValue(max);
164 void
165 Main_GUI::check_limit()
167 int min = min_box->value();
168 int max = max_box->value();
169 int limit = limit_box->value();
170 if (limit < max)
171 max_box->setValue(limit);
172 if (limit < min)
173 min_box->setValue(limit);
177 void
178 Main_GUI::check_no_limit()
180 if (no_limit_box->isChecked())
182 limit_label->setEnabled(false);
183 limit_box->setEnabled(false);
185 else
187 limit_label->setEnabled(true);
188 limit_box->setEnabled(true);
193 void
194 Main_GUI::check_run()
196 if (input_line->text().isEmpty() || output_line->text().isEmpty())
197 run_button->setEnabled(false);
198 else
199 run_button->setEnabled(true);
203 void
204 Main_GUI::absolute_input()
206 QString input_name = QDir::fromNativeSeparators(input_line->text());
207 if (!input_name.isEmpty()
208 && QDir::isRelativePath(input_name))
210 QDir cur_path(QDir::currentPath() + "/" + input_name);
211 input_line->setText(QDir::toNativeSeparators(cur_path.absolutePath()));
216 void
217 Main_GUI::absolute_output()
219 QString output_name = QDir::fromNativeSeparators(output_line->text());
220 if (!output_name.isEmpty()
221 && QDir::isRelativePath(output_name))
223 QDir cur_path(QDir::currentPath() + "/" + output_name);
224 output_line->setText(QDir::toNativeSeparators(cur_path.absolutePath()));
230 Main_GUI::check_filenames(const QString& input_name,
231 const QString& output_name)
233 if (!QFile::exists(input_name))
235 QMessageBox::warning(
236 this,
237 "TTFautohint",
238 tr("The file %1 cannot be found.")
239 .arg(QUOTE_STRING(QDir::toNativeSeparators(input_name))),
240 QMessageBox::Ok,
241 QMessageBox::Ok);
242 return 0;
245 if (input_name == output_name)
247 QMessageBox::warning(
248 this,
249 "TTFautohint",
250 tr("Input and output file names must be different."),
251 QMessageBox::Ok,
252 QMessageBox::Ok);
253 return 0;
256 if (QFile::exists(output_name))
258 int ret = QMessageBox::warning(
259 this,
260 "TTFautohint",
261 tr("The file %1 already exists.\n"
262 "Overwrite?")
263 .arg(QUOTE_STRING(QDir::toNativeSeparators(output_name))),
264 QMessageBox::Yes | QMessageBox::No,
265 QMessageBox::No);
266 if (ret == QMessageBox::No)
267 return 0;
270 return 1;
275 Main_GUI::open_files(const QString& input_name,
276 FILE** in,
277 const QString& output_name,
278 FILE** out)
280 const int buf_len = 1024;
281 char buf[buf_len];
283 *in = fopen(qPrintable(input_name), "rb");
284 if (!*in)
286 strerror_r(errno, buf, buf_len);
287 QMessageBox::warning(
288 this,
289 "TTFautohint",
290 tr("The following error occurred while opening input file %1:\n")
291 .arg(QUOTE_STRING(QDir::toNativeSeparators(input_name)))
292 + QString::fromLocal8Bit(buf),
293 QMessageBox::Ok,
294 QMessageBox::Ok);
295 return 0;
298 *out = fopen(qPrintable(output_name), "wb");
299 if (!*out)
301 strerror_r(errno, buf, buf_len);
302 QMessageBox::warning(
303 this,
304 "TTFautohint",
305 tr("The following error occurred while opening output file %1:\n")
306 .arg(QUOTE_STRING(QDir::toNativeSeparators(output_name)))
307 + QString::fromLocal8Bit(buf),
308 QMessageBox::Ok,
309 QMessageBox::Ok);
310 return 0;
313 return 1;
317 extern "C" {
319 struct GUI_Progress_Data
321 long last_sfnt;
322 bool begin;
323 QProgressDialog* dialog;
328 gui_progress(long curr_idx,
329 long num_glyphs,
330 long curr_sfnt,
331 long num_sfnts,
332 void* user)
334 GUI_Progress_Data* data = (GUI_Progress_Data*)user;
336 if (num_sfnts > 1 && curr_sfnt != data->last_sfnt)
338 data->dialog->setLabelText(QCoreApplication::translate(
339 "GuiProgress",
340 "Auto-hinting subfont %1 of %2"
341 " with %3 glyphs...")
342 .arg(curr_sfnt + 1)
343 .arg(num_sfnts)
344 .arg(num_glyphs));
346 if (curr_sfnt + 1 == num_sfnts)
348 data->dialog->setAutoReset(true);
349 data->dialog->setAutoClose(true);
351 else
353 data->dialog->setAutoReset(false);
354 data->dialog->setAutoClose(false);
357 data->last_sfnt = curr_sfnt;
358 data->begin = true;
361 if (data->begin)
363 if (num_sfnts == 1)
364 data->dialog->setLabelText(QCoreApplication::translate(
365 "GuiProgress",
366 "Auto-hinting %1 glyphs...")
367 .arg(num_glyphs));
368 data->dialog->setMaximum(num_glyphs - 1);
370 data->begin = false;
373 data->dialog->setValue(curr_idx);
375 if (data->dialog->wasCanceled())
376 return 1;
378 return 0;
381 } // extern "C"
384 // return value 1 indicates a retry
387 Main_GUI::handle_error(TA_Error error,
388 const unsigned char* error_string,
389 QString output_name)
391 int ret = 0;
393 if (error == TA_Err_Canceled)
395 else if (error == TA_Err_Invalid_FreeType_Version)
396 QMessageBox::critical(
397 this,
398 "TTFautohint",
399 tr("FreeType version 2.4.5 or higher is needed.\n"
400 "Are you perhaps using a wrong FreeType DLL?"),
401 QMessageBox::Ok,
402 QMessageBox::Ok);
403 else if (error == TA_Err_Already_Processed)
404 QMessageBox::warning(
405 this,
406 "TTFautohint",
407 tr("This font has already been processed by ttfautohint."),
408 QMessageBox::Ok,
409 QMessageBox::Ok);
410 else if (error == TA_Err_Missing_Legal_Permission)
412 int yesno = QMessageBox::warning(
413 this,
414 "TTFautohint",
415 tr("Bit 1 in the %1 field of the %2 table is set:"
416 " This font must not be modified"
417 " without permission of the legal owner.\n"
418 "Do you have such a permission?")
419 .arg(QUOTE_STRING_LITERAL("fsType"))
420 .arg(QUOTE_STRING_LITERAL("OS/2")),
421 QMessageBox::Yes | QMessageBox::No,
422 QMessageBox::No);
423 if (yesno == QMessageBox::Yes)
425 ignore_permissions = true;
426 ret = 1;
429 else if (error == TA_Err_Missing_Unicode_CMap)
430 QMessageBox::warning(
431 this,
432 "TTFautohint",
433 tr("No Unicode character map."),
434 QMessageBox::Ok,
435 QMessageBox::Ok);
436 else if (error == TA_Err_Missing_Glyph)
437 QMessageBox::warning(
438 this,
439 "TTFautohint",
440 tr("No glyph for the key character"
441 " to derive standard stem width and height.\n"
442 "For the latin script, this key character is %1 (U+006F).\n"
443 "\n"
444 "Set the %2 checkbox if you want to circumvent this test.")
445 .arg(QUOTE_STRING_LITERAL("o"))
446 .arg(QUOTE_STRING_LITERAL("symbol")),
447 QMessageBox::Ok,
448 QMessageBox::Ok);
449 else
450 QMessageBox::warning(
451 this,
452 "TTFautohint",
453 tr("Error code 0x%1 while autohinting font:\n")
454 .arg(error, 2, 16, QLatin1Char('0'))
455 + QString::fromLocal8Bit((const char*)error_string),
456 QMessageBox::Ok,
457 QMessageBox::Ok);
459 if (QFile::exists(output_name) && remove(qPrintable(output_name)))
461 const int buf_len = 1024;
462 char buf[buf_len];
464 strerror_r(errno, buf, buf_len);
465 QMessageBox::warning(
466 this,
467 "TTFautohint",
468 tr("The following error occurred while removing output file %1:\n")
469 .arg(QUOTE_STRING(QDir::toNativeSeparators(output_name)))
470 + QString::fromLocal8Bit(buf),
471 QMessageBox::Ok,
472 QMessageBox::Ok);
475 return ret;
479 void
480 Main_GUI::run()
482 statusBar()->clearMessage();
484 QString input_name = QDir::fromNativeSeparators(input_line->text());
485 QString output_name = QDir::fromNativeSeparators(output_line->text());
486 if (!check_filenames(input_name, output_name))
487 return;
489 // we need C file descriptors for communication with TTF_autohint
490 FILE* input;
491 FILE* output;
493 again:
494 if (!open_files(input_name, &input, output_name, &output))
495 return;
497 unsigned char version_data[128];
498 unsigned char version_data_wide[256];
500 QProgressDialog dialog;
501 dialog.setCancelButtonText(tr("Cancel"));
502 dialog.setMinimumDuration(1000);
503 dialog.setWindowModality(Qt::WindowModal);
505 const unsigned char* error_string;
506 TA_Info_Func info_func = info;
507 GUI_Progress_Data gui_progress_data = {-1, true, &dialog};
508 Info_Data info_data;
510 info_data.data = version_data;
511 info_data.data_wide = version_data_wide;
513 info_data.hinting_range_min = min_box->value();
514 info_data.hinting_range_max = max_box->value();
515 info_data.hinting_limit = no_limit_box->isChecked() ? 0
516 : limit_box->value();
518 info_data.pre_hinting = pre_box->isChecked();
519 info_data.increase_x_height = increase_box->isChecked();
520 info_data.latin_fallback = fallback_box->currentIndex();
521 info_data.symbol = symbol_box->isChecked();
523 if (info_box->isChecked())
524 build_version_string(&info_data);
525 else
526 info_func = NULL;
528 TA_Error error =
529 TTF_autohint("in-file, out-file,"
530 "hinting-range-min, hinting-range-max,"
531 "hinting-limit,"
532 "error-string,"
533 "progress-callback, progress-callback-data,"
534 "info-callback, info-callback-data,"
535 "ignore-permissions,"
536 "pre-hinting, increase-x-height,"
537 "fallback-script, symbol",
538 input, output,
539 info_data.hinting_range_min, info_data.hinting_range_max,
540 info_data.hinting_limit,
541 &error_string,
542 gui_progress, &gui_progress_data,
543 info_func, &info_data,
544 ignore_permissions,
545 info_data.pre_hinting, info_data.increase_x_height,
546 info_data.latin_fallback, info_data.symbol);
548 fclose(input);
549 fclose(output);
551 if (error)
553 if (handle_error(error, error_string, output_name))
554 goto again;
556 else
557 statusBar()->showMessage(tr("Auto-hinting finished."));
561 void
562 Main_GUI::create_layout()
564 // file stuff
565 QCompleter* completer = new QCompleter(this);
566 QFileSystemModel* model = new QFileSystemModel(completer);
567 model->setRootPath(QDir::rootPath());
568 completer->setModel(model);
570 QLabel* input_label = new QLabel(tr("&Input File:"));
571 input_line = new QLineEdit;
572 input_button = new QPushButton(tr("Browse..."));
573 input_label->setBuddy(input_line);
574 // enforce rich text to get nice word wrapping
575 input_label->setToolTip(
576 tr("<b></b>The input file, either a TrueType font (TTF),"
577 " TrueType collection (TTC), or a TrueType-based OpenType font."));
578 input_line->setCompleter(completer);
580 QLabel* output_label = new QLabel(tr("&Output File:"));
581 output_line = new QLineEdit;
582 output_button = new QPushButton(tr("Browse..."));
583 output_label->setBuddy(output_line);
584 output_label->setToolTip(
585 tr("<b></b>The output file, which will be essentially identical"
586 " to the input font but contains new, generated hints."));
587 output_line->setCompleter(completer);
589 QGridLayout* file_layout = new QGridLayout;
590 file_layout->addWidget(input_label, 0, 0);
591 file_layout->addWidget(input_line, 0, 1);
592 file_layout->addWidget(input_button, 0, 2);
593 file_layout->addWidget(output_label, 1, 0);
594 file_layout->addWidget(output_line, 1, 1);
595 file_layout->addWidget(output_button, 1, 2);
597 // minmax controls
598 QLabel* min_label = new QLabel(tr("Mi&nimum:"));
599 min_box = new QSpinBox;
600 min_label->setBuddy(min_box);
601 min_box->setKeyboardTracking(false);
602 min_box->setRange(2, 10000);
603 min_box->setValue(hinting_range_min);
605 QLabel* max_label = new QLabel(tr("Ma&ximum:"));
606 max_box = new QSpinBox;
607 max_label->setBuddy(max_box);
608 max_box->setKeyboardTracking(false);
609 max_box->setRange(2, 10000);
610 max_box->setValue(hinting_range_max);
612 QGridLayout* minmax_layout = new QGridLayout;
613 minmax_layout->addWidget(min_label, 0, 0);
614 minmax_layout->addWidget(min_box, 0, 1);
615 minmax_layout->addWidget(max_label, 1, 0);
616 minmax_layout->addWidget(max_box, 1, 1);
618 // hinting and fallback controls
619 QLabel* hinting_label = new QLabel(tr("Hint Set Range") + " ");
620 QLabel* fallback_label = new QLabel(tr("Fallback &Script:"));
621 hinting_label->setToolTip(
622 tr("The PPEM range for which <b>TTFautohint</b> computes"
623 " <i>hint sets</i>."
624 " A hint set for a given PPEM value hints this size optimally."
625 " The larger the range, the more hint sets are considered,"
626 " usually increasing the size of the bytecode.<br>"
627 "Note that changing this range doesn't influence"
628 " the <i>gasp</i> table:"
629 " Hinting is enabled for all sizes."));
630 fallback_box = new QComboBox;
631 fallback_label->setBuddy(fallback_box);
632 fallback_label->setToolTip(
633 tr("This sets the fallback script module for glyphs"
634 " which <b>TTFautohint</b> can't map to a script automatically."));
635 fallback_box->insertItem(0, tr("None"));
636 fallback_box->insertItem(1, tr("Latin"));
637 fallback_box->setCurrentIndex(latin_fallback);
639 QHBoxLayout* hint_fallback_layout = new QHBoxLayout;
640 hint_fallback_layout->addWidget(hinting_label);
641 hint_fallback_layout->addLayout(minmax_layout);
642 hint_fallback_layout->addStretch(1);
643 hint_fallback_layout->addWidget(fallback_label);
644 hint_fallback_layout->addWidget(fallback_box);
645 hint_fallback_layout->addStretch(2);
647 // hinting limit
648 limit_label = new QLabel(tr("Hinting &Limit:"));
649 limit_box = new QSpinBox;
650 limit_label->setBuddy(limit_box);
651 limit_label->setToolTip(
652 tr("Make <b>TTFautohint</b> add bytecode to the output font so that"
653 " sizes larger than this PPEM value are not hinted"
654 " (regardless of the values in the <i>gasp</i> table)."));
655 limit_box->setKeyboardTracking(false);
656 limit_box->setRange(2, 10000);
657 limit_box->setValue(hinting_limit ? hinting_limit : hinting_range_max);
659 no_limit_box = new QCheckBox(tr("No Hinting Limi&t"), this);
660 no_limit_box->setToolTip(
661 tr("If switched on, <b>TTFautohint</b> adds no hinting limit"
662 " to the bytecode."));
664 QHBoxLayout* limit_layout = new QHBoxLayout;
665 limit_layout->addWidget(limit_label);
666 limit_layout->addWidget(limit_box);
667 limit_layout->addStretch(1);
668 limit_layout->addWidget(no_limit_box);
669 limit_layout->addStretch(2);
671 // handle command line option `--hinting-limit=0'
672 if (!hinting_limit)
674 hinting_limit = max_box->value();
675 no_limit_box->setChecked(true);
678 check_min();
679 check_max();
680 check_limit();
681 check_no_limit();
683 // flags
684 pre_box = new QCheckBox(tr("Pr&e-hinting"), this);
685 pre_box->setToolTip(
686 tr("If switched on, the original bytecode of the input font"
687 " gets applied before <b>TTFautohint</b> starts processing"
688 " the outlines of the glyphs."));
689 if (pre_hinting)
690 pre_box->setChecked(true);
691 increase_box = new QCheckBox(tr("In&crease x-height"), this);
692 increase_box->setToolTip(
693 tr("For PPEM values in the range 5&nbsp;&lt; PPEM &lt;&nbsp;15,"
694 " round up the font's x&nbsp;height much more often than normally"
695 " if switched on.<br>"
696 "Use this if holes in letters like <i>e</i> get filled,"
697 " for example."));
698 if (increase_x_height)
699 increase_box->setChecked(true);
700 symbol_box = new QCheckBox(tr("S&ymbol Font"), this);
701 symbol_box->setToolTip(
702 tr("If switched on, <b>ttfautohint</b> uses default values"
703 " for standard stem width and height"
704 " instead of deriving these values from the input font.<br>"
705 "Use this for fonts which don't contain glyphs"
706 " of a (supported) script."));
707 if (symbol)
708 symbol_box->setChecked(true);
710 QHBoxLayout* flags_layout = new QHBoxLayout;
711 flags_layout->addWidget(pre_box);
712 flags_layout->addStretch(1);
713 flags_layout->addWidget(increase_box);
714 flags_layout->addStretch(1);
715 flags_layout->addWidget(symbol_box);
716 flags_layout->addStretch(1);
718 // info
719 info_box = new QCheckBox(tr("add ttf&autohint info"), this);
720 info_box->setToolTip(
721 tr("If switched on, information about <b>ttfautohint</b>"
722 " and its calling parameters are added to the version string(s)"
723 " (name ID&nbsp;5) in the <i>name</i> table."));
724 if (!no_info)
725 info_box->setChecked(true);
727 QHBoxLayout* info_layout = new QHBoxLayout;
728 info_layout->addWidget(info_box);
730 // running
731 run_button = new QPushButton(tr("&Run"));
732 run_button->setEnabled(false);
734 QHBoxLayout* running_layout = new QHBoxLayout;
735 running_layout->addStretch(1);
736 running_layout->addWidget(run_button);
737 running_layout->addStretch(1);
739 // the whole gui
740 QVBoxLayout* gui_layout = new QVBoxLayout;
741 gui_layout->addSpacing(10); // XXX urgh, pixels...
742 gui_layout->addLayout(file_layout);
743 gui_layout->addSpacing(20); // XXX urgh, pixels...
744 gui_layout->addLayout(hint_fallback_layout);
745 gui_layout->addSpacing(20); // XXX urgh, pixels...
746 gui_layout->addLayout(limit_layout);
747 gui_layout->addSpacing(20); // XXX urgh, pixels...
748 gui_layout->addLayout(flags_layout);
749 gui_layout->addSpacing(20); // XXX urgh, pixels...
750 gui_layout->addLayout(info_layout);
751 gui_layout->addSpacing(20); // XXX urgh, pixels...
752 gui_layout->addLayout(running_layout);
753 gui_layout->addSpacing(10); // XXX urgh, pixels...
755 // create dummy widget to register layout
756 QWidget* main_widget = new QWidget;
757 main_widget->setLayout(gui_layout);
758 setCentralWidget(main_widget);
759 setWindowTitle("TTFautohint");
763 void
764 Main_GUI::create_connections()
766 connect(input_button, SIGNAL(clicked()), this,
767 SLOT(browse_input()));
768 connect(output_button, SIGNAL(clicked()), this,
769 SLOT(browse_output()));
771 connect(input_line, SIGNAL(textChanged(QString)), this,
772 SLOT(check_run()));
773 connect(output_line, SIGNAL(textChanged(QString)), this,
774 SLOT(check_run()));
776 connect(input_line, SIGNAL(editingFinished()), this,
777 SLOT(absolute_input()));
778 connect(output_line, SIGNAL(editingFinished()), this,
779 SLOT(absolute_output()));
781 connect(min_box, SIGNAL(valueChanged(int)), this,
782 SLOT(check_min()));
783 connect(max_box, SIGNAL(valueChanged(int)), this,
784 SLOT(check_max()));
786 connect(limit_box, SIGNAL(valueChanged(int)), this,
787 SLOT(check_limit()));
788 connect(no_limit_box, SIGNAL(clicked()), this,
789 SLOT(check_no_limit()));
791 connect(run_button, SIGNAL(clicked()), this,
792 SLOT(run()));
796 void
797 Main_GUI::create_actions()
799 exit_act = new QAction(tr("E&xit"), this);
800 exit_act->setShortcuts(QKeySequence::Quit);
801 connect(exit_act, SIGNAL(triggered()), this, SLOT(close()));
803 about_act = new QAction(tr("&About"), this);
804 connect(about_act, SIGNAL(triggered()), this, SLOT(about()));
806 about_Qt_act = new QAction(tr("About &Qt"), this);
807 connect(about_Qt_act, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
811 void
812 Main_GUI::create_menus()
814 file_menu = menuBar()->addMenu(tr("&File"));
815 file_menu->addAction(exit_act);
817 help_menu = menuBar()->addMenu(tr("&Help"));
818 help_menu->addAction(about_act);
819 help_menu->addAction(about_Qt_act);
823 void
824 Main_GUI::create_status_bar()
826 statusBar()->showMessage("");
830 void
831 Main_GUI::read_settings()
833 QSettings settings;
834 // QPoint pos = settings.value("pos", QPoint(200, 200)).toPoint();
835 // QSize size = settings.value("size", QSize(400, 400)).toSize();
836 // resize(size);
837 // move(pos);
841 void
842 Main_GUI::write_settings()
844 QSettings settings;
845 // settings.setValue("pos", pos());
846 // settings.setValue("size", size());
849 // end of maingui.cpp