35 KGuiItem::assign(
ui->btnBox->button(QDialogButtonBox::Ok), KStandardGuiItem::ok());
36 KGuiItem::assign(
ui->btnBox->button(QDialogButtonBox::Cancel), KStandardGuiItem::cancel());
37 connect(
ui->btnBox, SIGNAL(rejected()),
this, SLOT(reject()));
40 connect(
ui->radioCustomMapping, SIGNAL(toggled(
bool)),
ui->lblXOffset, SLOT(setEnabled(
bool)));
41 connect(
ui->radioCustomMapping, SIGNAL(toggled(
bool)),
ui->lblYOffset, SLOT(setEnabled(
bool)));
42 connect(
ui->radioCustomMapping, SIGNAL(toggled(
bool)),
ui->lblWidth, SLOT(setEnabled(
bool)));
43 connect(
ui->radioCustomMapping, SIGNAL(toggled(
bool)),
ui->lblHeight, SLOT(setEnabled(
bool)));
45 connect(
ui->radioCustomMapping, SIGNAL(toggled(
bool)),
ui->intXOffset, SLOT(setEnabled(
bool)));
46 connect(
ui->radioCustomMapping, SIGNAL(toggled(
bool)),
ui->intYOffset, SLOT(setEnabled(
bool)));
47 connect(
ui->radioCustomMapping, SIGNAL(toggled(
bool)),
ui->intWidth, SLOT(setEnabled(
bool)));
48 connect(
ui->radioCustomMapping, SIGNAL(toggled(
bool)),
ui->intHeight, SLOT(setEnabled(
bool)));
52 ui->radioMapToEntireScreen->setText(i18nc(
"@option:radio",
"Map to entire virtual screen (%1)", rectToString(virtualScreenRect)));
54 QRect nativeScreenRect;
55 QPlatformScreen *screen = qGuiApp->primaryScreen()->handle();
56 Q_FOREACH (QPlatformScreen *scr, screen->virtualSiblings()) {
57 nativeScreenRect |= scr->geometry();
60 QRect customScreenRect = virtualScreenRect;
64 ui->radioCustomMapping->setChecked(
true);
66 ui->radioMapToEntireScreen->setChecked(
true);
68 ui->radioMapAsWintab->setChecked(
true);
71 ui->intXOffset->setValue(customScreenRect.x());
72 ui->intYOffset->setValue(customScreenRect.y());
73 ui->intWidth->setValue(customScreenRect.width());
74 ui->intHeight->setValue(customScreenRect.height());
79 const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
80 QSettings cfg(configPath + QStringLiteral(
"/kritadisplayrc"), QSettings::IniFormat);
82 if (
ui->radioMapAsWintab->isChecked()) {
83 cfg.setValue(
"wintabResolutionMode",
"wintab");
84 }
else if (
ui->radioMapToEntireScreen->isChecked()) {
85 cfg.setValue(
"wintabResolutionMode",
"virtual-screen");
86 }
else if (
ui->radioCustomMapping->isChecked()) {
87 cfg.setValue(
"wintabResolutionMode",
"custom");
89 cfg.setValue(
"wintabCustomResolutionX",
ui->intXOffset->value());
90 cfg.setValue(
"wintabCustomResolutionY",
ui->intYOffset->value());
91 cfg.setValue(
"wintabCustomResolutionWidth",
ui->intWidth->value());
92 cfg.setValue(
"wintabCustomResolutionHeight",
ui->intHeight->value());
97 QRect customTabletRect;
122 const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
123 QSettings cfg(configPath + QStringLiteral(
"/kritadisplayrc"), QSettings::IniFormat);
125 const QString mode = cfg.value(
"wintabResolutionMode", QString(
"wintab")).toString();
128 if (mode ==
"custom") {
130 }
else if (mode ==
"virtual-screen") {
136 if (mode ==
"custom") {
137 customRect->setX(cfg.value(
"wintabCustomResolutionX", customRect->x()).toInt());
138 customRect->setY(cfg.value(
"wintabCustomResolutionY", customRect->y()).toInt());
139 customRect->setWidth(cfg.value(
"wintabCustomResolutionWidth", customRect->width()).toInt());
140 customRect->setHeight(cfg.value(
"wintabCustomResolutionHeight", customRect->height()).toInt());