int UBDrawingController::currentToolWidthIndex() { if (stylusTool() == UBStylusTool::Pen || stylusTool() == UBStylusTool::Line) return UBSettings::settings()->penWidthIndex(); else if (stylusTool() == UBStylusTool::Marker) return UBSettings::settings()->markerWidthIndex(); else return -1; }
qreal UBDrawingController::currentToolWidth() { if (stylusTool() == UBStylusTool::Pen || stylusTool() == UBStylusTool::Line) return UBSettings::settings()->currentPenWidth(); else if (stylusTool() == UBStylusTool::Marker) return UBSettings::settings()->currentMarkerWidth(); else //failsafe return UBSettings::settings()->currentPenWidth(); }
int UBDrawingController::currentToolColorIndex() { if (stylusTool() == UBStylusTool::Pen || stylusTool() == UBStylusTool::Line) { return UBSettings::settings()->penColorIndex(); } else if (stylusTool() == UBStylusTool::Marker) { return UBSettings::settings()->markerColorIndex(); } else { return -1; } }
void UBDrawingController::setLineWidthIndex(int index) { if (stylusTool() == UBStylusTool::Marker) { UBSettings::settings()->setMarkerWidthIndex(index); } else { UBSettings::settings()->setPenWidthIndex(index); if(stylusTool() != UBStylusTool::Line && stylusTool() != UBStylusTool::Selector) { setStylusTool(UBStylusTool::Pen); } } emit lineWidthIndexChanged(index); }
QColor UBDrawingController::toolColor(bool onDarkBackground) { if (stylusTool() == UBStylusTool::Pen || stylusTool() == UBStylusTool::Line) { return UBSettings::settings()->penColor(onDarkBackground); } else if (stylusTool() == UBStylusTool::Marker) { return UBSettings::settings()->markerColor(onDarkBackground); } else { //failsafe if (onDarkBackground) { return Qt::white; } else { return Qt::black; } } }
void UBDrawingController::setColorIndex(int index) { Q_ASSERT(index >= 0 && index < UBSettings::settings()->colorPaletteSize); if (stylusTool() == UBStylusTool::Marker) { UBSettings::settings()->setMarkerColorIndex(index); } else { UBSettings::settings()->setPenColorIndex(index); } emit colorIndexChanged(index); }
bool UBDrawingController::isDrawingTool() { return (stylusTool() == UBStylusTool::Pen) || (stylusTool() == UBStylusTool::Marker) || (stylusTool() == UBStylusTool::Line); }