Ejemplo n.º 1
0
void IncomingDataParser::InsertUrls(const pb::remote::Message& msg) {
  const pb::remote::RequestInsertUrls& request = msg.request_insert_urls();

  // Extract urls
  QList<QUrl> urls;
  for (auto it = request.urls().begin(); it != request.urls().end(); ++it) {
    std::string s = *it;
    urls << QUrl(QStringFromStdString(s));
  }

  // Insert the urls
  emit InsertUrls(request.playlist_id(), urls, request.position(),
                  request.play_now(), request.enqueue());
}
Ejemplo n.º 2
0
void CVoxSQLite::InsertProfile( const char* username, Profile& rProfile )
{
	//TODO: compile as a member var?
	std::string	strSql = "INSERT INTO Profile "
						 "( [username], [first_name], [last_name], [alias], [sms_signature], [company], [notes], [sex] ) "
//						 "[birthday], [photo] ) "		//TODO
						 "VALUES( ?, ?, ?, ?, ?, ?, ?, ? ); ";

	try
	{
		CppSQLite3Statement stmt = m_db.compileStatement( strSql.c_str() );

		stmt.bind( 1, username	);
		stmt.bind( 2, rProfile.getFirstName().c_str()	);
		stmt.bind( 3, rProfile.getLastName().c_str() 	);
		stmt.bind( 4, rProfile.getAlias().c_str()		);
		stmt.bind( 5, rProfile.getSmsSignature().c_str());
		stmt.bind( 6, rProfile.getCompany().c_str()		);
		stmt.bind( 7, rProfile.getNotes().c_str()		);
		stmt.bind( 8, rProfile.getSex()					);
//		stmt.bind( 10, rProfile.getBirthday()			);
//		stmt.bind( 11, rProfile.getPhoto()				);

		stmt.execDML();		//We expect a return value == 1 (Number of rows changed);
		stmt.reset();

		int nId = (int)m_db.lastRowId();

		InsertUrls			 ( nId, rProfile.getUrls()			  );
		InsertStreetAddresses( nId, rProfile.getStreetAddresses() );
		InsertEmailAddresses ( nId, rProfile.getEmailAddresses()  );
		InsertTelephones	 ( nId, rProfile.getTelephones()	  );
	}

	catch (CppSQLite3Exception& e)
	{
		e.errorCode();
	}
}
Ejemplo n.º 3
0
void IncomingDataParser::Parse(const pb::remote::Message& msg) {
  close_connection_ = false;

  RemoteClient* client = qobject_cast<RemoteClient*>(sender());

  // Now check what's to do
  switch (msg.type()) {
    case pb::remote::CONNECT:
      ClientConnect(msg);
      break;
    case pb::remote::DISCONNECT:
      close_connection_ = true;
      break;
    case pb::remote::REQUEST_PLAYLISTS:
      SendPlaylists(msg);
      break;
    case pb::remote::REQUEST_PLAYLIST_SONGS:
      GetPlaylistSongs(msg);
      break;
    case pb::remote::SET_VOLUME:
      emit SetVolume(msg.request_set_volume().volume());
      break;
    case pb::remote::PLAY:
      emit Play();
      break;
    case pb::remote::PLAYPAUSE:
      emit PlayPause();
      break;
    case pb::remote::PAUSE:
      emit Pause();
      break;
    case pb::remote::STOP:
      emit Stop();
      break;
    case pb::remote::STOP_AFTER:
      emit StopAfterCurrent();
      break;
    case pb::remote::NEXT:
      emit Next();
      break;
    case pb::remote::PREVIOUS:
      emit Previous();
      break;
    case pb::remote::CHANGE_SONG:
      ChangeSong(msg);
      break;
    case pb::remote::SHUFFLE_PLAYLIST:
      emit ShuffleCurrent();
      break;
    case pb::remote::REPEAT:
      SetRepeatMode(msg.repeat());
      break;
    case pb::remote::SHUFFLE:
      SetShuffleMode(msg.shuffle());
      break;
    case pb::remote::SET_TRACK_POSITION:
      emit SeekTo(msg.request_set_track_position().position());
      break;
    case pb::remote::INSERT_URLS:
      InsertUrls(msg);
      break;
    case pb::remote::REMOVE_SONGS:
      RemoveSongs(msg);
      break;
    case pb::remote::OPEN_PLAYLIST:
      OpenPlaylist(msg);
      break;
    case pb::remote::CLOSE_PLAYLIST:
      ClosePlaylist(msg);
      break;
    case pb::remote::LOVE:
      emit Love();
      break;
    case pb::remote::BAN:
      emit Ban();
      break;
    case pb::remote::GET_LYRICS:
      emit GetLyrics();
      break;
    case pb::remote::DOWNLOAD_SONGS:
      emit SendSongs(msg.request_download_songs(), client);
      break;
    case pb::remote::SONG_OFFER_RESPONSE:
      emit ResponseSongOffer(client, msg.response_song_offer().accepted());
      break;
    case pb::remote::GET_LIBRARY:
      emit SendLibrary(client);
      break;
    case pb::remote::RATE_SONG:
      RateSong(msg);
      break;
    default:
      break;
  }
}