1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#include "globals/UBGlobals.h"
#include "UBTBDocumentPreviewWidget.h"
UBTBDocumentPreviewWidget::UBTBDocumentPreviewWidget(UBTeacherBarDataMgr *pDataMgr, QWidget *parent, const char *name):QWidget(parent)
, mpContainer(NULL)
, 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)
{
setObjectName(name);
mpDataMgr = pDataMgr;
setLayout(&mLayout);
mLayout.setContentsMargins(0, 0, 0, 0);
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);
// 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");
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()));
}
UBTBDocumentPreviewWidget::~UBTBDocumentPreviewWidget()
{
}
void UBTBDocumentPreviewWidget::onEdit()
{
emit changeTBState(eTeacherBarState_DocumentEdit);
}
void UBTBDocumentPreviewWidget::onPageView()
{
emit changeTBState(eTeacherBarState_PagePreview);
}
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("");
}