1 #include "mainwidget.h"
3 #include <QInputDialog>
8 #include "settingsdlg.h"
10 MainWidget::MainWidget (QWidget *parent)
13 layout = new QGridLayout(this);
15 for (int i = 0; i < BUTTON_COUNT; ++i)
17 QPushButton *button = new QPushButton(QString(i+0x30), this);
19 layout->addWidget(button, i%2, i/2);
22 connect(buttons[0], SIGNAL(clicked(bool)), &irCtrl, SLOT(sendCmd0(bool)));
23 connect(buttons[1], SIGNAL(clicked(bool)), &irCtrl, SLOT(sendCmd1(bool)));
24 connect(buttons[2], SIGNAL(clicked(bool)), &irCtrl, SLOT(sendCmd2(bool)));
25 connect(buttons[3], SIGNAL(clicked(bool)), &irCtrl, SLOT(sendCmd3(bool)));
26 connect(buttons[4], SIGNAL(clicked(bool)), &irCtrl, SLOT(sendCmd4(bool)));
27 connect(buttons[5], SIGNAL(clicked(bool)), &irCtrl, SLOT(sendCmd5(bool)));
29 this->setLayout(layout);
30 this->setAttribute(Qt::WA_TranslucentBackground);
33 void MainWidget::paintEvent(QPaintEvent *event)
36 p.setBrush(QColor(0, 0, 0, 128));
38 p.drawRoundRect(rect(), 10, 20);
42 void MainWidget::showSettingsDialog()
44 SettingsDlg dlg(this);
45 if (dlg.exec() == QDialog::Accepted)
47 irCtrl.setRemoteName(dlg.getRemoteName());