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

179 Commits

Author SHA1 Message Date
Anthony Bilinski
7c519c3895
refactor(main): Move main global state into new AppManager class
main() couldn't hold its own state since cleanup() needed access to it.
Having the state in a class allows QApplication::aboutToQuit to call
into a member function with access to the state.

Data used in logging still needs to be global due to
qInstallMessageHandler not accepting a void* to get back to this.

Set QGuiApplication attributes before constructing Qapplication as required,
by using comma operator to call an initialization function before construction
all members in the member initializer list.

Keep logic largely unchanged, but with a defined destruction order.

Destruction is still abnormal due to QApplication::aboutToQuit forcing
us to do partial cleanup before QApplication returns, since some OSes
will kill qTox before the QApplication returns.
2022-05-24 13:26:48 -07:00
Anthony Bilinski
9571434df9
feat(CI): Disallow unsafe implicit casts to QString
Covers char* without size, and QByteArray.

Catches the case of QByteArray to QString implicit conversion like was
fixed in 47ee51c61d, but still allows
construction or assignment from string literals in source. Gives most
of the type safety of QT_NO_CAST_FROM_ASCII without having to wrap
every literal string in QStringLiteral.

No functional issues found during change.
2022-04-05 12:10:05 -07:00
Anthony Bilinski
b5aa5dac63
feat(CI): Disallow implicit casting of QString to char*
QString holds UTF8 data which may not be a valid ASCII C string. Require
an explicit conversion if wanted.
2022-04-05 12:10:05 -07:00
Anthony Bilinski
f1b401166a
feat(CI): Disallow implicit casting of QByteArray to char* or void*
QByteArray usually holds arbitrary binary data, which can have null
characters or invalid characters when converted to ASCII or UTF8.
Disallow implicit casting for safety, forcing an explicit decision if
the conversion is wanted.
2022-04-05 12:10:05 -07:00
Anthony Bilinski
1ac7285c79
refactor(widget): Make RemoveFriendDialog generic for Chats 2022-03-30 19:27:57 -07:00
Anthony Bilinski
16ac8a8eac
refactor(History): Split peers table into chats and authors
peers had combined meaning, both being referenced by history for which
chat a message was in, and being reference by aliases for who authored a
message. This means that peers had conceptually different sub-groups:
all friends are both a chat and an author, but self is an author but not
a chat. With the addition of group chats this is amplified by groups
themselves being chats but not authors, and group members being authors
but not chats. Instead of having four sub-groups all within peers,
splitting peers into chats and authors gives a clean mapping,
simplifying interactions with the data.

In the new chats and authors tables, store what used to be a public_key
string as a BLOB, since it’s inherently a 32-byte binary value in both
cases. Call the public_key a UUID for chats, since group IDs are not
defined as public keys by toxcore.

Even though the data change is quite minor, the upgrade is large because
of SQLite's lack of support for modifying foreign key constrains for
existing tables. This means when peers are moved to new tables, all
tables referencing peers need to be cloned with a new foreign key
constraint, as well as all tables referencing those, recursively.
2022-03-29 21:27:01 -07:00
Anthony Bilinski
f6dddf7c58
refactor(History): Move history upgrades to new directory
Upcoming upgrade is fairly large, and all the helper functions for each
upgrade are becoming ambiguous.
2022-03-27 23:33:38 -07:00
Anthony Bilinski
0d366a5790
chore(build): Enable all warnings on qTox libraries as well
warnings interface was only being linked to qtox_static, so were not being
applied to e.g. util. Link it to each library as well as qtox_static so that
they all inherit all the warnings.
2022-03-24 04:19:41 -07:00
Anthony Bilinski
b24faabf42
refactor(GUI): Move remaining messsage box functionality to new class
* Pass MessageBoxManager instantiation around instead of relying on a singleton
* Mock MessageBoxManager for unit tests when needed, since they don't have a
  QApplication which is required for creating QWidgets
* Remove GUI class, which didn't have a clear purpose
2022-03-24 02:14:20 -07:00
Anthony Bilinski
d7b67081e5
refactor(history): Separate db upgrade logic from History
Allows for cleaner testability of upgrade logic and reduces the overall size
and clutter of History.
2022-03-19 21:27:40 -07:00
Anthony Bilinski
b894531cdb
fix(tests): Mock Settings for SmileyPack test
Settings upgrades global settings on construction, which can cause the
SmileyPack test to be inconsistent based on file system state.

