Final polisihing for KDE4:
[kdemultimedia.git] / kmix / kmixctrl.cpp
blobd73ffa0b826bd3d89634873f60ae681f977e8d80
1 /*
2 * kmixctrl - kmix volume save/restore utility
4 * Copyright (C) 2000 Stefan Schimanski <1Stein@gmx.de>
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this program; if not, write to the Free
18 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #include "mixertoolbox.h"
22 #include <kapplication.h>
23 #include <kcmdlineargs.h>
24 #include <kaboutdata.h>
25 #include <klocale.h>
26 #include <kglobal.h>
27 #include <kstandarddirs.h>
28 #include <kconfig.h>
29 #include <kdebug.h>
31 #include "kmixtoolbox.h"
32 #include "mixer.h"
33 #include "version.h"
35 static const char description[] =
36 I18N_NOOP("kmixctrl - kmix volume save/restore utility");
38 extern "C" KDE_EXPORT int kdemain(int argc, char *argv[])
40 KLocale::setMainCatalog("kmix");
41 KAboutData aboutData( "kmixctrl", 0, ki18n("KMixCtrl"),
42 APP_VERSION, ki18n(description), KAboutData::License_GPL,
43 ki18n("(c) 2000 by Stefan Schimanski"));
45 aboutData.addAuthor(ki18n("Stefan Schimanski"), KLocalizedString(), "1Stein@gmx.de");
47 KCmdLineArgs::init( argc, argv, &aboutData );
49 KCmdLineOptions options;
50 options.add("s");
51 options.add("save", ki18n("Save current volumes as default"));
52 options.add("r");
53 options.add("restore", ki18n("Restore default volumes"));
54 KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
55 KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
56 KApplication app( false );
58 // create mixers
59 QString dummyStringHwinfo;
60 MixerToolBox::instance()->initMixer(false, dummyStringHwinfo);
62 // load volumes
63 if ( args->isSet("restore") )
65 for (int i=0; i<Mixer::mixers().count(); ++i) {
66 Mixer *mixer = (Mixer::mixers())[i];
67 mixer->volumeLoad( KGlobal::config().data() );
71 // save volumes
72 if ( args->isSet("save") )
74 for (int i=0; i<Mixer::mixers().count(); ++i) {
75 Mixer *mixer = (Mixer::mixers())[i];
76 mixer->volumeSave( KGlobal::config().data() );
80 MixerToolBox::instance()->deinitMixer();
82 return 0;