27 #if defined (HAVE_CONFIG_H) 36 #include "ui-settings-dialog.h" 38 #include <QButtonGroup> 41 #include <QFileDialog> 44 #include <QMessageBox> 47 #if defined (HAVE_QSCINTILLA) 50 # include <QScrollArea> 52 # if defined (HAVE_QSCI_QSCILEXEROCTAVE_H) 53 # define HAVE_LEXER_OCTAVE 1 54 # include <Qsci/qscilexeroctave.h> 55 # elif defined (HAVE_QSCI_QSCILEXERMATLAB_H) 56 # define HAVE_LEXER_MATLAB 1 57 # include <Qsci/qscilexermatlab.h> 60 # include <Qsci/qscilexercpp.h> 61 # include <Qsci/qscilexerbash.h> 62 # include <Qsci/qscilexerperl.h> 63 # include <Qsci/qscilexerbatch.h> 64 # include <Qsci/qscilexerdiff.h> 67 #if defined (HAVE_QSCINTILLA) 79 if ((lexer->description (actual_style)) !=
"")
80 styles[max_style++] = actual_style;
90 lexer->readSettings (*settings);
94 QGridLayout *style_grid =
new QGridLayout ();
95 QVector<QLabel*> description (max_style);
96 QVector<QFontComboBox*> select_font (max_style);
97 QVector<QSpinBox*> font_size (max_style);
98 QVector<QCheckBox*> attrib_font (3 * max_style);
99 QVector<color_picker*> color (max_style);
100 QVector<color_picker*> bg_color (max_style);
101 int default_size = 10;
102 QFont default_font = QFont ();
104 QColor default_color = QColor ();
105 QColor dummy_color = QColor (255, 0, 255);
107 for (
int i = 0;
i < max_style;
i++)
109 QString actual_name = lexer->description (styles[
i]);
110 QFont actual_font = lexer->font (styles[
i]);
111 description[
i] =
new QLabel (actual_name);
112 description[
i]->setWordWrap (
true);
113 label_width = 24*description[
i]->fontMetrics ().averageCharWidth ();
114 description[
i]->setMaximumSize (label_width, QWIDGETSIZE_MAX);
115 description[
i]->setMinimumSize (label_width, 1);
116 select_font[
i] =
new QFontComboBox ();
117 select_font[
i]->setObjectName (actual_name +
"_font");
118 select_font[
i]->setMaximumSize (label_width, QWIDGETSIZE_MAX);
119 select_font[
i]->setMinimumSize (label_width, 1);
120 font_size[
i] =
new QSpinBox ();
121 font_size[
i]->setObjectName (actual_name +
"_size");
124 select_font[
i]->setCurrentFont (actual_font);
125 default_font = actual_font;
126 font_size[
i]->setRange (6, 24);
127 default_size = actual_font.pointSize ();
128 font_size[
i]->setValue (default_size);
129 default_color = lexer->defaultPaper ();
134 select_font[
i]->setCurrentFont (actual_font);
135 if (actual_font.family () == default_font.family ())
136 select_font[
i]->setEditText (lexer->description (0));
137 font_size[
i]->setRange (-4, 4);
138 font_size[
i]->setValue (actual_font.pointSize ()-default_size);
139 font_size[
i]->setToolTip (QObject::tr (
"Difference to the default size"));
140 if (lexer->paper (styles[
i]) == default_color)
144 bg_color[
i]->setToolTip
145 (QObject::tr (
"Background color, pink (255, 0, 255) means default"));
147 attrib_font[0+3*
i] =
new QCheckBox (QObject::tr (
"b",
"short form for bold"));
148 attrib_font[1+3*
i] =
new QCheckBox (QObject::tr (
"i",
"short form for italic"));
149 attrib_font[2+3*
i] =
new QCheckBox (QObject::tr (
"u",
"short form for underlined"));
150 attrib_font[0+3*
i]->setChecked (actual_font.bold ());
151 attrib_font[0+3*
i]->setObjectName (actual_name +
"_bold");
152 attrib_font[1+3*
i]->setChecked (actual_font.italic ());
153 attrib_font[1+3*
i]->setObjectName (actual_name +
"_italic");
154 attrib_font[2+3*
i]->setChecked (actual_font.underline ());
155 attrib_font[2+3*
i]->setObjectName (actual_name +
"_underline");
157 color[
i]->setObjectName (actual_name +
"_color");
158 bg_color[
i]->setObjectName (actual_name +
"_bg_color");
160 style_grid->addWidget (description[
i],
i,
column++);
161 style_grid->addWidget (select_font[
i],
i,
column++);
162 style_grid->addWidget (font_size[
i],
i,
column++);
163 style_grid->addWidget (attrib_font[0+3*
i],
i,
column++);
164 style_grid->addWidget (attrib_font[1+3*
i],
i,
column++);
165 style_grid->addWidget (attrib_font[2+3*
i],
i,
column++);
166 style_grid->addWidget (color[
i],
i,
column++);
167 style_grid->addWidget (bg_color[
i],
i,
column++);
170 QScrollArea *scroll_area =
new QScrollArea ();
172 scroll_area_contents->setObjectName (QString (lexer->language ()) +
"_styles");
173 scroll_area_contents->setLayout (style_grid);
174 scroll_area->setWidget (scroll_area_contents);
175 ui->tabs_editor_lexers->addTab (scroll_area, lexer->language ());
177 ui->tabs_editor_lexers->setCurrentIndex (settings->value (
"settings/last_editor_styles_tab", 0).toInt ());
184 QWidget *tab = ui->tabs_editor_lexers->
185 findChild <QWidget *> (QString (lexer->language ()) +
"_styles");
189 QFontComboBox *select_font;
191 QCheckBox *attrib_font[3];
194 int default_size = 10;
195 QFont default_font = QFont (
"Courier New", 10, -1, 0);
196 QColor default_color = QColor ();
197 QColor dummy_color = QColor (255, 0, 255);
199 for (
int i = 0;
i < max_style;
i++)
201 QString actual_name = lexer->description (styles[
i]);
202 select_font = tab->findChild <QFontComboBox *> (actual_name +
"_font");
203 font_size = tab->findChild <QSpinBox *> (actual_name +
"_size");
204 attrib_font[0] = tab->findChild <QCheckBox *> (actual_name +
"_bold");
205 attrib_font[1] = tab->findChild <QCheckBox *> (actual_name +
"_italic");
206 attrib_font[2] = tab->findChild <QCheckBox *> (actual_name +
"_underline");
207 color = tab->findChild <
color_picker *> (actual_name +
"_color");
208 bg_color = tab->findChild <
color_picker *> (actual_name +
"_bg_color");
209 QFont new_font = default_font;
212 new_font = select_font->currentFont ();
214 default_font = new_font;
215 else if (select_font->currentText () == lexer->description (0))
216 new_font = default_font;
222 default_size = font_size->value ();
223 new_font.setPointSize (font_size->value ());
226 new_font.setPointSize (font_size->value ()+default_size);
229 new_font.setBold (attrib_font[0]->isChecked ());
231 new_font.setItalic (attrib_font[1]->isChecked ());
233 new_font.setUnderline (attrib_font[2]->isChecked ());
234 lexer->setFont (new_font, styles[
i]);
236 lexer->setDefaultFont (new_font);
238 lexer->setColor (color->color (), styles[
i]);
243 default_color = bg_color->
color ();
244 lexer->setPaper (default_color, styles[
i]);
245 lexer->setDefaultPaper (default_color);
249 if (bg_color->
color () == dummy_color)
250 lexer->setPaper (default_color, styles[
i]);
252 lexer->setPaper (bg_color->
color (), styles[
i]);
257 lexer->writeSettings (*settings);
259 settings->setValue (
"settings/last_editor_styles_tab",
260 ui->tabs_editor_lexers->currentIndex ());
271 QSettings *settings = resource_manager::get_settings ();
276 (QMessageBox::Warning, tr (
"Octave Settings"),
277 tr (
"Unable to save settings. Missing settings file or unknown directory."));
285 QString qm_dir_name = resource_manager::get_gui_translation_dir ();
286 QDir qm_dir (qm_dir_name);
287 QFileInfoList qm_files = qm_dir.entryInfoList (QStringList (
"*.qm"), QDir::Files | QDir::Readable, QDir::Name);
289 for (
int i = 0;
i < qm_files.length ();
i++)
290 ui->comboBox_language->addItem (qm_files.at (
i).baseName ());
292 ui->comboBox_language->insertItem (0, tr (
"System setting"));
293 ui->comboBox_language->insertSeparator (1);
294 QString language = settings->value (
"language",
"SYSTEM").toString ();
295 if (language ==
"SYSTEM")
296 language = tr (
"System setting");
297 int selected =
ui->comboBox_language->findText (language);
299 ui->comboBox_language->setCurrentIndex (selected);
301 ui->comboBox_language->setCurrentIndex (0);
304 QButtonGroup *icon_size_group =
new QButtonGroup (
this);
305 icon_size_group->addButton (
ui->icon_size_small);
306 icon_size_group->addButton (
ui->icon_size_normal);
307 icon_size_group->addButton (
ui->icon_size_large);
308 int icon_size = settings->value (
"toolbar_icon_size", 0).toInt ();
309 ui->icon_size_normal->setChecked (
true);
310 ui->icon_size_small->setChecked (icon_size == -1);
311 ui->icon_size_large->setChecked (icon_size == 1);
314 QButtonGroup *icon_group =
new QButtonGroup (
this);
315 icon_group->addButton (
ui->general_icon_octave);
316 icon_group->addButton (
ui->general_icon_graphic);
317 icon_group->addButton (
ui->general_icon_letter);
318 QString widget_icon_set =
319 settings->value (
"DockWidgets/widget_icon_set",
"NONE").toString ();
320 ui->general_icon_octave->setChecked (
true);
321 ui->general_icon_octave->setChecked (widget_icon_set ==
"NONE");
322 ui->general_icon_graphic->setChecked (widget_icon_set ==
"GRAPHIC");
323 ui->general_icon_letter->setChecked (widget_icon_set ==
"LETTER");
326 QVariant default_var = QColor (255, 255, 255);
327 QColor bg_color = settings->value (
"DockWidgets/title_bg_color",
328 default_var).value<QColor> ();
333 connect (
ui->cb_widget_custom_style, SIGNAL (toggled (
bool)),
336 default_var = QColor (192, 192, 192);
337 QColor bg_color_active = settings->value (
"DockWidgets/title_bg_color_active",
338 default_var).value<QColor> ();
343 connect (
ui->cb_widget_custom_style, SIGNAL (toggled (
bool)),
346 default_var = QColor (0, 0, 0);
347 QColor fg_color = settings->value (
"DockWidgets/title_fg_color",
348 default_var).value<QColor> ();
353 connect (
ui->cb_widget_custom_style, SIGNAL (toggled (
bool)),
356 default_var = QColor (0, 0, 0);
357 QColor fg_color_active = settings->value (
"DockWidgets/title_fg_color_active",
358 default_var).value<QColor> ();
363 connect (
ui->cb_widget_custom_style, SIGNAL (toggled (
bool)),
366 ui->sb_3d_title->setValue (settings->value (
"DockWidgets/widget_title_3d", 50).toInt ());
367 ui->cb_widget_custom_style->setChecked (settings->value (
"DockWidgets/widget_title_custom_style",
false).toBool ());
372 if (settings->contains (
"cursor_blinking"))
375 ui->cb_cursor_blinking->setChecked (settings->value (
"cursor_blinking",
true).toBool ());
380 ui->cb_cursor_blinking->setChecked (settings->value (
"terminal/cursorBlinking",
true).toBool ());
384 ui->cb_prompt_to_exit->setChecked (settings->value (
"prompt_to_exit",
false).toBool ());
387 ui->cb_status_bar->setChecked (settings->value (
"show_status_bar",
true).toBool ());
390 ui->cb_restore_octave_dir->setChecked (settings->value (
"restore_octave_dir",
false).toBool ());
391 ui->le_octave_dir->setText (settings->value (
"octave_startup_dir").toString ());
393 connect (
ui->pb_octave_dir, SIGNAL (pressed (
void)),
399 ui->useCustomFileEditor->setChecked (settings->value (
"useCustomFileEditor",
false).toBool ());
400 ui->customFileEditor->setText (settings->value (
"customFileEditor").toString ());
401 ui->editor_showLineNumbers->setChecked (settings->value (
"editor/showLineNumbers",
true).toBool ());
402 ui->editor_linenr_size->setValue (settings->value (
"editor/line_numbers_size", 0).toInt ());
404 resource_manager::combo_encoding (
ui->editor_combo_encoding);
406 default_var = QColor (240, 240, 240);
407 QColor setting_color = settings->value (
"editor/highlight_current_line_color", default_var).value<QColor> ();
413 connect (
ui->editor_highlightCurrentLine, SIGNAL (toggled (
bool)),
416 ui->editor_highlightCurrentLine->setChecked (settings->value (
"editor/highlightCurrentLine",
true).toBool ());
417 ui->editor_long_line_marker->setChecked (settings->value (
"editor/long_line_marker",
true).toBool ());
419 settings->value (
"editor/long_line_marker_line",
true).toBool ();
420 ui->editor_long_line_marker_line->setChecked (long_line);
422 settings->value (
"editor/long_line_marker_background",
false).toBool ();
423 ui->editor_long_line_marker_background->setChecked (long_back);
424 if (! (long_line || long_back))
425 ui->editor_long_line_marker_line->setChecked (
true);
426 ui->editor_long_line_column->setValue (settings->value (
"editor/long_line_column", 80).toInt ());
427 ui->editor_break_checkbox->setChecked (settings->value (
"editor/break_lines",
false).toBool ());
428 ui->editor_break_checkbox->setChecked (settings->value (
"editor/break_lines_comments",
false).toBool ());
429 ui->editor_wrap_checkbox->setChecked (settings->value (
"editor/wrap_lines",
false).toBool ());
430 ui->cb_edit_status_bar->setChecked (settings->value (
"editor/show_edit_status_bar",
true).toBool ());
431 ui->cb_edit_tool_bar->setChecked (settings->value (
"editor/show_toolbar",
true).toBool ());
432 ui->cb_code_folding->setChecked (settings->value (
"editor/code_folding",
true).toBool ());
433 ui->editor_highlight_all_occurrences->setChecked (settings->value (
"editor/highlight_all_occurrences",
true).toBool ());
435 ui->editor_auto_endif->setCurrentIndex (settings->value (
"editor/auto_endif", 1).toInt () );
436 ui->editor_codeCompletion->setChecked (settings->value (
"editor/codeCompletion",
true).toBool ());
437 ui->editor_spinbox_ac_threshold->setValue (settings->value (
"editor/codeCompletion_threshold", 2).toInt ());
438 ui->editor_checkbox_ac_keywords->setChecked (settings->value (
"editor/codeCompletion_keywords",
true).toBool ());
439 ui->editor_checkbox_ac_builtins->setEnabled (
ui->editor_checkbox_ac_keywords->isChecked ());
440 ui->editor_checkbox_ac_functions->setEnabled (
ui->editor_checkbox_ac_keywords->isChecked ());
441 ui->editor_checkbox_ac_builtins->setChecked (settings->value (
"editor/codeCompletion_octave_builtins",
true).toBool ());
442 ui->editor_checkbox_ac_functions->setChecked (settings->value (
"editor/codeCompletion_octave_functions",
true).toBool ());
443 ui->editor_checkbox_ac_document->setChecked (settings->value (
"editor/codeCompletion_document",
false).toBool ());
444 ui->editor_checkbox_ac_case->setChecked (settings->value (
"editor/codeCompletion_case",
true).toBool ());
445 ui->editor_checkbox_ac_replace->setChecked (settings->value (
"editor/codeCompletion_replace",
false).toBool ());
446 ui->editor_ws_checkbox->setChecked (settings->value (
"editor/show_white_space",
false).toBool ());
447 ui->editor_ws_indent_checkbox->setChecked (settings->value (
"editor/show_white_space_indent",
false).toBool ());
448 ui->cb_show_eol->setChecked (settings->value (
"editor/show_eol_chars",
false).toBool ());
449 ui->cb_show_hscrollbar->setChecked (settings->value (
"editor/show_hscroll_bar",
true).toBool ());
451 int selected_comment_string, selected_uncomment_string;
484 #if defined (HAVE_QSCINTILLA) 485 # if defined (Q_OS_WIN32) 486 int eol_mode = QsciScintilla::EolWindows;
487 #elif defined (Q_OS_MAC) 488 int eol_mode = QsciScintilla::EolMac;
490 int eol_mode = QsciScintilla::EolUnix;
495 ui->combo_eol_mode->setCurrentIndex (settings->value (
"editor/default_eol_mode", eol_mode).toInt ());
496 ui->editor_auto_ind_checkbox->setChecked (settings->value (
"editor/auto_indent",
true).toBool ());
497 ui->editor_tab_ind_checkbox->setChecked (settings->value (
"editor/tab_indents_line",
false).toBool ());
498 ui->editor_bs_unind_checkbox->setChecked (settings->value (
"editor/backspace_unindents_line",
false).toBool ());
499 ui->editor_ind_guides_checkbox->setChecked (settings->value (
"editor/show_indent_guides",
false).toBool ());
500 ui->editor_ind_width_spinbox->setValue (settings->value (
"editor/indent_width", 2).toInt ());
501 ui->editor_ind_uses_tabs_checkbox->setChecked (settings->value (
"editor/indent_uses_tabs",
false).toBool ());
502 ui->editor_tab_width_spinbox->setValue (settings->value (
"editor/tab_width", 2).toInt ());
503 ui->editor_longWindowTitle->setChecked (settings->value (
"editor/longWindowTitle",
false).toBool ());
504 ui->editor_notebook_tab_width_min->setValue (settings->value (
"editor/notebook_tab_width_min", 160).toInt ());
505 ui->editor_notebook_tab_width_max->setValue (settings->value (
"editor/notebook_tab_width_max", 300).toInt ());
506 ui->editor_restoreSession->setChecked (settings->value (
"editor/restoreSession",
true).toBool ());
507 ui->editor_create_new_file->setChecked (settings->value (
"editor/create_new_file",
false).toBool ());
508 ui->editor_reload_changed_files->setChecked (settings->value (
"editor/always_reload_changed_files",
false).toBool ());
509 ui->editor_hiding_closes_files->setChecked (settings->value (
"editor/hiding_closes_files",
false).toBool ());
512 ui->terminal_fontName->setCurrentFont (QFont (settings->value (
"terminal/fontName",
"Courier New").toString ()));
513 ui->terminal_fontSize->setValue (settings->value (
"terminal/fontSize", 10).toInt ());
514 ui->terminal_history_buffer->setValue (settings->value (
"terminal/history_buffer", 1000).toInt ());
515 ui->terminal_cursorUseForegroundColor->setChecked (settings->value (
"terminal/cursorUseForegroundColor",
true).toBool ());
516 ui->terminal_focus_command->setChecked (settings->value (
"terminal/focus_after_command",
false).toBool ());
517 ui->terminal_print_dbg_location->setChecked (settings->value (
"terminal/print_debug_location",
false).toBool ());
520 = settings->value (
"terminal/cursorType",
"ibeam").toString ();
523 items << QString (
"0") << QString (
"1") << QString (
"2");
524 ui->terminal_cursorType->addItems (items);
525 ui->terminal_cursorType->setItemText (0, tr (
"IBeam Cursor"));
526 ui->terminal_cursorType->setItemText (1, tr (
"Block Cursor"));
527 ui->terminal_cursorType->setItemText (2, tr (
"Underline Cursor"));
529 if (cursorType ==
"ibeam")
530 ui->terminal_cursorType->setCurrentIndex (0);
531 else if (cursorType ==
"block")
532 ui->terminal_cursorType->setCurrentIndex (1);
533 else if (cursorType ==
"underline")
534 ui->terminal_cursorType->setCurrentIndex (2);
537 connect (
ui->sync_octave_directory, SIGNAL (toggled (
bool)),
540 ui->sync_octave_directory->setChecked (settings->value (
"filesdockwidget/sync_octave_directory",
true).toBool ());
541 ui->cb_restore_file_browser_dir->setChecked (settings->value (
"filesdockwidget/restore_last_dir",
false).toBool ());
542 ui->le_file_browser_dir->setText (settings->value (
"filesdockwidget/startup_dir").toString ());
544 connect (
ui->pb_file_browser_dir, SIGNAL (pressed (
void)),
547 ui->le_file_browser_extensions->setText (settings->value (
"filesdockwidget/txt_file_extensions",
"m;c;cc;cpp;h;txt").toString ());
549 ui->checkbox_allow_web_connect->setChecked (settings->value (
"news/allow_web_connection",
false).toBool ());
550 ui->useProxyServer->setChecked (settings->value (
"useProxyServer",
false).toBool ());
551 ui->proxyHostName->setText (settings->value (
"proxyHostName").toString ());
553 int currentIndex = 0;
554 QString proxyTypeString = settings->value (
"proxyType").toString ();
555 while ((currentIndex < ui->proxyType->count ())
556 && (
ui->proxyType->currentText () != proxyTypeString))
559 ui->proxyType->setCurrentIndex (currentIndex);
562 ui->proxyPort->setText (settings->value (
"proxyPort").toString ());
563 ui->proxyUserName->setText (settings->value (
"proxyUserName").toString ());
564 ui->proxyPassword->setText (settings->value (
"proxyPassword").toString ());
570 ui->cb_hide_tool_tips->setChecked (settings->value (
"workspaceview/hide_tool_tips",
false).toBool ());
576 ui->varedit_columnWidth->setValue (settings->value (
"variable_editor/column_width", 100).toInt ());
577 ui->varedit_autoFitColumnWidth->setChecked (settings->value (
"variable_editor/autofit_column_width",
false).toBool ());
578 ui->varedit_autofitType->setCurrentIndex (settings->value (
"autofit_type", 0).toInt ());
579 ui->varedit_rowHeight->setValue (settings->value (
"variable_editor/row_height", 10).toInt ());
580 ui->varedit_rowAutofit->setChecked (settings->value (
"variable_editor/autofit_row_height",
true).toBool ());
582 ui->varedit_font->setCurrentFont (QFont (settings->value (
"variable_editor/font_name", settings->value (
"terminal/fontName",
"Courier New")).toString ()));
583 ui->varedit_fontSize->setValue (settings->value (
"variable_editor/font_size", QVariant (10)).toInt ());
584 connect (
ui->varedit_useTerminalFont, SIGNAL (toggled (
bool)),
585 ui->varedit_font, SLOT (setDisabled (
bool)));
586 connect (
ui->varedit_useTerminalFont, SIGNAL (toggled (
bool)),
587 ui->varedit_fontSize, SLOT (setDisabled (
bool)));
588 ui->varedit_useTerminalFont->setChecked (settings->value (
"variable_editor/use_terminal_font",
false).toBool ());
589 ui->varedit_font->setDisabled (
ui->varedit_useTerminalFont->isChecked ());
590 ui->varedit_fontSize->setDisabled (
ui->varedit_useTerminalFont->isChecked ());
592 ui->varedit_alternate->setChecked (settings->value (
"variable_editor/alternate_rows", QVariant (
false)).toBool ());
599 ui->cb_prevent_readline_conflicts->setChecked (settings->value (
"shortcuts/prevent_readline_conflicts",
true).toBool ());
602 shortcut_manager::fill_treewidget (
ui->shortcuts_treewidget);
605 connect (
ui->btn_import_shortcut_set, SIGNAL (clicked (
void)),
608 connect (
ui->btn_export_shortcut_set, SIGNAL (clicked (
void)),
611 connect (
ui->btn_default_shortcut_set, SIGNAL (clicked (
void)),
614 #if defined (HAVE_QSCINTILLA) 619 #if defined (HAVE_LEXER_OCTAVE) 621 lexer =
new QsciLexerOctave ();
625 #elif defined (HAVE_LEXER_MATLAB) 627 lexer =
new QsciLexerMatlab ();
633 lexer =
new QsciLexerCPP ();
637 lexer =
new QsciLexerPerl ();
641 lexer =
new QsciLexerBatch ();
645 lexer =
new QsciLexerDiff ();
649 lexer =
new QsciLexerBash ();
663 connect (
ui->button_box, SIGNAL (clicked (QAbstractButton *)),
667 if (settings->contains (
"settings/geometry"))
668 restoreGeometry (settings->value (
"settings/geometry").toByteArray ());
670 setGeometry (QRect (10,50,1000,600));
683 QSettings *settings = resource_manager::get_settings ();
685 ui->tabWidget->setCurrentIndex (settings->value (
"settings/last_tab", 0).toInt ());
689 QHash <QString, QWidget*> tab_hash;
690 tab_hash[
"editor"] =
ui->tab_editor;
691 tab_hash[
"editor_styles"] =
ui->tab_editor_styles;
692 ui->tabWidget->setCurrentIndex (
ui->tabWidget->indexOf (tab_hash.value (tab)));
699 get_dir (
ui->le_octave_dir, tr (
"Set Octave Startup Directory"));
705 get_dir (
ui->le_file_browser_dir, tr (
"Set File Browser Startup Directory"));
711 QString dir = QFileDialog::getExistingDirectory
712 (
this, title, line_edit->text (), QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
714 line_edit->setText (dir);
720 QDialogButtonBox::ButtonRole button_role =
ui->button_box->buttonRole (button);
722 if (button_role == QDialogButtonBox::ApplyRole
723 || button_role == QDialogButtonBox::AcceptRole)
729 if (button_role == QDialogButtonBox::RejectRole
730 || button_role == QDialogButtonBox::AcceptRole)
737 ui->cb_restore_file_browser_dir->setDisabled (disable);
741 ui->le_file_browser_dir->setDisabled (
ui->cb_restore_file_browser_dir->isChecked ());
742 ui->pb_file_browser_dir->setDisabled (
ui->cb_restore_file_browser_dir->isChecked ());
746 ui->le_file_browser_dir->setDisabled (disable);
747 ui->pb_file_browser_dir->setDisabled (disable);
755 shortcut_manager::import_export (shortcut_manager::OSC_IMPORT);
761 shortcut_manager::import_export (shortcut_manager::OSC_EXPORT);
767 shortcut_manager::import_export (shortcut_manager::OSC_DEFAULT);
773 QSettings *settings = resource_manager::get_settings ();
776 QString widget_icon_set =
"NONE";
777 if (
ui->general_icon_letter->isChecked ())
778 widget_icon_set =
"LETTER";
779 else if (
ui->general_icon_graphic->isChecked ())
780 widget_icon_set =
"GRAPHIC";
781 settings->setValue (
"DockWidgets/widget_icon_set", widget_icon_set);
784 QString language =
ui->comboBox_language->currentText ();
785 if (language == tr (
"System setting"))
787 settings->setValue (
"language", language);
790 settings->setValue (
"DockWidgets/widget_title_custom_style",
ui->cb_widget_custom_style->isChecked ());
791 settings->setValue (
"DockWidgets/widget_title_3d",
ui->sb_3d_title->value ());
799 if (
ui->icon_size_small->isChecked ())
801 else if (
ui->icon_size_large->isChecked ())
803 settings->setValue (
"toolbar_icon_size", icon_size);
806 settings->setValue (
"cursor_blinking",
ui->cb_cursor_blinking->isChecked ());
809 settings->setValue (
"prompt_to_exit",
ui->cb_prompt_to_exit->isChecked ());
812 settings->setValue (
"show_status_bar",
ui->cb_status_bar->isChecked ());
815 settings->setValue (
"restore_octave_dir",
ui->cb_restore_octave_dir->isChecked ());
816 settings->setValue (
"octave_startup_dir",
ui->le_octave_dir->text ());
819 settings->setValue (
"useCustomFileEditor",
ui->useCustomFileEditor->isChecked ());
820 settings->setValue (
"customFileEditor",
ui->customFileEditor->text ());
821 settings->setValue (
"editor/showLineNumbers",
ui->editor_showLineNumbers->isChecked ());
822 settings->setValue (
"editor/line_numbers_size",
ui->editor_linenr_size->value ());
823 settings->setValue (
"editor/highlightCurrentLine",
ui->editor_highlightCurrentLine->isChecked ());
825 settings->setValue (
"editor/long_line_marker",
ui->editor_long_line_marker->isChecked ());
826 settings->setValue (
"editor/long_line_marker_line",
ui->editor_long_line_marker_line->isChecked ());
827 settings->setValue (
"editor/long_line_marker_background",
ui->editor_long_line_marker_background->isChecked ());
828 settings->setValue (
"editor/long_line_column",
ui->editor_long_line_column->value ());
829 settings->setValue (
"editor/break_lines",
ui->editor_break_checkbox->isChecked ());
830 settings->setValue (
"editor/break_lines_comments",
ui->editor_break_comments_checkbox->isChecked ());
831 settings->setValue (
"editor/wrap_lines",
ui->editor_wrap_checkbox->isChecked ());
832 settings->setValue (
"editor/code_folding",
ui->cb_code_folding->isChecked ());
833 settings->setValue (
"editor/show_edit_status_bar",
ui->cb_edit_status_bar->isChecked ());
834 settings->setValue (
"editor/show_toolbar",
ui->cb_edit_tool_bar->isChecked ());
835 settings->setValue (
"editor/highlight_all_occurrences",
ui->editor_highlight_all_occurrences->isChecked ());
836 settings->setValue (
"editor/codeCompletion",
ui->editor_codeCompletion->isChecked ());
837 settings->setValue (
"editor/codeCompletion_threshold",
ui->editor_spinbox_ac_threshold->value ());
838 settings->setValue (
"editor/codeCompletion_keywords",
ui->editor_checkbox_ac_keywords->isChecked ());
839 settings->setValue (
"editor/codeCompletion_octave_builtins",
ui->editor_checkbox_ac_builtins->isChecked ());
840 settings->setValue (
"editor/codeCompletion_octave_functions",
ui->editor_checkbox_ac_functions->isChecked ());
841 settings->setValue (
"editor/codeCompletion_document",
ui->editor_checkbox_ac_document->isChecked ());
842 settings->setValue (
"editor/codeCompletion_case",
ui->editor_checkbox_ac_case->isChecked ());
843 settings->setValue (
"editor/codeCompletion_replace",
ui->editor_checkbox_ac_replace->isChecked ());
844 settings->setValue (
"editor/auto_endif",
ui->editor_auto_endif->currentIndex ());
845 settings->setValue (
"editor/show_white_space",
ui->editor_ws_checkbox->isChecked ());
846 settings->setValue (
"editor/show_white_space_indent",
ui->editor_ws_indent_checkbox->isChecked ());
847 settings->setValue (
"editor/show_eol_chars",
ui->cb_show_eol->isChecked ());
848 settings->setValue (
"editor/show_hscroll_bar",
ui->cb_show_hscrollbar->isChecked ());
849 settings->setValue (
"editor/default_eol_mode",
ui->combo_eol_mode->currentIndex ());
852 int rb_uncomment = 0;
864 rb_uncomment = rb_uncomment + (1 <<
i);
868 settings->setValue (
"editor/default_encoding",
ui->editor_combo_encoding->currentText ());
869 settings->setValue (
"editor/auto_indent",
ui->editor_auto_ind_checkbox->isChecked ());
870 settings->setValue (
"editor/tab_indents_line",
ui->editor_tab_ind_checkbox->isChecked ());
871 settings->setValue (
"editor/backspace_unindents_line",
ui->editor_bs_unind_checkbox->isChecked ());
872 settings->setValue (
"editor/show_indent_guides",
ui->editor_ind_guides_checkbox->isChecked ());
873 settings->setValue (
"editor/indent_width",
ui->editor_ind_width_spinbox->value ());
874 settings->setValue (
"editor/indent_uses_tabs",
ui->editor_ind_uses_tabs_checkbox->isChecked ());
875 settings->setValue (
"editor/tab_width",
ui->editor_tab_width_spinbox->value ());
876 settings->setValue (
"editor/longWindowTitle",
ui->editor_longWindowTitle->isChecked ());
877 settings->setValue (
"editor/notebook_tab_width_min",
ui->editor_notebook_tab_width_min->value ());
878 settings->setValue (
"editor/notebook_tab_width_max",
ui->editor_notebook_tab_width_max->value ());
879 settings->setValue (
"editor/restoreSession",
ui->editor_restoreSession->isChecked ());
880 settings->setValue (
"editor/create_new_file",
ui->editor_create_new_file->isChecked ());
881 settings->setValue (
"editor/hiding_closes_files",
ui->editor_hiding_closes_files->isChecked ());
882 settings->setValue (
"editor/always_reload_changed_files",
ui->editor_reload_changed_files->isChecked ());
883 settings->setValue (
"terminal/fontSize",
ui->terminal_fontSize->value ());
884 settings->setValue (
"terminal/fontName",
ui->terminal_fontName->currentFont ().family ());
887 settings->setValue (
"filesdockwidget/sync_octave_directory",
ui->sync_octave_directory->isChecked ());
888 settings->setValue (
"filesdockwidget/restore_last_dir",
ui->cb_restore_file_browser_dir->isChecked ());
889 settings->setValue (
"filesdockwidget/startup_dir",
ui->le_file_browser_dir->text ());
890 settings->setValue (
"filesdockwidget/txt_file_extensions",
ui->le_file_browser_extensions->text ());
892 settings->setValue (
"news/allow_web_connection",
ui->checkbox_allow_web_connect->isChecked ());
893 settings->setValue (
"useProxyServer",
ui->useProxyServer->isChecked ());
894 settings->setValue (
"proxyType",
ui->proxyType->currentText ());
895 settings->setValue (
"proxyHostName",
ui->proxyHostName->text ());
896 settings->setValue (
"proxyPort",
ui->proxyPort->text ());
897 settings->setValue (
"proxyUserName",
ui->proxyUserName->text ());
898 settings->setValue (
"proxyPassword",
ui->proxyPassword->text ());
899 settings->setValue (
"terminal/cursorUseForegroundColor",
ui->terminal_cursorUseForegroundColor->isChecked ());
900 settings->setValue (
"terminal/focus_after_command",
ui->terminal_focus_command->isChecked ());
901 settings->setValue (
"terminal/print_debug_location",
ui->terminal_print_dbg_location->isChecked ());
902 settings->setValue (
"terminal/history_buffer",
ui->terminal_history_buffer->value ());
906 switch (
ui->terminal_cursorType->currentIndex ())
908 case 0: cursorType =
"ibeam";
break;
909 case 1: cursorType =
"block";
break;
910 case 2: cursorType =
"underline";
break;
912 settings->setValue (
"terminal/cursorType", cursorType);
914 #if defined (HAVE_QSCINTILLA) 918 #if defined (HAVE_LEXER_OCTAVE) 920 lexer =
new QsciLexerOctave ();
924 #elif defined (HAVE_LEXER_MATLAB) 926 lexer =
new QsciLexerMatlab ();
932 lexer =
new QsciLexerCPP ();
936 lexer =
new QsciLexerPerl ();
940 lexer =
new QsciLexerBatch ();
944 lexer =
new QsciLexerDiff ();
948 lexer =
new QsciLexerBash ();
961 settings->setValue (
"workspaceview/hide_tool_tips",
ui->cb_hide_tool_tips->isChecked ());
967 settings->setValue (
"variable_editor/autofit_column_width",
ui->varedit_autoFitColumnWidth->isChecked ());
968 settings->setValue (
"variable_editor/autofit_type",
ui->varedit_autofitType->currentIndex ());
969 settings->setValue (
"variable_editor/column_width",
ui->varedit_columnWidth->value ());
970 settings->setValue (
"variable_editor/row_height",
ui->varedit_rowHeight->value ());
971 settings->setValue (
"variable_editor/autofit_row_height",
ui->varedit_rowAutofit->isChecked ());
972 settings->setValue (
"variable_editor/use_terminal_font",
ui->varedit_useTerminalFont->isChecked ());
973 settings->setValue (
"variable_editor/alternate_rows",
ui->varedit_alternate->isChecked ());
974 settings->setValue (
"variable_editor/font_name",
ui->varedit_font->currentFont ().family ());
975 settings->setValue (
"variable_editor/font_size",
ui->varedit_fontSize->value ());
979 settings->setValue (
"shortcuts/prevent_readline_conflicts",
ui->cb_prevent_readline_conflicts->isChecked ());
980 shortcut_manager::write_shortcuts (settings, closing);
983 settings->setValue (
"settings/last_tab",
ui->tabWidget->currentIndex ());
984 settings->setValue (
"settings/geometry", saveGeometry ());
994 resource_manager::storage_class_default_colors ();
995 QStringList class_names = resource_manager::storage_class_names ();
996 QString class_chars = resource_manager::storage_class_chars ();
997 int nr_of_classes = class_chars.length ();
999 QGridLayout *style_grid =
new QGridLayout ();
1000 QVector<QLabel*> description (nr_of_classes);
1001 QVector<color_picker*> color (nr_of_classes);
1005 for (
int i = 0;
i < nr_of_classes;
i++)
1007 description[
i] =
new QLabel (
" " + class_names.at (
i));
1008 description[
i]->setAlignment (Qt::AlignRight);
1009 QVariant default_var = default_colors.at (
i);
1010 QColor setting_color = settings->value (
"workspaceview/color_" + class_chars.mid (
i, 1), default_var).value<QColor> ();
1012 color[
i]->setObjectName (
"color_" + class_chars.mid (
i, 1));
1013 color[
i]->setMinimumSize (30, 10);
1014 style_grid->addWidget (description[
i],
row, 3*
column);
1015 style_grid->addWidget (color[
i],
row, 3*
column+1);
1018 style_grid->setColumnStretch (4*
column, 10);
1025 ui->workspace_colors_box->setLayout (style_grid);
1032 QString class_chars = resource_manager::storage_class_chars ();
1035 for (
int i = 0;
i < class_chars.length ();
i++)
1037 color =
ui->workspace_colors_box->findChild <
color_picker *> (
"color_" + class_chars.mid (
i, 1));
1039 settings->setValue (
"workspaceview/color_" + class_chars.mid (
i, 1), color->
color ());
1048 QList<QColor> default_colors = resource_manager::terminal_default_colors ();
1049 QStringList class_names = resource_manager::terminal_color_names ();
1050 QString class_chars = resource_manager::terminal_color_chars ();
1051 int nr_of_classes = class_chars.length ();
1053 QGridLayout *style_grid =
new QGridLayout ();
1054 QVector<QLabel*> description (nr_of_classes);
1055 QVector<color_picker*> color (nr_of_classes);
1059 for (
int i = 0;
i < nr_of_classes;
i++)
1061 description[
i] =
new QLabel (
" " + class_names.at (
i));
1062 description[
i]->setAlignment (Qt::AlignRight);
1063 QVariant default_var = default_colors.at (
i);
1064 QColor setting_color = settings->value (
"terminal/color_" + class_chars.mid (
i, 1), default_var).value<QColor> ();
1066 color[
i]->setObjectName (
"terminal_color_" + class_chars.mid (
i, 1));
1067 color[
i]->setMinimumSize (30, 10);
1068 style_grid->addWidget (description[
i],
row, 2*
column);
1069 style_grid->addWidget (color[
i],
row, 2*
column+1);
1072 style_grid->setColumnStretch (3*
column, 10);
1079 ui->terminal_colors_box->setLayout (style_grid);
1085 QString class_chars = resource_manager::terminal_color_chars ();
1088 for (
int i = 0;
i < class_chars.length ();
i++)
1090 color =
ui->terminal_colors_box->findChild <
color_picker *> (
"terminal_color_" + class_chars.mid (
i, 1));
1092 settings->setValue (
"terminal/color_" + class_chars.mid (
i, 1), color->
color ());
1103 QString class_chars = resource_manager::varedit_color_chars ();
1104 int nr_of_classes = class_chars.length ();
1106 QGridLayout *style_grid =
new QGridLayout ();
1107 QVector<QLabel*> description (nr_of_classes);
1108 QVector<color_picker*> color (nr_of_classes);
1112 for (
int i = 0;
i < nr_of_classes;
i++)
1114 description[
i] =
new QLabel (
" " + class_names.at (
i));
1115 description[
i]->setAlignment (Qt::AlignRight);
1116 QVariant default_var = default_colors.at (
i);
1117 QColor setting_color = settings->value (
"variable_editor/color_" + class_chars.mid (
i, 1), default_var).value<QColor> ();
1119 color[
i]->setObjectName (
"varedit_color_" + class_chars.mid (
i, 1));
1120 color[
i]->setMinimumSize (30, 10);
1121 style_grid->addWidget (description[
i],
row, 2*
column);
1122 style_grid->addWidget (color[
i],
row, 2*
column+1);
1125 style_grid->setColumnStretch (3*
column, 10);
1132 ui->varedit_colors_box->setLayout (style_grid);
1138 QString class_chars = resource_manager::varedit_color_chars ();
1141 for (
int i = 0;
i < class_chars.length ();
i++)
1143 color =
ui->varedit_colors_box->findChild <
color_picker *> (
"varedit_color_" + class_chars.mid (
i, 1));
1145 settings->setValue (
"variable_editor/color_" + class_chars.mid (
i, 1), color->
color ());
static const int MaxLexerStyles
static QStringList color_names(void)
settings_dialog(QWidget *parent, const QString &desired_tab=QString())
OCTAVE_EXPORT octave_value_list column
const QStringList oct_comment_strings(QStringList()<< "##"<< "#"<< "%"<< "%%"<< "%!")
static int get_valid_lexer_styles(QsciLexer *lexer, int styles[])
static void write_lexer_settings(Ui::settings_dialog *ui, QsciLexer *lexer, QSettings *settings)
color_picker * m_widget_title_fg_color_active
void read_varedit_colors(QSettings *settings)
void set_disabled_pref_file_browser_dir(bool disable)
void get_octave_dir(void)
const int oct_comment_str_d
void read_terminal_colors(QSettings *settings)
static void read_lexer_settings(Ui::settings_dialog *ui, QsciLexer *lexer, QSettings *settings)
void export_shortcut_set(void)
void default_shortcut_set(void)
void get_file_browser_dir(void)
color_picker * m_widget_title_bg_color
const QString oct_comment_str("editor/oct_comment_str")
color_picker * m_editor_current_line_color
void write_workspace_colors(QSettings *settings)
const int oct_uncomment_str_d
void apply_new_settings(void)
static QList< QColor > default_colors(void)
QRadioButton * m_rb_comment_strings[oct_comment_strings_count]
color_picker * m_widget_title_fg_color
const QString oct_comment_str_old("editor/octave_comment_string")
void import_shortcut_set(void)
void write_changed_settings(bool closing)
QRadioButton * m_rb_uncomment_strings[oct_comment_strings_count]
void show_tab(const QString &)
const QString oct_uncomment_str("editor/oct_uncomment_str")
void write_terminal_colors(QSettings *settings)
void get_dir(QLineEdit *, const QString &)
const int oct_comment_strings_count
void button_clicked(QAbstractButton *button)
void read_workspace_colors(QSettings *settings)
where the brackets indicate optional arguments and and character or cell array For character arrays the conversion is repeated for every row
void write_varedit_colors(QSettings *settings)
color_picker * m_widget_title_bg_color_active
static const int MaxStyleNumber