Mercurial > hg > octave-lyh
diff libgui/src/octave-qt-link.cc @ 16580:adc150db1809
style fixes for uigetfile changes
* dialog.cc, dialog.h, main-window.cc, octave-qt-link.cc,
octave-qt-link.h, octave-link.cc, octave-link.h, uigetfile.m:
Style fixes.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sun, 28 Apr 2013 13:41:37 -0400 |
parents | 7f8db1942dc0 |
children | fa4a035e0cf4 |
line wrap: on
line diff
--- a/libgui/src/octave-qt-link.cc +++ b/libgui/src/octave-qt-link.cc @@ -129,29 +129,31 @@ } static QStringList -make_filter_list (const std::list< std::pair<std::string, std::string> >& lst) +make_filter_list (const octave_link::filter_list& lst) { QStringList retval; - // we have pairs of data, first being the list of extensions exta;exb;extc etc - // second the name to use as filter name (optional). - // Qt wants a a list of filters in the format of 'FilterName (spacfe separated exts)' + // We have pairs of data, first being the list of extensions + // exta;exb;extc etc second the name to use as filter name + // (optional). Qt wants a a list of filters in the format of + // 'FilterName (space separated exts)'. - for (std::list< std::pair<std::string,std::string> >::const_iterator it = lst.begin (); + for (octave_link::filter_list::const_iterator it = lst.begin (); it != lst.end (); it++) { - QString ext = QString::fromStdString ((*it).first); - QString name = QString::fromStdString ((*it).second); + QString ext = QString::fromStdString (it->first); + QString name = QString::fromStdString (it->second); - // strip out (exts) from name (if any) - name.replace(QRegExp("\\(.*\\)"), ""); - // replace ';' with spaces in ext list - ext.replace(";"," "); + // Strip out extensions from name and replace ';' with spaces in + // list. + + name.replace (QRegExp ("\\(.*\\)"), ""); + ext.replace (";", " "); if (name.length() == 0) { - // no name field - so need build one from teh extendiions - name = ext.toUpper() + " Files"; + // No name field. Build one from the extensions. + name = ext.toUpper() + " Files"; } retval.append (name + " (" + ext + ")"); @@ -220,7 +222,7 @@ } std::list<std::string> -octave_qt_link::do_file_dialog (const std::list< std::pair< std::string, std::string > > filter, +octave_qt_link::do_file_dialog (const filter_list& filter, const std::string& title, const std::string& filename, const std::string& dirname, @@ -228,23 +230,21 @@ { std::list<std::string> retval; - uiwidget_creator.signal_filedialog ( make_filter_list (filter), - QString::fromStdString (title), - QString::fromStdString (filename), - QString::fromStdString (dirname), - multiselect); + uiwidget_creator.signal_filedialog (make_filter_list (filter), + QString::fromStdString (title), + QString::fromStdString (filename), + QString::fromStdString (dirname), + multiselect); // Wait while the user is responding to dialog. uiwidget_creator.wait (); - // add all the file dialog result to a string list + // Add all the file dialog results to a string list. const QStringList *inputLine = uiwidget_creator.get_string_list (); for (QStringList::const_iterator it = inputLine->begin (); it != inputLine->end (); it++) - { - retval.push_back (it->toStdString ()); - } + retval.push_back (it->toStdString ()); retval.push_back (uiwidget_creator.get_dialog_path ()->toStdString ()); retval.push_back ((QString ("%1").arg (uiwidget_creator.get_dialog_result ())).toStdString ());