📄 qmmarkmanager.cpp
字号:
/* qmmarkmanager.cpp * * $Id: qmmarkmanager.cpp,v 1.9 2002/03/07 03:44:16 mariuss 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 "qmmarkmanager.h"#include <qdir.h>#include <qfile.h>QmAutoPtr<QmMarkManager> QmMarkManager::s_Instance;/** * @file qmmarkmanager.cpp * @brief Mark songs that mpg123 can't handle as bad *//*! \class QmMarkManager qmmarkmanager.h \brief Class for managing song marks. This class is responsible for managing song marks. Currently, a song can only be marked as bad.*//*! \fn void QmMarkManager::songInserted() Emitted whenever a song is inserted.*//*! \fn void QmMarkManager::songRemoved() Emitted whenever a song is removed.*//*! Loads the bad song list from disk.*/QmMarkManager::QmMarkManager(){ load();}/*! Saves the bad song list to disk.*/QmMarkManager::~QmMarkManager(){ save();}/*! \return The instance of the manager. */QmMarkManager*QmMarkManager::instance(){ if ( QmMarkManager::s_Instance.get() == 0 ) s_Instance.reset( new QmMarkManager() ); return (QmMarkManager *)QmMarkManager::s_Instance.get();}/*! Adds \a song if it does not already exist. If the song was added, changed() will be emitted.*/voidQmMarkManager::insert( const QString &song){ if(m_BadList.find(song) == m_BadList.end()) { m_BadList.append(song); emit songInserted(); }}/*! Removes \a song. It is safe to call this function even if \a song was not previously added. The changed() signal will be emitted.*/voidQmMarkManager::remove( const QString &song){ m_BadList.remove(song);// emit changed(); // mainwindow->markmanager::remove()->markmanager::load() ... not good emit songRemoved();}/*! \return True if \a song is marked as bad, false otherwise. */boolQmMarkManager::isBad( const QString &song) const{ if(m_BadList.find(song) == m_BadList.end()) return false; else return true;}/*! \return The list of bad songs (full paths). */const QStringList&QmMarkManager::badList() const{ return m_BadList;}/*! Loads the bad song list from disk. \warning This will erase the current set of bad songs.*/voidQmMarkManager::load(){ QString badlist = QDir::homeDirPath() + "/.apollo/badlist"; QFile f(badlist); if(f.open( IO_ReadOnly )) { QDataStream str( &f ); str >> m_BadList; }}/*! Saves the bad song list to disk.*/voidQmMarkManager::save(){ QString badlist = QDir::homeDirPath() + "/.apollo/badlist"; QFile f(badlist); f.open( IO_WriteOnly ); QDataStream str( &f ); str << m_BadList;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -