void SettingsDialog::on_okButton_clicked()
{
    // Port Name
    QString portName = ui->portNameComboBox->currentText();

    QSerialPort::BaudRate baudRate =
            static_cast<QSerialPort::BaudRate> ( ui->baudRateComboBox->currentText().toInt() );

    // Baud Rate
    int currentIndex = ui->dataBitsComboBox->currentIndex();
    QSerialPort::DataBits dataBits = static_cast<QSerialPort::DataBits>( ui->dataBitsComboBox->itemData( currentIndex ).toInt() );

    // Parity
    currentIndex = ui->parityComboBox->currentIndex();
    QSerialPort::Parity parity = static_cast<QSerialPort::Parity>( ui->parityComboBox->itemData( currentIndex ).toInt() );

    // Stop Bits
    currentIndex = ui->stopBitsComboBox->currentIndex();
    QSerialPort::StopBits stopBits = static_cast<QSerialPort::StopBits>( ui->stopBitsComboBox->itemData( currentIndex ).toInt() );

    // FlowControl
    currentIndex = ui->flowControlComboBox->currentIndex();
    QSerialPort::FlowControl flowControl = static_cast<QSerialPort::FlowControl>( ui->flowControlComboBox->itemData( currentIndex ).toInt() );

    Receiver receiver( portName,
                       baudRate,
                       dataBits,
                       parity,
                       stopBits,
                       flowControl );

    emit signalSetSettings( receiver );

    this->close();
}
void SettingsDialog::on_okButton_clicked()
{
    QString portName = ui->portNameComboBox->currentText();
    QString portSpeed = ui->portSpeedComboBox->currentText();
    emit signalSetSettings( portName, portSpeed );
    this->close();
}
Example #3
0
void FirstWindow::on_settingsButton_clicked()
{
    SettingsDialog dialog;
    connect( &dialog, SIGNAL( signalSetSettings( Settings ) ),
             this, SLOT( slotSetSettings( Settings ) ) );
    dialog.exec();
}
void MainWindow::on_actionSettings_triggered()
{
    SettingsDialog dialog;
    dialog.setModal( true );
    connect( &dialog, SIGNAL( signalSetSettings( QString, QString) ),
             this, SLOT( slotSetSettings(QString, QString ) ) );
    dialog.exec();
}
Example #5
0
void SettingsManager::addSettings(const QString &pSetingsProviderId, const QString &pSettingsGroupName, Settings *pSettings)
{
    if (pSetingsProviderId.isEmpty())
    {
        qDebug("SettingsManager::addSettings: plugin id is empty!");
        return;
    }

    if (pSettingsGroupName.isEmpty())
    {
        qDebug("SettingsManager::addSettings: settings page name is empty!");
        return;
    }

    if (!pSettings)
    {
        qDebug("SettingsManager::addSettings: settings object is nullptr!");
        return;
    }

    mPluginIdBySettings.insert(pSettings, pSetingsProviderId);
    mPageNameBySettings.insert(pSettings, pSettingsGroupName);
    QString lFullSettingsPath = QString("%1/%2/%3").arg(pSetingsProviderId).arg(pSettingsGroupName).arg(pSettings->settingsPath());

    mPathBySettings.insert(pSettings, lFullSettingsPath);

    connect(pSettings, SIGNAL(settingsChanged(QMap<QString,QVariant>)),
        this, SLOT(slotWriteSettings(QMap<QString,QVariant>)), Qt::UniqueConnection);
    connect(mStorage, SIGNAL(signalSetSettings(QMap<QString,QVariant>)),
        pSettings, SLOT(slotSetSettings(QMap<QString,QVariant>)), Qt::UniqueConnection);

    if (mStorage)
    {
        mStorage->slotLoadSettings(pathBySettings(pSettings));
    }
}
Example #6
0
void FirstWindow::slotSetSettings(const Settings &settings)
{
    emit signalSetSettings( settings );
}