mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-30 14:17:45 +00:00
Fix incorrectly resolved merge conflict in mac platfrom code (#124)
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -265,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 = [ToNSImage(userpic) autorelease];
|
NSImage *img = Q2NSImage(userpic.toImage());
|
||||||
[notification setContentImage:img];
|
[notification setContentImage:img];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -10,8 +10,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||||||
#include "platform/platform_specific.h"
|
#include "platform/platform_specific.h"
|
||||||
#include "platform/mac/specific_mac_p.h"
|
#include "platform/mac/specific_mac_p.h"
|
||||||
|
|
||||||
Q_FORWARD_DECLARE_OBJC_CLASS(NSImage);
|
|
||||||
|
|
||||||
namespace Data {
|
namespace Data {
|
||||||
class LocationPoint;
|
class LocationPoint;
|
||||||
} // namespace Data
|
} // namespace Data
|
||||||
@@ -60,8 +58,6 @@ inline bool WindowsNeedShadow() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSImage *ToNSImage(const QPixmap &pixmap);
|
|
||||||
|
|
||||||
namespace ThirdParty {
|
namespace ThirdParty {
|
||||||
|
|
||||||
inline void start() {
|
inline void start() {
|
||||||
|
@@ -213,18 +213,6 @@ Window::ControlsLayout WindowControlsLayout() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
NSImage *ToNSImage(const QPixmap &pixmap) {
|
|
||||||
if (pixmap.isNull())
|
|
||||||
return 0;
|
|
||||||
CGImageRef cgimage = pixmap.toImage().toCGImage();
|
|
||||||
NSBitmapImageRep *bitmapRep = [[NSBitmapImageRep alloc] initWithCGImage:cgimage];
|
|
||||||
NSImage *image = [[NSImage alloc] init];
|
|
||||||
[image addRepresentation:bitmapRep];
|
|
||||||
[bitmapRep release];
|
|
||||||
CFRelease(cgimage);
|
|
||||||
return image;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Platform
|
} // namespace Platform
|
||||||
|
|
||||||
void psNewVersion() {
|
void psNewVersion() {
|
||||||
|
@@ -216,7 +216,7 @@ 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*>(ToNSImage(pixmap));
|
image = Q2NSImage(pixmap.toImage());
|
||||||
}
|
}
|
||||||
[[NSApplication sharedApplication] setApplicationIconImage:image];
|
[[NSApplication sharedApplication] setApplicationIconImage:image];
|
||||||
}
|
}
|
||||||
|
@@ -13,7 +13,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||||||
#include "api/api_sending.h"
|
#include "api/api_sending.h"
|
||||||
#include "base/call_delayed.h"
|
#include "base/call_delayed.h"
|
||||||
#include "base/platform/mac/base_utilities_mac.h"
|
#include "base/platform/mac/base_utilities_mac.h"
|
||||||
#include "platform/platform_specific.h"
|
|
||||||
#include "boxes/confirm_box.h"
|
#include "boxes/confirm_box.h"
|
||||||
#include "chat_helpers/emoji_list_widget.h"
|
#include "chat_helpers/emoji_list_widget.h"
|
||||||
#include "core/sandbox.h"
|
#include "core/sandbox.h"
|
||||||
@@ -143,19 +142,22 @@ using Platform::Q2NSString;
|
|||||||
using Platform::Q2NSImage;
|
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 [Platform::ToNSImage(pixmap) autorelease];
|
0,
|
||||||
|
0);
|
||||||
|
}
|
||||||
|
return Q2NSImage(image);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto ActiveChat(not_null<Window::Controller*> controller) {
|
auto ActiveChat(not_null<Window::Controller*> controller) {
|
||||||
@@ -422,8 +424,7 @@ void AppendEmojiPacks(
|
|||||||
PickerScrubberItemView *itemView = [scrubber
|
PickerScrubberItemView *itemView = [scrubber
|
||||||
makeItemWithIdentifier:kStickerItemIdentifier
|
makeItemWithIdentifier:kStickerItemIdentifier
|
||||||
owner:self];
|
owner:self];
|
||||||
itemView.imageView.image = [Platform::ToNSImage(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) {
|
||||||
|
@@ -9,7 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||||||
|
|
||||||
#ifndef OS_OSX
|
#ifndef OS_OSX
|
||||||
|
|
||||||
#include "platform/platform_specific.h"
|
#include "base/platform/mac/base_utilities_mac.h"
|
||||||
|
|
||||||
#import <AppKit/NSTextField.h>
|
#import <AppKit/NSTextField.h>
|
||||||
|
|
||||||
@@ -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 = [Platform::ToNSImage(pixmap) autorelease];
|
|
||||||
[image setSize:NSMakeSize(size, size)];
|
[image setSize:NSMakeSize(size, size)];
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user