summaryrefslogtreecommitdiffstats
path: root/abs/core/mythinstall/MythVantage-app/mythinstall/infrared.cpp
blob: ae53011546ca6b0046b7aa8189e60731e96e4abf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
#include <unistd.h>
#include <stdlib.h>
#include "infrared.h"
#include <QTextStream>

using namespace std;

extern  HostParms hostparm;

// READS IN REMOTES DESIGNATED AS favorites
HostRemoteTypeIR_favorites::HostRemoteTypeIR_favorites():
    HostImageSelect("HostRemoteType_favorites") {
    setLabel(QObject::tr("Remote"));
    QString dirtxt;
    QString previewpath;
    //scan templates
    dirtxt=MV_ROOT;
    dirtxt.append("templates/remotes/favorites");
    QDir remotes_global(dirtxt);
    remotes_global.setFilter(QDir::Dirs);
    remotes_global.setSorting(QDir::Name | QDir::IgnoreCase);
    QFileInfoList fil_global = remotes_global.entryInfoList(QDir::Dirs);
    QString previewpath_global;
    previewpath_global = dirtxt;
    for( QFileInfoList::iterator it =  fil_global.begin();
            it != fil_global.end();
            ++it )
    {
        QFileInfo  &remote = *it;
        previewpath=dirtxt;
        previewpath+="/";
        previewpath+=remote.fileName() ;
        previewpath+="/preview.jpg" ;
        QFileInfo preview_global(previewpath);
        if ( !preview_global.exists() )
        {
            continue;
        }
        QImage* previewImage = new QImage(preview_global.absoluteFilePath());
        addImageSelection(remote.fileName(), previewImage);
    }
};

// READS IN REMOTES DESIGNATED AS OTHER
HostRemoteTypeIR_other::HostRemoteTypeIR_other():
    HostImageSelect("HostRemoteType_other") {
    setLabel(QObject::tr("Remote"));
    QString dirtxt;
    QString previewpath;
    //scan templates

    dirtxt=MV_ROOT;
    dirtxt.append("templates/remotes/other");
    QDir remotes_global(dirtxt);
    remotes_global.setFilter(QDir::Dirs);
    remotes_global.setSorting(QDir::Name | QDir::IgnoreCase);
    QFileInfoList fil_global = remotes_global.entryInfoList(QDir::Dirs);
    QString previewpath_global;
    previewpath_global = dirtxt;
    for( QFileInfoList::iterator it =  fil_global.begin();
            it != fil_global.end();
            ++it )
    {
        QFileInfo  &remote = *it;
        previewpath=dirtxt;
        previewpath+="/";
        previewpath+=remote.fileName() ;
        previewpath+="/preview.jpg" ;
        QFileInfo preview_global(previewpath);
        if ( !preview_global.exists() )
        {
            continue;
        }
        QImage* previewImage = new QImage(preview_global.absoluteFilePath());
        addImageSelection(remote.fileName(), previewImage);
    }
};


// READS IN REMOTES DESIGNATED AS hauppauge
HostRemoteTypeIR_hauppauge::HostRemoteTypeIR_hauppauge():
    HostImageSelect("HostRemoteType_hauppauge") {
    setLabel(QObject::tr("Remote"));
    QString dirtxt;
    QString previewpath;
    //scan templates

    dirtxt=MV_ROOT;
    dirtxt.append("templates/remotes/hauppauge");
    QDir remotes_global(dirtxt);
    remotes_global.setFilter(QDir::Dirs);
    remotes_global.setSorting(QDir::Name | QDir::IgnoreCase);
    QFileInfoList fil_global = remotes_global.entryInfoList(QDir::Dirs);
    QString previewpath_global;
    previewpath_global = dirtxt;
    for( QFileInfoList::iterator it =  fil_global.begin();
            it != fil_global.end();
            ++it )
    {
        QFileInfo  &remote = *it;
        previewpath=dirtxt;
        previewpath+="/";
        previewpath+=remote.fileName() ;
        previewpath+="/preview.jpg" ;
        QFileInfo preview_global(previewpath);
        if ( !preview_global.exists() )
        {
            continue;
        }
        QImage* previewImage = new QImage(preview_global.absoluteFilePath());
        addImageSelection(remote.fileName(), previewImage);
    }
};



// READS IN REMOTES DESIGNATED AS ATI
HostRemoteTypeIR_ATI::HostRemoteTypeIR_ATI():
    HostImageSelect("HostRemoteType_ATI") {
    setLabel(QObject::tr("Remote"));
    QString dirtxt;
    QString previewpath;
    //scan templates

    dirtxt=MV_ROOT;
    dirtxt.append("templates/remotes/ATI");
    QDir remotes_global(dirtxt);
    remotes_global.setFilter(QDir::Dirs);
    remotes_global.setSorting(QDir::Name | QDir::IgnoreCase);
    QFileInfoList fil_global = remotes_global.entryInfoList(QDir::Dirs);
    QString previewpath_global;
    previewpath_global = dirtxt;
    for( QFileInfoList::iterator it =  fil_global.begin();
            it != fil_global.end();
            ++it )
    {
        QFileInfo  &remote = *it;
        previewpath=dirtxt;
        previewpath+="/";
        previewpath+=remote.fileName() ;
        previewpath+="/preview.jpg" ;
        QFileInfo preview_global(previewpath);
        if ( !preview_global.exists() )
        {
            continue;
        }
        QImage* previewImage = new QImage(preview_global.absoluteFilePath());
        addImageSelection(remote.fileName(), previewImage);
    }
};



// READS IN REMOTES DESIGNATED AS USER
HostRemoteTypeIR_user::HostRemoteTypeIR_user():
    HostImageSelect("HostRemoteType_user") {
    setLabel(QObject::tr("Remote"));
    QString dirtxt;
    QString previewpath;
    //scan home dir  $HOME/remotes
    dirtxt=QDir::homePath() ;
    dirtxt.append("/remotes");

    QDir remotes_global(dirtxt);
    remotes_global.setFilter(QDir::Dirs);
    remotes_global.setSorting(QDir::Name | QDir::IgnoreCase);
    QFileInfoList fil_global = remotes_global.entryInfoList(QDir::Dirs);
    QString previewpath_global;
    previewpath_global = dirtxt;
    int count = 0;
    for( QFileInfoList::iterator it =  fil_global.begin();
            it != fil_global.end();
            ++it )
    {
        QFileInfo  &remote = *it;
        previewpath=dirtxt;
        previewpath+="/";
        previewpath+=remote.fileName() ;
        previewpath+="/preview.jpg" ;
        QFileInfo preview_global(previewpath);
        if ( !preview_global.exists() )
        {
            continue;
        }
        QImage* previewImage = new QImage(preview_global.absoluteFilePath());
        addImageSelection(remote.fileName(), previewImage);
        count++;
    }
    QFileInfo preview_global(previewpath);
    QImage* previewImage = new QImage(preview_global.absoluteFilePath());
    if ( count == 0 )
        addImageSelection("none found", previewImage);

};





static HostComboBox *HostReceiverType()
{
    HostComboBox *gc = new HostComboBox("HostReceiverType");
    gc->setLabel(QObject::tr("Receiver"));
    gc->addSelection("Default");
    gc->addSelection("tinker");
    gc->addSelection("serial");
    gc->addSelection("streamzap");
    gc->addSelection("mce");
    //gc->addSelection("imon");
    gc->addSelection("Hauppauge");
    gc->addSelection("hd_pvr");
    gc->addSelection("CommandIR");
    gc->addSelection("iguanaIR-usb");
    gc->addSelection("SiliconDust_HDHR");

    gc->setHelpText(QObject::tr("The type of infrared receiver used.  Default will use ALL remote devices found."));
    gc->setValue("Default");
    return gc;
};



static HostComboBox *HostSerialPortlirc()
{
    HostComboBox *gc = new HostComboBox("HostSerialPortlirc",false);
    gc->setLabel(QObject::tr("Serial Port"));
    gc->addSelection("ttyS0");
    gc->addSelection("ttyS1");
    gc->addSelection("ttyS2");
    gc->addSelection("ttyS3");
    gc->setHelpText(QObject::tr("Serial port with the lirc receiver or transmitter"));
    return gc;
}

