Ignore:
Timestamp:
Aug 2, 2010, 9:27:30 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.3 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/examples/multimedia/audiodevices/audiodevices.cpp

    r651 r769  
    4444
    4545#include "audiodevices.h"
     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
    4680
    4781AudioDevicesBase::AudioDevicesBase(QWidget *parent, Qt::WFlags f)
     
    68102    connect(sampleTypesBox, SIGNAL(activated(int)), SLOT(sampleTypeChanged(int)));
    69103    connect(endianBox, SIGNAL(activated(int)), SLOT(endianChanged(int)));
     104
    70105
    71106    modeBox->setCurrentIndex(0);
     
    82117{
    83118    // tries to set all the settings picked.
    84     logOutput->clear();
    85     logOutput->append("NOTE: an invalid codec audio/test exists for testing, to get a fail condition.");
     119    testResult->clear();
    86120
    87121    if (!deviceInfo.isNull()) {
    88122        if (deviceInfo.isFormatSupported(settings)) {
    89             logOutput->append(tr("Success"));
     123            (tr("Success"));
    90124            nearestFreq->setText("");
    91125            nearestChannel->setText("");
     
    96130        } else {
    97131            QAudioFormat nearest = deviceInfo.nearestFormat(settings);
    98             logOutput->append(tr("Failed"));
     132            (tr("Failed"));
    99133            nearestFreq->setText(QString("%1").arg(nearest.frequency()));
    100134            nearestChannel->setText(QString("%1").arg(nearest.channels()));
    101135            nearestCodec->setText(nearest.codec());
    102136            nearestSampleSize->setText(QString("%1").arg(nearest.sampleSize()));
    103 
    104             switch(nearest.sampleType()) {
    105                 case QAudioFormat::SignedInt:
    106                     nearestSampleType->setText("SignedInt");
    107                     break;
    108                 case QAudioFormat::UnSignedInt:
    109                     nearestSampleType->setText("UnSignedInt");
    110                     break;
    111                 case QAudioFormat::Float:
    112                     nearestSampleType->setText("Float");
    113                     break;
    114                 case QAudioFormat::Unknown:
    115                     nearestSampleType->setText("Unknown");
    116             }
    117             switch(nearest.byteOrder()) {
    118                 case QAudioFormat::LittleEndian:
    119                     nearestEndian->setText("LittleEndian");
    120                     break;
    121                 case QAudioFormat::BigEndian:
    122                     nearestEndian->setText("BigEndian");
    123             }
     137            nearestSampleType->setText(toString(nearest.sampleType()));
     138            nearestEndian->setText(toString(nearest.byteOrder()));
    124139        }
    125140    }
    126141    else
    127         logOutput->append(tr("No Device"));
     142        (tr("No Device"));
    128143}
    129144
    130145void AudioTest::modeChanged(int idx)
    131146{
     147
     148
    132149    // mode has changed
    133150    if (idx == 0)
     
    139156    foreach (const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::availableDevices(mode))
    140157        deviceBox->addItem(deviceInfo.deviceName(), qVariantFromValue(deviceInfo));
     158
     159
     160
    141161}
    142162
    143163void AudioTest::deviceChanged(int idx)
    144164{
     165
     166
    145167    if (deviceBox->count() == 0)
    146168        return;
     
    181203    sampleTypesBox->clear();
    182204    QList<QAudioFormat::SampleType> sampleTypez = deviceInfo.supportedSampleTypes();
    183     for (int i = 0; i < sampleTypez.size(); ++i) {
    184         switch(sampleTypez.at(i)) {
    185             case QAudioFormat::SignedInt:
    186                 sampleTypesBox->addItem("SignedInt");
    187                 break;
    188             case QAudioFormat::UnSignedInt:
    189                 sampleTypesBox->addItem("UnSignedInt");
    190                 break;
    191             case QAudioFormat::Float:
    192                 sampleTypesBox->addItem("Float");
    193                 break;
    194             case QAudioFormat::Unknown:
    195                 sampleTypesBox->addItem("Unknown");
    196         }
    197         if (sampleTypez.size())
    198             settings.setSampleType(sampleTypez.at(0));
    199     }
     205
     206    for (int i = 0; i < sampleTypez.size(); ++i)
     207        sampleTypesBox->addItem(toString(sampleTypez.at(i)));
     208    if (sampleTypez.size())
     209        settings.setSampleType(sampleTypez.at(0));
    200210
    201211    endianBox->clear();
    202212    QList<QAudioFormat::Endian> endianz = deviceInfo.supportedByteOrders();
    203     for (int i = 0; i < endianz.size(); ++i) {
    204         switch (endianz.at(i)) {
    205             case QAudioFormat::LittleEndian:
    206                 endianBox->addItem("Little Endian");
    207                 break;
    208             case QAudioFormat::BigEndian:
    209                 endianBox->addItem("Big Endian");
    210                 break;
    211         }
    212     }
     213    for (int i = 0; i < endianz.size(); ++i)
     214        endianBox->addItem(toString(endianz.at(i)));
    213215    if (endianz.size())
    214216        settings.setByteOrder(endianz.at(0));
     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
    215267}
    216268
Note: See TracChangeset for help on using the changeset viewer.