示例#1
0
ReminderSettings::ReminderSettings() {
	ui.setupUi( this );

	// it can't be on initialization list, because the ui.setupUi creates the controls
	m_bIsOn = ui.signalCheck->isChecked();
	m_fTimeEarlier = ui.signalSpinBox->value();
	m_bIsSoundOn = ui.soundCheck->isChecked();
	m_strSoundPath = ui.soundPathEdit->text();

	connect( ui.okButton, SIGNAL( clicked() ), this, SLOT( pressedOk() ) );
	connect( ui.cancelButton, SIGNAL( clicked() ), this, SLOT( pressedCancel() ) );
	connect( ui.browseSoundButton, SIGNAL( clicked() ), this, SLOT( browseSound() ) );
	connect( ui.playSoundButton, SIGNAL( clicked() ), this, SLOT( playSound() ) );
	connect( ui.stopSoundButton, SIGNAL( clicked() ), this, SLOT( stopSound() ) );
	connect( ui.soundCheck, SIGNAL( clicked() ), this, SLOT( soundChecked() ) );
	connect( ui.signalCheck, SIGNAL( clicked() ), this, SLOT( signalUnchecked() ) );

	m_sound = new Phonon::MediaObject( this );
}
示例#2
0
void ConfigWindow::createSoundGroupBox(Config& cfg)
{
    m_soundGroupBox = new QGroupBox(tr("Sound"));
    QGridLayout *layout = new QGridLayout;

    m_browseSoundButton = createButton(tr("Browse..."), SLOT(browseSound()));

    m_soundFileLineEdit = new QLineEdit;
    m_soundFileLineEdit->setText(cfg.soundFile);
    m_soundFileLabel = new QLabel(tr("Sound file:"));
    m_soundFileLabel->setBuddy(m_soundFileLineEdit);

    m_soundCodecComboBox = new QComboBox;
#ifdef Platform_dm365
    m_soundCodecComboBox->addItem(tr("AAC"), "aac");
#endif
    m_soundCodecComboBox->addItem(tr("G711"), "g711");

    m_soundCodecLabel = new QLabel(tr("Codec:"));
    m_soundCodecLabel->setBuddy(m_soundCodecComboBox);

    m_soundBitRateComboBox = new QComboBox;
    m_soundBitRateComboBox->addItem(tr("96 kbps"), 96000);
    m_soundBitRateComboBox->addItem(tr("128 kbps"), 128000);
    m_soundBitRateComboBox->addItem(tr("160 kbps"), 160000);
    m_soundBitRateComboBox->setToolTip("Note: Increasing bit rate may reduce" 
        " performance.");

    m_soundBitRateLabel = new QLabel(tr("Audio bit rate:"));
    m_soundBitRateLabel->setBuddy(m_soundBitRateComboBox);

    m_samplingRateComboBox = new QComboBox;
    m_samplingRateComboBox->addItem(tr("16 kHz"), 16000);
    m_samplingRateComboBox->addItem(tr("44.1 kHz"), 44100);
    m_samplingRateComboBox->addItem(tr("48 kHz"), 48000);
    m_samplingRateComboBox->setToolTip("Note: Increasing sample rate may " 
        "reduce performance.");

    m_samplingRateLabel = new QLabel(tr("Audio sample rate:"));
    m_samplingRateLabel->setBuddy(m_samplingRateComboBox);

    m_encodeSoundCheckBox = new QCheckBox(tr("Disable sound"));

    connect(m_encodeSoundCheckBox, SIGNAL(toggled(bool)),
            this, SLOT(setEncodeSound(bool)));
    connect(m_soundCodecComboBox, SIGNAL(activated(int)),
            this, SLOT(soundCodecChanged()));
    connect(m_soundBitRateComboBox, SIGNAL(activated(int)),
            this, SLOT(soundBitRateChanged()));
    connect(m_samplingRateComboBox, SIGNAL(activated(int)),
            this, SLOT(samplingRateChanged()));

    layout->addWidget(m_soundFileLabel, 1, 0, Qt::AlignLeft);
    layout->addWidget(m_soundFileLineEdit, 1, 1, 1, 5);
    layout->addWidget(m_browseSoundButton, 1, 6);
    layout->addWidget(m_soundCodecLabel, 2, 0, Qt::AlignRight);
    layout->addWidget(m_soundCodecComboBox, 2, 1);
    layout->addWidget(m_encodeSoundCheckBox, 2, 4);
    layout->addWidget(m_soundBitRateLabel, 3, 2, Qt::AlignRight);
    layout->addWidget(m_soundBitRateComboBox, 3, 3);
    layout->addWidget(m_samplingRateLabel, 3, 4, Qt::AlignRight);
    layout->addWidget(m_samplingRateComboBox, 3, 5);

    m_soundGroupBox->setLayout(layout);
}