void FeedPanel::SetFeed(const wxString& resource, int delay) { // Already watching this feed if (resource == feedResource) return; Twitter &twitter = wxGetApp().GetTwitter(); if (feedResource != _T("")) { // unregister the old resource twitter.UnregisterListener(*this, feedResource); twitter.GetFeed(feedResource)->Pause(); SetItemCount(0); // flush the data } // Load any residual data in the feedResource feedResource = resource; TwitterFeed *feed = wxGetApp().GetTwitter().GetFeed(feedResource); if (feed) { SetItemCount(GetStatusSize()); } else { // Attempt to de-serialize any saved data feed = Serializer<wxString, TwitterFeed>().Read(feedResource); if (feed) { twitter.LoadFeed(feedResource, feed); SetItemCount(GetStatusSize()); } } // register the listener and begin the monitoring threads twitter.RegisterListener(*this, feedResource); twitter.BeginFeed(feedResource, delay); }
const TwitterStatus FeedPanel::GetStatusItem(unsigned int n) const { unsigned int count = 0; const TwitterFeed *feed = wxGetApp().GetTwitter().GetFeed(feedResource); const std::vector<TwitterStatus>& statuses = feed->GetStatuses(); n = (GetStatusSize() - 1) - n; // reverse n index FilteredIterator it(statuses.begin(), statuses.end(), filter); for (; it != statuses.end(); ++it, ++count) { if (count - 1 == n) return *it; } throw "invalid status item"; }
void FeedPanel::OnFeedUpdated(wxCommandEvent &event) { SetItemCount(GetStatusSize()); RefreshAll(); }
void RefreshStatusBar( gedict_t * pl ) { int win; int sec; gedict_t *te; const char *status_size,*status; char stmp[1024]; int clip; if ( !pl->StatusBarSize ) { pl->StatusRefreshTime = g_globalvars.time + 60; return; } pl->StatusRefreshTime = g_globalvars.time + 1.5; if ( !pl->playerclass ) return; status_size = GetStatusSize( pl ); status = default_status; if ( pl->playerclass == 9 || ( (pl->playerclass == 2 || pl->playerclass == 3 || pl->playerclass == 5 || pl->playerclass == 6 || pl->playerclass == 7 || tg_data.tg_sbar) && tfset(tg_enabled)) ) { /// eng sbar status = GetEngSbar( pl ); } else { if ( pl->playerclass == 8 ) status = GetSpySbar( pl ); if ( pl->playerclass == 4 ) { if ( pl->is_detpacking ) { status = " setting detpack "; } else { for ( te = world; (te = trap_find( te, FOFS( s.v.classname ), "detpack" ));) { if ( te->s.v.owner != EDICT_TO_PROG( self ) ) continue; _snprintf( stmp, sizeof(stmp) , "Detpack: %d ", ( int ) ( te->s.v.nextthink - g_globalvars.time ) ); status = stmp; break; } } } if ( pl->playerclass == 1 ) { _snprintf( stmp, sizeof(stmp), "Scan %3d %s%s %3s ", pl->ScanRange, ( pl->tf_items_flags & 1 ) ? "En" : " ", ( pl->tf_items_flags & 2 ) ? "Fr" : " ", ( pl->ScannerOn ) ? "On " : "Off" ); status = stmp; } } win = TeamFortress_TeamGetWinner( ); sec = TeamFortress_TeamGetSecond( ); clip = GetClipSize( pl ); if( clip >= 0) G_centerprint( pl, "%s%s\n%s%3d %s%3d " _C _L _I _P ":%2d\n", status_size, status, teamnames[win], TeamFortress_TeamGetScore( win ), teamnames[sec], TeamFortress_TeamGetScore( sec ), clip); else G_centerprint( pl, "%s%s\n%s%3d %s%3d \n", status_size, status, teamnames[win], TeamFortress_TeamGetScore( win ), teamnames[sec], TeamFortress_TeamGetScore( sec )); }