changeset 14307:be3e1a14a6de gui

Added an interface settings tab to the settings dialog. Made a few improvements on the editor. Wrote a small welcome text in the welcome wizard. Moved configuration file to ~/.config/octave-gui/settings. * FileEditorMdiSubWindow: Set sources for code completion to all, lowered completion threshold, changed colors. * SettingsDialog: Added interface tab with shortcut configuration table widget. * WelcomeWizard: Wrote a little text to appear at startup.
author Jacob Dawid <jacob.dawid@googlemail.com>
date Wed, 01 Feb 2012 15:53:19 +0100
parents c3b62d211b80
children 3b6177bd63b0
files gui/src/FileEditorMdiSubWindow.cpp gui/src/FileEditorMdiSubWindow.h gui/src/OctaveGUI.cpp gui/src/ResourceManager.cpp gui/src/SettingsDialog.cpp gui/src/SettingsDialog.ui gui/src/WelcomeWizard.ui
diffstat 7 files changed, 252 insertions(+), 104 deletions(-) [+]
line wrap: on
line diff
--- a/gui/src/FileEditorMdiSubWindow.cpp
+++ b/gui/src/FileEditorMdiSubWindow.cpp
@@ -428,20 +428,20 @@
   m_editor->setMarginType (3, QsciScintilla::SymbolMargin);
   m_editor->setFolding (QsciScintilla::BoxedTreeFoldStyle , 3);
   // other features
-  if ( settings->value ("editor/highlightActualLine",true).toBool () )
+  if ( settings->value ("editor/highlightCurrentLine",true).toBool () )
     {
       m_editor->setCaretLineVisible(true);
-      m_editor->setCaretLineBackgroundColor(QColor(255,255,200));
+      m_editor->setCaretLineBackgroundColor(QColor(245,245,245));
     }
-  m_editor->setBraceMatching (QsciScintilla::SloppyBraceMatch);
+  m_editor->setBraceMatching (QsciScintilla::StrictBraceMatch);
   m_editor->setAutoIndent (true);
   m_editor->setIndentationWidth (2);
   m_editor->setIndentationsUseTabs (false);
   if ( settings->value ("editor/codeCompletion",true).toBool () )
     {
-      m_editor->autoCompleteFromAll();
-      m_editor->setAutoCompletionSource(QsciScintilla::AcsAPIs);
-      m_editor->setAutoCompletionThreshold (3);
+      m_editor->autoCompleteFromAll ();
+      m_editor->setAutoCompletionSource(QsciScintilla::AcsAll);
+      m_editor->setAutoCompletionThreshold (1);
     }
   m_editor->setUtf8 (true);
   m_longTitle = settings->value ("editor/longWindowTitle",true).toBool ();
