//----------------------------------------------------------------------------- //! //----------------------------------------------------------------------------- void tDataSourcesDialog::ResetGlobal() { QString sourceSelectionString; tPilotController* pPilotDevice = 0; if( tProductSettings::Instance().AutopilotAllowed() ) { pPilotDevice = tGlobal<tPilotManager>::Instance()->GetActivePilotController(); } bool resetAPFirst(false); if ( pPilotDevice != 0 && pPilotDevice->GotHeartbeatFromPilotComputer() && pPilotDevice->CommandInterfaceReady() && pPilotDevice->GetCommandInterface()->GetMode() != tPilotCommandInterface::PILOT_MODE_STANDBY ) { sourceSelectionString = tr("Autopilot must be in standby mode before performing a global reset."); resetAPFirst = true; } else { sourceSelectionString = tr("This will reset all source selections and all instances on all networked units. Are you sure you want to do this?"); } if( confirmationDialog( tr("Global Reset Data Sources"), sourceSelectionString, resetAPFirst ) ) { QTimer::singleShot( 0, m_pSourceSelection, SLOT(GlobalResetSourceSelections()) ); m_pDataModel->Reset(); OnItemSelectionChanged( m_pTreeView->currentIndex() ); // Update the SK's } }
//----------------------------------------------------------------------------- //! //----------------------------------------------------------------------------- void tDataSourcesDialog::ResetLocal() { if(confirmationDialog( tr("Local Reset Data Sources"), tr("This will revert all local source selections on this unit back to the global selection. Are you sure you want to do this?"))) { m_pSourceSelection->LocalResetSourceSelections(); m_pDataModel->RefreshModelData(); OnItemSelectionChanged( m_pTreeView->currentIndex() ); // Update the SK's } }
void CRepositoryFilterView::HandleNmClick(LPNMTREEVIEW pNmHdr) { //this is only needed so that we can tell if they clicked on //an item that is already selected if ( pNmHdr->action == TVC_BYMOUSE ) { unsigned nFlags; HTREEITEM hItem = m_Tree.HitTest(pNmHdr->ptDrag, &nFlags); ATLTRACE(_T("NM_CLICK(%0x)\n"), hItem ); if (hItem && (nFlags & TVHT_ONITEMINDENT|TVHT_ONITEMSTATEICON|TVHT_ONITEM|TVHT_ONITEMRIGHT) > 0 ) { TVITEM item; item.mask = TVIF_HANDLE; item.hItem = hItem; if ( m_Tree.GetItem(&item)) { CComPtr<CTreeNode> tn = (CTreeNode *)item.lParam; OnItemSelectionChanged(tn, true ); } } } }
LRESULT CMainFrame::OnNewSelection(WPARAM wParam, LPARAM lParam) { OnItemSelectionChanged((CTreeNode *)wParam, (bool)(lParam != 0)); return 0; }
//-------------------------------------------------------------------------------------- //! Defines the work for constructor //-------------------------------------------------------------------------------------- void tDataSourcesDialog::Init( const QList<tDataFilter*>& filters, tDataType selDataType /* = DATA_TYPE_INVALID*/, int selInstance /* = 0*/, tDataCategory selCategory /* = DATA_CATEGORY_INVALID*/, const QString& title /* = QString()*/ ) { setWindowTitle( title ); // grab the screen size so we can adapt to it QSize screenResolution = tProductSettings::Instance().ScreenResolution(); m_pDataModel = new tDataSourceTreeModel( *m_pSourceSelection->GetSourceSettings(), filters ); m_pTreeView = new tTreeView( this ); m_pTreeView->setModel( m_pDataModel ); m_pTreeView->setHeaderHidden( true ); m_pTreeView->setTextElideMode( Qt::ElideMiddle ); if ( tProductSettings::Instance().ProductSupportsTouch() ) { int largeIconSize = style()->pixelMetric( QStyle::PM_LargeIconSize ); m_pTreeView->setIconSize( QSize(largeIconSize, largeIconSize) ); QHeaderView* pHeaderView = m_pTreeView->header(); if ( m_pDataModel->columnCount() == tDataSourceTreeItem::Columns_Count ) { pHeaderView->setResizeMode( tDataSourceTreeItem::Columns_Icon, QHeaderView::ResizeToContents ); } pHeaderView->setResizeMode( tDataSourceTreeItem::Columns_Name, QHeaderView::Stretch ); pHeaderView->setStretchLastSection( false ); // This is creating the padding about the menu icon. // Remove it if it's too much. pHeaderView->setMinimumSectionSize(largeIconSize); } m_pTreeView->show(); if( tUiSettings::Instance()->ShowTouchToolTips() ) { m_pTreeView->setToolTip( tr("Tap-and-hold for more options.") ); } else { if( tProductSettings::Instance().ProductSupportsMenuKey() == false ) { // Kiwi m_pTreeView->setToolTip( tr("Press and hold pages for more options.") ); } else { m_pTreeView->setToolTip( tr("Press %1 for more options.").arg(BUTTON_HTML(tNOSStyle::FP_ButtonImageMENU, "MENU")) ); } } if( tProductSettings::Instance().ProductSupportsMenuKey() == false ) { // only KIWI at the moment m_pTreeView->setProperty( "RemapLongPressPagesToMenuKey", true ); } m_SelectedSource = tDataId(); // invalid data m_SelectedData = DATA_TYPE_INVALID; m_SelectedInstance = -1; // Status bar m_pValue = new QLabel(""); m_pWidgetLayout = new QGridLayout(); m_pWidgetLayout->addWidget( m_pValue ); m_pDialogLayout = new QVBoxLayout(); m_pDialogLayout->addWidget( m_pTreeView ); if (screenResolution.height() > 240) { //Group box m_pGroupBox1 = new QGroupBox( "" ); m_pGroupBox1->setLayout( m_pWidgetLayout ); m_pDialogLayout->addWidget( m_pGroupBox1 ); } else { m_pDialogLayout->setContentsMargins( 0, 0, 0, 3 ); m_pDialogLayout->addLayout( m_pWidgetLayout ); } setLayout( m_pDialogLayout ); // if we have a SKB keys don't have focus, else hide keys m_NumKeys = 0; SoftKeyBar()->ExplicitHide(); CreateActions(); //todo - check whether we can call this directly instead of signals/slots Connect( this, SIGNAL( CloseRequested() ), this, SLOT( accept() ) ); Connect( this, SIGNAL(ShowSimnetAutoSelectionConfirmation( QWidget* )), m_pDataSourceMonitor, SLOT(ShowSimnetAutoSelectionConfirmation( QWidget* )), Qt::QueuedConnection ); Connect( m_pTreeView, SIGNAL( ItemSelectionChanged( const QModelIndex & ) ), this, SLOT( OnItemSelectionChanged( const QModelIndex & ) ) ); Connect( m_pTreeView, SIGNAL( activated( const QModelIndex& ) ), this, SLOT( OnItemClicked( const QModelIndex& ) ) ); Connect( m_pDataModel, SIGNAL( ModelAboutToBeRefreshed() ), this, SLOT( OnModelAboutToBeRefreshed() ) ); Connect( m_pDataModel, SIGNAL( ModelRefreshed() ), this, SLOT( OnModelRefreshed() ) ); QModelIndex selIndex; if( selDataType != DATA_TYPE_INVALID ) { selIndex = m_pDataModel->FindSelectedData( selDataType, selInstance ); } else if( selCategory != DATA_CATEGORY_INVALID ) { selIndex = m_pDataModel->FindCategory( selCategory ); } else { selIndex = m_pDataModel->index( 0, 0 ); } m_pTreeView->setCurrentIndex( selIndex ); //m_pTreeView->addAction( m_pEngineNumSetAct ); OnItemSelectionChanged( selIndex ); m_TimerId = startTimer( 1000 ); }
void SVisualLoggerLogsList::OnFiltersChanged() { FVisualLogDevice::FVisualLogEntryItem LogEntry = CurrentLogEntry; OnItemSelectionChanged(LogEntry); }