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

📄 qmplaylistpropertypage.cpp

📁 可以播放MP3,wma等文件格式的播放器
💻 CPP
字号:
/* qmplaylistpropertypage.cpp * * $Id: qmplaylistpropertypage.cpp,v 1.10.2.1 2002/10/10 21:40:52 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 "qmplaylistpropertypage.h"#include "qmplaylistbrowseritem.h"#include <qfiledialog.h>#include <qgroupbox.h>#include <qlabel.h>#include <qlayout.h>#include <qlineedit.h>#include <qpushbutton.h>#include <iostream>/** * @file qmplaylistpropertypage.cpp * @brief Playlist (browser) preferences page *//*!  \class QmPlayListPropertyPage qmplaylistpropertypage.h  \brief Playlist (browser) preferences page  For use in the playlist browser.*//*!*/QmPlayListPropertyPage::QmPlayListPropertyPage(	QmPlayListBrowserItem *item,	QmConfigDialog *parent,	const char *pname)	: QmConfigPage(parent, pname, WType_Modal),	  m_pItem(item),	  m_pFile(0){	CHECK_PTR(m_pItem);	QString thing;	if(item->isFolder())		thing = tr("Folder");	else		thing = tr("Playlist");	setCaption(tr("Apollo - %1 Properties").arg(thing));		QVBoxLayout *top = new QVBoxLayout(this, 2);	QHBoxLayout *bottom = new QHBoxLayout(4);	QGroupBox 	*group = new QGroupBox(1, Vertical, tr("%1 properties").arg(thing), this);	QWidget 	*dummy = new QWidget(group);		QLabel *name		= new QLabel(tr("&Name"), dummy);	m_pName				= new QLineEdit(m_pItem->text(0), dummy);	name->setBuddy(m_pName);	connect(m_pName, SIGNAL(textChanged(const QString&)), this, SLOT(nameChanged(const QString&)));	QLabel *file = 0;	QPushButton *browse = 0;		if( ! item->isFolder())	{		file	= new QLabel(tr("&Playlist"), dummy);		m_pFile	= new QLineEdit(m_pItem->fileName(), dummy);		file->setBuddy(m_pFile);		browse	= new QPushButton(tr("&Browse..."), dummy);		connect(browse, SIGNAL(clicked()), this, SLOT(browse()));		connect(m_pFile, SIGNAL(textChanged(const QString&)), this, SLOT(nameChanged(const QString&)));	}	int width1 = name->sizeHint().width();	int width2;	if( ! item->isFolder())		width2 = file->sizeHint().width();	else		width2 = 0;		int width3 = width1 > width2 ? width1 : width2;	name->setFixedWidth(width3);	if( ! item->isFolder())		file->setFixedWidth(width3);	QVBoxLayout *l3 = new QVBoxLayout(dummy, 2);	QHBoxLayout *l1 = new QHBoxLayout(l3, 2);		l1->addWidget(name);	l1->addWidget(m_pName);		if( ! item->isFolder())	{		QHBoxLayout *l2 = new QHBoxLayout(l3, 2);			l2->addWidget(file);		l2->addWidget(m_pFile, 2);		l2->addWidget(browse);	}			m_pOkay				= new QPushButton(tr("&OK"), this);	QPushButton *cancel	= new QPushButton(tr("&Cancel"), this);	width1 = m_pOkay->sizeHint().width();	width2 = cancel->sizeHint().width();	width3 = width1 > width2 ? width1 : width2;	m_pOkay->setFixedWidth(width3);	cancel->setFixedWidth(width3);		connect(m_pOkay, SIGNAL(clicked()), this, SLOT(okay()));	connect(cancel, SIGNAL(clicked()), this, SLOT(hide()));	nameChanged(""); // the text passed is not used		bottom->addStretch();	bottom->addWidget(m_pOkay);	bottom->addWidget(cancel);	top->addWidget(group);	top->addStretch();	top->addLayout(bottom);}/*!*/QmPlayListPropertyPage::~QmPlayListPropertyPage(){}/*!  Called when user click OK.*/voidQmPlayListPropertyPage::okay(){	save();	hide();}/*!  Updates the 'OK' button.  It will only be enabled if both the  text field and the filename field (if present) are non-null. */voidQmPlayListPropertyPage::nameChanged(	const QString &/*name*/){	if(m_pName->text().isEmpty())		m_pOkay->setEnabled(false);	else	{		if(m_pFile == 0)			m_pOkay->setEnabled(true);		else		{			if(m_pFile->text().isEmpty())				m_pOkay->setEnabled(false);			else				m_pOkay->setEnabled(true);		}	}}/*! */voidQmPlayListPropertyPage::browse(){	QString file = QFileDialog::getOpenFileName(m_pFile->text());	if( ! file.isEmpty())		m_pFile->setText(file);}/*! */voidQmPlayListPropertyPage::load(){}/*! */voidQmPlayListPropertyPage::save(){	m_pItem->setText(0, m_pName->text());	if(m_pFile)		m_pItem->setFileName(m_pFile->text());}

⌨️ 快捷键说明

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