Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions resources/etc/OpenBoard.config
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ MarkerLightBackgroundSelectedColors=#E3FF00, #FF0000, #004080, #008000, #C87400
MarkerMediumWidth=24
MarkerPressureSensitive=false
MarkerStrongWidth=48
DesktopPaletteScalePercent=100
DesktopPaletteShowPen=true
DesktopPaletteShowEraser=true
DesktopPaletteShowMarker=true
DesktopPaletteShowSelector=true
DesktopPaletteShowPointer=true
pageDpi=0
PenColorIndex=0
PenDarkBackgroundColors=#FFFFFF, #FF3400, #66C0FF, #81FF5C, #FFFF00, #B68360, #FF497E, #8D69FF, #000000
Expand Down
48 changes: 42 additions & 6 deletions resources/forms/preferences.ui
Original file line number Diff line number Diff line change
Expand Up @@ -94,20 +94,20 @@
<x>0</x>
<y>0</y>
<width>1018</width>
<height>1200</height>
<height>1300</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>783</width>
<height>1200</height>
<height>1300</height>
</size>
</property>
<widget class="QGroupBox" name="PDFGroupBox">
<property name="geometry">
<rect>
<x>0</x>
<y>920</y>
<y>1020</y>
<width>1011</width>
<height>111</height>
</rect>
Expand Down Expand Up @@ -234,7 +234,7 @@
<property name="geometry">
<rect>
<x>0</x>
<y>1040</y>
<y>1140</y>
<width>1011</width>
<height>111</height>
</rect>
Expand Down Expand Up @@ -485,7 +485,7 @@
<x>0</x>
<y>840</y>
<width>1011</width>
<height>111</height>
<height>211</height>
</rect>
</property>
<property name="sizePolicy">
Expand All @@ -498,7 +498,7 @@
<string>Mode</string>
</property>
<layout class="QGridLayout" name="gridLayout_15">
<item row="0" column="1" rowspan="2">
<item row="0" column="1">
<layout class="QGridLayout" name="gridLayout_16">
<item row="0" column="0">
<widget class="QLabel" name="modeLabel">
Expand Down Expand Up @@ -564,6 +564,42 @@
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="desktopPaletteScaleLabel">
<property name="text">
<string>Drawing palette scale:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="desktopPaletteScaleComboBox">
<item><property name="text"><string>100%</string></property></item>
<item><property name="text"><string>110%</string></property></item>
<item><property name="text"><string>120%</string></property></item>
<item><property name="text"><string>130%</string></property></item>
<item><property name="text"><string>140%</string></property></item>
<item><property name="text"><string>150%</string></property></item>
<item><property name="text"><string>160%</string></property></item>
<item><property name="text"><string>170%</string></property></item>
<item><property name="text"><string>180%</string></property></item>
<item><property name="text"><string>190%</string></property></item>
<item><property name="text"><string>200%</string></property></item>
</widget>
</item>
<item row="2" column="0" colspan="2">
<layout class="QGridLayout" name="desktopPaletteToolsLayout">
<item row="0" column="0">
<widget class="QLabel" name="desktopPaletteToolsLabel">
<property name="text"><string>Visible palette tools:</string></property>
</widget>
</item>
<item row="0" column="1"><widget class="QCheckBox" name="desktopShowPenCheckBox"><property name="text"><string>Pen</string></property></widget></item>
<item row="0" column="2"><widget class="QCheckBox" name="desktopShowMarkerCheckBox"><property name="text"><string>Marker</string></property></widget></item>
<item row="1" column="0"><widget class="QCheckBox" name="desktopShowEraserCheckBox"><property name="text"><string>Eraser</string></property></widget></item>
<item row="1" column="1"><widget class="QCheckBox" name="desktopShowSelectorCheckBox"><property name="text"><string>Selector</string></property></widget></item>
<item row="1" column="2"><widget class="QCheckBox" name="desktopShowPointerCheckBox"><property name="text"><string>Laser pointer</string></property></widget></item>
</layout>
</item>
<item row="0" column="0">
<spacer name="horizontalSpacer_5">
<property name="sizeType">
Expand Down
29 changes: 29 additions & 0 deletions src/core/UBPreferencesController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,21 @@ void UBPreferencesController::wire()
settings->appThemeMode->setInt(index);
UBThemeManager::instance()->applyUserThemePreference();
});
connect(mPreferencesUI->desktopPaletteScaleComboBox,
qOverload<int>(&QComboBox::currentIndexChanged), this,
[settings](int index) {
settings->desktopPaletteScalePercent->setInt(100 + index * 10);
});
connect(mPreferencesUI->desktopShowPenCheckBox, SIGNAL(clicked(bool)),
settings->desktopPaletteShowPen, SLOT(setBool(bool)));
connect(mPreferencesUI->desktopShowMarkerCheckBox, SIGNAL(clicked(bool)),
settings->desktopPaletteShowMarker, SLOT(setBool(bool)));
connect(mPreferencesUI->desktopShowEraserCheckBox, SIGNAL(clicked(bool)),
settings->desktopPaletteShowEraser, SLOT(setBool(bool)));
connect(mPreferencesUI->desktopShowSelectorCheckBox, SIGNAL(clicked(bool)),
settings->desktopPaletteShowSelector, SLOT(setBool(bool)));
connect(mPreferencesUI->desktopShowPointerCheckBox, SIGNAL(clicked(bool)),
settings->desktopPaletteShowPointer, SLOT(setBool(bool)));

