1 #include <rotorconfig.h>
3 #include <lib/base/i18n.h>
4 #include <lib/system/init_num.h>
5 #include <lib/gui/eskin.h>
6 #include <lib/gui/ebutton.h>
7 #include <lib/gui/emessage.h>
8 #include <lib/gui/echeckbox.h>
9 #include <lib/gui/actions.h>
10 #include <lib/dvb/edvb.h>
11 #include <lib/dvb/dvbservice.h>
12 #include <lib/dvb/frontend.h>
13 #include <lib/dvb/dvbwidgets.h>
14 #include <lib/dvb/edvb.h>
15 #include <lib/system/info.h>
17 RotorConfig::RotorConfig(eLNB
*lnb
)
20 init_RotorConfig(lnb
);
23 void RotorConfig::init_RotorConfig(eLNB
*lnb
)
26 LCDTitle
=parent
->LCDTitle
;
27 LCDElement
=parent
->LCDElement
;
29 useRotorInPower
= new eCheckbox(this);
30 useRotorInPower
->setName("useRotorInPower");
32 lDeltaA
= new eLabel(this);
33 lDeltaA
->setName("lDeltaA");
35 DeltaA
= new eNumber( this, 1, 0, 200, 3, 0, 0, lDeltaA
);
36 DeltaA
->setName("DeltaA");
39 useGotoXX
= new eCheckbox(this);
40 useGotoXX
->setName("useGotoXX");
42 lLongitude
= new eLabel(this);
43 lLongitude
->setName("lLongitude");
46 Longitude
= new eNumber(this, 2, 0, 360, 3, 0, 0, lLongitude
);
47 Longitude
->setFlags( eNumber::flagFixedNum
);
48 Longitude
->setName("Longitude");
51 LoDirection
= new eComboBox( this, 2 );
52 LoDirection
->setName("LoDirection");
54 new eListBoxEntryText( *LoDirection
, _("East"), (void*)eDiSEqC::EAST
, 0, _("East") );
55 new eListBoxEntryText( *LoDirection
, _("West"), (void*)eDiSEqC::WEST
, 0, _("West") );
57 lLatitude
= new eLabel(this);
58 lLatitude
->setName("lLatitude");
61 Latitude
= new eNumber(this, 2, 0, 360, 3, 0, 0, lLatitude
);
62 Latitude
->setFlags( eNumber::flagFixedNum
);
63 Latitude
->setName("Latitude");
66 LaDirection
= new eComboBox( this, 2 );
67 LaDirection
->setName("LaDirection");
69 new eListBoxEntryText( *LaDirection
, _("North"), (void*)eDiSEqC::NORTH
, 0, _("North") );
70 new eListBoxEntryText( *LaDirection
, _("South"), (void*)eDiSEqC::SOUTH
, 0, _("South") );
72 positions
= new eListBox
< eListBoxEntryText
>( this );
73 positions
->setFlags( eListBoxBase::flagLostFocusOnFirst
|eListBoxBase::flagLostFocusOnLast
);
74 positions
->setName("positions");
77 lStoredRotorNo
= new eLabel(this);
78 lStoredRotorNo
->setName("lStoredRotorNo");
79 lStoredRotorNo
->hide();
80 number
= new eNumber( this, 1, 0, 255, 3, 0, 0, lStoredRotorNo
);
81 number
->setName("StoredRotorNo");
84 lOrbitalPosition
= new eLabel(this);
85 lOrbitalPosition
->setName("lOrbitalPosition");
86 lOrbitalPosition
->hide();
87 orbital_position
= new eNumber( this, 1, 0, 3600, 4, 0, 0, lOrbitalPosition
);
89 orbital_position
->setName("OrbitalPosition");
90 orbital_position
->hide();
92 lDirection
= new eLabel(this);
93 lDirection
->setName("lDirection");
95 direction
= new eComboBox( this, 2, lDirection
);
96 direction
->setName("Direction");
98 new eListBoxEntryText( *direction
, _("East"), (void*)0, 0, _("East") );
99 new eListBoxEntryText( *direction
, _("West"), (void*)1, 0, _("West") );
101 add
= new eButton( this );
105 remove
= new eButton ( this, 0, 0 );
106 remove
->setName("remove");
109 save
= new eButton(this);
110 save
->setName("save");
112 next
= new eButton(this);
113 next
->setName("next");
115 eSkin
*skin
=eSkin::getActive();
116 if (skin
->build(this, "RotorConfig"))
117 eFatal("skin load of \"RotorConfig\" failed");
119 orbital_position
->setHelpText(_("enter orbital position without dot (19.2\xC2\xB0 = 192)"));
120 CONNECT( orbital_position
->selected
, RotorConfig::numSelected
);
121 CONNECT( Longitude
->selected
, RotorConfig::numSelected
);
122 CONNECT( Latitude
->selected
, RotorConfig::numSelected
);
123 CONNECT( number
->selected
, RotorConfig::numSelected
);
124 CONNECT( DeltaA
->selected
, RotorConfig::numSelected
);
125 CONNECT( add
->selected
, RotorConfig::onAdd
);
126 CONNECT( remove
->selected
, RotorConfig::onRemove
);
127 CONNECT( positions
->selchanged
, RotorConfig::posChanged
);
128 CONNECT( useGotoXX
->checked
, RotorConfig::gotoXXChanged
);
129 CONNECT( useRotorInPower
->checked
, RotorConfig::useRotorInPowerChanged
);
131 CONNECT( save
->selected
, RotorConfig::onSavePressed
);
132 CONNECT( next
->selected
, RotorConfig::onNextPressed
);
134 addActionMap(&i_focusActions
->map
);
139 if ( !eSystemInfo::getInstance()->canMeasureLNBCurrent() )
141 eDebug("useRotorInputPower can only used on dreambox");
142 useRotorInPower
->hide();
148 std::map
<int,int,Orbital_Position_Compare
> &map
;
150 savePosition(std::map
<int,int,Orbital_Position_Compare
> &map
): map(map
)
154 bool operator()(eListBoxEntryText
& s
)
156 if ( (int)s
.getKey() == 0xFFFF )
157 return 0; // ignore sample Entry... delete me...
159 int num
= atoi( s
.getText().left( s
.getText().find('/') ).c_str() );
160 map
[ (int)s
.getKey() ] = num
;
165 void RotorConfig::onSavePressed()
167 lnb
->getDiSEqC().useGotoXX
= useGotoXX
->isChecked();
168 lnb
->getDiSEqC().useRotorInPower
= useRotorInPower
->isChecked()?1:0;
169 lnb
->getDiSEqC().useRotorInPower
|= DeltaA
->getNumber()<<8;
170 lnb
->getDiSEqC().gotoXXLaDirection
= (int) LaDirection
->getCurrent()->getKey();
171 lnb
->getDiSEqC().gotoXXLoDirection
= (int) LoDirection
->getCurrent()->getKey();
172 lnb
->getDiSEqC().gotoXXLatitude
= Latitude
->getFixedNum();
173 lnb
->getDiSEqC().gotoXXLongitude
= Longitude
->getFixedNum();
174 lnb
->getDiSEqC().RotorTable
.clear();
175 positions
->forEachEntry( savePosition( lnb
->getDiSEqC().RotorTable
) );
176 eTransponderList::getInstance()->writeLNBData();
177 eConfig::getInstance()->flush();
181 void RotorConfig::useRotorInPowerChanged( int state
)
183 eDebug("useRotorInPowerChanged to %d", state
);
196 void RotorConfig::gotoXXChanged( int state
)
198 eDebug("gotoXXChanged to %d", state
);
203 lOrbitalPosition
->hide();
204 orbital_position
->hide();
205 lStoredRotorNo
->hide();
229 lOrbitalPosition
->show();
230 orbital_position
->show();
231 lStoredRotorNo
->show();
239 void RotorConfig::setLNBData( eLNB
*lnb
)
241 positions
->beginAtomic();
242 positions
->clearList();
243 eDiSEqC
&DiSEqC
= lnb
->getDiSEqC();
247 for ( std::map
<int, int>::iterator
it ( DiSEqC
.RotorTable
.begin() ); it
!= DiSEqC
.RotorTable
.end(); it
++ )
248 new eListBoxEntryText( positions
, eString().sprintf(" %d / %d.%d%c", it
->second
, abs(it
->first
)/10, abs(it
->first
)%10, it
->first
> 0 ? 'E' : 'W'), (void*) it
->first
);
250 useGotoXX
->setCheck( (int) (lnb
->getDiSEqC().useGotoXX
& 1 ? 1 : 0) );
251 gotoXXChanged( (int) lnb
->getDiSEqC().useGotoXX
& 1 );
252 if ( eSystemInfo::getInstance()->canMeasureLNBCurrent() )
254 useRotorInPower
->setCheck( (int) lnb
->getDiSEqC().useRotorInPower
& 1 );
255 useRotorInPowerChanged( (int) lnb
->getDiSEqC().useRotorInPower
& 1 );
259 useRotorInPower
->setCheck( 0 );
260 useRotorInPowerChanged( 0 );
263 Latitude
->setFixedNum( lnb
->getDiSEqC().gotoXXLatitude
);
264 LaDirection
->setCurrent( (void*) lnb
->getDiSEqC().gotoXXLaDirection
);
265 Longitude
->setFixedNum( lnb
->getDiSEqC().gotoXXLongitude
);
266 LoDirection
->setCurrent( (void*) lnb
->getDiSEqC().gotoXXLoDirection
);
267 DeltaA
->setNumber( (lnb
->getDiSEqC().useRotorInPower
& 0x0000FF00) >> 8 );
271 Latitude
->setFixedNum(0);
272 LaDirection
->setCurrent(0);
273 Longitude
->setFixedNum(0);
274 LoDirection
->setCurrent(0);
275 DeltaA
->setNumber(40);
276 useGotoXX
->setCheck( 1 );
277 useRotorInPower
->setCheck( 0 );
280 if ( positions
->getCount() )
283 positions
->moveSelection(eListBox
<eListBoxEntryText
>::dirFirst
);
287 new eListBoxEntryText( positions
, _("delete me"), (void*) 0xFFFF );
291 positions
->endAtomic();
294 void RotorConfig::posChanged( eListBoxEntryText
*e
)
296 if ( e
&& (int)e
->getKey() != 0xFFFF )
298 direction
->setCurrent( e
->getText().right( 1 ) == "E" ? 0 : 1 );
299 orbital_position
->setNumber( (int) e
->getKey() );
300 number
->setNumber( atoi( e
->getText().mid( 1 , e
->getText().find('/')-1 ).c_str()) );
304 orbital_position
->setNumber( 0 );
305 number
->setNumber( 0 );
306 direction
->setCurrent( 0 );
310 void RotorConfig::numSelected(int*)
312 focusNext( eWidget::focusDirNext
);
315 void RotorConfig::onAdd()
317 positions
->beginAtomic();
319 new eListBoxEntryText( positions
,eString().sprintf(" %d / %d.%d%c",
321 orbital_position
->getNumber()/10,
322 orbital_position
->getNumber()%10,
323 direction
->getCurrent()->getKey() ? 'W':'E'
325 (void*) ( direction
->getCurrent()->getKey()
326 ? - orbital_position
->getNumber()
327 : orbital_position
->getNumber() )
331 positions
->invalidateContent();
332 positions
->endAtomic();
335 void RotorConfig::onRemove()
337 positions
->beginAtomic();
339 if (positions
->getCurrent())
340 positions
->remove( positions
->getCurrent() );
342 if (!positions
->getCount())
344 new eListBoxEntryText( positions
, _("delete me"), (void*) 0xFFFF );
348 positions
->invalidate();
349 positions
->endAtomic();
352 void RotorConfig::onNextPressed()
359 c
.setLCD( LCDTitle
, LCDElement
);
366 useGotoXX
->setCheck(0);
367 positions
->forEachEntry( savePosition( lnb
->getDiSEqC().RotorTable
) );
368 eTransponderList::getInstance()->writeLNBData();
375 struct rotorMenuActions
378 eAction east
, eastFine
, eastStop
, west
, westFine
, westStop
;
380 map("rotorMenu", "rotorMenu"),
381 east(map
, "driveEast", _("drive Motor East"), eAction::prioWidget
),
382 eastFine(map
, "driveEastStep", _("drive Motor East.. one step"), eAction::prioWidget
),
383 eastStop(map
, "driveEastStop", _("stop Motor drive East"), eAction::prioWidget
),
384 west(map
, "driveWest", _("drive Motor East"), eAction::prioWidget
),
385 westFine(map
, "driveWestStep", _("drive Motor West.. one step"), eAction::prioWidget
),
386 westStop(map
, "driveWestStop", _("stop Motor drive West"), eAction::prioWidget
)
391 eAutoInitP0
<rotorMenuActions
> i_rotorMenuActions(eAutoInitNumbers::actions
, "rotor menu actions");
393 eRotorManual::eRotorManual(eLNB
*lnb
)
394 :lnb(lnb
), retuneTimer(new eTimer(eApp
)), transponder(0), changed(0)
396 init_eRotorManual(lnb
);
399 void eRotorManual::init_eRotorManual(eLNB
*lnb
)
401 lMode
= new eLabel(this);
402 lMode
->setName("lMode");
404 lSat
= new eLabel(this);
405 lSat
->setName("lSat");
407 lTransponder
= new eLabel(this);
408 lTransponder
->setName("lTransponder");
410 lDirection
= new eLabel(this);
411 lDirection
->setName("lDirection");
413 lCounter
= new eLabel(this);
414 lCounter
->setName("lCounter");
418 Mode
= new eComboBox(this, 4, lMode
);
419 Mode
->setName("Mode");
420 CONNECT(Mode
->selchanged
, eRotorManual::modeChanged
);
422 num
= new eNumber( this, 1, 1, 80, 2, 0, 0, lSat
);
426 // send no more DiSEqC Commands on transponder::tune to Rotor
427 eFrontend::getInstance()->disableRotor();
429 Sat
= new eComboBox( this, 7, lSat
);
431 CONNECT(Sat
->selchanged
, eRotorManual::satChanged
);
433 Transponder
= new eComboBox(this, 5 );
434 Transponder
->setName("Transponder");
435 CONNECT(Transponder
->selchanged
, eRotorManual::tpChanged
);
437 Direction
= new eButton(this);
438 Direction
->setName("Direction");
440 Exit
= new eButton(this);
441 Exit
->setName("Exit");
442 CONNECT( Exit
->selected
, eRotorManual::reject
);
444 Save
= new eButton(this);
445 Save
->setName("Save");
446 CONNECT(Save
->selected
, eRotorManual::onButtonPressed
);
448 Search
= new eButton(this);
449 Search
->setName("Search");
450 CONNECT( Search
->selected
, eRotorManual::onScanPressed
);
452 status
= new eFEStatusWidget( this, eFrontend::getInstance() );
453 status
->setName("Status");
455 if ( eSkin::getActive()->build(this, "RotorManual"))
456 eFatal("skin load of \"RotorManual\" failed");
458 Direction
->setText("< Stop >");
460 eTransponderList::getInstance()->reloadNetworks();
462 new eListBoxEntryText(*Mode
, _("position"), (void*) 0, 0, _("store new sat positions"));
463 new eListBoxEntryText(*Mode
, _("drive to stored pos"), (void*) 1, 0, _("drive to stored position"));
464 new eListBoxEntryText(*Mode
, _("drive to satellite"), (void*) 8, 0, _("drive to stored satellite"));
465 new eListBoxEntryText(*Mode
, _("drive to 0\xC2\xB0"), (void*) 2, 0, _("drives to 0\xB0"));
466 new eListBoxEntryText(*Mode
, _("recalculate"), (void*) 3, 0, _("recalculate stored positions rel. to current pos"));
467 new eListBoxEntryText(*Mode
, _("set east limit"), (void*) 4, 0, _("set east soft limit"));
468 new eListBoxEntryText(*Mode
, _("set west limit"), (void*) 5, 0, _("set west soft limit"));
469 new eListBoxEntryText(*Mode
, _("disable limits"), (void*) 6, 0, _("disable soft limits"));
470 new eListBoxEntryText(*Mode
, _("enable limits"), (void*) 7, 0, _("enable soft limits"));
471 Mode
->setCurrent(0,true);
473 eDVBServiceController
*sapi
=eDVB::getInstance()->getServiceAPI();
475 if (sapi
&& sapi
->transponder
)
476 transponder
= sapi
->transponder
;
478 eListBoxEntryText
*sel
=0;
480 for ( std::list
<eLNB
>::iterator
it( eTransponderList::getInstance()->getLNBs().begin() ); it
!= eTransponderList::getInstance()->getLNBs().end(); it
++)
481 if ( it
->getDiSEqC().DiSEqCMode
== eDiSEqC::V1_2
)
482 for ( ePtrList
<eSatellite
>::iterator
s ( it
->getSatelliteList().begin() ); s
!= it
->getSatelliteList().end(); s
++)
483 if ( transponder
&& s
->getOrbitalPosition() == transponder
->satellite
.orbital_position
)
484 sel
= new eListBoxEntryText(*Sat
, s
->getDescription().c_str(), (void*) *s
);
486 new eListBoxEntryText(*Sat
, s
->getDescription().c_str(), (void*) *s
);
489 Sat
->setCurrent(sel
,true);
491 Sat
->setCurrent(0,true);
493 CONNECT( retuneTimer
->timeout
, eRotorManual::retune
);
494 addActionMap(&i_rotorMenuActions
->map
);
496 CONNECT(num
->selected
, eRotorManual::nextfield
);
499 void eRotorManual::modeChanged( eListBoxEntryText
*e
)
501 eString buttonText
, helpText
;
503 switch((int)e
->getKey())
507 helptext
=_("store current pos in motor");
508 buttonText
=_("store");
511 helptext
=_("drive motor to stored pos");
515 helptext
=_("drive motor to reference position");
519 helptext
=_("recalculate all stored positions");
520 buttonText
=_("recalc");
523 helptext
=_("store current pos as east soft limit");
524 buttonText
=_("store");
527 helptext
=_("store current pos as west soft limit");
528 buttonText
=_("store");
531 helptext
=_("disable soft limits");
532 buttonText
=_("do it");
535 helptext
=_("enable soft limits");
536 buttonText
=_("do it");
539 helptext
=_("drive motor to satellite");
543 Save
->setHelpText(helptext
);
544 Save
->setText(buttonText
);
546 switch((int)e
->getKey())
550 case 0: // store new positions
551 case 4: // set east limit
552 case 5: // set west limit
553 /* lRecalcParams->hide();
557 case 3: // recalculate
561 case 6: // clear limits
562 case 7: // set limits
563 case 2: // goto ref pos
564 /* lRecalcParams->hide();
569 case 1: // go to stored pos
572 case 8: // goto satellite
573 lTransponder
->hide();
580 switch((int)e
->getKey())
583 case 3: // recalculate
584 /* lRecalcParams->show();
588 case 0: // store new positions
589 case 4: // set east limit
590 case 5: // set west limit
591 lTransponder
->show();
595 case 8: // goto sat pos
597 lSat
->setText(_("Satellite:"));
602 case 1: // go to stored pos
604 lSat
->setText("Position:");
606 case 6: // clear limits
607 case 7: // set limits
608 case 2: // goto ref pos
613 void eRotorManual::retune()
615 if( transponder
&& !eFrontend::getInstance()->Locked() )
619 void eRotorManual::satChanged( eListBoxEntryText
*sat
)
621 Transponder
->clear();
622 if (sat
&& sat
->getKey())
624 eListBoxEntryText
*sel
=0;
626 eSatellite
*Sat
= (eSatellite
*) (sat
->getKey());
628 for ( std::list
<tpPacket
>::const_iterator
i( eTransponderList::getInstance()->getNetworks().begin() ); i
!= eTransponderList::getInstance()->getNetworks().end(); i
++ )
630 if ( i
->orbital_position
== Sat
->getOrbitalPosition() )
632 for (std::list
<eTransponder
>::const_iterator
it( i
->possibleTransponders
.begin() ); it
!= i
->possibleTransponders
.end(); it
++)
633 if ( transponder
&& *transponder
== *it
)
634 sel
= new eListBoxEntryText( *Transponder
, eString().sprintf("%d / %d / %c", it
->satellite
.frequency
/1000, it
->satellite
.symbol_rate
/1000, it
->satellite
.polarisation
?'V':'H' ), (void*)&(*it
) );
636 new eListBoxEntryText( *Transponder
, eString().sprintf("%d / %d / %c", it
->satellite
.frequency
/1000, it
->satellite
.symbol_rate
/1000, it
->satellite
.polarisation
?'V':'H' ), (void*)&(*it
) );
640 if (Transponder
->getCount())
643 Transponder
->setCurrent(sel
,true);
645 Transponder
->setCurrent(0,true);
650 void eRotorManual::tpChanged( eListBoxEntryText
*tp
)
652 if (tp
&& tp
->getKey() )
654 if ( transponder
&& *transponder
== *((eTransponder
*)tp
->getKey()))
656 transponder
= (eTransponder
*)(tp
->getKey());
663 void eRotorManual::onButtonPressed()
665 switch((int)Mode
->getCurrent()->getKey())
668 case 0: // store current pos in Rotor
670 eStoreWindow
w( lnb
, ((eSatellite
*) Sat
->getCurrent()->getKey())->getOrbitalPosition() );
674 if (ret
&& ret
!= -1)
676 eFrontend::getInstance()->sendDiSEqCCmd( 0x31, 0x6A, eString().sprintf("%02x",ret
) );
683 case 1: //drive rotor to stored pos
684 eFrontend::getInstance()->sendDiSEqCCmd( 0x31, 0x6B, eString().sprintf("%02x",num
->getNumber()).c_str() );
686 case 2: //driver rotor to reference position
687 eFrontend::getInstance()->sendDiSEqCCmd( 0x31, 0x6B, "00");
689 case 3: //recalculate all stored positions
691 eMessageBox
mb( _("Wrong use of this function can corrupt all stored sat positions.\n"
692 "Are you sure you want to use this function?"), _("Warning"), eMessageBox::iconWarning
|eMessageBox::btYes
|eMessageBox::btNo
, eMessageBox::btNo
);
697 case eMessageBox::btYes
:
698 eFrontend::getInstance()->sendDiSEqCCmd( 0x31, 0x6F, "00");
702 case eMessageBox::btNo
:
710 case 4: //store current pos as east soft limit
711 eFrontend::getInstance()->sendDiSEqCCmd( 0x31, 0x66 );
713 case 5: //store current pos as west soft limit
714 eFrontend::getInstance()->sendDiSEqCCmd( 0x31, 0x67 );
716 case 6: //disable soft limits
717 eFrontend::getInstance()->sendDiSEqCCmd( 0x31, 0x63 );
719 case 7: //enable soft limits
720 eFrontend::getInstance()->sendDiSEqCCmd( 0x31, 0x6A, "00");
722 case 8: //goto sat pos
723 eFrontend::getInstance()->sendDiSEqCCmd( 0x31, 0x6B, eString().sprintf("%02x", lnb
->getDiSEqC().RotorTable
[ ((eSatellite
*)Sat
->getCurrent()->getKey())->getOrbitalPosition()] ) );
729 void eRotorManual::onScanPressed()
732 TransponderScan
setup(LCDTitle
, LCDElement
);
734 TransponderScan setup
;
741 int eRotorManual::eventHandler( const eWidgetEvent
& e
)
745 case eWidgetEvent::execDone
:
746 // enable send DiSEqC Commands to Rotor on eTransponder::tune
747 eFrontend::getInstance()->enableRotor();
750 case eWidgetEvent::evtAction
:
751 if ( focus
== Direction
)
753 if (e
.action
== &i_rotorMenuActions
->eastFine
)
757 Direction
->setText(_("one step East..."));
759 eFrontend::getInstance()->sendDiSEqCCmd( 0x31, 0x68, "FF" );
762 else if (e
.action
== &i_rotorMenuActions
->westFine
)
766 Direction
->setText(_("one step west..."));
768 eFrontend::getInstance()->sendDiSEqCCmd( 0x31, 0x69, "FF" );
771 else if (e
.action
== &i_rotorMenuActions
->east
)
777 eFrontend::getInstance()->sendDiSEqCCmd( 0x31, 0x68, "00" );
778 retuneTimer
->start(500, false);
780 Direction
->setText(_("turning to east..."));
782 else if (e
.action
== &i_rotorMenuActions
->west
)
788 eFrontend::getInstance()->sendDiSEqCCmd( 0x31, 0x69, "00" );
789 retuneTimer
->start(500, false);
791 Direction
->setText(_("turning to west..."));
793 else if (e
.action
== &i_rotorMenuActions
->eastStop
|| e
.action
== &i_rotorMenuActions
->westStop
)
798 eFrontend::getInstance()->sendDiSEqCCmd( 0x31, 0x60 );
799 eFrontend::getInstance()->sendDiSEqCCmd( 0x31, 0x60 );
804 Direction
->setText(_("< Stop >"));
816 return eWindow::eventHandler(e
);
819 eRotorManual::~eRotorManual()
825 void eRotorManual::nextfield(int*)
827 eDebug("focusDirNext");
828 focusNext(eWidget::focusDirNext
);
832 eStoreWindow::eStoreWindow(eLNB
*lnb
, int orbital_pos
)
833 :lnb(lnb
), orbital_pos(orbital_pos
)
835 cresize(eSize(360,140));
836 cmove(ePoint(150,150));
837 setText("Store Satellite");
838 lStorageLoc
= new eLabel(this);
839 lStorageLoc
->resize(eSize(250, 35));
840 lStorageLoc
->move(ePoint(10,10));
841 lStorageLoc
->setText(_("Storage Location:"));
842 StorageLoc
= new eNumber( this, 1, 1, 80, 2, 0, 0, lStorageLoc
);
843 StorageLoc
->setHelpText(_("change storage Location or store"));
844 StorageLoc
->resize(eSize(80, 35));
845 StorageLoc
->move(ePoint(270, 10));
846 StorageLoc
->loadDeco();
847 CONNECT(StorageLoc
->selected
, eStoreWindow::nextfield
);
848 Store
= new eButton(this);
849 Store
->setShortcut("green");
850 Store
->setShortcutPixmap("green");
851 Store
->move(ePoint(10,60));
852 Store
->resize(eSize(220,40));
853 Store
->setText(_("store"));
855 CONNECT( Store
->selected
, eStoreWindow::onStorePressed
);
856 eStatusBar
*sbar
= new eStatusBar(this);
857 sbar
->move( ePoint(0, getClientSize().height()-30) );
858 sbar
->resize( eSize( getClientSize().width(), 30) );
864 std::map
<int,int>::iterator
it(lnb
->getDiSEqC().RotorTable
.begin());
865 for ( ; it
!= lnb
->getDiSEqC().RotorTable
.end(); it
++ )
866 if ( it
->second
== i
)
869 if (it
!= lnb
->getDiSEqC().RotorTable
.end() )
871 if ( it
->first
!= orbital_pos
)
875 StorageLoc
->setNumber(i
);
880 void eStoreWindow::nextfield(int*)
882 focusNext(eWidget::focusDirNext
);
885 void eStoreWindow::onStorePressed()
887 std::map
<int,int>::iterator it
= lnb
->getDiSEqC().RotorTable
.find( orbital_pos
);
888 if ( it
!= lnb
->getDiSEqC().RotorTable
.end() )
890 int ret
= eMessageBox::btYes
;
891 if ( StorageLoc
->getNumber() != it
->second
)
893 eMessageBox
mb( eString().sprintf(_("%d.%d\xC2\xB0%c is currently stored at location %d!\nWhen you store this now at Location %d, we must remove the old Location.\nAre you sure you want to do this?"),abs(orbital_pos
)/10, abs(orbital_pos
)%10, orbital_pos
>0?'E':'W', it
->second
, StorageLoc
->getNumber() ), _("Warning"), eMessageBox::iconWarning
|eMessageBox::btYes
|eMessageBox::btNo
, eMessageBox::btNo
);
902 case eMessageBox::btYes
:
903 lnb
->getDiSEqC().RotorTable
.erase(it
);
904 lnb
->getDiSEqC().useGotoXX
=0;
905 lnb
->getDiSEqC().RotorTable
[orbital_pos
] = StorageLoc
->getNumber();
906 close(StorageLoc
->getNumber());
908 case eMessageBox::btNo
:
915 eMessageBox
mb( eString().sprintf(_("Store %d.%d\xC2\xB0%c at location %d.\n"
916 "If you want another location, then say no and change the location manually.\n"
917 "Are you sure you want to store at this location?"),abs(orbital_pos
)/10, abs(orbital_pos
)%10, orbital_pos
>0?'E':'W', StorageLoc
->getNumber() ), _("Information"), eMessageBox::iconWarning
|eMessageBox::btYes
|eMessageBox::btNo
, eMessageBox::btNo
);
922 case eMessageBox::btYes
:
923 lnb
->getDiSEqC().useGotoXX
=0;
924 lnb
->getDiSEqC().RotorTable
[orbital_pos
] = StorageLoc
->getNumber();
927 close(StorageLoc
->getNumber());
930 case eMessageBox::btNo
: