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

Constructor & Destructor Documentation

◆ TabletSettingsTab()

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

Definition at line 1753 of file kis_dlg_preferences.cc.

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

1718{
1719 KisConfig cfg(true);
1720 const KisCubicCurve curve(cfg.pressureTabletCurve(true));
1721 m_page->pressureCurve->setCurve(curve);
1722
1723 m_page->chkUseRightMiddleClickWorkaround->setChecked(
1724 KisConfig(true).useRightMiddleTabletButtonWorkaround(true));
1725
1726#if defined Q_OS_WIN && (defined QT5_HAS_WINTAB_SWITCH || QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
1727 m_page->radioWintab->setChecked(!cfg.useWin8PointerInput(true));
1728 m_page->radioWin8PointerInput->setChecked(cfg.useWin8PointerInput(true));
1729#else
1730 m_page->grpTabletApi->setVisible(false);
1731#endif
1732
1733#if KRITA_QT_HAS_ANDROID_EMULATE_MOUSE_BUTTONS_FOR_PAGE_UP_DOWN
1734 m_page->chkUsePageUpDownMouseButtonEmulationWorkaround->setChecked(
1735 cfg.usePageUpDownMouseButtonEmulationWorkaround(true));
1736#endif
1737
1738#if KRITA_QT_HAS_ANDROID_EMULATE_MOUSE_BUTTONS_FOR_HIGH_FUNCTION_KEYS
1739 m_page->chkUseHighFunctionKeyMouseButtonEmulationWorkaround->setChecked(
1740 cfg.useHighFunctionKeyMouseButtonEmulationWorkaround(true));
1741#endif
1742
1743#if KRITA_QT_HAS_ANDROID_IGNORE_HISTORIC_TABLET_EVENTS
1744 m_page->chkUseIgnoreHistoricTabletEventsWorkaround->setChecked(cfg.useIgnoreHistoricTabletEventsWorkaround(true));
1745#endif
1746
1747 m_page->chkUseTimestampsForBrushSpeed->setChecked(false);
1748 m_page->intMaxAllowedBrushSpeed->setValue(30);
1749 m_page->intBrushSpeedSmoothing->setValue(3);
1750 m_page->tiltDirectionOffsetAngle->setAngle(0);
1751}

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

◆ slotResolutionSettings

void TabletSettingsTab::slotResolutionSettings ( )
privateslot

Definition at line 1853 of file kis_dlg_preferences.cc.

1854{
1855#ifdef Q_OS_WIN
1857 dlg.exec();
1858#endif
1859}

◆ slotTabletTest

void TabletSettingsTab::slotTabletTest ( )
privateslot

Definition at line 1843 of file kis_dlg_preferences.cc.

1844{
1845 TabletTestDialog tabletTestDialog(this);
1846 tabletTestDialog.exec();
1847}

Member Data Documentation

◆ m_page

WdgTabletSettings* TabletSettingsTab::m_page

Definition at line 258 of file kis_dlg_preferences.h.


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