static HostComboBox *HostHDHRlirc_device()
{
    QString temphdhr;
    temphdhr =  gCoreContext->GetSetting("HostHDHRlirc_device");
    MSqlQuery query(MSqlQuery::InitCon());
    query.prepare( "delete from settings where  hostname=:HOSTNAME  and value = 'HostHDHRlirc_device';  "  );
    query.bindValue( ":HOSTNAME" ,   gCoreContext->GetHostName()  );
    query.exec();

    HostComboBox *gc = new HostComboBox("HostHDHRlirc_device",false);
    system ("hdhomerun_config discover > /tmp/.hdhrdiscover");
    gc->setLabel(QObject::tr("HDHR device"));
    gc->setHelpText(QObject::tr("HDHomeRun device to use as remote receiver.  Identifier listed is the Device id found on the bottom of the HDHomeRun."));
    QString currentitem;
    QString line;
    QFile file("/tmp/.hdhrdiscover");
    bool foundhdhr;
    foundhdhr = false;

    if ( file.open(QIODevice::ReadOnly | QIODevice::Text) )
    {
        QTextStream t( &file );        // use a text stream
        while ( !t.atEnd() )
        {
            line = t.readLine();
            if ( line.startsWith("hdhomerun device"))
            {
                currentitem = line.section( " ", 2, 2 );
                gc->addSelection(currentitem);
                foundhdhr = true;
            }
        }
        file.close();
    }

    //These are all hoops to jump through to clear out the device list and save when the combobox isn't touched by the user and they just accept the defaults
    if ( foundhdhr == false )
    {
        gc->clearSelections();
        gc->addSelection("No devices found");
        gc->setValue("No devices found");
        gCoreContext->SaveSetting("HostHDHRlirc_device","No devices found");
    }
    else
    {
        int findhdhr=gc->findSelection(temphdhr);
        //JM VERBOSE(VB_IMPORTANT, findhdhr);
        if ( findhdhr > -1 )
        {
            gc->addSelection(temphdhr);
            gc->setValue(temphdhr);
            gCoreContext->SaveSetting("HostHDHRlirc_device", temphdhr );
        }
        else
        {
            gCoreContext->SaveSetting("HostHDHRlirc_device", gc->getValue());
        }
    }

    return gc;
}



class LIRC_ReceiverSettings: public TriggeredConfigurationGroup {
public:
    LIRC_ReceiverSettings():
        TriggeredConfigurationGroup(false, false, true, true,false, false, true, true) {
        Setting* trigger =  HostReceiverType() ;
        addChild(trigger);
        setTrigger(trigger);

        ConfigurationGroup* blanksettings = new GridConfigurationGroup(2,true);

        ConfigurationGroup* settings = new GridConfigurationGroup(2,true);
        settings->addChild(HostSerialPortlirc());

        ConfigurationGroup* hdhrsettings = new GridConfigurationGroup(2,true);
        hdhrsettings->addChild(HostHDHRlirc_device());



        addTarget("Default", blanksettings);
        addTarget("tinker", blanksettings );
        addTarget("serial", settings);
        addTarget("imon", blanksettings );
        //addTarget("Hauppauge",blanksettings);
        addTarget("hd_pvr",blanksettings);
        addTarget("CommandIR", blanksettings);
        addTarget("iguanaIR-usb", blanksettings);
        addTarget("mce", blanksettings);
        addTarget("streamzap", blanksettings);
        addTarget("SiliconDust_HDHR", hdhrsettings);

    };
};

static HostComboBox *HostRemotebucket()
{
    HostComboBox *gc = new HostComboBox("HostRemotebucket");
    gc->setLabel(QObject::tr("Remote Class"));
    gc->addSelection("favorites");
    gc->addSelection("hauppauge");
    gc->addSelection("ATI");
    gc->addSelection("user");
    gc->addSelection("other");

    gc->setHelpText(QObject::tr("Remote classification. Favorites are remotes fully supported by LinHES."));

    return gc;
};


class Remote_bucket: public TriggeredConfigurationGroup {
public:
    Remote_bucket():
    TriggeredConfigurationGroup(false, false, true, true,false, false, true, true) {
        Setting* trigger =  HostRemotebucket() ;
        addChild(trigger);
        setTrigger(trigger);

        ConfigurationGroup* blanksettings = new GridConfigurationGroup(2,true);
        ConfigurationGroup* favorites_def = new GridConfigurationGroup(2,true);
            favorites_def-> addChild(new HostRemoteTypeIR_favorites());

        ConfigurationGroup* other_def = new GridConfigurationGroup(2,true);
            other_def-> addChild(new HostRemoteTypeIR_other());

        ConfigurationGroup* hauppauge_def = new GridConfigurationGroup(2,true);
            hauppauge_def-> addChild(new HostRemoteTypeIR_hauppauge());

        ConfigurationGroup* ATI_def = new GridConfigurationGroup(2,true);
            ATI_def-> addChild(new HostRemoteTypeIR_ATI());


        ConfigurationGroup* user_def = new GridConfigurationGroup(2,true);
            user_def-> addChild(new HostRemoteTypeIR_user());

        addTarget("favorites", favorites_def);
        addTarget("hauppauge", hauppauge_def);
        addTarget("ATI", ATI_def);
        addTarget("user", user_def);
        addTarget("other", other_def);




    };
};







