Krita Source Code Documentation
Loading...
Searching...
No Matches
TabletSettingsTab Class Reference

#include <kis_dlg_preferences.h>

+ Inheritance diagram for TabletSettingsTab:

Public Member Functions

void setDefault ()
 
 TabletSettingsTab (QWidget *parent=0, const char *name=0)
 

Public Attributes

WdgTabletSettingsm_page
 

Private Slots

void slotResolutionSettings ()
 
void slotTabletTest ()
 

Detailed Description

Definition at line 235 of file kis_dlg_preferences.h.

Constructor & Destructor Documentation

◆ TabletSettingsTab()

TabletSettingsTab::TabletSettingsTab ( QWidget * parent = 0,
const char * name = 0 )

Definition at line 1640 of file kis_dlg_preferences.cc.

1640 : QWidget(parent)
1641{
1642 setObjectName(name);
1643
1644 QGridLayout * l = new QGridLayout(this);
1645 l->setContentsMargins(0, 0, 0, 0);
1646 m_page = new WdgTabletSettings(this);
1647 l->addWidget(m_page, 0, 0);
1648
1649 KisConfig cfg(true);
1650 const KisCubicCurve curve(cfg.pressureTabletCurve());
1651 m_page->pressureCurve->setMaximumSize(QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX));
1652 m_page->pressureCurve->setCurve(curve);
1653
1654 m_page->chkUseRightMiddleClickWorkaround->setChecked(
1655 cfg.useRightMiddleTabletButtonWorkaround());
1656
1657#if defined Q_OS_WIN && (defined QT5_HAS_WINTAB_SWITCH || QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
1658# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
1659 QString actualTabletProtocol = "<unknown>";
1660 using QWindowsApplication = QNativeInterface::Private::QWindowsApplication;
1661 if (auto nativeWindowsApp = dynamic_cast<QWindowsApplication *>(QGuiApplicationPrivate::platformIntegration())) {
1662 actualTabletProtocol = nativeWindowsApp->isWinTabEnabled() ? "WinTab" : "Windows Ink";
1663 }
1664 m_page->grpTabletApi->setTitle(i18n("Tablet Input API (currently active API: \"%1\")", actualTabletProtocol));
1665# endif
1666 m_page->radioWintab->setChecked(!cfg.useWin8PointerInput());
1667 m_page->radioWin8PointerInput->setChecked(cfg.useWin8PointerInput());
1668
1669 connect(m_page->btnResolutionSettings, SIGNAL(clicked()), SLOT(slotResolutionSettings()));
1670 connect(m_page->radioWintab, SIGNAL(toggled(bool)), m_page->btnResolutionSettings, SLOT(setEnabled(bool)));
1671 m_page->btnResolutionSettings->setEnabled(m_page->radioWintab->isChecked());
1672#else
1673 m_page->grpTabletApi->setVisible(false);
1674#endif
1675 connect(m_page->btnTabletTest, SIGNAL(clicked()), SLOT(slotTabletTest()));
1676
1677#ifdef Q_OS_WIN
1678 m_page->chkUseTimestampsForBrushSpeed->setText(i18n("Use tablet driver timestamps for brush speed (may cause severe artifacts when using WinTab tablet API)"));
1679#else
1680 m_page->chkUseTimestampsForBrushSpeed->setText(i18n("Use tablet driver timestamps for brush speed"));
1681#endif
1682 m_page->chkUseTimestampsForBrushSpeed->setChecked(cfg.readEntry("useTimestampsForBrushSpeed", false));
1683
1684#if KRITA_QT_HAS_ANDROID_EMULATE_MOUSE_BUTTONS_FOR_PAGE_UP_DOWN
1685 m_page->chkUsePageUpDownMouseButtonEmulationWorkaround->setChecked(
1686 cfg.usePageUpDownMouseButtonEmulationWorkaround());
1687#else
1688 m_page->chkUsePageUpDownMouseButtonEmulationWorkaround->hide();
1689#endif
1690
1691#if KRITA_QT_HAS_ANDROID_EMULATE_MOUSE_BUTTONS_FOR_HIGH_FUNCTION_KEYS
1692 m_page->chkUseHighFunctionKeyMouseButtonEmulationWorkaround->setChecked(
1693 cfg.useHighFunctionKeyMouseButtonEmulationWorkaround());
1694#else
1695 m_page->chkUseHighFunctionKeyMouseButtonEmulationWorkaround->hide();
1696#endif
1697
1698#if KRITA_QT_HAS_ANDROID_IGNORE_HISTORIC_TABLET_EVENTS
1699 m_page->chkUseIgnoreHistoricTabletEventsWorkaround->setChecked(cfg.useIgnoreHistoricTabletEventsWorkaround());
1700#else
1701 m_page->chkUseIgnoreHistoricTabletEventsWorkaround->hide();
1702#endif
1703
1704 m_page->intMaxAllowedBrushSpeed->setRange(1, 100);
1705 m_page->intMaxAllowedBrushSpeed->setValue(cfg.readEntry("maxAllowedSpeedValue", 30));
1706 KisSpinBoxI18nHelper::install(m_page->intMaxAllowedBrushSpeed, [](int value) {
1707 // i18n: This is meant to be used in a spinbox so keep the {n} in the text
1708 // and it will be substituted by the number. The text before will be
1709 // used as the prefix and the text after as the suffix
1710 return i18np("Maximum brush speed: {n} px/ms", "Maximum brush speed: {n} px/ms", value);
1711 });
1712
1713 m_page->intBrushSpeedSmoothing->setRange(3, 100);
1714 m_page->intBrushSpeedSmoothing->setValue(cfg.readEntry("speedValueSmoothing", 3));
1715 KisSpinBoxI18nHelper::install(m_page->intBrushSpeedSmoothing, [](int value) {
1716 // i18n: This is meant to be used in a spinbox so keep the {n} in the text
1717 // and it will be substituted by the number. The text before will be
1718 // used as the prefix and the text after as the suffix
1719 return i18np("Brush speed smoothing: {n} sample", "Brush speed smoothing: {n} samples", value);
1720 });
1721
1722 m_page->tiltDirectionOffsetAngle->setDecimals(0);
1723 m_page->tiltDirectionOffsetAngle->setRange(-180, 180);
1724 // the angle is saved in clockwise direction to be consistent with Drawing Angle, so negate
1725 m_page->tiltDirectionOffsetAngle->setAngle(-cfg.readEntry("tiltDirectionOffset", 0.0));
1726 m_page->tiltDirectionOffsetAngle->setPrefix(i18n("Pen tilt direction offset: "));
1727 m_page->tiltDirectionOffsetAngle->setFlipOptionsMode(KisAngleSelector::FlipOptionsMode_MenuButton);
1728}
float value(const T *src, size_t ch)
@ FlipOptionsMode_MenuButton
The flip options are shown as a menu accessible via a options button.
WdgTabletSettings * m_page
void install(QSpinBox *spinBox, std::function< QString(int)> messageFn)

