Mercurial > octave
annotate libgui/src/welcome-wizard.cc @ 17611:0dd2cf2e3174
don't use ui designer for welcome dialog box
* welcome-wizard.ui: Delete.
* module.mk: Update file list.
* welcome-wizard.cc, welcome-wizard.h: Rewrite.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 08 Oct 2013 18:38:40 -0400 |
parents | c8c0dff02538 |
children | 8cc19352fd74 |
rev | line source |
---|---|
15204
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
1 /* |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
2 |
17611
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
3 Copyright (C) 2013 John W. Eaton |
15204
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
4 Copyright (C) 2011-2012 Jacob Dawid |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
5 |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
6 This file is part of Octave. |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
7 |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
8 Octave is free software; you can redistribute it and/or modify it |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
9 under the terms of the GNU General Public License as published by the |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
10 Free Software Foundation; either version 3 of the License, or (at your |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
11 option) any later version. |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
12 |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
13 Octave is distributed in the hope that it will be useful, but WITHOUT |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
16 for more details. |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
17 |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
18 You should have received a copy of the GNU General Public License |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
19 along with Octave; see the file COPYING. If not, see |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
20 <http://www.gnu.org/licenses/>. |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
21 |
359098ad343e
update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents:
15196
diff
changeset
|
22 */ |
13674
c0e66d6e3dc8
Updated license headers and moved to AGPLv3.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
13668
diff
changeset
|
23 |
15286
ae9079bbc627
Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents:
15204
diff
changeset
|
24 #ifdef HAVE_CONFIG_H |
ae9079bbc627
Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents:
15204
diff
changeset
|
25 #include <config.h> |
ae9079bbc627
Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents:
15204
diff
changeset
|
26 #endif |
ae9079bbc627
Add '#include <config.h>' to C++ files in libgui/src
Rik <rik@octave.org>
parents:
15204
diff
changeset
|
27 |
17611
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
28 #include <QApplication> |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
29 #include <QHBoxLayout> |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
30 #include <QVBoxLayout> |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
31 #include <QLabel> |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
32 #include <QPushButton> |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
33 |
14707
674740c44c09
Changed various files to matche file naming conventions.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
14703
diff
changeset
|
34 #include "welcome-wizard.h" |
17515
c8c0dff02538
gui: welcome wizard with new message text
Torsten <ttl@justmail.de>
parents:
15368
diff
changeset
|
35 #include "resource-manager.h" |
13668
421afeae929b
Added a settings wizard that appears at first startup of Octave GUI.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
36 |
15368
36ececf69385
avoid some GCC warnings in the libgui code
John W. Eaton <jwe@octave.org>
parents:
15286
diff
changeset
|
37 welcome_wizard::welcome_wizard (QWidget *p) |
17611
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
38 : QDialog (p) |
13668
421afeae929b
Added a settings wizard that appears at first startup of Octave GUI.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
39 { |
17611
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
40 setWindowTitle (tr ("Welcome to GNU Octave")); |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
41 |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
42 setEnabled (true); |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
43 resize (600, 480); |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
44 setMinimumSize (QSize (600, 480)); |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
45 |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
46 |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
47 QVBoxLayout *page_layout = new QVBoxLayout (this); |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
48 setLayout (page_layout); |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
49 |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
50 QHBoxLayout *message_and_logo = new QHBoxLayout (this); |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
51 |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
52 QVBoxLayout *message = new QVBoxLayout (this); |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
53 |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
54 QLabel *title = new QLabel (tr ("Welcome to Octave!"), this); |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
55 QFont ft; |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
56 ft.setPointSize (20); |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
57 title->setFont (ft); |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
58 |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
59 QLabel *msg_1 = new QLabel (tr ("You seem to be using the Octave graphical interface for the first time on this computer. Click 'Finish' to write a configuration file and launch Octave GUI."), |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
60 this); |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
61 msg_1->setWordWrap (true); |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
62 |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
63 QLabel *msg_2 = new QLabel (tr ("The configuration file is stored in __%1__. If that file exists, you will not see this dialog when Octave starts again."), |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
64 this); |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
65 msg_2->setWordWrap (true); |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
66 |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
67 QString msg_2_text = msg_2->text (); |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
68 msg_2_text.replace (QString ("__%1__"), |
17515
c8c0dff02538
gui: welcome wizard with new message text
Torsten <ttl@justmail.de>
parents:
15368
diff
changeset
|
69 resource_manager::get_settings_file ()); |
17611
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
70 msg_2->setText (msg_2_text); |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
71 |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
72 message->addWidget (title); |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
73 message->addWidget (msg_1); |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
74 message->addWidget (msg_2); |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
75 |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
76 QSpacerItem *logo_filler = new QSpacerItem (40, 20, QSizePolicy::Expanding, |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
77 QSizePolicy::Minimum); |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
78 |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
79 QLabel *logo = new QLabel (this); |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
80 QPixmap logo_pixmap (":/actions/icons/logo.png"); |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
81 logo->setPixmap (logo_pixmap.scaledToHeight (150)); |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
82 |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
83 message_and_logo->addLayout (message); |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
84 message_and_logo->addItem (logo_filler); |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
85 message_and_logo->addWidget (logo); |
13668
421afeae929b
Added a settings wizard that appears at first startup of Octave GUI.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
86 |
17611
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
87 QLabel *links = new QLabel |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
88 (tr ("<html><head>\n" |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
89 "<style>\n" |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
90 "a:link { text-decoration: underline; color: #0000ff; }\n" |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
91 "</style>\n" |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
92 "<head/><body>\n" |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
93 "<p>For more information about Octave:</p>\n" |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
94 "<ul>\n" |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
95 "<li>Visit <a href=\"http://octave.org\">http://octave.org</a></li>\n" |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
96 "<li>Get the documentation online as <a href=\"http://www.gnu.org/software/octave/doc/interpreter/index.html\">html</a>- or <a href=\"http://www.gnu.org/software/octave/octave.pdf\">pdf</span></a>-document</li>\n" |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
97 "<li>Open the documentation browser of Octave GUI with the help menu</li>\n" |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
98 "</ul>\n" |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
99 "</body></html>"), |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
100 this); |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
101 links->setWordWrap (true); |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
102 links->setOpenExternalLinks (true); |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
103 |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
104 QSpacerItem *hfill = new QSpacerItem (40, 20, QSizePolicy::Expanding, |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
105 QSizePolicy::Minimum); |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
106 |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
107 QPushButton *finish_button = new QPushButton (this); |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
108 finish_button->setText (tr ("Finish")); |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
109 |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
110 QSpacerItem *vspace = new QSpacerItem (20, 40, QSizePolicy::Minimum); |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
111 |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
112 QHBoxLayout *button_bar = new QHBoxLayout (this); |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
113 |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
114 button_bar->addItem (hfill); |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
115 button_bar->addWidget (finish_button); |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
116 |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
117 QSpacerItem *vfill = new QSpacerItem (20, 40, QSizePolicy::Minimum, |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
118 QSizePolicy::Expanding); |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
119 |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
120 page_layout->addLayout (message_and_logo); |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
121 page_layout->addWidget (links); |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
122 page_layout->addItem (vspace); |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
123 page_layout->addLayout (button_bar); |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
124 page_layout->addItem (vfill); |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
125 |
0dd2cf2e3174
don't use ui designer for welcome dialog box
John W. Eaton <jwe@octave.org>
parents:
17515
diff
changeset
|
126 connect (finish_button, SIGNAL (clicked ()), this, SLOT (accept ())); |
13668
421afeae929b
Added a settings wizard that appears at first startup of Octave GUI.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff
changeset
|
127 } |