Mercurial > octave
diff 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 |
line wrap: on
line diff
--- a/libgui/src/welcome-wizard.cc Tue Oct 08 15:50:38 2013 -0700 +++ b/libgui/src/welcome-wizard.cc Tue Oct 08 18:38:40 2013 -0400 @@ -1,5 +1,6 @@ /* +Copyright (C) 2013 John W. Eaton Copyright (C) 2011-2012 Jacob Dawid This file is part of Octave. @@ -24,21 +25,103 @@ #include <config.h> #endif +#include <QApplication> +#include <QHBoxLayout> +#include <QVBoxLayout> +#include <QLabel> +#include <QPushButton> + #include "welcome-wizard.h" #include "resource-manager.h" -#include "ui-welcome-wizard.h" welcome_wizard::welcome_wizard (QWidget *p) - : QDialog (p), _ui (new Ui::welcome_wizard) + : QDialog (p) { - _ui->setupUi (this); - QString label_text = _ui->label_config_file->text (); - label_text.replace (QString ("__%1__"), + setWindowTitle (tr ("Welcome to GNU Octave")); + + setEnabled (true); + resize (600, 480); + setMinimumSize (QSize (600, 480)); + + + QVBoxLayout *page_layout = new QVBoxLayout (this); + setLayout (page_layout); + + QHBoxLayout *message_and_logo = new QHBoxLayout (this); + + QVBoxLayout *message = new QVBoxLayout (this); + + QLabel *title = new QLabel (tr ("Welcome to Octave!"), this); + QFont ft; + ft.setPointSize (20); + title->setFont (ft); + + 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."), + this); + msg_1->setWordWrap (true); + + 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."), + this); + msg_2->setWordWrap (true); + + QString msg_2_text = msg_2->text (); + msg_2_text.replace (QString ("__%1__"), resource_manager::get_settings_file ()); - _ui->label_config_file->setText (label_text); -} + msg_2->setText (msg_2_text); + + message->addWidget (title); + message->addWidget (msg_1); + message->addWidget (msg_2); + + QSpacerItem *logo_filler = new QSpacerItem (40, 20, QSizePolicy::Expanding, + QSizePolicy::Minimum); + + QLabel *logo = new QLabel (this); + QPixmap logo_pixmap (":/actions/icons/logo.png"); + logo->setPixmap (logo_pixmap.scaledToHeight (150)); + + message_and_logo->addLayout (message); + message_and_logo->addItem (logo_filler); + message_and_logo->addWidget (logo); -welcome_wizard::~welcome_wizard() -{ - delete _ui; + QLabel *links = new QLabel + (tr ("<html><head>\n" + "<style>\n" + "a:link { text-decoration: underline; color: #0000ff; }\n" + "</style>\n" + "<head/><body>\n" + "<p>For more information about Octave:</p>\n" + "<ul>\n" + "<li>Visit <a href=\"http://octave.org\">http://octave.org</a></li>\n" + "<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" + "<li>Open the documentation browser of Octave GUI with the help menu</li>\n" + "</ul>\n" + "</body></html>"), + this); + links->setWordWrap (true); + links->setOpenExternalLinks (true); + + QSpacerItem *hfill = new QSpacerItem (40, 20, QSizePolicy::Expanding, + QSizePolicy::Minimum); + + QPushButton *finish_button = new QPushButton (this); + finish_button->setText (tr ("Finish")); + + QSpacerItem *vspace = new QSpacerItem (20, 40, QSizePolicy::Minimum); + + QHBoxLayout *button_bar = new QHBoxLayout (this); + + button_bar->addItem (hfill); + button_bar->addWidget (finish_button); + + QSpacerItem *vfill = new QSpacerItem (20, 40, QSizePolicy::Minimum, + QSizePolicy::Expanding); + + page_layout->addLayout (message_and_logo); + page_layout->addWidget (links); + page_layout->addItem (vspace); + page_layout->addLayout (button_bar); + page_layout->addItem (vfill); + + connect (finish_button, SIGNAL (clicked ()), this, SLOT (accept ())); }