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 253 of file kis_dlg_preferences.h.

Constructor & Destructor Documentation

◆ TabletSettingsTab()

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

Definition at line 1780 of file kis_dlg_preferences.cc.

1780 : QWidget(parent)
1781{
1782 setObjectName(name);
1783
1784 QGridLayout * l = new QGridLayout(this);
1785 l->setContentsMargins(0, 0, 0, 0);
1786 m_page = new WdgTabletSettings(this);
1787 l->addWidget(m_page, 0, 0);
1788
1789 KisConfig cfg(true);
1790 const KisCubicCurve curve(cfg.pressureTabletCurve());
1791 m_page->pressureCurve->setMaximumSize(QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX));
1792 m_page->pressureCurve->setCurve(curve);
1793
1794 m_page->chkUseRightMiddleClickWorkaround->setChecked(
1795 cfg.useRightMiddleTabletButtonWorkaround());
1796
1797#if defined Q_OS_WIN && (defined QT5_HAS_WINTAB_SWITCH || QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
1798# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
1799 QString actualTabletProtocol = "<unknown>";
1800 using QWindowsApplication = QNativeInterface::Private::QWindowsApplication;
1801 if (auto nativeWindowsApp = dynamic_cast<QWindowsApplication *>(QGuiApplicationPrivate::platformIntegration())) {
1802 actualTabletProtocol = nativeWindowsApp->isWinTabEnabled() ? "WinTab" : "Windows Ink";
1803 }
1804 m_page->grpTabletApi->setTitle(i18n("Tablet Input API (currently active API: \"%1\")", actualTabletProtocol));
1805# endif
1806 m_page->radioWintab->setChecked(!cfg.useWin8PointerInput());
1807 m_page->radioWin8PointerInput->setChecked(cfg.useWin8PointerInput());
1808
1809 connect(m_page->btnResolutionSettings, SIGNAL(clicked()), SLOT(slotResolutionSettings()));
1810 connect(m_page->radioWintab, SIGNAL(toggled(bool)), m_page->btnResolutionSettings, SLOT(setEnabled(bool)));
1811 m_page->btnResolutionSettings->setEnabled(m_page->radioWintab->isChecked());
1812#else
1813 m_page->grpTabletApi->setVisible(false);
1814#endif
1815 connect(m_page->btnTabletTest, SIGNAL(clicked()), SLOT(slotTabletTest()));
1816
1817#ifdef Q_OS_WIN
1818 m_page->chkUseTimestampsForBrushSpeed->setText(i18n("Use tablet driver timestamps for brush speed (may cause severe artifacts when using WinTab tablet API)"));
1819#else
1820 m_page->chkUseTimestampsForBrushSpeed->setText(i18n("Use tablet driver timestamps for brush speed"));
1821#endif
1822 m_page->chkUseTimestampsForBrushSpeed->setChecked(cfg.readEntry("useTimestampsForBrushSpeed", false));
1823
1824#if KRITA_QT_HAS_ANDROID_EMULATE_MOUSE_BUTTONS_FOR_PAGE_UP_DOWN
1825 m_page->chkUsePageUpDownMouseButtonEmulationWorkaround->setChecked(
1826 cfg.usePageUpDownMouseButtonEmulationWorkaround());
1827#else
1828 m_page->chkUsePageUpDownMouseButtonEmulationWorkaround->hide();
1829#endif
1830
1831#if KRITA_QT_HAS_ANDROID_EMULATE_MOUSE_BUTTONS_FOR_HIGH_FUNCTION_KEYS
1832 m_page->chkUseHighFunctionKeyMouseButtonEmulationWorkaround->setChecked(
1833 cfg.useHighFunctionKeyMouseButtonEmulationWorkaround());
1834#else
1835 m_page->chkUseHighFunctionKeyMouseButtonEmulationWorkaround->hide();
1836#endif
1837
1838#if KRITA_QT_HAS_ANDROID_IGNORE_HISTORIC_TABLET_EVENTS
1839 m_page->chkUseIgnoreHistoricTabletEventsWorkaround->setChecked(cfg.useIgnoreHistoricTabletEventsWorkaround());
1840#else
1841 m_page->chkUseIgnoreHistoricTabletEventsWorkaround->hide();
1842#endif
1843
1844 m_page->intMaxAllowedBrushSpeed->setRange(1, 100);
1845 m_page->intMaxAllowedBrushSpeed->setValue(cfg.readEntry("maxAllowedSpeedValue", 30));
1846 KisSpinBoxI18nHelper::install(m_page->intMaxAllowedBrushSpeed, [](int value) {
1847 // i18n: This is meant to be used in a spinbox so keep the {n} in the text
1848 // and it will be substituted by the number. The text before will be
1849 // used as the prefix and the text after as the suffix
1850 return i18np("Maximum brush speed: {n} px/ms", "Maximum brush speed: {n} px/ms", value);
1851 });
1852
1853 m_page->intBrushSpeedSmoothing->setRange(3, 100);
1854 m_page->intBrushSpeedSmoothing->setValue(cfg.readEntry("speedValueSmoothing", 3));
1855 KisSpinBoxI18nHelper::install(m_page->intBrushSpeedSmoothing, [](int value) {
1856 // i18n: This is meant to be used in a spinbox so keep the {n} in the text
1857 // and it will be substituted by the number. The text before will be
1858 // used as the prefix and the text after as the suffix
1859 return i18np("Brush speed smoothing: {n} sample", "Brush speed smoothing: {n} samples", value);
1860 });
1861
1862 m_page->tiltDirectionOffsetAngle->setDecimals(0);
1863 m_page->tiltDirectionOffsetAngle->setRange(-180, 180);
1864 // the angle is saved in clockwise direction to be consistent with Drawing Angle, so negate
1865 m_page->tiltDirectionOffsetAngle->setAngle(-cfg.readEntry("tiltDirectionOffset", 0.0));
1866 m_page->tiltDirectionOffsetAngle->setPrefix(i18n("Pen tilt direction offset: "));
1867 m_page->tiltDirectionOffsetAngle->setFlipOptionsMode(KisAngleSelector::FlipOptionsMode_MenuButton);
1868}
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 1744 of file kis_dlg_preferences.cc.

