You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tdemultimedia/kmix/kmixctrl.cpp

91 lines
2.7 KiB

/*
* kmixctrl - kmix volume save/restore utility
*
* Copyright (C) 2000 Stefan Schimanski <1Stein@gmx.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library 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.
*/
#include "mixertoolbox.h"
#include <tdeapplication.h>
#include <tdecmdlineargs.h>
#include <tdeaboutdata.h>
#include <tdelocale.h>
#include <tdeglobal.h>
#include <kstandarddirs.h>
#include <tdeconfig.h>
#include <kdebug.h>
#include <tqptrlist.h>
#include "kmixtoolbox.h"
#include "mixer.h"
#include "version.h"
static const char description[] =
I18N_NOOP("kmixctrl - kmix volume save/restore utility");
static TDECmdLineOptions options[] =
{
{ "s", 0, 0 },
{ "save", I18N_NOOP("Save current volumes as default"), 0 },
{ "r", 0, 0 },
{ "restore", I18N_NOOP("Restore default volumes"), 0 },
TDECmdLineLastOption
// INSERT YOUR COMMANDLINE OPTIONS HERE
};
extern "C" TDE_EXPORT int kdemain(int argc, char *argv[])
{
TDELocale::setMainCatalogue("kmix");
TDEAboutData aboutData( "kmixctrl", I18N_NOOP("KMixCtrl"),
APP_VERSION, description, TDEAboutData::License_GPL,
"(c) 2000 by Stefan Schimanski");
aboutData.addAuthor("Stefan Schimanski", 0, "1Stein@gmx.de");
TDECmdLineArgs::init( argc, argv, &aboutData );
TDECmdLineArgs::addCmdLineOptions( options ); // Add our own options.
TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();
TDEApplication app( false, false );
// get maximum values
TDEConfig *config= new TDEConfig("kmixrc", true, false);
config->setGroup("Misc");
delete config;
// create mixers
TQString dummyStringHwinfo;
MixerToolBox::initMixer(Mixer::mixers(), false, dummyStringHwinfo);
// load volumes
if ( args->isSet("restore") )
{
for (Mixer *mixer=Mixer::mixers().first(); mixer!=0; mixer=Mixer::mixers().next()) {
mixer->volumeLoad( TDEGlobal::config() );
}
}
// save volumes
if ( args->isSet("save") )
{
for (Mixer *mixer=Mixer::mixers().first(); mixer!=0; mixer=Mixer::mixers().next())
mixer->volumeSave( TDEGlobal::config() );
}
MixerToolBox::deinitMixer();
return 0;
}