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

Add initial actioncollection skeleton

This commit is contained in:
Jeff Mitchell 2011-11-06 13:43:23 -05:00
parent 953a271bee
commit f70f61ac2f
4 changed files with 106 additions and 0 deletions

View File

@ -18,6 +18,7 @@ set( libSources
pipeline.cpp
aclsystem.cpp
actioncollection.cpp
artist.cpp
album.cpp
collection.cpp

View File

@ -0,0 +1,54 @@
/* === 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 "actioncollection.h"
ActionCollection* ActionCollection::s_instance = 0;
ActionCollection* ActionCollection::instance()
{
return s_instance;
}
ActionCollection::ActionCollection()
{
s_instance = this;
initActions();
}
void
ActionCollection::initActions()
{
}
ActionCollection::~ActionCollection()
{
s_instance = 0;
foreach( QString key, m_actionCollection.keys() )
delete m_actionCollection[ key ];
}
QAction*
ActionCollection::getAction( const QString& name )
{
return m_actionCollection.contains( name ) ? m_actionCollection[ name ] : 0;
}

View File

@ -0,0 +1,46 @@
/* === 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/>.
*/
#ifndef TOMAHAWKACTIONCOLLECTION_H
#define TOMAHAWKACTIONCOLLECTION_H
#include "dllmacro.h"
#include <QAction>
class DLLEXPORT ActionCollection
{
public:
static ActionCollection* instance();
ActionCollection();
~ActionCollection();
void initActions();
QAction* getAction( const QString &name );
private:
static ActionCollection* s_instance;
QHash< QString, QAction* > m_actionCollection;
};
#endif

View File

@ -32,6 +32,7 @@
#include <QFileInfo>
#include <QNetworkProxy>
#include "actioncollection.h"
#include "artist.h"
#include "album.h"
#include "collection.h"
@ -160,6 +161,8 @@ TomahawkApp::init()
new TomahawkSettings( this );
TomahawkSettings* s = TomahawkSettings::instance();
new ActionCollection();
tDebug( LOGINFO ) << "Setting NAM.";
#ifdef LIBLASTFM_FOUND
TomahawkUtils::setNam( lastfm::nam() );
@ -317,6 +320,8 @@ TomahawkApp::~TomahawkApp()
delete AtticaManager::instance();
#endif
delete ActionCollection::instance();
tLog() << "Finished shutdown.";
}