From 67b71a5f81b3edb785157b217b2bc88a14365744 Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> Date: Thu, 19 Feb 2015 23:34:07 +0000 Subject: [PATCH] Fix GCC, Coverity and Krazy2 warnings Refs #66610 --- CMakeLists.txt | 8 ++++---- src/accountmodel.cpp | 2 +- src/accountstatusmodel.h | 2 +- src/bookmarkmodel.cpp | 4 ++-- src/bookmarkmodel.h | 2 +- src/call.cpp | 12 +++++++++--- src/callmodel.cpp | 6 +++--- src/categorizedcompositenode.cpp | 2 +- src/certificatemodel.h | 4 ++-- src/ciphermodel.h | 2 +- src/collectioneditor.cpp | 2 +- src/collectioneditor.h | 8 ++++---- src/collectioneditor.hpp | 2 +- src/collectioninterface.h | 2 +- src/collectionmediator.h | 2 +- src/collectionmediator.hpp | 2 +- src/collectionmodel.cpp | 2 +- src/contactmethod.cpp | 2 +- src/contactproxymodel.cpp | 17 +++-------------- src/contactproxymodel.h | 3 +-- src/historytimecategorymodel.cpp | 8 +++++++- src/historytimecategorymodel.h | 1 + src/instantmessagingmodel.cpp | 3 ++- src/itembase.h | 2 +- src/itembase.hpp | 2 +- src/networkinterfacemodel.cpp | 2 +- src/networkinterfacemodel.h | 2 +- src/numbercompletionmodel.cpp | 2 +- src/person.cpp | 6 +++--- src/phonedirectorymodel.cpp | 4 ++-- src/private/account_p.h | 2 +- src/private/accountmodel_p.h | 2 +- src/private/useractions.h | 10 +++++++++- src/private/videoresolution_p.h | 2 +- src/profilemodel.cpp | 11 ++++++----- src/profilemodel.h | 2 +- src/tlsmethodmodel.cpp | 2 +- src/tlsmethodmodel.h | 2 +- src/uri.cpp | 3 ++- src/useractionmodel.h | 2 +- src/vcardutils.cpp | 20 ++++++++++---------- src/video/channel.cpp | 3 ++- src/video/sourcesmodel.cpp | 5 +++++ src/video/sourcesmodel.h | 1 + 44 files changed, 102 insertions(+), 83 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1b6d89bc..43ce104a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,7 +42,7 @@ ADD_DEFINITIONS( -Wall -Wextra -Wno-cpp - #-Wmissing-declarations + -Wmissing-declarations -Wmissing-noreturn -Wpointer-arith -Wcast-align @@ -60,15 +60,15 @@ ADD_DEFINITIONS( -Woverloaded-virtual -Wsuggest-attribute=const -Wunused-value -# -pedantic + -pedantic -Wdouble-promotion -Wnonnull -Wsequence-point -Wunused-but-set-parameter - #-Wsuggest-attribute=const + -Wsuggest-attribute=const #-Wsystem-headers -Wsizeof-pointer-memaccess -# -Wuseless-cast + #-Wuseless-cast -Wvarargs ) diff --git a/src/accountmodel.cpp b/src/accountmodel.cpp index e4306e09..863121f4 100644 --- a/src/accountmodel.cpp +++ b/src/accountmodel.cpp @@ -294,7 +294,7 @@ void AccountModelPrivate::slotAccountPresenceEnabledChanged(bool state) emit q_ptr->presenceEnabledChanged(q_ptr->isPresenceEnabled()); } -///Emited when some runtime details changes +///Emitted when some runtime details changes void AccountModelPrivate::slotVolatileAccountDetailsChange(const QString& accountId, const MapStringString& details) { Account* a = q_ptr->getById(accountId.toLatin1()); diff --git a/src/accountstatusmodel.h b/src/accountstatusmodel.h index f753545f..8f68e51f 100644 --- a/src/accountstatusmodel.h +++ b/src/accountstatusmodel.h @@ -72,7 +72,7 @@ private: virtual ~AccountStatusModel(); AccountStatusModelPrivate* d_ptr; - Q_DECLARE_PRIVATE(AccountStatusModel); + Q_DECLARE_PRIVATE(AccountStatusModel) }; Q_DECLARE_METATYPE(AccountStatusModel*) diff --git a/src/bookmarkmodel.cpp b/src/bookmarkmodel.cpp index c841a925..4c63b0a1 100644 --- a/src/bookmarkmodel.cpp +++ b/src/bookmarkmodel.cpp @@ -410,7 +410,7 @@ QVariant BookmarkModelPrivate::commonCallInfo(NumberTreeBackend* number, int rol cat = "N/A";//timeToHistoryCategory(QDateTime::fromTime_t(call->getStartTimeStamp().toUInt()).date()); break; case Call::Role::PhoneNu: - return QVariant::fromValue(const_cast<ContactMethod*>(number->m_pNumber)); + return QVariant::fromValue(number->m_pNumber); case Call::Role::IsBookmark: return true; case Call::Role::Filter: @@ -617,4 +617,4 @@ void BookmarkModel::backendAddedCallback(CollectionInterface* backend) // return tr("Bookmarks"); // } -#include <bookmarkmodel.moc> \ No newline at end of file +#include <bookmarkmodel.moc> diff --git a/src/bookmarkmodel.h b/src/bookmarkmodel.h index d7b08d17..be9165c3 100644 --- a/src/bookmarkmodel.h +++ b/src/bookmarkmodel.h @@ -85,7 +85,7 @@ private: static BookmarkModel* m_spInstance; BookmarkModelPrivate* d_ptr; - Q_DECLARE_PRIVATE(BookmarkModel); + Q_DECLARE_PRIVATE(BookmarkModel) //Backend interface virtual void backendAddedCallback(CollectionInterface* backend) override; diff --git a/src/call.cpp b/src/call.cpp index 97c19a48..4117f6b6 100644 --- a/src/call.cpp +++ b/src/call.cpp @@ -185,7 +185,7 @@ const TypedStateMachine< TypedStateMachine< bool , Call::LifeCycleState > , Call QDebug LIB_EXPORT operator<<(QDebug dbg, const Call::State& c) { - dbg.nospace() << QString(Call::toHumanStateName(c)); + dbg.nospace() << Call::toHumanStateName(c); return dbg.space(); } @@ -200,16 +200,22 @@ QDebug LIB_EXPORT operator<<(QDebug dbg, const Call::Action& c) switch (c) { case Call::Action::ACCEPT: dbg.nospace() << "ACCEPT"; + break; case Call::Action::REFUSE: dbg.nospace() << "REFUSE"; + break; case Call::Action::TRANSFER: dbg.nospace() << "TRANSFER"; + break; case Call::Action::HOLD: dbg.nospace() << "HOLD"; + break; case Call::Action::RECORD: dbg.nospace() << "RECORD"; + break; case Call::Action::COUNT__: dbg.nospace() << "COUNT"; + break; }; dbg.space(); dbg.nospace() << '(' << static_cast<int>(c) << ')'; @@ -222,7 +228,7 @@ m_pImModel(nullptr),m_pTimer(nullptr),m_Recording(false),m_Account(nullptr), m_PeerName(),m_pPeerContactMethod(nullptr),m_HistoryConst(HistoryTimeCategoryModel::HistoryConst::Never), m_CallId(),m_pStartTimeStamp(0),m_pDialNumber(nullptr),m_pTransferNumber(nullptr), m_History(false),m_Missed(false),m_Direction(Call::Direction::OUTGOING),m_Type(Call::Type::CALL), -m_pUserActionModel(nullptr) +m_pUserActionModel(nullptr),m_HistoryState(Call::LegacyHistoryState::NONE), m_CurrentState(Call::State::ERROR) { } @@ -1648,7 +1654,7 @@ QVariant Call::roleData(int role) const break; case Call::Role::Filter: { QString normStripppedC; - foreach(QChar char2,QString(static_cast<int>(historyState())+'\n'+roleData(Call::Role::Name).toString()+'\n'+ + foreach(QChar char2,(static_cast<int>(historyState())+'\n'+roleData(Call::Role::Name).toString()+'\n'+ roleData(Call::Role::Number).toString()).toLower().normalized(QString::NormalizationForm_KD) ) { if (!char2.combiningClass()) normStripppedC += char2; diff --git a/src/callmodel.cpp b/src/callmodel.cpp index 3acae76a..dfea2898 100644 --- a/src/callmodel.cpp +++ b/src/callmodel.cpp @@ -433,7 +433,7 @@ Call* CallModelPrivate::addIncomingCall(const QString& callId) { Call* call = addCall(CallPrivate::buildIncomingCall(callId)); //Call without account is not possible - if (dynamic_cast<Account*>(call->account())) { + if (call->account()) { if (call->account()->isAutoAnswer()) { call->performAction(Call::Action::ACCEPT); } @@ -476,7 +476,7 @@ void CallModelPrivate::removeCall(Call* call, bool noEmit) InternalStruct* internal = m_sPrivateCallList_call[call]; if (!internal || !call) { - qDebug() << "Cannot remove " << internal->call_real << ": call not found"; + qDebug() << "Cannot remove " << (internal?internal->call_real->id():"nullptr") << ": call not found"; return; } @@ -1050,7 +1050,7 @@ void CallModelPrivate::slotChangingConference(const QString &confID, const QStri } Call* conf = confInt->call_real; qDebug() << "Changing conference state" << conf << confID; - if (conf && dynamic_cast<Call*>(conf)) { //Prevent a race condition between call and conference + if (conf && conf) { //Prevent a race condition between call and conference if (!q_ptr->getIndex(conf).isValid()) { qWarning() << "The conference item does not exist"; return; diff --git a/src/categorizedcompositenode.cpp b/src/categorizedcompositenode.cpp index 081bed5b..6fae53de 100644 --- a/src/categorizedcompositenode.cpp +++ b/src/categorizedcompositenode.cpp @@ -28,7 +28,7 @@ public: }; CategorizedCompositeNodePrivate::CategorizedCompositeNodePrivate(): -m_DropState(0),m_pParent(nullptr),m_HoverState(0) +m_DropState(0),m_pParent(nullptr),m_HoverState(0),m_type(CategorizedCompositeNode::Type::CALL) { } diff --git a/src/certificatemodel.h b/src/certificatemodel.h index f5107923..216380aa 100644 --- a/src/certificatemodel.h +++ b/src/certificatemodel.h @@ -35,7 +35,7 @@ public: }; //Constructor - CertificateModel(QObject* parent = nullptr); + explicit CertificateModel(QObject* parent = nullptr); virtual ~CertificateModel(); //Model implementation @@ -57,7 +57,7 @@ public: private: CertificateModelPrivate* d_ptr; - Q_DECLARE_PRIVATE(CertificateModel); + Q_DECLARE_PRIVATE(CertificateModel) }; #endif \ No newline at end of file diff --git a/src/ciphermodel.h b/src/ciphermodel.h index 0fa83d9d..1a44bc1a 100644 --- a/src/ciphermodel.h +++ b/src/ciphermodel.h @@ -56,7 +56,7 @@ private: virtual ~CipherModel(); CipherModelPrivate* d_ptr; - Q_DECLARE_PRIVATE(CipherModel); + Q_DECLARE_PRIVATE(CipherModel) }; Q_DECLARE_METATYPE(CipherModel*) diff --git a/src/collectioneditor.cpp b/src/collectioneditor.cpp index 4bad1299..8aa3a560 100644 --- a/src/collectioneditor.cpp +++ b/src/collectioneditor.cpp @@ -23,4 +23,4 @@ CollectionEditorBase::CollectionEditorBase(QAbstractItemModel* m) : m_pModel(m) QAbstractItemModel* CollectionEditorBase::model() const { return m_pModel; -} \ No newline at end of file +} diff --git a/src/collectioneditor.h b/src/collectioneditor.h index 247bf38c..65011fc3 100644 --- a/src/collectioneditor.h +++ b/src/collectioneditor.h @@ -38,10 +38,10 @@ template<typename T> class CollectionMediator; /** * This is the class that does the actual work. This class * represent a delegate of CollectionInterface. It is usually - * recommanded to implement this as a private class in the .cpp + * recommended to implement this as a private class in the .cpp * that implement the CollectionInterface. * - * The rational behind this inversion of responsability layer + * The rational behind this inversion of responsibility layer * is to avoid using a template class for CollectionInterface. * This would add obstable when implementing objects using it due * to C++11 lack of generic template polymorphism. A base class @@ -51,7 +51,7 @@ template<typename T> class LIB_EXPORT CollectionEditor : public CollectionEditorBase { friend class CollectionInterface; public: - CollectionEditor(CollectionMediator<T>* m); + explicit CollectionEditor(CollectionMediator<T>* m); virtual ~CollectionEditor(); CollectionMediator<T>* mediator() const; @@ -87,4 +87,4 @@ private: #include "collectioneditor.hpp" -#endif \ No newline at end of file +#endif diff --git a/src/collectioneditor.hpp b/src/collectioneditor.hpp index 2c6eb17e..64907230 100644 --- a/src/collectioneditor.hpp +++ b/src/collectioneditor.hpp @@ -69,4 +69,4 @@ bool CollectionEditor<T>::remove(T* item) { Q_UNUSED(item) return false; -} \ No newline at end of file +} diff --git a/src/collectioninterface.h b/src/collectioninterface.h index a04c95d5..849ce031 100644 --- a/src/collectioninterface.h +++ b/src/collectioninterface.h @@ -34,7 +34,7 @@ template<typename T> class CollectionMediator; template<typename T> class ItemBase; /** - * This is the iterface that must be implemented by each item backends to + * This is the interface that must be implemented by each item backends to * be used by a CollectionManager. * * The class need to be extended with a template constructor: diff --git a/src/collectionmediator.h b/src/collectionmediator.h index 694bd01f..bbb3cf7b 100644 --- a/src/collectionmediator.h +++ b/src/collectionmediator.h @@ -51,4 +51,4 @@ private: #include <collectionmediator.hpp> -#endif \ No newline at end of file +#endif diff --git a/src/collectionmediator.hpp b/src/collectionmediator.hpp index a5e872da..3dc33b5e 100644 --- a/src/collectionmediator.hpp +++ b/src/collectionmediator.hpp @@ -48,4 +48,4 @@ template<typename T> QAbstractItemModel* CollectionMediator<T>::model() const { return d_ptr->m_pModel; -} \ No newline at end of file +} diff --git a/src/collectionmodel.cpp b/src/collectionmodel.cpp index 4ddc3267..31da2772 100644 --- a/src/collectionmodel.cpp +++ b/src/collectionmodel.cpp @@ -203,7 +203,7 @@ QModelIndex CollectionModel::index( int row, int column, const QModelIndex& pare else { item = new CollectionModelPrivate::ProxyItem(); item->parent = parentItem; - item->backend = static_cast<CollectionInterface*>(parentItem->backend->children()[row]); + item->backend = parentItem->backend->children()[row]; parentItem->m_Children << item; } item->row = row; diff --git a/src/contactmethod.cpp b/src/contactmethod.cpp index 03912fc4..2741bc52 100644 --- a/src/contactmethod.cpp +++ b/src/contactmethod.cpp @@ -127,7 +127,7 @@ ContactMethodPrivate::ContactMethodPrivate(const URI& uri, NumberCategory* cat, m_Uri(uri),m_pCategory(cat),m_Tracked(false),m_Present(false),m_LastUsed(0), m_Type(st),m_PopularityIndex(-1),m_pPerson(nullptr),m_pAccount(nullptr), m_LastWeekCount(0),m_LastTrimCount(0),m_HaveCalled(false),m_IsBookmark(false),m_TotalSeconds(0), - m_Index(-1) + m_Index(-1),m_hasType(false) {} ///Constructor diff --git a/src/contactproxymodel.cpp b/src/contactproxymodel.cpp index 430bac02..b617f2ad 100644 --- a/src/contactproxymodel.cpp +++ b/src/contactproxymodel.cpp @@ -92,7 +92,6 @@ public: QVector<ContactTopLevelItem*> m_lCategoryCounter ; QHash<QString,ContactTopLevelItem*> m_hCategories ; int m_Role ; - bool m_ShowAll ; QStringList m_lMimes ; //Helper @@ -162,7 +161,6 @@ void ContactTreeBinder::slotContactMethodCountChanged(int count, int oldCount) { const QModelIndex idx = m_pModel->index(m_pTreeNode->m_Index,0,m_pModel->index(m_pTreeNode->m_pParent3->m_Index,0)); if (count > oldCount) { - const QModelIndex lastPhoneIdx = m_pModel->index(oldCount-1,0,idx); m_pModel->beginInsertRows(idx,oldCount,count-1); m_pModel->endInsertRows(); } @@ -180,17 +178,16 @@ void ContactTreeBinder::slotContactMethodCountAboutToChange(int count, int oldCo } ContactProxyModelPrivate::ContactProxyModelPrivate(ContactProxyModel* parent) : QObject(parent), q_ptr(parent), -m_lCategoryCounter() +m_lCategoryCounter(),m_Role(Qt::DisplayRole) { } // -ContactProxyModel::ContactProxyModel(int role, bool showAll) : QAbstractItemModel(QCoreApplication::instance()),d_ptr(new ContactProxyModelPrivate(this)) +ContactProxyModel::ContactProxyModel(int role) : QAbstractItemModel(QCoreApplication::instance()),d_ptr(new ContactProxyModelPrivate(this)) { setObjectName("ContactProxyModel"); d_ptr->m_Role = role; - d_ptr->m_ShowAll = showAll; d_ptr->m_lCategoryCounter.reserve(32); d_ptr->m_lMimes << RingMimes::PLAIN_TEXT << RingMimes::PHONENUMBER; connect(PersonModel::instance(),SIGNAL(reloaded()),d_ptr.data(),SLOT(reloadCategories())); @@ -586,7 +583,7 @@ QString ContactProxyModelPrivate::category(const Person* ct) const { default: cat = ct->formattedName(); } - if (cat.size() && !m_ShowAll) + if (cat.size()) cat = cat[0].toUpper(); return cat; } @@ -599,12 +596,4 @@ void ContactProxyModel::setRole(int role) } } -void ContactProxyModel::setShowAll(bool showAll) -{ - if (showAll != d_ptr->m_ShowAll) { - d_ptr->m_ShowAll = showAll; - d_ptr->reloadCategories(); - } -} - #include <contactproxymodel.moc> diff --git a/src/contactproxymodel.h b/src/contactproxymodel.h index f6b39c0c..7926c40a 100644 --- a/src/contactproxymodel.h +++ b/src/contactproxymodel.h @@ -41,12 +41,11 @@ public: friend class PersonModel; friend class ContactTreeNode; friend class ContactTreeBinder; - explicit ContactProxyModel(int role = Qt::DisplayRole, bool showAll = false); + explicit ContactProxyModel(int role = Qt::DisplayRole); virtual ~ContactProxyModel(); //Setters void setRole(int role); - void setShowAll(bool showAll); //Model implementation virtual bool setData ( const QModelIndex& index, const QVariant &value, int role ) override; diff --git a/src/historytimecategorymodel.cpp b/src/historytimecategorymodel.cpp index 169a6ed7..fbbe11e1 100644 --- a/src/historytimecategorymodel.cpp +++ b/src/historytimecategorymodel.cpp @@ -27,7 +27,8 @@ class HistoryTimeCategoryModelPrivate QVector<QString> HistoryTimeCategoryModel::m_lCategories; HistoryTimeCategoryModel* HistoryTimeCategoryModel::m_spInstance = new HistoryTimeCategoryModel(); -HistoryTimeCategoryModel::HistoryTimeCategoryModel(QObject* parent) : QAbstractListModel(parent) +HistoryTimeCategoryModel::HistoryTimeCategoryModel(QObject* parent) : QAbstractListModel(parent), +d_ptr(new HistoryTimeCategoryModelPrivate) { m_lCategories << tr("Today") ;//0 m_lCategories << tr("Yesterday") ;//1 @@ -56,6 +57,11 @@ HistoryTimeCategoryModel::HistoryTimeCategoryModel(QObject* parent) : QAbstractL m_lCategories << tr("Never") ;//24 } +HistoryTimeCategoryModel::~HistoryTimeCategoryModel() +{ + delete d_ptr; +} + QHash<int,QByteArray> HistoryTimeCategoryModel::roleNames() const { static QHash<int, QByteArray> roles = QAbstractItemModel::roleNames(); diff --git a/src/historytimecategorymodel.h b/src/historytimecategorymodel.h index 38c03b39..22d0ee9b 100644 --- a/src/historytimecategorymodel.h +++ b/src/historytimecategorymodel.h @@ -61,6 +61,7 @@ public: //Constructor explicit HistoryTimeCategoryModel(QObject* parent = nullptr); + virtual ~HistoryTimeCategoryModel(); //Abstract model member virtual QVariant data (const QModelIndex& index, int role = Qt::DisplayRole ) const override; diff --git a/src/instantmessagingmodel.cpp b/src/instantmessagingmodel.cpp index 5400c8a7..ab195a79 100644 --- a/src/instantmessagingmodel.cpp +++ b/src/instantmessagingmodel.cpp @@ -24,7 +24,8 @@ #include "contactmethod.h" #include "private/instantmessagingmodel_p.h" -InstantMessagingModelPrivate::InstantMessagingModelPrivate(InstantMessagingModel* parent) : QObject(parent), q_ptr(parent) +InstantMessagingModelPrivate::InstantMessagingModelPrivate(InstantMessagingModel* parent) : QObject(parent), q_ptr(parent), +m_pCall(nullptr) { } diff --git a/src/itembase.h b/src/itembase.h index 7226f4a4..da876e06 100644 --- a/src/itembase.h +++ b/src/itembase.h @@ -50,4 +50,4 @@ private: #include <itembase.hpp> -#endif \ No newline at end of file +#endif diff --git a/src/itembase.hpp b/src/itembase.hpp index 6e605e97..1db529ac 100644 --- a/src/itembase.hpp +++ b/src/itembase.hpp @@ -75,4 +75,4 @@ bool ItemBase<Base>::remove() // } // else // qDebug() << "Cannot save, invalid item type"; -} \ No newline at end of file +} diff --git a/src/networkinterfacemodel.cpp b/src/networkinterfacemodel.cpp index 2f28250f..350db39c 100644 --- a/src/networkinterfacemodel.cpp +++ b/src/networkinterfacemodel.cpp @@ -90,4 +90,4 @@ NetworkInterfaceModel* NetworkInterfaceModel::instance() // } -#include <networkinterfacemodel.moc> \ No newline at end of file +#include <networkinterfacemodel.moc> diff --git a/src/networkinterfacemodel.h b/src/networkinterfacemodel.h index 29e59735..42499472 100644 --- a/src/networkinterfacemodel.h +++ b/src/networkinterfacemodel.h @@ -49,7 +49,7 @@ private: static NetworkInterfaceModel* m_spInstance; NetworkInterfaceModelPrivate* d_ptr; - Q_DECLARE_PRIVATE(NetworkInterfaceModel); + Q_DECLARE_PRIVATE(NetworkInterfaceModel) }; Q_DECLARE_METATYPE(NetworkInterfaceModel*) diff --git a/src/numbercompletionmodel.cpp b/src/numbercompletionmodel.cpp index 826d3acf..27c540d0 100644 --- a/src/numbercompletionmodel.cpp +++ b/src/numbercompletionmodel.cpp @@ -132,7 +132,7 @@ QVariant NumberCompletionModel::data(const QModelIndex& index, int role ) const return needAcc; case NumberCompletionModel::Role::ACCOUNT: if (needAcc) - return QVariant::fromValue(const_cast<Account*>(n->account())); + return QVariant::fromValue(n->account()); break; }; break; diff --git a/src/person.cpp b/src/person.cpp index 5b68cd67..5bb4d83d 100644 --- a/src/person.cpp +++ b/src/person.cpp @@ -156,7 +156,7 @@ QString PersonPrivate::filterString() } //Strip non essential characters like accents from the filter string - foreach(const QChar& char2,QString(m_FormattedName+'\n'+m_Organization+'\n'+m_Group+'\n'+ + foreach(const QChar& char2,(m_FormattedName+'\n'+m_Organization+'\n'+m_Group+'\n'+ m_Department+'\n'+m_PreferredEmail).toLower().normalized(QString::NormalizationForm_KD) ) { if (!char2.combiningClass()) m_CachedFilterString += char2; @@ -202,7 +202,7 @@ void PersonPrivate::phoneNumberCountAboutToChange(int n,int o) } PersonPrivate::PersonPrivate(Person* contact) : - m_Numbers(contact),m_DisplayPhoto(false),m_Active(true) + m_Numbers(contact),m_DisplayPhoto(false),m_Active(true),m_isPlaceHolder(false) { } @@ -530,7 +530,7 @@ const QByteArray Person::toVCard(QList<Account*> accounts) const VCardUtils* maker = new VCardUtils(); maker->startVCard("2.1"); maker->addProperty(VCardUtils::Property::UID, uid()); - maker->addProperty(VCardUtils::Property::NAME, QString(secondName() + maker->addProperty(VCardUtils::Property::NAME, (secondName() + VCardUtils::Delimiter::SEPARATOR_TOKEN + firstName())); maker->addProperty(VCardUtils::Property::FORMATTED_NAME, formattedName()); diff --git a/src/phonedirectorymodel.cpp b/src/phonedirectorymodel.cpp index 2fa54407..8830de88 100644 --- a/src/phonedirectorymodel.cpp +++ b/src/phonedirectorymodel.cpp @@ -201,14 +201,14 @@ QVariant PhoneDirectoryModel::data(const QModelIndex& index, int role ) const case PhoneDirectoryModelPrivate::Columns::POPULARITY_INDEX: switch (role) { case Qt::DisplayRole: - return (int)number->popularityIndex(); + return number->popularityIndex(); break; } break; case PhoneDirectoryModelPrivate::Columns::BOOKMARED: switch (role) { case Qt::CheckStateRole: - return (bool)number->isBookmarked()?Qt::Checked:Qt::Unchecked; + return number->isBookmarked()?Qt::Checked:Qt::Unchecked; break; } break; diff --git a/src/private/account_p.h b/src/private/account_p.h index a20bc1ba..60f6c163 100644 --- a/src/private/account_p.h +++ b/src/private/account_p.h @@ -53,7 +53,7 @@ public: friend class TlsMethodModel; //Constructor - AccountPrivate(Account* acc); + explicit AccountPrivate(Account* acc); //Attributes QByteArray m_AccountId ; diff --git a/src/private/accountmodel_p.h b/src/private/accountmodel_p.h index 8d156803..a3049dd7 100644 --- a/src/private/accountmodel_p.h +++ b/src/private/accountmodel_p.h @@ -33,7 +33,7 @@ class AccountModelPrivate : public QObject friend class AvailableAccountModel; public: //Constructor - AccountModelPrivate(AccountModel* parent); + explicit AccountModelPrivate(AccountModel* parent); void init(); //Helpers diff --git a/src/private/useractions.h b/src/private/useractions.h index c6f7cf45..fe9a0b89 100644 --- a/src/private/useractions.h +++ b/src/private/useractions.h @@ -26,6 +26,14 @@ */ namespace UserActions { +bool accept(const QList<Call*> calls); +bool hangup(const QList<Call*> calls); +bool refuse(const QList<Call*> calls); +bool hold(const QList<Call*> calls); +bool unhold(const QList<Call*> calls); +bool transfer(const QList<Call*> calls); +bool record(const QList<Call*> calls); + bool accept(const QList<Call*> calls) { bool ret = true; @@ -175,6 +183,6 @@ bool record(const QList<Call*> calls) return ret; } -}; //namespace UserActions +} //namespace UserActions #endif \ No newline at end of file diff --git a/src/private/videoresolution_p.h b/src/private/videoresolution_p.h index 769fb4ec..a954a42f 100644 --- a/src/private/videoresolution_p.h +++ b/src/private/videoresolution_p.h @@ -21,7 +21,7 @@ namespace Video { class Rate; class Channel; -}; +} class VideoResolutionPrivate { diff --git a/src/profilemodel.cpp b/src/profilemodel.cpp index 05ee6b2b..6f39ea56 100644 --- a/src/profilemodel.cpp +++ b/src/profilemodel.cpp @@ -270,7 +270,8 @@ ProfileModel* ProfileModel::m_spInstance = nullptr; template<typename T> ProfileContentBackend::ProfileContentBackend(CollectionMediator<T>* mediator) : - CollectionInterface(new ProfileEditor(mediator),nullptr), m_pDefault(nullptr) + CollectionInterface(new ProfileEditor(mediator),nullptr), m_pDefault(nullptr), + m_needSaving(false) { m_pEditor = static_cast<ProfileEditor*>(editor<Person>()); } @@ -616,7 +617,7 @@ private: ProfileModel* q_ptr; }; -ProfileModelPrivate::ProfileModelPrivate(ProfileModel* parent) : QObject(parent), q_ptr(parent) +ProfileModelPrivate::ProfileModelPrivate(ProfileModel* parent) : QObject(parent), q_ptr(parent),m_pProfileBackend(nullptr) { } @@ -634,7 +635,7 @@ ProfileModel::ProfileModel(QObject* parent) : QAbstractItemModel(parent), d_ptr( d_ptr->m_lMimes << RingMimes::PLAIN_TEXT << RingMimes::HTML_TEXT << RingMimes::ACCOUNT << RingMimes::PROFILE; //Creating the profile contact backend - d_ptr->m_pProfileBackend = static_cast<ProfileContentBackend*>(PersonModel::instance()->addBackend<ProfileContentBackend>(LoadOptions::FORCE_ENABLED)); + d_ptr->m_pProfileBackend = PersonModel::instance()->addBackend<ProfileContentBackend>(LoadOptions::FORCE_ENABLED); //Once LibRingClient is ready, start listening QTimer::singleShot(0,d_ptr,SLOT(slotDelayedInit())); @@ -781,7 +782,7 @@ QMimeData* ProfileModel::mimeData(const QModelIndexList &indexes) const for (const QModelIndex &index : indexes) { Node* current = static_cast<Node*>(index.internalPointer()); - if (index.isValid() && current->parent && current) { + if (current && index.isValid() && current->parent) { mMimeData->setData(RingMimes::ACCOUNT , current->account->id()); } else if (index.isValid() && current) { @@ -822,7 +823,7 @@ bool ProfileModel::dropMimeData(const QMimeData *data, Qt::DropAction action, in const QByteArray accountId = data->data(RingMimes::ACCOUNT); Node* newProfile = nullptr; - int destIdx, indexOfAccountToMove = -1; // Where to insert in account list of profile + int destIdx = 0, indexOfAccountToMove = -1; // Where to insert in account list of profile if(!parent.isValid() && row < d_ptr->m_pProfileBackend->m_pEditor->m_lProfiles.size()) { qDebug() << "Dropping on profile title"; diff --git a/src/profilemodel.h b/src/profilemodel.h index 28cde02a..217e5d20 100644 --- a/src/profilemodel.h +++ b/src/profilemodel.h @@ -61,7 +61,7 @@ public: private: ProfileModelPrivate* d_ptr; - Q_DECLARE_PRIVATE(ProfileModel); + Q_DECLARE_PRIVATE(ProfileModel) //Singleton static ProfileModel* m_spInstance; diff --git a/src/tlsmethodmodel.cpp b/src/tlsmethodmodel.cpp index 55dfb4f0..0d149816 100644 --- a/src/tlsmethodmodel.cpp +++ b/src/tlsmethodmodel.cpp @@ -183,4 +183,4 @@ TlsMethodModel::Type TlsMethodModelPrivate::fromDaemonName(const QString& name) return TlsMethodModel::Type::DEFAULT; } -#include <tlsmethodmodel.moc> \ No newline at end of file +#include <tlsmethodmodel.moc> diff --git a/src/tlsmethodmodel.h b/src/tlsmethodmodel.h index 11a91213..e1afec2b 100644 --- a/src/tlsmethodmodel.h +++ b/src/tlsmethodmodel.h @@ -65,7 +65,7 @@ public: private: TlsMethodModelPrivate* d_ptr; - Q_DECLARE_PRIVATE(TlsMethodModel); + Q_DECLARE_PRIVATE(TlsMethodModel) }; Q_DECLARE_METATYPE(TlsMethodModel*) diff --git a/src/uri.cpp b/src/uri.cpp index e5956d0c..943129e5 100644 --- a/src/uri.cpp +++ b/src/uri.cpp @@ -39,7 +39,8 @@ private: QString* q_ptr; }; -URIPrivate::URIPrivate(QString* uri) : m_Parsed(false),m_HeaderType(URI::SchemeType::NONE),q_ptr(uri) +URIPrivate::URIPrivate(QString* uri) : m_Parsed(false),m_HeaderType(URI::SchemeType::NONE),q_ptr(uri), +m_hasChevrons(false) { } diff --git a/src/useractionmodel.h b/src/useractionmodel.h index 8323b2b1..d3be3cb1 100644 --- a/src/useractionmodel.h +++ b/src/useractionmodel.h @@ -73,7 +73,7 @@ public: }; Q_ENUMS(Action) - Q_PROPERTY(QSortFilterProxyModel* activeActionModel READ activeActionModel); + Q_PROPERTY(QSortFilterProxyModel* activeActionModel READ activeActionModel) //Constructor explicit UserActionModel(Call* parent); diff --git a/src/vcardutils.cpp b/src/vcardutils.cpp index 72a20024..520d66a4 100644 --- a/src/vcardutils.cpp +++ b/src/vcardutils.cpp @@ -49,16 +49,16 @@ void VCardUtils::startVCard(const QString& version) void VCardUtils::addProperty(const char* prop, const QString& value) { - if(value.isEmpty() || value == ";") + if (value.isEmpty() || value == QString(';')) return; - m_vCard << QString(QString::fromUtf8(prop) + ":" + value); + m_vCard << (QString::fromUtf8(prop) + ':' + value); } void VCardUtils::addProperty(const QString& prop, const QString& value) { - if(value.isEmpty() || value == ";") + if (value.isEmpty() || value == QString(';')) return; - m_vCard << QString(prop + ":" + value); + m_vCard << (prop + ':' + value); } void VCardUtils::addEmail(const QString& type, const QString& email) @@ -101,12 +101,12 @@ void VCardUtils::addContactMethod(const QString& type, const QString& num) void VCardUtils::addPhoto(const QByteArray img) { - m_vCard << QString(QString::fromUtf8(Property::PHOTO) + - QString::fromUtf8(Delimiter::SEPARATOR_TOKEN) + - "ENCODING=BASE64" + - QString::fromUtf8(Delimiter::SEPARATOR_TOKEN) + - "TYPE=PNG:" + - img.toBase64()); + m_vCard << (QString::fromUtf8(Property::PHOTO) + + QString::fromUtf8(Delimiter::SEPARATOR_TOKEN) + + "ENCODING=BASE64" + + QString::fromUtf8(Delimiter::SEPARATOR_TOKEN) + + "TYPE=PNG:" + + img.toBase64()); } const QByteArray VCardUtils::endVCard() diff --git a/src/video/channel.cpp b/src/video/channel.cpp index cb335727..beb9b3b0 100644 --- a/src/video/channel.cpp +++ b/src/video/channel.cpp @@ -24,7 +24,8 @@ #include "../private/videochannel_p.h" #include "../private/videodevice_p.h" -VideoChannelPrivate::VideoChannelPrivate() : m_pCurrentResolution(nullptr) +VideoChannelPrivate::VideoChannelPrivate() : m_pCurrentResolution(nullptr), +m_pDevice(nullptr) { } diff --git a/src/video/sourcesmodel.cpp b/src/video/sourcesmodel.cpp index ad7356d9..950462e2 100644 --- a/src/video/sourcesmodel.cpp +++ b/src/video/sourcesmodel.cpp @@ -61,6 +61,11 @@ d_ptr(new Video::SourcesModelPrivate()) d_ptr->m_Display.rect = QRect(0,0,0,0); } +Video::SourcesModel::~SourcesModel() +{ + delete d_ptr; +} + Video::SourcesModel* Video::SourcesModel::instance() { if (!m_spInstance) diff --git a/src/video/sourcesmodel.h b/src/video/sourcesmodel.h index 1e0cfcb4..782185c4 100644 --- a/src/video/sourcesmodel.h +++ b/src/video/sourcesmodel.h @@ -52,6 +52,7 @@ public: static Video::SourcesModel* instance(); private: explicit SourcesModel(); + virtual ~SourcesModel(); Video::SourcesModelPrivate* d_ptr; static Video::SourcesModel* m_spInstance; -- GitLab