Mercurial > hg > octave-nkf
changeset 14588:fa52c6e84ae0 gui
Added controls and settings for changing the terminal font.
MainWindow.cpp: Added logic to update terminal font and store settings persistently.
SettingDialog.ui: Added controls to alter terminal font and size.
author | "Israel Herraiz <israel.herraiz@upm.es>" |
---|---|
date | Mon, 30 Apr 2012 19:38:24 -0700 |
parents | 12b60f3b1394 |
children | e4d380c01dcf 97cb9286919c |
files | gui/src/MainWindow.cpp gui/src/MainWindow.h gui/src/SettingsDialog.cpp gui/src/SettingsDialog.ui |
diffstat | 4 files changed, 83 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/gui/src/MainWindow.cpp +++ b/gui/src/MainWindow.cpp @@ -201,6 +201,18 @@ delete settingsDialog; emit settingsChanged (); ResourceManager::instance ()->updateNetworkSettings (); + updateTerminalFont(); +} + +void +MainWindow::updateTerminalFont () +{ + QSettings *settings = ResourceManager::instance ()->settings (); + QFont font = QFont(); + //font.setStyleHint(QFont::TypeWriter); + font.setFamily(settings->value("terminal/fontName").toString()); + font.setPointSize(settings->value("terminal/fontSize").toInt ()); + m_terminalView->setTerminalFont(font); } void @@ -392,6 +404,7 @@ setStatusBar (m_statusBar); readSettings (); + updateTerminalFont(); openWebPage ("http://www.gnu.org/software/octave/doc/interpreter/"); }
--- a/gui/src/MainWindow.h +++ b/gui/src/MainWindow.h @@ -102,6 +102,7 @@ void processSettingsDialogRequest (); void showAboutOctave (); void showAboutQt (); + void updateTerminalFont (); protected: void closeEvent (QCloseEvent * closeEvent);
--- a/gui/src/SettingsDialog.cpp +++ b/gui/src/SettingsDialog.cpp @@ -32,8 +32,10 @@ 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 ()); + ui->editor_fontSize->setValue (settings->value ("editor/fontSize",10).toInt ()); ui->editor_longWindowTitle->setChecked (settings->value ("editor/longWindowTitle",true).toBool ()); + ui->terminal_fontName->setCurrentFont (QFont (settings->value ("terminal/fontName","Courier").toString()) ); + ui->terminal_fontSize->setValue (settings->value ("terminal/fontSize",10).toInt ()); ui->showFilenames->setChecked (settings->value ("showFilenames").toBool()); ui->showFileSize->setChecked (settings->value ("showFileSize").toBool()); ui->showFileType->setChecked (settings->value ("showFileType").toBool()); @@ -94,6 +96,8 @@ settings->setValue ("editor/fontName", ui->editor_fontName->currentFont().family()); settings->setValue ("editor/fontSize", ui->editor_fontSize->value()); settings->setValue ("editor/longWindowTitle", ui->editor_longWindowTitle->isChecked()); + settings->setValue ("terminal/fontSize", ui->terminal_fontSize->value()); + settings->setValue ("terminal/fontName", ui->terminal_fontName->currentFont().family()); settings->setValue ("showFilenames", ui->showFilenames->isChecked ()); settings->setValue ("showFileSize", ui->showFileSize->isChecked ()); settings->setValue ("showFileType", ui->showFileType->isChecked ());
--- a/gui/src/SettingsDialog.ui +++ b/gui/src/SettingsDialog.ui @@ -237,6 +237,70 @@ </item> </layout> </widget> + <widget class="QWidget" name="tab_5"> + <attribute name="title"> + <string>Terminal</string> + </attribute> + <widget class="QWidget" name="layoutWidget"> + <property name="geometry"> + <rect> + <x>10</x> + <y>10</y> + <width>436</width> + <height>22</height> + </rect> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_5"> + <item> + <widget class="QLabel" name="label_11"> + <property name="text"> + <string>Font</string> + </property> + </widget> + </item> + <item> + <widget class="QFontComboBox" name="terminal_fontName"> + <property name="editable"> + <bool>false</bool> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_12"> + <property name="text"> + <string>Font Size</string> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="terminal_fontSize"> + <property name="minimum"> + <number>2</number> + </property> + <property name="maximum"> + <number>96</number> + </property> + <property name="value"> + <number>10</number> + </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> + </layout> + </widget> + </widget> <widget class="QWidget" name="tab_2"> <attribute name="title"> <string>File Browser</string>