1 #include <wizard_scan.h>
2 #include <rotorconfig.h>
3 #include <lib/dvb/frontend.h>
4 #include <lib/gdi/font.h>
5 #include <lib/gui/listbox.h>
6 #include <lib/system/init_num.h>
7 #include <lib/system/info.h>
8 #include <lib/system/econfig.h>
11 #include <enigma_scan.h>
12 #include <enigma_main.h>
14 class eDiseqcChoice
: public eListBoxEntry
16 friend class eListBox
<eDiseqcChoice
>;
24 enum { none
, simple
, complex };
25 eDiseqcChoice(eListBox
<eDiseqcChoice
>* lb
, int choice
)
26 : eListBoxEntry( (eListBox
<eListBoxEntry
>*)lb
), choice(choice
)
28 pixmap
=eSkin::getActive()->queryImage(eString().sprintf("diseqc_%d", choice
));
30 font
= eSkin::getActive()->queryFont("eListBox.EntryText.normal");
39 int getDiseqcChoice() const
44 static int getEntryHeight()
49 const eString
& redraw(gPainter
*rc
, const eRect
& rect
, gColor coActiveB
, gColor coActiveF
, gColor coNormalB
, gColor coNormalF
, int state
)
51 drawEntryRect( rc
, rect
, coActiveB
, coActiveF
, coNormalB
, coNormalF
, state
);
55 para
= new eTextPara( eRect( rect
.left(), 0, rect
.width(), rect
.height() ) );
57 para
->renderString(text
);
58 para
->realign(eTextPara::dirCenter
);
59 yOffs
= ((rect
.height() - para
->getBoundBox().height()) / 2) - para
->getBoundBox().top();
61 rc
->renderPara(*para
, ePoint(0, rect
.top() + yOffs
) );
63 rc
->blit(*pixmap
, ePoint(rect
.left()+15, rect
.top()+15));
69 gFont
eDiseqcChoice::font
;
71 eWizardSelectDiseqc::eWizardSelectDiseqc()
73 diseqclist
=new eListBox
<eDiseqcChoice
>(this);
74 diseqclist
->setName("choices");
75 diseqclist
->setColumns(3);
77 description
=new eLabel(this);
78 description
->setName("description");
80 if (eSkin::getActive()->build(this, "eWizardDiseqc"))
81 eFatal("skin load of \"eWizardDiseqc\" failed");
83 eDiseqcChoice
*current
;
84 current
=new eDiseqcChoice(diseqclist
, eDiseqcChoice::none
);
85 new eDiseqcChoice(diseqclist
, eDiseqcChoice::simple
);
86 new eDiseqcChoice(diseqclist
, eDiseqcChoice::complex);
87 CONNECT(diseqclist
->selchanged
, eWizardSelectDiseqc::selchanged
);
88 CONNECT(diseqclist
->selected
, eWizardSelectDiseqc::selected
);
92 int eWizardSelectDiseqc::run()
94 eWizardSelectDiseqc
*wizard
=new eWizardSelectDiseqc();
96 int res
=wizard
->exec();
101 void eWizardSelectDiseqc::selected(eDiseqcChoice
*choice
)
106 close(choice
->getDiseqcChoice());
109 void eWizardSelectDiseqc::selchanged(eDiseqcChoice
*choice
)
113 switch(choice
->getDiseqcChoice())
116 description
->setText(_("Direct connection to one LNB"));
119 description
->setText(_("Simple DiSEqC (2 LNBs/satellites)"));
122 description
->setText(_("Complex configuration (including DiSEqC 1.2)"));
127 class eWizardScanInit
132 if ( eApp
->isAppQuitNowSet() )
136 eConfig::getInstance()->getKey("/elitedvb/wizards/diseqc", diseqc
);
139 if ( eSystemInfo::getInstance()->getFEType() == eSystemInfo::feSatellite
)
141 // gotos considered harmless.. :)
143 res
=eWizardSelectDiseqc::run();
147 eSatelliteConfigurationManager satconfig
;
152 satconfig
.extSetComplexity(0); // single lnb
155 satconfig
.extSetComplexity(1); // diseqc 1.0
158 satconfig
.extSetComplexity(3); // diseqc 1.2
164 res
=satconfig
.exec();
171 eLNB
*l
=eZapScan::getRotorLNB(1);
182 TransponderScan
scan(0, 0, TransponderScan::stateMenu
);
190 else if ( eSystemInfo::getInstance()->getFEType() != eSystemInfo::feUnknown
)
192 TransponderScan
scan(0, 0, TransponderScan::stateMenu
);
196 eZapMain::getInstance()->showServiceSelector( eServiceSelector::dirFirst
, eZapMain::pathAll
);
198 eConfig::getInstance()->setKey("/elitedvb/wizards/diseqc", diseqc
);
202 eAutoInitP0
<eWizardScanInit
> init_eWizardScanInit(eAutoInitNumbers::wizard
+3, "wizard: scan");