Logo Search packages:      
Sourcecode: basket version File versions  Download package

void Item::movieStatus ( int  status  )  [slot]

When a user drop a .gif file, for instance, we don't know if it is an image or an animtion (gif file contain multiple images). To determin that, we assume this is an animation and count the number of images. QMovie send, in this order:

  • For a unique image: QMovie::EndOfFrame, QMovie::EndOfLoop, QMovie::EndOfMovie.
  • For animation: QMovie::EndOfFrame... (for each image), QMovie::EndOfLoop, and it then restart that for each loop.

Definition at line 1037 of file item.cpp.

References Basket::ensureVisibleItem().

{
      static int oldStatus = -100;

      // At least two frames: it's an animation, everything is OK
      if (oldStatus == QMovie::EndOfFrame && status == QMovie::EndOfFrame) {
            m_item->movie()->disconnectStatus(this);
            oldStatus = -100;
            if (m_isFocused)   // When inserting a new item we ensure it visble
                  m_parentBasket->ensureVisibleItem(this); //  But after loading it has certainly grown and if it was
      }
      // Only one image: it's an image, change item's type
      else if (oldStatus == QMovie::EndOfFrame && status == QMovie::EndOfLoop) {
            m_item->movie()->disconnectStatus(this);
            oldStatus = -100;
            m_type = Image;
            QTimer::singleShot(0,   this, SLOT(loadContent()));    // Delayed to avoid crash!
            QTimer::singleShot(100, this, SLOT(saveProperties())); // We should save it's an image and not an animation
            if (m_isFocused)
                  QTimer::singleShot(25, this, SLOT(delayedEnsureVisible()));
      }
      else
            oldStatus = status;
}


Generated by  Doxygen 1.6.0   Back to index