1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-19 15:29:42 +01:00

Removed obsolete PlaylistTypeSelectorDialog and NewPlaylistWidget.

This commit is contained in:
Christian Muehlhaeuser 2014-10-12 12:27:24 +02:00
parent ceeb7ff7c5
commit bd09c7733e
10 changed files with 0 additions and 612 deletions

View File

@ -133,13 +133,11 @@ set( libGuiSources
widgets/HeaderLabel.cpp
widgets/HistoryWidget.cpp
widgets/ImageButton.cpp
widgets/NewPlaylistWidget.cpp
widgets/NewReleasesWidget.cpp
widgets/OverlayButton.cpp
widgets/OverlayWidget.cpp
widgets/PlayableCover.cpp
widgets/PlaylistsModel.cpp
widgets/PlaylistTypeSelectorDialog.cpp
widgets/QueryLabel.cpp
widgets/RecentPlaylistsModel.cpp
widgets/RecentlyPlayedPlaylistsModel.cpp
@ -371,8 +369,6 @@ IF(LIBLASTFM_FOUND)
ENDIF(LIBLASTFM_FOUND)
set( libUI ${libUI}
widgets/PlaylistTypeSelectorDialog.ui
widgets/NewPlaylistWidget.ui
widgets/HeaderWidget.ui
widgets/NewReleasesWidget.ui
viewpages/SearchViewPage.ui

View File

@ -48,7 +48,6 @@
#include "viewpages/ArtistViewPage.h"
#include "viewpages/AlbumViewPage.h"
#include "viewpages/TrackViewPage.h"
#include "widgets/NewPlaylistWidget.h"
#include "widgets/AnimatedSplitter.h"
#include "utils/Logger.h"
@ -527,13 +526,6 @@ ViewManager::setPage( ViewPage* page, bool trackHistory )
}
bool
ViewManager::isNewPlaylistPageVisible() const
{
return dynamic_cast< NewPlaylistWidget* >( currentPage() ) != 0;
}
void
ViewManager::onWidgetDestroyed( QWidget* widget )
{

View File

@ -76,8 +76,6 @@ public:
QueueView* queue() const { return m_queue; }
void setQueue( QueueView* queue ) { m_queue = queue; }
bool isNewPlaylistPageVisible() const;
Tomahawk::playlistinterface_ptr currentPlaylistInterface() const;
Tomahawk::ViewPage* currentPage() const;
Tomahawk::ViewPage* pageForInterface( Tomahawk::playlistinterface_ptr plInterface ) const;

View File

@ -1,151 +0,0 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.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 "NewPlaylistWidget.h"
#include "ui_NewPlaylistWidget.h"
#include <QPushButton>
#include <QDialogButtonBox>
#include "SourceList.h"
#include "ViewManager.h"
#include "playlist/PlaylistModel.h"
#include "widgets/OverlayWidget.h"
#include "utils/XspfLoader.h"
#include "utils/TomahawkUtils.h"
#include "utils/Logger.h"
#define FILTER_TIMEOUT 280
NewPlaylistWidget::NewPlaylistWidget( QWidget* parent )
: QWidget( parent )
, ui( new Ui::NewPlaylistWidget )
{
ui->setupUi( this );
m_saveButton = new QPushButton( tr( "&Create Playlist" ) );
m_saveButton->setDefault( true );
m_saveButton->setEnabled( false );
ui->buttonBox->addButton( m_saveButton, QDialogButtonBox::AcceptRole );
connect( ui->titleEdit, SIGNAL( textChanged( QString ) ), SLOT( onTitleChanged( QString ) ) );
connect( ui->tagEdit, SIGNAL( textChanged( QString ) ), SLOT( onTagChanged() ) );
connect( ui->buttonBox, SIGNAL( accepted() ), SLOT( savePlaylist() ) );
connect( ui->buttonBox, SIGNAL( rejected() ), SLOT( cancel() ) );
m_suggestionsModel = new PlaylistModel( ui->suggestionsView );
ui->suggestionsView->setPlayableModel( m_suggestionsModel );
ui->suggestionsView->overlay()->setEnabled( false );
connect( &m_filterTimer, SIGNAL( timeout() ), SLOT( updateSuggestions() ) );
ui->titleEdit->setFocus();
}
NewPlaylistWidget::~NewPlaylistWidget()
{
delete ui;
}
void
NewPlaylistWidget::changeEvent( QEvent* e )
{
QWidget::changeEvent( e );
switch ( e->type() )
{
case QEvent::LanguageChange:
ui->retranslateUi( this );
break;
default:
break;
}
}
void
NewPlaylistWidget::onTitleChanged( const QString& title )
{
m_saveButton->setEnabled( !title.isEmpty() );
}
void
NewPlaylistWidget::onTagChanged()
{
m_tag = ui->tagEdit->text();
m_filterTimer.stop();
m_filterTimer.setInterval( FILTER_TIMEOUT );
m_filterTimer.setSingleShot( true );
m_filterTimer.start();
}
void
NewPlaylistWidget::updateSuggestions()
{
QUrl url( QString( "http://ws.audioscrobbler.com/1.0/tag/%1/toptracks.xspf" ).arg( m_tag ) );
XSPFLoader* loader = new XSPFLoader( false );
connect( loader, SIGNAL( ok( Tomahawk::playlist_ptr ) ), SLOT( suggestionsFound() ) );
loader->load( url );
}
void
NewPlaylistWidget::suggestionsFound()
{
XSPFLoader* loader = qobject_cast<XSPFLoader*>( sender() );
m_queries = loader->entries();
delete m_suggestionsModel;
m_suggestionsModel = new PlaylistModel( ui->suggestionsView );
ui->suggestionsView->setPlayableModel( m_suggestionsModel );
m_suggestionsModel->appendQueries( m_queries );
loader->deleteLater();
}
void
NewPlaylistWidget::savePlaylist()
{
Tomahawk::playlist_ptr playlist;
playlist = Tomahawk::Playlist::create( SourceList::instance()->getLocal(), uuid(), ui->titleEdit->text(), "", "", false, m_queries );
ViewManager::instance()->show( playlist );
cancel();
}
void
NewPlaylistWidget::cancel()
{
// will be deleted by viewmanager
emit destroyed( this );
}

View File

@ -1,82 +0,0 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.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 NEWPLAYLISTWIDGET_H
#define NEWPLAYLISTWIDGET_H
#include "PlaylistInterface.h"
#include "ViewPage.h"
#include "DllMacro.h"
#include <QWidget>
#include <QTimer>
class QPushButton;
class PlaylistModel;
namespace Ui
{
class NewPlaylistWidget;
}
class DLLEXPORT NewPlaylistWidget : public QWidget, public Tomahawk::ViewPage
{
Q_OBJECT
public:
NewPlaylistWidget( QWidget* parent = 0 );
~NewPlaylistWidget();
virtual QWidget* widget() { return this; }
virtual Tomahawk::playlistinterface_ptr playlistInterface() const { return Tomahawk::playlistinterface_ptr(); }
virtual QString title() const { return tr( "Create a new playlist" ); }
virtual QString description() const { return QString(); }
virtual bool jumpToCurrentTrack() { return false; }
protected:
void changeEvent( QEvent* e );
signals:
void destroyed( QWidget* widget );
private slots:
void onTitleChanged( const QString& title );
void onTagChanged();
void updateSuggestions();
void suggestionsFound();
void savePlaylist();
void cancel();
private:
Ui::NewPlaylistWidget *ui;
PlaylistModel* m_suggestionsModel;
QList< Tomahawk::query_ptr > m_queries;
QTimer m_filterTimer;
QString m_tag;
QPushButton* m_saveButton;
};
#endif // NEWPLAYLISTWIDGET_H

View File

@ -1,85 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>NewPlaylistWidget</class>
<widget class="QWidget" name="NewPlaylistWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>729</width>
<height>460</height>
</rect>
</property>
<property name="focusPolicy">
<enum>Qt::TabFocus</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Enter a title for the new playlist:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="titleEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>26</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Tomahawk offers a variety of ways to help you create playlists and find music you enjoy!</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Just enter a genre or tag name and Tomahawk will suggest a few songs to get you started with your new playlist:</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="tagEdit">
<property name="minimumSize">
<size>
<width>0</width>
<height>26</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="TrackView" name="suggestionsView"/>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel</set>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>TrackView</class>
<extends>QTreeView</extends>
<header>playlist/TrackView.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@ -1,93 +0,0 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2011, Christopher Reichert <creichert07@gmail.com>
*
* 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 "PlaylistTypeSelectorDialog.h"
#include "ui_PlaylistTypeSelectorDialog.h"
#include "widgets/NewPlaylistWidget.h"
#include "ViewManager.h"
#include "ViewPage.h"
#include "SourceList.h"
#include "utils/Logger.h"
PlaylistTypeSelectorDlg::PlaylistTypeSelectorDlg( QWidget* parent, Qt::WindowFlags f )
: QDialog( parent, f )
, ui( new Ui::PlaylistTypeSelectorDlg )
{
ui->setupUi( this );
#ifdef Q_WS_MAC
// ui->
ui->verticalLayout->setContentsMargins( 4, 0, 4, 4 );
setSizeGripEnabled( false );
resize( width(), 180 );
setMinimumSize( size() );
setMaximumSize( size() ); // to remove the resize grip on osx this is the only way
setContentsMargins( 12, 12, 12, 12 );
#else
ui->verticalLayout->setContentsMargins( 9, 0, 9, 9 );
#endif
ui->line->setMaximumHeight( ui->label->sizeHint().height() );
ui->line->setContentsMargins( 0, 0, 0, 0 );
m_isAutoPlaylist = false;
connect( ui->manualPlaylistButton, SIGNAL( clicked() ),
this, SLOT( createNormalPlaylist() ));
connect( ui->autoPlaylistButton, SIGNAL( clicked() ),
this, SLOT( createAutomaticPlaylist() ));
}
PlaylistTypeSelectorDlg::~PlaylistTypeSelectorDlg()
{
delete ui;
}
void
PlaylistTypeSelectorDlg::createNormalPlaylist()
{
m_isAutoPlaylist = false;
done( QDialog::Accepted ); // return code is used to vaidate we did not exit out of the Dialog
}
void
PlaylistTypeSelectorDlg::createAutomaticPlaylist()
{
m_isAutoPlaylist = true;
done( QDialog::Accepted ); // return code is used to vaidate we did not exit out of the Dialog successfully
}
QString
PlaylistTypeSelectorDlg::playlistName() const
{
return ui->playlistNameLine->text();
}
bool
PlaylistTypeSelectorDlg::playlistTypeIsAuto() const
{
return m_isAutoPlaylist;
}

View File

@ -1,53 +0,0 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2011, Christopher Reichert <creichert07@gmail.com>
*
* 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 PLAYLISTTYPESELECTORDLG_H
#define PLAYLISTTYPESELECTORDLG_H
#include <QDialog>
#include "DllMacro.h"
namespace Ui
{
class PlaylistTypeSelectorDlg;
}
class DLLEXPORT PlaylistTypeSelectorDlg : public QDialog
{
Q_OBJECT
public:
PlaylistTypeSelectorDlg( QWidget* parent = 0, Qt::WindowFlags = 0 );
~PlaylistTypeSelectorDlg();
bool playlistTypeIsNormal() const;
bool playlistTypeIsAuto() const;
QString playlistName() const;
private slots:
void createNormalPlaylist();
void createAutomaticPlaylist();
private:
bool m_isAutoPlaylist; // if not an auto playlist then its a normal playlist
Ui::PlaylistTypeSelectorDlg *ui;
};
#endif // PlaylistTypeSelectorDlg_H

View File

@ -1,133 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PlaylistTypeSelectorDlg</class>
<widget class="QDialog" name="PlaylistTypeSelectorDlg">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>420</width>
<height>128</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>420</width>
<height>100</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>10000</width>
<height>10000</height>
</size>
</property>
<property name="windowTitle">
<string>New Playlist</string>
</property>
<property name="modal">
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label">
<property name="minimumSize">
<size>
<width>190</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Just a regular old playlist... Give it a name, drag in some tracks, and go!</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="margin">
<number>2</number>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Don't know exactly what you want? Give Tomahawk a few pointers and let it build a playlist for you!</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="margin">
<number>1</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Name:</string>
</property>
<property name="margin">
<number>1</number>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="playlistNameLine">
<property name="placeholderText">
<string>New Playlist...</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QPushButton" name="manualPlaylistButton">
<property name="text">
<string>Create Manual Playlist</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="autoPlaylistButton">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Create Automatic Playlist</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -30,7 +30,6 @@
#include "TomahawkWindow.h"
#include "utils/TomahawkUtils.h"
#include "playlist/dynamic/GeneratorInterface.h"
#include "widgets/NewPlaylistWidget.h"
#include "utils/ImageRegistry.h"
#include "utils/Logger.h"