1 #include "mainwidget.h"
3 #include <QInputDialog>
8 #include "settingsdlg.h"
10 MainWidget::MainWidget (QWidget *parent)
13 layout = new QGridLayout(this);
16 "/usr/share/icons/hicolor/48x48/hildon/statusarea_volumelevel4.png",
17 "/usr/share/icons/hicolor/48x48/hildon/statusarea_volumelevel1.png",
18 "/usr/share/icons/hicolor/48x48/hildon/rss_reader_move_up.png",
19 "/usr/share/icons/hicolor/48x48/hildon/rss_reader_move_down.png",
20 "/usr/share/icons/hicolor/48x48/hildon/location_applet_on.png",
21 "/usr/share/icons/hicolor/48x48/hildon/statusarea_volume_mute.png"
24 char *buttonTitles[] = {
33 for (int i = 0; i < BUTTON_COUNT; ++i)
35 QPushButton *button = new QPushButton(
36 QIcon(QString(iconNames[i])),
37 QString(buttonTitles[i]), this);
39 button->setPalette(QPalette(QColor(0, 0, 0, 192)));
40 layout->addWidget(button, i%2, i/2);
43 connect(buttons[0], SIGNAL(clicked(bool)), &irCtrl, SLOT(sendCmd0(bool)));
44 connect(buttons[1], SIGNAL(clicked(bool)), &irCtrl, SLOT(sendCmd1(bool)));
45 connect(buttons[2], SIGNAL(clicked(bool)), &irCtrl, SLOT(sendCmd2(bool)));
46 connect(buttons[3], SIGNAL(clicked(bool)), &irCtrl, SLOT(sendCmd3(bool)));
47 connect(buttons[4], SIGNAL(clicked(bool)), &irCtrl, SLOT(sendCmd4(bool)));
48 connect(buttons[5], SIGNAL(clicked(bool)), &irCtrl, SLOT(sendCmd5(bool)));
50 this->setContentsMargins(0, 0, 0, 0);
51 layout->setContentsMargins(0, 0, 0, 0);
52 this->setLayout(layout);
53 this->setAttribute(Qt::WA_TranslucentBackground);
56 void MainWidget::paintEvent(QPaintEvent *event)
59 p.setBrush(QColor(0, 0, 0, 128));
61 p.drawRoundRect(rect(), 0, 0);
65 void MainWidget::showSettingsDialog()
67 SettingsDlg dlg(this);
68 if (dlg.exec() == QDialog::Accepted)
70 irCtrl.setRemoteName(dlg.getRemoteName());