1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00
Commit Graph

4017 Commits

Author SHA1 Message Date
iphydf
e71225268f
chore: Various code cleanups.
* Reorder class data members and/or constructor initialisers to match,
  reducing confusion about when members will be initialised.
* Remove (most) unused variables. Not removed: some global variables with
  `TODO(sudden6)` on them for using them in the future. I don't know how
  far into the future sudden6 wants to use them, so I left them there for
  now.
* Distinguish different bootstrap nodes in the logs by index in the
  bootstrap node list. Originally, we used to log the address/port of the
  node we're bootstrapping to. This was removed out of privacy concerns
  (even though the bootstrap nodes are public). This made the logs much
  less useful when debugging why the client isn't connecting. Having
  indices makes it easier to see that different nodes are being selected,
  and makes it possible to determine which node was selected.
* Explicitly cast unused results of Tox API functions to `void` when all
  we want is to know whether the function succeeds or not.
* Don't try to `#include <unistd.h>` on Windows. It does not exist on
  MSVC.
* Remove extra `;` after function definitions.
* Remove reference indirection of QJsonValueRef, since a copy of that ref
  (small pointer-like object) has to be made anyway when iterating over
  QJsonArrays.
* Make some file-scope global state `static`.
* Use `nullptr` instead of `NULL`.
* Add `#if DESKTOP_NOTIFICATIONS` around the code that implements desktop
  notifications, so it becomes a bit easier to compile everything with a
  single compiler command - useful for manually running static analysers.
* Fix an error on MSVC where `disconnect` is looked up to be a non-static
  member function and the `this` capture is missing.
* Consistently use `struct` and `class` tags for types.
* Use references in ranged-for where it reduces copies.
* Move private static data members out of the Style class and into
  file-local scope. There is no need for them to be in the class. Also
  marked them `const` where possible.
* Removed unused lambda capture.
* Ensure qTox can compile under NDEBUG with `-Wunused-variable` by
  inlining the unused variable into the `assert` that was its only
  target.
* Minor reformatting in core_test.cpp.
2020-04-16 19:07:40 +00:00
Anthony Bilinski
deb7fbb67c
fix(db): Add half-upgraded cipher params
Our previous SQLCiper upgrade code attempted to set SQLCipher 4.0
default params. If SQLCipher 3.x was used at that time, it would result
in only half upgrading the params, since SQLCipher 3.x doesn't support
PRAGMA cipher_hmac_algorithm or PRAGMA cipher_kdf_algorithm. This means
that our databases could be saved with any of three sets of SQLCipher
params.
2020-04-14 23:38:44 -07:00
Anthony Bilinski
2fe1918083
feat(ipc): make IPC user specific
This allows multiple users on a system each running qTox to use IPC at once.

Fix #6076
2020-04-14 20:32:12 -07:00
Anthony Bilinski
d028f9e394
chore(cleanup): replace remaining deprecated toxcore enums
Some were missed in 5ae738f818.

