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

462 Commits

Author SHA1 Message Date
Mick Sayson
c7efe320d2 refactor(filetransfer): Move file transfer progress into ToxFile
* Refactor/test ToxFileProgress to ensure that when it's moved it
  behaves well
* Notice problems with speed averaging. We were average speeds without
  keeping track of the times they were over. Adding samples of different
  lengths would result in incorrect speeds. Refactor whole class to correct
* Move ToxFileProgress to be a member of ToxFile
* Remove duplicated members between ToxFile and ToxFileProgress
* Move sample addition into CoreFile
2021-12-11 15:38:35 -08:00
Mick Sayson
6c34fad9b6
fix(history): Fix qt deprecation warning
Qt 5.15 has QDateTime(QDate()) deprecated. Fix a usage of the deprecated
constructor introduced in parent commit
2021-11-21 16:17:15 -08:00
Anthony Bilinski
1104417022
revert(chatlog): "edit load history in search"
This reverts commit 8c4b1e00a1.
2021-11-21 16:17:10 -08:00
Brandon Mosher
1438f8f766 refactor: Provide a Virtual Method Anchor for Classes in Headers
Define at least one virtual method in polymorphic class cpp files to
improve link efficiency. Do so by defining a defaulted destructor or
another overridden virtual method in the class cpp file.
Also add explicitly defaulted copy/move constructors and assignment
operators to follow the rule of five and to avoid compiler suppression
of these functions due to the addition of a user-provided destructor.
Where neccessary, create new cpp files and add them to CMakeLists and
Testing.cmake. Set the -Wweak-vtables by default when compiling with
clang to issue warnings for new classes that do not comply with this
pattern.

See http://llvm.org/docs/CodingStandards.html#provide-a-virtual-method-anchor-for-classes-in-headers.

Fixes #6036.
2021-10-26 16:47:40 +00:00
Mick Sayson
18109b2f7f feat(history): Save/load system messages to history 2021-10-16 14:29:57 -07:00
Anthony Bilinski
8276141ef9
fix: Replace deprecated QMutex::Recursive with QRecursiveMutex 2021-06-06 01:29:44 -07:00
Mick Sayson
e9131d33aa
feat(chatlog): Upgrade db schema to support system messages
* Resolves #6221
* System message schema designed to take enum of message base + args
* New table layout required many updates to the queries executed by
  history
* Bonus reduction of history signals/slots by issuing some file transfer
  insertions directly when possible
2021-05-02 03:26:04 -07:00
Waris Boonyasiriwat
034d7671a5 fix(smileys): fix flag emojis
Fix two small problems that break flag emojis

(1) Multi-char emojis are accidentally grouped together with emoticons
(such as : smile :). This is fixed by using a more robust isAscii(...) function
(2) Smiley regexp construction is undeterministic, causing multi-char to
sometimes be processed first, sometimes last. This is fixed by explicitly
inserting multi-char patterns first.

Issue: #5147
2021-02-16 09:29:21 -08:00
Mick Sayson
5f5f612841
feat(messages): History and offline message support for extended messages
* Added new negotiating friend state to allow delayed sending of offline
messages
* Added ability to flag currently outgoing message as broken in UI
* Reworked OfflineMsgEngine to support multiple receipt types
    * Moved resending logic out of the OfflineMsgEngine
    * Moved coordination of receipt and DispatchedMessageId into helper
    class usable for both ExtensionReceiptNum and ReceiptNum
    * Resending logic now has a failure case when the friend's extension
    set is lower than the required extensions needed for the message
    * When a user is known to be offline we do not allow use of any
    extensions
* Added DB support for broken message reasons
* Added DB support to tie an faux_offline_pending message to a required
extension set
2021-01-30 12:52:06 -08:00
Mick Sayson
13b8bc207b refactor(history): Remove peerId caching from history
In history we cache peers to avoid extra DB lookups, this code is not
pretty and seems to provide little benefit. This reduces the cognitive
load when trying to reason about history.

* Removed peerId table from history
* Replaced peerId lookups with generated select statement
* Benchmarked on a profile with ~100 peers in the db and saw no
  noticible change in transaction time (6-30 ms both before and after
  the changes)
2021-01-24 11:48:16 -08:00
Anthony Bilinski
425e3f6518
Merge branch 'v1.17-dev' 2020-11-23 09:53:13 -08:00
Anthony Bilinski
b42b1f5e15
fix(osx): Update deprecated QDateTime and QProcess APIs 2020-11-22 20:06:33 -08:00
Jimi Huotari
d9c3279c40
refactor(Qt): fix build with Qt 5.15
This fixes compile-time warnings about deprecated functions when
building with Qt 5.15.

