Mercurial > hg > octave-nkf
changeset 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 | 3f8b3588a9f0 |
children | 4669cfca69a0 |
files | libgui/src/module.mk libgui/src/welcome-wizard.cc libgui/src/welcome-wizard.h libgui/src/welcome-wizard.ui |
diffstat | 4 files changed, 98 insertions(+), 167 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/module.mk +++ b/libgui/src/module.mk @@ -100,8 +100,7 @@ octave_gui_RC = src/qrc-resource.cc octave_gui_UI = \ - src/settings-dialog.ui \ - src/welcome-wizard.ui + src/settings-dialog.ui octave_gui_UI_H = $(patsubst src/%.ui, src/ui-%.h, $(octave_gui_UI))
--- a/libgui/src/welcome-wizard.cc +++ b/libgui/src/welcome-wizard.cc @@ -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 ())); }
--- a/libgui/src/welcome-wizard.h +++ b/libgui/src/welcome-wizard.h @@ -1,5 +1,6 @@ /* +Copyright (C) 2013 John W. Eaton Copyright (C) 2011-2012 Jacob Dawid This file is part of Octave. @@ -25,22 +26,15 @@ #include <QDialog> -namespace Ui { - class welcome_wizard; -} - class welcome_wizard : public QDialog { Q_OBJECT - public: - explicit welcome_wizard (QWidget *parent = 0); - ~welcome_wizard (); +public: -public slots: + welcome_wizard (QWidget *parent = 0); -private: - Ui::welcome_wizard *_ui; + ~welcome_wizard (void) { } }; #endif // WELCOMEWIZARD_H
deleted file mode 100644 --- a/libgui/src/welcome-wizard.ui +++ /dev/null @@ -1,145 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>welcome_wizard</class> - <widget class="QDialog" name="welcome_wizard"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>480</width> - <height>320</height> - </rect> - </property> - <property name="minimumSize"> - <size> - <width>480</width> - <height>320</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>480</width> - <height>320</height> - </size> - </property> - <property name="windowTitle"> - <string>Welcome to GNU Octave</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <item> - <layout class="QVBoxLayout" name="verticalLayout_7"> - <item> - <widget class="QLabel" name="label_2"> - <property name="font"> - <font> - <pointsize>20</pointsize> - </font> - </property> - <property name="text"> - <string>Welcome to Octave!</string> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_4"> - <property name="text"> - <string>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. </string> - </property> - <property name="wordWrap"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_config_file"> - <property name="text"> - <string>The configuration file is stored in __%1__. If that file exists, you will not see this dialog when Octave starts again.</string> - </property> - <property name="wordWrap"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_3"> - <property name="text"> - <string><html><head/><body><p>For more information about Octave,</p> -<ul> -<li>visit <a href="http://octave.org"><span style=" text-decoration: underline; color:#0000ff;">http://octave.org</span></a>,</li> -<li> get the documentation online as <a href="http://www.gnu.org/software/octave/doc/interpreter/index.html"><span style=" text-decoration: underline; color:#0000ff;">html</span></a>- or <a href="http://www.gnu.org/software/octave/octave.pdf"><span style=" text-decoration: underline; color:#0000ff;">pdf</span></a>-document, or</li> -<li>open the documentation browser of Octave GUI with the help menu.</li> -</ul> -</body></html></string> - </property> - <property name="wordWrap"> - <bool>true</bool> - </property> - <property name="openExternalLinks"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <spacer name="verticalSpacer_5"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_7"> - <item> - <spacer name="horizontalSpacer_5"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QPushButton" name="finishButton"> - <property name="text"> - <string>Finish</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </item> - </layout> - </widget> - <resources/> - <connections> - <connection> - <sender>finishButton</sender> - <signal>clicked()</signal> - <receiver>welcome_wizard</receiver> - <slot>accept()</slot> - <hints> - <hint type="sourcelabel"> - <x>577</x> - <y>372</y> - </hint> - <hint type="destinationlabel"> - <x>323</x> - <y>199</y> - </hint> - </hints> - </connection> - </connections> -</ui>