void UBDrawingController::setStylusTool(int tool) { if (tool != mStylusTool) { if (mStylusTool == UBStylusTool::Pen || mStylusTool == UBStylusTool::Marker || mStylusTool == UBStylusTool::Line) { mLatestDrawingTool = mStylusTool; } if (tool == UBStylusTool::Pen || tool == UBStylusTool::Line) { emit lineWidthIndexChanged(UBSettings::settings()->penWidthIndex()); emit colorIndexChanged(UBSettings::settings()->penColorIndex()); } else if (tool == UBStylusTool::Marker) { emit lineWidthIndexChanged(UBSettings::settings()->markerWidthIndex()); emit colorIndexChanged(UBSettings::settings()->markerColorIndex()); } mStylusTool = (UBStylusTool::Enum)tool; if(eDrawingMode_Vector == DRAWING_MODE){ mDrawingMode = eDrawingMode_Vector; } if (mStylusTool == UBStylusTool::Pen) UBApplication::mainWindow->actionPen->setChecked(true); else if (mStylusTool == UBStylusTool::Eraser){ UBApplication::mainWindow->actionEraser->setChecked(true); mDrawingMode = eDrawingMode_Artistic; } else if (mStylusTool == UBStylusTool::Marker) UBApplication::mainWindow->actionMarker->setChecked(true); else if (mStylusTool == UBStylusTool::Selector) UBApplication::mainWindow->actionSelector->setChecked(true); else if (mStylusTool == UBStylusTool::Play) UBApplication::mainWindow->actionPlay->setChecked(true); else if (mStylusTool == UBStylusTool::Hand) UBApplication::mainWindow->actionHand->setChecked(true); else if (mStylusTool == UBStylusTool::ZoomIn) UBApplication::mainWindow->actionZoomIn->setChecked(true); else if (mStylusTool == UBStylusTool::ZoomOut) UBApplication::mainWindow->actionZoomOut->setChecked(true); else if (mStylusTool == UBStylusTool::Pointer) UBApplication::mainWindow->actionPointer->setChecked(true); else if (mStylusTool == UBStylusTool::Line) UBApplication::mainWindow->actionLine->setChecked(true); else if (mStylusTool == UBStylusTool::Text) UBApplication::mainWindow->actionText->setChecked(true); else if (mStylusTool == UBStylusTool::Capture) UBApplication::mainWindow->actionCapture->setChecked(true); emit stylusToolChanged(tool); emit colorPaletteChanged(); } }
UBDesktopPenPalette::UBDesktopPenPalette(QWidget *parent, UBRightPalette* rightPalette) : UBDesktopPropertyPalette(parent, rightPalette) { // Setup color choice widget QList<QAction *> colorActions; colorActions.append(UBApplication::mainWindow->actionColor0); colorActions.append(UBApplication::mainWindow->actionColor1); colorActions.append(UBApplication::mainWindow->actionColor2); colorActions.append(UBApplication::mainWindow->actionColor3); colorActions.append(UBApplication::mainWindow->actionColor4); UBToolbarButtonGroup *colorChoice = new UBToolbarButtonGroup(UBApplication::mainWindow->boardToolBar, colorActions); colorChoice->displayText(false); //connect(colorChoice, SIGNAL(activated(int)), this, SLOT(UBApplication::boardController->setColorIndex(int))); connect(UBDrawingController::drawingController(), SIGNAL(colorIndexChanged(int)), colorChoice, SLOT(setCurrentIndex(int))); connect(UBDrawingController::drawingController(), SIGNAL(colorIndexChanged(int)), this, SLOT(close())); connect(UBDrawingController::drawingController(), SIGNAL(colorPaletteChanged()), colorChoice, SLOT(colorPaletteChanged())); connect(UBDrawingController::drawingController(), SIGNAL(colorPaletteChanged()), this, SLOT(close())); layout()->addWidget(colorChoice); // Setup line width choice widget QList<QAction *> lineWidthActions; lineWidthActions.append(UBApplication::mainWindow->actionLineSmall); lineWidthActions.append(UBApplication::mainWindow->actionLineMedium); lineWidthActions.append(UBApplication::mainWindow->actionLineLarge); UBToolbarButtonGroup *lineWidthChoice = new UBToolbarButtonGroup(UBApplication::mainWindow->boardToolBar, lineWidthActions); lineWidthChoice->displayText(false); connect(lineWidthChoice, SIGNAL(activated(int)), UBDrawingController::drawingController(), SLOT(setLineWidthIndex(int))); connect(lineWidthChoice, SIGNAL(activated(int)), this, SLOT(close())); connect(UBDrawingController::drawingController(), SIGNAL(lineWidthIndexChanged(int)), lineWidthChoice, SLOT(setCurrentIndex(int))); connect(UBDrawingController::drawingController(), SIGNAL(lineWidthIndexChanged(int)), this, SLOT(close())); onParentMaximized(); layout()->addWidget(lineWidthChoice); }
void UBDrawingController::setMarkerAlpha(qreal alpha) { UBSettings::settings()->boardMarkerLightBackgroundColors->setAlpha(alpha); UBSettings::settings()->boardMarkerLightBackgroundSelectedColors->setAlpha(alpha); UBSettings::settings()->boardMarkerDarkBackgroundColors->setAlpha(alpha); UBSettings::settings()->boardMarkerDarkBackgroundSelectedColors->setAlpha(alpha); UBSettings::settings()->boardMarkerAlpha->set(alpha); emit colorPaletteChanged(); }
void UBDrawingController::setMarkerColor(bool onDarkBackground, const QColor& color, int pIndex) { if (onDarkBackground) { UBSettings::settings()->boardMarkerDarkBackgroundSelectedColors->setColor(pIndex, color); } else { UBSettings::settings()->boardMarkerLightBackgroundSelectedColors->setColor(pIndex, color); } emit colorPaletteChanged(); }
UBDrawingController::UBDrawingController(QObject * parent) : QObject(parent) , mActiveRuler(NULL) , mStylusTool((UBStylusTool::Enum)-1) , mLatestDrawingTool((UBStylusTool::Enum)-1) , mIsDesktopMode(false) { connect(UBSettings::settings(), SIGNAL(colorContextChanged()), this, SIGNAL(colorPaletteChanged())); connect(UBApplication::mainWindow->actionPen, SIGNAL(triggered(bool)), this, SLOT(penToolSelected(bool))); connect(UBApplication::mainWindow->actionEraser, SIGNAL(triggered(bool)), this, SLOT(eraserToolSelected(bool))); connect(UBApplication::mainWindow->actionMarker, SIGNAL(triggered(bool)), this, SLOT(markerToolSelected(bool))); connect(UBApplication::mainWindow->actionSelector, SIGNAL(triggered(bool)), this, SLOT(selectorToolSelected(bool))); connect(UBApplication::mainWindow->actionPlay, SIGNAL(triggered(bool)), this, SLOT(playToolSelected(bool))); connect(UBApplication::mainWindow->actionHand, SIGNAL(triggered(bool)), this, SLOT(handToolSelected(bool))); connect(UBApplication::mainWindow->actionZoomIn, SIGNAL(triggered(bool)), this, SLOT(zoomInToolSelected(bool))); connect(UBApplication::mainWindow->actionZoomOut, SIGNAL(triggered(bool)), this, SLOT(zoomOutToolSelected(bool))); connect(UBApplication::mainWindow->actionPointer, SIGNAL(triggered(bool)), this, SLOT(pointerToolSelected(bool))); connect(UBApplication::mainWindow->actionLine, SIGNAL(triggered(bool)), this, SLOT(lineToolSelected(bool))); connect(UBApplication::mainWindow->actionText, SIGNAL(triggered(bool)), this, SLOT(textToolSelected(bool))); connect(UBApplication::mainWindow->actionCapture, SIGNAL(triggered(bool)), this, SLOT(captureToolSelected(bool))); }