Logo Search packages:      
Sourcecode: kcm-tablet version File versions  Download package

void PenWidget::loadFromProfile (  )  [slot]

Called whenever the profile is switched or the widget needs to be reinitialized.

Updates all values on the widget to the values from the profile.

Definition at line 92 of file penwidget.cpp.

References Wacom::ProfileManagement::configGroup(), Wacom::ProfileManagement::getPenButtonFunction(), m_profileManagement, m_stylus, m_ui, and Wacom::ProfileManagement::transformButtonFromConfig().

Referenced by Wacom::TabletWidget::reloadProfile(), and Wacom::TabletWidget::switchProfile().

{
    KConfigGroup penConfig;
    if (m_stylus) {
        penConfig = m_profileManagement->configGroup("stylus");
    } else {
        penConfig = m_profileManagement->configGroup("eraser");
    }

    // Cursor Settings
    if (penConfig.readEntry("Mode").toInt() == 1 || penConfig.readEntry("Mode") == QString("absolute")) {
        m_ui->radioButton_Absolute->setChecked(true);
        m_ui->radioButton_Relative->setChecked(false);
    } else {
        m_ui->radioButton_Absolute->setChecked(false);
        m_ui->radioButton_Relative->setChecked(true);
    }

    m_ui->speedSlider->setValue(penConfig.readEntry("SpeedLevel").toInt());
    m_ui->thresholdSlider->setValue(penConfig.readEntry("Threshold").toInt());
    m_ui->pressureValue->setText(penConfig.readEntry("PressCurve"));

    QString readEntry;
    ProfileManagement::PenButton modeSwitch;

    readEntry = penConfig.readEntry("Button1");
    modeSwitch = m_profileManagement->getPenButtonFunction(readEntry);
    m_ui->button1ComboBox->blockSignals(true);
    m_ui->button1ComboBox->setCurrentIndex(modeSwitch);
    m_ui->button1ComboBox->blockSignals(false);
    m_ui->button1ActionLabel->setText(m_profileManagement->transformButtonFromConfig(modeSwitch, readEntry));

    readEntry = penConfig.readEntry("Button2");
    modeSwitch = m_profileManagement->getPenButtonFunction(readEntry);
    m_ui->button2ComboBox->blockSignals(true);
    m_ui->button2ComboBox->setCurrentIndex(modeSwitch);
    m_ui->button2ComboBox->blockSignals(false);
    m_ui->button2ActionLabel->setText(m_profileManagement->transformButtonFromConfig(modeSwitch, readEntry));

    readEntry = penConfig.readEntry("Button3");
    modeSwitch = m_profileManagement->getPenButtonFunction(readEntry);
    m_ui->button3ComboBox->blockSignals(true);
    m_ui->button3ComboBox->setCurrentIndex(modeSwitch);
    m_ui->button3ComboBox->blockSignals(false);
    m_ui->button3ActionLabel->setText(m_profileManagement->transformButtonFromConfig(modeSwitch, readEntry));

    //Double Click Distance
    m_ui->clickSlider->setValue(penConfig.readEntry("ClickForce").toInt());
}


Generated by  Doxygen 1.6.0   Back to index