mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-17 22:57:11 +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()) {
|
||||
setWindowFlags(Qt::FramelessWindowHint
|
||||
| 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 {
|
||||
setWindowFlags(Qt::FramelessWindowHint);
|
||||
}
|
||||
|
|
|
@ -47,8 +47,6 @@ using Manager = Platform::Notifications::Manager;
|
|||
|
||||
} // namespace
|
||||
|
||||
NSImage *qt_mac_create_nsimage(const QPixmap &pm);
|
||||
|
||||
@interface NotificationDelegate : NSObject<NSUserNotificationCenterDelegate> {
|
||||
}
|
||||
|
||||
|
@ -267,7 +265,7 @@ void Manager::Private::showNotification(
|
|||
: peer->isRepliesChat()
|
||||
? Ui::EmptyUserpic::GenerateRepliesMessages(st::notifyMacPhotoSize)
|
||||
: peer->genUserpic(userpicView, st::notifyMacPhotoSize);
|
||||
NSImage *img = [qt_mac_create_nsimage(userpic) autorelease];
|
||||
NSImage *img = Q2NSImage(userpic.toImage());
|
||||
[notification setContentImage:img];
|
||||
}
|
||||
|
||||
|
|
|
@ -39,8 +39,6 @@ constexpr auto kIgnoreActivationTimeoutMs = 500;
|
|||
|
||||
} // namespace
|
||||
|
||||
NSImage *qt_mac_create_nsimage(const QPixmap &pm);
|
||||
|
||||
using Platform::Q2NSString;
|
||||
using Platform::NS2QString;
|
||||
|
||||
|
@ -214,10 +212,9 @@ void SetApplicationIcon(const QIcon &icon) {
|
|||
if (!icon.isNull()) {
|
||||
auto pixmap = icon.pixmap(1024, 1024);
|
||||
pixmap.setDevicePixelRatio(cRetinaFactor());
|
||||
image = static_cast<NSImage*>(qt_mac_create_nsimage(pixmap));
|
||||
image = Q2NSImage(pixmap.toImage());
|
||||
}
|
||||
[[NSApplication sharedApplication] setApplicationIconImage:image];
|
||||
[image release];
|
||||
}
|
||||
|
||||
} // namespace Platform
|
||||
|
|
|
@ -43,7 +43,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#import <AppKit/NSSegmentedControl.h>
|
||||
#import <AppKit/NSTextField.h>
|
||||
|
||||
NSImage *qt_mac_create_nsimage(const QPixmap &pm);
|
||||
using TouchBar::kCircleDiameter;
|
||||
using TouchBar::CreateNSImageFromStyleIcon;
|
||||
|
||||
|
@ -96,32 +95,32 @@ struct PickerScrubberItem {
|
|||
}
|
||||
|
||||
void updateThumbnail() {
|
||||
if (!document || !qpixmap.isNull()) {
|
||||
if (!document || !image.isNull()) {
|
||||
return;
|
||||
}
|
||||
const auto image = mediaView->getStickerSmall();
|
||||
if (!image) {
|
||||
const auto sticker = mediaView->getStickerSmall();
|
||||
if (!sticker) {
|
||||
return;
|
||||
}
|
||||
const auto size = image->size()
|
||||
const auto size = sticker->size()
|
||||
.scaled(kCircleDiameter, kCircleDiameter, Qt::KeepAspectRatio);
|
||||
qpixmap = image->pixSingle(
|
||||
image = sticker->pixSingle(
|
||||
size.width(),
|
||||
size.height(),
|
||||
kCircleDiameter,
|
||||
kCircleDiameter,
|
||||
ImageRoundRadius::None);
|
||||
ImageRoundRadius::None).toImage();
|
||||
}
|
||||
|
||||
bool isStickerLoaded() const {
|
||||
return !qpixmap.isNull();
|
||||
return !image.isNull();
|
||||
}
|
||||
|
||||
QString title = QString();
|
||||
|
||||
DocumentData *document = nullptr;
|
||||
std::shared_ptr<Data::DocumentMedia> mediaView = nullptr;
|
||||
QPixmap qpixmap;
|
||||
QImage image;
|
||||
|
||||
EmojiPtr emoji = nullptr;
|
||||
};
|
||||
|
@ -140,21 +139,25 @@ struct PickerScrubberItemsHolder {
|
|||
};
|
||||
|
||||
using Platform::Q2NSString;
|
||||
using Platform::Q2NSImage;
|
||||
|
||||
NSImage *CreateNSImageFromEmoji(EmojiPtr emoji) {
|
||||
const auto s = kIdealIconSize * cIntRetinaFactor();
|
||||
auto pixmap = QPixmap(s, s);
|
||||
pixmap.setDevicePixelRatio(cRetinaFactor());
|
||||
pixmap.fill(Qt::black);
|
||||
Painter paint(&pixmap);
|
||||
PainterHighQualityEnabler hq(paint);
|
||||
Ui::Emoji::Draw(
|
||||
paint,
|
||||
std::move(emoji),
|
||||
Ui::Emoji::GetSizeTouchbar(),
|
||||
0,
|
||||
0);
|
||||
return [qt_mac_create_nsimage(pixmap) autorelease];
|
||||
auto image = QImage(
|
||||
QSize(kIdealIconSize, kIdealIconSize) * cIntRetinaFactor(),
|
||||
QImage::Format_ARGB32_Premultiplied);
|
||||
image.setDevicePixelRatio(cRetinaFactor());
|
||||
image.fill(Qt::black);
|
||||
{
|
||||
Painter paint(&image);
|
||||
PainterHighQualityEnabler hq(paint);
|
||||
Ui::Emoji::Draw(
|
||||
paint,
|
||||
emoji,
|
||||
Ui::Emoji::GetSizeTouchbar(),
|
||||
0,
|
||||
0);
|
||||
}
|
||||
return Q2NSImage(image);
|
||||
}
|
||||
|
||||
auto ActiveChat(not_null<Window::Controller*> controller) {
|
||||
|
@ -421,8 +424,7 @@ void AppendEmojiPacks(
|
|||
PickerScrubberItemView *itemView = [scrubber
|
||||
makeItemWithIdentifier:kStickerItemIdentifier
|
||||
owner:self];
|
||||
itemView.imageView.image = [qt_mac_create_nsimage(item.qpixmap)
|
||||
autorelease];
|
||||
itemView.imageView.image = Q2NSImage(item.image);
|
||||
itemView->documentId = document->id;
|
||||
return itemView;
|
||||
} 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/NSSliderTouchBarItem.h>
|
||||
|
||||
NSImage *qt_mac_create_nsimage(const QPixmap &pm);
|
||||
using TouchBar::kCircleDiameter;
|
||||
using TouchBar::CreateNSImageFromStyleIcon;
|
||||
|
||||
|
|
|
@ -9,9 +9,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
|
||||
#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 {
|
||||
|
||||
|
@ -21,10 +21,9 @@ int WidthFromString(NSString *s) {
|
|||
}
|
||||
|
||||
NSImage *CreateNSImageFromStyleIcon(const style::icon &icon, int size) {
|
||||
const auto instance = icon.instance(QColor(255, 255, 255, 255), 100);
|
||||
auto pixmap = QPixmap::fromImage(instance);
|
||||
pixmap.setDevicePixelRatio(cRetinaFactor());
|
||||
NSImage *image = [qt_mac_create_nsimage(pixmap) autorelease];
|
||||
auto instance = icon.instance(QColor(255, 255, 255, 255), 100);
|
||||
instance.setDevicePixelRatio(cRetinaFactor());
|
||||
NSImage *image = Platform::Q2NSImage(instance);
|
||||
[image setSize:NSMakeSize(size, size)];
|
||||
return image;
|
||||
}
|
||||
|
|
|
@ -254,16 +254,16 @@ Go to ***BuildPath*** and run
|
|||
ninja -C out/Release
|
||||
cd ..
|
||||
|
||||
git clone git://code.qt.io/qt/qt5.git qt_5_12_8
|
||||
cd qt_5_12_8
|
||||
git clone git://code.qt.io/qt/qt5.git qt_5_15_1
|
||||
cd qt_5_15_1
|
||||
perl init-repository --module-subset=qtbase,qtimageformats
|
||||
git checkout v5.12.8
|
||||
git checkout v5.15.1
|
||||
git submodule update qtbase qtimageformats
|
||||
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 ..
|
||||
|
||||
./configure -prefix "/usr/local/desktop-app/Qt-5.12.8" \
|
||||
./configure -prefix "/usr/local/desktop-app/Qt-5.15.1" \
|
||||
-debug-and-release \
|
||||
-force-debug-info \
|
||||
-opensource \
|
||||
|
|
Loading…
Add table
Reference in a new issue