qmmarkdialog.cpp

来自「可以播放MP3,wma等文件格式的播放器」· C++ 代码 · 共 159 行

CPP
159
字号
/* qmmarkdialog.cpp * * $Id: qmmarkdialog.cpp,v 1.14.2.1 2002/09/23 19:26:51 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 "qmmarkdialog.h"#include "qmconfig.h"#include "qmrecoverymanager.h"#include <iostream>#include <qdir.h>#include <qfile.h>#include <qfileinfo.h>#include <qheader.h>#include <qlayout.h>#include <qlistview.h>#include <qpushbutton.h>#include "qmmarkmanager.h"/** * @file qmmarkdialog.cpp * @brief Widget for editing bad marks (songs mpg123 have problems with) *//*!  \class QmMarkDialog qmmarkdialog.h  \brief The dialog for unmarking previously marked songs (clearing bad mark).  This class is for showing all the songs that are marked bad.  The user  can in this dialog remove songs that were marked as bad earlier.  *//*!  Creates a new mark dialog.*/QmMarkDialog::QmMarkDialog(	QWidget *parent,	const char *name)	: QDialog(parent, name){	setCaption(tr("Apollo - Mark Editor"));		QVBoxLayout *main 	= new QVBoxLayout(this, 2);	QHBoxLayout *bottom = new QHBoxLayout;	m_pListView = new QListView(this);	m_pListView->header()->hide();	m_pListView->setAcceptDrops(false);	m_pListView->addColumn(tr("Song"));	m_pListView->setMultiSelection(true);		m_pUnmark 	= new QPushButton("&Clear bad mark", this);	m_pUnmark->setDefault(true);	m_pUnmark->setAccel(Key_Delete);	connect(m_pUnmark, SIGNAL(clicked()), this, SLOT(unmarkClicked()));	QPushButton *hide = new QPushButton("&Hide", this);	hide->setFixedSize(hide->sizeHint());	connect(hide, SIGNAL(clicked()), this, SLOT(hide()));	// The songInserted() signal will be emitted when a song is marked as bad	// in the playlist.  We need to update our list.	connect(QmMarkManager::instance(), SIGNAL(songInserted()), this, SLOT(load()));	main->addWidget(m_pListView, 2);	main->addLayout(bottom);	bottom->addWidget(m_pUnmark);	bottom->addWidget(hide);	load();	resize(300, 400);}/*!  Destroys the mark dialog.  The changes to the marks (if any) is  \e not saved to disk.  \sa QmMarkManager::save()*/QmMarkDialog::~QmMarkDialog(){}/*!  Unmarks (as bad) the currently selected song(s).*/voidQmMarkDialog::unmarkClicked(){	QListViewItem *item = m_pListView->firstChild();	QListViewItem *temp;	while(item)	{				temp = item->itemBelow();				if(item->isSelected())		{			QmMarkManager::instance()->remove(item->text(0));			delete item;		}				item = temp;	}}/*!  Clears the list and (re)loads the bad list.*/voidQmMarkDialog::load(){	if(QmRecoveryManager::instance()->loadingEnabled(QmConfig::Badlist) == false)		return;		m_pListView->clear();		const QStringList strlist = QmMarkManager::instance()->badList();		for(QStringList::ConstIterator it = strlist.begin(); it != strlist.end(); ++it)	{		QFileInfo song(*it);		(void) new QListViewItem(m_pListView, song.filePath());	}}

⌨️ 快捷键说明

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