qtmobility/src/multimedia/qradiotuner.cpp
changeset 14 6fbed849b4f4
parent 11 06b8e2af4411
child 15 1f895d8a5b2b
equal deleted inserted replaced
11:06b8e2af4411 14:6fbed849b4f4
   100     Q_D(QRadioTuner);
   100     Q_D(QRadioTuner);
   101 
   101 
   102     d->provider = provider;
   102     d->provider = provider;
   103 
   103 
   104     if (d->service != 0) {
   104     if (d->service != 0) {
   105         d->control = qobject_cast<QRadioTunerControl*>(d->service->control(QRadioTunerControl_iid));
   105         d->control = qobject_cast<QRadioTunerControl*>(d->service->requestControl(QRadioTunerControl_iid));
   106         if (d->control != 0) {
   106         if (d->control != 0) {
   107             connect(d->control, SIGNAL(stateChanged(QRadioTuner::State)), SIGNAL(stateChanged(QRadioTuner::State)));
   107             connect(d->control, SIGNAL(stateChanged(QRadioTuner::State)), SIGNAL(stateChanged(QRadioTuner::State)));
   108             connect(d->control, SIGNAL(bandChanged(QRadioTuner::Band)), SIGNAL(bandChanged(QRadioTuner::Band)));
   108             connect(d->control, SIGNAL(bandChanged(QRadioTuner::Band)), SIGNAL(bandChanged(QRadioTuner::Band)));
   109             connect(d->control, SIGNAL(frequencyChanged(int)), SIGNAL(frequencyChanged(int)));
   109             connect(d->control, SIGNAL(frequencyChanged(int)), SIGNAL(frequencyChanged(int)));
   110             connect(d->control, SIGNAL(stereoStatusChanged(bool)), SIGNAL(stereoStatusChanged(bool)));
   110             connect(d->control, SIGNAL(stereoStatusChanged(bool)), SIGNAL(stereoStatusChanged(bool)));
   122 
   122 
   123 QRadioTuner::~QRadioTuner()
   123 QRadioTuner::~QRadioTuner()
   124 {
   124 {
   125     Q_D(QRadioTuner);
   125     Q_D(QRadioTuner);
   126 
   126 
       
   127     if (d->service && d->control)
       
   128         d->service->releaseControl(d->control);
       
   129 
   127     d->provider->releaseService(d->service);
   130     d->provider->releaseService(d->service);
   128 }
   131 }
   129 
   132 
   130 /*!
   133 /*!
   131     Returns true if the radio tuner service is ready to use.
   134     Returns true if the radio tuner service is ready to use.
   139 }
   142 }
   140 
   143 
   141 /*!
   144 /*!
   142     Returns the availability error state.
   145     Returns the availability error state.
   143 */
   146 */
   144 QtMediaServices::AvailabilityError QRadioTuner::availabilityError() const
   147 QtMultimedia::AvailabilityError QRadioTuner::availabilityError() const
   145 {
   148 {
   146     if (d_func()->control != NULL)
   149     if (d_func()->control != NULL)
   147         return d_func()->control->availabilityError();
   150         return d_func()->control->availabilityError();
   148     else
   151     else
   149         return QtMediaServices::ServiceMissingError;
   152         return QtMultimedia::ServiceMissingError;
   150 }
   153 }
   151 
   154 
   152 /*!
   155 /*!
   153     \property QRadioTuner::state
   156     \property QRadioTuner::state
   154     Return the current radio tuner state.
   157     Return the current radio tuner state.