mirror of https://github.com/procxx/kepka.git
parent
f0e18ac619
commit
6db4972208
|
@ -585,7 +585,7 @@ void Messenger::startLocalStorage() {
|
|||
if (_mtproto) {
|
||||
_mtproto->requestConfig();
|
||||
}
|
||||
qApp->setWindowIcon(Window::CreateIcon());
|
||||
Platform::SetApplicationIcon(Window::CreateIcon());
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -52,6 +52,10 @@ bool IsApplicationActive() {
|
|||
return static_cast<QApplication*>(QApplication::instance())->activeWindow() != nullptr;
|
||||
}
|
||||
|
||||
void SetApplicationIcon(const QIcon &icon) {
|
||||
qApp->setWindowIcon(icon);
|
||||
}
|
||||
|
||||
QString CurrentExecutablePath(int argc, char *argv[]) {
|
||||
constexpr auto kMaxPath = 1024;
|
||||
char result[kMaxPath] = { 0 };
|
||||
|
|
|
@ -33,6 +33,8 @@ std::optional<bool> ApplicationIsActive;
|
|||
|
||||
} // namespace
|
||||
|
||||
NSImage *qt_mac_create_nsimage(const QPixmap &pm);
|
||||
|
||||
using Platform::Q2NSString;
|
||||
using Platform::NSlang;
|
||||
using Platform::NS2QString;
|
||||
|
@ -210,6 +212,17 @@ bool IsApplicationActive() {
|
|||
: (static_cast<QApplication*>(QApplication::instance())->activeWindow() != nullptr);
|
||||
}
|
||||
|
||||
void SetApplicationIcon(const QIcon &icon) {
|
||||
NSImage *image = nil;
|
||||
if (!icon.isNull()) {
|
||||
auto pixmap = icon.pixmap(1024, 1024);
|
||||
pixmap.setDevicePixelRatio(cRetinaFactor());
|
||||
image = static_cast<NSImage*>(qt_mac_create_nsimage(pixmap));
|
||||
}
|
||||
[[NSApplication sharedApplication] setApplicationIconImage:image];
|
||||
[image release];
|
||||
}
|
||||
|
||||
void InitOnTopPanel(QWidget *panel) {
|
||||
Expects(!panel->windowHandle());
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ enum class PermissionType {
|
|||
|
||||
void SetWatchingMediaKeys(bool watching);
|
||||
bool IsApplicationActive();
|
||||
void SetApplicationIcon(const QIcon &icon);
|
||||
bool TranslucentWindowsSupported(QPoint globalPosition);
|
||||
void StartTranslucentPaint(QPainter &p, QPaintEvent *e);
|
||||
void InitOnTopPanel(QWidget *panel);
|
||||
|
|
|
@ -336,6 +336,10 @@ bool IsApplicationActive() {
|
|||
return static_cast<QApplication*>(QApplication::instance())->activeWindow() != nullptr;
|
||||
}
|
||||
|
||||
void SetApplicationIcon(const QIcon &icon) {
|
||||
qApp->setWindowIcon(icon);
|
||||
}
|
||||
|
||||
QString CurrentExecutablePath(int argc, char *argv[]) {
|
||||
WCHAR result[MAX_PATH + 1] = { 0 };
|
||||
auto count = GetModuleFileName(nullptr, result, MAX_PATH + 1);
|
||||
|
|
|
@ -90,16 +90,11 @@ void ConvertIconToBlack(QImage &image) {
|
|||
}
|
||||
|
||||
QIcon CreateOfficialIcon() {
|
||||
auto useNoMarginLogo = (cPlatform() == dbipMac);
|
||||
auto image = [&] {
|
||||
if (const auto messenger = Messenger::InstancePointer()) {
|
||||
return useNoMarginLogo
|
||||
? messenger->logoNoMargin()
|
||||
: messenger->logo();
|
||||
return messenger->logo();
|
||||
}
|
||||
return useNoMarginLogo
|
||||
? LoadLogoNoMargin()
|
||||
: LoadLogo();
|
||||
return LoadLogo();
|
||||
}();
|
||||
if (AuthSession::Exists() && Auth().supportMode()) {
|
||||
ConvertIconToBlack(image);
|
||||
|
|
Loading…
Reference in New Issue