From 01a6b5d4c1114b19ad61a1197ebe48b690f8fb6b Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage <emmanuel.lepage@savoirfairelinux.com> Date: Fri, 16 Dec 2011 11:48:05 -0500 Subject: [PATCH] [ #7901 ] Partial rewrite of the drag and drop event, does not really work --- kde/src/CMakeLists.txt | 1 + kde/src/CallView.cpp | 115 ++++++- kde/src/CallView.h | 85 ++++- kde/src/SFLPhoneView.cpp | 5 +- kde/src/icons/transferarraw.png | Bin 0 -> 2666 bytes kde/src/icons/transfertarrow.svg | 124 +++++++ kde/src/lib/Call.h | 2 +- kde/src/lib/CallModel.h | 14 +- kde/src/lib/CallModel.hpp | 19 ++ kde/src/widgets/CallTreeItem.cpp | 91 +++++- kde/src/widgets/CallTreeItem.h | 20 ++ kde/src/widgets/TranslucentButtons.cpp | 427 +++++++++++++++++++++++++ kde/src/widgets/TranslucentButtons.h | 36 +++ 13 files changed, 926 insertions(+), 13 deletions(-) create mode 100644 kde/src/icons/transferarraw.png create mode 100644 kde/src/icons/transfertarrow.svg create mode 100644 kde/src/widgets/TranslucentButtons.cpp create mode 100644 kde/src/widgets/TranslucentButtons.h diff --git a/kde/src/CMakeLists.txt b/kde/src/CMakeLists.txt index 9c22f65f5f..4ae867412c 100755 --- a/kde/src/CMakeLists.txt +++ b/kde/src/CMakeLists.txt @@ -43,6 +43,7 @@ SET( sflphone_client_kde_SRCS widgets/ContactDock.cpp widgets/HistoryDock.cpp widgets/BookmarkDock.cpp + widgets/TranslucentButtons.cpp Codec.cpp AccountListModel.cpp AkonadiBackend.cpp diff --git a/kde/src/CallView.cpp b/kde/src/CallView.cpp index 35c79b56e9..0d76da7c10 100644 --- a/kde/src/CallView.cpp +++ b/kde/src/CallView.cpp @@ -25,9 +25,13 @@ #include <QtGui/QInputDialog> #include <QtGui/QTreeWidget> #include <QtGui/QTreeWidgetItem> +#include <QtGui/QPushButton> +#include <QtGui/QSpacerItem> +#include <QtGui/QGridLayout> //KDE #include <KDebug> +#include <KLineEdit> //SFLPhone library #include "lib/Contact.h" @@ -42,14 +46,30 @@ ///Retrieve current and older calls from the daemon, fill history and the calls TreeView and enable drag n' drop -CallView::CallView(QWidget* parent) : QTreeWidget(parent) +CallView::CallView(QWidget* parent) : QTreeWidget(parent),m_pCallPendingTransfer(0),m_pActiveOverlay(0) { //Widget part setAcceptDrops(true); setDragEnabled(true); + setAnimated(true); CallTreeItemDelegate *delegate = new CallTreeItemDelegate(); setItemDelegate(delegate); setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding)); + + m_pTransferOverlay = new CallViewOverlay(this); + m_pTransferOverlay->setVisible(false); + m_pTransferOverlay->resize(size()); + m_pTransferOverlay->setCornerWidget(new QTreeWidget()); + + m_pTransferB = new QPushButton(m_pTransferOverlay); + m_pTransferLE = new KLineEdit(m_pTransferOverlay); + m_pTransferB->setText("Transfer"); + m_pTransferB->setMaximumSize(70,9000); + QGridLayout* gl = new QGridLayout(m_pTransferOverlay); + gl->addItem(new QSpacerItem(0,0,QSizePolicy::Expanding,QSizePolicy::Minimum),0,0,1,3); + gl->addWidget(m_pTransferLE,1,1,1,2); + gl->addWidget(m_pTransferB,1,4,1,2); + gl->addItem(new QSpacerItem(0,0,QSizePolicy::Expanding,QSizePolicy::Minimum),2,0,1,3); //User Interface even // SENDER SIGNAL RECEIVER SLOT / @@ -60,6 +80,8 @@ CallView::CallView(QWidget* parent) : QTreeWidget(parent) /**/connect(SFLPhone::model() , SIGNAL(conferenceChanged(Call*) ) , this, SLOT( conferenceChanged(Call*)) ); /**/connect(SFLPhone::model() , SIGNAL(aboutToRemoveConference(Call*) ) , this, SLOT( conferenceRemoved(Call*)) ); /**/connect(SFLPhone::model() , SIGNAL(callAdded(Call*,Call*) ) , this, SLOT( addCall(Call*,Call*)) ); + /**/connect(m_pTransferB , SIGNAL(clicked() ) , this, SLOT( transfer()) ); + /**/connect(m_pTransferLE , SIGNAL(returnPressed() ) , this, SLOT( transfer()) ); /* */ } @@ -71,6 +93,46 @@ CallView::CallView(QWidget* parent) : QTreeWidget(parent) * * ****************************************************************************/ +///Called when someone try to drop something on the tree +void CallView::dragEnterEvent ( QDragEnterEvent *e ) +{ + kDebug() << "Potential drag event enter"; + e->accept(); +} + +///When a drag position change +void CallView::dragMoveEvent ( QDragMoveEvent *e ) +{ + e->ignore(); +} + +///When a drag event is leaving the widget +void CallView::dragLeaveEvent ( QDragLeaveEvent *e ) +{ + kDebug() << "Potential drag event leave"; + e->accept(); +} + +///Add some child to the QTreeWidgetItem to show drop options (conference or transfer) +void CallView::showDropOptions(CallTreeItem* widget) +{ + //TODO remove? +} + +///Proxy to handle transfer mime data +void CallView::transferDropEvent(Call* call,QMimeData* data) +{ + QByteArray encodedCallId = data->data( MIME_CALLID ); + SFLPhone::model()->attendedTransfer(SFLPhone::model()->getCall(encodedCallId),call); +} + +///Proxy to handle conversation mime data +void CallView::conversationDropEvent(Call* call,QMimeData* data) +{ + kDebug() << "Calling real drag and drop function"; + dropMimeData(SFLPhone::model()->getIndex(call), 0, data, (Qt::DropAction)0); +} + ///A call is dropped on another call bool CallView::callToCall(QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action) { @@ -320,12 +382,58 @@ Call* CallView::addCall(Call* call, Call* parent) return call; } +///Transfer a call +void CallView::transfer() +{ + if (m_pCallPendingTransfer) { + SFLPhone::model()->transfer(m_pCallPendingTransfer,m_pTransferLE->text()); + m_pCallPendingTransfer = 0; + m_pTransferLE->clear(); + m_pTransferOverlay->setVisible(false); + } +} + /***************************************************************************** * * * View related code * * * ****************************************************************************/ +///Show the transfer overlay +void CallView::showTransferOverlay(Call* call) +{ + if (!m_pTransferOverlay) { + kDebug() << "Creating overlay"; + } + m_pTransferOverlay->setVisible(true); + m_pCallPendingTransfer = call; + m_pActiveOverlay = m_pTransferOverlay; + m_pTransferLE->setFocus(); + connect(call,SIGNAL(changed()),this,SLOT(hideOverlay())); +} + +///Is there an active overlay +bool CallView::haveOverlay() +{ + return (m_pActiveOverlay && m_pActiveOverlay->isVisible()); +} + +///Remove the active overlay +void CallView::hideOverlay() +{ + if (m_pActiveOverlay) + m_pActiveOverlay->setVisible(false); + m_pActiveOverlay = 0; +} + +///Be sure the size of the overlay stay the same +void CallView::resizeEvent (QResizeEvent *e) +{ + if (m_pTransferOverlay) + m_pTransferOverlay->resize(size()); + QTreeWidget::resizeEvent(e); +} + ///Set the TreeView header text void CallView::setTitle(const QString& title) { @@ -415,6 +523,11 @@ CallTreeItem* CallView::insertItem(QTreeWidgetItem* item, QTreeWidgetItem* paren parent->addChild(item); CallTreeItem* callItem = new CallTreeItem(); + connect(callItem, SIGNAL(showChilds(CallTreeItem*)), this, SLOT(showDropOptions(CallTreeItem*))); + connect(callItem, SIGNAL(askTransfer(Call*)), this, SLOT(showTransferOverlay(Call*))); + connect(callItem, SIGNAL(transferDropEvent(Call*,QMimeData*)), this, SLOT(transferDropEvent(Call*,QMimeData*))); + connect(callItem, SIGNAL(conversationDropEvent(Call*,QMimeData*)), this, SLOT(conversationDropEvent(Call*,QMimeData*))); + SFLPhone::model()->updateWidget(SFLPhone::model()->getCall(item), callItem); callItem->setCall(SFLPhone::model()->getCall(item)); diff --git a/kde/src/CallView.h b/kde/src/CallView.h index 3fddaf2563..8805844d35 100644 --- a/kde/src/CallView.h +++ b/kde/src/CallView.h @@ -22,10 +22,16 @@ #include <QtGui/QItemDelegate> #include <QtGui/QTreeWidget> +#include <QtGui/QPainter> +#include <QtCore/QTimer> #include "lib/CallModel.h" //Qt class QTreeWidgetItem; +class QPushButton; + +//KDE +class KLineEdit; //SFLPhone class CallTreeItem; @@ -46,6 +52,66 @@ class CallTreeItemDelegate : public QItemDelegate } }; +///@class CallViewOverlay Display overlay on top of the call tree +class CallViewOverlay : public QWidget { + Q_OBJECT +public: + CallViewOverlay(QWidget* parent) : QWidget(parent),m_pIcon(0),m_enabled(true),black("black"),m_pTimer(0) + { + black.setAlpha(75); + } + void setCornerWidget(QWidget* wdg) { + wdg->setParent(this); + wdg->setMinimumSize(100,100); + wdg->resize(100,100); + wdg->move(width()-100,height()-100); + m_pIcon = wdg; + } + + void setVisible(bool enabled) { + if (m_enabled != enabled) { + if (m_pTimer) { + m_pTimer->stop(); + disconnect(m_pTimer); + } + m_pTimer = new QTimer(this); //TODO LEAK + connect(m_pTimer, SIGNAL(timeout()), this, SLOT(changeVisibility())); + m_step = 0; + black.setAlpha(0); + repaint(); + m_pTimer->start(10); + } + m_enabled = enabled; + QWidget::setVisible(enabled); + } +protected: + void paintEvent(QPaintEvent* event) { + QPainter customPainter(this); + customPainter.fillRect(rect(),black); + } + virtual void resizeEvent(QResizeEvent *e) { + if (m_pIcon) { + m_pIcon->setMinimumSize(100,100); + m_pIcon->move(width()-100,height()-100); + } + } +private: + QWidget* m_pIcon; + uint m_step; + QTimer* m_pTimer; + bool m_enabled; + QColor black; + +private slots: + void changeVisibility() { + m_step++; + black.setAlpha(0.1*m_step*m_step); + repaint(); + if (m_step >= 35) + m_pTimer->stop(); + } +}; + ///@class CallView Central tree widget managing active calls class CallView : public QTreeWidget { Q_OBJECT @@ -58,6 +124,7 @@ class CallView : public QTreeWidget { bool removeItem ( Call* item ); bool dropMimeData ( QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action ); virtual QMimeData* mimeData ( const QList<QTreeWidgetItem *> items ) const; + bool haveOverlay(); private: QTreeWidgetItem* extractItem ( const QString& callId ); @@ -66,9 +133,17 @@ class CallView : public QTreeWidget { CallTreeItem* insertItem ( QTreeWidgetItem* item, Call* parent ); void clearArtefact ( QTreeWidgetItem* item ); + QPushButton* m_pTransferB; + KLineEdit* m_pTransferLE; + CallViewOverlay* m_pTransferOverlay; + CallViewOverlay* m_pActiveOverlay; + Call* m_pCallPendingTransfer; + protected: - void dragEnterEvent( QDragEnterEvent *e) { e->accept(); } - void dragMoveEvent ( QDragMoveEvent *e) { e->accept(); } + virtual void dragEnterEvent ( QDragEnterEvent *e ); + virtual void dragMoveEvent ( QDragMoveEvent *e ); + virtual void dragLeaveEvent ( QDragLeaveEvent *e ); + virtual void resizeEvent ( QResizeEvent *e ); bool callToCall ( QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action ); bool phoneNumberToCall ( QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action ); bool contactToCall ( QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action ); @@ -81,11 +156,17 @@ class CallView : public QTreeWidget { Call* addConference ( Call* conf ); bool conferenceChanged ( Call* conf ); void conferenceRemoved ( Call* conf ); + void showDropOptions ( CallTreeItem* widget ); virtual void keyPressEvent(QKeyEvent* event); public slots: void clearHistory(); + void showTransferOverlay(Call* call); + void transfer(); + void transferDropEvent(Call* call,QMimeData* data); + void conversationDropEvent(Call* call,QMimeData* data); + void hideOverlay(); signals: void itemChanged(Call*); diff --git a/kde/src/SFLPhoneView.cpp b/kde/src/SFLPhoneView.cpp index 9679838663..cd69482c42 100755 --- a/kde/src/SFLPhoneView.cpp +++ b/kde/src/SFLPhoneView.cpp @@ -180,7 +180,10 @@ void SFLPhoneView::escape() { kDebug() << "escape"; Call* call = callTreeModel->getCurrentItem(); - if(!call) { + if (callTreeModel->haveOverlay()) { + callTreeModel->hideOverlay(); + } + else if(!call) { kDebug() << "Escape when no item is selected. Doing nothing."; } else { diff --git a/kde/src/icons/transferarraw.png b/kde/src/icons/transferarraw.png new file mode 100644 index 0000000000000000000000000000000000000000..29ef8ad4d1bc7cf83b9fc0f2e853db242b7a6d82 GIT binary patch literal 2666 zcmX9=2{_bU7bmY|`{s@CRU(Wun6X62Qm;%#vSiQL$&w5WS;qD?>Mf>BGel{Sy&*KV zF<FLBGAR3QEM*L8m^Zs7e1E?CJoldGoagsD=brPN^W2+kYi%wra!Q1ck5AkJVP*%& zZD8Lyb`&@XiKMH5_#@oZ!r>UO;*R+}0d(Oo#I0~Xz9V%9o1YJ@S_>FYM!;Pn>_hz{ zqP)?!`J$qtU_q$ha9{7R+pth{!0Q#GQvh+n!t5`HX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75H!r%u~rwr+kBUH4%kcG2N}ICk$;t$@BsK1@>#&G K%_>a2u>S+(O)0Yg literal 0 HcmV?d00001 diff --git a/kde/src/icons/transfertarrow.svg b/kde/src/icons/transfertarrow.svg new file mode 100644 index 0000000000..4a81ea2983 --- /dev/null +++ b/kde/src/icons/transfertarrow.svg @@ -0,0 +1,124 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="744.09448819" + height="1052.3622047" + id="svg2" + version="1.1" + inkscape:version="0.48.2 r9819" + sodipodi:docname="New document 1"> + <defs + id="defs4"> + <linearGradient + inkscape:collect="always" + id="linearGradient3013"> + <stop + style="stop-color:#000000;stop-opacity:1;" + offset="0" + id="stop3015" /> + <stop + style="stop-color:#000000;stop-opacity:0;" + offset="1" + id="stop3017" /> + </linearGradient> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient3013" + id="linearGradient3019" + x1="521.41046" + y1="1700.8801" + x2="224.25386" + y2="1700.8801" + gradientUnits="userSpaceOnUse" + gradientTransform="translate(-84.852814,185.86807)" /> + <filter + inkscape:collect="always" + id="filter3817"> + <feGaussianBlur + inkscape:collect="always" + stdDeviation="12.671464" + id="feGaussianBlur3819" /> + </filter> + </defs> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="0.49497475" + inkscape:cx="666.56683" + inkscape:cy="-873.48218" + inkscape:document-units="px" + inkscape:current-layer="layer1" + showgrid="false" + showguides="true" + inkscape:guide-bbox="true" + inkscape:window-width="1918" + inkscape:window-height="1147" + inkscape:window-x="0" + inkscape:window-y="35" + inkscape:window-maximized="0"> + <sodipodi:guide + orientation="1,0" + position="-677.14286,1117.1429" + id="guide2987" /> + <sodipodi:guide + orientation="0,1" + position="-1771.4286,1100" + id="guide2989" /> + <sodipodi:guide + orientation="1,0" + position="-342.85714,811.42857" + id="guide2991" /> + <sodipodi:guide + orientation="0,1" + position="-1631.4286,1200" + id="guide2993" /> + <sodipodi:guide + orientation="0,1" + position="-1860,1002.8571" + id="guide2995" /> + <sodipodi:guide + orientation="0,1" + position="-1411.4286,1348.5714" + id="guide2999" /> + <sodipodi:guide + orientation="0,1" + position="-2077.1429,848.57143" + id="guide3001" /> + </sodipodi:namedview> + <metadata + id="metadata7"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1"> + <path + style="fill:url(#linearGradient3019);fill-opacity:1;stroke:none;opacity:0.35205993000000002;filter:url(#filter3817)" + d="m 141.6779,1819.068 0,152.533 c 0,11.4516 9.20732,24.6643 24.99727,24.6643 l 836.40633,0 c 13.2009,0 21.4536,4.3878 21.4536,17.7621 l 0,114.1473 c 0,14.2454 7.7974,16.5115 20.1022,7.2566 l 293.8567,-221.0204 c 13.3512,-9.1629 11.9007,-18.8749 1.4521,-29.3235 l -302.8417,-225.1901 c -8.4642,-4.8868 -12.5693,-0.761 -12.5693,12.6986 l 0,104.0457 c 0,12.9665 -12.6903,22.4808 -26.50441,22.4808 l -833.37583,0 c -11.77182,0 -22.97696,8.2567 -22.97696,19.9456 z" + id="path3003" + inkscape:connector-curvature="0" + sodipodi:nodetypes="ccccccccccccccc" /> + </g> +</svg> diff --git a/kde/src/lib/Call.h b/kde/src/lib/Call.h index 76f31180ab..8e475dbcdf 100644 --- a/kde/src/lib/Call.h +++ b/kde/src/lib/Call.h @@ -162,7 +162,7 @@ public: void setTransferNumber(const QString& number); void setCallNumber(const QString& number); - //Mutotors + //Mutators void appendText(const QString& str); void backspaceItemText(); void changeCurrentState(call_state newState); diff --git a/kde/src/lib/CallModel.h b/kde/src/lib/CallModel.h index 44f76fd3ef..608af376d0 100644 --- a/kde/src/lib/CallModel.h +++ b/kde/src/lib/CallModel.h @@ -101,12 +101,14 @@ class LIB_EXPORT CallModel : public CallModelBase { virtual void initContact ( ContactBackend* be ); //Call related - virtual Call* addCall ( Call* call , Call* parent =0 ); - Call* addDialingCall ( const QString& peerName="", QString account="" ); - Call* addIncomingCall ( const QString& callId ); - Call* addRingingCall ( const QString& callId ); - static QString generateCallId ( ); - void removeCall ( Call* call ); + virtual Call* addCall ( Call* call , Call* parent =0 ); + Call* addDialingCall ( const QString& peerName="", QString account="" ); + Call* addIncomingCall ( const QString& callId ); + Call* addRingingCall ( const QString& callId ); + static QString generateCallId ( ); + void removeCall ( Call* call ); + void attendedTransfer ( Call* toTransfer , Call* target ); + void transfer ( Call* toTransfer , QString target ); virtual bool selectItem(Call* item) { Q_UNUSED(item); return false;} diff --git a/kde/src/lib/CallModel.hpp b/kde/src/lib/CallModel.hpp index 11e51f8336..f7dd95f067 100644 --- a/kde/src/lib/CallModel.hpp +++ b/kde/src/lib/CallModel.hpp @@ -263,6 +263,25 @@ template<typename CallWidget, typename Index> void CallModel<CallWidget,Index>:: } } +///Transfer "toTransfer" to "target" and wait to see it it succeeded +template<typename CallWidget, typename Index> void CallModel<CallWidget,Index>::attendedTransfer(Call* toTransfer, Call* target) +{ + CallManagerInterface& callManager = CallManagerInterfaceSingleton::getInstance(); + callManager.attendedTransfer(toTransfer->getCallId(),target->getCallId()); + + //TODO [Daemon] Implement this correctly + toTransfer->changeCurrentState(CALL_STATE_OVER); + target->changeCurrentState(CALL_STATE_OVER); +} + +///Transfer this call to "target" number +template<typename CallWidget, typename Index> void CallModel<CallWidget,Index>::transfer(Call* toTransfer, QString target) +{ + qDebug() << "Transferring call " << target; + toTransfer->setTransferNumber(target); + toTransfer->actionPerformed(CALL_ACTION_ACCEPT); + toTransfer->changeCurrentState(CALL_STATE_OVER); +} /***************************************************************************** * * diff --git a/kde/src/widgets/CallTreeItem.cpp b/kde/src/widgets/CallTreeItem.cpp index fc062bc39e..d6730f10b5 100644 --- a/kde/src/widgets/CallTreeItem.cpp +++ b/kde/src/widgets/CallTreeItem.cpp @@ -28,6 +28,11 @@ #include <QtGui/QSpacerItem> #include <QtGui/QHBoxLayout> #include <QtGui/QVBoxLayout> +#include <QtGui/QDragEnterEvent> +#include <QtGui/QDragMoveEvent> +#include <QtGui/QDragLeaveEvent> +#include <QtGui/QPushButton> +#include <QtCore/QMimeData> //KDE #include <KLocale> @@ -41,14 +46,14 @@ //SFLPhone #include "AkonadiBackend.h" - +#include "widgets/TranslucentButtons.h" ///Constant const char * CallTreeItem::callStateIcons[12] = {ICON_INCOMING, ICON_RINGING, ICON_CURRENT, ICON_DIALING, ICON_HOLD, ICON_FAILURE, ICON_BUSY, ICON_TRANSFER, ICON_TRANSF_HOLD, "", "", ICON_CONFERENCE}; ///Constructor CallTreeItem::CallTreeItem(QWidget *parent) - : QWidget(parent), m_pItemCall(0), m_Init(false) + : QWidget(parent), m_pItemCall(0), m_Init(false),m_pBtnConf(0), m_pBtnTrans(0) { setMaximumSize(99999,50); } @@ -83,6 +88,7 @@ Call* CallTreeItem::call() const void CallTreeItem::setCall(Call *call) { m_pItemCall = call; + setAcceptDrops(true); if (m_pItemCall->isConference()) { if (!m_Init) { @@ -109,6 +115,18 @@ void CallTreeItem::setCall(Call *call) QHBoxLayout* mainLayout = new QHBoxLayout(); mainLayout->setContentsMargins ( 3, 1, 2, 1); + + + m_pBtnConf = new TranslucentButtons(this); + m_pBtnConf->setVisible(false); + m_pBtnConf->setParent(this); + m_pBtnConf->setText("Conference"); + connect(m_pBtnConf,SIGNAL(dataDropped(QMimeData*)),this,SLOT(conversationEvent(QMimeData*))); + + m_pBtnTrans = new TranslucentButtons(this); + m_pBtnTrans->setText("Transfer"); + m_pBtnTrans->setVisible(false); + connect(m_pBtnTrans,SIGNAL(dataDropped(QMimeData*)),this,SLOT(transferEvent(QMimeData*))); m_pCodecL = new QLabel(this); //m_pCodecL->setText("Codec: "+m_pItemCall->getCurrentCodecName()); @@ -149,6 +167,7 @@ void CallTreeItem::setCall(Call *call) ///Update data void CallTreeItem::updated() { + kDebug() << "\n\n\n\nI am here\n\n\n\n\n" << m_pItemCall->getState() << "\n\n\n"; kDebug() << "Updating tree item"; Contact* contact = AkonadiBackend::getInstance()->getContactByPhone(m_pItemCall->getPeerPhoneNumber()); if (contact) { @@ -198,5 +217,73 @@ void CallTreeItem::updated() else { //kDebug() << "Updating item of call of state OVER. Doing nothing."; } + if (state == CALL_STATE_TRANSFER) { + kDebug() << "emmiting tranfer signal"; + emit askTransfer(m_pItemCall); + } + else { + kDebug() << "not emmiting tranfer signal"; + } changed(); } + + +/***************************************************************************** + * * + * Drag and drop * + * * + ****************************************************************************/ + +///Called when a drag and drop occure while the item have not been dropped yet +void CallTreeItem::dragEnterEvent ( QDragEnterEvent *e ) +{ + kDebug() << "Drag enter"; + if (e->mimeData()->hasFormat( MIME_CALLID) && m_pBtnTrans) { + m_pBtnConf->setVisible(true); + m_pBtnTrans->setVisible(true); + emit showChilds(this); + e->accept(); + } + else + e->ignore(); +} + +///The cursor move on a potential drag event +void CallTreeItem::dragMoveEvent ( QDragMoveEvent *e ) +{ + e->accept(); +} + +///A potential drag event is cancelled +void CallTreeItem::dragLeaveEvent ( QDragLeaveEvent *e ) +{ + m_pBtnConf->setVisible(false); + m_pBtnTrans->setVisible(false); + kDebug() << "Drag leave"; + e->ignore(); +} + +void CallTreeItem::resizeEvent ( QResizeEvent *e ) +{ + kDebug() << "Resize"; + if (m_pBtnConf) { + m_pBtnConf->setMinimumSize(width()/2-5,height()); + m_pBtnConf->setMaximumSize(width()/2-5,height()); + m_pBtnTrans->setMinimumSize(width()/2-5,height()); + m_pBtnTrans->setMaximumSize(width()/2-5,height()); + m_pBtnTrans->move(width()/2+10,m_pBtnTrans->y()); + } + + e->accept(); +} + +void CallTreeItem::transferEvent(QMimeData* data) +{ + emit transferDropEvent(m_pItemCall,data); +} + +void CallTreeItem::conversationEvent(QMimeData* data) +{ + kDebug() << "Proxying conversation mime"; + emit conversationDropEvent(m_pItemCall,data); +} \ No newline at end of file diff --git a/kde/src/widgets/CallTreeItem.h b/kde/src/widgets/CallTreeItem.h index f008fa6cdd..e12d572354 100644 --- a/kde/src/widgets/CallTreeItem.h +++ b/kde/src/widgets/CallTreeItem.h @@ -29,12 +29,15 @@ //Qt class QLabel; +class QPushButton; +class QMimeData; //KDE class KIcon; //SFLPhone class Call; +class TranslucentButtons; ///@class CallTreeItem Widget for the central call treeview class CallTreeItem : public QWidget @@ -66,12 +69,29 @@ class CallTreeItem : public QWidget QLabel* m_pCodecL; QLabel* m_pSecureL; QLabel* m_pHistoryPeerL; + TranslucentButtons* m_pBtnConf; + TranslucentButtons* m_pBtnTrans; + + protected: + virtual void dragEnterEvent ( QDragEnterEvent *e ); + virtual void dragMoveEvent ( QDragMoveEvent *e ); + virtual void dragLeaveEvent ( QDragLeaveEvent *e ); + virtual void resizeEvent ( QResizeEvent *e ); + +private slots: + void transferEvent(QMimeData* data); + void conversationEvent(QMimeData* data); public slots: void updated(); + signals: void over(Call*); void changed(); + void showChilds(CallTreeItem*); + void askTransfer(Call*); + void transferDropEvent(Call*,QMimeData*); + void conversationDropEvent(Call*,QMimeData*); }; #endif // CALLTREE_ITEM_H diff --git a/kde/src/widgets/TranslucentButtons.cpp b/kde/src/widgets/TranslucentButtons.cpp new file mode 100644 index 0000000000..c81fee2abd --- /dev/null +++ b/kde/src/widgets/TranslucentButtons.cpp @@ -0,0 +1,427 @@ +#include "TranslucentButtons.h" + +#include <QtGui/QPainter> +#include <KDebug> +#include <QtCore/QTimer> +#include <QDragEnterEvent> +#include <QDragMoveEvent> +#include <QDragLeaveEvent> +#include <QMimeData> + +TranslucentButtons* TranslucentButtons::m_psActiveButton =0; + +TranslucentButtons::TranslucentButtons(QWidget* parent):QPushButton(parent),m_enabled(true),m_pTimer(0) +{ + setAcceptDrops(true); + m_CurrentColor = "black"; + m_CurrentColor.setAlpha(0); +} + +TranslucentButtons::~TranslucentButtons() +{ + if (m_psActiveButton == this) + m_psActiveButton=0; +} + +void TranslucentButtons::paintEvent(QPaintEvent* event) +{ + + QPainter customPainter(this); + //kDebug() << m_CurrentColor.name(); + customPainter.setBackgroundMode( Qt::OpaqueMode ); + customPainter.setBackground(m_CurrentColor); + customPainter.setBrush(m_CurrentColor); + customPainter.setPen(Qt::NoPen); + customPainter.drawRoundedRect(rect(), 10, 10); + customPainter.setPen("white"); + customPainter.drawText (rect(), Qt::AlignVCenter|Qt::AlignHCenter, text() ); + +} + +void TranslucentButtons::setVisible(bool enabled) +{ + kDebug() << "Enabling!"; + if (m_enabled != enabled) { + if (m_pTimer) { + m_pTimer->stop(); + disconnect(m_pTimer); + } + m_pTimer = new QTimer(this); //TODO LEAK + connect(m_pTimer, SIGNAL(timeout()), this, SLOT(changeVisibility())); + m_step = 0; + m_CurrentColor = "black"; + m_CurrentColor.setAlpha(0); + repaint(); + m_pTimer->start(10); + } + m_enabled = enabled; + QWidget::setVisible(enabled); +} + +void TranslucentButtons::changeVisibility() +{ + m_step++; + m_CurrentColor.setAlpha(0.1*m_step*m_step); + repaint(); + if (m_step >= 35) + m_pTimer->stop(); +} + +void TranslucentButtons::dragEnterEvent ( QDragEnterEvent *e ) +{ +// if (m_psActiveButton && m_psActiveButton != this) { +// m_psActiveButton->dragLeaveEvent(0); +// } + m_psActiveButton = this; + kDebug() << "In button event"; + int alpha = m_CurrentColor.alpha(); + m_CurrentColor = "#FF0000"; + m_CurrentColor.setAlpha(alpha); + repaint(); + e->acceptProposedAction(); +} + +void TranslucentButtons::dragMoveEvent ( QDragMoveEvent *e ) +{ + kDebug() << "In button move event"; + int alpha = m_CurrentColor.alpha(); + m_CurrentColor = "#FF0000"; + m_CurrentColor.setAlpha(alpha); + e->accept(); +} + +void TranslucentButtons::dragLeaveEvent ( QDragLeaveEvent *e ) +{ + kDebug() << "Button drag leave"; + int alpha = m_CurrentColor.alpha(); + m_CurrentColor = "black"; + m_CurrentColor.setAlpha(alpha); + //m_CurrentColor = "black"; + if (e) + e->accept(); + else { + repaint(); + } + e->accept(); +} + +void TranslucentButtons::dropEvent(QDropEvent *e) +{ + kDebug() << "Drop accepted"; + emit dataDropped((QMimeData*)e->mimeData()); +} + +bool TranslucentButtons::event(QEvent* e) +{ +// switch (e->type()) { +// case QEvent::None: +// kDebug() << "None"; break; +// case QEvent::Timer: +// kDebug() << "Timer"; break; +// case QEvent::MouseButtonPress: +// kDebug() << "MouseButtonPress"; break; +// case QEvent::MouseButtonRelease: +// kDebug() << "MouseButtonRelease"; break; +// case QEvent::MouseButtonDblClick: +// kDebug() << "MouseButtonDblClick"; break; +// case QEvent::MouseMove: +// kDebug() << "MouseMove"; break; +// case QEvent::KeyPress: +// kDebug() << "KeyPress"; break; +// case QEvent::KeyRelease: +// kDebug() << "KeyRelease"; break; +// case QEvent::FocusIn: +// kDebug() << "FocusIn"; break; +// case QEvent::FocusOut: +// kDebug() << "FocusOut"; break; +// case QEvent::Enter: +// kDebug() << "Enter"; break; +// case QEvent::Leave: +// kDebug() << "Leave"; break; +// case QEvent::Paint: +// kDebug() << "Paint"; break; +// case QEvent::Move: +// kDebug() << "Move"; break; +// case QEvent::Resize: +// kDebug() << "Resize"; break; +// case QEvent::Create: +// kDebug() << "Create"; break; +// case QEvent::Destroy: +// kDebug() << "Destroy"; break; +// case QEvent::Show: +// kDebug() << "Show"; break; +// case QEvent::Hide: +// kDebug() << "Hide"; break; +// case QEvent::Close: +// kDebug() << "Close"; break; +// case QEvent::Quit: +// kDebug() << "Quit"; break; +// case QEvent::ParentChange: +// kDebug() << "ParentChange"; break; +// case QEvent::ParentAboutToChange: +// kDebug() << "ParentAboutToChange"; break; +// case QEvent::ThreadChange: +// kDebug() << "ThreadChange"; break; +// case QEvent::WindowActivate: +// kDebug() << "WindowActivate"; break; +// case QEvent::WindowDeactivate: +// kDebug() << "WindowDeactivate"; break; +// case QEvent::ShowToParent: +// kDebug() << "ShowToParent"; break; +// case QEvent::HideToParent: +// kDebug() << "HideToParent"; break; +// case QEvent::Wheel: +// kDebug() << "Wheel"; break; +// case QEvent::WindowTitleChange: +// kDebug() << "WindowTitleChange"; break; +// case QEvent::WindowIconChange: +// kDebug() << "WindowIconChange"; break; +// case QEvent::ApplicationWindowIconChange: +// kDebug() << "ApplicationWindowIconChange"; break; +// case QEvent::ApplicationFontChange: +// kDebug() << "ApplicationFontChange"; break; +// case QEvent::ApplicationLayoutDirectionChange: +// kDebug() << "ApplicationLayoutDirectionChange"; break; +// case QEvent::ApplicationPaletteChange: +// kDebug() << "ApplicationPaletteChange"; break; +// case QEvent::PaletteChange: +// kDebug() << "PaletteChange"; break; +// case QEvent::Clipboard: +// kDebug() << "Clipboard"; break; +// case QEvent::Speech: +// kDebug() << "Speech"; break; +// case QEvent::MetaCall: +// kDebug() << "MetaCall"; break; +// case QEvent::SockAct: +// kDebug() << "SockAct"; break; +// case QEvent::WinEventAct: +// kDebug() << "WinEventAct"; break; +// case QEvent::DeferredDelete: +// kDebug() << "DeferredDelete"; break; +// case QEvent::DragEnter: +// kDebug() << "DragEnter"; break; +// case QEvent::DragMove: +// kDebug() << "DragMove"; break; +// case QEvent::DragLeave: +// kDebug() << "DragLeave"; break; +// case QEvent::Drop: +// kDebug() << "Drop"; break; +// case QEvent::DragResponse: +// kDebug() << "DragResponse"; break; +// case QEvent::ChildAdded: +// kDebug() << "ChildAdded"; break; +// case QEvent::ChildPolished: +// kDebug() << "ChildPolished"; break; +// case QEvent::ChildRemoved: +// kDebug() << "ChildRemoved"; break; +// case QEvent::ShowWindowRequest: +// kDebug() << "ShowWindowRequest"; break; +// case QEvent::PolishRequest: +// kDebug() << "PolishRequest"; break; +// case QEvent::Polish: +// kDebug() << "Polish"; break; +// case QEvent::LayoutRequest: +// kDebug() << "LayoutRequest"; break; +// case QEvent::UpdateRequest: +// kDebug() << "UpdateRequest"; break; +// case QEvent::UpdateLater: +// kDebug() << "UpdateLater"; break; +// case QEvent::EmbeddingControl: +// kDebug() << "EmbeddingControl"; break; +// case QEvent::ActivateControl: +// kDebug() << "ActivateControl"; break; +// case QEvent::DeactivateControl: +// kDebug() << "DeactivateControl"; break; +// case QEvent::ContextMenu: +// kDebug() << "ContextMenu"; break; +// case QEvent::InputMethod: +// kDebug() << "InputMethod"; break; +// case QEvent::AccessibilityPrepare: +// kDebug() << "AccessibilityPrepare"; break; +// case QEvent::TabletMove: +// kDebug() << "TabletMove"; break; +// case QEvent::LocaleChange: +// kDebug() << "LocaleChange"; break; +// case QEvent::LanguageChange: +// kDebug() << "LanguageChange"; break; +// case QEvent::LayoutDirectionChange: +// kDebug() << "LayoutDirectionChange"; break; +// case QEvent::Style: +// kDebug() << "Style"; break; +// case QEvent::TabletPress: +// kDebug() << "TabletPress"; break; +// case QEvent::TabletRelease: +// kDebug() << "TabletRelease"; break; +// case QEvent::OkRequest: +// kDebug() << "OkRequest"; break; +// case QEvent::HelpRequest: +// kDebug() << "HelpRequest"; break; +// case QEvent::IconDrag: +// kDebug() << "IconDrag"; break; +// case QEvent::FontChange: +// kDebug() << "FontChange"; break; +// case QEvent::EnabledChange: +// kDebug() << "EnabledChange"; break; +// case QEvent::ActivationChange: +// kDebug() << "ActivationChange"; break; +// case QEvent::StyleChange: +// kDebug() << "StyleChange"; break; +// case QEvent::IconTextChange: +// kDebug() << "IconTextChange"; break; +// case QEvent::ModifiedChange: +// kDebug() << "ModifiedChange"; break; +// case QEvent::MouseTrackingChange: +// kDebug() << "MouseTrackingChange"; break; +// case QEvent::WindowBlocked: +// kDebug() << "WindowBlocked"; break; +// case QEvent::WindowUnblocked: +// kDebug() << "WindowUnblocked"; break; +// case QEvent::WindowStateChange: +// kDebug() << "WindowStateChange"; break; +// case QEvent::ToolTip: +// kDebug() << "ToolTip"; break; +// case QEvent::WhatsThis: +// kDebug() << "WhatsThis"; break; +// case QEvent::StatusTip: +// kDebug() << "StatusTip"; break; +// case QEvent::ActionChanged: +// kDebug() << "ActionChanged"; break; +// case QEvent::ActionAdded: +// kDebug() << "ActionAdded"; break; +// case QEvent::ActionRemoved: +// kDebug() << "ActionRemoved"; break; +// case QEvent::FileOpen: +// kDebug() << "FileOpen"; break; +// case QEvent::Shortcut: +// kDebug() << "Shortcut"; break; +// case QEvent::ShortcutOverride: +// kDebug() << "ShortcutOverride"; break; +// case QEvent::WhatsThisClicked: +// kDebug() << "WhatsThisClicked"; break; +// case QEvent::QueryWhatsThis: +// kDebug() << "QueryWhatsThis"; break; +// case QEvent::EnterWhatsThisMode: +// kDebug() << "EnterWhatsThisMode"; break; +// case QEvent::LeaveWhatsThisMode: +// kDebug() << "LeaveWhatsThisMode"; break; +// case QEvent::ZOrderChange: +// kDebug() << "ZOrderChange"; break; +// case QEvent::HoverEnter: +// kDebug() << "HoverEnter"; break; +// case QEvent::HoverLeave: +// kDebug() << "HoverLeave"; break; +// case QEvent::HoverMove: +// kDebug() << "HoverMove"; break; +// case QEvent::AccessibilityHelp: +// kDebug() << "AccessibilityHelp"; break; +// case QEvent::AccessibilityDescription: +// kDebug() << "AccessibilityDescription"; break; +// case QEvent::AcceptDropsChange: +// kDebug() << "AcceptDropsChange"; break; +// case QEvent::MenubarUpdated: +// kDebug() << "MenubarUpdated"; break; +// case QEvent::ZeroTimerEvent: +// kDebug() << "ZeroTimerEvent"; break; +// case QEvent::GraphicsSceneMouseMove: +// kDebug() << "GraphicsSceneMouseMove"; break; +// case QEvent::GraphicsSceneMousePress: +// kDebug() << "GraphicsSceneMousePress"; break; +// case QEvent::GraphicsSceneMouseRelease: +// kDebug() << "GraphicsSceneMouseRelease"; break; +// case QEvent::GraphicsSceneMouseDoubleClick: +// kDebug() << "GraphicsSceneMouseDoubleClick"; break; +// case QEvent::GraphicsSceneContextMenu: +// kDebug() << "GraphicsSceneContextMenu"; break; +// case QEvent::GraphicsSceneHoverEnter: +// kDebug() << "GraphicsSceneHoverEnter"; break; +// case QEvent::GraphicsSceneHoverMove: +// kDebug() << "GraphicsSceneHoverMove"; break; +// case QEvent::GraphicsSceneHoverLeave: +// kDebug() << "GraphicsSceneHoverLeave"; break; +// case QEvent::GraphicsSceneHelp: +// kDebug() << "GraphicsSceneHelp"; break; +// case QEvent::GraphicsSceneDragEnter: +// kDebug() << "GraphicsSceneDragEnter"; break; +// case QEvent::GraphicsSceneDragMove: +// kDebug() << "GraphicsSceneDragMove"; break; +// case QEvent::GraphicsSceneDragLeave: +// kDebug() << "GraphicsSceneDragLeave"; break; +// case QEvent::GraphicsSceneDrop: +// kDebug() << "GraphicsSceneDrop"; break; +// case QEvent::GraphicsSceneWheel: +// kDebug() << "GraphicsSceneWheel"; break; +// case QEvent::KeyboardLayoutChange: +// kDebug() << "KeyboardLayoutChange"; break; +// case QEvent::DynamicPropertyChange: +// kDebug() << "DynamicPropertyChange"; break; +// case QEvent::TabletEnterProximity: +// kDebug() << "TabletEnterProximity"; break; +// case QEvent::TabletLeaveProximity: +// kDebug() << "TabletLeaveProximity"; break; +// case QEvent::NonClientAreaMouseMove: +// kDebug() << "NonClientAreaMouseMove"; break; +// case QEvent::NonClientAreaMouseButtonPress: +// kDebug() << "NonClientAreaMouseButtonPress"; break; +// case QEvent::NonClientAreaMouseButtonRelease: +// kDebug() << "NonClientAreaMouseButtonRelease"; break; +// case QEvent::NonClientAreaMouseButtonDblClick: +// kDebug() << "NonClientAreaMouseButtonDblClick"; break; +// case QEvent::MacSizeChange: +// kDebug() << "MacSizeChange"; break; +// case QEvent::ContentsRectChange: +// kDebug() << "ContentsRectChange"; break; +// case QEvent::MacGLWindowChange: +// kDebug() << "MacGLWindowChange"; break; +// case QEvent::FutureCallOut: +// kDebug() << "FutureCallOut"; break; +// case QEvent::GraphicsSceneResize: +// kDebug() << "GraphicsSceneResize"; break; +// case QEvent::GraphicsSceneMove: +// kDebug() << "GraphicsSceneMove"; break; +// case QEvent::CursorChange: +// kDebug() << "CursorChange"; break; +// case QEvent::ToolTipChange: +// kDebug() << "ToolTipChange"; break; +// case QEvent::NetworkReplyUpdated: +// kDebug() << "NetworkReplyUpdated"; break; +// case QEvent::GrabMouse: +// kDebug() << "GrabMouse"; break; +// case QEvent::UngrabMouse: +// kDebug() << "UngrabMouse"; break; +// case QEvent::GrabKeyboard: +// kDebug() << "GrabKeyboard"; break; +// case QEvent::UngrabKeyboard: +// kDebug() << "UngrabKeyboard"; break; +// case QEvent::MacGLClearDrawable: +// kDebug() << "MacGLClearDrawable"; break; +// case QEvent::StateMachineSignal: +// kDebug() << "StateMachineSignal"; break; +// case QEvent::StateMachineWrapped: +// kDebug() << "StateMachineWrapped"; break; +// case QEvent::TouchBegin: +// kDebug() << "TouchBegin"; break; +// case QEvent::TouchUpdate: +// kDebug() << "TouchUpdate"; break; +// case QEvent::TouchEnd: +// kDebug() << "TouchEnd"; break; +// case QEvent::NativeGesture: +// kDebug() << "NativeGesture"; break; +// case QEvent::RequestSoftwareInputPanel: +// kDebug() << "RequestSoftwareInputPanel"; break; +// case QEvent::CloseSoftwareInputPanel: +// kDebug() << "CloseSoftwareInputPanel"; break; +// case QEvent::UpdateSoftKeys: +// kDebug() << "UpdateSoftKeys"; break; +// case QEvent::WinIdChange: +// kDebug() << "WinIdChange"; break; +// case QEvent::Gesture: +// kDebug() << "Gesture"; break; +// case QEvent::GestureOverride: +// kDebug() << "GestureOverride"; break; +// case QEvent::User: +// kDebug() << "User"; break; +// case QEvent::MaxUser: +// kDebug() << "MaxUser"; break; +// } + return QPushButton::event(e); +} \ No newline at end of file diff --git a/kde/src/widgets/TranslucentButtons.h b/kde/src/widgets/TranslucentButtons.h new file mode 100644 index 0000000000..3e5c32f1d8 --- /dev/null +++ b/kde/src/widgets/TranslucentButtons.h @@ -0,0 +1,36 @@ +#ifndef TRANSLUCENTBUTTONS_H +#define TRANSLUCENTBUTTONS_H +#include <QtGui/QPushButton> + +class QTimer; +class QMimeData; + +///@class TranslucentButtons Fancy buttons for the call widget +class TranslucentButtons : public QPushButton +{ + Q_OBJECT +public: + TranslucentButtons(QWidget* parent); + ~TranslucentButtons(); + +protected: + virtual void paintEvent(QPaintEvent* event); + virtual void dragEnterEvent ( QDragEnterEvent *e ); + virtual void dragMoveEvent ( QDragMoveEvent *e ); + virtual void dragLeaveEvent ( QDragLeaveEvent *e ); + virtual void dropEvent ( QDropEvent *e ); + virtual bool event(QEvent* e); +private: + bool m_enabled; + uint m_step; + QTimer* m_pTimer; + QColor m_CurrentColor; + static TranslucentButtons* m_psActiveButton; /*Workaround for a Qt bug*/ +public slots: + void setVisible(bool enabled); +private slots: + void changeVisibility(); +signals: + void dataDropped(QMimeData*); +}; +#endif \ No newline at end of file -- GitLab