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

Constructor & Destructor Documentation

◆ TabletSettingsTab()

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

Definition at line 1784 of file kis_dlg_preferences.cc.

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

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

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

◆ slotResolutionSettings

void TabletSettingsTab::slotResolutionSettings ( )
privateslot

Definition at line 1884 of file kis_dlg_preferences.cc.

1885{
1886#ifdef Q_OS_WIN
1888 dlg.exec();
1889#endif
1890}

◆ slotTabletTest

void TabletSettingsTab::slotTabletTest ( )
privateslot

Definition at line 1874 of file kis_dlg_preferences.cc.

1875{
1876 TabletTestDialog tabletTestDialog(this);
1877 tabletTestDialog.exec();
1878}

Member Data Documentation

◆ m_page

WdgTabletSettings* TabletSettingsTab::m_page

Definition at line 261 of file kis_dlg_preferences.h.


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