Fix #5997
2020-04-13 09:25:20 -07:00
TriKriSta
c13ede85df
fix(ui): add vertical spacer to profileform 2020-04-13 00:56:39 -07:00
Anthony Bilinski
7b7950e7f7
revert(chatlog): "load messages from the database after date"
This reverts commit b705ac8060.
2020-04-12 22:40:11 -07:00
Anthony Bilinski
c75d8c8d3e
revert(chatlog): "edit function "Load chat history""
This reverts commit 6de1173c17.
2020-04-12 22:40:11 -07:00
Anthony Bilinski
8e03aa4b17
revert(chatlog): "edit load history in search"
This reverts commit 8c4b1e00a1.
2020-04-12 22:40:10 -07:00
Anthony Bilinski
5efb0ba020
revert(chatlog): "add action "Go to current date""
This reverts commit 2a9648d12c.
2020-04-12 22:40:10 -07:00
Anthony Bilinski
8c3f3199ef
revert(chatlog): "edit position chat after load history"
This reverts commit c2d5b422b3.
2020-04-12 22:40:10 -07:00
Anthony Bilinski
ccc7107f92
revert(chatlog): "remove part messages from chat"
This reverts commit 4c7ecb6024.
2020-04-12 22:40:10 -07:00
Anthony Bilinski
3f36b31f8b
revert(chatlog): "simple edit code"
This reverts commit b807998fe9.
2020-04-12 22:40:10 -07:00
Anthony Bilinski
8f167f45a3
revert(chatlog): "edit load history when scrolling"
This reverts commit 0a9e72020e.
2020-04-12 22:40:10 -07:00
Anthony Bilinski
bd0ef5de82
revert(chatlog): "prohibition to remove messages in group chat"
This reverts commit 5aeac56b76.
2020-04-12 22:40:09 -07:00
Anthony Bilinski
3ac6b578df
revert(chatlog): "fix a crash when there are no messages to load"
This reverts commit 040c6b95ae.
2020-04-12 22:40:09 -07:00
Anthony Bilinski
35c5e77a8a
revert(chatlog): "fix: data validation during the search"
This reverts commit acb91ed731.
2020-04-12 22:40:09 -07:00
Anthony Bilinski
6395ce3aae
revert(chatlog): "feat: check chat status before start a search"
This reverts commit ce570927b1.
2020-04-12 22:40:09 -07:00
Anthony Bilinski
c1d0624b5d
revert(chatlog): "feat: save selected search text after scrolling up"
This reverts commit dbf880078e.
2020-04-12 22:40:09 -07:00
Anthony Bilinski
83d5863bbe
revert(chatlog): "optimize load messages during the search"
This reverts commit 6de307e6b9.
2020-04-12 22:40:09 -07:00
Anthony Bilinski
306bbb424e
revert(chatlog): "update workerStb"
This reverts commit 177bf12f11.
2020-04-12 22:40:08 -07:00
Anthony Bilinski
4cd443ae7b
revert(chatlog): "scroll bar stuck to bottom (fix #5755)"
This reverts commit 38df897e02.
2020-04-12 22:40:08 -07:00
Anthony Bilinski
efff8d53c9
revert(chatlog): "add comments for functions that load history"
This reverts commit 5fc1afbab5.
2020-04-12 22:40:08 -07:00
Anthony Bilinski
5d44cd773f
revert(chatlog): partially revert "prevent invalid history access"
This partially reverts commit e3e6e1d9c4.
2020-04-12 22:40:08 -07:00
Anthony Bilinski
b04639c6d0
revert(chatlog): "fix stick to bottom behavior"
This reverts commit f2fa601073.
2020-04-12 22:40:08 -07:00
Anthony Bilinski
5da1e4b9a8
revert(chatlog): "enable dynamic view range in chatlog with history disabled"
This reverts commit a7f3495956.
2020-04-12 22:40:08 -07:00
Anthony Bilinski
6e2ac12d84
fix(avatar): reject avatars that are larger than 64KB
This will prevent qTox from auto-accepting arbitrarily large avatars. Avatars
are already limited by TCS 2.2.4 to 64KB, so we would only receive larger
avatars from badly behaving clients.
2020-04-10 15:32:35 -07:00
bodwok
d01fed92f0
fix(ui): updating friends list color at runtime 2020-04-09 15:53:02 +03:00
bodwok
1aad91944e
fix(chatlog): fixed rendering of new messages when scrolling up 2020-04-07 19:58:00 +03:00
Jimi Huotari
6a59f0fe4d refactor(Qt): fix build with Qt 5.15 again
A deprecated function was previously replaced with an overload that
also got recently deprecated [1].

1. https://code.qt.io/cgit/qt/qtbase.git/commit/?h=5.15&id=46ebd11e
2020-04-03 00:39:46 +03:00
Anthony Bilinski
ef8c2b7cb3
Merge branch 'v1.17-dev' 2020-03-28 01:43:40 -07:00
Anthony Bilinski
4f7056385f
refactor: remove dependency on libfilteraudio
The audio filtering/echo compensation didn't ever work reliably, so just
remove it.
2020-03-23 18:24:23 -07:00
Anthony Bilinski
ad042b09e0
chore(cleanup): don't add semicolon to Q_DECLARE_METATYPE
It is uneeded and prevents enabling of warnings for uneeded semicolons after
classes or namespaces

Fix #6007
2020-03-23 18:21:14 -07:00
Anthony Bilinski
5ae738f818
chore(cleanup): replace remaining deprecated toxcore enums with newer versions
Fix #5997
2020-03-23 18:20:39 -07:00
Anthony Bilinski
f373107f63
chore(cleanup): add Wunknown-pragmas, fix pragma typos
Fix #6035
2020-03-23 18:04:35 -07:00
Anthony Bilinski
715794f664
chore(build): fix implicit narrowing warning by making it explicit
Exact accuracy isn't needed for the normalized value, being off by one part per
quadrillion is ok.

Fix #6000
2020-03-22 04:06:45 -07:00
Anthony Bilinski
2b981d88a2
fix(interface): use virtual destructors for all interfaces
Avoids memory leak if derived classes are deleted through interface pointer.

Fix #6006
2020-03-22 01:59:24 -07:00
Anthony Bilinski
f53e44b62c
chore(cleanup): don't std::move for return statement
std::moveing prevents RVO, and even in cases where RVO can't take place, move
will be used if possible.

Fix #6011
2020-03-22 01:39:10 -07:00
Anthony Bilinski
70824729ff
chore(cleanup): don't use 0 as nullptr
Don't add Wzero-as-null-pointer-constant by default, since on older Qt
versions that we stil support and that our CI runs agains, Qt API themselves
cause warnings which lead to build errors all over the place.

Fix #6008
2020-03-21 23:20:03 -07:00
Anthony Bilinski
f756dbae2a
chore(cleanup): don't explicitly initialize std::unique_ptr to nullptr
Fix #6009
2020-03-21 22:15:03 -07:00
Anthony Bilinski
2c1a86482a
chore(style): remove old style casts and cross sign comparisons
Enable warnings for both. Favour casting to signed rather than casting to
unsigend for comparisons. Per isocpp's core guidelines ES.102, signed
arithmetic gives more expected results. If we need one extra bit of range,
using longer signed types achives that.

Fix #6010
Fix #6012
2020-03-21 20:29:10 -07:00
Anthony Bilinski
a7f3495956
fix(chatlog): enable dynamic view range in chatlog with history disabled
Message caching is handled by SessionChatLog in memory even when history is
disabled. ChatLog doesn't need to worry about how the messages its rendering
are being stored. Dynamic loading up and down in chatlog is sitll functional.
2020-03-21 19:41:22 -07:00
Anthony Bilinski
c906cdf57b
fix(history): check history settings when getting initial chatlog idx
Checking if history pointer is valid is not sufficient, the setting must also
be checked. This caused asserts in history when history was disabled in
settings.
2020-03-21 01:45:46 -07:00
sudden6
b5785a1b0c
fix: add missing type for Qt slot
(cherry picked from commit ad139d67c2)
2020-03-20 02:26:22 -07:00
sudden6
df7fe22398
fix(toxcall): move ToxCall ownership to correct Thread
Makes the CoreAV thread own all ToxCalls in order to prevent signals
from being emitted via a Direct connection from Audio to CoreAV.

(cherry picked from commit 6b468e41fa)
2020-03-20 02:26:18 -07:00
Mick Sayson
caf4f59fb2
feat(groups): Allow being in group call if only member
In other applications chatrooms allow you to idle in a call and have
people hop in and out as desired. If a user is the only one presently
online in a group but knows someone will be joining shortly they should
be able to join the call ahead of time.

(cherry picked from commit 46d57c6864)
2020-03-20 02:26:08 -07:00
sudden6
f02943c191
fix(toxcall): handle Null sink correctly
This was introduced in 82a4f1b412

(cherry picked from commit bf3921ce94)
2020-03-20 02:07:57 -07:00
Anthony Bilinski
3a5e28fffb
fix(model): take QObject receiver argument to interface signal connection macro
receiver QObject is used by Qt to automatically deregister the connection when
the receiver is destroyed. Forward it on to Qt's connect.

