diff --git a/src/EditDialog.cpp b/src/EditDialog.cpp index 9edd91db..e1279276 100644 --- a/src/EditDialog.cpp +++ b/src/EditDialog.cpp @@ -22,6 +22,8 @@ #include #include +#include + EditDialog::EditDialog(QWidget* parent) : QDialog(parent), ui(new Ui::EditDialog), @@ -65,6 +67,8 @@ EditDialog::EditDialog(QWidget* parent) ui->actionIndent->setChecked(mustIndentAndCompact); ui->buttonAutoSwitchMode->setChecked(Settings::getValue("databrowser", "auto_switch_mode").toBool()); + ui->actionWordWrap->setChecked(Settings::getValue("databrowser", "editor_word_wrap").toBool()); + setWordWrapping(ui->actionWordWrap->isChecked()); reloadSettings(); } @@ -73,6 +77,7 @@ EditDialog::~EditDialog() { Settings::setValue("databrowser", "indent_compact", mustIndentAndCompact); Settings::setValue("databrowser", "auto_switch_mode", ui->buttonAutoSwitchMode->isChecked()); + Settings::setValue("databrowser", "editor_word_wrap", ui->actionWordWrap->isChecked()); delete ui; } @@ -1012,3 +1017,9 @@ void EditDialog::copyHexAscii() { QApplication::clipboard()->setText(hexEdit->selectionToReadableString()); } + +void EditDialog::setWordWrapping(bool value) +{ + // Set wrap lines + sciEdit->setWrapMode(value ? QsciScintilla::WrapWord : QsciScintilla::WrapNone); +} diff --git a/src/EditDialog.h b/src/EditDialog.h index 70cb3d88..b814d048 100644 --- a/src/EditDialog.h +++ b/src/EditDialog.h @@ -46,6 +46,7 @@ private slots: void openPrintDialog(); void openPrintImageDialog(); void copyHexAscii(); + void setWordWrapping(bool value); signals: void recordTextUpdated(const QPersistentModelIndex& idx, const QByteArray& data, bool isBlob); diff --git a/src/EditDialog.ui b/src/EditDialog.ui index 519947de..a495eeab 100644 --- a/src/EditDialog.ui +++ b/src/EditDialog.ui @@ -115,6 +115,7 @@ + @@ -150,8 +151,8 @@ Errors are indicated with a red squiggle underline. 0 0 - 598 - 265 + 85 + 35 @@ -359,6 +360,24 @@ Errors are indicated with a red squiggle underline. Erases the contents of the cell + + + true + + + true + + + + :/icons/word_wrap:/icons/word_wrap + + + Word Wrap + + + Wrap lines on word boundaries + + comboMode @@ -529,6 +548,22 @@ Errors are indicated with a red squiggle underline. + + actionWordWrap + toggled(bool) + EditDialog + setWordWrapping(bool) + + + -1 + -1 + + + 308 + 190 + + + importData() diff --git a/src/ExtendedScintilla.cpp b/src/ExtendedScintilla.cpp index 04e80a94..2ecff1fd 100644 --- a/src/ExtendedScintilla.cpp +++ b/src/ExtendedScintilla.cpp @@ -198,9 +198,6 @@ void ExtendedScintilla::reloadLexerSettings(QsciLexer *lexer) if(lexer) lexer->refreshProperties(); - // Set wrap lines - setWrapMode(static_cast(Settings::getValue("editor", "wrap_lines").toInt())); - // Check if error indicators are enabled and clear them if they just got disabled showErrorIndicators = Settings::getValue("editor", "error_indicators").toBool(); if(!showErrorIndicators) diff --git a/src/Settings.cpp b/src/Settings.cpp index 6dcb123a..8f9b9097 100644 --- a/src/Settings.cpp +++ b/src/Settings.cpp @@ -207,6 +207,8 @@ QVariant Settings::getDefaultValue(const QString& group, const QString& name) return false; if(name == "auto_switch_mode") return true; + if(name == "editor_word_wrap") + return true; if(name == "null_text") return "NULL"; if(name == "blob_text") diff --git a/src/icons/icons.qrc b/src/icons/icons.qrc index ea3defd5..b406416a 100644 --- a/src/icons/icons.qrc +++ b/src/icons/icons.qrc @@ -79,5 +79,6 @@ package_rename.png page_foreign_key.png save_all.png + page_white_text.png diff --git a/src/icons/page_white_text.png b/src/icons/page_white_text.png new file mode 100644 index 00000000..813f712f Binary files /dev/null and b/src/icons/page_white_text.png differ diff --git a/src/sqltextedit.cpp b/src/sqltextedit.cpp index 2e00c4ed..b8971358 100644 --- a/src/sqltextedit.cpp +++ b/src/sqltextedit.cpp @@ -61,6 +61,8 @@ void SqlTextEdit::reloadSettings() } else { setAutoCompletionThreshold(0); } + // Set wrap lines + setWrapMode(static_cast(Settings::getValue("editor", "wrap_lines").toInt())); ExtendedScintilla::reloadSettings();