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
922efd33
Commit
922efd33
authored
May 04, 2012
by
Anna Udovichenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implemented downloading pictures to library
parent
bfd74d22
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
89 additions
and
5 deletions
+89
-5
UBBoardPaletteManager.h
src/board/UBBoardPaletteManager.h
+1
-1
UBFeaturesController.cpp
src/board/UBFeaturesController.cpp
+20
-1
UBFeaturesController.h
src/board/UBFeaturesController.h
+4
-0
UBFeaturesWidget.cpp
src/gui/UBFeaturesWidget.cpp
+59
-0
UBFeaturesWidget.h
src/gui/UBFeaturesWidget.h
+5
-3
No files found.
src/board/UBBoardPaletteManager.h
View file @
922efd33
...
...
@@ -44,7 +44,7 @@ class UBApplicationController;
class
UBDockTeacherGuideWidget
;
// Uncomment this to use old-styles lib paletter
#define USE_WEB_WIDGET
//
#define USE_WEB_WIDGET
class
UBBoardPaletteManager
:
public
QObject
...
...
src/board/UBFeaturesController.cpp
View file @
922efd33
...
...
@@ -369,7 +369,7 @@ void UBFeaturesController::addItemAsBackground(const UBFeature &item)
UBFeature
UBFeaturesController
::
getDestinationForItem
(
const
QUrl
&
url
)
{
QString
mimetype
=
UBFileSystemUtils
::
mimeTypeFromFileName
(
fileNameFromUrl
(
url
)
);
QString
mimetype
=
UBFileSystemUtils
::
mimeTypeFromFileName
(
url
.
toString
(
)
);
if
(
mimetype
.
contains
(
"audio"
)
)
return
audiosElement
;
...
...
@@ -387,6 +387,25 @@ UBFeature UBFeaturesController::getDestinationForItem( const QUrl &url )
return
UBFeature
();
}
UBFeature
UBFeaturesController
::
addDownloadedFile
(
const
QUrl
&
sourceUrl
,
const
QByteArray
&
pData
)
{
UBFeature
dest
=
getDestinationForItem
(
sourceUrl
);
if
(
dest
==
UBFeature
()
)
return
UBFeature
();
QString
fileName
=
QFileInfo
(
sourceUrl
.
toString
()
).
fileName
();
QString
filePath
=
dest
.
getFullPath
().
toLocalFile
()
+
"/"
+
fileName
;
QFile
file
(
filePath
);
if
(
file
.
open
(
QIODevice
::
WriteOnly
))
{
file
.
write
(
pData
);
file
.
close
();
return
UBFeature
(
dest
.
getFullVirtualPath
(),
thumbnailForFile
(
filePath
),
fileName
,
QUrl
::
fromLocalFile
(
filePath
),
FEATURE_ITEM
);
}
return
UBFeature
();
}
UBFeature
UBFeaturesController
::
moveItemToFolder
(
const
QUrl
&
url
,
const
UBFeature
&
destination
)
{
UBFeature
newElement
=
copyItemToFolder
(
url
,
destination
);
...
...
src/board/UBFeaturesController.h
View file @
922efd33
...
...
@@ -10,6 +10,7 @@
#include <QPixmap>
#include <QMap>
#include <QUrl>
#include <QByteArray>
//#include "UBDockPaletteWidget.h"
...
...
@@ -75,6 +76,9 @@ public:
const
UBFeature
&
getCurrentElement
()
const
{
return
currentElement
;
}
void
setCurrentElement
(
const
UBFeature
&
elem
)
{
currentElement
=
elem
;
}
const
UBFeature
&
getTrashElement
()
const
{
return
trashElement
;
}
UBFeature
addDownloadedFile
(
const
QUrl
&
sourceUrl
,
const
QByteArray
&
pData
);
UBFeature
moveItemToFolder
(
const
QUrl
&
url
,
const
UBFeature
&
destination
);
UBFeature
copyItemToFolder
(
const
QUrl
&
url
,
const
UBFeature
&
destination
);
void
deleteItem
(
const
QUrl
&
url
);
...
...
src/gui/UBFeaturesWidget.cpp
View file @
922efd33
...
...
@@ -126,6 +126,8 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name):UBDockPale
connect
(
thumbSlider
,
SIGNAL
(
sliderMoved
(
int
)
),
this
,
SLOT
(
thumbnailSizeChanged
(
int
)
)
);
connect
(
UBApplication
::
boardController
,
SIGNAL
(
displayMetadata
(
QMap
<
QString
,
QString
>
)
),
this
,
SLOT
(
onDisplayMetadata
(
QMap
<
QString
,
QString
>
)
)
);
connect
(
UBDownloadManager
::
downloadManager
(),
SIGNAL
(
addDownloadedFileToLibrary
(
bool
,
QUrl
,
QString
,
QByteArray
)
),
this
,
SLOT
(
onAddDownloadedFileToLibrary
(
bool
,
QUrl
,
QString
,
QByteArray
)
)
);
}
bool
UBFeaturesWidget
::
eventFilter
(
QObject
*
target
,
QEvent
*
event
)
...
...
@@ -317,6 +319,20 @@ void UBFeaturesWidget::onDisplayMetadata( QMap<QString,QString> metadata )
mActionBar
->
setCurrentState
(
IN_PROPERTIES
);
}
void
UBFeaturesWidget
::
onAddDownloadedFileToLibrary
(
bool
pSuccess
,
QUrl
sourceUrl
,
QString
pContentHeader
,
QByteArray
pData
)
{
if
(
pSuccess
)
{
UBFeature
newFeature
=
controller
->
addDownloadedFile
(
sourceUrl
,
pData
);
if
(
newFeature
!=
UBFeature
()
)
{
featuresModel
->
addItem
(
newFeature
);
QSortFilterProxyModel
*
model
=
dynamic_cast
<
QSortFilterProxyModel
*>
(
featuresListView
->
model
()
);
model
->
invalidate
();
}
}
}
void
UBFeaturesWidget
::
switchToListView
()
{
stackedWidget
->
setCurrentIndex
(
ID_LISTVIEW
);
...
...
@@ -557,7 +573,34 @@ UBFeatureProperties::UBFeatureProperties( QWidget *parent, const char *name ) :
connect
(
mpAddPageButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
onAddToPage
())
);
connect
(
mpSetAsBackgroundButton
,
SIGNAL
(
clicked
()
),
this
,
SLOT
(
onSetAsBackground
()
)
);
connect
(
mpAddToLibButton
,
SIGNAL
(
clicked
()
),
this
,
SLOT
(
onAddToLib
()
)
);
}
void
UBFeatureProperties
::
resizeEvent
(
QResizeEvent
*
event
)
{
Q_UNUSED
(
event
);
adaptSize
();
}
void
UBFeatureProperties
::
showEvent
(
QShowEvent
*
event
)
{
Q_UNUSED
(
event
);
adaptSize
();
}
void
UBFeatureProperties
::
adaptSize
()
{
if
(
NULL
!=
mpOrigPixmap
)
{
if
(
width
()
<
THUMBNAIL_WIDTH
+
40
)
{
mpThumbnail
->
setPixmap
(
mpOrigPixmap
->
scaledToWidth
(
width
()
-
40
)
);
}
else
{
mpThumbnail
->
setPixmap
(
mpOrigPixmap
->
scaledToWidth
(
THUMBNAIL_WIDTH
)
);
}
}
}
void
UBFeatureProperties
::
showElement
(
const
UBFeature
&
elem
)
...
...
@@ -629,6 +672,22 @@ void UBFeatureProperties::onAddToPage()
featuresWidget
->
getFeaturesController
()
->
addItemToPage
(
*
mpElement
);
}
void
UBFeatureProperties
::
onAddToLib
()
{
if
(
UBApplication
::
isFromWeb
(
mpElement
->
getFullPath
().
toString
()
)
)
{
sDownloadFileDesc
desc
;
desc
.
isBackground
=
false
;
desc
.
modal
=
false
;
desc
.
name
=
QFileInfo
(
mpElement
->
getFullPath
().
toString
()).
fileName
();
qDebug
()
<<
desc
.
name
;
desc
.
url
=
mpElement
->
getFullPath
().
toString
();
qDebug
()
<<
desc
.
url
;
UBDownloadManager
::
downloadManager
()
->
addFileToDownload
(
desc
);
}
}
void
UBFeatureProperties
::
onSetAsBackground
()
{
QWidget
*
w
=
parentWidget
()
->
parentWidget
();
...
...
src/gui/UBFeaturesWidget.h
View file @
922efd33
...
...
@@ -100,6 +100,7 @@ private slots:
void
removeFromFavorite
(
const
QMimeData
&
);
void
thumbnailSizeChanged
(
int
);
void
onDisplayMetadata
(
QMap
<
QString
,
QString
>
);
void
onAddDownloadedFileToLibrary
(
bool
,
QUrl
,
QString
,
QByteArray
);
protected
:
bool
eventFilter
(
QObject
*
target
,
QEvent
*
event
);
};
...
...
@@ -151,17 +152,18 @@ public:
protected
:
//
void resizeEvent(QResizeEvent *event);
//
void showEvent(QShowEvent *event);
void
resizeEvent
(
QResizeEvent
*
event
);
void
showEvent
(
QShowEvent
*
event
);
private
slots
:
void
onAddToPage
();
//
void onAddToLib();
void
onAddToLib
();
void
onSetAsBackground
();
//void onBack();
private
:
void
populateMetadata
();
void
adaptSize
();
QVBoxLayout
*
mpLayout
;
QHBoxLayout
*
mpButtonLayout
;
...
...
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