From bd09c7733ee49092043412a2780fb0c28fe40ef2 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Sun, 12 Oct 2014 12:27:24 +0200 Subject: [PATCH] Removed obsolete PlaylistTypeSelectorDialog and NewPlaylistWidget. --- src/libtomahawk/CMakeLists.txt | 4 - src/libtomahawk/ViewManager.cpp | 8 - src/libtomahawk/ViewManager.h | 2 - src/libtomahawk/widgets/NewPlaylistWidget.cpp | 151 ------------------ src/libtomahawk/widgets/NewPlaylistWidget.h | 82 ---------- src/libtomahawk/widgets/NewPlaylistWidget.ui | 85 ---------- .../widgets/PlaylistTypeSelectorDialog.cpp | 93 ----------- .../widgets/PlaylistTypeSelectorDialog.h | 53 ------ .../widgets/PlaylistTypeSelectorDialog.ui | 133 --------------- .../sourcetree/items/CategoryItems.cpp | 1 - 10 files changed, 612 deletions(-) delete mode 100644 src/libtomahawk/widgets/NewPlaylistWidget.cpp delete mode 100644 src/libtomahawk/widgets/NewPlaylistWidget.h delete mode 100644 src/libtomahawk/widgets/NewPlaylistWidget.ui delete mode 100644 src/libtomahawk/widgets/PlaylistTypeSelectorDialog.cpp delete mode 100644 src/libtomahawk/widgets/PlaylistTypeSelectorDialog.h delete mode 100644 src/libtomahawk/widgets/PlaylistTypeSelectorDialog.ui diff --git a/src/libtomahawk/CMakeLists.txt b/src/libtomahawk/CMakeLists.txt index 711381a61..b0319158f 100644 --- a/src/libtomahawk/CMakeLists.txt +++ b/src/libtomahawk/CMakeLists.txt @@ -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 diff --git a/src/libtomahawk/ViewManager.cpp b/src/libtomahawk/ViewManager.cpp index 4fe3d5b20..15ce28787 100644 --- a/src/libtomahawk/ViewManager.cpp +++ b/src/libtomahawk/ViewManager.cpp @@ -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 ) { diff --git a/src/libtomahawk/ViewManager.h b/src/libtomahawk/ViewManager.h index a48428b10..25447b284 100644 --- a/src/libtomahawk/ViewManager.h +++ b/src/libtomahawk/ViewManager.h @@ -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; diff --git a/src/libtomahawk/widgets/NewPlaylistWidget.cpp b/src/libtomahawk/widgets/NewPlaylistWidget.cpp deleted file mode 100644 index 255f587f6..000000000 --- a/src/libtomahawk/widgets/NewPlaylistWidget.cpp +++ /dev/null @@ -1,151 +0,0 @@ -/* === This file is part of Tomahawk Player - === - * - * Copyright 2010-2011, Christian Muehlhaeuser - * - * 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 . - */ - -#include "NewPlaylistWidget.h" -#include "ui_NewPlaylistWidget.h" - -#include -#include - -#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( 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 ); -} diff --git a/src/libtomahawk/widgets/NewPlaylistWidget.h b/src/libtomahawk/widgets/NewPlaylistWidget.h deleted file mode 100644 index 03520d411..000000000 --- a/src/libtomahawk/widgets/NewPlaylistWidget.h +++ /dev/null @@ -1,82 +0,0 @@ -/* === This file is part of Tomahawk Player - === - * - * Copyright 2010-2011, Christian Muehlhaeuser - * Copyright 2010-2011, Jeff Mitchell - * - * 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 . - */ - -#ifndef NEWPLAYLISTWIDGET_H -#define NEWPLAYLISTWIDGET_H - -#include "PlaylistInterface.h" -#include "ViewPage.h" - -#include "DllMacro.h" - -#include -#include - -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 diff --git a/src/libtomahawk/widgets/NewPlaylistWidget.ui b/src/libtomahawk/widgets/NewPlaylistWidget.ui deleted file mode 100644 index b440d4006..000000000 --- a/src/libtomahawk/widgets/NewPlaylistWidget.ui +++ /dev/null @@ -1,85 +0,0 @@ - - - NewPlaylistWidget - - - - 0 - 0 - 729 - 460 - - - - Qt::TabFocus - - - - - - Enter a title for the new playlist: - - - - - - - - 0 - 26 - - - - - - - - Tomahawk offers a variety of ways to help you create playlists and find music you enjoy! - - - true - - - - - - - Just enter a genre or tag name and Tomahawk will suggest a few songs to get you started with your new playlist: - - - true - - - - - - - - 0 - 26 - - - - - - - - - - - QDialogButtonBox::Cancel - - - - - - - - TrackView - QTreeView -
playlist/TrackView.h
-
-
- - -
diff --git a/src/libtomahawk/widgets/PlaylistTypeSelectorDialog.cpp b/src/libtomahawk/widgets/PlaylistTypeSelectorDialog.cpp deleted file mode 100644 index 96570b244..000000000 --- a/src/libtomahawk/widgets/PlaylistTypeSelectorDialog.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* === This file is part of Tomahawk Player - === - * - * Copyright 2011, Christopher Reichert - * - * 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 . - */ - -#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; -} diff --git a/src/libtomahawk/widgets/PlaylistTypeSelectorDialog.h b/src/libtomahawk/widgets/PlaylistTypeSelectorDialog.h deleted file mode 100644 index 1f78ecc42..000000000 --- a/src/libtomahawk/widgets/PlaylistTypeSelectorDialog.h +++ /dev/null @@ -1,53 +0,0 @@ -/* === This file is part of Tomahawk Player - === - * - * Copyright 2011, Christopher Reichert - * - * 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 . - */ - -#ifndef PLAYLISTTYPESELECTORDLG_H -#define PLAYLISTTYPESELECTORDLG_H - -#include - -#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 diff --git a/src/libtomahawk/widgets/PlaylistTypeSelectorDialog.ui b/src/libtomahawk/widgets/PlaylistTypeSelectorDialog.ui deleted file mode 100644 index fb60ff6cc..000000000 --- a/src/libtomahawk/widgets/PlaylistTypeSelectorDialog.ui +++ /dev/null @@ -1,133 +0,0 @@ - - - PlaylistTypeSelectorDlg - - - - 0 - 0 - 420 - 128 - - - - - 0 - 0 - - - - - 420 - 100 - - - - - 10000 - 10000 - - - - New Playlist - - - false - - - - - - - - - 190 - 0 - - - - Just a regular old playlist... Give it a name, drag in some tracks, and go! - - - true - - - 2 - - - - - - - Qt::Vertical - - - - - - - - 0 - 0 - - - - Don't know exactly what you want? Give Tomahawk a few pointers and let it build a playlist for you! - - - true - - - 1 - - - - - - - - - - - Name: - - - 1 - - - - - - - New Playlist... - - - - - - - - - - - Create Manual Playlist - - - - - - - true - - - Create Automatic Playlist - - - - - - - - - - diff --git a/src/tomahawk/sourcetree/items/CategoryItems.cpp b/src/tomahawk/sourcetree/items/CategoryItems.cpp index e273f17c1..425591f03 100644 --- a/src/tomahawk/sourcetree/items/CategoryItems.cpp +++ b/src/tomahawk/sourcetree/items/CategoryItems.cpp @@ -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"