--- a/gui/src/FileEditorMdiSubWindow.h
+++ b/gui/src/FileEditorMdiSubWindow.h
@@ -41,7 +41,9 @@
 
 class FileEditorMdiSubWindow:public QMdiSubWindow
 {
-Q_OBJECT public:
+Q_OBJECT
+
+public:
   FileEditorMdiSubWindow (QWidget * parent = 0);
   ~FileEditorMdiSubWindow ();
   void loadFile (QString fileName);
--- a/gui/src/OctaveGUI.cpp
+++ b/gui/src/OctaveGUI.cpp
@@ -43,7 +43,7 @@
           settings->setValue ("useCustomFileEditor", false);
           settings->setValue ("customFileEditor", "emacs");
           settings->setValue ("editor/showLineNumbers", true);
-          settings->setValue ("editor/highlightActualLine", true);
+          settings->setValue ("editor/highlightCurrentLine", true);
           settings->setValue ("editor/codeCompletion", true);
           settings->setValue ("editor/fontName", "Monospace");
           settings->setValue ("editor/fontSize", 10);
--- a/gui/src/ResourceManager.cpp
+++ b/gui/src/ResourceManager.cpp
@@ -49,7 +49,7 @@
 {
   QDesktopServices desktopServices;
   m_homePath = desktopServices.storageLocation (QDesktopServices::HomeLocation);
-  setSettings(m_homePath + "/.octave-gui");
+  setSettings(m_homePath + "/.config/octave-gui/settings");
 }
 
 void
--- a/gui/src/SettingsDialog.cpp
+++ b/gui/src/SettingsDialog.cpp
@@ -34,7 +34,7 @@
   ui->useCustomFileEditor->setChecked (settings->value ("useCustomFileEditor").toBool ());
   ui->customFileEditor->setText (settings->value ("customFileEditor").toString ());
   ui->editor_showLineNumbers->setChecked (settings->value ("editor/showLineNumbers",true).toBool () );
-  ui->editor_highlightActualLine->setChecked (settings->value ("editor/highlightActualLine",true).toBool () );
+  ui->editor_highlightCurrentLine->setChecked (settings->value ("editor/highlightCurrentLine",true).toBool () );
   ui->editor_codeCompletion->setChecked (settings->value ("editor/codeCompletion",true).toBool () );
   ui->editor_fontName->setCurrentFont (QFont (settings->value ("editor/fontName","Courier").toString()) );
   ui->editor_fontSize->setValue (settings->value ("editor/fontSize",10).toInt ());
@@ -59,6 +59,33 @@
   ui->proxyPort->setText (settings->value ("proxyPort").toString ());
   ui->proxyUserName->setText (settings->value ("proxyUserName").toString ());
   ui->proxyPassword->setText (settings->value ("proxyPassword").toString ());
+
+  // Short cuts
+  QStringList headerLabels;
+  headerLabels << "Modifier" << "Key" << "Action";
+  ui->shortcutTableWidget->setColumnCount (3);
+  ui->shortcutTableWidget->setRowCount (10);
+  ui->shortcutTableWidget->horizontalHeader ()->setStretchLastSection (true);
+  ui->shortcutTableWidget->setHorizontalHeaderLabels (headerLabels);
+  ui->shortcutTableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
+  ui->shortcutTableWidget->setSelectionMode(QAbstractItemView::SingleSelection);
+
+  /*
+  newAction->setShortcut(QKeySequence::New);
+  openAction->setShortcut(QKeySequence::Open);
+  saveAction->setShortcut(QKeySequence::Save);
+  saveAsAction->setShortcut(QKeySequence::SaveAs);
+  undoAction->setShortcut(QKeySequence::Undo);
+  redoAction->setShortcut(QKeySequence::Redo);
+  m_copyAction->setShortcut(QKeySequence::Copy);
+  m_cutAction->setShortcut(QKeySequence::Cut);
+  pasteAction->setShortcut(QKeySequence::Paste);
+  runAction->setShortcut(Qt::Key_F5);
+  nextBookmarkAction->setShortcut(Qt::Key_F2);
+  prevBookmarkAction->setShortcut(Qt::SHIFT + Qt::Key_F2);
+  toggleBookmarkAction->setShortcut(Qt::Key_F7);
+  commentSelectedAction->setShortcut(Qt::CTRL + Qt::Key_R);
+  uncommentSelectedAction->setShortcut(Qt::CTRL + Qt::Key_T);*/
 }
 
 SettingsDialog::~SettingsDialog ()
@@ -72,7 +99,7 @@
   settings->setValue ("useCustomFileEditor", ui->useCustomFileEditor->isChecked ());
   settings->setValue ("customFileEditor", ui->customFileEditor->text ());
   settings->setValue ("editor/showLineNumbers", ui->editor_showLineNumbers->isChecked ());
-  settings->setValue ("editor/highlightActualLine", ui->editor_highlightActualLine->isChecked ());
+  settings->setValue ("editor/highlightCurrentLine", ui->editor_highlightCurrentLine->isChecked ());
   settings->setValue ("editor/codeCompletion", ui->editor_codeCompletion->isChecked ());
   settings->setValue ("editor/fontName", ui->editor_fontName->currentFont().family());
   settings->setValue ("editor/fontSize", ui->editor_fontSize->value());
