1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
|
#include "preferencesdlg.h"
#include <tqlayout.h>
#include <tqcheckbox.h>
#include <tqcombobox.h>
#include <tqspinbox.h>
#include <tqlabel.h>
#include <tqframe.h>
#include <tqgroupbox.h>
#include <tdeglobal.h>
#include <tdeconfig.h>
#include <tdelocale.h>
PreferencesDlg::PreferencesDlg( TQWidget *parent )
: KDialogBase( Tabbed, i18n("Configure TMix"),
Ok | Apply | Cancel, Ok, parent, 0, false )
{
// ---- General -------------------------------------------------------------
TQFrame *gen = addPage( i18n("General") );
TQVBoxLayout *gl = new TQVBoxLayout( gen, marginHint(), spacingHint() );
m_dockInTray = new TQCheckBox( i18n("Dock in system tray"), gen );
gl->addWidget( m_dockInTray );
gl->addSpacing( 4 );
TQHBoxLayout *popupRow = new TQHBoxLayout( 0, 0, spacingHint() );
popupRow->addWidget( new TQLabel( i18n("Tray left-click:"), gen ) );
m_popupMode = new TQComboBox( false, gen );
m_popupMode->insertItem( i18n("Show mixer window") );
m_popupMode->insertItem( i18n("Show mini popup") );
popupRow->addWidget( m_popupMode );
popupRow->addStretch();
gl->addLayout( popupRow );
TQGroupBox *popupContent = new TQGroupBox( i18n("Mini popup shows:"), gen );
popupContent->setColumnLayout( 0, Qt::Vertical );
popupContent->layout()->setSpacing( spacingHint() );
popupContent->layout()->setMargin( marginHint() );
TQVBoxLayout *pcl = new TQVBoxLayout( popupContent->layout() );
m_popupShowOutput = new TQCheckBox( i18n("Default output (speakers/headphones)"), popupContent );
m_popupShowMic = new TQCheckBox( i18n("Microphone inputs"), popupContent );
m_popupShowApps = new TQCheckBox( i18n("Active app streams"), popupContent );
pcl->addWidget( m_popupShowOutput );
pcl->addWidget( m_popupShowMic );
pcl->addWidget( m_popupShowApps );
gl->addWidget( popupContent );
connect( m_popupMode, TQ_SIGNAL(activated(int)), this, TQ_SLOT(onPopupModeChanged(int)) );
gl->addSpacing( 4 );
m_showRecTray = new TQCheckBox( i18n("Show microphone-in-use icon in tray"), gen );
gl->addWidget( m_showRecTray );
m_confirmQuit = new TQCheckBox( i18n("Ask for confirmation before quitting"), gen );
gl->addWidget( m_confirmQuit );
gl->addSpacing( 8 );
TQHBoxLayout *stepRow = new TQHBoxLayout( 0, 0, spacingHint() );
stepRow->addWidget( new TQLabel( i18n("Scroll wheel volume step:"), gen ) );
m_scrollStep = new TQSpinBox( 1, 20, 1, gen );
m_scrollStep->setSuffix( i18n(" %") );
stepRow->addWidget( m_scrollStep );
stepRow->addStretch();
gl->addLayout( stepRow );
gl->addStretch();
// ---- View ----------------------------------------------------------------
TQFrame *view = addPage( i18n("View") );
TQVBoxLayout *vl = new TQVBoxLayout( view, marginHint(), spacingHint() );
m_noTabs = new TQCheckBox( i18n("Show all devices in one view (no tabs)"), view );
vl->addWidget( m_noTabs );
vl->addSpacing( 8 );
vl->addWidget( new TQLabel( i18n("Show tabs:"), view ) );
m_showOutput = new TQCheckBox( i18n("Output"), view );
m_showInput = new TQCheckBox( i18n("Input"), view );
m_showPlayback = new TQCheckBox( i18n("Playback"), view );
m_showRecording = new TQCheckBox( i18n("Recording"), view );
vl->addWidget( m_showOutput );
vl->addWidget( m_showInput );
vl->addWidget( m_showPlayback );
vl->addWidget( m_showRecording );
vl->addStretch();
load();
}
void PreferencesDlg::onPopupModeChanged( int idx )
{
bool popupEnabled = ( idx == 1 );
m_popupShowOutput->setEnabled( popupEnabled );
m_popupShowMic->setEnabled( popupEnabled );
m_popupShowApps->setEnabled( popupEnabled );
}
void PreferencesDlg::load()
{
TDEConfig *cfg = TDEGlobal::config();
cfg->setGroup("General");
m_dockInTray->setChecked( cfg->readBoolEntry("DockInTray", true) );
int mode = cfg->readNumEntry("PopupMode", 1);
m_popupMode->setCurrentItem( mode );
m_popupShowOutput->setChecked( cfg->readBoolEntry("PopupShowOutput", true) );
m_popupShowMic->setChecked( cfg->readBoolEntry("PopupShowMic", false) );
m_popupShowApps->setChecked( cfg->readBoolEntry("PopupShowApps", true) );
onPopupModeChanged( mode );
m_showRecTray->setChecked( cfg->readBoolEntry("ShowRecordingTray", true) );
m_confirmQuit->setChecked( cfg->readBoolEntry("ConfirmQuit", false) );
m_scrollStep->setValue( cfg->readNumEntry( "ScrollStep", 5) );
cfg->setGroup("View");
m_noTabs->setChecked( cfg->readBoolEntry("NoTabs", false) );
m_showOutput->setChecked( cfg->readBoolEntry("ShowOutput", true) );
m_showInput->setChecked( cfg->readBoolEntry("ShowInput", true) );
m_showPlayback->setChecked( cfg->readBoolEntry("ShowPlayback", true) );
m_showRecording->setChecked( cfg->readBoolEntry("ShowRecording", true) );
}
void PreferencesDlg::save()
{
TDEConfig *cfg = TDEGlobal::config();
cfg->setGroup("General");
cfg->writeEntry( "DockInTray", m_dockInTray->isChecked() );
cfg->writeEntry( "PopupMode", m_popupMode->currentItem() );
cfg->writeEntry( "PopupShowOutput", m_popupShowOutput->isChecked() );
cfg->writeEntry( "PopupShowMic", m_popupShowMic->isChecked() );
cfg->writeEntry( "PopupShowApps", m_popupShowApps->isChecked() );
cfg->writeEntry( "ShowRecordingTray", m_showRecTray->isChecked() );
cfg->writeEntry( "ConfirmQuit", m_confirmQuit->isChecked() );
cfg->writeEntry( "ScrollStep", m_scrollStep->value() );
cfg->setGroup("View");
cfg->writeEntry( "NoTabs", m_noTabs->isChecked() );
cfg->writeEntry( "ShowOutput", m_showOutput->isChecked() );
cfg->writeEntry( "ShowInput", m_showInput->isChecked() );
cfg->writeEntry( "ShowPlayback", m_showPlayback->isChecked() );
cfg->writeEntry( "ShowRecording", m_showRecording->isChecked() );
cfg->sync();
emit settingsChanged();
}
void PreferencesDlg::slotOk() { save(); accept(); }
void PreferencesDlg::slotApply() { save(); }
#include "preferencesdlg.moc"
|