1745{
1746 KisConfig cfg(true);
1747 const KisCubicCurve curve(cfg.pressureTabletCurve(true));
1748 m_page->pressureCurve->setCurve(curve);
1749
1750 m_page->chkUseRightMiddleClickWorkaround->setChecked(
1751 KisConfig(true).useRightMiddleTabletButtonWorkaround(true));
1752
1753#if defined Q_OS_WIN && (defined QT5_HAS_WINTAB_SWITCH || QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
1754 m_page->radioWintab->setChecked(!cfg.useWin8PointerInput(true));
1755 m_page->radioWin8PointerInput->setChecked(cfg.useWin8PointerInput(true));
1756#else
1757 m_page->grpTabletApi->setVisible(false);
1758#endif
1759
1760#if KRITA_QT_HAS_ANDROID_EMULATE_MOUSE_BUTTONS_FOR_PAGE_UP_DOWN
1761 m_page->chkUsePageUpDownMouseButtonEmulationWorkaround->setChecked(
1762 cfg.usePageUpDownMouseButtonEmulationWorkaround(true));
1763#endif
1764
1765#if KRITA_QT_HAS_ANDROID_EMULATE_MOUSE_BUTTONS_FOR_HIGH_FUNCTION_KEYS
1766 m_page->chkUseHighFunctionKeyMouseButtonEmulationWorkaround->setChecked(
1767 cfg.useHighFunctionKeyMouseButtonEmulationWorkaround(true));
1768#endif
1769
1770#if KRITA_QT_HAS_ANDROID_IGNORE_HISTORIC_TABLET_EVENTS
1771 m_page->chkUseIgnoreHistoricTabletEventsWorkaround->setChecked(cfg.useIgnoreHistoricTabletEventsWorkaround(true));
1772#endif
1773
1774 m_page->chkUseTimestampsForBrushSpeed->setChecked(false);
1775 m_page->intMaxAllowedBrushSpeed->setValue(30);
1776 m_page->intBrushSpeedSmoothing->setValue(3);
1777 m_page->tiltDirectionOffsetAngle->setAngle(0);
1778}

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

◆ slotResolutionSettings

void TabletSettingsTab::slotResolutionSettings ( )
privateslot

Definition at line 1880 of file kis_dlg_preferences.cc.

1881{
1882#ifdef Q_OS_WIN
1884 dlg.exec();
1885#endif
1886}

◆ slotTabletTest

void TabletSettingsTab::slotTabletTest ( )
privateslot

Definition at line 1870 of file kis_dlg_preferences.cc.

1871{
1872 TabletTestDialog tabletTestDialog(this);
1873 tabletTestDialog.exec();
1874}

Member Data Documentation

◆ m_page

WdgTabletSettings* TabletSettingsTab::m_page

Definition at line 264 of file kis_dlg_preferences.h.


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