summaryrefslogtreecommitdiff
path: root/rbutil/rbutilqt/gui
diff options
context:
space:
mode:
Diffstat (limited to 'rbutil/rbutilqt/gui')
-rw-r--r--rbutil/rbutilqt/gui/changelog.cpp70
-rw-r--r--rbutil/rbutilqt/gui/changelog.h40
-rw-r--r--rbutil/rbutilqt/gui/changelogfrm.ui60
3 files changed, 170 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}
diff --git a/rbutil/rbutilqt/gui/changelog.h b/rbutil/rbutilqt/gui/changelog.h
new file mode 100644
index 0000000000..103a3bc9fb
--- /dev/null
+++ b/rbutil/rbutilqt/gui/changelog.h
@@ -0,0 +1,40 @@
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#ifndef CHANGELOG_H
20#define CHANGELOG_H
21
22#include <QDialog>
23#include "ui_changelogfrm.h"
24
25class Changelog : public QDialog
26{
27 Q_OBJECT
28public:
29 Changelog(QWidget *parent = 0);
30
31public slots:
32 void accept(void);
33
34private:
35 QString parseChangelogFile(QString filename);
36 Ui::Changelog ui;
37
38};
39
40#endif
diff --git a/rbutil/rbutilqt/gui/changelogfrm.ui b/rbutil/rbutilqt/gui/changelogfrm.ui
new file mode 100644
index 0000000000..83763d84d9
--- /dev/null
+++ b/rbutil/rbutilqt/gui/changelogfrm.ui
@@ -0,0 +1,60 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<ui version="4.0">
3 <class>Changelog</class>
4 <widget class="QDialog" name="Changelog">
5 <property name="windowModality">
6 <enum>Qt::WindowModal</enum>
7 </property>
8 <property name="geometry">
9 <rect>
10 <x>0</x>
11 <y>0</y>
12 <width>400</width>
13 <height>300</height>
14 </rect>
15 </property>
16 <property name="windowTitle">
17 <string>Changelog</string>
18 </property>
19 <layout class="QGridLayout" name="gridLayout">
20 <item row="0" column="0" colspan="3">
21 <widget class="QTextBrowser" name="browserChangelog"/>
22 </item>
23 <item row="1" column="1">
24 <spacer name="horizontalSpacer">
25 <property name="orientation">
26 <enum>Qt::Horizontal</enum>
27 </property>
28 <property name="sizeHint" stdset="0">
29 <size>
30 <width>40</width>
31 <height>20</height>
32 </size>
33 </property>
34 </spacer>
35 </item>
36 <item row="1" column="0">
37 <widget class="QCheckBox" name="checkBoxShowAlways">
38 <property name="text">
39 <string>Show on startup</string>
40 </property>
41 </widget>
42 </item>
43 <item row="1" column="2">
44 <widget class="QPushButton" name="buttonOk">
45 <property name="text">
46 <string>&amp;Ok</string>
47 </property>
48 <property name="icon">
49 <iconset resource="../rbutilqt.qrc">
50 <normaloff>:/icons/go-next.png</normaloff>:/icons/go-next.png</iconset>
51 </property>
52 </widget>
53 </item>
54 </layout>
55 </widget>
56 <resources>
57 <include location="../rbutilqt.qrc"/>
58 </resources>
59 <connections/>
60</ui>