Merge branch 'Bett-2012' of github.com:Sankore/Sankore-3.1 into Bett-2012

preferencesAboutTextFull
shibakaneki 13 years ago
commit 86f30482d7
  1. 10
      src/board/UBBoardView.cpp
  2. 39
      src/customWidgets/UBDraggableLabel.cpp
  3. 23
      src/customWidgets/UBDraggableLabel.h
  4. 8
      src/customWidgets/customWidgets.pri
  5. 28
      src/gui/UBMediaPlayer.cpp
  6. 12
      src/gui/UBMediaPlayer.h
  7. 44
      src/gui/UBTeacherBarWidget.cpp
  8. 7
      src/gui/UBTeacherBarWidget.h

@ -19,6 +19,7 @@
#include "UBDrawingController.h"
#include "frameworks/UBGeometryUtils.h"
#include "frameworks/UBPlatformUtils.h"
#include "core/UBSettings.h"
#include "core/UBMimeData.h"
@ -33,8 +34,8 @@
#include "gui/UBToolWidget.h"
#include "gui/UBResources.h"
#include "gui/UBMainWindow.h"
#include "gui/UBTeacherBarWidget.h"
#include "gui/UBMediaPlayer.h"
#include "gui/UBThumbnailWidget.h"
#include "board/UBBoardController.h"
@ -44,9 +45,8 @@
#include "domain/UBItem.h"
#include "document/UBDocumentProxy.h"
#include "../gui/UBThumbnailWidget.h"
#include "frameworks/UBPlatformUtils.h"
#include "customWidgets/UBDraggableLabel.h"
#include "core/memcheck.h"
@ -727,7 +727,7 @@ void
UBBoardView::dropEvent (QDropEvent *event)
{
qDebug() << event->source();
if(!event->source() || dynamic_cast<UBThumbnailWidget *>(event->source()) || dynamic_cast<QWebView*>(event->source()) || dynamic_cast<UBTeacherBarPreviewMedia *>(event->source()))
if(!event->source() || dynamic_cast<UBThumbnailWidget *>(event->source()) || dynamic_cast<QWebView*>(event->source()) || dynamic_cast<UBDraggableMediaPlayer *>(event->source()) || dynamic_cast<UBDraggableLabel *>(event->source()))
{
mController->processMimeData (event->mimeData (), mapToScene (event->pos ()));
event->acceptProposedAction ();

@ -0,0 +1,39 @@
#include <QMimeData>
#include <QDrag>
#include <QUrl>
#include "UBDraggableLabel.h"
UBDraggableLabel::UBDraggableLabel(QWidget *parent) :
QLabel(parent)
{
}
UBDraggableLabel::~UBDraggableLabel()
{
//NOOP
}
void UBDraggableLabel::loadImage(QString imagePath)
{
mSourcePath = imagePath;
QPixmap pix = QPixmap(mSourcePath);
setPixmap(pix);
setScaledContents(true);
}
void UBDraggableLabel::mousePressEvent(QMouseEvent *event)
{
Q_UNUSED(event);
QMimeData *mimeData = new QMimeData;
QList<QUrl> urls;
urls << QUrl::fromLocalFile(mSourcePath);
mimeData->setUrls(urls);
mimeData->setText(mSourcePath);
QDrag *drag = new QDrag(this);
drag->setMimeData(mimeData);
drag->start();
}

@ -0,0 +1,23 @@
#ifndef UBDRAGGABLELABEL_H
#define UBDRAGGABLELABEL_H
#include <QLabel>
class UBDraggableLabel : public QLabel
{
Q_OBJECT
public:
UBDraggableLabel(QWidget *parent = 0);
~UBDraggableLabel();
void loadImage(QString imagePath);
signals:
public slots:
protected:
QString mSourcePath;
void mousePressEvent(QMouseEvent *event);
};
#endif // UBDRAGGABLELABEL_H

@ -1,5 +1,9 @@
HEADERS += src/customWidgets/UBWidgetList.h
HEADERS += src/customWidgets/UBWidgetList.h \
src/customWidgets/UBDraggableLabel.h
SOURCES += src/customWidgets/UBWidgetList.cpp \
src/customWidgets/UBDraggableLabel.cpp
SOURCES += src/customWidgets/UBWidgetList.cpp

@ -343,3 +343,31 @@ void UBMediaPlayer::hasVideoChanged(bool bHasVideo)
// info->setVisible(!bHasVideo);
m_videoWindow.setVisible(bHasVideo);
}
//*************************************************************************
UBDraggableMediaPlayer::UBDraggableMediaPlayer():UBMediaPlayer()
{
// setAcceptDrops(true);
}
void UBDraggableMediaPlayer::setFile(const QString &text)
{
mSourcePath = text;
UBMediaPlayer::setFile(text);
}
void UBDraggableMediaPlayer::mousePressEvent(QMouseEvent *event)
{
Q_UNUSED(event);
QMimeData *mimeData = new QMimeData;
QList<QUrl> urls;
urls << QUrl::fromLocalFile(mSourcePath);
mimeData->setUrls(urls);
mimeData->setText(mSourcePath);
QDrag *drag = new QDrag(this);
drag->setMimeData(mimeData);
drag->start();
}

@ -89,4 +89,16 @@ private:
Phonon::Path m_audioOutputPath;
};
class UBDraggableMediaPlayer : public UBMediaPlayer
{
Q_OBJECT
public:
UBDraggableMediaPlayer();
void setFile(const QString &text);
protected:
QString mSourcePath;
void mousePressEvent(QMouseEvent *event);
};
#endif // UBUBMediaPlayer_H

