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
84249d56
Commit
84249d56
authored
Jan 28, 2010
by
Jakob Leben
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt: replace playlist view title with interactive location bar
parent
76cc0af9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
73 additions
and
6 deletions
+73
-6
modules/gui/qt4/components/playlist/standardpanel.cpp
modules/gui/qt4/components/playlist/standardpanel.cpp
+55
-6
modules/gui/qt4/components/playlist/standardpanel.hpp
modules/gui/qt4/components/playlist/standardpanel.hpp
+18
-0
No files found.
modules/gui/qt4/components/playlist/standardpanel.cpp
View file @
84249d56
...
...
@@ -43,6 +43,8 @@
#include <QMenu>
#include <QSignalMapper>
#include <QWheelEvent>
#include <QToolButton>
#include <QFontMetrics>
#include <assert.h>
...
...
@@ -68,12 +70,15 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
currentRootId
=
-
1
;
/* Title label */
title
=
new
QLabel
;
/*
title = new QLabel;
QFont titleFont;
titleFont.setPointSize( titleFont.pointSize() + 6 );
titleFont.setFamily( "Verdana" );
title->setFont( titleFont );
layout
->
addWidget
(
title
,
0
,
0
);
layout->addWidget( title, 0, 0 );*/
locationBar
=
new
LocationBar
(
model
);
layout
->
addWidget
(
locationBar
,
0
,
0
);
/* A Spacer and the search possibilities */
layout
->
setColumnStretch
(
1
,
10
);
...
...
@@ -117,6 +122,8 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
last_activated_id
=
-
1
;
CONNECT
(
THEMIM
,
inputChanged
(
input_thread_t
*
),
this
,
handleInputChange
(
input_thread_t
*
)
);
CONNECT
(
locationBar
,
invoked
(
const
QModelIndex
&
),
iconView
,
setRootIndex
(
const
QModelIndex
&
)
);
}
StandardPLPanel
::~
StandardPLPanel
()
...
...
@@ -219,15 +226,17 @@ void StandardPLPanel::setRoot( playlist_item_t *p_item )
currentRootId
=
p_item
->
i_id
;
/* cosmetics, ..still need playlist locking.. */
char
*
psz_title
=
input_item_GetName
(
p_item
->
p_input
);
/*
char *psz_title = input_item_GetName( p_item->p_input );
title->setText( qfu(psz_title) );
free
(
psz_title
);
free( psz_title );
*/
QPL_UNLOCK
;
/* do THE job */
model
->
rebuild
(
p_item
);
locationBar
->
setIndex
(
QModelIndex
()
);
/* enable/disable adding */
if
(
p_item
==
THEPL
->
p_local_category
||
p_item
==
THEPL
->
p_local_onelevel
)
...
...
@@ -372,7 +381,8 @@ void StandardPLPanel::activate( const QModelIndex &index )
{
if
(
currentView
==
iconView
)
{
iconView
->
setRootIndex
(
index
);
title
->
setText
(
index
.
data
().
toString
()
);
//title->setText( index.data().toString() );
locationBar
->
setIndex
(
index
);
}
}
else
...
...
@@ -395,9 +405,48 @@ void StandardPLPanel::handleInputChange( input_thread_t *p_input_thread )
{
QModelIndex
index
=
model
->
index
(
p_item
->
p_parent
->
i_id
,
0
);
iconView
->
setRootIndex
(
index
);
title
->
setText
(
index
.
data
().
toString
()
);
//title->setText( index.data().toString() );
locationBar
->
setIndex
(
index
);
last_activated_id
=
p_item
->
i_id
;
}
playlist_Unlock
(
THEPL
);
}
LocationBar
::
LocationBar
(
PLModel
*
m
)
{
model
=
m
;
mapper
=
new
QSignalMapper
;
CONNECT
(
mapper
,
mapped
(
int
),
this
,
invoke
(
int
)
);
}
void
LocationBar
::
setIndex
(
const
QModelIndex
&
index
)
{
clear
();
QAction
*
prev
=
NULL
;
QModelIndex
i
=
index
;
QFont
font
;
QFontMetrics
metrics
(
font
);
while
(
true
)
{
QToolButton
*
btn
=
new
QToolButton
;
PLItem
*
item
=
model
->
getItem
(
i
);
QString
text
=
input_item_GetTitleFbName
(
item
->
inputItem
()
);
text
=
QString
(
"/ "
)
+
metrics
.
elidedText
(
text
,
Qt
::
ElideRight
,
150
);
btn
->
setText
(
text
);
btn
->
setToolButtonStyle
(
Qt
::
ToolButtonTextBesideIcon
);
prev
=
insertWidget
(
prev
,
btn
);
mapper
->
setMapping
(
btn
,
item
->
id
()
);
CONNECT
(
btn
,
clicked
(
),
mapper
,
map
(
)
);
if
(
i
.
isValid
()
)
i
=
i
.
parent
();
else
break
;
}
}
void
LocationBar
::
invoke
(
int
i_id
)
{
QModelIndex
index
=
model
->
index
(
i_id
,
0
);
emit
invoked
(
index
);
}
modules/gui/qt4/components/playlist/standardpanel.hpp
View file @
84249d56
...
...
@@ -34,6 +34,7 @@
#include <QModelIndex>
#include <QWidget>
#include <QString>
#include <QToolBar>
#include <vlc_playlist.h>
...
...
@@ -45,6 +46,7 @@ class QPushButton;
class
QKeyEvent
;
class
QWheelEvent
;
class
PlIconView
;
class
LocationBar
;
class
StandardPLPanel
:
public
QWidget
{
...
...
@@ -68,6 +70,7 @@ private:
QLabel
*
title
;
QPushButton
*
addButton
;
QGridLayout
*
layout
;
LocationBar
*
locationBar
;
QTreeView
*
treeView
;
PlIconView
*
iconView
;
...
...
@@ -104,4 +107,19 @@ private slots:
void
handleInputChange
(
input_thread_t
*
);
};
class
LocationBar
:
public
QToolBar
{
Q_OBJECT
;
public:
LocationBar
(
PLModel
*
);
void
setIndex
(
const
QModelIndex
&
);
signals:
void
invoked
(
const
QModelIndex
&
);
private
slots
:
void
invoke
(
int
i_item_id
);
private:
PLModel
*
model
;
QSignalMapper
*
mapper
;
};
#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