Commit 26038ffc authored by Aleksei Kanash's avatar Aleksei Kanash

Go to content source action is Delegate Button now. It showed for widgets, images and media items.

Some warnings removed.
Fixed source url for async copyed files.
parent 8724a01a
......@@ -78,7 +78,7 @@ void UBAsyncLocalFileDownloader::run()
QFile::remove(mTo);
}
else
emit signal_asyncCopyFinished(mDesc.id, !mTo.isEmpty(), QUrl::fromLocalFile(mTo), QUrl::fromLocalFile(mDesc.originalSrcUrl), "", NULL, mDesc.pos, mDesc.size, mDesc.isBackground);
emit signal_asyncCopyFinished(mDesc.id, !mTo.isEmpty(), QUrl::fromLocalFile(mTo), QUrl(mDesc.originalSrcUrl), "", NULL, mDesc.pos, mDesc.size, mDesc.isBackground);
}
void UBAsyncLocalFileDownloader::abort()
......
......@@ -381,7 +381,6 @@ QSizeF UBGraphicsDelegateFrame::resizeDelegate(qreal moveX, qreal moveY)
return incVector;
}
void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
if (None == mCurrentTool)
......
......@@ -144,7 +144,7 @@ void DelegateButton::startShowProgress()
}
}
UBGraphicsItemDelegate::UBGraphicsItemDelegate(QGraphicsItem* pDelegated, QObject * parent, bool respectRatio, bool canRotate, bool useToolBar)
UBGraphicsItemDelegate::UBGraphicsItemDelegate(QGraphicsItem* pDelegated, QObject * parent, bool respectRatio, bool canRotate, bool useToolBar, bool showGoContentButton)
: QObject(parent)
, mDelegated(pDelegated)
, mDeleteButton(NULL)
......@@ -164,6 +164,7 @@ UBGraphicsItemDelegate::UBGraphicsItemDelegate(QGraphicsItem* pDelegated, QObjec
, mMimeData(NULL)
, mFlippable(false)
, mToolBarUsed(useToolBar)
, mShowGoContentButton(showGoContentButton)
{
connect(UBApplication::boardController, SIGNAL(zoomChanged(qreal)), this, SLOT(onZoomChanged()));
}
......@@ -189,6 +190,13 @@ void UBGraphicsItemDelegate::init()
connect(mMenuButton, SIGNAL(clicked()), this, SLOT(showMenu()));
mButtons << mMenuButton;
if (mShowGoContentButton)
{
mContentSourceButton = new DelegateButton(":/images/home.svg", mDelegated, mFrame, Qt::TopLeftSection);
connect(mContentSourceButton, SIGNAL(clicked()), this, SLOT(gotoContentSource()));
mButtons << mContentSourceButton;
}
mZOrderUpButton = new DelegateButton(":/images/z_layer_up.svg", mDelegated, mFrame, Qt::BottomLeftSection);
mZOrderUpButton->setShowProgressIndicator(true);
connect(mZOrderUpButton, SIGNAL(clicked()), this, SLOT(increaseZLevelUp()));
......@@ -550,10 +558,8 @@ void UBGraphicsItemDelegate::showHide(bool show)
}
void UBGraphicsItemDelegate::gotoContentSource(bool checked)
void UBGraphicsItemDelegate::gotoContentSource()
{
Q_UNUSED(checked)
UBItem* item = dynamic_cast<UBItem*>(mDelegated);
if(item && !item->sourceUrl().isEmpty())
......@@ -624,13 +630,6 @@ void UBGraphicsItemDelegate::decorateMenu(QMenu* menu)
showIcon.addPixmap(QPixmap(":/images/eyeOpened.svg"), QIcon::Normal, QIcon::On);
showIcon.addPixmap(QPixmap(":/images/eyeClosed.svg"), QIcon::Normal, QIcon::Off);
mShowOnDisplayAction->setIcon(showIcon);
mGotoContentSourceAction = menu->addAction(tr("Go to Content Source"), this, SLOT(gotoContentSource(bool)));
QIcon sourceIcon;
sourceIcon.addPixmap(QPixmap(":/images/toolbar/internet.png"), QIcon::Normal, QIcon::On);
mGotoContentSourceAction->setIcon(sourceIcon);
}
void UBGraphicsItemDelegate::updateMenuActionState()
......
......@@ -207,7 +207,7 @@ class UBGraphicsItemDelegate : public QObject
Q_OBJECT
public:
UBGraphicsItemDelegate(QGraphicsItem* pDelegated, QObject * parent = 0, bool respectRatio = true, bool canRotate = false, bool useToolBar = true);
UBGraphicsItemDelegate(QGraphicsItem* pDelegated, QObject * parent = 0, bool respectRatio = true, bool canRotate = false, bool useToolBar = true, bool showGoContentButton = false);
virtual ~UBGraphicsItemDelegate();
......@@ -287,6 +287,7 @@ class UBGraphicsItemDelegate : public QObject
//buttons from the top left section of delegate frame
DelegateButton* mDeleteButton;
DelegateButton* mDuplicateButton;
DelegateButton *mContentSourceButton;
DelegateButton* mMenuButton;
//buttons from the bottom left section of delegate frame
......@@ -308,7 +309,7 @@ class UBGraphicsItemDelegate : public QObject
UBGraphicsToolBarItem* mToolBarItem;
protected slots:
virtual void gotoContentSource(bool checked);
virtual void gotoContentSource();
private:
void updateFrame();
......@@ -330,6 +331,8 @@ private:
/** A boolean saying that this object can be flippable (mirror effect) */
bool mFlippable;
bool mToolBarUsed;
bool mShowGoContentButton;
};
......
......@@ -195,7 +195,7 @@ void UBGraphicsMediaItem::setSourceUrl(const QUrl &pSourceUrl)
UBAudioPresentationWidget* pAudioWidget = dynamic_cast<UBAudioPresentationWidget*>(mAudioWidget);
if (pAudioWidget)
{
pAudioWidget->setTitle(UBFileSystemUtils::lastPathComponent(pSourceUrl.toLocalFile()));
pAudioWidget->setTitle(UBFileSystemUtils::lastPathComponent(pSourceUrl.toString()));
}
UBItem::setSourceUrl(pSourceUrl);
......
......@@ -32,7 +32,7 @@
#include "core/memcheck.h"
UBGraphicsMediaItemDelegate::UBGraphicsMediaItemDelegate(UBGraphicsMediaItem* pDelegated, Phonon::MediaObject* pMedia, QObject * parent)
: UBGraphicsItemDelegate(pDelegated, parent, true, false)
: UBGraphicsItemDelegate(pDelegated, parent, true, false, true, true)
, mMedia(pMedia)
, mToolBarShowTimer(NULL)
, m_iToolBarShowingInterval(5000)
......
......@@ -28,7 +28,7 @@
UBGraphicsPixmapItem::UBGraphicsPixmapItem(QGraphicsItem* parent)
: QGraphicsPixmapItem(parent)
{
setDelegate(new UBGraphicsItemDelegate(this, 0, true));
setDelegate(new UBGraphicsItemDelegate(this, 0, true, false, true, true));
Delegate()->init();
Delegate()->setFlippable(true);
Delegate()->setRotatable(true);
......
......@@ -53,7 +53,7 @@ void UBGraphicsSvgItem::init()
{
setData(UBGraphicsItemData::ItemLayerType, UBItemLayerType::Object);
setDelegate(new UBGraphicsItemDelegate(this, 0, true, true, false));
setDelegate(new UBGraphicsItemDelegate(this, 0, true, true, false, true));
Delegate()->init();
Delegate()->setFlippable(true);
Delegate()->setRotatable(true);
......
......@@ -30,7 +30,7 @@
#include "core/memcheck.h"
UBGraphicsWidgetItemDelegate::UBGraphicsWidgetItemDelegate(UBGraphicsWidgetItem* pDelegated, int widgetType)
: UBGraphicsItemDelegate(pDelegated, 0, true, false, false)
: UBGraphicsItemDelegate(pDelegated, 0, true, false, false, true)
, freezeAction(0)
, setAsToolAction(0)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment