X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;ds=sidebyside;f=src%2Fsettingsdlg.cpp;h=2b1b1953ce2f4af49fd8b080a9e7ae4e281cb532;hb=af55637d27c287425a091ae482acff97c7f0e382;hp=f560210907f650feea344a5dd4051a89ae997309;hpb=37dc5d22c18458b24e0678230d03892b4b64b581;p=irwi diff --git a/src/settingsdlg.cpp b/src/settingsdlg.cpp index f560210..2b1b195 100644 --- a/src/settingsdlg.cpp +++ b/src/settingsdlg.cpp @@ -1,35 +1,119 @@ #include "settingsdlg.h" +#include "advsettingsdlg.h" +#include "selectremotedlg.h" +#include "aboutdlg.h" +#include "iengine.h" +#include "iremote.h" #include +#include +#include +#include +#include +#include #include -#include -#include +#include -SettingsDlg::SettingsDlg(QWidget *parent) +SettingsDlg::SettingsDlg(QWidget *parent, IEngine *engine) : QDialog(parent) + , engine(engine) { - this->setWindowTitle(tr("Settings")); - layout = new QHBoxLayout(this); - - alphabetList = new QListWidget(this); - for (char c = 'a'; c <= 'z'; ++c) - { - alphabetList->addItem(QString(c)); - } - layout->addWidget(alphabetList); + layout = new QVBoxLayout(this); + btnLayout = new QHBoxLayout(this); + remoteNameLayout = new QHBoxLayout(this); - layout->addWidget(new QLabel("bar")); - layout->addWidget(new QLabel("baz")); + QSettings settings(this); + advSettingsBtn = new QPushButton(tr("Advanced"), this); + selectRemoteBtn = new QPushButton(tr("Select remote"), this); + aboutBtn = new QPushButton(tr("About"), this); + + rateUpBtn = new QPushButton( + QIcon(settings.value("rateUpIcon", + "/usr/share/icons/hicolor/48x48/hildon/chat_smiley_happy.png"). + toString()), + "", this); + rateDownBtn = new QPushButton( + QIcon(settings.value("rateDownIcon", + "/usr/share/icons/hicolor/48x48/hildon/chat_smiley_sad.png"). + toString()), + "", this); + rateUpBtn->setMaximumSize(72, 72); + rateDownBtn->setMaximumSize(72, 72); + + btnLayout->addWidget(advSettingsBtn); + btnLayout->addWidget(selectRemoteBtn); + btnLayout->addWidget(aboutBtn); + + connect(advSettingsBtn, SIGNAL(clicked()), + this, SLOT(showAdvSettingsDlg())); + connect(selectRemoteBtn, SIGNAL(clicked()), + this, SLOT(showSelectRemoteDlg())); + connect(aboutBtn, SIGNAL(clicked()), + this, SLOT(showAboutDlg())); + + remoteNameLabel = new QLabel( + settings.value("remoteName", + tr("")).toString(), this); + remoteNameLayout->addWidget(new QLabel(tr("Remote name: "), this)); + remoteNameLayout->addWidget(remoteNameLabel); + remoteNameLayout->addWidget(rateUpBtn); + remoteNameLayout->addWidget(rateDownBtn); + + layout->addLayout(remoteNameLayout); + layout->addLayout(btnLayout); this->setLayout(layout); + + updateRemoteName(); + + connect(engine->remote(), SIGNAL(ratingChanged(int)), + this, SLOT(setRating(int))); + engine->remote()->updateRating(); } SettingsDlg::~SettingsDlg() { + delete advSettingsBtn; + delete selectRemoteBtn; + delete aboutBtn; + delete rateUpBtn; + delete rateDownBtn; + delete remoteNameLabel; + delete remoteNameLayout; + delete btnLayout; delete layout; } -QString& SettingsDlg::getRemoteName() +void SettingsDlg::showAdvSettingsDlg() +{ + AdvSettingsDlg dlg(this, engine); + dlg.exec(); + updateRemoteName(); +} + +void SettingsDlg::showSelectRemoteDlg() { - return remoteName; + SelectRemoteDlg dlg(this, engine); + connect(&dlg, SIGNAL(remoteDownloaded()), + this, SLOT(updateRemoteName())); + dlg.exec(); } +void SettingsDlg::showAboutDlg() +{ + AboutDlg dlg(this); + dlg.exec(); +} + +void SettingsDlg::updateRemoteName() +{ + QSettings settings(this); + remoteNameLabel->setText(settings.value("remoteName", + tr("Select remote")).toString()); +} + +void SettingsDlg::setRating(int rating) +{ + qDebug() << rating; +} + +