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
0cd15a38
Commit
0cd15a38
authored
Nov 11, 2011
by
shibakaneki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a frist drag and drop support from Safari
parent
652d966e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
19 deletions
+29
-19
UBLibraryController.cpp
src/board/UBLibraryController.cpp
+3
-0
UBDownloadWidget.cpp
src/gui/UBDownloadWidget.cpp
+0
-5
UBLibraryWidget.cpp
src/gui/UBLibraryWidget.cpp
+26
-14
No files found.
src/board/UBLibraryController.cpp
View file @
0cd15a38
...
...
@@ -149,6 +149,9 @@ void UBLibraryController::importImageOnLibrary(QImage& pImage)
QDateTime
now
=
QDateTime
::
currentDateTime
();
QString
filePath
=
mPicturesStandardDirectoryPath
.
toLocalFile
()
+
"/"
+
tr
(
"ImportedImage"
)
+
"-"
+
now
.
toString
(
"dd-MM-yyyy hh-mm-ss"
)
+
".png"
;
filePath
=
UBFileSystemUtils
::
normalizeFilePath
(
filePath
);
qDebug
()
<<
"Importing image file from: "
<<
filePath
;
pImage
.
save
(
filePath
);
UBApplication
::
showMessage
(
tr
(
"Added 1 Image to Library"
));
}
...
...
src/gui/UBDownloadWidget.cpp
View file @
0cd15a38
...
...
@@ -66,11 +66,6 @@ UBDownloadWidget::UBDownloadWidget(QWidget *parent, const char *name):QWidget(pa
*/
UBDownloadWidget
::~
UBDownloadWidget
()
{
if
(
NULL
!=
mpItem
)
{
delete
mpItem
;
mpItem
=
NULL
;
}
if
(
NULL
!=
mpCancelBttn
)
{
delete
mpCancelBttn
;
...
...
src/gui/UBLibraryWidget.cpp
View file @
0cd15a38
...
...
@@ -351,13 +351,29 @@ void UBLibraryWidget::dropEvent(QDropEvent *event)
else
{
bool
bDropAccepted
=
false
;
if
(
pMimeData
->
hasImage
())
// We must check the URLs first because an image dropped from the web can contains the image datas, as well as the URLs
// and if we want to display the download widget in order to make the user wait for the end of the download, we need
// to check the URLs first!
if
(
pMimeData
->
hasUrls
())
{
qDebug
()
<<
"hasImage"
;
QImage
image
=
qvariant_cast
<
QImage
>
(
pMimeData
->
imageData
());
mLibraryController
->
importImageOnLibrary
(
image
);
bDropAccepted
=
true
;
qDebug
()
<<
"hasUrls"
;
QList
<
QUrl
>
urlList
=
pMimeData
->
urls
();
for
(
int
i
=
0
;
i
<
urlList
.
size
()
&&
i
<
32
;
++
i
)
{
QString
filePath
;
#ifdef Q_WS_MACX
filePath
=
QUrl
(
urlList
.
at
(
i
)).
toString
();
#else
filePath
=
QUrl
(
urlList
.
at
(
i
).
path
()).
toLocalFile
();
#endif
mLibraryController
->
importItemOnLibrary
(
filePath
);
bDropAccepted
=
true
;
}
}
// When an HTML is present, it means that we dropped something from the web. Normally, the HTML contains the element
// of the webpage and has a 'src' attribute containing the URL of the web ressource. Here we are looking for this
// 'src' attribute, get its value and download the ressource from this URL.
else
if
(
pMimeData
->
hasHtml
())
{
qDebug
()
<<
"hasHtml"
;
...
...
@@ -377,16 +393,12 @@ void UBLibraryWidget::dropEvent(QDropEvent *event)
mLibraryController
->
importItemOnLibrary
(
filePath
);
bDropAccepted
=
true
;
}
else
if
(
pMimeData
->
has
Urls
())
else
if
(
pMimeData
->
has
Image
())
{
qDebug
()
<<
"hasUrls"
;
QList
<
QUrl
>
urlList
=
pMimeData
->
urls
();
for
(
int
i
=
0
;
i
<
urlList
.
size
()
&&
i
<
32
;
++
i
)
{
QString
filePath
=
QUrl
(
urlList
.
at
(
i
).
path
()).
toLocalFile
();
mLibraryController
->
importItemOnLibrary
(
filePath
);
bDropAccepted
=
true
;
}
qDebug
()
<<
"hasImage"
;
QImage
image
=
qvariant_cast
<
QImage
>
(
pMimeData
->
imageData
());
mLibraryController
->
importImageOnLibrary
(
image
);
bDropAccepted
=
true
;
}
else
{
...
...
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