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

preferencesAboutTextFull
Claudio Valerio 13 years ago
commit 2e0bf00367
  1. 3
      resources/style.qss
  2. 97
      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;
}
QWidget#UBTeacherBarPreviewWidget
QWidget#UBTBPreviewWidget
{
background: #FFFFFF;
border-radius: 10px;

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

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

@ -101,7 +101,6 @@ void UBExportPDF::persistsDocument(UBDocumentProxy* pDocumentProxy, const QStrin
//setting page size to appropriate value
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);
//render to PDF
scene->render(&pdfPainter);

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

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

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

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

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

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

@ -1150,11 +1150,10 @@ void UBDocumentController::moveSceneToIndex(UBDocumentProxy* proxy, int source,
UBMetadataDcSubsetAdaptor::persist(proxy);
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
emit movedToIndex(target);
UBApplication::boardController->setActiveDocumentScene(proxy, target);
}

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

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

@ -305,10 +305,11 @@ void UBGraphicsTextItemDelegate::ChangeTextSize(int delta)
bool bEndofTheSameBlock;
int iBlockLen;
int iPointSize;
int inewPointSize;
int iNextPointSize;
int iCursorPos = startPos;
// 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)
{
bEndofTheSameBlock = false;
@ -326,17 +327,18 @@ void UBGraphicsTextItemDelegate::ChangeTextSize(int delta)
iBlockLen++;
cursor.setPosition (iCursorPos+iBlockLen+1, QTextCursor::KeepAnchor);
inewPointSize = cursor.charFormat().font().pointSize();
iNextPointSize = cursor.charFormat().font().pointSize();
cursor.setPosition (iCursorPos+iBlockLen, QTextCursor::KeepAnchor);
if ((iPointSize != inewPointSize)||(iCursorPos+iBlockLen >= endPos))
if ((iPointSize != iNextPointSize)||(iCursorPos+iBlockLen >= endPos))
bEndofTheSameBlock = true;
}while(!bEndofTheSameBlock);
//setting new parameners
curFont.setPointSize(iPointSize + delta);
int iNewPointSize = iPointSize + delta;
curFont.setPointSize( (iNewPointSize > 0)?iNewPointSize:1);
textFormat.setFont(curFont);
cursor.mergeCharFormat(textFormat);

@ -697,7 +697,7 @@ void UBDockPalette::moveTabs()
void UBDockPalette::resizeTabs()
{
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()
{

@ -391,17 +391,13 @@ void UBDocumentNavigator::mousePressEvent(QMouseEvent *event)
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
emit changeCurrentPage();
refreshScene();
}
bNavig = false;
}
QGraphicsView::mousePressEvent(event);
}
/**
@ -448,7 +444,8 @@ void UBDocumentNavigator::onMovedToIndex(int index)
UBSceneThumbnailNavigPixmap* pItem = dynamic_cast<UBSceneThumbnailNavigPixmap*>(mThumbnails.at(index));
if(NULL != pItem)
{
mCrntItem = pItem;
if(mCrntItem) mCrntItem->setSelected(false);//deselecting previous one
mCrntItem = pItem;
mCrntItem->setSelected(true);
centerOn(mCrntItem);
}

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

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

@ -51,7 +51,6 @@ void UBResources::init()
// Cursors
penCursor = QCursor(Qt::CrossCursor);
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);
pointerCursor = QCursor(QPixmap(":/images/cursors/laser.png"), 2, 1);
handCursor = QCursor(Qt::OpenHandCursor);
@ -60,5 +59,5 @@ void UBResources::init()
arrowCursor = QCursor(Qt::ArrowCursor);
textCursor = QCursor(Qt::ArrowCursor);
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 eraserCursor;
QCursor magnifierCursor;
QCursor markerCursor;
QCursor pointerCursor;
QCursor handCursor;

@ -62,8 +62,8 @@ UBTBDocumentEditWidget::UBTBDocumentEditWidget(UBTeacherBarDataMgr* pDataMgr, QW
mpKeywords->setObjectName("DockPaletteWidgetLineEdit");
mpLevel = new QComboBox(this);
mpLevel->setObjectName("DockPaletteWidgetComboBox");
mpTopic = new QComboBox(this);
mpTopic->setObjectName("DockPaletteWidgetComboBox");
mpTopic = new QLineEdit(this);
mpTopic->setObjectName("DockPaletteWidgetLineEdit");
mpAuthor = new QLineEdit(this);
mpAuthor->setObjectName("DockPaletteWidgetLineEdit");
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(mpKeywords, SIGNAL(textChanged(QString)), this, SLOT(onKeywordChanged(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)));
}
@ -179,7 +179,7 @@ void UBTBDocumentEditWidget::updateFields()
mpTarget->setPlainText(mpDataMgr->sessionTarget());
mpKeywords->setText(mpDataMgr->keywords());
// TODO: retrieve the level
// TODO retrieve the topic
mpTopic->setText(mpDataMgr->topic());
mpAuthor->setText(mpDataMgr->authors());
}
@ -192,7 +192,6 @@ void UBTBDocumentEditWidget::clearFields()
void UBTBDocumentEditWidget::onKeywordChanged(const QString &kw)
{
mpDataMgr->setKeywords(kw);
qDebug() << ">>> KEYWORD CHANGED: " << kw;
emit valueChanged();
}

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

@ -4,27 +4,119 @@
UBTBDocumentPreviewWidget::UBTBDocumentPreviewWidget(UBTeacherBarDataMgr *pDataMgr, QWidget *parent, const char *name):QWidget(parent)
, mpPageViewButton(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);
mpDataMgr = pDataMgr;
setLayout(&mLayout);
mLayout.setContentsMargins(0, 0, 0, 0);
mpPageViewButton = new QPushButton(tr("Page View"), this);
mpPageViewButton->setObjectName("DockPaletteWidgetButton");
mPageLayout.addStretch(1);
mPageLayout.addWidget(mpPageViewButton, 0);
mPageLayout.addStretch(1);
mLayout.addLayout(&mPageLayout);
mpContainer = new QWidget(this);
mpContainer->setLayout(&mContainerLayout);
mpContainer->setObjectName("UBTBPreviewWidget");
// Session Title
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->setObjectName("DockPaletteWidgetButton");
mPreviewLayout.addStretch(1);
mPreviewLayout.addWidget(mpEditButton, 0);
mPreviewLayout.addStretch(1);
mLayout.addLayout(&mPreviewLayout);
mButtonsLayout.addWidget(mpPageViewButton, 0);
mButtonsLayout.addWidget(mpEditButton, 0);
mButtonsLayout.addStretch(1);
mLayout.addLayout(&mButtonsLayout, 0);
connect(mpPageViewButton, SIGNAL(clicked()), this, SLOT(onPageView()));
connect(mpEditButton, SIGNAL(clicked()), this, SLOT(onEdit()));
@ -32,8 +124,7 @@ UBTBDocumentPreviewWidget::UBTBDocumentPreviewWidget(UBTeacherBarDataMgr *pDataM
UBTBDocumentPreviewWidget::~UBTBDocumentPreviewWidget()
{
DELETEPTR(mpPageViewButton);
DELETEPTR(mpEditButton);
}
void UBTBDocumentPreviewWidget::onEdit()
@ -48,10 +139,23 @@ void UBTBDocumentPreviewWidget::onPageView()
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()
{
mpSessionTitle->setText("");
mpAuthors->setText("");
mpCreationDate->setText("");
mpTarget->setText("");
mpKeyword->setText("");
mpLevel->setText("");
mpTopic->setText("");
}

@ -24,10 +24,35 @@ private slots:
private:
QVBoxLayout mLayout;
QHBoxLayout mPageLayout;
QHBoxLayout mPreviewLayout;
QHBoxLayout mButtonsLayout;
QWidget* mpContainer;
QVBoxLayout mContainerLayout;
QPushButton* mpPageViewButton;
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;
};

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

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

@ -115,6 +115,13 @@ public:
void setAuthors(const QString& authors){mAuthors = authors;}
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
void clearLists();
@ -131,6 +138,8 @@ private:
QString mLevel;
QString mTopic;
QString mAuthors;
QString mCreationDate;
QString mLastModif;
QVector<sAction> mActionList;
QVector<sLink> mUrlList;

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

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

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

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

@ -740,25 +740,21 @@ void UBSceneThumbnailNavigPixmap::paint(QPainter *painter, const QStyleOptionGra
void UBSceneThumbnailNavigPixmap::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
// INFO: This implementation should work but this method is not called on a mousePressEvent, why?
// PLEASE DO NOT REMOVE THIS METHOD! We should reactivate this code when we will fix
// the mousePressEvent-not-called issue!
// QPointF p = event->pos();
// // 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)
// {
// deletePage();
// }
// if(bCanMoveUp && p.x() >= BUTTONSIZE + BUTTONSPACING && p.x() <= 2*BUTTONSIZE + BUTTONSPACING && p.y() >= 0 && p.y() <= BUTTONSIZE)
// {
// moveUpPage();
// }
// if(bCanMoveDown && p.x() >= 2*(BUTTONSIZE + BUTTONSPACING) && p.x() <= 2*(BUTTONSIZE + BUTTONSPACING) + BUTTONSIZE && p.y() >= 0 && p.y() <= BUTTONSIZE)
// {
// moveDownPage();
// }
QPointF p = event->pos();
// 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)
{
deletePage();
}
if(bCanMoveUp && p.x() >= BUTTONSIZE + BUTTONSPACING && p.x() <= 2*BUTTONSIZE + BUTTONSPACING && p.y() >= 0 && p.y() <= BUTTONSIZE)
{
moveUpPage();
}
if(bCanMoveDown && p.x() >= 2*(BUTTONSIZE + BUTTONSPACING) && p.x() <= 2*(BUTTONSIZE + BUTTONSPACING) + BUTTONSIZE && p.y() >= 0 && p.y() <= BUTTONSIZE)
{
moveDownPage();
}
event->accept();
}
@ -809,32 +805,3 @@ void UBSceneThumbnailNavigPixmap::moveDownPage()
{
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:
UBSceneThumbnailNavigPixmap(const QPixmap& pix, UBDocumentProxy* proxy, int pSceneIndex);
~UBSceneThumbnailNavigPixmap();
void notifyClick(QPointF clickedScenePos);
protected:
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
@ -305,7 +304,6 @@ class UBSceneThumbnailNavigPixmap : public UBSceneThumbnailPixmap
void deletePage();
void moveUpPage();
void moveDownPage();
QPointF clickedPos(QPointF clickedScenePos);
bool bButtonsVisible;
bool bCanDelete;

Loading…
Cancel
Save