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

📄 qmrecoverydialog.cpp

📁 可以播放MP3,wma等文件格式的播放器
💻 CPP
字号:
/* qmrecoverydialog.cpp * * $Id: qmrecoverydialog.cpp,v 1.6 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 "qmrecoverydialog.h"#include "qmrecoverymanager.h"#include <qcheckbox.h>#include <qfile.h>#include <qgroupbox.h>#include <qlabel.h>#include <qlayout.h>#include <qpushbutton.h>#include "qmconfig.h"/** * @file qmrecoverydialog.cpp * @brief Asks if you want to load apollo files on startup after suspected fuckup *//*!  \class QmRecoveryDialog qmrecoverydialog.h  \brief*//*!*/QmRecoveryDialog::QmRecoveryDialog(	QWidget *parent,	const char *name)	: QDialog(parent, name, true){	setCaption(tr("Apollo - Recovery"));	QmConfig *conf = QmConfig::instance();		QVBoxLayout *main = new QVBoxLayout(this, 2);	QLabel *desc = new QLabel(tr(		"<center><h2>Apollo Recovery</h2></center>"		"<p>"		"It appears that Apollo did not shut down properly last time it ran. "		"Although the cause is unknown, it <i>may</i> be a problem with any of "		"the configuration files maintained by Apollo. If this is the case, "		"you are here given the choice which files to load or not so that "		"you can avoid the same thing happening again. "		"</p>"		"<p>"		"If you believe you have a configuration file that causes Apollo to fail, "		"we would very much like to hear from you. Please submit a bug report in "		"one of these ways and include the file that causes Apollo to fail:"		"</p>"		"<p>"		"<ul>"		"<li>bugs@apolloplayer.org</li>"		"<li>http://bugs.apolloplayer.org</li>"		"</ul>"		"</p>"		"<p>"		"Below is a list of all the files.  Check the ones you want to load.  If "		"a configuration file could not be found, its corresponding checkbox will "		"be disabled.  If a configuration file does not exist, the built-in defaults "		"will be used. "		"</p>"		"<h3>Note</h3>"		"If you do not load a file, its contents will be lost. That is, when you "		"quit Apollo, the file will be overwritten with the built-in default values."), this);	desc->setFixedWidth(450);	QGroupBox 	*group = new QGroupBox(1, Vertical, tr("Configuration files"), this);	QWidget 	*dummy = new QWidget(group);	QGridLayout *grid  = new QGridLayout(dummy, 6, 2);    QPushButton *select_all = new QPushButton( tr( "&All" ), dummy, "AllButton" );    QPushButton *select_none = new QPushButton( tr( "&None" ), dummy, "NoneButton" );	m_pFile1 = new QCheckBox(tr("Load configuration"), dummy);	m_pFile2 = new QCheckBox(tr("Load default playlist"), dummy);	m_pFile3 = new QCheckBox(tr("Load playlist tree"), dummy);	m_pFile4 = new QCheckBox(tr("Load directory tree"), dummy);	m_pFile5 = new QCheckBox(tr("Load bad list"), dummy);    m_CheckBoxes.append( m_pFile1 );    m_CheckBoxes.append( m_pFile2 );    m_CheckBoxes.append( m_pFile3 );    m_CheckBoxes.append( m_pFile4 );    m_CheckBoxes.append( m_pFile5 );	QString found(tr("File found."));	QString notfound(tr("File not found."));	QLabel *label1, *label2, *label3, *label4, *label5;		if(QFile::exists(conf->path(QmConfig::Config)))		label1 = new QLabel(found, dummy);	else	{		label1 = new QLabel(notfound, dummy);		m_pFile1->setEnabled(false);	}	if(QFile::exists(conf->path(QmConfig::PlayList)))		label2 = new QLabel(found, dummy);	else	{		label2 = new QLabel(notfound, dummy);		m_pFile2->setEnabled(false);	}	if(QFile::exists(conf->path(QmConfig::PlayListTree)))		label3 = new QLabel(found, dummy);	else	{		label3 = new QLabel(notfound, dummy);		m_pFile3->setEnabled(false);	}	if(QFile::exists(conf->path(QmConfig::DirectoryTree)))		label4 = new QLabel(found, dummy);	else	{		label4 = new QLabel(notfound, dummy);		m_pFile4->setEnabled(false);	}	if(QFile::exists(conf->path(QmConfig::Badlist)))		label5 = new QLabel(found, dummy);	else	{		label5 = new QLabel(notfound, dummy);		m_pFile5->setEnabled(false);	}    QHBoxLayout *row_lay = new QHBoxLayout();    grid->addMultiCellLayout( row_lay, 0, 0, 0, 1, 0 );	grid->addWidget(m_pFile1, 1, 0);	grid->addWidget(label1, 1, 1, AlignRight);	grid->addWidget(m_pFile2, 2, 0);	grid->addWidget(label2, 2, 1, AlignRight);	grid->addWidget(m_pFile3, 3, 0);	grid->addWidget(label3, 3, 1, AlignRight);	grid->addWidget(m_pFile4, 4, 0);	grid->addWidget(label4, 4, 1, AlignRight);	grid->addWidget(m_pFile5, 5, 0);	grid->addWidget(label5, 5, 1, AlignRight);    row_lay->addStretch( 1 );    row_lay->addWidget( select_all, 0 );    row_lay->addStretch( 1 );    row_lay->addWidget( select_none, 0 );    row_lay->addStretch( 1 );	QPushButton *cont = new QPushButton(tr("&Continue"), this);	cont->setFixedWidth(cont->sizeHint().width());	QPushButton *exit = new QPushButton(tr("&Exit"), this);	exit->setFixedWidth(cont->sizeHint().width());	QHBoxLayout *bottom = new QHBoxLayout;	bottom->addWidget(cont);	bottom->addWidget(exit);		connect(cont, SIGNAL(clicked()), this, SLOT(okayClicked()));	connect(exit, SIGNAL(clicked()), this, SLOT(reject()));    connect( select_all, SIGNAL( clicked() ),             this, SLOT( selectAll() ) );    connect( select_none, SIGNAL( clicked() ),             this, SLOT( selectNone() ) );	main->addWidget(desc);	main->addWidget(group);	main->addStretch(2);	main->addLayout(bottom);}/*!*/QmRecoveryDialog::~QmRecoveryDialog(){}/*!  The user clicked the Continue button so we enable/disable the various settings.*/voidQmRecoveryDialog::okayClicked(){	QmRecoveryManager *rm = QmRecoveryManager::instance();	bool set;	set = m_pFile1->isOn();	rm->setLoadingEnabled(QmConfig::Config, set);	set = m_pFile2->isOn();// 	conf->setLoading(QmConfig::PlayList, set);	rm->setLoadingEnabled(QmConfig::PlayList, set);	set = m_pFile3->isOn();// 	conf->setLoading(QmConfig::PlayListTree, set);	rm->setLoadingEnabled(QmConfig::PlayListTree, set);	set = m_pFile4->isOn();	rm->setLoadingEnabled(QmConfig::DirectoryTree, set);	set = m_pFile5->isOn();	rm->setLoadingEnabled(QmConfig::Badlist, set);	accept();}/*!  Selects all config items.  \sa selectNone(), selectCheckBoxes()*/voidQmRecoveryDialog::selectAll(){    selectCheckBoxes( true );}/*!  Selects no config items.  \sa selectAll(), selectCheckBoxes()*/void QmRecoveryDialog::selectNone(){    selectCheckBoxes( false );}/*!  Selects/deselects all config items.  \sa selectAll(), selectNone()*/voidQmRecoveryDialog::selectCheckBoxes( bool check ){    for ( QListIterator<QCheckBox> it( m_CheckBoxes ); it.current(); ++it )    {        it.current()->setChecked( check );    }}

⌨️ 快捷键说明

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