コード例 #1
0
ファイル: networkremote.cpp プロジェクト: BrummbQ/Clementine
void NetworkRemote::AcceptConnection() {
  if (!signals_connected_) {
    signals_connected_ = true;

    // Setting up the signals, but only once
    connect(incoming_data_parser_.get(), SIGNAL(SendClementineInfo()),
            outgoing_data_creator_.get(), SLOT(SendClementineInfo()));
    connect(incoming_data_parser_.get(), SIGNAL(SendFirstData(bool)),
            outgoing_data_creator_.get(), SLOT(SendFirstData(bool)));
    connect(incoming_data_parser_.get(), SIGNAL(SendAllPlaylists()),
            outgoing_data_creator_.get(), SLOT(SendAllPlaylists()));
    connect(incoming_data_parser_.get(), SIGNAL(SendAllActivePlaylists()),
            outgoing_data_creator_.get(), SLOT(SendAllActivePlaylists()));
    connect(incoming_data_parser_.get(), SIGNAL(SendPlaylistSongs(int)),
            outgoing_data_creator_.get(), SLOT(SendPlaylistSongs(int)));

    connect(app_->playlist_manager(), SIGNAL(ActiveChanged(Playlist*)),
            outgoing_data_creator_.get(), SLOT(ActiveChanged(Playlist*)));
    connect(app_->playlist_manager(), SIGNAL(PlaylistChanged(Playlist*)),
            outgoing_data_creator_.get(), SLOT(PlaylistChanged(Playlist*)));
    connect(app_->playlist_manager(), SIGNAL(PlaylistAdded(int,QString,bool)),
            outgoing_data_creator_.get(), SLOT(PlaylistAdded(int,QString,bool)));
    connect(app_->playlist_manager(), SIGNAL(PlaylistRenamed(int,QString)),
            outgoing_data_creator_.get(), SLOT(PlaylistRenamed(int,QString)));
    connect(app_->playlist_manager(), SIGNAL(PlaylistClosed(int)),
            outgoing_data_creator_.get(), SLOT(PlaylistClosed(int)));
    connect(app_->playlist_manager(), SIGNAL(PlaylistDeleted(int)),
            outgoing_data_creator_.get(), SLOT(PlaylistDeleted(int)));

    connect(app_->player(), SIGNAL(VolumeChanged(int)), outgoing_data_creator_.get(),
            SLOT(VolumeChanged(int)));
    connect(app_->player()->engine(), SIGNAL(StateChanged(Engine::State)),
            outgoing_data_creator_.get(), SLOT(StateChanged(Engine::State)));

    connect(app_->playlist_manager()->sequence(),
            SIGNAL(RepeatModeChanged(PlaylistSequence::RepeatMode)),
            outgoing_data_creator_.get(),
            SLOT(SendRepeatMode(PlaylistSequence::RepeatMode)));
    connect(app_->playlist_manager()->sequence(),
            SIGNAL(ShuffleModeChanged(PlaylistSequence::ShuffleMode)),
            outgoing_data_creator_.get(),
            SLOT(SendShuffleMode(PlaylistSequence::ShuffleMode)));

    connect(incoming_data_parser_.get(), SIGNAL(GetLyrics()),
            outgoing_data_creator_.get(), SLOT(GetLyrics()));

    connect(incoming_data_parser_.get(),
            SIGNAL(SendSongs(pb::remote::RequestDownloadSongs,RemoteClient*)),
            outgoing_data_creator_.get(),
            SLOT(SendSongs(pb::remote::RequestDownloadSongs,RemoteClient*)));
    connect(incoming_data_parser_.get(),
            SIGNAL(ResponseSongOffer(RemoteClient*, bool)),
            outgoing_data_creator_.get(),
            SLOT(ResponseSongOffer(RemoteClient*, bool)));

    connect(incoming_data_parser_.get(),
            SIGNAL(SendLibrary(RemoteClient*)),
            outgoing_data_creator_.get(),
            SLOT(SendLibrary(RemoteClient*)));
  }
コード例 #2
0
ファイル: incomingdataparser.cpp プロジェクト: Gu1/Clementine
void IncomingDataParser::ClientConnect(const pb::remote::Message& msg) {
  // Always sned the Clementine infos
  emit SendClementineInfo();

  // Check if we should send the first data
  if (!msg.request_connect().has_send_playlist_songs()  // legacy
      || msg.request_connect().send_playlist_songs()) {
    emit SendFirstData(true);
  } else {
    emit SendFirstData(false);
  }
}