File indexing completed on 2024-04-28 04:48:36
0001 /* 0002 SPDX-FileCopyrightText: 2005 Max Howell <max.howell@methylblue.com> 0003 SPDX-FileCopyrightText: 2007 Ian Monroe <ian@monroe.nu> 0004 0005 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0006 */ 0007 0008 #include "actions.h" 0009 #include "theStream.h" 0010 0011 #include <QDebug> 0012 #include <QIcon> 0013 0014 #include <KGuiItem> 0015 #include <KLocalizedString> 0016 0017 #include "videoWindow.h" 0018 0019 Dragon::PlayAction::PlayAction(KActionCollection *ac) 0020 : KDualAction(ac) 0021 { 0022 setObjectName(QLatin1String("play")); 0023 0024 setInactiveGuiItem(KGuiItem(i18nc("@action", "Play"), QStringLiteral("media-playback-start"))); 0025 setActiveGuiItem(KGuiItem(i18nc("@action", "Pause"), QStringLiteral("media-playback-pause"))); 0026 setAutoToggle(false); 0027 ac->setDefaultShortcuts(this, QList<QKeySequence>() << Qt::Key_Space << Qt::Key_MediaPlay); 0028 ac->addAction(objectName(), this); 0029 } 0030 0031 void Dragon::PlayAction::setPlaying(bool playing) 0032 { 0033 setActive(playing); 0034 } 0035 0036 ///////////////////////////////////////////////////// 0037 /// Codeine::VolumeAction 0038 //////////////////////////////////////////////////// 0039 Dragon::VolumeAction::VolumeAction(KActionCollection *ac) 0040 : KToggleAction(i18nc("@option:check Volume of sound output", "Volume"), ac) 0041 { 0042 setObjectName(QLatin1String("volume")); 0043 setIcon(QIcon::fromTheme(QLatin1String("player-volume"))); 0044 ac->setDefaultShortcut(this, Qt::Key_V); 0045 ac->addAction(objectName(), this); 0046 connect(engine(), &Dragon::VideoWindow::mutedChanged, this, &Dragon::VolumeAction::mutedChanged); 0047 } 0048 0049 void Dragon::VolumeAction::mutedChanged(bool mute) 0050 { 0051 if (mute) 0052 setIcon(QIcon::fromTheme(QLatin1String("player-volume-muted"))); 0053 else 0054 setIcon(QIcon::fromTheme(QLatin1String("player-volume"))); 0055 } 0056 0057 #include "moc_actions.cpp"