mirror of https://github.com/procxx/kepka.git
Added custom close icon to touchbar
- Slightly refactored.
This commit is contained in:
parent
9873e6d75c
commit
ba1691bf7e
|
@ -152,6 +152,9 @@ mediaPlayerPreviousButton: IconButton(mediaPlayerNextButton) {
|
||||||
mediaPlayerPreviousDisabledIcon: icon {
|
mediaPlayerPreviousDisabledIcon: icon {
|
||||||
{ "player_next-flip_horizontal", mediaPlayerInactiveFg, mediaPlayerSkipIconPosition },
|
{ "player_next-flip_horizontal", mediaPlayerInactiveFg, mediaPlayerSkipIconPosition },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
iconPlayerClose: icon {{ "player_close", windowFg }};
|
||||||
|
|
||||||
mediaPlayerClose: IconButton(mediaPlayerRepeatButton) {
|
mediaPlayerClose: IconButton(mediaPlayerRepeatButton) {
|
||||||
width: 37px;
|
width: 37px;
|
||||||
icon: icon {{ "player_close", menuIconFg, point(10px, 12px) }};
|
icon: icon {{ "player_close", menuIconFg, point(10px, 12px) }};
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include "ui/empty_userpic.h"
|
#include "ui/empty_userpic.h"
|
||||||
#include "observer_peer.h"
|
#include "observer_peer.h"
|
||||||
#include "styles/style_dialogs.h"
|
#include "styles/style_dialogs.h"
|
||||||
|
#include "styles/style_media_player.h"
|
||||||
#include "data/data_folder.h"
|
#include "data/data_folder.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -205,7 +206,7 @@ auto lifetime = rpl::lifetime();
|
||||||
Ui::EmptyUserpic::PaintSavedMessages(paint, 0, 0, s, s);
|
Ui::EmptyUserpic::PaintSavedMessages(paint, 0, 0, s, s);
|
||||||
}
|
}
|
||||||
pix->setDevicePixelRatio(cRetinaFactor());
|
pix->setDevicePixelRatio(cRetinaFactor());
|
||||||
return static_cast<NSImage*>(qt_mac_create_nsimage(*pix));
|
return [qt_mac_create_nsimage(*pix) autorelease];
|
||||||
}
|
}
|
||||||
if (!self.peer) {
|
if (!self.peer) {
|
||||||
// Random picture.
|
// Random picture.
|
||||||
|
@ -214,7 +215,7 @@ auto lifetime = rpl::lifetime();
|
||||||
self.waiting = !self.peer->userpicLoaded();
|
self.waiting = !self.peer->userpicLoaded();
|
||||||
auto pixmap = self.peer->genUserpic(kIdealIconSize);
|
auto pixmap = self.peer->genUserpic(kIdealIconSize);
|
||||||
pixmap.setDevicePixelRatio(cRetinaFactor());
|
pixmap.setDevicePixelRatio(cRetinaFactor());
|
||||||
return static_cast<NSImage*>(qt_mac_create_nsimage(pixmap));
|
return [qt_mac_create_nsimage(pixmap) autorelease];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -264,7 +265,7 @@ auto lifetime = rpl::lifetime();
|
||||||
@"type": @"button",
|
@"type": @"button",
|
||||||
@"name": @"Close Player",
|
@"name": @"Close Player",
|
||||||
@"cmd": [NSNumber numberWithInt:kClosePlayer],
|
@"cmd": [NSNumber numberWithInt:kClosePlayer],
|
||||||
@"image": [NSImage imageNamed:NSImageNameTouchBarExitFullScreenTemplate]
|
@"image": createImageFromStyleIcon(st::iconPlayerClose, NSMakeSize(kIdealIconSize / 3, kIdealIconSize / 3))
|
||||||
}],
|
}],
|
||||||
currentPosition: [NSMutableDictionary dictionaryWithDictionary:@{
|
currentPosition: [NSMutableDictionary dictionaryWithDictionary:@{
|
||||||
@"type": @"text",
|
@"type": @"text",
|
||||||
|
@ -297,6 +298,13 @@ auto lifetime = rpl::lifetime();
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NSImage *createImageFromStyleIcon(const style::icon &icon, NSSize size) {
|
||||||
|
const auto pixmap = icon.instance(QColor(255, 255, 255, 255), 100);
|
||||||
|
NSImage *image = [qt_mac_create_nsimage(QPixmap::fromImage(pixmap)) autorelease];
|
||||||
|
[image setSize:size];
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
- (void) createTouchBar {
|
- (void) createTouchBar {
|
||||||
_touchBarMain = [[NSTouchBar alloc] init];
|
_touchBarMain = [[NSTouchBar alloc] init];
|
||||||
_touchBarMain.delegate = self;
|
_touchBarMain.delegate = self;
|
||||||
|
|
Loading…
Reference in New Issue