diff --git a/Telegram/PrepareWin.bat b/Telegram/PrepareWin.bat
index 7e4e156f6..b0eee4e0f 100644
--- a/Telegram/PrepareWin.bat
+++ b/Telegram/PrepareWin.bat
@@ -1,11 +1,11 @@
@echo OFF
set "AppVersionStrMajor=0.8"
-set "AppVersion=8038"
-set "AppVersionStrSmall=0.8.38"
-set "AppVersionStr=0.8.38"
-set "AppVersionStrFull=0.8.38.0"
-set "DevChannel=0"
+set "AppVersion=8039"
+set "AppVersionStrSmall=0.8.39"
+set "AppVersionStr=0.8.39"
+set "AppVersionStrFull=0.8.39.0"
+set "DevChannel=1"
if %DevChannel% neq 0 goto preparedev
diff --git a/Telegram/Resources/style.txt b/Telegram/Resources/style.txt
index 859f3d1f5..e2658c14c 100644
--- a/Telegram/Resources/style.txt
+++ b/Telegram/Resources/style.txt
@@ -1989,6 +1989,7 @@ playerNext: sprite(374px, 151px, 22px, 14px);
playerPrev: sprite(374px, 165px, 22px, 14px);
playerClose: sprite(361px, 97px, 12px, 12px);
playerFull: sprite(365px, 109px, 12px, 12px);
+playerRepeat: sprite(365px, 121px, 12px, 14px);
playerVolume: sprite(352px, 179px, 44px, 12px);
playerInactiveOpacity: 0.8;
playerUnavailableOpacity: 0.3;
diff --git a/Telegram/SourceFiles/application.cpp b/Telegram/SourceFiles/application.cpp
index 1d75d7824..76e8a4bc1 100644
--- a/Telegram/SourceFiles/application.cpp
+++ b/Telegram/SourceFiles/application.cpp
@@ -654,8 +654,8 @@ void Application::checkMapVersion() {
psRegisterCustomScheme();
if (Local::oldMapVersion()) {
QString versionFeatures;
- if (DevChannel && Local::oldMapVersion() < 8037) {
- versionFeatures = lang(lng_new_version_text);// QString::fromUtf8("\xe2\x80\x94 Forward photos, media and stickers with drag-n-drop\n\xe2\x80\x94 Drag-n-drop text messages by timestamp to forward them\n\xe2\x80\x94 Larger stickers panel");// .replace('@', qsl("@") + QChar(0x200D));
+ if (DevChannel && Local::oldMapVersion() < 8039) {
+ versionFeatures = QString::fromUtf8("\xe2\x80\x94 Moved to Qt 5.5\n\xe2\x80\x94 Some bugfixes and optimizations\n\xe2\x80\x94 In OS X 10.10.3 location marks sent from mobile should be displayed now");// .replace('@', qsl("@") + QChar(0x200D));
} else if (!DevChannel && Local::oldMapVersion() < 8038) {
versionFeatures = lang(lng_new_version_text).trimmed();
}
diff --git a/Telegram/SourceFiles/art/sprite.png b/Telegram/SourceFiles/art/sprite.png
index fe2c98bc2..648101a31 100644
Binary files a/Telegram/SourceFiles/art/sprite.png and b/Telegram/SourceFiles/art/sprite.png differ
diff --git a/Telegram/SourceFiles/art/sprite_200x.png b/Telegram/SourceFiles/art/sprite_200x.png
index 63b51ff0b..f8d5d7f38 100644
Binary files a/Telegram/SourceFiles/art/sprite_200x.png and b/Telegram/SourceFiles/art/sprite_200x.png differ
diff --git a/Telegram/SourceFiles/audio.cpp b/Telegram/SourceFiles/audio.cpp
index 831b41f88..ac7988a17 100644
--- a/Telegram/SourceFiles/audio.cpp
+++ b/Telegram/SourceFiles/audio.cpp
@@ -1010,7 +1010,7 @@ public:
virtual int64 duration() = 0;
virtual int32 frequency() = 0;
virtual int32 format() = 0;
- virtual bool readMore(QByteArray &result, int64 &samplesAdded) = 0;
+ virtual int readMore(QByteArray &result, int64 &samplesAdded) = 0; // < 0 - error, 0 - nothing read, > 0 - read something
protected:
@@ -1189,14 +1189,14 @@ public:
return fmt;
}
- bool readMore(QByteArray &result, int64 &samplesAdded) {
+ int readMore(QByteArray &result, int64 &samplesAdded) {
int res;
if ((res = av_read_frame(fmtContext, &avpkt)) < 0) {
if (res != AVERROR_EOF) {
char err[AV_ERROR_MAX_STRING_SIZE] = { 0 };
LOG(("Audio Error: Unable to av_read_frame() file '%1', data size '%2', error %3, %4").arg(fname).arg(data.size()).arg(res).arg(av_make_error_string(err, sizeof(err), res)));
}
- return false;
+ return -1;
}
if (avpkt.stream_index == streamId) {
av_frame_unref(frame);
@@ -1204,7 +1204,10 @@ public:
if ((res = avcodec_decode_audio4(codecContext, frame, &got_frame, &avpkt)) < 0) {
char err[AV_ERROR_MAX_STRING_SIZE] = { 0 };
LOG(("Audio Error: Unable to avcodec_decode_audio4() file '%1', data size '%2', error %3, %4").arg(fname).arg(data.size()).arg(res).arg(av_make_error_string(err, sizeof(err), res)));
- return false;
+
+ av_free_packet(&avpkt);
+ if (res == AVERROR_INVALIDDATA) return 0; // try to skip bad packet
+ return -1;
}
if (got_frame) {
@@ -1218,13 +1221,17 @@ public:
dstSamplesData[0] = 0;
char err[AV_ERROR_MAX_STRING_SIZE] = { 0 };
LOG(("Audio Error: Unable to av_samples_alloc for file '%1', data size '%2', error %3, %4").arg(fname).arg(data.size()).arg(res).arg(av_make_error_string(err, sizeof(err), res)));
- return false;
+
+ av_free_packet(&avpkt);
+ return -1;
}
}
if ((res = swr_convert(swrContext, dstSamplesData, dstSamples, (const uint8_t**)frame->extended_data, frame->nb_samples)) < 0) {
char err[AV_ERROR_MAX_STRING_SIZE] = { 0 };
LOG(("Audio Error: Unable to swr_convert for file '%1', data size '%2', error %3, %4").arg(fname).arg(data.size()).arg(res).arg(av_make_error_string(err, sizeof(err), res)));
- return false;
+
+ av_free_packet(&avpkt);
+ return -1;
}
int32 resultLen = av_samples_get_buffer_size(0, _toChannels, res, _toFormat, 1);
result.append((const char*)dstSamplesData[0], resultLen);
@@ -1236,7 +1243,7 @@ public:
}
}
av_free_packet(&avpkt);
- return true;
+ return 1;
}
~FFMpegLoader() {
@@ -1427,7 +1434,8 @@ void AudioPlayerLoaders::loadData(MediaOverviewType type, const void *objId, qin
QByteArray result;
int64 samplesAdded = 0, frequency = l->frequency(), format = l->format();
while (result.size() < AudioVoiceMsgBufferSize) {
- if (!l->readMore(result, samplesAdded)) {
+ int res = l->readMore(result, samplesAdded);
+ if (res < 0) {
if (errAtStart) {
{
QMutexLocker lock(&playerMutex);
@@ -1440,7 +1448,7 @@ void AudioPlayerLoaders::loadData(MediaOverviewType type, const void *objId, qin
finished = true;
break;
}
- errAtStart = false;
+ if (res > 0) errAtStart = false;
QMutexLocker lock(&playerMutex);
if (!checkLoader(type)) {
@@ -2309,9 +2317,9 @@ public:
return _coverFormat;
}
- bool readMore(QByteArray &result, int64 &samplesAdded) {
+ int readMore(QByteArray &result, int64 &samplesAdded) {
DEBUG_LOG(("Audio Read Error: should not call this"));
- return false;
+ return -1;
}
~FFMpegAttributesReader() {
diff --git a/Telegram/SourceFiles/config.h b/Telegram/SourceFiles/config.h
index 724f702b8..336274926 100644
--- a/Telegram/SourceFiles/config.h
+++ b/Telegram/SourceFiles/config.h
@@ -17,9 +17,9 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
*/
#pragma once
-static const int32 AppVersion = 8038;
-static const wchar_t *AppVersionStr = L"0.8.38";
-static const bool DevChannel = false;
+static const int32 AppVersion = 8039;
+static const wchar_t *AppVersionStr = L"0.8.39";
+static const bool DevChannel = true;
static const wchar_t *AppNameOld = L"Telegram Win (Unofficial)";
static const wchar_t *AppName = L"Telegram Desktop";
diff --git a/Telegram/SourceFiles/playerwidget.cpp b/Telegram/SourceFiles/playerwidget.cpp
index c0676ff70..317ac2e85 100644
--- a/Telegram/SourceFiles/playerwidget.cpp
+++ b/Telegram/SourceFiles/playerwidget.cpp
@@ -33,7 +33,7 @@ PlayerWidget::PlayerWidget(QWidget *parent) : TWidget(parent),
_prevAvailable(false), _nextAvailable(false), _fullAvailable(false),
_over(OverNone), _down(OverNone), _downCoord(0), _downFrequency(AudioVoiceMsgFrequency), _downProgress(0.),
_stateAnim(animFunc(this, &PlayerWidget::stateStep)),
-_index(-1), _history(0), _showPause(false), _position(0), _duration(0), _loaded(0),
+_index(-1), _history(0), _timeWidth(0), _repeat(false), _showPause(false), _position(0), _duration(0), _loaded(0),
a_progress(0., 0.), a_loadProgress(0., 0.), _progressAnim(animFunc(this, &PlayerWidget::progressStep)) {
resize(st::wndMinWidth, st::playerHeight);
setMouseTracking(true);
@@ -108,6 +108,11 @@ void PlayerWidget::paintEvent(QPaintEvent *e) {
p.setOpacity(o * 1. + (1. - o) * st::playerInactiveOpacity);
p.drawSpriteCenterLeft(_fullRect, width(), st::playerFull);
}
+ if (checkr.intersects(_repeatRect)) {
+ float64 o = _stateHovers[OverRepeat];
+ p.setOpacity(_repeat ? 1. : (o * st::playerInactiveOpacity + (1. - o) * st::playerUnavailableOpacity));
+ p.drawSpriteCenterLeft(_repeatRect, width(), st::playerRepeat);
+ }
p.setOpacity(1.);
p.setPen(st::playerTimeFg->p);
@@ -185,6 +190,9 @@ void PlayerWidget::mousePressEvent(QMouseEvent *e) {
if (HistoryItem *item = App::histItemById(_song.msgId)) {
App::main()->showMediaOverview(item->history()->peer, OverviewAudioDocuments);
}
+ } else if (_over == OverRepeat) {
+ _repeat = !_repeat;
+ updateOverRect(OverRepeat);
}
}
}
@@ -230,6 +238,7 @@ void PlayerWidget::updateOverRect(OverState state) {
case OverClose: rtlupdate(_closeRect); break;
case OverVolume: rtlupdate(_volumeRect); break;
case OverFull: rtlupdate(_fullRect); break;
+ case OverRepeat: rtlupdate(_repeatRect); break;
case OverPlayback: rtlupdate(_playbackRect); break;
}
}
@@ -365,6 +374,8 @@ void PlayerWidget::updateSelected() {
updateOverState(OverClose);
} else if (_volumeRect.contains(pos)) {
updateOverState(OverVolume);
+ } else if (_repeatRect.contains(pos)) {
+ updateOverState(OverRepeat);
} else if (_duration && _playbackRect.contains(pos)) {
updateOverState(OverPlayback);
} else if (_fullAvailable && inInfo) {
@@ -446,7 +457,7 @@ void PlayerWidget::playPausePressed() {
}
void PlayerWidget::prevPressed() {
- if (isHidden() || !_prevAvailable) return;
+ if (isHidden()) return;
const History::MediaOverview *o = _history ? &_history->_overview[OverviewAudioDocuments] : 0;
if (audioPlayer() && o && _index > 0 && _index <= o->size() && !o->isEmpty()) {
@@ -455,7 +466,7 @@ void PlayerWidget::prevPressed() {
}
void PlayerWidget::nextPressed() {
- if (isHidden() || !_nextAvailable) return;
+ if (isHidden()) return;
const History::MediaOverview *o = _history ? &_history->_overview[OverviewAudioDocuments] : 0;
if (audioPlayer() && o && _index >= 0 && _index < o->size() - 1) {
@@ -480,10 +491,11 @@ void PlayerWidget::resizeEvent(QResizeEvent *e) {
_closeRect = QRect(width() - st::playerSkip / 2 - st::playerClose.pxWidth() - st::playerSkip, ct, st::playerClose.pxWidth() + st::playerSkip, ch);
_volumeRect = QRect(_closeRect.x() - st::playerVolume.pxWidth() - st::playerSkip, ct, st::playerVolume.pxWidth() + st::playerSkip, ch);
- _fullRect = _fullAvailable ? QRect(_volumeRect.x() - st::playerFull.pxWidth() - st::playerSkip, ct, st::playerFull.pxWidth() + st::playerSkip, ch) : QRect();
+ _repeatRect = QRect(_volumeRect.x() - st::playerRepeat.pxWidth() - st::playerSkip, ct, st::playerRepeat.pxWidth() + st::playerSkip, ch);
+ _fullRect = _fullAvailable ? QRect(_repeatRect.x() - st::playerFull.pxWidth() - st::playerSkip, ct, st::playerFull.pxWidth() + st::playerSkip, ch) : QRect();
int32 infoLeft = (_fullAvailable ? (_nextRect.x() + _nextRect.width()) : (_playRect.x() + _playRect.width()));
- _infoRect = QRect(infoLeft + st::playerSkip / 2, 0, (_fullAvailable ? _fullRect.x() : _volumeRect.x()) - infoLeft - st::playerSkip, availh);
+ _infoRect = QRect(infoLeft + st::playerSkip / 2, 0, (_fullAvailable ? _fullRect.x() : _repeatRect.x()) - infoLeft - st::playerSkip, availh);
update();
}
@@ -600,9 +612,10 @@ void PlayerWidget::updateState(SongMsgId playing, AudioPlayerState playingState,
}
if (wasPlaying && playingState == AudioPlayerStoppedAtEnd) {
- const History::MediaOverview *o = _history ? &_history->_overview[OverviewAudioDocuments] : 0;
- if (audioPlayer() && o && _index >= 0 && _index < o->size() - 1) {
- startPlay(o->at(_index + 1));
+ if (_repeat) {
+ startPlay(_song.msgId);
+ } else {
+ nextPressed();
}
}
diff --git a/Telegram/SourceFiles/playerwidget.h b/Telegram/SourceFiles/playerwidget.h
index f7ca31696..7e6095287 100644
--- a/Telegram/SourceFiles/playerwidget.h
+++ b/Telegram/SourceFiles/playerwidget.h
@@ -65,6 +65,7 @@ private:
OverClose,
OverVolume,
OverFull,
+ OverRepeat,
OverPlayback,
OverStateCount
@@ -97,8 +98,9 @@ private:
int32 _index;
History *_history;
QRect _playRect, _prevRect, _nextRect, _playbackRect;
- QRect _closeRect, _volumeRect, _fullRect, _infoRect;
+ QRect _closeRect, _volumeRect, _fullRect, _repeatRect, _infoRect;
int32 _timeWidth;
+ bool _repeat;
QString _time;
Text _name;
bool _showPause;
diff --git a/Telegram/Telegram.plist b/Telegram/Telegram.plist
index f3626d369..939c89ea4 100644
--- a/Telegram/Telegram.plist
+++ b/Telegram/Telegram.plist
@@ -11,7 +11,7 @@
CFBundlePackageType
APPL
CFBundleShortVersionString
- 0.8.38
+ 0.8.39
LSMinimumSystemVersion
$(MACOSX_DEPLOYMENT_TARGET)
CFBundleSignature
diff --git a/Telegram/Telegram.rc b/Telegram/Telegram.rc
index 2f08b76ab..f7b4fba3d 100644
Binary files a/Telegram/Telegram.rc and b/Telegram/Telegram.rc differ
diff --git a/Telegram/Telegram.xcodeproj/project.pbxproj b/Telegram/Telegram.xcodeproj/project.pbxproj
index dfaa734e7..3469c0314 100644
--- a/Telegram/Telegram.xcodeproj/project.pbxproj
+++ b/Telegram/Telegram.xcodeproj/project.pbxproj
@@ -1711,7 +1711,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 0.8.38;
+ CURRENT_PROJECT_VERSION = 0.8.39;
DEBUG_INFORMATION_FORMAT = dwarf;
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
@@ -1729,7 +1729,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
COPY_PHASE_STRIP = YES;
- CURRENT_PROJECT_VERSION = 0.8.38;
+ CURRENT_PROJECT_VERSION = 0.8.39;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_OPTIMIZATION_LEVEL = fast;
GCC_PREFIX_HEADER = ./SourceFiles/stdafx.h;
@@ -1755,10 +1755,10 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "";
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 0.8.38;
+ CURRENT_PROJECT_VERSION = 0.8.39;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DYLIB_COMPATIBILITY_VERSION = 0.8;
- DYLIB_CURRENT_VERSION = 0.8.38;
+ DYLIB_CURRENT_VERSION = 0.8.39;
ENABLE_STRICT_OBJC_MSGSEND = YES;
FRAMEWORK_SEARCH_PATHS = "";
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
@@ -1898,10 +1898,10 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "";
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 0.8.38;
+ CURRENT_PROJECT_VERSION = 0.8.39;
DEBUG_INFORMATION_FORMAT = dwarf;
DYLIB_COMPATIBILITY_VERSION = 0.8;
- DYLIB_CURRENT_VERSION = 0.8.38;
+ DYLIB_CURRENT_VERSION = 0.8.39;
ENABLE_STRICT_OBJC_MSGSEND = YES;
FRAMEWORK_SEARCH_PATHS = "";
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
diff --git a/Telegram/Version.sh b/Telegram/Version.sh
index 6058fe1f6..6f9f1534a 100755
--- a/Telegram/Version.sh
+++ b/Telegram/Version.sh
@@ -1,2 +1,2 @@
-echo 0.8 8038 0.8.38 0
+echo 0.8 8039 0.8.39 1
# AppVersionStrMajor AppVersion AppVersionStr DevChannel