mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-10 16:14:40 +02:00
Insert private listening actions into Tomahawk menu and tray icon menu.
Some visual feedback would be nice.
This commit is contained in:
@@ -131,6 +131,7 @@ LatchManager::catchUpRequest()
|
|||||||
void
|
void
|
||||||
LatchManager::unlatchRequest( const source_ptr& source )
|
LatchManager::unlatchRequest( const source_ptr& source )
|
||||||
{
|
{
|
||||||
|
Q_UNUSED( source );
|
||||||
AudioEngine::instance()->stop();
|
AudioEngine::instance()->stop();
|
||||||
AudioEngine::instance()->setPlaylist( 0 );
|
AudioEngine::instance()->setPlaylist( 0 );
|
||||||
|
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "actioncollection.h"
|
#include "actioncollection.h"
|
||||||
|
#include "tomahawksettings.h"
|
||||||
|
|
||||||
ActionCollection* ActionCollection::s_instance = 0;
|
ActionCollection* ActionCollection::s_instance = 0;
|
||||||
ActionCollection* ActionCollection::instance()
|
ActionCollection* ActionCollection::instance()
|
||||||
@@ -38,6 +39,8 @@ ActionCollection::initActions()
|
|||||||
{
|
{
|
||||||
m_actionCollection[ "latchOn" ] = new QAction( tr( "&Listen Along" ), this );
|
m_actionCollection[ "latchOn" ] = new QAction( tr( "&Listen Along" ), this );
|
||||||
m_actionCollection[ "latchOff" ] = new QAction( tr( "&Stop Listening Along" ), this );
|
m_actionCollection[ "latchOff" ] = new QAction( tr( "&Stop Listening Along" ), this );
|
||||||
|
m_actionCollection[ "togglePrivacy" ] = new QAction( tr( QString( TomahawkSettings::instance()->privateListeningMode() == TomahawkSettings::PublicListening ?
|
||||||
|
"&Listen Privately" : "&Listen Publicly" ).toAscii().constData() ), this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#include "dllmacro.h"
|
#include "dllmacro.h"
|
||||||
|
|
||||||
#include <QAction>
|
#include <QtGui/QAction>
|
||||||
|
|
||||||
|
|
||||||
class DLLEXPORT ActionCollection : public QObject
|
class DLLEXPORT ActionCollection : public QObject
|
||||||
|
@@ -24,16 +24,18 @@
|
|||||||
#include "playlistinterface.h"
|
#include "playlistinterface.h"
|
||||||
#include "sourceplaylistinterface.h"
|
#include "sourceplaylistinterface.h"
|
||||||
#include "tomahawksettings.h"
|
#include "tomahawksettings.h"
|
||||||
|
#include "actioncollection.h"
|
||||||
#include "database/database.h"
|
#include "database/database.h"
|
||||||
#include "database/databasecommand_logplayback.h"
|
#include "database/databasecommand_logplayback.h"
|
||||||
#include "network/servent.h"
|
#include "network/servent.h"
|
||||||
#include "utils/qnr_iodevicestream.h"
|
#include "utils/qnr_iodevicestream.h"
|
||||||
|
#include "headlesscheck.h"
|
||||||
|
|
||||||
#include "album.h"
|
#include "album.h"
|
||||||
|
|
||||||
#include "utils/logger.h"
|
#include "utils/logger.h"
|
||||||
|
|
||||||
|
|
||||||
using namespace Tomahawk;
|
using namespace Tomahawk;
|
||||||
|
|
||||||
AudioEngine* AudioEngine::s_instance = 0;
|
AudioEngine* AudioEngine::s_instance = 0;
|
||||||
@@ -75,6 +77,11 @@ AudioEngine::AudioEngine()
|
|||||||
|
|
||||||
connect( m_audioOutput, SIGNAL( volumeChanged( qreal ) ), this, SLOT( onVolumeChanged( qreal ) ) );
|
connect( m_audioOutput, SIGNAL( volumeChanged( qreal ) ), this, SLOT( onVolumeChanged( qreal ) ) );
|
||||||
|
|
||||||
|
#ifndef TOMAHAWK_HEADLESS
|
||||||
|
tDebug() << Q_FUNC_INFO << "Connecting privacy toggle";
|
||||||
|
connect( ActionCollection::instance()->getAction( "togglePrivacy" ), SIGNAL( triggered( bool ) ), this, SLOT( togglePrivateListeningMode() ) );
|
||||||
|
#endif
|
||||||
|
|
||||||
onVolumeChanged( m_audioOutput->volume() );
|
onVolumeChanged( m_audioOutput->volume() );
|
||||||
|
|
||||||
#ifndef Q_WS_X11
|
#ifndef Q_WS_X11
|
||||||
@@ -394,6 +401,25 @@ AudioEngine::infoSystemFinished( QString caller )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
AudioEngine::togglePrivateListeningMode()
|
||||||
|
{
|
||||||
|
tDebug() << Q_FUNC_INFO;
|
||||||
|
if ( TomahawkSettings::instance()->privateListeningMode() == TomahawkSettings::PublicListening )
|
||||||
|
TomahawkSettings::instance()->setPrivateListeningMode( TomahawkSettings::FullyPrivate );
|
||||||
|
else
|
||||||
|
TomahawkSettings::instance()->setPrivateListeningMode( TomahawkSettings::PublicListening );
|
||||||
|
|
||||||
|
#ifndef TOMAHAWK_HEADLESS
|
||||||
|
ActionCollection::instance()->getAction( "togglePrivacy" )->setText(
|
||||||
|
tr( QString( TomahawkSettings::instance()->privateListeningMode() == TomahawkSettings::PublicListening ?
|
||||||
|
"&Listen Privately" : "&Listen Publicly" ).toAscii().constData() )
|
||||||
|
);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
|
AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
|
||||||
{
|
{
|
||||||
|
@@ -103,6 +103,8 @@ public slots:
|
|||||||
void infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output );
|
void infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output );
|
||||||
void infoSystemFinished( QString caller );
|
void infoSystemFinished( QString caller );
|
||||||
|
|
||||||
|
void togglePrivateListeningMode();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void loading( const Tomahawk::result_ptr& track );
|
void loading( const Tomahawk::result_ptr& track );
|
||||||
void started( const Tomahawk::result_ptr& track );
|
void started( const Tomahawk::result_ptr& track );
|
||||||
|
@@ -27,6 +27,7 @@
|
|||||||
#include "tomahawkwindow.h"
|
#include "tomahawkwindow.h"
|
||||||
|
|
||||||
#include "utils/logger.h"
|
#include "utils/logger.h"
|
||||||
|
#include <actioncollection.h>
|
||||||
|
|
||||||
|
|
||||||
TomahawkTrayIcon::TomahawkTrayIcon( QObject* parent )
|
TomahawkTrayIcon::TomahawkTrayIcon( QObject* parent )
|
||||||
@@ -48,6 +49,8 @@ TomahawkTrayIcon::TomahawkTrayIcon( QObject* parent )
|
|||||||
m_contextMenu->addSeparator();
|
m_contextMenu->addSeparator();
|
||||||
m_prevAction = m_contextMenu->addAction( tr( "Previous Track" ) );
|
m_prevAction = m_contextMenu->addAction( tr( "Previous Track" ) );
|
||||||
m_nextAction = m_contextMenu->addAction( tr( "Next Track" ) );
|
m_nextAction = m_contextMenu->addAction( tr( "Next Track" ) );
|
||||||
|
m_contextMenu->addSeparator();
|
||||||
|
m_contextMenu->addAction( ActionCollection::instance()->getAction( "togglePrivacy" ) );
|
||||||
|
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_WS_MAC
|
||||||
// On mac you can close the windows while leaving the app open. We then need a way to show the main window again
|
// On mac you can close the windows while leaving the app open. We then need a way to show the main window again
|
||||||
|
@@ -70,6 +70,7 @@
|
|||||||
#include "utils/logger.h"
|
#include "utils/logger.h"
|
||||||
#include "jobview/JobStatusModel.h"
|
#include "jobview/JobStatusModel.h"
|
||||||
#include "LoadXSPFDialog.h"
|
#include "LoadXSPFDialog.h"
|
||||||
|
#include <actioncollection.h>
|
||||||
|
|
||||||
using namespace Tomahawk;
|
using namespace Tomahawk;
|
||||||
|
|
||||||
@@ -106,6 +107,9 @@ TomahawkWindow::TomahawkWindow( QWidget* parent )
|
|||||||
ui->menu_Help->addAction( "Crash now...", this, SLOT( crashNow() ) );
|
ui->menu_Help->addAction( "Crash now...", this, SLOT( crashNow() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ui->menuApp->insertAction( ui->actionCreatePlaylist, ActionCollection::instance()->getAction( "togglePrivacy" ) );
|
||||||
|
ui->menuApp->insertSeparator( ui->actionCreatePlaylist );
|
||||||
|
|
||||||
// set initial state
|
// set initial state
|
||||||
onSipDisconnected();
|
onSipDisconnected();
|
||||||
vm->setQueue( m_queueView );
|
vm->setQueue( m_queueView );
|
||||||
|
Reference in New Issue
Block a user