From 05b1d851244fa45fc07d4d55426466596ccfc7fe Mon Sep 17 00:00:00 2001 From: Armin Felder Date: Sat, 9 Feb 2019 17:15:19 +0100 Subject: [PATCH] iqw --- container/sortedvector.cpp | 33 ++++++++++++++++----------------- rocketchat.cpp | 34 +++++++++++++++++----------------- 2 files changed, 33 insertions(+), 34 deletions(-) diff --git a/container/sortedvector.cpp b/container/sortedvector.cpp index 7f30dd6..f5c8ca7 100644 --- a/container/sortedvector.cpp +++ b/container/sortedvector.cpp @@ -31,13 +31,14 @@ int SortedVector::insertSort( const QSharedPointer &pointer ) this->append( pointer ); row = 0; } else { - auto elementSmallerThanNew = std::lower_bound(this->begin(),this->end(),pointer,[](const auto &first, const auto &second)->bool{ - return (*first)>(*second); - }); + auto elementSmallerThanNew = std::lower_bound( this->begin(), this->end(), pointer, []( const auto & first, const auto & second )->bool{ + return ( *first ) > ( *second ); + } ); + + this->insert( elementSmallerThanNew, pointer ); + row = elementSmallerThanNew - this->begin(); + } - insert(elementSmallerThanNew, pointer); - row = elementSmallerThanNew-begin(); -} return row; } @@ -45,11 +46,11 @@ template int SortedVector::findInsertPosition( const QSharedPointer &pointer ) const { int row = -1; - auto elementSmallerThanNew = std::lower_bound(this->begin(),this->end(),pointer,[](const auto &first, const auto &second)->bool{ - return (*first)>(*second); - }); + auto elementSmallerThanNew = std::lower_bound( this->begin(), this->end(), pointer, []( const auto & first, const auto & second )->bool{ + return ( *first ) > ( *second ); + } ); - row = elementSmallerThanNew-begin(); + row = elementSmallerThanNew - this->begin(); return row; } @@ -57,17 +58,15 @@ int SortedVector::findInsertPosition( const QSharedPointer &pointer ) cons template int SortedVector::findPosition( const QSharedPointer &pointer ) const { - int row = -1; - - auto pos = find(begin(),end(), pointer); - return pos - begin(); + auto pos = find( this->begin(), this->end(), pointer ); + return pos - this->begin(); } template void SortedVector::reOrder() { - std::sort(this->begin(),this->end(),[=](const auto &first, const auto &second)->bool{ - return (*first) >(*second); - }); + std::sort( this->begin(), this->end(), [ = ]( const auto & first, const auto & second )->bool{ + return ( *first ) > ( *second ); + } ); } diff --git a/rocketchat.cpp b/rocketchat.cpp index 7737ab1..1f37795 100755 --- a/rocketchat.cpp +++ b/rocketchat.cpp @@ -87,11 +87,11 @@ RocketChat::RocketChat( QGuiApplication *app ) #endif qRegisterMetaType( "ConnectionState" ); qRegisterMetaType( "Qt::ApplicationState" ); - qRegisterMetaType( "RocketChatServerData*" ); + qRegisterMetaType( "RocketChatServerData*" ); // qInstallMessageHandler( customOutput ); - qDebug()<<"threadId ctr"<(); - QtAndroid::androidActivity().callObjectMethod("openFile","(Ljava/lang/String;)Ljava/lang/String;",j); + QtAndroid::androidActivity().callObjectMethod( "openFile", "(Ljava/lang/String;)Ljava/lang/String;", j ); #elif defined(Q_OS_LINUX) - QDesktopServices::openUrl(pPath); + QDesktopServices::openUrl( pPath ); #elif defined (Q_OS_IOS) emit openIOSFileDialog( pPath ); #elif defined(Q_OS_WIN) - QDesktopServices::openUrl(pPath); + QDesktopServices::openUrl( pPath ); #elif defined(Q_OS_MACOS) - QDesktopServices::openUrl(pPath); + QDesktopServices::openUrl( pPath ); #endif @@ -608,7 +608,7 @@ void RocketChat::createPrivateGroup( const QString &pServerId, const QString &pC void RocketChat::registerServer( RocketChatServerData *pServer ) { - qDebug()<<"threadId register"<moveToThread( &mServerThread ); qDebug() << "add server to map"; @@ -671,7 +671,7 @@ void RocketChat::onUnreadCountChanged( const QString &pServerId, uint pUnread ) mUnreadSum[pServerId] = pUnread; // qDebug() << "onUnreadCountChanged"; - uint number = 0; + int number = 0; if ( mServerStatus ) { for ( auto count : mUnreadSum ) { -- GitLab