Mercurial > hg > octave-nkf
comparison libgui/src/files-dock-widget.cc @ 16555:04fb96f4bea1
allow double-click in file browser to load data files
* files-dock-widget.cc (files_dock_widget::display_directory): If file
looks like Octave data file, load it instead of opening with editor.
* ls-mat-ascii.h, ls-mat-ascii.cc (get_lines_and_columns): New option
to supress error messages. New option to check for numeric values.
(looks_like_mat_ascii_file): New function.
* load-save.h load-save.cc (is_octave_data_file): New function.
(get_file_format): Don't return LS_MAT_ASCII unless the file really
looks like it is a numeric data file.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 23 Apr 2013 12:57:16 -0400 |
parents | 016073c0cb94 |
children | 5fc1ce2947bd |
comparison
equal
deleted
inserted
replaced
16554:03a28487fa9d | 16555:04fb96f4bea1 |
---|---|
39 #include <QMenu> | 39 #include <QMenu> |
40 #include <QInputDialog> | 40 #include <QInputDialog> |
41 #include <QMessageBox> | 41 #include <QMessageBox> |
42 #include <QToolButton> | 42 #include <QToolButton> |
43 | 43 |
44 #include "load-save.h" | |
45 | |
44 files_dock_widget::files_dock_widget (QWidget *p) | 46 files_dock_widget::files_dock_widget (QWidget *p) |
45 : octave_dock_widget (p) | 47 : octave_dock_widget (p) |
46 { | 48 { |
47 setObjectName ("FilesDockWidget"); | 49 setObjectName ("FilesDockWidget"); |
48 setWindowIcon (QIcon(":/actions/icons/logo.png")); | 50 setWindowIcon (QIcon(":/actions/icons/logo.png")); |
278 _current_directory->insertItem(0, fileInfo.absoluteFilePath ()); | 280 _current_directory->insertItem(0, fileInfo.absoluteFilePath ()); |
279 _current_directory->setCurrentIndex(0); | 281 _current_directory->setCurrentIndex(0); |
280 } | 282 } |
281 else | 283 else |
282 { | 284 { |
283 if (QFile::exists (fileInfo.absoluteFilePath ())) | 285 QString abs_fname = fileInfo.absoluteFilePath (); |
284 emit open_file (fileInfo.absoluteFilePath ()); | 286 |
287 if (QFile::exists (abs_fname)) | |
288 { | |
289 if (is_octave_data_file (abs_fname.toStdString ())) | |
290 emit load_file_signal (abs_fname); | |
291 else | |
292 emit open_file (fileInfo.absoluteFilePath ()); | |
293 } | |
285 } | 294 } |
286 } | 295 } |
287 } | 296 } |
288 | 297 |
289 void | 298 void |