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

« back to all changes in this revision

Viewing changes to kmix/kmixprefdlg.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
 
 * KMix -- KDE's full featured mini mixer
3
 
 *
4
 
 *
5
 
 * Copyright (C) 2000 Stefan Schimanski <1Stein@gmx.de>
6
 
 * Copyright (C) 2001 Preston Brown <pbrown@kde.org>
7
 
 *
8
 
 * This program is free software; you can redistribute it and/or
9
 
 * modify it under the terms of the GNU Library General Public
10
 
 * License as published by the Free Software Foundation; either
11
 
 * version 2 of the License, or (at your option) any later version.
12
 
 *
13
 
 * This program is distributed in the hope that it will be useful,
14
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
 
 * Library General Public License for more details.
17
 
 *
18
 
 * You should have received a copy of the GNU Library General Public
19
 
 * License along with this program; if not, write to the Free
20
 
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21
 
 */
22
 
 
23
 
#include <qbuttongroup.h>
24
 
#include <qwhatsthis.h>
25
 
#include <QCheckBox>
26
 
#include <QLabel>
27
 
#include <qradiobutton.h>
28
 
 
29
 
#include <klocale.h>
30
 
// For "kapp"
31
 
#include <kapplication.h>
32
 
 
33
 
#include "kmix.h"
34
 
#include "kmixprefdlg.h"
35
 
#include "kmixerwidget.h"
36
 
 
37
 
 
38
 
KMixPrefDlg::KMixPrefDlg( QWidget *parent )
39
 
    : KDialog( parent )
40
 
{
41
 
    setCaption( i18n( "Configure" ) );
42
 
    setButtons( Ok|Cancel|Apply );
43
 
    setDefaultButton( Ok );
44
 
 
45
 
   // general buttons
46
 
   m_generalTab = new QFrame( this );
47
 
   setMainWidget( m_generalTab );
48
 
 
49
 
   QBoxLayout *layout = new QVBoxLayout( m_generalTab );
50
 
   layout->setMargin( 0 );
51
 
   layout->setSpacing( KDialog::spacingHint() );
52
 
 
53
 
// -----------------------------------------------------------
54
 
 
55
 
   QLabel *label;
56
 
   label = new QLabel( i18n("Behavior"), m_generalTab );
57
 
   layout->addWidget(label);
58
 
 
59
 
   QBoxLayout *l;
60
 
   l = new QHBoxLayout();
61
 
   layout->addItem( l );
62
 
      l->addSpacing(10);
63
 
      m_dockingChk = new QCheckBox( i18n("&Dock in system tray"), m_generalTab );
64
 
      l->addWidget( m_dockingChk );
65
 
      m_dockingChk->setWhatsThis( i18n("Docks the mixer into the KDE system tray"));
66
 
 
67
 
      l = new QHBoxLayout();
68
 
      layout->addItem( l );
69
 
         l->addSpacing(20);
70
 
         m_volumeChk = new QCheckBox(i18n("Enable system tray &volume control"), m_generalTab);
71
 
         l->addWidget(m_volumeChk);
72
 
         m_volumeChk->setWhatsThis( i18n("Allows to control the volume from the system tray"));
73
 
         connect(m_dockingChk, SIGNAL(stateChanged(int)), SLOT(dockIntoPanelChange(int)) );
74
 
 
75
 
   l = new QHBoxLayout();
76
 
   layout->addItem( l );
77
 
      l->addSpacing(10);
78
 
      m_onLogin = new QCheckBox( i18n("Restore volumes on login"), m_generalTab );
79
 
      l->addWidget( m_onLogin );
80
 
 
81
 
// -----------------------------------------------------------
82
 
 
83
 
   label = new QLabel( i18n("Visual"), m_generalTab );
84
 
   layout->addWidget(label);
85
 
 
86
 
   l = new QHBoxLayout();
87
 
   layout->addItem( l );
88
 
      l->addSpacing(10);
89
 
      m_showTicks = new QCheckBox( i18n("Show &tickmarks"), m_generalTab );
90
 
      l->addWidget( m_showTicks );
91
 
      m_showTicks->setWhatsThis( i18n("Enable/disable tickmark scales on the sliders"));
92
 
 
93
 
   l = new QHBoxLayout();
94
 
   layout->addItem( l );
95
 
      l->addSpacing(10);
96
 
      m_showLabels = new QCheckBox( i18n("Show &labels"), m_generalTab );
97
 
      l->addWidget( m_showLabels );
98
 
      m_showLabels->setWhatsThis( i18n("Enables/disables description labels above the sliders"));
99
 
 
100
 
   QBoxLayout *orientationLayout = new QHBoxLayout();
101
 
      orientationLayout->addSpacing(10);
102
 
      layout->addItem( orientationLayout );
103
 
      QButtonGroup* orientationGroup = new QButtonGroup( m_generalTab );
104
 
      orientationGroup->setExclusive(true);
105
 
      QLabel* qlb = new QLabel( i18n("Slider orientation: "), m_generalTab );
106
 
      _rbHorizontal = new QRadioButton(i18n("&Horizontal"), m_generalTab );
107
 
      _rbVertical   = new QRadioButton(i18n("&Vertical"  ), m_generalTab );
108
 
      orientationGroup->addButton(_rbHorizontal);
109
 
      orientationGroup->addButton(_rbVertical);
110
 
      
111
 
      orientationLayout->addWidget(qlb);
112
 
      orientationLayout->addWidget(_rbHorizontal);
113
 
      orientationLayout->addWidget(_rbVertical);
114
 
      
115
 
      orientationLayout->addStretch();
116
 
      layout->addStretch();
117
 
      showButtonSeparator(true);
118
 
 
119
 
   connect( this, SIGNAL(applyClicked()), this, SLOT(apply()) );
120
 
   connect( this, SIGNAL(okClicked()), this, SLOT(apply()) );
121
 
}
122
 
 
123
 
KMixPrefDlg::~KMixPrefDlg()
124
 
{
125
 
}
126
 
 
127
 
void KMixPrefDlg::apply()
128
 
{
129
 
   // disabling buttons => users sees that we are working
130
 
   enableButtonOk(false);
131
 
   enableButtonCancel(false);
132
 
   enableButtonApply(false);
133
 
   kapp->processEvents();
134
 
   emit signalApplied( this );
135
 
   // re-enable (in case of "Apply")
136
 
   enableButtonOk(true);
137
 
   enableButtonCancel(true);
138
 
   enableButtonApply(true);
139
 
}
140
 
 
141
 
void KMixPrefDlg::dockIntoPanelChange(int state)
142
 
{
143
 
   if ( state == Qt::Unchecked ) {
144
 
      m_volumeChk->setDisabled(true);
145
 
   } else {
146
 
     m_volumeChk->setEnabled(true);
147
 
   } 
148
 
}
149
 
 
150
 
#include "kmixprefdlg.moc"