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:
parent
953a271bee
commit
f70f61ac2f
@ -18,6 +18,7 @@ set( libSources
|
||||
pipeline.cpp
|
||||
|
||||
aclsystem.cpp
|
||||
actioncollection.cpp
|
||||
artist.cpp
|
||||
album.cpp
|
||||
collection.cpp
|
||||
|
54
src/libtomahawk/actioncollection.cpp
Normal file
54
src/libtomahawk/actioncollection.cpp
Normal 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;
|
||||
}
|
46
src/libtomahawk/actioncollection.h
Normal file
46
src/libtomahawk/actioncollection.h
Normal 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
|
@ -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.";
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user