mirror of https://github.com/procxx/kepka.git
dont cache default background image, cmd+m minimizes window in os x
This commit is contained in:
parent
34d5c3777b
commit
a356a4dc06
|
@ -1808,16 +1808,22 @@ namespace App {
|
||||||
if (Local::readBackground()) return;
|
if (Local::readBackground()) return;
|
||||||
|
|
||||||
QImage img(p);
|
QImage img(p);
|
||||||
|
bool remove = false;
|
||||||
if (p.isNull()) {
|
if (p.isNull()) {
|
||||||
img.load(st::msgBG);
|
img.load(st::msgBG);
|
||||||
id = 0;
|
id = 0;
|
||||||
|
remove = true;
|
||||||
}
|
}
|
||||||
if (img.format() != QImage::Format_ARGB32 && img.format() != QImage::Format_ARGB32_Premultiplied && img.format() != QImage::Format_RGB32) {
|
if (img.format() != QImage::Format_ARGB32 && img.format() != QImage::Format_ARGB32_Premultiplied && img.format() != QImage::Format_RGB32) {
|
||||||
img = img.convertToFormat(QImage::Format_RGB32);
|
img = img.convertToFormat(QImage::Format_RGB32);
|
||||||
}
|
}
|
||||||
img.setDevicePixelRatio(cRetinaFactor());
|
img.setDevicePixelRatio(cRetinaFactor());
|
||||||
|
|
||||||
if (!nowrite) Local::writeBackground(id, img);
|
if (remove) {
|
||||||
|
Local::writeBackground(0, QImage());
|
||||||
|
} else if (!nowrite) {
|
||||||
|
Local::writeBackground(id, img);
|
||||||
|
}
|
||||||
|
|
||||||
delete cChatBackground();
|
delete cChatBackground();
|
||||||
cSetChatBackground(new QPixmap(QPixmap::fromImage(img, Qt::ColorOnly)));
|
cSetChatBackground(new QPixmap(QPixmap::fromImage(img, Qt::ColorOnly)));
|
||||||
|
|
|
@ -60,6 +60,9 @@ namespace {
|
||||||
App::wnd()->minimizeToTray();
|
App::wnd()->minimizeToTray();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
} else if (ev->key() == Qt::Key_M && (ev->modifiers() & (Qt::MetaModifier | Qt::ControlModifier))) {
|
||||||
|
App::wnd()->setWindowState(Qt::WindowMinimized);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return QObject::eventFilter(o, e);
|
return QObject::eventFilter(o, e);
|
||||||
|
|
|
@ -78,7 +78,7 @@ void BackgroundInner::gotWallpapers(const MTPVector<MTPWallPaper> &result) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (thumb && full && full->type() != mtpc_photoSizeEmpty) {
|
if (thumb && full && full->type() != mtpc_photoSizeEmpty) {
|
||||||
wallpapers.push_back(App::WallPaper(d.vid.v, App::image(*thumb), App::image(*full)));
|
wallpapers.push_back(App::WallPaper(d.vid.v ? d.vid.v : INT_MAX, App::image(*thumb), App::image(*full)));
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
|
|
@ -2178,6 +2178,15 @@ namespace Local {
|
||||||
void writeBackground(int32 id, const QImage &img) {
|
void writeBackground(int32 id, const QImage &img) {
|
||||||
if (!_working()) return;
|
if (!_working()) return;
|
||||||
|
|
||||||
|
if (img.isNull()) {
|
||||||
|
if (_backgroundKey) {
|
||||||
|
clearKey(_backgroundKey);
|
||||||
|
_backgroundKey = 0;
|
||||||
|
_mapChanged = true;
|
||||||
|
}
|
||||||
|
_writeMap();
|
||||||
|
return;
|
||||||
|
}
|
||||||
QByteArray png;
|
QByteArray png;
|
||||||
{
|
{
|
||||||
QBuffer buf(&png);
|
QBuffer buf(&png);
|
||||||
|
|
|
@ -1591,7 +1591,7 @@ void MainWidget::checkChatBackground() {
|
||||||
if (_background->full->isNull()) {
|
if (_background->full->isNull()) {
|
||||||
App::initBackground();
|
App::initBackground();
|
||||||
} else {
|
} else {
|
||||||
App::initBackground(_background->id, _background->full->pix().toImage());
|
App::initBackground(_background->id, _background->id ? _background->full->pix().toImage() : QImage());
|
||||||
}
|
}
|
||||||
delete _background;
|
delete _background;
|
||||||
_background = 0;
|
_background = 0;
|
||||||
|
|
Loading…
Reference in New Issue