void ProfileInner::onUpdatePhoto() { saveError(); QStringList imgExtensions(cImgExtensions()); QString filter(qsl("Image files (*") + imgExtensions.join(qsl(" *")) + qsl(");;All files (*.*)")); QImage img; QString file; QByteArray remoteContent; if (filedialogGetOpenFile(file, remoteContent, lang(lng_choose_images), filter)) { if (!remoteContent.isEmpty()) { img = App::readImage(remoteContent); } else { if (!file.isEmpty()) { img = App::readImage(file); } } } else { return; } if (img.isNull() || img.width() > 10 * img.height() || img.height() > 10 * img.width()) { saveError(lang(lng_bad_photo)); return; } PhotoCropBox *box = new PhotoCropBox(img, _peer->id); connect(box, SIGNAL(closed()), this, SLOT(onPhotoUpdateStart())); App::wnd()->showLayer(box); }
/*! stop spectrum thread */ void Spectrum::stopSpectrum() { saveError(); }
void ProfileInner::onPhotoUpdateDone(PeerId peer) { if (_peer->id != peer) return; saveError(); showAll(); update(); }
void ProfileInner::onPhotoUpdateFail(PeerId peer) { if (_peer->id != peer) return; saveError(lang(lng_bad_photo)); showAll(); update(); }
void SettingsInner::onPhotoUpdateFail(PeerId peer) { if (!_self || _self->id != peer) return; saveError(lang(lng_bad_photo)); showAll(); update(); }