Version for OS X 10.6-10.7 build from GYP is ready, not tested yet.

This commit is contained in:
John Preston 2016-08-29 23:24:16 -06:00
parent b821978a36
commit 50616cc267
26 changed files with 264 additions and 77 deletions

View File

@ -21,9 +21,9 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "stdafx.h" #include "stdafx.h"
#include "app.h" #include "app.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0) #ifdef OS_MAC_OLD
#include <libexif/exif-data.h> #include <libexif/exif-data.h>
#endif #endif // OS_MAC_OLD
#include "styles/style_overview.h" #include "styles/style_overview.h"
#include "styles/style_mediaview.h" #include "styles/style_mediaview.h"
@ -2395,9 +2395,9 @@ namespace {
} }
{ {
QImageReader reader(&buffer, *format); QImageReader reader(&buffer, *format);
#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0) #ifndef OS_MAC_OLD
reader.setAutoTransform(true); reader.setAutoTransform(true);
#endif #endif // OS_MAC_OLD
if (animated) *animated = reader.supportsAnimation() && reader.imageCount() > 1; if (animated) *animated = reader.supportsAnimation() && reader.imageCount() > 1;
QByteArray fmt = reader.format(); QByteArray fmt = reader.format();
if (!fmt.isEmpty()) *format = fmt; if (!fmt.isEmpty()) *format = fmt;
@ -2410,7 +2410,7 @@ namespace {
buffer.seek(0); buffer.seek(0);
QString fmt = QString::fromUtf8(*format).toLower(); QString fmt = QString::fromUtf8(*format).toLower();
if (fmt == "jpg" || fmt == "jpeg") { if (fmt == "jpg" || fmt == "jpeg") {
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0) #ifdef OS_MAC_OLD
ExifData *exifData = exif_data_new_from_data((const uchar*)(data.constData()), data.size()); ExifData *exifData = exif_data_new_from_data((const uchar*)(data.constData()), data.size());
if (exifData) { if (exifData) {
ExifByteOrder byteOrder = exif_data_get_byte_order(exifData); ExifByteOrder byteOrder = exif_data_get_byte_order(exifData);
@ -2431,7 +2431,7 @@ namespace {
} }
exif_data_free(exifData); exif_data_free(exifData);
} }
#endif #endif // OS_MAC_OLD
} else if (opaque && result.hasAlphaChannel()) { } else if (opaque && result.hasAlphaChannel()) {
QImage solid(result.width(), result.height(), QImage::Format_ARGB32_Premultiplied); QImage solid(result.width(), result.height(), QImage::Format_ARGB32_Premultiplied);
solid.fill(st::white->c); solid.fill(st::white->c);

View File

@ -664,7 +664,7 @@ bool Generator::writeIconValues() {
if (maskData.isEmpty()) { if (maskData.isEmpty()) {
return false; return false;
} }
source_->stream() << "const uchar iconMask" << i.value() << "Data[] = " << stringToBinaryArray(maskData.toStdString()) << ";\n"; source_->stream() << "const uchar iconMask" << i.value() << "Data[] = " << stringToBinaryArray(std::string(maskData.constData(), maskData.size())) << ";\n";
source_->stream() << "IconMask iconMask" << i.value() << "(iconMask" << i.value() << "Data);\n\n"; source_->stream() << "IconMask iconMask" << i.value() << "(iconMask" << i.value() << "Data);\n\n";
} }
return true; return true;

View File

@ -175,6 +175,8 @@ template <typename T, size_t N> char(&ArraySizeHelper(T(&array)[N]))[N];
// For QFlags<> declared in private section of a class we need to declare // For QFlags<> declared in private section of a class we need to declare
// operators from Q_DECLARE_OPERATORS_FOR_FLAGS as friend functions. // operators from Q_DECLARE_OPERATORS_FOR_FLAGS as friend functions.
#ifndef OS_MAC_OLD
#define Q_DECLARE_FRIEND_INCOMPATIBLE_FLAGS(Flags) \ #define Q_DECLARE_FRIEND_INCOMPATIBLE_FLAGS(Flags) \
friend Q_DECL_CONSTEXPR QIncompatibleFlag operator|(Flags::enum_type f1, int f2) Q_DECL_NOTHROW; friend Q_DECL_CONSTEXPR QIncompatibleFlag operator|(Flags::enum_type f1, int f2) Q_DECL_NOTHROW;
@ -183,6 +185,18 @@ friend Q_DECL_CONSTEXPR QFlags<Flags::enum_type> operator|(Flags::enum_type f1,
friend Q_DECL_CONSTEXPR QFlags<Flags::enum_type> operator|(Flags::enum_type f1, QFlags<Flags::enum_type> f2) Q_DECL_NOTHROW; \ friend Q_DECL_CONSTEXPR QFlags<Flags::enum_type> operator|(Flags::enum_type f1, QFlags<Flags::enum_type> f2) Q_DECL_NOTHROW; \
Q_DECLARE_FRIEND_INCOMPATIBLE_FLAGS(Flags) Q_DECLARE_FRIEND_INCOMPATIBLE_FLAGS(Flags)
#else // OS_MAC_OLD
#define Q_DECLARE_FRIEND_INCOMPATIBLE_FLAGS(Flags) \
friend Q_DECL_CONSTEXPR QIncompatibleFlag operator|(Flags::enum_type f1, int f2);
#define Q_DECLARE_FRIEND_OPERATORS_FOR_FLAGS(Flags) \
friend Q_DECL_CONSTEXPR QFlags<Flags::enum_type> operator|(Flags::enum_type f1, Flags::enum_type f2); \
friend Q_DECL_CONSTEXPR QFlags<Flags::enum_type> operator|(Flags::enum_type f1, QFlags<Flags::enum_type> f2); \
Q_DECLARE_FRIEND_INCOMPATIBLE_FLAGS(Flags)
#endif // OS_MAC_OLD
// using for_const instead of plain range-based for loop to ensure usage of const_iterator // using for_const instead of plain range-based for loop to ensure usage of const_iterator
// it is important for the copy-on-write Qt containers // it is important for the copy-on-write Qt containers
// if you have "QVector<T*> v" then "for (T * const p : v)" will still call QVector::detach(), // if you have "QVector<T*> v" then "for (T * const p : v)" will still call QVector::detach(),
@ -219,7 +233,11 @@ public:
} }
constexpr char operator[](std::size_t n) const { constexpr char operator[](std::size_t n) const {
return (n < _size) ? _str[n] : return (n < _size) ? _str[n] :
#ifndef OS_MAC_OLD
throw std::out_of_range(""); throw std::out_of_range("");
#else // OS_MAC_OLD
throw std::exception();
#endif // OS_MAC_OLD
} }
constexpr std::size_t size() const { return _size; } constexpr std::size_t size() const { return _size; }
const char *c_str() const { return _str; } const char *c_str() const { return _str; }
@ -257,6 +275,11 @@ typedef double float64;
using std::string; using std::string;
using std::exception; using std::exception;
#ifdef OS_MAC_OLD
namespace std {
using nullptr_t = decltype(nullptr);
}
#endif // OS_MAC_OLD
// we copy some parts of C++11/14/17 std:: library, because on OS X 10.6+ // we copy some parts of C++11/14/17 std:: library, because on OS X 10.6+
// version we can use C++11/14/17, but we can not use its library :( // version we can use C++11/14/17, but we can not use its library :(
@ -873,7 +896,7 @@ public:
template <typename... Args> template <typename... Args>
void makeIfNull(Args&&... args) { void makeIfNull(Args&&... args) {
if (isNull()) { if (isNull()) {
reset(new T(std::forward<Args>(args)...)); reset(new T(std_::forward<Args>(args)...));
} }
}; };

View File

@ -52,8 +52,10 @@ enum class RegExOption {
InvertedGreediness = QRegularExpression::InvertedGreedinessOption, InvertedGreediness = QRegularExpression::InvertedGreedinessOption,
DontCapture = QRegularExpression::DontCaptureOption, DontCapture = QRegularExpression::DontCaptureOption,
UseUnicodeProperties = QRegularExpression::UseUnicodePropertiesOption, UseUnicodeProperties = QRegularExpression::UseUnicodePropertiesOption,
#ifndef OS_MAC_OLD
OptimizeOnFirstUsage = QRegularExpression::OptimizeOnFirstUsageOption, OptimizeOnFirstUsage = QRegularExpression::OptimizeOnFirstUsageOption,
DontAutomaticallyOptimize = QRegularExpression::DontAutomaticallyOptimizeOption, DontAutomaticallyOptimize = QRegularExpression::DontAutomaticallyOptimizeOption,
#endif // OS_MAC_OLD
}; };
Q_DECLARE_FLAGS(RegExOptions, RegExOption); Q_DECLARE_FLAGS(RegExOptions, RegExOption);
Q_DECLARE_OPERATORS_FOR_FLAGS(RegExOptions); Q_DECLARE_OPERATORS_FOR_FLAGS(RegExOptions);
@ -65,7 +67,11 @@ inline RegularExpressionMatch regex_match(const QString &string, const QString &
inline RegularExpressionMatch regex_match(const QString &string, const QStringRef &subjectRef, RegExOptions options = 0) { inline RegularExpressionMatch regex_match(const QString &string, const QStringRef &subjectRef, RegExOptions options = 0) {
auto qtOptions = QRegularExpression::PatternOptions(static_cast<int>(options)); auto qtOptions = QRegularExpression::PatternOptions(static_cast<int>(options));
#ifndef OS_MAC_OLD
return RegularExpressionMatch(QRegularExpression(string, qtOptions).match(subjectRef)); return RegularExpressionMatch(QRegularExpression(string, qtOptions).match(subjectRef));
#else // OS_MAC_OLD
return RegularExpressionMatch(QRegularExpression(string, qtOptions).match(subjectRef.toString()));
#endif // OS_MAC_OLD
} }
} // namespace qthelp } // namespace qthelp

