6fcc2eae51b51e2b37f4a8c294fcdcd56c852ec3
[pierogi] / forms / pirmainform.cpp
1 #include "pirmainform.h"
2 #include "ui_pirmainform.h"
3
4 #include "mainwindow.h"
5 #include "pirkeysetmanager.h"
6
7 // Ugly global:
8 extern PIRMakeMgr makeManager;
9
10
11 PIRMainForm::PIRMainForm(
12   MainWindow *mw)
13   : QWidget(0),
14     ui(new Ui::PIRMainForm),
15     mainWindow(mw)
16 {
17   ui->setupUi(this);
18 }
19
20 PIRMainForm::~PIRMainForm()
21 {
22   delete ui;
23 }
24
25
26 void PIRMainForm::enableButtons(
27   const PIRKeysetManager *keyset,
28   unsigned int id)
29 {
30   emit powerEnabled(keyset->hasKey(id, Power_Key));
31   emit volumeUpEnabled(keyset->hasKey(id, VolumeUp_Key));
32   emit volumeDownEnabled(keyset->hasKey(id, VolumeDown_Key));
33   emit channelUpEnabled(keyset->hasKey(id, ChannelUp_Key));
34   emit channelDownEnabled(keyset->hasKey(id, ChannelDown_Key));
35   emit muteEnabled(keyset->hasKey(id, Mute_Key));
36
37   emit keysetMakeChanged(makeManager.getMakeString(keyset->getMake(id)));
38   emit keysetNameChanged(keyset->getDisplayName(id));
39 }
40
41
42 void PIRMainForm::on_powerButton_pressed()
43 {
44   mainWindow->startRepeating(Power_Key);
45 }
46
47 void PIRMainForm::on_powerButton_released()
48 {
49   mainWindow->stopRepeating();
50 }
51
52 void PIRMainForm::on_mainChannelUpButton_pressed()
53 {
54   mainWindow->startRepeating(ChannelUp_Key);
55 }
56
57 void PIRMainForm::on_mainChannelUpButton_released()
58 {
59   mainWindow->stopRepeating();
60 }
61
62 void PIRMainForm::on_mainChannelDownButton_pressed()
63 {
64   mainWindow->startRepeating(ChannelDown_Key);
65 }
66
67 void PIRMainForm::on_mainChannelDownButton_released()
68 {
69   mainWindow->stopRepeating();
70 }
71
72 void PIRMainForm::on_mainVolumeUp_pressed()
73 {
74   mainWindow->startRepeating(VolumeUp_Key);
75 }
76
77 void PIRMainForm::on_mainVolumeUp_released()
78 {
79   mainWindow->stopRepeating();
80 }
81
82 void PIRMainForm::on_mainVolumeDownButton_pressed()
83 {
84   mainWindow->startRepeating(VolumeDown_Key);
85 }
86
87 void PIRMainForm::on_mainVolumeDownButton_released()
88 {
89   mainWindow->stopRepeating();
90 }
91
92 void PIRMainForm::on_muteButton_pressed()
93 {
94   mainWindow->startRepeating(Mute_Key);
95 }
96
97 void PIRMainForm::on_muteButton_released()
98 {
99   mainWindow->stopRepeating();
100 }