mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-07-31 11:20:22 +02:00
Clean up from working branch, disable playlist links until ready.
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
Copyright (C) 2011 Leo Franchi <lfranchi@kde.org>
|
Copyright (C) 2011 Leo Franchi <lfranchi@kde.org>
|
||||||
Copyright (C) 2011, Jeff Mitchell <jeff@tomahawk-player.org>
|
Copyright (C) 2011, Jeff Mitchell <jeff@tomahawk-player.org>
|
||||||
Copyright (C) 2011-2012, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
Copyright (C) 2011-2012, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
@@ -170,8 +170,8 @@ GlobalActionManager::getShortLink( const playlist_ptr& pl )
|
|||||||
|
|
||||||
QJson::Serializer s;
|
QJson::Serializer s;
|
||||||
QByteArray msg = s.serialize( jspf );
|
QByteArray msg = s.serialize( jspf );
|
||||||
qDebug() << "POSTING DATA:" << msg;
|
|
||||||
|
|
||||||
|
// No built-in Qt facilities for doing a FORM POST. So we build the payload ourselves...
|
||||||
const QByteArray boundary = "----------------------------2434992cccab";
|
const QByteArray boundary = "----------------------------2434992cccab";
|
||||||
QByteArray data(QByteArray("--" + boundary + "\r\n"));
|
QByteArray data(QByteArray("--" + boundary + "\r\n"));
|
||||||
data += "Content-Disposition: form-data; name=\"data\"; filename=\"playlist.jspf\"\r\n";
|
data += "Content-Disposition: form-data; name=\"data\"; filename=\"playlist.jspf\"\r\n";
|
||||||
@@ -180,9 +180,8 @@ GlobalActionManager::getShortLink( const playlist_ptr& pl )
|
|||||||
data += "\r\n\r\n";
|
data += "\r\n\r\n";
|
||||||
data += "--" + boundary + "--\r\n\r\n";
|
data += "--" + boundary + "--\r\n\r\n";
|
||||||
|
|
||||||
const QUrl url( QString( "%1/playlist/").arg( hostname() ) );
|
const QUrl url( QString( "%1/p/").arg( hostname() ) );
|
||||||
QNetworkRequest req( url );
|
QNetworkRequest req( url );
|
||||||
qDebug() << "POSTING TO:" << url.toString();
|
|
||||||
req.setHeader( QNetworkRequest::ContentTypeHeader, QString( "multipart/form-data; boundary=%1" ).arg( QString::fromLatin1( boundary ) ) );
|
req.setHeader( QNetworkRequest::ContentTypeHeader, QString( "multipart/form-data; boundary=%1" ).arg( QString::fromLatin1( boundary ) ) );
|
||||||
QNetworkReply *reply = TomahawkUtils::nam()->post( req, data );
|
QNetworkReply *reply = TomahawkUtils::nam()->post( req, data );
|
||||||
|
|
||||||
@@ -1073,7 +1072,7 @@ GlobalActionManager::shortenLinkRequestFinished()
|
|||||||
QVariant callbackObj;
|
QVariant callbackObj;
|
||||||
if ( reply->property( "callbackobj" ).isValid() )
|
if ( reply->property( "callbackobj" ).isValid() )
|
||||||
callbackObj = reply->property( "callbackobj" );
|
callbackObj = reply->property( "callbackobj" );
|
||||||
|
|
||||||
// Check for the redirect attribute, as this should be the shortened link
|
// Check for the redirect attribute, as this should be the shortened link
|
||||||
QVariant urlVariant = reply->attribute( QNetworkRequest::RedirectionTargetAttribute );
|
QVariant urlVariant = reply->attribute( QNetworkRequest::RedirectionTargetAttribute );
|
||||||
|
|
||||||
@@ -1233,7 +1232,7 @@ GlobalActionManager::waitingForResolved( bool /* success */ )
|
|||||||
QString
|
QString
|
||||||
GlobalActionManager::hostname() const
|
GlobalActionManager::hostname() const
|
||||||
{
|
{
|
||||||
return QString( "http://stage.toma.hk" );
|
return QString( "http://toma.hk" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -226,8 +226,8 @@ SourceTreeView::setupMenus()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// if ( type == SourcesModel::StaticPlaylist )
|
if ( type == SourcesModel::StaticPlaylist )
|
||||||
// copyPlaylistAction->setText( tr( "&Export Playlist" ) );
|
copyPlaylistAction->setText( tr( "&Export Playlist" ) );
|
||||||
|
|
||||||
connect( loadPlaylistAction, SIGNAL( triggered() ), SLOT( loadPlaylist() ) );
|
connect( loadPlaylistAction, SIGNAL( triggered() ), SLOT( loadPlaylist() ) );
|
||||||
connect( renamePlaylistAction, SIGNAL( triggered() ), SLOT( renamePlaylist() ) );
|
connect( renamePlaylistAction, SIGNAL( triggered() ), SLOT( renamePlaylist() ) );
|
||||||
@@ -358,20 +358,21 @@ SourceTreeView::copyPlaylistLink()
|
|||||||
else if ( type == SourcesModel::StaticPlaylist )
|
else if ( type == SourcesModel::StaticPlaylist )
|
||||||
{
|
{
|
||||||
|
|
||||||
PlaylistItem* item = itemFromIndex< PlaylistItem >( m_contextMenuIndex );
|
// Disable toma.hk playlist mode until ready
|
||||||
playlist_ptr playlist = item->playlist();
|
// GlobalActionManager::instance()->getShortLink( playlist );
|
||||||
|
|
||||||
GlobalActionManager::instance()->getShortLink( playlist );
|
PlaylistItem* item = itemFromIndex< PlaylistItem >( m_contextMenuIndex );
|
||||||
|
playlist_ptr playlist = item->playlist();
|
||||||
|
|
||||||
// QString suggestedFilename = TomahawkSettings::instance()->playlistDefaultPath() + "/" + playlist->title();
|
QString suggestedFilename = TomahawkSettings::instance()->playlistDefaultPath() + "/" + playlist->title();
|
||||||
// QString filename = QFileDialog::getSaveFileName( TomahawkUtils::tomahawkWindow(), tr( "Save XSPF" ),
|
QString filename = QFileDialog::getSaveFileName( TomahawkUtils::tomahawkWindow(), tr( "Save XSPF" ),
|
||||||
// suggestedFilename, tr( "Playlists (*.xspf)" ) );
|
suggestedFilename, tr( "Playlists (*.xspf)" ) );
|
||||||
// if ( !filename.isEmpty() )
|
if ( !filename.isEmpty() )
|
||||||
// {
|
{
|
||||||
// QFileInfo playlistAbsoluteFilePath = filename;
|
QFileInfo playlistAbsoluteFilePath = filename;
|
||||||
// TomahawkSettings::instance()->setPlaylistDefaultPath( playlistAbsoluteFilePath.absolutePath() );
|
TomahawkSettings::instance()->setPlaylistDefaultPath( playlistAbsoluteFilePath.absolutePath() );
|
||||||
// GlobalActionManager::instance()->savePlaylistToFile( playlist, filename );
|
GlobalActionManager::instance()->savePlaylistToFile( playlist, filename );
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user