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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
|
/*
Rosegarden
A MIDI and audio sequencer and musical notation editor.
This program is Copyright 2000-2008
Guillaume Laurent <glaurent@telegraph-road.org>,
Chris Cannam <cannam@all-day-breakfast.com>,
Richard Bown <richard.bown@ferventsoftware.com>
The moral rights of Guillaume Laurent, Chris Cannam, and Richard
Bown to claim authorship of this work have been asserted.
Other copyrights also apply to some parts of this work. Please
see the AUTHORS file and individual file headers for details.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version. See the file
COPYING included with this distribution for more information.
*/
#include "GeneralConfigurationPage.h"
#include "document/ConfigGroups.h"
#include "ConfigurationPage.h"
#include "document/RosegardenGUIDoc.h"
#include "gui/editors/eventlist/EventView.h"
#include "gui/editors/parameters/RosegardenParameterArea.h"
#include "gui/studio/StudioControl.h"
#include "gui/dialogs/ShowSequencerStatusDialog.h"
#include "gui/seqmanager/SequenceManager.h"
#include "sound/SoundDriver.h"
#include "TabbedConfigurationPage.h"
#include <kcombobox.h>
#include <tdeconfig.h>
#include <tdefiledialog.h>
#include <tdemessagebox.h>
#include <tqcheckbox.h>
#include <tqcombobox.h>
#include <tqfileinfo.h>
#include <tqframe.h>
#include <tqlabel.h>
#include <tqlineedit.h>
#include <tqpushbutton.h>
#include <tqspinbox.h>
#include <tqstring.h>
#include <tqtabwidget.h>
#include <tqvbox.h>
#include <tqwidget.h>
#include <tqlayout.h>
namespace Rosegarden
{
GeneralConfigurationPage::GeneralConfigurationPage(RosegardenGUIDoc *doc,
TDEConfig *cfg,
TQWidget *parent, const char *name)
: TabbedConfigurationPage(cfg, parent, name),
m_doc(doc),
m_client(0),
m_countIn(0),
m_nameStyle(0)
{
m_cfg->setGroup(GeneralOptionsConfigGroup);
TQFrame *frame;
TQGridLayout *layout;
TQLabel *label = 0;
int row = 0;
//
// "Behavior" tab
//
frame = new TQFrame(m_tabWidget);
layout = new TQGridLayout(frame,
6, 2, // nbrow, nbcol
10, 5);
layout->setRowSpacing(row, 15);
++row;
layout->addWidget(new TQLabel(i18n("Double-click opens segment in"),
frame), row, 0);
m_client = new KComboBox(frame);
m_client->insertItem(i18n("Notation editor"));
m_client->insertItem(i18n("Matrix editor"));
m_client->insertItem(i18n("Event List editor"));
m_client->setCurrentItem(m_cfg->readUnsignedNumEntry("doubleclickclient", NotationView));
layout->addMultiCellWidget(m_client, row, row, 1, 2);
++row;
layout->addWidget(new TQLabel(i18n("Number of count-in measures when recording"),
frame), row, 0);
m_countIn = new TQSpinBox(frame);
m_countIn->setValue(m_cfg->readUnsignedNumEntry("countinbars", 0));
m_countIn->setMaxValue(10);
m_countIn->setMinValue(0);
layout->addMultiCellWidget(m_countIn, row, row, 1, 2);
++row;
layout->addWidget(new TQLabel(i18n("Auto-save interval"), frame), row, 0);
m_autoSave = new KComboBox(frame);
m_autoSave->insertItem(i18n("Every 30 seconds"));
m_autoSave->insertItem(i18n("Every minute"));
m_autoSave->insertItem(i18n("Every five minutes"));
m_autoSave->insertItem(i18n("Every half an hour"));
m_autoSave->insertItem(i18n("Never"));
bool doAutoSave = m_cfg->readBoolEntry("autosave", true);
int autoSaveInterval = m_cfg->readUnsignedNumEntry("autosaveinterval", 300);
if (!doAutoSave || autoSaveInterval == 0) {
m_autoSave->setCurrentItem(4); // off
} else if (autoSaveInterval < 45) {
m_autoSave->setCurrentItem(0);
} else if (autoSaveInterval < 150) {
m_autoSave->setCurrentItem(1);
} else if (autoSaveInterval < 900) {
m_autoSave->setCurrentItem(2);
} else {
m_autoSave->setCurrentItem(3);
}
layout->addMultiCellWidget(m_autoSave, row, row, 1, 2);
++row;
// JACK Transport
//
#ifdef HAVE_LIBJACK
m_cfg->setGroup(SequencerOptionsConfigGroup);
label = new TQLabel(i18n("Use JACK transport"), frame);
layout->addWidget(label, row, 0);
m_jackTransport = new TQCheckBox(frame);
layout->addMultiCellWidget(m_jackTransport, row, row, 1, 2);
// m_jackTransport->insertItem(i18n("Ignore JACK transport"));
// m_jackTransport->insertItem(i18n("Sync"));
/*!!! Removed as not yet implemented
m_jackTransport->insertItem(i18n("Sync, and offer timebase master"));
*/
bool jackMaster = m_cfg->readBoolEntry("jackmaster", false);
bool jackTransport = m_cfg->readBoolEntry("jacktransport", false);
/*
if (jackTransport)
m_jackTransport->setCurrentItem(1);
else
m_jackTransport->setCurrentItem(0);
*/
m_jackTransport->setChecked(jackTransport);
++row;
m_cfg->setGroup(GeneralOptionsConfigGroup);
#endif
layout->setRowSpacing(row, 20);
++row;
layout->addWidget(new TQLabel(i18n("Sequencer status"), frame), row, 0);
TQString status(i18n("Unknown"));
SequenceManager *mgr = doc->getSequenceManager();
if (mgr) {
int driverStatus = mgr->getSoundDriverStatus() & (AUDIO_OK | MIDI_OK);
switch (driverStatus) {
case AUDIO_OK:
status = i18n("No MIDI, audio OK");
break;
case MIDI_OK:
status = i18n("MIDI OK, no audio");
break;
case AUDIO_OK | MIDI_OK:
status = i18n("MIDI OK, audio OK");
break;
default:
status = i18n("No driver");
break;
}
}
layout->addWidget(new TQLabel(status, frame), row, 1);
TQPushButton *showStatusButton = new TQPushButton(i18n("Details..."),
frame);
TQObject::connect(showStatusButton, TQT_SIGNAL(clicked()),
this, TQT_SLOT(slotShowStatus()));
layout->addWidget(showStatusButton, row, 2, TQt::AlignRight);
++row;
layout->setRowStretch(row, 10);
addTab(frame, i18n("Behavior"));
//
// "Appearance" tab
//
frame = new TQFrame(m_tabWidget);
layout = new TQGridLayout(frame,
7, 4, // nbrow, nbcol -- one extra row improves layout
10, 5);
row = 0;
layout->setRowSpacing(row, 15);
++row;
layout->addWidget(new TQLabel(i18n("Side-bar parameter box layout"),
frame), row, 0);
m_sidebarStyle = new KComboBox(frame);
m_sidebarStyle->insertItem(i18n("Vertically stacked"),
RosegardenParameterArea::CLASSIC_STYLE);
m_sidebarStyle->insertItem(i18n("Tabbed"),
RosegardenParameterArea::TAB_BOX_STYLE);
m_sidebarStyle->setCurrentItem(m_cfg->readUnsignedNumEntry("sidebarstyle",
0));
layout->addMultiCellWidget(m_sidebarStyle, row, row, 1, 3);
++row;
layout->addWidget(new TQLabel(i18n("Note name style"),
frame), row, 0);
m_nameStyle = new KComboBox(frame);
m_nameStyle->insertItem(i18n("Always use US names (e.g. quarter, 8th)"));
m_nameStyle->insertItem(i18n("Localized (where available)"));
m_nameStyle->setCurrentItem(m_cfg->readUnsignedNumEntry("notenamestyle", Local));
layout->addMultiCellWidget(m_nameStyle, row, row, 1, 3);
++row;
/*
layout->addWidget(new TQLabel(i18n("Show tool context help in status bar"), frame), row, 0);
m_toolContextHelp = new TQCheckBox(frame);
layout->addWidget(m_toolContextHelp, row, 1);
m_toolContextHelp->setChecked(m_cfg->readBoolEntry
("toolcontexthelp", true));
++row;
*/
layout->addWidget(new TQLabel(i18n("Show textured background on"), frame), row, 0);
m_backgroundTextures = new TQCheckBox(i18n("Main window"), frame);
layout->addWidget(m_backgroundTextures, row, 1);
m_matrixBackgroundTextures = new TQCheckBox(i18n("Matrix"), frame);
layout->addWidget(m_matrixBackgroundTextures, row, 2);
m_notationBackgroundTextures = new TQCheckBox(i18n("Notation"), frame);
layout->addWidget(m_notationBackgroundTextures, row, 3);
m_backgroundTextures->setChecked(m_cfg->readBoolEntry
("backgroundtextures", true));
m_cfg->setGroup(MatrixViewConfigGroup);
m_matrixBackgroundTextures->setChecked(m_cfg->readBoolEntry
("backgroundtextures-1.6-plus", true));
m_cfg->setGroup(NotationViewConfigGroup);
m_notationBackgroundTextures->setChecked(m_cfg->readBoolEntry
("backgroundtextures", true));
m_cfg->setGroup(GeneralOptionsConfigGroup);
++row;
layout->addWidget(new TQLabel(i18n("Use bundled Klearlook theme"), frame), row, 0);
m_globalStyle = new KComboBox(frame);
m_globalStyle->insertItem(i18n("Never"));
m_globalStyle->insertItem(i18n("When not running under TDE"));
m_globalStyle->insertItem(i18n("Always"));
m_globalStyle->setCurrentItem(m_cfg->readUnsignedNumEntry("Install Own Theme", 1));
layout->addMultiCellWidget(m_globalStyle, row, row, 1, 3);
++row;
layout->setRowStretch(row, 10);
addTab(frame, i18n("Presentation"));
}
void
GeneralConfigurationPage::slotShowStatus()
{
ShowSequencerStatusDialog dialog(this);
dialog.exec();
}
void GeneralConfigurationPage::apply()
{
m_cfg->setGroup(GeneralOptionsConfigGroup);
int countIn = getCountInSpin();
m_cfg->writeEntry("countinbars", countIn);
int client = getDblClickClient();
m_cfg->writeEntry("doubleclickclient", client);
int globalstyle = m_globalStyle->currentItem();
m_cfg->writeEntry("Install Own Theme", globalstyle);
int namestyle = getNoteNameStyle();
m_cfg->writeEntry("notenamestyle", namestyle);
/*
m_cfg->writeEntry("toolcontexthelp", m_toolContextHelp->isChecked());
*/
bool texturesChanged = false;
bool mainTextureChanged = false;
m_cfg->setGroup(GeneralOptionsConfigGroup);
if (m_cfg->readBoolEntry("backgroundtextures", true) !=
m_backgroundTextures->isChecked()) {
texturesChanged = true;
mainTextureChanged = true;
} else {
m_cfg->setGroup(MatrixViewConfigGroup);
if (m_cfg->readBoolEntry("backgroundtextures-1.6-plus", false) !=
m_matrixBackgroundTextures->isChecked()) {
texturesChanged = true;
} else {
m_cfg->setGroup(NotationViewConfigGroup);
if (m_cfg->readBoolEntry("backgroundtextures", true) !=
m_notationBackgroundTextures->isChecked()) {
texturesChanged = true;
}
}
}
m_cfg->setGroup(GeneralOptionsConfigGroup);
m_cfg->writeEntry("backgroundtextures", m_backgroundTextures->isChecked());
m_cfg->setGroup(MatrixViewConfigGroup);
m_cfg->writeEntry("backgroundtextures-1.6-plus", m_matrixBackgroundTextures->isChecked());
m_cfg->setGroup(NotationViewConfigGroup);
m_cfg->writeEntry("backgroundtextures", m_notationBackgroundTextures->isChecked());
m_cfg->setGroup(GeneralOptionsConfigGroup);
int sidebarStyle = m_sidebarStyle->currentItem();
m_cfg->writeEntry("sidebarstyle", sidebarStyle);
emit updateSidebarStyle(sidebarStyle);
unsigned int interval = 0;
if (m_autoSave->currentItem() == 4) {
m_cfg->writeEntry("autosave", false);
} else {
m_cfg->writeEntry("autosave", true);
if (m_autoSave->currentItem() == 0) {
interval = 30;
} else if (m_autoSave->currentItem() == 1) {
interval = 60;
} else if (m_autoSave->currentItem() == 2) {
interval = 300;
} else {
interval = 1800;
}
m_cfg->writeEntry("autosaveinterval", interval);
emit updateAutoSaveInterval(interval);
}
#ifdef HAVE_LIBJACK
m_cfg->setGroup(SequencerOptionsConfigGroup);
// Write the JACK entry
//
/*
int jackValue = m_jackTransport->currentItem();
bool jackTransport, jackMaster;
switch (jackValue) {
case 2:
jackTransport = true;
jackMaster = true;
break;
case 1:
jackTransport = true;
jackMaster = false;
break;
default:
jackValue = 0;
case 0:
jackTransport = false;
jackMaster = false;
break;
}
*/
bool jackTransport = m_jackTransport->isChecked();
bool jackMaster = false;
int jackValue = 0; // 0 -> nothing, 1 -> sync, 2 -> master
if (jackTransport) jackValue = 1;
// Write the items
//
m_cfg->writeEntry("jacktransport", jackTransport);
m_cfg->writeEntry("jackmaster", jackMaster);
// Now send it
//
MappedEvent mEjackValue(MidiInstrumentBase, // InstrumentId
MappedEvent::SystemJackTransport,
MidiByte(jackValue));
StudioControl::sendMappedEvent(mEjackValue);
#endif // HAVE_LIBJACK
if (mainTextureChanged) {
KMessageBox::information(this, i18n("Changes to the textured background in the main window will not take effect until you restart Rosegarden."));
}
}
}
#include "GeneralConfigurationPage.moc"
|