radioapp/radiouiengine/src/radiomonitorservice.cpp
changeset 47 74b7c6e79031
parent 34 bc10a61bd7d3
child 51 bbebb0235466
--- a/radioapp/radiouiengine/src/radiomonitorservice.cpp	Mon Aug 23 14:17:50 2010 +0300
+++ b/radioapp/radiouiengine/src/radiomonitorservice.cpp	Fri Sep 03 12:25:04 2010 +0300
@@ -71,10 +71,18 @@
 void RadioMonitorService::init()
 {
     RadioStationModel* stationModel = &mUiEngine.api().stationModel();
+    Radio::connect( stationModel,   SIGNAL(rowsInserted(QModelIndex,int,int)),
+                    this,           SLOT(notifyFavoriteCount()) );
+    Radio::connect( stationModel,   SIGNAL(rowsInserted(QModelIndex,int,int)),
+                    this,           SLOT(notifyLocalCount()) );
     Radio::connect( stationModel,   SIGNAL(rowsRemoved(QModelIndex,int,int)),
                     this,           SLOT(notifyFavoriteCount()) );
+    Radio::connect( stationModel,   SIGNAL(rowsRemoved(QModelIndex,int,int)),
+                    this,           SLOT(notifyLocalCount()) );
     Radio::connect( stationModel,   SIGNAL(favoriteChanged(RadioStation)),
                     this,           SLOT(notifyFavoriteCount()) );
+    Radio::connect( stationModel,   SIGNAL(favoriteChanged(RadioStation)),
+                    this,           SLOT(notifyLocalCount()) );
     Radio::connect( stationModel,   SIGNAL(stationDataChanged(RadioStation)),
                     this,           SLOT(notifyStationChange(RadioStation)) );
     Radio::connect( stationModel,   SIGNAL(radioTextReceived(RadioStation)),
@@ -126,6 +134,9 @@
     notification.setValue( RadioNotificationData( RadioServiceNotification::FavoriteCount, stationModel.favoriteCount() ) );
     notificationList.append( notification );
 
+    notification.setValue( RadioNotificationData( RadioServiceNotification::LocalCount, stationModel.localCount() ) );
+    notificationList.append( notification );
+
     notification.setValue( RadioNotificationData( RadioServiceNotification::Frequency, RadioStation::parseFrequency( station.frequency() ) ) );
     notificationList.append( notification );
 
@@ -194,6 +205,16 @@
  * Private slot
  *
  */
+void RadioMonitorService::notifyLocalCount()
+{
+    const int localCount = mUiEngine.api().stationModel().localCount();
+    RUN_NOTIFY( LocalCount, localCount );
+}
+
+/*!
+ * Private slot
+ *
+ */
 void RadioMonitorService::notifyStationChange( const RadioStation& station )
 {
     RadioUiEngine& uiEngine = mUiEngine.api();