summaryrefslogtreecommitdiff
path: root/rbutil/rbutilqt/gui/changelog.cpp
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2013-09-20 23:03:56 +0200
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2013-09-30 23:42:21 +0200
commit8df12c63b846edcec4fb7020a8409f5aefa089f1 (patch)
tree1334a10b59b3332113247cce5531deee19ba7da6 /rbutil/rbutilqt/gui/changelog.cpp
parent1977281bb3de54db1be7527bdea3ab9089f15011 (diff)
downloadrockbox-8df12c63b846edcec4fb7020a8409f5aefa089f1.tar.gz
rockbox-8df12c63b846edcec4fb7020a8409f5aefa089f1.zip
Implement a first, simple changelog dialog.
When Rockbox Utility is started for the first time, a new version is started or the user selected to do so on startup a changelog window is shown. Change-Id: Ic223e092a09d31ccbbfcd9b973355225cac27632
Diffstat (limited to 'rbutil/rbutilqt/gui/changelog.cpp')
-rw-r--r--rbutil/rbutilqt/gui/changelog.cpp70
1 files changed, 70 insertions, 0 deletions
diff --git a/rbutil/rbutilqt/gui/changelog.cpp b/rbutil/rbutilqt/gui/changelog.cpp
new file mode 100644
index 0000000000..d8361023b1
--- /dev/null
+++ b/rbutil/rbutilqt/gui/changelog.cpp
@@ -0,0 +1,70 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2013 by Dominik Riebeling
10 *
11 * All files in this archive are subject to the GNU General Public License.
12 * See the file COPYING in the source tree root for full license agreement.
13 *
14 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
15 * KIND, either express or implied.
16 *
17 ****************************************************************************/
18
19#include "changelog.h"
20#include "rbsettings.h"
21#include "ui_changelogfrm.h"
22
23Changelog::Changelog(QWidget *parent) : QDialog(parent)
24{
25 ui.setupUi(this);
26 ui.browserChangelog->setOpenExternalLinks(true);
27 ui.browserChangelog->setHtml(parseChangelogFile(":/docs/changelog.txt"));
28 ui.browserChangelog->moveCursor(QTextCursor::Start, QTextCursor::MoveAnchor);
29 ui.checkBoxShowAlways->setChecked(RbSettings::value(RbSettings::ShowChangelog).toBool());
30 connect(ui.buttonOk, SIGNAL(clicked()), this, SLOT(accept()));
31}
32
33
34void Changelog::accept(void)
35{
36 RbSettings::setValue(RbSettings::ShowChangelog, ui.checkBoxShowAlways->isChecked());
37 this->hide();
38 this->deleteLater();
39}
40
41
42QString Changelog::parseChangelogFile(QString filename)
43{
44 QFile changelog(filename);
45 changelog.open(QIODevice::ReadOnly);
46 QTextStream c(&changelog);
47 QString text;
48 while(!c.atEnd()) {
49 QString line = c.readLine();
50 if(line.startsWith("#"))
51 continue;
52 if(line.startsWith("Version")) {
53 text.append(QString("<h4>Rockbox Utility %1</h4>").arg(line.remove("Version")));
54 line = c.readLine();
55 text.append("<ul>");
56 while(line.startsWith("*")) {
57 QString t = line.remove(QRegExp("^\\*"));
58 t.replace(QRegExp("FS#(\\d+)"),
59 "<a href='http://www.rockbox.org/tracker/task/\\1'>FS#\\1</a>");
60 text.append(QString("<li>%1</li>").arg(t));
61 line = c.readLine();
62 if(line.startsWith("#"))
63 line = c.readLine();
64 }
65 text.append("</ul>");
66 }
67 }
68 changelog.close();
69 return text;
70}