changeset 17515:c8c0dff02538

gui: welcome wizard with new message text * resource-manager.cc(do_get_settings_path): new function for the path of the settings path (do_get_settings_file): new function for the name of the settings file (do_reload_settings): use new functions do_get_settings_path and -file * resource-manager.h(get_settings_file): new static function returning the the name of the settings file; new internal functions do_get_settings_path and do_get_settings_file * welcome-wizard.ui: removed extra pages, new text messages * welcome-wizard.cc(constructor): no more buttons to connect, replace placeholder by the settings file name (next,previous): remove unnecessary functions * welcome-wizard.h: removed unnecessary functions next and previous
author Torsten <ttl@justmail.de>
date Sun, 29 Sep 2013 20:56:39 +0200
parents 5b916efea542
children 21656a949661
files libgui/src/resource-manager.cc libgui/src/resource-manager.h libgui/src/welcome-wizard.cc libgui/src/welcome-wizard.h libgui/src/welcome-wizard.ui
diffstat 5 files changed, 118 insertions(+), 322 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/resource-manager.cc	Sat Sep 28 17:36:27 2013 -0700
+++ b/libgui/src/resource-manager.cc	Sun Sep 29 20:56:39 2013 +0200
@@ -153,13 +153,28 @@
   return home_path;
 }
 
