📄 qmstuffpage.cpp
字号:
/* qmstuffpage.cpp * * $Id: qmstuffpage.cpp,v 1.15 2002/03/21 15:03:08 amos 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 "qmstuffpage.h"#include "qmconfig.h"#include "qmconfigpage.h"#include "qmmainwindow.h"#include "qmsystray.h"#include <iostream>#include <qlayout.h>#include <qvbox.h>#include <qcheckbox.h>#include <qlabel.h>#include <qhbox.h>#include <qcombobox.h>#include <qvgroupbox.h>#include <qlineedit.h>/*! \file qmstuffpage.cpp \brief Preferences page for different stuff*//*! \class QmStuffPage qmstuffpage.h \brief Various settings*/QmStuffPage::QmStuffPage( QmConfigDialog *parent, const char *name) : QmConfigPage(parent, name){ QVBoxLayout *layout = new QVBoxLayout(this, 5); m_pPacked = new QCheckBox( "&Packed mode: fit more songs in one screen height", this); connect(m_pPacked, SIGNAL(clicked()), this, SLOT(changed())); layout->addWidget(m_pPacked); m_pSystray = new QCheckBox( "&Enable system tray icon", this); connect(m_pSystray, SIGNAL(clicked()), this, SLOT(changed())); layout->addWidget(m_pSystray);#ifndef APOLLO_USE_SYSTRAY m_pSystray->hide();#endif m_pLatin1 = new QCheckBox( "&Encoding: use latin 1 instead of utf-8.", this); connect(m_pLatin1, SIGNAL(clicked()), this, SLOT(changed())); layout->addWidget(m_pLatin1); layout->addWidget(new QLabel(tr("<table><tr><td>" "utf-8 should work for everyone, but latin1 is <i>much</i> faster. " "More choices will be added." "</td></tr></table>"), this)); layout->addWidget(new QLabel(tr("<table><tr><td>" "Choose what to display in the playlist:" "</td></tr></table>"), this)); m_pDisplayString = new QLineEdit(QmConfig::instance()->getString("stuff", "display-format"), this); layout->addWidget(m_pDisplayString); connect(m_pDisplayString, SIGNAL(textChanged(const QString&)), this, SLOT(changed())); layout->addWidget(new QLabel(tr("<table><tr><td>" "What to display for songs (that we think are) part of a multi artist album:" "</td></tr></table>"), this)); m_pDisplayStringMulti = new QLineEdit(QmConfig::instance()->getString("stuff", "display-format-multi"), this); layout->addWidget(m_pDisplayStringMulti); connect(m_pDisplayStringMulti, SIGNAL(textChanged(const QString&)), this, SLOT(changed())); layout->addWidget(new QLabel(tr("<table><tr><td>%p - performer</td><td>%a - album</td></tr>" "<tr><td>%f - filename</td><td>%F - file path</td></tr>" "<tr><td>%e - extension</td><td>%t - track name</td></tr>" "<tr><td>%n - track no</td><td>%y - year</td></tr>" "<tr><td>%g - genre</td><td>%c - comment</td></tr></table"), this)); layout->addStretch(1000);}/*! Destroys the page.*/QmStuffPage::~QmStuffPage(){}/*! Save changes */voidQmStuffPage::save(){ QmConfig *conf = QmConfig::instance(); conf->set( "stuff", "packed", m_pPacked->isOn()); conf->set( "stuff", "systray", m_pSystray->isOn()); conf->set( "stuff", "encoding", (m_pLatin1->isOn() ? "ISO-8859-1" : "utf-8")); QmSystray::show( QmMainWindow::mainwin, m_pSystray->isOn() ); QmMainWindow::mainwin->updatePlayList(); if (conf->getString( "stuff", "display-format" ) != m_pDisplayString->text() || conf->getString( "stuff", "display-format-multi" ) != m_pDisplayStringMulti->text()) { conf->set( "stuff", "display-format", m_pDisplayString->text()); conf->set( "stuff", "display-format-multi", m_pDisplayStringMulti->text()); QmMainWindow::mainwin->setDisplayFormat(); }}/*! loads in the current values from QmConfig. Used before showing the page, and to reset to previous settings.*/voidQmStuffPage::load(){ bool initval; QmConfig *conf = QmConfig::instance(); conf->get( "stuff", "packed", initval ); m_pPacked->setChecked(initval); bool initvalSystray; conf->get( "stuff", "systray", initvalSystray ); m_pSystray->setChecked(initvalSystray); QmSystray::show( QmMainWindow::mainwin, m_pSystray->isOn() ); QString initvalS; conf->get( "stuff", "encoding", initvalS ); m_pLatin1->setChecked(initvalS == "ISO-8859-1"); m_pDisplayString->setText(conf->getString( "stuff", "display-format" )); m_pDisplayStringMulti->setText(conf->getString( "stuff", "display-format-multi" )); }/*! Discard changes done since last save(). */voidQmStuffPage::discard(){ load();}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -