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
fd322cdf
Commit
fd322cdf
authored
Jan 17, 2012
by
Mario Izquierdo (mariodebian)
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'upstream/master'
parents
658a1c88
fd9fc419
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
101 additions
and
88 deletions
+101
-88
UBBoardView.cpp
src/board/UBBoardView.cpp
+25
-8
UBBoardView.h
src/board/UBBoardView.h
+2
-0
UBSettings.cpp
src/core/UBSettings.cpp
+1
-0
UBSettings.h
src/core/UBSettings.h
+2
-0
UBGraphicsScene.cpp
src/domain/UBGraphicsScene.cpp
+1
-1
UBGraphicsTextItemDelegate.cpp
src/domain/UBGraphicsTextItemDelegate.cpp
+51
-72
UBGraphicsTextItemDelegate.h
src/domain/UBGraphicsTextItemDelegate.h
+5
-0
UBFileSystemUtils.cpp
src/frameworks/UBFileSystemUtils.cpp
+9
-6
UBDocumentThumbnailWidget.cpp
src/gui/UBDocumentThumbnailWidget.cpp
+2
-0
UBKeyboardPalette.cpp
src/gui/UBKeyboardPalette.cpp
+3
-1
No files found.
src/board/UBBoardView.cpp
View file @
fd322cdf
...
...
@@ -72,6 +72,7 @@ UBBoardView::UBBoardView (UBBoardController* pController, QWidget* pParent)
,
mController
(
pController
)
,
mIsCreatingTextZone
(
false
)
,
mIsCreatingSceneGrabZone
(
false
)
,
mOkOnWidget
(
false
)
{
init
();
...
...
@@ -738,16 +739,27 @@ void UBBoardView::dragMoveEvent (QDragMoveEvent *event)
QGraphicsItem
*
graphicsItemAtPos
=
itemAt
(
event
->
pos
().
x
(),
event
->
pos
().
y
());
UBGraphicsWidgetItem
*
graphicsWidget
=
dynamic_cast
<
UBGraphicsWidgetItem
*>
(
graphicsItemAtPos
);
if
(
graphicsWidget
&&
graphicsWidget
->
acceptDrops
()){
if
(
isDropableData
(
event
->
mimeData
()))
{
if
(
graphicsWidget
)
{
if
(
graphicsWidget
->
acceptDrops
())
{
if
(
!
mOkOnWidget
)
{
if
(
!
isDropableData
(
event
->
mimeData
()))
{
mOkOnWidget
=
false
;
event
->
ignore
();
return
;
}
else
{
mOkOnWidget
=
true
;
}
}
QPoint
newPoint
(
graphicsWidget
->
mapFromScene
(
mapToScene
(
event
->
pos
())).
toPoint
());
QDragMoveEvent
newEvent
(
newPoint
,
event
->
dropAction
(),
event
->
mimeData
(),
event
->
mouseButtons
(),
event
->
keyboardModifiers
());
QApplication
::
sendEvent
(
graphicsWidget
->
widgetWebView
(),
&
newEvent
);
}
else
{
mOkOnWidget
=
false
;
event
->
ignore
();
}
}
else
{
event
->
acceptProposedAction
();
mOkOnWidget
=
false
;
}
}
...
...
@@ -804,6 +816,9 @@ QString UBBoardView::fileExtention(const QString &filename)
}
QString
UBBoardView
::
typeForExtention
(
const
QString
&
extention
)
{
if
(
extention
.
isEmpty
())
return
QString
();
QString
result
=
QString
();
if
(
audioExtentions
.
contains
(
extention
))
{
...
...
@@ -812,24 +827,26 @@ QString UBBoardView::typeForExtention(const QString &extention)
result
=
videoAlias
;
}
else
if
(
imageExtentions
.
contains
(
extention
))
{
result
=
imageAlias
;
}
else
if
(
htmlExtentions
.
contains
(
extention
))
{
result
=
htmlAlias
;
//
} else if (htmlExtentions.contains(extention)) {
//
result = htmlAlias;
}
return
result
;
}
bool
UBBoardView
::
isDropableData
(
const
QMimeData
*
pMimeData
)
{
if
(
pMimeData
->
hasUrls
())
if
(
!
typeForExtention
(
fileExtention
(
pMimeData
->
urls
().
at
(
0
).
toLocalFile
())).
isNull
())
if
(
pMimeData
->
hasUrls
())
{
if
(
!
typeForExtention
(
fileExtention
(
pMimeData
->
urls
().
at
(
0
).
toLocalFile
())).
isNull
())
{
return
true
;
}
}
return
false
;
}
void
UBBoardView
::
dropEvent
(
QDropEvent
*
event
)
{
qDebug
()
<<
event
->
source
()
;
mOkOnWidget
=
false
;
QGraphicsItem
*
graphicsItemAtPos
=
itemAt
(
event
->
pos
().
x
(),
event
->
pos
().
y
());
UBGraphicsWidgetItem
*
graphicsWidget
=
dynamic_cast
<
UBGraphicsWidgetItem
*>
(
graphicsItemAtPos
);
...
...
src/board/UBBoardView.h
View file @
fd322cdf
...
...
@@ -116,6 +116,8 @@ class UBBoardView : public QGraphicsView
bool
isAbsurdPoint
(
QPoint
point
);
bool
mVirtualKeyboardActive
;
bool
mOkOnWidget
;
QString
typeForExtention
(
const
QString
&
extention
);
QString
fileExtention
(
const
QString
&
filename
);
...
...
src/core/UBSettings.cpp
View file @
fd322cdf
...
...
@@ -363,6 +363,7 @@ void UBSettings::init()
intranetPodcastPublishingUrl
=
new
UBSetting
(
this
,
"IntranetPodcast"
,
"PublishingUrl"
,
""
);
intranetPodcastAuthor
=
new
UBSetting
(
this
,
"IntranetPodcast"
,
"Author"
,
""
);
KeyboardLocale
=
new
UBSetting
(
this
,
"Board"
,
"StartupKeyboardLocale"
,
0
);
}
...
...
src/core/UBSettings.h
View file @
fd322cdf
...
...
@@ -318,6 +318,8 @@ class UBSettings : public QObject
static int libPaletteWidth;
*/
UBSetting
*
KeyboardLocale
;
public
slots
:
void
setPenWidthIndex
(
int
index
);
...
...
src/domain/UBGraphicsScene.cpp
View file @
fd322cdf
...
...
@@ -1938,7 +1938,7 @@ void UBGraphicsScene::keyReleaseEvent(QKeyEvent * keyEvent)
QList
<
QGraphicsItem
*>
si
=
selectedItems
();
if
(
si
.
size
()
>
0
&&
!
keyEvent
->
isAccepted
(
))
if
(
(
si
.
size
()
>
0
)
&&
(
keyEvent
->
isAccepted
()
))
{
#ifdef Q_OS_MAC
if
(
keyEvent
->
key
()
==
Qt
::
Key_Backspace
)
...
...
src/domain/UBGraphicsTextItemDelegate.cpp
View file @
fd322cdf
...
...
@@ -35,6 +35,7 @@ const int UBGraphicsTextItemDelegate::sMinPointSize = 8;
UBGraphicsTextItemDelegate
::
UBGraphicsTextItemDelegate
(
UBGraphicsTextItem
*
pDelegated
,
QObject
*
parent
)
:
UBGraphicsItemDelegate
(
pDelegated
,
0
,
parent
,
true
)
,
mLastFontPixelSize
(
-
1
)
,
delta
(
5
)
{
delegated
()
->
setData
(
UBGraphicsItemData
::
ItemEditable
,
QVariant
(
true
));
delegated
()
->
setPlainText
(
""
);
...
...
@@ -231,82 +232,12 @@ void UBGraphicsTextItemDelegate::pickColor()
void
UBGraphicsTextItemDelegate
::
decreaseSize
()
{
QTextCursor
cursor
=
delegated
()
->
textCursor
();
QTextCharFormat
textFormat
;
QFont
curFont
=
cursor
.
charFormat
().
font
();
int
pointSize
=
curFont
.
pointSize
();
pointSize
-=
5
;
// QFontInfo fi(delegated()->font());
// int pixelSize = fi.pixelSize();
// if (-1 == mLastFontPixelSize)
// mLastFontPixelSize = pixelSize;
// int newPixelSize = sMinPixelSize;
// while (newPixelSize * 1.5 < pixelSize)
// newPixelSize *= 1.5;
// if (newPixelSize < mLastFontPixelSize && mLastFontPixelSize < pixelSize)
// newPixelSize = mLastFontPixelSize;
// if (pixelSize > newPixelSize)
// {
// QFont font = delegated()->font();
// font.setPixelSize(newPixelSize);
// delegated()->setFont(font);
// UBSettings::settings()->setFontPixelSize(newPixelSize);
// delegated()->document()->adjustSize();
// delegated()->contentsChanged();dddd
// }
curFont
.
setPointSize
(
pointSize
);
textFormat
.
setFont
(
curFont
);
cursor
.
mergeCharFormat
(
textFormat
);
delegated
()
->
setTextCursor
(
cursor
);
UBSettings
::
settings
()
->
setFontPixelSize
(
curFont
.
pixelSize
());
UBSettings
::
settings
()
->
setFontPointSize
(
pointSize
);
delegated
()
->
document
()
->
adjustSize
();
delegated
()
->
setFont
(
curFont
);
ChangeTextSize
(
-
delta
);
}
void
UBGraphicsTextItemDelegate
::
increaseSize
()
{
QTextCursor
cursor
=
delegated
()
->
textCursor
();
QTextCharFormat
textFormat
;
QFont
curFont
=
cursor
.
charFormat
().
font
();
int
pointSize
=
curFont
.
pointSize
();
pointSize
+=
5
;
// QFontInfo fi(cursor.charFormat().font());
// int pixelSize = fi.pixelSize();
// if (-1 == mLastFontPixelSize)
// mLastFontPixelSize = pixelSize;
// int newPixelSize = sMinPixelSize;
// while (newPixelSize <= pixelSize)
// newPixelSize *= 1.5;
// if (pixelSize < mLastFontPixelSize && mLastFontPixelSize < newPixelSize)
// newPixelSize = mLastFontPixelSize;
curFont
.
setPointSize
(
pointSize
);
textFormat
.
setFont
(
curFont
);
cursor
.
mergeCharFormat
(
textFormat
);
delegated
()
->
setTextCursor
(
cursor
);
// UBSettings::settings()->setFontPixelSize(curFont.pixelSize());
UBSettings
::
settings
()
->
setFontPointSize
(
pointSize
);
delegated
()
->
document
()
->
adjustSize
();
delegated
()
->
setFont
(
curFont
);
// delegated()->contentsChanged();
ChangeTextSize
(
delta
);
}
UBGraphicsTextItem
*
UBGraphicsTextItemDelegate
::
delegated
()
...
...
@@ -349,3 +280,51 @@ void UBGraphicsTextItemDelegate::positionHandles()
UBGraphicsItemDelegate
::
positionHandles
();
setEditable
(
isEditable
());
}
void
UBGraphicsTextItemDelegate
::
ChangeTextSize
(
int
delta
)
{
if
(
0
==
delta
)
return
;
QTextCursor
cursor
=
delegated
()
->
textCursor
();
QTextCharFormat
textFormat
;
int
anchorPos
=
cursor
.
anchor
();
int
cursorPos
=
cursor
.
position
();
if
(
0
==
anchorPos
-
cursorPos
)
{
cursor
.
setPosition
(
0
,
QTextCursor
::
MoveAnchor
);
cursor
.
setPosition
(
cursor
.
document
()
->
characterCount
()
-
1
,
QTextCursor
::
KeepAnchor
);
}
int
startPos
=
qMin
(
cursor
.
anchor
(),
cursor
.
position
());
int
endPos
=
qMax
(
cursor
.
anchor
(),
cursor
.
position
());
for
(
int
i
=
startPos
;
i
<
endPos
;
i
++
)
{
// selecting single symbol
cursor
.
setPosition
(
i
,
QTextCursor
::
MoveAnchor
);
cursor
.
setPosition
(
i
+
1
,
QTextCursor
::
KeepAnchor
);
//setting new parameners
QFont
curFont
=
cursor
.
charFormat
().
font
();
int
pointSize
=
curFont
.
pointSize
()
+
delta
;
curFont
.
setPointSize
(
pointSize
);
textFormat
.
setFont
(
curFont
);
cursor
.
mergeCharFormat
(
textFormat
);
delegated
()
->
setTextCursor
(
cursor
);
UBSettings
::
settings
()
->
setFontPointSize
(
pointSize
);
delegated
()
->
document
()
->
adjustSize
();
delegated
()
->
setFont
(
curFont
);
}
//returning initial selection
cursor
.
setPosition
(
anchorPos
,
QTextCursor
::
MoveAnchor
);
cursor
.
setPosition
(
cursorPos
,
QTextCursor
::
KeepAnchor
);
delegated
()
->
setTextCursor
(
cursor
);
}
src/domain/UBGraphicsTextItemDelegate.h
View file @
fd322cdf
...
...
@@ -61,6 +61,8 @@ class UBGraphicsTextItemDelegate : public UBGraphicsItemDelegate
private
:
void
customize
(
QFontDialog
&
fontDialog
);
void
ChangeTextSize
(
int
delta
);
QFont
createDefaultFont
();
QAction
*
mEditableAction
;
...
...
@@ -72,6 +74,9 @@ class UBGraphicsTextItemDelegate : public UBGraphicsItemDelegate
void
decreaseSize
();
void
increaseSize
();
private
:
const
int
delta
;
};
#endif
/* UBGRAPHICSTEXTITEMDELEGATE_H_ */
src/frameworks/UBFileSystemUtils.cpp
View file @
fd322cdf
...
...
@@ -60,20 +60,23 @@ bool UBFileSystemUtils::copyFile(const QString &source, const QString &Destinati
qDebug
()
<<
"file"
<<
source
<<
"does not present in fs"
;
return
false
;
}
if
(
QFile
::
exists
(
Destination
))
{
if
(
QFileInfo
(
Destination
).
isFile
()
&&
overwrite
)
{
QFile
::
remove
(
Destination
);
QString
normalizedDestination
=
Destination
;
if
(
QFile
::
exists
(
normalizedDestination
))
{
if
(
QFileInfo
(
normalizedDestination
).
isFile
()
&&
overwrite
)
{
QFile
::
remove
(
normalizedDestination
);
}
}
else
{
int
pos
=
Destination
.
lastIndexOf
(
QDir
::
separator
());
normalizedDestination
=
normalizedDestination
.
replace
(
QString
(
"
\\
"
),
QString
(
"/"
));
int
pos
=
normalizedDestination
.
lastIndexOf
(
"/"
);
if
(
pos
!=
-
1
)
{
QString
newpath
=
Destination
.
left
(
pos
);
QString
newpath
=
normalized
Destination
.
left
(
pos
);
if
(
!
QDir
().
mkpath
(
newpath
))
{
qDebug
()
<<
"can't create a new path at "
<<
newpath
;
}
}
}
return
QFile
::
copy
(
source
,
Destination
);
return
QFile
::
copy
(
source
,
normalized
Destination
);
}
QString
UBFileSystemUtils
::
defaultTempDirPath
()
...
...
src/gui/UBDocumentThumbnailWidget.cpp
View file @
fd322cdf
...
...
@@ -254,4 +254,6 @@ void UBDocumentThumbnailWidget::hightlightItem(int index)
if
(
thumbnail
)
thumbnail
->
highlight
();
}
selectItemAt
(
index
);
}
src/gui/UBKeyboardPalette.cpp
View file @
fd322cdf
...
...
@@ -54,7 +54,7 @@ UBKeyboardPalette::UBKeyboardPalette(QWidget *parent)
createCtrlButtons
();
nCurrentLocale
=
0
;
nCurrentLocale
=
UBSettings
::
settings
()
->
KeyboardLocale
->
get
().
toInt
()
;
setInput
(
locales
[
nCurrentLocale
]);
setContentsMargins
(
22
,
22
,
22
,
22
);
...
...
@@ -166,6 +166,8 @@ void UBKeyboardPalette::setLocale(int nLocale)
setInput
(
locales
[
nCurrentLocale
]);
onLocaleChanged
(
locales
[
nCurrentLocale
]);
update
();
UBSettings
::
settings
()
->
KeyboardLocale
->
set
(
nCurrentLocale
);
}
emit
localeChanged
(
nLocale
);
}
...
...
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