# HG changeset patch # User Jacob Dawid # Date 1342849143 14400 # Node ID de3a318128f2defc46f60a82b093eb6317a05601 # Parent 2d6766e93f7b93dc556dbfdac65a2700490757f6 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. diff --git a/.hgsubstate b/.hgsubstate --- a/.hgsubstate +++ b/.hgsubstate @@ -1,2 +1,2 @@ 33f823397dbb0edb57503f2f6dad2362456bc6a9 gnulib -243383e54ff1bd39ae726029770e8d6dd2549684 gui/qterminal +186cf3960cfa0c2752b77eba18af24cd0853c12a gui/qterminal diff --git a/gui/src/main-window.cc b/gui/src/main-window.cc --- a/gui/src/main-window.cc +++ b/gui/src/main-window.cc @@ -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 diff --git a/gui/src/settings-dialog.cc b/gui/src/settings-dialog.cc --- a/gui/src/settings-dialog.cc +++ b/gui/src/settings-dialog.cc @@ -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; } diff --git a/gui/src/settings-dialog.ui b/gui/src/settings-dialog.ui --- a/gui/src/settings-dialog.ui +++ b/gui/src/settings-dialog.ui @@ -242,6 +242,57 @@ + + + + + Cursor type: + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + Cursor blinking + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + Qt::Vertical