mirror of https://github.com/procxx/kepka.git
Fixed several bugs appearing on logout-login in player and messages.
This commit is contained in:
parent
48a20f0e71
commit
40fc7379bc
|
@ -2927,8 +2927,8 @@ namespace {
|
||||||
|
|
||||||
if (App::main()) {
|
if (App::main()) {
|
||||||
App::main()->updateScrollColors();
|
App::main()->updateScrollColors();
|
||||||
HistoryLayout::serviceColorsUpdated();
|
|
||||||
}
|
}
|
||||||
|
HistoryLayout::serviceColorsUpdated();
|
||||||
}
|
}
|
||||||
|
|
||||||
const style::color &msgServiceBg() {
|
const style::color &msgServiceBg() {
|
||||||
|
|
|
@ -161,6 +161,7 @@ void NotificationsBox::paintEvent(QPaintEvent *e) {
|
||||||
p.drawPixmapLeft(sampleLeft, sampleTop, width(), _notificationSampleSmall);
|
p.drawPixmapLeft(sampleLeft, sampleTop, width(), _notificationSampleSmall);
|
||||||
sampleTop += (isTop ? 1 : -1) * (st::notificationSampleSize.height() + st::notificationsSampleMargin);
|
sampleTop += (isTop ? 1 : -1) * (st::notificationSampleSize.height() + st::notificationsSampleMargin);
|
||||||
}
|
}
|
||||||
|
p.setOpacity(1.);
|
||||||
} else {
|
} else {
|
||||||
p.setOpacity(st::notificationSampleOpacity);
|
p.setOpacity(st::notificationSampleOpacity);
|
||||||
p.drawPixmapLeft(sampleLeft, sampleTop, width(), _notificationSampleSmall);
|
p.drawPixmapLeft(sampleLeft, sampleTop, width(), _notificationSampleSmall);
|
||||||
|
@ -169,6 +170,8 @@ void NotificationsBox::paintEvent(QPaintEvent *e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
auto labelTop = screenRect.y() + screenRect.height() + st::notificationsBoxCountLabelTop;
|
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));
|
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>
|
template <typename T>
|
||||||
inline T take(T &source) {
|
inline T take(T &source, T &&new_value = T()) {
|
||||||
T result = T();
|
std_::swap_moveable(new_value, source);
|
||||||
std_::swap_moveable(result, source);
|
return std_::move(new_value);
|
||||||
return std_::move(result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace base
|
} // namespace base
|
||||||
|
|
|
@ -975,6 +975,9 @@ void HistoryInner::itemRemoved(HistoryItem *item) {
|
||||||
if (_history != item->history() && _migrated != item->history()) {
|
if (_history != item->history() && _migrated != item->history()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!App::main()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto i = _selected.find(item);
|
auto i = _selected.find(item);
|
||||||
if (i != _selected.cend()) {
|
if (i != _selected.cend()) {
|
||||||
|
|
|
@ -312,6 +312,9 @@ void CoverWidget::updateTimeLabel() {
|
||||||
void CoverWidget::handleSongChange() {
|
void CoverWidget::handleSongChange() {
|
||||||
auto ¤t = instance()->current();
|
auto ¤t = instance()->current();
|
||||||
auto song = current.audio()->song();
|
auto song = current.audio()->song();
|
||||||
|
if (!song) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
TextWithEntities textWithEntities;
|
TextWithEntities textWithEntities;
|
||||||
if (song->performer.isEmpty()) {
|
if (song->performer.isEmpty()) {
|
||||||
|
|
|
@ -59,6 +59,11 @@ Instance::Instance() {
|
||||||
subscribe(Notify::PeerUpdated(), Notify::PeerUpdatedHandler(observeEvents, [this](const Notify::PeerUpdate &update) {
|
subscribe(Notify::PeerUpdated(), Notify::PeerUpdatedHandler(observeEvents, [this](const Notify::PeerUpdate &update) {
|
||||||
notifyPeerUpdated(update);
|
notifyPeerUpdated(update);
|
||||||
}));
|
}));
|
||||||
|
subscribe(Global::RefSelfChanged(), [this] {
|
||||||
|
if (!App::self()) {
|
||||||
|
handleLogout();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Instance::notifyPeerUpdated(const Notify::PeerUpdate &update) {
|
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 Player
|
||||||
} // namespace Media
|
} // namespace Media
|
||||||
|
|
|
@ -105,6 +105,8 @@ public:
|
||||||
|
|
||||||
void documentLoadProgress(DocumentData *document);
|
void documentLoadProgress(DocumentData *document);
|
||||||
|
|
||||||
|
void clear();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Instance();
|
Instance();
|
||||||
friend void start();
|
friend void start();
|
||||||
|
@ -117,6 +119,7 @@ private:
|
||||||
void rebuildPlaylist();
|
void rebuildPlaylist();
|
||||||
void moveInPlaylist(int delta);
|
void moveInPlaylist(int delta);
|
||||||
void preloadNext();
|
void preloadNext();
|
||||||
|
void handleLogout();
|
||||||
|
|
||||||
template <typename CheckCallback>
|
template <typename CheckCallback>
|
||||||
void emitUpdate(CheckCallback check);
|
void emitUpdate(CheckCallback check);
|
||||||
|
|
|
@ -161,9 +161,10 @@ QRect ListWidget::getCurrentTrackGeometry() const {
|
||||||
if (exists()) {
|
if (exists()) {
|
||||||
auto top = marginTop();
|
auto top = marginTop();
|
||||||
auto current = instance()->current();
|
auto current = instance()->current();
|
||||||
|
auto fullMsgId = current.contextId();
|
||||||
for_const (auto layout, _list) {
|
for_const (auto layout, _list) {
|
||||||
auto layoutHeight = layout->height();
|
auto layoutHeight = layout->height();
|
||||||
if (layout->getItem()->fullId() == current.contextId()) {
|
if (layout->getItem()->fullId() == fullMsgId) {
|
||||||
return QRect(0, top, width(), layoutHeight);
|
return QRect(0, top, width(), layoutHeight);
|
||||||
}
|
}
|
||||||
top += layoutHeight;
|
top += layoutHeight;
|
||||||
|
|
|
@ -367,6 +367,9 @@ void Widget::updateTimeLabel() {
|
||||||
void Widget::handleSongChange() {
|
void Widget::handleSongChange() {
|
||||||
auto ¤t = instance()->current();
|
auto ¤t = instance()->current();
|
||||||
auto song = current.audio()->song();
|
auto song = current.audio()->song();
|
||||||
|
if (!song) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
TextWithEntities textWithEntities;
|
TextWithEntities textWithEntities;
|
||||||
if (song->performer.isEmpty()) {
|
if (song->performer.isEmpty()) {
|
||||||
|
|
Loading…
Reference in New Issue