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