--- a/gui/src/SettingsDialog.ui
+++ b/gui/src/SettingsDialog.ui
@@ -9,20 +9,20 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>500</width>
-    <height>300</height>
+    <width>600</width>
+    <height>400</height>
    </rect>
   </property>
   <property name="minimumSize">
    <size>
-    <width>500</width>
-    <height>300</height>
+    <width>600</width>
+    <height>400</height>
    </size>
   </property>
   <property name="maximumSize">
    <size>
-    <width>500</width>
-    <height>300</height>
+    <width>600</width>
+    <height>400</height>
    </size>
   </property>
   <property name="windowTitle">
@@ -34,87 +34,59 @@
      <property name="currentIndex">
       <number>0</number>
      </property>
-     <widget class="QWidget" name="chatTab">
+     <widget class="QWidget" name="tab_4">
       <attribute name="title">
-       <string>Chat</string>
+       <string>Interface</string>
       </attribute>
-      <layout class="QGridLayout" name="gridLayout_2">
-       <item row="0" column="0">
-        <layout class="QVBoxLayout" name="verticalLayout">
-         <item>
-          <widget class="QCheckBox" name="connectOnStartup">
-           <property name="text">
-            <string>Connect to #octave on startup</string>
-           </property>
-           <property name="checked">
-            <bool>true</bool>
-           </property>
-          </widget>
-         </item>
+      <layout class="QVBoxLayout" name="verticalLayout_6">
+       <item>
+        <widget class="QLabel" name="label_10">
+         <property name="text">
+          <string>Shortcuts:</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QTableWidget" name="shortcutTableWidget">
+         <property name="enabled">
+          <bool>false</bool>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <layout class="QHBoxLayout" name="horizontalLayout_2">
          <item>
-          <widget class="QCheckBox" name="showMessageOfTheDay">
-           <property name="text">
-            <string>Show message of the day</string>
+          <widget class="QPushButton" name="addShortcutButton">
+           <property name="enabled">
+            <bool>false</bool>
            </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QCheckBox" name="showTopic">
            <property name="text">
-            <string>Show topic</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QCheckBox" name="autoIdentification">
-           <property name="text">
-            <string>Automatically identify on NickServ</string>
+            <string>Add</string>
            </property>
           </widget>
          </item>
          <item>
-          <widget class="QLabel" name="label_2">
+          <widget class="QPushButton" name="removeShortCutButton">
+           <property name="enabled">
+            <bool>false</bool>
+           </property>
            <property name="text">
-            <string>Warning: Your password will be stored in ~/.octavegui in human-readable format. Do not enter your password if you worry about security issues.</string>
-           </property>
-           <property name="wordWrap">
-            <bool>true</bool>
+            <string>Remove</string>
            </property>
           </widget>
          </item>
          <item>
-          <layout class="QHBoxLayout" name="horizontalLayout">
-           <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="QLabel" name="label">
-             <property name="text">
-              <string>Password:</string>
-             </property>
-            </widget>
-           </item>
-           <item>
-            <widget class="QLineEdit" name="nickServPassword">
-             <property name="enabled">
-              <bool>false</bool>
-             </property>
-             <property name="echoMode">
-              <enum>QLineEdit::Password</enum>
-             </property>
-            </widget>
-           </item>
-          </layout>
+          <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>
         </layout>
        </item>
@@ -124,21 +96,8 @@
       <attribute name="title">
        <string>Editor</string>
       </attribute>
-      <layout class="QGridLayout" name="gridLayout">
-       <item row="3" column="0">
-        <spacer name="verticalSpacer">
-         <property name="orientation">
-          <enum>Qt::Vertical</enum>
-         </property>
-         <property name="sizeHint" stdset="0">
-          <size>
-           <width>20</width>
-           <height>158</height>
-          </size>
-         </property>
-        </spacer>
-       </item>
-       <item row="1" column="0">
+      <layout class="QVBoxLayout" name="verticalLayout_5">
+       <item>
         <layout class="QVBoxLayout" name="verticalLayout_7">
          <item>
           <layout class="QHBoxLayout" name="horizontalLayout_3">