(cherry picked from commit 24e4ec3751)
2020-03-20 02:07:20 -07:00
Anthony Bilinski
b7062b2518
fix(model): stop interfaces from inheriting from QObject
Qt doesn't support QObject multiple inheritance, so use our existing interface
macros to declare signals in the interface without QObject, and implement them
in child classes.

(cherry picked from commit 82a4f1b412)
2020-03-20 02:07:20 -07:00
Anthony Bilinski
40e43586f1
fix(model): return connection from interface macro
connection is normally returned from Qt's connect, and the caller may want to
track the connection to manually disconnect it.

(cherry picked from commit 41b2b35ce3)
2020-03-20 02:07:19 -07:00
sudden6
dfeca3e906
fix(coreav): prevent racy access to call variable
(cherry picked from commit c507d2665d)
2020-03-20 02:07:19 -07:00
sudden6
26fcea0639
fix(coreav): change some lock to write locks
I missed some cases where data was written.

(cherry picked from commit dfcfb7d5e0)
2020-03-20 02:07:19 -07:00
sudden6
e340688b94
fix(coreav): fix assert because c-toxcore calls from unexpected thread
c-toxcore calls the groupCallCallback from it's main thread instead of
the ToxAV thread as expected, this was triggering an assertion.

Aditionally the destructors of Core and CoreAV were fixed, because they
now either crashed or deadlocked qTox when it was closed while a group
call was still running.

(cherry picked from commit 141cbf8870)
2020-03-20 02:07:18 -07:00
sudden6
723a8e5dc7
fix(coreav): avoid deadlock between CoreAV, main and Audio thread
This actually fixes two problems:

1) CoreAV and Audio thread both locked the callsLock and audioLock in
different orders, resulting in a deadlock of both threads. This fixed by
using a ReadWriteLock in the CoreAV thread.

2) Multiple functions were emitting signals while holding a lock. This
is unsafe, because the connected slot may acquire any other lock. This
is fixed by releasing the locks before emitting signals.

(cherry picked from commit 4b9e4a571d)
2020-03-20 02:07:18 -07:00
sudden6
a4ac6d67c7
fix(coreav): cleanup assertions
It doesn't really make sense to assert that the callbacks are coming
from any other thread than CoreAV, when we actually want to ensure the
callback is coming from Core thread.

Remove over agressive assert from sendGroupCallAudio(...), this function
should be callable from any thread.

(cherry picked from commit 9499925fb2)
2020-03-20 02:07:18 -07:00
sudden6
89400c91f7
refactor: properly lock against Core thread
We we're calling toxav_* functions without synchronizing to any of the
Tox threads.

Additionally remove the call timeout, it creates timers from different
threads, which causes errors.

(cherry picked from commit 98cfe9838f)
2020-03-20 02:07:17 -07:00
sudden6
8e54805e7d
feat(coreav): add assertions to check for threading errors 2020-03-20 02:06:49 -07:00
sudden6
cf402bd11c
refactor(coreav): simplify start sequence
(cherry picked from commit c332cc0cca)
2020-03-20 02:05:47 -07:00
sudden6
f72b3397a5
refactor(coreav): move threading of CoreAV to single mutex
Use a standard mutex instead of trying to build proper locking
ourselfes.

(cherry picked from commit 2bc0057bbd)
2020-03-20 02:05:47 -07:00
Anthony Bilinski
e5a6708877
Merge branch 'v1.17-dev' 2020-03-19 13:21:14 -07:00
sudden6
4345fafbc6
Merge pull request #6005
Jimi Huotari (1):
      refactor(Qt): fix build with Qt 5.15