IRFrame::IRFrame():
    VerticalConfigurationGroup(false,false,false,false)
{
    setLabel(QObject::tr("Remotes Settings"));
    LIRC_ReceiverSettings *receiversettings = new LIRC_ReceiverSettings();
    //addChild(new HostRemoteTypeIR());
    addChild(new Remote_bucket());
    addChild(receiversettings);
}


//----------------transmit settings--------------
static HostComboBox *HostTransmitproto_1()
{
    HostComboBox *gc = new HostComboBox("HostTransmitproto_1",false);
    gc->setLabel(QObject::tr("Transmitter 1"));
    gc->addSelection("none");
    gc->setValue(0);
    gc->setHelpText(QObject::tr("Remote codes to control a cable box"));
    QString dirtxt;
    dirtxt=MV_ROOT;
    dirtxt.append("templates/transmit");
    QDir transmit(dirtxt);
    transmit.setFilter(QDir::Dirs);
    transmit.setSorting(QDir::Name | QDir::IgnoreCase);
    QFileInfoList fil = transmit.entryInfoList(QDir::Dirs);
    for( QFileInfoList::iterator it =  fil.begin();
            it != fil.end();
            ++it )
    {
        QFileInfo  &currentitem = *it;
        //  //JM VERBOSE(VB_IMPORTANT, currentitem.fileName());
        if ( currentitem.fileName() != ".." && currentitem.fileName() != "." && currentitem.fileName() != "")
        {
            gc->addSelection(currentitem.fileName());
        }
    }
    return gc;
};





static HostComboBox *HostTransmitproto_2()
{
    HostComboBox *gc = new HostComboBox("HostTransmitproto_2",false);
    gc->setLabel(QObject::tr("Transmitter 2"));
    gc->addSelection("none");
    gc->setValue(0);
    gc->setHelpText(QObject::tr("Remote codes to control a cable box"));
    QString dirtxt;
    dirtxt=MV_ROOT;
    dirtxt.append("templates/transmit");
    QDir transmit(dirtxt);
    transmit.setFilter(QDir::Dirs);
    transmit.setSorting(QDir::Name | QDir::IgnoreCase);
    QFileInfoList fil = transmit.entryInfoList(QDir::Dirs);
    for( QFileInfoList::iterator it =  fil.begin();
            it != fil.end();
            ++it )
    {
        QFileInfo  &currentitem = *it;
        //  //JM VERBOSE(VB_IMPORTANT, currentitem.fileName());
        if ( currentitem.fileName() != ".." && currentitem.fileName() != "." && currentitem.fileName() != "")
        {
            gc->addSelection(currentitem.fileName());
        }
    }
    return gc;
};

static HostComboBox *HostTransmitproto_3()
{
    HostComboBox *gc = new HostComboBox("HostTransmitproto_3",false);
    gc->setLabel(QObject::tr("Transmitter 3"));
    gc->addSelection("none");
    gc->setValue(0);
    gc->setHelpText(QObject::tr("Remote codes to control a cable box"));
    QString dirtxt;
    dirtxt=MV_ROOT;
    dirtxt.append("templates/transmit");
    QDir transmit(dirtxt);
    transmit.setFilter(QDir::Dirs);
    QFileInfoList fil = transmit.entryInfoList(QDir::Dirs);
    for( QFileInfoList::iterator it =  fil.begin();
            it != fil.end();
            ++it )
    {
        QFileInfo  &currentitem = *it;
        //  //JM VERBOSE(VB_IMPORTANT, currentitem.fileName());
        if ( currentitem.fileName() != ".." && currentitem.fileName() != "." && currentitem.fileName() != "")
        {
            gc->addSelection(currentitem.fileName());
        }
    }
    return gc;
};

static HostComboBox *HostTransmitproto_4()
{
    HostComboBox *gc = new HostComboBox("HostTransmitproto_4",false);
    gc->setLabel(QObject::tr("Transmitter 4"));
    gc->addSelection("none");
    gc->setValue(0);
    gc->setHelpText(QObject::tr("Remote codes to control a cable box"));
    QString dirtxt;
    dirtxt=MV_ROOT;
    dirtxt.append("templates/transmit");
    QDir transmit(dirtxt);
    QFileInfoList fil = transmit.entryInfoList(QDir::Dirs);
    for( QFileInfoList::iterator it =  fil.begin();
            it != fil.end();
            ++it )
    {
        QFileInfo  &currentitem = *it;
        //    //JM VERBOSE(VB_IMPORTANT, currentitem.fileName());
        if ( currentitem.fileName() != ".." && currentitem.fileName() != "." && currentitem.fileName() != "")
        {
            gc->addSelection(currentitem.fileName());
        }
    }
    return gc;
};


static HostComboBox *HostBlasterType()
{
    HostComboBox *gc = new HostComboBox("HostBlasterType");
    gc->setLabel(QObject::tr("Blaster"));
    gc->addSelection("None");
    gc->addSelection("Receiver");
    gc->addSelection("serial");
    gc->addSelection("CommandIR");

    //gc->addSelection("Hauppauge");
    gc->addSelection("mce");
    //gc->addSelection("pvr150");
    gc->addSelection("iguanaIR-usb");
    gc->addSelection("hd_pvr");
    gc->setHelpText(QObject::tr("The type of infrared transmitter being used. Receiver will use the receiver settings. Selecting CommandIR or iguanaIR-usb will use that device for both transmitting and receiving.  All other receivers will be disabled."));
    gc->setValue("None");
    return gc;
};

static HostComboBox *HostSerialPort_blasterlirc()
{
    HostComboBox *gc = new HostComboBox("HostSerialPort_blasterlirc",false);
    gc->setLabel(QObject::tr("Serial Port"));
    gc->addSelection("ttyS0");
    gc->addSelection("ttyS1");
    gc->addSelection("ttyS2");
    gc->addSelection("ttyS3");
    gc->setHelpText(QObject::tr("Serial port with the lirc transmitter"));
    return gc;
}


static HostSpinBox *HostTransmitDelay_1()
{
    HostSpinBox *gc = new HostSpinBox("HostTransmitDelay_1", 1 , 200, 1, true);
    gc->setLabel(QObject::tr("Delay"));
    gc->setValue(2);
    gc->setHelpText(QObject::tr("Amount of delay in tenths of a second between transmits"));
    return gc;
}
static HostComboBox *HostTransmitSend_after_1()
{
    HostComboBox *gc = new HostComboBox("HostTransmitSend_after_1",false);
    gc->setLabel(QObject::tr("Key:"));
    gc->addSelection("Enter");
    gc->addSelection("Select");
    gc->setHelpText(QObject::tr("Name of the key to send after transmitting the numbers.  For example Enter or Select"));
    return gc;
}

static HostSpinBox *HostTransmitDelay_2()
{
    HostSpinBox *gc = new HostSpinBox("HostTransmitDelay_2", 1 , 200, 1, true);
    gc->setLabel(QObject::tr("Delay"));
    gc->setValue(2);
    gc->setHelpText(QObject::tr("Amount of delay in tenths of a second between transmits"));
    return gc;
}
static HostComboBox *HostTransmitSend_after_2()
{
    HostComboBox *gc = new HostComboBox("HostTransmitSend_after_2",false);
    gc->setLabel(QObject::tr("Key:"));
    gc->addSelection("Enter");
    gc->addSelection("Select");
    gc->setHelpText(QObject::tr("Name of the key to send after transmitting the numbers.  For example Enter or Select"));
    return gc;
}


static HostSpinBox *HostTransmitDelay_3()
{
    HostSpinBox *gc = new HostSpinBox("HostTransmitDelay_3", 1 , 200, 1, true);
    gc->setLabel(QObject::tr("Delay"));
    gc->setValue(2);
    gc->setHelpText(QObject::tr("Amount of delay in tenths of a second between transmits"));
    return gc;
}
static HostComboBox *HostTransmitSend_after_3()
{
    HostComboBox *gc = new HostComboBox("HostTransmitSend_after_3",false);
    gc->setLabel(QObject::tr("Key:"));
    gc->addSelection("Enter");
    gc->addSelection("Select");
    gc->setHelpText(QObject::tr("Name of the key to send after transmitting the numbers.  For example Enter or Select"));
    return gc;
}


static HostSpinBox *HostTransmitDelay_4()
{
    HostSpinBox *gc = new HostSpinBox("HostTransmitDelay_4", 1 , 200, 1, true);
    gc->setLabel(QObject::tr("Delay"));
    gc->setValue(2);
    gc->setHelpText(QObject::tr("Amount of delay in tenths of a second between transmits"));
    return gc;
}
static HostComboBox *HostTransmitSend_after_4()
{
    HostComboBox *gc = new HostComboBox("HostTransmitSend_after_4",false);
    gc->setLabel(QObject::tr("Key:"));
    gc->addSelection("Enter");
    gc->addSelection("Select");
    gc->setHelpText(QObject::tr("Name of the key to send after transmitting the numbers.  For example Enter or Select"));
    return gc;
}







