Mercurial > hg > octave-nkf
changeset 19721:ffc339cea115
maint: Periodic merge of gui-release to default.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 02 Jan 2015 17:27:33 -0500 |
parents | 5802ea7037d4 (current diff) 17e6c770e6ac (diff) |
children | 18377fc879d0 |
files | libgui/src/qtinfo/parser.cc libgui/src/qtinfo/parser.h libgui/src/qtinfo/webinfo.cc libgui/src/qtinfo/webinfo.h |
diffstat | 4 files changed, 40 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/qtinfo/parser.cc +++ b/libgui/src/qtinfo/parser.cc @@ -47,7 +47,7 @@ _compressors_map.insert ("Z", "gunzip -c \"%1\""); } -void +bool parser::set_info_path (const QString& infoPath) { this->_info_path = infoPath; @@ -56,15 +56,32 @@ QFileInfo info (infoPath); - QString path = info.absolutePath (); - QString fileName = info.fileName (); + bool info_file_exists = info.exists (); + QHash<QString, QString>::iterator it; + for (it = _compressors_map.begin (); it != _compressors_map.end (); it++) + { + if (info_file_exists) + break; + info_file_exists = QFileInfo (info.absoluteFilePath () + "." + it.key ()).exists (); + } - QDir infoDir (path); - QStringList filter; - filter.append (fileName + "*"); + if (info_file_exists) + { + QString path = info.absolutePath (); + QString fileName = info.fileName (); + + QDir infoDir (path); + QStringList filter; + filter.append (fileName + "*"); - _info_files = infoDir.entryInfoList (filter, QDir::Files); - parse_info_map (); + _info_files = infoDir.entryInfoList (filter, QDir::Files); + + parse_info_map (); + + return true; + } + else + return false; } QString
--- a/libgui/src/qtinfo/parser.h +++ b/libgui/src/qtinfo/parser.h @@ -53,7 +53,7 @@ public: parser (QObject *parent = 0); - void set_info_path (const QString& _info_path); + bool set_info_path (const QString& _info_path); QString get_info_path (); QString search_node (const QString& node); QString global_search (const QString& text, int maxFounds);
--- a/libgui/src/qtinfo/webinfo.cc +++ b/libgui/src/qtinfo/webinfo.cc @@ -96,29 +96,30 @@ resize (500, 300); - QFileInfo info_file = QFileInfo (QString::fromStdString (Vinfo_file)); - - if (info_file.exists ()) - set_info_path (QString::fromStdString (Vinfo_file)); - else + if (! set_info_path (QString::fromStdString (Vinfo_file))) { // Info file does not exist _search_check_box->setEnabled (false); _search_line_edit->setEnabled (false); QTextBrowser *msg = addNewTab (tr ("Error")); - QString msg_text = QString ("<html><body><br><br><center><b>%1" - "</b></center></body></html>"). - arg (tr ("The info file %1 does not exist"). - arg(info_file.absoluteFilePath ())); + QString msg_text = QString ( + "<html><body><br><br><center><b>%1</b></center></body></html>"). + arg (tr ("The info file<p>%1<p>or compressed versions do not exist"). + arg(QString::fromStdString (Vinfo_file))); msg->setHtml (msg_text); } } -void +bool webinfo::set_info_path (const QString& info_path) { - _parser.set_info_path (info_path); - load_node ("Top"); + if (_parser.set_info_path (info_path)) + { + load_node ("Top"); + return true; + } + else + return false; } void
--- a/libgui/src/qtinfo/webinfo.h +++ b/libgui/src/qtinfo/webinfo.h @@ -38,7 +38,7 @@ Q_OBJECT public: webinfo (QWidget *parent = 0); - void set_info_path (const QString& info_path); + bool set_info_path (const QString& info_path); void load_node (const QString& node_name); void load_ref (const QString &ref_name);