📄 qmpixmapsupplier.cpp
字号:
/* qmpixmapsupplier.cpp * * $Id: qmpixmapsupplier.cpp,v 1.12 2002/04/01 22:51:01 kyllingstad Exp $ * * Apollo sound player: http://www.apolloplayer.org * Copyright(C) 2000-2002 Apollo Team. See CREDITS file. * * This program 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 2 * of the License, or (at your option) any later version. * * This program 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 this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * The GNU General Public License is also available online at: * * http://www.gnu.org/copyleft/gpl.html */#include "qmpixmapsupplier.h"#include "icons/eject.xpm"#include "icons/minimize.xpm"#include "icons/maximize.xpm"#include "icons/next.xpm"#include "icons/options.xpm"#include "icons/pause.xpm"#include "icons/play.xpm"#include "icons/playlist.xpm"#include "icons/prev.xpm"#include "icons/stop.xpm"#include "icons/songitem.xpm"#include "icons/folder.xpm"#include "icons/apollo-mini.xpm"#include "icons/apollo-systray.xpm"#include "icons/dice.xpm"#include "icons/apollo.xpm"#include "icons/loop.xpm"#include "icons/one.xpm"/*! \file qmpixmapsupplier.cpp Implementation of QmPixmapSupplier class*//*! \class QmPixmapSupplier qmpixmapsupplier.h \brief Supplies clients with QPixmaps from symbols*/QmAutoPtr<QmPixmapSupplier> QmPixmapSupplier::s_pInstance;/*! Default constructor*/QmPixmapSupplier::QmPixmapSupplier(){ store( "icons-eject", QPixmap( eject_xpm ) ); store( "icons-minimize", QPixmap( minimize_xpm ) ); store( "icons-maximize", QPixmap( maximize_xpm ) ); store( "icons-next", QPixmap( next_xpm ) ); store( "icons-options", QPixmap( options_xpm ) ); store( "icons-pause", QPixmap( pause_xpm ) ); store( "icons-play", QPixmap( play_xpm ) ); store( "icons-playlist", QPixmap( playlist_xpm ) ); store( "icons-prev", QPixmap( prev_xpm ) ); store( "icons-stop", QPixmap( stop_xpm ) ); store( "icons-songitem", QPixmap( songitem_xpm ) ); store( "icons-folder", QPixmap( folder_xpm ) ); store( "icons-apollo-mini", QPixmap( apollo_32x32_xpm ) ); store( "icons-apollo-systray", QPixmap( apollo_systray_xpm ) ); store( "icons-random", QPixmap( dice_xpm ) ); store( "icons-apollo", QPixmap( apollo_xpm ) ); store( "icons-loop", QPixmap( loop_xpm ) ); store( "icons-one", QPixmap( one_xpm ) ); }/*! Destroys the object*/QmPixmapSupplier::~QmPixmapSupplier(){}/*! Supplies the client with a pixmap, the parameter \c symbol is used for locating the pixmap. If no pixmap is found an error message is printed and an empty pixmap i returned.*/QPixmapQmPixmapSupplier::pixmap( const QString &symbol ){ if ( m_Pixmaps.find( symbol ) != m_Pixmaps.end() ) { return m_Pixmaps[symbol]; } else { qWarning( "QmPixmapSupplier: No pixmap named \"%s\" found, empty pixmap returned", symbol.latin1() ); return QPixmap(); }}/*! Stores the pixmap \c pix with symbolic name \c symbol. If the symbol already exists an error message is printed and the operation fails.*/voidQmPixmapSupplier::store( const QString &symbol, const QPixmap &pix ){ if ( m_Pixmaps.find( symbol ) == m_Pixmaps.end() ) { m_Pixmaps.insert( symbol, pix ); } else { qWarning( "QmPixmapSupplier: A pixmap named \"%s\" already exists, pixmap is not stored", symbol.latin1() ); }}/*! Returns the only instance of the QmPixmapSupplier class. Uses QmAutoPtr for storing the object so it is automaticly destroyed when quitting.*/QmPixmapSupplier *QmPixmapSupplier::instance(){ if ( QmPixmapSupplier::s_pInstance.get() == 0 ) { s_pInstance.reset( new QmPixmapSupplier() ); } return (QmPixmapSupplier *)QmPixmapSupplier::s_pInstance.get();}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -