MythTV master
diseqcsettings.cpp
Go to the documentation of this file.
1/*
2 * \file diseqcsettings.cpp
3 * \brief DVB-S Device Tree Configuration Classes.
4 * \author Copyright (C) 2006, Yeasah Pell
5 */
6
7// Std C headers
8#include <array>
9#include <cmath>
10#include <utility>
11
12// MythTV headers
14#include "diseqcsettings.h"
15
16/* Lat/Long items relocated from videosource.cpp */
17
19{
20 auto *gc = new GlobalTextEditSetting("latitude");
21 gc->setLabel("Latitude");
22 gc->setHelpText(
23 DeviceTree::tr("The Cartesian latitude for your location. "
24 "Use negative numbers for southern coordinates."));
25 return gc;
26}
27
29{
30 auto *gc = new GlobalTextEditSetting("longitude");
31 gc->setLabel("Longitude");
32 gc->setHelpText(
33 DeviceTree::tr("The Cartesian longitude for your location. "
34 "Use negative numbers for western coordinates."));
35 return gc;
36}
37
39
41{
42 public:
44 {
45 setLabel(DeviceTree::tr("Device Type"));
46 addSelection(DeviceTree::tr("Unconnected"),
47 QString::number((uint) 0xFFFF));
48 addSelection(DeviceTree::tr("Switch"),
49 QString::number((uint) DiSEqCDevDevice::kTypeSwitch));
50 addSelection(DeviceTree::tr("Rotor"),
51 QString::number((uint) DiSEqCDevDevice::kTypeRotor));
52 addSelection(DeviceTree::tr("Unicable"),
53 QString::number((uint) DiSEqCDevDevice::kTypeSCR));
54 addSelection(DeviceTree::tr("LNB"),
55 QString::number((uint) DiSEqCDevDevice::kTypeLNB));
56 }
57
58 void Load(void) override // StandardSetting
59 {
60 if (m_device)
61 {
62 QString tmp = QString::number((uint) m_device->GetDeviceType());
64 }
65 setChanged(false);
66 }
67
69 {
70 m_device = dev;
71 }
72
74 {
75 SetDevice(nullptr);
77 }
78
80 {
81 return m_device;
82 }
83
84 private:
86};
87
89
91{
92 public:
94 m_device(device)
95 {
96 setLabel(DeviceTree::tr("Description"));
97 QString help = DeviceTree::tr(
98 "Optional descriptive name for this device, to "
99 "make it easier to configure settings later.");
101 }
102
103 void Load(void) override // StandardSetting
104 {
106 setChanged(false);
107 }
108
109 void Save(void) override // StandardSetting
110 {
112 }
113
114 private:
116};
117
118
120
122{
123 public:
125 TransMythUISpinBoxSetting(0, 15, 1), m_device(device)
126 {
127 setLabel(DeviceTree::tr("Repeat Count"));
128 QString help = DeviceTree::tr(
129 "Number of repeat (command with repeat flag ON) or resend (the same command) DiSEqC commands. "
130 "If value is higher than 10, command will be resend N-10 times. "
131 "If value is lower than 10, command will be repeated N times. "
132 "Repeat useful for unreliable DiSEqC equipment; resend useful when unreliable DiSEqC equipment has broken/unsupported repeat flag support.");
134 }
135
136 void Load(void) override // StandardSetting
137 {
139 setChanged(false);
140 }
141
142 void Save(void) override // StandardSetting
143 {
144 m_device.SetRepeatCount(getValue().toUInt());
145 }
146
147 private:
149};
150
152
154{
155 public:
156 explicit SwitchTypeSetting(DiSEqCDevSwitch &switch_dev) :
157 m_switch(switch_dev)
158 {
159 setLabel(DeviceTree::tr("Switch Type"));
160 setHelpText(DeviceTree::tr("Select the type of switch from the list."));
161
162 addSelection(DeviceTree::tr("Tone"),
163 QString::number((uint) DiSEqCDevSwitch::kTypeTone));
164 addSelection(DeviceTree::tr("Voltage"),
165 QString::number((uint) DiSEqCDevSwitch::kTypeVoltage));
166 addSelection(DeviceTree::tr("Mini DiSEqC"),
167 QString::number((uint) DiSEqCDevSwitch::kTypeMiniDiSEqC));
168 addSelection(DeviceTree::tr("DiSEqC"),
169 QString::number((uint)
171 addSelection(DeviceTree::tr("DiSEqC (Uncommitted)"),
172 QString::number((uint)
174 addSelection(DeviceTree::tr("Legacy SW21"),
175 QString::number((uint) DiSEqCDevSwitch::kTypeLegacySW21));
176 addSelection(DeviceTree::tr("Legacy SW42"),
177 QString::number((uint) DiSEqCDevSwitch::kTypeLegacySW42));
178 addSelection(DeviceTree::tr("Legacy SW64"),
179 QString::number((uint) DiSEqCDevSwitch::kTypeLegacySW64));
180 }
181
182 void Load(void) override // StandardSetting
183 {
184 setValue(getValueIndex(QString::number((uint) m_switch.GetType())));
185 setChanged(false);
186 }
187
188 void Save(void) override // StandardSetting
189 {
191 getValue().toUInt());
192 }
193
194 private:
196};
197
199
201{
202 public:
203 explicit SwitchAddressSetting(DiSEqCDevSwitch &switch_dev) :
204 m_switch(switch_dev)
205 {
206 setLabel(DeviceTree::tr("Address of switch"));
207 setHelpText(DeviceTree::tr("The DiSEqC address of the switch."));
208 }
209
210 void Load(void) override // StandardSetting
211 {
212 setValue(QString("0x%1").arg(m_switch.GetAddress(), 0, 16));
213 setChanged(false);
214 }
215
216 void Save(void) override // StandardSetting
217 {
218 m_switch.SetAddress(getValue().toUInt(nullptr, 16));
219 }
220
221 private:
223};
224
226
228{
229 public:
230 explicit SwitchPortsSetting(DiSEqCDevSwitch &switch_dev) :
231 m_switch(switch_dev)
232 {
233 setLabel(DeviceTree::tr("Number of ports"));
234 setHelpText(DeviceTree::tr("The number of ports this switch has."));
235 }
236
237 void Load(void) override // StandardSetting
238 {
239 setValue(QString::number(m_switch.GetNumPorts()));
240 setChanged(false);
241 }
242
243 void Save(void) override // StandardSetting
244 {
245 m_switch.SetNumPorts(getValue().toUInt());
246 }
247
248 private:
250};
251
253
255 : m_deviceDescr(new DeviceDescrSetting(switch_dev)),
256 m_type(new SwitchTypeSetting(switch_dev)),
257 m_ports(new SwitchPortsSetting(switch_dev)),
258 m_address(new SwitchAddressSetting(switch_dev))
259{
260 setLabel(DeviceTree::tr("Switch Configuration"));
261
262 parent = this;
263 parent->addChild(m_deviceDescr);
264 parent->addChild(new DeviceRepeatSetting(switch_dev));
265 parent->addChild(m_type);
266 parent->addChild(m_address);
267 parent->addChild(m_ports);
268
269 connect(m_type, qOverload<const QString&>(&StandardSetting::valueChanged),
270 this, qOverload<const QString&>(&SwitchConfig::update));
271 connect(m_deviceDescr, qOverload<const QString&>(&StandardSetting::valueChanged),
272 this, qOverload<const QString&>(&StandardSetting::setValue));
273}
274
276{
279 update();
280 setChanged(false);
281}
282
284{
286 {
292 m_address->setValue(QString("0x10"));
293 m_address->setEnabled(false);
294 m_ports->setValue("2");
295 m_ports->setEnabled(false);
296 break;
298 m_address->setValue(QString("0x10"));
299 m_address->setEnabled(false);
300 m_ports->setValue("3");
301 m_ports->setEnabled(false);
302 break;
305 m_address->setEnabled(true);
306 m_ports->setEnabled(true);
307 break;
308 }
309}
310
311void SwitchConfig::update(const QString &/*value*/)
312{
313 update();
314}
315
317{
318 QStringList actions;
319 if (GetMythMainWindow()->TranslateKeyPress("Global", e, actions))
320 return true;
321
322 if (actions.contains("DELETE"))
323 {
324 emit DeleteClicked();
325 return true;
326 }
327
328 return false;
329}
330
332
334{
335 public:
337 m_rotor(rotor)
338 {
339 setLabel(DeviceTree::tr("Rotor Type"));
340 setHelpText(DeviceTree::tr("Select the type of rotor from the list."));
341 addSelection(DeviceTree::tr("DiSEqC 1.2"),
342 QString::number((uint) DiSEqCDevRotor::kTypeDiSEqC_1_2));
343 addSelection(DeviceTree::tr("DiSEqC 1.3 (GotoX/USALS)"),
344 QString::number((uint) DiSEqCDevRotor::kTypeDiSEqC_1_3));
345 }
346
347 void Load(void) override // StandardSetting
348 {
349 setValue(getValueIndex(QString::number((uint)m_rotor.GetType())));
350 setChanged(false);
351 }
352
353 void Save(void) override // StandardSetting
354 {
356 }
357
358 private:
360};
361
363
365{
366 public:
368 m_rotor(rotor)
369 {
370 setLabel(DeviceTree::tr("Rotor Low Speed (deg/sec)"));
371 QString help = DeviceTree::tr(
372 "To allow the approximate monitoring of rotor movement, enter "
373 "the rated angular speed of the rotor when powered at 13V.");
375 }
376
377 void Load(void) override // StandardSetting
378 {
379 setValue(QString::number(m_rotor.GetLoSpeed()));
380 setChanged(false);
381 }
382
383 void Save(void) override // StandardSetting
384 {
385 m_rotor.SetLoSpeed(getValue().toDouble());
386 }
387
388 private:
390};
391
393
395{
396 public:
398 m_rotor(rotor)
399 {
400 setLabel(DeviceTree::tr("Rotor High Speed (deg/sec)"));
401 QString help = DeviceTree::tr(
402 "To allow the approximate monitoring of rotor movement, enter "
403 "the rated angular speed of the rotor when powered at 18V.");
405 }
406
407 void Load(void) override // StandardSetting
408 {
409 setValue(QString::number(m_rotor.GetHiSpeed()));
410 setChanged(false);
411 }
412
413 void Save(void) override // StandardSetting
414 {
415 m_rotor.SetHiSpeed(getValue().toDouble());
416 }
417
418 private:
420};
421
423
424static QString AngleToString(double angle)
425{
426 QString str;
427 if (angle >= 0.0)
428 {
429 str = QString::number(angle) +
430 DeviceTree::tr("E", "Eastern Hemisphere");
431 }
432 else /* if (angle < 0.0) */
433 {
434 str = QString::number(-angle) +
435 DeviceTree::tr("W", "Western Hemisphere");
436 }
437 return str;
438}
439
440static double AngleToEdit(double angle, QString &hemi)
441{
442 if (angle > 0.0)
443 {
444 hemi = "E";
445 return angle;
446 }
447
448 hemi = "W";
449 return -angle;
450}
451
452static double AngleToFloat(const QString &angle, bool translated = true)
453{
454 if (angle.length() < 2)
455 return 0.0;
456
457 double pos = __builtin_nan("");
458 QChar postfix = angle.at(angle.length() - 1);
459 if (postfix.isLetter())
460 {
461#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
462 pos = angle.leftRef(angle.length() - 1).toDouble();
463#else
464 pos = QStringView(angle).left(angle.length() - 1).toDouble();
465#endif
466 if ((translated &&
467 (postfix.toUpper() ==
468 DeviceTree::tr("W", "Western Hemisphere").at(0))) ||
469 (!translated && (postfix.toUpper() == 'W')))
470 {
471 pos = -pos;
472 }
473 }
474 else
475 {
476 pos = angle.toDouble();
477 }
478
479 return pos;
480}
481
483{
485 PopulateList();
486}
487
489{
491}
492
494{
495public:
496 RotorPosTextEdit(const QString &label, uint id, const QString &value) :
497 m_id(id)
498 {
499 setLabel(label);
500 setValue(value);
501 }
502
503 void updateButton(MythUIButtonListItem *item) override // MythUITextEditSetting
504 {
506 if (getValue().isEmpty())
507 item->SetText(DeviceTree::tr("None"), "value");
508 }
509
511};
512
514{
515 auto *posEdit = dynamic_cast<RotorPosTextEdit*>(setting);
516 if (posEdit == nullptr)
517 return;
518 QString value = posEdit->getValue();
519 if (value.isEmpty())
520 m_posmap.erase(m_posmap.find(posEdit->m_id));
521 else
522 m_posmap[posEdit->m_id] = AngleToFloat(posEdit->getValue());
523}
524
526{
527 uint num_pos = 64;
528 for (uint pos = 1; pos < num_pos; pos++)
529 {
530 uint_to_dbl_t::const_iterator it = m_posmap.constFind(pos);
531 QString posval;
532 if (it != m_posmap.constEnd())
533 posval = AngleToString(*it);
534
535 auto *posEdit =
536 new RotorPosTextEdit(DeviceTree::tr("Position #%1").arg(pos),
537 pos,
538 posval);
539 connect(posEdit, qOverload<StandardSetting*>(&StandardSetting::valueChanged),
540 this, &RotorPosMap::newValue);
541 addChild(posEdit);
542 }
543}
544
546
548 : m_rotor(rotor),
549 m_pos(new RotorPosMap(rotor))
550{
551 setLabel(DeviceTree::tr("Rotor Configuration"));
552 setValue(rotor.GetDescription());
553
554 parent = this;
555 parent->addChild(new DeviceDescrSetting(rotor));
556 parent->addChild(new DeviceRepeatSetting(rotor));
557
558 auto *rtype = new RotorTypeSetting(rotor);
559 connect(rtype, qOverload<const QString&>(&StandardSetting::valueChanged),
560 this, &RotorConfig::SetType);
561 parent->addChild(rtype);
562
563 m_pos->setLabel(DeviceTree::tr("Positions"));
564 m_pos->setHelpText(DeviceTree::tr("Rotor position setup."));
565 parent->addChild(m_pos);
566
567 parent->addChild(new RotorLoSpeedSetting(rotor));
568 parent->addChild(new RotorHiSpeedSetting(rotor));
569 parent->addChild(DiSEqCLatitude());
570 parent->addChild(DiSEqCLongitude());
571}
572
574{
577}
578
579void RotorConfig::SetType(const QString &type)
580{
581 auto rtype = (DiSEqCDevRotor::dvbdev_rotor_t) type.toUInt();
583}
584
586
588{
589 public:
591 TransMythUISpinBoxSetting(0, 7, 1), m_scr(scr)
592 {
593 setLabel(DeviceTree::tr("Userband"));
594 setHelpText(DeviceTree::tr(
595 "Unicable userband ID (0-7). The Unicable userband channels "
596 "are often numbered starting at 1 but MythTV starts at 0."));
597 }
598
599 void Load(void) override // StandardSetting
600 {
602 setChanged(false);
603 }
604
605 void Save(void) override // StandardSetting
606 {
608 }
609
610 private:
612};
613
615
617{
618 public:
620 {
621 setLabel(DeviceTree::tr("Frequency (MHz)"));
622 setHelpText(DeviceTree::tr("Unicable userband frequency (usually 1210, 1420, 1680 and 2040 MHz)"));
623 }
624
625 void Load(void) override // StandardSetting
626 {
627 setValue(QString::number(m_scr.GetFrequency()));
628 setChanged(false);
629 }
630
631 void Save(void) override // StandardSetting
632 {
633 m_scr.SetFrequency(getValue().toUInt());
634 }
635
636 private:
638};
639
641
643{
644 public:
645 explicit SCRPINSetting(DiSEqCDevSCR &scr) : m_scr(scr)
646 {
647 setLabel(DeviceTree::tr("PIN code"));
648 setHelpText(DeviceTree::tr("Unicable PIN code (-1 disabled, 0 - 255)"));
649 }
650
651 void Load(void) override // StandardSetting
652 {
653 setValue(QString::number(m_scr.GetPIN()));
654 setChanged(false);
655 }
656
657 void Save(void) override // StandardSetting
658 {
659 m_scr.SetPIN(getValue().toInt());
660 }
661
662 private:
664};
665
667
669{
670 setLabel(DeviceTree::tr("Unicable Configuration"));
671
672 parent = this;
673 parent->addChild(new SCRUserBandSetting(scr));
674 parent->addChild(new SCRFrequencySetting(scr));
675 parent->addChild(new SCRPINSetting(scr));
676 parent->addChild(new DeviceRepeatSetting(scr));
677}
678
680
682{
683 public:
685 uint _lof_sw = 0, uint _lof_lo = 0,
686 uint _lof_hi = 0, bool _pol_inv = false) :
687 m_name(std::move(_name)), m_type(_type),
688 m_lofSw(_lof_sw), m_lofLo(_lof_lo),
689 m_lofHi(_lof_hi), m_polInv(_pol_inv) {}
690
691 public:
692 QString m_name;
698};
699
700static const std::array<const lnb_preset,7> lnb_presets
701{
702
703 /* description, type, LOF switch, LOF low, LOF high, inverted polarity */
704 lnb_preset(QT_TRANSLATE_NOOP("DeviceTree", "Universal (Europe)"),
706 11700000, 9750000, 10600000),
707 lnb_preset(QT_TRANSLATE_NOOP("DeviceTree", "Single (Europe)"),
709 lnb_preset(QT_TRANSLATE_NOOP("DeviceTree", "Circular (N. America)"),
711 lnb_preset(QT_TRANSLATE_NOOP("DeviceTree", "Linear (N. America)"),
713 lnb_preset(QT_TRANSLATE_NOOP("DeviceTree", "C Band"),
715 lnb_preset(QT_TRANSLATE_NOOP("DeviceTree", "DishPro Bandstacked"),
716 DiSEqCDevLNB::kTypeBandstacked, 0, 11250000, 14350000),
718};
719
720static uint FindPreset(const DiSEqCDevLNB &lnb)
721{
722 uint i = 0;
723 for ( ; !lnb_presets[i].m_name.isEmpty(); i++)
724 {
725 if (lnb_presets[i].m_type == lnb.GetType() &&
726 lnb_presets[i].m_lofSw == lnb.GetLOFSwitch() &&
727 lnb_presets[i].m_lofLo == lnb.GetLOFLow() &&
728 lnb_presets[i].m_lofHi == lnb.GetLOFHigh() &&
729 lnb_presets[i].m_polInv== lnb.IsPolarityInverted())
730 {
731 break;
732 }
733 }
734 return i;
735}
736
738{
739 public:
740 explicit LNBPresetSetting(DiSEqCDevLNB &lnb) : m_lnb(lnb)
741 {
742 setLabel(DeviceTree::tr("LNB Preset"));
743 QString help = DeviceTree::tr(
744 "Select the LNB preset from the list, or choose "
745 "'Custom' and set the advanced settings below.");
747
748 uint i = 0;
749 for (; !lnb_presets[i].m_name.isEmpty(); i++)
750 addSelection(DeviceTree::tr( lnb_presets[i].m_name.toUtf8().constData() ),
751 QString::number(i));
752 addSelection(DeviceTree::tr("Custom"), QString::number(i));
753 }
754
755 void Load(void) override // StandardSetting
756 {
758 setChanged(false);
759 }
760
761 void Save(void) override // StandardSetting
762 {
763 }
764
765 private:
767};
768
770
772{
773 public:
774 explicit LNBTypeSetting(DiSEqCDevLNB &lnb) : m_lnb(lnb)
775 {
776 setLabel(DeviceTree::tr("LNB Type"));
777 setHelpText(DeviceTree::tr("Select the type of LNB from the list."));
778 addSelection(DeviceTree::tr("Legacy (Fixed)"),
779 QString::number((uint) DiSEqCDevLNB::kTypeFixed));
780 addSelection(DeviceTree::tr("Standard (Voltage)"),
781 QString::number((uint) DiSEqCDevLNB::
782 kTypeVoltageControl));
783 addSelection(DeviceTree::tr("Universal (Voltage & Tone)"),
784 QString::number((uint) DiSEqCDevLNB::
785 kTypeVoltageAndToneControl));
786 addSelection(DeviceTree::tr("Bandstacked"),
787 QString::number((uint) DiSEqCDevLNB::kTypeBandstacked));
788 }
789
790 void Load(void) override // StandardSetting
791 {
792 setValue(getValueIndex(QString::number((uint) m_lnb.GetType())));
793 setChanged(false);
794 }
795
796 void Save(void) override // StandardSetting
797 {
799 }
800
801 private:
803};
804
806
808{
809 public:
811 {
812 setLabel(DeviceTree::tr("LNB LOF Switch (MHz)"));
813 QString help = DeviceTree::tr(
814 "This defines at what frequency the LNB will do a "
815 "switch from high to low setting, and vice versa.");
817 }
818
819 void Load(void) override // StandardSetting
820 {
821 setValue(QString::number(m_lnb.GetLOFSwitch() / 1000));
822 setChanged(false);
823 }
824
825 void Save(void) override // StandardSetting
826 {
827 m_lnb.SetLOFSwitch(getValue().toUInt() * 1000);
828 }
829
830 private:
832};
833
835
837{
838 public:
839 explicit LNBLOFLowSetting(DiSEqCDevLNB &lnb) : m_lnb(lnb)
840 {
841 setLabel(DeviceTree::tr("LNB LOF Low (MHz)"));
842 QString help = DeviceTree::tr(
843 "This defines the offset the frequency coming "
844 "from the LNB will be in low setting. For bandstacked "
845 "LNBs this is the vertical/right polarization band.");
847 }
848
849 void Load(void) override // StandardSetting
850 {
851 setValue(QString::number(m_lnb.GetLOFLow() / 1000));
852 setChanged(false);
853 }
854
855 void Save(void) override // StandardSetting
856 {
857 m_lnb.SetLOFLow(getValue().toUInt() * 1000);
858 }
859
860 private:
862};
863
865
867{
868 public:
870 {
871 setLabel(DeviceTree::tr("LNB LOF High (MHz)"));
872 QString help = DeviceTree::tr(
873 "This defines the offset the frequency coming from "
874 "the LNB will be in high setting. For bandstacked "
875 "LNBs this is the horizontal/left polarization band.");
877 }
878
879 void Load(void) override // StandardSetting
880 {
881 setValue(QString::number(m_lnb.GetLOFHigh() / 1000));
882 setChanged(false);
883 }
884
885 void Save(void) override // StandardSetting
886 {
887 m_lnb.SetLOFHigh(getValue().toUInt() * 1000);
888 }
889
890 private:
892};
893
895{
896 public:
898 m_lnb(lnb)
899 {
900 setLabel(DeviceTree::tr("LNB Reversed"));
901 QString help = DeviceTree::tr(
902 "This defines whether the signal reaching the LNB "
903 "is reversed from normal polarization. This happens "
904 "to circular signals bouncing twice on a toroidal "
905 "dish.");
907 }
908
909 void Load(void) override // StandardSetting
910 {
912 setChanged(false);
913 }
914
915 void Save(void) override // StandardSetting
916 {
918 }
919
920 private:
922};
923
925
927 : m_preset(new LNBPresetSetting(lnb)),
928 m_type(new LNBTypeSetting(lnb)),
929 m_lofSwitch(new LNBLOFSwitchSetting(lnb)),
930 m_lofLo(new LNBLOFLowSetting(lnb)),
931 m_lofHi(new LNBLOFHighSetting(lnb)),
932 m_polInv(new LNBPolarityInvertedSetting(lnb))
933{
934 setLabel(DeviceTree::tr("LNB Configuration"));
936
937 parent = this;
938 auto *deviceDescr = new DeviceDescrSetting(lnb);
939 parent->addChild(deviceDescr);
940 parent->addChild(m_preset);
941 parent->addChild(m_type);
942 parent->addChild(m_lofSwitch);
943 parent->addChild(m_lofLo);
944 parent->addChild(m_lofHi);
945 parent->addChild(m_polInv);
946 connect(m_type, qOverload<const QString&>(&StandardSetting::valueChanged),
947 this, qOverload<const QString&>(&LNBConfig::UpdateType));
948 connect(m_preset, qOverload<const QString&>(&StandardSetting::valueChanged),
949 this, &LNBConfig::SetPreset);
950 connect(deviceDescr, qOverload<const QString&>(&StandardSetting::valueChanged),
951 this, qOverload<const QString&>(&StandardSetting::setValue));
952}
953
955{
958}
959
960void LNBConfig::SetPreset(const QString &value)
961{
962 uint index = value.toUInt();
963 if (index >= (sizeof(lnb_presets) / sizeof(lnb_preset)))
964 return;
965
966 const lnb_preset &preset = lnb_presets[index];
967 if (preset.m_name.isEmpty())
968 {
969 m_type->setEnabled(true);
970 UpdateType();
971 }
972 else
973 {
975 QString::number((uint)preset.m_type)));
976 m_lofSwitch->setValue(QString::number(preset.m_lofSw / 1000));
977 m_lofLo->setValue(QString::number(preset.m_lofLo / 1000));
978 m_lofHi->setValue(QString::number(preset.m_lofHi / 1000));
979 m_polInv->setValue(preset.m_polInv);
980 m_type->setEnabled(false);
981 m_lofSwitch->setEnabled(false);
982 m_lofHi->setEnabled(false);
983 m_lofLo->setEnabled(false);
984 m_polInv->setEnabled(false);
985 }
986}
987
989{
990 if (!m_type->isEnabled())
991 return;
992
993 switch ((DiSEqCDevLNB::dvbdev_lnb_t) m_type->getValue().toUInt())
994 {
997 m_lofSwitch->setEnabled(false);
998 m_lofHi->setEnabled(false);
999 m_lofLo->setEnabled(true);
1000 m_polInv->setEnabled(true);
1001 break;
1003 m_lofSwitch->setEnabled(true);
1004 m_lofHi->setEnabled(true);
1005 m_lofLo->setEnabled(true);
1006 m_polInv->setEnabled(true);
1007 break;
1009 m_lofSwitch->setEnabled(false);
1010 m_lofHi->setEnabled(true);
1011 m_lofLo->setEnabled(true);
1012 m_polInv->setEnabled(true);
1013 break;
1014 }
1015}
1016
1017void LNBConfig::UpdateType(const QString &/*value*/)
1018{
1019 UpdateType();
1020}
1022
1024{
1025 PopulateTree();
1027}
1028
1030{
1031 DiSEqCDevDevice *dev = devtype->GetDevice();
1032 if (dev)
1033 {
1034 DiSEqCDevDevice *parent = dev->GetParent();
1035 if (parent)
1036 parent->SetChild(dev->GetOrdinal(), nullptr);
1037 else
1038 m_tree.SetRoot(nullptr);
1039 }
1040
1041 devtype->DeleteDevice();
1042}
1043
1045{
1046 clearSettings();
1048}
1049
1051 StandardSetting *parent)
1052{
1053 DiseqcConfigBase *setting = nullptr;
1054 switch (dev->GetDeviceType())
1055 {
1057 {
1058 auto *sw = dynamic_cast<DiSEqCDevSwitch*>(dev);
1059 if (sw)
1060 setting = new SwitchConfig(*sw, parent);
1061 }
1062 break;
1063
1065 {
1066 auto *rotor = dynamic_cast<DiSEqCDevRotor*>(dev);
1067 if (rotor)
1068 setting = new RotorConfig(*rotor, parent);
1069 }
1070 break;
1071
1073 {
1074 auto *scr = dynamic_cast<DiSEqCDevSCR*>(dev);
1075 if (scr)
1076 setting = new SCRConfig(*scr, parent);
1077 }
1078 break;
1079
1081 {
1082 auto *lnb = dynamic_cast<DiSEqCDevLNB*>(dev);
1083 if (lnb)
1084 setting = new LNBConfig(*lnb, parent);
1085 }
1086 break;
1087
1088 default:
1089 break;
1090 }
1091
1092 return setting;
1093}
1094
1096 DiSEqCDevDevice *parent,
1097 uint childnum,
1098 GroupSetting *parentSetting)
1099{
1100 if (node)
1101 {
1102 auto *devtype = new DeviceTypeSetting();
1103 devtype->SetDevice(node);
1104 devtype->Load();
1106 devtype);
1107
1108 if (setting)
1109 {
1110 setting->Load();
1111 devtype->addChild(setting);
1112 PopulateChildren(node, setting);
1113
1114 AddDeviceTypeSetting(devtype, parent, childnum, parentSetting);
1115 }
1116 else
1117 {
1118 delete devtype;
1119 }
1120 }
1121 else
1122 {
1123 auto *devtype = new DeviceTypeSetting();
1124 AddDeviceTypeSetting(devtype, parent, childnum, parentSetting);
1125 }
1126}
1127
1129 DiSEqCDevDevice *parent,
1130 uint childnum,
1131 GroupSetting *parentSetting)
1132{
1133 if (parentSetting)
1134 parentSetting->addChild(devtype);
1135 else // Root node
1136 addChild(devtype);
1137
1138 ConnectToValueChanged(devtype, parent, childnum);
1139}
1140
1142 DiSEqCDevDevice *parent,
1143 uint childnum)
1144{
1145 auto slot = [devtype, parent, childnum, this](const QString &value)
1146 {
1147 ValueChanged(value, devtype, parent, childnum);
1148 };
1149
1150 connect(devtype,
1151 qOverload<const QString&>(&StandardSetting::valueChanged),
1152 this,
1153 slot);
1154}
1155
1157 GroupSetting *parentSetting)
1158{
1159 uint num_ch = node->GetChildCount();
1160 for (uint ch = 0; ch < num_ch; ch++)
1161 {
1162 PopulateTree(node->GetChild(ch), node, ch, parentSetting);
1163 }
1164}
1165
1166void DeviceTree::ValueChanged(const QString &value,
1167 DeviceTypeSetting *devtype,
1168 DiSEqCDevDevice *parent,
1169 uint childnum)
1170{
1171 // Remove old setting from m_tree
1172 DeleteDevice(devtype);
1173
1174 const auto type = static_cast<DiSEqCDevDevice::dvbdev_t>(value.toUInt());
1175
1177 if (dev)
1178 {
1179 if (!parent)
1180 {
1181 m_tree.SetRoot(dev);
1182 PopulateTree();
1183 }
1184 else if (parent->SetChild(childnum, dev))
1185 {
1186 DiseqcConfigBase *newConfig =
1187 DiseqcConfigBase::CreateByType(dev, devtype);
1188 newConfig->Load();
1189
1190 PopulateChildren(dev, newConfig);
1191
1192 devtype->addChild(newConfig);
1193 devtype->SetDevice(dev);
1194 }
1195 else
1196 {
1197 delete dev;
1198 }
1199 }
1200
1201 emit settingsChanged(this);
1202}
1203
1205
1207{
1208 public:
1210 : m_node(node), m_settings(settings)
1211 {
1212 setLabel(node.GetDescription());
1213 setHelpText(DeviceTree::tr("Choose a port to use for this switch."));
1214
1215 uint num_children = node.GetChildCount();
1216 for (uint ch = 0; ch < num_children; ch++)
1217 {
1218 QString val = QString("%1").arg(ch);
1219 QString descr = DeviceTree::tr("Port %1").arg(ch+1);
1220 DiSEqCDevDevice *child = node.GetChild(ch);
1221 if (child)
1222 descr += QString(" (%2)").arg(child->GetDescription());
1223 addSelection(descr, val);
1224 }
1225 }
1226
1227 void Load(void) override // StandardSetting
1228 {
1229 double value = m_settings.GetValue(m_node.GetDeviceID());
1230 setValue((uint)value);
1231 setChanged(false);
1232 }
1233
1234 void Save(void) override // StandardSetting
1235 {
1237 }
1238
1239 private:
1242};
1243
1245
1247{
1248 public:
1250 : m_node(node), m_settings(settings)
1251 {
1252 setLabel(node.GetDescription());
1253 setHelpText(DeviceTree::tr("Choose a satellite position."));
1254
1255 auto *rotor = dynamic_cast<DiSEqCDevRotor*>(&m_node);
1256 if (rotor)
1257 m_posmap = rotor->GetPosMap();
1258 }
1259
1260 void Load(void) override // StandardSetting
1261 {
1263
1264 for (double d : std::as_const(m_posmap))
1265 addSelection(AngleToString(d), QString::number(d));
1266
1267 double angle = m_settings.GetValue(m_node.GetDeviceID());
1268 setValue(getValueIndex(QString::number(angle)));
1269 setChanged(false);
1270 }
1271
1272 void Save(void) override // StandardSetting
1273 {
1275 }
1276
1277 private:
1281};
1282
1284
1286{
1287 public:
1291 m_node(node), m_settings(settings)
1292 {
1293 QString help =
1294 DeviceTree::tr(
1295 "Locates the satellite you wish to point to "
1296 "with the longitude along the Clarke Belt of "
1297 "the satellite [-180..180] and its hemisphere.");
1298
1299 m_numeric->setLabel(DeviceTree::tr("Longitude (degrees)"));
1301 m_hemisphere->setLabel(DeviceTree::tr("Hemisphere"));
1302 m_hemisphere->addSelection(DeviceTree::tr("Eastern"), "E", false);
1303 m_hemisphere->addSelection(DeviceTree::tr("Western"), "W", true);
1305
1308
1309 addChild(new RotorConfig(dynamic_cast<DiSEqCDevRotor&>(m_node), this));
1310 }
1311
1312 void Load(void) override // StandardSetting
1313 {
1314 double val = m_settings.GetValue(m_node.GetDeviceID());
1315 QString hemi;
1316 double eval = AngleToEdit(val, hemi);
1317 m_numeric->setValue(QString::number(eval));
1320 }
1321
1322 void Save(void) override // StandardSetting
1323 {
1324 QString val = QString::number(m_numeric->getValue().toDouble());
1325 val += m_hemisphere->getValue();
1327 }
1328
1329 private:
1334};
1335
1337
1339{
1340 public:
1342 : m_node(node), m_settings(settings)
1343 {
1344 setLabel("Position");
1345 setHelpText(DeviceTree::tr("Unicable satellite position (A/B)"));
1347 QString::number((uint)DiSEqCDevSCR::kTypeScrPosA), true);
1349 QString::number((uint)DiSEqCDevSCR::kTypeScrPosB), false);
1350 }
1351
1352 void Load(void) override // StandardSetting
1353 {
1354 double value = m_settings.GetValue(m_node.GetDeviceID());
1355 setValue(getValueIndex(QString::number((uint)value)));
1356 setChanged(false);
1357 }
1358
1359 void Save(void) override // StandardSetting
1360 {
1362 }
1363
1364 private:
1367};
1368
1370
1372 DiSEqCDevSettings &settings, uint cardid, bool switches_enabled) :
1373 m_settings(settings), m_switchesEnabled(switches_enabled)
1374{
1375 setLabel(DeviceTree::tr("DTV Device Configuration"));
1376
1377 // load
1378 m_tree.Load(cardid);
1379
1380 // initial UI setup
1381 AddNodes(this, QString(), m_tree.Root());
1382}
1383
1385 StandardSetting *group, const QString &trigger, DiSEqCDevDevice *node)
1386{
1387 if (!node)
1388 return;
1389
1390 StandardSetting *setting = nullptr;
1391 switch (node->GetDeviceType())
1392 {
1394 setting = new SwitchSetting(*node, m_settings);
1395 setting->setEnabled(m_switchesEnabled);
1396 break;
1398 {
1399 auto *rotor = dynamic_cast<DiSEqCDevRotor*>(node);
1400 if (rotor && (rotor->GetType() == DiSEqCDevRotor::kTypeDiSEqC_1_2))
1401 setting = new RotorSetting(*node, m_settings);
1402 else
1403 setting = new USALSRotorSetting(*node, m_settings);
1404 break;
1405 }
1407 {
1408 setting = new SCRPositionSetting(*node, m_settings);
1409 break;
1410 }
1411 default:
1412 break;
1413 }
1414
1415 if (!setting)
1416 return;
1417
1418 m_devs[node->GetDeviceID()] = setting;
1419
1420 uint num_ch = node->GetChildCount();
1422 {
1423 for (uint i = 0; i < num_ch; i++)
1424 AddNodes(setting, QString::number(i), node->GetChild(i));
1425
1426 AddChild(group, trigger, setting);
1427 return;
1428 }
1429
1430 if (!num_ch)
1431 {
1432 AddChild(group, trigger, setting);
1433 return;
1434 }
1435
1436 AddChild(group, trigger, setting);
1437 for (uint i = 0; i < num_ch; i++)
1438 AddNodes(group, trigger, node->GetChild(i));
1439}
1440
1442 StandardSetting *group, const QString &trigger, StandardSetting *setting)
1443{
1444 if (!trigger.isEmpty())
1445 group->addTargetedChild(trigger, setting);
1446 else
1447 group->addChild(setting);
1448}
1449
1450#include "moc_diseqcsettings.cpp"
DiSEqCDevTree m_tree
devid_to_setting_t m_devs
DTVDeviceConfigGroup(DiSEqCDevSettings &settings, uint cardid, bool switches_enabled)
static void AddChild(StandardSetting *group, const QString &trigger, StandardSetting *setting)
void AddNodes(StandardSetting *group, const QString &trigger, DiSEqCDevDevice *node)
DiSEqCDevSettings & m_settings
void Save(void) override
DiSEqCDevDevice & m_device
void Load(void) override
DeviceDescrSetting(DiSEqCDevDevice &device)
void Load(void) override
DiSEqCDevDevice & m_device
void Save(void) override
DeviceRepeatSetting(DiSEqCDevDevice &device)
DiSEqCDevTree & m_tree
void ValueChanged(const QString &value, DeviceTypeSetting *devtype, DiSEqCDevDevice *parent, uint childnum)
void DeleteDevice(DeviceTypeSetting *devtype)
void Load(void) override
void AddDeviceTypeSetting(DeviceTypeSetting *devtype, DiSEqCDevDevice *parent, uint childnum, GroupSetting *parentSetting)
void PopulateTree(void)
void PopulateChildren(DiSEqCDevDevice *node, GroupSetting *parentSetting)
void ConnectToValueChanged(DeviceTypeSetting *devtype, DiSEqCDevDevice *parent, uint childnum)
void Load(void) override
void SetDevice(DiSEqCDevDevice *dev)
DiSEqCDevDevice * m_device
DiSEqCDevDevice * GetDevice()
Represents a node in a DVB-S device network.
Definition: diseqc.h:140
uint GetDeviceID(void) const
Definition: diseqc.h:170
void SetRepeatCount(uint repeat)
Definition: diseqc.h:164
virtual uint GetChildCount(void) const
Retrieves the proper number of children for this node.
Definition: diseqc.h:177
virtual DiSEqCDevDevice * GetChild(uint)
Retrieves the nth child of this node.
Definition: diseqc.h:188
uint GetOrdinal(void) const
Definition: diseqc.h:174
QString GetDescription(void) const
Definition: diseqc.h:175
void SetDescription(const QString &desc)
Definition: diseqc.h:163
uint GetRepeatCount(void) const
Definition: diseqc.h:176
static DiSEqCDevDevice * CreateByType(DiSEqCDevTree &tree, dvbdev_t type, uint dev_id=0)
Definition: diseqc.cpp:942
virtual bool SetChild(uint, DiSEqCDevDevice *)
Changes the nth child of this node.
Definition: diseqc.h:165
dvbdev_t GetDeviceType(void) const
Definition: diseqc.h:169
DiSEqCDevDevice * GetParent(void) const
Definition: diseqc.h:173
LNB Class.
Definition: diseqc.h:447
dvbdev_lnb_t GetType(void) const
Definition: diseqc.h:472
bool IsPolarityInverted(void) const
Definition: diseqc.h:476
uint GetLOFHigh(void) const
Definition: diseqc.h:474
uint GetLOFSwitch(void) const
Definition: diseqc.h:473
void SetLOFLow(uint lof_lo)
Definition: diseqc.h:468
void SetType(dvbdev_lnb_t type)
Definition: diseqc.h:465
void SetPolarityInverted(bool inv)
Definition: diseqc.h:469
@ kTypeFixed
Definition: diseqc.h:460
@ kTypeVoltageAndToneControl
Definition: diseqc.h:462
@ kTypeBandstacked
Definition: diseqc.h:463
@ kTypeVoltageControl
Definition: diseqc.h:461
uint GetLOFLow(void) const
Definition: diseqc.h:475
void SetLOFSwitch(uint lof_switch)
Definition: diseqc.h:466
void SetLOFHigh(uint lof_hi)
Definition: diseqc.h:467
Rotor class.
Definition: diseqc.h:303
double GetLoSpeed(void) const
Definition: diseqc.h:326
double GetHiSpeed(void) const
Definition: diseqc.h:327
@ kTypeDiSEqC_1_3
Definition: diseqc.h:316
@ kTypeDiSEqC_1_2
Definition: diseqc.h:316
void SetHiSpeed(double speed)
Definition: diseqc.h:319
uint_to_dbl_t GetPosMap(void) const
Definition: diseqc.cpp:1985
void SetType(dvbdev_rotor_t type)
Definition: diseqc.h:317
void SetPosMap(const uint_to_dbl_t &posmap)
Definition: diseqc.cpp:1995
dvbdev_rotor_t GetType(void) const
Definition: diseqc.h:325
void SetLoSpeed(double speed)
Definition: diseqc.h:318
Unicable / SCR Class.
Definition: diseqc.h:383
int GetPIN(void) const
Definition: diseqc.h:410
uint GetFrequency(void) const
Definition: diseqc.h:409
void SetPIN(int pin)
Definition: diseqc.h:404
static QString SCRPositionToString(dvbdev_pos_t pos)
Definition: diseqc.h:427
void SetFrequency(uint freq)
Definition: diseqc.h:403
@ kTypeScrPosB
Definition: diseqc.h:400
@ kTypeScrPosA
Definition: diseqc.h:399
uint GetUserBand(void) const
Definition: diseqc.h:408
void SetUserBand(uint userband)
Definition: diseqc.h:402
DVB-S device settings class.
Definition: diseqc.h:37
double GetValue(uint devid) const
Retrieves a value from this configuration chain by device id.
Definition: diseqc.cpp:207
void SetValue(uint devid, double value)
Sets a value for this configuration chain by device id.
Definition: diseqc.cpp:222
Switch class, including tone, legacy and DiSEqC switches.
Definition: diseqc.h:224
void SetAddress(uint address)
Definition: diseqc.h:249
void SetType(dvbdev_switch_t type)
Definition: diseqc.h:248
dvbdev_switch_t GetType(void) const
Definition: diseqc.h:254
uint GetAddress(void) const
Definition: diseqc.h:255
@ kTypeDiSEqCUncommitted
Definition: diseqc.h:241
@ kTypeDiSEqCCommitted
Definition: diseqc.h:240
void SetNumPorts(uint num_ports)
Definition: diseqc.cpp:1346
uint GetNumPorts(void) const
Definition: diseqc.h:256
bool Load(const QString &device)
Loads the device tree from the database.
Definition: diseqc.cpp:314
void SetRoot(DiSEqCDevDevice *root)
Changes the root node of the tree.
Definition: diseqc.cpp:638
DiSEqCDevDevice * Root(void)
Retrieves the root node in the tree.
Definition: diseqc.h:93
static DiseqcConfigBase * CreateByType(DiSEqCDevDevice *dev, StandardSetting *parent)
void DeleteClicked(void)
bool keyPressEvent(QKeyEvent *event) override
void UpdateType(void)
void SetPreset(const QString &value)
LNBPolarityInvertedSetting * m_polInv
LNBPresetSetting * m_preset
LNBTypeSetting * m_type
void Load(void) override
LNBLOFSwitchSetting * m_lofSwitch
LNBConfig(DiSEqCDevLNB &lnb, StandardSetting *parent)
LNBLOFLowSetting * m_lofLo
LNBLOFHighSetting * m_lofHi
DiSEqCDevLNB & m_lnb
LNBLOFHighSetting(DiSEqCDevLNB &lnb)
void Load(void) override
void Save(void) override
void Save(void) override
LNBLOFLowSetting(DiSEqCDevLNB &lnb)
DiSEqCDevLNB & m_lnb
void Load(void) override
void Load(void) override
DiSEqCDevLNB & m_lnb
LNBLOFSwitchSetting(DiSEqCDevLNB &lnb)
void Save(void) override
LNBPolarityInvertedSetting(DiSEqCDevLNB &lnb)
void Save(void) override
void Load(void) override
LNBPresetSetting(DiSEqCDevLNB &lnb)
void Save(void) override
DiSEqCDevLNB & m_lnb
void Load(void) override
void Load(void) override
LNBTypeSetting(DiSEqCDevLNB &lnb)
DiSEqCDevLNB & m_lnb
void Save(void) override
void setValue(const QString &newValue) override
virtual void addSelection(const QString &label, QString value=QString(), bool select=false)
void setValue(int value) override
int getValueIndex(const QString &value) const
void updateButton(MythUIButtonListItem *item) override
This method is called whenever the UI need to reflect a change Reimplement this If you widget need a ...
RotorPosMap * m_pos
void Load() override
RotorConfig(DiSEqCDevRotor &rotor, StandardSetting *parent)
void SetType(const QString &type)
DiSEqCDevRotor & m_rotor
RotorHiSpeedSetting(DiSEqCDevRotor &rotor)
void Save(void) override
void Load(void) override
DiSEqCDevRotor & m_rotor
void Save(void) override
void Load(void) override
DiSEqCDevRotor & m_rotor
RotorLoSpeedSetting(DiSEqCDevRotor &rotor)
void PopulateList(void)
void Save(void) override
void newValue(StandardSetting *setting)
void Load(void) override
DiSEqCDevRotor & m_rotor
uint_to_dbl_t m_posmap
RotorPosTextEdit(const QString &label, uint id, const QString &value)
void updateButton(MythUIButtonListItem *item) override
This method is called whenever the UI need to reflect a change Reimplement this If you widget need a ...
uint_to_dbl_t m_posmap
DiSEqCDevDevice & m_node
DiSEqCDevSettings & m_settings
RotorSetting(DiSEqCDevDevice &node, DiSEqCDevSettings &settings)
void Load(void) override
void Save(void) override
void Load(void) override
DiSEqCDevRotor & m_rotor
void Save(void) override
RotorTypeSetting(DiSEqCDevRotor &rotor)
SCRConfig(DiSEqCDevSCR &scr, StandardSetting *parent)
void Save(void) override
DiSEqCDevSCR & m_scr
SCRFrequencySetting(DiSEqCDevSCR &scr)
void Load(void) override
void Load(void) override
void Save(void) override
SCRPINSetting(DiSEqCDevSCR &scr)
DiSEqCDevSCR & m_scr
DiSEqCDevSettings & m_settings
DiSEqCDevDevice & m_node
SCRPositionSetting(DiSEqCDevDevice &node, DiSEqCDevSettings &settings)
void Save(void) override
void Load(void) override
void Save(void) override
void Load(void) override
SCRUserBandSetting(DiSEqCDevSCR &scr)
DiSEqCDevSCR & m_scr
virtual void addChild(StandardSetting *child)
virtual void Load(void)
bool isEnabled() const
void addTargetedChild(const QString &value, StandardSetting *setting)
virtual void clearSettings()
void settingsChanged(StandardSetting *selectedSetting=nullptr)
virtual void setHelpText(const QString &str)
virtual void setValue(const QString &newValue)
void valueChanged(const QString &newValue)
virtual QString getValue(void) const
virtual void setEnabled(bool enabled)
virtual void setLabel(QString str)
void setChanged(bool changed)
SwitchAddressSetting(DiSEqCDevSwitch &switch_dev)
DiSEqCDevSwitch & m_switch
void Load(void) override
void Save(void) override
DeviceDescrSetting * m_deviceDescr
SwitchConfig(DiSEqCDevSwitch &switch_dev, StandardSetting *parent)
SwitchAddressSetting * m_address
void Load(void) override
void update(void)
SwitchPortsSetting * m_ports
SwitchTypeSetting * m_type
SwitchPortsSetting(DiSEqCDevSwitch &switch_dev)
void Save(void) override
DiSEqCDevSwitch & m_switch
void Load(void) override
SwitchSetting(DiSEqCDevDevice &node, DiSEqCDevSettings &settings)
DiSEqCDevDevice & m_node
void Save(void) override
void Load(void) override
DiSEqCDevSettings & m_settings
void Load(void) override
void Save(void) override
SwitchTypeSetting(DiSEqCDevSwitch &switch_dev)
DiSEqCDevSwitch & m_switch
DiSEqCDevDevice & m_node
void Save(void) override
TransTextEditSetting * m_numeric
void Load(void) override
USALSRotorSetting(DiSEqCDevDevice &node, DiSEqCDevSettings &settings)
DiSEqCDevSettings & m_settings
TransMythUIComboBoxSetting * m_hemisphere
lnb_preset(QString _name, DiSEqCDevLNB::dvbdev_lnb_t _type, uint _lof_sw=0, uint _lof_lo=0, uint _lof_hi=0, bool _pol_inv=false)
DiSEqCDevLNB::dvbdev_lnb_t m_type
unsigned int uint
Definition: compat.h:60
QMap< uint, double > uint_to_dbl_t
Definition: diseqc.h:30
static const std::array< const lnb_preset, 7 > lnb_presets
static QString AngleToString(double angle)
static uint FindPreset(const DiSEqCDevLNB &lnb)
static double AngleToEdit(double angle, QString &hemi)
static double AngleToFloat(const QString &angle, bool translated=true)
static GlobalTextEditSetting * DiSEqCLongitude(void)
static GlobalTextEditSetting * DiSEqCLatitude(void)
static const iso6937table * d
MythMainWindow * GetMythMainWindow(void)