Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpenBoard
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lifo
Nicolas Ollinger
OpenBoard
Commits
9444787b
Commit
9444787b
authored
Apr 11, 2012
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove UBWidgetList class
parent
a9ba75ac
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
3 additions
and
369 deletions
+3
-369
style.qss
resources/style.qss
+1
-69
UBWidgetList.cpp
src/customWidgets/UBWidgetList.cpp
+0
-229
UBWidgetList.h
src/customWidgets/UBWidgetList.h
+0
-69
customWidgets.pri
src/customWidgets/customWidgets.pri
+2
-2
No files found.
resources/style.qss
View file @
9444787b
...
@@ -3,23 +3,13 @@ QWidget#documentNavigator,
...
@@ -3,23 +3,13 @@ QWidget#documentNavigator,
QWidget#UBLibPathViewer,
QWidget#UBLibPathViewer,
QWidget#UBLibNavigatorWidget,
QWidget#UBLibNavigatorWidget,
QWidget#UBLibItemProperties,
QWidget#UBLibItemProperties,
QWidget#UBDownloadWidget,
QWidget#UBDownloadWidget
QWidget#UBWidgetList,
QWidget#UBTeacherBarDropMediaZone,
QWidget#UBTBMediaContainer
{
{
background: #EEEEEE;
background: #EEEEEE;
border-radius: 10px;
border-radius: 10px;
border: 2px solid #999999;
border: 2px solid #999999;
}
}
QFrame#UBTBSeparator
{
background: #DDDDDD;
border-radius: 2px;
border: 1px solid #DDDDDD;
}
QWidget#UBMediaVideoContainer
QWidget#UBMediaVideoContainer
{
{
background: #000000;
background: #000000;
...
@@ -27,40 +17,6 @@ QWidget#UBMediaVideoContainer
...
@@ -27,40 +17,6 @@ QWidget#UBMediaVideoContainer
border: 2px solid #999999;
border: 2px solid #999999;
}
}
QWidget#UBTBPreviewWidget
{
background: #FFFFFF;
border-radius: 10px;
border: 2px solid #999999;
}
QLabel#UBTBPreviewSessionTitle
{
font-size: 12px;
}
QLabel#UBTeacherBarPreviewTitle
{
color: #555555;
font-size : 20px;
font-weight:bold;
padding-left:5px;
}
QLabel#UBMediaPlayerButton
{
padding: 0px 0px 0px 0px;
}
QLabel#UBTeacherBarPreviewSubtitle
{
color: #555555;
font-size : 15px;
font-weight:bold;
padding-left:5px;
}
QWidget#UBLibWebView
QWidget#UBLibWebView
{
{
background: #EEEEEE;
background: #EEEEEE;
...
@@ -68,30 +24,6 @@ QWidget#UBLibWebView
...
@@ -68,30 +24,6 @@ QWidget#UBLibWebView
border: 2px solid #999999;
border: 2px solid #999999;
}
}
QWidget#UBActionPreviewOwner
{
color: #555555;
font-size : 12px;
font-weight: bold;
}
QWidget#UBTeacherBarPreviewComments,
QWidget#UBTeacherBarTargetBox
{
border-radius: 10px;
border: white 2px solid;
padding: 5px 5px 5px 5px;
background-color: white;
}
QWidget#UBActionPreviewContent,
QTextEdit#UBCommentPreview
{
border-radius : 10px;
border: 2px solid #999999;
padding: 5px 5px 5px 5px;
}
QWebView#SearchEngineView
QWebView#SearchEngineView
{
{
background:white;
background:white;
...
...
src/customWidgets/UBWidgetList.cpp
deleted
100644 → 0
View file @
a9ba75ac
#include <QDebug>
#include <QScrollBar>
#include <QApplication>
#include <QPainter>
#include "globals/UBGlobals.h"
#include "UBWidgetList.h"
UBWidgetList
::
UBWidgetList
(
QWidget
*
parent
,
eWidgetListOrientation
orientation
,
const
char
*
name
)
:
QScrollArea
(
parent
)
,
mCanRemove
(
true
)
,
mpLayout
(
NULL
)
,
mpContainer
(
NULL
)
,
mMargin
(
10
)
,
mListElementsSpacing
(
10
)
,
mpEmptyLabel
(
NULL
)
,
mpCurrentWidget
(
NULL
)
{
setObjectName
(
name
);
mOrientation
=
orientation
;
mpContainer
=
new
QWidget
(
this
);
mpEmptyLabel
=
new
QLabel
(
this
);
mpEmptyLabel
->
setObjectName
(
"emptyString"
);
mpEmptyLabel
->
setWordWrap
(
true
);
mpEmptyLabel
->
setAlignment
(
Qt
::
AlignCenter
);
if
(
eWidgetListOrientation_Vertical
==
orientation
){
setVerticalScrollBarPolicy
(
Qt
::
ScrollBarAsNeeded
);
setHorizontalScrollBarPolicy
(
Qt
::
ScrollBarAlwaysOff
);
mpLayout
=
new
QVBoxLayout
(
mpContainer
);
}
else
{
setHorizontalScrollBarPolicy
(
Qt
::
ScrollBarAsNeeded
);
setVerticalScrollBarPolicy
(
Qt
::
ScrollBarAlwaysOff
);
mpLayout
=
new
QHBoxLayout
(
mpContainer
);
}
mpLayout
->
setContentsMargins
(
margin
(),
margin
(),
margin
(),
margin
());
mpContainer
->
setLayout
(
mpLayout
);
setWidget
(
mpContainer
);
}
UBWidgetList
::~
UBWidgetList
()
{
DELETEPTR
(
mpEmptyLabel
);
DELETEPTR
(
mpLayout
);
DELETEPTR
(
mpContainer
);
}
void
UBWidgetList
::
addWidget
(
QWidget
*
widget
)
{
if
(
NULL
!=
mpLayout
&&
NULL
!=
widget
){
widget
->
setParent
(
mpContainer
);
mpEmptyLabel
->
setVisible
(
false
);
mWidgetInfo
[
widget
]
=
widget
->
size
();
updateView
(
size
());
mpLayout
->
addWidget
(
widget
);
// This call is used only to refresh the size of the widgets
updateSizes
();
}
}
void
UBWidgetList
::
removeWidget
(
QWidget
*
widget
)
{
if
(
NULL
!=
mpLayout
&&
NULL
!=
widget
){
mpLayout
->
removeWidget
(
widget
);
mWidgetInfo
.
remove
(
widget
);
widget
->
setVisible
(
false
);
updateView
(
size
());
if
(
0
==
mpLayout
->
count
()){
mpEmptyLabel
->
setVisible
(
true
);
}
if
(
mpCurrentWidget
==
widget
){
mpCurrentWidget
=
NULL
;
}
}
}
int
UBWidgetList
::
scaleWidgets
(
QSize
pSize
)
{
// to remove the first spacing that shouldn't be there.
int
result
=
-
mListElementsSpacing
;
foreach
(
QWidget
*
eachWidget
,
mWidgetInfo
.
keys
()){
qreal
scaleFactor
=
0
;
int
newWidgetWidth
=
pSize
.
width
();
int
newWidgetHeight
=
pSize
.
height
();
if
(
eWidgetListOrientation_Vertical
==
mOrientation
){
scaleFactor
=
(
float
)
mWidgetInfo
[
eachWidget
].
width
()
/
(
float
)
pSize
.
width
();
newWidgetHeight
=
mWidgetInfo
[
eachWidget
].
height
()
/
scaleFactor
;
result
+=
newWidgetHeight
;
eachWidget
->
setMinimumHeight
(
newWidgetHeight
-
1
);
eachWidget
->
setMaximumHeight
(
newWidgetHeight
);
}
else
{
scaleFactor
=
(
float
)
mWidgetInfo
[
eachWidget
].
height
()
/
(
float
)
pSize
.
height
();
newWidgetWidth
=
mWidgetInfo
[
eachWidget
].
width
()
/
scaleFactor
;
result
+=
newWidgetWidth
;
eachWidget
->
setMinimumWidth
(
newWidgetWidth
-
1
);
eachWidget
->
setMaximumWidth
(
newWidgetWidth
);
}
//Adding a vertical/horizontal space between each element of the list
result
+=
mListElementsSpacing
;
}
return
result
;
}
void
UBWidgetList
::
scaleContainer
(
QSize
pSize
,
int
updateValue
)
{
if
(
eWidgetListOrientation_Vertical
==
mOrientation
)
mpContainer
->
resize
(
pSize
.
width
(),
updateValue
);
else
mpContainer
->
resize
(
updateValue
,
pSize
.
height
());
}
void
UBWidgetList
::
updateView
(
QSize
pSize
)
{
// Widgets on list are resized automatically to fit the mpcontainer.
// so if you want to keep the aspect ratio you have to calculate
// the sum of the new widget height and give it to the mpContainer.
// The container resize will trig the widgets resize and the good
// height permits to respect the aspect ratio.
int
updatedValue
=
scaleWidgets
(
pSize
);
scaleContainer
(
pSize
,
updatedValue
);
}
void
UBWidgetList
::
resizeEvent
(
QResizeEvent
*
ev
)
{
Q_UNUSED
(
ev
);
mpEmptyLabel
->
setGeometry
((
width
()
-
mpEmptyLabel
->
width
())
/
2
,
(
height
()
-
mpEmptyLabel
->
height
())
/
2
,
mpEmptyLabel
->
width
(),
mpEmptyLabel
->
height
());
updateView
(
size
());
updateSizes
();
}
void
UBWidgetList
::
mousePressEvent
(
QMouseEvent
*
ev
)
{
Q_UNUSED
(
ev
);
if
(
mCanRemove
){
QWidget
*
pWAt
=
widgetAt
(
ev
->
pos
());
if
(
NULL
!=
mpCurrentWidget
){
if
(
pWAt
!=
mpCurrentWidget
){
mpCurrentWidget
->
setActionsVisible
(
false
);
update
();
}
}
mpCurrentWidget
=
dynamic_cast
<
UBActionableWidget
*>
(
pWAt
);
if
(
NULL
!=
mpCurrentWidget
){
mpCurrentWidget
->
setActionsVisible
(
true
);
update
();
}
}
update
();
}
QWidget
*
UBWidgetList
::
widgetAt
(
QPoint
p
)
{
QWidget
*
pW
=
NULL
;
pW
=
childAt
(
p
);
if
(
NULL
!=
pW
){
do
{
if
(
"UBTeacherStudentAction"
==
pW
->
objectName
()
||
"UBUrlWidget"
==
pW
->
objectName
()
||
"UBTBMediaPicture"
==
pW
->
objectName
()
||
"UBMediaWidget"
==
pW
->
objectName
()){
return
pW
;
}
else
{
pW
=
pW
->
parentWidget
();
}
}
while
(
NULL
!=
pW
&&
this
!=
pW
);
}
return
pW
;
}
void
UBWidgetList
::
updateSizes
()
{
// Resize all the widgets
foreach
(
QWidget
*
eachWidget
,
mWidgetInfo
.
keys
()){
if
(
NULL
!=
eachWidget
){
QSize
originalSize
=
mWidgetInfo
[
eachWidget
];
int
currentWidth
=
mpContainer
->
width
();
int
currentHeight
=
mpContainer
->
height
();
if
(
eWidgetListOrientation_Vertical
==
mOrientation
){
if
(
verticalScrollBar
()
->
isVisible
()){
currentWidth
-=
verticalScrollBar
()
->
width
();
eachWidget
->
setStyleSheet
(
QString
(
"margin-right:%0;"
).
arg
(
verticalScrollBar
()
->
width
()));
}
float
scaleFactor
=
(
float
)
currentWidth
/
(
float
)
originalSize
.
width
();
currentHeight
=
originalSize
.
height
()
*
scaleFactor
;
}
else
{
if
(
horizontalScrollBar
()
->
isVisible
()){
currentHeight
-=
horizontalScrollBar
()
->
height
();
eachWidget
->
setStyleSheet
(
QString
(
"padding-bottom:%0;"
).
arg
(
horizontalScrollBar
()
->
height
()));
}
float
scaleFactor
=
(
float
)
currentHeight
/
(
float
)
originalSize
.
height
();
currentWidth
=
originalSize
.
width
()
*
scaleFactor
;
}
eachWidget
->
resize
(
currentWidth
,
currentHeight
);
}
}
}
void
UBWidgetList
::
setMargin
(
int
margin
)
{
mMargin
=
margin
;
}
int
UBWidgetList
::
margin
()
{
return
mMargin
;
}
void
UBWidgetList
::
setEmptyText
(
const
QString
&
text
)
{
if
(
NULL
!=
mpEmptyLabel
){
mpEmptyLabel
->
setText
(
text
);
}
}
bool
UBWidgetList
::
empty
()
{
return
mWidgetInfo
.
empty
();
}
src/customWidgets/UBWidgetList.h
deleted
100644 → 0
View file @
a9ba75ac
#ifndef UBWIDGETLIST_H
#define UBWIDGETLIST_H
#include <QWidget>
#include <QScrollArea>
#include <QBoxLayout>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QResizeEvent>
#include <QVector>
#include <QLabel>
#include "interfaces/IResizeable.h"
#include "customWidgets/UBActionableWidget.h"
typedef
enum
{
eWidgetListOrientation_Vertical
,
eWidgetListOrientation_Horizontal
}
eWidgetListOrientation
;
class
UBWidgetList
:
public
QScrollArea
{
Q_OBJECT
typedef
struct
{
QSize
size
;
bool
isResizable
;
}
sWidgetProperties
;
public
:
UBWidgetList
(
QWidget
*
parent
=
0
,
eWidgetListOrientation
orientation
=
eWidgetListOrientation_Vertical
,
const
char
*
name
=
"UBWidgetList"
);
~
UBWidgetList
();
void
addWidget
(
QWidget
*
widget
);
void
removeWidget
(
QWidget
*
widget
);
void
setMargin
(
int
margin
);
void
setEmptyText
(
const
QString
&
text
);
int
margin
();
bool
empty
();
void
setListElementSpacing
(
int
margin
)
{
mListElementsSpacing
=
margin
;
}
int
listElementsSpacing
()
{
return
mListElementsSpacing
;
}
signals
:
void
closeWidget
(
QWidget
*
w
);
protected
:
bool
mCanRemove
;
void
resizeEvent
(
QResizeEvent
*
ev
);
void
mousePressEvent
(
QMouseEvent
*
ev
);
private
:
QWidget
*
widgetAt
(
QPoint
p
);
int
scaleWidgets
(
QSize
pSize
);
void
scaleContainer
(
QSize
pSize
,
int
updateValue
);
void
updateView
(
QSize
pSize
);
void
updateSizes
();
QBoxLayout
*
mpLayout
;
QWidget
*
mpContainer
;
eWidgetListOrientation
mOrientation
;
int
mMargin
;
int
mListElementsSpacing
;
QMap
<
QWidget
*
,
QSize
>
mWidgetInfo
;
QLabel
*
mpEmptyLabel
;
UBActionableWidget
*
mpCurrentWidget
;
};
#endif // UBWIDGETLIST_H
src/customWidgets/customWidgets.pri
View file @
9444787b
HEADERS +=
src/customWidgets/UBWidgetList.h
\
HEADERS += \
src/customWidgets/UBMediaWidget.h \
src/customWidgets/UBMediaWidget.h \
src/customWidgets/UBActionableWidget.h
src/customWidgets/UBActionableWidget.h
SOURCES +=
src/customWidgets/UBWidgetList.cpp
\
SOURCES += \
src/customWidgets/UBMediaWidget.cpp \
src/customWidgets/UBMediaWidget.cpp \
src/customWidgets/UBActionableWidget.cpp
src/customWidgets/UBActionableWidget.cpp
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment