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