mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-04-21 16:31:58 +02:00
Add ViewPageLazyLoader template
This commit is contained in:
parent
d18e34771b
commit
be2af20ed0
src/libtomahawk
@ -18,6 +18,7 @@ set( libGuiSources
|
||||
DropJob.cpp
|
||||
GlobalActionManager.cpp
|
||||
ViewPage.cpp
|
||||
ViewPageLazyLoader.cpp
|
||||
ViewPagePlugin.cpp
|
||||
ViewManager.cpp
|
||||
LatchManager.cpp
|
||||
|
19
src/libtomahawk/ViewPageLazyLoader.cpp
Normal file
19
src/libtomahawk/ViewPageLazyLoader.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2013, Dominik Schmidt <domme@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 "ViewPageLazyLoader.h"
|
58
src/libtomahawk/ViewPageLazyLoader.h
Normal file
58
src/libtomahawk/ViewPageLazyLoader.h
Normal file
@ -0,0 +1,58 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2013, Dominik Schmidt <domme@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 VIEWPAGELAZYLOADER_H
|
||||
#define VIEWPAGELAZYLOADER_H
|
||||
|
||||
#include "ViewPagePlugin.h"
|
||||
|
||||
#include "DllMacro.h"
|
||||
|
||||
namespace Tomahawk
|
||||
{
|
||||
|
||||
template <class T>
|
||||
class ViewPageLazyLoader : public ViewPagePlugin
|
||||
{
|
||||
public:
|
||||
ViewPageLazyLoader<T>()
|
||||
: m_widget( 0 )
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~ViewPageLazyLoader()
|
||||
{
|
||||
delete m_widget;
|
||||
}
|
||||
|
||||
virtual T* widget()
|
||||
{
|
||||
if( !m_widget )
|
||||
m_widget = new T();
|
||||
|
||||
return m_widget;
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
T* m_widget;
|
||||
};
|
||||
|
||||
} // ns
|
||||
|
||||
#endif //VIEWPAGELAZYLOADER_H
|
Loading…
x
Reference in New Issue
Block a user