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
70e3b539
Commit
70e3b539
authored
Jan 19, 2012
by
Aleksei Kanash
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added clearing sources of any UBGraphicsWidget.
Added new system util method: deleteFile.
parent
93e08950
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
29 additions
and
8 deletions
+29
-8
UBBoardController.cpp
src/board/UBBoardController.cpp
+1
-0
UBGraphicsMediaItem.cpp
src/domain/UBGraphicsMediaItem.cpp
+3
-5
UBGraphicsWidgetItem.cpp
src/domain/UBGraphicsWidgetItem.cpp
+8
-0
UBGraphicsWidgetItem.h
src/domain/UBGraphicsWidgetItem.h
+4
-2
UBCoreGraphicsScene.cpp
src/frameworks/UBCoreGraphicsScene.cpp
+4
-0
UBFileSystemUtils.cpp
src/frameworks/UBFileSystemUtils.cpp
+7
-0
UBFileSystemUtils.h
src/frameworks/UBFileSystemUtils.h
+2
-1
No files found.
src/board/UBBoardController.cpp
View file @
70e3b539
...
...
@@ -1802,6 +1802,7 @@ UBGraphicsWidgetItem *UBBoardController::addW3cWidget(const QUrl &pUrl, const QP
QString
struuid
=
UBStringUtils
::
toCanonicalUuid
(
uuid
);
QString
snapshotPath
=
mActiveDocument
->
persistencePath
()
+
"/"
+
UBPersistenceManager
::
widgetDirectory
+
"/"
+
struuid
+
".png"
;
w3cWidgetItem
->
setSnapshotPath
(
QUrl
::
fromLocalFile
(
snapshotPath
));
UBGraphicsWidgetItem
*
tmpItem
=
dynamic_cast
<
UBGraphicsWidgetItem
*>
(
w3cWidgetItem
);
if
(
tmpItem
)
tmpItem
->
widgetWebView
()
->
takeSnapshot
().
save
(
snapshotPath
,
"PNG"
);
...
...
src/domain/UBGraphicsMediaItem.cpp
View file @
70e3b539
...
...
@@ -25,6 +25,8 @@
#include "core/memcheck.h"
#include "frameworks/UBFileSystemUtils.h"
bool
UBGraphicsMediaItem
::
sIsMutedByDefault
=
false
;
UBGraphicsMediaItem
::
UBGraphicsMediaItem
(
const
QUrl
&
pMediaFileUrl
,
QGraphicsItem
*
parent
)
...
...
@@ -85,15 +87,11 @@ QVariant UBGraphicsMediaItem::itemChange(GraphicsItemChange change, const QVaria
void
UBGraphicsMediaItem
::
clearSource
()
{
QString
path
=
mediaFileUrl
().
path
();
//if path is absolute clean duplicated path string
if
(
!
path
.
contains
(
UBApplication
::
boardController
->
activeDocument
()
->
persistencePath
()))
path
=
UBApplication
::
boardController
->
activeDocument
()
->
persistencePath
()
+
"/"
+
path
;
QFile
f
(
path
);
f
.
setPermissions
(
path
,
QFile
::
ReadOwner
|
QFile
::
WriteOwner
);
f
.
remove
();
UBFileSystemUtils
::
deleteFile
(
path
);
}
void
UBGraphicsMediaItem
::
toggleMute
()
...
...
src/domain/UBGraphicsWidgetItem.cpp
View file @
70e3b539
...
...
@@ -25,6 +25,7 @@
#include "UBW3CWidget.h"
#include "UBGraphicsScene.h"
#include "UBAppleWidget.h"
#include "frameworks/UBFileSystemUtils.h"
#include "core/memcheck.h"
...
...
@@ -246,6 +247,13 @@ void UBGraphicsWidgetItem::removeScript()
mWebKitWidget
->
page
()
->
mainFrame
()
->
evaluateJavaScript
(
"if(widget && widget.onremove) { widget.onremove();}"
);
}
}
void
UBGraphicsWidgetItem
::
clearSource
()
{
UBFileSystemUtils
::
deleteDir
(
getOwnFolder
().
toLocalFile
());
UBFileSystemUtils
::
deleteFile
(
getSnapshotPath
().
toLocalFile
());
}
QString
UBGraphicsWidgetItem
::
downloadUrl
(
const
QString
&
fileUrl
,
const
QString
&
extention
)
{
return
mUniboardAPI
->
downloadUrl
(
fileUrl
,
extention
);
...
...
src/domain/UBGraphicsWidgetItem.h
View file @
70e3b539
...
...
@@ -70,9 +70,10 @@ class UBGraphicsWidgetItem : public UBGraphicsProxyWidget
virtual
void
setOwnFolder
(
const
QUrl
&
newFolder
)
{
ownFolder
=
newFolder
;}
virtual
QUrl
getOwnFolder
()
const
{
return
ownFolder
;}
virtual
void
setSnapshotPath
(
const
QUrl
&
newFilePath
){
SnapshotFile
=
newFilePath
;}
virtual
QUrl
getSnapshotPath
(){
return
SnapshotFile
;}
virtual
void
clearSource
(){;}
virtual
void
clearSource
();
protected
:
...
...
@@ -95,6 +96,7 @@ class UBGraphicsWidgetItem : public UBGraphicsProxyWidget
bool
mShouldMoveWidget
;
UBWidgetUniboardAPI
*
mUniboardAPI
;
QUrl
ownFolder
;
QUrl
SnapshotFile
;
};
class
UBGraphicsAppleWidgetItem
:
public
UBGraphicsWidgetItem
...
...
src/frameworks/UBCoreGraphicsScene.cpp
View file @
70e3b539
...
...
@@ -19,6 +19,7 @@
#include "domain/UBGraphicsAudioItem.h"
#include "domain/UBGraphicsVideoItem.h"
#include "domain/UBGraphicsMediaItem.h"
#include "domain/UBGraphicsWidgetItem.h"
UBCoreGraphicsScene
::
UBCoreGraphicsScene
(
QObject
*
parent
)
:
QGraphicsScene
(
parent
)
...
...
@@ -70,6 +71,9 @@ bool UBCoreGraphicsScene::deleteItem(QGraphicsItem* item)
case
UBGraphicsVideoItem
:
:
Type
:
item_casted
=
dynamic_cast
<
UBGraphicsVideoItem
*>
(
item
);
break
;
case
UBGraphicsW3CWidgetItem
:
:
Type
:
item_casted
=
dynamic_cast
<
UBGraphicsWidgetItem
*>
(
item
);
break
;
}
if
(
0
!=
item_casted
)
...
...
src/frameworks/UBFileSystemUtils.cpp
View file @
70e3b539
...
...
@@ -79,6 +79,13 @@ bool UBFileSystemUtils::copyFile(const QString &source, const QString &Destinati
return
QFile
::
copy
(
source
,
normalizedDestination
);
}
bool
UBFileSystemUtils
::
deleteFile
(
const
QString
&
path
)
{
QFile
f
(
path
);
f
.
setPermissions
(
path
,
QFile
::
ReadOwner
|
QFile
::
WriteOwner
);
return
f
.
remove
();
}
QString
UBFileSystemUtils
::
defaultTempDirPath
()
{
return
QDesktopServices
::
storageLocation
(
QDesktopServices
::
TempLocation
)
+
"/"
+
defaultTempDirName
();
...
...
src/frameworks/UBFileSystemUtils.h
View file @
70e3b539
...
...
@@ -66,7 +66,8 @@ class UBFileSystemUtils
static
bool
isAZipFile
(
QString
&
filePath
);
static
bool
copyFile
(
const
QString
&
source
,
const
QString
&
Destination
,
bool
overwrite
=
false
);
static
bool
deleteFile
(
const
QString
&
path
);
/**
* Compress a source directory in a zip file.
* @arg pDir the directory to add in zip
...
...
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