View File

@ -128,7 +128,11 @@ public:
} }
inline const T &at(int index) const { inline const T &at(int index) const {
if (index < 0 || index >= _size) { if (index < 0 || index >= _size) {
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
throw std::exception();
#else // QT_VERSION < 5.5.0
throw std::out_of_range(""); throw std::out_of_range("");
#endif // QT_VERSION < 5.5.0
} }
return data()[index]; return data()[index];
} }

View File

@ -6028,9 +6028,9 @@ void LocationManager::onFinished(QNetworkReply *reply) {
{ {
QBuffer buffer(&data); QBuffer buffer(&data);
QImageReader reader(&buffer); QImageReader reader(&buffer);
#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0) #ifndef OS_MAC_OLD
reader.setAutoTransform(true); reader.setAutoTransform(true);
#endif #endif // OS_MAC_OLD
thumb = QPixmap::fromImageReader(&reader, Qt::ColorOnly); thumb = QPixmap::fromImageReader(&reader, Qt::ColorOnly);
format = reader.format(); format = reader.format();
thumb.setDevicePixelRatio(cRetinaFactor()); thumb.setDevicePixelRatio(cRetinaFactor());

View File

@ -47,6 +47,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "window/top_bar_widget.h" #include "window/top_bar_widget.h"
#include "observer_peer.h" #include "observer_peer.h"
#include "playerwidget.h" #include "playerwidget.h"
#include "core/qthelp_regex.h"
namespace { namespace {
@ -2971,9 +2972,8 @@ EntitiesInText entitiesFromTextTags(const FlatTextarea::TagList &tags) {
auto mentionStart = qstr("mention://user."); auto mentionStart = qstr("mention://user.");
for_const (auto &tag, tags) { for_const (auto &tag, tags) {
if (tag.id.startsWith(mentionStart)) { if (tag.id.startsWith(mentionStart)) {
auto match = QRegularExpression("^(\\d+\\.\\d+)(/|$)").match(tag.id.midRef(mentionStart.size())); if (auto match = qthelp::regex_match("^(\\d+\\.\\d+)(/|$)", tag.id.midRef(mentionStart.size()))) {
if (match.hasMatch()) { result.push_back(EntityInText(EntityInTextMentionName, tag.offset, tag.length, match->captured(1)));
result.push_back(EntityInText(EntityInTextMentionName, tag.offset, tag.length, match.captured(1)));
} }
} }
} }
@ -8111,7 +8111,12 @@ void HistoryWidget::updatePreview() {
updateMouseTracking(); updateMouseTracking();
if (_previewData->pendingTill) { if (_previewData->pendingTill) {
_previewTitle.setText(st::msgServiceNameFont, lang(lng_preview_loading), _textNameOptions); _previewTitle.setText(st::msgServiceNameFont, lang(lng_preview_loading), _textNameOptions);
_previewDescription.setText(st::msgFont, textClean(_previewLinks.splitRef(' ').at(0).toString()), _textDlgOptions); #ifndef OS_MAC_OLD
auto linkText = _previewLinks.splitRef(' ').at(0).toString();
#else // OS_MAC_OLD
auto linkText = _previewLinks.split(' ').at(0);
#endif // OS_MAC_OLD
_previewDescription.setText(st::msgFont, textClean(linkText), _textDlgOptions);
int32 t = (_previewData->pendingTill - unixtime()) * 1000; int32 t = (_previewData->pendingTill - unixtime()) * 1000;
if (t <= 0) t = 1; if (t <= 0) t = 1;

View File

@ -173,9 +173,13 @@ ClickHandlerPtr ItemBase::getResultContentUrlHandler() const {
} }
QString ItemBase::getResultThumbLetter() const { QString ItemBase::getResultThumbLetter() const {
QVector<QStringRef> parts = _result->_url.splitRef('/'); #ifndef OS_MAC_OLD
auto parts = _result->_url.splitRef('/');
#else // OS_MAC_OLD
auto parts = _result->_url.split('/');
#endif // OS_MAC_OLD
if (!parts.isEmpty()) { if (!parts.isEmpty()) {
QStringRef domain = parts.at(0); auto domain = parts.at(0);
if (parts.size() > 2 && domain.endsWith(':') && parts.at(1).isEmpty()) { // http:// and others if (parts.size() > 2 && domain.endsWith(':') && parts.at(1).isEmpty()) { // http:// and others
domain = parts.at(2); domain = parts.at(2);
} }

View File

@ -3621,9 +3621,9 @@ namespace Local {
QImage img; QImage img;
QBuffer buf(&pngData); QBuffer buf(&pngData);
QImageReader reader(&buf); QImageReader reader(&buf);
#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0) #ifndef OS_MAC_OLD
reader.setAutoTransform(true); reader.setAutoTransform(true);
#endif #endif // OS_MAC_OLD
if (reader.read(&img)) { if (reader.read(&img)) {
App::initBackground(id, img, true); App::initBackground(id, img, true);
return true; return true;

View File

@ -31,6 +31,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#define AL_ALEXT_PROTOTYPES #define AL_ALEXT_PROTOTYPES
#include <AL/alext.h> #include <AL/alext.h>
#include <numeric>
extern "C" { extern "C" {
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
#include <iconv.h> #include <iconv.h>

View File

@ -118,9 +118,9 @@ bool QtGifReaderImplementation::jumpToStart() {
delete _reader; delete _reader;
initDevice(); initDevice();
_reader = new QImageReader(_device); _reader = new QImageReader(_device);
#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0) #ifndef OS_MAC_OLD
_reader->setAutoTransform(true); _reader->setAutoTransform(true);
#endif #endif // OS_MAC_OLD
if (!_reader->canRead() || !_reader->supportsAnimation()) { if (!_reader->canRead() || !_reader->supportsAnimation()) {
return false; return false;
} }

View File

@ -984,9 +984,14 @@ Link::Link(HistoryMedia *media, HistoryItem *parent) : ItemBase(parent) {
if (_page) { if (_page) {
_title = _page->title; _title = _page->title;
} }
QVector<QStringRef> parts = mainUrl.splitRef('/');
#ifndef OS_MAC_OLD
auto parts = mainUrl.splitRef('/');
#else // OS_MAC_OLD
auto parts = mainUrl.split('/');
#endif // OS_MAC_OLD
if (!parts.isEmpty()) { if (!parts.isEmpty()) {
QStringRef domain = parts.at(0); auto domain = parts.at(0);
if (parts.size() > 2 && domain.endsWith(':') && parts.at(1).isEmpty()) { // http:// and others if (parts.size() > 2 && domain.endsWith(':') && parts.at(1).isEmpty()) { // http:// and others
domain = parts.at(2); domain = parts.at(2);
} }

View File

@ -160,12 +160,14 @@ bool gAutoPlayGif = true;
void settingsParseArgs(int argc, char *argv[]) { void settingsParseArgs(int argc, char *argv[]) {
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
#ifndef OS_MAC_OLD
if (QSysInfo::macVersion() >= QSysInfo::MV_10_11) { if (QSysInfo::macVersion() >= QSysInfo::MV_10_11) {
gIsElCapitan = true; gIsElCapitan = true;
} else if (QSysInfo::macVersion() < QSysInfo::MV_10_8) {
gPlatform = dbipMacOld;
} }
#endif #else // OS_MAC_OLD
gPlatform = dbipMacOld;
#endif // OS_MAC_OLD
#endif // Q_OS_MAC
switch (cPlatform()) { switch (cPlatform()) {
case dbipWindows: case dbipWindows:

View File

@ -253,6 +253,22 @@ struct DataStruct {
t_assert(DataPtr == nullptr); t_assert(DataPtr == nullptr);
DataPtr = this; DataPtr = this;
if (autoRepeatCommands.isEmpty()) {
autoRepeatCommands.insert(qsl("media_previous"));
autoRepeatCommands.insert(qsl("media_next"));
autoRepeatCommands.insert(qsl("next_chat"));
autoRepeatCommands.insert(qsl("previous_chat"));
}
if (mediaCommands.isEmpty()) {
mediaCommands.insert(qsl("media_play"));
mediaCommands.insert(qsl("media_playpause"));
mediaCommands.insert(qsl("media_play"));
mediaCommands.insert(qsl("media_stop"));
mediaCommands.insert(qsl("media_previous"));
mediaCommands.insert(qsl("media_next"));
}
#define DeclareAlias(keys, command) setShortcut(qsl(keys), qsl(#command)) #define DeclareAlias(keys, command) setShortcut(qsl(keys), qsl(#command))
#define DeclareCommand(keys, command) createCommand(qsl(#command), ShortcutCommands::command); DeclareAlias(keys, command) #define DeclareCommand(keys, command) createCommand(qsl(#command), ShortcutCommands::command); DeclareAlias(keys, command)
@ -305,22 +321,9 @@ struct DataStruct {
QMap<int, ShortcutCommands::Handler> handlers; QMap<int, ShortcutCommands::Handler> handlers;
QSet<QShortcut*> mediaShortcuts; QSet<QShortcut*> mediaShortcuts;
QSet<QString> autoRepeatCommands;
QSet<QString> mediaCommands;
QSet<QString> autoRepeatCommands = {
qsl("media_previous"),
qsl("media_next"),
qsl("next_chat"),
qsl("previous_chat"),
};
QSet<QString> mediaCommands = {
qsl("media_play"),
qsl("media_pause"),
qsl("media_playpause"),
qsl("media_stop"),
qsl("media_previous"),
qsl("media_next")
};
}; };
namespace { namespace {

View File

@ -45,6 +45,9 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#pragma clang diagnostic pop #pragma clang diagnostic pop
#endif // __clang__ #endif // __clang__
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#define OS_MAC_OLD
#endif // QT_VERSION < 5.5.0
#include <QtWidgets/QtWidgets> #include <QtWidgets/QtWidgets>
#include <QtNetwork/QtNetwork> #include <QtNetwork/QtNetwork>

View File

@ -798,6 +798,22 @@ void PhotoCancelClickHandler::onClickImpl() const {
} }
} }
QString joinList(const QStringList &list, const QString &sep) {
QString result;
if (list.isEmpty()) return result;
int32 l = list.size(), s = sep.size() * (l - 1);
for (int32 i = 0; i < l; ++i) {
s += list.at(i).size();
}
result.reserve(s);
result.append(list.at(0));
for (int32 i = 1; i < l; ++i) {
result.append(sep).append(list.at(i));
}
return result;
}
QString saveFileName(const QString &title, const QString &filter, const QString &prefix, QString name, bool savingAs, const QDir &dir) { QString saveFileName(const QString &title, const QString &filter, const QString &prefix, QString name, bool savingAs, const QDir &dir) {
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
name = name.replace(QRegularExpression(qsl("[\\\\\\/\\:\\*\\?\\\"\\<\\>\\|]")), qsl("_")); name = name.replace(QRegularExpression(qsl("[\\\\\\/\\:\\*\\?\\\"\\<\\>\\|]")), qsl("_"));
@ -832,9 +848,9 @@ QString saveFileName(const QString &title, const QString &filter, const QString
QRegularExpressionMatch m = QRegularExpression(qsl(" \\*\\.") + ext + qsl("[\\)\\s]"), QRegularExpression::CaseInsensitiveOption).match(first); QRegularExpressionMatch m = QRegularExpression(qsl(" \\*\\.") + ext + qsl("[\\)\\s]"), QRegularExpression::CaseInsensitiveOption).match(first);
if (m.hasMatch() && m.capturedStart() > start + 3) { if (m.hasMatch() && m.capturedStart() > start + 3) {
int32 oldpos = m.capturedStart(), oldend = m.capturedEnd(); int32 oldpos = m.capturedStart(), oldend = m.capturedEnd();
fil = first.mid(0, start + 3) + ext + qsl(" *.") + first.mid(start + 3, oldpos - start - 3) + first.mid(oldend - 1) + sep + filters.mid(1).join(sep); fil = first.mid(0, start + 3) + ext + qsl(" *.") + first.mid(start + 3, oldpos - start - 3) + first.mid(oldend - 1) + sep + joinList(filters.mid(1), sep);
} else { } else {
fil = first.mid(0, start + 3) + ext + qsl(" *.") + first.mid(start + 3) + sep + filters.mid(1).join(sep); fil = first.mid(0, start + 3) + ext + qsl(" *.") + first.mid(start + 3) + sep + joinList(filters.mid(1), sep);
} }
} }
} else { } else {

View File

@ -1417,7 +1417,13 @@ inline bool operator<(const LocationCoords &a, const LocationCoords &b) {
return (a.lat < b.lat) || ((a.lat == b.lat) && (a.lon < b.lon)); return (a.lat < b.lat) || ((a.lat == b.lat) && (a.lon < b.lon));
} }
inline uint qHash(const LocationCoords &t, uint seed = 0) { inline uint qHash(const LocationCoords &t, uint seed = 0) {
#ifndef OS_MAC_OLD
return qHash(QtPrivate::QHashCombine().operator()(qHash(t.lat), t.lon), seed); return qHash(QtPrivate::QHashCombine().operator()(qHash(t.lat), t.lon), seed);
#else // OS_MAC_OLD
uint h1 = qHash(t.lat, seed);
uint h2 = qHash(t.lon, seed);
return ((h1 << 16) | (h1 >> 16)) ^ h2 ^ seed;
#endif // OS_MAC_OLD
} }
struct LocationData { struct LocationData {

View File

@ -644,9 +644,9 @@ void Image::restore() const {
QBuffer buffer(&_saved); QBuffer buffer(&_saved);
QImageReader reader(&buffer, _format); QImageReader reader(&buffer, _format);
#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0) #ifndef OS_MAC_OLD
reader.setAutoTransform(true); reader.setAutoTransform(true);
#endif #endif // OS_MAC_OLD
_data = QPixmap::fromImageReader(&reader, Qt::ColorOnly); _data = QPixmap::fromImageReader(&reader, Qt::ColorOnly);
if (!_data.isNull()) { if (!_data.isNull()) {

View File

@ -106,7 +106,11 @@ namespace internal {
QImage createCircleMask(int size, const QColor &bg, const QColor &fg) { QImage createCircleMask(int size, const QColor &bg, const QColor &fg) {
int realSize = size * cIntRetinaFactor(); int realSize = size * cIntRetinaFactor();
#ifndef OS_MAC_OLD
auto result = QImage(realSize, realSize, QImage::Format::Format_Grayscale8); auto result = QImage(realSize, realSize, QImage::Format::Format_Grayscale8);
#else // OS_MAC_OLD
auto result = QImage(realSize, realSize, QImage::Format::Format_RGB32);
#endif // OS_MAC_OLD
{ {
QPainter pcircle(&result); QPainter pcircle(&result);
pcircle.setRenderHint(QPainter::HighQualityAntialiasing, true); pcircle.setRenderHint(QPainter::HighQualityAntialiasing, true);

View File

@ -123,7 +123,17 @@ void ToggleableShadow::paintEvent(QPaintEvent *e) {
void sendSynteticMouseEvent(QWidget *widget, QEvent::Type type, Qt::MouseButton button, const QPoint &globalPoint) { void sendSynteticMouseEvent(QWidget *widget, QEvent::Type type, Qt::MouseButton button, const QPoint &globalPoint) {
auto windowHandle = widget->window()->windowHandle(); auto windowHandle = widget->window()->windowHandle();
auto localPoint = windowHandle->mapFromGlobal(globalPoint); auto localPoint = windowHandle->mapFromGlobal(globalPoint);
QMouseEvent ev(type, localPoint, localPoint, globalPoint, button, QGuiApplication::mouseButtons() | button, QGuiApplication::keyboardModifiers(), Qt::MouseEventSynthesizedByApplication); QMouseEvent ev(type
, localPoint
, localPoint
, globalPoint
, button
, QGuiApplication::mouseButtons() | button
, QGuiApplication::keyboardModifiers()
#ifndef OS_MAC_OLD
, Qt::MouseEventSynthesizedByApplication
#endif // OS_MAC_OLD
);
ev.setTimestamp(getms()); ev.setTimestamp(getms());
QGuiApplication::sendEvent(windowHandle, &ev); QGuiApplication::sendEvent(windowHandle, &ev);
} }

View File

@ -48,7 +48,6 @@
'ko', 'ko',
'pt-BR', 'pt-BR',
], ],
'mac_target': '10.8',
}, },
'includes': [ 'includes': [
'common_executable.gypi', 'common_executable.gypi',
@ -75,8 +74,6 @@
'<(src_loc)', '<(src_loc)',
'<(SHARED_INTERMEDIATE_DIR)', '<(SHARED_INTERMEDIATE_DIR)',
'<(libs_loc)/breakpad/src', '<(libs_loc)/breakpad/src',
'<(libs_loc)/crashpad/crashpad',
'<(libs_loc)/crashpad/crashpad/third_party/mini_chromium/mini_chromium',
'<(libs_loc)/lzma/C', '<(libs_loc)/lzma/C',
'<(libs_loc)/libexif-0.6.20', '<(libs_loc)/libexif-0.6.20',
'<(libs_loc)/zlib-1.2.8', '<(libs_loc)/zlib-1.2.8',
@ -84,9 +81,6 @@
'<(libs_loc)/openal-soft/include', '<(libs_loc)/openal-soft/include',
'<(minizip_loc)', '<(minizip_loc)',
], ],
'library_dirs': [
'<(libs_loc)/ffmpeg',
],
'sources': [ 'sources': [
'<@(qrc_files)', '<@(qrc_files)',
'<@(style_files)', '<@(style_files)',

View File

@ -65,7 +65,6 @@
'build_mac%': '<(build_mac)', 'build_mac%': '<(build_mac)',
'build_linux%': '<(build_linux)', 'build_linux%': '<(build_linux)',
'official_build_target%': '<(official_build_target)', 'official_build_target%': '<(official_build_target)',
'mac_target%': '10.8',
# GYP does not support per-configuration libraries :( # GYP does not support per-configuration libraries :(
# So they will be emulated through additional link flags, # So they will be emulated through additional link flags,
@ -82,10 +81,10 @@
}], }],
[ '"<(official_build_target)" == "mac32"', { [ '"<(official_build_target)" == "mac32"', {
'mac_target%': '10.6', 'mac_target%': '10.6',
'build_mac32': 1, 'build_macold': 1,
}, { }, {
'mac_target%': '10.8', 'mac_target%': '10.8',
'build_mac32': 0, 'build_macold': 0,
}] }]
], ],
'ld_lib_prefix': '<(ld_lib_prefix)', 'ld_lib_prefix': '<(ld_lib_prefix)',

View File

@ -24,9 +24,7 @@
'variables': { 'variables': {
'qt_libs': [ 'qt_libs': [
'Qt5Core', 'Qt5Core',
'qtpcre',
'Qt5Gui', 'Qt5Gui',
'qtfreetype',
'Qt5Widgets', 'Qt5Widgets',
'qtharfbuzzng', 'qtharfbuzzng',
'Qt5Network', 'Qt5Network',
@ -34,8 +32,15 @@
'Qt5PrintSupport', 'Qt5PrintSupport',
'qwebp', 'qwebp',
], ],
'conditions': [
[ 'build_macold', {
'qt_version%': '5.3.2',
}, {
'qt_version%': '5.6.0',
}]
],
}, },
'qt_version%': '5.6.0', 'qt_version%': '<(qt_version)',
'conditions': [ 'conditions': [
[ 'build_win', { [ 'build_win', {
'qt_lib_prefix': '<(ld_lib_prefix)', 'qt_lib_prefix': '<(ld_lib_prefix)',
@ -57,9 +62,20 @@
'qcocoa', 'qcocoa',
], ],
}], }],
[ 'build_macold', {
'qt_loc_unix': '/usr/local/Qt-<(qt_version)'
}, {
'qt_loc_unix': '/usr/local/tdesktop/Qt-<(qt_version)',
'qt_libs': [
'<@(qt_libs)',
'qtfreetype',
'qtpcre',
],
}]
], ],
}, },
'qt_version%': '<(qt_version)', 'qt_version%': '<(qt_version)',
'qt_loc_unix': '<(qt_loc_unix)',
'qt_version_loc': '<!(python -c "print(\'<(qt_version)\'.replace(\'.\', \'_\'))")', 'qt_version_loc': '<!(python -c "print(\'<(qt_version)\'.replace(\'.\', \'_\'))")',
'qt_libs_debug': [ 'qt_libs_debug': [
'<!@(python -c "for s in \'<@(qt_libs)\'.split(\' \'): print(\'<(qt_lib_prefix)\' + s + \'<(qt_lib_debug_postfix)\')")', '<!@(python -c "for s in \'<@(qt_libs)\'.split(\' \'): print(\'<(qt_lib_prefix)\' + s + \'<(qt_lib_debug_postfix)\')")',
@ -75,7 +91,7 @@
[ 'build_win', { [ 'build_win', {
'qt_loc': '../../../Libraries/qt<(qt_version_loc)/qtbase', 'qt_loc': '../../../Libraries/qt<(qt_version_loc)/qtbase',
}, { }, {
'qt_loc': '/usr/local/tdesktop/Qt-<(qt_version)', 'qt_loc': '<(qt_loc_unix)',
}], }],
], ],
}, },

View File

@ -28,8 +28,6 @@
'CoreText', 'CoreText',
'CoreGraphics', 'CoreGraphics',
'OpenGL', 'OpenGL',
'VideoToolbox',
'VideoDecodeAcceleration',
'AudioUnit', 'AudioUnit',
'ApplicationServices', 'ApplicationServices',
'Foundation', 'Foundation',
@ -40,8 +38,6 @@
'AudioToolbox', 'AudioToolbox',
'CoreAudio', 'CoreAudio',
'QuartzCore', 'QuartzCore',
'AVFoundation',
'CoreMedia',
'AppKit', 'AppKit',
'CoreWLAN', 'CoreWLAN',
'IOKit', 'IOKit',
@ -69,14 +65,40 @@
'<@(mac_common_flags)', '<@(mac_common_flags)',
], ],
'OTHER_LDFLAGS': [ 'OTHER_LDFLAGS': [
'-stdlib=libc++',
'<!@(python -c "for s in \'<@(mac_frameworks)\'.split(\' \'): print(\'-framework \' + s)")', '<!@(python -c "for s in \'<@(mac_frameworks)\'.split(\' \'): print(\'-framework \' + s)")',
], ],
'MACOSX_DEPLOYMENT_TARGET': '<(mac_target)', 'MACOSX_DEPLOYMENT_TARGET': '<(mac_target)',
'COMBINE_HIDPI_IMAGES': 'YES', 'COMBINE_HIDPI_IMAGES': 'YES',
'COPY_PHASE_STRIP': 'NO', 'COPY_PHASE_STRIP': 'NO',
'CLANG_CXX_LANGUAGE_STANDARD': 'c++14', 'CLANG_CXX_LANGUAGE_STANDARD': 'c++14',
},
'configurations': {
'Debug': {
'xcode_settings': {
'ENABLE_TESTABILITY': 'YES',
'ONLY_ACTIVE_ARCH': 'YES',
},
},
},
}],
[ 'build_macold', {
'xcode_settings': {
'OTHER_CFLAGS': [
'-Wno-inconsistent-missing-override',
],
'OTHER_CPLUSPLUSFLAGS': [
'-Wno-inconsistent-missing-override',
],
},
}, {
'xcode_settings': {
'CLANG_CXX_LIBRARY': 'libc++', 'CLANG_CXX_LIBRARY': 'libc++',
'OTHER_LDFLAGS': [
'-framework VideoToolbox',
'-framework VideoDecodeAcceleration',
'-framework AVFoundation',
'-framework CoreMedia',
],
}, },
}], }],
], ],

View File

@ -32,15 +32,8 @@
'-lssl', '-lssl',
'-lcrypto', '-lcrypto',
'/usr/local/lib/liblzma.a', '/usr/local/lib/liblzma.a',
'/usr/local/lib/libopenal.a',
'/usr/local/lib/libopus.a', '/usr/local/lib/libopus.a',
'/usr/local/lib/libexif.a', '/usr/local/lib/libexif.a',
'-lavcodec',
'-lavformat',
'-lswscale',
'-lswresample',
'-lavutil',
'/usr/local/lib/libiconv.a',
'-lbase', '-lbase',
'-lcrashpad_client', '-lcrashpad_client',
'-lcrashpad_util', '-lcrashpad_util',
@ -57,17 +50,11 @@
], ],
'configurations': { 'configurations': {
'Debug': { 'Debug': {
'library_dirs': [
'<(libs_loc)/crashpad/crashpad/out/Debug',
],
'xcode_settings': { 'xcode_settings': {
'GCC_OPTIMIZATION_LEVEL': '0', 'GCC_OPTIMIZATION_LEVEL': '0',
}, },
}, },
'Release': { 'Release': {
'library_dirs': [
'<(libs_loc)/crashpad/crashpad/out/Release',
],
'xcode_settings': { 'xcode_settings': {
'DEBUG_INFORMATION_FORMAT': 'dwarf-with-dsym', 'DEBUG_INFORMATION_FORMAT': 'dwarf-with-dsym',
'LLVM_LTO': 'YES', 'LLVM_LTO': 'YES',
@ -97,7 +84,80 @@
'action': [ 'action': [
'mkdir', '-p', '${BUILT_PRODUCTS_DIR}/Telegram.app/Contents/Helpers/' 'mkdir', '-p', '${BUILT_PRODUCTS_DIR}/Telegram.app/Contents/Helpers/'
], ],
}, { }],
}], [ 'build_macold', {
'xcode_settings': {
'OTHER_LDFLAGS': [
'/usr/local/openal_old/lib/libopenal.a',
'/usr/local/zlib_old/lib/libz.a',
'/usr/local/iconv_old/lib/libiconv.a',
'/usr/local/ffmpeg_old/lib/libavcodec.a',
'/usr/local/ffmpeg_old/lib/libavformat.a',
'/usr/local/ffmpeg_old/lib/libavutil.a',
'/usr/local/ffmpeg_old/lib/libswscale.a',
'/usr/local/ffmpeg_old/lib/libswresample.a',
],
},
'include_dirs': [
'<(libs_loc)/crashpad_oldmac/crashpad',
'<(libs_loc)/crashpad_oldmac/crashpad/third_party/mini_chromium/mini_chromium',
],
'library_dirs': [
'/usr/local/ffmpeg_old',
],
'configurations': {
'Debug': {
'library_dirs': [
'<(libs_loc)/crashpad_oldmac/crashpad/out/Debug',
],
},
'Release': {
'library_dirs': [
'<(libs_loc)/crashpad_oldmac/crashpad/out/Release',
],
},
},
'postbuilds': [{
'postbuild_name': 'Copy crashpad_client to Helpers',
'action': [
'cp',
'<(libs_loc)/crashpad_oldmac/crashpad/out/${CONFIGURATION}/crashpad_handler',
'${BUILT_PRODUCTS_DIR}/Telegram.app/Contents/Helpers/',
],
}],
}, {
'xcode_settings': {
'OTHER_LDFLAGS': [
'/usr/local/lib/libz.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': [
'<(libs_loc)/crashpad/crashpad',
'<(libs_loc)/crashpad/crashpad/third_party/mini_chromium/mini_chromium',
],
'library_dirs': [
'/usr/local/ffmpeg',
],
'configurations': {
'Debug': {
'library_dirs': [
'<(libs_loc)/crashpad/crashpad/out/Debug',
],
},
'Release': {
'library_dirs': [
'<(libs_loc)/crashpad/crashpad/out/Release',
],
},
},
'postbuilds': [{
'postbuild_name': 'Copy crashpad_client to Helpers', 'postbuild_name': 'Copy crashpad_client to Helpers',
'action': [ 'action': [
'cp', 'cp',

View File

@ -25,6 +25,9 @@
'sources': [ 'sources': [
'<(res_loc)/winrc/Telegram.rc', '<(res_loc)/winrc/Telegram.rc',
], ],
'library_dirs': [
'<(libs_loc)/ffmpeg',
],
'libraries': [ 'libraries': [
'libeay32', 'libeay32',
'ssleay32', 'ssleay32',