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

void ProfileManagement::createNewProfile ( const QString &  profilename = "default"  ) 

Creates a new profile for the currently detected device and saves it back to the KConfig file

Parameters:
profilename name of the profile that will be created

Definition at line 38 of file profilemanagement.cpp.

References m_deviceInterface.

Referenced by Wacom::TabletWidget::addProfile(), deleteProfile(), and Wacom::TabletWidget::loadTabletInformation().

{
    //get information via DBus
    QDBusReply<QString> deviceName  = m_deviceInterface->call("deviceName");
    QDBusReply<QString> padName = m_deviceInterface->call("padName");

    KSharedConfig::Ptr profilesConfig = KSharedConfig::openConfig("tabletprofilesrc", KConfig::SimpleConfig);

    KConfigGroup *deviceGroup = new KConfigGroup(profilesConfig, deviceName);
    KConfigGroup *profileGroup = new KConfigGroup(deviceGroup, profilename);

    // write default config for the pad
    KConfigGroup *padGroup = new KConfigGroup(profileGroup, "pad");

    padGroup->writeEntry("Button1", "Button 1");
    padGroup->writeEntry("Button2", "Button 2");
    padGroup->writeEntry("Button3", "Button 3");
    padGroup->writeEntry("Button4", "Button 4");
    padGroup->writeEntry("Button5", "Button 5");
    padGroup->writeEntry("Button6", "Button 6");
    padGroup->writeEntry("Button7", "Button 7");
    padGroup->writeEntry("Button8", "Button 8");
    padGroup->writeEntry("Button9", "Button 9");
    padGroup->writeEntry("Button10", "Button 10");
    padGroup->writeEntry("StripLUp", "Button 11");
    padGroup->writeEntry("StripLDn", "Button 12");
    padGroup->writeEntry("StripRUp", "Button 13");
    padGroup->writeEntry("StripRDn", "Button 14");
    padGroup->writeEntry("RelWUp", "Button 15");
    padGroup->writeEntry("RelWDn", "Button 16");
    padGroup->writeEntry("AbsWUp", "Button 15");
    padGroup->writeEntry("AbsWDn", "Button 16");
    //padGroup->writeEntry("TPCButton", "On");
    padGroup->writeEntry("Rotate", "none");

    QDBusReply<QString> topX = m_deviceInterface->call("getDefaultConfiguration", QString(padName), "TopX");
    if (topX.isValid()) {
        padGroup->writeEntry("TopX", topX.value());
    } else {
        padGroup->writeEntry("TopX", "0");
    }
    QDBusReply<QString> topY = m_deviceInterface->call("getDefaultConfiguration", QString(padName), "TopY");
    if (topY.isValid()) {
        padGroup->writeEntry("TopY", topY.value());
    } else {
        padGroup->writeEntry("TopY", "0");
    }
    QDBusReply<QString> bottomX = m_deviceInterface->call("getDefaultConfiguration", QString(padName), "BottomX");
    if (bottomX.isValid()) {
        padGroup->writeEntry("BottomX", bottomX.value());
    } else {
        padGroup->writeEntry("BottomX", "0");
    }
    QDBusReply<QString> bottomY = m_deviceInterface->call("getDefaultConfiguration", QString(padName), "BottomY");
    if (bottomY.isValid()) {
        padGroup->writeEntry("BottomY", bottomY.value());
    } else {
        padGroup->writeEntry("BottomY", "0");
    }

    padGroup->sync();
    profileGroup->sync();
    deviceGroup->sync();
    delete padGroup;

    // write default config for the stylus
    KConfigGroup *stylusGroup = new KConfigGroup(profileGroup, "stylus");

    stylusGroup->writeEntry("Button1", "Button 1");
    stylusGroup->writeEntry("Button2", "Button 2");
    stylusGroup->writeEntry("Button3", "Button 3");
    //stylusGroup->writeEntry("Suppress", "todo");
    //stylusGroup->writeEntry("RawSample", "todo");
    stylusGroup->writeEntry("PressCurve", "0 0 100 100");
    stylusGroup->writeEntry("Mode", "absolute");
    stylusGroup->writeEntry("CursorProx", "42"); //@todo get/set values that give a better feeling for it.Might have a bug in my wacom-tools because its alwas -1 here
    //stylusGroup->writeEntry("RawFilter", "todo");
    stylusGroup->writeEntry("SpeedLevel", "6");
    stylusGroup->writeEntry("ClickForce", "6");
    stylusGroup->writeEntry("Threshold", "30");
    stylusGroup->writeEntry("Accel", "1");
    stylusGroup->writeEntry("0TwinView", "0");
    stylusGroup->writeEntry("1TVResolution0", "0 0");
    stylusGroup->writeEntry("1TVResolution1", "0 0");
    stylusGroup->writeEntry("mmonitor", "1");
    stylusGroup->writeEntry("Screen_No", "-1");

    stylusGroup->sync();
    profileGroup->sync();
    deviceGroup->sync();
    delete stylusGroup;

    // write default config for the eraser
    KConfigGroup *eraserGroup = new KConfigGroup(profileGroup, "eraser");

    eraserGroup->writeEntry("Button1", "Button 1");
    eraserGroup->writeEntry("Button2", "Button 2");
    eraserGroup->writeEntry("Button3", "Button 3");
    //eraserGroup->writeEntry("Suppress", "todo");
    //eraserGroup->writeEntry("RawSample", "todo");
    eraserGroup->writeEntry("PressCurve", "0 0 100 100");
    eraserGroup->writeEntry("Mode", "absolute");
    //eraserGroup->writeEntry("CursorProx", "42"); //@todo get/set values that give a better feeling for it.Might have a bug in my wacom-tools because its alwas -1 here
    //eraserGroup->writeEntry("RawFilter", "todo");
    eraserGroup->writeEntry("SpeedLevel", "6");
    eraserGroup->writeEntry("ClickForce", "6");
    eraserGroup->writeEntry("Threshold", "30");
    eraserGroup->writeEntry("Accel", "1");
    eraserGroup->writeEntry("0TwinView", "0");
    eraserGroup->writeEntry("1TVResolution0", "0 0");
    eraserGroup->writeEntry("1TVResolution1", "0 0");
    eraserGroup->writeEntry("mmonitor", "1");
    eraserGroup->writeEntry("Screen_No", "-1");

    eraserGroup->sync();
    profileGroup->sync();
    deviceGroup->sync();
    delete eraserGroup;
}


Generated by  Doxygen 1.6.0   Back to index