src/adaptors

preferencesAboutTextFull
shibakaneki 13 years ago
parent 5ce549f174
commit d6af845cf0
  1. 6
      resources/sankore.qrc
  2. 5
      resources/style.qss
  3. 23
      src/gui/UBTBDocumentEditWidget.cpp
  4. 6
      src/gui/UBTBDocumentEditWidget.h
  5. 65
      src/gui/UBTeacherBarDataMgr.cpp
  6. 36
      src/gui/UBTeacherBarDataMgr.h
  7. 29
      src/gui/UBTeacherBarPreviewWidget.cpp
  8. 16
      src/gui/UBTeacherBarPreviewWidget.h

@ -341,5 +341,11 @@
<file>images/duration1.png</file>
<file>images/duration2.png</file>
<file>images/duration3.png</file>
<file>images/licenses/ccby.png</file>
<file>images/licenses/ccbync.png</file>
<file>images/licenses/ccbyncnd.png</file>
<file>images/licenses/ccbyncsa.png</file>
<file>images/licenses/ccbynd.png</file>
<file>images/licenses/ccbysa.png</file>
</qresource>
</RCC>

@ -83,10 +83,11 @@ QWidget#UBTeacherBarTargetBox
background-color: white;
}
QWidget#UBActionPreviewContent
QWidget#UBActionPreviewContent,
QTextEdit#UBCommentPreview
{
border-radius : 10px;
border: 2px solid;
border: 2px solid #999999;
padding: 5px 5px 5px 5px;
}