Fix #6530
2022-03-15 01:32:16 -07:00
Anthony Bilinski
e5f16d812e
chore(macOS): Remove support for old AvFoundation
We no longer need conditional support for the older API since our minimum supported version is now 10.15.
2022-03-14 14:48:41 -07:00
Anthony Bilinski
16aeb5f572
refactor(model): Rename Contact and ContactId to Chat and ChatId
* Referring to groups generically as contacts is confusing.
* Friends are referred to as contacts in many places either as more
  neutral wording, or to avoid using the keyword friend as a variable
  name. Calling Contact Chat allows contact to be used for Friends.
2022-03-14 12:44:37 -07:00
Anthony Bilinski
0afc11fafc
chore(build): Migrate existing warning handling to new warnings project 2022-03-11 10:22:13 -08:00
Anthony Bilinski
df58c35998
chore(build): Remove redundant warnings 2022-03-11 10:22:13 -08:00
Anthony Bilinski
aa2e253674
chore(build): Enable lots of compile-time warnings
Taken directly from 9777aa619d/warnings

* Remove Wuseless-cast, because Qt's MOC-generated code hits it.
* Remove Wduplicated-branches, Wduplicated-branches, Wformat-truncation
because they aren't supported on our oldest CI job.
2022-03-11 10:22:13 -08:00
Anthony Bilinski
2b41a06b55
feat(Settings): Add system for versioning and upgrading Settings
Similar to how History handles SCHEMA_VERSION. Run separately on global and
personal settings, since some state in global, and personal settings can’t be
done globally since they require the passkey.

Restrict a user from downgrading past the saved settings version, due to
possible compatibility breaks or old qTox versions re-introducing corrupt state
that was already healed.

Pass in new profile state for personal settings rather than relying on settings
file presence because personal settings can be stored in either the personal
settings file or global settings file. This was introduced in
aea9eea8a4 when personal settings were first
moved to their own file.
2022-03-06 06:00:13 -08:00
Anthony Bilinski
3c682abc69
fix(docs): Add brew prefix to macOS build instructions
Update brew's qt5 to qt@5, following brew naming deprecation.
2022-03-04 22:04:26 -08:00
sudden6
cd8af735fc
fix: don't link emoji resources into targets that don't need them
The emoji resouce file is quite big, so link it only when really needed.
2022-02-25 23:22:28 +01:00
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
ffef0e3796
refactor(chatlog): Rename ChatLog -> ChatWidget
* Makes the distinction between IChatLog (the model class) and
  ChatWidget (the view class) more clear
2021-11-21 16:18:45 -08:00
Mick Sayson
b36a38e716
feat(chatlog): Re-implement sliding window ChatLog view
* Replace lines/messages with helper class to synchronize state between
  IChatLog and ChatLog more easily
* selection indexes have been replaced with ChatLine::Ptrs, this is to
  ensure consistency while the view slides around
    * This has another benefit of removing all the code that has to
      manually slide the selection boxes around
* Replaced all insertion/removal functions with single "insertAtIdx".
  This helps ensure that mappings between ChatLogIdx and position within
  the view are captured correctly as items in the view slide around
* workerTimeout replaced with more generic name "renderFinished" that is
  used in synchronous and asynchronous paths
* Removed unused function ChatForm::insertChatMessage
* Re-implemented "Go to current date" with new ChatLog APIs
* Removed unused GenericChatForm::addSystemDateMessage. This is handled
  by ChatLog now
* Resolves #6223
* Resolves #5878
* Resolves #5940
2021-11-21 16:18:44 -08:00
Anthony Bilinski
8cf7f51c14
chore(deps): Update minimum cmake version to 3.7.2
This matches Debian 9 LTS version, and is lower than Ubuntu 18.04's
cmake which is the oldest Ubuntu version now supported.
2021-10-27 00:25:14 -07: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
7c218b389d
feat(chatlog): Add image preview on paste
Reuse code from the file transfer widget to provide an image preview
on paste/grab. This prevents users from accidentally sending images they
did not mean to when their clipboard is not in the state they thought it
was.

Implementation exposes the genericchatlog vbox to the child classes and
chatform injects the imagepreview into it.
2021-10-24 22:06:58 -07:00
Anthony Bilinski
a24f99df0d
Merge pull request #6347
bodwok (4):
      refactor(ui): separation of responsibility for sorting the contact list
      fix(build): include QVector type
      refactor(ui): code improvement
      refactor(ui): code improvement
