void GUICONTROLLIST::RegisterActions( const std::map<std::string, Slot1<int>*> & actionmap, const Config::const_iterator section, const Config & cfg) { std::string actionstr; for (size_t i = 0; i < EVENTNUM; ++i) { if (cfg.get(section, signal_names[i], actionstr)) SetActions(actionmap, actionstr, m_signaln[i]); } }
void GUICONTROL::RegisterActions( const std::map<std::string, Slot1<const std::string &>*> & vactionmap, const std::map<std::string, Slot0*> & actionmap, const std::string & name, const CONFIG & cfg) { CONFIG::const_iterator section; cfg.GetSection(name, section); std::string actionstr; if (cfg.GetParam(section, "onselectx", actionstr)) SetActions(vactionmap, actionstr, onselectx); if (cfg.GetParam(section, "onselecty", actionstr)) SetActions(vactionmap, actionstr, onselecty); if (cfg.GetParam(section, "onselect", actionstr)) SetActions(actionmap, actionstr, onselect); if (cfg.GetParam(section, "onfocus", actionstr)) SetActions(actionmap, actionstr, onfocus); if (cfg.GetParam(section, "onblur", actionstr)) SetActions(actionmap, actionstr, onblur); if (cfg.GetParam(section, "onmoveup", actionstr)) SetActions(actionmap, actionstr, onmoveup); if (cfg.GetParam(section, "onmovedown", actionstr)) SetActions(actionmap, actionstr, onmovedown); if (cfg.GetParam(section, "onmoveleft", actionstr)) SetActions(actionmap, actionstr, onmoveleft); if (cfg.GetParam(section, "onmoveright", actionstr)) SetActions(actionmap, actionstr, onmoveright); }
void Listener :: exec ( const QPoint & Loc ) { { const ActList AL = FindActs ( CurrDev ) ; if ( ! AL . isEmpty ( ) ) { setActiveAction ( AL . first ( ) ) ; }//fi } ActPtr Act = QMenu :: exec ( Loc ) ; if ( Act ) { const QString AN = Act -> objectName ( ) ; // Primary key. CurrDev = sect ( AN , 0 ) ; // SysPath. const UdevDev Dev ( UdevContext , CurrDev ) ; QString Node = Dev . DevNode ( ) ; const QString MP = Mounts :: DecodeIFS ( sect ( AN , 1 ) ) ; // Mountpoint/dm-name if any. const bool Cont = isLUKS ( Dev ) , // It's container. MoM = ! MP . isEmpty ( ) ; // It's mounted or mapped. int RC = 0 ; // Return code for command. if ( MoM || ! Suppl ) { // Currently Suppl may be Eject, Remove or UnmountAll. loKey C , T , S ; if ( MoM ) { if ( Cont ) { C = kLockCmd ; T = kLockTO ; S = kLockShow ; } else { C = kUnmntCmd ; T = kUnmntTO ; S = kUnmntShow ; }//fi } else { if ( Cont ) { C = kUnlockCmd ; T = kUnlockTO ; S = kUnlockShow ; } else { C = kMountCmd ; T = kMountTO ; S = kMountShow ; }//fi }//fi RC = ExecCmd ( Opt . toStr ( C ) , MoM ? MP : Node , Opt . toInt ( T ) , Opt . toBool ( S ) ) ; }//fi const UdevDev WD ( WDisk ( Dev ) ) ; // whole disk. bool Show = Opt . toBool ( kEjectShow ) ; RefreshMInfo ( ) ; { const bool A = Opt . toBool ( kAutoEject ) , D = Opt . toStr ( kEjectCmd ) . isEmpty ( ) , L = ( MPoints ( Dev ) + Holders ( Dev ) ) . isEmpty ( ) , S = Suppl == reqEject || Suppl == reqRemove , E = Ejectable ( WD ) ; if ( MoM && ( L || Suppl ) && A && ! D && E && ! S ) { Suppl = reqEject ; Show = Opt . toBool ( kAutoEjShow ) ; }//fi } if ( RC ) { SetActions ( Dev ) ; // workaround for setChecked () } else if ( Suppl == reqUnmtAll ) { UnmntAll ( Dev , Opt . toBool ( kUnmntShow ) ) ; } else if ( Suppl ) { // Eject or Remove. QStringList Msg , NL ; Node = WD . DevNode ( ) ; foreach ( const QString P , Parts ( WD ) << WD . SysPath ( ) ) { const UdevDev D ( UdevContext , P ) ; const QString N = D . DevNode ( ) ; NL += N ; UnmntAll ( D , false ) ; RefreshMInfo ( ) ; foreach ( const QString M , MPoints ( D ) ) { Msg << N + tr ( " mounted on " ) + M ; }//done foreach ( const QString M , Holders ( D ) ) { Msg << N + tr ( " mapped on " ) + M ; }//done UdevEnum En ( UdevContext ) ; En . MatchSubsys ( Subsys_Block ) ; En . MatchSysAttr ( SA_BackFile , N . toLatin1 ( ) ) ; En . ScanDevs ( ) ; foreach ( const UdevPair M , En . GetList ( ) ) { Msg << N + tr ( " mapped on " ) + UdevDev ( UdevContext , M . first ) . DevNode ( ) ; }//done }//done const QStringList F ( "[1-9]*" ) ; foreach ( const QString P , QDir ( "/proc" ) . entryList ( F , Drs ) ) { const QDir D ( "/proc/" + P + "/fd" ) ; foreach ( const QFileInfo I , D . entryInfoList ( QDir :: Files ) ) { const QString N = I . symLinkTarget ( ) ; if ( NL . contains ( N ) ) { Msg << N + tr ( " used by PId " ) + P ; }//fi }//done }//done if ( ! Msg . isEmpty ( ) ) { QMessageBox :: critical ( this , TPref + tr ( "Error" ) , tr ( "Device " ) + Node + tr ( " in use:" ) + "\n" + Msg . join ( "\n" ) ) ; } else { QString Cmd ; int TO ; if ( Suppl == reqEject ) { Cmd = Opt . toStr ( kEjectCmd ) ; TO = Opt . toInt ( kEjectTO ) ; } else { Cmd = Opt . toStr ( kRemoveCmd ) ; TO = Opt . toInt ( kRemoveTO ) ; Show = Opt . toBool ( kRemoveShow ) ; }//fi ExecCmd ( Cmd , Node , TO , Show ) ; }//fi }//fi
//----------------------------------------------------------------------------- //! //----------------------------------------------------------------------------- tPageFluid::tPageFluid( tMfdUiFluidFactory& mfdUiFactory, tSiriusXmWeatherManager& siriusXmWeatherManager, QWidget* parent ) : tPage( siriusXmWeatherManager, parent ) , m_pStatusIcon(0) , m_PagesTimerID(0) , m_pHoldIndicator(0) , m_pPageOverlay(0) , m_pMenuButton(0) , m_PanelButtonPressed(false) , m_HasVideoPanel() , m_pControlBar(0) , m_pPrevPanel(0) , m_pCommandBarHideTimer(0) , m_pWinKeyTimer(0) , m_pSettingsMenuTimer(0) , m_pApBar(0) , m_ApBarVisible(false) , m_MfdUiFactory(mfdUiFactory) { m_pStatusIcon = new tStatusIcon( this ); m_pStatusIcon->hide(); // this widget is positioned manually in LayoutChildren() m_pPageOverlay = new tPageOverlay( this ); m_pPageOverlay->setVisible( tPagesSettings::Instance()->DataOverlayVisible() ); Connect( tPagesSettings::Instance(), SIGNAL( DataOverlayVisibleChanged( bool ) ), m_pPageOverlay, SLOT( setVisible( bool ) ) ); Connect( m_pPageOverlay, SIGNAL( ContextMenuRequest() ), this, SLOT( FocusOnCommandBar() ) ); // this widget is positioned manually in LayoutChildren() // add the command bar // NSW-19831: We must initialise the command bar to NOT accept focus, otherwise it it can consume physical key presses // whilst actually being in touch mode, rendering physical keys temporarily unusable m_pCommandBar = new tCommandBar( false, this ); m_pCommandBar->installEventFilter( this ); // For intercepting press-hold show/hide of the command bar. m_pMainLayout->addWidget( m_pCommandBar, 0, 2, eLR_MaxRows, 1 ); Connect( m_pCommandBar, SIGNAL( ItemSizeChanged( QSize ) ), this, SLOT( ResizePanelButtons( QSize) ) ); Connect( m_pCommandBar, SIGNAL( RequestClose() ), this, SLOT( ReturnFocusToPanel() ) ); m_pMenuButton = new tPanelButton( Qt::AlignTop | Qt::AlignRight, this ); m_pMenuButton->SetText( tr( "Menu" ) ); m_pMenuButton->SetOverlayOnGL( true ); m_pMenuButton->setIcon( style()->standardIcon( NIT(tNOSStyle::NIT_CommandBarMenu) ) ); int iconWidth = ( font().pixelSize() * 3 ) / 2; QSize iconSize( iconWidth, iconWidth ); m_pMenuButton->setIconSize( iconSize ); m_pMenuButton->SetManualPositioning( true ); m_pMenuButton->installEventFilter( this ); m_pMenuButton->hide(); m_pQuickActionButton = new tClearCursorButton( Qt::AlignTop | Qt::AlignRight, this ); m_pQuickActionButton->SetOverlayOnGL( true ); m_pQuickActionButton->installEventFilter(this); m_pQuickActionButton->hide(); m_pControlBar = mfdUiFactory.ControlBar(this); m_pMainLayout->addWidget(m_pControlBar, eLR_Page, 0); AddCollateralPanel(m_pControlBar); Connect( m_pCommandBar, SIGNAL( RequestMinimise() ), this, SLOT( MinimiseCommandBar() ) ); Connect( m_pMenuButton, SIGNAL( clicked() ), this, SLOT( RestoreCommandBar() ) ); Connect( m_pPageOverlay, SIGNAL( ActionsChanged( QList< tAction* > ) ), m_pCommandBar, SLOT( SetActions( QList< tAction* > ) ) ); setLayout( m_pMainLayout ); Connect( m_pPageOverlay, SIGNAL( SelectedEvent( bool ) ), this, SLOT( OverlaySelected( bool ) ) ); m_pCommandBarHideTimer = new QTimer(this); m_pCommandBarHideTimer->setInterval(2000); Connect( m_pCommandBarHideTimer, SIGNAL( timeout() ), this, SLOT( HideCommandBar() ) ); Assert( tUiConfig::Instance()->MediaWidgetType() == tUiConfig::eMWT_AudioBar ); // Fluid should be using the media bar, rather than the media dialog if ( tProductSettings::Instance().AutopilotBarAllowed() && tSystemSettings::Instance()->AutopilotEnabled() ) { m_pApBar = new tAutopilotBar( tGlobal<tPilotManager>::Instance()->GetActivePilotController(), this); m_pApBar->adjustSize(); m_pApBar->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed ); m_pApBar->hide(); m_ApBarVisible = false; Connect( tAutopilotSettings::Instance(), SIGNAL( AutoHideOnStandbyChanged(bool) ), this, SLOT( UpdateAutopilotVisibility() ) ); Connect( tGlobal<tPilotManager>::Instance(), SIGNAL( ActivePilotControllerChanged( tPilotController* ) ), this, SLOT( UpdateAutopilotVisibility() ) ); Connect( tGlobal<tPilotManager>::Instance(), SIGNAL( PilotModesChanged() ), this, SLOT( UpdateAutopilotVisibility() ) ); m_pMainLayout->addWidget( m_pApBar, eLR_AutopilotBar, 1 ); }