diff options
Diffstat (limited to 'kcontrol/arts')
-rw-r--r-- | kcontrol/arts/Makefile.am | 15 | ||||
-rw-r--r-- | kcontrol/arts/arts.cpp | 730 | ||||
-rw-r--r-- | kcontrol/arts/arts.desktop | 240 | ||||
-rw-r--r-- | kcontrol/arts/arts.h | 135 | ||||
-rw-r--r-- | kcontrol/arts/generaltab.ui | 330 | ||||
-rw-r--r-- | kcontrol/arts/hardwaretab.ui | 358 | ||||
-rw-r--r-- | kcontrol/arts/krichtextlabel.cpp | 115 | ||||
-rw-r--r-- | kcontrol/arts/krichtextlabel.h | 65 |
8 files changed, 1988 insertions, 0 deletions
diff --git a/kcontrol/arts/Makefile.am b/kcontrol/arts/Makefile.am new file mode 100644 index 000000000..f4b68cfa1 --- /dev/null +++ b/kcontrol/arts/Makefile.am @@ -0,0 +1,15 @@ +kde_module_LTLIBRARIES = kcm_arts.la + +kcm_arts_la_SOURCES = arts.cpp generaltab.ui hardwaretab.ui krichtextlabel.cpp + +kcm_arts_la_LDFLAGS = $(all_libraries) -module -avoid-version -no-undefined +kcm_arts_la_LIBADD = $(LIB_KIO) $(LIB_KUTILS) -lkmid + +AM_CPPFLAGS = -I$(kde_includes)/arts $(all_includes) + +METASOURCES = AUTO + +messages: rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/kcmarts.pot + +xdg_apps_DATA = arts.desktop diff --git a/kcontrol/arts/arts.cpp b/kcontrol/arts/arts.cpp new file mode 100644 index 000000000..a8edb30a2 --- /dev/null +++ b/kcontrol/arts/arts.cpp @@ -0,0 +1,730 @@ +/* + + Copyright (C) 2000 Stefan Westerfeld + stefan@space.twc.de + + 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + Permission is also granted to link this program with the Qt + library, treating Qt like a library that normally accompanies the + operating system kernel, whether or not that is in fact the case. + +*/ + +#include <unistd.h> + +#include <qcombobox.h> +#include <qdir.h> +#include <qlayout.h> +#include <qpushbutton.h> +#include <qregexp.h> +#include <qslider.h> +#include <qtabwidget.h> +#include <qwhatsthis.h> + +#include <dcopref.h> + +#include <kaboutdata.h> +#include <kapplication.h> +#include <kcmoduleloader.h> +#include <kdebug.h> +#include <kdialog.h> +#include <klineedit.h> +#include <kmessagebox.h> +#include <kprocess.h> +#include <krichtextlabel.h> +#include <ksimpleconfig.h> +#include <kstandarddirs.h> +#include <kurlrequester.h> +#include <libkmid/deviceman.h> + +#include "arts.h" + +extern "C" { + KDE_EXPORT void init_arts(); + + KDE_EXPORT KCModule *create_arts(QWidget *parent, const char* /*name*/) + { + KGlobal::locale()->insertCatalogue("kcmarts"); + return new KArtsModule(parent, "kcmarts" ); + } +} + +static bool startArts() +{ + KConfig *config = new KConfig("kcmartsrc", true, false); + + config->setGroup("Arts"); + bool startServer = config->readBoolEntry("StartServer",true); + bool startRealtime = config->readBoolEntry("StartRealtime",true); + QString args = config->readEntry("Arguments","-F 10 -S 4096 -s 60 -m artsmessage -c drkonqi -l 3 -f"); + + delete config; + + if (startServer) + kapp->kdeinitExec(startRealtime?"artswrapper":"artsd", + QStringList::split(" ",args)); + return startServer; +} + +/* + * This function uses artsd -A to init audioIOList with the possible audioIO + * methods. Here is a sample output of artsd -A (note the two spaces before + * each "interesting" line are used in parsing: + * + * # artsd -A + * possible choices for the audio i/o method: + * + * toss Threaded Open Sound System + * esd Enlightened Sound Daemon + * null No audio input/output + * alsa Advanced Linux Sound Architecture + * oss Open Sound System + * + */ +void KArtsModule::initAudioIOList() +{ + KProcess* artsd = new KProcess(); + *artsd << "artsd"; + *artsd << "-A"; + + connect(artsd, SIGNAL(processExited(KProcess*)), + this, SLOT(slotArtsdExited(KProcess*))); + connect(artsd, SIGNAL(receivedStderr(KProcess*, char*, int)), + this, SLOT(slotProcessArtsdOutput(KProcess*, char*, int))); + + if (!artsd->start(KProcess::Block, KProcess::Stderr)) { + KMessageBox::error(0, i18n("Unable to start the sound server to " + "retrieve possible sound I/O methods.\n" + "Only automatic detection will be " + "available.")); + delete artsd; + } +} + +void KArtsModule::slotArtsdExited(KProcess* proc) +{ + latestProcessStatus = proc->exitStatus(); + delete proc; +} + +void KArtsModule::slotProcessArtsdOutput(KProcess*, char* buf, int len) +{ + // XXX(gioele): I suppose this will be called with full lines, am I wrong? + + QStringList availableIOs = QStringList::split("\n", QCString(buf, len)); + // valid entries have two leading spaces + availableIOs = availableIOs.grep(QRegExp("^ {2}")); + availableIOs.sort(); + + QString name, fullName; + QStringList::Iterator it; + for (it = availableIOs.begin(); it != availableIOs.end(); ++it) { + name = (*it).left(12).stripWhiteSpace(); + fullName = (*it).mid(12).stripWhiteSpace(); + audioIOList.append(new AudioIOElement(name, fullName)); + } +} + +KArtsModule::KArtsModule(QWidget *parent, const char *name) + : KCModule(parent, name), configChanged(false) +{ + setButtons(Default|Apply); + + setQuickHelp( i18n("<h1>Sound System</h1> Here you can configure aRts, KDE's sound server." + " This program not only allows you to hear your system sounds while simultaneously" + " listening to an MP3 file or playing a game with background music. It also allows you" + " to apply different effects to your system sounds and provides programmers with" + " an easy way to achieve sound support.")); + + initAudioIOList(); + + QVBoxLayout *layout = new QVBoxLayout(this, 0, KDialog::spacingHint()); + QTabWidget *tab = new QTabWidget(this); + layout->addWidget(tab); + + general = new generalTab(tab); + hardware = new hardwareTab(tab); + //mixer = KCModuleLoader::loadModule("kmixcfg", tab); + //midi = new KMidConfig(tab, "kmidconfig"); + + general->layout()->setMargin( KDialog::marginHint() ); + hardware->layout()->setMargin( KDialog::marginHint() ); + general->latencyLabel->setFixedHeight(general->latencyLabel->fontMetrics().lineSpacing()); + + tab->addTab(general, i18n("&General")); + tab->addTab(hardware, i18n("&Hardware")); + + startServer = general->startServer; + networkTransparent = general->networkTransparent; + startRealtime = general->startRealtime; + autoSuspend = general->autoSuspend; + suspendTime = general->suspendTime; + + fullDuplex = hardware->fullDuplex; + customDevice = hardware->customDevice; + deviceName = hardware->deviceName; + customRate = hardware->customRate; + samplingRate = hardware->samplingRate; + + QString deviceHint = i18n("Normally, the sound server defaults to using the device called <b>/dev/dsp</b> for sound output. That should work in most cases. On some systems where devfs is used, however, you may need to use <b>/dev/sound/dsp</b> instead. Other alternatives are things like <b>/dev/dsp0</b> or <b>/dev/dsp1</b>, if you have a soundcard that supports multiple outputs, or you have multiple soundcards."); + + QString rateHint = i18n("Normally, the sound server defaults to using a sampling rate of 44100 Hz (CD quality), which is supported on almost any hardware. If you are using certain <b>Yamaha soundcards</b>, you might need to configure this to 48000 Hz here, if you are using <b>old SoundBlaster cards</b>, like SoundBlaster Pro, you might need to change this to 22050 Hz. All other values are possible, too, and may make sense in certain contexts (i.e. professional studio equipment)."); + + QString optionsHint = i18n("This configuration module is intended to cover almost every aspect of the aRts sound server that you can configure. However, there are some things which may not be available here, so you can add <b>command line options</b> here which will be passed directly to <b>artsd</b>. The command line options will override the choices made in the GUI. To see the possible choices, open a Konsole window, and type <b>artsd -h</b>."); + + QWhatsThis::add(customDevice, deviceHint); + QWhatsThis::add(deviceName, deviceHint); + QWhatsThis::add(customRate, rateHint); + QWhatsThis::add(samplingRate, rateHint); + QWhatsThis::add(hardware->customOptions, optionsHint); + QWhatsThis::add(hardware->addOptions, optionsHint); + + hardware->audioIO->insertItem( i18n( "Autodetect" ) ); + for (AudioIOElement *a = audioIOList.first(); a != 0; a = audioIOList.next()) + hardware->audioIO->insertItem(i18n(a->fullName.utf8())); + + deviceManager = new DeviceManager(); + deviceManager->initManager(); + + QString s; + for ( int i = 0; i < deviceManager->midiPorts()+deviceManager->synthDevices(); i++) + { + if ( strcmp( deviceManager->type( i ), "" ) != 0 ) + s.sprintf( "%s - %s", deviceManager->name( i ), deviceManager->type( i ) ); + else + s.sprintf( "%s", deviceManager->name( i ) ); + + hardware->midiDevice->insertItem( s, i ); + + }; + + config = new KConfig("kcmartsrc"); + load(); + + suspendTime->setRange( 1, 999, 1, true ); + + connect(startServer,SIGNAL(clicked()),this,SLOT(slotChanged())); + connect(networkTransparent,SIGNAL(clicked()),this,SLOT(slotChanged())); + connect(startRealtime,SIGNAL(clicked()),this,SLOT(slotChanged())); + connect(fullDuplex,SIGNAL(clicked()),this,SLOT(slotChanged())); + connect(customDevice, SIGNAL(clicked()), SLOT(slotChanged())); + connect(deviceName, SIGNAL(textChanged(const QString&)), SLOT(slotChanged())); + connect(customRate, SIGNAL(clicked()), SLOT(slotChanged())); + connect(samplingRate, SIGNAL(valueChanged(const QString&)), SLOT(slotChanged())); +// connect(general->volumeSystray, SIGNAL(clicked()), this, SLOT(slotChanged()) ); + + connect(hardware->audioIO,SIGNAL(highlighted(int)),SLOT(slotChanged())); + connect(hardware->audioIO,SIGNAL(activated(int)),SLOT(slotChanged())); + connect(hardware->customOptions,SIGNAL(clicked()),SLOT(slotChanged())); + connect(hardware->addOptions,SIGNAL(textChanged(const QString&)),SLOT(slotChanged())); + connect(hardware->soundQuality,SIGNAL(highlighted(int)),SLOT(slotChanged())); + connect(hardware->soundQuality,SIGNAL(activated(int)),SLOT(slotChanged())); + connect(general->latencySlider,SIGNAL(valueChanged(int)),SLOT(slotChanged())); + connect(autoSuspend,SIGNAL(clicked()),SLOT(slotChanged())); + connect(suspendTime,SIGNAL(valueChanged(int)),SLOT(slotChanged())); + connect(general->testSound,SIGNAL(clicked()),SLOT(slotTestSound())); + connect(hardware->midiDevice, SIGNAL( highlighted(int) ), this, SLOT( slotChanged() ) ); + connect(hardware->midiDevice, SIGNAL( activated(int) ), this, SLOT( slotChanged() ) ); + connect(hardware->midiUseMapper, SIGNAL( clicked() ), this, SLOT( slotChanged() ) ); + connect(hardware->midiMapper, SIGNAL( textChanged( const QString& ) ), + this, SLOT( slotChanged() ) ); + + KAboutData *about = new KAboutData(I18N_NOOP("kcmarts"), + I18N_NOOP("The Sound Server Control Module"), + 0, 0, KAboutData::License_GPL, + I18N_NOOP("(c) 1999 - 2001, Stefan Westerfeld")); + about->addAuthor("Stefan Westerfeld",I18N_NOOP("aRts Author") , "stw@kde.org"); + setAboutData(about); +} + +void KArtsModule::load( bool useDefaults ) +{ + config->setReadDefaults( useDefaults ); + config->setGroup("Arts"); + startServer->setChecked(config->readBoolEntry("StartServer",true)); + startRealtime->setChecked(config->readBoolEntry("StartRealtime",true) && + realtimeIsPossible()); + networkTransparent->setChecked(config->readBoolEntry("NetworkTransparent",false)); + fullDuplex->setChecked(config->readBoolEntry("FullDuplex",false)); + autoSuspend->setChecked(config->readBoolEntry("AutoSuspend",true)); + suspendTime->setValue(config->readNumEntry("SuspendTime",60)); + deviceName->setText(config->readEntry("DeviceName",QString::null)); + customDevice->setChecked(!deviceName->text().isEmpty()); + hardware->addOptions->setText(config->readEntry("AddOptions",QString::null)); + hardware->customOptions->setChecked(!hardware->addOptions->text().isEmpty()); + general->latencySlider->setValue(config->readNumEntry("Latency",250)); + + int rate = config->readNumEntry("SamplingRate",0); + if(rate) + { + customRate->setChecked(true); + samplingRate->setValue(rate); + } + else + { + customRate->setChecked(false); + samplingRate->setValue(44100); + } + + switch (config->readNumEntry("Bits", 0)) { + case 0: + hardware->soundQuality->setCurrentItem(0); + break; + case 16: + hardware->soundQuality->setCurrentItem(1); + break; + case 8: + hardware->soundQuality->setCurrentItem(2); + break; + } + + QString audioIO = config->readEntry("AudioIO", QString::null); + hardware->audioIO->setCurrentItem(0); + for(AudioIOElement *a = audioIOList.first(); a != 0; a = audioIOList.next()) + { + if(a->name == audioIO) // first item: "autodetect" + { + hardware->audioIO->setCurrentItem(audioIOList.at() + 1); + break; + } + + } + +// config->setGroup( "Mixer" ); +// general->volumeSystray->setChecked( config->readBoolEntry( "VolumeControlOnSystray", true ) ); + + KConfig *midiConfig = new KConfig( "kcmmidirc", true ); + + midiConfig->setGroup( "Configuration" ); + hardware->midiDevice->setCurrentItem( midiConfig->readNumEntry( "midiDevice", 0 ) ); + QString mapurl( midiConfig->readPathEntry( "mapFilename" ) ); + hardware->midiMapper->setURL( mapurl ); + hardware->midiUseMapper->setChecked( midiConfig->readBoolEntry( "useMidiMapper", false ) ); + hardware->midiMapper->setEnabled( hardware->midiUseMapper->isChecked() ); + + delete midiConfig; + + updateWidgets(); + emit changed( useDefaults ); +} + +KArtsModule::~KArtsModule() { + delete config; + audioIOList.setAutoDelete(true); + audioIOList.clear(); +} + +void KArtsModule::saveParams( void ) +{ + QString audioIO; + + int item = hardware->audioIO->currentItem() - 1; // first item: "default" + + if (item >= 0) { + audioIO = audioIOList.at(item)->name; + } + + QString dev = customDevice->isChecked() ? deviceName->text() : QString::null; + int rate = customRate->isChecked()?samplingRate->value() : 0; + QString addOptions; + if(hardware->customOptions->isChecked()) + addOptions = hardware->addOptions->text(); + + int latency = general->latencySlider->value(); + int bits = 0; + + if (hardware->soundQuality->currentItem() == 1) + bits = 16; + else if (hardware->soundQuality->currentItem() == 2) + bits = 8; + + config->setGroup("Arts"); + config->writeEntry("StartServer",startServer->isChecked()); + config->writeEntry("StartRealtime",startRealtime->isChecked()); + config->writeEntry("NetworkTransparent",networkTransparent->isChecked()); + config->writeEntry("FullDuplex",fullDuplex->isChecked()); + config->writeEntry("DeviceName",dev); + config->writeEntry("SamplingRate",rate); + config->writeEntry("AudioIO",audioIO); + config->writeEntry("AddOptions",addOptions); + config->writeEntry("Latency",latency); + config->writeEntry("Bits",bits); + config->writeEntry("AutoSuspend", autoSuspend->isChecked()); + config->writeEntry("SuspendTime", suspendTime->value()); + calculateLatency(); + // Save arguments string in case any other process wants to restart artsd. + + config->writeEntry("Arguments", + createArgs(networkTransparent->isChecked(), fullDuplex->isChecked(), + fragmentCount, fragmentSize, dev, rate, bits, + audioIO, addOptions, autoSuspend->isChecked(), + suspendTime->value() )); + +// config->setGroup( "Mixer" ); +// config->writeEntry( "VolumeControlOnSystray", general->volumeSystray->isChecked() ); + + KConfig *midiConfig = new KConfig( "kcmmidirc", false ); + + midiConfig->setGroup( "Configuration" ); + midiConfig->writeEntry( "midiDevice", hardware->midiDevice->currentItem() ); + midiConfig->writeEntry( "useMidiMapper", hardware->midiUseMapper->isChecked() ); + midiConfig->writePathEntry( "mapFilename", hardware->midiMapper->url() ); + + delete midiConfig; + + KConfig *knotifyConfig = new KConfig( "knotifyrc", false ); + + knotifyConfig->setGroup( "StartProgress" ); + knotifyConfig->writeEntry( "Arts Init", startServer->isChecked() ); + knotifyConfig->writeEntry( "Use Arts", startServer->isChecked() ); + + delete knotifyConfig; + + config->sync(); +} + +void KArtsModule::load() +{ + load( false ); +} + +void KArtsModule::save() +{ + if (configChanged) { + configChanged = false; + saveParams(); + restartServer(); + updateWidgets(); + } + emit changed( false ); +} + +int KArtsModule::userSavedChanges() +{ + int reply; + + if (!configChanged) + return KMessageBox::Yes; + + QString question = i18n("The settings have changed since the last time " + "you restarted the sound server.\n" + "Do you want to save them?"); + QString caption = i18n("Save Sound Server Settings?"); + reply = KMessageBox::questionYesNo(this, question, caption,KStdGuiItem::save(),KStdGuiItem::discard()); + if ( reply == KMessageBox::Yes) + { + configChanged = false; + saveParams(); + } + + return reply; +} + +void KArtsModule::slotTestSound() +{ + if (configChanged && (userSavedChanges() == KMessageBox::Yes) || !artsdIsRunning() ) + restartServer(); + + KProcess test; + test << "artsplay"; + test << locate("sound", "KDE_Startup_1.ogg"); + test.start(KProcess::DontCare); +} + +void KArtsModule::defaults() +{ + load( true ); +} + +void KArtsModule::calculateLatency() +{ + int latencyInBytes, latencyInMs; + + if(general->latencySlider->value() < 490) + { + int rate = customRate->isChecked() ? samplingRate->text().toLong() : 44100; + + if (rate < 4000 || rate > 200000) { + rate = 44100; + } + + int sampleSize = (hardware->soundQuality->currentItem() == 2) ? 2 : 4; + + latencyInBytes = general->latencySlider->value()*rate*sampleSize/1000; + + fragmentSize = 2; + do { + fragmentSize *= 2; + fragmentCount = latencyInBytes / fragmentSize; + } while (fragmentCount > 8 && fragmentSize != 4096); + + latencyInMs = (fragmentSize*fragmentCount*1000) / rate / sampleSize; + general->latencyLabel->setText( + i18n("%1 milliseconds (%2 fragments with %3 bytes)") + .arg(latencyInMs).arg(fragmentCount).arg(fragmentSize)); + } + else + { + fragmentCount = 128; + fragmentSize = 8192; + general->latencyLabel->setText(i18n("as large as possible")); + } +} + +void KArtsModule::updateWidgets() +{ + bool startServerIsChecked = startServer->isChecked(); + if (startRealtime->isChecked() && !realtimeIsPossible()) { + startRealtime->setChecked(false); + KMessageBox::error(this, i18n("Impossible to start aRts with realtime " + "priority because artswrapper is " + "missing or disabled")); + } + deviceName->setEnabled(customDevice->isChecked()); + QString audioIO; + int item = hardware->audioIO->currentItem() - 1; // first item: "default" + if (item >= 0) + { + audioIO = audioIOList.at(item)->name; + bool jack = (audioIO == QString::fromLatin1("jack")); + if(jack) + { + customRate->setChecked(false); + hardware->soundQuality->setCurrentItem(0); + autoSuspend->setChecked(false); + } + customRate->setEnabled(!jack); + hardware->soundQuality->setEnabled(!jack); + autoSuspend->setEnabled(!jack); + } + samplingRate->setEnabled(customRate->isChecked()); + hardware->addOptions->setEnabled(hardware->customOptions->isChecked()); + suspendTime->setEnabled(autoSuspend->isChecked()); + calculateLatency(); + + general->testSound->setEnabled(startServerIsChecked); + +// general->volumeSystray->setEnabled(startServerIsChecked); + general->networkedSoundGroupBox->setEnabled(startServerIsChecked); + general->realtimeGroupBox->setEnabled(startServerIsChecked); + general->autoSuspendGroupBox->setEnabled(startServerIsChecked); + hardware->setEnabled(startServerIsChecked); + hardware->midiMapper->setEnabled( hardware->midiUseMapper->isChecked() ); +} + +void KArtsModule::slotChanged() +{ + updateWidgets(); + configChanged = true; + emit changed(true); +} + +/* check if starting realtime would be possible */ +bool KArtsModule::realtimeIsPossible() +{ + static bool checked = false; + if (!checked) + { + KProcess* checkProcess = new KProcess(); + *checkProcess << "artswrapper"; + *checkProcess << "check"; + + connect(checkProcess, SIGNAL(processExited(KProcess*)), + this, SLOT(slotArtsdExited(KProcess*))); + if (!checkProcess->start(KProcess::Block)) + { + delete checkProcess; + realtimePossible = false; + } + else if (latestProcessStatus == 0) + { + realtimePossible = true; + } + else + { + realtimePossible = false; + } + + checked = true; + + } + return realtimePossible; +} + +void KArtsModule::restartServer() +{ + config->setGroup("Arts"); + bool starting = config->readBoolEntry("StartServer", true); + bool restarting = artsdIsRunning(); + + // Shut down knotify + DCOPRef("knotify", "qt/knotify").send("quit"); + + // Shut down artsd + KProcess terminateArts; + terminateArts << "artsshell"; + terminateArts << "terminate"; + terminateArts.start(KProcess::Block); + + if (starting) + { + // Wait for artsd to shutdown completely and then (re)start artsd again + KStartArtsProgressDialog dlg(this, "start_arts_progress", + restarting ? i18n("Restarting Sound System") : i18n("Starting Sound System"), + restarting ? i18n("Restarting sound system.") : i18n("Starting sound system.")); + dlg.exec(); + } + + // Restart knotify + kapp->startServiceByDesktopName("knotify"); +} + +bool KArtsModule::artsdIsRunning() +{ + KProcess check; + check << "artsshell"; + check << "status"; + check.start(KProcess::Block); + + return (check.exitStatus() == 0); +} + + +void init_arts() +{ + startArts(); +} + +QString KArtsModule::createArgs(bool netTrans, + bool duplex, int fragmentCount, + int fragmentSize, + const QString &deviceName, + int rate, int bits, const QString &audioIO, + const QString &addOptions, bool autoSuspend, + int suspendTime + ) +{ + QString args; + + if(fragmentCount) + args += QString::fromLatin1(" -F %1").arg(fragmentCount); + + if(fragmentSize) + args += QString::fromLatin1(" -S %1").arg(fragmentSize); + + if (!audioIO.isEmpty()) + args += QString::fromLatin1(" -a %1").arg(audioIO); + + if (duplex) + args += QString::fromLatin1(" -d"); + + if (netTrans) + args += QString::fromLatin1(" -n"); + + if (!deviceName.isEmpty()) + args += QString::fromLatin1(" -D ") + deviceName; + + if (rate) + args += QString::fromLatin1(" -r %1").arg(rate); + + if (bits) + args += QString::fromLatin1(" -b %1").arg(bits); + + if (autoSuspend && suspendTime) + args += QString::fromLatin1(" -s %1").arg(suspendTime); + + if (!addOptions.isEmpty()) + args += QChar(' ') + addOptions; + + args += QString::fromLatin1(" -m artsmessage"); + args += QString::fromLatin1(" -c drkonqi"); + args += QString::fromLatin1(" -l 3"); + args += QString::fromLatin1(" -f"); + + return args; +} + +KStartArtsProgressDialog::KStartArtsProgressDialog(KArtsModule *parent, const char *name, + const QString &caption, const QString &text) + : KProgressDialog(parent, name, caption, text, true), m_module(parent), m_shutdown(false) +{ + connect(&m_timer, SIGNAL(timeout()), this, SLOT(slotProgress())); + progressBar()->setTotalSteps(20); + m_timeStep = 700; + m_timer.start(m_timeStep); + setAutoClose(false); +} + +void +KStartArtsProgressDialog::slotProgress() +{ + int p = progressBar()->progress(); + if (p == 18) + { + progressBar()->reset(); + progressBar()->setProgress(1); + m_timeStep = m_timeStep * 2; + m_timer.start(m_timeStep); + } + else + { + progressBar()->setProgress(p+1); + } + + if (!m_shutdown) + { + // Wait for arts to shutdown + if (!m_module->artsdIsRunning()) + { + // Shutdown complete, restart + if (!startArts()) + slotFinished(); // Strange, it didn't start + else + m_shutdown = true; + } + } + + // Shut down completed? Wait for artsd to come up again + if (m_shutdown && m_module->artsdIsRunning()) + slotFinished(); // Restart complete +} + +void +KStartArtsProgressDialog::slotFinished() +{ + progressBar()->setProgress(20); + m_timer.stop(); + QTimer::singleShot(1000, this, SLOT(close())); +} + + +#ifdef I18N_ONLY + //lukas: these are hacks to allow translation of the following + I18N_NOOP("No Audio Input/Output"); + I18N_NOOP("Advanced Linux Sound Architecture"); + I18N_NOOP("Open Sound System"); + I18N_NOOP("Threaded Open Sound System"); + I18N_NOOP("Network Audio System"); + I18N_NOOP("Personal Audio Device"); + I18N_NOOP("SGI dmedia Audio I/O"); + I18N_NOOP("Sun Audio Input/Output"); + I18N_NOOP("Portable Audio Library"); + I18N_NOOP("Enlightened Sound Daemon"); + I18N_NOOP("MAS Audio Input/Output"); + I18N_NOOP("Jack Audio Connection Kit"); +#endif + +#include "arts.moc" diff --git a/kcontrol/arts/arts.desktop b/kcontrol/arts/arts.desktop new file mode 100644 index 000000000..cb7f28b61 --- /dev/null +++ b/kcontrol/arts/arts.desktop @@ -0,0 +1,240 @@ +[Desktop Entry] +Exec=kcmshell arts +Icon=arts +Type=Application +DocPath=kcontrol/arts/index.html + + +X-KDE-Library=arts +X-KDE-Init=arts +X-KDE-ParentApp=kcontrol + +Name=Sound System +Name[af]=Klank Stelsel +Name[ar]=نظام الصوت +Name[az]=Səs Sistemi +Name[be]=Гукавая сістэма +Name[bg]=Аудио система +Name[bn]=সাউণ্ড সিস্টেম +Name[br]=Reizhiad Son +Name[bs]=Zvučni sistem +Name[ca]=Sistema de so +Name[cs]=Zvukový systém +Name[csb]=Zwãkòwô systema +Name[cy]=System Sain +Name[da]=Lydsystem +Name[de]=Sound-System +Name[el]=Σύστημα ήχου +Name[eo]=Sona Sistemo +Name[es]=Sistema de sonido +Name[et]=Helisüsteem +Name[eu]=Soinu sistema +Name[fa]=سیستم صوتی +Name[fi]=Äänijärjestelmä +Name[fr]=Système de sons +Name[fy]=Lûdssysteem +Name[ga]=Córas Fuaime +Name[gl]=Sistema de Son +Name[he]=מערכת צליל +Name[hi]=ध्वनि तंत्र +Name[hr]=Zvučni sustav +Name[hu]=Hangszolgáltatás +Name[id]=Sistem Suara +Name[is]=Hljóðkerfi +Name[it]=Sistema sonoro +Name[ja]=サウンドシステム +Name[ka]=ხმის სისტემა +Name[kk]=Дыбыс жүйесі +Name[km]=ប្រព័ន្ធសំឡេង +Name[lo]=ແບບModSystem +Name[lt]=Garso sistema +Name[lv]=Skaņas Sistēma +Name[mk]=Звучен систем +Name[mn]=Дуун-Систем +Name[ms]=Sistem Bunyi +Name[mt]=Sistema Awdjo +Name[nb]=Lydsystem +Name[nds]=Klangsysteem +Name[ne]=ध्वनि प्रणाली +Name[nl]=Geluidssysteem +Name[nn]=Lydsystem +Name[nso]=System ya Modumo +Name[pa]=ਧੁਨੀ ਸਿਸਟਮ +Name[pl]=System dźwiękowy +Name[pt]=Sistema de Som +Name[pt_BR]=Sistema de Som +Name[ro]=Sistemul de sunet +Name[ru]=Звуковая система +Name[rw]=Sistemu y'Ijwi +Name[se]=Jietnavuogádat +Name[sk]=Zvukový systém +Name[sl]=Zvočni sistem +Name[sr]=Звучни систем +Name[sr@Latn]=Zvučni sistem +Name[sv]=Ljudsystem +Name[ta]=ஒலி சாதனம் +Name[te]=శబ్ద వ్యవస్థ +Name[tg]=Системаи Садо +Name[th]=ระบบเสียง +Name[tr]=Ses Sistemi +Name[tt]=Tawış Sisteme +Name[uk]=Система звуку +Name[uz]=Tovush tizimi +Name[uz@cyrillic]=Товуш тизими +Name[ven]=Sisitemu ya Mubvumo +Name[vi]=Hệ thống âm thanh +Name[wa]=Sistinme di son +Name[xh]=Indlela yokusebenza Yesandi +Name[zh_CN]=声音系统 +Name[zh_TW]=聲音系統 +Name[zu]=Isistimu yomsindo + +Comment=Sound System Configuration +Comment[af]=Klank Stelsel Opstelling +Comment[ar]=إعداد نظام الصوت +Comment[az]=Səs Sistemi Qurğuları +Comment[be]=Настаўленні гукавай сістэмы +Comment[bg]=Настройване на аудио системата +Comment[bn]=সাউণ্ড সিস্টেম কনফিগারেশন +Comment[br]=Kefluniañ reizhiad ar son +Comment[bs]=Postavke zvučnog sistema +Comment[ca]=Configuració del sistema de so +Comment[cs]=Nastavení zvukového systému +Comment[csb]=Kònfigùracëjô zwãkòwi systemë +Comment[cy]=Ffurfweddu System Sain +Comment[da]=Opsætning af lydsystem +Comment[de]=Einrichtung des Sound-Systems +Comment[el]=Ρύθμιση συστήματος ήχου +Comment[eo]=Agordo de la sonoservo +Comment[es]=Configuración del sistema de sonido +Comment[et]=Helisüsteemi seadistamine +Comment[eu]=Soinu sistemaren konfigurazioa +Comment[fa]=پیکربندی سیستم صوتی +Comment[fi]=Äänijärjestelmän asetukset +Comment[fr]=Configuration du système de sons +Comment[fy]=Lûdssysteem Ynstelle +Comment[ga]=Cumraíocht an Chórais Fuaime +Comment[gl]=Configuración do Sistema de Son +Comment[he]=שינוי הגדרות מערכת הצליל +Comment[hi]=ध्वनि तंत्र कॉन्फ़िगरेशन +Comment[hr]=Konfiguracija zvučnog sustava +Comment[hu]=A hangszolgáltatás beállításai +Comment[id]=Konfigurasi Sistem Suara +Comment[is]=Stillingar hljóðkerfis vélarinnar +Comment[it]=Configurazione del sistema sonoro +Comment[ja]=サウンドシステムの設定 +Comment[ka]=ხმის სისტემის კონფიგურაცია +Comment[kk]=Дыбыс жүйесін баптау +Comment[km]=ការកំណត់រចនាសម្ព័ន្ធប្រព័ន្ធសំឡេង +Comment[ko]=시스템 종소리 설정 +Comment[lo]=ປັບແຕ່ງເຊີບເວີຂອງລະບົບສງງ +Comment[lt]=Garso sistemos konfigūravimas +Comment[lv]=Skaņas sistēmas konfigurācija +Comment[mk]=Конфигурација на звучниот систем +Comment[mn]=Дууны-системийн тохируулга +Comment[ms]=Konfigurasi Sistem Bunyi +Comment[mt]=Konfigurazzjoni tas-Sound +Comment[nb]=Oppsett av lydsystemet +Comment[nds]=Instellen för dat Klangsysteem +Comment[ne]=ध्वनि प्रणाली कन्फिगरेसन +Comment[nl]=Geluidssysteem instellen +Comment[nn]=Oppsett av lydsystem +Comment[nso]=Peakanyo ya System ya Modumo +Comment[pa]=ਧੁਨੀ ਸਿਸਟਮ ਸੰਰਚਨਾ +Comment[pl]=Konfiguracja systemu dźwiękowego +Comment[pt]=Configuração do Sistema de Som +Comment[pt_BR]=Configuração do Sistema de Som +Comment[ro]=Configurează sistemul de sunet +Comment[ru]=Настройка звуковой системы +Comment[rw]=Iboneza rya Sisitemu y'Ijwi +Comment[se]=Jietnavuogádatheivehusat +Comment[sk]=Nastavenie zvukového systému +Comment[sl]=Nastavitve zvočnega sistema +Comment[sr]=Подешавање звучног система +Comment[sr@Latn]=Podešavanje zvučnog sistema +Comment[sv]=Anpassa ljudsystem +Comment[ta]=ஒலி சாதன அமைப்பு +Comment[te]=శబ్ద వ్యవస్థ అమరిక +Comment[tg]=Танзимоти системаи садо +Comment[th]=ปรับแต่งระบบเสียง +Comment[tr]=Ses Sistemi Yapılandırması +Comment[tt]=Tawış Sistemen Caylaw +Comment[uk]=Налаштування системи звуку +Comment[uz]=Tovush tizimini moslash +Comment[uz@cyrillic]=Товуш тизимини мослаш +Comment[ven]=Nzudzanyo ya sisitemu ya mubvumo +Comment[vi]=Cấu hình Hệ thống Âm thanh +Comment[wa]=Apontiaedje do sistinme di son +Comment[xh]=Uqwalaselo Lwendlela yokusebenza Yesandi +Comment[zh_CN]=声音系统配置 +Comment[zh_TW]=聲音系統組態 +Comment[zu]=Inhlanganiselo yesistimu yomsindo + +Keywords=aRts,Sound Server,artsd,Audio,Sound,startup,network transparency,transparency,priority,duplex,full duplex,response time,Mixer,Volume,KMix,Mix,login,MIDI,synthesizer,music +Keywords[az]=aRts,Sound Server,artsd,Audio,Sound,startup,network transparency,transparency,priority,duplex,full duplex,response time,Mixer,Volume,KMix,Mix,login,MIDI,synthesizer,music, şəbəkə keçirgənliyi,keçirəenlik,üstünlük,dubleks,tam dubleks,qarşılıq müddəti +Keywords[be]=Гукавы сервер,гук,аўдыё,запуск,празрыстасць,сеткавая празрыстасць,прыярытэт,дуплекс,поўны дуплекс,час адказу,мікшэр,гучнасць,уваход,сінтэзатар,музыка,aRts,Sound Server,artsd,Audio,Sound,startup,network transparency,transparency,priority,duplex,full duplex,response time,Mixer,Volume,KMix,Mix,login,MIDI,synthesizer,music +Keywords[bg]=аудио, звук, музика, aRts, Sound Server, artsd, Audio, Sound, startup, network transparency, transparency, priority, duplex, full duplex, response time, Mixer, Volume, KMix, Mix, login, MIDI, synthesizer, music +Keywords[ca]=aRts,Servidor de so,artsd,Àudio,So,engegada,transparència a xarxa,transparència,prioritat,duplex,full duplex,temps de resposta,Mesclador,Volum,KMix,Mix,accés,MIDI,sintetitzador,música +Keywords[cs]=aRts,Zvukový server,Zvuk,artsd,Audio,Spuštění,Priorita,Duplex, Plný duplex,Odezva,Směšovač,KMix,Přihlášení,MIDI,Hudba,Syntezátor,Hlasitost +Keywords[csb]=aRts, zwãkòwi serwer,artsd,Audio,Zwãk,zrësznié,przezérnota dlô séce,przezérnota,prioritet,dupleks,fùl dupleks,czas odpòwiesce,mikser,głosnosc, KMix,Mix,logòwanié,MIDI,syntezator,mùzyka,rozpòczãce robòtë +Keywords[cy]=aRTS,Gweinydd Sain,artsd,S?n,Sain,cychwyn,tryloywder rhwydwaith,tryloywder,blaenoriaeth,dyblyg,dyblyg llawn,amser ymateb,cymysgwr,sain,Kmix,Cymysgu,mewngofnodi,MIDI,syntheseisydd,cerdd +Keywords[da]=aRts,Lydserver,artsd,Audio,Lyd,opstart,netværksgennemsigtighed,prioritet,duplex,fuld duplex,svartid,Mixer,Lydstyrke,KMix,Mix,login,MIDI,synthesizer,musik +Keywords[de]=aRts,Soundserver,artsd,Audio,Klänge,Sound,Start,Netzwerktransparenz,Transparenz,Duplex,Voll-Duplex,Reaktionszeit,Priorität,Antwortzeit,Lautstärke, KMix,Mix,MIDI,Synthesizer,Musik,Anmeldung +Keywords[el]=aRts,Εξυπηρετητής ήχου,artsd,Ήχος,Ήχος,εκκίνηση,διαφάνεια δικτύου,διαφάνεια,προτεραιότητα,duplex,full duplex,χρόνος απόκρισης,Μείκτης,Ένταση,KMix,Μίξη,σύνδεση,MIDI,συνθεσάιζερ,μουσική +Keywords[en_GB]=aRts,Sound Server,artsd,Audio,Sound,startup,network transparency,transparency,priority,duplex,full duplex,response time,Mixer,Volume,KMix,Mix,login,MIDI,synthesiser,music +Keywords[eo]=aRts,sonoservo,sonoj,artsd,lanĉo,reto,prioritato,dudirekta,reagtempo,Miksilo,KMix,Mix,MIDI,muziko +Keywords[es]=aRts,Servidor de sonido,artsd,Audio,Sonido,arranque,transparencia de red,transparencia,prioridad,duplex,full duplex,tiempo de respuesta, tiempo,Mezclador,Volumen,KMix,Mix,acceso,MIDI,sintetizador,música +Keywords[et]=aRts,heliserver,artsd,audio,heli,käivitamine,võrgu läbipaistvus,läbipaistvus,prioriteet,duplex,full duplex,reageerimise aeg,mikser,helitugevus,kmix,mix,sisselogimine,MIDI,süntesaator,muusika +Keywords[eu]=aRts,Soinu zerbitzaria,artsd,Audio,Soinua,abioa,sare transparentzia,transparentzoa,lehentasuna,duplex,full duplex,erantzun denbora,Nahasgailua,Bolumena,KMix,Mix,sarrera,MIDI,sintetizagailua,musika +Keywords[fa]= aRts، کارساز صوت، artsd ،صوتی، صوت، راهاندازی، شفافیت شبکه شفافیت، اولویت، دوسویه، تمام دوسویه، زمان پاسخ، مخلوطکن، حجم صدا، KMix ،Mix ،ورود ،MIDI ،ترکیبکننده، موسیقی +Keywords[fi]=aRts,äänipalvelin,artsd,ääni,käynnistys,verkkoläpinäkyvyys, ,prioriteetti,duplex,full duplex,vasteaika,mikseri,äänenvoimakkuus,KMix,MIDI, syntetisaattori,musiikki +Keywords[fr]=aRts,son,serveur de son,serveur sonore,bruit,artsd,audio,démarrage,transparence réseau,transparence,priorité,duplex,full duplex,temps de réponse,mixeur,volume,KMix,Mix,login,MIDI,synthétiseur,musique +Keywords[fy]=aRts,Lûd tsjinner,artsd,audio,Lûd,lûdstsjinner,Begjinne,netwurk ,netwurktransparâsje,priority,prioriteit,duplex,full duplex,response tiid,responstiid,folume,KMix,kanalen,login,oanmelde,synthesizer,muzyk,mixer,midi, +Keywords[ga]=aRts,Freastalaí Fuaime,artsd,Fuaim,tosú,trédhearcacht líonra,trédhearcacht,tosaíocht,déphléacsach,déphléacsach iomlán,aga freagartha,Meascthóir,Airde,KMix,Measc,logáil isteach,MIDI,sintéiseoir,ceol +Keywords[gl]=aRts,Servidor de Son,artsd,Audio,Son,comezo,transparéncia de rede,transparéncia,prioridade,duplex,full duplex,tempo de resposta,Mesturador,Volume,KMix,login,MIDI,sintetizador,música +Keywords[he]=aRts,שרת צליל,artsd,שמע,צליל,אתחול,שקיפות רשת,שקיפות,עדיפות,דו־כיווניות,דו־כיווניות מלאה,זמן תגובה,מערבל,עצמה,KMix,כניסה למערכת,MIDI,מידי,סינתסייזר,מוזיקה, aRts,Sound, Server,artsd,Audio, Sound,startup,network transparency,transparency,priority,duplex,full duplex,response time,Mixer,Volume,KMix,Mix,login,MIDI,synthesizer,music +Keywords[hi]=ए-आरटीएस,ध्वनि सर्वर,एआरटीएसडी,ऑडियो,ध्वनि,स्टार्टअप,नेटवर्क ट्रांसपेरेंसी, ट्रांसपेरेंसी,प्राथमिकता,डुप्ले,फुल डुप्ले,प्रतिक्रिया समय,मिक्सर,आवाज़ निर्धारक,केमिक्स,मिक्स,लॉगइन,मिडी,सिंथेसाइजर,संगीत +Keywords[hr]=aRts,Sound Server,artsd,Audio,Sound,startup,network transparency,transparency,priority,duplex,full duplex,response time,Mixer,Volume,KMix,Mix,login,MIDI,synthesizer,music,zvučni sustav,zvuk,pokretanje,mrežna transparentnost,transparentnost,priorite,vrijeme odziva,mikser,glasnoća,prijava,prijavljivanje,glazba,sintetizator +Keywords[hu]=aRts,hangszolgáltatás,artsd,audió,hang,indulás,hálózati láthatóság,láthatóság,prioritás,duplex,full duplex,válaszidő,hangkeverő,hangerő,KMix,Mix,bejelentkezés,MIDI,szintetizátor,zene +Keywords[is]=aRts,hljóðþjónn,hljóðmiðlari,artsd,hljóð,hljóð stillingar,ræsing,net,forgangur,tvíátta,svartími,mixer,MIDI,músík +Keywords[it]=aRts,server sonoro,artsd,audio,suono,avvio,trasparenza di rete,trasparenza,priorità,duplex,full duplex,tempo di risposta,Mixer,Volume, KMix,login,MIDI,sintetizzatore,musica +Keywords[ja]=aRts,サウンドサーバ,artsd,オーディオ,サウンド,スタートアップ,ネットワーク透過,透過,優先度,二重,全二重,反応時間,ミキサー,音量,KMix,Mix.ログイン,MIDI,シンセサイザー,音楽 +Keywords[ka]=aRts,ხმის სერვერი,artsd,აუდიო,ხმა,ჩატვირთვა,ქსელის გამჭირვალობა,გამჭირვალობა,პრიორიტეტი,დუპლექსი,მთლიანი დუპლექსი,გამოხმაურების დრო,მიქსერი,ხმა,KMix,Mix,ავტორიზაცია,MIDI,სინთეზატორი,მუსიკა +Keywords[km]=aRts,ម៉ាស៊ីនបម្រើសំឡេង,artsd,អូឌីយ៉ូ,សំឡេង,ចាប់ផ្ដើម,ភាពថ្លារបស់បណ្ដាញ,ភាពថ្លា,អាទិភាព,ទ្វេ,ទ្វេទិស,រយៈពេលឆ្លើយតប,ឧបករណ៍លាយ,ទំហំសំឡេង,KMix,លាយ,ចូល,MIDI,synthesizer,តន្ត្រី +Keywords[lt]=aRts,Garsų serveris,Sound Server,artsd,Audio,Sound,garsas,startup,įkrova,network transparency,tinklo skaidrumas,transparency,skaidrumas,priority,prioritetas,duplex,dupleksas,full duplex,pilnas dupleksas,response time,reakcijos laikas +Keywords[lv]=aRts,Skaņas Serveris,artsd,Audio,Skaņa,palaišanās,tīkla caurspīdīgums,caurspīdīgums,prioritāte,duplekss,pilns duplekss,atbildes laiks,Mikseris,Skaļums,KMix,Mix,login,MIDI,sintizators,mūzika +Keywords[mk]=aRts,Sound Server,artsd,Audio,Sound,startup,network transparency,transparency,priority,duplex,full duplex,response time,Mixer,Volume,KMix,Mix,login,MIDI,synthesizer,music,Звучен сервер,Аудио,Звук,старт,мрежна транспарентност,транспарентност,приоритет,дуплекс,цел дуплекс,време на одговор,Миксер,Гласност,најава,синтисајзер,музика +Keywords[mn]=aRts,Дууны сервер,artsd,Дуу,Чимээ,Дуун,Эхлэл,Сүлжээ- Тунгалаг,Тунгалаг,Давхар,Бүтэн давхар,Хариулах хугацаа, Эрх,Дууны чанга, KMix,Mix,MIDI,Synthesizer,Хөгжим,Бүртгэл +Keywords[nb]=aRts,lydtjener,artsd,lyd,audio,oppstart,nettverkstransparens,transparens,prioritet,dupleks,full dupleks,svartid,responstid,mikser,volum,lydstyrke,KMix,innlogging,synt,musikk +Keywords[nds]=aRts,Sound Server,Klangserver,artsd,Audio,Klang,Kläng,Hoochfohren,Nettwarktransparenz,Transparenz,Prioriteet,duplex,vull duplex,Antwoorttiet,Mischer,Luutstärk,KMix,mischen,anmellen,MIDI,synthesizer,Musik,Klangteler +Keywords[ne]=aRts, ध्वनि सर्भर, artsd, अडियो, ध्वनि, सुरुआत, सञ्जाल पारदर्शिता, पारदर्शिता, प्राथमिकता, डुप्लेक्स, पूरा डुप्लेक्स, प्रतिक्रिया समय, मिश्रक, भोल्युम, KMix, मिश्रण, लगइन, MIDI, संश्लेषक, सङ्गीत +Keywords[nl]=aRts,sound server,artsd,audio,sound,geluidsserver,geluid,opstarten,netwerk ,netwerktransparantie,priority,prioriteit,duplex,full duplex,response time,responstijd,volume,KMix,kanalen,login,aanmelden,synthesizer,muziek,mixer,midi, +Keywords[nn]=aRts,lydtenar,artsd,lyd,audio,oppstart,nettverkstransparens,transparens,prioritet,dupleks,full dupleks,svartid,responstid,miksar,volum,lydstyrke,KMix,innlogging,synt,musikk +Keywords[nso]=aRts,Seabi sa Modumo,artsd,Kwagalo,Modumo,thomiso, bobontsha tsakamosola bja kgokagano,bobontsha tsaka mosola,kgethokgolo,kgatiso, kgatiso yeo e feleletsego,nako ya phetolo,Setswaki,Volume,KMix,Motswako,tsena,MIDI, mokopanyi,mmino +Keywords[pl]=aRts,Serwer dźwiękowy,artsd,Audio,Dźwięk,uruchomienie,przeźroczystość dla sieci,przeźroczystość,priorytet,dupleks,pełny dupleks,czas odpowiedzi,mikser,głośność, KMix,Mix,logowanie,MIDI,syntezator,muzyka,rozpoczęcie pracy +Keywords[pt]=aRts,servidor de som,artsd,áudio,som,iniciar,transparência de rede,transparência,prioridade,duplex,full duplex,tempo de resposta,mistura,volume,KMix,Misturador,MIDI,ligação,sintetizador,música +Keywords[pt_BR]=aRts,servidor de som,artsd,áudio,som,inicialização,transparência de rede,transparência,prioridade,duplex,full-duplex,tempo de resposta,mixer,volume,KMix,Mix,login,MIDI,sintetizador,música +Keywords[ro]=aRts,server de sunet,artsd,audio,sunet,pornire,startare,transparență de rețea,transparență,prioritate,duplex,duplex integral,timp de răspuns,mixer,volum,KMix,logare,MIDI,sintetizator,muzică +Keywords[ru]=aRts,Sound Server,artsd,Audio,Sound,startup,network transparency,transparency,priority,duplex,full duplex,response time,Mixer,Volume,KMix,Mix,login,MIDI,synthesizer,music,звук,звуковой сервер,дуплекс,музыка +Keywords[rw]=aRts,Seriveri y'Ijwi,artsd,Inyumvo,Ijwi,gutangira,ububonerane bw'urusobemiyoboro,ububonerane,uburenganzira,nzira-ebyiri,nzira-ebyiri zuzuye,igihe cy'igisubizo,Muvanga,Agahindurajwi,K-Kuvanga,Kuvanga,ifashayinjira,MIDI,inanga,umuziki +Keywords[se]=aRts,jietnabálvá,artsd,audio,jietna,álggaheapmi,fierpmádatjietna,prioritehta,duplex,full duplex,vástidanáigi,mixer,sisačáliheapmi,MIDI,synthesizer,musihkka +Keywords[sk]=aRts,Zvukový server,artsd,Zvuk,Audio,štart,sieťová transparencia,priehľadnosť,priorita,duplex,plný duplex,čas reakcie,mixér,hlasitosť,kmix,mix,prihlásenie,MIDI,syntezátor,hudba +Keywords[sl]=aRts,zvočni strežnik,artsd,avdio,zvok,zagon,omrežna prosojnost,prosojnost,prioriteta,dupleks,duplex,full duplex,čas odgovora,Mixer,glasnost,KMix,Mix,prijava,MIDI,sintesajzer,glasba +Keywords[sr]=aRts,Звучни сервер,artsd,Аудио,Звук,Покретање,мрежна транспарентност,транспарентност,приоритет,дуплекс,пуни-дуплекс,време одзива +Keywords[sr@Latn]=aRts,Zvučni server,artsd,Audio,Zvuk,Pokretanje,mrežna transparentnost,transparentnost,prioritet,dupleks,puni-dupleks,vreme odziva +Keywords[sv]=aRts,Ljudserver,artsd,Ljud,uppstart,nätverkstransparens,transparens,prioritet,duplex,full duplex,svarstid,Mixer,Volym,Kmix,Mixa,inloggning,MIDI,synthesizer,musik +Keywords[ta]=aRts,ஒலி சேவகன்,artsd,ஒலி,கேட்பு ஒலி,துவக்கம்,வலைதள ஊடகம்,ஊடகம்,முக்கியத்துவம்,இருதிசை,முழு இருதிசை,பதில் நேரம்,கலவை,ஒலியளவு,KMix,கல,நுழை,MIDI,இணைப்பாக்கி,இசை +Keywords[th]=aRts,Sound Server,artsd,Audio,เสียง,เริ่มต้น,network transparency,transparency,ลำดับก่อน,duplex,full duplex,เวลาในการตอบสนอง, มิกเซอร์,ระดับเสียง,KMix,Mix,ล็อกอิน,MIDI,synthesizer,ดนตรี +Keywords[tr]=aRts,Ses Sunucu,artsd,Ses,Ses,Başlangıç,ağ geçirgenliği,geçirgenlik,öncelik,dubleks,tam dubleks,karşılık süresi,MIDI,karıştırıcı,Kmix +Keywords[uk]=aRts,сервер звуку,artsd,аудіо,звук,запуск,прозорість мережі,прозорість,повний дуплекс,пріоритет,дуплекс,час відповіді,мікшер,гучність,KMix,MIDI,синтезатор,музика +Keywords[uz]=aRts,Tovush serveri,artsd,Audio,Tovush,startup,tarmoq shaffofligi,shaffoflik,muhimlik darajasi,dupleks,toʻliq dupleks,javob berish vaqti,Mikser,Tovush balandligi,KMix,Mix,kirish,MIDI,sintezator,musiqa +Keywords[uz@cyrillic]=aRts,Товуш сервери,artsd,Аудио,Товуш,startup,тармоқ шаффофлиги,шаффофлик,муҳимлик даражаси,дуплекс,тўлиқ дуплекс,жавоб бериш вақти,Миксер,Товуш баландлиги,KMix,Mix,кириш,MIDI,синтезатор,мусиқа +Keywords[ven]=aRts,Siva ya Mubvumo,artsd,Pfala,Mubvumo,thoma,vhudavhidzano ha khagala,khagala,tshipikwa,dubulekisi,dubulekisi yo fhelelaho, tshifhinga tshau fhindula,tshitanganisi,Volomu,KMix,Tanganisa, u loga,MIDI,tshiiti,muzika +Keywords[vi]=aRts,Trình phục vụ Âm thanh,artsd,Âm nhạc, âm thanh,khởi động,mạng trong suốt,trong suốt,ưu tiên,kép,kép hoàn toàn,phản hồi thời gian,Bộ hoà âm,Âm lượng,KMix,Trộn,đăng nhập,MIDI,Bộ tổng hợp âm nhạc,âm nhạc +Keywords[wa]=aRts,Sound Server,sierveu d' son,artsd,Audio,son,Sound,startup,enonde tot seu,transparince rantoele, transparince,prumîristé,duplex,full duplex,complet duplex,tins d' response,Mixer,maxheu,Volume,KMix,Mix,login,MIDI,synthesizer,forveyeu,muzike +Keywords[xh]=aRts,Umncedisi Wesandi,artsd,Evakalayo,qalisa kwakhona,umsebenzi womnatha obinisa ngaphaya, Isandi,Isandi,isiqalo,ubono ngaphaya komsebenzi womnatha,bona ngaphaya,intshukumo yokuqala,into ephindwe kabinini,into ephindwe kabini epheleleyo,ixesha lokujongana nokuthile +Keywords[zh_CN]=aRts,Sound Server,artsd,Audio,Sound,startup,network transparency,transparency,priority,duplex,full duplex,response time,声音服务器,声音,启动,网络透明,优先级,全双工,响应时间 +Keywords[zh_TW]=aRts,Sound Server,artsd,Audio,Sound,startup,network transparency,transparency,priority,duplex,full duplex,response time,Mixer,Volume,KMix,Mix,login,MIDI,synthesizer,musica,聲音伺服器,聲音,啟動,網路透明,優先級,全雙工,響應時間,混音器,音量,登入 +Keywords[zu]=aRts,Umlekeleli Womsindo,artsd,Okuzwakalayo,Umsindo,Isiqaliso, ukubonakala koxhumano olusakazekile,Ukubonakala ngale,ukubaluleka,okunezingxemye ezimbili,okunezingxenye ezimbili eziphendulanayo,isikhathi sokuphendula, Umxubi,Izinga lomsindo,KMix,Xuba,ngena ngaphakathi,MIDI,umlungisi womsindo, umculo + +Categories=Qt;KDE;X-KDE-settings-sound; diff --git a/kcontrol/arts/arts.h b/kcontrol/arts/arts.h new file mode 100644 index 000000000..e69f5767d --- /dev/null +++ b/kcontrol/arts/arts.h @@ -0,0 +1,135 @@ + /* + + Copyright (C) 2000 Stefan Westerfeld + stefan@space.twc.de + + 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + Permission is also granted to link this program with the Qt + library, treating Qt like a library that normally accompanies the + operating system kernel, whether or not that is in fact the case. + + */ + +#ifndef KARTSCONFIG_H +#define KARTSCONFIG_H + +#include <kapplication.h> + +#include <qbuttongroup.h> +#include <qcheckbox.h> +#include <qlabel.h> +#include <qlineedit.h> +#include <qradiobutton.h> +#include <qtimer.h> + +#include <kcmodule.h> +#include <knuminput.h> +#include <kprogress.h> + +#include "generaltab.h" +#include "hardwaretab.h" + + +class KProcess; +class DeviceManager; + +class KArtsModule : public KCModule +{ + Q_OBJECT + +public: + + KArtsModule(QWidget *parent=0, const char *name=0); + ~KArtsModule(); + void saveParams( void ); + + void load(); + void load( bool useDefaults ); + void save(); + void defaults(); + + bool artsdIsRunning(); + +private slots: + + void slotChanged(); + void slotTestSound(); + void slotArtsdExited(KProcess* proc); + void slotProcessArtsdOutput(KProcess* p, char* buf, int len); + //void slotStartServerChanged(); + +private: + + void updateWidgets (); + void calculateLatency(); + QString createArgs(bool netTrans,bool duplex, int fragmentCount, + int fragmentSize, + const QString &deviceName, + int rate, int bits, const QString &audioIO, + const QString &addOptions, bool autoSuspend, + int suspendTime); + int userSavedChanges(); + + QCheckBox *startServer, *startRealtime, *networkTransparent, + *fullDuplex, *customDevice, *customRate, *autoSuspend; + QLineEdit *deviceName; + QSpinBox *samplingRate; + KIntNumInput *suspendTime; + generalTab *general; + hardwareTab *hardware; + KConfig *config; + DeviceManager *deviceManager; + int latestProcessStatus; + int fragmentCount; + int fragmentSize; + bool configChanged; + bool realtimePossible; + + class AudioIOElement { + public: + AudioIOElement(const QString &name, const QString &fullName) + : name(name), fullName(fullName) {;} + QString name; + QString fullName; + }; + + void initAudioIOList(); + QPtrList<AudioIOElement> audioIOList; + + void restartServer(); + bool realtimeIsPossible(); +}; + + +class KStartArtsProgressDialog : public KProgressDialog +{ + Q_OBJECT +public: + KStartArtsProgressDialog(KArtsModule *parent, const char *name, + const QString &caption, const QString &text); +public slots: + void slotProgress(); + void slotFinished(); + +private: + QTimer m_timer; + int m_timeStep; + KArtsModule *m_module; + bool m_shutdown; +}; + +#endif + diff --git a/kcontrol/arts/generaltab.ui b/kcontrol/arts/generaltab.ui new file mode 100644 index 000000000..5b7ba7f79 --- /dev/null +++ b/kcontrol/arts/generaltab.ui @@ -0,0 +1,330 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>generalTab</class> +<widget class="QWidget"> + <property name="name"> + <cstring>generalTab</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>637</width> + <height>613</height> + </rect> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>450</height> + </size> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>startServer</cstring> + </property> + <property name="font"> + <font> + <bold>1</bold> + </font> + </property> + <property name="text"> + <string>&Enable the sound system</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="whatsThis" stdset="0"> + <string>If this option is enabled, the sound system will be loaded on KDE startup. +Recommended if you want sound.</string> + </property> + </widget> + <widget class="QFrame"> + <property name="name"> + <cstring>frame3</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>networkedSoundGroupBox</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="title"> + <string>Networked Sound</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KRichTextLabel"> + <property name="name"> + <cstring>textLabel1_2</cstring> + </property> + <property name="text"> + <string><i>Enable this option if you want to play sound on a remote computer or you want to be able to control sound on this system from another computer.</i></string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>networkTransparent</cstring> + </property> + <property name="text"> + <string>Enable &networked sound</string> + </property> + <property name="whatsThis" stdset="0"> + <string>This option allows sound requests coming in from over the network to be accepted, instead of just limiting the server to the local computer.</string> + </property> + </widget> + </vbox> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>realtimeGroupBox</cstring> + </property> + <property name="title"> + <string>Skip Prevention</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KRichTextLabel" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string><i>If your sound is skipping during playback, enable running with highest possible priority. Increasing your sound buffer might also help.</i></string> + </property> + </widget> + <widget class="QCheckBox" row="1" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>startRealtime</cstring> + </property> + <property name="text"> + <string>&Run with the highest possible priority (realtime priority)</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="whatsThis" stdset="0"> + <string>On systems which support realtime scheduling, if you have sufficient permissions, this option will enable a very high priority for processing sound requests.</string> + </property> + </widget> + <widget class="QSlider" row="2" column="1"> + <property name="name"> + <cstring>latencySlider</cstring> + </property> + <property name="minValue"> + <number>10</number> + </property> + <property name="maxValue"> + <number>500</number> + </property> + <property name="value"> + <number>150</number> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="tickmarks"> + <enum>NoMarks</enum> + </property> + <property name="tickInterval"> + <number>50</number> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>textLabel5</cstring> + </property> + <property name="text"> + <string>Sound &buffer:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>latencySlider</cstring> + </property> + </widget> + <widget class="QLabel" row="3" column="1"> + <property name="name"> + <cstring>latencyLabel</cstring> + </property> + <property name="text"> + <string><p align="right"><b>Huge</b> buffer, for <b>low-end</b> machines, <b>less skipping</b></p></string> + </property> + </widget> + </grid> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>autoSuspendGroupBox</cstring> + </property> + <property name="title"> + <string>Auto-Suspend</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KRichTextLabel"> + <property name="name"> + <cstring>textLabel5_2</cstring> + </property> + <property name="text"> + <string><i>The KDE sound system takes exclusive control over your audio hardware, blocking programs that may wish to use it directly. If the KDE sound system sits idle it can give up this exclusive control.</i></string> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout7</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>autoSuspend</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="text"> + <string>&Auto-suspend if idle after:</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="whatsThis" stdset="0"> + <string>The sound server will suspend itself if idle for this period of time.</string> + </property> + </widget> + <widget class="KIntNumInput"> + <property name="name"> + <cstring>suspendTime</cstring> + </property> + <property name="suffix"> + <string> seconds</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer17_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>173</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </widget> + </vbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout3</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer3_2_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QPushButton"> + <property name="name"> + <cstring>testSound</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Test &Sound</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer3</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <spacer> + <property name="name"> + <cstring>spacer5</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>0</height> + </size> + </property> + </spacer> + </vbox> +</widget> +<customwidgets> +</customwidgets> +<includes> + <include location="local" impldecl="in implementation">krichtextlabel.h</include> +</includes> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> +</includehints> +</UI> diff --git a/kcontrol/arts/hardwaretab.ui b/kcontrol/arts/hardwaretab.ui new file mode 100644 index 000000000..c11f19962 --- /dev/null +++ b/kcontrol/arts/hardwaretab.ui @@ -0,0 +1,358 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>hardwareTab</class> +<widget class="QWidget"> + <property name="name"> + <cstring>hardwareTab</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>372</width> + <height>357</height> + </rect> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QGroupBox"> + <property name="name"> + <cstring>groupBox4</cstring> + </property> + <property name="frameShape"> + <enum>GroupBoxPanel</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="title"> + <string>Select && Configure your Audio Device</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>layout57</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel3_2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>&Select the audio device:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>audioIO</cstring> + </property> + </widget> + <widget class="QComboBox"> + <property name="name"> + <cstring>audioIO</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget" row="1" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>layout31</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>fullDuplex</cstring> + </property> + <property name="text"> + <string>&Full duplex</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="whatsThis" stdset="0"> + <string>This enables the soundserver to record and play sound at the same time. If you use applications like Internet telephony, voice recognition or similar, you probably want this.</string> + </property> + </widget> + </hbox> + </widget> + <widget class="QCheckBox" row="5" column="0"> + <property name="name"> + <cstring>customOptions</cstring> + </property> + <property name="text"> + <string>Use other custom &options:</string> + </property> + </widget> + <widget class="QCheckBox" row="4" column="0"> + <property name="name"> + <cstring>customDevice</cstring> + </property> + <property name="text"> + <string>Override &device location:</string> + </property> + </widget> + <widget class="QLayoutWidget" row="3" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>layout4</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel2</cstring> + </property> + <property name="text"> + <string>&Quality:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>soundQuality</cstring> + </property> + </widget> + <widget class="QComboBox"> + <item> + <property name="text"> + <string>Default</string> + </property> + </item> + <item> + <property name="text"> + <string>16 Bits (high)</string> + </property> + </item> + <item> + <property name="text"> + <string>8 Bits (low)</string> + </property> + </item> + <property name="name"> + <cstring>soundQuality</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer3</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>0</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <widget class="QCheckBox" row="2" column="0"> + <property name="name"> + <cstring>customRate</cstring> + </property> + <property name="text"> + <string>Use &custom sampling rate:</string> + </property> + </widget> + <widget class="QLayoutWidget" row="2" column="1"> + <property name="name"> + <cstring>layout6</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QSpinBox"> + <property name="name"> + <cstring>samplingRate</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="suffix"> + <string> Hz </string> + </property> + <property name="maxValue"> + <number>99999</number> + </property> + <property name="lineStep"> + <number>10</number> + </property> + <property name="value"> + <number>44100</number> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer4</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>0</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <widget class="QLineEdit" row="5" column="1"> + <property name="name"> + <cstring>addOptions</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + </widget> + <widget class="QLineEdit" row="4" column="1"> + <property name="name"> + <cstring>deviceName</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>/dev/dsp</string> + </property> + </widget> + </grid> + </widget> + <widget class="QGroupBox"> + <property name="name"> + <cstring>groupBox3</cstring> + </property> + <property name="title"> + <string>Select your MIDI Device</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox" row="1" column="0"> + <property name="name"> + <cstring>midiUseMapper</cstring> + </property> + <property name="text"> + <string>Use MIDI ma&pper:</string> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel4</cstring> + </property> + <property name="text"> + <string>Select the &MIDI device:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>deviceName</cstring> + </property> + </widget> + <widget class="QComboBox" row="0" column="1"> + <property name="name"> + <cstring>midiDevice</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="KURLRequester" row="1" column="1"> + <property name="name"> + <cstring>midiMapper</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + </widget> + </grid> + </widget> + <spacer> + <property name="name"> + <cstring>spacer17</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>60</height> + </size> + </property> + </spacer> + </vbox> +</widget> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/kcontrol/arts/krichtextlabel.cpp b/kcontrol/arts/krichtextlabel.cpp new file mode 100644 index 000000000..7e292cde1 --- /dev/null +++ b/kcontrol/arts/krichtextlabel.cpp @@ -0,0 +1,115 @@ +/* This file is part of the KDE libraries + Copyright (C) 2005 Waldo Bastian <bastian@kde.org> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "krichtextlabel.h" + +#include <qtooltip.h> +#include <qstylesheet.h> +#include <qsimplerichtext.h> + +#include <kglobalsettings.h> + +static QString qrichtextify( const QString& text ) +{ + if ( text.isEmpty() || text[0] == '<' ) + return text; + + QStringList lines = QStringList::split('\n', text); + for(QStringList::Iterator it = lines.begin(); it != lines.end(); ++it) + { + *it = QStyleSheet::convertFromPlainText( *it, QStyleSheetItem::WhiteSpaceNormal ); + } + + return lines.join(QString::null); +} + +KRichTextLabel::KRichTextLabel( const QString &text , QWidget *parent, const char *name ) + : QLabel ( parent, name ) { + m_defaultWidth = QMIN(500, KGlobalSettings::desktopGeometry(this).width()*3/5); + setAlignment( Qt::WordBreak ); + setText(text); +} + +KRichTextLabel::KRichTextLabel( QWidget *parent, const char *name ) + : QLabel ( parent, name ) { + m_defaultWidth = QMIN(500, KGlobalSettings::desktopGeometry(this).width()*3/5); + setAlignment( Qt::WordBreak ); +} + +void KRichTextLabel::setDefaultWidth(int defaultWidth) +{ + m_defaultWidth = defaultWidth; + updateGeometry(); +} + +QSizePolicy KRichTextLabel::sizePolicy() const +{ + return QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum, false); +} + +QSize KRichTextLabel::minimumSizeHint() const +{ + QString qt_text = qrichtextify( text() ); + int pref_width = 0; + int pref_height = 0; + QSimpleRichText rt(qt_text, font()); + pref_width = m_defaultWidth; + rt.setWidth(pref_width); + int used_width = rt.widthUsed(); + if (used_width <= pref_width) + { + while(true) + { + int new_width = (used_width * 9) / 10; + rt.setWidth(new_width); + int new_height = rt.height(); + if (new_height > pref_height) + break; + used_width = rt.widthUsed(); + if (used_width > new_width) + break; + } + pref_width = used_width; + } + else + { + if (used_width > (pref_width *2)) + pref_width = pref_width *2; + else + pref_width = used_width; + } + + return QSize(pref_width, rt.height()); +} + +QSize KRichTextLabel::sizeHint() const +{ + return minimumSizeHint(); +} + +void KRichTextLabel::setText( const QString &text ) { + if (!text.startsWith("<qt>")) + QLabel::setText("<qt>"+text+"</qt>"); + else + QLabel::setText(text); +} + +void KRichTextLabel::virtual_hook( int, void* ) +{ /*BASE::virtual_hook( id, data );*/ } + +#include "krichtextlabel.moc" diff --git a/kcontrol/arts/krichtextlabel.h b/kcontrol/arts/krichtextlabel.h new file mode 100644 index 000000000..e03fe2509 --- /dev/null +++ b/kcontrol/arts/krichtextlabel.h @@ -0,0 +1,65 @@ +/* This file is part of the KDE libraries + Copyright (C) 2005 Waldo Bastian <bastian@kde.org> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef KRICHTEXTLABEL_H +#define KRICHTEXTLABEL_H + +#include <qlabel.h> + +#include <kdelibs_export.h> + +/** + * @short A replacement for QLabel that supports richtext and proper layout management + * + * @author Waldo Bastian <bastian@kde.org> + */ + +/* + * QLabel + */ +class KDEUI_EXPORT KRichTextLabel : public QLabel { + Q_OBJECT + +public: + /** + * Default constructor. + */ + KRichTextLabel( QWidget *parent, const char *name = 0 ); + KRichTextLabel( const QString &text, QWidget *parent, const char *name = 0 ); + + int defaultWidth() const { return m_defaultWidth; } + void setDefaultWidth(int defaultWidth); + + virtual QSize minimumSizeHint() const; + virtual QSize sizeHint() const; + QSizePolicy sizePolicy() const; + +public slots: + void setText( const QString & ); + +protected: + int m_defaultWidth; + +protected: + virtual void virtual_hook( int id, void* data ); +private: + class KRichTextLabelPrivate; + KRichTextLabelPrivate *d; +}; + +#endif // KRICHTEXTLABEL_H |