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

void TabletWidget::loadTabletInformation (  )  [slot]

Initialize the widgets tablet parameter. Shows an image of the connected tablet or a generic image if no image was found. If no tablet is connected an error message will be shown.

Definition at line 96 of file tabletwidget.cpp.

References Wacom::ProfileManagement::availableProfiles(), Wacom::ProfileManagement::createNewProfile(), m_deviceError, m_deviceInterface, m_eraserPage, m_generalPage, m_padButtonPage, m_padMappingPage, m_profileManagement, m_screenPage, m_stylusPage, m_tabletInterface, m_ui, Wacom::ProfileManagement::reload(), Wacom::PenWidget::reloadWidget(), Wacom::ScreenWidget::reloadWidget(), Wacom::PadMapping::reloadWidget(), Wacom::PadButtonWidget::reloadWidget(), Wacom::GeneralWidget::reloadWidget(), and showError().

Referenced by init(), and TabletWidget().

{
    //check if a tablet is connected
    QDBusReply<bool> isAvailable = m_tabletInterface->call("tabletAvailable");

    if (!isAvailable.isValid()) {
        QString errmsg = i18n("DBus connection to the kded deamon not available!\n\nPlease start the wacom tablet deamon and try again.\nThe deamon is responsible for tablet detection and profile support.");
        showError(errmsg);
        kError() << "DBus reply tabletAvailable failed";
        return;
    }

    if (!isAvailable) {
        QString errmsg = i18n("No tablet device was found!\n\nPlease connect the device before you start this module.\nIf the device is already connected refer to the help file for any further information.");
        showError(errmsg);
        return;
    }

    if (m_deviceError) {
        m_deviceError->setVisible(false);
        m_ui->verticalLayout->removeWidget(m_deviceError);
    }

    m_profileManagement->reload();
    m_generalPage->reloadWidget();
    m_padButtonPage->reloadWidget();
    m_padMappingPage->reloadWidget();
    m_screenPage->reloadWidget();
    m_stylusPage->reloadWidget();
    m_eraserPage->reloadWidget();

    // ok we found a device, lets add all necessary information
    m_ui->profileSelector->setEnabled(true);
    m_ui->addProfileButton->setEnabled(true);
    m_ui->delProfileButton->setEnabled(true);
    m_ui->deviceTabWidget->setEnabled(true);
    m_ui->deviceTabWidget->setVisible(true);

    // load available profiles and create a default one if no profile exist;
    KConfigGroup deviceGroup = m_profileManagement->availableProfiles();

    if (deviceGroup.groupList().isEmpty()) {
        m_profileManagement->createNewProfile();
    }

    // fill combobox with all available profiles
    m_ui->profileSelector->clear();
    m_ui->profileSelector->addItems(deviceGroup.groupList());

    // add all tab pages
    m_ui->deviceTabWidget->addTab(m_generalPage, i18nc("Basic overview page for the tablet hardware", "General"));
    QDBusReply<bool> hasPadButtons = m_deviceInterface->call("hasPadButtons");
    if (hasPadButtons) {
        m_ui->deviceTabWidget->addTab(m_padButtonPage, i18n("Pad Buttons"));
    }
    m_ui->deviceTabWidget->addTab(m_padMappingPage, i18n("Pad Mapping"));
    m_ui->deviceTabWidget->addTab(m_screenPage, i18n("Screen Setup"));
    m_ui->deviceTabWidget->addTab(m_stylusPage, i18n("Stylus"));
    m_ui->deviceTabWidget->addTab(m_eraserPage, i18n("Eraser"));
}


Generated by  Doxygen 1.6.0   Back to index