mirror of
https://github.com/vale981/tdesktop
synced 2025-03-06 02:01:40 -05:00
Fixed several bugs appearing on logout-login in player and messages.
This commit is contained in:
parent
48a20f0e71
commit
40fc7379bc
9 changed files with 38 additions and 6 deletions
|
@ -2927,8 +2927,8 @@ namespace {
|
|||
|
||||
if (App::main()) {
|
||||
App::main()->updateScrollColors();
|
||||
HistoryLayout::serviceColorsUpdated();
|
||||
}
|
||||
HistoryLayout::serviceColorsUpdated();
|
||||
}
|
||||
|
||||
const style::color &msgServiceBg() {
|
||||
|
|
|
@ -161,6 +161,7 @@ void NotificationsBox::paintEvent(QPaintEvent *e) {
|
|||
p.drawPixmapLeft(sampleLeft, sampleTop, width(), _notificationSampleSmall);
|
||||
sampleTop += (isTop ? 1 : -1) * (st::notificationSampleSize.height() + st::notificationsSampleMargin);
|
||||
}
|
||||
p.setOpacity(1.);
|
||||
} else {
|
||||
p.setOpacity(st::notificationSampleOpacity);
|
||||
p.drawPixmapLeft(sampleLeft, sampleTop, width(), _notificationSampleSmall);
|
||||
|
@ -169,6 +170,8 @@ void NotificationsBox::paintEvent(QPaintEvent *e) {
|
|||
}
|
||||
|
||||
auto labelTop = screenRect.y() + screenRect.height() + st::notificationsBoxCountLabelTop;
|
||||
p.setFont(st::boxTitleFont);
|
||||
p.setPen(st::boxTitleFg);
|
||||
p.drawTextLeft(contentLeft, labelTop, width(), lang(lng_settings_notifications_count));
|
||||
}
|
||||
|
||||
|
|
|
@ -30,10 +30,9 @@ inline constexpr size_t array_size(T(&)[N]) {
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
inline T take(T &source) {
|
||||
T result = T();
|
||||
std_::swap_moveable(result, source);
|
||||
return std_::move(result);
|
||||
inline T take(T &source, T &&new_value = T()) {
|
||||
std_::swap_moveable(new_value, source);
|
||||
return std_::move(new_value);
|
||||
}
|
||||
|
||||
} // namespace base
|
||||
|
|
|
@ -975,6 +975,9 @@ void HistoryInner::itemRemoved(HistoryItem *item) {
|
|||
if (_history != item->history() && _migrated != item->history()) {
|
||||
return;
|
||||
}
|
||||
if (!App::main()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto i = _selected.find(item);
|
||||
if (i != _selected.cend()) {
|
||||
|
|
|
@ -312,6 +312,9 @@ void CoverWidget::updateTimeLabel() {
|
|||
void CoverWidget::handleSongChange() {
|
||||
auto ¤t = instance()->current();
|
||||
auto song = current.audio()->song();
|
||||
if (!song) {
|
||||
return;
|
||||
}
|
||||
|
||||
TextWithEntities textWithEntities;
|
||||
if (song->performer.isEmpty()) {
|
||||
|
|
|
@ -59,6 +59,11 @@ Instance::Instance() {
|
|||
subscribe(Notify::PeerUpdated(), Notify::PeerUpdatedHandler(observeEvents, [this](const Notify::PeerUpdate &update) {
|
||||
notifyPeerUpdated(update);
|
||||
}));
|
||||
subscribe(Global::RefSelfChanged(), [this] {
|
||||
if (!App::self()) {
|
||||
handleLogout();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void Instance::notifyPeerUpdated(const Notify::PeerUpdate &update) {
|
||||
|
@ -297,5 +302,17 @@ void Instance::preloadNext() {
|
|||
}
|
||||
}
|
||||
|
||||
void Instance::handleLogout() {
|
||||
_current = _seeking = AudioMsgId();
|
||||
_history = nullptr;
|
||||
_migrated = nullptr;
|
||||
|
||||
_repeatEnabled = _isPlaying = false;
|
||||
|
||||
_playlist.clear();
|
||||
|
||||
_usePanelPlayer.notify(false, true);
|
||||
}
|
||||
|
||||
} // namespace Player
|
||||
} // namespace Media
|
||||
|
|
|
@ -105,6 +105,8 @@ public:
|
|||
|
||||
void documentLoadProgress(DocumentData *document);
|
||||
|
||||
void clear();
|
||||
|
||||
private:
|
||||
Instance();
|
||||
friend void start();
|
||||
|
@ -117,6 +119,7 @@ private:
|
|||
void rebuildPlaylist();
|
||||
void moveInPlaylist(int delta);
|
||||
void preloadNext();
|
||||
void handleLogout();
|
||||
|
||||
template <typename CheckCallback>
|
||||
void emitUpdate(CheckCallback check);
|
||||
|
|
|
@ -161,9 +161,10 @@ QRect ListWidget::getCurrentTrackGeometry() const {
|
|||
if (exists()) {
|
||||
auto top = marginTop();
|
||||
auto current = instance()->current();
|
||||
auto fullMsgId = current.contextId();
|
||||
for_const (auto layout, _list) {
|
||||
auto layoutHeight = layout->height();
|
||||
if (layout->getItem()->fullId() == current.contextId()) {
|
||||
if (layout->getItem()->fullId() == fullMsgId) {
|
||||
return QRect(0, top, width(), layoutHeight);
|
||||
}
|
||||
top += layoutHeight;
|
||||
|
|
|
@ -367,6 +367,9 @@ void Widget::updateTimeLabel() {
|
|||
void Widget::handleSongChange() {
|
||||
auto ¤t = instance()->current();
|
||||
auto song = current.audio()->song();
|
||||
if (!song) {
|
||||
return;
|
||||
}
|
||||
|
||||
TextWithEntities textWithEntities;
|
||||
if (song->performer.isEmpty()) {
|
||||
|
|
Loading…
Add table
Reference in a new issue