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 @@
#include "qt4.hpp"
#include "components/playlist/playlist_model.hpp"
#include "dialogs_provider.hpp"
/* THEDP */
#include "input_manager.hpp"
/* THEMIM */
#include <vlc_intf_strings.h>
/* I_DIR */
...
...
@@ -41,6 +40,7 @@
#include <QIcon>
#include <QFont>
#include <QTimer>
#include <QAction>
QIcon
PLModel
::
icons
[
ITEM_TYPE_NUMBER
];
...
...
@@ -74,8 +74,6 @@ PLModel::PLModel( playlist_t *_p_playlist, /* THEPL */
ADD_ICON
(
NODE
,
":/type/node"
);
#undef ADD_ICON
i_zoom
=
getSettings
()
->
value
(
"Playlist/zoom"
,
0
).
toInt
();
rebuild
(
p_root
);
DCONNECT
(
THEMIM
->
getIM
(),
metaChanged
(
input_item_t
*
),
this
,
processInputItemUpdate
(
input_item_t
*
)
);
...
...
@@ -90,7 +88,6 @@ PLModel::PLModel( playlist_t *_p_playlist, /* THEPL */
PLModel
::~
PLModel
()
{
getSettings
()
->
setValue
(
"Playlist/zoom"
,
i_zoom
);
delete
rootItem
;
}
...
...
@@ -367,7 +364,6 @@ QVariant PLModel::data( const QModelIndex &index, const int role ) const
else
if
(
role
==
Qt
::
FontRole
)
{
QFont
f
;
f
.
setPointSize
(
__MAX
(
f
.
pointSize
()
+
i_zoom
,
4
)
);
if
(
isCurrent
(
index
)
)
f
.
setBold
(
true
);
return
QVariant
(
f
);
...
...
modules/gui/qt4/components/playlist/standardpanel.cpp
View file @
58dc2946
...
...
@@ -59,6 +59,7 @@
#include <QInputDialog>
#include <QDesktopServices>
#include <QUrl>
#include <QFont>
#include <assert.h>
...
...
@@ -88,6 +89,8 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
/* Saved Settings */
int
i_savedViewMode
=
getSettings
()
->
value
(
"Playlist/view-mode"
,
TREE_VIEW
).
toInt
();
i_zoom
=
getSettings
()
->
value
(
"Playlist/zoom"
,
0
).
toInt
();
showView
(
i_savedViewMode
);
DCONNECT
(
THEMIM
,
leafBecameParent
(
int
),
...
...
@@ -106,6 +109,7 @@ StandardPLPanel::~StandardPLPanel()
if
(
treeView
)
getSettings
()
->
setValue
(
"headerStateV2"
,
treeView
->
header
()
->
saveState
()
);
getSettings
()
->
setValue
(
"view-mode"
,
currentViewIndex
()
);
getSettings
()
->
setValue
(
"zoom"
,
i_zoom
);
getSettings
()
->
endGroup
();
}
...
...
@@ -245,8 +249,8 @@ bool StandardPLPanel::popup( const QModelIndex & index, const QPoint &point, con
/* Zoom */
QMenu
*
zoomMenu
=
new
QMenu
(
qtr
(
"Display size"
)
);
zoomMenu
->
addAction
(
qtr
(
"Increase"
),
model
,
SLOT
(
increaseZoom
()
)
);
zoomMenu
->
addAction
(
qtr
(
"Decrease"
),
model
,
SLOT
(
decreaseZoom
()
)
);
zoomMenu
->
addAction
(
qtr
(
"Increase"
),
this
,
SLOT
(
increaseZoom
()
)
);
zoomMenu
->
addAction
(
qtr
(
"Decrease"
),
this
,
SLOT
(
decreaseZoom
()
)
);
menu
.
addMenu
(
zoomMenu
);
CONNECT
(
&
menu
,
triggered
(
QAction
*
),
model
,
actionSlot
(
QAction
*
)
);
...
...
@@ -561,6 +565,20 @@ void StandardPLPanel::createTreeView()
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
)
{
#ifdef MEDIA_LIBRARY
...
...
@@ -646,6 +664,7 @@ void StandardPLPanel::showView( int i_view )
}
}
updateZoom
(
i_zoom
);
viewStack
->
setCurrentWidget
(
currentView
);
browseInto
();
gotoPlayingItem
();
...
...
modules/gui/qt4/components/playlist/standardpanel.hpp
View file @
58dc2946
...
...
@@ -86,6 +86,7 @@ private:
PlIconView
*
iconView
;
PlListView
*
listView
;
PicFlowView
*
picFlowView
;
int
i_zoom
;
QAbstractItemView
*
currentView
;
...
...
@@ -100,6 +101,7 @@ private:
void
createIconView
();
void
createListView
();
void
createCoverView
();
void
updateZoom
(
int
i_zoom
);
void
changeModel
(
bool
b_ml
);
bool
eventFilter
(
QObject
*
watched
,
QEvent
*
event
);
...
...
@@ -130,6 +132,8 @@ private slots:
void
popupExplore
();
void
popupStream
();
void
popupSave
();
void
increaseZoom
()
{
updateZoom
(
i_zoom
+
1
);
};
void
decreaseZoom
()
{
updateZoom
(
i_zoom
-
1
);
};
void
toggleColumnShown
(
int
);
void
showView
(
int
);
...
...
modules/gui/qt4/components/playlist/views.cpp
View file @
58dc2946
...
...
@@ -32,6 +32,7 @@
#include <QFontMetrics>
#include <QDrag>
#include <QDragMoveEvent>
#include <QMetaType>
#include "assert.h"
...
...
@@ -78,6 +79,7 @@ void PlIconViewItemDelegate::paint( QPainter * painter, const QStyleOptionViewIt
QString
artist
=
VLCModel
::
getMeta
(
index
,
COLUMN_ARTIST
);
QFont
font
(
index
.
data
(
Qt
::
FontRole
).
value
<
QFont
>
()
);
font
.
setPointSize
(
__MAX
(
font
.
pointSize
()
+
i_zoom
,
4
)
);
painter
->
setFont
(
font
);
QFontMetrics
fm
=
painter
->
fontMetrics
();
...
...
@@ -163,6 +165,7 @@ void PlIconViewItemDelegate::paint( QPainter * painter, const QStyleOptionViewIt
QSize
PlIconViewItemDelegate
::
sizeHint
(
const
QStyleOptionViewItem
&
,
const
QModelIndex
&
index
)
const
{
QFont
f
(
index
.
data
(
Qt
::
FontRole
).
value
<
QFont
>
()
);
f
.
setPointSize
(
__MAX
(
f
.
pointSize
()
+
i_zoom
,
4
)
);
f
.
setBold
(
true
);
QFontMetrics
fm
(
f
);
int
textHeight
=
fm
.
height
();
...
...
@@ -216,6 +219,7 @@ void PlListViewItemDelegate::paint( QPainter * painter, const QStyleOptionViewIt
//Draw title info
f
.
setItalic
(
true
);
f
.
setPointSize
(
__MAX
(
f
.
pointSize
()
+
i_zoom
,
4
)
);
painter
->
setFont
(
f
);
QFontMetrics
fm
(
painter
->
fontMetrics
()
);
...
...
modules/gui/qt4/components/playlist/views.hpp
View file @
58dc2946
...
...
@@ -32,12 +32,19 @@
class
QPainter
;
class
PLModel
;
class
QFont
;
class
AbstractPlViewItemDelegate
:
public
QStyledItemDelegate
{
Q_OBJECT
public:
AbstractPlViewItemDelegate
(
QWidget
*
parent
=
0
)
:
QStyledItemDelegate
(
parent
)
{}
void
paintBackground
(
QPainter
*
,
const
QStyleOptionViewItem
&
,
const
QModelIndex
&
)
const
;
void
setZoom
(
int
z
)
{
i_zoom
=
z
;
};
protected:
int
i_zoom
;
};
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 )
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:
public
slots
:
virtual
void
activateItem
(
const
QModelIndex
&
index
)
=
0
;
virtual
void
actionSlot
(
QAction
*
action
)
=
0
;
void
increaseZoom
();
void
decreaseZoom
();
protected:
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
)
...
...
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