Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpenBoard
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lifo
Nicolas Ollinger
OpenBoard
Commits
c6c0120a
Commit
c6c0120a
authored
Dec 06, 2017
by
Clément Fauconnier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added grid tab on preferences to handle grid color and opacity parameters
parent
0d66ec25
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
656 additions
and
250 deletions
+656
-250
OpenBoard.config
resources/etc/OpenBoard.config
+3
-1
brushProperties.ui
resources/forms/brushProperties.ui
+137
-176
preferences.ui
resources/forms/preferences.ui
+365
-63
UBPreferencesController.cpp
src/core/UBPreferencesController.cpp
+117
-0
UBPreferencesController.h
src/core/UBPreferencesController.h
+6
-2
UBSetting.cpp
src/core/UBSetting.cpp
+16
-6
UBSettings.cpp
src/core/UBSettings.cpp
+9
-2
UBSettings.h
src/core/UBSettings.h
+3
-0
No files found.
resources/etc/OpenBoard.config
View file @
c6c0120a
...
...
@@ -25,12 +25,14 @@ UseSystemOnScreenKeyboard=true
[
Board
]
AutoSaveIntervalInMinutes
=
3
CrossColorDarkBackground
=
#C8
C0C0C0
CrossColorDarkBackground
=
#C8
2C2C2C
CrossColorLightBackground
=
#A5E1FF
DarkBackground
=
0
DefaultPageSize
=@
Size
(
1280
960
)
EraserCircleWidthIndex
=
1
FeatureSliderPosition
=
40
GridDarkBackgroundColors
=
#FFFFFF, #FF3400, #66C0FF, #81FF5C, #FFFF00, #B68360, #FF497E, #8D69FF, #C82C2C2C
GridLightBackgroundColors
=
#000000, #FF0000, #004080, #008000, #FFDD00, #C87400, #800040, #008080, #5F2D0A, #A5E1FF
InterpolateMarkerStrokes
=
true
InterpolatePenStrokes
=
true
KeyboardPaletteKeyBtnSize
=
16
x16
...
...
resources/forms/brushProperties.ui
View file @
c6c0120a
This diff is collapsed.
Click to expand it.
resources/forms/preferences.ui
View file @
c6c0120a
This diff is collapsed.
Click to expand it.
src/core/UBPreferencesController.cpp
View file @
c6c0120a
...
...
@@ -39,6 +39,7 @@
#include "core/UBDisplayManager.h"
#include "board/UBBoardController.h"
#include "domain/UBGraphicsScene.h"
#include "board/UBDrawingController.h"
#include "podcast/UBPodcastController.h"
...
...
@@ -76,6 +77,8 @@ UBPreferencesController::UBPreferencesController(QWidget *parent)
,
mPreferencesUI
(
0
)
,
mPenProperties
(
0
)
,
mMarkerProperties
(
0
)
,
mDarkBackgroundGridColorPicker
(
0
)
,
mLightBackgroundGridColorPicker
(
0
)
{
mDesktop
=
qApp
->
desktop
();
mPreferencesWindow
=
new
UBPreferencesDialog
(
this
,
parent
,
Qt
::
Dialog
);
...
...
@@ -97,6 +100,10 @@ UBPreferencesController::~UBPreferencesController()
delete
mPenProperties
;
delete
mMarkerProperties
;
delete
mDarkBackgroundGridColorPicker
;
delete
mLightBackgroundGridColorPicker
;
}
void
UBPreferencesController
::
adjustScreens
(
int
screen
)
...
...
@@ -149,6 +156,43 @@ void UBPreferencesController::wire()
connect
(
mPreferencesUI
->
verticalChoice
,
SIGNAL
(
clicked
(
bool
)),
this
,
SLOT
(
toolbarOrientationVertical
(
bool
)));
connect
(
mPreferencesUI
->
toolbarDisplayTextCheckBox
,
SIGNAL
(
clicked
(
bool
)),
settings
->
appToolBarDisplayText
,
SLOT
(
setBool
(
bool
)));
//grid tab
//On light background
QList
<
QColor
>
gridLightBackgroundColors
=
settings
->
boardGridLightBackgroundColors
->
colors
();
QColor
selectedCrossColorLightBackground
(
settings
->
boardCrossColorLightBackground
->
get
().
toString
());
mLightBackgroundGridColorPicker
=
new
UBColorPicker
(
mPreferencesUI
->
crossColorLightBackgroundFrame
);
mLightBackgroundGridColorPicker
->
setObjectName
(
QString
::
fromUtf8
(
"crossColorLightBackgroundFrame"
));
mLightBackgroundGridColorPicker
->
setMinimumSize
(
QSize
(
32
,
32
));
mLightBackgroundGridColorPicker
->
setFrameShape
(
QFrame
::
StyledPanel
);
mLightBackgroundGridColorPicker
->
setFrameShadow
(
QFrame
::
Raised
);
mPreferencesUI
->
crossColorLightBackgroundLayout
->
addWidget
(
mLightBackgroundGridColorPicker
);
mLightBackgroundGridColorPicker
->
setColors
(
gridLightBackgroundColors
);
mLightBackgroundGridColorPicker
->
setSelectedColorIndex
(
gridLightBackgroundColors
.
indexOf
(
selectedCrossColorLightBackground
));
mPreferencesUI
->
lightBackgroundOpacitySlider
->
setValue
(
selectedCrossColorLightBackground
.
alpha
()
*
100
/
255
);
QObject
::
connect
(
mLightBackgroundGridColorPicker
,
SIGNAL
(
colorSelected
(
const
QColor
&
)),
this
,
SLOT
(
setCrossColorOnLightBackground
(
const
QColor
&
)));
connect
(
mPreferencesUI
->
lightBackgroundOpacitySlider
,
SIGNAL
(
valueChanged
(
int
)),
this
,
SLOT
(
lightBackgroundCrossOpacityValueChanged
(
int
)));
//On dark background
QList
<
QColor
>
gridDarkBackgroundColors
=
settings
->
boardGridDarkBackgroundColors
->
colors
();
QColor
selectedCrossColorDarkBackground
(
settings
->
boardCrossColorDarkBackground
->
get
().
toString
());
mDarkBackgroundGridColorPicker
=
new
UBColorPicker
(
mPreferencesUI
->
crossColorDarkBackgroundFrame
);
mDarkBackgroundGridColorPicker
->
setObjectName
(
QString
::
fromUtf8
(
"crossColorDarkBackgroundFrame"
));
mDarkBackgroundGridColorPicker
->
setMinimumSize
(
QSize
(
32
,
32
));
mDarkBackgroundGridColorPicker
->
setFrameShape
(
QFrame
::
StyledPanel
);
mDarkBackgroundGridColorPicker
->
setFrameShadow
(
QFrame
::
Raised
);
mPreferencesUI
->
crossColorDarkBackgroundLayout
->
addWidget
(
mDarkBackgroundGridColorPicker
);
mDarkBackgroundGridColorPicker
->
setColors
(
gridDarkBackgroundColors
);
mDarkBackgroundGridColorPicker
->
setSelectedColorIndex
(
gridDarkBackgroundColors
.
indexOf
(
selectedCrossColorDarkBackground
));
mPreferencesUI
->
darkBackgroundOpacitySlider
->
setValue
(
selectedCrossColorDarkBackground
.
alpha
()
*
100
/
255
);
QObject
::
connect
(
mDarkBackgroundGridColorPicker
,
SIGNAL
(
colorSelected
(
const
QColor
&
)),
this
,
SLOT
(
setCrossColorOnDarkBackground
(
const
QColor
&
)));
connect
(
mPreferencesUI
->
darkBackgroundOpacitySlider
,
SIGNAL
(
valueChanged
(
int
)),
this
,
SLOT
(
darkBackgroundCrossOpacityValueChanged
(
int
)));
// pen
QList
<
QColor
>
penLightBackgroundColors
=
settings
->
boardPenLightBackgroundColors
->
colors
();
QList
<
QColor
>
penDarkBackgroundColors
=
settings
->
boardPenDarkBackgroundColors
->
colors
();
...
...
@@ -340,6 +384,54 @@ void UBPreferencesController::defaultSettings()
}
void
UBPreferencesController
::
darkBackgroundCrossOpacityValueChanged
(
int
value
)
{
UBSettings
*
settings
=
UBSettings
::
settings
();
int
opacity
=
value
*
255
/
100
;
QList
<
QColor
>
gridDarkBackgroundColors
=
settings
->
boardGridDarkBackgroundColors
->
colors
();
int
index
=
mDarkBackgroundGridColorPicker
->
selectedColorIndex
();
QColor
currentColor
=
gridDarkBackgroundColors
.
at
(
index
);
currentColor
.
setAlpha
(
opacity
);
gridDarkBackgroundColors
.
replace
(
index
,
currentColor
);
mDarkBackgroundGridColorPicker
->
setColors
(
gridDarkBackgroundColors
);
settings
->
boardGridDarkBackgroundColors
->
setColor
(
index
,
currentColor
);
UBSettings
::
settings
()
->
boardCrossColorDarkBackground
->
set
(
currentColor
.
name
(
QColor
::
HexArgb
));
if
(
UBApplication
::
boardController
&&
UBApplication
::
boardController
->
activeScene
())
{
foreach
(
QGraphicsView
*
view
,
UBApplication
::
boardController
->
activeScene
()
->
views
())
view
->
resetCachedContent
();
}
}
void
UBPreferencesController
::
lightBackgroundCrossOpacityValueChanged
(
int
value
)
{
UBSettings
*
settings
=
UBSettings
::
settings
();
int
opacity
=
value
*
255
/
100
;
QList
<
QColor
>
gridLightBackgroundColors
=
settings
->
boardGridLightBackgroundColors
->
colors
();
int
index
=
mLightBackgroundGridColorPicker
->
selectedColorIndex
();
QColor
currentColor
=
gridLightBackgroundColors
.
at
(
index
);
currentColor
.
setAlpha
(
opacity
);
gridLightBackgroundColors
.
replace
(
index
,
currentColor
);
mLightBackgroundGridColorPicker
->
setColors
(
gridLightBackgroundColors
);
settings
->
boardGridLightBackgroundColors
->
setColor
(
index
,
currentColor
);
UBSettings
::
settings
()
->
boardCrossColorLightBackground
->
set
(
currentColor
.
name
(
QColor
::
HexArgb
));
if
(
UBApplication
::
boardController
&&
UBApplication
::
boardController
->
activeScene
())
{
foreach
(
QGraphicsView
*
view
,
UBApplication
::
boardController
->
activeScene
()
->
views
())
view
->
resetCachedContent
();
}
}
void
UBPreferencesController
::
penPreviewFromSizeChanged
(
int
value
)
{
UBSettings
::
settings
()
->
setPenPreviewFromSize
(
value
);
...
...
@@ -446,6 +538,31 @@ void UBPreferencesController::colorSelected(const QColor& color)
}
void
UBPreferencesController
::
setCrossColorOnDarkBackground
(
const
QColor
&
color
)
{
UBSettings
::
settings
()
->
boardCrossColorDarkBackground
->
set
(
color
.
name
(
QColor
::
HexArgb
));
mPreferencesUI
->
darkBackgroundOpacitySlider
->
setValue
(
color
.
alpha
()
*
100
/
255
);
if
(
UBApplication
::
boardController
&&
UBApplication
::
boardController
->
activeScene
())
{
foreach
(
QGraphicsView
*
view
,
UBApplication
::
boardController
->
activeScene
()
->
views
())
view
->
resetCachedContent
();
}
}
void
UBPreferencesController
::
setCrossColorOnLightBackground
(
const
QColor
&
color
)
{
UBSettings
::
settings
()
->
boardCrossColorLightBackground
->
set
(
color
.
name
(
QColor
::
HexArgb
));
mPreferencesUI
->
lightBackgroundOpacitySlider
->
setValue
(
color
.
alpha
()
*
100
/
255
);
if
(
UBApplication
::
boardController
&&
UBApplication
::
boardController
->
activeScene
())
{
foreach
(
QGraphicsView
*
view
,
UBApplication
::
boardController
->
activeScene
()
->
views
())
view
->
resetCachedContent
();
}
}
void
UBPreferencesController
::
toolbarPositionChanged
(
bool
checked
)
{
...
...
src/core/UBPreferencesController.h
View file @
c6c0120a
...
...
@@ -47,7 +47,6 @@ namespace Ui
class
UBBrushPropertiesFrame
;
class
UBPreferencesDialog
:
public
QDialog
{
Q_OBJECT
;
...
...
@@ -84,15 +83,21 @@ class UBPreferencesController : public QObject
Ui
::
preferencesDialog
*
mPreferencesUI
;
UBBrushPropertiesFrame
*
mPenProperties
;
UBBrushPropertiesFrame
*
mMarkerProperties
;
UBColorPicker
*
mDarkBackgroundGridColorPicker
;
UBColorPicker
*
mLightBackgroundGridColorPicker
;
protected
slots
:
void
close
();
void
defaultSettings
();
void
penPreviewFromSizeChanged
(
int
value
);
void
darkBackgroundCrossOpacityValueChanged
(
int
value
);
void
lightBackgroundCrossOpacityValueChanged
(
int
value
);
void
widthSliderChanged
(
int
value
);
void
opacitySliderChanged
(
int
value
);
void
colorSelected
(
const
QColor
&
);
void
setCrossColorOnDarkBackground
(
const
QColor
&
color
);
void
setCrossColorOnLightBackground
(
const
QColor
&
color
);
void
toolbarPositionChanged
(
bool
checked
);
void
toolbarOrientationVertical
(
bool
checked
);
void
toolbarOrientationHorizontal
(
bool
checked
);
...
...
@@ -122,5 +127,4 @@ class UBBrushPropertiesFrame : public Ui::brushProperties
};
#endif
/* UBPREFERENCESCONTROLLER_H_ */
src/core/UBSetting.cpp
View file @
c6c0120a
...
...
@@ -105,13 +105,16 @@ UBColorListSetting::UBColorListSetting(UBSettings* owner, const QString& pDomain
:
UBSetting
(
owner
,
pDomain
,
pKey
,
pDefaultValue
)
,
mAlpha
(
pAlpha
)
{
foreach
(
QString
s
,
get
().
toStringList
())
{
QColor
color
;
color
.
setNamedColor
(
s
);
color
.
setAlphaF
(
mAlpha
);
if
(
mAlpha
>=
0
)
color
.
setAlphaF
(
mAlpha
);
mColors
.
append
(
color
);
}
}
UBColorListSetting
::~
UBColorListSetting
()
...
...
@@ -129,7 +132,9 @@ QVariant UBColorListSetting::reset()
{
QColor
color
;
color
.
setNamedColor
(
s
);
color
.
setAlphaF
(
mAlpha
);
if
(
mAlpha
>=
0
)
color
.
setAlphaF
(
mAlpha
);
mColors
.
append
(
color
);
}
...
...
@@ -146,10 +151,15 @@ QList<QColor> UBColorListSetting::colors() const
void
UBColorListSetting
::
setColor
(
int
pIndex
,
const
QColor
&
color
)
{
QStringList
list
=
get
().
toStringList
();
list
.
replace
(
pIndex
,
color
.
name
());
QColor
c
=
color
;
c
.
setAlphaF
(
mAlpha
);
mColors
.
replace
(
pIndex
,
c
);
list
.
replace
(
pIndex
,
color
.
name
(
QColor
::
HexArgb
));
if
(
mAlpha
>=
0
)
{
QColor
c
=
color
;
c
.
setAlphaF
(
mAlpha
);
mColors
.
replace
(
pIndex
,
c
);
}
else
mColors
.
replace
(
pIndex
,
color
);
set
(
list
);
}
...
...
src/core/UBSettings.cpp
View file @
c6c0120a
...
...
@@ -286,10 +286,17 @@ void UBSettings::init()
pageSize
=
new
UBSetting
(
this
,
"Board"
,
"DefaultPageSize"
,
documentSizes
.
value
(
DocumentSizeRatio
::
Ratio4_3
));
boardCrossColorDarkBackground
=
new
UBSetting
(
this
,
"Board"
,
"CrossColorDarkBackground"
,
"#C8C0C0C0"
);
boardCrossColorDarkBackground
=
new
UBSetting
(
this
,
"Board"
,
"CrossColorDarkBackground"
,
"#C82C2C2C"
);
boardCrossColorLightBackground
=
new
UBSetting
(
this
,
"Board"
,
"CrossColorLightBackground"
,
"#A5E1FF"
);
QStringList
gridLightBackgroundColors
;
gridLightBackgroundColors
<<
"#FFFFFF"
<<
"#FF3400"
<<
"#66C0FF"
<<
"#81FF5C"
<<
"#FFFF00"
<<
"#B68360"
<<
"#FF497E"
<<
"#8D69FF"
<<
"#C82C2C2C"
;
boardGridLightBackgroundColors
=
new
UBColorListSetting
(
this
,
"Board"
,
"GridLightBackgroundColors"
,
gridLightBackgroundColors
,
-
1.0
);
QStringList
gridDarkBackgroundColors
;
gridDarkBackgroundColors
<<
"#000000"
<<
"#FF0000"
<<
"#004080"
<<
"#008000"
<<
"#FFDD00"
<<
"#C87400"
<<
"#800040"
<<
"#008080"
<<
"#A5E1FF"
;
boardGridDarkBackgroundColors
=
new
UBColorListSetting
(
this
,
"Board"
,
"GridDarkBackgroundColors"
,
gridDarkBackgroundColors
,
-
1.0
);
QStringList
penLightBackgroundColors
;
penLightBackgroundColors
<<
"#000000"
<<
"#FF0000"
<<
"#004080"
<<
"#008000"
<<
"#FFDD00"
<<
"#C87400"
<<
"#800040"
<<
"#008080"
<<
"#5F2D0A"
<<
"#FFFFFF"
;
boardPenLightBackgroundColors
=
new
UBColorListSetting
(
this
,
"Board"
,
"PenLightBackgroundColors"
,
penLightBackgroundColors
,
1.0
);
...
...
src/core/UBSettings.h
View file @
c6c0120a
...
...
@@ -294,6 +294,9 @@ class UBSettings : public QObject
UBSetting
*
boardCrossColorDarkBackground
;
UBSetting
*
boardCrossColorLightBackground
;
UBColorListSetting
*
boardGridLightBackgroundColors
;
UBColorListSetting
*
boardGridDarkBackgroundColors
;
UBColorListSetting
*
boardPenLightBackgroundColors
;
UBColorListSetting
*
boardPenLightBackgroundSelectedColors
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment