X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Fmainwidget.cpp;h=76a3ccfb4ad2c4f5c0f386b930429fbebe31d6e3;hb=ed7ff3a791bf0fe390fbc55e3a73b0a93cb6f8b8;hp=48e049fbc5661c3f63fbb53f1a689b7f35ccff3c;hpb=e31b792996b7d8586c5f16b246d8e46cfab657af;p=irwi diff --git a/src/mainwidget.cpp b/src/mainwidget.cpp index 48e049f..76a3ccf 100644 --- a/src/mainwidget.cpp +++ b/src/mainwidget.cpp @@ -1,4 +1,7 @@ #include "mainwidget.h" +#include "engine.h" +#include "iengine.h" +#include "settingsdlg.h" #include #include @@ -6,11 +9,12 @@ #include #include -#include "settingsdlg.h" - MainWidget::MainWidget (QWidget *parent) : QWidget(parent) + , engine(new Engine()) { + engine->setRemote("1"); + layout = new QGridLayout(this); settings = new QSettings(this); @@ -36,24 +40,24 @@ MainWidget::MainWidget (QWidget *parent) layout->addWidget(button, i%2, i/2); } - connect(buttons[0], SIGNAL(clicked()), &irCtrl, SLOT(sendCmd0())); - connect(buttons[1], SIGNAL(clicked()), &irCtrl, SLOT(sendCmd1())); - connect(buttons[2], SIGNAL(clicked()), &irCtrl, SLOT(sendCmd2())); - connect(buttons[3], SIGNAL(clicked()), &irCtrl, SLOT(sendCmd3())); - connect(buttons[4], SIGNAL(clicked()), &irCtrl, SLOT(sendCmd4())); - connect(buttons[5], SIGNAL(clicked()), &irCtrl, SLOT(sendCmd5())); - + connect(buttons[0], SIGNAL(clicked()), + this, SLOT(sendCmdClicked(IRemote::VOLUMEUP))); + this->setContentsMargins(0, 0, 0, 0); layout->setContentsMargins(0, 0, 0, 0); this->setLayout(layout); this->setAttribute(Qt::WA_TranslucentBackground); this->setAttribute(Qt::WA_OpaquePaintEvent); resize(); + + + showSettingsDialog(); } MainWidget::~MainWidget() { delete settings; + delete engine; } void MainWidget::paintEvent(QPaintEvent*) @@ -66,7 +70,7 @@ void MainWidget::paintEvent(QPaintEvent*) void MainWidget::showSettingsDialog() { - SettingsDlg dlg; + SettingsDlg dlg(this, engine); dlg.exec(); update(); // Repaint required if bgAlpha value was changed resize(); @@ -83,3 +87,10 @@ void MainWidget::resize() QWidget::resize(w, h); } +void MainWidget::sendCmdClicked(IRemote::RemoteCmd cmd) +{ + engine->remote()->sendCmd(cmd); + +} + +