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(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)));

  // For some connects we have to wait for the playlistmanager
  // to be initialized
  connect(app_->playlist_manager(), SIGNAL(PlaylistManagerInitialized()),
          this, SLOT(PlaylistManagerInitialized()));
}
Exemplo n.º 2
0
shared_ptr<SpineItem> SpineItem::PriorStep() const
{
    auto p = Previous();
    while ( p != nullptr && p->Linear() == false )
        p = p->Previous();
    return p;
}
Exemplo n.º 3
0
void CycList::DeleteANode(CListPtr corpse)
{ 
	CListPtr temp;
	//	if(Head==Tail) printf("DELETING ON EMPTY LIST\n");
	if(corpse == Head) //case 1 corpse = Head
		{
			temp=Head;
			Head=Head->Next;
			Tail->Next = Head;
			delete temp;
		}
	else if(corpse == Tail) //case 2 corpse is at the end
		{ 
			temp=Previous(corpse);
			temp->Next=NULL;
			delete corpse;
			Tail=temp;
			Tail->Next = Head;
		}
	else //case 3 corpse is in middle somewhere
		{
			temp=Previous(corpse);
			temp->Next=corpse->Next;
			delete corpse;
		}
	
	CurrentPtr=Head; //Reset the class tempptr
}
Exemplo n.º 4
0
void PrintReverse(node *head)
{
    node *ptr = head;
    while (ptr != NULL)
        ptr = ptr -> next;

    while (Previous(head, ptr) != NULL)
    {
        ptr = Previous(head, ptr);
        if (ptr == head)
            printf("%d\n", ptr -> info);
        else
            printf("%d, ", ptr -> info);
    }
}
Exemplo n.º 5
0
PlayerControl::PlayerControl(Player *player, PlayerHistory *history)
: progress_(new Phonon::SeekSlider(player->media())),
  progress_text_(new QLabel),
  play_pause_(new QPushButton),
  next_(new QPushButton(tr("Next"))),
  previous_(new QPushButton(tr("Previous"))),
  stop_(new QPushButton(tr("Stop"))),
  volume_(new Phonon::VolumeSlider(player->audio()))
{
  QVBoxLayout* vLayout = new QVBoxLayout;
  setLayout(vLayout);

  QHBoxLayout* hLayout1 = new QHBoxLayout;
  hLayout1->addWidget(previous_);
  hLayout1->addWidget(stop_);
  hLayout1->addWidget(play_pause_);
  hLayout1->addWidget(next_);
  hLayout1->addWidget(volume_);

  QHBoxLayout* hLayout2 = new QHBoxLayout;
  hLayout2->addWidget(progress_);
  hLayout2->addWidget(progress_text_);

  vLayout->addLayout(hLayout1);
  vLayout->addLayout(hLayout2);

  connect(next_, SIGNAL(clicked()), history, SLOT(Next()));
  connect(previous_, SIGNAL(clicked()), history, SLOT(Previous()));
  connect(play_pause_, SIGNAL(clicked()), player, SLOT(PlayPause()));
  connect(stop_, SIGNAL(clicked()), player, SLOT(Stop()));
  connect(player, SIGNAL(OnStatus(PlayerState)), this, SLOT(Status(PlayerState)));

  Status(PlayerState_Invalid);
}
Exemplo n.º 6
0
ConfirmPage::ConfirmPage(UsagerModel *umodel,
                         VehiculeModel *vmodel,
                         StationModel *smodel,
                         QWidget *parent) :
    Page(parent),
    umodel(umodel),
    vmodel(vmodel),
    smodel(smodel)
{
    addTitle(trUtf8("Confirmer la réservation"));


    editor = new QPlainTextEdit(this);
    editor->setReadOnly(true);
    editor->setFont(QFont("Courier"));


    addWidget(editor);

    QPushButton *btnPrevious = new QPushButton(this);
    btnPrevious->setIcon(QIcon(":/icones/data/icons/arrow_left.png"));
    QPushButton *btnConfirm= new QPushButton(trUtf8("Confirmer"), this);
    btnConfirm->setIcon(QIcon(":/icones/data/icons/tick.png"));
    QPushButton *btnMenu = new QPushButton(trUtf8("Menu"), this);

    addBottomButtons(btnPrevious, btnMenu, btnConfirm);

    connect(btnPrevious, SIGNAL(clicked()), SIGNAL(Previous()));
    connect(btnMenu, SIGNAL(clicked()), SIGNAL(Menu()));
    connect(btnConfirm, SIGNAL(clicked()), SIGNAL(Confirm()));
}
Exemplo n.º 7
0
/** Called every time a frame is read in. Calc RMSD. If not first and not
  * RefTraj SetRefStructure has already been called. When fitting, 
  * SetRefStructure pre-centers the reference coordinates at the origin
  * and puts the translation from origin to reference in Trans[3-5]. 
  */
Action::RetType Action_Rmsd::DoAction(int frameNum, Frame* currentFrame, Frame** frameAddress) {
  // Perform any needed reference actions
  ActionRef( *currentFrame, Fit(), UseMass() );
  // Calculate RMSD
  double rmsdval = CalcRmsd( *currentFrame, SelectedRef(), RefTrans() );
  rmsd_->Add(frameNum, &rmsdval);

  // ---=== Per Residue RMSD ===---
  // Set reference and selected frame for each residue using the previously
  // set-up masks in refResMask and tgtResMask. Use SetFrame instead
  // of SetCoordinates since each residue can be a different size.
  if (perres_) {
    for (int N=0; N < NumResidues_; ++N) {
      if (!resIsActive_[N]) {
        //mprintf("DEBUG:           [%4i] Not Active.\n",N);
        continue;
      }
      ResRefFrame_->SetFrame(RefFrame(), refResMask_[N]);
      ResFrame_->SetFrame(*currentFrame, tgtResMask_[N]);
      if (perrescenter_) {
        ResFrame_->CenterOnOrigin(false);
        ResRefFrame_->CenterOnOrigin(false);
      }
      double R = ResFrame_->RMSD_NoFit(*ResRefFrame_, UseMass());
      //mprintf("DEBUG:           [%4i] Res [%s] nofit RMSD to [%s] = %lf\n",N,
      //        tgtResMask[N]->MaskString(),refResMask[N]->MaskString(),R);
      PerResRMSD_[N]->Add(frameNum, &R);
    }
  }

  if (Previous())
    SetRefStructure( *currentFrame, Fit(), UseMass() );

  return Action::OK;
}
Exemplo n.º 8
0
Vector3 Drag::Delta()
// ----------------------------------------------------------------------------
//   Return the difference between the last mouse position and current one
// ----------------------------------------------------------------------------
{
    return Current() - Previous();
}
SelectPositionPage::SelectPositionPage(QWidget *parent) :
    Page(parent)
{
    addTitle(trUtf8("Choisir une position\n(2 / 5)"));

    CarteScene *scene = CarteScene::readSceneFile("data/xml/map_montreal.osm");
    CarteWidget::setScene(scene);

    mapWidget = new CarteWidget(this);
    addWidget(mapWidget);

    QPushButton *btnPrevious = new QPushButton(this);
    btnPrevious->setIcon(QIcon(":/icones/data/icons/arrow_left.png"));
    btnNext = new QPushButton(this);
    btnNext->setIcon(QIcon(":/icones/data/icons/arrow_right.png"));
    QPushButton *btnMenu = new QPushButton(trUtf8("Menu"), this);
    btnNext->setEnabled(false);

    addBottomButtons(btnPrevious, btnMenu, btnNext);

    connect(mapWidget, SIGNAL(editFinished()), this, SLOT(enableNextButton()));
    connect(btnPrevious, SIGNAL(clicked()), SIGNAL(Previous()));
    connect(btnMenu, SIGNAL(clicked()), SIGNAL(Menu()));
    connect(btnNext, SIGNAL(clicked()), SIGNAL(Next()));
}
Exemplo n.º 10
0
float LookAhead::Cosine()
{
  if(cosine < 1.5)
    return cosine;
    
  cosine = 0.0;
  float a2 = 0.0;
  float b2 = 0.0;
  float m1;
  float m2;
  for(int8_t i = 0; i < AXES; i++)
  {
	m1 = MachineToEndPoint(i);
    m2 = Next()->MachineToEndPoint(i) - m1;
    m1 = m1 - Previous()->MachineToEndPoint(i);
    a2 += m1*m1;
    b2 += m2*m2;
    cosine += m1*m2;
  }
  
  if(a2 <= 0.0 || b2 <= 0.0)
  {
	cosine = 0.0;		// one of the moves is just an extruder move (probably a retraction), so orthogonal (in 4D space!) to XYZ moves
    return cosine;
  }
 
  cosine = cosine/( (float)sqrt(a2) * (float)sqrt(b2) );
  return cosine;
}
Exemplo n.º 11
0
void DebugMenu::Update( float fDeltaTime )
{
    bool bChanged = false;
    if( m_fTimeSinceLastUpdate > TIME_BEFORE_UPDATE )
    {
        if( m_iFlags & E_INCREMENT )
        {
            Increment();
            bChanged = true;
        }
        if( m_iFlags & E_DECREMENT )
        {
            Decrement();
            bChanged = true;
        }
        if( m_iFlags & E_NEXT )
        {
            Next();
            bChanged = true;
        }
        if( m_iFlags & E_PREVIOUS )
        {
            Previous();
            bChanged = true;
        }
        if( bChanged )
        {
            m_fTimeSinceLastUpdate = 0.0f;
        }
    }
    else
    {
        m_fTimeSinceLastUpdate += fDeltaTime * 1000.0f;
    }
}
Exemplo n.º 12
0
node *RemoveDuplicates(node *head)
{
    node *ptr = head;
    node *transverse = ptr -> next;
    node *temp;

    while (ptr != NULL)
    {
        while (transverse != NULL)
            if (ptr -> info == transverse -> info)
            {
                temp = transverse;
                transverse = transverse -> next;
                Previous(head, temp) -> next = transverse;
                free(temp);
            }
            else
                transverse = transverse -> next;

        ptr = ptr -> next;
        if (ptr != NULL)
            transverse = ptr -> next;
    }

    return(head);
}
Exemplo n.º 13
0
void AccountMap::Existing( const ID& id ) {
  vector<ID*> list_id(10);
  vector<int> list_score(10);
  int target_score = 1;
  int num_compare = id.size() - 1;
  int score_temp;
  int size = 0;
  SkipListNode* front;
  SkipListNode* back;

  // Set the iteratro go to front and back
  Find(id, front);
  back = Next(front);

  // Stop when get enough data, or two iterator are at the end
  while ((front->data_id.front() != '!' || back->data_id.front() != '{') && \
         (size != 10 || list_score[10] > target_score)
  ) {

    // First move front iteratro
    while (front->data_id.front() != '!' && \
          (num_compare == 0 || id.compare(0, num_compare, front->data_id, 0, num_compare) == 0)
    ) {
      score_temp = calculate_score(id, front->data_id);
      if (size < 10 || score_temp <= list_score.back()) {
        insert_id_to_vector(list_id, list_score, 0, front->data_id, score_temp, size);
      }
      front = Previous(front);
    }
    
    // If get enough data, stop
    if (size == 10 && list_score[10] <= target_score) break;
    
    // If data is not enough, move back iterator
    while (back->data_id.front() != '{' && \
          (num_compare == 0 || id.compare(0, num_compare, back->data_id, 0, num_compare) == 0)
          ) {
      score_temp = calculate_score(id, back->data_id);
      if (size < 10 || score_temp < list_score.back()) {
        insert_id_to_vector(list_id, list_score, 1, back->data_id, score_temp, size);
      }
      back = Next(back);
    }

    // Add the tolerent to score, adjust the number of string to compare
    target_score += 1;
    if (num_compare > 0) num_compare -= 1;
  }

  // Print the result
  bool comma = false;
  for (int i = 0; i < (int)list_score.size(); ++i) {
    if (comma) {
      cout << ',';
    }
    cout << *(list_id[i]);
    comma = true;
  }

}
Exemplo n.º 14
0
 void ParseSymbols()
 {
     StartToken();
     
     switch (Previous())
     {
         case '/':
             if (Current() == '/')
             {
                 ParseLineComment();
                 break;
             }
             else if (Current() == '*')
             {
                 ParseBlockComment();
                 break;
             }
             
             // Yes. No break. This is deliberate.
             
         default:
         {
             String4 tinySource = {};
             tinySource.Append(Previous());
             lastSourceToken.tokenType = TokenType::Reserved;
             lastSourceToken.tokenIndex = FindOperator(tinySource);
             
             for (int i = index; i < length && IsSymbol(source[i]); ++i)
             {
                 tinySource.Append(source[i]);
                 auto tokenIndex = FindOperator(tinySource);
                 
                 if (tokenIndex != -1)
                 {
                     lastSourceToken.tokenIndex = tokenIndex;
                     lastSourceToken.length = i - index + 2;
                 }
             }
             
             int offset = lastSourceToken.length - 1;
             index += offset;
             position.column += offset;
             
             break;
         }
     }
 }
Exemplo n.º 15
0
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
}
Exemplo n.º 16
0
 void Mpris2DBusHandler::Seek( qlonglong time )
 {
     // convert time from microseconds to milliseconds
     time /= 1000;
     int position = The::engineController()->trackPositionMs() + time;
     if( position < 0 )
         Previous();
     else if( position > The::engineController()->trackLength() )
         Next();
     else
         The::engineController()->seek( position );
 }
GlobalShortcuts::GlobalShortcuts(QObject *parent)
  : QObject(parent),
    gnome_backend_(NULL),
    system_backend_(NULL),
    use_gnome_(false),
    rating_signals_mapper_(new QSignalMapper(this))
{
  settings_.beginGroup(kSettingsGroup);

  // Create actions
  AddShortcut("play", tr("Play"), SIGNAL(Play()));
  AddShortcut("pause", tr("Pause"), SIGNAL(Pause()));
  AddShortcut("play_pause", tr("Play/Pause"), SIGNAL(PlayPause()), QKeySequence(Qt::Key_MediaPlay));
  AddShortcut("stop", tr("Stop"), SIGNAL(Stop()), QKeySequence(Qt::Key_MediaStop));
  AddShortcut("stop_after", tr("Stop playing after current track"), SIGNAL(StopAfter()));
  AddShortcut("next_track", tr("Next track"), SIGNAL(Next()), QKeySequence(Qt::Key_MediaNext));
  AddShortcut("prev_track", tr("Previous track"), SIGNAL(Previous()), QKeySequence(Qt::Key_MediaPrevious));
  AddShortcut("inc_volume", tr("Increase volume"), SIGNAL(IncVolume()));
  AddShortcut("dec_volume", tr("Decrease volume"), SIGNAL(DecVolume()));
  AddShortcut("mute", tr("Mute"), SIGNAL(Mute()));
  AddShortcut("seek_forward", tr("Seek forward"), SIGNAL(SeekForward()));
  AddShortcut("seek_backward", tr("Seek backward"), SIGNAL(SeekBackward()));
  AddShortcut("show_hide", tr("Show/Hide"), SIGNAL(ShowHide()));
  AddShortcut("show_osd", tr("Show OSD"), SIGNAL(ShowOSD()));
  AddShortcut("toggle_pretty_osd", tr("Toggle Pretty OSD"), SIGNAL(TogglePrettyOSD())); // Toggling possible only for pretty OSD
  AddShortcut("shuffle_mode", tr("Change shuffle mode"), SIGNAL(CycleShuffleMode()));
  AddShortcut("repeat_mode", tr("Change repeat mode"), SIGNAL(CycleRepeatMode()));
  AddShortcut("toggle_last_fm_scrobbling", tr("Enable/disable Last.fm scrobbling"), SIGNAL(ToggleScrobbling()));
  AddShortcut("global_search_popup", tr("Show Global Search Popup"), SIGNAL(ShowGlobalSearch()));

  AddRatingShortcut("rate_zero_star", tr("Rate the current song 0 stars"), rating_signals_mapper_, 0);
  AddRatingShortcut("rate_one_star", tr("Rate the current song 1 star"), rating_signals_mapper_, 1);
  AddRatingShortcut("rate_two_star", tr("Rate the current song 2 stars"), rating_signals_mapper_, 2);
  AddRatingShortcut("rate_three_star", tr("Rate the current song 3 stars"), rating_signals_mapper_, 3);
  AddRatingShortcut("rate_four_star", tr("Rate the current song 4 stars"), rating_signals_mapper_, 4);
  AddRatingShortcut("rate_five_star", tr("Rate the current song 5 stars"), rating_signals_mapper_, 5);

  connect(rating_signals_mapper_, SIGNAL(mapped(int)), SIGNAL(RateCurrentSong(int)));

  // Create backends - these do the actual shortcut registration
  gnome_backend_ = new GnomeGlobalShortcutBackend(this);

#ifndef Q_OS_DARWIN
  system_backend_ = new QxtGlobalShortcutBackend(this);
#else
  system_backend_ = new MacGlobalShortcutBackend(this);
#endif

  ReloadSettings();
}
Exemplo n.º 18
0
  ///\brief Checks for clashing names when trying to extract a declaration.
  ///
  ///\returns true if there is another declaration with the same name
  bool DeclExtractor::CheckForClashingNames(
                                  const llvm::SmallVector<NamedDecl*, 4>& Decls,
                                            DeclContext* DC, Scope* S) {
    for (size_t i = 0; i < Decls.size(); ++i) {
      NamedDecl* ND = Decls[i];

      if (TagDecl* TD = dyn_cast<TagDecl>(ND)) {
        LookupResult Previous(*m_Sema, ND->getDeclName(), ND->getLocation(),
                              Sema::LookupTagName, Sema::ForRedeclaration
                              );

        m_Sema->LookupName(Previous, S);

        // There is no function diagnosing the redeclaration of tags (eg. enums).
        // So either we have to do it by hand or we can call the top-most
        // function that does the check. Currently the top-most clang function
        // doing the checks creates an AST node, which we don't want.
        if (!CheckTagDeclaration(TD, Previous))
          return true;
      }
      else if (VarDecl* VD = dyn_cast<VarDecl>(ND)) {
        LookupResult Previous(*m_Sema, ND->getDeclName(), ND->getLocation(),
                              Sema::LookupOrdinaryName, Sema::ForRedeclaration
                              );

        m_Sema->LookupName(Previous, S);
        m_Sema->CheckVariableDeclaration(VD, Previous);
        if (VD->isInvalidDecl())
          return true;
        // This var decl will likely get referenced later; claim that it's used.
        VD->setIsUsed();
      }
    }

    return false;
  }