+QString
+resource_manager::do_get_settings_path (void)
+{
+  QDesktopServices desktopServices;
+  home_path = desktopServices.storageLocation (QDesktopServices::HomeLocation);
+  QString settings_path = home_path + "/.config/octave/";
+  return settings_path;
+}
+
+QString
+resource_manager::do_get_settings_file (void)
+{
+  return do_get_settings_path ()  + "qt-settings";
+}
+
 void
 resource_manager::do_reload_settings (void)
 {
   QDesktopServices desktopServices;
   home_path = desktopServices.storageLocation (QDesktopServices::HomeLocation);
-  QString settings_path = home_path + "/.config/octave/";
-  QString settings_file = settings_path + "qt-settings";
+  QString settings_path = do_get_settings_path ();
+  QString settings_file = do_get_settings_file ();
 
   if (!QFile::exists (settings_file))
     {
--- a/libgui/src/resource-manager.h	Sat Sep 28 17:36:27 2013 -0700
+++ b/libgui/src/resource-manager.h	Sun Sep 29 20:56:39 2013 +0200
@@ -54,6 +54,11 @@
     return instance_ok () ? instance->do_get_home_path () : QString ();
   }
 
+  static QString get_settings_file (void)
+  {
+    return instance_ok () ? instance->do_get_settings_file () : QString ();
+  }
+
   static void reload_settings (void)
   {
     if (instance_ok ())
@@ -117,6 +122,10 @@
 
   QString do_get_home_path (void) const;
 
+  QString do_get_settings_file (void);
+
+  QString do_get_settings_path (void);
+
   void do_reload_settings (void);
 
   void do_set_settings (const QString& file);
--- a/libgui/src/welcome-wizard.cc	Sat Sep 28 17:36:27 2013 -0700
+++ b/libgui/src/welcome-wizard.cc	Sun Sep 29 20:56:39 2013 +0200
@@ -25,37 +25,20 @@
 #endif
 
 #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)
 {
   _ui->setupUi (this);
-  connect (_ui->nextButton1, SIGNAL (clicked ()), this, SLOT (next ()));
-  connect (_ui->nextButton2, SIGNAL (clicked ()), this, SLOT (next ()));
-  connect (_ui->nextButton3, SIGNAL (clicked ()), this, SLOT (next ()));
-  connect (_ui->nextButton4, SIGNAL (clicked ()), this, SLOT (next ()));
-
-  connect (_ui->previousButton2, SIGNAL (clicked ()), this, SLOT (previous ()));
-  connect (_ui->previousButton3, SIGNAL (clicked ()), this, SLOT (previous ()));
-  connect (_ui->previousButton4, SIGNAL (clicked ()), this, SLOT (previous ()));
-  connect (_ui->previousButton5, SIGNAL (clicked ()), this, SLOT (previous ()));
+  QString label_text = _ui->label_config_file->text ();
+  label_text.replace (QString ("__%1__"),
+                      resource_manager::get_settings_file ());
+  _ui->label_config_file->setText (label_text);
 }
 
 welcome_wizard::~welcome_wizard()
 {
   delete _ui;
 }
-
-void
-welcome_wizard::next ()
-{
-  _ui->stackedWidget->setCurrentIndex (_ui->stackedWidget->currentIndex () + 1);
-}
-
-void
-welcome_wizard::previous ()
-{
-  _ui->stackedWidget->setCurrentIndex (_ui->stackedWidget->currentIndex () - 1);
-}
-
--- a/libgui/src/welcome-wizard.h	Sat Sep 28 17:36:27 2013 -0700
+++ b/libgui/src/welcome-wizard.h	Sun Sep 29 20:56:39 2013 +0200
@@ -38,8 +38,6 @@
   ~welcome_wizard ();
 
 public slots:
-  void next ();
-  void previous ();
 
 private:
   Ui::welcome_wizard *_ui;
--- a/libgui/src/welcome-wizard.ui	Sat Sep 28 17:36:27 2013 -0700
+++ b/libgui/src/welcome-wizard.ui	Sun Sep 29 20:56:39 2013 +0200
@@ -2,24 +2,27 @@
 <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>647</width>
-    <height>400</height>
+    <width>480</width>
+    <height>320</height>
    </rect>
   </property>
   <property name="minimumSize">
    <size>
-    <width>647</width>
-    <height>400</height>
+    <width>480</width>
+    <height>320</height>
    </size>
   </property>
   <property name="maximumSize">
    <size>
-    <width>647</width>
-    <height>400</height>
+    <width>480</width>
+    <height>320</height>
    </size>
   </property>
   <property name="windowTitle">
@@ -27,308 +30,96 @@
   </property>
   <layout class="QVBoxLayout" name="verticalLayout_2">
    <item>
-    <widget class="QStackedWidget" name="stackedWidget">
-     <property name="currentIndex">
-      <number>4</number>
-     </property>
-     <widget class="QWidget" name="page">
-      <layout class="QVBoxLayout" name="verticalLayout">
+    <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>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;For more information about Octave,&lt;/p&gt;
+&lt;ul&gt;
+&lt;li&gt;visit &lt;a href=&quot;http://octave.org&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;http://octave.org&lt;/span&gt;&lt;/a&gt;,&lt;/li&gt;
+&lt;li&gt; get the documentation online as &lt;a href=&quot;http://www.gnu.org/software/octave/doc/interpreter/index.html&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;html&lt;/span&gt;&lt;/a&gt;- or &lt;a href=&quot;http://www.gnu.org/software/octave/octave.pdf&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;pdf&lt;/span&gt;&lt;/a&gt;-document, or&lt;/li&gt;
+&lt;li&gt;open the documentation browser of Octave GUI with the help menu.&lt;/li&gt;
+&lt;/ul&gt;
+&lt;/body&gt;&lt;/html&gt;</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>
-        <widget class="QLabel" name="label">
-         <property name="text">
-          <string>It appears that you have launched Octave GUI for the first time on this computer, since no configuration file could be found at '~/.octave-gui'. This wizard will guide you through the essential settings you should make before you can start using Octave GUI. If you want to transfer your settings you have previously made just close this dialog and copy over the settings file to your home folder. The presence of that file will automatically be detected and will skip this wizard. IMPORTANT: This wizard is not fully functional yet. Just click your way to the end and it will create a standard settings file.</string>
-         </property>
-         <property name="alignment">
-          <set>Qt::AlignJustify|Qt::AlignVCenter</set>
-         </property>
-         <property name="wordWrap">
-          <bool>true</bool>
-         </property>
-        </widget>
-       </item>
-       <item>
-        <spacer name="verticalSpacer">
+        <spacer name="horizontalSpacer_5">
          <property name="orientation">
-          <enum>Qt::Vertical</enum>
+          <enum>Qt::Horizontal</enum>
          </property>
          <property name="sizeHint" stdset="0">
           <size>
-           <width>20</width>
-           <height>218</height>
+           <width>40</width>
+           <height>20</height>
           </size>
          </property>
         </spacer>
        </item>
        <item>
-        <layout class="QHBoxLayout" name="horizontalLayout_2">
-         <item>
-          <spacer name="horizontalSpacer">
-           <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="nextButton1">
-           <property name="text">
-            <string>Next</string>
-           </property>
-          </widget>
-         </item>
-        </layout>
-       </item>
-      </layout>
-     </widget>
-     <widget class="QWidget" name="page_2">
-      <layout class="QVBoxLayout" name="verticalLayout_4">
-       <item>
-        <layout class="QVBoxLayout" name="verticalLayout_3">
-         <item>
-          <spacer name="verticalSpacer_2">
-           <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">
-           <item>
-            <widget class="QPushButton" name="previousButton2">
-             <property name="text">
-              <string>Previous</string>
-             </property>
-            </widget>
-           </item>
-           <item>
-            <spacer name="horizontalSpacer_2">
-             <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="nextButton2">
-             <property name="text">
-              <string>Next</string>
-             </property>
-            </widget>
-           </item>
-          </layout>
-         </item>
-        </layout>
-       </item>
-      </layout>
-     </widget>
-     <widget class="QWidget" name="page_3">
-      <layout class="QHBoxLayout" name="horizontalLayout_4">
-       <item>
-        <layout class="QVBoxLayout" name="verticalLayout_5">
-         <item>
-          <spacer name="verticalSpacer_3">
-           <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_3">
-           <item>
-            <widget class="QPushButton" name="previousButton3">
-             <property name="text">
-              <string>Previous</string>
-             </property>
-            </widget>
-           </item>
-           <item>
-            <spacer name="horizontalSpacer_3">
-             <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="nextButton3">
-             <property name="text">
-              <string>Next</string>
-             </property>
-            </widget>
-           </item>
-          </layout>
-         </item>
-        </layout>
+        <widget class="QPushButton" name="finishButton">
+         <property name="text">
+          <string>Finish</string>
+         </property>
+        </widget>
        </item>
       </layout>
-     </widget>
-     <widget class="QWidget" name="page_4">
-      <layout class="QHBoxLayout" name="horizontalLayout_6">
-       <item>
-        <layout class="QVBoxLayout" name="verticalLayout_6">
-         <item>
-          <spacer name="verticalSpacer_4">
-           <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_5">
-           <item>
-            <widget class="QPushButton" name="previousButton4">
-             <property name="text">
-              <string>Previous</string>
-             </property>
-            </widget>
-           </item>
-           <item>
-            <spacer name="horizontalSpacer_4">
-             <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="nextButton4">
-             <property name="text">
-              <string>Next</string>
-             </property>
-            </widget>
-           </item>
-          </layout>
-         </item>
-        </layout>
-       </item>
-      </layout>
-     </widget>
-     <widget class="QWidget" name="page_5">
-      <layout class="QHBoxLayout" name="horizontalLayout_8">
-       <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_3">
-           <property name="text">
-            <string>This is the development version of Octave with the first official GUI.</string>
-           </property>
-           <property name="wordWrap">
-            <bool>true</bool>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QLabel" name="label_4">
-           <property name="text">
-            <string>You seem to be running Octave GUI for the first time on this computer. This assistant will help you to configure this software installation. Click 'Finish' to write a configuration file and launch Octave GUI.</string>
-           </property>
-           <property name="wordWrap">
-            <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>
-            <widget class="QPushButton" name="previousButton5">
-             <property name="enabled">
-              <bool>false</bool>
-             </property>
-             <property name="text">
-              <string>Previous</string>
-             </property>
-            </widget>
-           </item>
-           <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>
-    </widget>
+     </item>
+    </layout>
    </item>
   </layout>
  </widget>