~ubuntu-branches/ubuntu/natty/kdemultimedia/natty-proposed

« back to all changes in this revision

Viewing changes to kmix/kmixctrl.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Debian Qt/KDE Maintainers
  • Date: 2011-05-26 02:41:36 UTC
  • mfrom: (0.2.3 upstream)
  • mto: This revision was merged to the branch mainline in revision 108.
  • Revision ID: james.westby@ubuntu.com-20110526024136-jjwsigfy402jhupm
Tags: upstream-4.6.3
ImportĀ upstreamĀ versionĀ 4.6.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * kmixctrl - kmix volume save/restore utility
3
 
 *
4
 
 * Copyright (C) 2000 Stefan Schimanski <1Stein@gmx.de>
5
 
 *
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.
10
 
 *
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.
15
 
 *
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.
19
 
 */
20
 
 
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>
30
 
 
31
 
#include "kmixtoolbox.h"
32
 
#include "mixer.h"
33
 
#include "version.h"
34
 
 
35
 
static const char description[] =
36
 
I18N_NOOP("kmixctrl - kmix volume save/restore utility");
37
 
 
38
 
extern "C" KDE_EXPORT int kdemain(int argc, char *argv[])
39
 
{
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"));
44
 
 
45
 
   aboutData.addAuthor(ki18n("Stefan Schimanski"), KLocalizedString(), "1Stein@gmx.de");
46
 
 
47
 
   KCmdLineArgs::init( argc, argv, &aboutData );
48
 
 
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 );
57
 
 
58
 
   // create mixers
59
 
   QString dummyStringHwinfo;
60
 
   MixerToolBox::instance()->initMixer(false, dummyStringHwinfo);
61
 
 
62
 
   // load volumes
63
 
   if ( args->isSet("restore") )
64
 
   {
65
 
      for (int i=0; i<Mixer::mixers().count(); ++i) {
66
 
         Mixer *mixer = (Mixer::mixers())[i];
67
 
         mixer->volumeLoad( KGlobal::config().data() );
68
 
      }
69
 
   }
70
 
 
71
 
   // save volumes
72
 
   if ( args->isSet("save") )
73
 
   {
74
 
      for (int i=0; i<Mixer::mixers().count(); ++i) {
75
 
         Mixer *mixer = (Mixer::mixers())[i];
76
 
         mixer->volumeSave( KGlobal::config().data() );
77
 
      }
78
 
   }
79
 
 
80
 
   MixerToolBox::instance()->deinitMixer();
81
 
 
82
 
   return 0;
83
 
}