mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-21 00:09:47 +01:00
More cleanup, more actioncollectionifying, and fix a few signals
This commit is contained in:
parent
9a3cc63700
commit
9f1ec0ce93
@ -54,6 +54,11 @@ ActionCollection::initActions()
|
||||
m_actionCollection[ "loadPlaylist"] = new QAction( tr( "&Load Playlist" ), this );
|
||||
m_actionCollection[ "renamePlaylist"] = new QAction( tr( "&Rename Playlist" ), this );
|
||||
m_actionCollection[ "copyPlaylist"] = new QAction( tr( "&Copy Playlist Link" ), this );
|
||||
m_actionCollection[ "playPause"] = new QAction( tr( "&Play" ), this );
|
||||
m_actionCollection[ "stop"] = new QAction( tr( "&Stop" ), this );
|
||||
m_actionCollection[ "previousTrack"] = new QAction( tr( "&Previous Track" ), this );
|
||||
m_actionCollection[ "nextTrack"] = new QAction( tr( "&Next Track" ), this );
|
||||
m_actionCollection[ "quit"] = new QAction( tr( "&Quit" ), this );
|
||||
}
|
||||
|
||||
|
||||
|
@ -79,7 +79,12 @@ AudioEngine::AudioEngine()
|
||||
|
||||
#ifndef TOMAHAWK_HEADLESS
|
||||
tDebug() << Q_FUNC_INFO << "Connecting privacy toggle";
|
||||
connect( ActionCollection::instance()->getAction( "togglePrivacy" ), SIGNAL( triggered( bool ) ), this, SLOT( togglePrivateListeningMode() ) );
|
||||
ActionCollection *ac = ActionCollection::instance();
|
||||
connect( ac->getAction( "togglePrivacy" ), SIGNAL( triggered() ), SLOT( togglePrivateListeningMode() ), Qt::UniqueConnection );
|
||||
connect( ac->getAction( "playPause" ), SIGNAL( triggered() ), SLOT( playPause() ), Qt::UniqueConnection );
|
||||
connect( ac->getAction( "stop" ), SIGNAL( triggered() ), SLOT( stop() ), Qt::UniqueConnection );
|
||||
connect( ac->getAction( "previousTrack" ), SIGNAL( triggered() ), SLOT( previous() ), Qt::UniqueConnection );
|
||||
connect( ac->getAction( "nextTrack" ), SIGNAL( triggered() ), SLOT( next() ), Qt::UniqueConnection );
|
||||
#endif
|
||||
|
||||
onVolumeChanged( m_audioOutput->volume() );
|
||||
@ -416,6 +421,7 @@ AudioEngine::togglePrivateListeningMode()
|
||||
privacyToggle->setText( tr( QString( isPublic ? "&Listen Privately" : "&Listen Publicly" ).toAscii().constData() ) );
|
||||
privacyToggle->setIconVisibleInMenu( isPublic );
|
||||
#endif
|
||||
emit privacyModeChanged();
|
||||
}
|
||||
|
||||
|
||||
|
@ -125,6 +125,8 @@ signals:
|
||||
|
||||
void error( AudioErrorCode errorCode );
|
||||
|
||||
void privacyModeChanged();
|
||||
|
||||
private slots:
|
||||
bool loadTrack( const Tomahawk::result_ptr& result );
|
||||
void loadPreviousTrack();
|
||||
|
@ -19,8 +19,8 @@
|
||||
#ifndef CONTEXTMENU_H
|
||||
#define CONTEXTMENU_H
|
||||
|
||||
#include <QSignalMapper>
|
||||
#include <QMenu>
|
||||
#include <QtCore/QSignalMapper>
|
||||
#include <QtGui/QMenu>
|
||||
|
||||
#include "typedefs.h"
|
||||
#include "dllmacro.h"
|
||||
|
@ -25,14 +25,13 @@
|
||||
#include "utils/tomahawkutils.h"
|
||||
#include "widgets/elidedlabel.h"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QStackedLayout>
|
||||
#include <QToolButton>
|
||||
#include <QAction>
|
||||
#include <QEasingCurve>
|
||||
#include <QTimeLine>
|
||||
#include <QPaintEvent>
|
||||
#include <QPainter>
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QStackedLayout>
|
||||
#include <QtGui/QToolButton>
|
||||
#include <QtCore/QEasingCurve>
|
||||
#include <QtCore/QTimeLine>
|
||||
#include <QtGui/QPaintEvent>
|
||||
#include <QtGui/QPainter>
|
||||
|
||||
#include "utils/logger.h"
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#include "typedefs.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QtGui/QWidget>
|
||||
|
||||
class QPaintEvent;
|
||||
class QHBoxLayout;
|
||||
|
@ -18,13 +18,12 @@
|
||||
|
||||
#include "imagebutton.h"
|
||||
|
||||
#include <QPainter>
|
||||
#include <QPaintEvent>
|
||||
#include <QLayout>
|
||||
#include <QAction>
|
||||
#include <QPixmap>
|
||||
#include <QIcon>
|
||||
#include <QString>
|
||||
#include <QtGui/QPainter>
|
||||
#include <QtGui/QPaintEvent>
|
||||
#include <QtGui/QLayout>
|
||||
#include <QtGui/QPixmap>
|
||||
#include <QtGui/QIcon>
|
||||
#include <QtCore/QString>
|
||||
|
||||
#include "utils/logger.h"
|
||||
|
||||
|
@ -19,9 +19,9 @@
|
||||
#ifndef IMAGE_BUTTON_H
|
||||
#define IMAGE_BUTTON_H
|
||||
|
||||
#include <QAbstractButton>
|
||||
#include <QIcon>
|
||||
#include <QMap>
|
||||
#include <QtGui/QAbstractButton>
|
||||
#include <QtGui/QIcon>
|
||||
#include <QtCore/QMap>
|
||||
|
||||
#include "dllmacro.h"
|
||||
|
||||
|
@ -31,9 +31,9 @@
|
||||
#include "source.h"
|
||||
#include "tomahawksettings.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QPainter>
|
||||
#include <QMouseEvent>
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QPainter>
|
||||
#include <QtGui/QMouseEvent>
|
||||
#include <audio/audioengine.h>
|
||||
#include <actioncollection.h>
|
||||
|
||||
|
@ -24,8 +24,8 @@
|
||||
#include "sourcetreeview.h"
|
||||
#include "items/sourcetreeitem.h"
|
||||
|
||||
#include <QStyledItemDelegate>
|
||||
#include <QPropertyAnimation>
|
||||
#include <QtGui/QStyledItemDelegate>
|
||||
#include <QtCore/QPropertyAnimation>
|
||||
|
||||
class AnimationHelper;
|
||||
|
||||
|
@ -115,8 +115,7 @@ SourceTreeView::SourceTreeView( QWidget* parent )
|
||||
connect( this, SIGNAL( unlatchRequest( Tomahawk::source_ptr ) ), m_latchManager, SLOT( unlatchRequest( Tomahawk::source_ptr ) ) );
|
||||
connect( this, SIGNAL( catchUpRequest() ), m_latchManager, SLOT( catchUpRequest() ) );
|
||||
|
||||
QAction *privacyToggle = ActionCollection::instance()->getAction( "togglePrivacy" );
|
||||
connect( privacyToggle, SIGNAL( triggered( bool ) ), SLOT( repaint() ) );
|
||||
connect( AudioEngine::instance(), SIGNAL( privacyModeChanged() ), SLOT( repaint() ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -21,16 +21,15 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <QPluginLoader>
|
||||
#include <QDir>
|
||||
#include <QMetaType>
|
||||
#include <QTime>
|
||||
#include <QNetworkReply>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QNetworkProxy>
|
||||
#include <QtCore/QPluginLoader>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QMetaType>
|
||||
#include <QtCore/QTime>
|
||||
#include <QtNetwork/QNetworkReply>
|
||||
#include <QtCore/QFile>
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <QtNetwork/QNetworkProxy>
|
||||
|
||||
#include "actioncollection.h"
|
||||
#include "artist.h"
|
||||
#include "album.h"
|
||||
#include "collection.h"
|
||||
@ -70,9 +69,9 @@
|
||||
#include "AtticaManager.h"
|
||||
#include "tomahawkwindow.h"
|
||||
#include "settingsdialog.h"
|
||||
#include <QMessageBox>
|
||||
#include "actioncollection.h"
|
||||
#include <QtGui/QMessageBox>
|
||||
#include "widgets/HeaderLabel.h"
|
||||
|
||||
#endif
|
||||
|
||||
// should go to a plugin actually
|
||||
@ -159,8 +158,11 @@ TomahawkApp::init()
|
||||
new TomahawkSettings( this );
|
||||
TomahawkSettings* s = TomahawkSettings::instance();
|
||||
|
||||
#ifndef ENABLE_HEADLESS
|
||||
new ActionCollection( this );
|
||||
|
||||
connect( ActionCollection::instance()->getAction( "quit" ), SIGNAL( triggered() ), SLOT( quit() ), Qt::UniqueConnection );
|
||||
#endif
|
||||
|
||||
tDebug( LOGINFO ) << "Setting NAM.";
|
||||
// Cause the creation of the nam, but don't need to address it directly, so prevent warning
|
||||
Q_UNUSED( TomahawkUtils::nam() );
|
||||
|
@ -24,11 +24,11 @@
|
||||
#include "headlesscheck.h"
|
||||
#include "config.h"
|
||||
|
||||
#include <QRegExp>
|
||||
#include <QFile>
|
||||
#include <QSettings>
|
||||
#include <QDir>
|
||||
#include <QPersistentModelIndex>
|
||||
#include <QtCore/QRegExp>
|
||||
#include <QtCore/QFile>
|
||||
#include <QtCore/QSettings>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QPersistentModelIndex>
|
||||
|
||||
#include "QxtHttpServerConnector"
|
||||
#include "QxtHttpSessionManager"
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
#include "tomahawktrayicon.h"
|
||||
|
||||
#include <QWheelEvent>
|
||||
#include <QtGui/QWheelEvent>
|
||||
|
||||
#include "artist.h"
|
||||
|
||||
@ -43,12 +43,12 @@ TomahawkTrayIcon::TomahawkTrayIcon( QObject* parent )
|
||||
m_contextMenu = new QMenu();
|
||||
setContextMenu( m_contextMenu );
|
||||
|
||||
m_playPauseAction = m_contextMenu->addAction( tr( "Play" ) );
|
||||
//m_pauseAction = m_contextMenu->addAction( tr( "Pause" ) );
|
||||
m_stopAction = m_contextMenu->addAction( tr( "Stop" ) );
|
||||
ActionCollection *ac = ActionCollection::instance();
|
||||
m_contextMenu->addAction( ac->getAction( "playPause" ) );
|
||||
m_contextMenu->addAction( ac->getAction( "stop" ) );
|
||||
m_contextMenu->addSeparator();
|
||||
m_prevAction = m_contextMenu->addAction( tr( "Previous Track" ) );
|
||||
m_nextAction = m_contextMenu->addAction( tr( "Next Track" ) );
|
||||
m_contextMenu->addAction( ac->getAction( "previousTrack" ) );
|
||||
m_contextMenu->addAction( ac->getAction( "nextTrack" ) );
|
||||
m_contextMenu->addSeparator();
|
||||
m_contextMenu->addAction( ActionCollection::instance()->getAction( "togglePrivacy" ) );
|
||||
|
||||
@ -61,7 +61,7 @@ TomahawkTrayIcon::TomahawkTrayIcon( QObject* parent )
|
||||
#endif
|
||||
|
||||
m_contextMenu->addSeparator();
|
||||
m_quitAction = m_contextMenu->addAction( tr( "Quit" ) );
|
||||
m_contextMenu->addAction( ac->getAction( "quit" ) );
|
||||
|
||||
connect( AudioEngine::instance(), SIGNAL( loading( Tomahawk::result_ptr ) ), SLOT( setResult( Tomahawk::result_ptr ) ) );
|
||||
connect( AudioEngine::instance(), SIGNAL( started( Tomahawk::result_ptr ) ), SLOT( enablePause() ) );
|
||||
@ -69,12 +69,6 @@ TomahawkTrayIcon::TomahawkTrayIcon( QObject* parent )
|
||||
connect( AudioEngine::instance(), SIGNAL( stopped() ), this, SLOT( enablePlay() ) );
|
||||
connect( AudioEngine::instance(), SIGNAL( paused() ), this, SLOT( enablePlay() ) );
|
||||
|
||||
connect( m_playPauseAction, SIGNAL( triggered() ), AudioEngine::instance(), SLOT( playPause() ) );
|
||||
connect( m_stopAction, SIGNAL( triggered() ), AudioEngine::instance(), SLOT( stop() ) );
|
||||
connect( m_prevAction, SIGNAL( triggered() ), AudioEngine::instance(), SLOT( previous() ) );
|
||||
connect( m_nextAction, SIGNAL( triggered() ), AudioEngine::instance(), SLOT( next() ) );
|
||||
connect( m_quitAction, SIGNAL( triggered() ), (QObject*)APP, SLOT( quit() ) );
|
||||
|
||||
connect( &m_animationTimer, SIGNAL( timeout() ), SLOT( onAnimationTimer() ) );
|
||||
connect( this, SIGNAL( activated( QSystemTrayIcon::ActivationReason ) ), SLOT( onActivated( QSystemTrayIcon::ActivationReason ) ) );
|
||||
|
||||
@ -203,14 +197,14 @@ TomahawkTrayIcon::onActivated( QSystemTrayIcon::ActivationReason reason )
|
||||
void
|
||||
TomahawkTrayIcon::enablePlay()
|
||||
{
|
||||
m_playPauseAction->setText( tr( "Play" ) );
|
||||
ActionCollection::instance()->getAction( "playPause" )->setText( tr( "Play" ) );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TomahawkTrayIcon::enablePause()
|
||||
{
|
||||
m_playPauseAction->setText( tr( "Pause" ) );
|
||||
ActionCollection::instance()->getAction( "playPause" )->setText( tr( "Pause" ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -19,9 +19,9 @@
|
||||
#ifndef TOMAHAWK_TRAYICON_H
|
||||
#define TOMAHAWK_TRAYICON_H
|
||||
|
||||
#include <QSystemTrayIcon>
|
||||
#include <QTimer>
|
||||
#include <QMenu>
|
||||
#include <QtGui/QSystemTrayIcon>
|
||||
#include <QtCore/QTimer>
|
||||
#include <QtGui/QMenu>
|
||||
|
||||
#include "result.h"
|
||||
|
||||
@ -57,12 +57,6 @@ private:
|
||||
int m_currentAnimationFrame;
|
||||
|
||||
QMenu* m_contextMenu;
|
||||
QAction* m_playPauseAction;
|
||||
//QAction* m_pauseAction;
|
||||
QAction* m_stopAction;
|
||||
QAction* m_prevAction;
|
||||
QAction* m_nextAction;
|
||||
QAction* m_quitAction;
|
||||
|
||||
QAction* m_showWindowAction;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user