Пример #1
0
static bool
OnKeyDown(WindowControl *Sender, unsigned key_code)
{
  switch(key_code){
    case VK_ESCAPE:
      OnCloseClicked(Sender);
    return true;

#ifdef GNAV
    case VK_APP1:
    case '6':
      OnAckClicked(Sender);
    return true;

    case VK_APP2:
    case '7':
      OnAck1Clicked(Sender);
    return true;

    case VK_APP3:
    case '8':
      OnAck2Clicked(Sender);
    return true;

    case VK_APP4:
    case '9':
      OnEnableClicked(Sender);
    return true;
#endif

  default:
    return false;
  }
}
Пример #2
0
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)));
        }
Пример #3
0
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()));
        }