@ -15,6 +15,8 @@
#include "frameworks/UBFileSystemUtils.h"
#include "customWidgets/UBDraggableLabel.h"
#include "core/memcheck.h"
UBTeacherBarWidget::UBTeacherBarWidget(QWidget *parent, const char *name):UBDockPaletteWidget(parent)
@ -593,7 +595,6 @@ void UBTeacherBarDropMediaZone::reloadMedia(QStringList pList)
foreach(QString eachString, pList){
addMedia(eachString);
}
}
void UBTeacherBarDropMediaZone::dropEvent(QDropEvent *pEvent)
@ -809,15 +810,11 @@ void UBTeacherBarPreviewWidget::setDuration(eDuration duration)
UBTeacherBarPreviewMedia::UBTeacherBarPreviewMedia(QWidget* parent, const char* name) : QWidget(parent)
{
setObjectName(name);
setAcceptDrops(true);
mWidget = new UBWidgetList(parent);
mWidget->setEmptyText(tr("No media found"));
mLayout.addWidget(mWidget);
setLayout(&mLayout);
//TO TEST only
// QStringList mediaPathList;
// mediaPathList << "/home/claudio/Desktop/PIPPO.jpg";
// loadMedia(mediaPathList);
mWidgetList.clear();
}
UBTeacherBarPreviewMedia::~UBTeacherBarPreviewMedia()
@ -830,28 +827,25 @@ UBTeacherBarPreviewMedia::~UBTeacherBarPreviewMedia()
}
// for test only
QString tempString;
void UBTeacherBarPreviewMedia::loadMedia(QStringList pMedias)
{
foreach(QWidget* eachWidget, mWidgetList.keys())
delete eachWidget;
mWidgetList.clear();
foreach(QString eachString, pMedias){
if(!eachString.isEmpty()){
tempString = eachString;
QString mimeType = UBFileSystemUtils::mimeTypeFromFileName(eachString);
if(mimeType.contains("image")){
QPixmap pix = QPixmap(eachString);
QLabel* label = new QLabel();
label->setPixmap(pix);
label->setScaledContents(true);
UBDraggableLabel* label = new UBDraggableLabel();
label->loadImage(eachString);
mWidget->addWidget(label);
// mWidgetList << label;
mWidgetList[label]=eachString;
}
else if(mimeType.contains("video") || mimeType.contains("audio")){
UBMediaPlayer* mediaPlayer = new UBMediaPlayer();
UBDraggableMediaPlayer* mediaPlayer = new UBDraggableMediaPlayer();
mediaPlayer->setFile(eachString);
mWidget->addWidget(mediaPlayer);
// mWidgetList << mediaPlayer;
mWidgetList[mediaPlayer] = eachString;
}
else{
qWarning() << "pMediaPath" << eachString;
@ -860,19 +854,3 @@ void UBTeacherBarPreviewMedia::loadMedia(QStringList pMedias)
}
}
}
void UBTeacherBarPreviewMedia::mousePressEvent(QMouseEvent *event)
{
Q_UNUSED(event);
QMimeData *mimeData = new QMimeData;
QList<QUrl> urls;
urls << QUrl::fromLocalFile(tempString);
mimeData->setUrls(urls);
mimeData->setText(tempString);
QDrag *drag = new QDrag(this);
drag->setMimeData(mimeData);
drag->start();
}

@ -87,12 +87,7 @@ public:
private:
UBWidgetList* mWidget;
QVBoxLayout mLayout;
protected:
void mousePressEvent(QMouseEvent *event);
public slots:
QMap<QWidget*,QString>mWidgetList;
};
class UBUrlWidget : public QWidget

Loading…
Cancel
Save