# HG changeset patch # User Torsten # Date 1368886433 -7200 # Node ID cf939872811cce65d1e41fa946cd62753092e03c # Parent 518dbe0ae857a845011cedf1b10af43110d7b405 options for auto completion threshold, source and word replacement in settings * settings-dialog.ui: new settings for auto completion threshold, source and word replacement * settings-dailog.cc(constructor): load values for new settings from file; (write_changed_settings): store values of new settings to settings file * file-editor-tab.cc(notice_settings): load values for auto completion threshold, source and word replacement from settings diff -r 518dbe0ae857 -r cf939872811c libgui/src/m-editor/file-editor-tab.cc --- a/libgui/src/m-editor/file-editor-tab.cc Sat May 18 15:17:03 2013 +0200 +++ b/libgui/src/m-editor/file-editor-tab.cc Sat May 18 16:13:53 2013 +0200 @@ -1093,8 +1093,30 @@ _edit_area->setCaretLineVisible (settings->value ("editor/highlightCurrentLine", true).toBool ()); - if (settings->value ("editor/codeCompletion", true).toBool ()) - _edit_area->setAutoCompletionThreshold (1); + if (settings->value ("editor/codeCompletion", true).toBool ()) // auto compl. + { + bool match_keywords = settings->value + ("editor/codeCompletion_keywords",true).toBool (); + bool match_document = settings->value + ("editor/codeCompletion_document",true).toBool (); + + QsciScintilla::AutoCompletionSource source = QsciScintilla::AcsNone; + if (match_keywords) + if (match_document) + source = QsciScintilla::AcsAll; + else + source = QsciScintilla::AcsAPIs; + else + if (match_document) + source = QsciScintilla::AcsDocument; + _edit_area->setAutoCompletionSource (source); + + _edit_area->setAutoCompletionReplaceWord + (settings->value ("editor/codeCompletion_replace",false).toBool ()); + + _edit_area->setAutoCompletionThreshold + (settings->value ("editor/codeCompletion_threshold",2).toInt ()); + } else _edit_area->setAutoCompletionThreshold (-1); diff -r 518dbe0ae857 -r cf939872811c libgui/src/settings-dialog.cc --- a/libgui/src/settings-dialog.cc Sat May 18 15:17:03 2013 +0200 +++ b/libgui/src/settings-dialog.cc Sat May 18 16:13:53 2013 +0200 @@ -93,6 +93,10 @@ ui->editor_showLineNumbers->setChecked (settings->value ("editor/showLineNumbers",true).toBool () ); ui->editor_highlightCurrentLine->setChecked (settings->value ("editor/highlightCurrentLine",true).toBool () ); ui->editor_codeCompletion->setChecked (settings->value ("editor/codeCompletion",true).toBool () ); + ui->editor_spinbox_ac_threshold->setValue (settings->value ("editor/codeCompletion_threshold",2).toInt ()); + ui->editor_checkbox_ac_keywords->setChecked (settings->value ("editor/codeCompletion_keywords",true).toBool ()); + ui->editor_checkbox_ac_document->setChecked (settings->value ("editor/codeCompletion_document",false).toBool ()); + ui->editor_checkbox_ac_replace->setChecked (settings->value ("editor/codeCompletion_replace",false).toBool ()); ui->editor_longWindowTitle->setChecked (settings->value ("editor/longWindowTitle",false).toBool ()); ui->editor_restoreSession->setChecked (settings->value ("editor/restoreSession",true).toBool ()); ui->terminal_fontName->setCurrentFont (QFont (settings->value ("terminal/fontName","Courier New").toString()) ); @@ -374,6 +378,10 @@ settings->setValue ("editor/showLineNumbers", ui->editor_showLineNumbers->isChecked ()); settings->setValue ("editor/highlightCurrentLine", ui->editor_highlightCurrentLine->isChecked ()); settings->setValue ("editor/codeCompletion", ui->editor_codeCompletion->isChecked ()); + settings->setValue ("editor/codeCompletion_threshold", ui->editor_spinbox_ac_threshold->value ()); + settings->setValue ("editor/codeCompletion_keywords", ui->editor_checkbox_ac_keywords->isChecked ()); + settings->setValue ("editor/codeCompletion_document", ui->editor_checkbox_ac_document->isChecked ()); + settings->setValue ("editor/codeCompletion_replace", ui->editor_checkbox_ac_replace->isChecked ()); settings->setValue ("editor/longWindowTitle", ui->editor_longWindowTitle->isChecked()); settings->setValue ("editor/restoreSession", ui->editor_restoreSession->isChecked ()); settings->setValue ("terminal/fontSize", ui->terminal_fontSize->value()); diff -r 518dbe0ae857 -r cf939872811c libgui/src/settings-dialog.ui --- a/libgui/src/settings-dialog.ui Sat May 18 15:17:03 2013 +0200 +++ b/libgui/src/settings-dialog.ui Sat May 18 16:13:53 2013 +0200 @@ -32,7 +32,7 @@ - 3 + 0 @@ -196,10 +196,7 @@ - - - - + @@ -221,19 +218,6 @@ - - - true - - - Code completion - - - false - - - - Show complete path in window title @@ -247,6 +231,144 @@ + + + + + + 6 + + + + + false + + + Characters before list with suggestions is displayed + + + + + + + false + + + + + + + + + + + + 1 + + + 6 + + + 2 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + false + + + Match keywords + + + true + + + + + + + false + + + Match words in document + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + true + + + Code completion + + + false + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 0 + + + + + + + + false + + + Replace the rest of the actual word by suggested word + + + + + @@ -918,5 +1040,85 @@ + + editor_codeCompletion + toggled(bool) + editor_label_ac_threshold + setEnabled(bool) + + + 83 + 223 + + + 288 + 223 + + + + + editor_codeCompletion + toggled(bool) + editor_spinbox_ac_threshold + setEnabled(bool) + + + 83 + 223 + + + 412 + 223 + + + + + editor_codeCompletion + toggled(bool) + editor_checkbox_ac_keywords + setEnabled(bool) + + + 83 + 170 + + + 238 + 201 + + + + + editor_codeCompletion + toggled(bool) + editor_checkbox_ac_document + setEnabled(bool) + + + 83 + 170 + + + 390 + 201 + + + + + editor_codeCompletion + toggled(bool) + editor_checkbox_ac_replace + setEnabled(bool) + + + 83 + 170 + + + 427 + 229 + + +