コード例 #1
0
ファイル: roadmap_groups.c プロジェクト: NoamSheffer/WazeWP7
void roadmap_groups_add_following_group_icon(int index, char *name){

   if (name && *name){
      char temp[GROUP_ICON_MAX_SIZE];
      snprintf(temp, GROUP_ICON_MAX_SIZE, "wazer_%s", name);

      // preload follwing groups icons
      if (roadmap_res_get(RES_BITMAP,RES_SKIN, name) == NULL)
          roadmap_res_download(RES_DOWNLOAD_IMAGE, name, NULL, "",FALSE, 0, NULL, NULL );
   }

   if (index > MAX_GROUPS)
      return;

   if (g_FollowingGroupIcons[index] != NULL)
      free(g_FollowingGroupIcons[index]);

   if (name && *name){
      g_FollowingGroupIcons[index] = strdup(name);
   }
   else{
      g_FollowingGroupIcons[index] = strdup("groups_default_icons");
   }


}
コード例 #2
0
static void download_wide_splash(void){
   time_t update_time  = 0;
   const char *file_name = roadmap_splash_get_splash_name(TRUE);

   roadmap_res_download (RES_DOWNLOAD_COUNTRY_SPECIFIC_IMAGES, file_name, "welcome_wide", "", TRUE, update_time,
                  on_wide_splash_downloaded, NULL);
}
コード例 #3
0
ファイル: roadmap_groups.c プロジェクト: NoamSheffer/WazeWP7
void roadmap_groups_set_active_group_icon(char *name){

   if (name && *name){

      strncpy(g_ActiveGroupIcon, name, sizeof(g_ActiveGroupIcon));

      snprintf(g_ActiveGroupWazerIcon, GROUP_ICON_MAX_SIZE, "wazer_%s", name);

      // preload my active groups icon
      if (roadmap_res_get(RES_BITMAP,RES_SKIN, name) == NULL)
         roadmap_res_download(RES_DOWNLOAD_IMAGE, name, NULL, "",FALSE, 0, NULL, NULL );

      // preload my active groups wazer icon
      if (roadmap_res_get(RES_BITMAP,RES_SKIN, g_ActiveGroupWazerIcon) == NULL)
         roadmap_res_download(RES_DOWNLOAD_IMAGE, g_ActiveGroupWazerIcon, NULL, "",FALSE, 0, NULL, NULL );
   }
   else{
      g_ActiveGroupIcon[0] = 0;
      g_ActiveGroupWazerIcon[0] = 0;
   }
}
コード例 #4
0
ファイル: roadmap_lang.c プロジェクト: Priednis/WazeWP7
void roadmap_lang_download_conf_file(RoadMapCallback callback){
   time_t update_time;
   static BOOL run_once = FALSE;
   const char* last_save_time = roadmap_lang_get_update_time();

   if (run_once)
      return;
   run_once = TRUE;

   if (last_save_time[0] == 0){
      update_time = 0;
   }
   else{
      update_time = WDF_TimeFromModifiedSince(last_save_time);
   }
   roadmap_res_download (RES_DOWNLOAD_CONFIFG, "lang.conf", NULL, "", TRUE, update_time, on_conf_file_downloaded, callback);
}
コード例 #5
0
ファイル: roadmap_lang.c プロジェクト: Daoudai/waze-qt
void roadmap_lang_download_lang_file(const char *lang, RoadMapCallback callback){
   char file_name[256];
   time_t update_time;
   const char* last_save_time = roadmap_lang_get_lang_file_update_time(lang);

   sprintf(file_name, "lang.%s",lang);


   if (last_save_time[0] == 0){
      update_time = 0;
   }
   else{
      update_time = WDF_TimeFromModifiedSince(last_save_time);
   }

   roadmap_res_download (RES_DOWNLOAD_LANG, file_name, NULL, "", TRUE, update_time, on_lang_file_downloaded, (void *)callback);
}
コード例 #6
0
static void download_splash(void){
   time_t update_time;
   const char *file_name = roadmap_splash_get_splash_name(FALSE);
   const char* last_save_time = roadmap_splash_get_update_time();

   // TODO:: Remove this when the splash bug will be fixed
   roadmap_log( ROADMAP_WARNING, "Downloading splash: %s, Canvas: (%d, %d)", file_name, roadmap_canvas_width(), roadmap_canvas_height() );

   if (!file_name)
      return;

   if (last_save_time[0] == 0) {
      update_time = 0;
   }
   else {
      update_time = WDF_TimeFromModifiedSince(last_save_time);
   }
   roadmap_res_download (RES_DOWNLOAD_COUNTRY_SPECIFIC_IMAGES, file_name, "welcome", "", TRUE, update_time,
                  on_splash_downloaded, NULL);

}
コード例 #7
0
ファイル: RealtimeBonus.c プロジェクト: NoamSheffer/WazeWP7
BOOL RealtimeBonus_Add (RTBonus *pbonus) {
   int index;
   int i;


   if (!roadmap_map_settings_road_goodies() && !pbonus->bIsCustomeBonus)
      return TRUE;

   // Full?
   if (MAX_ADD_ONS == gBonusTable.iCount){
      roadmap_log( ROADMAP_ERROR, "RealtimeBonus_Add() - Failed (Table is full)");
      return FALSE;
   }

   if ((pbonus->bIsCustomeBonus) && (g_CustomIndex != -1))
      return TRUE;


   if ((pbonus->bIsCustomeBonus) && !custom_bonus_feature_enabled()){
      Realtime_CollectCustomBonus(pbonus->iID,
            FALSE,
            FALSE);
      editor_points_add_new_points (pbonus->iNumPoints);
      return TRUE;
   }

   if (RealtimeBonus_Exists (pbonus->iID))
      RealtimeBonus_Delete(pbonus->iID);


   for (i = 0; i < MAX_ADD_ONS; i++) {
      if (gBonusTable.bonus[i] == NULL) {
         index = i;
         break;
      }
   }

   gBonusTable.bonus[index] = calloc (1, sizeof(RTBonus));
   RealtimeBonus_Record_Init (gBonusTable.bonus[index]);
   gBonusTable.bonus[index]->iID = pbonus->iID;
   gBonusTable.bonus[index]->iType = pbonus->iType;
   gBonusTable.bonus[index]->iNumPoints = pbonus->iNumPoints;
   gBonusTable.bonus[index]->iToken = pbonus->iToken;
   gBonusTable.bonus[index]->iRadius = pbonus->iRadius;
   gBonusTable.bonus[index]->position.latitude = pbonus->position.latitude;
   gBonusTable.bonus[index]->position.longitude = pbonus->position.longitude;
   gBonusTable.bonus[index]->pIconName = strdup (pbonus->pIconName);
   if (pbonus->pBonusText)
      gBonusTable.bonus[index]->pBonusText = strdup (pbonus->pBonusText);

   if (pbonus->pCollectText)
      gBonusTable.bonus[index]->pCollectText = strdup (pbonus->pCollectText);

   if (pbonus->pCollectTitle)
      gBonusTable.bonus[index]->pCollectTitle = strdup (pbonus->pCollectTitle);

   if (pbonus->pCollectIcon)
      gBonusTable.bonus[index]->pCollectIcon = strdup (pbonus->pCollectIcon);

   gBonusTable.bonus[index]->bIsCustomeBonus = pbonus->bIsCustomeBonus;

   gBonusTable.bonus[index]->collected = FALSE;
   RealtimeBonus_CreateGUIID (gBonusTable.bonus[index]);
   gBonusTable.iCount++;

   if (gBonusTable.bonus[index]->bIsCustomeBonus){
      if (gBonusTable.bonus[index]->iNumPoints != 0)
         gBonusTable.bonus[index]->iType = BONUS_TYPE_POINTS;
      gBonusTable.bonus[index]->iRadius = get_custom_bonus_radius();
      g_CustomIndex = index;
   }
   if (roadmap_res_get(RES_BITMAP,RES_SKIN, gBonusTable.bonus[index]->pIconName) == NULL){
	   if (pbonus->bIsCustomeBonus)
		   printf("download custom %s",gBonusTable.bonus[index]->pIconName);

      roadmap_res_download(RES_DOWNLOAD_IMAGE, gBonusTable.bonus[index]->pIconName,NULL, "",FALSE,0, on_resource_downloaded, NULL );
   }
   else {
	   if (pbonus->bIsCustomeBonus)
		   printf("add custom %s",gBonusTable.bonus[index]->pIconName);
      onBonusAdd (gBonusTable.bonus[index]);
   }
   return TRUE;
}