Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Multimedia
Dragon
Commits
e9ae6ded
Commit
e9ae6ded
authored
Nov 27, 2020
by
Friedrich W. H. Kossebau
Browse files
Use more member-function-pointer-based signal/slot connections
NO_CHANGELOG
parent
a360c512
Changes
18
Hide whitespace changes
Inline
Side-by-side
src/app/actions.cpp
View file @
e9ae6ded
...
...
@@ -16,7 +16,7 @@
#include "videoWindow.h"
Dragon
::
PlayAction
::
PlayAction
(
QObject
*
receiver
,
const
char
*
slot
,
KActionCollection
*
ac
)
Dragon
::
PlayAction
::
PlayAction
(
KActionCollection
*
ac
)
:
KDualAction
(
ac
)
{
setObjectName
(
QLatin1String
(
"play"
)
);
...
...
@@ -26,7 +26,6 @@ Dragon::PlayAction::PlayAction( QObject *receiver, const char *slot, KActionColl
setAutoToggle
(
false
);
ac
->
setDefaultShortcuts
(
this
,
QList
<
QKeySequence
>
()
<<
Qt
::
Key_Space
<<
Qt
::
Key_MediaPlay
);
ac
->
addAction
(
objectName
(),
this
);
connect
(
this
,
SIGNAL
(
triggered
(
bool
)),
receiver
,
slot
);
}
void
Dragon
::
PlayAction
::
setPlaying
(
bool
playing
)
...
...
@@ -37,15 +36,14 @@ void Dragon::PlayAction::setPlaying( bool playing )
/////////////////////////////////////////////////////
///Codeine::VolumeAction
////////////////////////////////////////////////////
Dragon
::
VolumeAction
::
VolumeAction
(
QObject
*
receiver
,
const
char
*
slot
,
KActionCollection
*
ac
)
Dragon
::
VolumeAction
::
VolumeAction
(
KActionCollection
*
ac
)
:
KToggleAction
(
i18nc
(
"@option:check Volume of sound output"
,
"Volume"
),
ac
)
{
setObjectName
(
QLatin1String
(
"volume"
)
);
setIcon
(
QIcon
::
fromTheme
(
QLatin1String
(
"player-volume"
)
)
);
ac
->
setDefaultShortcut
(
this
,
Qt
::
Key_V
);
ac
->
addAction
(
objectName
(),
this
);
connect
(
this
,
SIGNAL
(
triggered
(
bool
)),
receiver
,
slot
);
connect
(
engine
(),
SIGNAL
(
mutedChanged
(
bool
)),
this
,
SLOT
(
mutedChanged
(
bool
))
);
connect
(
engine
(),
&
Dragon
::
VideoWindow
::
mutedChanged
,
this
,
&
Dragon
::
VolumeAction
::
mutedChanged
);
}
void
Dragon
::
VolumeAction
::
mutedChanged
(
bool
mute
)
...
...
src/app/actions.h
View file @
e9ae6ded
...
...
@@ -22,17 +22,31 @@ class PlayAction : public KDualAction
{
Q_OBJECT
public:
PlayAction
(
QObject
*
receiver
,
const
char
*
slot
,
KActionCollection
*
);
template
<
class
Receiver
,
class
Func
>
inline
PlayAction
(
const
Receiver
*
receiver
,
Func
slot
,
KActionCollection
*
ac
)
:
PlayAction
(
ac
)
{
connect
(
this
,
&
QAction
::
triggered
,
receiver
,
slot
);
}
void
setPlaying
(
bool
playing
);
private:
explicit
PlayAction
(
KActionCollection
*
ac
);
};
class
VolumeAction
:
public
KToggleAction
{
Q_OBJECT
public:
VolumeAction
(
QObject
*
receiver
,
const
char
*
slot
,
KActionCollection
*
);
template
<
class
Receiver
,
class
Func
>
inline
VolumeAction
(
const
Receiver
*
receiver
,
Func
slot
,
KActionCollection
*
ac
)
:
VolumeAction
(
ac
)
{
connect
(
this
,
&
QAction
::
triggered
,
receiver
,
slot
);
}
private
Q_SLOTS
:
void
mutedChanged
(
bool
);
private:
explicit
VolumeAction
(
KActionCollection
*
ac
);
};
}
...
...
src/app/adjustSizeButton.cpp
View file @
e9ae6ded
...
...
@@ -37,12 +37,12 @@ AdjustSizeButton::AdjustSizeButton( QWidget *parent )
setFrameStyle
(
QFrame
::
Plain
|
QFrame
::
Box
);
m_preferred
=
new
QPushButton
(
QIcon
::
fromTheme
(
"viewmag"
),
i18nc
(
"@action:button"
,
"Preferred Scale"
),
this
);
connect
(
m_preferred
,
SIGNAL
(
clicked
())
,
Dragon
::
mainWindow
(),
SLOT
(
adjustSize
())
);
connect
(
m_preferred
,
SIGNAL
(
clicked
()),
SLOT
(
deleteLater
())
);
connect
(
m_preferred
,
&
QAbstractButton
::
clicked
,
Dragon
::
mainWindow
(),
&
QWidget
::
adjustSize
);
connect
(
m_preferred
,
&
QAbstractButton
::
clicked
,
this
,
&
QObject
::
deleteLater
);
m_oneToOne
=
new
QPushButton
(
QIcon
::
fromTheme
(
"viewmag1"
),
i18nc
(
"@action:button"
,
"Scale 100%"
),
this
);
connect
(
m_oneToOne
,
SIGNAL
(
clicked
()),
(
QObject
*
)
videoWindow
(),
SLOT
(
resetZoom
())
);
connect
(
m_oneToOne
,
SIGNAL
(
clicked
()),
SLOT
(
deleteLater
())
);
connect
(
m_oneToOne
,
&
QAbstractButton
::
clicked
,
videoWindow
(),
&
VideoWindow
::
resetZoom
);
connect
(
m_oneToOne
,
&
QAbstractButton
::
clicked
,
this
,
&
QObject
::
deleteLater
);
QBoxLayout
*
hbox
=
new
QHBoxLayout
(
this
);
QBoxLayout
*
vbox
=
new
QVBoxLayout
(
this
);
...
...
src/app/adjustSizeButton.h
View file @
e9ae6ded
...
...
@@ -12,6 +12,7 @@
class
QEvent
;
class
QTimerEvent
;
class
QPushButton
;
namespace
Dragon
{
...
...
@@ -23,8 +24,8 @@ class AdjustSizeButton : public QFrame
int
m_offset
;
int
m_timerId
;
Q
Widget
*
m_preferred
;
Q
Widget
*
m_oneToOne
;
Q
PushButton
*
m_preferred
;
Q
PushButton
*
m_oneToOne
;
QFrame
*
m_thingy
;
...
...
src/app/analyzer/analyzerBase.cpp
View file @
e9ae6ded
...
...
@@ -147,10 +147,10 @@ void Analyzer::Base::demo() //virtual
Analyzer
::
Base2D
::
Base2D
(
QWidget
*
parent
,
uint
scopeSize
)
:
Base
(
parent
,
scopeSize
)
{
QTimer
::
singleShot
(
0
,
this
,
SLOT
(
init
())
);
// needs to know the size
QTimer
::
singleShot
(
0
,
this
,
&
Base2D
::
init
);
// needs to know the size
timer
.
setInterval
(
34
);
timer
.
setSingleShot
(
false
);
connect
(
&
timer
,
SIGNAL
(
timeout
())
,
this
,
SLOT
(
demo
())
);
connect
(
&
timer
,
&
QTimer
::
timeout
,
this
,
&
Base2D
::
demo
);
timer
.
start
();
}
...
...
src/app/audioView2.cpp
View file @
e9ae6ded
...
...
@@ -21,7 +21,7 @@ AudioView2::AudioView2(QWidget *parent) :
ui
->
m_analyzerFrame
->
setMinimumSize
(
ui
->
m_analyzer
->
minimumSize
());
setupAnalyzer
();
connect
(
engine
(),
SIGNAL
(
metaDataChanged
())
,
this
,
SLOT
(
update
())
);
connect
(
engine
(),
&
VideoWindow
::
metaDataChanged
,
this
,
&
AudioView2
::
update
);
}
AudioView2
::~
AudioView2
()
...
...
src/app/discSelectionDialog.cpp
View file @
e9ae6ded
...
...
@@ -87,7 +87,8 @@ DiscSelectionDialog::DiscSelectionDialog( QWidget* parent, const QList< Solid::D
layout
->
addWidget
(
bbox
);
setLayout
(
layout
);
connect
(
m_listWidget
,
SIGNAL
(
itemDoubleClicked
(
QListWidgetItem
*
)),
this
,
SLOT
(
discItemSelected
(
QListWidgetItem
*
))
);
connect
(
m_listWidget
,
&
QListWidget
::
itemDoubleClicked
,
this
,
&
DiscSelectionDialog
::
discItemSelected
);
connect
(
bbox
,
&
QDialogButtonBox
::
accepted
,
this
,
&
DiscSelectionDialog
::
okClicked
);
connect
(
bbox
,
&
QDialogButtonBox
::
rejected
,
this
,
&
QDialog
::
deleteLater
);
//connect( bbox, &QDialogButtonBox::rejected, const_cast<QObject *>(Dragon::mainWindow()), &Dragon::MainWindow::playDisc ); // kf5 FIXME? this could have never worked
...
...
src/app/loadView.cpp
View file @
e9ae6ded
...
...
@@ -20,11 +20,12 @@ LoadView::LoadView( QWidget *parent )
setupUi
(
this
);
setStyleSheet
(
QLatin1String
(
"QPushButton { text-align: center; }"
));
connect
(
m_playDiskButton
,
SIGNAL
(
clicked
()),
this
,
SIGNAL
(
openDVDPressed
())
);
connect
(
m_playFileButton
,
SIGNAL
(
clicked
()),
this
,
SIGNAL
(
openFilePressed
())
);
connect
(
m_playStreamButton
,
SIGNAL
(
clicked
()),
this
,
SIGNAL
(
openStreamPressed
())
);
connect
(
m_recentlyPlayed
,
SIGNAL
(
itemDoubleClicked
(
QUrl
)),
this
,
SIGNAL
(
loadUrl
(
QUrl
))
);
connect
(
this
,
SIGNAL
(
reloadRecentlyList
()),
m_recentlyPlayed
,
SLOT
(
loadEntries
())
);
connect
(
m_playDiskButton
,
&
QAbstractButton
::
clicked
,
this
,
&
LoadView
::
openDVDPressed
);
connect
(
m_playFileButton
,
&
QAbstractButton
::
clicked
,
this
,
&
LoadView
::
openFilePressed
);
connect
(
m_playStreamButton
,
&
QAbstractButton
::
clicked
,
this
,
&
LoadView
::
openStreamPressed
);
connect
(
m_recentlyPlayed
,
QOverload
<
const
QUrl
&>::
of
(
&
RecentlyPlayedList
::
itemDoubleClicked
),
this
,
&
LoadView
::
loadUrl
);
connect
(
this
,
&
LoadView
::
reloadRecentlyList
,
m_recentlyPlayed
,
&
RecentlyPlayedList
::
loadEntries
);
}
void
LoadView
::
setThumbnail
(
QWidget
*
object
)
...
...
src/app/loadView.h
View file @
e9ae6ded
...
...
@@ -21,7 +21,7 @@ public:
explicit
LoadView
(
QWidget
*
parent
);
void
setThumbnail
(
QWidget
*
object
);
Q_SIGNALS:
void
loadUrl
(
QUrl
);
void
loadUrl
(
const
QUrl
&
);
void
openFilePressed
();
void
openDVDPressed
();
void
openStreamPressed
();
...
...
src/app/mainWindow.cpp
View file @
e9ae6ded
...
...
@@ -135,7 +135,7 @@ MainWindow::MainWindow()
menuAction = new KActionMenu( text, this ); \
menuAction->setObjectName( name ); \
menuAction->setEnabled( false ); \
connect(
menuAction->menu(),
SIGNAL(
aboutToShow
()), SLOT(
aboutToShowMenu
())
); \
connect(menuAction->menu(),
&QMenu::
aboutToShow
, this, &MainWindow::
aboutToShowMenu); \
ac->addAction( menuAction->objectName(), menuAction );
make_menu
(
QLatin1String
(
"aspect_ratio_menu"
),
i18nc
(
"@title:menu"
,
"Aspect &Ratio"
)
);
make_menu
(
QLatin1String
(
"audio_channels_menu"
),
i18nc
(
"@title:menu"
,
"&Audio Channels"
)
);
...
...
@@ -152,7 +152,7 @@ MainWindow::MainWindow()
m_aspectRatios->addAction( ratioAction ); \
TheStream::addRatio( aspectEnum, ratioAction ); \
ac->addAction( objectname, ratioAction ); \
connect(
ratioAction,
SIGNAL(
triggered
())
, this,
SLOT(
streamSettingChange
())
); \
connect(ratioAction,
&QAction::
triggered, this,
&MainWindow::
streamSettingChange); \
}
make_ratio_action
(
i18nc
(
"@option:radio aspect ratio"
,
"Determine &Automatically"
),
QLatin1String
(
"ratio_auto"
),
Phonon
::
VideoWidget
::
AspectRatioAuto
);
make_ratio_action
(
i18nc
(
"@option:radio aspect ratio"
,
"&4:3"
),
QLatin1String
(
"ratio_golden"
),
Phonon
::
VideoWidget
::
AspectRatio4_3
);
...
...
@@ -174,7 +174,7 @@ MainWindow::MainWindow()
//"faster" startup
//TODO if we have a size stored for this video, do the "faster" route
QTimer
::
singleShot
(
0
,
this
,
SLOT
(
init
())
);
QTimer
::
singleShot
(
0
,
this
,
&
MainWindow
::
init
);
QApplication
::
setOverrideCursor
(
Qt
::
WaitCursor
);
}
...
...
@@ -182,23 +182,23 @@ void
MainWindow
::
init
()
{
//connect the stuff in loadView
connect
(
m_loadView
,
SIGNAL
(
openDVDPressed
())
,
this
,
SLOT
(
playDisc
())
);
connect
(
m_loadView
,
SIGNAL
(
openFilePressed
())
,
this
,
SLOT
(
openFileDialog
())
);
connect
(
m_loadView
,
SIGNAL
(
openStreamPressed
())
,
this
,
SLOT
(
openStreamDialog
())
);
connect
(
m_loadView
,
SIGNAL
(
loadUrl
(
QUrl
)),
this
,
SLOT
(
open
(
QUrl
))
);
connect
(
m_loadView
,
&
LoadView
::
openDVDPressed
,
this
,
&
MainWindow
::
playDisc
);
connect
(
m_loadView
,
&
LoadView
::
openFilePressed
,
this
,
&
MainWindow
::
openFileDialog
);
connect
(
m_loadView
,
&
LoadView
::
openStreamPressed
,
this
,
&
MainWindow
::
openStreamDialog
);
connect
(
m_loadView
,
&
LoadView
::
loadUrl
,
this
,
&
MainWindow
::
open
);
//connect the video player
connect
(
engine
(),
SIGNAL
(
stateUpdated
(
Phonon
::
S
tate
,
Phonon
::
St
ate
))
,
this
,
SLOT
(
engineStateChanged
(
Phonon
::
State
))
);
connect
(
engine
(),
SIGNAL
(
currentSourceChanged
(
Phonon
::
MediaSource
)),
this
,
SLOT
(
engineMediaChanged
(
Phonon
::
MediaSource
))
);
connect
(
engine
(),
SIGNAL
(
seekableChanged
(
bool
))
,
this
,
SLOT
(
engineSeekableChanged
(
bool
))
);
connect
(
engine
(),
SIGNAL
(
metaDataChanged
())
,
this
,
SLOT
(
engineMetaDataChanged
())
);
connect
(
engine
(),
SIGNAL
(
hasVideoChanged
(
bool
))
,
this
,
SLOT
(
engineHasVideoChanged
(
bool
))
);
connect
(
engine
(),
&
VideoWindow
::
s
tate
Upd
ate
d
,
this
,
&
MainWindow
::
engineStateChanged
);
connect
(
engine
(),
&
VideoWindow
::
currentSourceChanged
,
this
,
&
MainWindow
::
engineMediaChanged
);
connect
(
engine
(),
&
VideoWindow
::
seekableChanged
,
this
,
&
MainWindow
::
engineSeekableChanged
);
connect
(
engine
(),
&
VideoWindow
::
metaDataChanged
,
this
,
&
MainWindow
::
engineMetaDataChanged
);
connect
(
engine
(),
&
VideoWindow
::
hasVideoChanged
,
this
,
&
MainWindow
::
engineHasVideoChanged
);
connect
(
engine
(),
SIGNAL
(
subChannelsChanged
(
QList
<
QAction
*>
)),
this
,
SLOT
(
subChannelsChanged
(
QList
<
QAction
*>
))
);
connect
(
engine
(),
SIGNAL
(
audioChannelsChanged
(
QList
<
QAction
*>
)),
this
,
SLOT
(
audioChannelsChanged
(
QList
<
QAction
*>
))
);
connect
(
engine
(),
SIGNAL
(
mutedChanged
(
bool
))
,
this
,
SLOT
(
mutedChanged
(
bool
))
);
connect
(
engine
(),
&
VideoWindow
::
subChannelsChanged
,
this
,
&
MainWindow
::
subChannelsChanged
);
connect
(
engine
(),
&
VideoWindow
::
audioChannelsChanged
,
this
,
&
MainWindow
::
audioChannelsChanged
);
connect
(
engine
(),
&
VideoWindow
::
mutedChanged
,
this
,
&
MainWindow
::
mutedChanged
);
connect
(
engine
(),
&
VideoWindow
::
finished
,
this
,
&
MainWindow
::
toggleLoadView
);
connect
(
engine
(),
&
VideoWindow
::
finished
,
this
,
&
MainWindow
::
toggleLoadView
);
if
(
!
engine
()
->
init
()
)
{
KMessageBox
::
error
(
this
,
i18n
(
...
...
@@ -208,11 +208,11 @@ MainWindow::init()
//would be dangerous for these to happen before the videoWindow() is initialised
setAcceptDrops
(
true
);
connect
(
statusBar
(),
SIGNAL
(
messageChanged
(
QString
))
,
engine
(),
SLOT
(
showOSD
(
QString
))
);
connect
(
statusBar
(),
&
QStatusBar
::
messageChanged
,
engine
(),
&
VideoWindow
::
showOSD
);
//statusBar()->insertPermanentItem( "hello world", 0, 0 );
m_timeLabel
=
new
TimeLabel
(
statusBar
()
);
connect
(
videoWindow
(),
SIGNAL
(
tick
(
qint64
))
,
m_timeLabel
,
SLOT
(
setCurrentTime
(
qint64
))
);
connect
(
videoWindow
(),
SIGNAL
(
totalTimeChanged
(
qint64
))
,
m_timeLabel
,
SLOT
(
setTotalTime
(
qint64
))
);
connect
(
videoWindow
(),
&
VideoWindow
::
tick
,
m_timeLabel
,
&
TimeLabel
::
setCurrentTime
);
connect
(
videoWindow
(),
&
VideoWindow
::
totalTimeChanged
,
m_timeLabel
,
&
TimeLabel
::
setTotalTime
);
statusBar
()
->
addPermanentWidget
(
m_titleLabel
,
100
);
statusBar
()
->
addPermanentWidget
(
m_timeLabel
);
...
...
@@ -263,9 +263,9 @@ MainWindow::setupActions()
{
KActionCollection
*
const
ac
=
actionCollection
();
KStandardAction
::
quit
(
qApp
,
SLOT
(
closeAllWindows
())
,
ac
);
KStandardAction
::
quit
(
qApp
,
&
QApplication
::
closeAllWindows
,
ac
);
KStandardAction
::
open
(
this
,
SLOT
(
toggleLoadView
())
,
ac
)
->
setText
(
i18nc
(
"@action"
,
"Play &Media..."
)
);
KStandardAction
::
open
(
this
,
&
MainWindow
::
toggleLoadView
,
ac
)
->
setText
(
i18nc
(
"@action"
,
"Play &Media..."
)
);
#define addToAc( X ) ac->addAction( X->objectName(), X );
...
...
@@ -274,10 +274,11 @@ MainWindow::setupActions()
ac
->
setDefaultShortcuts
(
toggleFullScreen
,
QList
<
QKeySequence
>
()
<<
Qt
::
Key_F
<<
KStandardShortcut
::
fullScreen
());
toggleFullScreen
->
setAutoRepeat
(
false
);
connect
(
toggleFullScreen
,
SIGNAL
(
toggled
(
bool
)),
Dragon
::
mainWindow
(),
SLOT
(
setFullScreen
(
bool
))
);
addToAc
(
toggleFullScreen
);
new
PlayAction
(
this
,
SLOT
(
play
())
,
ac
);
new
VolumeAction
(
this
,
SLOT
(
toggleVolumeSlider
(
bool
))
,
ac
);
new
PlayAction
(
this
,
&
MainWindow
::
play
,
ac
);
new
VolumeAction
(
this
,
&
MainWindow
::
toggleVolumeSlider
,
ac
);
m_menuToggleAction
=
static_cast
<
KToggleAction
*>
(
ac
->
addAction
(
KStandardAction
::
ShowMenubar
,
...
...
@@ -286,36 +287,36 @@ MainWindow::setupActions()
QAction
*
action
=
new
QAction
(
i18nc
(
"@action"
,
"Increase Volume"
),
ac
);
action
->
setObjectName
(
QLatin1String
(
"volume_inc"
));
connect
(
action
,
SIGNAL
(
triggered
())
,
engine
(),
SLOT
(
increaseVolume
())
);
connect
(
action
,
&
QAction
::
triggered
,
engine
(),
&
VideoWindow
::
increaseVolume
);
addToAc
(
action
);
action
=
new
QAction
(
i18nc
(
"@action"
,
"Decrease Volume"
),
ac
);
action
->
setObjectName
(
QLatin1String
(
"volume_dec"
));
connect
(
action
,
SIGNAL
(
triggered
())
,
engine
(),
SLOT
(
decreaseVolume
())
);
connect
(
action
,
&
QAction
::
triggered
,
engine
(),
&
VideoWindow
::
decreaseVolume
);
addToAc
(
action
);
QAction
*
playerStop
=
new
QAction
(
QIcon
::
fromTheme
(
QLatin1String
(
"media-playback-stop"
)),
i18nc
(
"@action"
,
"Stop"
),
ac
);
playerStop
->
setObjectName
(
QLatin1String
(
"stop"
)
);
ac
->
setDefaultShortcuts
(
playerStop
,
QList
<
QKeySequence
>
()
<<
Qt
::
Key_S
<<
Qt
::
Key_MediaStop
);
connect
(
playerStop
,
SIGNAL
(
triggered
())
,
this
,
SLOT
(
stop
())
);
connect
(
playerStop
,
&
QAction
::
triggered
,
this
,
&
MainWindow
::
stop
);
addToAc
(
playerStop
)
KToggleAction
*
mute
=
new
KToggleAction
(
QIcon
::
fromTheme
(
QLatin1String
(
"player-volume-muted"
)),
i18nc
(
"@action Mute the sound output"
,
"Mute"
),
ac
);
mute
->
setObjectName
(
QLatin1String
(
"mute"
)
);
ac
->
setDefaultShortcut
(
mute
,
Qt
::
Key_M
);
connect
(
mute
,
SIGNAL
(
toggled
(
bool
)),
videoWindow
(),
SLOT
(
mute
(
bool
))
);
connect
(
mute
,
&
QAction
::
toggled
,
videoWindow
(),
&
VideoWindow
::
mute
);
addToAc
(
mute
)
QAction
*
resetZoom
=
new
QAction
(
QIcon
::
fromTheme
(
QLatin1String
(
"zoom-fit-best"
)),
i18nc
(
"@action"
,
"Reset Video Scale"
),
ac
);
resetZoom
->
setObjectName
(
QLatin1String
(
"reset_zoom"
)
);
ac
->
setDefaultShortcut
(
resetZoom
,
Qt
::
Key_Equal
);
connect
(
resetZoom
,
SIGNAL
(
triggered
())
,
videoWindow
(),
SLOT
(
resetZoom
())
);
connect
(
resetZoom
,
&
QAction
::
triggered
,
videoWindow
(),
&
VideoWindow
::
resetZoom
);
addToAc
(
resetZoom
)
QAction
*
dvdMenu
=
new
QAction
(
QIcon
::
fromTheme
(
QLatin1String
(
"media-optical-video"
)),
i18nc
(
"@action"
,
"Menu Toggle"
),
ac
);
dvdMenu
->
setObjectName
(
QLatin1String
(
"toggle_dvd_menu"
)
);
ac
->
setDefaultShortcut
(
dvdMenu
,
Qt
::
Key_R
);
connect
(
dvdMenu
,
SIGNAL
(
triggered
())
,
engine
(),
SLOT
(
toggleDVDMenu
())
);
connect
(
dvdMenu
,
&
QAction
::
triggered
,
engine
(),
&
VideoWindow
::
toggleDVDMenu
);
addToAc
(
dvdMenu
)
QWidgetAction
*
positionSlider
=
new
QWidgetAction
(
ac
);
...
...
@@ -327,7 +328,7 @@ MainWindow::setupActions()
QAction
*
videoSettings
=
new
QAction
(
i18nc
(
"@option:check"
,
"Video Settings"
),
ac
);
videoSettings
->
setObjectName
(
QLatin1String
(
"video_settings"
)
);
videoSettings
->
setCheckable
(
true
);
connect
(
videoSettings
,
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
toggleVideoSettings
(
bool
))
);
connect
(
videoSettings
,
&
QAction
::
toggled
,
this
,
&
MainWindow
::
toggleVideoSettings
);
addToAc
(
videoSettings
)
QAction
*
uniqueToggle
=
...
...
@@ -337,45 +338,45 @@ MainWindow::setupActions()
uniqueToggle
->
setObjectName
(
QLatin1String
(
"unique"
)
);
uniqueToggle
->
setCheckable
(
true
);
uniqueToggle
->
setChecked
(
!
KSharedConfig
::
openConfig
()
->
group
(
"KDE"
).
readEntry
(
"MultipleInstances"
,
QVariant
(
false
)).
toBool
()
);
connect
(
uniqueToggle
,
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
toggleUnique
(
bool
))
);
connect
(
uniqueToggle
,
&
QAction
::
toggled
,
this
,
&
MainWindow
::
toggleUnique
);
addToAc
(
uniqueToggle
)
QAction
*
prev_chapter
=
new
QAction
(
QIcon
::
fromTheme
(
QLatin1String
(
"media-skip-backward"
)),
i18nc
(
"@action previous chapter"
,
"Previous"
),
ac
);
prev_chapter
->
setObjectName
(
QLatin1String
(
"prev_chapter"
)
);
ac
->
setDefaultShortcuts
(
prev_chapter
,
QList
<
QKeySequence
>
()
<<
Qt
::
Key_Comma
<<
Qt
::
Key_MediaPrevious
);
connect
(
prev_chapter
,
SIGNAL
(
triggered
())
,
engine
(),
SLOT
(
prevChapter
())
);
connect
(
prev_chapter
,
&
QAction
::
triggered
,
engine
(),
&
VideoWindow
::
prevChapter
);
addToAc
(
prev_chapter
)
QAction
*
next_chapter
=
new
QAction
(
QIcon
::
fromTheme
(
QLatin1String
(
"media-skip-forward"
)),
i18nc
(
"@action next chapter"
,
"Next"
),
ac
);
next_chapter
->
setObjectName
(
QLatin1String
(
"next_chapter"
)
);
ac
->
setDefaultShortcuts
(
next_chapter
,
QList
<
QKeySequence
>
()
<<
Qt
::
Key_Period
<<
Qt
::
Key_MediaNext
);
connect
(
next_chapter
,
SIGNAL
(
triggered
())
,
engine
(),
SLOT
(
nextChapter
())
);
connect
(
next_chapter
,
&
QAction
::
triggered
,
engine
(),
&
VideoWindow
::
nextChapter
);
addToAc
(
next_chapter
)
// xgettext: no-c-format
QAction
*
tenPercentBack
=
new
QAction
(
QIcon
::
fromTheme
(
QLatin1String
(
"media-seek-backward"
)),
i18nc
(
"@action"
,
"Return 10% Back"
),
ac
);
tenPercentBack
->
setObjectName
(
QLatin1String
(
"ten_percent_back"
)
);
ac
->
setDefaultShortcut
(
tenPercentBack
,
Qt
::
Key_PageUp
);
connect
(
tenPercentBack
,
SIGNAL
(
triggered
())
,
engine
(),
SLOT
(
tenPercentBack
())
);
connect
(
tenPercentBack
,
&
QAction
::
triggered
,
engine
(),
&
VideoWindow
::
tenPercentBack
);
addToAc
(
tenPercentBack
)
// xgettext: no-c-format
QAction
*
tenPercentForward
=
new
QAction
(
QIcon
::
fromTheme
(
QLatin1String
(
"media-seek-forward"
)),
i18nc
(
"@action"
,
"Go 10% Forward"
),
ac
);
tenPercentForward
->
setObjectName
(
QLatin1String
(
"ten_percent_forward"
)
);
ac
->
setDefaultShortcut
(
tenPercentForward
,
Qt
::
Key_PageDown
);
connect
(
tenPercentForward
,
SIGNAL
(
triggered
())
,
engine
(),
SLOT
(
tenPercentForward
())
);
connect
(
tenPercentForward
,
&
QAction
::
triggered
,
engine
(),
&
VideoWindow
::
tenPercentForward
);
addToAc
(
tenPercentForward
)
QAction
*
tenSecondsBack
=
new
QAction
(
QIcon
::
fromTheme
(
QLatin1String
(
"media-seek-backward"
)),
i18nc
(
"@action"
,
"Return 10 Seconds Back"
),
ac
);
tenSecondsBack
->
setObjectName
(
QLatin1String
(
"ten_seconds_back"
)
);
ac
->
setDefaultShortcut
(
tenSecondsBack
,
Qt
::
Key_Minus
);
connect
(
tenSecondsBack
,
SIGNAL
(
triggered
())
,
engine
(),
SLOT
(
tenSecondsBack
())
);
connect
(
tenSecondsBack
,
&
QAction
::
triggered
,
engine
(),
&
VideoWindow
::
tenSecondsBack
);
addToAc
(
tenSecondsBack
)
QAction
*
tenSecondsForward
=
new
QAction
(
QIcon
::
fromTheme
(
QLatin1String
(
"media-seek-forward"
)),
i18nc
(
"@action"
,
"Go 10 Seconds Forward"
),
ac
);
tenSecondsForward
->
setObjectName
(
QLatin1String
(
"ten_seconds_forward"
)
);
ac
->
setDefaultShortcut
(
tenSecondsForward
,
Qt
::
Key_Plus
);
connect
(
tenSecondsForward
,
SIGNAL
(
triggered
())
,
engine
(),
SLOT
(
tenSecondsForward
())
);
connect
(
tenSecondsForward
,
&
QAction
::
triggered
,
engine
(),
&
VideoWindow
::
tenSecondsForward
);
addToAc
(
tenSecondsForward
)
#undef addToAc
}
...
...
@@ -407,12 +408,12 @@ MainWindow::toggleVideoSettings( bool show )
m_sliders
<<
ui
.
brightnessSlider
<<
ui
.
contrastSlider
<<
ui
.
hueSlider
<<
ui
.
saturationSlider
;
updateSliders
();
for
(
QSlider
*
slider
:
qAsConst
(
m_sliders
))
{
connect
(
slider
,
SIGNAL
(
valueChanged
(
int
))
,
engine
(),
SLOT
(
settingChanged
(
int
))
);
connect
(
slider
,
&
QAbstractSlider
::
valueChanged
,
engine
(),
&
VideoWindow
::
settingChanged
);
}
connect
(
ui
.
defaultsButton
,
SIGNAL
(
clicked
(
bool
)),
this
,
SLOT
(
restoreDefaultVideoSettings
())
);
connect
(
ui
.
closeButton
,
SIGNAL
(
clicked
(
bool
))
,
action
(
"video_settings"
),
SLOT
(
setChecked
(
bool
))
);
connect
(
ui
.
closeButton
,
SIGNAL
(
clicked
(
bool
))
,
m_leftDock
,
SLOT
(
deleteLater
())
);
connect
(
ui
.
defaultsButton
,
&
QAbstractButton
::
clicked
,
this
,
&
MainWindow
::
restoreDefaultVideoSettings
);
connect
(
ui
.
closeButton
,
&
QAbstractButton
::
clicked
,
action
(
"video_settings"
),
&
QAction
::
setChecked
);
connect
(
ui
.
closeButton
,
&
QAbstractButton
::
clicked
,
m_leftDock
,
&
QObject
::
deleteLater
);
}
else
{
m_sliders
.
clear
();
delete
m_leftDock
;
...
...
@@ -464,7 +465,7 @@ MainWindow::toggleVolumeSlider( bool show )
m_muteCheckBox
=
new
QCheckBox
();
m_muteCheckBox
->
setText
(
i18nc
(
"@option:check Mute the sound output"
,
"Mute"
)
);
m_muteCheckBox
->
setChecked
(
engine
()
->
isMuted
()
);
connect
(
m_muteCheckBox
,
SIGNAL
(
toggled
(
bool
)),
videoWindow
(),
SLOT
(
mute
(
bool
))
);
connect
(
m_muteCheckBox
,
&
QCheckBox
::
toggled
,
videoWindow
(),
&
VideoWindow
::
mute
);
QVBoxLayout
*
layout
=
new
QVBoxLayout
();
layout
->
addWidget
(
m_volumeSlider
);
...
...
@@ -480,7 +481,7 @@ MainWindow::toggleVolumeSlider( bool show )
m_rightDock
->
setWidget
(
dock
);
addDockWidget
(
Qt
::
RightDockWidgetArea
,
m_rightDock
);
}
else
{
disconnect
(
m_muteCheckBox
,
SIGNAL
(
toggled
(
bool
)),
videoWindow
(),
SLOT
(
mute
(
bool
))
);
disconnect
(
m_muteCheckBox
,
&
QCheckBox
::
toggled
,
videoWindow
(),
&
VideoWindow
::
mute
);
delete
m_rightDock
;
// it's a QPointer, it will 0 itself
}
}
...
...
src/app/part.cpp
View file @
e9ae6ded
...
...
@@ -60,7 +60,7 @@ namespace Dragon
layout
->
addWidget
(
toolBar
);
layout
->
addWidget
(
new
VideoWindow
(
widget
()
)
);
m_playPause
=
new
Dragon
::
PlayAction
(
videoWindow
(),
SLOT
(
playPause
())
,
ac
);
m_playPause
=
new
Dragon
::
PlayAction
(
videoWindow
(),
&
VideoWindow
::
playPause
,
ac
);
toolBar
->
addAction
(
m_playPause
);
{
QWidget
*
slider
=
videoWindow
()
->
newPositionSlider
();
...
...
@@ -71,9 +71,9 @@ namespace Dragon
ac
->
addAction
(
sliderAction
->
objectName
(),
sliderAction
);
toolBar
->
addAction
(
sliderAction
);
}
connect
(
engine
(),
SIGNAL
(
stateChanged
(
Phonon
::
State
))
,
this
,
SLOT
(
engineStateChanged
(
Phonon
::
State
))
);
connect
(
engine
(),
&
VideoWindow
::
stateChanged
,
this
,
&
Part
::
engineStateChanged
);
videoWindow
()
->
setContextMenuPolicy
(
Qt
::
CustomContextMenu
);
connect
(
videoWindow
(),
SIGNAL
(
customContextMenuRequested
())
,
this
,
SLOT
(
videoContextMenu
())
);
connect
(
videoWindow
(),
&
QWidget
::
customContextMenuRequested
,
this
,
&
Part
::
videoContextMenu
);
widget
()
->
setLayout
(
layout
);
}
...
...
src/app/playDialog.cpp
View file @
e9ae6ded
...
...
@@ -30,7 +30,7 @@ PlayDialog::PlayDialog( QWidget *parent, bool be_welcome_dialog )
setWindowTitle
(
i18nc
(
"@title:window"
,
"Play Media"
)
);
QSignalMapper
*
mapper
=
new
QSignalMapper
(
this
);
Q
Widget
*
o
;
Q
PushButton
*
o
;
QPushButton
*
closeButton
=
new
QPushButton
(
this
);
KGuiItem
::
assign
(
closeButton
,
KStandardGuiItem
::
close
());
QBoxLayout
*
vbox
=
new
QVBoxLayout
();
...
...
@@ -48,15 +48,15 @@ PlayDialog::PlayDialog( QWidget *parent, bool be_welcome_dialog )
//TODO use the kguiItems from the actions
mapper
->
setMapping
(
o
=
new
QPushButton
(
QIcon
::
fromTheme
(
"document-open"
),
i18nc
(
"@action:button"
,
"Play File..."
),
this
),
FILE
);
connect
(
o
,
SIGNAL
(
clicked
())
,
mapper
,
SLOT
(
map
())
);
connect
(
o
,
&
QAbstractButton
::
clicked
,
mapper
,
QOverload
<>::
of
(
&
QSignalMapper
::
map
)
);
grid
->
addWidget
(
o
,
0
,
0
);
mapper
->
setMapping
(
o
=
new
QPushButton
(
QIcon
::
fromTheme
(
"media-optical-video"
),
i18nc
(
"@action:button"
,
"Play Disc"
),
this
),
DVD
);
connect
(
o
,
SIGNAL
(
clicked
())
,
mapper
,
SLOT
(
map
())
);
connect
(
o
,
&
QAbstractButton
::
clicked
,
mapper
,
QOverload
<>::
of
(
&
QSignalMapper
::
map
)
);
grid
->
addWidget
(
o
,
0
,
1
);
mapper
->
setMapping
(
closeButton
,
QDialog
::
Rejected
);
connect
(
closeButton
,
SIGNAL
(
clicked
())
,
mapper
,
SLOT
(
map
())
);
connect
(
closeButton
,
&
QAbstractButton
::
clicked
,
mapper
,
QOverload
<>::
of
(
&
QSignalMapper
::
map
)
);
createRecentFileWidget
(
grid
);
...
...
@@ -67,7 +67,7 @@ PlayDialog::PlayDialog( QWidget *parent, bool be_welcome_dialog )
QPushButton
*
w
=
new
QPushButton
(
this
);
KGuiItem
::
assign
(
w
,
KStandardGuiItem
::
quit
());
hbox
->
addWidget
(
w
);
connect
(
w
,
SIGNAL
(
clicked
())
,
qApp
,
SLOT
(
closeAllWindows
())
);
connect
(
w
,
&
QAbstractButton
::
clicked
,
qApp
,
&
QApplication
::
closeAllWindows
);
}
hbox
->
addWidget
(
closeButton
);
...
...
@@ -86,7 +86,7 @@ PlayDialog::createRecentFileWidget( QGridLayout *layout )
//delete list view widget if there are no items in it
if
(
lv
->
count
()
)
{
layout
->
addWidget
(
lv
,
1
,
0
,
1
,
-
1
);
connect
(
lv
,
SIGNAL
(
itemActivated
(
QListWidgetItem
*
)),
this
,
SLOT
(
finished
(
QListWidgetItem
*
))
);
connect
(
lv
,
&
QListWidget
::
itemActivated
,
this
,
&
PlayDialog
::
finished
);
}
else
delete
lv
;
...
...
src/app/recentlyPlayedList.cpp
View file @
e9ae6ded
...
...
@@ -26,7 +26,8 @@
RecentlyPlayedList
::
RecentlyPlayedList
(
QWidget
*
parent
)
:
QListWidget
(
parent
)
{
connect
(
this
,
SIGNAL
(
itemDoubleClicked
(
QListWidgetItem
*
)),
this
,
SLOT
(
itemDoubleClicked
(
QListWidgetItem
*
)));
connect
(
this
,
QOverload
<
QListWidgetItem
*>::
of
(
&
QListWidget
::
itemDoubleClicked
),
this
,
QOverload
<
QListWidgetItem
*>::
of
(
&
RecentlyPlayedList
::
itemDoubleClicked
));
setAlternatingRowColors
(
true
);
setSelectionMode
(
QAbstractItemView
::
SingleSelection
);
...
...
src/app/recentlyPlayedList.h
View file @
e9ae6ded
...
...
@@ -28,7 +28,7 @@ public Q_SLOTS:
void
copyUrl
();
void
itemDoubleClicked
(
QListWidgetItem
*
);
Q_SIGNALS:
void
itemDoubleClicked
(
QUrl
);
void
itemDoubleClicked
(
const
QUrl
&
);
};
#endif
src/app/videoWindow.cpp
View file @
e9ae6ded
...
...
@@ -91,25 +91,25 @@ VideoWindow::VideoWindow( QWidget *parent )
Phonon
::
createPath
(
m_media
,
m_vWidget
);
m_audioPath
=
Phonon
::
createPath
(
m_media
,
m_aOutput
);
m_media
->
setTickInterval
(
1000
);
connect
(
m_media
,
SIGNAL
(
tick
(
qint64
)),
this
,
SIGNAL
(
tick
(
qint64
))
);
connect
(
m_media
,
SIGNAL
(
currentSourceChanged
(
Phonon
::
MediaSource
)),
this
,
SIGNAL
(
currentSourceChanged
(
Phonon
::
MediaSource
))
);
connect
(
m_media
,
SIGNAL
(
totalTimeChanged
(
qint64
)),
this
,
SIGNAL
(
totalTimeChanged
(
qint64
))
);
connect
(
m_media
,
SIGNAL
(
seekableChanged
(
bool
))
,
this
,
SIGNAL
(
seekableChanged
(
bool
))
);
connect
(
m_media
,
SIGNAL
(
metaDataChanged
())
,
this
,
SIGNAL
(
metaDataChanged
())
);
connect
(
m_aOutput
,
SIGNAL
(
mutedChanged
(
bool
))
,
this
,
SIGNAL
(
mutedChanged
(
bool
))
);
connect
(
m_aOutput
,
SIGNAL
(
volumeChanged
(
qreal
)),
this
,
SIGNAL
(
volumeChanged
(
qreal
))
);
connect
(
m_media
,
SIGNAL
(
hasVideoChanged
(
bool
))
,
this
,
SIGNAL
(
hasVideoChanged
(
bool
))
);
connect
(
m_media
,
SIGNAL
(
hasVideoChanged
(
bool
))
,
m_vWidget
,
SLOT
(
setVisible
(
bool
))
);
//hide video widget if no video to show
connect
(
m_media
,
SIGNAL
(
hasVideoChanged
(
bool
))
,
m_logo
,
SLOT
(
setHidden
(
bool
))
);
connect
(
m_media
,
SIGNAL
(
finished
())
,
this
,
SIGNAL
(
finished
())
);
connect
(
m_controller
,
SIGNAL
(
availableSubtitlesChanged
())
,
this
,
SLOT
(
updateChannels
())
);
connect
(
m_media
,
&
Phonon
::
MediaObject
::
tick
,
this
,
&
VideoWindow
::
tick
);
connect
(
m_media
,
&
Phonon
::
MediaObject
::
currentSourceChanged
,
this
,
&
VideoWindow
::
currentSourceChanged
);
connect
(
m_media
,
&
Phonon
::
MediaObject
::
totalTimeChanged
,
this
,
&
VideoWindow
::
totalTimeChanged
);
connect
(
m_media
,
&
Phonon
::
MediaObject
::
seekableChanged
,
this
,
&
VideoWindow
::
seekableChanged
);
connect
(
m_media
,
&
Phonon
::
MediaObject
::
metaDataChanged
,
this
,
&
VideoWindow
::
metaDataChanged
);
connect
(
m_aOutput
,
&
Phonon
::
AudioOutput
::
mutedChanged
,
this
,
&
VideoWindow
::
mutedChanged
);
connect
(
m_aOutput
,
&
Phonon
::
AudioOutput
::
volumeChanged
,
this
,
&
VideoWindow
::
volumeChanged
);
connect
(
m_media
,
&
Phonon
::
MediaObject
::
hasVideoChanged
,
this
,
&
VideoWindow
::
hasVideoChanged
);
connect
(
m_media
,
&
Phonon
::
MediaObject
::
hasVideoChanged
,
m_vWidget
,
&
QWidget
::
setVisible
);
//hide video widget if no video to show
connect
(
m_media
,
&
Phonon
::
MediaObject
::
hasVideoChanged
,
m_logo
,
&
QWidget
::
setHidden
);
connect
(
m_media
,
&
Phonon
::
MediaObject
::
finished
,
this
,
&
VideoWindow
::
finished
);
connect
(
m_controller
,
&
Phonon
::
MediaController
::
availableSubtitlesChanged
,
this
,
&
VideoWindow
::
updateChannels
);
{
m_subLanguages
->
setExclusive
(
true
);
QAction
*
turnOff
=
new
QAction
(
i18nc
(
"@option:radio"
,
"&DVD Subtitle Selection"
),
m_subLanguages
);
turnOff
->
setCheckable
(
true
);
turnOff
->
setProperty
(
TheStream
::
CHANNEL_PROPERTY
,
-
1
);
connect
(
turnOff
,
SIGNAL
(
triggered
())
,
this
,
SLOT
(
slotSetSubtitle
())
);
connect
(
turnOff
,
&
QAction
::
triggered
,
this
,
&
VideoWindow
::
slotSetSubtitle
);
QAction
*
separator
=
new
QAction
(
m_subLanguages
);
separator
->
setSeparator
(
true
);
...
...
@@ -119,14 +119,14 @@ VideoWindow::VideoWindow( QWidget *parent )
QAction
*
autoLang
=
new
QAction
(
i18nc
(
"@option:radio audio language"
,
"&Auto"
),
m_audioLanguages
);
autoLang
->
setProperty
(
TheStream
::
CHANNEL_PROPERTY
,
-
1
);
autoLang
->
setCheckable
(
true
);
connect
(
autoLang
,
SIGNAL
(
triggered
())
,
this
,
SLOT
(
slotSetAudio
())
);
connect
(
autoLang
,
&
QAction
::
triggered
,
this
,
&
VideoWindow
::
slotSetAudio
);
QAction
*
separator
=
new
QAction
(
m_audioLanguages
);
separator
->
setSeparator
(
true
);
}