Version 0.10.15 alpha: crash fix in new player, close button added.

Also some grammar improvements and pinned message bar hiding fixed.
This commit is contained in:
John Preston 2016-10-18 18:19:13 +03:00
parent b33b59b8b9
commit 48a20f0e71
18 changed files with 132 additions and 62 deletions

View file

@ -976,7 +976,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
"lng_new_version_wrap" = "Telegram Desktop was updated to version {version}\n\n{changes}\n\nFull version history is available here:\n{link}";
"lng_new_version_minor" = "— Bug fixes and other minor improvements";
"lng_new_version_text" = "— New audio player design\n\nWindows and Linux:\n— Quick reply from notifications\n— Hide all notifications button added\n— Change notifications location and maximum count\n\nWindows 10:\n— Respecting quite hours for the notifications\n\nLinux:\n— You can enable native notifications in Settings";
"lng_new_version_text" = "— New audio player design\n\nWindows and Linux:\n— Quick reply from notifications\n— Hide all notifications button added\n— Change notifications location and maximum count\n\nWindows 10:\n— Respecting quiet hours for the notifications\n\nLinux:\n— You can enable native notifications in Settings";
"lng_menu_insert_unicode" = "Insert Unicode control character";

View file

@ -34,8 +34,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico"
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,10,14,0
PRODUCTVERSION 0,10,14,0
FILEVERSION 0,10,15,0
PRODUCTVERSION 0,10,15,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -51,10 +51,10 @@ BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "Telegram Messenger LLP"
VALUE "FileVersion", "0.10.14.0"
VALUE "FileVersion", "0.10.15.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2016"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "0.10.14.0"
VALUE "ProductVersion", "0.10.15.0"
END
END
BLOCK "VarFileInfo"

View file

@ -25,8 +25,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,10,14,0
PRODUCTVERSION 0,10,14,0
FILEVERSION 0,10,15,0
PRODUCTVERSION 0,10,15,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -43,10 +43,10 @@ BEGIN
BEGIN
VALUE "CompanyName", "Telegram Messenger LLP"
VALUE "FileDescription", "Telegram Updater"
VALUE "FileVersion", "0.10.14.0"
VALUE "FileVersion", "0.10.15.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2016"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "0.10.14.0"
VALUE "ProductVersion", "0.10.15.0"
END
END
BLOCK "VarFileInfo"

View file