2021-06-30 09:35:10 -07:00
Anthony Bilinski
65ff532a54
fix(macos): update deprecated AVFoundation API 2021-06-27 11:20:17 -07:00
bodwok
18b34b325f
refactor(ui): separation of responsibility for sorting the contact list 2021-06-13 20:11:19 +03:00
bodwok
3ba11f7075
refactor(CMakeLists): remove duplicate files 2021-04-28 19:09:28 +03:00
Jamie Westell
f85f633346
chore(travis): add code coverage report generation
This change adds a cmake configuration switch to enable code coverage
instrumentation during the compilation of the project. When tests are
executed, the instrumentation outputs coverage data to output files in
the build directory. Programs such as lcov/gcovr can turn that data into
reports.

This change also adds steps to the travis CI configuration to build with
this configuration switch and then use lcov to generate the consolidated
report and publish to codecov.io
2021-03-21 20:36:28 -07:00
Anthony Bilinski
be167c9229
feat(build): Add option to enable ThreadSanitizer 2021-03-18 16:04:35 -07:00
Mick Sayson
b715815011
feat(extensions): UI updates for extension support
Added a UI element to indicate extension support of the chatroom. For
all groups it will always be red since we do not support extensions in
groups. In a 1-1 chat the indicator will either be green/yellow/red
depending on if the friend has support for all/some/none of qTox's
desired extension set.
2021-01-30 12:52:07 -08:00
Mick Sayson
7474c6d8ac
feat(messages): Multipacket message support
* Introduced ToxExt and CoreExt abstraction
    * Along with interfaces for mocking and unit testing
* Add "supportedExtensions" concept to Friend
* Dispatch messages to CoreExt instead of Core when friend supports
extended messages
    * Only split messages for core when extended messages are unavailable
* Offline message engine/History not altered. Currently only valid for
an existing session after extension negotiation has completed
2021-01-30 12:52:06 -08:00
begasus
d413e7b13c
feat(haiku): Don't use fstack-protector on Haiku 2021-01-23 05:44:02 -08:00
Anthony Bilinski
425e3f6518
Merge branch 'v1.17-dev' 2020-11-23 09:53:13 -08:00
Anthony Bilinski
a93c599497
feat(osx): Add support for macOS 10.16, remove support for macOS 10.13
Stop specifying a specific path in cmake for the SDK, since the path differs in
10.16, and cmake will find it automatically.

Use the oldest supported SDK based on https://developer.apple.com/support/xcode/

Fix #6252
2020-11-22 20:06:33 -08:00
Anthony Bilinski
ede0418b4f
Merge pull request #6182
bodwok (2):
      refactor: connection to parent method in toxuri.cpp
      refactor: connection to parent method in toxuri.cpp
2020-07-04 16:52:36 -07:00
bodwok
06ff723c0d
refactor: connection to parent method in toxuri.cpp 2020-07-04 21:32:57 +03:00
sudden6
f37813ff88
refactor: move translations to their own module 2020-07-03 15:46:07 +02:00
sudden6
0335f20362
fix: Qt ressource system usage
Make use of the `AUTORCC` feature of cmake to simplify adding resource
files to qTox.

Fixes #6144
2020-07-03 15:45:57 +02: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
sudden6
8768f6be37
refactor: remove unused OSX platform code 2020-06-22 01:12:35 +02:00
Mick Sayson
a9f6543e43
feat(notification): Notification string generator for multiple messages 2020-05-17 00:00:48 -07:00
Mick Sayson
99c1753a76 fix(preview): Fix exif orientations
Previous exif transformations were not valid. The exif spec defines the
orientations as where the 0th row and the 0th column should end. The
previous mappings used in qTox did not respect these mappings and needed
to be updated.
2020-05-16 16:53:14 -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
Anthony Bilinski
5a877d742b
refactor(core): pass bootstrap list interface to Core 2020-05-10 21:39:58 -07:00
Anthony Bilinski
c748b5a8d0
Merge branch 'v1.17-dev' 2020-04-24 18:35:00 -07:00
Anthony Bilinski
9888bc2d80
fix(build): disable Werror by default, keep enabled on CI
To allow for easier building with different compilers on user systems. Keep
strict checks on CI to make sure new warnings aren't ignored.
2020-04-12 16:30:17 -07:00
Anthony Bilinski
bd339d2cb6
chore(build): stop using removed cmake options
Options were removed in https://github.com/qTox/qTox/pull/5888
2020-04-12 01:52:06 -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