1
0
mirror of https://github.com/fwbuilder/fwbuilder synced 2026-05-01 14:47:27 +02:00

Feature: select and show all release notes

This commit is contained in:
Sirius Bakke 2014-06-24 11:16:16 +00:00
parent 70000f0ec7
commit ba08c03788
4 changed files with 36 additions and 2 deletions

View File

@ -1525,6 +1525,7 @@ void FWWindow::showReleaseNotes()
h->hide();
} else
{
h->showAllReleaseNotes(h->findHelpFile(file_name));
// I do not know why, but url "file://file_name" does not seem to work.
// But "file:file_name" works.
h->setSource(QUrl("file:" + file_name));

View File

@ -33,6 +33,7 @@
#include "FWWindow.h"
#include <QFile>
#include <QDir>
#include <QLocale>
#include <QtDebug>
@ -57,6 +58,9 @@ Help::Help(QWidget *, const QString &title, bool _load_links_in_browser) :
connect(http_getter, SIGNAL(done(const QString&)),
this, SLOT(downloadComplete(const QString&)));
connect(m_dialog->comboBox, SIGNAL(currentIndexChanged(int)),
this, SLOT(showReleaseNotesSelected()));
QString locale = QLocale::system().name(); //"en_US";
// Set up path to help qtextBrowser find contents, such as files for <img>
@ -73,6 +77,7 @@ Help::Help(QWidget *, const QString &title, bool _load_links_in_browser) :
//raise();
flags = windowFlags()| Qt::WindowMinimizeButtonHint;
m_dialog->comboBox->hide();
};
Help::~Help()
@ -164,8 +169,31 @@ QString Help::findHelpFile(const QString &file_base_name)
return "";
}
void Help::showAllReleaseNotes(const QString &path)
{
m_dialog->comboBox->show();
QStringList filters;
filters << "release_notes_*.html";
QDir dir;
dir.setPath(QFileInfo(path).path());
m_dialog->comboBox->addItems(dir.entryList(filters, QDir::NoFilter, QDir::Name | QDir::Reversed));
}
void Help::showReleaseNotesSelected()
{
if (!m_dialog->comboBox->isVisible()) return;
QString file_name = m_dialog->comboBox->currentText();
setSource(QUrl("file:" + file_name));
}
void Help::closeEvent(QCloseEvent *event)
{
m_dialog->comboBox->hide();
window_geometry = QWidget::saveGeometry();
QDialog::closeEvent(event);
}

View File

@ -60,6 +60,7 @@ public:
void setSource(const QUrl &url);
QString findHelpFile(const QString &file_base_name);
void showAllReleaseNotes(const QString &path);
void setName(const QString &name);
@ -73,6 +74,7 @@ public:
public slots:
void downloadComplete(const QString&);
void show();
void showReleaseNotesSelected();
};

View File

@ -47,10 +47,10 @@
</layout>
</widget>
</item>
<item row="1" column="0">
<item row="2" column="0">
<widget class="QTextBrowser" name="textview"/>
</item>
<item row="2" column="0">
<item row="3" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
@ -74,6 +74,9 @@
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QComboBox" name="comboBox"/>
</item>
</layout>
</item>
</layout>