(cherry picked from commit 6d51971c6f)
2020-11-22 19:56:59 -08:00
sudden6
db205bea57
refactor(profile): remove some uses of Settings::getInstance() 2020-08-29 00:45:21 +02:00
sudden6
9971bc3a1e
refactor(core): make construction independent of CoreAV
Allows to construct a Core object without also starting CoreAV.
2020-08-28 13:12:27 +02:00
Anthony Bilinski
0f5ba08fd2
fix(settings): Unlock Settings mutex before emitting setting changed signals
When a setting is set it locks the Settings mutex and emits a signal for that
setting. If a slot is connected to that signal and lives on the same thread as
Settings, it is executed immediately with the Settings mutex still locked. That
slot can then lock a series of other mutexes. During this time another thread
can lock a mutex and then try to read settings, which will cause a deadlock due
to the opposite order of multiple mutex locking. By always emitting signals
after unlocking the Settings mutex, we avoid holding the Settings mutex while
executing slots.

Fix #6218
2020-08-27 18:44:19 -07:00
Anthony Bilinski
6801098651
fix(settings): Emit correct signal when spellchecking is updated 2020-08-27 10:55:06 -07:00
Anthony Bilinski
431fd7bfa2
Merge pull request #6073
Anthony Bilinski (1):
      fix(notification): hide snore warning log spam

Mick Sayson (2):
      feat(notification): Notification string generator for multiple messages
      feat(notification): Notifications now always replace the previous one
2020-07-02 01:34:34 -07:00
Anthony Bilinski
5dcea74db5
fix(core): read proxy type after personal settings are loaded
Profile is required to load personal settings, and Profile was creating the
bootstraplist using personal settings. Instead create the bootstraplist in
initCore, after personal settings have been loaded. This avoids using an
uninitialized proxy type on every profile load.
2020-07-01 12:49:24 -07:00
Mick Sayson
6e163ca5ed
feat(notification): Notifications now always replace the previous one
This is a feature/fix to improve notification behavior when we receive
over 3 messages.

SnoreNotify prevents over 3 notifications from being displayed before a
user clears the notification. This is presumably to avoid infinite
notification spam.

Unfortunately this results in the notifications just coming in _after_
the user clears them. This means if there are 100s of messages built up
the user has to clear their notifications N messages / 3 times.

This feature/fix folds all notifications into a single notification
representing the current qTox notification state. See
notificationgenerator_test.cpp for what the new messages look like.
2020-05-17 00:00:53 -07:00
Mick Sayson
a9f6543e43
feat(notification): Notification string generator for multiple messages 2020-05-17 00:00:48 -07:00
sudden6
a90f0762d9
refactor(cmake): change folder structure
The new folder structure will be like this:

/<module>/CMakeLists.txt
/<module>/src/file.cpp
/<module>/include/<module>/file.h
/<module>/<subdir>/<...>
2020-05-11 16:45:52 +02:00
sudden6
f3a10815ed
refactor: remove Core::getInstance from AvatarBroadcaster
During this process, make AvatarBroadcaster a non-static class.
2020-05-11 10:28:26 +02:00
Anthony Bilinski
365a452fb8
feat(core): use user editable bootstrap node list
Fix #5767
2020-05-10 21:40:04 -07:00
Anthony Bilinski
e5f33608c4
refactor(core): pass Paths into BootstrapNodeUpdater
In preparation of loading local bootstrap list files.
2020-05-10 21:40:04 -07:00
Anthony Bilinski
5a877d742b
refactor(core): pass bootstrap list interface to Core 2020-05-10 21:39:58 -07:00
Anthony Bilinski
5d56a3c039
refactor(paths): move Settings path functions into Paths 2020-05-10 18:03:47 -07:00
Anthony Bilinski
062ba03fb8
refactor(db): map foreign key dependency in db schema
Reorder deletion of history to avoid violating constraint.
2020-05-03 18:06:10 -07:00
Anthony Bilinski
f37f9a9492
refactor(history): enforce using PK instead of ToxId in history
We need to be lenient when reading from db because of ToxIds being saved in the
db from a bug introduced in e07d8d358f, which
used self ID rather than self Pk. Was subsequently fixed in
033f28e67e.
2020-05-03 16:22:12 -07:00
Anthony Bilinski
8abd4e47e9
refactor(style): use #pragma once rather than include guards 2020-05-03 15:51:52 -07:00
sudden6
9306e946f8
refactor: remove Core::getInstance() from ChatForm classes 2020-05-02 23:36:38 +02:00
Anthony Bilinski
00d08d9887
Merge branch 'v1.17-dev' 2020-04-24 18:37:27 -07:00
iphydf
58b4c19709
chore: remove extra ;
These are misleading in some cases, or at least not useful in others.
Most cases of Q_UNUSED in qtox don't have a ;, so this seems acceptable.
2020-04-22 23:55:51 +00:00
Anthony Bilinski
2c59c92030
fix(db): Support opening and upgrading to any of three SQLCipher params
Fix #5952
2020-04-18 14:39:41 -07:00
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
8e03aa4b17
revert(chatlog): "edit load history in search"
This reverts commit 8c4b1e00a1.
2020-04-12 22:40:10 -07: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
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
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
Anthony Bilinski
13cf04fad9
Merge branch 'v1.17-dev' 2020-02-22 14:18:26 -08:00
Anthony Bilinski
92e51b05ac
fix(db): fix schema log to display correct version 2020-01-27 01:21:29 -08:00
Anthony Bilinski
49abc996ae
Merge branch 'v1.17-dev' 2020-01-19 16:16:57 -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