Version bump
[someplayer] / src / aboutform.cpp
1 #include "aboutform.h"
2 #include "ui_aboutform.h"
3 #include "config.h"
4 #include <QWebView>
5 #include <QDebug>
6 #include "someplayer.h"
7
8 using namespace SomePlayer::Storage;
9
10 AboutForm::AboutForm(QWidget *parent) :
11                 QWidget(parent),
12                 ui(new Ui::AboutForm)
13 {
14         ui->setupUi(this);
15         updateIcons();
16         updateTranslations();
17         setAttribute(Qt::WA_Maemo5StackedWindow);
18         setWindowFlags(Qt::Window | windowFlags());
19         connect(ui->onlineHelpButton, SIGNAL(clicked()), this, SLOT(onlineHelp()));
20         ui->donateButton->hide();
21 }
22
23 AboutForm::~AboutForm()
24 {
25         delete ui;
26 }
27
28 void AboutForm::updateIcons() {
29         Config config;
30         _icons_theme = config.getValue("ui/iconstheme").toString();
31         ui->logoLabel->setPixmap(QPixmap(":/icons/"+_icons_theme+"/player.png"));
32 }
33
34 void AboutForm::updateTranslations() {
35         ui->retranslateUi(this);
36         ui->versionLabel->setText(QString("<b>%1</b>").arg(_SOMEPLAYER_VERSION_));
37 }
38
39 void AboutForm::onlineHelp() {
40         Config config;
41         QWebView *view = new QWebView(this);
42         view->setAttribute(Qt::WA_Maemo5StackedWindow);
43         view->setWindowFlags(Qt::Window | view->windowFlags());
44         QString lang = config.getValue("ui/language").toString();
45         QString icons_theme = config.getValue("ui/iconstheme").toString();
46         QColor background = palette().color(QPalette::Active, QPalette::Background);
47         QColor text = palette().color(QPalette::Active, QPalette::Text);
48         QString paramBg = QString("%1:%2:%3").arg(background.red()).arg(background.blue()).arg(background.green());
49         QString paramText = QString("%1:%2:%3").arg(text.red()).arg(text.blue()).arg(text.green());
50         QString url = QString("http://someplayer.some-body.ru/help.php?bg=%1&text=%2&lang=%3&iconstheme=%4")
51                       .arg(paramBg).arg(paramText).arg(lang).arg(icons_theme);
52         view->load(QUrl(url));
53         view->show();
54 }
55
56 void AboutForm::donate() {
57 }