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

WdgTabletSettings * m_page
 

Private Slots

void slotResolutionSettings ()
 
void slotTabletTest ()
 

Detailed Description

Definition at line 258 of file kis_dlg_preferences.h.

Constructor & Destructor Documentation

◆ TabletSettingsTab()

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

Definition at line 1818 of file kis_dlg_preferences.cc.

1818 : QWidget(parent)
1819{
1820 setObjectName(name);
1821
1822 QGridLayout * l = new QGridLayout(this);
1823 l->setContentsMargins(0, 0, 0, 0);
1824 m_page = new WdgTabletSettings(this);
1825 l->addWidget(m_page, 0, 0);
1826
1827 KisConfig cfg(true);
1828 const KisCubicCurve curve(cfg.pressureTabletCurve());
1829 m_page->pressureCurve->setMaximumSize(QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX));
1830 m_page->pressureCurve->setCurve(curve);
1831
1832 m_page->chkUseRightMiddleClickWorkaround->setChecked(
1833 cfg.useRightMiddleTabletButtonWorkaround());
1834
1835#if defined Q_OS_WIN && (defined QT5_HAS_WINTAB_SWITCH || QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
1836# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
1837 QString actualTabletProtocol = "<unknown>";
1838 using QWindowsApplication = QNativeInterface::Private::QWindowsApplication;
1839 if (auto nativeWindowsApp = dynamic_cast<QWindowsApplication *>(QGuiApplicationPrivate::platformIntegration())) {
1840 actualTabletProtocol = nativeWindowsApp->isWinTabEnabled() ? "WinTab" : "Windows Ink";
1841 }
1842 m_page->grpTabletApi->setTitle(i18n("Tablet Input API (currently active API: \"%1\")", actualTabletProtocol));
1843# endif
1844 m_page->radioWintab->setChecked(!cfg.useWin8PointerInput());
1845 m_page->radioWin8PointerInput->setChecked(cfg.useWin8PointerInput());
1846
1847 connect(m_page->btnResolutionSettings, SIGNAL(clicked()), SLOT(slotResolutionSettings()));
1848 connect(m_page->radioWintab, SIGNAL(toggled(bool)), m_page->btnResolutionSettings, SLOT(setEnabled(bool)));
1849 m_page->btnResolutionSettings->setEnabled(m_page->radioWintab->isChecked());
1850#else
1851 m_page->grpTabletApi->setVisible(false);
1852#endif
1853 connect(m_page->btnTabletTest, SIGNAL(clicked()), SLOT(slotTabletTest()));
1854
1855#ifdef Q_OS_WIN
1856 m_page->chkUseTimestampsForBrushSpeed->setText(i18n("Use tablet driver timestamps for brush speed (may cause severe artifacts when using WinTab tablet API)"));
1857#else
1858 m_page->chkUseTimestampsForBrushSpeed->setText(i18n("Use tablet driver timestamps for brush speed"));
1859#endif
1860 m_page->chkUseTimestampsForBrushSpeed->setChecked(cfg.readEntry("useTimestampsForBrushSpeed", false));
1861
1862#if KRITA_QT_HAS_ANDROID_EMULATE_MOUSE_BUTTONS_FOR_PAGE_UP_DOWN
1863 m_page->chkUsePageUpDownMouseButtonEmulationWorkaround->setChecked(
1864 cfg.usePageUpDownMouseButtonEmulationWorkaround());
1865#else
1866 m_page->chkUsePageUpDownMouseButtonEmulationWorkaround->hide();
1867#endif
1868
1869#if KRITA_QT_HAS_ANDROID_EMULATE_MOUSE_BUTTONS_FOR_HIGH_FUNCTION_KEYS
1870 m_page->chkUseHighFunctionKeyMouseButtonEmulationWorkaround->setChecked(
1871 cfg.useHighFunctionKeyMouseButtonEmulationWorkaround());
1872#else
1873 m_page->chkUseHighFunctionKeyMouseButtonEmulationWorkaround->hide();
1874#endif
1875
1876#if KRITA_QT_HAS_ANDROID_IGNORE_HISTORIC_TABLET_EVENTS
1877 m_page->chkUseIgnoreHistoricTabletEventsWorkaround->setChecked(cfg.useIgnoreHistoricTabletEventsWorkaround());
1878#else
1879 m_page->chkUseIgnoreHistoricTabletEventsWorkaround->hide();
1880#endif
1881
1882#ifdef Q_OS_ANDROID
1884 m_page->chkHideTouchAndStylusCursorsWorkaround->setChecked(cfg.hideTouchAndStylusCursorsWorkaround());
1885 } else {
1886 m_page->chkHideTouchAndStylusCursorsWorkaround->hide();
1887 }
1888#else
1889 m_page->chkHideTouchAndStylusCursorsWorkaround->hide();
1890#endif
1891
1892 m_page->intMaxAllowedBrushSpeed->setRange(1, 100);
1893 m_page->intMaxAllowedBrushSpeed->setValue(cfg.readEntry("maxAllowedSpeedValue", 30));
1894 KisSpinBoxI18nHelper::install(m_page->intMaxAllowedBrushSpeed, [](int value) {
1895 // i18n: This is meant to be used in a spinbox so keep the {n} in the text
1896 // and it will be substituted by the number. The text before will be
1897 // used as the prefix and the text after as the suffix
1898 return i18np("Maximum brush speed: {n} px/ms", "Maximum brush speed: {n} px/ms", value);
1899 });
1900
1901 m_page->intBrushSpeedSmoothing->setRange(3, 100);
1902 m_page->intBrushSpeedSmoothing->setValue(cfg.readEntry("speedValueSmoothing", 3));
1903 KisSpinBoxI18nHelper::install(m_page->intBrushSpeedSmoothing, [](int value) {
1904 // i18n: This is meant to be used in a spinbox so keep the {n} in the text
1905 // and it will be substituted by the number. The text before will be
1906 // used as the prefix and the text after as the suffix
1907 return i18np("Brush speed smoothing: {n} sample", "Brush speed smoothing: {n} samples", value);
1908 });
1909
1910 m_page->tiltDirectionOffsetAngle->setDecimals(0);
1911 m_page->tiltDirectionOffsetAngle->setRange(-180, 180);
1912 // the angle is saved in clockwise direction to be consistent with Drawing Angle, so negate
1913 m_page->tiltDirectionOffsetAngle->setAngle(-cfg.readEntry("tiltDirectionOffset", 0.0));
1914 m_page->tiltDirectionOffsetAngle->setPrefix(i18n("Pen tilt direction offset: "));
1915 m_page->tiltDirectionOffsetAngle->setFlipOptionsMode(KisAngleSelector::FlipOptionsMode_MenuButton);
1916}
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
bool canHideTouchAndStylusCursors()
void install(QSpinBox *spinBox, std::function< QString(int)> messageFn)

