1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-06 06:07:37 +02:00

Merge remote-tracking branch 'origin/master' into accounts

Conflicts:
	src/accounts/xmpp/sip/xmppsip.cpp
This commit is contained in:
Leo Franchi
2012-02-11 12:18:58 -05:00
17 changed files with 3329 additions and 74 deletions

View File

@@ -72,7 +72,7 @@ IF( NOT BUILD_GUI )
MESSAGE( STATUS "Building Tomahawk ${TOMAHAWK_VERSION} in HEADLESS mode ***" )
ELSE()
MESSAGE( STATUS "Building Tomahawk ${TOMAHAWK_VERSION} full GUI version ***" )
LIST(APPEND NEEDED_QT4_COMPONENTS "QtGui" "QtWebkit" )
LIST(APPEND NEEDED_QT4_COMPONENTS "QtGui" "QtWebkit" "QtUiTools" )
ENDIF()
IF( BUILD_GUI AND UNIX AND NOT APPLE )
@@ -80,7 +80,7 @@ IF( BUILD_GUI AND UNIX AND NOT APPLE )
ENDIF()
macro_optional_find_package(Qt4 4.7.0 COMPONENTS ${NEEDED_QT4_COMPONENTS} )
macro_log_feature(QT4_FOUND "Qt" "A cross-platform application and UI framework" "http://qt.nokia.com" TRUE "" "If you see this, although libqt4-devel is installed, check whether \n the qtwebkit-devel package is installed as well")
macro_log_feature(QT4_FOUND "Qt" "A cross-platform application and UI framework" "http://qt.nokia.com" TRUE "" "If you see this, although libqt4-devel is installed, check whether the \n qtwebkit-devel package and whatever contains QtUiTools is installed too")
macro_optional_find_package(Phonon 4.5.0)
macro_log_feature(PHONON_FOUND "Phonon" "The Phonon multimedia library" "http://phonon.kde.org" TRUE "" "")

View File

@@ -56,7 +56,7 @@ ELSE()
include(FindLibraryWithDebug)
include(FindPackageHandleStandardArgs)
find_path(TAGLIB_CFLAGS
find_path(TAGLIB_INCLUDES
NAMES
tag.h
PATH_SUFFIXES taglib

View File

@@ -17,10 +17,6 @@ SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# libs with broken find modules
SET(TAGLIB_FOUND true)
SET(TAGLIB_LIBRARIES ${CMAKE_FIND_ROOT_PATH}/lib/libtag.dll.a)
SET(TAGLIB_INCLUDES ${CMAKE_FIND_ROOT_PATH}/include/taglib)
SET(QT_PLUGINS_DIR ${CMAKE_FIND_ROOT_PATH}/lib/qt4/plugins/)
SET(QT_QTUITOOLS_LIBRARY_RELEASE ${CMAKE_FIND_ROOT_PATH}/lib/libQtUiTools.a)
SET(QT_QTUITOOLS_LIBRARY_DEBUG ${CMAKE_FIND_ROOT_PATH}/lib/libQtUiToolsd.a)

View File

@@ -4,5 +4,6 @@
<file>tomahawk_de.qm</file>
<file>tomahawk_sv.qm</file>
<file>tomahawk_es.qm</file>
<file>tomahawk_pt_BR.qm</file>
</qresource>
</RCC>

3246
lang/tomahawk_pt_BR.ts Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -37,19 +37,19 @@
#include <qjson/parser.h>
#include <qjson/serializer.h>
#include <QtPlugin>
#include <QStringList>
#include <QDateTime>
#include <QTimer>
#include <QtCore/QtPlugin>
#include <QtCore/QStringList>
#include <QtCore/QDateTime>
#include <QtCore/QTimer>
#include <utils/tomahawkutils.h>
#include <utils/logger.h>
#include <accounts/AccountManager.h>
#ifndef ENABLE_HEADLESS
#include <QInputDialog>
#include <QLineEdit>
#include <QMessageBox>
#include <QtGui/QInputDialog>
#include <QtGui/QLineEdit>
#include <QtGui/QMessageBox>
#endif
#include <utils/tomahawkutilsgui.h>
@@ -348,7 +348,7 @@ XmppSipPlugin::errorMessage( Jreen::Client::DisconnectReason reason )
void
XmppSipPlugin::sendMsg(const QString& to, const QString& msg)
JabberPlugin::sendMsg( const QString& to, const QString& msg )
{
qDebug() << Q_FUNC_INFO << to << msg;
@@ -373,11 +373,11 @@ XmppSipPlugin::sendMsg(const QString& to, const QString& msg)
TomahawkXmppMessage *sipMessage;
if(m["visible"].toBool())
{
sipMessage = new TomahawkXmppMessage(m["ip"].toString(),
m["port"].toInt(),
m["uniqname"].toString(),
m["key"].toString()
);
sipMessage = new TomahawkSipMessage( m["ip"].toString(),
m["port"].toInt(),
m["uniqname"].toString(),
m["key"].toString()
);
}
else
{
@@ -387,14 +387,14 @@ XmppSipPlugin::sendMsg(const QString& to, const QString& msg)
qDebug() << "Send sip messsage to " << to;
Jreen::IQ iq( Jreen::IQ::Set, to );
iq.addExtension( sipMessage );
Jreen::IQReply *reply = m_client->send(iq);
reply->setData(SipMessageSent);
connect(reply, SIGNAL(received(Jreen::IQ)), SLOT(onNewIq(Jreen::IQ)));
Jreen::IQReply *reply = m_client->send( iq );
reply->setData( SipMessageSent );
connect( reply, SIGNAL( received( Jreen::IQ ) ), SLOT( onNewIq( Jreen::IQ ) ) );
}
void
XmppSipPlugin::broadcastMsg(const QString& msg)
JabberPlugin::broadcastMsg( const QString& msg )
{
qDebug() << Q_FUNC_INFO;
@@ -409,7 +409,7 @@ XmppSipPlugin::broadcastMsg(const QString& msg)
void
XmppSipPlugin::addContact(const QString& jid, const QString& msg)
JabberPlugin::addContact( const QString& jid, const QString& msg )
{
// Add contact to the Tomahawk group on the roster
@@ -572,7 +572,8 @@ void XmppSipPlugin::removeMenuHelper()
#endif
}
void XmppSipPlugin::onNewMessage(const Jreen::Message& message)
void JabberPlugin::onNewMessage( const Jreen::Message& message )
{
if ( m_state != Account::Connected )
return;
@@ -644,9 +645,9 @@ void XmppSipPlugin::onPresenceReceived( const Jreen::RosterItem::Ptr &item, cons
Jreen::IQ featuresIq( Jreen::IQ::Get, jid );
featuresIq.addExtension( new Jreen::Disco::Info( node ) );
Jreen::IQReply *reply = m_client->send(featuresIq);
reply->setData(RequestDisco);
connect(reply, SIGNAL(received(Jreen::IQ)), SLOT(onNewIq(Jreen::IQ)));
Jreen::IQReply *reply = m_client->send( featuresIq );
reply->setData( RequestDisco );
connect( reply, SIGNAL( received( Jreen::IQ ) ), SLOT( onNewIq( Jreen::IQ ) ) );
}
else if( !caps )
{
@@ -656,7 +657,8 @@ void XmppSipPlugin::onPresenceReceived( const Jreen::RosterItem::Ptr &item, cons
}
}
void XmppSipPlugin::onSubscriptionReceived(const Jreen::RosterItem::Ptr& item, const Jreen::Presence& presence)
void JabberPlugin::onSubscriptionReceived( const Jreen::RosterItem::Ptr& item, const Jreen::Presence& presence )
{
if ( m_state != Account::Connected )
return;
@@ -718,9 +720,9 @@ XmppSipPlugin::onSubscriptionRequestConfirmed( int result )
QList< QMessageBox* > confirmBoxes = m_subscriptionConfirmBoxes.values();
Jreen::JID jid;
foreach( QMessageBox* currentBox, confirmBoxes )
foreach ( QMessageBox* currentBox, confirmBoxes )
{
if( currentBox == sender() )
if ( currentBox == sender() )
{
jid = m_subscriptionConfirmBoxes.key( currentBox );
}
@@ -730,7 +732,7 @@ XmppSipPlugin::onSubscriptionRequestConfirmed( int result )
m_subscriptionConfirmBoxes.remove( jid );
sender()->deleteLater();
QMessageBox::StandardButton allowSubscription = static_cast<QMessageBox::StandardButton>( result );
QMessageBox::StandardButton allowSubscription = static_cast< QMessageBox::StandardButton >( result );
if ( allowSubscription == QMessageBox::Yes )
{
@@ -746,19 +748,20 @@ XmppSipPlugin::onSubscriptionRequestConfirmed( int result )
#endif
}
void XmppSipPlugin::onNewIq(const Jreen::IQ& iq)
void JabberPlugin::onNewIq( const Jreen::IQ& iq )
{
if ( m_state != Account::Connected )
return;
Jreen::IQReply *reply = qobject_cast<Jreen::IQReply*>(sender());
Jreen::IQReply *reply = qobject_cast< Jreen::IQReply* >( sender() );
int context = reply ? reply->data().toInt() : NoContext;
if( context == RequestDisco )
if ( context == RequestDisco )
{
// qDebug() << Q_FUNC_INFO << "Received disco IQ...";
Jreen::Disco::Info *discoInfo = iq.payload<Jreen::Disco::Info>().data();
if(!discoInfo)
Jreen::Disco::Info *discoInfo = iq.payload< Jreen::Disco::Info >().data();
if ( !discoInfo )
return;
iq.accept();
@@ -766,7 +769,7 @@ void XmppSipPlugin::onNewIq(const Jreen::IQ& iq)
Jreen::DataForm::Ptr form = discoInfo->form();
if(discoInfo->features().contains( TOMAHAWK_FEATURE ))
if ( discoInfo->features().contains( TOMAHAWK_FEATURE ) )
{
qDebug() << Q_FUNC_INFO << jid.full() << "Running tomahawk/feature enabled: yes";
@@ -774,17 +777,17 @@ void XmppSipPlugin::onNewIq(const Jreen::IQ& iq)
handlePeerStatus( jid, Jreen::Presence::Available );
}
}
else if(context == RequestVersion)
else if ( context == RequestVersion)
{
Jreen::SoftwareVersion::Ptr softwareVersion = iq.payload<Jreen::SoftwareVersion>();
if( softwareVersion )
if ( softwareVersion )
{
QString versionString = QString("%1 %2 %3").arg( softwareVersion->name(), softwareVersion->os(), softwareVersion->version() );
qDebug() << Q_FUNC_INFO << "Received software version for " << iq.from().full() << ":" << versionString;
emit softwareVersionReceived( iq.from().full(), versionString );
}
}
else if(context == RequestedDisco)
else if ( context == RequestedDisco )
{
qDebug() << "Sent IQ(Set), what should be happening here?";
}
@@ -798,7 +801,7 @@ void XmppSipPlugin::onNewIq(const Jreen::IQ& iq)
}*/
else
{
TomahawkXmppMessage::Ptr sipMessage = iq.payload<TomahawkXmppMessage>();
TomahawkSipMessage::Ptr sipMessage = iq.payload< TomahawkSipMessage >();
if(sipMessage)
{
iq.accept();
@@ -827,9 +830,10 @@ void XmppSipPlugin::onNewIq(const Jreen::IQ& iq)
}
}
bool XmppSipPlugin::presenceMeansOnline(Jreen::Presence::Type p)
bool JabberPlugin::presenceMeansOnline( Jreen::Presence::Type p )
{
switch(p)
switch( p )
{
case Jreen::Presence::Invalid:
case Jreen::Presence::Unavailable:
@@ -841,7 +845,8 @@ bool XmppSipPlugin::presenceMeansOnline(Jreen::Presence::Type p)
}
}
void XmppSipPlugin::handlePeerStatus(const Jreen::JID& jid, Jreen::Presence::Type presenceType)
void JabberPlugin::handlePeerStatus( const Jreen::JID& jid, Jreen::Presence::Type presenceType )
{
QString fulljid = jid.full();
@@ -860,7 +865,7 @@ void XmppSipPlugin::handlePeerStatus(const Jreen::JID& jid, Jreen::Presence::Typ
}
// "coming online" event
if( presenceMeansOnline( presenceType ) &&
if ( presenceMeansOnline( presenceType ) &&
( !m_peers.contains( jid ) ||
!presenceMeansOnline( m_peers.value( jid ) )
)
@@ -872,16 +877,16 @@ void XmppSipPlugin::handlePeerStatus(const Jreen::JID& jid, Jreen::Presence::Typ
emit peerOnline( fulljid );
#ifndef ENABLE_HEADLESS
if(!m_avatarManager->avatar(jid.bare()).isNull())
if ( !m_avatarManager->avatar( jid.bare() ).isNull() )
onNewAvatar( jid.bare() );
#endif
// request software version
Jreen::IQ versionIq( Jreen::IQ::Get, jid );
versionIq.addExtension( new Jreen::SoftwareVersion() );
Jreen::IQReply *reply = m_client->send(versionIq);
reply->setData(RequestVersion);
connect(reply, SIGNAL(received(Jreen::IQ)), SLOT(onNewIq(Jreen::IQ)));
Jreen::IQReply *reply = m_client->send( versionIq );
reply->setData( RequestVersion );
connect( reply, SIGNAL( received( Jreen::IQ ) ), SLOT( onNewIq( Jreen::IQ ) ) );
return;
}
@@ -890,18 +895,19 @@ void XmppSipPlugin::handlePeerStatus(const Jreen::JID& jid, Jreen::Presence::Typ
m_peers[ jid ] = presenceType;
}
void XmppSipPlugin::onNewAvatar(const QString& jid)
void JabberPlugin::onNewAvatar( const QString& jid )
{
#ifndef ENABLE_HEADLESS
// qDebug() << Q_FUNC_INFO << jid;
if ( m_state != Account::Connected )
return;
Q_ASSERT(!m_avatarManager->avatar( jid ).isNull());
Q_ASSERT( !m_avatarManager->avatar( jid ).isNull() );
// find peers for the jid
QList<Jreen::JID> peers = m_peers.keys();
foreach(const Jreen::JID &peer, peers)
QList< Jreen::JID > peers = m_peers.keys();
foreach ( const Jreen::JID &peer, peers )
{
if( peer.bare() == jid )
{
@@ -909,7 +915,7 @@ void XmppSipPlugin::onNewAvatar(const QString& jid)
}
}
if( jid == m_client->jid().bare() )
if ( jid == m_client->jid().bare() )
// own avatar
emit avatarReceived ( m_avatarManager->avatar( jid ) );
else

View File

@@ -43,7 +43,7 @@
#include <jreen/mucroom.h>
#ifndef ENABLE_HEADLESS
#include <QMessageBox>
#include <QtGui/QMessageBox>
#endif
#define TOMAHAWK_FEATURE QLatin1String( "tomahawk:sip:v1" )
@@ -92,7 +92,7 @@ protected:
private slots:
void showXmlConsole();
void onConnect();
void onDisconnect(Jreen::Client::DisconnectReason reason);
void onDisconnect( Jreen::Client::DisconnectReason reason );
void onPresenceReceived( const Jreen::RosterItem::Ptr &item, const Jreen::Presence& presence );
void onSubscriptionReceived( const Jreen::RosterItem::Ptr &item, const Jreen::Presence& presence );

View File

@@ -53,10 +53,13 @@ signals:
public slots:
void resolved( QHostInfo i )
{
emit tomahawkHostFound( ip, port, i.hostName(), nid );
if ( i.hostName().length() )
emit tomahawkHostFound( ip, port, i.hostName(), nid );
else
emit tomahawkHostFound( ip, port, "Unknown", nid );
this->deleteLater();
}
void resolve()
{
QHostInfo::lookupHost( ip, this, SLOT( resolved( QHostInfo ) ) );

View File

@@ -123,16 +123,7 @@ ControlConnection::setup()
return;
}
QString friendlyName;
if ( Servent::isIPWhitelisted( m_sock->peerAddress() ) )
{
// FIXME TODO blocking DNS lookup if LAN, slow/fails on windows?
QHostInfo i = QHostInfo::fromName( m_sock->peerAddress().toString() );
if( i.hostName().length() )
friendlyName = i.hostName();
}
else
friendlyName = name();
QString friendlyName = name();
tDebug() << "Detected name:" << name() << friendlyName << m_sock->peerAddress();

View File

@@ -695,6 +695,8 @@ Servent::claimOffer( ControlConnection* cc, const QString &nodeid, const QString
bool
Servent::checkACL( const Connection* conn, const QString &nodeid, bool showDialog ) const
{
Q_UNUSED( conn );
Q_UNUSED( showDialog );
tDebug( LOGVERBOSE ) << "Checking ACLs";
ACLSystem* aclSystem = ACLSystem::instance();

View File

@@ -26,6 +26,7 @@ PlaylistInterface::PlaylistInterface ()
: QObject()
, m_latchMode( StayOnSong )
{
m_id = uuid();
qRegisterMetaType<Tomahawk::PlaylistInterface::RepeatMode>( "Tomahawk::PlaylistInterface::RepeatMode" );
}

View File

@@ -44,6 +44,8 @@ public:
explicit PlaylistInterface();
virtual ~PlaylistInterface();
const QString id() { return m_id; }
virtual QList< Tomahawk::query_ptr > tracks() = 0;
virtual int unfilteredTrackCount() const = 0;
@@ -98,6 +100,7 @@ protected:
private:
Q_DISABLE_COPY( PlaylistInterface )
QString m_id;
QString m_filter;
};

View File

@@ -250,7 +250,7 @@ ScriptResolver::handleMsg( const QByteArray& msg )
rp->setSize( m.value( "size" ).toUInt() );
rp->setRID( uuid() );
rp->setFriendlySource( m_name );
rp->setYear( m.value( "year ").toUInt() );
rp->setYear( m.value( "year").toUInt() );
rp->setDiscNumber( m.value( "discnumber" ).toUInt() );
rp->setMimetype( m.value( "mimetype" ).toString() );

View File

@@ -159,7 +159,9 @@ Result::toVariant() const
m.insert( "score", score() );
m.insert( "sid", id() );
m.insert( "discnumber", discnumber() );
m.insert( "composer", composer()->name() );
if ( !composer().isNull() )
m.insert( "composer", composer()->name() );
return m;
}

View File

@@ -158,6 +158,9 @@ AlbumInfoWidget::onLoadingFinished()
bool
AlbumInfoWidget::isBeingPlayed() const
{
//tDebug() << Q_FUNC_INFO << "audioengine playlistInterface = " << AudioEngine::instance()->currentTrackPlaylist()->id();
//tDebug() << Q_FUNC_INFO << "albumsView playlistInterface = " << ui->albumsView->playlistInterface()->id();
//tDebug() << Q_FUNC_INFO << "tracksView playlistInterface = " << ui->tracksView->playlistInterface()->id();
if ( ui->albumsView->playlistInterface() == AudioEngine::instance()->currentTrackPlaylist() )
return true;

View File

@@ -323,8 +323,9 @@ SourceTreeView::copyPlaylistLink()
PlaylistItem* item = itemFromIndex< PlaylistItem >( m_contextMenuIndex );
playlist_ptr playlist = item->playlist();
QString suggestedFilename = TomahawkSettings::instance()->playlistDefaultPath() + "/" + playlist->title();
QString filename = QFileDialog::getSaveFileName( TomahawkUtils::tomahawkWindow(), tr( "Save XSPF" ),
TomahawkSettings::instance()->playlistDefaultPath(), tr( "Playlists (*.xspf)" ) );
suggestedFilename, tr( "Playlists (*.xspf)" ) );
if ( !filename.isEmpty() )
{
QFileInfo playlistAbsoluteFilePath = filename;

View File

@@ -730,7 +730,7 @@ void
TomahawkWindow::showAboutTomahawk()
{
QMessageBox::about( this, tr( "About Tomahawk" ),
tr( "<h2><b>Tomahawk %1<br/>(%2)</h2>Copyright 2010, 2011<br/>Christian Muehlhaeuser &lt;muesli@tomahawk-player.org&gt;<br/><br/>"
tr( "<h2><b>Tomahawk %1<br/>(%2)</h2>Copyright 2010 - 2012<br/>Christian Muehlhaeuser &lt;muesli@tomahawk-player.org&gt;<br/><br/>"
"Thanks to: Leo Franchi, Jeff Mitchell, Dominik Schmidt, Jason Herskowitz, Alejandro Wainzinger, Hugo Lindstr&ouml;m, Michael Zanetti, Harald Sitter and Steve Robertson" )
.arg( TomahawkUtils::appFriendlyVersion() )
.arg( qApp->applicationVersion() ) );