You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
1.2 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #include "qtavwidget.h"
  2. #define AVDEBUG() qDebug("%s %s @%d", __FILE__, __FUNCTION__, __LINE__);
  3. using namespace QtAV;
  4. const qreal kVolumeInterval = 0.04;
  5. extern QStringList idsToNames(QVector<VideoDecoderId> ids);
  6. extern QVector<VideoDecoderId> idsFromNames(const QStringList& names);
  7. void QLabelSetElideText(QLabel *label, QString text, int W = 0){
  8. QFontMetrics metrix(label->font());
  9. int width = label->width() - label->indent() - label->margin();
  10. if (W || label->parent()) {
  11. int w = W;
  12. if (!w)
  13. w = ((QWidget*)label->parent())->width();
  14. width = qMax(w - label->indent() - label->margin() - 13*(30), 0); //TODO: why 30?
  15. }
  16. QString clippedText = metrix.elidedText(text, Qt::ElideRight, width);
  17. label->setText(clippedText);
  18. }
  19. QtAVWidget::QtAVWidget(QWidget *parent) : QWidget(parent){
  20. QtAV::Widgets::registerRenderers();
  21. mpPlayer = new AVPlayer(this);
  22. //mIsReady = true;
  23. VideoRenderer *vo = VideoRenderer::create((VideoRendererId)property("rendererId").toInt());
  24. if (!vo || !vo->isAvailable() || !vo->widget()) {
  25. QMessageBox::critical(0, QString::fromLatin1("QtAV"), tr("Video renderer is ") + tr("not availabe on your platform!"));
  26. }
  27. //setRenderer(vo);
  28. }