mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-30 06:07:45 +00:00
Fix incorrectly resolved merge conflict in mac platfrom code (#124)
This commit is contained in:
parent
8c6e461d56
commit
8edcb9afb4
File diff suppressed because it is too large
Load Diff
@ -265,7 +265,7 @@ void Manager::Private::showNotification(
|
||||
: peer->isRepliesChat()
|
||||
? Ui::EmptyUserpic::GenerateRepliesMessages(st::notifyMacPhotoSize)
|
||||
: peer->genUserpic(userpicView, st::notifyMacPhotoSize);
|
||||
NSImage *img = [ToNSImage(userpic) autorelease];
|
||||
NSImage *img = Q2NSImage(userpic.toImage());
|
||||
[notification setContentImage:img];
|
||||
}
|
||||
|
||||
|
@ -10,8 +10,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "platform/platform_specific.h"
|
||||
#include "platform/mac/specific_mac_p.h"
|
||||
|
||||
Q_FORWARD_DECLARE_OBJC_CLASS(NSImage);
|
||||
|
||||
namespace Data {
|
||||
class LocationPoint;
|
||||
} // namespace Data
|
||||
@ -60,8 +58,6 @@ inline bool WindowsNeedShadow() {
|
||||
return false;
|
||||
}
|
||||
|
||||
NSImage *ToNSImage(const QPixmap &pixmap);
|
||||
|
||||
namespace ThirdParty {
|
||||
|
||||
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
|
||||
|
||||
void psNewVersion() {
|
||||
|
@ -216,7 +216,7 @@ void SetApplicationIcon(const QIcon &icon) {
|
||||
if (!icon.isNull()) {
|
||||
auto pixmap = icon.pixmap(1024, 1024);
|
||||
pixmap.setDevicePixelRatio(cRetinaFactor());
|
||||
image = static_cast<NSImage*>(ToNSImage(pixmap));
|
||||
image = Q2NSImage(pixmap.toImage());
|
||||
}
|
||||
[[NSApplication sharedApplication] setApplicationIconImage:image];
|
||||
}
|
||||
|
@ -13,7 +13,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "api/api_sending.h"
|
||||
#include "base/call_delayed.h"
|
||||
#include "base/platform/mac/base_utilities_mac.h"
|
||||
#include "platform/platform_specific.h"
|
||||
#include "boxes/confirm_box.h"
|
||||
#include "chat_helpers/emoji_list_widget.h"
|
||||
#include "core/sandbox.h"
|
||||
@ -143,19 +142,22 @@ 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);
|
||||
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,
|
||||
std::move(emoji),
|
||||
emoji,
|
||||
Ui::Emoji::GetSizeTouchbar(),
|
||||
0,
|
||||
0);
|
||||
return [Platform::ToNSImage(pixmap) autorelease];
|
||||
}
|
||||
return Q2NSImage(image);
|
||||
}
|
||||
|
||||
auto ActiveChat(not_null<Window::Controller*> controller) {
|
||||
@ -422,8 +424,7 @@ void AppendEmojiPacks(
|
||||
PickerScrubberItemView *itemView = [scrubber
|
||||
makeItemWithIdentifier:kStickerItemIdentifier
|
||||
owner:self];
|
||||
itemView.imageView.image = [Platform::ToNSImage(item.qpixmap)
|
||||
autorelease];
|
||||
itemView.imageView.image = Q2NSImage(item.image);
|
||||
itemView->documentId = document->id;
|
||||
return itemView;
|
||||
} else if (const auto emoji = item.emoji) {
|
||||
|
@ -9,7 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
|
||||
#ifndef OS_OSX
|
||||
|
||||
#include "platform/platform_specific.h"
|
||||
#include "base/platform/mac/base_utilities_mac.h"
|
||||
|
||||
#import <AppKit/NSTextField.h>
|
||||
|
||||
@ -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 = [Platform::ToNSImage(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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user