From dad668683f593211348fd6373625707e18f557b4 Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Tue, 12 Mar 2013 15:34:13 +0100 Subject: [PATCH] removed unsed code --- src/domain/UBGraphicsAudioItem.h | 22 -------------- src/domain/UBGraphicsMediaItem.cpp | 34 +++------------------- src/domain/UBGraphicsMediaItem.h | 1 - src/domain/UBGraphicsMediaItemDelegate.cpp | 20 +++++-------- 4 files changed, 11 insertions(+), 66 deletions(-) delete mode 100644 src/domain/UBGraphicsAudioItem.h diff --git a/src/domain/UBGraphicsAudioItem.h b/src/domain/UBGraphicsAudioItem.h deleted file mode 100644 index fc7ee6ba..00000000 --- a/src/domain/UBGraphicsAudioItem.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2012 Webdoc SA - * - * This file is part of Open-Sankoré. - * - * Open-Sankoré is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, version 3 of the License, - * with a specific linking exception for the OpenSSL project's - * "OpenSSL" library (or with modified versions of it that use the - * same license as the "OpenSSL" library). - * - * Open-Sankoré is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Open-Sankoré. If not, see . - */ - - diff --git a/src/domain/UBGraphicsMediaItem.cpp b/src/domain/UBGraphicsMediaItem.cpp index e84bfb21..87356f38 100644 --- a/src/domain/UBGraphicsMediaItem.cpp +++ b/src/domain/UBGraphicsMediaItem.cpp @@ -35,7 +35,6 @@ UBAudioPresentationWidget::UBAudioPresentationWidget(QWidget *parent) : QWidget(parent) , mBorderSize(10) - , mTitleSize(10) { } @@ -44,7 +43,7 @@ void UBAudioPresentationWidget::paintEvent(QPaintEvent *event) { QPainter painter(this); painter.fillRect(rect(), QBrush(Qt::white)); - + QPen borderPen; borderPen.setWidth(2); borderPen.setColor(QColor(Qt::black)); @@ -52,16 +51,6 @@ void UBAudioPresentationWidget::paintEvent(QPaintEvent *event) painter.setPen(borderPen); painter.drawRect(0,0, width(), height()); - if (QString() != mTitle) - { - painter.setPen(QPen(Qt::black)); - QRect titleRect = rect(); - titleRect.setX(mBorderSize); - titleRect.setY(2); - titleRect.setHeight(15); - painter.drawText(titleRect, mTitle); - } - QWidget::paintEvent(event); } @@ -112,9 +101,7 @@ UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsIte int borderSize = 0; UBAudioPresentationWidget* pAudioWidget = dynamic_cast(mAudioWidget); if (pAudioWidget) - { borderSize = pAudioWidget->borderSize(); - } mAudioWidget->resize(320,26+2*borderSize); //3*border size with enabled title mAudioWidget->setMinimumSize(150,26+borderSize); @@ -166,26 +153,19 @@ QVariant UBGraphicsMediaItem::itemChange(GraphicsItemChange change, const QVaria || (change == QGraphicsItem::ItemVisibleChange)) { if (mMediaObject && (!isEnabled() || !isVisible() || !scene())) - { mMediaObject->pause(); - } } else if (change == QGraphicsItem::ItemSceneHasChanged) { if (!scene()) - { mMediaObject->stop(); - } - else - { + else { QString absoluteMediaFilename; - if(mMediaFileUrl.toLocalFile().startsWith("audios/") || mMediaFileUrl.toLocalFile().startsWith("videos/")){ + if(mMediaFileUrl.toLocalFile().startsWith("audios/") || mMediaFileUrl.toLocalFile().startsWith("videos/")) absoluteMediaFilename = scene()->document()->persistencePath() + "/" + mMediaFileUrl.toLocalFile(); - } - else{ + else absoluteMediaFilename = mMediaFileUrl.toLocalFile(); - } if (absoluteMediaFilename.length() > 0) mMediaObject->setCurrentSource(Phonon::MediaSource(absoluteMediaFilename)); @@ -199,12 +179,6 @@ QVariant UBGraphicsMediaItem::itemChange(GraphicsItemChange change, const QVaria void UBGraphicsMediaItem::setSourceUrl(const QUrl &pSourceUrl) { - UBAudioPresentationWidget* pAudioWidget = dynamic_cast(mAudioWidget); - if (pAudioWidget) - { - pAudioWidget->setTitle(UBFileSystemUtils::lastPathComponent(pSourceUrl.toString())); - } - UBItem::setSourceUrl(pSourceUrl); } diff --git a/src/domain/UBGraphicsMediaItem.h b/src/domain/UBGraphicsMediaItem.h index 63a63a7b..880725bc 100644 --- a/src/domain/UBGraphicsMediaItem.h +++ b/src/domain/UBGraphicsMediaItem.h @@ -45,7 +45,6 @@ private: virtual void paintEvent(QPaintEvent *event); int mBorderSize; - int mTitleSize; QString mTitle; }; diff --git a/src/domain/UBGraphicsMediaItemDelegate.cpp b/src/domain/UBGraphicsMediaItemDelegate.cpp index ea1ae07f..17a14152 100644 --- a/src/domain/UBGraphicsMediaItemDelegate.cpp +++ b/src/domain/UBGraphicsMediaItemDelegate.cpp @@ -60,10 +60,9 @@ UBGraphicsMediaItemDelegate::UBGraphicsMediaItemDelegate(UBGraphicsMediaItem* pD connect(mToolBarShowTimer, SIGNAL(timeout()), this, SLOT(hideToolBar())); mToolBarShowTimer->setInterval(m_iToolBarShowingInterval); } + if (delegated()->isMuted()) - { delegated()->setMute(true); - } //Wrapper function. Use it to set correct data() to QGraphicsItem as well setFlippable(false); @@ -97,13 +96,13 @@ void UBGraphicsMediaItemDelegate::buildButtons() mMediaControl = new DelegateMediaControl(delegated(), mToolBarItem); mMediaControl->setFlag(QGraphicsItem::ItemIsSelectable, true); UBGraphicsItem::assignZValue(mMediaControl, delegated()->zValue()); - + if (delegated()->isMuted()) mMuteButton = new DelegateButton(":/images/soundOff.svg", mDelegated, mToolBarItem, Qt::TitleBarArea); else mMuteButton = new DelegateButton(":/images/soundOn.svg", mDelegated, mToolBarItem, Qt::TitleBarArea); - connect(mMuteButton, SIGNAL(clicked(bool)), delegated(), SLOT(toggleMute())); + connect(mMuteButton, SIGNAL(clicked(bool)), delegated(), SLOT(toggleMute())); connect(mMuteButton, SIGNAL(clicked(bool)), this, SLOT(toggleMute())); // for changing button image mToolBarButtons << mPlayPauseButton << mStopButton << mMuteButton; @@ -145,7 +144,7 @@ void UBGraphicsMediaItemDelegate::positionHandles() { QRectF toolBarRect = mToolBarItem->rect(); if (mediaItem->getMediaType() == UBGraphicsMediaItem::mediaType_Video) - { + { mToolBarItem->setPos(0, delegated()->boundingRect().height()-mToolBarItem->rect().height()); toolBarRect.setWidth(delegated()->boundingRect().width()); @@ -186,15 +185,10 @@ void UBGraphicsMediaItemDelegate::positionHandles() mMediaControl->setRect(mediaItemRect); mToolBarItem->positionHandles(); - mMediaControl->positionHandles(); + mMediaControl->positionHandles(); - if (mediaItem) - { - if (mediaItem->getMediaType() == UBGraphicsMediaItem::mediaType_Audio) - { - mToolBarItem->show(); - } - } + if (mediaItem && mediaItem->getMediaType() == UBGraphicsMediaItem::mediaType_Audio) + mToolBarItem->show(); } void UBGraphicsMediaItemDelegate::remove(bool canUndo)