diff --git a/kde/src/AccountWizard.cpp b/kde/src/AccountWizard.cpp index d14d9120abcabad17fd01a48b0b94a83167a78a3..2f389bdc640b4e0502a9470ea2ceac2b0b36f0f1 100755 --- a/kde/src/AccountWizard.cpp +++ b/kde/src/AccountWizard.cpp @@ -2,6 +2,7 @@ * Copyright (C) 2009-2012 by Savoir-Faire Linux * * Author : Jérémy Quentin <jeremy.quentin@savoirfairelinux.com> * * Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com>* + * ^^ Refuse any liability for this code * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * diff --git a/kde/src/AccountWizard.h b/kde/src/AccountWizard.h index 1bc870b57f9249d4b9a0d107018382329e5de614..04171199091dbbf85944367e3dc4c9a3907999f5 100755 --- a/kde/src/AccountWizard.h +++ b/kde/src/AccountWizard.h @@ -36,13 +36,10 @@ class AccountWizard : public QWizard Q_OBJECT public: - enum { Page_Intro, Page_AutoMan, Page_Type, Page_Email, Page_SIPForm, Page_IAXForm, Page_Stun, Page_Conclusion }; - AccountWizard(QWidget * parent = 0); ~AccountWizard(); void accept(); - }; /*************************************************************************** diff --git a/kde/src/CallView.cpp b/kde/src/CallView.cpp index 9714c918cdd839bc77bf5df4dd45d882ee1a0a62..265a7c21cee2c4a819201418c0f2fd4858fa6790 100644 --- a/kde/src/CallView.cpp +++ b/kde/src/CallView.cpp @@ -69,7 +69,6 @@ CallTreeItemDelegate(CallView* widget) if (index.parent().isValid() && !index.parent().child(index.row()+1,0).isValid()) sh.rheight() += 15; - } return sh; @@ -113,7 +112,6 @@ CallTreeItemDelegate(CallView* widget) for (int i =0;i < childCount;i++) { r.setHeight(r.height() + sizeHint(option,index).height()); } -// qDebug() << "\n\nFINAL SIZE" << r; } r.setTop(r.top() + m_ConferenceDrawer.leftMargin()); @@ -180,13 +178,13 @@ CallTreeItemDelegate(CallView* widget) widget->setMaximumSize((m_tree->viewport()->width() - m_ConferenceDrawer.leftMargin() - m_ConferenceDrawer.rightMargin())-m_ConferenceDrawer.leftMargin(),max); } } - + if (index.parent().isValid() && !index.parent().child(index.row()+1,0).isValid()) { m_ConferenceDrawer.drawBoxBottom(index, 0, option, painter); } } - + private: CallView* m_tree; ConferenceBox m_ConferenceDrawer; diff --git a/kde/src/CallView.h b/kde/src/CallView.h index 38d8438463bfcd05a151d56543adeca33fc3dde7..8bca22dad8804962b78abf70b7c139c6ef9aaaea 100644 --- a/kde/src/CallView.h +++ b/kde/src/CallView.h @@ -18,10 +18,13 @@ #ifndef CALL_VIEW #define CALL_VIEW +//Qt #include <QtGui/QTreeWidget> #include <QtGui/QPainter> #include <QtGui/QStyledItemDelegate> #include <QtCore/QTimer> + +//SFLPhone #include "lib/CallModel.h" //Qt diff --git a/kde/src/SFLPhone.cpp b/kde/src/SFLPhone.cpp index 11c0edb908ffff3cb3dc73daccecd3fd4706ebdd..35e302393fef61eef8c0f305f727facfb165f96c 100755 --- a/kde/src/SFLPhone.cpp +++ b/kde/src/SFLPhone.cpp @@ -252,35 +252,37 @@ void SFLPhone::setupActions() action_configureSflPhone = KStandardAction::preferences(m_pView, SLOT(configureSflPhone()), this); action_configureSflPhone->setText(i18n("Configure SFLphone")); - action_displayDialpad = new KAction(KIcon(QIcon(ICON_DISPLAY_DIALPAD)), i18n("Display dialpad"), this); + action_displayDialpad = new KAction(KIcon(QIcon(ICON_DISPLAY_DIALPAD)), i18n("Display dialpad") , this); + action_displayMessageBox = new KAction(KIcon("mail-message-new"), i18n("Display text message box") , this); + action_displayVolumeControls = new KAction(KIcon(QIcon(ICON_DISPLAY_VOLUME_CONSTROLS)), i18n("Display volume controls"), this); + action_pastenumber = new KAction(KIcon("edit-paste"), i18n("Paste") , this); + action_showContactDock = new KAction(KIcon("edit-find-user") , i18n("Display Contact") , this); + action_showHistoryDock = new KAction(KIcon("view-history") , i18n("Display history") , this); + action_showBookmarkDock = new KAction(KIcon("bookmark-new-list"), i18n("Display bookmark") , this); + action_accountCreationWizard = new KAction(i18n("Account creation wizard") , this); + + action_displayDialpad->setCheckable( true ); action_displayDialpad->setChecked ( ConfigurationSkeleton::displayDialpad() ); action_configureSflPhone->setText(i18n("Configure SFLphone")); - action_displayMessageBox = new KAction(KIcon("mail-message-new"), i18n("Display text message box"), this); action_displayMessageBox->setCheckable( true ); action_displayMessageBox->setChecked ( ConfigurationSkeleton::displayMessageBox() ); - action_displayVolumeControls = new KAction(KIcon(QIcon(ICON_DISPLAY_VOLUME_CONSTROLS)), i18n("Display volume controls"), this); action_displayVolumeControls->setCheckable( true ); action_displayVolumeControls->setChecked ( ConfigurationSkeleton::displayVolume() ); - action_pastenumber = new KAction(KIcon("edit-paste"), i18n("Paste"), this); action_pastenumber->setShortcut ( Qt::CTRL + Qt::Key_V ); - action_showContactDock = new KAction(KIcon("edit-find-user") , i18n("Display Contact") , this); action_showContactDock->setCheckable( true ); action_showContactDock->setChecked(ConfigurationSkeleton::displayContactDock()); - action_showHistoryDock = new KAction(KIcon("view-history") , i18n("Display history") , this); action_showHistoryDock->setCheckable( true ); action_showHistoryDock->setChecked(ConfigurationSkeleton::displayHistoryDock()); - action_showBookmarkDock = new KAction(KIcon("bookmark-new-list"), i18n("Display bookmark"), this); action_showBookmarkDock->setCheckable( true ); action_showBookmarkDock->setChecked(ConfigurationSkeleton::displayBookmarkDock()); - action_accountCreationWizard = new KAction(i18n("Account creation wizard"), this); action_configureShortcut = new KAction(KIcon(KIcon("configure-shortcuts")), i18n("Configure Shortcut"), this); diff --git a/kde/src/SFLPhoneAccessibility.cpp b/kde/src/SFLPhoneAccessibility.cpp index 2cdb8f0a4906f2f6cc2683bf0cbed8f717265167..0c3c3694c223f41adf4b2efb16e597e0d77e0f69 100644 --- a/kde/src/SFLPhoneAccessibility.cpp +++ b/kde/src/SFLPhoneAccessibility.cpp @@ -28,18 +28,18 @@ SFLPhoneAccessibility* SFLPhoneAccessibility::m_pInstance=nullptr; SFLPhoneAccessibility::SFLPhoneAccessibility() : QObject(0),QList<KAction*>() { KAction* action = new KAction(0); - action->setObjectName("listCall"); - action->setShortcut( Qt::CTRL + Qt::Key_L ); - action->setText("List all current calls"); - action->setIcon(KIcon("text-speak")); + action->setObjectName ( "listCall" ); + action->setShortcut ( Qt::CTRL + Qt::Key_L ); + action->setText ( "List all current calls" ); + action->setIcon ( KIcon("text-speak") ); *this << action; connect(action,SIGNAL(triggered(bool)),this,SLOT(listCall())); action = new KAction(0); - action->setObjectName("currentCallDetails"); - action->setShortcut( Qt::CTRL + Qt::Key_I ); - action->setText("Get current call details"); - action->setIcon(KIcon("text-speak")); + action->setObjectName ( "currentCallDetails" ); + action->setShortcut ( Qt::CTRL + Qt::Key_I ); + action->setText ( "Get current call details" ); + action->setIcon ( KIcon("text-speak") ); *this << action; connect(action,SIGNAL(triggered(bool)),this,SLOT(currentCallDetails())); } @@ -92,7 +92,7 @@ void SFLPhoneAccessibility::currentCallDetails() toSay += i18n(", the peer phone number is %1 ",numberToDigit(call->getPeerPhoneNumber()) ); else if (!call->getCallNumber().isEmpty()) toSay += i18n(", the phone number is %1 ",numberToDigit(call->getCallNumber())); - + int nSec = QDateTime::fromTime_t(call->getStartTimeStamp().toInt()).time().secsTo( QTime::currentTime() ); if (nSec>0) toSay += i18n(" and you have been talking since %1 seconds",nSec ); diff --git a/kde/src/SFLPhoneAccessibility.h b/kde/src/SFLPhoneAccessibility.h index 02bb138f87c39f80fe90040c7db6487aa09c6bda..bfda00c375d8e6cdcdbf40f68d0f724e10657deb 100644 --- a/kde/src/SFLPhoneAccessibility.h +++ b/kde/src/SFLPhoneAccessibility.h @@ -26,10 +26,14 @@ class SFLPhoneAccessibility : public QObject, public QList<KAction*> { Q_OBJECT public: + //Singleton static SFLPhoneAccessibility* getInstance(); private: + //Constructor SFLPhoneAccessibility(); QString numberToDigit(QString number); + + //Static attributes static SFLPhoneAccessibility* m_pInstance; public slots: diff --git a/kde/src/SFLPhoneView.cpp b/kde/src/SFLPhoneView.cpp index 4ea8532483ccdfae39b86d6da83604ebe4253975..62464666e05a1c96ed3250bb090e7b1c0f4e4d99 100755 --- a/kde/src/SFLPhoneView.cpp +++ b/kde/src/SFLPhoneView.cpp @@ -414,15 +414,18 @@ void SFLPhoneView::updateWindowCallState() actionTexts [ SFLPhone::Refuse ] = ACTION_LABEL_REFUSE ; m_pMessageBoxW->setVisible(false || IM_ACTIVE) ; break; + case CALL_STATE_RINGING: enabledActions [ SFLPhone::Hold ] = false ; enabledActions [ SFLPhone::Transfer ] = false ; m_pMessageBoxW->setVisible(false) ; break; + case CALL_STATE_CURRENT: buttonIconFiles [ SFLPhone::Record ] = ICON_REC_DEL_ON ; m_pMessageBoxW->setVisible((true && ConfigurationSkeleton::displayMessageBox()) || IM_ACTIVE); break; + case CALL_STATE_DIALING: enabledActions [ SFLPhone::Hold ] = false ; enabledActions [ SFLPhone::Transfer ] = false ; @@ -431,11 +434,13 @@ void SFLPhoneView::updateWindowCallState() buttonIconFiles [ SFLPhone::Accept ] = ICON_ACCEPT ; m_pMessageBoxW->setVisible(false) ; break; + case CALL_STATE_HOLD: buttonIconFiles [ SFLPhone::Hold ] = ICON_UNHOLD ; actionTexts [ SFLPhone::Hold ] = ACTION_LABEL_UNHOLD ; m_pMessageBoxW->setVisible(false) ; break; + case CALL_STATE_FAILURE: enabledActions [ SFLPhone::Accept ] = false ; enabledActions [ SFLPhone::Hold ] = false ; @@ -443,6 +448,7 @@ void SFLPhoneView::updateWindowCallState() enabledActions [ SFLPhone::Record ] = false ; m_pMessageBoxW->setVisible(false) ; break; + case CALL_STATE_BUSY: enabledActions [ SFLPhone::Accept ] = false ; enabledActions [ SFLPhone::Hold ] = false ; @@ -450,6 +456,7 @@ void SFLPhoneView::updateWindowCallState() enabledActions [ SFLPhone::Record ] = false ; m_pMessageBoxW->setVisible(false) ; break; + case CALL_STATE_TRANSFERRED: buttonIconFiles [ SFLPhone::Accept ] = ICON_EXEC_TRANSF ; actionTexts [ SFLPhone::Transfer ] = ACTION_LABEL_GIVE_UP_TRANSF ; @@ -457,6 +464,7 @@ void SFLPhoneView::updateWindowCallState() m_pMessageBoxW->setVisible(false || IM_ACTIVE) ; transfer = true; break; + case CALL_STATE_TRANSF_HOLD: buttonIconFiles [ SFLPhone::Accept ] = ICON_EXEC_TRANSF ; buttonIconFiles [ SFLPhone::Hold ] = ICON_UNHOLD ; @@ -465,25 +473,31 @@ void SFLPhoneView::updateWindowCallState() m_pMessageBoxW->setVisible(false) ; transfer = true; break; + case CALL_STATE_OVER: kDebug() << "Error : Reached CALL_STATE_OVER with call " << call->getCallId() << "!"; m_pMessageBoxW->setVisible(false) ; break; + case CALL_STATE_ERROR: kDebug() << "Error : Reached CALL_STATE_ERROR with call " << call->getCallId() << "!"; m_pMessageBoxW->setVisible(false) ; break; + case CALL_STATE_CONFERENCE: enabledActions [ SFLPhone::Transfer ] = false ; m_pMessageBoxW->setVisible(false || IM_ACTIVE) ; break; + case CALL_STATE_CONFERENCE_HOLD: enabledActions [ SFLPhone::Transfer ] = false ; m_pMessageBoxW->setVisible(false) ; break; + default: kDebug() << "Error : Reached unexisting state for call " << call->getCallId() << "(" << call->toHumanStateName() << "!"; break; + } } diff --git a/kde/src/main.cpp b/kde/src/main.cpp index bb1978de5d44642a980ed6c3ab4b377376a3e481..0e7f2acb4798f8dcb7ff6ce1f5daca82890abbee 100755 --- a/kde/src/main.cpp +++ b/kde/src/main.cpp @@ -82,7 +82,7 @@ int main(int argc, char **argv) //configuration dbus TreeWidgetCallModel::init(); - + SFLPhone* sflphoneWindow_ = new SFLPhone(); if( ! sflphoneWindow_->initialize() ) { exit(1); @@ -96,13 +96,13 @@ int main(int argc, char **argv) sflphoneWindow_->show(); else sflphoneWindow_->hide(); - + int retVal = app->exec(); delete sflphoneWindow_; ConfigurationSkeleton::self()->writeConfig(); - + delete app; return retVal; } diff --git a/kde/src/widgets/AcceleratedVideoWidget.cpp b/kde/src/widgets/AcceleratedVideoWidget.cpp index 0bf3aac41d60f4b013df4b9e3fe9891cf0ea3f08..57ad8909aeaa307bd3c03bb64542e89be0318c86 100644 --- a/kde/src/widgets/AcceleratedVideoWidget.cpp +++ b/kde/src/widgets/AcceleratedVideoWidget.cpp @@ -1,6 +1,7 @@ /*************************************************************************** * Copyright (C) 2009-2012 by Savoir-Faire Linux * * Author : Emmanuel Lepage Valle <emmanuel.lepage@savoirfairelinux.com >* + * Nokia * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -26,9 +27,9 @@ #include <QtGui/QImage> #include <QtCore/QPropertyAnimation> -static const qreal FACE_SIZE = 0.4; +static const qreal FACE_SIZE = 0.4; -static const qreal speeds[] = { 1.8f, 2.4f, 3.6f }; +static const qreal speeds[] = { 1.8f, 2.4f, 3.6f }; static const qreal amplitudes[] = { 2.0f, 2.5f, 3.0f }; static inline void qSetColor(float colorVec[], QColor c) diff --git a/kde/src/widgets/AcceleratedVideoWidget.h b/kde/src/widgets/AcceleratedVideoWidget.h index edb1ba3d10ae94b3e89d25513048dfb278940134..74ca7c1372b396d430acf53580e284611b54885d 100644 --- a/kde/src/widgets/AcceleratedVideoWidget.h +++ b/kde/src/widgets/AcceleratedVideoWidget.h @@ -1,6 +1,7 @@ /*************************************************************************** * Copyright (C) 2009-2012 by Savoir-Faire Linux * * Author : Emmanuel Lepage Valle <emmanuel.lepage@savoirfairelinux.com >* + * Nokia * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * diff --git a/kde/src/widgets/BookmarkDock.cpp b/kde/src/widgets/BookmarkDock.cpp index 9b183c5252704de2954fd8a43590d3a862591603..9e394d6f0ddd8fb2e890bc445787b71f9389351b 100644 --- a/kde/src/widgets/BookmarkDock.cpp +++ b/kde/src/widgets/BookmarkDock.cpp @@ -69,26 +69,26 @@ BookmarkDock::BookmarkDock(QWidget* parent) : QDockWidget(parent) setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum); setMinimumSize(250,0); - m_pFilterLE = new KLineEdit(this); - m_pSplitter = new QSplitter(Qt::Vertical,this); - m_pItemView = new CategorizedTreeWidget(this); - m_pMostUsedCK = new QCheckBox(this); + m_pFilterLE = new KLineEdit ( this ); + m_pSplitter = new QSplitter ( Qt::Vertical,this ); + m_pItemView = new CategorizedTreeWidget( this ); + m_pMostUsedCK = new QCheckBox ( this ); + QWidget* mainWidget = new QWidget ( this ); + QVBoxLayout* mainLayout = new QVBoxLayout ( mainWidget ); m_pFilterLE->setPlaceholderText(i18n("Filter")); m_pMostUsedCK->setChecked(ConfigurationSkeleton::displayContactCallHistory()); - - QWidget* mainWidget = new QWidget(this); + setWidget(mainWidget); m_pMostUsedCK->setText(i18n("Show most called contacts")); - QVBoxLayout* mainLayout = new QVBoxLayout(mainWidget); - mainLayout->addWidget(m_pMostUsedCK); - mainLayout->addWidget(m_pSplitter); - m_pSplitter->addWidget(m_pItemView); - mainLayout->addWidget(m_pFilterLE); + mainLayout->addWidget ( m_pMostUsedCK ); + mainLayout->addWidget ( m_pSplitter ); + m_pSplitter->addWidget( m_pItemView ); + mainLayout->addWidget ( m_pFilterLE ); m_pSplitter->setChildrenCollapsible(true); m_pSplitter->setStretchFactor(0,7); diff --git a/kde/src/widgets/CallTreeItem.cpp b/kde/src/widgets/CallTreeItem.cpp index dc65971c6a0be791749e02f4f21c8a6a70eb13d2..10e1f8e2780ecaea0cddd359d780445bb0ddad35 100644 --- a/kde/src/widgets/CallTreeItem.cpp +++ b/kde/src/widgets/CallTreeItem.cpp @@ -194,12 +194,14 @@ void CallTreeItem::setCall(Call *call) baseColor.setRed (baseColor.red() + (textColor.red() -baseColor.red()) *0.6); baseColor.setGreen(baseColor.green()+ (textColor.green()-baseColor.green())*0.6); - m_pHistoryPeerL = new QLabel(i18n("<b>Conference</b>"),this); - m_pHistoryPeerL->setStyleSheet("color:"+baseColor.name()); - m_pIconL = new QLabel(" ",this); + m_pHistoryPeerL = new QLabel( i18n("<b>Conference</b>"),this ); + m_pIconL = new QLabel( " ",this ); QHBoxLayout* mainLayout = new QHBoxLayout(); - mainLayout->addWidget(m_pIconL); - mainLayout->addWidget(m_pHistoryPeerL); + m_pHistoryPeerL->setStyleSheet("color:"+baseColor.name()); + + mainLayout->addWidget( m_pIconL ); + mainLayout->addWidget( m_pHistoryPeerL ); + setLayout(mainLayout); m_Init = true; } @@ -213,35 +215,34 @@ void CallTreeItem::setCall(Call *call) m_pTransferNumberL = new QLabel(" "); m_pElapsedL = new QLabel(" "); QSpacerItem* verticalSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding); - + m_pTransferPrefixL->setVisible(false); m_pTransferNumberL->setVisible(false); - + 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(i18n("Conference")); m_pBtnConf->setPixmap(new QImage(KStandardDirs::locate("data","sflphone-client-kde/confBlackWhite.png"))); connect(m_pBtnConf,SIGNAL(dataDropped(QMimeData*)),this,SLOT(conversationEvent(QMimeData*))); - + m_pBtnTrans = new TranslucentButtons(this); m_pBtnTrans->setText(i18n("Transfer")); m_pBtnTrans->setVisible(false); m_pBtnTrans->setPixmap(new QImage(KStandardDirs::locate("data","sflphone-client-kde/transferarraw.png"))); connect(m_pBtnTrans,SIGNAL(dataDropped(QMimeData*)),this,SLOT(transferEvent(QMimeData*))); - + m_pElapsedL->setStyleSheet("margin-right:5px;"); - + mainLayout->setSpacing(4); - QVBoxLayout* descr = new QVBoxLayout(); - descr->setMargin(1); - descr->setSpacing(1); + QVBoxLayout* descr = new QVBoxLayout(); QHBoxLayout* transfer = new QHBoxLayout(); - transfer->setMargin(0); + descr->setMargin (1); + descr->setSpacing (1); + transfer->setMargin (0); transfer->setSpacing(0); if (ConfigurationSkeleton::displayCallIcon()) { @@ -499,12 +500,12 @@ void CallTreeItem::dropEvent(QDropEvent *e) void CallTreeItem::resizeEvent ( QResizeEvent *e ) { if (m_pBtnConf) { - m_pBtnConf->setMinimumSize(width()/2-15,height()-4); - m_pBtnConf->setMaximumSize(width()/2-15,height()-4); - m_pBtnTrans->setMinimumSize(width()/2-15,height()-4); - m_pBtnTrans->setMaximumSize(width()/2-15,height()-4); - m_pBtnTrans->move(width()/2+10,m_pBtnTrans->y()+2); - m_pBtnConf->move(10,m_pBtnConf->y()+2); + m_pBtnConf->setMinimumSize ( width()/2-15,height()-4 ); + m_pBtnConf->setMaximumSize ( width()/2-15,height()-4 ); + m_pBtnTrans->setMinimumSize( width()/2-15,height()-4 ); + m_pBtnTrans->setMaximumSize( width()/2-15,height()-4 ); + m_pBtnTrans->move ( width()/2+10,m_pBtnTrans->y()+2); + m_pBtnConf->move ( 10,m_pBtnConf->y()+2 ); } e->accept(); @@ -539,11 +540,11 @@ void CallTreeItem::copy() { kDebug() << "Copying contact"; QMimeData* mimeData = new QMimeData(); - mimeData->setData(MIME_CALLID, m_pItemCall->getCallId().toUtf8()); QString numbers(m_pItemCall->getPeerName()+": "+m_pItemCall->getPeerPhoneNumber()); QString numbersHtml("<b>"+m_pItemCall->getPeerName()+"</b><br />"+m_pItemCall->getPeerPhoneNumber()); - mimeData->setData("text/plain", numbers.toUtf8()); - mimeData->setData("text/html", numbersHtml.toUtf8()); + mimeData->setData( MIME_CALLID , m_pItemCall->getCallId().toUtf8() ); + mimeData->setData( "text/plain" , numbers.toUtf8() ); + mimeData->setData( "text/html" , numbersHtml.toUtf8() ); QClipboard* clipboard = QApplication::clipboard(); clipboard->setMimeData(mimeData); } @@ -552,7 +553,7 @@ void CallTreeItem::copy() void CallTreeItem::hide() { if (!m_isHover) { - m_pBtnConf->setVisible(false); + m_pBtnConf->setVisible (false); m_pBtnTrans->setVisible(false); } } diff --git a/kde/src/widgets/CallTreeItem.h b/kde/src/widgets/CallTreeItem.h index 5727c0944948975fd943376aa6e7a4089e3c9394..f169f7fd59ff233d7ce245137439f652b6d47e86 100644 --- a/kde/src/widgets/CallTreeItem.h +++ b/kde/src/widgets/CallTreeItem.h @@ -97,11 +97,11 @@ class CallTreeItem : public QWidget virtual void mouseDoubleClickEvent ( QMouseEvent *e ); private slots: - void transferEvent(QMimeData* data); + void transferEvent (QMimeData* data); void conversationEvent(QMimeData* data); - void hide(); - void incrementTimer(); - void copy(); + void hide ( ); + void incrementTimer ( ); + void copy ( ); public slots: void updated(); diff --git a/kde/src/widgets/CategorizedTreeWidget.cpp b/kde/src/widgets/CategorizedTreeWidget.cpp index fbd536e37b6431f311f254f738f8784a4119fa81..b57fb45cf29ceba3d85784ff0137a1890001f6d6 100644 --- a/kde/src/widgets/CategorizedTreeWidget.cpp +++ b/kde/src/widgets/CategorizedTreeWidget.cpp @@ -31,6 +31,7 @@ #include <QKeyEvent> //BEGIN KateColorTreeDelegate +///Code taken from Kate and adapted to render categorized lists class KateColorTreeDelegate : public QStyledItemDelegate { public: @@ -154,6 +155,7 @@ class KateColorTreeDelegate : public QStyledItemDelegate }; //END KateColorTreeDelegate +///Constructor CategorizedTreeWidget::CategorizedTreeWidget(QWidget *parent) : QTreeWidget(parent) { @@ -166,20 +168,21 @@ CategorizedTreeWidget::CategorizedTreeWidget(QWidget *parent) setHorizontalScrollMode(QAbstractItemView::ScrollPerItem); } +///Do not draw branches void CategorizedTreeWidget::drawBranches(QPainter* painter, const QRect& rect, const QModelIndex& index) const { - Q_UNUSED(painter) - Q_UNUSED(rect) - Q_UNUSED(index) - /*if (index.parent().parent().isValid()) - QTreeWidget::drawBranches(painter,rect,index);*/ + Q_UNUSED( painter ) + Q_UNUSED( rect ) + Q_UNUSED( index ) } +///Get the item list QVector<QTreeWidgetItem*> CategorizedTreeWidget::realItems() const { return m_lItems; } +///Remove an item from the list void CategorizedTreeWidget::removeItem(QTreeWidgetItem* item) { for (int i=0;i<topLevelItemCount();i++) { diff --git a/kde/src/widgets/CategorizedTreeWidget.h b/kde/src/widgets/CategorizedTreeWidget.h index da995dc8d5d9f4418c54a462c30a8473bf32276e..8a021d5bf5028057da5c8a4223afd3112fa378a0 100644 --- a/kde/src/widgets/CategorizedTreeWidget.h +++ b/kde/src/widgets/CategorizedTreeWidget.h @@ -51,6 +51,7 @@ class CategorizedTreeWidget : public QTreeWidget QVector<QTreeWidgetItem*> m_lItems; }; +///Add new item to the list template <class T> T* CategorizedTreeWidget::addItem(QString category,bool top) { QTreeWidgetItem* categoryItem = 0; @@ -74,7 +75,7 @@ template <class T> T* CategorizedTreeWidget::addItem(QString category,bool top) return iwdg; } - +///Add a category to the list template <class T> T* CategorizedTreeWidget::addCategory(QString name) { T* categoryItem = new T(this); diff --git a/kde/src/widgets/CategoryDrawer.cpp b/kde/src/widgets/CategoryDrawer.cpp index 67ba7c916262550f895fc972237f8de05fea0953..ddb3a02568023c2a2499a1d0336b6589fe4675db 100644 --- a/kde/src/widgets/CategoryDrawer.cpp +++ b/kde/src/widgets/CategoryDrawer.cpp @@ -24,248 +24,251 @@ #include <QApplication> #include <QStyleOption> +///Constructor CategoryDrawer::CategoryDrawer() { setLeftMargin ( 7 ); setRightMargin( 7 ); } -void CategoryDrawer::drawCategory(const QModelIndex &index, - int sortRole, - const QStyleOption &option, - QPainter *painter) const +///Draw a category style +void CategoryDrawer::drawCategory(const QModelIndex& index , + int sortRole, + const QStyleOption& option , + QPainter* painter ) const { - Q_UNUSED( sortRole ) + Q_UNUSED( sortRole ) + + painter->setRenderHint(QPainter::Antialiasing); - painter->setRenderHint(QPainter::Antialiasing); + const QRect optRect = option.rect; + QFont font(QApplication::font()); + font.setBold(true); + const QFontMetrics fontMetrics = QFontMetrics(font); + const int height = categoryHeight(index, option); + const bool leftToRight = painter->layoutDirection() == Qt::LeftToRight; - const QRect optRect = option.rect; - QFont font(QApplication::font()); - font.setBold(true); - const QFontMetrics fontMetrics = QFontMetrics(font); - const int height = categoryHeight(index, option); - const bool leftToRight = painter->layoutDirection() == Qt::LeftToRight; + //BEGIN: decoration gradient + { + QPainterPath path(optRect.bottomLeft()); - //BEGIN: decoration gradient - { - QPainterPath path(optRect.bottomLeft()); + path.lineTo(QPoint(optRect.topLeft().x(), optRect.topLeft().y() - 3)); + const QPointF topLeft(optRect.topLeft()); + QRectF arc(topLeft, QSizeF(4, 4)); + path.arcTo(arc, 180, -90); + path.lineTo(optRect.topRight()); + path.lineTo(optRect.bottomRight()); + path.lineTo(optRect.bottomLeft()); - path.lineTo(QPoint(optRect.topLeft().x(), optRect.topLeft().y() - 3)); - const QPointF topLeft(optRect.topLeft()); - QRectF arc(topLeft, QSizeF(4, 4)); - path.arcTo(arc, 180, -90); - path.lineTo(optRect.topRight()); - path.lineTo(optRect.bottomRight()); - path.lineTo(optRect.bottomLeft()); + QColor window(option.palette.window().color()); + const QColor base(option.palette.base().color()); - QColor window(option.palette.window().color()); - const QColor base(option.palette.base().color()); + window.setAlphaF(0.4); - window.setAlphaF(0.4); + QLinearGradient decoGradient1; + if (leftToRight) { + decoGradient1.setStart(optRect.topLeft()); + decoGradient1.setFinalStop(optRect.bottomLeft()); + } else { + decoGradient1.setStart(optRect.topRight()); + decoGradient1.setFinalStop(optRect.bottomRight()); + } + decoGradient1.setColorAt(0, window); + decoGradient1.setColorAt(1, Qt::transparent); - QLinearGradient decoGradient1; - if (leftToRight) { - decoGradient1.setStart(optRect.topLeft()); - decoGradient1.setFinalStop(optRect.bottomLeft()); - } else { - decoGradient1.setStart(optRect.topRight()); - decoGradient1.setFinalStop(optRect.bottomRight()); - } - decoGradient1.setColorAt(0, window); - decoGradient1.setColorAt(1, Qt::transparent); + QLinearGradient decoGradient2; + if (leftToRight) { + decoGradient2.setStart(optRect.topLeft()); + decoGradient2.setFinalStop(optRect.topRight()); + } else { + decoGradient2.setStart(optRect.topRight()); + decoGradient2.setFinalStop(optRect.topLeft()); + } + decoGradient2.setColorAt(0, Qt::transparent); + decoGradient2.setColorAt(1, base); - QLinearGradient decoGradient2; - if (leftToRight) { - decoGradient2.setStart(optRect.topLeft()); - decoGradient2.setFinalStop(optRect.topRight()); - } else { - decoGradient2.setStart(optRect.topRight()); - decoGradient2.setFinalStop(optRect.topLeft()); - } - decoGradient2.setColorAt(0, Qt::transparent); - decoGradient2.setColorAt(1, base); + painter->fillPath(path, decoGradient1); + painter->fillPath(path, decoGradient2); + } + //END: decoration gradient - painter->fillPath(path, decoGradient1); - painter->fillPath(path, decoGradient2); - } - //END: decoration gradient + { + QRect newOptRect(optRect); - { - QRect newOptRect(optRect); + if (leftToRight) { + newOptRect.translate(1, 1); + } else { + newOptRect.translate(-1, 1); + } - if (leftToRight) { - newOptRect.translate(1, 1); - } else { - newOptRect.translate(-1, 1); - } + //BEGIN: inner top left corner + { + painter->save(); + painter->setPen(option.palette.base().color()); + QRectF arc; + if (leftToRight) { + const QPointF topLeft(newOptRect.topLeft()); + arc = QRectF(topLeft, QSizeF(4, 4)); + arc.translate(0.5, 0.5); + painter->drawArc(arc, 1440, 1440); + } else { + QPointF topRight(newOptRect.topRight()); + topRight.rx() -= 4; + arc = QRectF(topRight, QSizeF(4, 4)); + arc.translate(-0.5, 0.5); + painter->drawArc(arc, 0, 1440); + } + painter->restore(); + } + //END: inner top left corner - //BEGIN: inner top left corner - { - painter->save(); - painter->setPen(option.palette.base().color()); - QRectF arc; - if (leftToRight) { - const QPointF topLeft(newOptRect.topLeft()); - arc = QRectF(topLeft, QSizeF(4, 4)); - arc.translate(0.5, 0.5); - painter->drawArc(arc, 1440, 1440); - } else { - QPointF topRight(newOptRect.topRight()); - topRight.rx() -= 4; - arc = QRectF(topRight, QSizeF(4, 4)); - arc.translate(-0.5, 0.5); - painter->drawArc(arc, 0, 1440); - } - painter->restore(); - } - //END: inner top left corner + //BEGIN: inner left vertical line + { + QPoint start; + QPoint verticalGradBottom; + if (leftToRight) { + start = newOptRect.topLeft(); + verticalGradBottom = newOptRect.topLeft(); + } else { + start = newOptRect.topRight(); + verticalGradBottom = newOptRect.topRight(); + } + start.ry() += 3; + verticalGradBottom.ry() += newOptRect.height() - 3; + QLinearGradient gradient(start, verticalGradBottom); + gradient.setColorAt(0, option.palette.base().color()); + gradient.setColorAt(1, Qt::transparent); + painter->fillRect(QRect(start, QSize(1, newOptRect.height() - 3)), gradient); + } + //END: inner left vertical line - //BEGIN: inner left vertical line - { - QPoint start; - QPoint verticalGradBottom; - if (leftToRight) { - start = newOptRect.topLeft(); - verticalGradBottom = newOptRect.topLeft(); - } else { - start = newOptRect.topRight(); - verticalGradBottom = newOptRect.topRight(); - } - start.ry() += 3; - verticalGradBottom.ry() += newOptRect.height() - 3; - QLinearGradient gradient(start, verticalGradBottom); - gradient.setColorAt(0, option.palette.base().color()); - gradient.setColorAt(1, Qt::transparent); - painter->fillRect(QRect(start, QSize(1, newOptRect.height() - 3)), gradient); - } - //END: inner left vertical line - - //BEGIN: inner horizontal line - { - QPoint start; - QPoint horizontalGradTop; - if (leftToRight) { - start = newOptRect.topLeft(); - horizontalGradTop = newOptRect.topLeft(); - start.rx() += 3; - horizontalGradTop.rx() += newOptRect.width() - 3; - } else { - start = newOptRect.topRight(); - horizontalGradTop = newOptRect.topRight(); - start.rx() -= 3; - horizontalGradTop.rx() -= newOptRect.width() - 3; - } - QLinearGradient gradient(start, horizontalGradTop); - gradient.setColorAt(0, option.palette.base().color()); - gradient.setColorAt(1, Qt::transparent); - QSize rectSize; - if (leftToRight) { - rectSize = QSize(newOptRect.width() - 3, 1); - } else { - rectSize = QSize(-newOptRect.width() + 3, 1); - } - painter->fillRect(QRect(start, rectSize), gradient); - } - //END: inner horizontal line - } + //BEGIN: inner horizontal line + { + QPoint start; + QPoint horizontalGradTop; + if (leftToRight) { + start = newOptRect.topLeft(); + horizontalGradTop = newOptRect.topLeft(); + start.rx() += 3; + horizontalGradTop.rx() += newOptRect.width() - 3; + } else { + start = newOptRect.topRight(); + horizontalGradTop = newOptRect.topRight(); + start.rx() -= 3; + horizontalGradTop.rx() -= newOptRect.width() - 3; + } + QLinearGradient gradient(start, horizontalGradTop); + gradient.setColorAt(0, option.palette.base().color()); + gradient.setColorAt(1, Qt::transparent); + QSize rectSize; + if (leftToRight) { + rectSize = QSize(newOptRect.width() - 3, 1); + } else { + rectSize = QSize(-newOptRect.width() + 3, 1); + } + painter->fillRect(QRect(start, rectSize), gradient); + } + //END: inner horizontal line + } QColor outlineColor = option.palette.text().color(); outlineColor.setAlphaF(0.35); - //BEGIN: top left corner - { - painter->save(); - painter->setPen(outlineColor); - QRectF arc; - if (leftToRight) { - const QPointF topLeft(optRect.topLeft()); - arc = QRectF(topLeft, QSizeF(4, 4)); - arc.translate(0.5, 0.5); - painter->drawArc(arc, 1440, 1440); - } else { - QPointF topRight(optRect.topRight()); - topRight.rx() -= 4; - arc = QRectF(topRight, QSizeF(4, 4)); - arc.translate(-0.5, 0.5); - painter->drawArc(arc, 0, 1440); - } - painter->restore(); - } - //END: top left corner + //BEGIN: top left corner + { + painter->save(); + painter->setPen(outlineColor); + QRectF arc; + if (leftToRight) { + const QPointF topLeft(optRect.topLeft()); + arc = QRectF(topLeft, QSizeF(4, 4)); + arc.translate(0.5, 0.5); + painter->drawArc(arc, 1440, 1440); + } else { + QPointF topRight(optRect.topRight()); + topRight.rx() -= 4; + arc = QRectF(topRight, QSizeF(4, 4)); + arc.translate(-0.5, 0.5); + painter->drawArc(arc, 0, 1440); + } + painter->restore(); + } + //END: top left corner - //BEGIN: left vertical line - { - QPoint start; - QPoint verticalGradBottom; - if (leftToRight) { - start = optRect.topLeft(); - verticalGradBottom = optRect.topLeft(); - } else { - start = optRect.topRight(); - verticalGradBottom = optRect.topRight(); - } - start.ry() += 3; - verticalGradBottom.ry() += optRect.height() - 3; - QLinearGradient gradient(start, verticalGradBottom); - gradient.setColorAt(0, outlineColor); - gradient.setColorAt(1, option.palette.base().color()); - painter->fillRect(QRect(start, QSize(1, optRect.height() - 3)), gradient); - } - //END: left vertical line + //BEGIN: left vertical line + { + QPoint start; + QPoint verticalGradBottom; + if (leftToRight) { + start = optRect.topLeft(); + verticalGradBottom = optRect.topLeft(); + } else { + start = optRect.topRight(); + verticalGradBottom = optRect.topRight(); + } + start.ry() += 3; + verticalGradBottom.ry() += optRect.height() - 3; + QLinearGradient gradient(start, verticalGradBottom); + gradient.setColorAt(0, outlineColor); + gradient.setColorAt(1, option.palette.base().color()); + painter->fillRect(QRect(start, QSize(1, optRect.height() - 3)), gradient); + } + //END: left vertical line - //BEGIN: horizontal line - { - QPoint start; - QPoint horizontalGradTop; - if (leftToRight) { - start = optRect.topLeft(); - horizontalGradTop = optRect.topLeft(); - start.rx() += 3; - horizontalGradTop.rx() += optRect.width() - 3; - } else { - start = optRect.topRight(); - horizontalGradTop = optRect.topRight(); - start.rx() -= 3; - horizontalGradTop.rx() -= optRect.width() - 3; - } - QLinearGradient gradient(start, horizontalGradTop); - gradient.setColorAt(0, outlineColor); - gradient.setColorAt(1, option.palette.base().color()); - QSize rectSize; - if (leftToRight) { - rectSize = QSize(optRect.width() - 3, 1); - } else { - rectSize = QSize(-optRect.width() + 3, 1); - } - painter->fillRect(QRect(start, rectSize), gradient); - } - //END: horizontal line + //BEGIN: horizontal line + { + QPoint start; + QPoint horizontalGradTop; + if (leftToRight) { + start = optRect.topLeft(); + horizontalGradTop = optRect.topLeft(); + start.rx() += 3; + horizontalGradTop.rx() += optRect.width() - 3; + } else { + start = optRect.topRight(); + horizontalGradTop = optRect.topRight(); + start.rx() -= 3; + horizontalGradTop.rx() -= optRect.width() - 3; + } + QLinearGradient gradient(start, horizontalGradTop); + gradient.setColorAt(0, outlineColor); + gradient.setColorAt(1, option.palette.base().color()); + QSize rectSize; + if (leftToRight) { + rectSize = QSize(optRect.width() - 3, 1); + } else { + rectSize = QSize(-optRect.width() + 3, 1); + } + painter->fillRect(QRect(start, rectSize), gradient); + } + //END: horizontal line - //BEGIN: draw text - { - const QString category = index.model()->data(index, Qt::DisplayRole).toString(); - QRect textRect = QRect(option.rect.topLeft(), QSize(option.rect.width() - 2 - 3 - 3, height)); - textRect.setTop(textRect.top() + 2 + 3 /* corner */); - textRect.setLeft(textRect.left() + 2 + 3 /* corner */ + 3 /* a bit of margin */); - painter->save(); - painter->setFont(font); - QColor penColor(option.palette.text().color()); - penColor.setAlphaF(0.6); - painter->setPen(penColor); - painter->drawText(textRect, Qt::AlignLeft | Qt::AlignTop, category); - painter->restore(); - } - //END: draw text + //BEGIN: draw text + { + const QString category = index.model()->data(index, Qt::DisplayRole).toString(); + QRect textRect = QRect(option.rect.topLeft(), QSize(option.rect.width() - 2 - 3 - 3, height)); + textRect.setTop(textRect.top() + 2 + 3 /* corner */); + textRect.setLeft(textRect.left() + 2 + 3 /* corner */ + 3 /* a bit of margin */); + painter->save(); + painter->setFont(font); + QColor penColor(option.palette.text().color()); + penColor.setAlphaF(0.6); + painter->setPen(penColor); + painter->drawText(textRect, Qt::AlignLeft | Qt::AlignTop, category); + painter->restore(); + } + //END: draw text } +///Return category height int CategoryDrawer::categoryHeight(const QModelIndex &index, const QStyleOption &option) const { - Q_UNUSED( index ); - Q_UNUSED( option ); + Q_UNUSED( index ); + Q_UNUSED( option ); - QFont font(QApplication::font()); - font.setBold(true); - const QFontMetrics fontMetrics = QFontMetrics(font); + QFont font(QApplication::font()); + font.setBold(true); + const QFontMetrics fontMetrics = QFontMetrics(font); - return fontMetrics.height() + 2 + 12 /* vertical spacing */; + return fontMetrics.height() + 2 + 12 /* vertical spacing */; } diff --git a/kde/src/widgets/CategoryDrawer.h b/kde/src/widgets/CategoryDrawer.h index 5422e2d527d92c2cb8778cd89a930dbb2efda4ab..ebdb6cb38ebec07d24cf5c16c66c159c5984ef0d 100644 --- a/kde/src/widgets/CategoryDrawer.h +++ b/kde/src/widgets/CategoryDrawer.h @@ -21,8 +21,10 @@ #ifndef CATEGORYDRAWER_H #define CATEGORYDRAWER_H +//KDE #include <KCategoryDrawer> +//Qt class QPainter; class QModelIndex; class QStyleOption; diff --git a/kde/src/widgets/ConferenceBox.cpp b/kde/src/widgets/ConferenceBox.cpp index 68bde0d03ff409a8eb154ff647a5ca6e717e6d7c..0711051e90b350feffeae33bb80a5d5f22df2578 100644 --- a/kde/src/widgets/ConferenceBox.cpp +++ b/kde/src/widgets/ConferenceBox.cpp @@ -26,276 +26,262 @@ #include <QModelIndex> #include <QDebug> +///Constructor ConferenceBox::ConferenceBox() { setLeftMargin ( 7 ); setRightMargin( 7 ); } -void ConferenceBox::drawCategory(const QModelIndex &index, - int sortRole, - const QStyleOption &option, - QPainter *painter) const +///Draw a conference box +void ConferenceBox::drawCategory(const QModelIndex& index , + int sortRole, + const QStyleOption& option , + QPainter* painter ) const { - Q_UNUSED( sortRole ) - Q_UNUSED( index ) - - painter->setRenderHint(QPainter::Antialiasing); - - const QRect optRect = option.rect; - const bool leftToRight = painter->layoutDirection() == Qt::LeftToRight; - - //BEGIN: decoration gradient - { - QPainterPath path(optRect.bottomLeft()); - - path.lineTo(QPoint(optRect.topLeft().x(), optRect.topLeft().y() - 3)); - const QPointF topLeft(optRect.topLeft()); - QRectF arc(topLeft, QSizeF(4, 4)); - path.arcTo(arc, 180, -90); - path.lineTo(optRect.topRight()); - path.lineTo(optRect.bottomRight()); - path.lineTo(optRect.bottomLeft()); - - QColor window(option.palette.window().color()); - const QColor base(option.palette.base().color()); - - window.setAlphaF(option.state & QStyle::State_Selected?0.9:0.7); - - QColor window2(window); - window2.setAlphaF(option.state & QStyle::State_Selected?0.4:0.2); - - QLinearGradient decoGradient1; - if (leftToRight) { - decoGradient1.setStart(optRect.topLeft()); - decoGradient1.setFinalStop(optRect.bottomLeft()); - } else { - decoGradient1.setStart(optRect.topRight()); - decoGradient1.setFinalStop(optRect.bottomRight()); - } - decoGradient1.setColorAt(0, window); - decoGradient1.setColorAt(1, Qt::transparent); - - QLinearGradient decoGradient2; - if (leftToRight) { - decoGradient2.setStart(optRect.topLeft()); - decoGradient2.setFinalStop(optRect.topRight()); - } else { - decoGradient2.setStart(optRect.topRight()); - decoGradient2.setFinalStop(optRect.topLeft()); - } - decoGradient2.setColorAt(0, window2); - decoGradient2.setColorAt(1, Qt::transparent); - - painter->fillPath(path, decoGradient1); - painter->fillRect(optRect, decoGradient2); - } - //END: decoration gradient - - { - QRect newOptRect(optRect); - - if (leftToRight) { - newOptRect.translate(1, 1); - } else { - newOptRect.translate(-1, 1); - } - - //BEGIN: inner top left corner - { - painter->save(); - painter->setPen(option.palette.base().color()); - QRectF arc; - if (leftToRight) { - const QPointF topLeft(newOptRect.topLeft()); - arc = QRectF(topLeft, QSizeF(4, 4)); - arc.translate(0.5, 0.5); - painter->drawArc(arc, 1440, 1440); - } else { - QPointF topRight(newOptRect.topRight()); - topRight.rx() -= 4; - arc = QRectF(topRight, QSizeF(4, 4)); - arc.translate(-0.5, 0.5); - painter->drawArc(arc, 0, 1440); - } - painter->restore(); - } - //END: inner top left corner - - //BEGIN: inner left vertical line - { - QPoint start; - QPoint verticalGradBottom; - if (leftToRight) { - start = newOptRect.topLeft(); - verticalGradBottom = newOptRect.topLeft(); - } else { - start = newOptRect.topRight(); - verticalGradBottom = newOptRect.topRight(); - } - start.ry() += 3; - verticalGradBottom.ry() += newOptRect.height() - 3; - QLinearGradient gradient(start, verticalGradBottom); - gradient.setColorAt(0, option.palette.base().color()); - gradient.setColorAt(1, Qt::transparent); - painter->fillRect(QRect(start, QSize(1, newOptRect.height() - 3)), gradient); - } - //END: inner left vertical line - - //BEGIN: top inner horizontal line - { - QPoint start; - QPoint horizontalGradTop; - if (leftToRight) { - start = newOptRect.topLeft(); - horizontalGradTop = newOptRect.topLeft(); - start.rx() += 3; - horizontalGradTop.rx() += newOptRect.width() - 3; - } else { - start = newOptRect.topRight(); - horizontalGradTop = newOptRect.topRight(); - start.rx() -= 3; - horizontalGradTop.rx() -= newOptRect.width() - 3; - } - QLinearGradient gradient(start, horizontalGradTop); - gradient.setColorAt(0, option.palette.base().color()); - gradient.setColorAt(1, Qt::transparent); - QSize rectSize; - if (leftToRight) { - rectSize = QSize(newOptRect.width() - 3, 1); - } else { - rectSize = QSize(-newOptRect.width() + 3, 1); - } - painter->fillRect(QRect(start, rectSize), gradient); - } - //END: top inner horizontal line - } - - QColor outlineColor = option.palette.text().color(); - outlineColor.setAlphaF(0.35); - - //BEGIN: top left corner - { - painter->save(); - painter->setPen(outlineColor); - QRectF arc; - if (leftToRight) { - const QPointF topLeft(optRect.topLeft()); - arc = QRectF(topLeft, QSizeF(4, 4)); - arc.translate(0.5, 0.5); - painter->drawArc(arc, 1440, 1440); - } else { - QPointF topRight(optRect.topRight()); - topRight.rx() -= 4; - arc = QRectF(topRight, QSizeF(4, 4)); - arc.translate(-0.5, 0.5); - painter->drawArc(arc, 0, 1440); - } - painter->restore(); - } - //END: top left corner - - //BEGIN: top right corner - { - painter->save(); - painter->setPen(outlineColor); - QRectF arc; - if (!leftToRight) { - const QPointF topLeft(optRect.topLeft()); - arc = QRectF(topLeft, QSizeF(4, 4)); - arc.translate(0.5, 0.5); - painter->drawArc(arc, 1440, 1440); - } else { - QPointF topRight(optRect.topRight()); - topRight.rx() -= 4; - arc = QRectF(topRight, QSizeF(4, 4)); - arc.translate(-0.5, 0.5); - painter->drawArc(arc, 0, 1440); - } - painter->restore(); - } - //END: top right corner - - //BEGIN: left vertical line - { - QPoint start; - QPoint verticalGradBottom; - if (leftToRight) { - start = optRect.topLeft(); - verticalGradBottom = optRect.topLeft(); - } else { - start = optRect.topRight(); - verticalGradBottom = optRect.topRight(); - } - start.ry() += 3; - verticalGradBottom.ry() += optRect.height() - 3 + 200; - painter->fillRect(QRect(start, QSize(1, optRect.height() - 21)), outlineColor); - } - //END: left vertical line - - //BEGIN: right vertical line - { - QPoint start; - QPoint verticalGradBottom; - if (!leftToRight) { - start = optRect.topLeft(); - verticalGradBottom = optRect.topLeft(); - } else { - start = optRect.topRight(); - verticalGradBottom = optRect.topRight(); - } - start.ry() += 3; - verticalGradBottom.ry() += optRect.height() - 3 + 200; - painter->fillRect(QRect(start, QSize(1, optRect.height() - 21)), outlineColor); - } - //END: right vertical line - - //BEGIN: horizontal line - { - QPoint start; - QPoint horizontalGradTop; - if (leftToRight) { - start = optRect.topLeft(); - horizontalGradTop = optRect.topLeft(); - start.rx() += 3; - horizontalGradTop.rx() += optRect.width() - 3; - } else { - start = optRect.topRight(); - horizontalGradTop = optRect.topRight(); - start.rx() -= 3; - horizontalGradTop.rx() -= optRect.width() - 3; - } - QLinearGradient gradient(start, horizontalGradTop); - gradient.setColorAt(0, outlineColor); - gradient.setColorAt(1, outlineColor); - QSize rectSize; - if (leftToRight) { - rectSize = QSize(optRect.width() - 7, 1); - } else { - rectSize = QSize(-optRect.width() + 7, 1); - } - painter->fillRect(QRect(start, rectSize), gradient); - } - //END: horizontal line - - //BEGIN: draw text -// { -// const QString category = index.model()->data(index, Qt::DisplayRole).toString(); -// QRect textRect = QRect(option.rect.topLeft(), QSize(option.rect.width() - 2 - 3 - 3, height)); -// textRect.setTop(textRect.top() + 2 + 3 /* corner */); -// textRect.setLeft(textRect.left() + 2 + 3 /* corner */ + 3 /* a bit of margin */); -// painter->save(); -// painter->setFont(font); -// QColor penColor(option.palette.text().color()); -// penColor.setAlphaF(0.6); -// painter->setPen(penColor); -// painter->drawText(textRect, Qt::AlignLeft | Qt::AlignTop, category); -// painter->restore(); -// } - //END: draw text -} + Q_UNUSED( sortRole ) + Q_UNUSED( index ) + + painter->setRenderHint(QPainter::Antialiasing); + + const QRect optRect = option.rect; + const bool leftToRight = painter->layoutDirection() == Qt::LeftToRight; + + //BEGIN: decoration gradient + { + QPainterPath path(optRect.bottomLeft()); + + path.lineTo(QPoint(optRect.topLeft().x(), optRect.topLeft().y() - 3)); + const QPointF topLeft(optRect.topLeft()); + QRectF arc(topLeft, QSizeF(4, 4)); + path.arcTo(arc, 180, -90); + path.lineTo(optRect.topRight()); + path.lineTo(optRect.bottomRight()); + path.lineTo(optRect.bottomLeft()); + + QColor window(option.palette.window().color()); + const QColor base(option.palette.base().color()); + + window.setAlphaF(option.state & QStyle::State_Selected?0.9:0.7); + + QColor window2(window); + window2.setAlphaF(option.state & QStyle::State_Selected?0.4:0.2); + + QLinearGradient decoGradient1; + if (leftToRight) { + decoGradient1.setStart(optRect.topLeft()); + decoGradient1.setFinalStop(optRect.bottomLeft()); + } else { + decoGradient1.setStart(optRect.topRight()); + decoGradient1.setFinalStop(optRect.bottomRight()); + } + decoGradient1.setColorAt(0, window); + decoGradient1.setColorAt(1, Qt::transparent); + + QLinearGradient decoGradient2; + if (leftToRight) { + decoGradient2.setStart(optRect.topLeft()); + decoGradient2.setFinalStop(optRect.topRight()); + } else { + decoGradient2.setStart(optRect.topRight()); + decoGradient2.setFinalStop(optRect.topLeft()); + } + decoGradient2.setColorAt(0, window2); + decoGradient2.setColorAt(1, Qt::transparent); + + painter->fillPath(path, decoGradient1); + painter->fillRect(optRect, decoGradient2); + } + //END: decoration gradient + + { + QRect newOptRect(optRect); + + if (leftToRight) { + newOptRect.translate(1, 1); + } else { + newOptRect.translate(-1, 1); + } + + //BEGIN: inner top left corner + { + painter->save(); + painter->setPen(option.palette.base().color()); + QRectF arc; + if (leftToRight) { + const QPointF topLeft(newOptRect.topLeft()); + arc = QRectF(topLeft, QSizeF(4, 4)); + arc.translate(0.5, 0.5); + painter->drawArc(arc, 1440, 1440); + } else { + QPointF topRight(newOptRect.topRight()); + topRight.rx() -= 4; + arc = QRectF(topRight, QSizeF(4, 4)); + arc.translate(-0.5, 0.5); + painter->drawArc(arc, 0, 1440); + } + painter->restore(); + } + //END: inner top left corner + + //BEGIN: inner left vertical line + { + QPoint start; + QPoint verticalGradBottom; + if (leftToRight) { + start = newOptRect.topLeft(); + verticalGradBottom = newOptRect.topLeft(); + } else { + start = newOptRect.topRight(); + verticalGradBottom = newOptRect.topRight(); + } + start.ry() += 3; + verticalGradBottom.ry() += newOptRect.height() - 3; + QLinearGradient gradient(start, verticalGradBottom); + gradient.setColorAt(0, option.palette.base().color()); + gradient.setColorAt(1, Qt::transparent); + painter->fillRect(QRect(start, QSize(1, newOptRect.height() - 3)), gradient); + } + //END: inner left vertical line + + //BEGIN: top inner horizontal line + { + QPoint start; + QPoint horizontalGradTop; + if (leftToRight) { + start = newOptRect.topLeft(); + horizontalGradTop = newOptRect.topLeft(); + start.rx() += 3; + horizontalGradTop.rx() += newOptRect.width() - 3; + } else { + start = newOptRect.topRight(); + horizontalGradTop = newOptRect.topRight(); + start.rx() -= 3; + horizontalGradTop.rx() -= newOptRect.width() - 3; + } + QLinearGradient gradient(start, horizontalGradTop); + gradient.setColorAt(0, option.palette.base().color()); + gradient.setColorAt(1, Qt::transparent); + QSize rectSize; + if (leftToRight) { + rectSize = QSize(newOptRect.width() - 3, 1); + } else { + rectSize = QSize(-newOptRect.width() + 3, 1); + } + painter->fillRect(QRect(start, rectSize), gradient); + } + //END: top inner horizontal line + } + + QColor outlineColor = option.palette.text().color(); + outlineColor.setAlphaF(0.35); + + //BEGIN: top left corner + { + painter->save(); + painter->setPen(outlineColor); + QRectF arc; + if (leftToRight) { + const QPointF topLeft(optRect.topLeft()); + arc = QRectF(topLeft, QSizeF(4, 4)); + arc.translate(0.5, 0.5); + painter->drawArc(arc, 1440, 1440); + } else { + QPointF topRight(optRect.topRight()); + topRight.rx() -= 4; + arc = QRectF(topRight, QSizeF(4, 4)); + arc.translate(-0.5, 0.5); + painter->drawArc(arc, 0, 1440); + } + painter->restore(); + } + //END: top left corner + + //BEGIN: top right corner + { + painter->save(); + painter->setPen(outlineColor); + QRectF arc; + if (!leftToRight) { + const QPointF topLeft(optRect.topLeft()); + arc = QRectF(topLeft, QSizeF(4, 4)); + arc.translate(0.5, 0.5); + painter->drawArc(arc, 1440, 1440); + } else { + QPointF topRight(optRect.topRight()); + topRight.rx() -= 4; + arc = QRectF(topRight, QSizeF(4, 4)); + arc.translate(-0.5, 0.5); + painter->drawArc(arc, 0, 1440); + } + painter->restore(); + } + //END: top right corner + //BEGIN: left vertical line + { + QPoint start; + QPoint verticalGradBottom; + if (leftToRight) { + start = optRect.topLeft(); + verticalGradBottom = optRect.topLeft(); + } else { + start = optRect.topRight(); + verticalGradBottom = optRect.topRight(); + } + start.ry() += 3; + verticalGradBottom.ry() += optRect.height() - 3 + 200; + painter->fillRect(QRect(start, QSize(1, optRect.height() - 21)), outlineColor); + } + //END: left vertical line + + //BEGIN: right vertical line + { + QPoint start; + QPoint verticalGradBottom; + if (!leftToRight) { + start = optRect.topLeft(); + verticalGradBottom = optRect.topLeft(); + } else { + start = optRect.topRight(); + verticalGradBottom = optRect.topRight(); + } + start.ry() += 3; + verticalGradBottom.ry() += optRect.height() - 3 + 200; + painter->fillRect(QRect(start, QSize(1, optRect.height() - 21)), outlineColor); + } + //END: right vertical line + + //BEGIN: horizontal line + { + QPoint start; + QPoint horizontalGradTop; + if (leftToRight) { + start = optRect.topLeft(); + horizontalGradTop = optRect.topLeft(); + start.rx() += 3; + horizontalGradTop.rx() += optRect.width() - 3; + } else { + start = optRect.topRight(); + horizontalGradTop = optRect.topRight(); + start.rx() -= 3; + horizontalGradTop.rx() -= optRect.width() - 3; + } + QLinearGradient gradient(start, horizontalGradTop); + gradient.setColorAt(0, outlineColor); + gradient.setColorAt(1, outlineColor); + QSize rectSize; + if (leftToRight) { + rectSize = QSize(optRect.width() - 7, 1); + } else { + rectSize = QSize(-optRect.width() + 7, 1); + } + painter->fillRect(QRect(start, rectSize), gradient); + } + //END: horizontal line +} +///Draw the bottom border of the box void ConferenceBox::drawBoxBottom(const QModelIndex &index, int sortRole, const QStyleOption &option, QPainter *painter) const { Q_UNUSED(index) Q_UNUSED(sortRole) @@ -327,6 +313,7 @@ void ConferenceBox::drawBoxBottom(const QModelIndex &index, int sortRole, const //END: bottom right corner } +///Return the height of the conference box int ConferenceBox::categoryHeight(const QModelIndex &index, const QStyleOption &option) const { Q_UNUSED( index ); diff --git a/kde/src/widgets/ConferenceBox.h b/kde/src/widgets/ConferenceBox.h index 4b63f037059b5f8f62204cebb79bbe012fbaa756..1c71a215664dc0e6a18c1010ae83d4fe6c2efdff 100644 --- a/kde/src/widgets/ConferenceBox.h +++ b/kde/src/widgets/ConferenceBox.h @@ -20,13 +20,15 @@ // Rafael agreet to relicense it under LGPLv2 or LGPLv3, just as we need it, // see: http://lists.kde.org/?l=kwrite-devel&m=133061943317199&w=2 +//KDE #include <KCategoryDrawer> +//Qt class QPainter; class QModelIndex; class QStyleOption; -///CategoryDrawer: A better looking widget than the plain QListWidget +///ConferenceBox: Draw a nice box instead of using plain tree class ConferenceBox : public KCategoryDrawerV2 { public: diff --git a/kde/src/widgets/ContactDock.cpp b/kde/src/widgets/ContactDock.cpp index 83e8626a00221fba6966e1173fcef05b33a8605d..dec21c2b145a4f3d169b73bcd59a59631071ec06 100644 --- a/kde/src/widgets/ContactDock.cpp +++ b/kde/src/widgets/ContactDock.cpp @@ -39,17 +39,17 @@ #include <KComboBox> //SFLPhone -#include "klib/AkonadiBackend.h" #include "ContactItemWidget.h" #include "SFLPhone.h" -#include "klib/ConfigurationSkeleton.h" #include "CallView.h" #include "SFLPhoneView.h" -#include "lib/HistoryModel.h" //SFLPhone library +#include "lib/HistoryModel.h" #include "lib/Call.h" #include "lib/Contact.h" +#include "klib/AkonadiBackend.h" +#include "klib/ConfigurationSkeleton.h" #define CURRENT_SORTING_MODE m_pSortByCBB->currentIndex() @@ -68,6 +68,7 @@ class QNumericTreeWidgetItem_hist : public QTreeWidgetItem { } }; +///A Phone number in contact with many of them (not used when 0 or 1 number) class PhoneNumberItem : public QWidget { public: PhoneNumberItem(QString number, QString type,QString name, QWidget* parent = nullptr) : QWidget(parent),m_pNumber(number),m_pType(type),m_pName(name) { @@ -132,13 +133,13 @@ ContactDock::ContactDock(QWidget* parent) : QDockWidget(parent) QWidget* mainWidget = new QWidget(this); setWidget(mainWidget); - m_pContactView->headerItem()->setText(0,i18n("Contacts")); - m_pContactView->header()->setClickable(true); - m_pContactView->header()->setSortIndicatorShown(true); - m_pContactView->setAcceptDrops(true); - m_pContactView->setDragEnabled(true); - KeyPressEaterC *keyPressEater = new KeyPressEaterC(this); - m_pContactView->installEventFilter(keyPressEater); + m_pContactView->headerItem()->setText ( 0,i18n("Contacts") ); + m_pContactView->header()->setClickable ( true ); + m_pContactView->header()->setSortIndicatorShown ( true ); + m_pContactView->setAcceptDrops ( true ); + m_pContactView->setDragEnabled ( true ); + KeyPressEaterC *keyPressEater = new KeyPressEaterC( this ); + m_pContactView->installEventFilter ( keyPressEater ); m_pFilterLE->setPlaceholderText(i18n("Filter")); m_pFilterLE->setClearButtonShown(true); @@ -164,16 +165,15 @@ ContactDock::ContactDock(QWidget* parent) : QDockWidget(parent) m_pSortByCBB->setCurrentIndex(ConfigurationSkeleton::contactSortMode()); - connect(AkonadiBackend::getInstance(),SIGNAL(collectionChanged()), this, SLOT(reloadContact()) ); - connect(m_pSortByCBB ,SIGNAL(currentIndexChanged(int)), this, SLOT(reloadContact()) ); - connect(m_pContactView, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),this, SLOT(loadContactHistory(QTreeWidgetItem*))); - connect(m_pFilterLE, SIGNAL(textChanged(QString)), this, SLOT(filter(QString)) ); - connect(m_pShowHistoCK, SIGNAL(toggled(bool)), this, SLOT(setHistoryVisible(bool)) ); - connect(timer ,SIGNAL(timeout()), this, SLOT(reloadHistoryConst()) ); - connect(ConfigurationSkeleton::self() ,SIGNAL(configChanged()), this, SLOT(reloadContact()) ); + connect(AkonadiBackend::getInstance() ,SIGNAL(collectionChanged()), this, SLOT(reloadContact()) ); + connect(m_pSortByCBB ,SIGNAL(currentIndexChanged(int)), this, SLOT(reloadContact()) ); + connect(m_pContactView, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),this, SLOT(loadContactHistory(QTreeWidgetItem*))); + connect(m_pFilterLE, SIGNAL(textChanged(QString)), this, SLOT(filter(QString)) ); + connect(m_pShowHistoCK, SIGNAL(toggled(bool)), this, SLOT(setHistoryVisible(bool)) ); + connect(timer ,SIGNAL(timeout()), this, SLOT(reloadHistoryConst()) ); + connect(ConfigurationSkeleton::self() ,SIGNAL(configChanged()), this, SLOT(reloadContact()) ); timer->start(1800*1000); //30 minutes setWindowTitle(i18n("Contact")); - } //ContactDock ///Destructor @@ -216,7 +216,7 @@ void ContactDock::reloadContact() } break; } - + foreach (Contact* cont, list) { if (cont->getPhoneNumbers().count() && usableNumberCount(cont)) { ContactItemWidget* aContact = new ContactItemWidget(m_pContactView); @@ -369,7 +369,7 @@ QMimeData* ContactTree::mimeData( const QList<QTreeWidgetItem *> items) const ///Handle data being dropped on the widget bool ContactTree::dropMimeData(QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action) { - Q_UNUSED(index) + Q_UNUSED(index ) Q_UNUSED(action) Q_UNUSED(parent) diff --git a/kde/src/widgets/ContactItemWidget.cpp b/kde/src/widgets/ContactItemWidget.cpp index b51afd01bb0bad22852d25ac435a0052832044a7..020a891a59d9fe340c708be933bad3e3287937d2 100644 --- a/kde/src/widgets/ContactItemWidget.cpp +++ b/kde/src/widgets/ContactItemWidget.cpp @@ -95,18 +95,18 @@ ContactItemWidget::ContactItemWidget(QWidget *parent) m_pBookmark->setText ( i18n("Bookmark") ); m_pBookmark->setIcon ( KIcon("bookmarks") ); - connect(m_pCallAgain , SIGNAL(triggered()) , this,SLOT(callAgain() )); - connect(m_pEditContact , SIGNAL(triggered()) , this,SLOT(editContact() )); - connect(m_pCopy , SIGNAL(triggered()) , this,SLOT(copy() )); - connect(m_pEmail , SIGNAL(triggered()) , this,SLOT(sendEmail() )); - connect(m_pAddPhone , SIGNAL(triggered()) , this,SLOT(addPhone() )); - connect(m_pBookmark , SIGNAL(triggered()) , this,SLOT(bookmark() )); + connect(m_pCallAgain , SIGNAL(triggered()) , this,SLOT(callAgain() )); + connect(m_pEditContact , SIGNAL(triggered()) , this,SLOT(editContact())); + connect(m_pCopy , SIGNAL(triggered()) , this,SLOT(copy() )); + connect(m_pEmail , SIGNAL(triggered()) , this,SLOT(sendEmail() )); + connect(m_pAddPhone , SIGNAL(triggered()) , this,SLOT(addPhone() )); + connect(m_pBookmark , SIGNAL(triggered()) , this,SLOT(bookmark() )); //Overlay m_pBtnTrans = new TranslucentButtons(this); - m_pBtnTrans->setText(i18n("Transfer")); - m_pBtnTrans->setVisible(false); - m_pBtnTrans->setPixmap(new QImage(KStandardDirs::locate("data","sflphone-client-kde/transferarraw.png"))); + m_pBtnTrans->setText ( i18n("Transfer")); + m_pBtnTrans->setVisible( false); + m_pBtnTrans->setPixmap ( new QImage(KStandardDirs::locate("data","sflphone-client-kde/transferarraw.png"))); connect(m_pBtnTrans,SIGNAL(dataDropped(QMimeData*)),this,SLOT(transferEvent(QMimeData*))); } //ContactItemWidget @@ -256,10 +256,10 @@ void ContactItemWidget::updated() QRect pxRect = pxm.rect(); QBitmap mask(pxRect.size()); QPainter customPainter(&mask); - customPainter.setRenderHint(QPainter::Antialiasing, true); - customPainter.fillRect(pxRect,"white"); - customPainter.setBackground(QColor("black")); - customPainter.setBrush(QColor("black")); + customPainter.setRenderHint (QPainter::Antialiasing, true ); + customPainter.fillRect (pxRect ,"white" ); + customPainter.setBackground (QColor("black") ); + customPainter.setBrush (QColor("black") ); customPainter.drawRoundedRect(pxRect,5,5); pxm.setMask(mask); m_pIconL->setPixmap(pxm); diff --git a/kde/src/widgets/HistoryDock.cpp b/kde/src/widgets/HistoryDock.cpp index e94231ee3305019724155ef14fd1c66520420dae..cb00d9a6209f730e05409b008c03a872d6b86196 100644 --- a/kde/src/widgets/HistoryDock.cpp +++ b/kde/src/widgets/HistoryDock.cpp @@ -88,16 +88,16 @@ HistoryDock::HistoryDock(QWidget* parent) : QDockWidget(parent) setObjectName("historyDock"); setMinimumSize(250,0); setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum); - m_pFilterLE = new KLineEdit ( ); - m_pItemView = new HistoryTree ( this ); - m_pSortByCBB = new KComboBox ( ); - m_pSortByL = new QLabel ( i18n("Sort by:") ); - m_pFromL = new QLabel ( i18n("From:") ); + m_pFilterLE = new KLineEdit ( ); + m_pItemView = new HistoryTree ( this ); + m_pSortByCBB = new KComboBox ( ); + m_pSortByL = new QLabel ( i18n("Sort by:") ); + m_pFromL = new QLabel ( i18n("From:") ); m_pToL = new QLabel ( i18nc("To date:","To:")); - m_pFromDW = new KDateWidget ( ); - m_pToDW = new KDateWidget ( ); - m_pAllTimeCB = new QCheckBox ( i18n("Display all")); - m_pLinkPB = new QPushButton ( this ); + m_pFromDW = new KDateWidget ( ); + m_pToDW = new KDateWidget ( ); + m_pAllTimeCB = new QCheckBox ( i18n("Display all") ); + m_pLinkPB = new QPushButton ( this ); m_pAllTimeCB->setChecked(!ConfigurationSkeleton::displayDataRange()); enableDateRange(!ConfigurationSkeleton::displayDataRange()); diff --git a/kde/src/widgets/HistoryTreeItem.cpp b/kde/src/widgets/HistoryTreeItem.cpp index 2927660bf2738514f571831cdf732a68040ef5cb..5290fcac3fe8be3e23f60227692899496e768fac 100644 --- a/kde/src/widgets/HistoryTreeItem.cpp +++ b/kde/src/widgets/HistoryTreeItem.cpp @@ -65,8 +65,8 @@ static const char* icnPath[4] = { /* INCOMING */ ICON_HISTORY_INCOMING, /* OUTGOING */ ICON_HISTORY_OUTGOING, -/* MISSED */ ICON_HISTORY_MISSED, -/* NONE */ "", +/* MISSED */ ICON_HISTORY_MISSED , +/* NONE */ "" , }; ///PlayerWidget: A small widget to play call recording @@ -147,14 +147,14 @@ HistoryTreeItem::HistoryTreeItem(QWidget *parent ,QString phone,bool isBookmark) m_pRemove->setSizePolicy(QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed)); m_pRemove->setVisible(false); - connect(m_pCallAgain , SIGNAL(triggered()) , this , SLOT(callAgain()) ); - connect(m_pAddContact , SIGNAL(triggered()) , this , SLOT(addContact()) ); - connect(m_pCopy , SIGNAL(triggered()) , this , SLOT(copy()) ); - connect(m_pEmail , SIGNAL(triggered()) , this , SLOT(sendEmail()) ); - connect(m_pAddToContact , SIGNAL(triggered()) , this , SLOT(addToContact()) ); - connect(m_pBookmark , SIGNAL(triggered()) , this , SLOT(bookmark()) ); - connect(m_pRemove , SIGNAL(clicked()) , this , SLOT(removeRecording()) ); - connect(this , SIGNAL(customContextMenuRequested(QPoint)) , this , SLOT(showContext(QPoint))); + connect(m_pCallAgain , SIGNAL(triggered()) , this , SLOT(callAgain()) ); + connect(m_pAddContact , SIGNAL(triggered()) , this , SLOT(addContact()) ); + connect(m_pCopy , SIGNAL(triggered()) , this , SLOT(copy()) ); + connect(m_pEmail , SIGNAL(triggered()) , this , SLOT(sendEmail()) ); + connect(m_pAddToContact , SIGNAL(triggered()) , this , SLOT(addToContact()) ); + connect(m_pBookmark , SIGNAL(triggered()) , this , SLOT(bookmark()) ); + connect(m_pRemove , SIGNAL(clicked()) , this , SLOT(removeRecording()) ); + connect(this , SIGNAL(customContextMenuRequested(QPoint)) , this , SLOT(showContext(QPoint))); m_pIconL = new QLabel( this ); m_pPeerNameL = new QLabel( this ); @@ -269,9 +269,9 @@ void HistoryTreeItem::callAgain() } Call* call = SFLPhone::model()->addDialingCall(getName(), AccountList::getCurrentAccount()); if (call) { - call->setCallNumber(m_PhoneNumber); - call->setPeerName(m_pPeerNameL->text()); - call->actionPerformed(CALL_ACTION_ACCEPT); + call->setCallNumber ( m_PhoneNumber ); + call->setPeerName ( m_pPeerNameL->text() ); + call->actionPerformed( CALL_ACTION_ACCEPT ); } else { HelperFunctions::displayNoAccountMessageBox(this); @@ -298,8 +298,8 @@ void HistoryTreeItem::copy() numbers = m_pItemCall->getPeerName()+": "+m_PhoneNumber; numbersHtml = "<b>"+m_pItemCall->getPeerName()+"</b><br />"+HelperFunctions::escapeHtmlEntities(m_PhoneNumber); } - mimeData->setData("text/plain", numbers.toUtf8()); - mimeData->setData("text/html", numbersHtml.toUtf8()); + mimeData->setData("text/plain", numbers.toUtf8() ); + mimeData->setData("text/html", numbersHtml.toUtf8()); QClipboard* clipboard = QApplication::clipboard(); clipboard->setMimeData(mimeData); } @@ -344,18 +344,18 @@ void HistoryTreeItem::removeRecording() void HistoryTreeItem::showRecordPlayer() { if (!m_pAudioSlider) { - m_pPlayer = new PlayerWidget ( this ); - QWidget* r1w = new QWidget ( this ); - QWidget* r2w = new QWidget ( this ); - QVBoxLayout* l = new QVBoxLayout ( m_pPlayer ); - QHBoxLayout* r1 = new QHBoxLayout ( r1w ); - QHBoxLayout* r2 = new QHBoxLayout ( r2w ); - m_pAudioSlider = new QSlider ( Qt::Horizontal, this ); - m_pTimeLeftL = new QLabel ( "00:00" ); - m_pTimePlayedL = new QLabel ( "00:00" ); - m_pPause = new QToolButton ( ); - m_pStop = new QToolButton ( ); - m_pNote = new QToolButton ( ); + m_pPlayer = new PlayerWidget( this ); + QWidget* r1w = new QWidget ( this ); + QWidget* r2w = new QWidget ( this ); + QVBoxLayout* l = new QVBoxLayout ( m_pPlayer ); + QHBoxLayout* r1 = new QHBoxLayout ( r1w ); + QHBoxLayout* r2 = new QHBoxLayout ( r2w ); + m_pAudioSlider = new QSlider ( Qt::Horizontal, this ); + m_pTimeLeftL = new QLabel ( "00:00" ); + m_pTimePlayedL = new QLabel ( "00:00" ); + m_pPause = new QToolButton ( ); + m_pStop = new QToolButton ( ); + m_pNote = new QToolButton ( ); l->addWidget(r1w); l->addWidget(r2w); @@ -449,6 +449,7 @@ void HistoryTreeItem::editNote() } +///Update the player slider void HistoryTreeItem::updateSlider(int pos, int size) { m_pTimeLeftL->setText(QString("%1").arg((size/1000-pos/1000)/60,2,10,QChar('0'))+':'+QString("%1").arg((size/1000-pos/1000)%60,2,10,QChar('0'))); @@ -474,6 +475,7 @@ void HistoryTreeItem::resizeEvent(QResizeEvent* event) } } +///Grab mouse click void HistoryTreeItem::mouseDoubleClickEvent(QMouseEvent* event) { Q_UNUSED(event); @@ -547,9 +549,9 @@ bool HistoryTreeItem::getContactInfo(QString phoneNumber) m_Name = m_pContact->getFormattedName(); m_pPeerNameL->setText("<b>"+m_Name+"</b>"); if (m_pContact->getPhoto() != nullptr) { - pxm = (*m_pContact->getPhoto()); - QRect pxRect = pxm.rect(); - QBitmap mask(pxRect.size()); + pxm = (*m_pContact->getPhoto()); + QRect pxRect = pxm.rect(); + QBitmap mask(pxRect.size()); QPainter customPainter(&mask); customPainter.setRenderHint(QPainter::Antialiasing, true); customPainter.fillRect(pxRect,"white"); @@ -563,7 +565,7 @@ bool HistoryTreeItem::getContactInfo(QString phoneNumber) //There is no point to add new contacts when there is already one m_pAddToContact->setDisabled(true); - m_pAddContact->setDisabled(true); + m_pAddContact->setDisabled (true); if (!m_pContact->getPreferredEmail().isEmpty()) m_pEmail->setDisabled(false); @@ -574,10 +576,10 @@ bool HistoryTreeItem::getContactInfo(QString phoneNumber) m_Name = phoneNumber; else if (m_Name.isEmpty()) m_Name = i18nc("Unknown peer","Unknown"); - + m_pPeerNameL->setText("<b>"+m_Name+"</b>"); } - + if (m_pItemCall && !m_pItemCall->getRecordingPath().isEmpty()) { QPainter painter(&pxm); QPixmap status(KStandardDirs::locate("data","sflphone-client-kde/voicemail.png")); @@ -591,7 +593,7 @@ bool HistoryTreeItem::getContactInfo(QString phoneNumber) painter.drawPixmap(pxm.width()-status.width(),pxm.height()-status.height(),status); } m_pIconL->setPixmap(pxm); - + return m_pContact; } //getContactInfo @@ -647,7 +649,7 @@ void HistoryTreeItem::dragEnterEvent ( QDragEnterEvent *e ) m_pBtnTrans->setMinimumSize(width()-16,height()-4); m_pBtnTrans->setMaximumSize(width()-16,height()-4); m_pBtnTrans->move(8,2); - m_pBtnTrans->setVisible(true); + m_pBtnTrans->setVisible (true); m_pBtnTrans->setHoverState(true); e->accept(); } @@ -666,7 +668,7 @@ void HistoryTreeItem::dragMoveEvent ( QDragMoveEvent *e ) void HistoryTreeItem::dragLeaveEvent ( QDragLeaveEvent *e ) { m_pBtnTrans->setHoverState(false); - m_pBtnTrans->setVisible(false); + m_pBtnTrans->setVisible (false); kDebug() << "Drag leave"; e->accept(); } @@ -684,7 +686,7 @@ void HistoryTreeItem::transferEvent(QMimeData* data) else kDebug() << "Invalid mime data"; m_pBtnTrans->setHoverState(false); - m_pBtnTrans->setVisible(false); + m_pBtnTrans->setVisible (false); } ///On data drop diff --git a/kde/src/widgets/HistoryTreeItem.h b/kde/src/widgets/HistoryTreeItem.h index d76efb7f6c58cb9e702ef14ced9b2aaa6b0721c5..cddef0a4c611433394a12f19babd940a4a32dd2a 100644 --- a/kde/src/widgets/HistoryTreeItem.h +++ b/kde/src/widgets/HistoryTreeItem.h @@ -66,8 +66,8 @@ class HistoryTreeItem : public QWidget uint getDurWidth (); //Setters - void setCall ( Call* call ); - void setItem ( QTreeWidgetItem* item ); + void setCall ( Call* call ); + void setItem ( QTreeWidgetItem* item ); private: //Attributes diff --git a/kde/src/widgets/IMManager.cpp b/kde/src/widgets/IMManager.cpp index 9c7fcb28e79fec4163d2d1e782234a539c4640f9..1cef6738c24d9450ee547f244cbc912ca3920a40 100644 --- a/kde/src/widgets/IMManager.cpp +++ b/kde/src/widgets/IMManager.cpp @@ -22,6 +22,7 @@ #include <KDebug> #include <KLocale> +///Constructor IMManager::IMManager(QWidget* parent) : KTabWidget(parent) { setVisible(false); @@ -30,6 +31,7 @@ IMManager::IMManager(QWidget* parent) : KTabWidget(parent) connect(this,SIGNAL(tabCloseRequested(int)),this,SLOT(closeRequest(int))); } +///Destructor void IMManager::newConversation(Call* call, InstantMessagingModel* model) { IMTab* newTab = new IMTab(model,this); @@ -39,6 +41,7 @@ void IMManager::newConversation(Call* call, InstantMessagingModel* model) addTab(newTab,name); } +///Close a tab void IMManager::closeRequest(int index) { QWidget* wdg = widget(index); diff --git a/kde/src/widgets/IMManager.h b/kde/src/widgets/IMManager.h index 607cf70bac062aef7f51416afc1aaed18880753c..45e0d13c4edeee58ba54cefe71dc1ce082f6b9e6 100644 --- a/kde/src/widgets/IMManager.h +++ b/kde/src/widgets/IMManager.h @@ -36,8 +36,12 @@ class IMManager : public KTabWidget public: IMManager(QWidget* parent = nullptr); + private: + //Attrubutes QHash<Call*,IMTab*> m_lTabs; + + private slots: void newConversation(Call* call, InstantMessagingModel* model); void closeRequest(int index); diff --git a/kde/src/widgets/IMTab.cpp b/kde/src/widgets/IMTab.cpp index d7d0bba801cf0b31d154168d5bad9aa6f0bc8f45..d3ff5af062b3b61f2e0279397a3e505a8e5b22ff 100644 --- a/kde/src/widgets/IMTab.cpp +++ b/kde/src/widgets/IMTab.cpp @@ -24,14 +24,14 @@ #include <KIcon> #include <QtGui/QFont> - +///Delegate contructor ImDelegates::ImDelegates(IMTab* parent) : QStyledItemDelegate(parent),m_pParent(parent) { } +///Delegate size hint QSize ImDelegates::sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const { -// QSize orig = QStyledItemDelegate::sizeHint(option,index); int height = 0; QPixmap* icon = (QPixmap*)index.data(InstantMessagingModel::MESSAGE_IMAGE_ROLE).value<void*>(); QFontMetrics metric( option.font); @@ -44,14 +44,10 @@ QSize ImDelegates::sizeHint(const QStyleOptionViewItem& option, const QModelInde return QSize(m_pParent->width()-30,height); } +///Delegate painter void ImDelegates::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const { Q_ASSERT(index.isValid()); -// const QRegion cl = painter->clipRegion(); -// painter->setClipRect(option.rect); - - - QPixmap* icon = (QPixmap*)index.data(InstantMessagingModel::MESSAGE_IMAGE_ROLE).value<void*>(); int icnWidth = 50; if (icon && dynamic_cast<QPixmap*>(icon)) { @@ -76,6 +72,7 @@ void ImDelegates::paint(QPainter* painter, const QStyleOptionViewItem& option, c } +///Constructor IMTab::IMTab(InstantMessagingModel* model,QWidget* parent) : QListView(parent) { setModel(model); @@ -87,7 +84,7 @@ IMTab::IMTab(InstantMessagingModel* model,QWidget* parent) : QListView(parent) connect(model,SIGNAL(dataChanged(QModelIndex,QModelIndex)),this,SLOT(scrollBottom())); } - +///Scroll to last message void IMTab::scrollBottom() { scrollTo(model()->index(model()->rowCount()-1,0)); diff --git a/kde/src/widgets/SFLPhoneTray.h b/kde/src/widgets/SFLPhoneTray.h index ebdcd9fcbdd2318687c9cf876a9a2315d6ed0a77..992350a5b27472cdb9e94df20b38e409fd607c72 100755 --- a/kde/src/widgets/SFLPhoneTray.h +++ b/kde/src/widgets/SFLPhoneTray.h @@ -37,7 +37,7 @@ public: //Constructor explicit SFLPhoneTray(QIcon icon, QWidget *parent = 0); ~SFLPhoneTray(); - + //Mutators void addAction(KAction *action); void addSeparator(); diff --git a/kde/src/widgets/VideoDock.cpp b/kde/src/widgets/VideoDock.cpp index a5ea0a23352f316aa746fca5119ea895d50dc21e..8273868aadb2516405b80a0578e599b0f4c78089 100644 --- a/kde/src/widgets/VideoDock.cpp +++ b/kde/src/widgets/VideoDock.cpp @@ -39,6 +39,7 @@ VideoDock::VideoDock(QWidget* parent) : QDockWidget(parent) setWidget(wdg); } +///Set current renderer void VideoDock::setRenderer(VideoRenderer* r) { m_pVideoWidet->setRenderer(r); diff --git a/kde/src/widgets/VideoDock.h b/kde/src/widgets/VideoDock.h index 319476e6ea1818b32e03d7442753a0fe3ce41dee..8e320c396c80533a34142ed6a8482636465dde3b 100644 --- a/kde/src/widgets/VideoDock.h +++ b/kde/src/widgets/VideoDock.h @@ -33,12 +33,12 @@ class VideoDock : public QDockWidget { public: VideoDock(QWidget* parent =0 ); void setRenderer(VideoRenderer* r); + private: VideoWidget* m_pVideoWidet; - -private slots: - + + }; #endif diff --git a/kde/src/widgets/VideoWidget.cpp b/kde/src/widgets/VideoWidget.cpp index e9a0a629d858a8b40e76c64c2c05b06708631e5e..b1659d7ba5e0d35d05e7df080ebb0d6e5284010a 100644 --- a/kde/src/widgets/VideoWidget.cpp +++ b/kde/src/widgets/VideoWidget.cpp @@ -28,7 +28,7 @@ VideoWidget::VideoWidget(QWidget* parent ,VideoRenderer* renderer) : QWidget(par connect(VideoModel::getInstance(),SIGNAL(videoCallInitiated(VideoRenderer*)),this,SLOT(setRenderer(VideoRenderer*))); } - +///Set widget renderer void VideoWidget::setRenderer(VideoRenderer* renderer) { disconnect(m_pRenderer,SIGNAL(frameUpdated()),this,SLOT(updateFrame())); diff --git a/kde/src/widgets/VideoWidget.h b/kde/src/widgets/VideoWidget.h index 3931189a8dc3ad83a2880645778986d380c94802..e035e6c7b3335b666b54f9aacb76a6866811cc0c 100644 --- a/kde/src/widgets/VideoWidget.h +++ b/kde/src/widgets/VideoWidget.h @@ -28,19 +28,27 @@ class VideoRenderer; class VideoWidget : public QWidget { Q_OBJECT public: - explicit VideoWidget(QWidget* parent =0, VideoRenderer* renderer = VideoModel::getInstance()->getPreviewRenderer()); + explicit VideoWidget(QWidget* parent =nullptr, VideoRenderer* renderer = VideoModel::getInstance()->getPreviewRenderer()); + + +protected: + virtual void paintEvent(QPaintEvent* event); + + private: + //Attributes QImage* m_Image; VideoRenderer* m_pRenderer; -protected: - virtual void paintEvent(QPaintEvent* event); + private slots: void update(); void updateFrame(); void stop(); + + public slots: void setRenderer(VideoRenderer* renderer); - + }; #endif