@@ -178,12 +137,12 @@
           </widget>
          </item>
          <item>
-          <widget class="QCheckBox" name="editor_highlightActualLine">
+          <widget class="QCheckBox" name="editor_highlightCurrentLine">
            <property name="enabled">
             <bool>true</bool>
            </property>
            <property name="text">
-            <string>Highlight actual line</string>
+            <string>Highlight current line</string>
            </property>
            <property name="checked">
             <bool>false</bool>
@@ -212,7 +171,7 @@
          </item>
         </layout>
        </item>
-       <item row="2" column="0">
+       <item>
         <layout class="QHBoxLayout" name="horizontalLayout_4">
          <item>
           <widget class="QLabel" name="label_8">
@@ -263,6 +222,19 @@
          </item>
         </layout>
        </item>
+       <item>
+        <spacer name="verticalSpacer">
+         <property name="orientation">
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>20</width>
+           <height>40</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
       </layout>
      </widget>
      <widget class="QWidget" name="tab_2">
@@ -312,6 +284,19 @@
          </property>
         </widget>
        </item>
+       <item>
+        <spacer name="verticalSpacer_2">
+         <property name="orientation">
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>20</width>
+           <height>360</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
       </layout>
      </widget>
      <widget class="QWidget" name="tab_3">
@@ -430,6 +415,105 @@
        </item>
       </layout>
      </widget>
+     <widget class="QWidget" name="chatTab">
+      <attribute name="title">
+       <string>Chat</string>
+      </attribute>
+      <layout class="QGridLayout" name="gridLayout_2">
+       <item row="0" column="0">
+        <layout class="QVBoxLayout" name="verticalLayout">
+         <item>
+          <widget class="QCheckBox" name="connectOnStartup">
+           <property name="text">
+            <string>Connect to #octave on startup</string>
+           </property>
+           <property name="checked">
+            <bool>true</bool>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QCheckBox" name="showMessageOfTheDay">
+           <property name="text">
+            <string>Show message of the day</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QCheckBox" name="showTopic">
+           <property name="text">
+            <string>Show topic</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QCheckBox" name="autoIdentification">
+           <property name="text">
+            <string>Automatically identify on NickServ</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QLabel" name="label_2">
+           <property name="text">
+            <string>Warning: Your password will be stored in ~/.octavegui in human-readable format. Do not enter your password if you worry about security issues.</string>
+           </property>
+           <property name="wordWrap">
+            <bool>true</bool>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <layout class="QHBoxLayout" name="horizontalLayout">
+           <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="QLabel" name="label">
+             <property name="text">
+              <string>Password:</string>
+             </property>
+            </widget>
+           </item>
+           <item>
+            <widget class="QLineEdit" name="nickServPassword">
+             <property name="enabled">
+              <bool>false</bool>
+             </property>
+             <property name="echoMode">
+              <enum>QLineEdit::Password</enum>
+             </property>
+            </widget>
+           </item>
+          </layout>
+         </item>
+        </layout>
+       </item>
+       <item row="1" column="0">
+        <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>
+      </layout>
+     </widget>
     </widget>
    </item>
   </layout>
@@ -645,9 +729,9 @@
    </hints>
   </connection>
   <connection>
-   <sender>editor_highlightActualLine</sender>
+   <sender>editor_highlightCurrentLine</sender>
    <signal>toggled(bool)</signal>
-   <receiver>editor_highlightActualLine</receiver>
+   <receiver>editor_highlightCurrentLine</receiver>
    <slot>setEnabled(bool)</slot>
    <hints>
     <hint type="sourcelabel">
--- a/gui/src/WelcomeWizard.ui
+++ b/gui/src/WelcomeWizard.ui
@@ -246,6 +246,38 @@
        <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 run 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>
@@ -262,6 +294,9 @@
           <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>