class LIRC_BlasterSettings: public TriggeredConfigurationGroup {
public:
    LIRC_BlasterSettings():
        TriggeredConfigurationGroup(false, false, true, true,false, false, true, true) {
        Setting* trigger =  HostBlasterType() ;
        addChild(trigger);
        setTrigger(trigger);

        ConfigurationGroup* blanksettings = new GridConfigurationGroup(2,true);

        ConfigurationGroup* transmit_1 = new GridConfigurationGroup(3,true);
            transmit_1->addChild(HostTransmitproto_1());
            transmit_1->addChild(HostTransmitDelay_1());
            //transmit_1->addChild(HostTransmitSend_after_1());

        ConfigurationGroup* transmit_2 = new GridConfigurationGroup(3,true);
            transmit_2->addChild(HostTransmitproto_2());
            transmit_2->addChild(HostTransmitDelay_2());
            //transmit_2->addChild(HostTransmitSend_after_2());


        ConfigurationGroup* transmit_3 = new GridConfigurationGroup(3,true);
            transmit_3->addChild(HostTransmitproto_3());
            transmit_3->addChild(HostTransmitDelay_3());
            //transmit_3->addChild(HostTransmitSend_after_3());

        ConfigurationGroup* transmit_4 = new GridConfigurationGroup(3,true);
            transmit_4->addChild(HostTransmitproto_4());
            transmit_4->addChild(HostTransmitDelay_4());
            //transmit_4->addChild(HostTransmitSend_after_4());

        ConfigurationGroup* CommandIRsettings = new GridConfigurationGroup(1,true);
            CommandIRsettings->addChild(transmit_1);
            CommandIRsettings->addChild(transmit_2);
            CommandIRsettings->addChild(transmit_3);
            CommandIRsettings->addChild(transmit_4);

        ConfigurationGroup* mcesettings = new GridConfigurationGroup(1,true);
            mcesettings->addChild(transmit_1);
            mcesettings->addChild(transmit_2);

        ConfigurationGroup* serial_settings = new GridConfigurationGroup(1,true);
            serial_settings->addChild(HostSerialPort_blasterlirc());
            serial_settings->addChild(transmit_1);

        addTarget("None", blanksettings);
        addTarget("Receiver", transmit_1);
        addTarget("serial", serial_settings);
        addTarget("CommandIR", CommandIRsettings);
        //addTarget("pvr150",blanksettings);
        addTarget("hd_pvr",transmit_1);
        addTarget("mce",mcesettings);
        addTarget("iguanaIR-usb",mcesettings);
//        addTarget("tinker", blanksettings );
    };
};

IR_TransmitFrame::IR_TransmitFrame():
    VerticalConfigurationGroup(false,false,false,false)
{
    setLabel(QObject::tr("Blaster Settings"));
    LIRC_BlasterSettings *blastersettings = new LIRC_BlasterSettings();
    addChild(blastersettings);
}

//------------------LCD settings-------------



static HostComboBox *HostLCDType()
{
    HostComboBox *gc = new HostComboBox("HostLCDType",false);
    gc->setLabel(QObject::tr("LCD/VFD model"));
    gc->addSelection("no_lcd");
    gc->addSelection("tinker");
    gc->setValue(0);
    gc->setHelpText(QObject::tr("VFD or LCD"));
    QString dirtxt;
    dirtxt=MV_ROOT;
    dirtxt.append("templates/LCD");
    QDir transmit(dirtxt);
    transmit.setFilter(QDir::Dirs);
    QFileInfoList fil = transmit.entryInfoList(QDir::Dirs);
    for( QFileInfoList::iterator it =  fil.begin();
            it != fil.end();
            ++it )
    {
        QFileInfo  &currentitem = *it;
        //JM VERBOSE(VB_IMPORTANT, currentitem.fileName());
        if ( currentitem.fileName() != ".." && currentitem.fileName() != "." && currentitem.fileName() != "")
        {
            gc->addSelection(currentitem.fileName());
        }
    }
    return gc;
};

LCDFrame::LCDFrame():
    VerticalConfigurationGroup(false,false,false,false)
{
    setLabel(QObject::tr("LCD Settings"));
    addChild(HostLCDType());
}