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() ...@@ -78,7 +78,7 @@ void UBAsyncLocalFileDownloader::run()
QFile::remove(mTo); QFile::remove(mTo);
} }
else 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() void UBAsyncLocalFileDownloader::abort()
......
...@@ -381,7 +381,6 @@ QSizeF UBGraphicsDelegateFrame::resizeDelegate(qreal moveX, qreal moveY) ...@@ -381,7 +381,6 @@ QSizeF UBGraphicsDelegateFrame::resizeDelegate(qreal moveX, qreal moveY)
return incVector; return incVector;
} }
void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event) void UBGraphicsDelegateFrame::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{ {
if (None == mCurrentTool) if (None == mCurrentTool)
......
...@@ -144,7 +144,7 @@ void DelegateButton::startShowProgress() ...@@ -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) : QObject(parent)
, mDelegated(pDelegated) , mDelegated(pDelegated)
, mDeleteButton(NULL) , mDeleteButton(NULL)
...@@ -164,6 +164,7 @@ UBGraphicsItemDelegate::UBGraphicsItemDelegate(QGraphicsItem* pDelegated, QObjec ...@@ -164,6 +164,7 @@ UBGraphicsItemDelegate::UBGraphicsItemDelegate(QGraphicsItem* pDelegated, QObjec
, mMimeData(NULL) , mMimeData(NULL)
, mFlippable(false) , mFlippable(false)
, mToolBarUsed(useToolBar) , mToolBarUsed(useToolBar)
, mShowGoContentButton(showGoContentButton)
{ {
connect(UBApplication::boardController, SIGNAL(zoomChanged(qreal)), this, SLOT(onZoomChanged())); connect(UBApplication::boardController, SIGNAL(zoomChanged(qreal)), this, SLOT(onZoomChanged()));
} }
...@@ -189,6 +190,13 @@ void UBGraphicsItemDelegate::init() ...@@ -189,6 +190,13 @@ void UBGraphicsItemDelegate::init()
connect(mMenuButton, SIGNAL(clicked()), this, SLOT(showMenu())); connect(mMenuButton, SIGNAL(clicked()), this, SLOT(showMenu()));
mButtons << mMenuButton; 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 = new DelegateButton(":/images/z_layer_up.svg", mDelegated, mFrame, Qt::BottomLeftSection);
mZOrderUpButton->setShowProgressIndicator(true); mZOrderUpButton->setShowProgressIndicator(true);
connect(mZOrderUpButton, SIGNAL(clicked()), this, SLOT(increaseZLevelUp())); connect(mZOrderUpButton, SIGNAL(clicked()), this, SLOT(increaseZLevelUp()));
...@@ -550,10 +558,8 @@ void UBGraphicsItemDelegate::showHide(bool show) ...@@ -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); UBItem* item = dynamic_cast<UBItem*>(mDelegated);
if(item && !item->sourceUrl().isEmpty()) if(item && !item->sourceUrl().isEmpty())
...@@ -624,13 +630,6 @@ void UBGraphicsItemDelegate::decorateMenu(QMenu* menu) ...@@ -624,13 +630,6 @@ void UBGraphicsItemDelegate::decorateMenu(QMenu* menu)
showIcon.addPixmap(QPixmap(":/images/eyeOpened.svg"), QIcon::Normal, QIcon::On); showIcon.addPixmap(QPixmap(":/images/eyeOpened.svg"), QIcon::Normal, QIcon::On);
showIcon.addPixmap(QPixmap(":/images/eyeClosed.svg"), QIcon::Normal, QIcon::Off); showIcon.addPixmap(QPixmap(":/images/eyeClosed.svg"), QIcon::Normal, QIcon::Off);
mShowOnDisplayAction->setIcon(showIcon); 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() void UBGraphicsItemDelegate::updateMenuActionState()
......
...@@ -207,7 +207,7 @@ class UBGraphicsItemDelegate : public QObject ...@@ -207,7 +207,7 @@ class UBGraphicsItemDelegate : public QObject
Q_OBJECT Q_OBJECT
public: 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(); virtual ~UBGraphicsItemDelegate();
...@@ -287,6 +287,7 @@ class UBGraphicsItemDelegate : public QObject ...@@ -287,6 +287,7 @@ class UBGraphicsItemDelegate : public QObject
//buttons from the top left section of delegate frame //buttons from the top left section of delegate frame
DelegateButton* mDeleteButton; DelegateButton* mDeleteButton;
DelegateButton* mDuplicateButton; DelegateButton* mDuplicateButton;
DelegateButton *mContentSourceButton;
DelegateButton* mMenuButton; DelegateButton* mMenuButton;
//buttons from the bottom left section of delegate frame //buttons from the bottom left section of delegate frame
...@@ -308,7 +309,7 @@ class UBGraphicsItemDelegate : public QObject ...@@ -308,7 +309,7 @@ class UBGraphicsItemDelegate : public QObject
UBGraphicsToolBarItem* mToolBarItem; UBGraphicsToolBarItem* mToolBarItem;
protected slots: protected slots:
virtual void gotoContentSource(bool checked); virtual void gotoContentSource();
private: private:
void updateFrame(); void updateFrame();
...@@ -330,6 +331,8 @@ private: ...@@ -330,6 +331,8 @@ private:
/** A boolean saying that this object can be flippable (mirror effect) */ /** A boolean saying that this object can be flippable (mirror effect) */
bool mFlippable; bool mFlippable;
bool mToolBarUsed; bool mToolBarUsed;
bool mShowGoContentButton;
}; };
......
...@@ -195,7 +195,7 @@ void UBGraphicsMediaItem::setSourceUrl(const QUrl &pSourceUrl) ...@@ -195,7 +195,7 @@ void UBGraphicsMediaItem::setSourceUrl(const QUrl &pSourceUrl)
UBAudioPresentationWidget* pAudioWidget = dynamic_cast<UBAudioPresentationWidget*>(mAudioWidget); UBAudioPresentationWidget* pAudioWidget = dynamic_cast<UBAudioPresentationWidget*>(mAudioWidget);
if (pAudioWidget) if (pAudioWidget)
{ {
pAudioWidget->setTitle(UBFileSystemUtils::lastPathComponent(pSourceUrl.toLocalFile())); pAudioWidget->setTitle(UBFileSystemUtils::lastPathComponent(pSourceUrl.toString()));
} }
UBItem::setSourceUrl(pSourceUrl); UBItem::setSourceUrl(pSourceUrl);
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#include "core/memcheck.h" #include "core/memcheck.h"
UBGraphicsMediaItemDelegate::UBGraphicsMediaItemDelegate(UBGraphicsMediaItem* pDelegated, Phonon::MediaObject* pMedia, QObject * parent) UBGraphicsMediaItemDelegate::UBGraphicsMediaItemDelegate(UBGraphicsMediaItem* pDelegated, Phonon::MediaObject* pMedia, QObject * parent)
: UBGraphicsItemDelegate(pDelegated, parent, true, false) : UBGraphicsItemDelegate(pDelegated, parent, true, false, true, true)
, mMedia(pMedia) , mMedia(pMedia)
, mToolBarShowTimer(NULL) , mToolBarShowTimer(NULL)
, m_iToolBarShowingInterval(5000) , m_iToolBarShowingInterval(5000)
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
UBGraphicsPixmapItem::UBGraphicsPixmapItem(QGraphicsItem* parent) UBGraphicsPixmapItem::UBGraphicsPixmapItem(QGraphicsItem* parent)
: QGraphicsPixmapItem(parent) : QGraphicsPixmapItem(parent)
{ {
setDelegate(new UBGraphicsItemDelegate(this, 0, true)); setDelegate(new UBGraphicsItemDelegate(this, 0, true, false, true, true));
Delegate()->init(); Delegate()->init();
Delegate()->setFlippable(true); Delegate()->setFlippable(true);
Delegate()->setRotatable(true); Delegate()->setRotatable(true);
......
...@@ -53,7 +53,7 @@ void UBGraphicsSvgItem::init() ...@@ -53,7 +53,7 @@ void UBGraphicsSvgItem::init()
{ {
setData(UBGraphicsItemData::ItemLayerType, UBItemLayerType::Object); 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()->init();
Delegate()->setFlippable(true); Delegate()->setFlippable(true);
Delegate()->setRotatable(true); Delegate()->setRotatable(true);
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include "core/memcheck.h" #include "core/memcheck.h"
UBGraphicsWidgetItemDelegate::UBGraphicsWidgetItemDelegate(UBGraphicsWidgetItem* pDelegated, int widgetType) UBGraphicsWidgetItemDelegate::UBGraphicsWidgetItemDelegate(UBGraphicsWidgetItem* pDelegated, int widgetType)
: UBGraphicsItemDelegate(pDelegated, 0, true, false, false) : UBGraphicsItemDelegate(pDelegated, 0, true, false, false, true)
, freezeAction(0) , freezeAction(0)
, setAsToolAction(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