@ -10,6 +10,7 @@ UBTBDocumentEditWidget::UBTBDocumentEditWidget(UBTeacherBarDataMgr* pDataMgr, QW
, mpTarget(NULL)
, mpMetadataLabel(NULL)
, mpLicenseLabel(NULL)
, mpLicenseCombox(NULL)
{
setObjectName(name);
@ -31,6 +32,7 @@ UBTBDocumentEditWidget::UBTBDocumentEditWidget(UBTeacherBarDataMgr* pDataMgr, QW
mpTitle = new QLineEdit(mpContainer);
mpTitle->setObjectName("DockPaletteWidgetLineEdit");
mContainerLayout.addWidget(mpTitle, 0);
mContainerLayout.addWidget(&mTitleSeparator);
// Target
mpTargetLabel = new QLabel(tr("Session Target"), mpContainer);
@ -39,18 +41,31 @@ UBTBDocumentEditWidget::UBTBDocumentEditWidget(UBTeacherBarDataMgr* pDataMgr, QW
mpTarget = new QTextEdit(mpContainer);
mpTarget->setObjectName("UBTeacherBarTargetBox");
mContainerLayout.addWidget(mpTarget, 1);
mContainerLayout.addWidget(&mTargetSeparator);
// Metadata
mpMetadataLabel = new QLabel(tr("Metadata"), mpContainer);
mpMetadataLabel->setAlignment(Qt::AlignLeft);
//mpMetadataLabel->setObjectName("UBTeacherBarPreviewSubtitle");
mContainerLayout.addWidget(mpMetadataLabel, 0);
mContainerLayout.addWidget(&mLicenseSeparator);
// License
mpLicenseLabel = new QLabel(tr("License"), mpContainer);
mpLicenseLabel->setAlignment(Qt::AlignLeft);
//mpLicenseLabel->setObjectName("UBTeacherBarPreviewSubtitle");
mContainerLayout.addWidget(mpLicenseLabel, 0);
mpLicenseCombox = new QComboBox(this);
mpLicenseCombox->setObjectName("DockPaletteWidgetComboBox");
QStringList qslLicenses;
qslLicenses << "CC BY";
qslLicenses << "CC BY-ND";
qslLicenses << "CC BY-NC-SA";
qslLicenses << "CC BY-SA";
qslLicenses << "CC BY-NC";
qslLicenses << "CC BY-NC-ND";
mpLicenseCombox->addItems(qslLicenses);
mContainerLayout.addWidget(mpLicenseCombox);
mpPageViewButton = new QPushButton(tr("Page View"), this);
mpPageViewButton->setObjectName("DockPaletteWidgetButton");
@ -65,6 +80,7 @@ UBTBDocumentEditWidget::UBTBDocumentEditWidget(UBTeacherBarDataMgr* pDataMgr, QW
connect(mpPreviewButton, SIGNAL(clicked()), this, SLOT(onPreview()));
connect(mpTitle, SIGNAL(textChanged(QString)), this, SLOT(onSessionTitleChanged()));
connect(mpTarget, SIGNAL(textChanged()), this, SLOT(onSessionTargetChanged()));
connect(mpLicenseCombox, SIGNAL(currentIndexChanged(int)), this, SLOT(onLicenseCurrentIndexChanged(int)));
}
UBTBDocumentEditWidget::~UBTBDocumentEditWidget()
@ -75,6 +91,7 @@ UBTBDocumentEditWidget::~UBTBDocumentEditWidget()
DELETEPTR(mpTarget);
DELETEPTR(mpMetadataLabel);
DELETEPTR(mpLicenseLabel);
DELETEPTR(mpLicenseCombox);
DELETEPTR(mpPageViewButton);
DELETEPTR(mpPreviewButton);
}
@ -101,6 +118,12 @@ void UBTBDocumentEditWidget::onSessionTargetChanged()
emit valueChanged();
}
void UBTBDocumentEditWidget::onLicenseCurrentIndexChanged(int selection)
{
mpDataMgr->setSessionLicence((eLicense)selection);
emit valueChanged();
}
void UBTBDocumentEditWidget::updateFields()
{
mpTitle->setText(mpDataMgr->sessionTitle());

@ -6,6 +6,7 @@
#include <QLabel>
#include <QLineEdit>
#include <QTextEdit>
#include <QComboBox>
#include "UBTeacherBarDataMgr.h"
@ -27,6 +28,7 @@ private slots:
void onPreview();
void onSessionTitleChanged();
void onSessionTargetChanged();
void onLicenseCurrentIndexChanged(int selection);
private:
QVBoxLayout mLayout;
@ -35,6 +37,9 @@ private:
QVBoxLayout mContainerLayout;
QPushButton* mpPageViewButton;
QPushButton* mpPreviewButton;
UBTBSeparator mTitleSeparator;
UBTBSeparator mTargetSeparator;
UBTBSeparator mLicenseSeparator;
QWidget* mpContainer;
QLabel* mpTitleLabel;
@ -43,6 +48,7 @@ private:
QTextEdit* mpTarget;
QLabel* mpMetadataLabel;
QLabel* mpLicenseLabel;
QComboBox* mpLicenseCombox;
UBTeacherBarDataMgr* mpDataMgr;
};

@ -58,7 +58,7 @@ void UBTeacherBarDataMgr::saveContent()
documentProxy->setSessionTitle(mSessionTitle);
documentProxy->setSessionTarget(mSessionTarget);
documentProxy->setSessionLicence(mSessionLicence);
documentProxy->setSessionLicence(QString("%0").arg(mSessionLicence));
UBMetadataDcSubsetAdaptor::persist(documentProxy);
}
@ -75,7 +75,7 @@ void UBTeacherBarDataMgr::loadContent(bool docChanged)
if(true/*docChanged*/){
mSessionTitle = documentProxy->sessionTitle();
mSessionTarget = documentProxy->sessionTarget();
mSessionLicence = documentProxy->sessionLicence();
mSessionLicence = (eLicense)documentProxy->sessionLicence().toInt();
}
// Page Title
@ -113,3 +113,64 @@ void UBTeacherBarDataMgr::loadContent(bool docChanged)
mComments = nextInfos.comments;
}
// ------------------------------------------------------------------------------------
UBTBSeparator::UBTBSeparator(QWidget *parent, const char *name):QFrame(parent)
{
setObjectName("UBTBSeparator");
setMinimumHeight(5);
setMaximumHeight(5);
}
UBTBSeparator::~UBTBSeparator()
{
}
// ------------------------------------------------------------------------------------
UBTBLicenseWidget::UBTBLicenseWidget(QWidget *parent, const char *name):QWidget(parent)
{
setObjectName(name);
setLayout(&mLayout);
mpIcon = new QLabel(this);
mpText = new QLabel(this);
mpText->setWordWrap(true);
mLayout.addWidget(mpIcon);
mLayout.addWidget(mpText);
}
UBTBLicenseWidget::~UBTBLicenseWidget()
{
DELETEPTR(mpIcon);
DELETEPTR(mpText);
}
void UBTBLicenseWidget::setLicense(eLicense lic)
{
switch(lic){
case eLicense_CCBY:
mpIcon->setPixmap(QPixmap(":images/licenses/ccby.png"));
mpText->setText(tr("Creative Common License %0").arg("CC BY"));
break;
case eLicense_CCBYND:
mpIcon->setPixmap(QPixmap(":images/licenses/ccbynd.png"));
mpText->setText(tr("Creative Common License %0").arg("CC BY-ND"));
break;
case eLicense_CCBYNCSA:
mpIcon->setPixmap(QPixmap(":images/licenses/ccbyncsa.png"));
mpText->setText(tr("Creative Common License %0").arg("CC BY-NC-SA"));
break;
case eLicense_CCBYSA:
mpIcon->setPixmap(QPixmap(":images/licenses/ccbysa.png"));
mpText->setText(tr("Creative Common License %0").arg("CC BY-SA"));
break;
case eLicense_CCBYNC:
mpIcon->setPixmap(QPixmap(":images/licenses/ccbync.png"));
mpText->setText(tr("Creative Common License %0").arg("CC BY-NC"));
break;
case eLicense_CCBYNCND:
mpIcon->setPixmap(QPixmap(":images/licenses/ccbyncnd.png"));
mpText->setText(tr("Creative Common License %0").arg("CC BY-NC-ND"));
break;
}
}