References KisAndroidUtils::canHideTouchAndStylusCursors(), 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 1776 of file kis_dlg_preferences.cc.

1777{
1778 KisConfig cfg(true);
1779 const KisCubicCurve curve(cfg.pressureTabletCurve(true));
1780 m_page->pressureCurve->setCurve(curve);
1781
1782 m_page->chkUseRightMiddleClickWorkaround->setChecked(
1783 KisConfig(true).useRightMiddleTabletButtonWorkaround(true));
1784
1785#if defined Q_OS_WIN && (defined QT5_HAS_WINTAB_SWITCH || QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
1786 m_page->radioWintab->setChecked(!cfg.useWin8PointerInput(true));
1787 m_page->radioWin8PointerInput->setChecked(cfg.useWin8PointerInput(true));
1788#else
1789 m_page->grpTabletApi->setVisible(false);
1790#endif
1791
1792#if KRITA_QT_HAS_ANDROID_EMULATE_MOUSE_BUTTONS_FOR_PAGE_UP_DOWN
1793 m_page->chkUsePageUpDownMouseButtonEmulationWorkaround->setChecked(
1794 cfg.usePageUpDownMouseButtonEmulationWorkaround(true));
1795#endif
1796
1797#if KRITA_QT_HAS_ANDROID_EMULATE_MOUSE_BUTTONS_FOR_HIGH_FUNCTION_KEYS
1798 m_page->chkUseHighFunctionKeyMouseButtonEmulationWorkaround->setChecked(
1799 cfg.useHighFunctionKeyMouseButtonEmulationWorkaround(true));
1800#endif
1801
1802#if KRITA_QT_HAS_ANDROID_IGNORE_HISTORIC_TABLET_EVENTS
1803 m_page->chkUseIgnoreHistoricTabletEventsWorkaround->setChecked(cfg.useIgnoreHistoricTabletEventsWorkaround(true));
1804#endif
1805
1806#ifdef Q_OS_ANDROID
1808 m_page->chkHideTouchAndStylusCursorsWorkaround->setChecked(cfg.hideTouchAndStylusCursorsWorkaround(true));
1809 }
1810#endif
1811
1812 m_page->chkUseTimestampsForBrushSpeed->setChecked(false);
1813 m_page->intMaxAllowedBrushSpeed->setValue(30);
1814 m_page->intBrushSpeedSmoothing->setValue(3);
1815 m_page->tiltDirectionOffsetAngle->setAngle(0);
1816}

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

◆ slotResolutionSettings

void TabletSettingsTab::slotResolutionSettings ( )
privateslot

Definition at line 1928 of file kis_dlg_preferences.cc.

1929{
1930#ifdef Q_OS_WIN
1932 dlg.exec();
1933#endif
1934}

◆ slotTabletTest

void TabletSettingsTab::slotTabletTest ( )
privateslot

Definition at line 1918 of file kis_dlg_preferences.cc.

1919{
1920 TabletTestDialog tabletTestDialog(this);
1921 tabletTestDialog.exec();
1922}

Member Data Documentation

◆ m_page

WdgTabletSettings* TabletSettingsTab::m_page

Definition at line 269 of file kis_dlg_preferences.h.


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