mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Build macOS version with Qt 5.15.1.
This commit is contained in:
parent
9210cf6d36
commit
117de5a1f9
7 changed files with 44 additions and 43 deletions
|
@ -350,6 +350,12 @@ OverlayWidget::OverlayWidget()
|
||||||
if (Platform::IsLinux()) {
|
if (Platform::IsLinux()) {
|
||||||
setWindowFlags(Qt::FramelessWindowHint
|
setWindowFlags(Qt::FramelessWindowHint
|
||||||
| Qt::MaximizeUsingFullscreenGeometryHint);
|
| Qt::MaximizeUsingFullscreenGeometryHint);
|
||||||
|
} else if (Platform::IsMac()) {
|
||||||
|
// Without Qt::Tool starting with Qt 5.15.1 this widget
|
||||||
|
// when being opened from a fullscreen main window was
|
||||||
|
// opening not as overlay over the main window, but as
|
||||||
|
// a separate fullscreen window with a separate space.
|
||||||
|
setWindowFlags(Qt::FramelessWindowHint | Qt::Tool);
|
||||||
} else {
|
} else {
|
||||||
setWindowFlags(Qt::FramelessWindowHint);
|
setWindowFlags(Qt::FramelessWindowHint);
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,8 +47,6 @@ using Manager = Platform::Notifications::Manager;
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
NSImage *qt_mac_create_nsimage(const QPixmap &pm);
|
|
||||||
|
|
||||||
@interface NotificationDelegate : NSObject<NSUserNotificationCenterDelegate> {
|
@interface NotificationDelegate : NSObject<NSUserNotificationCenterDelegate> {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,7 +265,7 @@ void Manager::Private::showNotification(
|
||||||
: peer->isRepliesChat()
|
: peer->isRepliesChat()
|
||||||
? Ui::EmptyUserpic::GenerateRepliesMessages(st::notifyMacPhotoSize)
|
? Ui::EmptyUserpic::GenerateRepliesMessages(st::notifyMacPhotoSize)
|
||||||
: peer->genUserpic(userpicView, st::notifyMacPhotoSize);
|
: peer->genUserpic(userpicView, st::notifyMacPhotoSize);
|
||||||
NSImage *img = [qt_mac_create_nsimage(userpic) autorelease];
|
NSImage *img = Q2NSImage(userpic.toImage());
|
||||||
[notification setContentImage:img];
|
[notification setContentImage:img];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,8 +39,6 @@ constexpr auto kIgnoreActivationTimeoutMs = 500;
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
NSImage *qt_mac_create_nsimage(const QPixmap &pm);
|
|
||||||
|
|
||||||
using Platform::Q2NSString;
|
using Platform::Q2NSString;
|
||||||
using Platform::NS2QString;
|
using Platform::NS2QString;
|
||||||
|
|
||||||
|
@ -214,10 +212,9 @@ void SetApplicationIcon(const QIcon &icon) {
|
||||||
if (!icon.isNull()) {
|
if (!icon.isNull()) {
|
||||||
auto pixmap = icon.pixmap(1024, 1024);
|
auto pixmap = icon.pixmap(1024, 1024);
|
||||||
pixmap.setDevicePixelRatio(cRetinaFactor());
|
pixmap.setDevicePixelRatio(cRetinaFactor());
|
||||||
image = static_cast<NSImage*>(qt_mac_create_nsimage(pixmap));
|
image = Q2NSImage(pixmap.toImage());
|
||||||
}
|
}
|
||||||
[[NSApplication sharedApplication] setApplicationIconImage:image];
|
[[NSApplication sharedApplication] setApplicationIconImage:image];
|
||||||
[image release];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Platform
|
} // namespace Platform
|
||||||
|
|
|
@ -43,7 +43,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#import <AppKit/NSSegmentedControl.h>
|
#import <AppKit/NSSegmentedControl.h>
|
||||||
#import <AppKit/NSTextField.h>
|
#import <AppKit/NSTextField.h>
|
||||||
|
|
||||||
NSImage *qt_mac_create_nsimage(const QPixmap &pm);
|
|
||||||
using TouchBar::kCircleDiameter;
|
using TouchBar::kCircleDiameter;
|
||||||
using TouchBar::CreateNSImageFromStyleIcon;
|
using TouchBar::CreateNSImageFromStyleIcon;
|
||||||
|
|
||||||
|
@ -96,32 +95,32 @@ struct PickerScrubberItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateThumbnail() {
|
void updateThumbnail() {
|
||||||
if (!document || !qpixmap.isNull()) {
|
if (!document || !image.isNull()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto image = mediaView->getStickerSmall();
|
const auto sticker = mediaView->getStickerSmall();
|
||||||
if (!image) {
|
if (!sticker) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto size = image->size()
|
const auto size = sticker->size()
|
||||||
.scaled(kCircleDiameter, kCircleDiameter, Qt::KeepAspectRatio);
|
.scaled(kCircleDiameter, kCircleDiameter, Qt::KeepAspectRatio);
|
||||||
qpixmap = image->pixSingle(
|
image = sticker->pixSingle(
|
||||||
size.width(),
|
size.width(),
|
||||||
size.height(),
|
size.height(),
|
||||||
kCircleDiameter,
|
kCircleDiameter,
|
||||||
kCircleDiameter,
|
kCircleDiameter,
|
||||||
ImageRoundRadius::None);
|
ImageRoundRadius::None).toImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isStickerLoaded() const {
|
bool isStickerLoaded() const {
|
||||||
return !qpixmap.isNull();
|
return !image.isNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString title = QString();
|
QString title = QString();
|
||||||
|
|
||||||
DocumentData *document = nullptr;
|
DocumentData *document = nullptr;
|
||||||
std::shared_ptr<Data::DocumentMedia> mediaView = nullptr;
|
std::shared_ptr<Data::DocumentMedia> mediaView = nullptr;
|
||||||
QPixmap qpixmap;
|
QImage image;
|
||||||
|
|
||||||
EmojiPtr emoji = nullptr;
|
EmojiPtr emoji = nullptr;
|
||||||
};
|
};
|
||||||
|
@ -140,21 +139,25 @@ struct PickerScrubberItemsHolder {
|
||||||
};
|
};
|
||||||
|
|
||||||
using Platform::Q2NSString;
|
using Platform::Q2NSString;
|
||||||
|
using Platform::Q2NSImage;
|
||||||
|
|
||||||
NSImage *CreateNSImageFromEmoji(EmojiPtr emoji) {
|
NSImage *CreateNSImageFromEmoji(EmojiPtr emoji) {
|
||||||
const auto s = kIdealIconSize * cIntRetinaFactor();
|
auto image = QImage(
|
||||||
auto pixmap = QPixmap(s, s);
|
QSize(kIdealIconSize, kIdealIconSize) * cIntRetinaFactor(),
|
||||||
pixmap.setDevicePixelRatio(cRetinaFactor());
|
QImage::Format_ARGB32_Premultiplied);
|
||||||
pixmap.fill(Qt::black);
|
image.setDevicePixelRatio(cRetinaFactor());
|
||||||
Painter paint(&pixmap);
|
image.fill(Qt::black);
|
||||||
PainterHighQualityEnabler hq(paint);
|
{
|
||||||
Ui::Emoji::Draw(
|
Painter paint(&image);
|
||||||
paint,
|
PainterHighQualityEnabler hq(paint);
|
||||||
std::move(emoji),
|
Ui::Emoji::Draw(
|
||||||
Ui::Emoji::GetSizeTouchbar(),
|
paint,
|
||||||
0,
|
emoji,
|
||||||
0);
|
Ui::Emoji::GetSizeTouchbar(),
|
||||||
return [qt_mac_create_nsimage(pixmap) autorelease];
|
0,
|
||||||
|
0);
|
||||||
|
}
|
||||||
|
return Q2NSImage(image);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto ActiveChat(not_null<Window::Controller*> controller) {
|
auto ActiveChat(not_null<Window::Controller*> controller) {
|
||||||
|
@ -421,8 +424,7 @@ void AppendEmojiPacks(
|
||||||
PickerScrubberItemView *itemView = [scrubber
|
PickerScrubberItemView *itemView = [scrubber
|
||||||
makeItemWithIdentifier:kStickerItemIdentifier
|
makeItemWithIdentifier:kStickerItemIdentifier
|
||||||
owner:self];
|
owner:self];
|
||||||
itemView.imageView.image = [qt_mac_create_nsimage(item.qpixmap)
|
itemView.imageView.image = Q2NSImage(item.image);
|
||||||
autorelease];
|
|
||||||
itemView->documentId = document->id;
|
itemView->documentId = document->id;
|
||||||
return itemView;
|
return itemView;
|
||||||
} else if (const auto emoji = item.emoji) {
|
} else if (const auto emoji = item.emoji) {
|
||||||
|
|
|
@ -20,7 +20,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#import <AppKit/NSSlider.h>
|
#import <AppKit/NSSlider.h>
|
||||||
#import <AppKit/NSSliderTouchBarItem.h>
|
#import <AppKit/NSSliderTouchBarItem.h>
|
||||||
|
|
||||||
NSImage *qt_mac_create_nsimage(const QPixmap &pm);
|
|
||||||
using TouchBar::kCircleDiameter;
|
using TouchBar::kCircleDiameter;
|
||||||
using TouchBar::CreateNSImageFromStyleIcon;
|
using TouchBar::CreateNSImageFromStyleIcon;
|
||||||
|
|
||||||
|
|
|
@ -9,9 +9,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
|
||||||
#ifndef OS_OSX
|
#ifndef OS_OSX
|
||||||
|
|
||||||
#import <AppKit/NSTextField.h>
|
#include "base/platform/mac/base_utilities_mac.h"
|
||||||
|
|
||||||
NSImage *qt_mac_create_nsimage(const QPixmap &pm);
|
#import <AppKit/NSTextField.h>
|
||||||
|
|
||||||
namespace TouchBar {
|
namespace TouchBar {
|
||||||
|
|
||||||
|
@ -21,10 +21,9 @@ int WidthFromString(NSString *s) {
|
||||||
}
|
}
|
||||||
|
|
||||||
NSImage *CreateNSImageFromStyleIcon(const style::icon &icon, int size) {
|
NSImage *CreateNSImageFromStyleIcon(const style::icon &icon, int size) {
|
||||||
const auto instance = icon.instance(QColor(255, 255, 255, 255), 100);
|
auto instance = icon.instance(QColor(255, 255, 255, 255), 100);
|
||||||
auto pixmap = QPixmap::fromImage(instance);
|
instance.setDevicePixelRatio(cRetinaFactor());
|
||||||
pixmap.setDevicePixelRatio(cRetinaFactor());
|
NSImage *image = Platform::Q2NSImage(instance);
|
||||||
NSImage *image = [qt_mac_create_nsimage(pixmap) autorelease];
|
|
||||||
[image setSize:NSMakeSize(size, size)];
|
[image setSize:NSMakeSize(size, size)];
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
|
@ -254,16 +254,16 @@ Go to ***BuildPath*** and run
|
||||||
ninja -C out/Release
|
ninja -C out/Release
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
git clone git://code.qt.io/qt/qt5.git qt_5_12_8
|
git clone git://code.qt.io/qt/qt5.git qt_5_15_1
|
||||||
cd qt_5_12_8
|
cd qt_5_15_1
|
||||||
perl init-repository --module-subset=qtbase,qtimageformats
|
perl init-repository --module-subset=qtbase,qtimageformats
|
||||||
git checkout v5.12.8
|
git checkout v5.15.1
|
||||||
git submodule update qtbase qtimageformats
|
git submodule update qtbase qtimageformats
|
||||||
cd qtbase
|
cd qtbase
|
||||||
find ../../patches/qtbase_5_12_8 -type f -print0 | sort -z | xargs -0 git apply
|
find ../../patches/qtbase_5_15_1 -type f -print0 | sort -z | xargs -0 git apply
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
./configure -prefix "/usr/local/desktop-app/Qt-5.12.8" \
|
./configure -prefix "/usr/local/desktop-app/Qt-5.15.1" \
|
||||||
-debug-and-release \
|
-debug-and-release \
|
||||||
-force-debug-info \
|
-force-debug-info \
|
||||||
-opensource \
|
-opensource \
|
||||||
|
|
Loading…
Add table
Reference in a new issue