connect(mPreferencesUI->useExternalBrowserCheckBox, SIGNAL(clicked(bool)), settings->webUseExternalBrowser, SLOT(setBool(bool)));
connect(mPreferencesUI->displayBrowserPageCheckBox, SIGNAL(clicked(bool)), settings->webShowPageImmediatelyOnMirroredScreen, SLOT(setBool(bool)));
Expand Down Expand Up @@ -472,6 +487,13 @@ void UBPreferencesController::init()

mPreferencesUI->startModeComboBox->setCurrentIndex(settings->appStartMode->get().toInt());
mPreferencesUI->themeComboBox->setCurrentIndex(settings->appThemeMode->get().toInt());
const int desktopScale = qBound(100, settings->desktopPaletteScalePercent->get().toInt(), 200);
mPreferencesUI->desktopPaletteScaleComboBox->setCurrentIndex((desktopScale - 100) / 10);
mPreferencesUI->desktopShowPenCheckBox->setChecked(settings->desktopPaletteShowPen->get().toBool());
mPreferencesUI->desktopShowMarkerCheckBox->setChecked(settings->desktopPaletteShowMarker->get().toBool());
mPreferencesUI->desktopShowEraserCheckBox->setChecked(settings->desktopPaletteShowEraser->get().toBool());
mPreferencesUI->desktopShowSelectorCheckBox->setChecked(settings->desktopPaletteShowSelector->get().toBool());
mPreferencesUI->desktopShowPointerCheckBox->setChecked(settings->desktopPaletteShowPointer->get().toBool());

mPreferencesUI->useExternalBrowserCheckBox->setChecked(settings->webUseExternalBrowser->get().toBool());
mPreferencesUI->displayBrowserPageCheckBox->setChecked(settings->webShowPageImmediatelyOnMirroredScreen->get().toBool());
Expand Down Expand Up @@ -546,6 +568,13 @@ void UBPreferencesController::defaultSettings()
mPreferencesUI->verticalChoice->setChecked(settings->appToolBarOrientationVertical->reset().toBool());
mPreferencesUI->horizontalChoice->setChecked(!settings->appToolBarOrientationVertical->reset().toBool());
mPreferencesUI->startModeComboBox->setCurrentIndex(0);
mPreferencesUI->desktopPaletteScaleComboBox->setCurrentIndex(
(settings->desktopPaletteScalePercent->reset().toInt() - 100) / 10);
mPreferencesUI->desktopShowPenCheckBox->setChecked(settings->desktopPaletteShowPen->reset().toBool());
mPreferencesUI->desktopShowMarkerCheckBox->setChecked(settings->desktopPaletteShowMarker->reset().toBool());
mPreferencesUI->desktopShowEraserCheckBox->setChecked(settings->desktopPaletteShowEraser->reset().toBool());
mPreferencesUI->desktopShowSelectorCheckBox->setChecked(settings->desktopPaletteShowSelector->reset().toBool());
mPreferencesUI->desktopShowPointerCheckBox->setChecked(settings->desktopPaletteShowPointer->reset().toBool());

mPreferencesUI->useSystemOSKCheckBox->setChecked(settings->useSystemOnScreenKeyboard->reset().toBool());

Expand Down
7 changes: 7 additions & 0 deletions src/core/UBSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,13 @@ void UBSettings::init()

boardUseHighResTabletEvent = new UBSetting(this, "Board", "UseHighResTabletEvent", true);

desktopPaletteScalePercent = new UBSetting(this, "Board", "DesktopPaletteScalePercent", 100);
desktopPaletteShowPen = new UBSetting(this, "Board", "DesktopPaletteShowPen", true);
desktopPaletteShowEraser = new UBSetting(this, "Board", "DesktopPaletteShowEraser", true);
desktopPaletteShowMarker = new UBSetting(this, "Board", "DesktopPaletteShowMarker", true);
desktopPaletteShowSelector = new UBSetting(this, "Board", "DesktopPaletteShowSelector", true);
desktopPaletteShowPointer = new UBSetting(this, "Board", "DesktopPaletteShowPointer", true);

boardInterpolatePenStrokes = new UBSetting(this, "Board", "InterpolatePenStrokes", true);
boardSimplifyPenStrokes = new UBSetting(this, "Board", "SimplifyPenStrokes", true);
boardSimplifyPenStrokesThresholdAngle = new UBSetting(this, "Board", "SimplifyPenStrokesThresholdAngle", 2);
Expand Down
7 changes: 7 additions & 0 deletions src/core/UBSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,13 @@ class UBSettings : public QObject

