Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-gpu
Commits
c5b155b6
Commit
c5b155b6
authored
Feb 04, 2010
by
Jakob Leben
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt: neat and crispy location bar, new location buttons
parent
4fe7b124
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
12 deletions
+60
-12
modules/gui/qt4/components/playlist/standardpanel.cpp
modules/gui/qt4/components/playlist/standardpanel.cpp
+47
-11
modules/gui/qt4/components/playlist/standardpanel.hpp
modules/gui/qt4/components/playlist/standardpanel.hpp
+13
-1
No files found.
modules/gui/qt4/components/playlist/standardpanel.cpp
View file @
c5b155b6
...
...
@@ -45,6 +45,7 @@
#include <QWheelEvent>
#include <QToolButton>
#include <QFontMetrics>
#include <QPainter>
#include <assert.h>
...
...
@@ -456,33 +457,33 @@ LocationBar::LocationBar( PLModel *m )
model
=
m
;
mapper
=
new
QSignalMapper
(
this
);
CONNECT
(
mapper
,
mapped
(
int
),
this
,
invoke
(
int
)
);
box
=
new
QHBoxLayout
;
box
->
setSpacing
(
0
);
setLayout
(
box
);
}
void
LocationBar
::
setIndex
(
const
QModelIndex
&
index
)
{
clear
(
);
QAction
*
prev
=
NULL
;
qDeleteAll
(
buttons
);
buttons
.
clear
()
;
QModelIndex
i
=
index
;
QFont
font
;
QFontMetrics
metrics
(
font
);
font
.
setBold
(
true
);
bool
bold
=
true
;
while
(
true
)
{
PLItem
*
item
=
model
->
getItem
(
i
);
QToolButton
*
btn
=
new
QToolButton
;
char
*
fb_name
=
input_item_GetTitleFbName
(
item
->
inputItem
()
);
QString
text
=
qfu
(
fb_name
);
free
(
fb_name
);
text
=
QString
(
"> "
)
+
metrics
.
elidedText
(
text
,
Qt
::
ElideRight
,
150
);
btn
->
setText
(
text
);
btn
->
setFont
(
font
);
prev
=
insertWidget
(
prev
,
btn
);
QToolButton
*
btn
=
new
LocationButton
(
text
,
bold
);
box
->
insertWidget
(
0
,
btn
);
buttons
.
append
(
btn
);
mapper
->
setMapping
(
btn
,
item
->
id
()
);
CONNECT
(
btn
,
clicked
(
),
mapper
,
map
(
)
);
font
=
QFont
()
;
bold
=
false
;
if
(
i
.
isValid
()
)
i
=
i
.
parent
();
else
break
;
...
...
@@ -495,3 +496,38 @@ void LocationBar::invoke( int i_id )
setIndex
(
index
);
emit
invoked
(
index
);
}
LocationButton
::
LocationButton
(
const
QString
&
text
,
bool
bold
)
{
QFont
font
;
font
.
setBold
(
bold
);
setFont
(
font
);
metrics
=
new
QFontMetrics
(
font
);
setText
(
metrics
->
elidedText
(
text
,
Qt
::
ElideRight
,
150
)
);
}
void
LocationButton
::
paintEvent
(
QPaintEvent
*
event
)
{
QStyleOptionButton
option
;
option
.
initFrom
(
this
);
option
.
rect
=
rect
();
option
.
text
=
text
();
option
.
features
=
QStyleOptionButton
::
Flat
;
option
.
state
|=
QStyle
::
State_Enabled
;
option
.
state
|=
isChecked
()
?
QStyle
::
State_On
:
QStyle
::
State_Off
;
if
(
isDown
()
)
option
.
state
|=
QStyle
::
State_Sunken
;
QPainter
p
(
this
);
style
()
->
drawControl
(
QStyle
::
CE_PushButtonBevel
,
&
option
,
&
p
);
option
.
rect
.
setLeft
(
18
);
p
.
drawText
(
option
.
rect
,
Qt
::
AlignVCenter
,
metrics
->
elidedText
(
text
(),
Qt
::
ElideRight
,
option
.
rect
.
width
()
-
5
)
);
option
.
rect
=
QRect
(
0
,
0
,
18
,
height
()
);
style
()
->
drawPrimitive
(
QStyle
::
PE_IndicatorArrowRight
,
&
option
,
&
p
);
}
QSize
LocationButton
::
sizeHint
()
const
{
QSize
s
(
metrics
->
boundingRect
(
text
()
).
size
()
);
s
+=
QSize
(
25
,
10
);
return
s
;
}
modules/gui/qt4/components/playlist/standardpanel.hpp
View file @
c5b155b6
...
...
@@ -110,7 +110,7 @@ private slots:
void
browseInto
(
input_item_t
*
);
};
class
LocationBar
:
public
Q
ToolBar
class
LocationBar
:
public
Q
Widget
{
Q_OBJECT
;
public:
...
...
@@ -123,6 +123,18 @@ private slots:
private:
PLModel
*
model
;
QSignalMapper
*
mapper
;
QHBoxLayout
*
box
;
QList
<
QWidget
*>
buttons
;
};
class
LocationButton
:
public
QToolButton
{
public:
LocationButton
(
const
QString
&
,
bool
bold
);
private:
void
paintEvent
(
QPaintEvent
*
event
);
QSize
sizeHint
()
const
;
QFontMetrics
*
metrics
;
};
#endif
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