Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
58dc2946
Commit
58dc2946
authored
Jul 19, 2012
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt: PLModel: move zoom value out of model
parent
029b9fae
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
37 additions
and
23 deletions
+37
-23
modules/gui/qt4/components/playlist/playlist_model.cpp
modules/gui/qt4/components/playlist/playlist_model.cpp
+1
-5
modules/gui/qt4/components/playlist/standardpanel.cpp
modules/gui/qt4/components/playlist/standardpanel.cpp
+21
-2
modules/gui/qt4/components/playlist/standardpanel.hpp
modules/gui/qt4/components/playlist/standardpanel.hpp
+4
-0
modules/gui/qt4/components/playlist/views.cpp
modules/gui/qt4/components/playlist/views.cpp
+4
-0
modules/gui/qt4/components/playlist/views.hpp
modules/gui/qt4/components/playlist/views.hpp
+7
-0
modules/gui/qt4/components/playlist/vlc_model.cpp
modules/gui/qt4/components/playlist/vlc_model.cpp
+0
-12
modules/gui/qt4/components/playlist/vlc_model.hpp
modules/gui/qt4/components/playlist/vlc_model.hpp
+0
-4
No files found.
modules/gui/qt4/components/playlist/playlist_model.cpp
View file @
58dc2946
...
@@ -29,7 +29,6 @@
...
@@ -29,7 +29,6 @@
#include "qt4.hpp"
#include "qt4.hpp"
#include "components/playlist/playlist_model.hpp"
#include "components/playlist/playlist_model.hpp"
#include "dialogs_provider.hpp"
/* THEDP */
#include "input_manager.hpp"
/* THEMIM */
#include "input_manager.hpp"
/* THEMIM */
#include <vlc_intf_strings.h>
/* I_DIR */
#include <vlc_intf_strings.h>
/* I_DIR */
...
@@ -41,6 +40,7 @@
...
@@ -41,6 +40,7 @@
#include <QIcon>
#include <QIcon>
#include <QFont>
#include <QFont>
#include <QTimer>
#include <QTimer>
#include <QAction>
QIcon
PLModel
::
icons
[
ITEM_TYPE_NUMBER
];
QIcon
PLModel
::
icons
[
ITEM_TYPE_NUMBER
];
...
@@ -74,8 +74,6 @@ PLModel::PLModel( playlist_t *_p_playlist, /* THEPL */
...
@@ -74,8 +74,6 @@ PLModel::PLModel( playlist_t *_p_playlist, /* THEPL */
ADD_ICON
(
NODE
,
":/type/node"
);
ADD_ICON
(
NODE
,
":/type/node"
);
#undef ADD_ICON
#undef ADD_ICON
i_zoom
=
getSettings
()
->
value
(
"Playlist/zoom"
,
0
).
toInt
();
rebuild
(
p_root
);
rebuild
(
p_root
);
DCONNECT
(
THEMIM
->
getIM
(),
metaChanged
(
input_item_t
*
),
DCONNECT
(
THEMIM
->
getIM
(),
metaChanged
(
input_item_t
*
),
this
,
processInputItemUpdate
(
input_item_t
*
)
);
this
,
processInputItemUpdate
(
input_item_t
*
)
);
...
@@ -90,7 +88,6 @@ PLModel::PLModel( playlist_t *_p_playlist, /* THEPL */
...
@@ -90,7 +88,6 @@ PLModel::PLModel( playlist_t *_p_playlist, /* THEPL */
PLModel
::~
PLModel
()
PLModel
::~
PLModel
()
{
{
getSettings
()
->
setValue
(
"Playlist/zoom"
,
i_zoom
);
delete
rootItem
;
delete
rootItem
;
}
}
...
@@ -367,7 +364,6 @@ QVariant PLModel::data( const QModelIndex &index, const int role ) const
...
@@ -367,7 +364,6 @@ QVariant PLModel::data( const QModelIndex &index, const int role ) const
else
if
(
role
==
Qt
::
FontRole
)
else
if
(
role
==
Qt
::
FontRole
)
{
{
QFont
f
;
QFont
f
;
f
.
setPointSize
(
__MAX
(
f
.
pointSize
()
+
i_zoom
,
4
)
);
if
(
isCurrent
(
index
)
)
if
(
isCurrent
(
index
)
)
f
.
setBold
(
true
);
f
.
setBold
(
true
);
return
QVariant
(
f
);
return
QVariant
(
f
);
...
...
modules/gui/qt4/components/playlist/standardpanel.cpp
View file @
58dc2946
...
@@ -59,6 +59,7 @@
...
@@ -59,6 +59,7 @@
#include <QInputDialog>
#include <QInputDialog>
#include <QDesktopServices>
#include <QDesktopServices>
#include <QUrl>
#include <QUrl>
#include <QFont>
#include <assert.h>
#include <assert.h>
...
@@ -88,6 +89,8 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
...
@@ -88,6 +89,8 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
/* Saved Settings */
/* Saved Settings */
int
i_savedViewMode
=
getSettings
()
->
value
(
"Playlist/view-mode"
,
TREE_VIEW
).
toInt
();
int
i_savedViewMode
=
getSettings
()
->
value
(
"Playlist/view-mode"
,
TREE_VIEW
).
toInt
();
i_zoom
=
getSettings
()
->
value
(
"Playlist/zoom"
,
0
).
toInt
();
showView
(
i_savedViewMode
);
showView
(
i_savedViewMode
);
DCONNECT
(
THEMIM
,
leafBecameParent
(
int
),
DCONNECT
(
THEMIM
,
leafBecameParent
(
int
),
...
@@ -106,6 +109,7 @@ StandardPLPanel::~StandardPLPanel()
...
@@ -106,6 +109,7 @@ StandardPLPanel::~StandardPLPanel()
if
(
treeView
)
if
(
treeView
)
getSettings
()
->
setValue
(
"headerStateV2"
,
treeView
->
header
()
->
saveState
()
);
getSettings
()
->
setValue
(
"headerStateV2"
,
treeView
->
header
()
->
saveState
()
);
getSettings
()
->
setValue
(
"view-mode"
,
currentViewIndex
()
);
getSettings
()
->
setValue
(
"view-mode"
,
currentViewIndex
()
);
getSettings
()
->
setValue
(
"zoom"
,
i_zoom
);
getSettings
()
->
endGroup
();
getSettings
()
->
endGroup
();
}
}
...
@@ -245,8 +249,8 @@ bool StandardPLPanel::popup( const QModelIndex & index, const QPoint &point, con
...
@@ -245,8 +249,8 @@ bool StandardPLPanel::popup( const QModelIndex & index, const QPoint &point, con
/* Zoom */
/* Zoom */
QMenu
*
zoomMenu
=
new
QMenu
(
qtr
(
"Display size"
)
);
QMenu
*
zoomMenu
=
new
QMenu
(
qtr
(
"Display size"
)
);
zoomMenu
->
addAction
(
qtr
(
"Increase"
),
model
,
SLOT
(
increaseZoom
()
)
);
zoomMenu
->
addAction
(
qtr
(
"Increase"
),
this
,
SLOT
(
increaseZoom
()
)
);
zoomMenu
->
addAction
(
qtr
(
"Decrease"
),
model
,
SLOT
(
decreaseZoom
()
)
);
zoomMenu
->
addAction
(
qtr
(
"Decrease"
),
this
,
SLOT
(
decreaseZoom
()
)
);
menu
.
addMenu
(
zoomMenu
);
menu
.
addMenu
(
zoomMenu
);
CONNECT
(
&
menu
,
triggered
(
QAction
*
),
model
,
actionSlot
(
QAction
*
)
);
CONNECT
(
&
menu
,
triggered
(
QAction
*
),
model
,
actionSlot
(
QAction
*
)
);
...
@@ -561,6 +565,20 @@ void StandardPLPanel::createTreeView()
...
@@ -561,6 +565,20 @@ void StandardPLPanel::createTreeView()
viewStack
->
addWidget
(
treeView
);
viewStack
->
addWidget
(
treeView
);
}
}
void
StandardPLPanel
::
updateZoom
(
int
i
)
{
if
(
i
<
4
-
QApplication
::
font
().
pointSize
()
)
return
;
i_zoom
=
i
;
#define A_ZOOM( view ) \
if ( view ) \
qobject_cast<AbstractPlViewItemDelegate*>( view->itemDelegate() )->setZoom( i_zoom )
/* Can't iterate as picflow & tree aren't using custom delegate */
A_ZOOM
(
iconView
);
A_ZOOM
(
listView
);
#undef A_ZOOM
currentView
->
reset
();
}
void
StandardPLPanel
::
changeModel
(
bool
b_ml
)
void
StandardPLPanel
::
changeModel
(
bool
b_ml
)
{
{
#ifdef MEDIA_LIBRARY
#ifdef MEDIA_LIBRARY
...
@@ -646,6 +664,7 @@ void StandardPLPanel::showView( int i_view )
...
@@ -646,6 +664,7 @@ void StandardPLPanel::showView( int i_view )
}
}
}
}
updateZoom
(
i_zoom
);
viewStack
->
setCurrentWidget
(
currentView
);
viewStack
->
setCurrentWidget
(
currentView
);
browseInto
();
browseInto
();
gotoPlayingItem
();
gotoPlayingItem
();
...
...
modules/gui/qt4/components/playlist/standardpanel.hpp
View file @
58dc2946
...
@@ -86,6 +86,7 @@ private:
...
@@ -86,6 +86,7 @@ private:
PlIconView
*
iconView
;
PlIconView
*
iconView
;
PlListView
*
listView
;
PlListView
*
listView
;
PicFlowView
*
picFlowView
;
PicFlowView
*
picFlowView
;
int
i_zoom
;
QAbstractItemView
*
currentView
;
QAbstractItemView
*
currentView
;
...
@@ -100,6 +101,7 @@ private:
...
@@ -100,6 +101,7 @@ private:
void
createIconView
();
void
createIconView
();
void
createListView
();
void
createListView
();
void
createCoverView
();
void
createCoverView
();
void
updateZoom
(
int
i_zoom
);
void
changeModel
(
bool
b_ml
);
void
changeModel
(
bool
b_ml
);
bool
eventFilter
(
QObject
*
watched
,
QEvent
*
event
);
bool
eventFilter
(
QObject
*
watched
,
QEvent
*
event
);
...
@@ -130,6 +132,8 @@ private slots:
...
@@ -130,6 +132,8 @@ private slots:
void
popupExplore
();
void
popupExplore
();
void
popupStream
();
void
popupStream
();
void
popupSave
();
void
popupSave
();
void
increaseZoom
()
{
updateZoom
(
i_zoom
+
1
);
};
void
decreaseZoom
()
{
updateZoom
(
i_zoom
-
1
);
};
void
toggleColumnShown
(
int
);
void
toggleColumnShown
(
int
);
void
showView
(
int
);
void
showView
(
int
);
...
...
modules/gui/qt4/components/playlist/views.cpp
View file @
58dc2946
...
@@ -32,6 +32,7 @@
...
@@ -32,6 +32,7 @@
#include <QFontMetrics>
#include <QFontMetrics>
#include <QDrag>
#include <QDrag>
#include <QDragMoveEvent>
#include <QDragMoveEvent>
#include <QMetaType>
#include "assert.h"
#include "assert.h"
...
@@ -78,6 +79,7 @@ void PlIconViewItemDelegate::paint( QPainter * painter, const QStyleOptionViewIt
...
@@ -78,6 +79,7 @@ void PlIconViewItemDelegate::paint( QPainter * painter, const QStyleOptionViewIt
QString
artist
=
VLCModel
::
getMeta
(
index
,
COLUMN_ARTIST
);
QString
artist
=
VLCModel
::
getMeta
(
index
,
COLUMN_ARTIST
);
QFont
font
(
index
.
data
(
Qt
::
FontRole
).
value
<
QFont
>
()
);
QFont
font
(
index
.
data
(
Qt
::
FontRole
).
value
<
QFont
>
()
);
font
.
setPointSize
(
__MAX
(
font
.
pointSize
()
+
i_zoom
,
4
)
);
painter
->
setFont
(
font
);
painter
->
setFont
(
font
);
QFontMetrics
fm
=
painter
->
fontMetrics
();
QFontMetrics
fm
=
painter
->
fontMetrics
();
...
@@ -163,6 +165,7 @@ void PlIconViewItemDelegate::paint( QPainter * painter, const QStyleOptionViewIt
...
@@ -163,6 +165,7 @@ void PlIconViewItemDelegate::paint( QPainter * painter, const QStyleOptionViewIt
QSize
PlIconViewItemDelegate
::
sizeHint
(
const
QStyleOptionViewItem
&
,
const
QModelIndex
&
index
)
const
QSize
PlIconViewItemDelegate
::
sizeHint
(
const
QStyleOptionViewItem
&
,
const
QModelIndex
&
index
)
const
{
{
QFont
f
(
index
.
data
(
Qt
::
FontRole
).
value
<
QFont
>
()
);
QFont
f
(
index
.
data
(
Qt
::
FontRole
).
value
<
QFont
>
()
);
f
.
setPointSize
(
__MAX
(
f
.
pointSize
()
+
i_zoom
,
4
)
);
f
.
setBold
(
true
);
f
.
setBold
(
true
);
QFontMetrics
fm
(
f
);
QFontMetrics
fm
(
f
);
int
textHeight
=
fm
.
height
();
int
textHeight
=
fm
.
height
();
...
@@ -216,6 +219,7 @@ void PlListViewItemDelegate::paint( QPainter * painter, const QStyleOptionViewIt
...
@@ -216,6 +219,7 @@ void PlListViewItemDelegate::paint( QPainter * painter, const QStyleOptionViewIt
//Draw title info
//Draw title info
f
.
setItalic
(
true
);
f
.
setItalic
(
true
);
f
.
setPointSize
(
__MAX
(
f
.
pointSize
()
+
i_zoom
,
4
)
);
painter
->
setFont
(
f
);
painter
->
setFont
(
f
);
QFontMetrics
fm
(
painter
->
fontMetrics
()
);
QFontMetrics
fm
(
painter
->
fontMetrics
()
);
...
...
modules/gui/qt4/components/playlist/views.hpp
View file @
58dc2946
...
@@ -32,12 +32,19 @@
...
@@ -32,12 +32,19 @@
class
QPainter
;
class
QPainter
;
class
PLModel
;
class
PLModel
;
class
QFont
;
class
AbstractPlViewItemDelegate
:
public
QStyledItemDelegate
class
AbstractPlViewItemDelegate
:
public
QStyledItemDelegate
{
{
Q_OBJECT
public:
public:
AbstractPlViewItemDelegate
(
QWidget
*
parent
=
0
)
:
QStyledItemDelegate
(
parent
)
{}
AbstractPlViewItemDelegate
(
QWidget
*
parent
=
0
)
:
QStyledItemDelegate
(
parent
)
{}
void
paintBackground
(
QPainter
*
,
const
QStyleOptionViewItem
&
,
const
QModelIndex
&
)
const
;
void
paintBackground
(
QPainter
*
,
const
QStyleOptionViewItem
&
,
const
QModelIndex
&
)
const
;
void
setZoom
(
int
z
)
{
i_zoom
=
z
;
};
protected:
int
i_zoom
;
};
};
class
PlIconViewItemDelegate
:
public
AbstractPlViewItemDelegate
class
PlIconViewItemDelegate
:
public
AbstractPlViewItemDelegate
...
...
modules/gui/qt4/components/playlist/vlc_model.cpp
View file @
58dc2946
...
@@ -76,15 +76,3 @@ QPixmap VLCModel::getArtPixmap( const QModelIndex & index, const QSize & size )
...
@@ -76,15 +76,3 @@ QPixmap VLCModel::getArtPixmap( const QModelIndex & index, const QSize & size )
return
artPix
;
return
artPix
;
}
}
void
VLCModel
::
increaseZoom
()
{
i_zoom
++
;
emit
layoutChanged
();
}
void
VLCModel
::
decreaseZoom
()
{
i_zoom
--
;
emit
layoutChanged
();
}
modules/gui/qt4/components/playlist/vlc_model.hpp
View file @
58dc2946
...
@@ -113,13 +113,9 @@ public:
...
@@ -113,13 +113,9 @@ public:
public
slots
:
public
slots
:
virtual
void
activateItem
(
const
QModelIndex
&
index
)
=
0
;
virtual
void
activateItem
(
const
QModelIndex
&
index
)
=
0
;
virtual
void
actionSlot
(
QAction
*
action
)
=
0
;
virtual
void
actionSlot
(
QAction
*
action
)
=
0
;
void
increaseZoom
();
void
decreaseZoom
();
protected:
protected:
intf_thread_t
*
p_intf
;
intf_thread_t
*
p_intf
;
/* Zoom factor for font-size */
int
i_zoom
;
/* FIXME: Probably should belong to View/Delegate */
};
};
Q_DECLARE_METATYPE
(
VLCModel
::
actionsContainerType
)
Q_DECLARE_METATYPE
(
VLCModel
::
actionsContainerType
)
...
...
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