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

📄 qmbrowser.cpp

📁 可以播放MP3,wma等文件格式的播放器
💻 CPP
字号:
/* qmbrowser.cpp * * $Id: qmbrowser.cpp,v 1.12 2002/03/31 23:52:41 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 "qmbrowser.h"#include "qmconfig.h"#include "qmdirbrowser.h"#include "qmpixmapsupplier.h"#include "qmplaylistbrowser.h"#include <qcombobox.h>#include <qlayout.h>#include <qwidgetstack.h>/** * \file qmbrowser.cpp * \brief Widget for browsing: playlists and directories  *//*!  \class QmBrowser qmbrowser.h  \brief Represents the play list browser widget.  This class provides a widget with a tree for quickly selecting play lists to  be played.  It also provides a directory browser.   Makes it fast and easy to  add to the playlist.  There are two modes:  <ul>  <li> Directory: A directory browser that lets you add mp3's/directories to the       playlist.</li>  <li> Playlist: A Playlist list browser.  A playlist list is like a playlist       that has names of playlists instead of mp3's.  (Create one in a shell with       "ls *.m3u > PlaylistList").  Lets you load/append/prepend playlists.</li>  </ul>*//*!*/QmBrowser::QmBrowser(	QmMainWindow *mainwindow,	QWidget *parent,	const char *name)	: QWidget(parent, name),	  m_pMainWindow(mainwindow){	QVBoxLayout *top = new QVBoxLayout(this, 1);    QmPixmapSupplier *sup = QmPixmapSupplier::instance();		m_pMode = new QComboBox(false, this);		m_pMode->insertItem(sup->pixmap( "icons-playlist" ), "Playlists", PLAYLIST_MODE);	m_pMode->insertItem(sup->pixmap( "icons-folder" ), "Directories", DIRECTORY_MODE);	m_pStack = new QWidgetStack(this);	m_pDirBrowser 	   = new QmDirBrowser(m_pMainWindow, m_pStack);	m_pPlayListBrowser = new QmPlayListBrowser(m_pStack);		m_pStack->addWidget(m_pDirBrowser, DIRECTORY_MODE);	m_pStack->addWidget(m_pPlayListBrowser, PLAYLIST_MODE);	m_pStack->raiseWidget(PLAYLIST_MODE);	connect(m_pMode, SIGNAL(activated(int)), this, SLOT(browserActivated(int)));	top->addWidget(m_pMode);	top->addWidget(m_pStack, 2);	int browser_mode;	QmConfig::instance()->get("main-window", "browser-mode", browser_mode);	m_pMode->setCurrentItem(browser_mode);	m_pStack->raiseWidget(browser_mode);}QmBrowser::~QmBrowser() {}/*!  Similar to QWidget::hasFocus(), except that this function will return true  if either of the browsers (child widgets) has focus, where as  QWidget::hasFocus() would only return if \e this widget has focus. */boolQmBrowser::hasBrowserFocus() const{	if(m_pDirBrowser->hasFocus())		return true;	else if(m_pPlayListBrowser->hasFocus())		return true;	else		return false;}/*!  Removes the active item, if any, in the browser that has keyboard focus.*/voidQmBrowser::removeItem(){	QListViewItem *current = 0;		if(m_pDirBrowser->hasFocus())	{		current = m_pDirBrowser->currentItem();	}	else if(m_pPlayListBrowser->hasFocus())	{		current = m_pPlayListBrowser->currentItem();	}	if(current)		delete current;}voidQmBrowser::loadPlayListTree(const QString &filename) {    m_pPlayListBrowser->loadPlayListTree(filename);}/*!  Displays the directory browser.*/voidQmBrowser::showDirectories(){    m_pMode->setCurrentItem( DIRECTORY_MODE );    browserActivated( DIRECTORY_MODE );}/*!  Displays the playlist browser.*/voidQmBrowser::showPlaylists(){    m_pMode->setCurrentItem( PLAYLIST_MODE );    browserActivated( PLAYLIST_MODE );}/*! */voidQmBrowser::browserActivated(	int mode){	QmConfig::instance()->set("main-window", "browser-mode", mode);	m_pStack->raiseWidget(mode);}

⌨️ 快捷键说明

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