tSidebarPageTroll::tSidebarPageTroll( const QWeakPointer<tMercuryStyle>& xStyle, const QWeakPointer<tMercurySettings>& xSettings, const QWeakPointer<tMercuryDataManager>& xDataManager, QGraphicsItem* pParent) : Base(xStyle, xSettings, pParent) , m_xDataManager(xDataManager) , m_pStatus(0) , m_pIndicator(0) , m_pButton(0) , m_pUp(0) , m_pDown(0) , m_CurrentRPM(0) , m_TimeoutTicks(0) , m_TrollAllowed(true) , m_RotaryFocus(false) { tSidebarPage::ItemsCollection items(this); tSidebarControlTitle* objTitle = new tSidebarControlTitle(xStyle.data(), tr("VESSEL CONTROL", "Mercury Vessel Control section heading"), tr("TROLL", "Mercury Troll Control page title"), tSidebarControlTitle::eModeBack); Connect(objTitle, SIGNAL(Triggered()), this, SIGNAL(Back())); items .Add(objTitle, 1.f, Qt::AlignAbsolute) .Add(m_pUp = new tSidebarControlSpinButton(xStyle.data(), tSidebarControlSpinButton::eDirectionUp), 1.5f, Qt::AlignAbsolute) .Add(m_pIndicator = new tSidebarControlIndicator( xStyle.data(), "", "", "", tSidebarControlIndicator::eModeNormal, true), -1.f, Qt::AlignAbsolute) .Add(m_pDown = new tSidebarControlSpinButton(xStyle.data(), tSidebarControlSpinButton::eDirectionDown), 1.5f, Qt::AlignAbsolute) .Add(m_pStatus = new tSidebarStaticText(xStyle.data(), ""), 0.5f, Qt::AlignAbsolute) .Add(m_pButton = new tSidebarControlButtonToggle(xStyle.data(), tr("Enable"), tr("Disable")), 1.f, Qt::AlignBottom) .End(); Connect(m_pUp, SIGNAL(Triggered()), this, SLOT(OnUpClicked())); Connect(m_pDown, SIGNAL(Triggered()), this, SLOT(OnDownClicked())); Connect(m_pButton, SIGNAL(Triggered()), this, SLOT(OnEnableClicked())); Connect(m_pIndicator, SIGNAL(Triggered()), this, SLOT(OnIndicatorTouched())); if( !m_xDataManager.isNull() ) { tMercuryCommand* command = m_xDataManager.data()->MercuryCommand(); if( command != 0 ) { m_CurrentRPM = static_cast<int>(command->TrollRpmSetpoint()); UpdateStatus(command->IsTrollActive()); SetTrollAllowed(command->IsTrollAllowed()); Connect(command, SIGNAL(TrollEngaged(int)), this, SLOT(StatusEnable())); Connect(command, SIGNAL(TrollDisengaged(int)), this, SLOT(StatusDisable())); Connect(command, SIGNAL(TrollActiveDetected()), this, SLOT(StatusEnable())); Connect(command, SIGNAL(TrollInactiveDetected()), this, SLOT(StatusDisable())); Connect(command, SIGNAL(TrollAllowedChanged(bool)), this, SLOT(SetTrollAllowed(bool))); }
tScanningDialogWidget::tScanningDialogWidget( QWidget* pParent ) : tDialogWidget( QString(), QString(), pParent ) , m_pSpinner( 0 ) , m_pLabel( 0 ) , m_Status( tFusionClient::eBluetoothPairingStatus_NotConnectedOrDisconnect ) , m_Discovering( false ) { m_pSpinner = new tWaitingSpinner( this ); m_pSpinner->start(); m_pSpinner->hide(); m_pSpinner->setInnerRadius( contentsRect().height()/2 ); m_pSpinner->setLineLength( contentsRect().height()/2 ); m_pSpinner->setColor( palette().color( QPalette::Disabled, QPalette::Text ) ); // Create a horizontal layout to hold the image label on the left and text labels on the right QHBoxLayout* pLayout = new QHBoxLayout; pLayout->setContentsMargins( 0, 0, 0, 0 ); pLayout->setSpacing ( 10 ); pLayout->addWidget( m_pSpinner ); pLayout->setAlignment( Qt::AlignLeft ); m_pLabel = new QLabel( this ); pLayout->addWidget( m_pLabel ); setLayout( pLayout ); Connect( this, SIGNAL( Triggered() ), this, SLOT( OnClicked() ) ); updateSpinner(); }
ACTIVITY_RETURN_TYPE CountdownDaemon :: Activity(ACTIVITY_INPUT) { #if 0 textprint ( "CountdownDaemon :: Activity(%i) with fuse %i\n", FixP_Time, FixP_TimeRemaining ); #endif if ( FixP_TimeRemaining > FixP_Time ) { // Keep counting down: FixP_TimeRemaining -= FixP_Time; } else { // Countdown has elapsed: Triggered(); delete this; } ACTIVITY_RVAL_NOCHANGE }
bool HotkeyListener::EventFilter(void* message) { XEvent *ev = (XEvent*) message; if(ev->type == KeyPress && ev->xkey.keycode == m_keycode && (ev->xkey.state & ~LockMask & ~Mod2Mask) == m_modifiers) { emit Triggered(); return true; } return false; }
//----------------------------------------------------------------------- // //----------------------------------------------------------------------- void tWifiClientSettingsDialog::RefreshClients() { if( m_pNoClientsWidget != 0 ) { RemoveWidget( m_pNoClientsWidget ); m_pNoClientsWidget = 0; } m_widgetOrgSSID.clear(); bool clientFound = false; tWifiClientSettings* pWifiClientSettings = g_xWirelessMgr->WifiClientSettings(); if( pWifiClientSettings != 0 ) { unsigned int clients = pWifiClientSettings->ClientCount(); if( clients > 0 ) { for( unsigned int count = 0; count < clients; ++count ) { QString orgSSID = pWifiClientSettings->GetClientSSID(count); QString SSID = orgSSID; if (SSID.startsWith("0x", Qt::CaseInsensitive)) { QString hex = SSID.mid(2); QByteArray temp = QByteArray::fromHex(hex.toLatin1().constData()); SSID = temp; } if( orgSSID.isEmpty() != true ) { clientFound = true; tDialogWidget* pWidget = AddText( SSID, GetClientText(orgSSID) ); m_widgetOrgSSID[pWidget] = orgSSID; Connect( pWidget, SIGNAL( Triggered() ), this, SLOT( OnTriggered() ) ); } } } } if( clientFound == false ) { m_pNoClientsWidget = AddText( tr( "No client settings" ), tr( "No settings for Wireless client mode have been stored" ) ); } }
ACTIVITY_RETURN_TYPE PulsingTriggerDaemon :: Activity(ACTIVITY_INPUT) { while ( FixP_Time > 0 ) { if ( FixP_Time >= FixP_TimeToNextPulse ) { // then elapse some of the available time to take you to the pulse FixP_Time -= FixP_TimeToNextPulse; FixP_TimeToNextPulse = FixP_Period_Val; // and trigger: Triggered(); } else { // Not enough time to warrant triggering; reduce time // to next pulse and stop. FixP_TimeToNextPulse -= FixP_Time; ACTIVITY_RVAL_NOCHANGE } } ACTIVITY_RVAL_NOCHANGE }
PageRecord::PageRecord(MainWindow* main_window) : QWidget(main_window->centralWidget()) { m_main_window = main_window; m_page_started = false; m_input_started = false; m_output_started = false; m_previewing = false; m_last_error_sound = std::numeric_limits<int64_t>::min(); QGroupBox *groupbox_recording = new QGroupBox(tr("Recording"), this); { m_pushbutton_start_pause = new QPushButton(groupbox_recording); m_checkbox_hotkey_enable = new QCheckBox(tr("Enable recording hotkey"), groupbox_recording); m_checkbox_sound_notifications_enable = new QCheckBox(tr("Enable sound notifications"), groupbox_recording); QLabel *label_hotkey = new QLabel(tr("Hotkey:"), groupbox_recording); m_checkbox_hotkey_ctrl = new QCheckBox(tr("Ctrl +"), groupbox_recording); m_checkbox_hotkey_shift = new QCheckBox(tr("Shift +"), groupbox_recording); m_checkbox_hotkey_alt = new QCheckBox(tr("Alt +"), groupbox_recording); m_checkbox_hotkey_super = new QCheckBox(tr("Super +"), groupbox_recording); m_combobox_hotkey_key = new QComboBox(groupbox_recording); m_combobox_hotkey_key->setToolTip(tr("The key that you have to press (combined with the given modifiers) to start or pause recording.\n" "The program that you are recording will not receive the key press.")); // Note: The choice of keys is currently rather limited, because capturing key presses session-wide is a bit harder than it looks. // For example, applications are not allowed to capture the F1-F12 keys (on Ubuntu at least). The A-Z keys don't have this limitation apparently. for(unsigned int i = 0; i < 26; ++i) { m_combobox_hotkey_key->addItem(QString('A' + i)); } connect(m_pushbutton_start_pause, SIGNAL(clicked()), this, SLOT(OnRecordStartPause())); connect(m_checkbox_hotkey_enable, SIGNAL(clicked()), this, SLOT(OnUpdateHotkeyFields())); connect(m_checkbox_sound_notifications_enable, SIGNAL(clicked()), this, SLOT(OnUpdateSoundNotifications())); connect(m_checkbox_hotkey_ctrl, SIGNAL(clicked()), this, SLOT(OnUpdateHotkey())); connect(m_checkbox_hotkey_shift, SIGNAL(clicked()), this, SLOT(OnUpdateHotkey())); connect(m_checkbox_hotkey_alt, SIGNAL(clicked()), this, SLOT(OnUpdateHotkey())); connect(m_checkbox_hotkey_super, SIGNAL(clicked()), this, SLOT(OnUpdateHotkey())); connect(m_combobox_hotkey_key, SIGNAL(activated(int)), this, SLOT(OnUpdateHotkey())); QVBoxLayout *layout = new QVBoxLayout(groupbox_recording); layout->addWidget(m_pushbutton_start_pause); { QHBoxLayout *layout2 = new QHBoxLayout(); layout->addLayout(layout2); layout2->addWidget(m_checkbox_hotkey_enable); layout2->addWidget(m_checkbox_sound_notifications_enable); } { QHBoxLayout *layout2 = new QHBoxLayout(); layout->addLayout(layout2); layout2->addWidget(label_hotkey); layout2->addWidget(m_checkbox_hotkey_ctrl); layout2->addWidget(m_checkbox_hotkey_shift); layout2->addWidget(m_checkbox_hotkey_alt); layout2->addWidget(m_checkbox_hotkey_super); layout2->addWidget(m_combobox_hotkey_key); } } QSplitter *splitter_vertical = new QSplitter(Qt::Vertical, this); { QSplitter *splitter_horizontal = new QSplitter(Qt::Horizontal, splitter_vertical); { QGroupBox *groupbox_information = new QGroupBox(tr("Information"), splitter_horizontal); { QLabel *label_total_time = new QLabel(tr("Total time:"), groupbox_information); m_label_info_total_time = new QLabel(groupbox_information); QLabel *label_frame_rate_in = new QLabel(tr("FPS in:"), groupbox_information); m_label_info_frame_rate_in = new QLabel(groupbox_information); QLabel *label_frame_rate_out = new QLabel(tr("FPS out:"), groupbox_information); m_label_info_frame_rate_out = new QLabel(groupbox_information); QLabel *label_size_in = new QLabel(tr("Size in:"), groupbox_information); m_label_info_size_in = new QLabel(groupbox_information); QLabel *label_size_out = new QLabel(tr("Size out:"), groupbox_information); m_label_info_size_out = new QLabel(groupbox_information); QLabel *label_file_name = new QLabel(tr("File name:"), groupbox_information); m_label_info_file_name = new ElidedLabel(QString(), Qt::ElideMiddle, groupbox_information); m_label_info_file_name->setMinimumWidth(100); QLabel *label_file_size = new QLabel(tr("File size:"), groupbox_information); m_label_info_file_size = new QLabel(groupbox_information); QLabel *label_bit_rate = new QLabel(tr("Bit rate:"), groupbox_information); m_label_info_bit_rate = new QLabel(groupbox_information); QGridLayout *layout = new QGridLayout(groupbox_information); layout->addWidget(label_total_time, 0, 0); layout->addWidget(m_label_info_total_time, 0, 1); layout->addWidget(label_frame_rate_in, 1, 0); layout->addWidget(m_label_info_frame_rate_in, 1, 1); layout->addWidget(label_frame_rate_out, 2, 0); layout->addWidget(m_label_info_frame_rate_out, 2, 1); layout->addWidget(label_size_in, 3, 0); layout->addWidget(m_label_info_size_in, 3, 1); layout->addWidget(label_size_out, 4, 0); layout->addWidget(m_label_info_size_out, 4, 1); layout->addWidget(label_file_name, 5, 0); layout->addWidget(m_label_info_file_name, 5, 1); layout->addWidget(label_file_size, 6, 0); layout->addWidget(m_label_info_file_size, 6, 1); layout->addWidget(label_bit_rate, 7, 0); layout->addWidget(m_label_info_bit_rate, 7, 1); layout->setColumnStretch(1, 1); layout->setRowStretch(8, 1); } QGroupBox *groupbox_preview = new QGroupBox(tr("Preview"), splitter_horizontal); { m_preview_page1 = new QWidget(groupbox_preview); { QLabel *label_preview_frame_rate = new QLabel(tr("Preview frame rate:"), m_preview_page1); m_spinbox_preview_frame_rate = new QSpinBox(m_preview_page1); m_spinbox_preview_frame_rate->setRange(1, 1000); m_spinbox_preview_frame_rate->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); QLabel *label_preview_note = new QLabel(tr("Note: Previewing requires extra CPU time (especially at high frame rates)."), m_preview_page1); label_preview_note->setWordWrap(true); label_preview_note->setAlignment(Qt::AlignLeft | Qt::AlignTop); label_preview_note->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::MinimumExpanding); QGridLayout *layout = new QGridLayout(m_preview_page1); layout->setMargin(0); layout->addWidget(label_preview_frame_rate, 0, 0); layout->addWidget(m_spinbox_preview_frame_rate, 0, 1); layout->addWidget(label_preview_note, 1, 0, 1, 2); } m_preview_page2 = new QWidget(groupbox_preview); { m_video_previewer = new VideoPreviewer(m_preview_page2); m_label_mic_icon = new QLabel(m_preview_page2); m_label_mic_icon->setPixmap(QIcon::fromTheme("audio-input-microphone").pixmap(24, 24)); m_audio_previewer = new AudioPreviewer(m_preview_page2); QVBoxLayout *layout = new QVBoxLayout(m_preview_page2); layout->setMargin(0); layout->addWidget(m_video_previewer); { QHBoxLayout *layout2 = new QHBoxLayout(); layout->addLayout(layout2); layout2->addStretch(); layout2->addWidget(m_label_mic_icon); layout2->addWidget(m_audio_previewer); layout2->addStretch(); } } m_pushbutton_preview_start_stop = new QPushButton(groupbox_preview); connect(m_pushbutton_preview_start_stop, SIGNAL(clicked()), this, SLOT(OnPreviewStartStop())); QVBoxLayout *layout = new QVBoxLayout(groupbox_preview); { m_stacked_layout_preview = new QStackedLayout(); layout->addLayout(m_stacked_layout_preview); m_stacked_layout_preview->addWidget(m_preview_page1); m_stacked_layout_preview->addWidget(m_preview_page2); } layout->addWidget(m_pushbutton_preview_start_stop); } splitter_horizontal->addWidget(groupbox_information); splitter_horizontal->addWidget(groupbox_preview); splitter_horizontal->setStretchFactor(0, 1); splitter_horizontal->setStretchFactor(1, 3); } QGroupBox *groupbox_log = new QGroupBox(tr("Log"), splitter_vertical); { m_textedit_log = new QTextEditSmall(groupbox_log); m_textedit_log->setReadOnly(true); QVBoxLayout *layout = new QVBoxLayout(groupbox_log); layout->addWidget(m_textedit_log); } splitter_vertical->addWidget(splitter_horizontal); splitter_vertical->addWidget(groupbox_log); splitter_vertical->setStretchFactor(0, 3); splitter_vertical->setStretchFactor(1, 1); } QPushButton *button_cancel = new QPushButton(QIcon::fromTheme("process-stop"), tr("Cancel recording"), this); QPushButton *button_save = new QPushButton(QIcon::fromTheme("document-save"), tr("Save recording"), this); if(g_option_systray) { m_systray_icon = new QSystemTrayIcon(g_icon_ssr, m_main_window); QMenu *menu = new QMenu(m_main_window); m_systray_action_start_pause = menu->addAction(QString(), this, SLOT(OnRecordStartPause())); m_systray_action_save = menu->addAction(tr("Save recording"), this, SLOT(OnSave())); m_systray_action_cancel = menu->addAction(tr("Cancel recording"), this, SLOT(OnCancel())); menu->addSeparator(); menu->addAction("Quit", m_main_window, SLOT(close())); m_systray_icon->setContextMenu(menu); } else { m_systray_icon = NULL; } connect(button_cancel, SIGNAL(clicked()), this, SLOT(OnCancel())); connect(button_save, SIGNAL(clicked()), this, SLOT(OnSave())); if(m_systray_icon != NULL) connect(m_systray_icon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), m_main_window, SLOT(OnSysTrayActivated(QSystemTrayIcon::ActivationReason))); QVBoxLayout *layout = new QVBoxLayout(this); layout->addWidget(groupbox_recording); layout->addWidget(splitter_vertical); { QHBoxLayout *layout2 = new QHBoxLayout(); layout->addLayout(layout2); layout2->addWidget(button_cancel); layout2->addWidget(button_save); } UpdateSysTray(); UpdateRecordPauseButton(); UpdatePreview(); m_timer_update_info = new QTimer(this); connect(m_timer_update_info, SIGNAL(timeout()), this, SLOT(OnUpdateInformation())); connect(&m_hotkey_start_pause, SIGNAL(Triggered()), this, SLOT(OnRecordStartPause())); connect(Logger::GetInstance(), SIGNAL(NewLine(Logger::enum_type,QString)), this, SLOT(OnNewLogLine(Logger::enum_type,QString)), Qt::QueuedConnection); if(m_systray_icon != NULL) m_systray_icon->show(); }
void EntityAction::Trigger(const QString ¶m1, const QString ¶m2, const QString ¶m3, const QStringList ¶ms) { emit Triggered(param1, param2, param3, params); }
tSidebarPageCruise::tSidebarPageCruise( const QWeakPointer<tMercuryStyle>& xStyle, const QWeakPointer<tMercurySettings>& xSettings, const QWeakPointer<tMercuryDataManager>& xDataManager, const QWeakPointer<tConvert> &xConvert, QGraphicsItem* pParent) : Base(xStyle, xSettings, pParent) , m_xDataManager(xDataManager) , m_xConvert(xConvert) , m_pStatus(0) , m_pIndicator(0) , m_pButton(0) , m_pUp(0) , m_pDown(0) , m_CurrentValue(0) , m_LastReceived(0) , m_TimeoutTicks(0) , m_IdleTimeoutTicks(0) , m_RotaryFocus(false) { tSidebarPage::ItemsCollection items(this); tSidebarControlTitle* objTitle = new tSidebarControlTitle(xStyle.data(), tr("VESSEL CONTROL", "Mercury Vessel Control section heading"), tr("CRUISE", "Mercury Cruise Control page title"), tSidebarControlTitle::eModeBack); Connect(objTitle, SIGNAL(Triggered()), this, SIGNAL(Back())); items .Add(objTitle, 1.f, Qt::AlignAbsolute) .Add(m_pUp = new tSidebarControlSpinButton(xStyle.data(), tSidebarControlSpinButton::eDirectionUp), 1.5f, Qt::AlignAbsolute) .Add(m_pIndicator = new tSidebarControlIndicator( xStyle.data(), "", "", "", tSidebarControlIndicator::eModeSimpleVertical, true), -1.f, Qt::AlignAbsolute) .Add(m_pDown = new tSidebarControlSpinButton(xStyle.data(), tSidebarControlSpinButton::eDirectionDown), 1.5f, Qt::AlignAbsolute) .Add(m_pStatus = new tSidebarStaticText(xStyle.data(), ""), 0.5f, Qt::AlignAbsolute) .Add(m_pButton = new tSidebarControlButtonToggle(xStyle.data(), tr("Enable"), tr("Disable")), 1.f, Qt::AlignAbsolute) .End(); Connect(m_pUp, SIGNAL(Triggered()), this, SLOT(OnUpClicked())); Connect(m_pDown, SIGNAL(Triggered()), this, SLOT(OnDownClicked())); Connect(m_pButton, SIGNAL(Triggered()), this, SLOT(OnEnableClicked())); Connect(m_pIndicator, SIGNAL(Triggered()), this, SLOT(OnIndicatorTouched())); if( !m_xDataManager.isNull() ) { tMercuryCommand* command = m_xDataManager.data()->MercuryCommand(); if( command != 0 ) { m_CurrentValue = static_cast<float>(m_xDataManager.data()->MercuryCommand()->CruiseSetpoint(false)); UpdateStatus(command->IsBasicCruiseEngaged()); Connect(command, SIGNAL(CruiseEngaged()), this, SLOT(StatusEnable())); Connect(command, SIGNAL(CruiseDisengaged()), this, SLOT(StatusDisable())); Connect(command, SIGNAL(SmartTowEngaged()), this, SLOT(UpdateControlsEnabledState())); Connect(command, SIGNAL(SmartTowDisengaged()), this, SLOT(UpdateControlsEnabledState())); Connect(command, SIGNAL(CruiseAllowedChanged(bool)), this, SLOT(UpdateControlsEnabledState())); }