1 #include "settingsdlg.h"
2 #include "advsettingsdlg.h"
3 #include "selectremotedlg.h"
12 #include <QPushButton>
17 SettingsDlg::SettingsDlg(QWidget *parent, IEngine *engine)
21 layout = new QVBoxLayout(this);
22 btnLayout = new QHBoxLayout(this);
23 remoteNameLayout = new QHBoxLayout(this);
25 QSettings settings(this);
26 advSettingsBtn = new QPushButton(tr("Advanced"), this);
27 selectRemoteBtn = new QPushButton(tr("Select remote"), this);
28 aboutBtn = new QPushButton(tr("About"), this);
30 rateUpBtn = new QPushButton(
31 QIcon(settings.value("rateUpIcon",
32 "/usr/share/icons/hicolor/48x48/hildon/chat_smiley_happy.png").
35 rateDownBtn = new QPushButton(
36 QIcon(settings.value("rateDownIcon",
37 "/usr/share/icons/hicolor/48x48/hildon/chat_smiley_sad.png").
40 rateUpBtn->setMaximumSize(72, 72);
41 rateDownBtn->setMaximumSize(72, 72);
43 btnLayout->addWidget(advSettingsBtn);
44 btnLayout->addWidget(selectRemoteBtn);
45 btnLayout->addWidget(aboutBtn);
47 connect(advSettingsBtn, SIGNAL(clicked()),
48 this, SLOT(showAdvSettingsDlg()));
49 connect(selectRemoteBtn, SIGNAL(clicked()),
50 this, SLOT(showSelectRemoteDlg()));
51 connect(aboutBtn, SIGNAL(clicked()),
52 this, SLOT(showAboutDlg()));
54 remoteNameLabel = new QLabel(
55 settings.value("remoteName",
56 tr("<no remote selected>")).toString(), this);
57 remoteNameLayout->addWidget(new QLabel(tr("Remote name: "), this));
58 remoteNameLayout->addWidget(remoteNameLabel);
59 remoteNameLayout->addWidget(rateUpBtn);
60 remoteNameLayout->addWidget(rateDownBtn);
62 layout->addLayout(remoteNameLayout);
63 layout->addLayout(btnLayout);
64 this->setLayout(layout);
68 connect(engine->remote(), SIGNAL(ratingChanged(int)),
69 this, SLOT(setRating(int)));
70 engine->remote()->updateRating();
73 SettingsDlg::~SettingsDlg()
75 delete advSettingsBtn;
76 delete selectRemoteBtn;
80 delete remoteNameLabel;
81 delete remoteNameLayout;
86 void SettingsDlg::showAdvSettingsDlg()
88 AdvSettingsDlg dlg(this, engine);
93 void SettingsDlg::showSelectRemoteDlg()
95 SelectRemoteDlg dlg(this, engine);
96 connect(&dlg, SIGNAL(remoteDownloaded()),
97 this, SLOT(updateRemoteName()));
101 void SettingsDlg::showAboutDlg()
107 void SettingsDlg::updateRemoteName()
109 QSettings settings(this);
110 remoteNameLabel->setText(settings.value("remoteName",
111 tr("Select remote")).toString());
114 void SettingsDlg::setRating(int rating)