Mercurial > octave
diff libgui/src/external-editor-interface.cc @ 24011:9107bae20480
style fixes for some GUI source files
* color-picker.cc, color-picker.h, documentation-dock-widget.cc,
documentation-dock-widget.h, external-editor-interface.cc,
external-editor-interface.h, find-files-dialog.cc,
find-files-dialog.h, find-files-model.cc, find-files-model.h,
history-dock-widget.cc, history-dock-widget.h, settings-dialog.cc,
settings-dialog.h, terminal-dock-widget.cc, thread-manager.cc,
thread-manager.h: Use m_ prefix for member variables, order
functions consistently in header and source files, and follow more
Octave coding conventions.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 06 Sep 2017 09:25:46 -0400 |
parents | 41639665aa34 |
children | 194eb4bd202b |
line wrap: on
line diff
--- a/libgui/src/external-editor-interface.cc Tue Sep 05 17:24:13 2017 -0700 +++ b/libgui/src/external-editor-interface.cc Wed Sep 06 09:25:46 2017 -0400 @@ -32,34 +32,8 @@ #include "resource-manager.h" external_editor_interface::external_editor_interface (QWidget *p) - : QWidget (p) -{ }; - -// Get and verify the settings of the external editor program -QString -external_editor_interface::external_editor () -{ - QSettings *settings = resource_manager::get_settings (); - QString editor = settings->value ("customFileEditor").toString (); - - // check the settings (avoid an empty string) - if (editor.trimmed ().isEmpty ()) - { - QMessageBox *msgBox = new QMessageBox (QMessageBox::Warning, - tr ("Octave Editor"), - tr ("There is no custom editor configured yet.\n" - "Do you want to open the preferences?"), - QMessageBox::No | QMessageBox::Yes); - msgBox->setDefaultButton (QMessageBox::Yes); - msgBox->setAttribute (Qt::WA_DeleteOnClose); - int button = msgBox->exec (); - - if (button == QMessageBox::Yes) - emit request_settings_dialog ("editor"); - } - - return editor; -} + : QWidget (p) +{ } // Calling the external editor bool @@ -106,7 +80,8 @@ void external_editor_interface::request_open_file (const QString& file_name, - const QString&, int line, bool, bool, bool, const QString&) + const QString&, int line, + bool, bool, bool, const QString&) { call_custom_editor (file_name, line); } @@ -117,3 +92,30 @@ call_custom_editor (file); } +// Get and verify the settings of the external editor program +QString +external_editor_interface::external_editor (void) +{ + QSettings *settings = resource_manager::get_settings (); + QString editor = settings->value ("customFileEditor").toString (); + + // check the settings (avoid an empty string) + if (editor.trimmed ().isEmpty ()) + { + QMessageBox *msgBox + = new QMessageBox (QMessageBox::Warning, + tr ("Octave Editor"), + tr ("There is no custom editor configured yet.\n" + "Do you want to open the preferences?"), + QMessageBox::No | QMessageBox::Yes); + msgBox->setDefaultButton (QMessageBox::Yes); + msgBox->setAttribute (Qt::WA_DeleteOnClose); + + int button = msgBox->exec (); + + if (button == QMessageBox::Yes) + emit request_settings_dialog ("editor"); + } + + return editor; +}