rbutil: Show the license of all libraries included.

Replace the Speex license tab in the about dialog with one that lists
all used libraries and their respective licenses, including Speex.

Previously only Speex required including the license in binary
distribution; the recently added bspatch also wants this. Show
the license for all used libraries so we can more easily add new ones in
the future.

Change-Id: Ic8b403f8a2a05d0f1734ddf092782b85ddfa5ed9
This commit is contained in:
Dominik Riebeling 2020-11-07 21:31:44 +01:00
parent db7c4424e4
commit 9fcdb44e55
3 changed files with 45 additions and 14 deletions

View file

@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>500</width> <width>640</width>
<height>500</height> <height>500</height>
</rect> </rect>
</property> </property>
@ -129,11 +129,11 @@
</widget> </widget>
<widget class="QWidget" name="licenseSpeex" > <widget class="QWidget" name="licenseSpeex" >
<attribute name="title" > <attribute name="title" >
<string>&amp;Speex License</string> <string>L&amp;ibraries</string>
</attribute> </attribute>
<layout class="QGridLayout" name="gridLayout_2" > <layout class="QGridLayout" name="gridLayout_2" >
<item row="0" column="0" > <item row="0" column="0" >
<widget class="QTextBrowser" name="browserSpeexLicense"/> <widget class="QTextBrowser" name="browserLicenses"/>
</item> </item>
</layout> </layout>
</widget> </widget>

View file

@ -282,12 +282,37 @@ void RbUtilQt::about()
QTextStream c(&licence); QTextStream c(&licence);
about.browserLicense->insertHtml(c.readAll()); about.browserLicense->insertHtml(c.readAll());
about.browserLicense->moveCursor(QTextCursor::Start, QTextCursor::MoveAnchor); about.browserLicense->moveCursor(QTextCursor::Start, QTextCursor::MoveAnchor);
licence.close();
QFile speexlicense(":/docs/COPYING.SPEEX"); QString html = "<p>" + tr("Libraries used") + "</p>";
speexlicense.open(QIODevice::ReadOnly); html += "<ul>";
QTextStream s(&speexlicense); html += "<li>Speex: <a href='#speex'>Speex License</a></li>";
about.browserSpeexLicense->insertHtml("<pre>" + s.readAll() + "</pre>"); html += "<li>bspatch: <a href='#bspatch'>bspatch License</a></li>";
about.browserSpeexLicense->moveCursor(QTextCursor::Start, QTextCursor::MoveAnchor); html += "<li>bzip2: <a href='#bzip2'>bzip2 License</a></li>";
html += "<li>mspack: <a href='#lgpl2'>LGPL v2.1 License</a></li>";
html += "<li>quazip: <a href='#lgpl2'>LGPL v2.1 License</a></li>";
html += "<li>tomcrypt: <a href='#tomcrypt'>Tomcrypt License</a></li>";
html += "<li>CuteLogger: <a href='#lgpl2'>LGPL v2.1 License</a></li>";
html += "</ul>";
about.browserLicenses->insertHtml(html);
QMap<QString, QString> licenses;
licenses[":/docs/COPYING.SPEEX"] = "<a id='speex'>Speex License</a>";
licenses[":/docs/lgpl-2.1.txt"] = "<a id='lgpl2'>LGPL v2.1</a>";
licenses[":/docs/LICENSE.TOMCRYPT"] = "<a id='tomcrypt'>Tomcrypt License</a>";
licenses[":/docs/LICENSE.BZIP2"] = "<a id='bzip2'>bzip2 License</a>";
licenses[":/docs/LICENSE.BSPATCH"] = "<a id='bspatch'>bspatch License</a>";
for (int i = 0; i < licenses.size(); i++) {
QString key = licenses.keys().at(i);
QFile license(key);
license.open(QIODevice::ReadOnly);
QTextStream s(&license);
about.browserLicenses->insertHtml("<hr/><h2>" + licenses[key] + "</h2><br/>\n");
about.browserLicenses->insertHtml("<pre>" + s.readAll() + "</pre>");
license.close();
}
about.browserLicenses->moveCursor(QTextCursor::Start, QTextCursor::MoveAnchor);
QFile credits(":/docs/CREDITS"); QFile credits(":/docs/CREDITS");
credits.open(QIODevice::ReadOnly); credits.open(QIODevice::ReadOnly);
@ -304,6 +329,7 @@ void RbUtilQt::about()
line.remove(QRegExp("^People.*")); line.remove(QRegExp("^People.*"));
about.browserCredits->append(line); about.browserCredits->append(line);
} }
credits.close();
about.browserCredits->moveCursor(QTextCursor::Start, QTextCursor::MoveAnchor); about.browserCredits->moveCursor(QTextCursor::Start, QTextCursor::MoveAnchor);
QString title = QString("<b>The Rockbox Utility</b><br/>Version %1").arg(FULLVERSION); QString title = QString("<b>The Rockbox Utility</b><br/>Version %1").arg(FULLVERSION);
about.labelTitle->setText(title); about.labelTitle->setText(title);

View file

@ -1,8 +1,12 @@
<RCC> <RCC>
<qresource prefix="/"> <qresource prefix="/">
<file>../../docs/CREDITS</file> <file alias="docs/CREDITS">../../docs/CREDITS</file>
<file>../../docs/gpl-2.0.html</file> <file alias="docs/gpl-2.0.html">../../docs/gpl-2.0.html</file>
<file alias="docs/lgpl-2.1.txt">logger/LICENSE.LGPL</file>
<file alias="docs/COPYING.SPEEX">../../lib/rbcodec/codecs/libspeex/COPYING</file> <file alias="docs/COPYING.SPEEX">../../lib/rbcodec/codecs/libspeex/COPYING</file>
<file alias="docs/LICENSE.TOMCRYPT">../../utils/tomcrypt/LICENSE</file>
<file alias="docs/LICENSE.BZIP2">../bzip2/LICENSE</file>
<file alias="docs/LICENSE.BSPATCH">../bspatch/LICENSE</file>
<file alias="docs/changelog.txt">changelog.txt</file> <file alias="docs/changelog.txt">changelog.txt</file>
</qresource> </qresource>
<qresource> <qresource>
@ -41,6 +45,7 @@
<file>icons/view-refresh.svg</file> <file>icons/view-refresh.svg</file>
<file>icons/wizard.jpg</file> <file>icons/wizard.jpg</file>
<file alias="icons/rockbox-clef.svg">../../docs/logo/rockbox-clef.svg</file> <file alias="icons/rockbox-clef.svg">../../docs/logo/rockbox-clef.svg</file>
<file alias="icons/rockbox-logo.svg">../../docs/logo/rockbox-logo.svg</file>
</qresource> </qresource>
<qresource> <qresource>
<file>icons/players/archosfmrecorder-small.png</file> <file>icons/players/archosfmrecorder-small.png</file>