2020-03-19 01:22:31 +01:00
sudden6
ad139d67c2
fix: add missing type for Qt slot 2020-03-17 18:06:21 +01:00
Jimi Huotari
6d51971c6f refactor(Qt): fix build with Qt 5.15
This fixes compile-time warnings about deprecated functions when
building with Qt 5.15.
2020-03-17 13:31:36 +02:00
sudden6
6b468e41fa
fix(toxcall): move ToxCall ownership to correct Thread
Makes the CoreAV thread own all ToxCalls in order to prevent signals
from being emitted via a Direct connection from Audio to CoreAV.
2020-03-17 11:56:56 +01:00
sudden6
f2fa601073
fix(chatlog): fix stick to bottom behavior
This commit fixes the behavior when a message is received while the
chatlog is scrolled to the bottom. With this change, the chatlog will
stick to the bottom when it is scrolled all the way down. If it is
somewhere in the middle (e.g. for search) the chatlog will not change
its position.
2020-03-15 16:45:09 +01:00
Anthony Bilinski
0b5f751104
fix(core): message when peer changes group name
boolean inversion in getGroupPeerName caused it to always return empty string

Fix #6001
2020-03-15 01:29:11 -07:00
sudden6
bf3921ce94
fix(toxcall): handle Null sink correctly
This was introduced in 82a4f1b412
2020-03-03 19:49:13 +01:00
sudden6
7e4f7f0489
fix: remove unused variables 2020-03-03 00:38:53 -08:00
sudden6
1158faee07
chore: update copyright date in About 2020-03-03 00:38:45 -08:00
sudden6
e67cdadf3d
fix: remove unused variables 2020-03-01 16:59:14 +01:00
sudden6
1f4fee0e4c
chore: update copyright date in About 2020-03-01 00:42:52 +01:00
sudden6
08fda121f0
Merge pull request #5982
Mick Sayson (1):
      feat(groups): Allow being in group call if only member
2020-02-28 18:23:21 +01:00
Mick Sayson
46d57c6864 feat(groups): Allow being in group call if only member
In other applications chatrooms allow you to idle in a call and have
people hop in and out as desired. If a user is the only one presently
online in a group but knows someone will be joining shortly they should
be able to join the call ahead of time.
2020-02-23 11:48:35 -08:00
Anthony Bilinski
13cf04fad9
Merge branch 'v1.17-dev' 2020-02-22 14:18:26 -08:00
Anthony Bilinski
24e4ec3751
fix(model): take QObject receiver argument to interface signal connection macro
receiver QObject is used by Qt to automatically deregister the connection when
the receiver is destroyed. Forward it on to Qt's connect.
2020-02-06 16:48:56 -08:00
Anthony Bilinski
82a4f1b412
fix(model): stop interfaces from inheriting from QObject
Qt doesn't support QObject multiple inheritance, so use our existing interface
macros to declare signals in the interface without QObject, and implement them
in child classes.
2020-02-06 16:48:56 -08:00
Anthony Bilinski
41b2b35ce3
fix(model): return connection from interface macro
connection is normally returned from Qt's connect, and the caller may want to
track the connection to manually disconnect it.
2020-02-06 16:48:56 -08:00
sudden6
c507d2665d
fix(coreav): prevent racy access to call variable 2020-01-29 22:22:18 +01:00
sudden6
dfcfb7d5e0
fix(coreav): change some lock to write locks
I missed some cases where data was written.
2020-01-29 22:22:18 +01:00
sudden6
141cbf8870
fix(coreav): fix assert because c-toxcore calls from unexpected thread
c-toxcore calls the groupCallCallback from it's main thread instead of
the ToxAV thread as expected, this was triggering an assertion.

Aditionally the destructors of Core and CoreAV were fixed, because they
now either crashed or deadlocked qTox when it was closed while a group
call was still running.
2020-01-29 22:22:18 +01:00
sudden6
4b9e4a571d
fix(coreav): avoid deadlock between CoreAV, main and Audio thread
This actually fixes two problems:

1) CoreAV and Audio thread both locked the callsLock and audioLock in
different orders, resulting in a deadlock of both threads. This fixed by
using a ReadWriteLock in the CoreAV thread.

2) Multiple functions were emitting signals while holding a lock. This
is unsafe, because the connected slot may acquire any other lock. This
is fixed by releasing the locks before emitting signals.
2020-01-29 22:22:18 +01:00
sudden6
9499925fb2
fix(coreav): cleanup assertions
It doesn't really make sense to assert that the callbacks are coming
from any other thread than CoreAV, when we actually want to ensure the
callback is coming from Core thread.

Remove over agressive assert from sendGroupCallAudio(...), this function
should be callable from any thread.
2020-01-29 22:22:18 +01:00
sudden6
98cfe9838f
refactor: properly lock against Core thread
We we're calling toxav_* functions without synchronizing to any of the
Tox threads.

Additionally remove the call timeout, it creates timers from different
threads, which causes errors.
2020-01-29 22:22:18 +01:00
sudden6
29f659c659
feat(coreav): add assertions to check for threading errors 2020-01-29 22:22:18 +01:00
sudden6
c332cc0cca
refactor(coreav): simplify start sequence 2020-01-29 22:22:17 +01:00
sudden6
2bc0057bbd
refactor(coreav): move threading of CoreAV to single mutex
Use a standard mutex instead of trying to build proper locking
ourselfes.
2020-01-29 22:22:17 +01:00
Anthony Bilinski
5b31effdb4
fix(group): don't display netcam view for group voice calls
This is a minimal fix to reduce risk for the release. A more complete
re-architecture will be made.

The netcam covers much of the chat in groups, and has nothing to show since
group video calls aren't possible. Who is speaking in call is already shown by
the bold names at the top of the group, taking much less space.

Fix #5918
2020-01-27 15:05:54 -08:00
Anthony Bilinski
92e51b05ac
fix(db): fix schema log to display correct version 2020-01-27 01:21:29 -08:00
Anthony Bilinski
981ecfcaeb
refactor(chatform): combine toggleVideoPreview implementations 2020-01-26 04:29:56 -08:00
Anthony Bilinski
89913e0f9a
refactor(netcam): remove GenericNetCamView, merge into NetCamview
Without GroupNetCamView, the split in arbitrary.
2020-01-26 04:29:55 -08:00
Anthony Bilinski
41d8f66e08
refactor(chatform): change ChatForm's netcam to NetCamView
Unlike GenericChatForm, ChatForm knows that it always has a NetCam
2020-01-26 04:29:55 -08:00
Anthony Bilinski
600993b43a
refactor(chatform): move netcam ownership to ChatForm from GenericChatForm
Since now only ChatForm uses the NetCamView.
2020-01-26 04:29:55 -08:00
Anthony Bilinski
8d8e75b800
refactor(chatform): move onMessagesClicked, onSplitterMoved to ChatForm
These API are only relevant for NetCamView, which is only used by ChatForm.
2020-01-26 04:29:55 -08:00
Anthony Bilinski
4c816b1bff
refactor(chatform): move create/show/hide NetCamView API to ChatForm
Since NetCamView is now only used by ChatForm, GenericChatForm shouldn't have
any of its functionality.
2020-01-26 04:29:54 -08:00
Anthony Bilinski
91bcd211a7
refactor(netcam): remove GroupNetCamView class
Fix #5918
2020-01-26 04:05:39 -08:00
Anthony Bilinski
366478fca9
chore: remove "Hardware" from issue template
For the grand majority of bug reports, user hardware isn't relevant. Figuring
out what to write isn't always trivial.
2020-01-26 02:33:20 -08:00
Anthony Bilinski
49abc996ae
Merge branch 'v1.17-dev' 2020-01-19 16:16:57 -08:00
accelsao
bdb3b61ee0
fix(net): check if the node has all needed fields
Fixes ##5766
2020-01-19 16:06:19 -08:00
Anthony Bilinski
cf672375be
revert(toxme): remove toxme from qTox - the service is offline permanently
As of 2019-10-09, toxme.io was taken offline permanently. Remove UI and code
in qTox relating to it. Revert this commit if it comes back online in the
future.

Fix #5897
2020-01-16 13:28:41 -08:00
accelsao
ca4f14cc4c fix(net): check if the node has all needed fields
Fixes ##5766
2020-01-14 09:04:55 +08:00
sudden6
547a038e48
refactor: remove AppImage update bridge
When re-evaluating our dependencies we decided that the update bridge
has a high potential for security issues because it's not widely used.
Additionally similar functionality is already present in qTox.
2020-01-13 11:19:01 -08:00