Nested class becomes single class.

preferencesAboutTextFull
Aleksei Kanash 12 years ago
parent 5b68ea125a
commit 1c2069ce73
  1. 31
      src/domain/UBGraphicsMediaItem.cpp
  2. 41
      src/domain/UBGraphicsMediaItem.h
  3. 4
      src/domain/UBGraphicsMediaItemDelegate.cpp

@ -23,6 +23,33 @@
#include "board/UBBoardController.h"
#include "core/memcheck.h"
UBAudioPresentationWidget::UBAudioPresentationWidget(QWidget *parent)
: QWidget(parent)
, mBorderSize(10)
, mTitleSize(10)
{
}
void UBAudioPresentationWidget::paintEvent(QPaintEvent *event)
{
QPainter painter(this);
painter.fillRect(rect(), QBrush(Qt::black));
if (QString() != mTitle)
{
painter.setPen(QPen(Qt::white));
QRect titleRect = rect();
titleRect.setX(mBorderSize);
titleRect.setY(2);
titleRect.setHeight(15);
painter.drawText(titleRect, mTitle);
}
QWidget::paintEvent(event);
}
bool UBGraphicsMediaItem::sIsMutedByDefault = false;
UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsItem *parent)
@ -67,9 +94,9 @@ UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsIte
mAudioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this);
mMediaObject->setTickInterval(1000);
mAudioWidget = new UBGraphicsMediaItem::UBAudioPresentationWidget();
mAudioWidget = new UBAudioPresentationWidget();
int borderSize = 0;
UBGraphicsMediaItem::UBAudioPresentationWidget* pAudioWidget = dynamic_cast<UBGraphicsMediaItem::UBAudioPresentationWidget*>(mAudioWidget);
UBAudioPresentationWidget* pAudioWidget = dynamic_cast<UBAudioPresentationWidget*>(mAudioWidget);
if (pAudioWidget)
{
borderSize = pAudioWidget->borderSize();

@ -23,52 +23,27 @@
#include "board/UBBoardController.h"
#include "frameworks/UBFileSystemUtils.h"
class UBGraphicsMediaItem : public UBGraphicsProxyWidget
{
Q_OBJECT
public:
class UBAudioPresentationWidget : public QWidget
{
public:
UBAudioPresentationWidget(QWidget *parent = NULL)
:QWidget(parent)
, mBorderSize(10)
, mTitleSize(10)
{}
UBAudioPresentationWidget(QWidget *parent = NULL);
int borderSize()
{
return mBorderSize;
}
int borderSize() {return mBorderSize;}
void setTitle(QString title = QString()){mTitle = title;}
QString getTitle(){return mTitle;}
private:
virtual void paintEvent(QPaintEvent *event)
{
QPainter painter(this);
painter.fillRect(rect(), QBrush(Qt::black));
if (QString() != mTitle)
{
painter.setPen(QPen(Qt::white));
QRect titleRect = rect();
titleRect.setX(mBorderSize);
titleRect.setY(2);
titleRect.setHeight(15);
painter.drawText(titleRect, mTitle);
}
QWidget::paintEvent(event);
}
virtual void paintEvent(QPaintEvent *event);
int mBorderSize;
int mTitleSize;
QString mTitle;
};
class UBGraphicsMediaItem : public UBGraphicsProxyWidget
{
Q_OBJECT
public:
typedef enum{
mediaType_Video,
@ -122,7 +97,7 @@ public:
virtual void setSourceUrl(const QUrl &pSourceUrl)
{
UBGraphicsMediaItem::UBAudioPresentationWidget* pAudioWidget = dynamic_cast<UBGraphicsMediaItem::UBAudioPresentationWidget*>(mAudioWidget);
UBAudioPresentationWidget* pAudioWidget = dynamic_cast<UBAudioPresentationWidget*>(mAudioWidget);
if (pAudioWidget)
{
pAudioWidget->setTitle(UBFileSystemUtils::lastPathComponent(pSourceUrl.toLocalFile()));

@ -138,7 +138,7 @@ void UBGraphicsMediaItemDelegate::positionHandles()
else if (mediaItem->getMediaType() == UBGraphicsMediaItem::mediaType_Audio)
{
int borderSize = 0;
UBGraphicsMediaItem::UBAudioPresentationWidget *audioWidget = dynamic_cast<UBGraphicsMediaItem::UBAudioPresentationWidget*>(delegated()->widget());
UBAudioPresentationWidget *audioWidget = dynamic_cast<UBAudioPresentationWidget*>(delegated()->widget());
if (audioWidget)
borderSize = audioWidget->borderSize();
@ -162,7 +162,7 @@ void UBGraphicsMediaItemDelegate::positionHandles()
}
toolBarMinimumWidth += mToolBarItem->boundingRect().height();
UBGraphicsMediaItem::UBAudioPresentationWidget* pAudioWidget = dynamic_cast<UBGraphicsMediaItem::UBAudioPresentationWidget*>(delegated()->widget());
UBAudioPresentationWidget* pAudioWidget = dynamic_cast<UBAudioPresentationWidget*>(delegated()->widget());
if (pAudioWidget)
{
pAudioWidget->setMinimumSize(toolBarMinimumWidth + (int)mMediaControl->lcdAreaSize().width() + (int)mMediaControl->rect().height(),26+pAudioWidget->borderSize());

Loading…
Cancel
Save