@ -1087,7 +1087,7 @@ void AppClass::checkMapVersion() {
if (Local::oldMapVersion()) {
QString versionFeatures;
if ((cAlphaVersion() || cBetaVersion()) && Local::oldMapVersion() < 10014) {
versionFeatures = QString::fromUtf8("\xe2\x80\x94 New audio player design\n\xe2\x80\x94 Moved to Qt library version 5.6.2\n\nWindows 10:\n\xe2\x80\x94 Respecting quite hours for the notifications");
versionFeatures = QString::fromUtf8("\xe2\x80\x94 New audio player design\n\xe2\x80\x94 Moved to Qt library version 5.6.2\n\nWindows 10:\n\xe2\x80\x94 Respecting quiet hours for the notifications");
} else if (!(cAlphaVersion() || cBetaVersion()) && Local::oldMapVersion() < 10005) {
versionFeatures = langNewVersionText();
} else {

View file

@ -24,7 +24,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#define BETA_VERSION_MACRO (0ULL)
constexpr int AppVersion = 10014;
constexpr str_const AppVersionStr = "0.10.14";
constexpr int AppVersion = 10015;
constexpr str_const AppVersionStr = "0.10.15";
constexpr bool AppAlphaVersion = true;
constexpr uint64 AppBetaVersion = BETA_VERSION_MACRO;

View file

@ -4190,7 +4190,7 @@ void HistoryWidget::showHistory(const PeerId &peerId, MsgId showAtMsgId, bool re
_history->showAtMsgId = _showAtMsgId;
destroyUnreadBar();
if (_pinnedBar) destroyPinnedBar();
destroyPinnedBar();
_history = _migrated = nullptr;
updateBotKeyboard();
}
@ -7560,6 +7560,11 @@ HistoryWidget::PinnedBar::PinnedBar(MsgId msgId, HistoryWidget *parent)
, shadow(parent, st::shadowColor) {
}
HistoryWidget::PinnedBar::~PinnedBar() {
cancel.destroyDelayed();
shadow.destroyDelayed();
}
void HistoryWidget::updatePinnedBar(bool force) {
if (!_pinnedBar) {
return;
@ -7603,7 +7608,7 @@ bool HistoryWidget::pinnedMsgVisibilityUpdated() {
}
if (pinnedMsgId) {
if (!_pinnedBar) {
_pinnedBar = new PinnedBar(pinnedMsgId, this);
_pinnedBar = std_::make_unique<PinnedBar>(pinnedMsgId, this);
if (_a_show.animating()) {
_pinnedBar->cancel->hide();
_pinnedBar->shadow->hide();
@ -7650,8 +7655,7 @@ bool HistoryWidget::pinnedMsgVisibilityUpdated() {
}
void HistoryWidget::destroyPinnedBar() {
delete _pinnedBar;
_pinnedBar = nullptr;
_pinnedBar.reset();
_inPinnedMsg = false;
}
@ -8881,6 +8885,5 @@ bool HistoryWidget::touchScroll(const QPoint &delta) {
}
HistoryWidget::~HistoryWidget() {
delete base::take(_pinnedBar);
delete base::take(_list);
}

View file

@ -886,6 +886,7 @@ private:
struct PinnedBar {
PinnedBar(MsgId msgId, HistoryWidget *parent);
~PinnedBar();
MsgId msgId = 0;
HistoryItem *msg = nullptr;
@ -893,7 +894,7 @@ private:
ChildWidget<IconedButton> cancel;
ChildWidget<Ui::PlainShadow> shadow;
};
PinnedBar *_pinnedBar = nullptr;
std_::unique_ptr<PinnedBar> _pinnedBar;
void updatePinnedBar(bool force = false);
bool pinnedMsgVisibilityUpdated();
void destroyPinnedBar();

View file

@ -124,6 +124,7 @@ MainWidget::MainWidget(MainWindow *window) : TWidget(window)
if (Media::Player::exists()) {
_playerPanel->setPinCallback([this] { switchToFixedPlayer(); });
_playerPanel->setCloseCallback([this] { closeBothPlayers(); });
subscribe(Media::Player::instance()->titleButtonOver(), [this](bool over) {
if (over) {
_playerPanel->showFromOther();
@ -1578,8 +1579,10 @@ void MainWidget::handleAudioUpdate(const AudioMsgId &audioId) {
}
if (playing == audioId && audioId.type() == AudioMsgId::Type::Song) {
if (!_playerUsingPanel && !_player && Media::Player::exists()) {
createPlayer();
if (!(playbackState.state & AudioPlayerStoppedMask) && playbackState.state != AudioPlayerFinishing) {
if (!_playerUsingPanel && !_player && Media::Player::exists()) {
createPlayer();
}
}
}
@ -1623,6 +1626,22 @@ void MainWidget::switchToFixedPlayer() {
_playerPanel->hideIgnoringEnterEvents();
}
void MainWidget::closeBothPlayers() {
_playerUsingPanel = false;
_player.destroyDelayed();
_playerVolume.destroyDelayed();
if (Media::Player::exists()) {
Media::Player::instance()->usePanelPlayer().notify(false, true);
}
_playerPanel->hideIgnoringEnterEvents();
_playerPlaylist->hideIgnoringEnterEvents();
if (Media::Player::exists()) {
Media::Player::instance()->stop();
}
}
void MainWidget::createPlayer() {
_player.create(this, [this] { playerHeightUpdated(); });
_player->entity()->setCloseCallback([this] { switchToPanelPlayer(); });

View file

@ -491,6 +491,7 @@ private:
void createPlayer();
void switchToPanelPlayer();
void switchToFixedPlayer();
void closeBothPlayers();
void playerHeightUpdated();
void sendReadRequest(PeerData *peer, MsgId upTo);

View file

@ -143,9 +143,7 @@ mediaPlayerPreviousDisabledIcon: icon {
};
mediaPlayerClose: IconButton(mediaPlayerRepeatButton) {
width: 37px;
icon: icon {
{ "player_close", #c8c8c8, point(10px, 12px) },
};
icon: icon {{ "player_close", #c8c8c8, point(10px, 12px) }};
}
mediaPlayerPlayback: FilledSlider {
fullWidth: 6px;
@ -190,25 +188,27 @@ mediaPlayerPanelMarginBottom: 10px;
mediaPlayerPanelWidth: 344px;
mediaPlayerCoverHeight: 102px;
mediaPlayerPanelClose: IconButton(mediaPlayerClose) {
width: 43px;
height: 28px;
icon: icon {{ "player_close", #c8c8c8, point(16px, 14px) }};
}
mediaPlayerPanelNextButton: IconButton(mediaPlayerRepeatButton) {
width: 37px;
icon: icon {
{ "player_panel_next", mediaPlayerActiveFg, point(10px, 10px) },
};
icon: icon {{ "player_panel_next", mediaPlayerActiveFg, point(10px, 10px) }};
}
mediaPlayerPanelNextDisabledIcon: icon {
{ "player_panel_next", mediaPlayerInactiveFg, point(10px, 10px) },
};
mediaPlayerPanelPreviousButton: IconButton(mediaPlayerPanelNextButton) {
icon: icon {
{ "player_panel_previous", mediaPlayerActiveFg, point(10px, 10px) },
};
icon: icon {{ "player_panel_previous", mediaPlayerActiveFg, point(10px, 10px) }};
}
mediaPlayerPanelPreviousDisabledIcon: icon {
{ "player_panel_previous", mediaPlayerInactiveFg, point(10px, 10px) },
};
mediaPlayerPanelPadding: 18px;
mediaPlayerPanelPadding: 16px;
mediaPlayerPanelNameTop: 24px;
mediaPlayerPanelPlayLeft: 9px;
mediaPlayerPanelPlaySkip: 7px;

View file

@ -73,6 +73,7 @@ void CoverWidget::PlayButton::paintEvent(QPaintEvent *e) {
CoverWidget::CoverWidget(QWidget *parent) : TWidget(parent)
, _nameLabel(this, st::mediaPlayerName)
, _timeLabel(this, st::mediaPlayerTime)
, _close(this, st::mediaPlayerPanelClose)
, _playback(new Ui::MediaSlider(this, st::mediaPlayerPanelPlayback))
, _playPause(this)
, _volumeToggle(this, st::mediaPlayerVolumeToggle)
@ -82,6 +83,11 @@ CoverWidget::CoverWidget(QWidget *parent) : TWidget(parent)
setAttribute(Qt::WA_OpaquePaintEvent);
resize(width(), st::mediaPlayerCoverHeight);
_close->hide();
_nameLabel->setAttribute(Qt::WA_TransparentForMouseEvents);
_timeLabel->setAttribute(Qt::WA_TransparentForMouseEvents);
setMouseTracking(true);
_playback->setChangeProgressCallback([this](float64 value) {
handleSeekProgress(value);
});
@ -128,10 +134,14 @@ CoverWidget::CoverWidget(QWidget *parent) : TWidget(parent)
}
}
void CoverWidget::setPinCallback(PinCallback &&callback) {
void CoverWidget::setPinCallback(ButtonCallback &&callback) {
_pinPlayer->setClickedCallback(std_::move(callback));
}
void CoverWidget::setCloseCallback(ButtonCallback &&callback) {
_close->setClickedCallback(std_::move(callback));
}
void CoverWidget::handleSeekProgress(float64 progress) {
if (!_lastDurationMs) return;
@ -167,6 +177,7 @@ void CoverWidget::resizeEvent(QResizeEvent *e) {
widthForName -= _timeLabel->width() + 2 * st::normalFont->spacew;
_nameLabel->resizeToWidth(widthForName);
updateLabelPositions();
_close->moveToRight(0, 0);
int skip = (st::mediaPlayerPanelPlayback.seekSize.width() / 2);
int length = (width() - 2 * st::mediaPlayerPanelPadding + st::mediaPlayerPanelPlayback.seekSize.width());
@ -187,6 +198,25 @@ void CoverWidget::paintEvent(QPaintEvent *e) {
p.fillRect(e->rect(), st::windowBg);
}
void CoverWidget::mouseMoveEvent(QMouseEvent *e) {
auto closeAreaLeft = st::mediaPlayerPanelPadding + _nameLabel->width();
auto closeAreaHeight = _nameLabel->y() + _nameLabel->height();
auto closeArea = myrtlrect(closeAreaLeft, 0, width() - closeAreaLeft, closeAreaHeight);
auto closeVisible = closeArea.contains(e->pos());
setCloseVisible(closeVisible);
}
void CoverWidget::leaveEvent(QEvent *e) {
setCloseVisible(false);
}
void CoverWidget::setCloseVisible(bool visible) {
if (visible == _close->isHidden()) {
_close->setVisible(visible);
_timeLabel->setVisible(!visible);
}
}
void CoverWidget::updatePlayPrevNextPositions() {
auto left = st::mediaPlayerPanelPlayLeft;
auto top = st::mediaPlayerPanelPlayTop;

View file

@ -42,14 +42,18 @@ class CoverWidget : public TWidget, private base::Subscriber {
public:
CoverWidget(QWidget *parent);
using PinCallback = base::lambda_unique<void()>;
void setPinCallback(PinCallback &&callback);
using ButtonCallback = base::lambda_unique<void()>;
void setPinCallback(ButtonCallback &&callback);
void setCloseCallback(ButtonCallback &&callback);
protected:
void resizeEvent(QResizeEvent *e) override;
void paintEvent(QPaintEvent *e) override;
void mouseMoveEvent(QMouseEvent *e) override;
void leaveEvent(QEvent *e) override;
private:
void setCloseVisible(bool visible);
void handleSeekProgress(float64 progress);
void handleSeekFinished(float64 progress);
@ -75,6 +79,7 @@ private:
class PlayButton;
ChildWidget<FlatLabel> _nameLabel;
ChildWidget<Ui::LabelSimple> _timeLabel;
ChildWidget<Ui::IconButton> _close;
ChildWidget<Clip::Playback> _playback;
ChildWidget<Ui::IconButton> _previousTrack = { nullptr };
ChildWidget<PlayButton> _playPause;

View file

@ -221,6 +221,7 @@ void Panel::ensureCreated() {
if (_layout == Layout::Full) {
_cover.create(this);
setPinCallback(std_::move(_pinCallback));
setCloseCallback(std_::move(_closeCallback));
_scrollShadow.create(this, st::mediaPlayerScrollShadow);
}
@ -254,10 +255,17 @@ void Panel::performDestroy() {
}
}
void Panel::setPinCallback(PinCallback &&callback) {
void Panel::setPinCallback(ButtonCallback &&callback) {
_pinCallback = std_::move(callback);
if (_cover) {
_cover->setPinCallback(PinCallback(_pinCallback));
_cover->setPinCallback(ButtonCallback(_pinCallback));
}
}
void Panel::setCloseCallback(ButtonCallback &&callback) {
_closeCallback = std_::move(callback);
if (_cover) {
_cover->setCloseCallback(ButtonCallback(_closeCallback));
}
}

View file

@ -51,8 +51,9 @@ public:
void showFromOther();
void hideFromOther();
using PinCallback = base::lambda_wrap<void()>;
void setPinCallback(PinCallback &&callback);
using ButtonCallback = base::lambda_wrap<void()>;
void setPinCallback(ButtonCallback &&callback);
void setCloseCallback(ButtonCallback &&callback);
void ui_repaintHistoryItem(const HistoryItem *item);
@ -107,7 +108,7 @@ private:
QTimer _hideTimer, _showTimer;
Ui::RectShadow _shadow;
PinCallback _pinCallback;
ButtonCallback _pinCallback, _closeCallback;
ChildWidget<CoverWidget> _cover = { nullptr };
ChildWidget<ScrollArea> _scroll;
ChildWidget<Ui::GradientShadow> _scrollShadow = { nullptr };

View file

@ -537,10 +537,10 @@ void Manager::onAfterNotificationActivated(PeerId peerId, MsgId msgId) {
namespace {
bool QuiteHoursEnabled = false;
DWORD QuiteHoursValue = 0;
bool QuietHoursEnabled = false;
DWORD QuietHoursValue = 0;
void queryQuiteHours() {
void queryQuietHours() {
LPTSTR lpKeyName = L"Software\\Microsoft\\Windows\\CurrentVersion\\Notifications\\Settings";
LPTSTR lpValueName = L"NOC_GLOBAL_SETTING_TOASTS_ENABLED";
HKEY key;
@ -553,14 +553,14 @@ void queryQuiteHours() {
result = RegQueryValueEx(key, lpValueName, 0, &type, (LPBYTE)&value, &size);
RegCloseKey(key);
auto quiteHoursEnabled = (result == ERROR_SUCCESS);
if (QuiteHoursEnabled != quiteHoursEnabled) {
QuiteHoursEnabled = quiteHoursEnabled;
QuiteHoursValue = value;
LOG(("Quite hours changed, entry value: %1").arg(value));
} else if (QuiteHoursValue != value) {
QuiteHoursValue = value;
LOG(("Quite hours value changed, was value: %1, entry value: %2").arg(QuiteHoursValue).arg(value));
auto quietHoursEnabled = (result == ERROR_SUCCESS);
if (QuietHoursEnabled != quietHoursEnabled) {
QuietHoursEnabled = quietHoursEnabled;
QuietHoursValue = value;
LOG(("Quiet hours changed, entry value: %1").arg(value));
} else if (QuietHoursValue != value) {
QuietHoursValue = value;
LOG(("Quiet hours value changed, was value: %1, entry value: %2").arg(QuietHoursValue).arg(value));
}
}
@ -584,7 +584,7 @@ void querySystemNotificationSettings() {
return;
}
LastSettingsQueryMs = ms;
queryQuiteHours();
queryQuietHours();
queryUserNotificationState();
}
@ -596,7 +596,7 @@ bool skipAudio() {
if (UserNotificationState == QUNS_NOT_PRESENT || UserNotificationState == QUNS_PRESENTATION_MODE) {
return true;
}
if (QuiteHoursEnabled) {
if (QuietHoursEnabled) {
return true;
}
if (EventFilter::getInstance()->sessionLoggedOff()) {
@ -611,7 +611,7 @@ bool skipToast() {
if (UserNotificationState == QUNS_PRESENTATION_MODE || UserNotificationState == QUNS_RUNNING_D3D_FULL_SCREEN/* || UserNotificationState == QUNS_BUSY*/) {
return true;
}
if (QuiteHoursEnabled) {
if (QuietHoursEnabled) {
return true;
}
return false;

View file

@ -45,10 +45,9 @@ void ContinuousSlider::setDisabled(bool disabled) {
}
}
void ContinuousSlider::setMoveByWheel(bool moveByWheel) {
if (_moveByWheel != moveByWheel) {
_moveByWheel = moveByWheel;
if (_moveByWheel) {
void ContinuousSlider::setMoveByWheel(bool move) {
if (move != moveByWheel()) {
if (move) {
_byWheelFinished = std_::make_unique<SingleTimer>();
_byWheelFinished->setTimeoutHandler([this] {
if (_changeFinishedCallback) {
@ -124,7 +123,7 @@ void ContinuousSlider::mouseReleaseEvent(QMouseEvent *e) {
}
void ContinuousSlider::wheelEvent(QWheelEvent *e) {
if (_mouseDown) {
if (_mouseDown || !moveByWheel()) {
return;
}
#ifdef OS_MAC_OLD

View file

@ -54,7 +54,7 @@ public:
return _mouseDown;
}
void setMoveByWheel(bool moveByWheel);
void setMoveByWheel(bool move);
protected:
void mouseMoveEvent(QMouseEvent *e) override;
@ -85,6 +85,10 @@ private:
virtual QRect getSeekRect() const = 0;
virtual float64 getOverDuration() const = 0;
bool moveByWheel() const {
return _byWheelFinished != nullptr;
}
void step_value(float64 ms, bool timer);
void setOver(bool over);
float64 computeValue(const QPoint &pos) const;
@ -93,7 +97,6 @@ private:
Direction _direction = Direction::Horizontal;
bool _disabled = false;
bool _moveByWheel = false;
std_::unique_ptr<SingleTimer> _byWheelFinished;
Callback _changeProgressCallback;

View file

@ -1,6 +1,6 @@
AppVersion 10014
AppVersion 10015
AppVersionStrMajor 0.10
AppVersionStrSmall 0.10.14
AppVersionStr 0.10.14
AppVersionStrSmall 0.10.15
AppVersionStr 0.10.15
AlphaChannel 1
BetaVersion 0