int main(int argc, char* argv[])
{
    ros::init(argc, argv, "twitcher_connection_node");
    
    ros::NodeHandle nh;
    
    handler = new TwitterRequestHandler;
    
    TwitterMentionsMonitor monitor(nh, *handler);
    
    /* Initialize a SendTweet Action server */
    SendTweetServer sendTweet("send_tweet", *handler);
    
    idConverter = nh.advertiseService("twitter/handle_from_id", idConverterCallback);
    
    ros::spin();
    
    delete handler;

    return 0;
    
}
Пример #2
0
CuculusView::CuculusView(QWidget *)
  : m_currentTweetIndex( 0 )
{
  setObjectName( "view" );

  m_model = new CuculusModel;

  QBoxLayout *mainLayout = new QHBoxLayout( this );
  
  QBoxLayout *topLayout = new QVBoxLayout;
  mainLayout->addLayout( topLayout );

  m_timeLabel = new QLabel;
  topLayout->addWidget( m_timeLabel );
  m_timeLabel->setAlignment( Qt::AlignCenter );

  connect( &m_timeLabelTimer, SIGNAL( timeout() ), SLOT( updateTimeLabel() ) );
  m_timeLabelTimer.start( 60 * 1000 );

  QBoxLayout *countLayout = new QHBoxLayout;
  topLayout->addLayout( countLayout );

  QLabel *label = new QLabel( i18n("What are you doing?") );
  countLayout->addWidget( label );

  countLayout->addStretch( 1 );

  m_countLabel = new QLabel;
  countLayout->addWidget( m_countLabel );


  m_tweetEdit = new QTextEdit;
  m_tweetEdit->setFixedHeight( 60 );
  topLayout->addWidget( m_tweetEdit );
  connect( m_tweetEdit, SIGNAL( textChanged() ), SLOT( updateEditCount() ) );
  connect( m_tweetEdit, SIGNAL( textChanged() ), SLOT( checkUpdateButton() ) );

  m_updateButton = new QPushButton( "Update" );
  topLayout->addWidget( m_updateButton );
  connect( m_updateButton, SIGNAL( clicked() ), SLOT( sendTweet() ) );


  QBoxLayout *updateLayout = new QHBoxLayout;
  topLayout->addLayout( updateLayout );
  
  updateLayout->addStretch( 1 );

  QPushButton *button = new QPushButton( "Get latest tweets" );
  updateLayout->addWidget( button );
  connect( button, SIGNAL( clicked() ), SLOT( updateTimeline() ) );


  m_upButton = new QPushButton;
  connect( m_upButton, SIGNAL( clicked() ), SLOT( pageUp() ) );
  QString picPath = KStandardDirs::locate( "appdata", "1uparrow.png" );
  m_upButton->setIcon( QPixmap( picPath ) );
  topLayout->addWidget( m_upButton );

  m_tweetsView = new TweetListView;
  topLayout->addWidget( m_tweetsView, 1 );
  m_tweetsView->setStyleSheet("background-color: white");

  m_downButton = new QPushButton;
  connect( m_downButton, SIGNAL( clicked() ), SLOT( pageDown() ) );
  picPath = KStandardDirs::locate( "appdata", "1downarrow.png" );
  m_downButton->setIcon( QPixmap( picPath ) );
  topLayout->addWidget( m_downButton );


  FriendsView *friendsView = new FriendsView;
  mainLayout->addWidget( friendsView );

  
  updateEditCount();
  checkUpdateButton();
  updateTimeLabel();
  updatePageButtons();
  
  settingsChanged();
  setAutoFillBackground(true);

  updateTimeline();
}