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
a3af649c
Commit
a3af649c
authored
Nov 09, 2011
by
shibakaneki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backup of the download manager
parent
ff0abb53
Changes
16
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
184 additions
and
28 deletions
+184
-28
download_close.png
resources/images/download_close.png
+0
-0
download_open.png
resources/images/download_open.png
+0
-0
sankore.qrc
resources/sankore.qrc
+2
-0
style.qss
resources/style.qss
+2
-1
UBBoardController.cpp
src/board/UBBoardController.cpp
+1
-7
UBBoardPaletteManager.cpp
src/board/UBBoardPaletteManager.cpp
+34
-15
UBBoardPaletteManager.h
src/board/UBBoardPaletteManager.h
+5
-1
UBLibraryController.cpp
src/board/UBLibraryController.cpp
+1
-0
UBDownloadManager.cpp
src/core/UBDownloadManager.cpp
+7
-0
UBDownloadManager.h
src/core/UBDownloadManager.h
+1
-0
UBDockDownloadWidget.cpp
src/gui/UBDockDownloadWidget.cpp
+49
-0
UBDockDownloadWidget.h
src/gui/UBDockDownloadWidget.h
+36
-0
UBDownloadWidget.cpp
src/gui/UBDownloadWidget.cpp
+2
-0
UBLibPathViewer.cpp
src/gui/UBLibPathViewer.cpp
+37
-2
UBLibPathViewer.h
src/gui/UBLibPathViewer.h
+3
-0
gui.pri
src/gui/gui.pri
+4
-2
No files found.
resources/images/download_close.png
0 → 100644
View file @
a3af649c
592 Bytes
resources/images/download_open.png
0 → 100644
View file @
a3af649c
605 Bytes
resources/sankore.qrc
View file @
a3af649c
...
...
@@ -335,5 +335,7 @@
<file>style.qss</file>
<file>images/teacher_open_disabled.png</file>
<file>images/libpalette/WebSearchCategory.svg</file>
<file>images/download_close.png</file>
<file>images/download_open.png</file>
</qresource>
</RCC>
resources/style.qss
View file @
a3af649c
...
...
@@ -3,7 +3,8 @@ QWidget#documentNavigator,
QWidget#UBLibPathViewer,
QWidget#UBTeacherStudentAction,
QWidget#UBLibNavigatorWidget,
QWidget#UBLibItemProperties
QWidget#UBLibItemProperties,
QWidget#UBDownloadWidget
{
background: #EEEEEE;
border-radius: 10px;
...
...
src/board/UBBoardController.cpp
View file @
a3af649c
...
...
@@ -726,6 +726,7 @@ void UBBoardController::lastScene()
void
UBBoardController
::
downloadURL
(
const
QUrl
&
url
,
const
QPointF
&
pPos
,
const
QSize
&
pSize
,
bool
isBackground
)
{
qDebug
()
<<
"something has been dropped on the board! Url is: "
<<
url
.
toString
();
QString
sUrl
=
url
.
toString
();
if
(
sUrl
.
startsWith
(
"uniboardTool://"
))
...
...
@@ -766,14 +767,7 @@ void UBBoardController::downloadURL(const QUrl& url, const QPointF& pPos, const
desc
.
size
=
pSize
;
desc
.
isBackground
=
isBackground
;
// INFO: DO NOT UNCOMMENT THE NEXT LINE! DEVELOPMENT IN PROGRESS
UBDownloadManager
::
downloadManager
()
->
addFileToDownload
(
desc
);
// UBHttpGet *http = new UBHttpGet(mActiveScene);
// showMessage(tr("Downloading content from %1").arg(url.toString()), true);
// connect(http, SIGNAL(downloadFinished(bool, QUrl, QString, QByteArray, QPointF, QSize, bool)),
// this, SLOT(downloadFinished(bool, QUrl, QString, QByteArray, QPointF, QSize, bool)));
// http->get(url, pPos, pSize, isBackground);
}
}
...
...
src/board/UBBoardPaletteManager.cpp
View file @
a3af649c
...
...
@@ -82,6 +82,7 @@ UBBoardPaletteManager::UBBoardPaletteManager(QWidget* container, UBBoardControll
,
mpCachePropWidget
(
NULL
)
,
mpTeacherBarWidget
(
NULL
)
,
mpDesktopLibWidget
(
NULL
)
,
mpDownloadWidget
(
NULL
)
{
setupPalettes
();
connectPalettes
();
...
...
@@ -90,6 +91,11 @@ UBBoardPaletteManager::UBBoardPaletteManager(QWidget* container, UBBoardControll
UBBoardPaletteManager
::~
UBBoardPaletteManager
()
{
if
(
NULL
!=
mpDownloadWidget
)
{
delete
mpDownloadWidget
;
mpDownloadWidget
=
NULL
;
}
if
(
NULL
!=
mpTeacherBarWidget
)
{
delete
mpTeacherBarWidget
;
...
...
@@ -182,7 +188,9 @@ void UBBoardPaletteManager::setupDockPaletteWidgets()
mpTeacherBarWidget
->
registerMode
(
eUBDockPaletteWidget_BOARD
);
// connect(this, SIGNAL(signal_changeMode(eUBDockPaletteWidgetMode)), mpTeacherBarWidget, SLOT(slot_changeMode(eUBDockPaletteWidgetMode)));
//------------------------------------------------//
mpDownloadWidget
=
new
UBDockDownloadWidget
();
mpDownloadWidget
->
registerMode
(
eUBDockPaletteWidget_BOARD
);
// Add the dock palettes
mLeftPalette
=
new
UBLeftPalette
(
mContainer
);
...
...
@@ -192,29 +200,24 @@ void UBBoardPaletteManager::setupDockPaletteWidgets()
mLeftPalette
->
connectSignals
();
//------------------------------------------------//
mRightPalette
=
new
UBRightPalette
(
mContainer
);
// RIGHT palette widgets
mRightPalette
->
registerWidget
(
mpLibWidget
);
mRightPalette
->
addTab
(
mpLibWidget
);
// ???
// The cache widget will be visible only if a cache is put on the page
mRightPalette
->
registerWidget
(
mpCachePropWidget
);
// mRightPalette->addTab(mpCachePropWidget);
// ???
// The teacher bar widget will always be there
mRightPalette
->
registerWidget
(
mpTeacherBarWidget
);
mRightPalette
->
addTab
(
mpTeacherBarWidget
);
// The download widget will be part of the right palette but
// will become visible only when the first download starts
mRightPalette
->
registerWidget
(
mpDownloadWidget
);
mRightPalette
->
connectSignals
();
//------------------------------------------------//
changeMode
(
eUBDockPaletteWidget_BOARD
,
true
);
//------------------------------------------------//
// Hide the tabs that must be hidden
mRightPalette
->
removeTab
(
mpDownloadWidget
->
name
());
mRightPalette
->
removeTab
(
mpCachePropWidget
->
name
());
// mLeftPalette->showTabWidget(0);
// mRightPalette->showTabWidget(0);
...
...
@@ -1003,3 +1006,19 @@ void UBBoardPaletteManager::refreshPalettes()
mRightPalette
->
update
();
mLeftPalette
->
update
();
}
void
UBBoardPaletteManager
::
startDownloads
()
{
if
(
!
mpDownloadWidget
->
isVisible
())
{
mRightPalette
->
addTab
(
mpDownloadWidget
);
}
}
void
UBBoardPaletteManager
::
stopDownloads
()
{
if
(
mpDownloadWidget
->
isVisible
())
{
mRightPalette
->
removeTab
(
mpDownloadWidget
->
name
());
}
}
src/board/UBBoardPaletteManager.h
View file @
a3af649c
...
...
@@ -26,6 +26,7 @@
#include "gui/UBLibWidget.h"
#include "gui/UBCachePropertiesWidget.h"
#include "gui/UBTeacherBarWidget.h"
#include "gui/UBDockDownloadWidget.h"
#include "core/UBApplicationController.h"
...
...
@@ -62,6 +63,8 @@ class UBBoardPaletteManager : public QObject
void
processPalettersWidget
(
UBDockPalette
*
paletter
,
eUBDockPaletteWidgetMode
mode
);
void
changeMode
(
eUBDockPaletteWidgetMode
newMode
,
bool
isInit
=
false
);
void
startDownloads
();
void
stopDownloads
();
signals
:
...
...
@@ -134,7 +137,8 @@ class UBBoardPaletteManager : public QObject
UBCachePropertiesWidget
*
mpCachePropWidget
;
/** The teacher bar widget */
UBTeacherBarWidget
*
mpTeacherBarWidget
;
/** The download widget */
UBDockDownloadWidget
*
mpDownloadWidget
;
// HACK: here we duplicate the lib widget for the desktop mode
// we MUST refactor the architecture in order to use only one
// lib widget!
...
...
src/board/UBLibraryController.cpp
View file @
a3af649c
...
...
@@ -110,6 +110,7 @@ void UBLibraryController::createDirectory(QUrl& pDirPath)
void
UBLibraryController
::
routeItem
(
QString
&
pItem
,
QString
pMiddleDirectory
)
{
qDebug
()
<<
"routeItem: "
<<
pItem
;
QFileInfo
itemToRoute
(
pItem
);
QString
mimetype
=
UBFileSystemUtils
::
mimeTypeFromFileName
(
itemToRoute
.
fileName
());
QString
destination
(
""
);
...
...
src/core/UBDownloadManager.cpp
View file @
a3af649c
...
...
@@ -251,6 +251,13 @@ void UBDownloadManager::updateFileCurrentSize(int id, qint64 received, qint64 to
onUpdateDownloadLists
();
emit
downloadFinished
(
id
);
// Verify if all downloads are finished
if
(
mCrntDL
.
empty
()
&&
mPendingDL
.
empty
())
{
emit
allDownloadsFinished
();
}
break
;
}
...
...
src/core/UBDownloadManager.h
View file @
a3af649c
...
...
@@ -79,6 +79,7 @@ signals:
void
downloadModalFinished
();
void
addDownloadedFileToBoard
(
bool
pSuccess
,
QUrl
sourceUrl
,
QString
pContentTypeHeader
,
QByteArray
pData
,
QPointF
pPos
,
QSize
pSize
,
bool
isBackground
);
void
cancelAllDownloads
();
void
allDownloadsFinished
();
private
slots
:
void
onUpdateDownloadLists
();
...
...
src/gui/UBDockDownloadWidget.cpp
0 → 100644
View file @
a3af649c
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "UBDockDownloadWidget.h"
#include "core/UBApplication.h"
UBDockDownloadWidget
::
UBDockDownloadWidget
(
QWidget
*
parent
,
const
char
*
name
)
:
UBDockPaletteWidget
(
parent
,
name
)
,
mpLayout
(
NULL
)
,
mpDLWidget
(
NULL
)
{
mName
=
"DownloadWidget"
;
setAttribute
(
Qt
::
WA_StyledBackground
,
true
);
setStyleSheet
(
UBApplication
::
globalStyleSheet
());
mIconToLeft
=
QPixmap
(
":images/download_open.png"
);
mIconToRight
=
QPixmap
(
":images/download_close.png"
);
mpLayout
=
new
QVBoxLayout
(
this
);
setLayout
(
mpLayout
);
mpDLWidget
=
new
UBDownloadWidget
(
this
);
mpLayout
->
addWidget
(
mpDLWidget
);
}
UBDockDownloadWidget
::~
UBDockDownloadWidget
()
{
if
(
NULL
!=
mpDLWidget
)
{
delete
mpDLWidget
;
mpDLWidget
=
NULL
;
}
if
(
NULL
!=
mpLayout
)
{
delete
mpLayout
;
mpLayout
=
NULL
;
}
}
src/gui/UBDockDownloadWidget.h
0 → 100644
View file @
a3af649c
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef UBDOCKDOWNLOADWIDGET_H
#define UBDOCKDOWNLOADWIDGET_H
#include <QWidget>
#include <QVBoxLayout>
#include "UBDockPaletteWidget.h"
#include "UBDownloadWidget.h"
class
UBDockDownloadWidget
:
public
UBDockPaletteWidget
{
Q_OBJECT
public
:
UBDockDownloadWidget
(
QWidget
*
parent
=
0
,
const
char
*
name
=
"UBDockDownloadWidget"
);
~
UBDockDownloadWidget
();
private
:
QVBoxLayout
*
mpLayout
;
UBDownloadWidget
*
mpDLWidget
;
};
#endif // UBDOCKDOWNLOADWIDGET_H
src/gui/UBDownloadWidget.cpp
View file @
a3af649c
...
...
@@ -49,6 +49,7 @@ UBDownloadWidget::UBDownloadWidget(QWidget *parent, const char *name):QWidget(pa
mpBttnLayout
=
new
QHBoxLayout
();
mpBttnLayout
->
addStretch
(
1
);
mpCancelBttn
=
new
QPushButton
(
tr
(
"Cancel"
),
this
);
mpCancelBttn
->
setObjectName
(
"DockPaletteWidgetButton"
);
mpBttnLayout
->
addWidget
(
mpCancelBttn
,
0
);
mpLayout
->
addLayout
(
mpBttnLayout
);
...
...
@@ -175,6 +176,7 @@ void UBDownloadWidget::onDownloadUpdated(int id, qint64 crnt, qint64 total)
*/
void
UBDownloadWidget
::
onDownloadFinished
(
int
id
)
{
Q_UNUSED
(
id
);
// Refresh the file's list
onFileAddedToDownload
();
}
...
...
src/gui/UBLibPathViewer.cpp
View file @
a3af649c
...
...
@@ -21,6 +21,8 @@
#include "board/UBBoardController.h"
#include "core/memcheck.h"
#include "core/UBDownloadManager.h"
#include "board/UBBoardPaletteManager.h"
/**
* \brief Constructor
...
...
@@ -367,7 +369,7 @@ void UBFolderPath::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
UBPathScene
::
UBPathScene
(
QWidget
*
parent
)
:
QGraphicsScene
(
parent
)
{
connect
(
UBDownloadManager
::
downloadManager
(),
SIGNAL
(
allDownloadsFinished
()),
this
,
SLOT
(
onAllDownloadsFinished
()));
}
UBPathScene
::~
UBPathScene
()
...
...
@@ -457,7 +459,7 @@ void UBPathScene::dropEvent(QGraphicsSceneDragDropEvent *event)
{
const
QMimeData
*
pMimeData
=
event
->
mimeData
();
if
(
0
==
QString
::
compare
(
event
->
source
()
->
metaObject
()
->
className
(),
"UBLibraryWidget"
))
if
(
NULL
!=
event
->
source
()
&&
0
==
QString
::
compare
(
event
->
source
()
->
metaObject
()
->
className
(),
"UBLibraryWidget"
))
{
UBLibElement
*
pTargetElement
=
elementFromPos
(
event
->
scenePos
());
if
(
NULL
!=
pTargetElement
)
...
...
@@ -480,6 +482,33 @@ void UBPathScene::dropEvent(QGraphicsSceneDragDropEvent *event)
event
->
accept
();
}
else
if
(
NULL
!=
event
->
mimeData
()
&&
event
->
mimeData
()
->
hasUrls
())
{
QList
<
QUrl
>
urls
=
event
->
mimeData
()
->
urls
();
foreach
(
QUrl
eachUrl
,
urls
)
{
QString
sUrl
=
eachUrl
.
toString
();
if
(
!
sUrl
.
startsWith
(
"uniboardTool://"
)
&&
!
sUrl
.
startsWith
(
"file://"
)
&&
!
sUrl
.
startsWith
(
"/"
))
{
// The dropped URL comes from the web
qDebug
()
<<
"Dropped url: "
<<
sUrl
;
// Show the download palette if it is hidden
UBApplication
::
boardController
->
paletteManager
()
->
startDownloads
();
// Add the dropped url to the download list
sDownloadFileDesc
desc
;
desc
.
currentSize
=
0
;
desc
.
id
=
0
;
desc
.
isBackground
=
false
;
desc
.
modal
=
false
;
desc
.
name
=
QFileInfo
(
sUrl
).
fileName
();
desc
.
totalSize
=
0
;
desc
.
url
=
sUrl
;
UBDownloadManager
::
downloadManager
()
->
addFileToDownload
(
desc
);
}
}
}
else
{
event
->
ignore
();
...
...
@@ -507,3 +536,9 @@ UBLibElement* UBPathScene::elementFromPos(QPointF p)
return
pElem
;
}
void
UBPathScene
::
onAllDownloadsFinished
()
{
// Hide the download tab
UBApplication
::
boardController
->
paletteManager
()
->
stopDownloads
();
}
src/gui/UBLibPathViewer.h
View file @
a3af649c
...
...
@@ -59,6 +59,9 @@ protected:
void
dragMoveEvent
(
QGraphicsSceneDragDropEvent
*
event
);
void
dropEvent
(
QGraphicsSceneDragDropEvent
*
event
);
private
slots
:
void
onAllDownloadsFinished
();
private
:
UBLibElement
*
elementFromPos
(
QPointF
p
);
/** The drag start position */
...
...
src/gui/gui.pri
View file @
a3af649c
...
...
@@ -45,7 +45,8 @@ HEADERS += src/gui/UBThumbnailView.h \
src/gui/UBCachePropertiesWidget.h \
src/gui/UBTeacherBarWidget.h \
src/gui/UBLibWebView.h \
src/gui/UBDownloadWidget.h
src/gui/UBDownloadWidget.h \
src/gui/UBDockDownloadWidget.h
SOURCES += src/gui/UBThumbnailView.cpp \
src/gui/UBFloatingPalette.cpp \
...
...
@@ -93,7 +94,8 @@ SOURCES += src/gui/UBThumbnailView.cpp \
src/gui/UBCachePropertiesWidget.cpp \
src/gui/UBTeacherBarWidget.cpp \
src/gui/UBLibWebView.cpp \
src/gui/UBDownloadWidget.cpp
src/gui/UBDownloadWidget.cpp \
src/gui/UBDockDownloadWidget.cpp
win32 {
...
...
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