From 02b588cbd2ff1c48875f72d03b7b9288bccd176c Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> Date: Tue, 24 Jul 2012 16:55:05 -0400 Subject: [PATCH] [ #13801 ] Fix about 200 Krazy2 notification/warning/comments --- src/Account.cpp | 13 ++++----- src/Account.h | 2 +- src/AccountList.cpp | 2 +- src/AudioCodecModel.cpp | 2 +- src/AudioCodecModel.h | 2 +- src/Call.cpp | 2 +- src/CallModel.cpp | 2 +- src/Contact.cpp | 2 +- src/ContactBackend.cpp | 14 +++++----- src/ContactBackend.h | 2 +- src/CredentialModel.cpp | 2 +- src/CredentialModel.h | 2 +- src/HistoryModel.cpp | 6 ++--- src/HistoryModel.h | 2 +- src/InstantMessagingModel.cpp | 3 ++- src/InstantMessagingModel.h | 6 ++--- src/VideoCodecModel.cpp | 6 ++--- src/VideoCodecModel.h | 2 +- src/VideoDevice.cpp | 27 ++++++++++--------- src/VideoDevice.h | 20 +++++++------- src/VideoModel.cpp | 2 +- src/VideoModel.h | 2 +- src/VideoRenderer.cpp | 2 +- src/VideoRenderer.h | 2 +- ...nfigurationmanager_interface_singleton.cpp | 1 - src/dbus/metatypes.h | 2 +- src/sflphone_const.h | 2 +- src/typedefs.h | 2 +- 28 files changed, 68 insertions(+), 66 deletions(-) diff --git a/src/Account.cpp b/src/Account.cpp index 2351cb7c..ac2b36ce 100644 --- a/src/Account.cpp +++ b/src/Account.cpp @@ -494,23 +494,24 @@ bool Account::operator==(const Account& a)const * * ****************************************************************************/ #ifdef ENABLE_VIDEO -void Account::setActiveVideoCodecList(QList<VideoCodec*> codecs) +void Account::setActiveVideoCodecList(const QList<VideoCodec*>& codecs) { - QStringList codecs; + QStringList codecs2; VideoInterface& interface = VideoInterfaceSingleton::getInstance(); foreach(VideoCodec* codec,codecs) { - codecs << codecs->getName(); + codecs2 << codecs->getName(); } - interface.setActiveCodecList(codecs,m_pAccountId); + interface.setActiveCodecList(codecs2,m_pAccountId); } QList<VideoCodec*> Account::getActiveVideoCodecList() { QList<VideoCodec*> codecs; VideoInterface& interface = VideoInterfaceSingleton::getInstance(); - foreach (QString codec, interface.getActiveCodecList(m_pAccountId)) { + const QStringList activeCodecList = interface.getActiveCodecList(m_pAccountId); + foreach (const QString& codec, activeCodecList) { codecs << VideoCodec::getCodec(codec); } } -#endif \ No newline at end of file +#endif diff --git a/src/Account.h b/src/Account.h index 07d67239..2e66943f 100644 --- a/src/Account.h +++ b/src/Account.h @@ -176,7 +176,7 @@ class LIB_EXPORT Account : public QObject { void setAccountDetails (const MapStringString& m ); bool setAccountDetail (const QString& param, const QString& val ); #ifdef ENABLE_VIDEO - void setActiveVideoCodecList(QList<VideoCodec*> codecs); + void setActiveVideoCodecList(const QList<VideoCodec*>& codecs); QList<VideoCodec*> getActiveVideoCodecList(); #endif ///Set the account alias diff --git a/src/AccountList.cpp b/src/AccountList.cpp index 620f16e3..0aeb5edc 100644 --- a/src/AccountList.cpp +++ b/src/AccountList.cpp @@ -259,7 +259,7 @@ QString AccountList::getOrderedList() const { QString order; for( int i = 0 ; i < size() ; i++) { - order += getAccountAt(i)->getAccountId() + "/"; + order += getAccountAt(i)->getAccountId() + '/'; } return order; } diff --git a/src/AudioCodecModel.cpp b/src/AudioCodecModel.cpp index f5b11ce7..c15254a9 100644 --- a/src/AudioCodecModel.cpp +++ b/src/AudioCodecModel.cpp @@ -143,4 +143,4 @@ bool AudioCodecModel::moveDown(QModelIndex idx) return true; } return false; -} \ No newline at end of file +} diff --git a/src/AudioCodecModel.h b/src/AudioCodecModel.h index ec50ca26..3321f633 100644 --- a/src/AudioCodecModel.h +++ b/src/AudioCodecModel.h @@ -65,4 +65,4 @@ private: }; -#endif \ No newline at end of file +#endif diff --git a/src/Call.cpp b/src/Call.cpp index db2b44fb..e2734e8c 100644 --- a/src/Call.cpp +++ b/src/Call.cpp @@ -962,4 +962,4 @@ void Call::updatePlayback(int position,int size) void Call::contactBackendChanged() { m_ContactChanged = true; -} \ No newline at end of file +} diff --git a/src/CallModel.cpp b/src/CallModel.cpp index bc5dd6eb..70fd6b8c 100644 --- a/src/CallModel.cpp +++ b/src/CallModel.cpp @@ -227,4 +227,4 @@ void CallModelBase::addPrivateCall(Call* call) { addCall(call,0); } -//More code in CallModel.hpp \ No newline at end of file +//More code in CallModel.hpp diff --git a/src/Contact.cpp b/src/Contact.cpp index 69603619..7ec52e51 100644 --- a/src/Contact.cpp +++ b/src/Contact.cpp @@ -208,4 +208,4 @@ QHash<QString,QVariant> Contact::toHash() aContact[ "group" ] = getGroup(); aContact[ "department" ] = getDepartment(); return aContact; -} \ No newline at end of file +} diff --git a/src/ContactBackend.cpp b/src/ContactBackend.cpp index 1dbb4cda..ddfbdd9e 100644 --- a/src/ContactBackend.cpp +++ b/src/ContactBackend.cpp @@ -56,10 +56,10 @@ ContactList ContactBackend::update() ///Return the extension/user of an URI (<sip:12345@exemple.com>) QString ContactBackend::getUserFromPhone(QString phoneNumber) { - if (phoneNumber.indexOf("@") != -1) { - QString user = phoneNumber.split("@")[0]; - if (user.indexOf(":") != -1) { - return user.split(":")[1]; + if (phoneNumber.indexOf('@') != -1) { + QString user = phoneNumber.split('@')[0]; + if (user.indexOf(':') != -1) { + return user.split(':')[1]; } else { return user; @@ -71,8 +71,8 @@ QString ContactBackend::getUserFromPhone(QString phoneNumber) ///Return the domaine of an URI (<sip:12345@exemple.com>) QString ContactBackend::getHostNameFromPhone(QString phoneNumber) { - if (phoneNumber.indexOf("@") != -1) { - return phoneNumber.split("@")[1].left(phoneNumber.split("@")[1].size()-1); + if (phoneNumber.indexOf('@') != -1) { + return phoneNumber.split('@')[1].left(phoneNumber.split('@')[1].size()-1); } return ""; -} \ No newline at end of file +} diff --git a/src/ContactBackend.h b/src/ContactBackend.h index 8899cae7..d755a92d 100644 --- a/src/ContactBackend.h +++ b/src/ContactBackend.h @@ -76,4 +76,4 @@ signals: }; -#endif \ No newline at end of file +#endif diff --git a/src/CredentialModel.cpp b/src/CredentialModel.cpp index dd7329c4..05e2fecd 100644 --- a/src/CredentialModel.cpp +++ b/src/CredentialModel.cpp @@ -103,4 +103,4 @@ void CredentialModel::clear() delete data; } m_lCredentials.clear(); -} \ No newline at end of file +} diff --git a/src/CredentialModel.h b/src/CredentialModel.h index 0d6013a0..c94dd9a3 100644 --- a/src/CredentialModel.h +++ b/src/CredentialModel.h @@ -61,4 +61,4 @@ private: }; -#endif \ No newline at end of file +#endif diff --git a/src/HistoryModel.cpp b/src/HistoryModel.cpp index 39f95a93..fbd09a13 100644 --- a/src/HistoryModel.cpp +++ b/src/HistoryModel.cpp @@ -58,8 +58,8 @@ CallMap HistoryModel::m_sHistoryCalls ; HistoryModel::HistoryModel():m_HistoryInit(false) { ConfigurationManagerInterface& configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); - QVector< QMap<QString, QString> > history = configurationManager.getHistory(); - foreach (MapStringString hc, history) { + const QVector< QMap<QString, QString> > history = configurationManager.getHistory(); + foreach (const MapStringString& hc, history) { Call* pastCall = Call::buildHistoryCall( hc[ CALLID_KEY ] , hc[ TIMESTAMP_START_KEY ].toUInt(), @@ -158,4 +158,4 @@ const QStringList HistoryModel::getNumbersByPopularity() } return cl; -} //getNumbersByPopularity \ No newline at end of file +} //getNumbersByPopularity diff --git a/src/HistoryModel.h b/src/HistoryModel.h index bbc85039..d3b638fe 100644 --- a/src/HistoryModel.h +++ b/src/HistoryModel.h @@ -77,4 +77,4 @@ signals: void newHistoryCall ( Call* call ); }; -#endif \ No newline at end of file +#endif diff --git a/src/InstantMessagingModel.cpp b/src/InstantMessagingModel.cpp index 8417e07f..5c7c8c69 100644 --- a/src/InstantMessagingModel.cpp +++ b/src/InstantMessagingModel.cpp @@ -17,6 +17,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * ***********************************************************************************/ #include "InstantMessagingModel.h" + #include "CallModel.h" #include "callmanager_interface_singleton.h" #include "Call.h" @@ -123,4 +124,4 @@ void InstantMessagingModel::addOutgoingMessage(QString message) im.message = message; m_lMessages << im; emit dataChanged(index(m_lMessages.size() -1,0), index(m_lMessages.size()-1,0)); -} \ No newline at end of file +} diff --git a/src/InstantMessagingModel.h b/src/InstantMessagingModel.h index c4123e44..81a1e38a 100644 --- a/src/InstantMessagingModel.h +++ b/src/InstantMessagingModel.h @@ -52,7 +52,7 @@ public: } InstantMessagingModel* getModel(Call* call); private: - InstantMessagingModelManager(); + explicit InstantMessagingModelManager(); static InstantMessagingModelManager* m_spInstance; static CallModelBase* m_spCallModel; QHash<QString,InstantMessagingModel*> m_lModels; @@ -75,7 +75,7 @@ public: static const int MESSAGE_IMAGE_ROLE = 103; static const int MESSAGE_CONTACT_ROLE = 104; - InstantMessagingModel(Call* call, QObject* parent = nullptr); + explicit InstantMessagingModel(Call* call, QObject* parent = nullptr); QVariant data ( const QModelIndex& index, int role = Qt::DisplayRole ) const; int rowCount ( const QModelIndex& parent = QModelIndex() ) const; Qt::ItemFlags flags ( const QModelIndex& index ) const; @@ -95,4 +95,4 @@ private: }; -#endif \ No newline at end of file +#endif diff --git a/src/VideoCodecModel.cpp b/src/VideoCodecModel.cpp index b8f32f9f..8196ce25 100644 --- a/src/VideoCodecModel.cpp +++ b/src/VideoCodecModel.cpp @@ -76,8 +76,8 @@ void VideoCodecModel::reload() { m_lCodecs.clear(); VideoInterface& interface = VideoInterfaceSingleton::getInstance(); - VectorMapStringString codecs = interface.getCodecs(m_pAccount->getAccountId()); - foreach(MapStringString h,codecs) { + const VectorMapStringString codecs = interface.getCodecs(m_pAccount->getAccountId()); + foreach(const MapStringString& h,codecs) { VideoCodec* c = new VideoCodec(h["name"],h["bitrate"].toInt(),h["enabled"]=="true"); m_lCodecs << c; } @@ -164,4 +164,4 @@ void VideoCodec::setBitrate(const uint bitrate) void VideoCodec::setEnabled(const bool enabled) { m_Enabled = enabled; -} \ No newline at end of file +} diff --git a/src/VideoCodecModel.h b/src/VideoCodecModel.h index 6a5c59f0..d87f4638 100644 --- a/src/VideoCodecModel.h +++ b/src/VideoCodecModel.h @@ -88,4 +88,4 @@ class LIB_EXPORT VideoCodec { bool m_Enabled; static bool m_sInit; }; -#endif \ No newline at end of file +#endif diff --git a/src/VideoDevice.cpp b/src/VideoDevice.cpp index 68dd6924..e43c56b3 100644 --- a/src/VideoDevice.cpp +++ b/src/VideoDevice.cpp @@ -28,12 +28,12 @@ VideoDevice::VideoDevice(QString id) : m_DeviceId(id) } ///Get the video device list -QList<VideoDevice*> VideoDevice::getDeviceList() +const QList<VideoDevice*> VideoDevice::getDeviceList() { QHash<QString,VideoDevice*> devices; VideoInterface& interface = VideoInterfaceSingleton::getInstance(); - QStringList deviceList = interface.getDeviceList(); - foreach(QString device,deviceList) { + const QStringList deviceList = interface.getDeviceList(); + foreach(const QString& device,deviceList) { if (!m_slDevices[device]) devices[device] = new VideoDevice(device); else @@ -55,14 +55,14 @@ VideoDevice* VideoDevice::getDevice(QString name) } ///Get the valid rates for this device -QStringList VideoDevice::getRateList(VideoChannel channel, Resolution resolution) +const QStringList VideoDevice::getRateList(VideoChannel channel, Resolution resolution) { VideoInterface& interface = VideoInterfaceSingleton::getInstance(); return interface.getDeviceRateList(m_DeviceId,channel,resolution.toString()); } ///Get the valid channel list -QList<VideoChannel> VideoDevice::getChannelList() +const QList<VideoChannel> VideoDevice::getChannelList() { VideoInterface& interface = VideoInterfaceSingleton::getInstance(); return interface.getDeviceChannelList(m_DeviceId); @@ -90,39 +90,40 @@ void VideoDevice::setChannel(VideoChannel channel) //??? No device } ///Get the current resolution -Resolution VideoDevice::getResolution() +const Resolution VideoDevice::getResolution() { VideoInterface& interface = VideoInterfaceSingleton::getInstance(); return Resolution(interface.getActiveDeviceSize()); } ///Get the current channel -VideoChannel VideoDevice::getChannel() //??? No device +const VideoChannel VideoDevice::getChannel() //??? No device { VideoInterface& interface = VideoInterfaceSingleton::getInstance(); return interface.getActiveDeviceChannel(); } ///Get the current rate -VideoRate VideoDevice::getRate() +const VideoRate VideoDevice::getRate() { VideoInterface& interface = VideoInterfaceSingleton::getInstance(); return interface.getActiveDeviceRate(); } ///Get a list of valid resolution -QList<Resolution> VideoDevice::getResolutionList(VideoChannel channel) +const QList<Resolution> VideoDevice::getResolutionList(VideoChannel channel) { QList<Resolution> toReturn; VideoInterface& interface = VideoInterfaceSingleton::getInstance(); - QStringList list = interface.getDeviceSizeList(m_DeviceId,channel); - foreach(QString res,list) { + const QStringList list = interface.getDeviceSizeList(m_DeviceId,channel); + foreach(const QString& res,list) { toReturn << Resolution(res); } return toReturn; } -QString VideoDevice::getDeviceId() +///Get the device id +const QString VideoDevice::getDeviceId() const { return m_DeviceId; -} \ No newline at end of file +} diff --git a/src/VideoDevice.h b/src/VideoDevice.h index e3457313..6fcebe1e 100644 --- a/src/VideoDevice.h +++ b/src/VideoDevice.h @@ -42,7 +42,7 @@ struct LIB_EXPORT Resolution { Resolution(const Resolution& res):width(res.width),height(res.height){} Resolution(const QSize& size):width(size.width()),height(size.height()){} //Getter - QString toString() { return QString::number(width)+"x"+QString::number(height);} + const QString toString() const { return QString::number(width)+"x"+QString::number(height);} //Attributes uint width; @@ -61,16 +61,16 @@ class LIB_EXPORT VideoDevice { static VideoDevice* getDevice(QString id); //Getter - QStringList getRateList(VideoChannel channel, Resolution resolution); - QList<Resolution> getResolutionList(VideoChannel channel); - QList<VideoChannel> getChannelList (); - Resolution getResolution (); - VideoChannel getChannel (); - VideoRate getRate (); - QString getDeviceId (); + const QStringList getRateList(VideoChannel channel, Resolution resolution); + const QList<Resolution> getResolutionList(VideoChannel channel); + const QList<VideoChannel> getChannelList (); + const Resolution getResolution (); + const VideoChannel getChannel (); + const VideoRate getRate (); + const QString getDeviceId () const; //Static getter - static QList<VideoDevice*> getDeviceList(); + static const QList<VideoDevice*> getDeviceList(); //Setter void setRate ( VideoRate rate ); @@ -85,4 +85,4 @@ class LIB_EXPORT VideoDevice { static QHash<QString,VideoDevice*> m_slDevices; static bool m_sInit; }; -#endif \ No newline at end of file +#endif diff --git a/src/VideoModel.cpp b/src/VideoModel.cpp index b792881a..43302490 100644 --- a/src/VideoModel.cpp +++ b/src/VideoModel.cpp @@ -164,4 +164,4 @@ void VideoModel::stoppedDecoding(QString id, QString shmPath) emit videoStopped(); // if (m_pTimer) // m_pTimer->stop(); -} \ No newline at end of file +} diff --git a/src/VideoModel.h b/src/VideoModel.h index 511efaf4..8eb56520 100644 --- a/src/VideoModel.h +++ b/src/VideoModel.h @@ -81,4 +81,4 @@ signals: void videoCallInitiated(VideoRenderer*); }; -#endif \ No newline at end of file +#endif diff --git a/src/VideoRenderer.cpp b/src/VideoRenderer.cpp index 9071ae4d..0a502e43 100644 --- a/src/VideoRenderer.cpp +++ b/src/VideoRenderer.cpp @@ -308,4 +308,4 @@ void VideoRenderer::setResolution(QSize size) void VideoRenderer::setShmPath(QString path) { m_ShmPath = path; -} \ No newline at end of file +} diff --git a/src/VideoRenderer.h b/src/VideoRenderer.h index bfbfa45e..5c647d38 100644 --- a/src/VideoRenderer.h +++ b/src/VideoRenderer.h @@ -90,4 +90,4 @@ class LIB_EXPORT VideoRenderer : public QObject { }; -#endif \ No newline at end of file +#endif diff --git a/src/configurationmanager_interface_singleton.cpp b/src/configurationmanager_interface_singleton.cpp index e1772723..37628d74 100644 --- a/src/configurationmanager_interface_singleton.cpp +++ b/src/configurationmanager_interface_singleton.cpp @@ -34,4 +34,3 @@ ConfigurationManagerInterface & ConfigurationManagerInterfaceSingleton::getInsta } return *interface; } - diff --git a/src/dbus/metatypes.h b/src/dbus/metatypes.h index e86ef685..a059e542 100644 --- a/src/dbus/metatypes.h +++ b/src/dbus/metatypes.h @@ -26,4 +26,4 @@ inline void registerCommTypes() { dbus_metaTypeInit = true; } -#endif \ No newline at end of file +#endif diff --git a/src/sflphone_const.h b/src/sflphone_const.h index 3b4fa6c1..f7b69856 100644 --- a/src/sflphone_const.h +++ b/src/sflphone_const.h @@ -312,4 +312,4 @@ static const QString empty(""); #define TIMESTAMP_STOP_KEY "timestamp_stop" #define MISSED_STRING "missed" #define INCOMING_STRING "incoming" -#define OUTGOING_STRING "outgoing" \ No newline at end of file +#define OUTGOING_STRING "outgoing" diff --git a/src/typedefs.h b/src/typedefs.h index d8bf6c89..e2241ae8 100644 --- a/src/typedefs.h +++ b/src/typedefs.h @@ -52,4 +52,4 @@ typedef QMap<QString, int> MapStringInt; #endif -#endif \ No newline at end of file +#endif -- GitLab