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

void PadButtonWidget::init (  ) 

Initialize and setup the widget.

gets its information for the detected device from the "wacom_devicelist" file

Definition at line 55 of file padbuttonwidget.cpp.

References fillComboBox(), and m_ui.

Referenced by PadButtonWidget(), and reloadWidget().

{
    //get information via DBus
    QDBusInterface *deviceInterface = new QDBusInterface("de.etricceline.Tablet", "/Device", "de.etricceline.Device");

    QDBusReply<QString> deviceModel = deviceInterface->call("deviceModel");
    QDBusReply<QString> deviceId  = deviceInterface->call("deviceId");

    delete deviceInterface;

    KSharedConfig::Ptr deviceConfig = KSharedConfig::openConfig(KStandardDirs::locate("data", "kcmtablet/data/wacom_devicelist"), KConfig::SimpleConfig, "data");
    KConfigGroup deviceGroup = KConfigGroup(deviceConfig, deviceId);

    int padButtons = deviceGroup.readEntry("padbuttons").toInt();

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

        if (!buttonLabel) {
            continue;
        }
        if (!actionLabel) {
            continue;
        }
        if (!comboBox) {
            continue;
        }

        if (i <= padButtons) {
            buttonLabel->setVisible(true);
            actionLabel->setVisible(true);
            comboBox->clear();
            fillComboBox(comboBox);
            comboBox->setVisible(true);
        } else {
            buttonLabel->setVisible(false);
            actionLabel->setVisible(false);
            comboBox->setVisible(false);
        }
    }

    if (KStandardDirs::exists(KStandardDirs::locate("data", QString("kcmtablet/images/pad/%1.png").arg(deviceModel)))) {
        m_ui->padImage->setPixmap(QPixmap(KStandardDirs::locate("data", QString("kcmtablet/images/pad/%1.png").arg(deviceModel))));
    }

    if (deviceGroup.readEntry("wheel").contains("no")) {
        m_ui->wheelGroupBox->setVisible(false);
    } else {
        m_ui->wheelUpComboBox->clear();
        fillComboBox(m_ui->wheelUpComboBox);
        m_ui->wheelDnComboBox->clear();
        fillComboBox(m_ui->wheelDnComboBox);
        m_ui->wheelGroupBox->setVisible(true);
    }

    if (deviceGroup.readEntry("touchring").contains("no")) {
        m_ui->tochRingGroupBox->setVisible(false);
    } else {
        m_ui->ringUpComboBox->clear();
        fillComboBox(m_ui->ringUpComboBox);
        m_ui->ringDnComboBox->clear();
        fillComboBox(m_ui->ringDnComboBox);
        m_ui->tochRingGroupBox->setVisible(true);
    }

    if (deviceGroup.readEntry("touchstripl").contains("no")) {
        m_ui->stripLUpLabel->setVisible(false);
        m_ui->stripLUpComboBox->setVisible(false);
        m_ui->stripLUpActionLabel->setVisible(false);
        m_ui->stripLDnLabel->setVisible(false);
        m_ui->stripLDnComboBox->setVisible(false);
        m_ui->stripLDnActionLabel->setVisible(false);
    } else {
        m_ui->stripLUpLabel->setVisible(true);
        m_ui->stripLUpComboBox->clear();
        fillComboBox(m_ui->stripLUpComboBox);
        m_ui->stripLUpComboBox->setVisible(true);
        m_ui->stripLUpActionLabel->setVisible(true);
        m_ui->stripLDnLabel->setVisible(true);
        m_ui->stripLDnComboBox->clear();
        fillComboBox(m_ui->stripLDnComboBox);
        m_ui->stripLDnComboBox->setVisible(true);
        m_ui->stripLDnActionLabel->setVisible(true);
    }
    if (deviceGroup.readEntry("touchstripr").contains("no")) {
        m_ui->stripRUpLabel->setVisible(false);
        m_ui->stripRUpComboBox->setVisible(false);
        m_ui->stripRUpActionLabel->setVisible(false);
        m_ui->stripRDnLabel->setVisible(false);
        m_ui->stripRDnComboBox->setVisible(false);
        m_ui->stripRDnActionLabel->setVisible(false);
    } else {
        m_ui->stripRUpLabel->setVisible(true);
        m_ui->stripRUpComboBox->clear();
        fillComboBox(m_ui->stripRUpComboBox);
        m_ui->stripRUpComboBox->setVisible(true);
        m_ui->stripRUpActionLabel->setVisible(true);
        m_ui->stripRDnLabel->setVisible(true);
        m_ui->stripRDnComboBox->clear();
        fillComboBox(m_ui->stripRDnComboBox);
        m_ui->stripRDnComboBox->setVisible(true);
        m_ui->stripRDnActionLabel->setVisible(true);
    }
    if (deviceGroup.readEntry("touchstripl").contains("no") && deviceGroup.readEntry("touchstripr").contains("no")) {
        m_ui->tochStripGroupBox->setVisible(false);
    } else {
        m_ui->tochStripGroupBox->setVisible(true);
    }
}


Generated by  Doxygen 1.6.0   Back to index