Merge branch 'master' of github.com:Sankore/Sankore-3.1

preferencesAboutTextFull
Claudio Valerio 13 years ago
commit 2e0bf00367
  1. 3
      resources/style.qss
  2. 95
      src/adaptors/UBExportFullPDF.cpp
  3. 7
      src/adaptors/UBExportFullPDF.h
  4. 1
      src/adaptors/UBExportPDF.cpp
  5. 3
      src/adaptors/UBMetadataDcSubsetAdaptor.cpp
  6. 1
      src/core/UBSettings.cpp
  7. 1
      src/core/UBSettings.h
  8. 9
      src/customWidgets/UBWidgetList.cpp
  9. 4
      src/customWidgets/UBWidgetList.h
  10. 2
      src/desktop/UBDesktopAnnotationController.cpp
  11. 5
      src/document/UBDocumentController.cpp
  12. 9
      src/document/UBDocumentProxy.cpp
  13. 1
      src/document/UBDocumentProxy.h
  14. 10
      src/domain/UBGraphicsTextItemDelegate.cpp
  15. 2
      src/gui/UBDockPalette.cpp
  16. 9
      src/gui/UBDocumentNavigator.cpp
  17. 2
      src/gui/UBLibPathViewer.cpp
  18. 5
      src/gui/UBLibraryWidget.cpp
  19. 3
      src/gui/UBResources.cpp
  20. 1
      src/gui/UBResources.h
  21. 9
      src/gui/UBTBDocumentEditWidget.cpp
  22. 2
      src/gui/UBTBDocumentEditWidget.h
  23. 134
      src/gui/UBTBDocumentPreviewWidget.cpp
  24. 29
      src/gui/UBTBDocumentPreviewWidget.h
  25. 2
      src/gui/UBTBPageEditWidget.cpp
  26. 10
      src/gui/UBTeacherBarDataMgr.cpp
  27. 9
      src/gui/UBTeacherBarDataMgr.h
  28. 43
      src/gui/UBTeacherBarPreviewWidget.cpp
  29. 7
      src/gui/UBTeacherBarPreviewWidget.h
  30. 6
      src/gui/UBTeacherBarWidget.cpp
  31. 1
      src/gui/UBTeacherBarWidget.h
  32. 63
      src/gui/UBThumbnailWidget.cpp
  33. 2
      src/gui/UBThumbnailWidget.h