Exemplo n.º 19
0
VOID TProtocol::Delete ()
{
   int fdNew;
   USHORT DoClose = FALSE;
   ULONG Position;

   if (fdDat == -1) {
      fdDat = sopen (DataFile, O_RDWR|O_BINARY|O_CREAT, SH_DENYNO, S_IREAD|S_IWRITE);
      DoClose = TRUE;
   }

   fdNew = sopen ("temp.dat", O_RDWR|O_BINARY|O_CREAT, SH_DENYNO, S_IREAD|S_IWRITE);

   if (fdDat != -1 && fdNew != -1) {
      if ((Position = tell (fdDat)) > 0L)
         Position -= sizeof (PROTOCOL);

      lseek (fdDat, 0L, SEEK_SET);

      while (read (fdDat, &prot, sizeof (PROTOCOL)) == sizeof (PROTOCOL)) {
         if (strcmp (Key, prot.Key))
            write (fdNew, &prot, sizeof (PROTOCOL));
      }

      lseek (fdDat, 0L, SEEK_SET);
      lseek (fdNew, 0L, SEEK_SET);

      while (read (fdNew, &prot, sizeof (PROTOCOL)) == sizeof (PROTOCOL))
            write (fdDat, &prot, sizeof (PROTOCOL));

      chsize (fdDat, tell (fdDat));

      lseek (fdDat, Position, SEEK_SET);
      if (Next () == FALSE) {
         if (Previous () == FALSE)
            New ();
      }
   }

   if (fdNew != -1) {
      close (fdNew);
      unlink ("temp.dat");
   }
   if (fdDat != -1 && DoClose == TRUE) {
      close (fdDat);
      fdDat = -1;
   }
}
Exemplo n.º 20
0
void MediumModeWindow::initNextPrev()
{
    for(int i = 0; i < 2; ++i)
        _nextPrev[i] = new QPushButton(this);

    _nextPrev[0]->setObjectName("Precedent");
    _nextPrev[1]->setObjectName("Suivant");

    _nextPrev[0]->setFixedSize(58, 58);
    _nextPrev[1]->setFixedSize(58, 58);

    _nextPrev[0]->move(20, 240);
    _nextPrev[1]->move(570, 240);

    connect(_nextPrev[0], SIGNAL(clicked()), this, SLOT(Previous()));
    connect(_nextPrev[1], SIGNAL(clicked()), this, SLOT(Next()));
}
Exemplo n.º 21
0
void Chooser::step() {
	previous_.SetFocus(focus_);
	next_.SetFocus(focus_);
	previous_.step();
	next_.step();
	if(focus_)
	{
		if(jngl::keyPressed(jngl::key::Left) || jngl::keyPressed(jngl::key::WizLeft))
		{
			Previous();
		}
		if(jngl::keyPressed(jngl::key::Right) || jngl::keyPressed(jngl::key::WizRight))
		{
			Next();
		}
	}
}
	/// Find and delete pointer from array.
	bool Del(void* pointer)
	{
		if (pointerNum <= 0) return false;
		int rtVal = Find(pointer);
		if (rtVal == -1) return false;
		pointerArray[rtVal] = NULL_POINTER;
		if (rtVal == beginIndex)
		{
			beginIndex = Next(beginIndex);
		}
		if (rtVal == endIndex)
		{
			endIndex = Previous(endIndex);
		}
		pointerNum--;
		return true;
	}
Exemplo n.º 23
0
GlobalShortcuts::GlobalShortcuts(QObject *parent)
    : QObject(parent),
    backend(nullptr) {

    // Create actions
    AddShortcut("play", tr("Play"), SIGNAL(Play()));
    AddShortcut("pause", tr("Pause"), SIGNAL(Pause()));
    AddShortcut("play_pause", tr("Play/Pause"), SIGNAL(PlayPause()), QKeySequence(Qt::Key_MediaPlay));
    AddShortcut("stop", tr("Stop"), SIGNAL(Stop()), QKeySequence(Qt::Key_MediaStop));
    AddShortcut("stop_after", tr("Stop playing after current track"), SIGNAL(StopAfter()));
    AddShortcut("next_track", tr("Next track"), SIGNAL(Next()), QKeySequence(Qt::Key_MediaNext));
    AddShortcut("prev_track", tr("Previous track"), SIGNAL(Previous()), QKeySequence(Qt::Key_MediaPrevious));
    AddShortcut("inc_volume", tr("Increase volume"), SIGNAL(IncVolume()));
    AddShortcut("dec_volume", tr("Decrease volume"), SIGNAL(DecVolume()));
    AddShortcut("mute", tr("Mute"), SIGNAL(Mute()));
    AddShortcut("seek_forward", tr("Seek forward"), SIGNAL(SeekForward()));
    AddShortcut("seek_backward", tr("Seek backward"), SIGNAL(SeekBackward()));

}
Exemplo n.º 24
0
TraceEntry*
TraceEntryIterator::MoveTo(int32 index)
{
	if (index == fIndex)
		return Current();

	if (index <= 0 || index > (int32)sTracingMetaData->Entries()) {
		fIndex = (index <= 0 ? 0 : sTracingMetaData->Entries() + 1);
		fEntry = NULL;
		return NULL;
	}

	// get the shortest iteration path
	int32 distance = index - fIndex;
	int32 direction = distance < 0 ? -1 : 1;
	distance *= direction;

	if (index < distance) {
		distance = index;
		direction = 1;
		fEntry = NULL;
		fIndex = 0;
	}
	if ((int32)sTracingMetaData->Entries() + 1 - fIndex < distance) {
		distance = sTracingMetaData->Entries() + 1 - fIndex;
		direction = -1;
		fEntry = NULL;
		fIndex = sTracingMetaData->Entries() + 1;
	}

	// iterate to the index
	if (direction < 0) {
		while (fIndex != index)
			Previous();
	} else {
		while (fIndex != index)
			Next();
	}

	return Current();
}
Exemplo n.º 25
0
void Application::run()
{
	if (!MMEnu)
	{
		cout << "Pas de menu accocher à l'application en cours! " << endl;
		return;
	}

	this->Again = true;


	do
	{
		this->MMEnu->display(cout);

		switch (this->MMEnu->askChoice(cout))
		{

		case eCREATE:		Create();	break;
		case eREAD:			Read();		break;
		case eUPDATE:		Update();	break;
		case eDELETE:		Delete();	break;
		case eDELETEALL:	DeleteAll(); break;
		case eLIST:			List();		break;
		case eFIRST:		First();	break;
		case eNEXT:			Next();		break;
		case eLAST:			Last();		break;
		case ePREVIOUS:		Previous();	break;
		case eSORT:			Sort();		break;
		case eSEARCH:		Shearch();	break;
		case eERROR:		Error();	break;
		case eQUIT:			Quit();		break;
		default:			Bydefault(); break;

		}


	} while (this->Again);


}
Exemplo n.º 26
0
void Application::Controller(enum_Menu menu)
{
	switch (menu)
	{

	case eCREATE:		Create();	break;
	case eREAD:			Read();		break;
	case eUPDATE:		Update();	break;
	case eDELETE:		Delete();	break;
	case eDELETEALL:	DeleteAll(); break;
	case eLIST:			List();		break;
	case eFIRST:		First();	break;
	case eNEXT:			Next();		break;
	case eLAST:			Last();		break;
	case ePREVIOUS:		Previous();	break;
	case eSORT:			Sort();		break;
	case eSEARCH:		Shearch();	break;
	case eERROR:		Error();	break;
	case eQUIT:			Quit();		break;
	default:			Bydefault(); break;

	}
}
Exemplo n.º 27
0
void CmToggleViews( HWND hWnd )			// respond to '/' by switching views
{
	Section *tmpSection;
	ViewPort *tmpView;
	HMENU	hMenu = GetMenu( hWnd );

	if ( BlendView )					// if in blend mode, turn off blending
		{
		CheckMenuItem( hMenu, CM_BLEND, MF_BYCOMMAND | MF_UNCHECKED );
		delete BlendView;
		BlendView = NULL;
		}

	if ( DomainView )
		{
		tmpView = FrontView;			// swap view pointers only
		FrontView = BackView;
		BackView = tmpView;
		InvalidateRect( hWnd, NULL, FALSE );
		if ( IsWindow(traceWindow) ) PostMessage( traceWindow, UM_UPDATESECTION, 0, 0 );
		}
	else Previous();					// swap sections also so can page correctly
}
int PlayerController::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: playing(); break;
        case 1: stopped(); break;
        case 2: paused(); break;
        case 3: playerStarted((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 4: playerClosed(); break;
        case 5: changeTrackInfo((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break;
        case 6: changePos((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        case 7: passAlbumArt((*reinterpret_cast< CFbsBitmap*(*)>(_a[1]))); break;
        case 8: updateAlbumArt((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 9: CheckPlayerState(); break;
        case 10: Tick(); break;
        case 11: Play(); break;
        case 12: Pause(); break;
        case 13: Next(); break;
        case 14: Previous(); break;
        case 15: SeekForward(); break;
        case 16: SeekBack(); break;
        case 17: StopSeeking(); break;
        case 18: AlbumArtSaved((*reinterpret_cast< CFbsBitmap*(*)>(_a[1]))); break;
        case 19: GoToNowPlaying(); break;
        case 20: ClosePlayer(); break;
        case 21: SeekToPos((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 22: GetState(); break;
        default: ;
        }
        _id -= 23;
    }
    return _id;
}
Exemplo n.º 29
0
void
CachedExtentTree::_CombineFreeExtent(CachedExtent* node)
{
	// node should be inserted first to call this function,
	// otherwise it will overdelete.
	if (node->IsAllocated() == true)
		return;

	CachedExtent* other = Next(node);
	if (other != NULL) {
		if (node->End() == other->offset && node->flags == other->flags) {
			node->length += other->length;
			_RemoveExtent(other);
		}
	}

	other = Previous(node);
	if (other != NULL) {
		if (other->End() == node->offset && node->flags == other->flags) {
			other->length += node->length;
			_RemoveExtent(node);
		}
	}
}
Exemplo n.º 30
0
void CycList::Rewind()
{ 
	if(CurrentPtr != Head) {
		CurrentPtr=Previous(CurrentPtr);
   }
}