Commit bebef5dc authored by JP Dinger's avatar JP Dinger

Skins2: Cosmetics, 100% pure. We don't indent for labels in C, we don't in C++.

parent b25aa5bf
......@@ -17,9 +17,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef ASYNC_QUEUE_HPP
......@@ -36,38 +36,38 @@ class OSTimer;
/// Asynchronous queue for commands
class AsyncQueue: public SkinObject
{
public:
/// Get the instance of AsyncQueue
/// Returns NULL if initialization failed.
static AsyncQueue *instance( intf_thread_t *pIntf );
public:
/// Get the instance of AsyncQueue
/// Returns NULL if initialization failed.
static AsyncQueue *instance( intf_thread_t *pIntf );
/// Destroy the instance of AsyncQueue
static void destroy( intf_thread_t *pIntf );
/// Destroy the instance of AsyncQueue
static void destroy( intf_thread_t *pIntf );
/// Add a command in the queue, after having removed the commands
/// of the same type already in the queue if needed
void push( const CmdGenericPtr &rcCommand, bool removePrev = true );
/// Add a command in the queue, after having removed the commands
/// of the same type already in the queue if needed
void push( const CmdGenericPtr &rcCommand, bool removePrev = true );
/// Remove the commands of the given type
void remove( const string &rType , const CmdGenericPtr &rcCommand );
/// Remove the commands of the given type
void remove( const string &rType , const CmdGenericPtr &rcCommand );
/// Flush the queue and execute the commands
void flush();
/// Flush the queue and execute the commands
void flush();
private:
/// Command queue
list<CmdGenericPtr> m_cmdList;
/// Timer
OSTimer *m_pTimer;
/// Mutex
vlc_mutex_t m_lock;
private:
/// Command queue
list<CmdGenericPtr> m_cmdList;
/// Timer
OSTimer *m_pTimer;
/// Mutex
vlc_mutex_t m_lock;
// Private because it is a singleton
AsyncQueue( intf_thread_t *pIntf );
virtual ~AsyncQueue();
// Private because it is a singleton
AsyncQueue( intf_thread_t *pIntf );
virtual ~AsyncQueue();
// Callback to flush the queue
DEFINE_CALLBACK( AsyncQueue, Flush );
// Callback to flush the queue
DEFINE_CALLBACK( AsyncQueue, Flush );
};
......
......@@ -17,9 +17,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef CMD_ADD_ITEM_HPP
......@@ -32,22 +32,18 @@
/// "Add item" command
class CmdAddItem: public CmdGeneric
{
public:
CmdAddItem( intf_thread_t *pIntf, const string &rName, bool playNow ):
CmdGeneric( pIntf ), m_name( rName ), m_playNow( playNow ) {}
virtual ~CmdAddItem() {}
/// This method does the real job of the command
virtual void execute();
/// Return the type of the command
virtual string getType() const { return "add item"; }
private:
/// Name of the item to enqueue
string m_name;
/// Should we play the item immediately?
bool m_playNow;
public:
CmdAddItem( intf_thread_t *pIntf, const string &rName, bool playNow )
: CmdGeneric( pIntf ), m_name( rName ), m_playNow( playNow ) { }
virtual ~CmdAddItem() { }
virtual void execute();
virtual string getType() const { return "add item"; }
private:
/// Name of the item to enqueue
string m_name;
/// Should we play the item immediately?
bool m_playNow;
};
#endif
......@@ -16,9 +16,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef CMD_AUDIO_HPP
......@@ -29,20 +29,16 @@
/// Command to enable/disable the equalizer
class CmdSetEqualizer: public CmdGeneric
{
public:
CmdSetEqualizer( intf_thread_t *pIntf, bool iEnable ):
CmdGeneric( pIntf ), m_enable( iEnable ) {}
virtual ~CmdSetEqualizer() {}
/// This method does the real job of the command
virtual void execute();
/// Return the type of the command
virtual string getType() const { return "set equalizer"; }
private:
/// Enable or disable the equalizer
bool m_enable;
public:
CmdSetEqualizer( intf_thread_t *pIntf, bool iEnable )
: CmdGeneric( pIntf ), m_enable( iEnable ) { }
virtual ~CmdSetEqualizer() { }
virtual void execute();
virtual string getType() const { return "set equalizer"; }
private:
/// Enable or disable the equalizer
bool m_enable;
};
......
......@@ -17,9 +17,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef CMD_CHANGE_SKIN_HPP
......@@ -31,20 +31,16 @@
/// "Change Skin" command
class CmdChangeSkin: public CmdGeneric
{
public:
CmdChangeSkin( intf_thread_t *pIntf, const string &rFile ):
CmdGeneric( pIntf ), m_file( rFile ) {}
virtual ~CmdChangeSkin() {}
/// This method does the real job of the command
virtual void execute();
/// Return the type of the command
virtual string getType() const { return "change skin"; }
private:
/// Skin file to load
string m_file;
public:
CmdChangeSkin( intf_thread_t *pIntf, const string &rFile ):
CmdGeneric( pIntf ), m_file( rFile ) { }
virtual ~CmdChangeSkin() { }
virtual void execute();
virtual string getType() const { return "change skin"; }
private:
/// Skin file to load
string m_file;
};
#endif
......@@ -17,68 +17,65 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef CMD_GENERIC_HPP
#define CMD_GENERIC_HPP
#include <string>
#include "../src/skin_common.hpp"
#include "../utils/pointer.hpp"
#include <string>
/// Macro to define the prototype of simple commands
#define DEFINE_COMMAND( name, type ) \
class Cmd##name: public CmdGeneric \
{ \
public: \
Cmd##name( intf_thread_t *pIntf ): CmdGeneric( pIntf ) {} \
virtual ~Cmd##name() {} \
virtual void execute(); \
virtual string getType() const { return type; } \
\
#define DEFINE_COMMAND( name, type ) \
class Cmd##name: public CmdGeneric \
{ public: \
Cmd##name( intf_thread_t *pIntf ): CmdGeneric( pIntf ) { } \
virtual ~Cmd##name() { } \
virtual void execute(); \
virtual string getType() const { return type; } \
};
/// Macro to define a "callback" command inside a class
#define DEFINE_CALLBACK( parent, action ) \
class Cmd##action: public CmdGeneric \
{ \
public: \
Cmd##action( parent *pParent ): \
CmdGeneric( pParent->getIntf() ), m_pParent( pParent ) {} \
virtual ~Cmd##action() {} \
virtual void execute(); \
virtual string getType() const { return "Cmd" #parent #action; } \
private: \
parent *m_pParent; \
\
} m_cmd##action; \
#define DEFINE_CALLBACK( parent, action ) \
class Cmd##action: public CmdGeneric \
{ \
public: \
Cmd##action( parent *pParent ): \
CmdGeneric( pParent->getIntf() ), m_pParent( pParent ) { } \
virtual ~Cmd##action() { } \
virtual void execute(); \
virtual string getType() const { return "Cmd" #parent #action; } \
private: \
parent *m_pParent; \
} m_cmd##action; \
friend class Cmd##action;
/// Base class for skins commands
class CmdGeneric: public SkinObject
{
public:
virtual ~CmdGeneric() {}
public:
virtual ~CmdGeneric() { }
/// This method does the real job of the command
virtual void execute() = 0;
/// This method does the real job of the command
virtual void execute() = 0;
/// Return the type of the command
virtual string getType() const { return ""; }
/// Return the type of the command
virtual string getType() const { return ""; }
/// During queue reductions, check if we really want to remove
/// this command.
virtual bool checkRemove( CmdGeneric * ) const { return true; }
/// During queue reductions, check if we really want to remove
/// this command.
virtual bool checkRemove( CmdGeneric * ) const { return true; }
protected:
CmdGeneric( intf_thread_t *pIntf ): SkinObject( pIntf ) {}
protected:
CmdGeneric( intf_thread_t *pIntf ): SkinObject( pIntf ) { }
};
......
......@@ -17,9 +17,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef CMD_LAYOUT_HPP
......@@ -33,20 +33,16 @@ class GenericLayout;
/// "Change layout" command
class CmdLayout: public CmdGeneric
{
public:
CmdLayout( intf_thread_t *pIntf, TopWindow &rWindow,
GenericLayout &rLayout );
virtual ~CmdLayout() {}
/// This method does the real job of the command
virtual void execute();
/// Return the type of the command
virtual string getType() const { return "change layout"; }
private:
TopWindow &m_rWindow;
GenericLayout &m_rLayout;
public:
CmdLayout( intf_thread_t *pIntf, TopWindow &rWindow,
GenericLayout &rLayout );
virtual ~CmdLayout() { }
virtual void execute();
virtual string getType() const { return "change layout"; }
private:
TopWindow &m_rWindow;
GenericLayout &m_rLayout;
};
#endif
......@@ -16,9 +16,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef CMD_MINIMIZE_HPP
......@@ -36,48 +36,40 @@ DEFINE_COMMAND(Restore, "restore" )
/// Command to maximize a window
class CmdMaximize: public CmdGeneric
{
public:
/// Maximize the given layout
CmdMaximize( intf_thread_t *pIntf, WindowManager &rWindowManager,
TopWindow &rWindow );
virtual ~CmdMaximize() {}
/// This method does the real job of the command
virtual void execute();
/// Return the type of the command
virtual string getType() const { return "maximize"; }
private:
WindowManager &m_rWindowManager;
TopWindow &m_rWindow;
public:
/// Maximize the given layout
CmdMaximize( intf_thread_t *pIntf, WindowManager &rWindowManager,
TopWindow &rWindow );
virtual ~CmdMaximize() { }
virtual void execute();
virtual string getType() const { return "maximize"; }
private:
WindowManager &m_rWindowManager;
TopWindow &m_rWindow;
};
/// Command to unmaximize a window
class CmdUnmaximize: public CmdGeneric
{
public:
/// Unmaximize the given layout
CmdUnmaximize( intf_thread_t *pIntf, WindowManager &rWindowManager,
TopWindow &rWindow );
virtual ~CmdUnmaximize() {}
/// This method does the real job of the command
virtual void execute();
/// Return the type of the command
virtual string getType() const { return "unmaximize"; }
private:
WindowManager &m_rWindowManager;
TopWindow &m_rWindow;
public:
/// Unmaximize the given layout
CmdUnmaximize( intf_thread_t *pIntf, WindowManager &rWindowManager,
TopWindow &rWindow );
virtual ~CmdUnmaximize() { }
virtual void execute();
virtual string getType() const { return "unmaximize"; }
private:
WindowManager &m_rWindowManager;
TopWindow &m_rWindow;
};
DEFINE_COMMAND(AddInTray, "add in tray" )
DEFINE_COMMAND(RemoveFromTray, "remove from tray" )
DEFINE_COMMAND(AddInTaskBar, "add in taskbar" )
DEFINE_COMMAND(RemoveFromTaskBar, "remove from taskbar" )
DEFINE_COMMAND( AddInTray, "add in tray" )
DEFINE_COMMAND( RemoveFromTray, "remove from tray" )
DEFINE_COMMAND( AddInTaskBar, "add in taskbar" )
DEFINE_COMMAND( RemoveFromTaskBar, "remove from taskbar" )
#endif
......@@ -16,9 +16,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef CMD_MUXER_HPP
......@@ -31,20 +31,16 @@
/// This command only contains other commands (composite pattern)
class CmdMuxer: public CmdGeneric
{
public:
CmdMuxer( intf_thread_t *pIntf, const list<CmdGeneric*> &rList ):
CmdGeneric( pIntf ), m_list( rList ) {}
virtual ~CmdMuxer() {}
/// This method does the real job of the command
virtual void execute();
/// Return the type of the command
virtual string getType() const { return "muxer"; }
private:
/// List of commands we will execute sequentially
list<CmdGeneric*> m_list;
public:
CmdMuxer( intf_thread_t *pIntf, const list<CmdGeneric*> &rList ):
CmdGeneric( pIntf ), m_list( rList ) { }
virtual ~CmdMuxer() { }
virtual void execute();
virtual string getType() const { return "muxer"; }
private:
/// List of commands we will execute sequentially
list<CmdGeneric*> m_list;
};
#endif
......@@ -17,9 +17,9 @@
* 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef CMD_PLAYLIST_HPP
......@@ -32,20 +32,16 @@
/// Command to delete the selected items from a list
class CmdPlaylistDel: public CmdGeneric
{
public:
CmdPlaylistDel( intf_thread_t *pIntf, VarList &rList ):
CmdGeneric( pIntf ), m_rList( rList ) {}
virtual ~CmdPlaylistDel() {}
/// This method does the real job of the command
virtual void execute();
/// Return the type of the command
virtual string getType() const { return "playlist del"; }
private:
/// List
VarList &m_rList;
public:
CmdPlaylistDel( intf_thread_t *pIntf, VarList &rList )
: CmdGeneric( pIntf ), m_rList( rList ) { }
virtual ~CmdPlaylistDel() { }
virtual void execute();
virtual string getType() const { return "playlist del"; }
private:
/// List
VarList &m_rList;
};
......@@ -65,100 +61,80 @@ DEFINE_COMMAND( PlaylistFirst, "playlist first" )
/// Command to set the random state
class CmdPlaylistRandom: public CmdGeneric
{
public:
CmdPlaylistRandom( intf_thread_t *pIntf, bool value ):
CmdGeneric( pIntf ), m_value( value ) {}
virtual ~CmdPlaylistRandom() {}
/// This method does the real job of the command
virtual void execute();
/// Return the type of the command
virtual string getType() const { return "playlist random"; }
private:
/// Random state
bool m_value;
public:
CmdPlaylistRandom( intf_thread_t *pIntf, bool value )
: CmdGeneric( pIntf ), m_value( value ) { }
virtual ~CmdPlaylistRandom() { }
virtual void execute();
virtual string getType() const { return "playlist random"; }
private:
/// Random state
bool m_value;
};
/// Command to set the loop state
class CmdPlaylistLoop: public CmdGeneric
{
public:
CmdPlaylistLoop( intf_thread_t *pIntf, bool value ):
CmdGeneric( pIntf ), m_value( value ) {}
virtual ~CmdPlaylistLoop() {}
/// This method does the real job of the command
virtual void execute();
/// Return the type of the command
virtual string getType() const { return "playlist loop"; }
private:
/// Loop state
bool m_value;
public:
CmdPlaylistLoop( intf_thread_t *pIntf, bool value )
: CmdGeneric( pIntf ), m_value( value ) { }
virtual ~CmdPlaylistLoop() { }
virtual void execute();
virtual string getType() const { return "playlist loop"; }
private:
/// Loop state
bool m_value;
};
/// Command to set the repeat state
class CmdPlaylistRepeat: public CmdGeneric
{
public:
CmdPlaylistRepeat( intf_thread_t *pIntf, bool value ):
CmdGeneric( pIntf ), m_value( value ) {}
virtual ~CmdPlaylistRepeat() {}
/// This method does the real job of the command
virtual void execute();
/// Return the type of the command
virtual string getType() const { return "playlist repeat"; }
private:
/// Repeat state
bool m_value;
public:
CmdPlaylistRepeat( intf_thread_t *pIntf, bool value )
: CmdGeneric( pIntf ), m_value( value ) { }
virtual ~CmdPlaylistRepeat() { }
virtual void execute();
virtual string getType() const { return "playlist repeat"; }
private:
/// Repeat state
bool m_value;
};
/// Command to load a playlist
class CmdPlaylistLoad: public CmdGeneric
{
public:
CmdPlaylistLoad( intf_thread_t *pIntf, const string& rFile ):
CmdGeneric( pIntf ), m_file( rFile ) {}
virtual ~CmdPlaylistLoad() {}
/// This method does the real job of the command
virtual void execute();
/// Return the type of the command
virtual string getType() const { return "playlist load"; }
private:
/// Playlist file to load
string m_file;
public:
CmdPlaylistLoad( intf_thread_t *pIntf, const string& rFile )
: CmdGeneric( pIntf ), m_file( rFile ) { }
virtual ~CmdPlaylistLoad() { }
virtual void execute();
virtual string getType() const { return "playlist load"; }
private:
/// Playlist file to load
string m_file;
};
/// Command to save a playlist
class CmdPlaylistSave: public CmdGeneric
{
public:
CmdPlaylistSave( intf_thread_t *pIntf, const string& rFile ):
CmdGeneric( pIntf ), m_file( rFile ) {}
virtual ~CmdPlaylistSave() {}
/// This method does the real job of the command
virtual void execute();
/// Return the type of the command
virtual string getType() const { return "playlist save"; }
private:
/// Playlist file to save
string m_file;
public:
CmdPlaylistSave( intf_thread_t *pIntf, const string& rFile )