References KisAngleSelector::FlipOptionsMode_MenuButton, KisSpinBoxI18nHelper::install(), m_page, KisConfig::pressureTabletCurve(), KisConfig::readEntry(), slotResolutionSettings(), slotTabletTest(), KisConfig::useRightMiddleTabletButtonWorkaround(), KisConfig::useWin8PointerInput(), and value().

Member Function Documentation

◆ setDefault()

void TabletSettingsTab::setDefault ( )

Definition at line 1604 of file kis_dlg_preferences.cc.

1605{
1606 KisConfig cfg(true);
1607 const KisCubicCurve curve(cfg.pressureTabletCurve(true));
1608 m_page->pressureCurve->setCurve(curve);
1609
1610 m_page->chkUseRightMiddleClickWorkaround->setChecked(
1611 KisConfig(true).useRightMiddleTabletButtonWorkaround(true));
1612
1613#if defined Q_OS_WIN && (defined QT5_HAS_WINTAB_SWITCH || QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
1614 m_page->radioWintab->setChecked(!cfg.useWin8PointerInput(true));
1615 m_page->radioWin8PointerInput->setChecked(cfg.useWin8PointerInput(true));
1616#else
1617 m_page->grpTabletApi->setVisible(false);
1618#endif
1619
1620#if KRITA_QT_HAS_ANDROID_EMULATE_MOUSE_BUTTONS_FOR_PAGE_UP_DOWN
1621 m_page->chkUsePageUpDownMouseButtonEmulationWorkaround->setChecked(
1622 cfg.usePageUpDownMouseButtonEmulationWorkaround(true));
1623#endif
1624
1625#if KRITA_QT_HAS_ANDROID_EMULATE_MOUSE_BUTTONS_FOR_HIGH_FUNCTION_KEYS
1626 m_page->chkUseHighFunctionKeyMouseButtonEmulationWorkaround->setChecked(
1627 cfg.useHighFunctionKeyMouseButtonEmulationWorkaround(true));
1628#endif
1629
1630#if KRITA_QT_HAS_ANDROID_IGNORE_HISTORIC_TABLET_EVENTS
1631 m_page->chkUseIgnoreHistoricTabletEventsWorkaround->setChecked(cfg.useIgnoreHistoricTabletEventsWorkaround(true));
1632#endif
1633
1634 m_page->chkUseTimestampsForBrushSpeed->setChecked(false);
1635 m_page->intMaxAllowedBrushSpeed->setValue(30);
1636 m_page->intBrushSpeedSmoothing->setValue(3);
1637 m_page->tiltDirectionOffsetAngle->setAngle(0);
1638}

References m_page, KisConfig::pressureTabletCurve(), and KisConfig::useWin8PointerInput().

◆ slotResolutionSettings

void TabletSettingsTab::slotResolutionSettings ( )
privateslot

Definition at line 1740 of file kis_dlg_preferences.cc.

1741{
1742#ifdef Q_OS_WIN
1744 dlg.exec();
1745#endif
1746}

◆ slotTabletTest

void TabletSettingsTab::slotTabletTest ( )
privateslot

Definition at line 1730 of file kis_dlg_preferences.cc.

1731{
1732 TabletTestDialog tabletTestDialog(this);
1733 tabletTestDialog.exec();
1734}

Member Data Documentation

◆ m_page

WdgTabletSettings* TabletSettingsTab::m_page

Definition at line 246 of file kis_dlg_preferences.h.


The documentation for this class was generated from the following files: