[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: extragear/multimedia/amarok/src
From: Dan Meltzer <hydrogen () notyetimplemented ! com>
Date: 2008-05-31 16:09:26
Message-ID: 1212250166.422094.4511.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 814882 by dmeltzer:
code cleanup
M +27 -163 MainWindow.cpp
M +0 -2 MainWindow.h
D context/applets/video/.directory
M +4 -7 context/applets/video/CMakeLists.txt
M +0 -12 playlist/PlaylistModel.cpp
M +2 -2 playlist/TrackNavigator.h
--- trunk/extragear/multimedia/amarok/src/MainWindow.cpp #814881:814882
@@ -18,43 +18,41 @@
#include "MainWindow.h"
-#include <config-amarok.h> //HAVE_LIBVISUAL definition
+#include <config-amarok.h> //HAVE_LIBVISUAL definition
-#include "ActionClasses.h" //see toolbar construction
-#include "amarokconfig.h"
#include "Amarok.h"
-#include "collection/CollectionManager.h"
-#include "collectionbrowser/CollectionWidget.h"
-#include "context/CoverBling.h"
-#include "context/ContextView.h"
-#include "covermanager/CoverManager.h" // for actions
#include "Debug.h"
#include "EngineController.h" //for actions in ctor
-#include "filebrowser/FileBrowser.h"
-#include "k3bexporter.h"
#include "MainToolbar.h"
-#include "mediabrowser.h"
#include "Osd.h"
-#include "playlist/PlaylistModel.h"
-#include "playlist/PlaylistWidget.h"
-#include "playlist/PlaylistGraphicsView.h"
#include "ScriptManager.h"
#include "SearchWidget.h"
-#include "servicebrowser/ServicePluginManager.h"
-#include "servicebrowser/scriptableservice/ScriptableService.h"
-#include "servicebrowser/ServiceBrowser.h"
#include "Sidebar.h"
#include "Sidebar.moc"
#include "Statistics.h"
#include "StatusBar.h"
#include "TheInstances.h"
-#include "playlistmanager/PlaylistManager.h"
-#include "playlistmanager/PlaylistFileProvider.h"
+#include "amarokconfig.h"
+#include "collection/CollectionManager.h"
+#include "collectionbrowser/CollectionWidget.h"
+#include "context/ContextView.h"
+#include "context/CoverBling.h"
+#include "covermanager/CoverManager.h" // for actions
+#include "filebrowser/FileBrowser.h"
+#include "k3bexporter.h"
+#include "mediabrowser.h"
+#include "playlist/PlaylistGraphicsView.h"
+#include "playlist/PlaylistModel.h"
+#include "playlist/PlaylistWidget.h"
#include "playlistbrowser/PlaylistBrowser.h"
+#include "playlistmanager/PlaylistFileProvider.h"
+#include "playlistmanager/PlaylistManager.h"
+#include "queuemanager/QueueManager.h"
+#include "servicebrowser/ServiceBrowser.h"
+#include "servicebrowser/ServicePluginManager.h"
+#include "servicebrowser/scriptableservice/ScriptableService.h"
#include "widgets/Splitter.h"
-#include "queuemanager/QueueManager.h"
-
#include <QDesktopWidget>
#include <QList>
#include <QVBoxLayout>
@@ -133,7 +131,7 @@
///////// public interface
/**
- * This function will initialize the playlist window.
+ * This function will initialize the main window.
*/
void
MainWindow::init()
@@ -164,9 +162,9 @@
PERF_LOG( "Creating ContextWidget" )
m_contextWidget = new ContextWidget( this );
PERF_LOG( "ContextWidget created" )
- m_contextWidget->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Maximum );
+ m_contextWidget->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Maximum );
PERF_LOG( "Creating ContextView" )
- (new Context::ContextView( m_contextWidget ))->setFrameShape( QFrame::NoFrame );
+ (new Context::ContextView( m_contextWidget ))->setFrameShape( QFrame::NoFrame );
PERF_LOG( "ContextView created" )
{
if( AmarokConfig::useCoverBling() && QGLFormat::hasOpenGL() )
@@ -176,9 +174,7 @@
connect( m_browsers, SIGNAL( widgetActivated( int ) ), SLOT( slotShrinkBrowsers( int ) ) );
QVBoxLayout *mainLayout = new QVBoxLayout;
- //mainLayout->setContentsMargins( 1, 1, 1, 1 );
- //mainLayout->setSpacing( 1 );
- mainLayout->setContentsMargins( 0, 0, 0, 0 ); //
+ mainLayout->setContentsMargins( 0, 0, 0, 0 );
mainLayout->setSpacing( 0 );
QWidget *centralWidget = new QWidget( this );
@@ -191,15 +187,14 @@
m_splitter->addWidget( playlistWidget );
//make room for a full width statusbar at the bottom of everything
- KHBox * m_statusbarArea = new KHBox( this );
- //figure out the needed heigh tbased on system font settings
- // do make sure that it is at least 26 pixels tall though
+ KHBox *m_statusbarArea = new KHBox( this );
+ //figure out the needed height based on system font settings
+ //do make sure that it is at least 26 pixels tall though
//or progress bars will not fit...
QFont currentFont = font();
currentFont.setBold( true );
QFontMetrics fm( currentFont );
int fontHeight = qMax( 26, fm.height() );
-
m_statusbarArea->setMinimumHeight( fontHeight );
m_statusbarArea->setMaximumHeight( fontHeight );
new Amarok::StatusBar( m_statusbarArea );
@@ -229,7 +224,7 @@
//cant use macros here since we need access to the browsers directly
PERF_LOG( "Creating ServiceBrowser" )
- ServiceBrowser * internetContentServiceBrowser = ServiceBrowser::instance();
+ ServiceBrowser *internetContentServiceBrowser = ServiceBrowser::instance();
internetContentServiceBrowser->setParent( this );
m_browsers->addWidget( KIcon( "services-amarok" ), i18n("Internet"), \
internetContentServiceBrowser ); m_browserNames.append( "Internet" );
@@ -246,7 +241,6 @@
addBrowserMacro( FileBrowser::Widget, "FileBrowser::Widget", i18n("Files"), "folder-amarok" )
PERF_LOG( "Created FileBrowser" )
-
//get the plugin manager
ServicePluginManager::instance()->setBrowser( internetContentServiceBrowser );
PERF_LOG( "Initialising ServicePluginManager" )
@@ -267,8 +261,6 @@
}
//</Browsers>
- kapp->installEventFilter( this ); // keyboards shortcuts for the browsers
-
Amarok::MessageQueue::instance()->sendMessages();
}
@@ -317,21 +309,6 @@
m_browsers->showWidget( index );
}
-
-/**
- * @param o The object
- * @param e The event
- *
- * Here we filter some events for the Playlist Search LineEdit and the Playlist. @n
- * this makes life easier since we have more useful functions available from this class
- */
-bool
-MainWindow::eventFilter( QObject *o, QEvent *e )
-{
- return QWidget::eventFilter( o, e );
-}
-
-
void
MainWindow::closeEvent( QCloseEvent *e )
{
@@ -343,8 +320,6 @@
//KDE policy states we should hide to tray and not quit() when the
//close window button is pushed for the main widget
- //e->accept(); //if we don't do this the info box appears on quit()!
-
if( AmarokConfig::showTrayIcon() && e->spontaneous() && !kapp->sessionSaving() )
{
KMessageBox::information( this,
@@ -378,7 +353,6 @@
return QApplication::desktop()->screenGeometry( (QWidget*)this ).size() / 1.5;
}
-
void
MainWindow::savePlaylist() const //SLOT
{
@@ -387,7 +361,6 @@
The::playlistModel()->savePlaylist( playlistName );
}
-
void
MainWindow::slotBurnPlaylist() const //SLOT
{
@@ -407,7 +380,6 @@
slotAddLocation( true );
}
-
void
MainWindow::slotAddLocation( bool directPlay ) //SLOT
{
@@ -445,114 +417,6 @@
The::playlistModel()->insertOptioned( track, Playlist::Append|Playlist::DirectPlay );
}
-// TODO: need to add these menu items via last.fm service
-#if 0
-void MainWindow::playLastfmPersonal() //SLOT
-{
- if( !LastFm::Controller::checkCredentials() ) return;
-
- const KUrl url( QString( "lastfm://user/%1/personal" )
- .arg( AmarokConfig::scrobblerUsername() ) );
-
- Meta::TrackPtr track = CollectionManager::instance()->trackForUrl( url );
-
- The::playlistModel()->insertOptioned( track, Playlist::Append|Playlist::DirectPlay );
-}
-
-
-void MainWindow::addLastfmPersonal() //SLOT
-{
- if( !LastFm::Controller::checkCredentials() ) return;
-
- const KUrl url( QString( "lastfm://user/%1/personal" )
- .arg( AmarokConfig::scrobblerUsername() ) );
-
- Meta::TrackPtr track = CollectionManager::instance()->trackForUrl( url );
-
- The::playlistModel()->insertOptioned( track, Playlist::Append );
-}
-
-
-void MainWindow::playLastfmNeighbor() //SLOT
-{
- if( !LastFm::Controller::checkCredentials() ) return;
-
- const KUrl url( QString( "lastfm://user/%1/neighbours" )
- .arg( AmarokConfig::scrobblerUsername() ) );
-
- Meta::TrackPtr track = CollectionManager::instance()->trackForUrl( url );
-
- The::playlistModel()->insertOptioned( track, Playlist::Append );
-}
-
-
-void MainWindow::addLastfmNeighbor() //SLOT
-{
- if( !LastFm::Controller::checkCredentials() ) return;
-
- const KUrl url( QString( "lastfm://user/%1/neighbours" )
- .arg( AmarokConfig::scrobblerUsername() ) );
-
- Meta::TrackPtr track = CollectionManager::instance()->trackForUrl( url );
-
- The::playlistModel()->insertOptioned( track, Playlist::Append );
-}
-
-
-void MainWindow::playLastfmCustom() //SLOT
-{
- const QString token = LastFm::Controller::createCustomStation();
- if( token.isEmpty() ) return;
-
- const KUrl url( "lastfm://artist/" + token + "/similarartists" );
- Meta::TrackPtr track = CollectionManager::instance()->trackForUrl( url );
-
- The::playlistModel()->insertOptioned( track, Playlist::Append|Playlist::DirectPlay );
-}
-
-
-void MainWindow::addLastfmCustom() //SLOT
-{
- const QString token = LastFm::Controller::createCustomStation();
- if( token.isEmpty() ) return;
-
- const KUrl url( "lastfm://artist/" + token + "/similarartists" );
- Meta::TrackPtr track = CollectionManager::instance()->trackForUrl( url );
-
- The::playlistModel()->insertOptioned( track, Playlist::Append );
-}
-
-
-void MainWindow::playLastfmGlobaltag() //SLOT
-{
- if( !LastFm::Controller::checkCredentials() ) return;
-
- KAction *action = dynamic_cast<KAction*>( sender() );
- if( !action ) return;
-
- const QString tag = action->text();
- const KUrl url( "lastfm://globaltags/" + tag );
- Meta::TrackPtr track = CollectionManager::instance()->trackForUrl( url );
-
- The::playlistModel()->insertOptioned( track, Playlist::Append|Playlist::DirectPlay );
-}
-
-
-void MainWindow::addLastfmGlobaltag() //SLOT
-{
- if( !LastFm::Controller::checkCredentials() ) return;
-
- KAction *action = dynamic_cast<KAction*>( sender() );
- if( !action ) return;
-
- const QString tag = action->text();
- const KUrl url( "lastfm://globaltags/" + tag );
- Meta::TrackPtr track = CollectionManager::instance()->trackForUrl( url );
-
- The::playlistModel()->insertOptioned( track, Playlist::Append );
-}
-#endif
-
void
MainWindow::playAudioCD() //SLOT
{
--- trunk/extragear/multimedia/amarok/src/MainWindow.h #814881:814882
@@ -57,8 +57,6 @@
//takes into account minimized, multiple desktops, etc.
bool isReallyShown() const;
- virtual bool eventFilter( QObject*, QEvent* );
-
//instance is declared in KXMLGUI
static MainWindow *self() { return s_instance; }
--- trunk/extragear/multimedia/amarok/src/context/applets/video/CMakeLists.txt #814881:814882
@@ -1,19 +1,16 @@
project(context-video)
-set(video_SRCS
- Video.cpp
- )
+set(video_SRCS Video.cpp )
include_directories( ../../..
- ../..
- ${KDE4_INCLUDE_DIR}/amarok ) # this way we don't need to prefix it with amarok/ (and \
it compiles this way too :) + ../.. )
kde4_add_plugin(amarok_context_applet_video ${video_SRCS})
if(APPLE)
- SET_TARGET_PROPERTIES(amarok_context_applet_video PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
+ SET_TARGET_PROPERTIES(amarok_context_applet_video PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
endif(APPLE)
-target_link_libraries(amarok_context_applet_video amaroklib ${QT_QTWEBKIT_LIBRARY} ${KDE4_KIO_LIBS})
+target_link_libraries(amarok_context_applet_video amaroklib )
install(TARGETS amarok_context_applet_video DESTINATION ${PLUGIN_INSTALL_DIR})
install(FILES amarok-context-applet-video.desktop DESTINATION ${SERVICES_INSTALL_DIR})
--- trunk/extragear/multimedia/amarok/src/playlist/PlaylistModel.cpp #814881:814882
@@ -103,11 +103,6 @@
// essentially announces to the TrackAdvancer that there was a change in the playlist
connect( this, SIGNAL( playlistCountChanged(int) ), SLOT( notifyAdvancersOnItemChange() ) );
- //FIXME: because the restoring in app.cpp:711 causes problems we do it here. This doesn't respect \
the command line flags though.
- /*if ( AmarokConfig::savePlaylist() )
- {
- The::playlistModel()->restoreSession();
- }*/
}
Playlist::Model::~Model()
@@ -134,13 +129,6 @@
Playlist::Model::data( const QModelIndex& index, int role ) const
{
int row = index.row();
- /*if( ( role == Qt::FontRole) && ( row == m_activeRow ) )
- {
- QFont original;
- original.setBold( true );
- return original;
- }
- else*/
if( role == ItemRole && ( row != -1 ) )
return QVariant::fromValue( m_items.at( row ) );
--- trunk/extragear/multimedia/amarok/src/playlist/TrackNavigator.h #814881:814882
@@ -35,7 +35,7 @@
*/
class TrackNavigator
{
- public:
+ public:
TrackNavigator( Model* model ) : m_playlistModel( model ) { m_playlistChanged = true; }
virtual ~TrackNavigator() { }
/** The next track that the engine should play. This is called a few seconds before the \
track actually ends */ @@ -51,7 +51,7 @@
///Convenience function, set the current track in the playlistmodel and play it.
///@param position position in Model of track to start playing
void setCurrentTrack( int position );
-
+
const bool playlistChanged() const { return m_playlistChanged; }
void playlistChangeHandled() { m_playlistChanged = false; }
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic