From 3c88aca1470a3049a55299d6e2610af6395b9297 Mon Sep 17 00:00:00 2001 From: iphydf Date: Thu, 14 Apr 2022 21:57:34 +0000 Subject: [PATCH] chore: Add bazel build. --- .cirrus.yml | 12 + .github/CODEOWNERS | 1 + .github/settings.yml | 9 + .github/workflows/build-test-deploy.yaml | 2 +- .github/workflows/commit-format.yaml | 2 +- .gitignore | 3 + BUILD.bazel | 56 ++++ LICENSE | 9 +- audio/BUILD.bazel | 64 ++++ osx/BUILD.bazel | 10 + .../qtox.icns.appiconset/Contents.json | 68 +++++ .../qtox.icns.appiconset/qtox.icns-128.png | 0 .../qtox.icns.appiconset/qtox.icns-128@2x.png | 0 .../qtox.icns.appiconset/qtox.icns-16.png | 0 .../qtox.icns.appiconset/qtox.icns-16@2x.png | 0 .../qtox.icns.appiconset/qtox.icns-256.png | 0 .../qtox.icns.appiconset/qtox.icns-256@2x.png | 0 .../qtox.icns.appiconset/qtox.icns-32.png | 0 .../qtox.icns.appiconset/qtox.icns-32@2x.png | 0 .../qtox.icns.appiconset/qtox.icns-512.png | 0 .../qtox.icns.appiconset/qtox.icns-512@2x.png | 0 .../LICENSE-GRAPHICS | 0 .../README.md | 0 .../emoticons.xml | 0 .../emoticons.xml | 0 smileys/emojione.qrc | 2 +- smileys/smileys.qrc | 2 +- src/BUILD.bazel | 275 ++++++++++++++++++ src/appmanager.cpp | 1 + src/chatlog/chatwidget.cpp | 2 +- src/chatlog/chatwidget.h | 2 +- src/core/core.cpp | 8 +- src/model/profile/profileinfo.h | 4 +- src/net/updatecheck.cpp | 1 + src/net/updatecheck.h | 1 + src/persistence/db/upgrades/dbupgrader.cpp | 2 +- src/persistence/settings.cpp | 2 +- src/persistence/settings.h | 2 +- src/platform/camera/avfoundation.mm | 26 ++ src/video/cameradevice.cpp | 8 +- src/widget/form/settings/aboutform.cpp | 1 + src/widget/form/settings/aboutform.h | 2 + src/widget/widget.cpp | 6 + src/widget/widget.h | 1 + test/BUILD.bazel | 54 ++++ test/model/groupmessagedispatcher_test.cpp | 4 +- test/model/notificationgenerator_test.cpp | 2 +- test/persistence/smileypack_test.cpp | 2 +- translations/translations.qrc | 10 +- util/BUILD.bazel | 32 ++ windows/BUILD.bazel | 8 + 51 files changed, 669 insertions(+), 27 deletions(-) create mode 100644 .cirrus.yml create mode 100644 .github/CODEOWNERS create mode 100644 .github/settings.yml create mode 100644 BUILD.bazel create mode 100644 audio/BUILD.bazel create mode 100644 osx/BUILD.bazel create mode 100644 osx/qtox.icns.xcassets/qtox.icns.appiconset/Contents.json create mode 100644 osx/qtox.icns.xcassets/qtox.icns.appiconset/qtox.icns-128.png create mode 100644 osx/qtox.icns.xcassets/qtox.icns.appiconset/qtox.icns-128@2x.png create mode 100644 osx/qtox.icns.xcassets/qtox.icns.appiconset/qtox.icns-16.png create mode 100644 osx/qtox.icns.xcassets/qtox.icns.appiconset/qtox.icns-16@2x.png create mode 100644 osx/qtox.icns.xcassets/qtox.icns.appiconset/qtox.icns-256.png create mode 100644 osx/qtox.icns.xcassets/qtox.icns.appiconset/qtox.icns-256@2x.png create mode 100644 osx/qtox.icns.xcassets/qtox.icns.appiconset/qtox.icns-32.png create mode 100644 osx/qtox.icns.xcassets/qtox.icns.appiconset/qtox.icns-32@2x.png create mode 100644 osx/qtox.icns.xcassets/qtox.icns.appiconset/qtox.icns-512.png create mode 100644 osx/qtox.icns.xcassets/qtox.icns.appiconset/qtox.icns-512@2x.png rename smileys/{ASCII+Universe => ASCII-Universe}/LICENSE-GRAPHICS (100%) rename smileys/{ASCII+Universe => ASCII-Universe}/README.md (100%) rename smileys/{ASCII+Universe => ASCII-Universe}/emoticons.xml (100%) rename smileys/{ASCII+emojione => ASCII-emojione}/emoticons.xml (100%) create mode 100644 src/BUILD.bazel create mode 100644 test/BUILD.bazel create mode 100644 util/BUILD.bazel create mode 100644 windows/BUILD.bazel diff --git a/.cirrus.yml b/.cirrus.yml new file mode 100644 index 0000000000..d79cc0380d --- /dev/null +++ b/.cirrus.yml @@ -0,0 +1,12 @@ +--- +bazel-opt_task: + container: + image: toxchat/toktok-stack:latest-release + cpu: 2 + memory: 6G + configure_script: + - /src/workspace/tools/inject-repo qtox + test_all_script: + - cd /src/workspace && bazel test -k + --remote_http_cache=http://$CIRRUS_HTTP_CACHE_HOST + //qtox/... diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000000..59122984fc --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +/.github/ @TokTok/admins diff --git a/.github/settings.yml b/.github/settings.yml new file mode 100644 index 0000000000..73cc3de1a1 --- /dev/null +++ b/.github/settings.yml @@ -0,0 +1,9 @@ +--- +_extends: .github + +repository: + name: qTox + description: Powerful Tox chat client that follows the Tox design guidelines. + homepage: https://qtox.github.io/ + topics: tox, chat + has_issues: false diff --git a/.github/workflows/build-test-deploy.yaml b/.github/workflows/build-test-deploy.yaml index 730ebfae11..74c218c365 100644 --- a/.github/workflows/build-test-deploy.yaml +++ b/.github/workflows/build-test-deploy.yaml @@ -1,5 +1,5 @@ name: Build, test, and deploy -on: [pull_request, push] +#on: [pull_request, push] jobs: update-nightly-tag: name: Update nightly release tag diff --git a/.github/workflows/commit-format.yaml b/.github/workflows/commit-format.yaml index f717db55f9..2713a67fe1 100644 --- a/.github/workflows/commit-format.yaml +++ b/.github/workflows/commit-format.yaml @@ -1,5 +1,5 @@ name: Commit Format -on: pull_request +#on: pull_request jobs: verify-commit-format: name: Verify Commit Format diff --git a/.gitignore b/.gitignore index 849e886afe..4f8ea40689 100644 --- a/.gitignore +++ b/.gitignore @@ -55,3 +55,6 @@ target/ # Tarballs *.tar.* + +# Editor temp files +*.swp diff --git a/BUILD.bazel b/BUILD.bazel new file mode 100644 index 0000000000..fd5f35c585 --- /dev/null +++ b/BUILD.bazel @@ -0,0 +1,56 @@ +load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") +load("//third_party/qt:build_defs.bzl", "qt_lconvert", "qt_rcc") +load("//tools/project:build_defs.bzl", "project") + +package(features = ["layering_check"]) + +project() + +qt_lconvert( + name = "qtox_qms", + srcs = glob(["translations/*.ts"]), +) + +genrule( + name = "translations_qrc", + srcs = ["translations/translations.qrc"], + outs = ["translations/translations_local.qrc"], + cmd = "cp $< $@", +) + +qt_rcc( + name = "translations", + srcs = [":translations_qrc"], + data = [":qtox_qms"], +) + +qt_rcc( + name = "res", + srcs = [ + "res.qrc", + "smileys/emojione.qrc", + "smileys/smileys.qrc", + ], + data = glob([ + "img/**/*", + "res/**/*", + "smileys/*/*", + "themes/**/*", + ]), +) + +cc_library( + name = "res_lib", + srcs = [ + ":res", + ":translations", + ], + visibility = ["//qtox:__subpackages__"], + alwayslink = True, +) + +cc_binary( + name = "qtox", + visibility = ["//qtox:__subpackages__"], + deps = ["//qtox/src:main"], +) diff --git a/LICENSE b/LICENSE index f288702d2f..10926e87f1 100644 --- a/LICENSE +++ b/LICENSE @@ -1,7 +1,7 @@ GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -645,7 +645,7 @@ the "copyright" line and a pointer to where the full notice is found. GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see . + along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. @@ -664,11 +664,12 @@ might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see -. +. The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read -. +. + diff --git a/audio/BUILD.bazel b/audio/BUILD.bazel new file mode 100644 index 0000000000..215ce01169 --- /dev/null +++ b/audio/BUILD.bazel @@ -0,0 +1,64 @@ +load("@rules_cc//cc:defs.bzl", "cc_library") +load("//third_party/qt:build_defs.bzl", "qt_moc", "qt_rcc") + +package(features = ["layering_check"]) + +qt_moc( + name = "audio_moc", + srcs = [ + "include/audio/iaudiocontrol.h", + "include/audio/iaudiosource.h", + "src/backend/alsink.h", + "src/backend/alsource.h", + "src/backend/openal.h", + ], + hdrs = glob(["**/*.h"]), + mocopts = ["-Iqtox/audio/include"], + deps = ["//qtox/util"], +) + +qt_rcc( + name = "audio_res", + srcs = ["resources/audio_res.qrc"], + data = glob(["resources/*.pcm"]), +) + +cc_library( + name = "audio_res_lib", + srcs = [":audio_res"], + visibility = ["//qtox:__subpackages__"], + alwayslink = True, +) + +cc_library( + name = "audio", + srcs = [ + ":audio_moc", + ] + glob( + [ + "src/**/*.cpp", + ], + ), + hdrs = glob(["**/*.h"]), + copts = ["-Iqtox"] + select({ + "//tools/config:freebsd": [], + "//tools/config:linux": ["-fPIC"], + "//tools/config:osx": [], + "//tools/config:windows": [], + }), + defines = [ + "DEBUG", + #"DESKTOP_NOTIFICATIONS", + "QTOX_PLATFORM_EXT", + "QT_MESSAGELOGCONTEXT", + "UPDATE_CHECK_ENABLED", + ], + includes = ["include"], + visibility = ["//qtox:__subpackages__"], + deps = [ + ":audio_res_lib", + "//qtox/util", + "@openal", + "@qt//:qt_core", + ], +) diff --git a/osx/BUILD.bazel b/osx/BUILD.bazel new file mode 100644 index 0000000000..875951c0c8 --- /dev/null +++ b/osx/BUILD.bazel @@ -0,0 +1,10 @@ +load("//third_party/qt:build_defs.bzl", "qt_mac_deploy") + +package(features = ["layering_check"]) + +qt_mac_deploy( + name = "qtox", + app_icons = glob(["qtox.icns.xcassets/**"]), + bundle_id = "chat.tox.qtox", + deps = ["//qtox:qtox_main"], +) diff --git a/osx/qtox.icns.xcassets/qtox.icns.appiconset/Contents.json b/osx/qtox.icns.xcassets/qtox.icns.appiconset/Contents.json new file mode 100644 index 0000000000..430bcd4e3d --- /dev/null +++ b/osx/qtox.icns.xcassets/qtox.icns.appiconset/Contents.json @@ -0,0 +1,68 @@ +{ + "images" : [ + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "qtox.icns-16.png", + "scale" : "1x" + }, + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "qtox.icns-16@2x.png", + "scale" : "2x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "qtox.icns-32.png", + "scale" : "1x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "qtox.icns-32@2x.png", + "scale" : "2x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "qtox.icns-128.png", + "scale" : "1x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "qtox.icns-128@2x.png", + "scale" : "2x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "qtox.icns-256.png", + "scale" : "1x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "qtox.icns-256@2x.png", + "scale" : "2x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "qtox.icns-512.png", + "scale" : "1x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "qtox.icns-512@2x.png", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/osx/qtox.icns.xcassets/qtox.icns.appiconset/qtox.icns-128.png b/osx/qtox.icns.xcassets/qtox.icns.appiconset/qtox.icns-128.png new file mode 100644 index 0000000000..e69de29bb2 diff --git a/osx/qtox.icns.xcassets/qtox.icns.appiconset/qtox.icns-128@2x.png b/osx/qtox.icns.xcassets/qtox.icns.appiconset/qtox.icns-128@2x.png new file mode 100644 index 0000000000..e69de29bb2 diff --git a/osx/qtox.icns.xcassets/qtox.icns.appiconset/qtox.icns-16.png b/osx/qtox.icns.xcassets/qtox.icns.appiconset/qtox.icns-16.png new file mode 100644 index 0000000000..e69de29bb2 diff --git a/osx/qtox.icns.xcassets/qtox.icns.appiconset/qtox.icns-16@2x.png b/osx/qtox.icns.xcassets/qtox.icns.appiconset/qtox.icns-16@2x.png new file mode 100644 index 0000000000..e69de29bb2 diff --git a/osx/qtox.icns.xcassets/qtox.icns.appiconset/qtox.icns-256.png b/osx/qtox.icns.xcassets/qtox.icns.appiconset/qtox.icns-256.png new file mode 100644 index 0000000000..e69de29bb2 diff --git a/osx/qtox.icns.xcassets/qtox.icns.appiconset/qtox.icns-256@2x.png b/osx/qtox.icns.xcassets/qtox.icns.appiconset/qtox.icns-256@2x.png new file mode 100644 index 0000000000..e69de29bb2 diff --git a/osx/qtox.icns.xcassets/qtox.icns.appiconset/qtox.icns-32.png b/osx/qtox.icns.xcassets/qtox.icns.appiconset/qtox.icns-32.png new file mode 100644 index 0000000000..e69de29bb2 diff --git a/osx/qtox.icns.xcassets/qtox.icns.appiconset/qtox.icns-32@2x.png b/osx/qtox.icns.xcassets/qtox.icns.appiconset/qtox.icns-32@2x.png new file mode 100644 index 0000000000..e69de29bb2 diff --git a/osx/qtox.icns.xcassets/qtox.icns.appiconset/qtox.icns-512.png b/osx/qtox.icns.xcassets/qtox.icns.appiconset/qtox.icns-512.png new file mode 100644 index 0000000000..e69de29bb2 diff --git a/osx/qtox.icns.xcassets/qtox.icns.appiconset/qtox.icns-512@2x.png b/osx/qtox.icns.xcassets/qtox.icns.appiconset/qtox.icns-512@2x.png new file mode 100644 index 0000000000..e69de29bb2 diff --git a/smileys/ASCII+Universe/LICENSE-GRAPHICS b/smileys/ASCII-Universe/LICENSE-GRAPHICS similarity index 100% rename from smileys/ASCII+Universe/LICENSE-GRAPHICS rename to smileys/ASCII-Universe/LICENSE-GRAPHICS diff --git a/smileys/ASCII+Universe/README.md b/smileys/ASCII-Universe/README.md similarity index 100% rename from smileys/ASCII+Universe/README.md rename to smileys/ASCII-Universe/README.md diff --git a/smileys/ASCII+Universe/emoticons.xml b/smileys/ASCII-Universe/emoticons.xml similarity index 100% rename from smileys/ASCII+Universe/emoticons.xml rename to smileys/ASCII-Universe/emoticons.xml diff --git a/smileys/ASCII+emojione/emoticons.xml b/smileys/ASCII-emojione/emoticons.xml similarity index 100% rename from smileys/ASCII+emojione/emoticons.xml rename to smileys/ASCII-emojione/emoticons.xml diff --git a/smileys/emojione.qrc b/smileys/emojione.qrc index d3992c8d8b..1c6cef92d4 100644 --- a/smileys/emojione.qrc +++ b/smileys/emojione.qrc @@ -1834,6 +1834,6 @@ emojione/3297.svg emojione/3299.svg emojione/emoticons.xml - ASCII+emojione/emoticons.xml + ASCII-emojione/emoticons.xml diff --git a/smileys/smileys.qrc b/smileys/smileys.qrc index d74b83eb3d..9cf9b782ac 100644 --- a/smileys/smileys.qrc +++ b/smileys/smileys.qrc @@ -840,6 +840,6 @@ Universe/1f1f7-1f1fa.svg Universe/1f1fa-1f1f8.svg Universe/emoticons.xml - ASCII+Universe/emoticons.xml + ASCII-Universe/emoticons.xml diff --git a/src/BUILD.bazel b/src/BUILD.bazel new file mode 100644 index 0000000000..c4d281abba --- /dev/null +++ b/src/BUILD.bazel @@ -0,0 +1,275 @@ +load("@rules_cc//cc:defs.bzl", "cc_library", "objc_library") +load("//third_party/qt:build_defs.bzl", "qt_moc", "qt_uic") + +package(features = ["layering_check"]) + +VERSION = "1.16.3" + +qt_moc( + name = "src_moc", + srcs = [ + "appmanager.h", + "chatlog/chatlinecontent.h", + "chatlog/chatlinecontentproxy.h", + "chatlog/chatwidget.h", + "chatlog/content/broken.h", + "chatlog/content/filetransferwidget.h", + "chatlog/content/notificationicon.h", + "chatlog/content/spinner.h", + "chatlog/content/text.h", + "chatlog/content/timestamp.h", + "chatlog/customtextdocument.h", + "core/core.h", + "core/coreav.h", + "core/coreext.h", + "core/corefile.h", + "core/toxcall.h", + "ipc.h", + "model/about/aboutfriend.h", + "model/chat.h", + "model/chathistory.h", + "model/chatroom/friendchatroom.h", + "model/chatroom/groupchatroom.h", + "model/friend.h", + "model/friendlist/friendlistmanager.h", + "model/friendmessagedispatcher.h", + "model/group.h", + "model/groupmessagedispatcher.h", + "model/ichatlog.h", + "model/imessagedispatcher.h", + "model/notificationgenerator.h", + "model/profile/profileinfo.h", + "model/sessionchatlog.h", + "net/avatarbroadcaster.h", + "net/bootstrapnodeupdater.h", + "net/toxuri.h", + "net/updatecheck.h", + "nexus.h", + "persistence/db/rawdatabase.h", + "persistence/history.h", + "persistence/offlinemsgengine.h", + "persistence/profile.h", + "persistence/settings.h", + "persistence/smileypack.h", + "platform/posixsignalnotifier.h", + "video/camerasource.h", + "video/corevideosource.h", + "video/netcamview.h", + "video/videosource.h", + "video/videosurface.h", + "widget/about/aboutfriendform.h", + "widget/categorywidget.h", + "widget/chatformheader.h", + "widget/circlewidget.h", + "widget/contentdialog.h", + "widget/contentdialogmanager.h", + "widget/emoticonswidget.h", + "widget/extensionstatus.h", + "widget/form/addfriendform.h", + "widget/form/chatform.h", + "widget/form/filesform.h", + "widget/form/genericchatform.h", + "widget/form/groupchatform.h", + "widget/form/groupinviteform.h", + "widget/form/groupinvitewidget.h", + "widget/form/loadhistorydialog.h", + "widget/form/profileform.h", + "widget/form/searchsettingsform.h", + "widget/form/setpassworddialog.h", + "widget/form/settings/aboutform.h", + "widget/form/settings/advancedform.h", + "widget/form/settings/avform.h", + "widget/form/settings/generalform.h", + "widget/form/settings/genericsettings.h", + "widget/form/settings/privacyform.h", + "widget/form/settings/userinterfaceform.h", + "widget/form/settings/verticalonlyscroller.h", + "widget/form/settingswidget.h", + "widget/form/tabcompleter.h", + "widget/friendlistlayout.h", + "widget/friendlistwidget.h", + "widget/friendwidget.h", + "widget/genericchatitemwidget.h", + "widget/genericchatroomwidget.h", + "widget/groupwidget.h", + "widget/loginscreen.h", + "widget/maskablepixmapwidget.h", + "widget/notificationedgewidget.h", + "widget/passwordedit.h", + "widget/qrwidget.h", + "widget/searchform.h", + "widget/style.h", + "widget/tool/activatedialog.h", + "widget/tool/adjustingscrollarea.h", + "widget/tool/callconfirmwidget.h", + "widget/tool/chattextedit.h", + "widget/tool/croppinglabel.h", + "widget/tool/flyoutoverlaywidget.h", + "widget/tool/messageboxmanager.h", + "widget/tool/profileimporter.h", + "widget/tool/removechatdialog.h", + "widget/tool/screengrabberchooserrectitem.h", + "widget/tool/screengrabberoverlayitem.h", + "widget/tool/screenshotgrabber.h", + "widget/tool/toolboxgraphicsitem.h", + "widget/widget.h", + ], + hdrs = glob(["**/*.h"]), + mocopts = [ + "-Iqtox", + "-Iqtox/util/include", + ], + deps = [ + "//qtox/util", + "@qt//:qt_widgets", + ], +) + +qt_uic( + name = "src_ui", + srcs = glob(["**/*.ui"]), +) + +objc_library( + name = "avfoundation", + hdrs = [ + "platform/camera/avfoundation.h", + "video/videomode.h", + ], + copts = ["-Wno-vla-extension"], + includes = ["."], + non_arc_srcs = ["platform/camera/avfoundation.mm"], + sdk_frameworks = ["AVFoundation"], + tags = ["macos"], + deps = ["@qt//:qt_core"], +) + +genrule( + name = "version", + outs = ["version.h"], + cmd = """cat < $@ +#define GIT_DESCRIBE "v%s" +#define GIT_DESCRIBE_EXACT "v%s" +#define GIT_VERSION "master" +#define TIMESTAMP "redacted" +EOF""" % (VERSION, VERSION), +) + +cc_library( + name = "src", + srcs = [ + ":src_moc", + ":src_ui", + ] + glob( + [ + "**/*.cpp", + ], + exclude = [ + "main.cpp", + "platform/camera/v4l2.cpp", + "platform/camera/directshow.cpp", + "platform/posixsignalnotifier.cpp", + "platform/*_osx.cpp", + "platform/*_win.cpp", + "platform/*_x11.cpp", + "platform/x11_*.cpp", + ], + ) + select({ + "//tools/config:freebsd": [ + "platform/camera/v4l2.cpp", + "platform/posixsignalnotifier.cpp", + ], + "//tools/config:linux": [ + "platform/camera/v4l2.cpp", + "platform/capslock_x11.cpp", + "platform/posixsignalnotifier.cpp", + "platform/timer_x11.cpp", + "platform/x11_display.cpp", + ], + "//tools/config:osx": [ + "platform/capslock_osx.cpp", + "platform/install_osx.cpp", + "platform/posixsignalnotifier.cpp", + "platform/timer_osx.cpp", + ], + "//tools/config:windows": [ + "platform/camera/directshow.cpp", + "platform/capslock_win.cpp", + "platform/timer_win.cpp", + ], + }), + hdrs = glob(["**/*.h"]) + [":version"], + copts = [ + "-Iqtox", + "-I$(GENDIR)/qtox", + ] + select({ + "//tools/config:freebsd": [], + "//tools/config:linux": ["-fPIC"], + "//tools/config:osx": [], + "//tools/config:windows": [], + }), + defines = [ + "DEBUG", + #"DESKTOP_NOTIFICATIONS", + "QTOX_PLATFORM_EXT", + "QT_MESSAGELOGCONTEXT", + "UPDATE_CHECK_ENABLED", + ], + includes = ["."], + linkopts = select({ + "//tools/config:freebsd": [], + "//tools/config:linux": [], + "//tools/config:osx": ["-framework IOKit"], + "//tools/config:windows": [], + }), + visibility = ["//qtox:__subpackages__"], + deps = [ + "//c-toxcore", + "//qtox:res_lib", + "//qtox/audio", + "//qtox/util", + "@ffmpeg", + "@libexif", + "@libqrencode", + "@libsodium", + "@libvpx", + "@openal", + "@qt//:qt_concurrent", + "@qt//:qt_core", + "@qt//:qt_gui", + "@qt//:qt_network", + "@qt//:qt_svg", + "@qt//:qt_widgets", + "@qt//:qt_xml", + "@sqlcipher", + "@tox_extension_messages", + "@toxext", + ] + select({ + "//tools/config:freebsd": [], + "//tools/config:linux": [ + "@x11", + "@xss", + ], + "//tools/config:osx": [":avfoundation"], + "//tools/config:windows": [], + }), +) + +cc_library( + name = "main", + srcs = ["main.cpp"], + copts = [ + "-Iqtox", + "-I$(GENDIR)/qtox", + ] + select({ + "//tools/config:freebsd": [], + "//tools/config:linux": ["-fPIC"], + "//tools/config:osx": [], + "//tools/config:windows": [], + }), + visibility = ["//qtox:__subpackages__"], + deps = [ + ":src", + "//qtox/audio", + ], +) diff --git a/src/appmanager.cpp b/src/appmanager.cpp index dafc11c3de..693495f985 100644 --- a/src/appmanager.cpp +++ b/src/appmanager.cpp @@ -28,6 +28,7 @@ #include "src/nexus.h" #include "src/net/toxuri.h" #include "src/widget/widget.h" +#include "src/version.h" #include "src/video/camerasource.h" #if defined(Q_OS_UNIX) diff --git a/src/chatlog/chatwidget.cpp b/src/chatlog/chatwidget.cpp index 517b0c259a..f97958b0a2 100644 --- a/src/chatlog/chatwidget.cpp +++ b/src/chatlog/chatwidget.cpp @@ -787,7 +787,7 @@ void ChatWidget::selectAll() clearSelection(); selectionMode = SelectionMode::Multi; - selFirstRow = chatLineStorage->front();; + selFirstRow = chatLineStorage->front(); selLastRow = chatLineStorage->back(); emit selectionChanged(); diff --git a/src/chatlog/chatwidget.h b/src/chatlog/chatwidget.h index da09c85561..6c7232cef7 100644 --- a/src/chatlog/chatwidget.h +++ b/src/chatlog/chatwidget.h @@ -66,7 +66,7 @@ class ChatWidget : public QGraphicsView ChatLineContent* getContentFromGlobalPos(QPoint pos) const; const uint repNameAfter = 5 * 60; - void setColorizedNames(bool enable) { colorizeNames = enable; }; + void setColorizedNames(bool enable) { colorizeNames = enable; } void jumpToDate(QDate date); void jumpToIdx(ChatLogIdx idx); diff --git a/src/core/core.cpp b/src/core/core.cpp index 17480e52c9..1fe01d5201 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -376,7 +376,9 @@ bool Core::checkConnection() toxConnected = true; connectionName = "the UDP DHT"; break; - qWarning() << "tox_self_get_connection_status returned unknown enum!"; + default: + qWarning() << "tox_self_get_connection_status returned unknown enum!"; + break; } if (toxConnected && !isConnected) { @@ -519,7 +521,9 @@ void Core::onConnectionStatusChanged(Tox* tox, uint32_t friendId, Tox_Connection friendStatus = Status::Status::Online; qDebug() << "Connected to friend" << friendId << "directly with UDP"; break; - qWarning() << "tox_callback_friend_connection_status returned unknown enum!"; + default: + qWarning() << "tox_callback_friend_connection_status returned unknown enum!"; + break; } // Ignore Online because it will be emited from onUserStatusChanged diff --git a/src/model/profile/profileinfo.h b/src/model/profile/profileinfo.h index 3158068c4d..b624ba8e87 100644 --- a/src/model/profile/profileinfo.h +++ b/src/model/profile/profileinfo.h @@ -20,9 +20,9 @@ #pragma once #include -#include "util/interface.h" -#include "src/core/toxpk.h" #include "iprofileinfo.h" +#include "src/core/toxpk.h" +#include "util/interface.h" class Core; class QFile; diff --git a/src/net/updatecheck.cpp b/src/net/updatecheck.cpp index 3c86855192..dc03f16465 100644 --- a/src/net/updatecheck.cpp +++ b/src/net/updatecheck.cpp @@ -18,6 +18,7 @@ */ #include "src/net/updatecheck.h" #include "src/persistence/settings.h" +#include "src/version.h" #include #include diff --git a/src/net/updatecheck.h b/src/net/updatecheck.h index b77cdd7e7c..c2611c62e4 100644 --- a/src/net/updatecheck.h +++ b/src/net/updatecheck.h @@ -22,6 +22,7 @@ #include #include #include +#include #include diff --git a/src/persistence/db/upgrades/dbupgrader.cpp b/src/persistence/db/upgrades/dbupgrader.cpp index d0db75a355..b474599e95 100644 --- a/src/persistence/db/upgrades/dbupgrader.cpp +++ b/src/persistence/db/upgrades/dbupgrader.cpp @@ -78,7 +78,7 @@ struct DuplicateAlias : goodAliasRow{goodAliasRow_} , badAliasRows{badAliasRows_} {} - DuplicateAlias(){}; + DuplicateAlias(){} RowId goodAliasRow{-1}; std::vector badAliasRows; }; diff --git a/src/persistence/settings.cpp b/src/persistence/settings.cpp index 21109775f1..75035ced7e 100644 --- a/src/persistence/settings.cpp +++ b/src/persistence/settings.cpp @@ -142,7 +142,7 @@ void Settings::loadGlobal() translation = s.value("translation", "en").toString(); showSystemTray = s.value("showSystemTray", true).toBool(); autostartInTray = s.value("autostartInTray", false).toBool(); - closeToTray = s.value("closeToTray", false).toBool(); + closeToTray = s.value("closeToTray", true).toBool(); if (currentProfile.isEmpty()) { currentProfile = s.value("currentProfile", "").toString(); currentProfileId = makeProfileId(currentProfile); diff --git a/src/persistence/settings.h b/src/persistence/settings.h index 3760c285f2..91b2c7cd53 100644 --- a/src/persistence/settings.h +++ b/src/persistence/settings.h @@ -411,7 +411,7 @@ public slots: QString getSmileyPack() const override; void setSmileyPack(const QString& value); - SIGNAL_IMPL(Settings, smileyPackChanged, const QString& name); + SIGNAL_IMPL(Settings, smileyPackChanged, const QString& name) int getThemeColor() const; void setThemeColor(int value); diff --git a/src/platform/camera/avfoundation.mm b/src/platform/camera/avfoundation.mm index 92338b5262..057f8725ae 100644 --- a/src/platform/camera/avfoundation.mm +++ b/src/platform/camera/avfoundation.mm @@ -19,6 +19,7 @@ */ #include "avfoundation.h" +#include #include #import @@ -26,6 +27,29 @@ QVector > avfoundation::getDeviceList() { QVector > result; + qDebug() << "!!!!!!!!!!!!!!!!!!!!!! Getting the device list from AVFoundation. !!!!!!!!!!!!!!!!!!!!!!"; + +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400 + const AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo]; + if (authStatus != AVAuthorizationStatusDenied && authStatus != AVAuthorizationStatusNotDetermined) { + qDebug() << "We already have access to the camera."; + } else { + qDebug() << "We don't have access to the camera yet; asking user for permission."; + QMutex mutex; + QMutex *mutexPtr = &mutex; + __block BOOL isGranted = false; + [AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted) { + isGranted = granted; + mutexPtr->unlock(); + }]; + mutex.lock(); + if (isGranted) { + qInfo() << "We now have access to the camera."; + } else { + qInfo() << "User did not grant us permission to access the camera."; + } + } +#endif AVCaptureDevice* device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]; id objects[] = {device}; @@ -46,6 +70,8 @@ } } + qDebug() << "XXX: got devices from avfoundation" << devices; + qDebug() << "XXX: got devices from avfoundation" << result; return result; } diff --git a/src/video/cameradevice.cpp b/src/video/cameradevice.cpp index d2900cadb3..a451abc856 100644 --- a/src/video/cameradevice.cpp +++ b/src/video/cameradevice.cpp @@ -348,6 +348,7 @@ QVector> CameraDevice::getDeviceList() devices.append({"none", QObject::tr("None", "No camera device set")}); + qDebug() << "XXX: getting device list"; if (!getDefaultInputFormat()) return devices; @@ -364,6 +365,7 @@ QVector> CameraDevice::getDeviceList() #ifdef Q_OS_OSX else if (QString::fromUtf8(iformat->name) == QString("avfoundation")) devices += avfoundation::getDeviceList(); + } #endif else devices += getRawDeviceListGeneric(); @@ -387,6 +389,7 @@ QVector> CameraDevice::getDeviceList() QObject::tr("Desktop", "Desktop as a camera input for screen sharing")}); } + qDebug() << "XXX: got devices:" << devices; return devices; } @@ -516,8 +519,10 @@ bool CameraDevice::betterPixelFormat(uint32_t a, uint32_t b) bool CameraDevice::getDefaultInputFormat() { QMutexLocker locker(&iformatLock); - if (iformat) + if (iformat) { + qDebug() << "XXX: input format already done"; return true; + } avdevice_register_all(); @@ -543,6 +548,7 @@ bool CameraDevice::getDefaultInputFormat() #endif #ifdef Q_OS_OSX + qDebug() << "XXX: checking for input format"; if ((iformat = av_find_input_format("avfoundation"))) return true; if ((iformat = av_find_input_format("qtkit"))) diff --git a/src/widget/form/settings/aboutform.cpp b/src/widget/form/settings/aboutform.cpp index 2b874051e9..7f8e4a879a 100644 --- a/src/widget/form/settings/aboutform.cpp +++ b/src/widget/form/settings/aboutform.cpp @@ -23,6 +23,7 @@ #include "src/net/updatecheck.h" #include "src/persistence/profile.h" #include "src/persistence/settings.h" +#include "src/version.h" #include "src/widget/style.h" #include "src/widget/tool/recursivesignalblocker.h" #include "src/widget/translator.h" diff --git a/src/widget/form/settings/aboutform.h b/src/widget/form/settings/aboutform.h index 69252c1952..b9dbdcc6f0 100644 --- a/src/widget/form/settings/aboutform.h +++ b/src/widget/form/settings/aboutform.h @@ -21,6 +21,8 @@ #include "genericsettings.h" +#include + #include class Core; class QTimer; diff --git a/src/widget/widget.cpp b/src/widget/widget.cpp index aad8762729..9ebb1bcd6a 100644 --- a/src/widget/widget.cpp +++ b/src/widget/widget.cpp @@ -2307,8 +2307,11 @@ void Widget::onEventIconTick() } } +//#define XX_UBUNTU1604_XX 1 + void Widget::onTryCreateTrayIcon() { +#ifndef XX_UBUNTU1604_XX static int32_t tries = 15; if (!icon && tries--) { if (QSystemTrayIcon::isSystemTrayAvailable()) { @@ -2343,12 +2346,15 @@ void Widget::onTryCreateTrayIcon() show(); } } else { +#endif disconnect(timer, &QTimer::timeout, this, &Widget::onTryCreateTrayIcon); if (!icon) { qWarning() << "No system tray detected!"; show(); } +#ifndef XX_UBUNTU1604_XX } +#endif } void Widget::setStatusOnline() diff --git a/src/widget/widget.h b/src/widget/widget.h index 593d6371f8..c389c1a614 100644 --- a/src/widget/widget.h +++ b/src/widget/widget.h @@ -25,6 +25,7 @@ #include #include #include +#include #include "genericchatitemwidget.h" diff --git a/test/BUILD.bazel b/test/BUILD.bazel new file mode 100644 index 0000000000..0ea0a98fd5 --- /dev/null +++ b/test/BUILD.bazel @@ -0,0 +1,54 @@ +load("@rules_cc//cc:defs.bzl", "cc_library") +load("//third_party/qt:build_defs.bzl", "qt_moc", "qt_test") + +package(features = ["layering_check"]) + +qt_moc( + name = "mock_moc", + srcs = ["mock/include/mock/mockcoresettings.h"], + mocopts = [ + "-Iqtox", + "-Iqtox/util/include", + ], + deps = [ + "//qtox/src", + "//qtox/util", + ], +) + +cc_library( + name = "mock", + srcs = [":mock_moc"] + glob(["mock/src/*.cpp"]), + hdrs = glob(["mock/include/mock/*.h"]), + copts = ["-Iqtox"] + select({ + "//tools/config:freebsd": [], + "//tools/config:linux": ["-fPIC"], + "//tools/config:osx": [], + "//tools/config:windows": [], + }), + includes = ["mock/include"], + deps = ["//qtox/src"], +) + +[qt_test( + name = src[src.rindex("/") + 1:-4], + size = "small", + src = src, + copts = ["-Iqtox"] + select({ + "//tools/config:freebsd": [], + "//tools/config:linux": ["-fPIC"], + "//tools/config:osx": [], + "//tools/config:windows": [], + }), + mocopts = ["-Iqtox"], + deps = [ + ":mock", + "//c-toxcore", + "//qtox:res_lib", + "//qtox/src", + "//qtox/util", + ], +) for src in glob( + ["*/*_test.cpp"], + exclude = ["persistence/dbschema_test.cpp"], +)] diff --git a/test/model/groupmessagedispatcher_test.cpp b/test/model/groupmessagedispatcher_test.cpp index b9a182f233..f572f416e3 100644 --- a/test/model/groupmessagedispatcher_test.cpp +++ b/test/model/groupmessagedispatcher_test.cpp @@ -70,8 +70,8 @@ class MockGroupSettings : public QObject, public IGroupSettings void setBlackList(const QStringList& blist) override; SIGNAL_IMPL(MockGroupSettings, blackListChanged, QStringList const& blist) - bool getShowGroupJoinLeaveMessages() const override { return true; }; - void setShowGroupJoinLeaveMessages(bool newValue) override { std::ignore = newValue; }; + bool getShowGroupJoinLeaveMessages() const override { return true; } + void setShowGroupJoinLeaveMessages(bool newValue) override { std::ignore = newValue; } SIGNAL_IMPL(MockGroupSettings, showGroupJoinLeaveMessagesChanged, bool show) private: diff --git a/test/model/notificationgenerator_test.cpp b/test/model/notificationgenerator_test.cpp index 963f5f2864..eef689dfd3 100644 --- a/test/model/notificationgenerator_test.cpp +++ b/test/model/notificationgenerator_test.cpp @@ -45,7 +45,7 @@ namespace virtual void setNotifySound(bool newValue) override { std::ignore = newValue; } virtual bool getNotifyHide() const override { return notifyHide; } - virtual void setNotifyHide(bool newValue) override { notifyHide = newValue; }; + virtual void setNotifyHide(bool newValue) override { notifyHide = newValue; } virtual bool getBusySound() const override { return true; } virtual void setBusySound(bool newValue) override { std::ignore = newValue; } diff --git a/test/persistence/smileypack_test.cpp b/test/persistence/smileypack_test.cpp index 6e1442c149..66b7a0c7da 100644 --- a/test/persistence/smileypack_test.cpp +++ b/test/persistence/smileypack_test.cpp @@ -35,7 +35,7 @@ class MockSettings : public QObject, public ISmileySettings Q_OBJECT public: QString getSmileyPack() const override; - SIGNAL_IMPL(MockSettings, smileyPackChanged, const QString& name); + SIGNAL_IMPL(MockSettings, smileyPackChanged, const QString& name) }; QString MockSettings::getSmileyPack() const diff --git a/translations/translations.qrc b/translations/translations.qrc index 1edd220ef6..ce9c8597e1 100644 --- a/translations/translations.qrc +++ b/translations/translations.qrc @@ -2,7 +2,7 @@ ar.qm be.qm - ber.ts + ber.qm bg.qm cs.qm da.qm @@ -15,7 +15,7 @@ fa.qm fi.qm fr.qm - gl.ts + gl.qm he.qm hr.qm hu.qm @@ -23,7 +23,7 @@ it.qm ja.qm jbo.qm - kn.ts + kn.qm ko.qm lt.qm mk.qm @@ -35,10 +35,10 @@ pt.qm ro.qm ru.qm - si.ts + si.qm sk.qm sl.qm - sq.ts + sq.qm sr_Latn.qm sr.qm sv.qm diff --git a/util/BUILD.bazel b/util/BUILD.bazel new file mode 100644 index 0000000000..0d59fe316c --- /dev/null +++ b/util/BUILD.bazel @@ -0,0 +1,32 @@ +load("@rules_cc//cc:defs.bzl", "cc_library") + +package(features = ["layering_check"]) + +cc_library( + name = "util", + srcs = glob( + [ + "src/**/*.cpp", + ], + ), + hdrs = glob(["include/**/*.h"]), + copts = select({ + "//tools/config:freebsd": [], + "//tools/config:linux": ["-fPIC"], + "//tools/config:osx": [], + "//tools/config:windows": [], + }), + defines = [ + "DEBUG", + #"DESKTOP_NOTIFICATIONS", + "QTOX_PLATFORM_EXT", + "QT_MESSAGELOGCONTEXT", + "UPDATE_CHECK_ENABLED", + ], + includes = ["include"], + visibility = ["//qtox:__subpackages__"], + deps = [ + "//c-toxcore", + "@qt//:qt_core", + ], +) diff --git a/windows/BUILD.bazel b/windows/BUILD.bazel new file mode 100644 index 0000000000..c2b851782a --- /dev/null +++ b/windows/BUILD.bazel @@ -0,0 +1,8 @@ +load("//third_party/qt:build_defs.bzl", "qt_win_deploy") + +package(features = ["layering_check"]) + +qt_win_deploy( + name = "qtox", + deps = ["//qtox"], +)