Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
chat
RocketChatMobileEngine
Commits
05b1d851
Commit
05b1d851
authored
Feb 09, 2019
by
armin
Browse files
iqw
parent
7625e5b9
Changes
2
Hide whitespace changes
Inline
Side-by-side
container/sortedvector.cpp
View file @
05b1d851
...
...
@@ -31,13 +31,14 @@ int SortedVector<T>::insertSort( const QSharedPointer<T> &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<typename T>
int
SortedVector
<
T
>::
findInsertPosition
(
const
QSharedPointer
<
T
>
&
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<T>::findInsertPosition( const QSharedPointer<T> &pointer ) cons
template
<
typename
T
>
int
SortedVector
<
T
>::
findPosition
(
const
QSharedPointer
<
T
>
&
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
<
typename
T
>
void
SortedVector
<
T
>::
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
);
}
);
}
rocketchat.cpp
View file @
05b1d851
...
...
@@ -87,11 +87,11 @@ RocketChat::RocketChat( QGuiApplication *app )
#endif
qRegisterMetaType
<
ConnectionState
>
(
"ConnectionState"
);
qRegisterMetaType
<
Qt
::
ApplicationState
>
(
"Qt::ApplicationState"
);
qRegisterMetaType
<
RocketChatServerData
*>
(
"RocketChatServerData*"
);
qRegisterMetaType
<
RocketChatServerData
*>
(
"RocketChatServerData*"
);
// qInstallMessageHandler( customOutput );
qDebug
()
<<
"threadId ctr"
<<
QThread
::
currentThreadId
();
qDebug
()
<<
"threadId ctr"
<<
QThread
::
currentThreadId
();
}
RocketChat
::~
RocketChat
()
...
...
@@ -305,7 +305,7 @@ void RocketChat::deleteMessage( QString rid, QString id )
QMetaObject
::
invokeMethod
(
mServerMap
.
first
(),
"deleteMessage"
,
Q_ARG
(
QString
,
rid
),
Q_ARG
(
QString
,
id
)
);
}
void
RocketChat
::
resetConnection
(
void
)
void
RocketChat
::
resetConnection
(
void
)
{
QMetaObject
::
invokeMethod
(
mServerMap
.
first
(),
"reconnect"
);
}
...
...
@@ -323,15 +323,15 @@ bool RocketChat::newServerByDomain( const QString &domain, bool pUnsecure = fals
mServerMap
.
clear
();
if
(
firstServer
!=
nullptr
)
{
connect
(
firstServer
,
&
RocketChatServerData
::
destroyed
,
[
=
,
serverptr
=
this
]()
{
connect
(
firstServer
,
&
RocketChatServerData
::
destroyed
,
[
=
,
serverptr
=
this
]()
{
qDebug
()
<<
"domain: "
<<
domain
;
Models
::
resetModels
();
qDebug
()
<<
"threadId destroyed"
<<
QThread
::
currentThreadId
();
Models
::
resetModels
();
qDebug
()
<<
"threadId destroyed"
<<
QThread
::
currentThreadId
();
RocketChatServerData
*
server
=
new
RocketChatServerData
(
domain
,
domain
,
pUnsecure
);
QMetaObject
::
invokeMethod
(
serverptr
,
"registerServer"
,
Q_ARG
(
RocketChatServerData
*
,
server
));
//registerServer( server );
newServerMutex
.
unlock
();
RocketChatServerData
*
server
=
new
RocketChatServerData
(
domain
,
domain
,
pUnsecure
);
QMetaObject
::
invokeMethod
(
serverptr
,
"registerServer"
,
Q_ARG
(
RocketChatServerData
*
,
server
)
);
//registerServer( server );
newServerMutex
.
unlock
();
}
);
QMetaObject
::
invokeMethod
(
firstServer
,
"deleteLater"
);
...
...
@@ -445,17 +445,17 @@ void RocketChat::openFileExternally( const QString &pPath )
#if defined( Q_OS_ANDROID)
QString
q
=
pPath
;
QAndroidJniObject
jniObject
=
QAndroidJniObject
::
fromString
(
q
);
QAndroidJniObject
jniObject
=
QAndroidJniObject
::
fromString
(
q
);
jstring
j
=
jniObject
.
object
<
jstring
>
();
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"
<<
QThread
::
currentThreadId
();
qDebug
()
<<
"threadId register"
<<
QThread
::
currentThreadId
();
pServer
->
moveToThread
(
&
mServerThread
);
qDebug
()
<<
"add server to map"
;
...
...
@@ -671,7 +671,7 @@ void RocketChat::onUnreadCountChanged( const QString &pServerId, uint pUnread )
mUnreadSum
[
pServerId
]
=
pUnread
;
// qDebug() << "onUnreadCountChanged";
u
int
number
=
0
;
int
number
=
0
;
if
(
mServerStatus
)
{
for
(
auto
count
:
mUnreadSum
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment