Support building OS X 10.10/10.11 version.

This commit is contained in:
John Preston 2019-11-05 14:27:21 +03:00
parent 88e0342e02
commit 1eb62579e2
21 changed files with 63 additions and 120 deletions

View File

@ -268,7 +268,7 @@ EditCaptionBox::EditCaptionBox(
_field->setEditLinkCallback(
DefaultEditLinkCallback(&_controller->session(), _field));
_spelling = InitSpellchecker(&_controller->session(), _field);
InitSpellchecker(&_controller->session(), _field);
auto r = object_ptr<Ui::SlideWrap<Ui::Checkbox>>(
this,

View File

@ -24,10 +24,6 @@ namespace Data {
class Media;
} // namespace Data
namespace Spellchecker {
class SpellingHighlighter;
} // namespace Spellchecker
namespace Ui {
class InputField;
class EmojiButton;
@ -103,7 +99,6 @@ private:
object_ptr<Ui::EmojiButton> _emojiToggle = { nullptr };
base::unique_qptr<ChatHelpers::TabbedPanel> _emojiPanel;
base::unique_qptr<QObject> _emojiFilter;
base::unique_qptr<Spellchecker::SpellingHighlighter> _spelling;
int _thumbx = 0;
int _thumbw = 0;

View File

@ -1679,7 +1679,7 @@ void SendFilesBox::setupCaption() {
_caption,
&_controller->session());
_spelling = InitSpellchecker(&_controller->session(), _caption);
InitSpellchecker(&_controller->session(), _caption);
updateCaptionPlaceholder();
setupEmojiPanel();

View File

@ -40,10 +40,6 @@ namespace Window {
class SessionController;
} // namespace Window
namespace Spellchecker {
class SpellingHighlighter;
} // namespace Spellchecker
enum class SendMenuType;
enum class SendFilesWay {
@ -154,7 +150,6 @@ private:
object_ptr<Ui::EmojiButton> _emojiToggle = { nullptr };
base::unique_qptr<ChatHelpers::TabbedPanel> _emojiPanel;
base::unique_qptr<QObject> _emojiFilter;
base::unique_qptr<Spellchecker::SpellingHighlighter> _spelling;
object_ptr<Ui::Radioenum<SendFilesWay>> _sendAlbum = { nullptr };
object_ptr<Ui::Radioenum<SendFilesWay>> _sendPhotos = { nullptr };

View File

@ -207,7 +207,7 @@ void ShareBox::prepareCommentField() {
field->setEditLinkCallback(
DefaultEditLinkCallback(&_navigation->session(), field));
_spelling = InitSpellchecker(&_navigation->session(), field);
InitSpellchecker(&_navigation->session(), field);
Ui::SendPendingMoveResizeEvents(_comment);
}

View File

@ -36,10 +36,6 @@ namespace Notify {
struct PeerUpdate;
} // namespace Notify
namespace Spellchecker {
class SpellingHighlighter;
} // namespace Spellchecker
namespace Ui {
class MultiSelect;
class InputField;
@ -117,7 +113,6 @@ private:
object_ptr<Ui::MultiSelect> _select;
object_ptr<Ui::SlideWrap<Ui::InputField>> _comment;
base::unique_qptr<Spellchecker::SpellingHighlighter> _spelling;
class Inner;
QPointer<Inner> _inner;

View File

@ -78,7 +78,6 @@ private:
QString _startLink;
Fn<void(QString, QString)> _callback;
Fn<void()> _setInnerFocus;
base::unique_qptr<Spellchecker::SpellingHighlighter> _spelling;
};
@ -128,7 +127,7 @@ void EditLinkBox::prepare() {
getDelegate()->outerContainer(),
text,
_session);
_spelling = InitSpellchecker(_session, text);
InitSpellchecker(_session, text);
const auto url = content->add(
object_ptr<Ui::InputField>(
@ -275,10 +274,11 @@ void InitMessageField(
DefaultEditLinkCallback(&controller->session(), field));
}
base::unique_qptr<Spellchecker::SpellingHighlighter> InitSpellchecker(
not_null<Main::Session*> session,
not_null<Ui::InputField*> field) {
auto s = base::make_unique_q<Spellchecker::SpellingHighlighter>(
void InitSpellchecker(
not_null<Main::Session*> session,
not_null<Ui::InputField*> field) {
#ifndef TDESKTOP_DISABLE_SPELLCHECK
const auto s = field->lifetime().make_state<Spellchecker::SpellingHighlighter>(
field->rawTextEdit(),
session->settings().spellcheckerEnabledValue(),
field->documentContentsChanges());
@ -288,7 +288,7 @@ base::unique_qptr<Spellchecker::SpellingHighlighter> InitSpellchecker(
{ &ph::lng_spellchecker_ignore, tr::lng_spellchecker_ignore() },
} });
field->setExtendedContextMenu(s->contextMenuCreated());
return s;
#endif // TDESKTOP_DISABLE_SPELLCHECK
}
bool HasSendText(not_null<const Ui::InputField*> field) {

View File

@ -7,11 +7,14 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
#include "spellcheck/spelling_highlighter.h"
#include "ui/widgets/input_fields.h"
#include "base/timer.h"
#include "base/qt_connection.h"
#ifndef TDESKTOP_DISABLE_SPELLCHECK
#include "spellcheck/spelling_highlighter.h"
#endif // TDESKTOP_DISABLE_SPELLCHECK
#include <QtGui/QClipboard>
namespace Main {
@ -35,9 +38,11 @@ Fn<bool(
void InitMessageField(
not_null<Window::SessionController*> controller,
not_null<Ui::InputField*> field);
base::unique_qptr<Spellchecker::SpellingHighlighter> InitSpellchecker(
void InitSpellchecker(
not_null<Main::Session*> session,
not_null<Ui::InputField*> field);
bool HasSendText(not_null<const Ui::InputField*> field);
struct InlineBotQuery {

View File

@ -416,7 +416,7 @@ HistoryWidget::HistoryWidget(
}
Unexpected("action in MimeData hook.");
});
_spelling = InitSpellchecker(&controller->session(), _field);
InitSpellchecker(&controller->session(), _field);
const auto suggestions = Ui::Emoji::SuggestionsController::Init(
this,

View File

@ -86,10 +86,6 @@ class ContactStatus;
class Element;
} // namespace HistoryView
namespace Spellchecker {
class SpellingHighlighter;
} // namespace Spellchecker
class DragArea;
class SendFilesBox;
class BotKeyboard;
@ -745,7 +741,6 @@ private:
object_ptr<Ui::IconButton> _scheduled = { nullptr };
bool _cmdStartShown = false;
object_ptr<Ui::InputField> _field;
base::unique_qptr<Spellchecker::SpellingHighlighter> _spelling;
bool _recording = false;
bool _inField = false;
bool _inReplyEditForward = false;

View File

@ -25,8 +25,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <QtGui/QWindow>
#include <QtWidgets/QApplication>
#if __has_include(<QtCore/QOperatingSystemVersion>)
#include <QtCore/QOperatingSystemVersion>
#endif // __has_include(<QtCore/QOperatingSystemVersion>)
#include <Cocoa/Cocoa.h>
#include <CoreFoundation/CFURL.h>
#include <IOKit/IOKitLib.h>
@ -285,6 +286,7 @@ void objc_outputDebugString(const QString &str) {
}
void objc_start() {
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
// Patch: Fix macOS regression. On 10.14.4, it crashes on GPU switches.
// See https://bugreports.qt.io/browse/QTCREATORBUG-22215
const auto version = QOperatingSystemVersion::current();
@ -293,6 +295,7 @@ void objc_start() {
&& version.microVersion() == 4) {
qputenv("QT_MAC_PRO_WEBENGINE_WORKAROUND", "1");
}
#endif // Qt 5.9.0
_sharedDelegate = [[ApplicationDelegate alloc] init];
[[NSApplication sharedApplication] setDelegate:_sharedDelegate];

View File

@ -8,8 +8,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <QtCore/QtPlugin>
Q_IMPORT_PLUGIN(QWebpPlugin)
#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
Q_IMPORT_PLUGIN(QJpegPlugin)
Q_IMPORT_PLUGIN(QGifPlugin)
#endif // Qt 5.8.0
#ifdef Q_OS_WIN
Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
#elif defined Q_OS_MAC // Q_OS_WIN

View File

@ -76,7 +76,6 @@
'<(submodules_loc)/codegen/codegen.gyp:codegen_style',
'<(submodules_loc)/lib_base/lib_base.gyp:lib_base',
'<(submodules_loc)/lib_ui/lib_ui.gyp:lib_ui',
'<(submodules_loc)/lib_spellcheck/lib_spellcheck.gyp:lib_spellcheck',
'<(third_party_loc)/libtgvoip/libtgvoip.gyp:libtgvoip',
'<(submodules_loc)/lib_lottie/lib_lottie.gyp:lib_lottie',
'tests/tests.gyp:tests',
@ -122,16 +121,22 @@
'sources!': [
'<!@(<(list_sources_command) <(qt_moc_list_sources_arg) --exclude_for <(build_os))',
],
'conditions': [
[ '"<(special_build_target)" != ""', {
'defines': [
'TDESKTOP_OFFICIAL_TARGET=<(special_build_target)',
'TDESKTOP_FORCE_GTK_FILE_DIALOG',
],
'dependencies': [
'utils.gyp:Packer',
],
}],
],
'conditions': [[ 'not build_osx', {
'dependencies': [
'<(submodules_loc)/lib_spellcheck/lib_spellcheck.gyp:lib_spellcheck',
],
}, {
'defines': [
'TDESKTOP_DISABLE_SPELLCHECK',
],
}], [ '"<(special_build_target)" != ""', {
'defines': [
'TDESKTOP_OFFICIAL_TARGET=<(special_build_target)',
'TDESKTOP_FORCE_GTK_FILE_DIALOG',
],
'dependencies': [
'utils.gyp:Packer',
],
}]],
}],
}

@ -1 +1 @@
Subproject commit be301940b8e5ac46c52f205e40d4f7ad307912af
Subproject commit 3a10166f5c99a4658c70480b3e8ec8c0f2870219

View File

@ -32,14 +32,6 @@
'lib_scheme.gyp:lib_scheme',
'<(submodules_loc)/lib_base/lib_base.gyp:lib_base',
],
'conditions': [[ 'build_macold', {
'xcode_settings': {
'OTHER_CPLUSPLUSFLAGS': [ '-nostdinc++' ],
},
'include_dirs': [
'/usr/local/macold/include/c++/v1',
],
}]],
'include_dirs': [
'<(src_loc)',
],

View File

@ -44,13 +44,6 @@
'defines': [
'TDESKTOP_OFFICIAL_TARGET=<(special_build_target)',
],
}], [ 'build_macold', {
'xcode_settings': {
'OTHER_CPLUSPLUSFLAGS': [ '-nostdinc++' ],
},
'include_dirs': [
'/usr/local/macold/include/c++/v1',
],
}]],
}],
}

