changeset 14998:de3a318128f2 gui

Added support for changing the terminal cursor and the cursor blinking. * main-window.cc: Added code to react on cursor settings changes. * settings-dialog.cc: Added code to handle new GUI settings elements. * settings-dialog.ui: Added combo box and checkbox for cursor settings.
author Jacob Dawid <jacob.dawid@gmail.com>
date Sat, 21 Jul 2012 01:39:03 -0400
parents 2d6766e93f7b
children 7c14e3e6fc6b
files .hgsubstate gui/src/main-window.cc gui/src/settings-dialog.cc gui/src/settings-dialog.ui
diffstat 4 files changed, 92 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/.hgsubstate	Fri Jul 20 16:45:10 2012 -0400
+++ b/.hgsubstate	Sat Jul 21 01:39:03 2012 -0400
@@ -1,2 +1,2 @@
 33f823397dbb0edb57503f2f6dad2362456bc6a9 gnulib
-243383e54ff1bd39ae726029770e8d6dd2549684 gui/qterminal
+186cf3960cfa0c2752b77eba18af24cd0853c12a gui/qterminal
--- a/gui/src/main-window.cc	Fri Jul 20 16:45:10 2012 -0400
+++ b/gui/src/main-window.cc	Sat Jul 21 01:39:03 2012 -0400
@@ -160,8 +160,6 @@
   settingsDialog->exec ();
   delete settingsDialog;
   emit settings_changed ();
-  resource_manager::instance ()->update_network_settings ();
-  notice_settings();
 }
 
 void
@@ -169,10 +167,22 @@
 {
   // Set terminal font:
   QSettings *settings = resource_manager::instance ()->get_settings ();
+
   QFont font = QFont();
   font.setFamily(settings->value("terminal/fontName").toString());
   font.setPointSize(settings->value("terminal/fontSize").toInt ());
   _terminal->setTerminalFont(font);
+
+  QString cursorType = settings->value ("terminal/cursorType").toString ();
+  bool cursorBlinking = settings->value ("terminal/cursorBlinking").toBool ();
+  if (cursorType == "ibeam")
+    _terminal->setCursorType(QTerminalInterface::IBeamCursor, cursorBlinking);
+  else if (cursorType == "block")
+    _terminal->setCursorType(QTerminalInterface::BlockCursor, cursorBlinking);
+  else if (cursorType == "underline")
+    _terminal->setCursorType(QTerminalInterface::UnderlineCursor, cursorBlinking);
+
+  resource_manager::instance ()->update_network_settings ();
 }
 
 void
--- a/gui/src/settings-dialog.cc	Fri Jul 20 16:45:10 2012 -0400
+++ b/gui/src/settings-dialog.cc	Sat Jul 21 01:39:03 2012 -0400
@@ -44,6 +44,23 @@
   ui->useAlternatingRowColors->setChecked (settings->value ("useAlternatingRowColors").toBool());
   ui->useProxyServer->setChecked (settings->value ("useProxyServer").toBool ());
   ui->proxyHostName->setText (settings->value ("proxyHostName").toString ());
+  ui->terminal_cursorBlinking->setChecked (settings->value ("terminal/cursorBlinking").toBool ());
+
+  QString cursorType = settings->value ("terminal/cursorType").toString ();
+
+  QStringList items;
+  items << QString("0") << QString("1") << QString("2");
+  ui->terminal_cursorType->addItems(items);
+  ui->terminal_cursorType->setItemText (0, "IBeam Cursor");
+  ui->terminal_cursorType->setItemText (1, "Block Cursor");
+  ui->terminal_cursorType->setItemText (2, "Underline Cursor");
+
+  if (cursorType == "ibeam")
+    ui->terminal_cursorType->setCurrentIndex (0);
+  else if (cursorType == "block")
+    ui->terminal_cursorType->setCurrentIndex (1);
+  else if (cursorType == "underline")
+    ui->terminal_cursorType->setCurrentIndex (2);
 
   int currentIndex = 0;
   QString proxyTypeString = settings->value ("proxyType").toString ();
@@ -83,5 +100,16 @@
   settings->setValue ("proxyPort", ui->proxyPort->text ());
   settings->setValue ("proxyUserName", ui->proxyUserName->text ());
   settings->setValue ("proxyPassword", ui->proxyPassword->text ());
+  settings->setValue ("terminal/cursorBlinking", ui->terminal_cursorBlinking->isChecked ());
+
+  QString cursorType;
+  switch (ui->terminal_cursorType->currentIndex ())
+    {
+    case 0: cursorType = "ibeam"; break;
+    case 1: cursorType = "block"; break;
+    case 2: cursorType = "underline";  break;
+    }
+  settings->setValue ("terminal/cursorType", cursorType);
+  settings->sync ();
   delete ui;
 }
--- a/gui/src/settings-dialog.ui	Fri Jul 20 16:45:10 2012 -0400
+++ b/gui/src/settings-dialog.ui	Sat Jul 21 01:39:03 2012 -0400
@@ -242,6 +242,57 @@
         </layout>
        </item>
        <item>
+        <layout class="QHBoxLayout" name="horizontalLayout_3">
+         <item>
+          <widget class="QLabel" name="label">
+           <property name="text">
+            <string>Cursor type:</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QComboBox" name="terminal_cursorType"/>
+         </item>
+         <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>
+        </layout>
+       </item>
+       <item>
+        <layout class="QHBoxLayout" name="horizontalLayout_2">
+         <item>
+          <widget class="QCheckBox" name="terminal_cursorBlinking">
+           <property name="text">
+            <string>Cursor blinking</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>
+        </layout>
+       </item>
+       <item>
         <spacer name="verticalSpacer_3">
          <property name="orientation">
           <enum>Qt::Vertical</enum>