@ -27,7 +27,8 @@ QWidget#UBMediaVideoContainer
border: 2px solid #999999; border: 2px solid #999999;
} }
QWidget#UBTeacherBarPreviewWidget
QWidget#UBTBPreviewWidget
{ {
background: #FFFFFF; background: #FFFFFF;
border-radius: 10px; border-radius: 10px;

@ -46,7 +46,10 @@ using namespace merge_lib;
UBExportFullPDF::UBExportFullPDF(QObject *parent) UBExportFullPDF::UBExportFullPDF(QObject *parent)
: UBExportAdaptor(parent) : UBExportAdaptor(parent)
{ {
// NOOP //need to calculate screen resolution
QDesktopWidget* desktop = UBApplication::desktop();
int dpiCommon = (desktop->physicalDpiX() + desktop->physicalDpiY()) / 2;
mScaleFactor = 72.0f / dpiCommon;
} }
@ -56,7 +59,7 @@ UBExportFullPDF::~UBExportFullPDF()
} }
void UBExportFullPDF::saveOverlayPdf(UBDocumentProxy* pDocumentProxy, QString filename) void UBExportFullPDF::saveOverlayPdf(UBDocumentProxy* pDocumentProxy, const QString& filename)
{ {
if (!pDocumentProxy || filename.length() == 0 || pDocumentProxy->pageCount() == 0) if (!pDocumentProxy || filename.length() == 0 || pDocumentProxy->pageCount() == 0)
return; return;
@ -70,9 +73,6 @@ void UBExportFullPDF::saveOverlayPdf(UBDocumentProxy* pDocumentProxy, QString fi
pdfPrinter.setOutputFileName(filename); pdfPrinter.setOutputFileName(filename);
pdfPrinter.setFullPage(true); pdfPrinter.setFullPage(true);
const qreal margin = UBSettings::settings()->pdfMargin->get().toDouble() * pdfPrinter.resolution() / 25.4;
mMargin = margin;
QPainter* pdfPainter = 0; QPainter* pdfPainter = 0;
for(int pageIndex = 0 ; pageIndex < pDocumentProxy->pageCount(); pageIndex++) for(int pageIndex = 0 ; pageIndex < pDocumentProxy->pageCount(); pageIndex++)
@ -87,54 +87,20 @@ void UBExportFullPDF::saveOverlayPdf(UBDocumentProxy* pDocumentProxy, QString fi
scene->setRenderingQuality(UBItem::RenderingQualityHigh); scene->setRenderingQuality(UBItem::RenderingQualityHigh);
scene->setRenderingContext(UBGraphicsScene::PdfExport); scene->setRenderingContext(UBGraphicsScene::PdfExport);
UBGraphicsPDFItem *pdfItem = qgraphicsitem_cast<UBGraphicsPDFItem*>(scene->backgroundObject()); QSize pageSize = scene->nominalSize();
if (pdfItem)
{
QSizeF sceneItemsBound = scene->itemsBoundingRect().size();
qreal ratio = (qreal)pdfPrinter.resolution() / 72.0;
QSizeF scaled = sceneItemsBound * ratio;
pdfPrinter.setPaperSize(scaled, QPrinter::DevicePixel);
if (pageIndex != 0) UBGraphicsPDFItem *pdfItem = qgraphicsitem_cast<UBGraphicsPDFItem*>(scene->backgroundObject());
pdfPrinter.newPage();
if (!pdfPainter)
pdfPainter = new QPainter(&pdfPrinter);
//render to PDF
scene->render(pdfPainter, QRectF(0, 0, sceneItemsBound.width() * ratio
, sceneItemsBound.height() * ratio), scene->itemsBoundingRect());
mHasPDFBackgrounds = true;
}
else
{
if (UBSettings::settings()->pdfPageFormat->get().toString() == "Letter")
pdfPrinter.setPageSize(QPrinter::Letter);
else
pdfPrinter.setPageSize(QPrinter::A4);
QSize docSize = pDocumentProxy->defaultDocumentSize(); if (pdfItem) mHasPDFBackgrounds = true;
if(docSize.width() > docSize.height())
{
pdfPrinter.setOrientation(QPrinter::Landscape);
}
if (pageIndex != 0) pdfPrinter.setPaperSize(QSizeF(pageSize.width()*mScaleFactor, pageSize.height()*mScaleFactor), QPrinter::Point);
pdfPrinter.newPage();
mDefaultPageRect = pdfPrinter.paperRect(); if (!pdfPainter) pdfPainter = new QPainter(&pdfPrinter);
QRectF paperRect = mDefaultPageRect.adjusted(margin, margin, -margin, -margin);
QRectF normalized = scene->normalizedSceneRect(paperRect.width() / paperRect.height());
if (!pdfPainter) if (pageIndex != 0) pdfPrinter.newPage();
pdfPainter = new QPainter(&pdfPrinter);
//render to PDF //render to PDF
scene->render(pdfPainter, paperRect, normalized); scene->render(pdfPainter);
}
//restore screen rendering quality //restore screen rendering quality
scene->setRenderingContext(UBGraphicsScene::Screen); scene->setRenderingContext(UBGraphicsScene::Screen);
@ -144,8 +110,7 @@ void UBExportFullPDF::saveOverlayPdf(UBDocumentProxy* pDocumentProxy, QString fi
scene->setBackground(isDark, isCrossed); scene->setBackground(isDark, isCrossed);
} }
if (pdfPainter) if (pdfPainter) delete pdfPainter;
delete pdfPainter;
} }
@ -171,12 +136,10 @@ void UBExportFullPDF::persist(UBDocumentProxy* pDocumentProxy)
} }
void UBExportFullPDF::persistsDocument(UBDocumentProxy* pDocumentProxy, QString filename) void UBExportFullPDF::persistsDocument(UBDocumentProxy* pDocumentProxy, const QString& filename)
{ {
QFile file(filename); QFile file(filename);
if (file.exists()) if (file.exists()) file.remove();
file.remove();
QString overlayName = filename; QString overlayName = filename;
overlayName.replace(".pdf", "_overlay.pdf"); overlayName.replace(".pdf", "_overlay.pdf");
@ -209,31 +172,27 @@ void UBExportFullPDF::persistsDocument(UBDocumentProxy* pDocumentProxy, QString
UBGraphicsScene* scene = UBPersistenceManager::persistenceManager()->loadDocumentScene(pDocumentProxy, pageIndex); UBGraphicsScene* scene = UBPersistenceManager::persistenceManager()->loadDocumentScene(pDocumentProxy, pageIndex);
UBGraphicsPDFItem *pdfItem = qgraphicsitem_cast<UBGraphicsPDFItem*>(scene->backgroundObject()); UBGraphicsPDFItem *pdfItem = qgraphicsitem_cast<UBGraphicsPDFItem*>(scene->backgroundObject());
if (pdfItem) QSize pageSize = scene->nominalSize();
if (pdfItem)
{ {
QString pdfName = UBPersistenceManager::objectDirectory + "/" + pdfItem->fileUuid().toString() + ".pdf"; QString pdfName = UBPersistenceManager::objectDirectory + "/" + pdfItem->fileUuid().toString() + ".pdf";
QString backgroundPath = pDocumentProxy->persistencePath() + "/" + pdfName; QString backgroundPath = pDocumentProxy->persistencePath() + "/" + pdfName;
QPointF boudingRectBottomLeft = scene->itemsBoundingRect().bottomLeft(); QPointF boudingRectBottomLeft = scene->itemsBoundingRect().bottomLeft();
QPointF pdfItemBottomLeft = pdfItem->sceneBoundingRect().bottomLeft(); QPointF pdfItemBottomLeft = pdfItem->sceneBoundingRect().bottomLeft();
QPointF offset = pdfItemBottomLeft - boudingRectBottomLeft;
qDebug() << "scene->itemsBoundingRect()" << scene->itemsBoundingRect(); qDebug() << "scene->itemsBoundingRect()" << scene->itemsBoundingRect();
qDebug() << "pdfItem->boundingRect()" << pdfItem->boundingRect(); qDebug() << "pdfItem->boundingRect()" << pdfItem->boundingRect();
qDebug() << "pdfItem->sceneBoundingRect()" << pdfItem->sceneBoundingRect(); qDebug() << "pdfItem->sceneBoundingRect()" << pdfItem->sceneBoundingRect();
qDebug() << offset;
TransformationDescription baseTrans(offset.x(), offset.y() * -1, 1, 0);
//TransformationDescription baseTrans(0, 0, 1, 0);
TransformationDescription overlayTrans(0, 0, 1, 0);
MergePageDescription pageDescription(scene->itemsBoundingRect().width(), MergePageDescription pageDescription(pageSize.width() * mScaleFactor,
scene->itemsBoundingRect().height(), pageSize.height() * mScaleFactor,
pdfItem->pageNumber(), pdfItem->pageNumber(),
QFile::encodeName(backgroundPath).constData(), QFile::encodeName(backgroundPath).constData(),
baseTrans, TransformationDescription(),
pageIndex + 1, pageIndex + 1,
overlayTrans, TransformationDescription(),
false, false); false, false);
mergeInfo.push_back(pageDescription); mergeInfo.push_back(pageDescription);
@ -242,12 +201,8 @@ void UBExportFullPDF::persistsDocument(UBDocumentProxy* pDocumentProxy, QString
} }
else else
{ {
QRectF paperRect = mDefaultPageRect.adjusted(mMargin, mMargin, -mMargin, -mMargin); MergePageDescription pageDescription(pageSize.width() * mScaleFactor,
QRectF normalized = scene->normalizedSceneRect(paperRect.width() / paperRect.height()); pageSize.height() * mScaleFactor,
MergePageDescription pageDescription(normalized.width(),
normalized.height(),
0, 0,
"", "",
TransformationDescription(), TransformationDescription(),

@ -33,14 +33,13 @@ class UBExportFullPDF : public UBExportAdaptor
virtual QString exportExtention(); virtual QString exportExtention();
virtual void persist(UBDocumentProxy* pDocument); virtual void persist(UBDocumentProxy* pDocument);
virtual void persistsDocument(UBDocumentProxy* pDocument, QString filename); virtual void persistsDocument(UBDocumentProxy* pDocument, const QString& filename);
protected: protected:
void saveOverlayPdf(UBDocumentProxy* pDocumentProxy, QString filename); void saveOverlayPdf(UBDocumentProxy* pDocumentProxy, const QString& filename);
private: private:
QRect mDefaultPageRect; float mScaleFactor;
int mMargin;
bool mHasPDFBackgrounds; bool mHasPDFBackgrounds;
}; };

@ -101,7 +101,6 @@ void UBExportPDF::persistsDocument(UBDocumentProxy* pDocumentProxy, const QStrin
//setting page size to appropriate value //setting page size to appropriate value
pdfPrinter.setPaperSize(QSizeF(pageSize.width()*scaleFactor, pageSize.height()*scaleFactor), QPrinter::Point); pdfPrinter.setPaperSize(QSizeF(pageSize.width()*scaleFactor, pageSize.height()*scaleFactor), QPrinter::Point);
pdfPrinter.setOrientation((pageSize.width() > pageSize.height())? QPrinter::Landscape : QPrinter::Portrait);
if(painterNeedsBegin) painterNeedsBegin = !pdfPainter.begin(&pdfPrinter); if(painterNeedsBegin) painterNeedsBegin = !pdfPainter.begin(&pdfPrinter);
//render to PDF //render to PDF
scene->render(&pdfPainter); scene->render(&pdfPainter);

@ -276,7 +276,6 @@ QMap<QString, QVariant> UBMetadataDcSubsetAdaptor::load(QString pPath)
qWarning() << "Document size not found, using default view size" << docSize; qWarning() << "Document size not found, using default view size" << docSize;
metadata.insert(UBSettings::documentSize, QVariant(docSize)); metadata.insert(UBSettings::documentSize, QVariant(docSize));
} }
if (!updatedAtFound) if (!updatedAtFound)
@ -284,6 +283,8 @@ QMap<QString, QVariant> UBMetadataDcSubsetAdaptor::load(QString pPath)
metadata.insert(UBSettings::documentUpdatedAt, date + "T00:00:00Z"); metadata.insert(UBSettings::documentUpdatedAt, date + "T00:00:00Z");
} }
metadata.insert(UBSettings::documentDate, QVariant(date));
return metadata; return metadata;
} }

@ -43,6 +43,7 @@ QString UBSettings::sessionKeywords = QString("sessionKeywords");
QString UBSettings::sessionLevel = QString("sessionLevel"); QString UBSettings::sessionLevel = QString("sessionLevel");
QString UBSettings::sessionTopic = QString("sessionTopic"); QString UBSettings::sessionTopic = QString("sessionTopic");
QString UBSettings::sessionAuthors = QString("sessionAuthors"); QString UBSettings::sessionAuthors = QString("sessionAuthors");
QString UBSettings::documentDate = QString("date");
QString UBSettings::trashedDocumentGroupNamePrefix = QString("_Trash:"); QString UBSettings::trashedDocumentGroupNamePrefix = QString("_Trash:");

@ -160,6 +160,7 @@ class UBSettings : public QObject
static QString sessionLevel; static QString sessionLevel;
static QString sessionTopic; static QString sessionTopic;
static QString sessionAuthors; static QString sessionAuthors;
static QString documentDate;
static QString trashedDocumentGroupNamePrefix; static QString trashedDocumentGroupNamePrefix;

@ -10,6 +10,8 @@ UBWidgetList::UBWidgetList(QWidget* parent, eWidgetListOrientation orientation,
, mMargin(5) , mMargin(5)
, mListElementsSpacing(10) , mListElementsSpacing(10)
, mpEmptyLabel(NULL) , mpEmptyLabel(NULL)
, mCanRemove(true)
, mpCurrentWidget(NULL)
{ {
setObjectName(name); setObjectName(name);
mOrientation = orientation; mOrientation = orientation;
@ -130,6 +132,13 @@ void UBWidgetList::resizeEvent(QResizeEvent *ev)
updateSizes(); updateSizes();
} }
void UBWidgetList::mousePressEvent(QMouseEvent *ev)
{
if(mCanRemove){
}
}
void UBWidgetList::updateSizes() void UBWidgetList::updateSizes()
{ {
// Resize all the widgets // Resize all the widgets

@ -41,7 +41,10 @@ public:
int listElementsSpacing() {return mListElementsSpacing; } int listElementsSpacing() {return mListElementsSpacing; }
protected: protected:
bool mCanRemove;
void resizeEvent(QResizeEvent* ev); void resizeEvent(QResizeEvent* ev);
void mousePressEvent(QMouseEvent* ev);
private: private:
int scaleWidgets(QSize pSize); int scaleWidgets(QSize pSize);
@ -55,6 +58,7 @@ private:
int mListElementsSpacing; int mListElementsSpacing;
QMap<QWidget*, QSize> mWidgetInfo; QMap<QWidget*, QSize> mWidgetInfo;
QLabel* mpEmptyLabel; QLabel* mpEmptyLabel;
QWidget* mpCurrentWidget;
}; };
#endif // UBWIDGETLIST_H #endif // UBWIDGETLIST_H

@ -81,7 +81,7 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent)
mTransparentDrawingView->setMouseTracking(true); mTransparentDrawingView->setMouseTracking(true);
mTransparentDrawingView->setAcceptDrops(false); mTransparentDrawingView->setAcceptDrops(true);
QString backgroundStyle = "QWidget {background-color: rgba(127, 127, 127, 0)}"; QString backgroundStyle = "QWidget {background-color: rgba(127, 127, 127, 0)}";
mTransparentDrawingView->setStyleSheet(backgroundStyle); mTransparentDrawingView->setStyleSheet(backgroundStyle);

@ -1150,11 +1150,10 @@ void UBDocumentController::moveSceneToIndex(UBDocumentProxy* proxy, int source,
UBMetadataDcSubsetAdaptor::persist(proxy); UBMetadataDcSubsetAdaptor::persist(proxy);
refreshDocumentThumbnailsView(); refreshDocumentThumbnailsView();
// NOTE [Didier]: I think that selecting the thumbnail is not the role of the documentController
mDocumentUI->thumbnailWidget->selectItemAt(target);
// Notify the move to anyone interested in knowing it // Notify the move to anyone interested in knowing it
emit movedToIndex(target); emit movedToIndex(target);
UBApplication::boardController->setActiveDocumentScene(proxy, target);
} }

