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

void PadButtonWidget::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 217 of file padbuttonwidget.cpp.

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

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

{
    KConfigGroup padConfig = m_profileManagement->configGroup("pad");

    KComboBox *buttonComboBox;
    QLabel *buttonActionLabel;
    QString readEntry;
    ProfileManagement::PadButton modeSwitch;

    for (int i = 1;i < 11 ;i++) {
        buttonActionLabel = m_ui->buttonGroupBox->findChild<QLabel *>(QString("button%1ActionLabel").arg(i));
        buttonComboBox = m_ui->buttonGroupBox->findChild<KComboBox *>(QString("button%1ComboBox").arg(i));

        if (!buttonActionLabel) {
            continue;
        }
        if (!buttonComboBox) {
            continue;
        }

        readEntry = padConfig.readEntry(QString("Button%1").arg(i));
        modeSwitch = m_profileManagement->getPadButtonFunction(readEntry);

        buttonComboBox->blockSignals(true);
        buttonComboBox->setCurrentIndex(modeSwitch);
        buttonComboBox->blockSignals(false);
        buttonActionLabel->setText(m_profileManagement->transformButtonFromConfig(modeSwitch, readEntry));
    }

    readEntry = padConfig.readEntry("RelWUp");           //RelWUp and AbsWUp are the same for now
    modeSwitch = m_profileManagement->getPadButtonFunction(readEntry);
    m_ui->wheelUpComboBox->blockSignals(true);
    m_ui->wheelUpComboBox->setCurrentIndex(modeSwitch);
    m_ui->wheelUpComboBox->blockSignals(false);
    m_ui->wheelUpActionLabel->setText(m_profileManagement->transformButtonFromConfig(modeSwitch, readEntry));
    m_ui->ringUpComboBox->blockSignals(true);
    m_ui->ringUpComboBox->setCurrentIndex(modeSwitch);
    m_ui->ringUpComboBox->blockSignals(false);
    m_ui->ringUpActionLabel->setText(m_profileManagement->transformButtonFromConfig(modeSwitch, readEntry));

    readEntry = padConfig.readEntry("RelWDn");           //RelWUp and AbsWUp are the same for now
    modeSwitch = m_profileManagement->getPadButtonFunction(readEntry);
    m_ui->wheelDnComboBox->blockSignals(true);
    m_ui->wheelDnComboBox->setCurrentIndex(modeSwitch);
    m_ui->wheelDnComboBox->blockSignals(false);
    m_ui->wheelDnActionLabel->setText(m_profileManagement->transformButtonFromConfig(modeSwitch, readEntry));
    m_ui->ringDnComboBox->blockSignals(true);
    m_ui->ringDnComboBox->setCurrentIndex(modeSwitch);
    m_ui->ringDnComboBox->blockSignals(false);
    m_ui->ringDnActionLabel->setText(m_profileManagement->transformButtonFromConfig(modeSwitch, readEntry));

    readEntry = padConfig.readEntry("StripLDn");
    modeSwitch = m_profileManagement->getPadButtonFunction(readEntry);
    m_ui->stripLDnComboBox->blockSignals(true);
    m_ui->stripLDnComboBox->setCurrentIndex(modeSwitch);
    m_ui->stripLDnComboBox->blockSignals(false);
    m_ui->stripLDnActionLabel->setText(m_profileManagement->transformButtonFromConfig(modeSwitch, readEntry));
    readEntry = padConfig.readEntry("StripLUp");
    modeSwitch = m_profileManagement->getPadButtonFunction(readEntry);
    m_ui->stripLUpComboBox->blockSignals(true);
    m_ui->stripLUpComboBox->setCurrentIndex(modeSwitch);
    m_ui->stripLUpComboBox->blockSignals(false);
    m_ui->stripLUpActionLabel->setText(m_profileManagement->transformButtonFromConfig(modeSwitch, readEntry));

    readEntry = padConfig.readEntry("StripRDn");
    modeSwitch = m_profileManagement->getPadButtonFunction(readEntry);
    m_ui->stripRDnComboBox->blockSignals(true);
    m_ui->stripRDnComboBox->setCurrentIndex(modeSwitch);
    m_ui->stripRDnComboBox->blockSignals(false);
    m_ui->stripRDnActionLabel->setText(m_profileManagement->transformButtonFromConfig(modeSwitch, readEntry));
    readEntry = padConfig.readEntry("StripRUp");
    modeSwitch = m_profileManagement->getPadButtonFunction(readEntry);
    m_ui->stripRUpComboBox->blockSignals(true);
    m_ui->stripRUpComboBox->setCurrentIndex(modeSwitch);
    m_ui->stripRUpComboBox->blockSignals(false);
    m_ui->stripRUpActionLabel->setText(m_profileManagement->transformButtonFromConfig(modeSwitch, readEntry));
}


Generated by  Doxygen 1.6.0   Back to index