View File

@ -37,13 +37,5 @@
'<(lz4_loc)/xxhash.c',
'<(lz4_loc)/xxhash.h',
],
'conditions': [[ 'build_macold', {
'xcode_settings': {
'OTHER_CPLUSPLUSFLAGS': [ '-nostdinc++' ],
},
'include_dirs': [
'/usr/local/macold/include/c++/v1',
],
}]],
}],
}

View File

@ -30,14 +30,6 @@
'export_dependent_settings': [
'lib_scheme.gyp:lib_scheme',
],
'conditions': [[ 'build_macold', {
'xcode_settings': {
'OTHER_CPLUSPLUSFLAGS': [ '-nostdinc++' ],
},
'include_dirs': [
'/usr/local/macold/include/c++/v1',
],
}]],
'include_dirs': [
'<(src_loc)',
],

View File

@ -21,14 +21,6 @@
},
'defines': [
],
'conditions': [[ 'build_macold', {
'xcode_settings': {
'OTHER_CPLUSPLUSFLAGS': [ '-nostdinc++' ],
},
'include_dirs': [
'/usr/local/macold/include/c++/v1',
],
}]],
'dependencies': [
'<(submodules_loc)/lib_base/lib_base.gyp:lib_base',
'<(submodules_loc)/lib_tl/lib_tl.gyp:lib_tl',

View File

@ -62,14 +62,7 @@
'<(src_loc)/storage/cache/storage_cache_types.cpp',
'<(src_loc)/storage/cache/storage_cache_types.h',
],
'conditions': [[ 'build_macold', {
'xcode_settings': {
'OTHER_CPLUSPLUSFLAGS': [ '-nostdinc++' ],
},
'include_dirs': [
'/usr/local/macold/include/c++/v1',
],
}], [ 'build_win', {
'conditions': [[ 'build_win', {
'sources!': [
'<(src_loc)/storage/storage_clear_legacy_posix.cpp',
'<(src_loc)/storage/storage_file_lock_posix.cpp',

View File

@ -49,43 +49,35 @@
},
},
},
}], [ 'build_macold', {
}], [ 'build_osx', {
'xcode_settings': {
'OTHER_CPLUSPLUSFLAGS': [ '-nostdinc++' ],
'OTHER_LDFLAGS': [
'-isysroot', '/',
'-L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/',
'-lbase',
'-lcrashpad_client',
'-lcrashpad_util',
'/usr/local/macold/lib/libz.a',
'/usr/local/macold/lib/libopus.a',
'/usr/local/macold/lib/libopenal.a',
'/usr/local/macold/lib/libiconv.a',
'/usr/local/macold/lib/libavcodec.a',
'/usr/local/macold/lib/libavformat.a',
'/usr/local/macold/lib/libavutil.a',
'/usr/local/macold/lib/libswscale.a',
'/usr/local/macold/lib/libswresample.a',
'/usr/local/macold/lib/libexif.a',
'/usr/local/macold/lib/libc++.a',
'/usr/local/macold/lib/libc++abi.a',
'/usr/local/lib/libz.a',
'/usr/local/lib/libopus.a',
'/usr/local/lib/libopenal.a',
'/usr/local/lib/libiconv.a',
'/usr/local/lib/libavcodec.a',
'/usr/local/lib/libavformat.a',
'/usr/local/lib/libavutil.a',
'/usr/local/lib/libswscale.a',
'/usr/local/lib/libswresample.a',
],
},
'include_dirs': [
'/usr/local/macold',
'/usr/local/macold/include/c++/v1',
'<(libs_loc)/macold/libexif-0.6.20',
'<(libs_loc)/macold/crashpad',
'<(libs_loc)/macold/crashpad/third_party/mini_chromium/mini_chromium',
'/usr/local',
'<(libs_loc)/crashpad',
'<(libs_loc)/crashpad/third_party/mini_chromium/mini_chromium',
],
'configurations': {
'Debug': {
'xcode_settings': {
'PRODUCT_BUNDLE_IDENTIFIER': 'com.tdesktop.TelegramDebugOld',
'PRODUCT_BUNDLE_IDENTIFIER': 'com.tdesktop.TelegramDebugOsx',
},
'library_dirs': [
'<(libs_loc)/macold/crashpad/out/Debug',
'<(libs_loc)/crashpad/out/Debug',
],
},
'Release': {
@ -93,7 +85,7 @@
'PRODUCT_BUNDLE_IDENTIFIER': 'com.tdesktop.Telegram',
},
'library_dirs': [
'<(libs_loc)/macold/crashpad/out/Release',
'<(libs_loc)/crashpad/out/Release',
],
},
},
@ -118,7 +110,7 @@
'postbuild_name': 'Copy crashpad_handler to Helpers',
'action': [
'cp',
'<(libs_loc)/macold/crashpad/out/${CONFIGURATION}/crashpad_handler',
'<(libs_loc)/crashpad/out/${CONFIGURATION}/crashpad_handler',
'${BUILT_PRODUCTS_DIR}/Telegram.app/Contents/Helpers/',
],
}],
@ -152,7 +144,7 @@
],
},
},
}], [ '"<(build_macold)" != "1" and "<(build_macstore)" != "1"', {
}], [ '"<(build_osx)" != "1" and "<(build_macstore)" != "1"', {
'xcode_settings': {
'OTHER_LDFLAGS': [
'-lbase',