⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qmplaylistformat.cpp

📁 可以播放MP3,wma等文件格式的播放器
💻 CPP
字号:
/* qmplaylistformat.cpp * * $Id: qmplaylistformat.cpp,v 1.10 2002/03/07 03:44:17 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 "qmplaylistformat.h"#include "qmxmlformat.h"#include "qmm3uformat.h"#include <iostream>#include <qfile.h>/*!  \file qmplaylistformat.h  Abstract base for m3u and apollo (xml based), playlist file formats*//*!  \class QmPlayListFormat qmplaylistformat.h  \brief Base class for playlist formats, currently m3u and apollo (xml based)*/QmPlayListFormat::QmPlayListFormat(){}QmPlayListFormat::~QmPlayListFormat(){}/*!  Determine format of \a filename and return it.  If \a quiet is false (default),  a warning will be printed if the format could not be determined and a default  picked.  If \a quiet is true, no warning will be printed, but the same default  will be picked.  The latter is useful when saving new playlists.    \return The format handler appropriate for the filetype of \a filename.  \warning The caller is responsible for deallocating the memory.*/QmPlayListFormat*QmPlayListFormat::getFormat(	const QString &filename,	bool quiet){	QString ext = filename.right(3);	if(ext == "m3u")		return new QmM3uFormat;	else if(ext == "xml")		return new QmXmlFormat;	else	{		// OK.  The extension test didn't work.  Now for the slow way.		// Note that these functions will actually open the file and		// fail if this doesn't work.  In other words, it will fail		// for saving playlists which haven't been made before.        if (QFile::exists(filename)) {            if(QmM3uFormat::isMatch(filename))                 return new QmM3uFormat;            else if(QmXmlFormat::isMatch(filename))                 return new QmXmlFormat;            else            {                // Let's just default...                if( ! quiet)                    qWarning("QmPlayListFormat::getFormat(): Couldn't estimate format of %s; "                             "defaulting to XML format.\n", filename.latin1());                return new QmXmlFormat;            }        }        else            return new QmXmlFormat;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -