mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 13:47:26 +02:00
Merge branch 'autoupdate' of github.com:lfranchi/tomahawk into autoupdate
This commit is contained in:
@@ -75,6 +75,7 @@ SET( tomahawkSourcesGui ${tomahawkSourcesGui}
|
|||||||
settingslistdelegate.cpp
|
settingslistdelegate.cpp
|
||||||
resolversmodel.cpp
|
resolversmodel.cpp
|
||||||
tomahawkwindow.cpp
|
tomahawkwindow.cpp
|
||||||
|
LoadXSPFDialog.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
SET( tomahawkHeaders ${tomahawkHeaders}
|
SET( tomahawkHeaders ${tomahawkHeaders}
|
||||||
@@ -124,6 +125,7 @@ SET( tomahawkHeadersGui ${tomahawkHeadersGui}
|
|||||||
resolversmodel.h
|
resolversmodel.h
|
||||||
delegateconfigwrapper.h
|
delegateconfigwrapper.h
|
||||||
tomahawkwindow.h
|
tomahawkwindow.h
|
||||||
|
LoadXSPFDialog.h
|
||||||
)
|
)
|
||||||
|
|
||||||
SET( tomahawkUI ${tomahawkUI}
|
SET( tomahawkUI ${tomahawkUI}
|
||||||
@@ -135,6 +137,7 @@ SET( tomahawkUI ${tomahawkUI}
|
|||||||
audiocontrols.ui
|
audiocontrols.ui
|
||||||
|
|
||||||
GetNewStuffDialog.ui
|
GetNewStuffDialog.ui
|
||||||
|
LoadXSPFDialog.ui
|
||||||
)
|
)
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(
|
INCLUDE_DIRECTORIES(
|
||||||
|
56
src/LoadXSPFDialog.cpp
Normal file
56
src/LoadXSPFDialog.cpp
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
|
*
|
||||||
|
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
|
||||||
|
*
|
||||||
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Tomahawk is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "LoadXSPFDialog.h"
|
||||||
|
|
||||||
|
#include "ui_LoadXSPFDialog.h"
|
||||||
|
#include <QFileDialog>
|
||||||
|
|
||||||
|
LoadXSPFDialog::LoadXSPFDialog( QWidget* parent, Qt::WindowFlags f )
|
||||||
|
: QDialog( parent, f )
|
||||||
|
, m_ui( new Ui_LoadXSPF )
|
||||||
|
{
|
||||||
|
m_ui->setupUi( this );
|
||||||
|
|
||||||
|
connect( m_ui->buttonBox, SIGNAL( accepted() ), SLOT( accept() ) );
|
||||||
|
connect( m_ui->buttonBox, SIGNAL( rejected() ), SLOT( reject() ) );
|
||||||
|
|
||||||
|
connect( m_ui->navigateButton, SIGNAL( clicked( bool ) ), this, SLOT( getLocalFile() ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
LoadXSPFDialog::~LoadXSPFDialog()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
LoadXSPFDialog::getLocalFile()
|
||||||
|
{
|
||||||
|
QString url = QFileDialog::getOpenFileName( this, tr( "Load XSPF File" ), QDir::homePath(), ".xspf" );
|
||||||
|
m_ui->lineEdit->setText( url );
|
||||||
|
}
|
||||||
|
|
||||||
|
QString LoadXSPFDialog::xspfUrl() const
|
||||||
|
{
|
||||||
|
return m_ui->lineEdit->text();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
LoadXSPFDialog::autoUpdate() const
|
||||||
|
{
|
||||||
|
return m_ui->autoUpdate->isChecked();
|
||||||
|
}
|
43
src/LoadXSPFDialog.h
Normal file
43
src/LoadXSPFDialog.h
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
|
*
|
||||||
|
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
|
||||||
|
*
|
||||||
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Tomahawk is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef LOADXSPFDIALOG_H
|
||||||
|
#define LOADXSPFDIALOG_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
class Ui_LoadXSPF;
|
||||||
|
|
||||||
|
class LoadXSPFDialog : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit LoadXSPFDialog( QWidget* parent = 0, Qt::WindowFlags f = 0 );
|
||||||
|
virtual ~LoadXSPFDialog();
|
||||||
|
|
||||||
|
QString xspfUrl() const;
|
||||||
|
bool autoUpdate() const;
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void getLocalFile();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui_LoadXSPF* m_ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // LOADXSPFDIALOG_H
|
102
src/LoadXSPFDialog.ui
Normal file
102
src/LoadXSPFDialog.ui
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>LoadXSPF</class>
|
||||||
|
<widget class="QDialog" name="LoadXSPF">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>332</width>
|
||||||
|
<height>86</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Load XSPF</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Playlist Url</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEdit">
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>Enter URL...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="navigateButton">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="autoUpdate">
|
||||||
|
<property name="text">
|
||||||
|
<string>Automatically update</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>accepted()</signal>
|
||||||
|
<receiver>LoadXSPF</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>248</x>
|
||||||
|
<y>254</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>157</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>rejected()</signal>
|
||||||
|
<receiver>LoadXSPF</receiver>
|
||||||
|
<slot>reject()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>316</x>
|
||||||
|
<y>260</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>286</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
@@ -140,6 +140,7 @@ set( libSources
|
|||||||
playlist/artistview.cpp
|
playlist/artistview.cpp
|
||||||
playlist/customplaylistview.cpp
|
playlist/customplaylistview.cpp
|
||||||
playlist/ViewHeader.cpp
|
playlist/ViewHeader.cpp
|
||||||
|
playlist/PlaylistUpdaterInterface.cpp
|
||||||
playlist/XspfUpdater.cpp
|
playlist/XspfUpdater.cpp
|
||||||
|
|
||||||
playlist/topbar/topbar.cpp
|
playlist/topbar/topbar.cpp
|
||||||
|
@@ -24,6 +24,7 @@
|
|||||||
#include "source.h"
|
#include "source.h"
|
||||||
|
|
||||||
#include "utils/logger.h"
|
#include "utils/logger.h"
|
||||||
|
#include <PlaylistUpdaterInterface.h>
|
||||||
|
|
||||||
using namespace Tomahawk;
|
using namespace Tomahawk;
|
||||||
|
|
||||||
@@ -185,6 +186,8 @@ Collection::setPlaylists( const QList<Tomahawk::playlist_ptr>& plists )
|
|||||||
{
|
{
|
||||||
// qDebug() << "Batch inserting playlist:" << p->guid();
|
// qDebug() << "Batch inserting playlist:" << p->guid();
|
||||||
m_playlists.insert( p->guid(), p );
|
m_playlists.insert( p->guid(), p );
|
||||||
|
if ( !m_source.isNull() && m_source->isLocal() )
|
||||||
|
PlaylistUpdaterInterface::loadForPlaylist( p );
|
||||||
}
|
}
|
||||||
emit playlistsAdded( plists );
|
emit playlistsAdded( plists );
|
||||||
}
|
}
|
||||||
|
@@ -26,6 +26,7 @@
|
|||||||
#include "thirdparty/Qocoa/qsearchfield.h"
|
#include "thirdparty/Qocoa/qsearchfield.h"
|
||||||
#include "utils/tomahawkutils.h"
|
#include "utils/tomahawkutils.h"
|
||||||
#include "utils/logger.h"
|
#include "utils/logger.h"
|
||||||
|
#include <QCheckBox>
|
||||||
|
|
||||||
#define ANIMATION_TIME 400
|
#define ANIMATION_TIME 400
|
||||||
#define IMAGE_HEIGHT 64
|
#define IMAGE_HEIGHT 64
|
||||||
@@ -70,6 +71,14 @@ InfoBar::InfoBar( QWidget* parent )
|
|||||||
ui->longDescriptionLabel->setText( QString() );
|
ui->longDescriptionLabel->setText( QString() );
|
||||||
ui->imageLabel->setText( QString() );
|
ui->imageLabel->setText( QString() );
|
||||||
|
|
||||||
|
m_autoUpdate = new QCheckBox( this );
|
||||||
|
m_autoUpdate->setText( tr( "Automatically update" ) );
|
||||||
|
m_autoUpdate->setLayoutDirection( Qt::RightToLeft );
|
||||||
|
m_autoUpdate->setPalette( whitePal );
|
||||||
|
connect( m_autoUpdate, SIGNAL( stateChanged( int ) ), this, SIGNAL( autoUpdateChanged( int ) ) );
|
||||||
|
|
||||||
|
ui->horizontalLayout->addWidget( m_autoUpdate );
|
||||||
|
|
||||||
m_searchWidget = new QSearchField( this );
|
m_searchWidget = new QSearchField( this );
|
||||||
m_searchWidget->setPlaceholderText( tr( "Filter..." ) );
|
m_searchWidget->setPlaceholderText( tr( "Filter..." ) );
|
||||||
m_searchWidget->setMinimumWidth( 180 );
|
m_searchWidget->setMinimumWidth( 180 );
|
||||||
@@ -87,6 +96,7 @@ InfoBar::InfoBar( QWidget* parent )
|
|||||||
setAutoFillBackground( true );
|
setAutoFillBackground( true );
|
||||||
|
|
||||||
connect( ViewManager::instance(), SIGNAL( filterAvailable( bool ) ), SLOT( setFilterAvailable( bool ) ) );
|
connect( ViewManager::instance(), SIGNAL( filterAvailable( bool ) ), SLOT( setFilterAvailable( bool ) ) );
|
||||||
|
connect( ViewManager::instance(), SIGNAL( autoUpdateAvailable( bool ) ), SLOT( setAutoUpdateAvailable( bool ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -147,6 +157,15 @@ InfoBar::setFilterAvailable( bool b )
|
|||||||
m_searchWidget->setVisible( b );
|
m_searchWidget->setVisible( b );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
InfoBar::setAutoUpdateAvailable( bool b )
|
||||||
|
{
|
||||||
|
if ( b )
|
||||||
|
m_autoUpdate->setChecked( ViewManager::instance()->currentPage()->autoUpdate() );
|
||||||
|
|
||||||
|
m_autoUpdate->setVisible( b );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
InfoBar::onFilterEdited()
|
InfoBar::onFilterEdited()
|
||||||
@@ -154,7 +173,6 @@ InfoBar::onFilterEdited()
|
|||||||
emit filterTextChanged( m_searchWidget->text() );
|
emit filterTextChanged( m_searchWidget->text() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
InfoBar::changeEvent( QEvent* e )
|
InfoBar::changeEvent( QEvent* e )
|
||||||
{
|
{
|
||||||
|
@@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include "dllmacro.h"
|
#include "dllmacro.h"
|
||||||
|
|
||||||
|
class QCheckBox;
|
||||||
class QTimeLine;
|
class QTimeLine;
|
||||||
class QSearchField;
|
class QSearchField;
|
||||||
class ContextWidget;
|
class ContextWidget;
|
||||||
@@ -49,8 +50,10 @@ public slots:
|
|||||||
void setFilter( const QString& filter );
|
void setFilter( const QString& filter );
|
||||||
void setFilterAvailable( bool b );
|
void setFilterAvailable( bool b );
|
||||||
|
|
||||||
|
void setAutoUpdateAvailable( bool b );
|
||||||
signals:
|
signals:
|
||||||
void filterTextChanged( const QString& filter );
|
void filterTextChanged( const QString& filter );
|
||||||
|
void autoUpdateChanged( int state );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void changeEvent( QEvent* e );
|
void changeEvent( QEvent* e );
|
||||||
@@ -62,6 +65,7 @@ private:
|
|||||||
Ui::InfoBar* ui;
|
Ui::InfoBar* ui;
|
||||||
|
|
||||||
QSearchField* m_searchWidget;
|
QSearchField* m_searchWidget;
|
||||||
|
QCheckBox* m_autoUpdate;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INFOBAR_H
|
#endif // INFOBAR_H
|
||||||
|
@@ -116,6 +116,7 @@ Playlist::Playlist( const source_ptr& src,
|
|||||||
, m_lastmodified( lastmod )
|
, m_lastmodified( lastmod )
|
||||||
, m_createdOn( createdOn )
|
, m_createdOn( createdOn )
|
||||||
, m_shared( shared )
|
, m_shared( shared )
|
||||||
|
, m_updater( 0 )
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
@@ -138,6 +139,7 @@ Playlist::Playlist( const source_ptr& author,
|
|||||||
, m_createdOn( 0 ) // will be set by db command
|
, m_createdOn( 0 ) // will be set by db command
|
||||||
, m_shared( shared )
|
, m_shared( shared )
|
||||||
, m_initEntries( entries )
|
, m_initEntries( entries )
|
||||||
|
, m_updater( 0 )
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
@@ -511,9 +513,12 @@ Playlist::addEntries( const QList<query_ptr>& queries, const QString& oldrev )
|
|||||||
|
|
||||||
|
|
||||||
QList<plentry_ptr>
|
QList<plentry_ptr>
|
||||||
Playlist::entriesFromQueries( const QList<Tomahawk::query_ptr>& queries )
|
Playlist::entriesFromQueries( const QList<Tomahawk::query_ptr>& queries, bool clearFirst )
|
||||||
{
|
{
|
||||||
QList<plentry_ptr> el = entries();
|
QList<plentry_ptr> el;
|
||||||
|
if ( !clearFirst )
|
||||||
|
el = entries();
|
||||||
|
|
||||||
foreach( const query_ptr& query, queries )
|
foreach( const query_ptr& query, queries )
|
||||||
{
|
{
|
||||||
plentry_ptr e( new PlaylistEntry() );
|
plentry_ptr e( new PlaylistEntry() );
|
||||||
|
@@ -36,10 +36,11 @@ class DatabaseCommand_LoadAllPlaylists;
|
|||||||
class DatabaseCommand_LoadAllSortedPlaylists;
|
class DatabaseCommand_LoadAllSortedPlaylists;
|
||||||
class DatabaseCommand_SetPlaylistRevision;
|
class DatabaseCommand_SetPlaylistRevision;
|
||||||
class DatabaseCommand_CreatePlaylist;
|
class DatabaseCommand_CreatePlaylist;
|
||||||
|
|
||||||
namespace Tomahawk
|
namespace Tomahawk
|
||||||
{
|
{
|
||||||
|
|
||||||
|
class PlaylistUpdaterInterface;
|
||||||
|
|
||||||
class DLLEXPORT PlaylistEntry : public QObject
|
class DLLEXPORT PlaylistEntry : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -196,7 +197,10 @@ public:
|
|||||||
|
|
||||||
virtual void setFilter( const QString& /*pattern*/ ) {}
|
virtual void setFilter( const QString& /*pattern*/ ) {}
|
||||||
|
|
||||||
QList<plentry_ptr> entriesFromQueries( const QList<Tomahawk::query_ptr>& queries );
|
QList<plentry_ptr> entriesFromQueries( const QList<Tomahawk::query_ptr>& queries, bool clearFirst = false );
|
||||||
|
void setUpdater( PlaylistUpdaterInterface* interface ) { m_updater = interface; }
|
||||||
|
PlaylistUpdaterInterface* updater() const { return m_updater; }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
/// emitted when the playlist revision changes (whenever the playlist changes)
|
/// emitted when the playlist revision changes (whenever the playlist changes)
|
||||||
void revisionLoaded( Tomahawk::PlaylistRevision );
|
void revisionLoaded( Tomahawk::PlaylistRevision );
|
||||||
@@ -293,6 +297,8 @@ private:
|
|||||||
|
|
||||||
QQueue<RevisionQueueItem> m_revisionQueue;
|
QQueue<RevisionQueueItem> m_revisionQueue;
|
||||||
|
|
||||||
|
PlaylistUpdaterInterface* m_updater;
|
||||||
|
|
||||||
bool m_locallyChanged;
|
bool m_locallyChanged;
|
||||||
bool m_deleted;
|
bool m_deleted;
|
||||||
bool m_busy;
|
bool m_busy;
|
||||||
|
104
src/libtomahawk/playlist/PlaylistUpdaterInterface.cpp
Normal file
104
src/libtomahawk/playlist/PlaylistUpdaterInterface.cpp
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
|
*
|
||||||
|
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
|
||||||
|
*
|
||||||
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Tomahawk is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "PlaylistUpdaterInterface.h"
|
||||||
|
#include "tomahawksettings.h"
|
||||||
|
#include "XspfUpdater.h"
|
||||||
|
|
||||||
|
using namespace Tomahawk;
|
||||||
|
|
||||||
|
PlaylistUpdaterInterface*
|
||||||
|
PlaylistUpdaterInterface::loadForPlaylist( const playlist_ptr& pl )
|
||||||
|
{
|
||||||
|
TomahawkSettings* s = TomahawkSettings::instance();
|
||||||
|
const QString key = QString( "playlistupdaters/%1" ).arg( pl->guid() );
|
||||||
|
if ( s->contains( QString( "%1/type" ).arg( key ) ) )
|
||||||
|
{
|
||||||
|
// Ok, we have one we can try to load
|
||||||
|
const QString type = s->value( QString( "%1/type" ).arg( key ) ).toString();
|
||||||
|
PlaylistUpdaterInterface* updater = 0;
|
||||||
|
if ( type == "xspf" )
|
||||||
|
updater = new XspfUpdater( pl );
|
||||||
|
|
||||||
|
// You forgot to register your new updater type with the factory above. 00ps.
|
||||||
|
if ( !updater )
|
||||||
|
{
|
||||||
|
Q_ASSERT( false );
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
updater->setAutoUpdate( s->value( QString( "%1/autoupdate" ).arg( key ) ).toBool() );
|
||||||
|
updater->setInterval( s->value( QString( "%1/interval" ).arg( key ) ).toInt() );
|
||||||
|
updater->loadFromSettings( key );
|
||||||
|
|
||||||
|
return updater;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PlaylistUpdaterInterface::PlaylistUpdaterInterface( const playlist_ptr& pl )
|
||||||
|
: QObject( 0 )
|
||||||
|
, m_timer( new QTimer( this ) )
|
||||||
|
, m_autoUpdate( true )
|
||||||
|
, m_playlist( pl )
|
||||||
|
{
|
||||||
|
Q_ASSERT( !m_playlist.isNull() );
|
||||||
|
|
||||||
|
m_playlist->setUpdater( this );
|
||||||
|
connect( m_timer, SIGNAL( timeout() ), this, SLOT( updateNow() ) );
|
||||||
|
|
||||||
|
QTimer::singleShot( 0, this, SLOT( doSave() ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
PlaylistUpdaterInterface::doSave()
|
||||||
|
{
|
||||||
|
TomahawkSettings* s = TomahawkSettings::instance();
|
||||||
|
const QString key = QString( "playlistupdaters/%1" ).arg( m_playlist->guid() );
|
||||||
|
if ( !s->contains( QString( "%1/type" ).arg( key ) ) )
|
||||||
|
{
|
||||||
|
s->setValue( QString( "%1/type" ).arg( key ), type() );
|
||||||
|
s->setValue( QString( "%1/autoupdate" ).arg( key ), m_autoUpdate );
|
||||||
|
s->setValue( QString( "%1/interval" ).arg( key ), m_timer->interval() );
|
||||||
|
saveToSettings( key );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
PlaylistUpdaterInterface::setAutoUpdate( bool autoUpdate )
|
||||||
|
{
|
||||||
|
m_autoUpdate = autoUpdate;
|
||||||
|
if ( m_autoUpdate )
|
||||||
|
m_timer->start();
|
||||||
|
else
|
||||||
|
m_timer->stop();
|
||||||
|
|
||||||
|
const QString key = QString( "playlistupdaters/%1/autoupdate" ).arg( m_playlist->guid() );
|
||||||
|
TomahawkSettings::instance()->setValue( key, m_autoUpdate );
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
PlaylistUpdaterInterface::setInterval( int intervalMsecs )
|
||||||
|
{
|
||||||
|
const QString key = QString( "playlistupdaters/%1/interval" ).arg( m_playlist->guid() );
|
||||||
|
TomahawkSettings::instance()->setValue( key, intervalMsecs );
|
||||||
|
|
||||||
|
m_timer->setInterval( intervalMsecs );
|
||||||
|
}
|
||||||
|
|
@@ -22,6 +22,7 @@
|
|||||||
#include "dllmacro.h"
|
#include "dllmacro.h"
|
||||||
#include "typedefs.h"
|
#include "typedefs.h"
|
||||||
#include "playlist.h"
|
#include "playlist.h"
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
namespace Tomahawk
|
namespace Tomahawk
|
||||||
{
|
{
|
||||||
@@ -35,21 +36,37 @@ class DLLEXPORT PlaylistUpdaterInterface : public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
PlaylistUpdaterInterface( const playlist_ptr& pl, QObject* parent )
|
PlaylistUpdaterInterface( const playlist_ptr& pl );
|
||||||
: QObject( parent )
|
|
||||||
, m_autoUpdate( true )
|
|
||||||
, m_playlist( pl )
|
|
||||||
{}
|
|
||||||
|
|
||||||
virtual ~PlaylistUpdaterInterface() {}
|
virtual ~PlaylistUpdaterInterface(){}
|
||||||
|
|
||||||
|
// What type you are. If you add a new updater, add the creation code as well.
|
||||||
|
virtual QString type() const = 0;
|
||||||
|
|
||||||
void setAutoUpdate( bool autoUpdate ) { m_autoUpdate = autoUpdate; }
|
|
||||||
bool autoUpdate() const { return m_autoUpdate; }
|
bool autoUpdate() const { return m_autoUpdate; }
|
||||||
|
void setAutoUpdate( bool autoUpdate );
|
||||||
|
|
||||||
|
void setInterval( int intervalMsecs ) ;
|
||||||
|
int intervalMsecs() const { return m_timer->interval(); }
|
||||||
|
|
||||||
playlist_ptr playlist() const { return m_playlist; }
|
playlist_ptr playlist() const { return m_playlist; }
|
||||||
signals:
|
|
||||||
|
/// If you want to try to load a updater from the settings. Returns a valid
|
||||||
|
/// updater if one was saved
|
||||||
|
static PlaylistUpdaterInterface* loadForPlaylist( const playlist_ptr& pl );
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
virtual void updateNow() {}
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void doSave();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void loadFromSettings( const QString& group ) = 0;
|
||||||
|
virtual void saveToSettings( const QString& group ) const = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
QTimer* m_timer;
|
||||||
bool m_autoUpdate;
|
bool m_autoUpdate;
|
||||||
playlist_ptr m_playlist;
|
playlist_ptr m_playlist;
|
||||||
};
|
};
|
||||||
|
@@ -22,26 +22,31 @@
|
|||||||
#include "utils/xspfloader.h"
|
#include "utils/xspfloader.h"
|
||||||
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
#include <tomahawksettings.h>
|
||||||
|
|
||||||
using namespace Tomahawk;
|
using namespace Tomahawk;
|
||||||
|
|
||||||
XspfUpdater::XspfUpdater( const playlist_ptr& pl, const QString& xUrl, QObject *parent )
|
XspfUpdater::XspfUpdater( const playlist_ptr& pl, const QString& xUrl )
|
||||||
: PlaylistUpdaterInterface( pl, parent )
|
: PlaylistUpdaterInterface( pl )
|
||||||
, m_url( xUrl )
|
, m_url( xUrl )
|
||||||
, m_timer( new QTimer( this ) )
|
|
||||||
{
|
{
|
||||||
// for now refresh every 60min
|
|
||||||
m_timer->setInterval( 60 * 60 * 1000);
|
|
||||||
connect( m_timer, SIGNAL( timeout() ), this, SLOT( update() ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
XspfUpdater::XspfUpdater( const playlist_ptr& pl )
|
||||||
|
: PlaylistUpdaterInterface( pl )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
XspfUpdater::~XspfUpdater()
|
XspfUpdater::~XspfUpdater()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void
|
void
|
||||||
XspfUpdater::update()
|
XspfUpdater::updateNow()
|
||||||
{
|
{
|
||||||
XSPFLoader* l = new XSPFLoader( false );
|
XSPFLoader* l = new XSPFLoader( false, false );
|
||||||
|
l->load( m_url );
|
||||||
connect( l, SIGNAL( ok ( Tomahawk::playlist_ptr ) ), this, SLOT( playlistLoaded() ) );
|
connect( l, SIGNAL( ok ( Tomahawk::playlist_ptr ) ), this, SLOT( playlistLoaded() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,7 +57,7 @@ XspfUpdater::playlistLoaded()
|
|||||||
Q_ASSERT( loader );
|
Q_ASSERT( loader );
|
||||||
|
|
||||||
QList< query_ptr > queries = loader->entries();
|
QList< query_ptr > queries = loader->entries();
|
||||||
QList<plentry_ptr> el = playlist()->entriesFromQueries( queries );
|
QList<plentry_ptr> el = playlist()->entriesFromQueries( queries, true );
|
||||||
playlist()->createNewRevision( uuid(), playlist()->currentrevision(), el );
|
playlist()->createNewRevision( uuid(), playlist()->currentrevision(), el );
|
||||||
|
|
||||||
// // if there are any different from the current playlist, clear and use the new one, update
|
// // if there are any different from the current playlist, clear and use the new one, update
|
||||||
@@ -65,3 +70,15 @@ XspfUpdater::playlistLoaded()
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
XspfUpdater::saveToSettings( const QString& group ) const
|
||||||
|
{
|
||||||
|
TomahawkSettings::instance()->setValue( QString( "%1/xspfurl" ).arg( group ), m_url );
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
XspfUpdater::loadFromSettings( const QString& group )
|
||||||
|
{
|
||||||
|
m_url = TomahawkSettings::instance()->value( QString( "%1/xspfurl" ).arg( group ) ).toString();
|
||||||
|
}
|
||||||
|
@@ -30,16 +30,24 @@ class XspfUpdater : public PlaylistUpdaterInterface
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit XspfUpdater( const playlist_ptr& pl, const QString& xspfUrl, QObject *parent = 0 );
|
XspfUpdater( const playlist_ptr& pl, const QString& xspfUrl );
|
||||||
|
explicit XspfUpdater( const playlist_ptr& pl ); // used by factory
|
||||||
|
|
||||||
virtual ~XspfUpdater();
|
virtual ~XspfUpdater();
|
||||||
|
|
||||||
|
virtual QString type() const { return "xspf"; }
|
||||||
|
public slots:
|
||||||
|
void updateNow();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void loadFromSettings( const QString& group );
|
||||||
|
void saveToSettings( const QString& group ) const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void update();
|
|
||||||
void playlistLoaded();
|
void playlistLoaded();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_url;
|
QString m_url;
|
||||||
QTimer* m_timer;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -480,6 +480,8 @@ EchonestGenerator::appendRadioType( Echonest::DynamicPlaylist::PlaylistParams& p
|
|||||||
}
|
}
|
||||||
if( someCatalog )
|
if( someCatalog )
|
||||||
params.append( Echonest::DynamicPlaylist::PlaylistParamData( Echonest::DynamicPlaylist::Type, Echonest::DynamicPlaylist::CatalogRadioType ) );
|
params.append( Echonest::DynamicPlaylist::PlaylistParamData( Echonest::DynamicPlaylist::Type, Echonest::DynamicPlaylist::CatalogRadioType ) );
|
||||||
|
else if( onlyThisArtistType( Echonest::DynamicPlaylist::ArtistType ) )
|
||||||
|
params.append( Echonest::DynamicPlaylist::PlaylistParamData( Echonest::DynamicPlaylist::Type, Echonest::DynamicPlaylist::ArtistType ) );
|
||||||
else if( onlyThisArtistType( Echonest::DynamicPlaylist::ArtistDescriptionType ) )
|
else if( onlyThisArtistType( Echonest::DynamicPlaylist::ArtistDescriptionType ) )
|
||||||
params.append( Echonest::DynamicPlaylist::PlaylistParamData( Echonest::DynamicPlaylist::Type, Echonest::DynamicPlaylist::ArtistDescriptionType ) );
|
params.append( Echonest::DynamicPlaylist::PlaylistParamData( Echonest::DynamicPlaylist::Type, Echonest::DynamicPlaylist::ArtistDescriptionType ) );
|
||||||
else if( onlyThisArtistType( Echonest::DynamicPlaylist::ArtistRadioType ) )
|
else if( onlyThisArtistType( Echonest::DynamicPlaylist::ArtistRadioType ) )
|
||||||
|
@@ -25,6 +25,7 @@
|
|||||||
#include "widgets/overlaywidget.h"
|
#include "widgets/overlaywidget.h"
|
||||||
#include "viewmanager.h"
|
#include "viewmanager.h"
|
||||||
#include "utils/logger.h"
|
#include "utils/logger.h"
|
||||||
|
#include "PlaylistUpdaterInterface.h"
|
||||||
|
|
||||||
using namespace Tomahawk;
|
using namespace Tomahawk;
|
||||||
|
|
||||||
@@ -104,6 +105,34 @@ PlaylistView::deleteItems()
|
|||||||
proxyModel()->removeIndexes( selectedIndexes() );
|
proxyModel()->removeIndexes( selectedIndexes() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
PlaylistView::canAutoUpdate() const
|
||||||
|
{
|
||||||
|
if ( !m_model->playlist().isNull() && m_model->playlist()->updater() )
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
PlaylistView::autoUpdate() const
|
||||||
|
{
|
||||||
|
if ( canAutoUpdate() )
|
||||||
|
return m_model->playlist()->updater()->autoUpdate();
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
PlaylistView::setAutoUpdate( bool autoUpdate )
|
||||||
|
{
|
||||||
|
if ( !canAutoUpdate() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_model->playlist()->updater()->setAutoUpdate( autoUpdate );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
PlaylistView::onTrackCountChanged( unsigned int tracks )
|
PlaylistView::onTrackCountChanged( unsigned int tracks )
|
||||||
|
@@ -42,6 +42,10 @@ public:
|
|||||||
|
|
||||||
virtual bool showFilter() const { return true; }
|
virtual bool showFilter() const { return true; }
|
||||||
|
|
||||||
|
virtual bool canAutoUpdate() const;
|
||||||
|
virtual void setAutoUpdate( bool autoUpdate );
|
||||||
|
virtual bool autoUpdate() const;
|
||||||
|
|
||||||
virtual QString title() const { return playlistModel()->title(); }
|
virtual QString title() const { return playlistModel()->title(); }
|
||||||
virtual QString description() const { return m_model->description(); }
|
virtual QString description() const { return m_model->description(); }
|
||||||
virtual QPixmap pixmap() const { return QPixmap( RESPATH "images/playlist-icon.png" ); }
|
virtual QPixmap pixmap() const { return QPixmap( RESPATH "images/playlist-icon.png" ); }
|
||||||
|
@@ -26,12 +26,14 @@
|
|||||||
|
|
||||||
#include "sourcelist.h"
|
#include "sourcelist.h"
|
||||||
#include "playlist.h"
|
#include "playlist.h"
|
||||||
|
#include <XspfUpdater.h>
|
||||||
|
|
||||||
using namespace Tomahawk;
|
using namespace Tomahawk;
|
||||||
|
|
||||||
XSPFLoader::XSPFLoader( bool autoCreate, QObject *parent )
|
XSPFLoader::XSPFLoader( bool autoCreate, bool autoUpdate, QObject *parent )
|
||||||
: QObject( parent )
|
: QObject( parent )
|
||||||
, m_autoCreate( autoCreate )
|
, m_autoCreate( autoCreate )
|
||||||
|
, m_autoUpdate( autoUpdate )
|
||||||
, m_NS("http://xspf.org/ns/0/")
|
, m_NS("http://xspf.org/ns/0/")
|
||||||
{
|
{
|
||||||
qRegisterMetaType< XSPFErrorCode >("XSPFErrorCode");
|
qRegisterMetaType< XSPFErrorCode >("XSPFErrorCode");
|
||||||
@@ -60,10 +62,11 @@ void
|
|||||||
XSPFLoader::load( const QUrl& url )
|
XSPFLoader::load( const QUrl& url )
|
||||||
{
|
{
|
||||||
QNetworkRequest request( url );
|
QNetworkRequest request( url );
|
||||||
|
m_url = url;
|
||||||
|
|
||||||
Q_ASSERT( TomahawkUtils::nam() != 0 );
|
Q_ASSERT( TomahawkUtils::nam() != 0 );
|
||||||
QNetworkReply* reply = TomahawkUtils::nam()->get( request );
|
QNetworkReply* reply = TomahawkUtils::nam()->get( request );
|
||||||
|
|
||||||
// isn't there a race condition here? something could happen before we connect()
|
|
||||||
connect( reply, SIGNAL( finished() ),
|
connect( reply, SIGNAL( finished() ),
|
||||||
SLOT( networkLoadFinished() ) );
|
SLOT( networkLoadFinished() ) );
|
||||||
|
|
||||||
@@ -219,6 +222,9 @@ XSPFLoader::gotBody()
|
|||||||
false,
|
false,
|
||||||
m_entries );
|
m_entries );
|
||||||
|
|
||||||
|
Tomahawk::XspfUpdater* updater = new Tomahawk::XspfUpdater( m_playlist, m_url.toString() );
|
||||||
|
updater->setInterval( 60000 );
|
||||||
|
updater->setAutoUpdate( m_autoUpdate );
|
||||||
deleteLater();
|
deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -40,7 +40,7 @@ Q_OBJECT
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
enum XSPFErrorCode { ParseError, InvalidTrackError, FetchError };
|
enum XSPFErrorCode { ParseError, InvalidTrackError, FetchError };
|
||||||
explicit XSPFLoader( bool autoCreate = true, QObject* parent = 0 );
|
explicit XSPFLoader( bool autoCreate = true, bool autoUpdate = false, QObject* parent = 0 );
|
||||||
|
|
||||||
virtual ~XSPFLoader();
|
virtual ~XSPFLoader();
|
||||||
QList< Tomahawk::query_ptr > entries() const;
|
QList< Tomahawk::query_ptr > entries() const;
|
||||||
@@ -63,11 +63,12 @@ private:
|
|||||||
void reportError();
|
void reportError();
|
||||||
void gotBody();
|
void gotBody();
|
||||||
|
|
||||||
bool m_autoCreate;
|
bool m_autoCreate, m_autoUpdate;
|
||||||
QString m_NS,m_overrideTitle;
|
QString m_NS,m_overrideTitle;
|
||||||
QList< Tomahawk::query_ptr > m_entries;
|
QList< Tomahawk::query_ptr > m_entries;
|
||||||
QString m_title, m_info, m_creator;
|
QString m_title, m_info, m_creator;
|
||||||
|
|
||||||
|
QUrl m_url;
|
||||||
QByteArray m_body;
|
QByteArray m_body;
|
||||||
Tomahawk::playlist_ptr m_playlist;
|
Tomahawk::playlist_ptr m_playlist;
|
||||||
};
|
};
|
||||||
|
@@ -109,6 +109,7 @@ ViewManager::ViewManager( QObject* parent )
|
|||||||
|
|
||||||
connect( &m_filterTimer, SIGNAL( timeout() ), SLOT( applyFilter() ) );
|
connect( &m_filterTimer, SIGNAL( timeout() ), SLOT( applyFilter() ) );
|
||||||
connect( m_infobar, SIGNAL( filterTextChanged( QString ) ), SLOT( setFilter( QString ) ) );
|
connect( m_infobar, SIGNAL( filterTextChanged( QString ) ), SLOT( setFilter( QString ) ) );
|
||||||
|
connect( m_infobar, SIGNAL( autoUpdateChanged( int ) ), SLOT( autoUpdateChanged( int ) ) );
|
||||||
/* connect( m_infobar, SIGNAL( flatMode() ), SLOT( setTableMode() ) );
|
/* connect( m_infobar, SIGNAL( flatMode() ), SLOT( setTableMode() ) );
|
||||||
connect( m_infobar, SIGNAL( artistMode() ), SLOT( setTreeMode() ) );
|
connect( m_infobar, SIGNAL( artistMode() ), SLOT( setTreeMode() ) );
|
||||||
connect( m_infobar, SIGNAL( albumMode() ), SLOT( setAlbumMode() ) );*/
|
connect( m_infobar, SIGNAL( albumMode() ), SLOT( setAlbumMode() ) );*/
|
||||||
@@ -506,6 +507,13 @@ ViewManager::applyFilter()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
ViewManager::autoUpdateChanged( int state )
|
||||||
|
{
|
||||||
|
currentPage()->setAutoUpdate( state == Qt::Checked );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewManager::setPage( ViewPage* page, bool trackHistory )
|
ViewManager::setPage( ViewPage* page, bool trackHistory )
|
||||||
{
|
{
|
||||||
@@ -656,6 +664,8 @@ ViewManager::updateView()
|
|||||||
emit modesAvailable( currentPage()->showModes() );
|
emit modesAvailable( currentPage()->showModes() );
|
||||||
emit filterAvailable( currentPage()->showFilter() );
|
emit filterAvailable( currentPage()->showFilter() );
|
||||||
|
|
||||||
|
emit autoUpdateAvailable( currentPage()->canAutoUpdate() );
|
||||||
|
|
||||||
/* if ( !currentPage()->showStatsBar() && !currentPage()->showModes() && !currentPage()->showFilter() )
|
/* if ( !currentPage()->showStatsBar() && !currentPage()->showModes() && !currentPage()->showFilter() )
|
||||||
m_topbar->setVisible( false );
|
m_topbar->setVisible( false );
|
||||||
else
|
else
|
||||||
|
@@ -117,6 +117,7 @@ signals:
|
|||||||
void statsAvailable( bool b );
|
void statsAvailable( bool b );
|
||||||
void modesAvailable( bool b );
|
void modesAvailable( bool b );
|
||||||
void filterAvailable( bool b );
|
void filterAvailable( bool b );
|
||||||
|
void autoUpdateAvailable( bool b );
|
||||||
void modeChanged( Tomahawk::PlaylistInterface::ViewMode mode );
|
void modeChanged( Tomahawk::PlaylistInterface::ViewMode mode );
|
||||||
|
|
||||||
void playClicked();
|
void playClicked();
|
||||||
@@ -165,6 +166,8 @@ private slots:
|
|||||||
void setFilter( const QString& filter );
|
void setFilter( const QString& filter );
|
||||||
void applyFilter();
|
void applyFilter();
|
||||||
|
|
||||||
|
void autoUpdateChanged( int );
|
||||||
|
|
||||||
void onWidgetDestroyed( QWidget* widget );
|
void onWidgetDestroyed( QWidget* widget );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -54,6 +54,10 @@ public:
|
|||||||
|
|
||||||
virtual bool isTemporaryPage() const { return false; }
|
virtual bool isTemporaryPage() const { return false; }
|
||||||
|
|
||||||
|
virtual bool canAutoUpdate() const { return false; }
|
||||||
|
virtual void setAutoUpdate( bool ) {}
|
||||||
|
virtual bool autoUpdate() const { return false; }
|
||||||
|
|
||||||
/** subclasses implementing ViewPage can emit the following signals:
|
/** subclasses implementing ViewPage can emit the following signals:
|
||||||
* nameChanged( const QString& )
|
* nameChanged( const QString& )
|
||||||
* descriptionChanged( const QString& )
|
* descriptionChanged( const QString& )
|
||||||
@@ -63,7 +67,6 @@ public:
|
|||||||
*
|
*
|
||||||
* See DynamicWidget for an example
|
* See DynamicWidget for an example
|
||||||
*/
|
*/
|
||||||
private:
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}; // ns
|
}; // ns
|
||||||
|
@@ -68,6 +68,7 @@
|
|||||||
|
|
||||||
#include "utils/logger.h"
|
#include "utils/logger.h"
|
||||||
#include "jobview/JobStatusModel.h"
|
#include "jobview/JobStatusModel.h"
|
||||||
|
#include "LoadXSPFDialog.h"
|
||||||
|
|
||||||
using namespace Tomahawk;
|
using namespace Tomahawk;
|
||||||
|
|
||||||
@@ -488,16 +489,44 @@ TomahawkWindow::showOfflineSources()
|
|||||||
void
|
void
|
||||||
TomahawkWindow::loadSpiff()
|
TomahawkWindow::loadSpiff()
|
||||||
{
|
{
|
||||||
bool ok;
|
LoadXSPFDialog* diag = new LoadXSPFDialog( this, Qt::Sheet );
|
||||||
QString urlstr = QInputDialog::getText( this, tr( "Load XSPF" ), tr( "Path:" ), QLineEdit::Normal, "http://ws.audioscrobbler.com/1.0/tag/metal/toptracks.xspf", &ok );
|
#ifdef Q_WS_MAC
|
||||||
if ( !ok || urlstr.isEmpty() )
|
connect( diag, SIGNAL( finished( int ) ), this, SLOT( loadXspfFinished( int ) ) );
|
||||||
return;
|
diag->show();
|
||||||
|
#else
|
||||||
|
QWeakPointer< LoadXSPFDialog > safe( diag );
|
||||||
|
|
||||||
XSPFLoader* loader = new XSPFLoader;
|
int ret = diag->exec();
|
||||||
|
if ( !safe.isNull() && ret == QDialog::Accepted )
|
||||||
|
{
|
||||||
|
QUrl url = QUrl::fromUserInput( safe.data()->xspfUrl() );
|
||||||
|
bool autoUpdate = safe.data()->autoUpdate();
|
||||||
|
|
||||||
|
XSPFLoader* loader = new XSPFLoader( true, autoUpdate );
|
||||||
connect( loader, SIGNAL( error( XSPFLoader::XSPFErrorCode ) ), SLOT( onXSPFError( XSPFLoader::XSPFErrorCode ) ) );
|
connect( loader, SIGNAL( error( XSPFLoader::XSPFErrorCode ) ), SLOT( onXSPFError( XSPFLoader::XSPFErrorCode ) ) );
|
||||||
loader->load( QUrl::fromUserInput( urlstr ) );
|
loader->load( url );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TomahawkWindow::loadXspfFinished( int ret )
|
||||||
|
{
|
||||||
|
LoadXSPFDialog* d = qobject_cast< LoadXSPFDialog* >( sender() );
|
||||||
|
Q_ASSERT( d );
|
||||||
|
if ( ret == QDialog::Accepted )
|
||||||
|
{
|
||||||
|
QUrl url = QUrl::fromUserInput( d->xspfUrl() );
|
||||||
|
bool autoUpdate = d->autoUpdate();
|
||||||
|
|
||||||
|
XSPFLoader* loader = new XSPFLoader( true, autoUpdate );
|
||||||
|
connect( loader, SIGNAL( error( XSPFLoader::XSPFErrorCode ) ), SLOT( onXSPFError( XSPFLoader::XSPFErrorCode ) ) );
|
||||||
|
loader->load( url );
|
||||||
|
}
|
||||||
|
d->deleteLater();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TomahawkWindow::onXSPFError( XSPFLoader::XSPFErrorCode error )
|
TomahawkWindow::onXSPFError( XSPFLoader::XSPFErrorCode error )
|
||||||
|
@@ -102,6 +102,8 @@ private slots:
|
|||||||
void onSearch( const QString& search );
|
void onSearch( const QString& search );
|
||||||
void onFilterEdited();
|
void onFilterEdited();
|
||||||
|
|
||||||
|
void loadXspfFinished( int );
|
||||||
|
|
||||||
void showQueue();
|
void showQueue();
|
||||||
void hideQueue();
|
void hideQueue();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user