// called from global shortcut
void PlaylistSequence::CycleRepeatMode() {
  RepeatMode mode = Repeat_Off;
  // we cycle through the repeat modes
  switch (repeat_mode()) {
    case Repeat_Off:
      mode = Repeat_Track;
      break;
    case Repeat_Track:
      mode = Repeat_Album;
      break;
    case Repeat_Album:
      mode = Repeat_Playlist;
      break;
    case Repeat_Playlist:
      mode = Repeat_OneByOne;
      break;
    case Repeat_OneByOne:
      mode = Repeat_Intro;
      break;
    case Repeat_Intro:
      break;
  }

  SetRepeatMode(mode);
}
void PlaylistSequence::Load() {
  loading_ = true;  // Stops these setter functions calling Save()
  SetShuffleMode(
      ShuffleMode(settings_->value("shuffle_mode", Shuffle_Off).toInt()));
  SetRepeatMode(
      RepeatMode(settings_->value("repeat_mode", Repeat_Off).toInt()));
  loading_ = false;
}
IncomingDataParser::IncomingDataParser(Application* app) : app_(app) {
  // Connect all the signals
  // due the player is in a different thread, we cannot access these functions
  // directly
  connect(this, SIGNAL(Play()), app_->player(), SLOT(Play()));
  connect(this, SIGNAL(PlayPause()), app_->player(), SLOT(PlayPause()));
  connect(this, SIGNAL(Pause()), app_->player(), SLOT(Pause()));
  connect(this, SIGNAL(Stop()), app_->player(), SLOT(Stop()));
  connect(this, SIGNAL(StopAfterCurrent()), app_->player(),
          SLOT(StopAfterCurrent()));
  connect(this, SIGNAL(Next()), app_->player(), SLOT(Next()));
  connect(this, SIGNAL(Previous()), app_->player(), SLOT(Previous()));
  connect(this, SIGNAL(SetVolume(int)), app_->player(), SLOT(SetVolume(int)));
  connect(this, SIGNAL(PlayAt(int, Engine::TrackChangeFlags, bool)),
          app_->player(), SLOT(PlayAt(int, Engine::TrackChangeFlags, bool)));
  connect(this, SIGNAL(SeekTo(int)), app_->player(), SLOT(SeekTo(int)));

  connect(this, SIGNAL(SetActivePlaylist(int)), app_->playlist_manager(),
          SLOT(SetActivePlaylist(int)));
  connect(this, SIGNAL(ShuffleCurrent()), app_->playlist_manager(),
          SLOT(ShuffleCurrent()));
  connect(this, SIGNAL(SetRepeatMode(PlaylistSequence::RepeatMode)),
          app_->playlist_manager()->sequence(),
          SLOT(SetRepeatMode(PlaylistSequence::RepeatMode)));
  connect(this, SIGNAL(SetShuffleMode(PlaylistSequence::ShuffleMode)),
          app_->playlist_manager()->sequence(),
          SLOT(SetShuffleMode(PlaylistSequence::ShuffleMode)));
  connect(this, SIGNAL(InsertUrls(int, const QList<QUrl>&, int, bool, bool)),
          app_->playlist_manager(),
          SLOT(InsertUrls(int, const QList<QUrl>&, int, bool, bool)));
  connect(this, SIGNAL(RemoveSongs(int, const QList<int>&)),
          app_->playlist_manager(),
          SLOT(RemoveItemsWithoutUndo(int, const QList<int>&)));
  connect(this, SIGNAL(Open(int)), app_->playlist_manager(), SLOT(Open(int)));
  connect(this, SIGNAL(Close(int)), app_->playlist_manager(), SLOT(Close(int)));

  connect(this, SIGNAL(RateCurrentSong(double)), app_->playlist_manager(),
          SLOT(RateCurrentSong(double)));

#ifdef HAVE_LIBLASTFM
  connect(this, SIGNAL(Love()), InternetModel::Service<LastFMService>(),
          SLOT(Love()));
  connect(this, SIGNAL(Ban()), InternetModel::Service<LastFMService>(),
          SLOT(Ban()));
#endif
}
Esempio n. 4
0
void IncomingDataParser::SetRepeatMode(const pb::remote::Repeat& repeat) {
  switch (repeat.repeat_mode()) {
    case pb::remote::Repeat_Off:
      emit SetRepeatMode(PlaylistSequence::Repeat_Off);
      break;
    case pb::remote::Repeat_Track:
      emit SetRepeatMode(PlaylistSequence::Repeat_Track);
      break;
    case pb::remote::Repeat_Album:
      emit SetRepeatMode(PlaylistSequence::Repeat_Album);
      break;
    case pb::remote::Repeat_Playlist:
      emit SetRepeatMode(PlaylistSequence::Repeat_Playlist);
      break;
    default:
      break;
  }
}
void PlaylistSequence::RepeatActionTriggered(QAction* action) {
  RepeatMode mode = Repeat_Off;
  if (action == ui_->action_repeat_track) mode = Repeat_Track;
  if (action == ui_->action_repeat_album) mode = Repeat_Album;
  if (action == ui_->action_repeat_playlist) mode = Repeat_Playlist;
  if (action == ui_->action_repeat_onebyone) mode = Repeat_OneByOne;
  if (action == ui_->action_repeat_intro) mode = Repeat_Intro;

  SetRepeatMode(mode);
}
Esempio n. 6
0
void PatternShader::calculateAttributesLocations()
{
    mTexcoordSlot = glGetAttribLocation(mHandle, "a_texCoord");
    mPositionSlot = glGetAttribLocation(mHandle, "a_position");
    mColorSlot = glGetAttribLocation(mHandle, "a_srcColor");
    mTransfromSlot = glGetUniformLocation(mHandle, "u_modelView");
    mTextureSamplerSlot = glGetUniformLocation(mHandle, "u_texture");
    mRepeatXSlot = glGetUniformLocation(mHandle, "repeatX");
    mRepeatYslot = glGetUniformLocation(mHandle, "repeatY");
    mTextureSizeSlot = glGetUniformLocation(mHandle, "textureSize");

    glUniform1i(mTextureSamplerSlot, 0);
    SetRepeatMode("no-repeat");
}
Esempio n. 7
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;
  }
}
          app_->player(), SLOT(PlayAt(int,Engine::TrackChangeFlags,bool)));
  connect(this, SIGNAL(SeekTo(int)),
          app_->player(), SLOT(SeekTo(int)));

  // For some connects we have to wait for the playlistmanager
  // to be initialized
  connect(app_->playlist_manager(), SIGNAL(PlaylistManagerInitialized()),
          this, SLOT(PlaylistManagerInitialized()));
}

void IncomingDataParser::PlaylistManagerInitialized() {
  connect(this, SIGNAL(SetActivePlaylist(int)),
          app_->playlist_manager(), SLOT(SetActivePlaylist(int)));
  connect(this, SIGNAL(ShuffleCurrent()),
          app_->playlist_manager(), SLOT(ShuffleCurrent()));
  connect(this, SIGNAL(SetRepeatMode(PlaylistSequence::RepeatMode)),
          app_->playlist_manager()->sequence(),
          SLOT(SetRepeatMode(PlaylistSequence::RepeatMode)));
  connect(this, SIGNAL(SetShuffleMode(PlaylistSequence::ShuffleMode)),
          app_->playlist_manager()->sequence(),
          SLOT(SetShuffleMode(PlaylistSequence::ShuffleMode)));
}

IncomingDataParser::~IncomingDataParser() {
}

bool IncomingDataParser::close_connection() {
  return close_connection_;
}

void IncomingDataParser::Parse(const pb::remote::Message& msg) {