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/duration1.png</file>
<file>images/duration2.png</file> <file>images/duration2.png</file>
<file>images/duration3.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> </qresource>
</RCC> </RCC>

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

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

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

@ -58,7 +58,7 @@ void UBTeacherBarDataMgr::saveContent()
documentProxy->setSessionTitle(mSessionTitle); documentProxy->setSessionTitle(mSessionTitle);
documentProxy->setSessionTarget(mSessionTarget); documentProxy->setSessionTarget(mSessionTarget);
documentProxy->setSessionLicence(mSessionLicence); documentProxy->setSessionLicence(QString("%0").arg(mSessionLicence));
UBMetadataDcSubsetAdaptor::persist(documentProxy); UBMetadataDcSubsetAdaptor::persist(documentProxy);
} }
@ -75,7 +75,7 @@ void UBTeacherBarDataMgr::loadContent(bool docChanged)
if(true/*docChanged*/){ if(true/*docChanged*/){
mSessionTitle = documentProxy->sessionTitle(); mSessionTitle = documentProxy->sessionTitle();
mSessionTarget = documentProxy->sessionTarget(); mSessionTarget = documentProxy->sessionTarget();
mSessionLicence = documentProxy->sessionLicence(); mSessionLicence = (eLicense)documentProxy->sessionLicence().toInt();
} }
// Page Title // Page Title
@ -113,3 +113,64 @@ void UBTeacherBarDataMgr::loadContent(bool docChanged)
mComments = nextInfos.comments; 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 <QHBoxLayout>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QComboBox> #include <QComboBox>
#include <QFrame>
typedef enum{ typedef enum{
eTeacherBarState_DocumentEdit, eTeacherBarState_DocumentEdit,
@ -32,6 +33,35 @@ typedef struct{
QString link; QString link;
}sLink; }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 class UBTeacherBarDataMgr
{ {
public: public:
@ -47,8 +77,8 @@ public:
QString sessionTarget(){return mSessionTarget;} QString sessionTarget(){return mSessionTarget;}
// Licence // Licence
void setSessionLicence(const QString& licence){mSessionLicence = licence;} void setSessionLicence(eLicense licence){mSessionLicence = licence;}
QString sessionLicence(){return mSessionLicence;} eLicense sessionLicence(){return mSessionLicence;}
// Page Title // Page Title
void setPageTitle(const QString& title){mPageTitle = title;} void setPageTitle(const QString& title){mPageTitle = title;}
@ -77,7 +107,7 @@ public:
private: private:
QString mSessionTitle; QString mSessionTitle;
QString mSessionTarget; QString mSessionTarget;
QString mSessionLicence; eLicense mSessionLicence;
QString mPageTitle; QString mPageTitle;
QString mComments; QString mComments;

@ -126,7 +126,7 @@ void UBActionPreview::setContent(const QString &content)
{ {
if(NULL != mpContent){ if(NULL != mpContent){
mpContent->setText(content); 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() 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 // License
mLayout.addWidget(&mLicenseSeparator); mLayout.addWidget(&mLicenseSeparator);
mpLicenseLabel = new QLabel(tr("License"), this); mpLicenseLabel = new UBTBLicenseWidget(this);
mpLicenseLabel->setObjectName("UBTeacherBarPreviewSubtitle");
mLayout.addWidget(mpLicenseLabel); mLayout.addWidget(mpLicenseLabel);
// TODO : Add the license field here
// Edit button // Edit button
mpEditButton = new QPushButton(tr("Edit infos"), this); mpEditButton = new QPushButton(tr("Edit infos"), this);
@ -271,11 +256,14 @@ void UBTeacherBarPreviewWidget::updateFields()
// Media // Media
generateMedias(); generateMedias();
// Comments
generateComments();
// Links // Links
generateLinks(); generateLinks();
// Comments // License
generateComments(); mpLicenseLabel->setLicense(mpDataMgr->sessionLicence());
} }
@ -295,6 +283,9 @@ void UBTeacherBarPreviewWidget::clearFields()
} }
mStoredWidgets.clear(); mStoredWidgets.clear();
} }
// License
mpLicenseLabel->setLicense(eLicense_CCBY);
} }
void UBTeacherBarPreviewWidget::generateActions() void UBTeacherBarPreviewWidget::generateActions()

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

Loading…
Cancel
Save