Exemplo n.º 1
0
Mount::Mount()
{
    setupUi(this);
    new MountAdaptor(this);
    QDBusConnection::sessionBus().registerObject("/KStars/Ekos/Mount",  this);

    currentTelescope = NULL;

    stopB->setIcon(QIcon::fromTheme("process-stop"));
    northB->setIcon(QIcon::fromTheme("go-up"));
    westB->setIcon(QIcon::fromTheme("go-previous"));
    eastB->setIcon(QIcon::fromTheme("go-next"));
    southB->setIcon(QIcon::fromTheme("go-down"));

    abortDispatch = -1;

    minAltLimit->setValue(Options::minimumAltLimit());
    maxAltLimit->setValue(Options::maximumAltLimit());


    QFile tempFile;

    if (KSUtils::openDataFile( tempFile, "go-nw.png" ) )
    {
        northwestB->setIcon(QIcon(tempFile.fileName()));
        tempFile.close();
    }

    if (KSUtils::openDataFile( tempFile, "go-ne.png" ) )
    {
        northeastB->setIcon(QIcon(tempFile.fileName()));
        tempFile.close();
    }

    if (KSUtils::openDataFile( tempFile, "go-sw.png" ) )
    {
        southwestB->setIcon(QIcon(tempFile.fileName()));
        tempFile.close();
    }

    if (KSUtils::openDataFile( tempFile, "go-se.png" ) )
    {
        southeastB->setIcon(QIcon(tempFile.fileName()));
        tempFile.close();
    }

    connect(northB, SIGNAL(pressed()), this, SLOT(move()));
    connect(northB, SIGNAL(released()), this, SLOT(stop()));
    connect(westB, SIGNAL(pressed()), this, SLOT(move()));
    connect(westB, SIGNAL(released()), this, SLOT(stop()));
    connect(southB, SIGNAL(pressed()), this, SLOT(move()));
    connect(southB, SIGNAL(released()), this, SLOT(stop()));
    connect(eastB, SIGNAL(pressed()), this, SLOT(move()));
    connect(eastB, SIGNAL(released()), this, SLOT(stop()));
    connect(northeastB, SIGNAL(pressed()), this, SLOT(move()));
    connect(northeastB, SIGNAL(released()), this, SLOT(stop()));
    connect(northwestB, SIGNAL(pressed()), this, SLOT(move()));
    connect(northwestB, SIGNAL(released()), this, SLOT(stop()));
    connect(southeastB, SIGNAL(pressed()), this, SLOT(move()));
    connect(southeastB, SIGNAL(released()), this, SLOT(stop()));
    connect(southwestB, SIGNAL(pressed()), this, SLOT(move()));
    connect(southwestB, SIGNAL(released()), this, SLOT(stop()));
    connect(stopB, SIGNAL(clicked()), this, SLOT(stop()));
    connect(saveB, SIGNAL(clicked()), this, SLOT(save()));

    connect(minAltLimit, SIGNAL(editingFinished()), this, SLOT(saveLimits()));
    connect(maxAltLimit, SIGNAL(editingFinished()), this, SLOT(saveLimits()));

    connect(enableLimitsCheck, SIGNAL(toggled(bool)), this, SLOT(enableAltitudeLimits(bool)));
    enableLimitsCheck->setChecked(Options::enableAltitudeLimits());
    altLimitEnabled = enableLimitsCheck->isChecked();
}
Exemplo n.º 2
0
Arquivo: moto.cpp Projeto: z80/avrusb
void Moto::saveSettings()
{
    QSettings set( INI_FILE_NAME,  QSettings::IniFormat, this );
    set.setValue( "rpmMin", ui.speed_msr->minValue() );
    set.setValue( "rpmMax", ui.speed_msr->maxValue() );
    set.setValue( "rpmStep", ui.speed_msr->step() );

    // Direction flip.
    set.setValue( "directionFlip", m_state.directionFlip );

    // Parameters availability.
    set.setValue( "throttleTypeEn",        m_state.throttleTypeEn );
    set.setValue( "throttleModeEn",        m_state.throttleModeEn );
    set.setValue( "maxThrottleCwEn",       m_state.maxThrottleCwEn );
    set.setValue( "maxThrottleCcwEn",      m_state.maxThrottleCcwEn );
    set.setValue( "maxSpeedCwEn",          m_state.maxSpeedCwEn );
    set.setValue( "maxSpeedCcwEn",         m_state.maxSpeedCcwEn );
    set.setValue( "throttleRampUpCwEn",    m_state.throttleRampUpCwEn );
    set.setValue( "throttleRampUpCcwEn",   m_state.throttleRampUpCcwEn );
    set.setValue( "throttleRampDownCwEn",  m_state.throttleRampDownCwEn );
    set.setValue( "throttleRampDownCcwEn", m_state.throttleRampDownCcwEn );
    set.setValue( "commutationModeEn",     m_state.commutationModeEn );
    set.setValue( "throttleLockoutEn",     m_state.throttleLockoutEn );
    set.setValue( "stallThresholdEn",      m_state.stallThresholdEn );
    set.setValue( "currentLimitEn",        m_state.currentLimitEn );
    set.setValue( "undervoltageCtrlEn",    m_state.undervoltageCtrlEn );
    set.setValue( "motorOvertempEn",       m_state.motorOvertempEn );
    set.setValue( "controllerOvertempEn",  m_state.controllerOvertempEn );
    set.setValue( "passwordEn",            m_state.passwordEn );

    // Error codes.
    for ( int i=0; i<m_errorCodes.size(); i++ )
    {
    	QString arg = QString( "errorCode_%1" ).arg( i );
    	QString val = m_errorCodes.at( i );
    	set.setValue( arg, val );
    }

    // Commutation mode
    for ( int i=0; i<m_commutationModeNames.size(); i++ )
    {
    	QString arg = QString( "commutationModeName_%1" ).arg( i );
    	set.setValue( arg, m_commutationModeNames.at( i ) );
    	arg = QString( "commutationModeVal_%1" ).arg( i );
    	set.setValue( arg, m_commutationModeVals.at( i ) );
    }

    // Current limit
    for ( int i=0; i<m_currentLimitNames.size(); i++ )
    {
    	QString arg = QString( "currentLimitName_%1" ).arg( i );
    	set.setValue( arg, m_currentLimitNames.at( i ) );
    	arg = QString( "currentLimitVal_%1" ).arg( i );
    	set.setValue( arg, m_currentLimitVals.at( i ) );
    }

    // Help command.
    set.setValue( "helpCmd", m_helpCmd );

    // Limits
    saveLimits( set );
}