@ -9,6 +9,7 @@
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QComboBox>
#include <QFrame>
typedef enum{
eTeacherBarState_DocumentEdit,
@ -32,6 +33,35 @@ typedef struct{
QString link;
}sLink;
typedef enum{
eLicense_CCBY,
eLicense_CCBYND,
eLicense_CCBYNCSA,
eLicense_CCBYSA,
eLicense_CCBYNC,
eLicense_CCBYNCND
}eLicense;
class UBTBSeparator : public QFrame
{
public:
UBTBSeparator(QWidget* parent=0, const char* name="UBTBSeparator");
~UBTBSeparator();
};
class UBTBLicenseWidget : public QWidget
{
public:
UBTBLicenseWidget(QWidget* parent=0, const char* name="UBTBLicenseWidget");
~UBTBLicenseWidget();
void setLicense(eLicense lic);
private:
QHBoxLayout mLayout;
QLabel* mpIcon;
QLabel* mpText;
};
class UBTeacherBarDataMgr
{
public:
@ -47,8 +77,8 @@ public:
QString sessionTarget(){return mSessionTarget;}
// Licence
void setSessionLicence(const QString& licence){mSessionLicence = licence;}
QString sessionLicence(){return mSessionLicence;}
void setSessionLicence(eLicense licence){mSessionLicence = licence;}
eLicense sessionLicence(){return mSessionLicence;}
// Page Title
void setPageTitle(const QString& title){mPageTitle = title;}
@ -77,7 +107,7 @@ public:
private:
QString mSessionTitle;
QString mSessionTarget;
QString mSessionLicence;
eLicense mSessionLicence;
QString mPageTitle;
QString mComments;

@ -126,7 +126,7 @@ void UBActionPreview::setContent(const QString &content)
{
if(NULL != mpContent){
mpContent->setText(content);
setMinimumHeight(mpOwner->height() + mpContent->height());
setMinimumHeight(mpOwner->height() + mpContent->document()->documentLayout()->documentSize().toSize().height());
}
}
@ -139,18 +139,6 @@ UBTBPreviewContainer::UBTBPreviewContainer(QWidget *parent, const char *name):UB
UBTBPreviewContainer::~UBTBPreviewContainer()
{
}
// ------------------------------------------------------------------------------------
UBTBPreviewSeparator::UBTBPreviewSeparator(QWidget *parent, const char *name):QFrame(parent)
{
setObjectName("UBTBSeparator");
setMinimumHeight(5);
setMaximumHeight(5);
}
UBTBPreviewSeparator::~UBTBPreviewSeparator()
{
}
// ------------------------------------------------------------------------------------
@ -206,11 +194,8 @@ UBTeacherBarPreviewWidget::UBTeacherBarPreviewWidget(UBTeacherBarDataMgr* pDataM
// License
mLayout.addWidget(&mLicenseSeparator);
mpLicenseLabel = new QLabel(tr("License"), this);
mpLicenseLabel->setObjectName("UBTeacherBarPreviewSubtitle");
mpLicenseLabel = new UBTBLicenseWidget(this);
mLayout.addWidget(mpLicenseLabel);
// TODO : Add the license field here
// Edit button
mpEditButton = new QPushButton(tr("Edit infos"), this);
@ -271,11 +256,14 @@ void UBTeacherBarPreviewWidget::updateFields()
// Media
generateMedias();
// Comments
generateComments();
// Links
generateLinks();
// Comments
generateComments();
// License
mpLicenseLabel->setLicense(mpDataMgr->sessionLicence());
}
@ -295,6 +283,9 @@ void UBTeacherBarPreviewWidget::clearFields()
}
mStoredWidgets.clear();
}
// License
mpLicenseLabel->setLicense(eLicense_CCBY);
}
void UBTeacherBarPreviewWidget::generateActions()

@ -4,7 +4,6 @@
#include <QLabel>
#include <QVBoxLayout>
#include <QPushButton>
#include <QFrame>
#include "core/UBPersistenceManager.h"
#include "customWidgets/UBWidgetList.h"
@ -52,13 +51,6 @@ public:
~UBTBPreviewContainer();
};
class UBTBPreviewSeparator : public QFrame
{
public:
UBTBPreviewSeparator(QWidget* parent=0, const char* name="UBTBPreviewSeparator");
~UBTBPreviewSeparator();
};
class UBTeacherBarPreviewWidget : public QWidget
{
Q_OBJECT
@ -90,7 +82,7 @@ private:
// Titles
QVBoxLayout mTitleLayout;
UBTBPreviewSeparator mTitleSeparator;
UBTBSeparator mTitleSeparator;
QWidget mTitleContainer;
QLabel* mpSessionTitle;
QLabel* mpTitle;
@ -102,8 +94,10 @@ private:
QLabel* mpScheduleLabel;
// License
UBTBPreviewSeparator mLicenseSeparator;
QLabel* mpLicenseLabel;
UBTBSeparator mLicenseSeparator;
// TODO : replace the QLabel of the license by a widget done for that!
UBTBLicenseWidget* mpLicenseLabel;
/** Pointer to the datas */
UBTeacherBarDataMgr* mpDataMgr;

Loading…
Cancel
Save