@ -295,6 +295,15 @@ QString UBDocumentProxy::sessionAuthors()
return QString(); return QString();
} }
QString UBDocumentProxy::documentDate()
{
if(mMetaDatas.contains(UBSettings::documentDate)){
return metaData(UBSettings::documentDate).toString();
}else{
return QString();
}
}
bool UBDocumentProxy::isModified() const bool UBDocumentProxy::isModified() const
{ {
return mIsModified; return mIsModified;

@ -59,6 +59,7 @@ class UBDocumentProxy : public QObject
QString sessionTopic(); QString sessionTopic();
void setSessionAuthor(const QString& authors); void setSessionAuthor(const QString& authors);
QString sessionAuthors(); QString sessionAuthors();
QString documentDate();
QSize defaultDocumentSize() const; QSize defaultDocumentSize() const;

@ -305,10 +305,11 @@ void UBGraphicsTextItemDelegate::ChangeTextSize(int delta)
bool bEndofTheSameBlock; bool bEndofTheSameBlock;
int iBlockLen; int iBlockLen;
int iPointSize; int iPointSize;
int inewPointSize; int iNextPointSize;
int iCursorPos = startPos; int iCursorPos = startPos;
// we search continuous blocks of the text with the same PointSize and allpy new settings for them. // we search continuous blocks of the text with the same PointSize and allpy new settings for them.
cursor.setPosition (startPos, QTextCursor::MoveAnchor);
while(iCursorPos < endPos) while(iCursorPos < endPos)
{ {
bEndofTheSameBlock = false; bEndofTheSameBlock = false;
@ -326,17 +327,18 @@ void UBGraphicsTextItemDelegate::ChangeTextSize(int delta)
iBlockLen++; iBlockLen++;
cursor.setPosition (iCursorPos+iBlockLen+1, QTextCursor::KeepAnchor); cursor.setPosition (iCursorPos+iBlockLen+1, QTextCursor::KeepAnchor);
inewPointSize = cursor.charFormat().font().pointSize(); iNextPointSize = cursor.charFormat().font().pointSize();
cursor.setPosition (iCursorPos+iBlockLen, QTextCursor::KeepAnchor); cursor.setPosition (iCursorPos+iBlockLen, QTextCursor::KeepAnchor);
if ((iPointSize != inewPointSize)||(iCursorPos+iBlockLen >= endPos)) if ((iPointSize != iNextPointSize)||(iCursorPos+iBlockLen >= endPos))
bEndofTheSameBlock = true; bEndofTheSameBlock = true;
}while(!bEndofTheSameBlock); }while(!bEndofTheSameBlock);
//setting new parameners //setting new parameners
curFont.setPointSize(iPointSize + delta); int iNewPointSize = iPointSize + delta;
curFont.setPointSize( (iNewPointSize > 0)?iNewPointSize:1);
textFormat.setFont(curFont); textFormat.setFont(curFont);
cursor.mergeCharFormat(textFormat); cursor.mergeCharFormat(textFormat);

@ -697,7 +697,7 @@ void UBDockPalette::moveTabs()
void UBDockPalette::resizeTabs() void UBDockPalette::resizeTabs()
{ {
int numTabs = mTabWidgets.size(); int numTabs = mTabWidgets.size();
mTabPalette->resize(2 * border(), (numTabs * TABSIZE) + qMax(numTabs - 1, 0) * tabSpacing()); mTabPalette->setFixedSize(2 * border(), (numTabs * TABSIZE) + qMax(numTabs - 1, 0) * tabSpacing());
} }
QRect UBDockPalette::getTabPaletteRect() QRect UBDockPalette::getTabPaletteRect()
{ {

@ -391,17 +391,13 @@ void UBDocumentNavigator::mousePressEvent(QMouseEvent *event)
mCrntItem = pCrntItem; mCrntItem = pCrntItem;
} }
// HACK: for an unknown reason, the mousePressEvent of the item is not
// called when a click occurs on it. So I created this method in
// order to handle the click.
mCrntItem->notifyClick(mapToScene(event->pos()));
// Then display the related page // Then display the related page
emit changeCurrentPage(); emit changeCurrentPage();
refreshScene(); refreshScene();
} }
bNavig = false; bNavig = false;
} }
QGraphicsView::mousePressEvent(event);
} }
/** /**
@ -448,7 +444,8 @@ void UBDocumentNavigator::onMovedToIndex(int index)
UBSceneThumbnailNavigPixmap* pItem = dynamic_cast<UBSceneThumbnailNavigPixmap*>(mThumbnails.at(index)); UBSceneThumbnailNavigPixmap* pItem = dynamic_cast<UBSceneThumbnailNavigPixmap*>(mThumbnails.at(index));
if(NULL != pItem) if(NULL != pItem)
{ {
mCrntItem = pItem; if(mCrntItem) mCrntItem->setSelected(false);//deselecting previous one
mCrntItem = pItem;
mCrntItem->setSelected(true); mCrntItem->setSelected(true);
centerOn(mCrntItem); centerOn(mCrntItem);
} }

@ -284,7 +284,7 @@ void UBLibPathViewer::showBack()
if(NULL != pLastElem) if(NULL != pLastElem)
{ {
mpBackElem->setPath(pLastElem->element()->path()); mpBackElem->setPath(pLastElem->element()->path());
mpBackElem->setType(eUBLibElementType_Folder); mpBackElem->setType(pLastElem->element()->type());
mpBackElem->setName(pLastElem->element()->name()); mpBackElem->setName(pLastElem->element()->name());
} }

@ -361,15 +361,12 @@ void UBLibraryWidget::dropEvent(QDropEvent *event)
QString filePath; QString filePath;
QString crntPath = urlList.at(i).toString(); QString crntPath = urlList.at(i).toString();
#ifdef Q_WS_MACX
filePath = QUrl(urlList.at(i)).toString();
#else
if(crntPath.startsWith("file:") || crntPath.startsWith("/")){ if(crntPath.startsWith("file:") || crntPath.startsWith("/")){
filePath = QUrl(crntPath).toLocalFile(); filePath = QUrl(crntPath).toLocalFile();
}else{ }else{
filePath = crntPath; filePath = crntPath;
} }
#endif
mLibraryController->importItemOnLibrary(filePath); mLibraryController->importItemOnLibrary(filePath);
bDropAccepted = true; bDropAccepted = true;
} }

@ -51,7 +51,6 @@ void UBResources::init()
// Cursors // Cursors
penCursor = QCursor(Qt::CrossCursor); penCursor = QCursor(Qt::CrossCursor);
eraserCursor = QCursor(QPixmap(":/images/cursors/eraser.png"), 21, 21); eraserCursor = QCursor(QPixmap(":/images/cursors/eraser.png"), 21, 21);
magnifierCursor = QCursor(QPixmap(":/images/cursors/magnifier.png"), 9, 9);
markerCursor = QCursor(QPixmap(":/images/cursors/marker.png"), 3, 30); markerCursor = QCursor(QPixmap(":/images/cursors/marker.png"), 3, 30);
pointerCursor = QCursor(QPixmap(":/images/cursors/laser.png"), 2, 1); pointerCursor = QCursor(QPixmap(":/images/cursors/laser.png"), 2, 1);
handCursor = QCursor(Qt::OpenHandCursor); handCursor = QCursor(Qt::OpenHandCursor);
@ -60,5 +59,5 @@ void UBResources::init()
arrowCursor = QCursor(Qt::ArrowCursor); arrowCursor = QCursor(Qt::ArrowCursor);
textCursor = QCursor(Qt::ArrowCursor); textCursor = QCursor(Qt::ArrowCursor);
rotateCursor = QCursor(QPixmap(":/images/cursors/rotate.png"), 16, 16); rotateCursor = QCursor(QPixmap(":/images/cursors/rotate.png"), 16, 16);
drawLineRulerCursor = QCursor(QPixmap(":/images/cursors/drawRulerLine.png"), 3, 12); drawLineRulerCursor = QCursor(QPixmap(":/images/cursors/drawRulerLine.png"), 3, 12);
} }

@ -37,7 +37,6 @@ class UBResources : public QObject
QCursor penCursor; QCursor penCursor;
QCursor eraserCursor; QCursor eraserCursor;
QCursor magnifierCursor;
QCursor markerCursor; QCursor markerCursor;
QCursor pointerCursor; QCursor pointerCursor;
QCursor handCursor; QCursor handCursor;

@ -62,8 +62,8 @@ UBTBDocumentEditWidget::UBTBDocumentEditWidget(UBTeacherBarDataMgr* pDataMgr, QW
mpKeywords->setObjectName("DockPaletteWidgetLineEdit"); mpKeywords->setObjectName("DockPaletteWidgetLineEdit");
mpLevel = new QComboBox(this); mpLevel = new QComboBox(this);
mpLevel->setObjectName("DockPaletteWidgetComboBox"); mpLevel->setObjectName("DockPaletteWidgetComboBox");
mpTopic = new QComboBox(this); mpTopic = new QLineEdit(this);
mpTopic->setObjectName("DockPaletteWidgetComboBox"); mpTopic->setObjectName("DockPaletteWidgetLineEdit");
mpAuthor = new QLineEdit(this); mpAuthor = new QLineEdit(this);
mpAuthor->setObjectName("DockPaletteWidgetLineEdit"); mpAuthor->setObjectName("DockPaletteWidgetLineEdit");
mpKeywordLabel = new QLabel(tr("Keywords:"), this); mpKeywordLabel = new QLabel(tr("Keywords:"), this);
@ -120,7 +120,7 @@ UBTBDocumentEditWidget::UBTBDocumentEditWidget(UBTeacherBarDataMgr* pDataMgr, QW
connect(mpLicenseCombox, SIGNAL(currentIndexChanged(int)), this, SLOT(onLicenseCurrentIndexChanged(int))); connect(mpLicenseCombox, SIGNAL(currentIndexChanged(int)), this, SLOT(onLicenseCurrentIndexChanged(int)));
connect(mpKeywords, SIGNAL(textChanged(QString)), this, SLOT(onKeywordChanged(QString))); connect(mpKeywords, SIGNAL(textChanged(QString)), this, SLOT(onKeywordChanged(QString)));
connect(mpLevel, SIGNAL(currentIndexChanged(QString)), this, SLOT(onLevelChanged(QString))); connect(mpLevel, SIGNAL(currentIndexChanged(QString)), this, SLOT(onLevelChanged(QString)));
connect(mpTopic, SIGNAL(currentIndexChanged(QString)), this, SLOT(onTopicChanged(QString))); connect(mpTopic, SIGNAL(textChanged(QString)), this, SLOT(onTopicChanged(QString)));
connect(mpAuthor, SIGNAL(textChanged(QString)), this, SLOT(onAuthorChanged(QString))); connect(mpAuthor, SIGNAL(textChanged(QString)), this, SLOT(onAuthorChanged(QString)));
} }
@ -179,7 +179,7 @@ void UBTBDocumentEditWidget::updateFields()
mpTarget->setPlainText(mpDataMgr->sessionTarget()); mpTarget->setPlainText(mpDataMgr->sessionTarget());
mpKeywords->setText(mpDataMgr->keywords()); mpKeywords->setText(mpDataMgr->keywords());
// TODO: retrieve the level // TODO: retrieve the level
// TODO retrieve the topic mpTopic->setText(mpDataMgr->topic());
mpAuthor->setText(mpDataMgr->authors()); mpAuthor->setText(mpDataMgr->authors());
} }
@ -192,7 +192,6 @@ void UBTBDocumentEditWidget::clearFields()
void UBTBDocumentEditWidget::onKeywordChanged(const QString &kw) void UBTBDocumentEditWidget::onKeywordChanged(const QString &kw)
{ {
mpDataMgr->setKeywords(kw); mpDataMgr->setKeywords(kw);
qDebug() << ">>> KEYWORD CHANGED: " << kw;
emit valueChanged(); emit valueChanged();
} }

@ -60,7 +60,7 @@ private:
QComboBox* mpLicenseCombox; QComboBox* mpLicenseCombox;
QLineEdit* mpKeywords; QLineEdit* mpKeywords;
QComboBox* mpLevel; QComboBox* mpLevel;
QComboBox* mpTopic; QLineEdit* mpTopic;
QLineEdit* mpAuthor; QLineEdit* mpAuthor;
QLabel* mpKeywordLabel; QLabel* mpKeywordLabel;
QLabel* mpLevelLabel; QLabel* mpLevelLabel;

@ -4,27 +4,119 @@
UBTBDocumentPreviewWidget::UBTBDocumentPreviewWidget(UBTeacherBarDataMgr *pDataMgr, QWidget *parent, const char *name):QWidget(parent) UBTBDocumentPreviewWidget::UBTBDocumentPreviewWidget(UBTeacherBarDataMgr *pDataMgr, QWidget *parent, const char *name):QWidget(parent)
, mpPageViewButton(NULL) , mpPageViewButton(NULL)
, mpEditButton(NULL) , mpEditButton(NULL)
, mpSessionLabel(NULL)
, mpSessionTitle(NULL)
, mpAuthorLabel(NULL)
, mpAuthors(NULL)
, mpCreationDate(NULL)
, mpTargetLabel(NULL)
, mpTarget(NULL)
, mpMetadataLabel(NULL)
, mpKeywordLabel(NULL)
, mpKeyword(NULL)
, mpLevelLabel(NULL)
, mpLevel(NULL)
, mpTopicLabel(NULL)
, mpTopic(NULL)
, mpLicense(NULL)
, mpContainer(NULL)
{ {
setObjectName(name); setObjectName(name);
mpDataMgr = pDataMgr; mpDataMgr = pDataMgr;
setLayout(&mLayout); setLayout(&mLayout);
mLayout.setContentsMargins(0, 0, 0, 0);
mpPageViewButton = new QPushButton(tr("Page View"), this); mpContainer = new QWidget(this);
mpPageViewButton->setObjectName("DockPaletteWidgetButton"); mpContainer->setLayout(&mContainerLayout);
mPageLayout.addStretch(1); mpContainer->setObjectName("UBTBPreviewWidget");
mPageLayout.addWidget(mpPageViewButton, 0);
mPageLayout.addStretch(1); // Session Title
mLayout.addLayout(&mPageLayout); mpSessionLabel = new QLabel(tr("Session"), mpContainer);
mpSessionLabel->setAlignment(Qt::AlignRight);
mpSessionLabel->setObjectName("UBTeacherBarPreviewSubtitle");
mContainerLayout.addWidget(mpSessionLabel, 0);
mpSessionTitle = new QLabel(mpContainer);
mpSessionTitle->setWordWrap(true);
mpSessionTitle->setAlignment(Qt::AlignRight);
mpSessionTitle->setObjectName("UBTeacherBarPreviewTitle");
mContainerLayout.addWidget(mpSessionTitle, 0);
mContainerLayout.addWidget(&mTitleSeparator, 0);
// Author(s)
mpAuthorLabel = new QLabel(tr("Author(s)"), mpContainer);
mpAuthorLabel->setObjectName("UBTeacherBarPreviewSubtitle");
mContainerLayout.addWidget(mpAuthorLabel, 0);
mpAuthors = new QLabel(mpContainer);
mpAuthors->setWordWrap(true);
mpAuthors->setStyleSheet("padding-left:5px;");
mContainerLayout.addWidget(mpAuthors, 0);
mContainerLayout.addWidget(&mAuthorSeparator, 0);
// Dates
mpCreationDate = new QLabel(tr("Created on: "), mpContainer);
mpCreationDate->setStyleSheet("padding-left:5px;");
mContainerLayout.addWidget(mpCreationDate);
mContainerLayout.addWidget(&mDateSeparator, 0);
// Target
mpTargetLabel = new QLabel(tr("Target"), mpContainer);
mpTargetLabel->setObjectName("UBTeacherBarPreviewSubtitle");
mContainerLayout.addWidget(mpTargetLabel,0);
mpTarget = new QTextEdit(mpContainer);
mpTarget->setReadOnly(true);
mContainerLayout.addWidget(mpTarget, 1);
mContainerLayout.addWidget(&mTargetSeparator, 0);
// Metadata
mpMetadataLabel = new QLabel(tr("Metadata"), mpContainer);
mpMetadataLabel->setObjectName("UBTeacherBarPreviewSubtitle");
mContainerLayout.addWidget(mpMetadataLabel, 0);
// Keyword
mpKeywordLabel = new QLabel(tr("<b>Keywords:</b>"), mpContainer);
mpKeywordLabel->setStyleSheet("padding-left:5px;");
mpKeyword = new QLabel(mpContainer);
mpKeyword->setWordWrap(true);
mKeywordLayout.addWidget(mpKeywordLabel, 0);
mKeywordLayout.addWidget(mpKeyword, 1);
mContainerLayout.addLayout(&mKeywordLayout, 0);
// Level
mpLevelLabel = new QLabel(tr("<b>Level:</b>"), mpContainer);
mpLevelLabel->setStyleSheet("padding-left:5px;");
mpLevel = new QLabel(mpContainer);
mpLevel->setWordWrap(true);
mLevelLayout.addWidget(mpLevelLabel, 0);
mLevelLayout.addWidget(mpLevel, 1);
mContainerLayout.addLayout(&mLevelLayout, 0);
// TODO : Add the elements here // Topic
mpTopicLabel = new QLabel(tr("<b>Topic:</b>"), mpContainer);
mpTopicLabel->setStyleSheet("padding-left:5px;");
mpTopic = new QLabel(mpContainer);
mpTopic->setWordWrap(true);
mTopicLayout.addWidget(mpTopicLabel, 0);
mTopicLayout.addWidget(mpTopic, 1);
mContainerLayout.addLayout(&mTopicLayout, 0);
mContainerLayout.addWidget(&mMetadataSeparator, 0);
// License
mpLicense = new UBTBLicenseWidget(mpContainer);
mContainerLayout.addWidget(mpLicense, 0);
mLayout.addWidget(mpContainer, 1);
mpPageViewButton = new QPushButton(tr("Page View"), this);
mpPageViewButton->setObjectName("DockPaletteWidgetButton");
mpEditButton = new QPushButton(tr("Edit"), this); mpEditButton = new QPushButton(tr("Edit"), this);
mpEditButton->setObjectName("DockPaletteWidgetButton"); mpEditButton->setObjectName("DockPaletteWidgetButton");
mPreviewLayout.addStretch(1);
mPreviewLayout.addWidget(mpEditButton, 0); mButtonsLayout.addWidget(mpPageViewButton, 0);
mPreviewLayout.addStretch(1); mButtonsLayout.addWidget(mpEditButton, 0);
mLayout.addLayout(&mPreviewLayout); mButtonsLayout.addStretch(1);
mLayout.addLayout(&mButtonsLayout, 0);
connect(mpPageViewButton, SIGNAL(clicked()), this, SLOT(onPageView())); connect(mpPageViewButton, SIGNAL(clicked()), this, SLOT(onPageView()));
connect(mpEditButton, SIGNAL(clicked()), this, SLOT(onEdit())); connect(mpEditButton, SIGNAL(clicked()), this, SLOT(onEdit()));
@ -32,8 +124,7 @@ UBTBDocumentPreviewWidget::UBTBDocumentPreviewWidget(UBTeacherBarDataMgr *pDataM
UBTBDocumentPreviewWidget::~UBTBDocumentPreviewWidget() UBTBDocumentPreviewWidget::~UBTBDocumentPreviewWidget()
{ {
DELETEPTR(mpPageViewButton);
DELETEPTR(mpEditButton);
} }
void UBTBDocumentPreviewWidget::onEdit() void UBTBDocumentPreviewWidget::onEdit()
@ -48,10 +139,23 @@ void UBTBDocumentPreviewWidget::onPageView()
void UBTBDocumentPreviewWidget::updateFields() void UBTBDocumentPreviewWidget::updateFields()
{ {
mpSessionTitle->setText(mpDataMgr->sessionTitle());
mpAuthors->setText(mpDataMgr->authors());
mpCreationDate->setText(tr("<b>Creation Date:</b> %0").arg(mpDataMgr->creationDate()));
mpTarget->setText(mpDataMgr->sessionTarget());
mpLicense->setLicense(mpDataMgr->sessionLicence());
mpKeyword->setText(mpDataMgr->keywords());
mpLevel->setText(mpDataMgr->level());
mpTopic->setText(mpDataMgr->topic());
} }
void UBTBDocumentPreviewWidget::clearFields() void UBTBDocumentPreviewWidget::clearFields()
{ {
mpSessionTitle->setText("");
mpAuthors->setText("");
mpCreationDate->setText("");
mpTarget->setText("");
mpKeyword->setText("");
mpLevel->setText("");
mpTopic->setText("");
} }

@ -24,10 +24,35 @@ private slots:
private: private:
QVBoxLayout mLayout; QVBoxLayout mLayout;
QHBoxLayout mPageLayout; QHBoxLayout mButtonsLayout;
QHBoxLayout mPreviewLayout;
QWidget* mpContainer;
QVBoxLayout mContainerLayout;
QPushButton* mpPageViewButton; QPushButton* mpPageViewButton;
QPushButton* mpEditButton; QPushButton* mpEditButton;
QLabel* mpSessionLabel;
QLabel* mpSessionTitle;
UBTBSeparator mTitleSeparator;
QLabel* mpAuthorLabel;
QLabel* mpAuthors;
UBTBSeparator mAuthorSeparator;
QLabel* mpCreationDate;
UBTBSeparator mDateSeparator;
QLabel* mpTargetLabel;
QTextEdit* mpTarget;
UBTBSeparator mTargetSeparator;
QLabel* mpMetadataLabel;
QHBoxLayout mKeywordLayout;
QLabel* mpKeywordLabel;
QLabel* mpKeyword;
QHBoxLayout mLevelLayout;
QLabel* mpLevelLabel;
QLabel* mpLevel;
QHBoxLayout mTopicLayout;
QLabel* mpTopicLabel;
QLabel* mpTopic;
UBTBSeparator mMetadataSeparator;
UBTBLicenseWidget* mpLicense;
UBTeacherBarDataMgr* mpDataMgr; UBTeacherBarDataMgr* mpDataMgr;
}; };

@ -320,7 +320,7 @@ QString UBUrlWidget::url()
QString str; QString str;
if(NULL != mpUrl){ if(NULL != mpUrl){
str = mpUrl->text() + ";" + mpTitle->text(); str = mpUrl->text();// + ";" + mpTitle->text();
} }
return str; return str;

@ -1,3 +1,5 @@
#include <QDate>
#include "UBTeacherBarDataMgr.h" #include "UBTeacherBarDataMgr.h"
#include "core/UBApplication.h" #include "core/UBApplication.h"
@ -59,7 +61,6 @@ void UBTeacherBarDataMgr::saveContent()
documentProxy->setSessionTitle(mSessionTitle); documentProxy->setSessionTitle(mSessionTitle);
documentProxy->setSessionTarget(mSessionTarget); documentProxy->setSessionTarget(mSessionTarget);
documentProxy->setSessionLicence(QString("%0").arg(mSessionLicence)); documentProxy->setSessionLicence(QString("%0").arg(mSessionLicence));
qDebug() << "Saving keywords: " << mKeywords;
documentProxy->setSessionKeywords(mKeywords); documentProxy->setSessionKeywords(mKeywords);
documentProxy->setSessionLevel(mLevel); documentProxy->setSessionLevel(mLevel);
documentProxy->setSessionTopic(mTopic); documentProxy->setSessionTopic(mTopic);
@ -82,10 +83,15 @@ void UBTeacherBarDataMgr::loadContent(bool docChanged)
mSessionTarget = documentProxy->sessionTarget(); mSessionTarget = documentProxy->sessionTarget();
mSessionLicence = (eLicense)documentProxy->sessionLicence().toInt(); mSessionLicence = (eLicense)documentProxy->sessionLicence().toInt();
mKeywords = documentProxy->sessionKeywords(); mKeywords = documentProxy->sessionKeywords();
qDebug() << "Keywords loaded: " << mKeywords << " (" << documentProxy->sessionKeywords() << ")";
mLevel = documentProxy->sessionLevel(); mLevel = documentProxy->sessionLevel();
mTopic = documentProxy->sessionTopic(); mTopic = documentProxy->sessionTopic();
mAuthors = documentProxy->sessionAuthors(); mAuthors = documentProxy->sessionAuthors();
if("" != documentProxy->documentDate()){
mCreationDate = documentProxy->documentDate();
}else{
mCreationDate = QDate::currentDate().toString("yyyy-MM-dd");
}
} }
// Page Title // Page Title

@ -115,6 +115,13 @@ public:
void setAuthors(const QString& authors){mAuthors = authors;} void setAuthors(const QString& authors){mAuthors = authors;}
QString authors(){return mAuthors;} QString authors(){return mAuthors;}
// Creation Date
void setCreationDate(const QString& date){mCreationDate = date;}
QString creationDate(){return mCreationDate;}
// Last Modification
void setLastModificationDate(const QString& date){mLastModif = date;}
QString lastModificationDate(){return mLastModif;}
// Others // Others
void clearLists(); void clearLists();
@ -131,6 +138,8 @@ private:
QString mLevel; QString mLevel;
QString mTopic; QString mTopic;
QString mAuthors; QString mAuthors;
QString mCreationDate;
QString mLastModif;
QVector<sAction> mActionList; QVector<sAction> mActionList;
QVector<sLink> mUrlList; QVector<sLink> mUrlList;

@ -134,6 +134,7 @@ void UBActionPreview::setContent(const QString &content)
UBTBPreviewContainer::UBTBPreviewContainer(QWidget *parent, const char *name):UBWidgetList(parent) UBTBPreviewContainer::UBTBPreviewContainer(QWidget *parent, const char *name):UBWidgetList(parent)
{ {
setObjectName(name); setObjectName(name);
mCanRemove = false;
} }
UBTBPreviewContainer::~UBTBPreviewContainer() UBTBPreviewContainer::~UBTBPreviewContainer()
@ -144,6 +145,7 @@ UBTBPreviewContainer::~UBTBPreviewContainer()
// ------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------
UBTeacherBarPreviewWidget::UBTeacherBarPreviewWidget(UBTeacherBarDataMgr* pDataMgr, QWidget *parent, const char *name):QWidget(parent) UBTeacherBarPreviewWidget::UBTeacherBarPreviewWidget(UBTeacherBarDataMgr* pDataMgr, QWidget *parent, const char *name):QWidget(parent)
, mpEditButton(NULL) , mpEditButton(NULL)
, mpDocumentButton(NULL)
, mpSessionTitle(NULL) , mpSessionTitle(NULL)
, mpTitle(NULL) , mpTitle(NULL)
, mpTitleLabel(NULL) , mpTitleLabel(NULL)
@ -155,20 +157,27 @@ UBTeacherBarPreviewWidget::UBTeacherBarPreviewWidget(UBTeacherBarDataMgr* pDataM
setObjectName(name); setObjectName(name);
mpDataMgr = pDataMgr; mpDataMgr = pDataMgr;
setLayout(&mLayout); setLayout(&mLayout);
mLayout.setContentsMargins(0, 0, 0, 0);
setAttribute(Qt::WA_StyledBackground, true); setAttribute(Qt::WA_StyledBackground, true);
setStyleSheet(UBApplication::globalStyleSheet()); setStyleSheet(UBApplication::globalStyleSheet());
// Build the Preview widget // Build the Preview widget
mpContainer = new QWidget(this);
mpContainer->setObjectName("UBTBPreviewWidget");
mpContainer->setLayout(&mContainerLayout);
mLayout.addWidget(mpContainer, 1);
// Session Title // Session Title
mpTitleContainer = new QWidget(this); mpTitleContainer = new QWidget(mpContainer);
mpTitleContainer->setLayout(&mTitleLayout); mpTitleContainer->setLayout(&mTitleLayout);
mpSessionTitle = new QLabel(this); mpSessionTitle = new QLabel(mpContainer);
mpSessionTitle->setText(tr("Session: ")); mpSessionTitle->setText(tr("Session: "));
mpSessionTitle->setWordWrap(true); mpSessionTitle->setWordWrap(true);
mpSessionTitle->setAlignment(Qt::AlignRight); mpSessionTitle->setAlignment(Qt::AlignRight);
mpSessionTitle->setObjectName("UBTBPreviewSessionTitle"); mpSessionTitle->setObjectName("UBTBPreviewSessionTitle");
mLayout.addWidget(mpSessionTitle); mContainerLayout.addWidget(mpSessionTitle);
// Title // Title
mpTitleContainer->setLayout(&mTitleLayout); mpTitleContainer->setLayout(&mTitleLayout);
@ -187,27 +196,32 @@ UBTeacherBarPreviewWidget::UBTeacherBarPreviewWidget(UBTeacherBarDataMgr* pDataM
mpPageNbrLabel->setObjectName("UBTBPreviewSessionTitle"); mpPageNbrLabel->setObjectName("UBTBPreviewSessionTitle");
mTitleLayout.addWidget(mpPageNbrLabel); mTitleLayout.addWidget(mpPageNbrLabel);
mTitleLayout.addWidget(&mTitleSeparator); mTitleLayout.addWidget(&mTitleSeparator);
mLayout.addWidget(mpTitleContainer); mContainerLayout.addWidget(mpTitleContainer);
// Content // Content
mpContentContainer = new UBTBPreviewContainer(this); mpContentContainer = new UBTBPreviewContainer(mpContainer);
mLayout.addWidget(mpContentContainer, 1); mContainerLayout.addWidget(mpContentContainer, 1);
// License // License
mLayout.addWidget(&mLicenseSeparator); mContainerLayout.addWidget(&mLicenseSeparator);
mpLicenseLabel = new UBTBLicenseWidget(this); mpLicenseLabel = new UBTBLicenseWidget(mpContainer);
mLayout.addWidget(mpLicenseLabel); mContainerLayout.addWidget(mpLicenseLabel);
// Edit button // Document Button
mpEditButton = new QPushButton(tr("Edit infos"), this); mpDocumentButton = new QPushButton(tr("Document View"), this);
mpDocumentButton->setObjectName("DockPaletteWidgetButton");
// Edit Button
mpEditButton = new QPushButton(tr("Edit"), this);
mpEditButton->setObjectName("DockPaletteWidgetButton"); mpEditButton->setObjectName("DockPaletteWidgetButton");
mEditLayout.addStretch(1); mEditLayout.addWidget(mpDocumentButton, 0);
mEditLayout.addWidget(mpEditButton, 0); mEditLayout.addWidget(mpEditButton, 0);
mEditLayout.addStretch(1); mEditLayout.addStretch(1);
mLayout.addLayout(&mEditLayout, 0); mLayout.addLayout(&mEditLayout, 0);
connect(mpEditButton, SIGNAL(clicked()), this, SLOT(onEdit())); connect(mpEditButton, SIGNAL(clicked()), this, SLOT(onEdit()));
connect(mpDocumentButton, SIGNAL(clicked()), this, SLOT(onDocumentClicked()));
connect(UBApplication::boardController, SIGNAL(activeSceneChanged()), this, SLOT(onActiveSceneChanged())); connect(UBApplication::boardController, SIGNAL(activeSceneChanged()), this, SLOT(onActiveSceneChanged()));
} }
@ -225,6 +239,11 @@ void UBTeacherBarPreviewWidget::onEdit()
emit showEditMode(); emit showEditMode();
} }
void UBTeacherBarPreviewWidget::onDocumentClicked()
{
emit showDocumentPreview();
}
void UBTeacherBarPreviewWidget::updateFields() void UBTeacherBarPreviewWidget::updateFields()
{ {
// Session Title // Session Title

@ -62,6 +62,7 @@ public:
signals: signals:
void showEditMode(); void showEditMode();
void showDocumentPreview();
protected: protected:
void showEvent(QShowEvent* ev); void showEvent(QShowEvent* ev);
@ -69,6 +70,7 @@ protected:
private slots: private slots:
void onEdit(); void onEdit();
void onActiveSceneChanged(); void onActiveSceneChanged();
void onDocumentClicked();
private: private:
void generateActions(); void generateActions();
@ -77,8 +79,12 @@ private:
void generateComments(); void generateComments();
QVBoxLayout mLayout; QVBoxLayout mLayout;
QVBoxLayout mContainerLayout;
QHBoxLayout mEditLayout; QHBoxLayout mEditLayout;
QPushButton* mpEditButton; QPushButton* mpEditButton;
QPushButton* mpDocumentButton;
QWidget* mpContainer;
// Titles // Titles
QVBoxLayout mTitleLayout; QVBoxLayout mTitleLayout;
@ -95,7 +101,6 @@ private:
// License // License
UBTBSeparator mLicenseSeparator; UBTBSeparator mLicenseSeparator;
// TODO : replace the QLabel of the license by a widget done for that!
UBTBLicenseWidget* mpLicenseLabel; UBTBLicenseWidget* mpLicenseLabel;

@ -57,6 +57,7 @@ UBTeacherBarWidget::UBTeacherBarWidget(QWidget *parent, const char *name):UBDock
connect(UBApplication::boardController, SIGNAL(activeDocumentChanged()), this, SLOT(onActiveDocumentChanged())); connect(UBApplication::boardController, SIGNAL(activeDocumentChanged()), this, SLOT(onActiveDocumentChanged()));
connect(mpPreview, SIGNAL(showEditMode()), this, SLOT(onShowEditMode())); connect(mpPreview, SIGNAL(showEditMode()), this, SLOT(onShowEditMode()));
connect(mpPreview, SIGNAL(showDocumentPreview()), this, SLOT(onShowDocumentPreview()));
connect(mpDocPreviewWidget, SIGNAL(changeTBState(eTeacherBarState)), this, SLOT(onTBStateChanged(eTeacherBarState))); connect(mpDocPreviewWidget, SIGNAL(changeTBState(eTeacherBarState)), this, SLOT(onTBStateChanged(eTeacherBarState)));
connect(mpDocEditWidget, SIGNAL(changeTBState(eTeacherBarState)), this, SLOT(onTBStateChanged(eTeacherBarState))); connect(mpDocEditWidget, SIGNAL(changeTBState(eTeacherBarState)), this, SLOT(onTBStateChanged(eTeacherBarState)));
connect(mpPageEditWidget, SIGNAL(changeTBState(eTeacherBarState)), this, SLOT(onTBStateChanged(eTeacherBarState))); connect(mpPageEditWidget, SIGNAL(changeTBState(eTeacherBarState)), this, SLOT(onTBStateChanged(eTeacherBarState)));
@ -150,6 +151,11 @@ void UBTeacherBarWidget::onShowEditMode()
onTBStateChanged(eTeacherBarState_PageEdit); onTBStateChanged(eTeacherBarState_PageEdit);
} }
void UBTeacherBarWidget::onShowDocumentPreview()
{
onTBStateChanged(eTeacherBarState_DocumentPreview);
}
void UBTeacherBarWidget::onTBStateChanged(eTeacherBarState state) void UBTeacherBarWidget::onTBStateChanged(eTeacherBarState state)
{ {
switch(state){ switch(state){

@ -48,6 +48,7 @@ private slots:
void onShowEditMode(); void onShowEditMode();
void onTBStateChanged(eTeacherBarState state); void onTBStateChanged(eTeacherBarState state);
void onActiveDocumentChanged(); void onActiveDocumentChanged();
void onShowDocumentPreview();
private: private:
bool isEmpty(); bool isEmpty();

@ -740,25 +740,21 @@ void UBSceneThumbnailNavigPixmap::paint(QPainter *painter, const QStyleOptionGra
void UBSceneThumbnailNavigPixmap::mousePressEvent(QGraphicsSceneMouseEvent *event) void UBSceneThumbnailNavigPixmap::mousePressEvent(QGraphicsSceneMouseEvent *event)
{ {
// INFO: This implementation should work but this method is not called on a mousePressEvent, why? QPointF p = event->pos();
// PLEASE DO NOT REMOVE THIS METHOD! We should reactivate this code when we will fix
// the mousePressEvent-not-called issue! // Here we check the position of the click and verify if it has to trig an action or not.
if(bCanDelete && p.x() >= 0 && p.x() <= BUTTONSIZE && p.y() >= 0 && p.y() <= BUTTONSIZE)
// QPointF p = event->pos(); {
deletePage();
// // Here we check the position of the click and verify if it has to trig an action or not. }
// if(bCanDelete && p.x() >= 0 && p.x() <= BUTTONSIZE && p.y() >= 0 && p.y() <= BUTTONSIZE) if(bCanMoveUp && p.x() >= BUTTONSIZE + BUTTONSPACING && p.x() <= 2*BUTTONSIZE + BUTTONSPACING && p.y() >= 0 && p.y() <= BUTTONSIZE)
// { {
// deletePage(); moveUpPage();
// } }
// if(bCanMoveUp && p.x() >= BUTTONSIZE + BUTTONSPACING && p.x() <= 2*BUTTONSIZE + BUTTONSPACING && p.y() >= 0 && p.y() <= BUTTONSIZE) if(bCanMoveDown && p.x() >= 2*(BUTTONSIZE + BUTTONSPACING) && p.x() <= 2*(BUTTONSIZE + BUTTONSPACING) + BUTTONSIZE && p.y() >= 0 && p.y() <= BUTTONSIZE)
// { {
// moveUpPage(); moveDownPage();
// } }
// if(bCanMoveDown && p.x() >= 2*(BUTTONSIZE + BUTTONSPACING) && p.x() <= 2*(BUTTONSIZE + BUTTONSPACING) + BUTTONSIZE && p.y() >= 0 && p.y() <= BUTTONSIZE)
// {
// moveDownPage();
// }
event->accept(); event->accept();
} }
@ -809,32 +805,3 @@ void UBSceneThumbnailNavigPixmap::moveDownPage()
{ {
UBApplication::documentController->moveSceneToIndex(proxy(), sceneIndex(), sceneIndex() + 1); UBApplication::documentController->moveSceneToIndex(proxy(), sceneIndex(), sceneIndex() + 1);
} }
void UBSceneThumbnailNavigPixmap::notifyClick(QPointF clickedScenePos)
{
QPointF p = clickedPos(clickedScenePos);
// Here we check the position of the click and verify if it has to trig an action or not.
if(bCanDelete && p.x() >= 0 && p.x() <= BUTTONSIZE/2 && p.y() >= 0 && p.y() <= BUTTONSIZE/2)
{
deletePage();
}
if(bCanMoveUp && p.x() >= (BUTTONSIZE + BUTTONSPACING)/2 && p.x() <= BUTTONSIZE + BUTTONSPACING && p.y() >= 0 && p.y() <= BUTTONSIZE/2)
{
moveUpPage();
}
if(bCanMoveDown && p.x() >= BUTTONSIZE + BUTTONSPACING && p.x() <= BUTTONSIZE + BUTTONSPACING + BUTTONSIZE/2 && p.y() >= 0 && p.y() <= BUTTONSIZE/2)
{
moveDownPage();
}
}
QPointF UBSceneThumbnailNavigPixmap::clickedPos(QPointF clickedScenePos)
{
QPointF p;
p.setX(clickedScenePos.x() - scenePos().x());
p.setY(clickedScenePos.y() - scenePos().y());
return p;
}

@ -292,7 +292,6 @@ class UBSceneThumbnailNavigPixmap : public UBSceneThumbnailPixmap
public: public:
UBSceneThumbnailNavigPixmap(const QPixmap& pix, UBDocumentProxy* proxy, int pSceneIndex); UBSceneThumbnailNavigPixmap(const QPixmap& pix, UBDocumentProxy* proxy, int pSceneIndex);
~UBSceneThumbnailNavigPixmap(); ~UBSceneThumbnailNavigPixmap();
void notifyClick(QPointF clickedScenePos);
protected: protected:
void hoverEnterEvent(QGraphicsSceneHoverEvent *event); void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
@ -305,7 +304,6 @@ class UBSceneThumbnailNavigPixmap : public UBSceneThumbnailPixmap
void deletePage(); void deletePage();
void moveUpPage(); void moveUpPage();
void moveDownPage(); void moveDownPage();
QPointF clickedPos(QPointF clickedScenePos);
bool bButtonsVisible; bool bButtonsVisible;
bool bCanDelete; bool bCanDelete;

Loading…
Cancel
Save