ScrobblesListWidget::ScrobblesListWidget( QWidget* parent )
    :QListWidget( parent ), m_trackItem( 0 )
{
    setVerticalScrollMode( QAbstractItemView::ScrollPerPixel );

#ifdef Q_OS_MAC
    connect( verticalScrollBar(), SIGNAL(valueChanged(int)), SLOT(scroll()) );
#endif

    setAttribute( Qt::WA_MacNoClickThrough );
    setAttribute( Qt::WA_MacShowFocusRect, false );

    setUniformItemSizes( false );
    setSortingEnabled( false );
    setSelectionMode( QAbstractItemView::NoSelection );
    setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );

    connect( qApp, SIGNAL( sessionChanged(unicorn::Session)), SLOT(onSessionChanged(unicorn::Session)));

    connect( &ScrobbleService::instance(), SIGNAL(scrobblesCached(QList<lastfm::Track>)), SLOT(onScrobblesSubmitted(QList<lastfm::Track>) ) );
    connect( &ScrobbleService::instance(), SIGNAL(scrobblesSubmitted(QList<lastfm::Track>)), SLOT(onScrobblesSubmitted(QList<lastfm::Track>) ) );

    connect( &ScrobbleService::instance(), SIGNAL(trackStarted(lastfm::Track,lastfm::Track)), SLOT(onTrackStarted(lastfm::Track,lastfm::Track)));
    connect( &ScrobbleService::instance(), SIGNAL(paused()), SLOT(onPaused()));
    connect( &ScrobbleService::instance(), SIGNAL(resumed()), SLOT(onResumed()));
    connect( &ScrobbleService::instance(), SIGNAL(stopped()), SLOT(onStopped()));

    onSessionChanged( aApp->currentSession() );
}
void
ScrobbleService::setConnection(PlayerConnection*c)
{
    if( m_connection )
    {
        // disconnect from all the objects that we connect to below
        disconnect( m_connection, 0, this, 0);
        if(m_watch)
            m_connection->setElapsed(m_watch->elapsed());
    }

    //
    connect(c, SIGNAL(trackStarted(Track, Track)), SLOT(onTrackStarted(Track, Track)));
    connect(c, SIGNAL(paused()), SLOT(onPaused()));
    connect(c, SIGNAL(resumed()), SLOT(onResumed()));
    connect(c, SIGNAL(stopped()), SLOT(onStopped()));

    connect(c, SIGNAL(trackStarted(Track, Track)), SIGNAL(trackStarted(Track, Track)));
    connect(c, SIGNAL(resumed()), SIGNAL(resumed()));
    connect(c, SIGNAL(paused()), SIGNAL(paused()));
    connect(c, SIGNAL(stopped()), SIGNAL(stopped()));
    connect(c, SIGNAL(bootstrapReady(QString)), SIGNAL( bootstrapReady(QString)));

    m_connection = c;

    if(c->state() == Playing || c->state() == Paused)
        c->forceTrackStarted(Track());

    if( c->state() == Paused )
        c->forcePaused();
}
Beispiel #3
0
int ItemSequencerI::onNotify(int msg, int param1, int param2) {
  switch (msg) {
    case SEQNOTIFY_ONREGISTER: return onRegister();
    case SEQNOTIFY_ONDEREGISTER: return onDeregister();
    case SEQNOTIFY_ONNEXTFILE: return onNextFile();
    case SEQNOTIFY_ONTITLECHANGE: return onTitleChange();
    case SEQNOTIFY_ONSTARTED: return onStarted();
    case SEQNOTIFY_ONSTOPPED: return onStopped();
    case SEQNOTIFY_ONPAUSED: return onPaused();
    case SEQNOTIFY_ONUNPAUSED: return onUnpaused();
  }
  return 0;
}
void Manager::draw(unsigned width, unsigned height)
{
   auto &io = ImGui::GetIO();
   updateMouseState();
   checkHotKeys();

   // Update some per-frame state information
   io.DisplaySize = ImVec2 { static_cast<float>(width), static_cast<float>(height) };
   io.DeltaTime = 1.0f / 60.0f;

   // Start the frame
   ImGui::NewFrame();
   mPaused = decaf::debug::isPaused();
   if (mPaused) {
      auto initiator = decaf::debug::getPauseInitiatorCoreId();
      auto context = decaf::debug::getPausedContext(initiator);
      if (context->nia != mPausedNia) {
         mWasPaused = false;
      }

      if (!mWasPaused) {
         onPaused();
         mPausedNia = context->nia;
         mWasPaused = true;
      }
   }

   if (mVisible) {
      if (decaf::debug::ready() && !mHasBeenActivated) {
         onFirstActivation();
         mHasBeenActivated = true;
      }

      drawMenu();

      for (auto &itr : mWindows) {
         auto window = itr.second;
         auto flags = window->flags();

         if (flags & Window::BringToFront) {
            // Bring window to front
            ImGui::SetNextWindowFocus();
            window->show();

            // Clear the BringToFront flag
            flags = static_cast<Window::Flags>(flags & ~Window::BringToFront);
            window->setFlags(flags);
         }

         if (window->visible()) {
            window->draw();
         }
      }
   }

   if (!mPaused && mWasPaused) {
      // Check if we have transitioned to resumed.
      mPaused = false;
      onResumed();
      mWasPaused = false;
   }

   ImGui::Render();
}