UBSetting* boardUseHighResTabletEvent;

UBSetting* desktopPaletteScalePercent;
UBSetting* desktopPaletteShowPen;
UBSetting* desktopPaletteShowEraser;
UBSetting* desktopPaletteShowMarker;
UBSetting* desktopPaletteShowSelector;
UBSetting* desktopPaletteShowPointer;

UBSetting* boardInterpolatePenStrokes;
UBSetting* boardSimplifyPenStrokes;
UBSetting* boardSimplifyPenStrokesThresholdAngle;
Expand Down
45 changes: 18 additions & 27 deletions src/desktop/UBDesktopAnnotationController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -570,15 +570,7 @@ void UBDesktopAnnotationController::penActionPressed()
mPenHoldTimer = QTime::currentTime();
mPendingPenButtonPressed = true;

// Check if the mouse cursor is on the little arrow
QPoint cursorPos = QCursor::pos();
QPoint palettePos = mDesktopPalette->mapToGlobal(QPoint(0, 0)); // global coordinates of palette
QPoint buttonPos = mDesktopPalette->buttonPos(UBApplication::mainWindow->actionPen);

int iX = cursorPos.x() - (palettePos.x() + buttonPos.x()); // x position of the cursor in the palette
int iY = cursorPos.y() - (palettePos.y() + buttonPos.y()); // y position of the cursor in the palette

if(iX >= 30 && iX <= 44 && iY >= 30 && iY <= 44)
if (isSubtoolArrowPressed(UBApplication::mainWindow->actionPen))
{
mbArrowClicked = true;
penActionReleased();
Expand Down Expand Up @@ -624,15 +616,7 @@ void UBDesktopAnnotationController::eraserActionPressed()
mEraserHoldTimer = QTime::currentTime();
mPendingEraserButtonPressed = true;

// Check if the mouse cursor is on the little arrow
QPoint cursorPos = QCursor::pos();
QPoint palettePos = mDesktopPalette->mapToGlobal(QPoint(0, 0));
QPoint buttonPos = mDesktopPalette->buttonPos(UBApplication::mainWindow->actionEraser);

int iX = cursorPos.x() - (palettePos.x() + buttonPos.x()); // x position of the cursor in the palette
int iY = cursorPos.y() - (palettePos.y() + buttonPos.y()); // y position of the cursor in the palette

if(iX >= 30 && iX <= 44 && iY >= 30 && iY <= 44)
if (isSubtoolArrowPressed(UBApplication::mainWindow->actionEraser))
{
mbArrowClicked = true;
eraserActionReleased();
Expand Down Expand Up @@ -679,15 +663,7 @@ void UBDesktopAnnotationController::markerActionPressed()
mMarkerHoldTimer = QTime::currentTime();
mPendingMarkerButtonPressed = true;

// Check if the mouse cursor is on the little arrow
QPoint cursorPos = QCursor::pos();
QPoint palettePos = mDesktopPalette->mapToGlobal(QPoint(0, 0));
QPoint buttonPos = mDesktopPalette->buttonPos(UBApplication::mainWindow->actionMarker);

int iX = cursorPos.x() - (palettePos.x() + buttonPos.x()); // x position of the cursor in the palette
int iY = cursorPos.y() - (palettePos.y() + buttonPos.y()); // y position of the cursor in the palette

if(iX >= 30 && iX <= 44 && iY >= 30 && iY <= 44)
if (isSubtoolArrowPressed(UBApplication::mainWindow->actionMarker))
{
mbArrowClicked = true;
markerActionReleased();
Expand Down Expand Up @@ -777,6 +753,21 @@ void UBDesktopAnnotationController::switchCursor(const int tool)
mTransparentDrawingView->setToolCursor(tool);
}

bool UBDesktopAnnotationController::isSubtoolArrowPressed(QAction* action) const
{
UBActionPaletteButton* button = mDesktopPalette->getButtonFromAction(action);

if (!button)
return false;

const QPoint localPosition = button->mapFromGlobal(QCursor::pos());
const int arrowExtent = qMax(14, qRound(qMin(button->width(), button->height()) * 0.36));
const QRect arrowRegion(button->width() - arrowExtent,
button->height() - arrowExtent,
arrowExtent, arrowExtent);
return arrowRegion.contains(localPosition);
}

/**
* \brief Reconnect the pressed & released signals of the property palettes
*/
Expand Down
1 change: 1 addition & 0 deletions src/desktop/UBDesktopAnnotationController.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ class UBDesktopAnnotationController : public QObject
void togglePropertyPalette(UBActionPalette* palette);
void updateMask(bool bTransparent);
static QPixmap clipboardScreenshot();
bool isSubtoolArrowPressed(QAction* action) const;

UBDesktopPalette *mDesktopPalette;
//UBKeyboardPalette *mKeyboardPalette;
Expand Down
Loading