From 697fdd42944e95af99c9d594f26d8a2bb1aac6d7 Mon Sep 17 00:00:00 2001
From: John Preston <johnprestonmail@gmail.com>
Date: Fri, 27 Jan 2017 10:08:59 +0300
Subject: [PATCH] Alpha 1.0.3: audio device opened only when some sound is
 played.

Also on Windows Vista and later audio device should switch after
the system default audio output device is changed.
---
 Telegram/Resources/winrc/Telegram.rc       |  8 ++++----
 Telegram/Resources/winrc/Updater.rc        |  8 ++++----
 Telegram/SourceFiles/application.cpp       |  4 ++--
 Telegram/SourceFiles/core/version.h        |  8 ++++----
 Telegram/SourceFiles/media/media_audio.cpp |  3 +++
 Telegram/build/version                     | 10 +++++-----
 6 files changed, 22 insertions(+), 19 deletions(-)

diff --git a/Telegram/Resources/winrc/Telegram.rc b/Telegram/Resources/winrc/Telegram.rc
index b909adec5..a27163ca7 100644
--- a/Telegram/Resources/winrc/Telegram.rc
+++ b/Telegram/Resources/winrc/Telegram.rc
@@ -34,8 +34,8 @@ IDI_ICON1               ICON                    "..\\art\\icon256.ico"
 //
 
 VS_VERSION_INFO VERSIONINFO
- FILEVERSION 1,0,2,1
- PRODUCTVERSION 1,0,2,1
+ FILEVERSION 1,0,3,0
+ PRODUCTVERSION 1,0,3,0
  FILEFLAGSMASK 0x3fL
 #ifdef _DEBUG
  FILEFLAGS 0x1L
@@ -51,10 +51,10 @@ BEGIN
         BLOCK "040904b0"
         BEGIN
             VALUE "CompanyName", "Telegram Messenger LLP"
-            VALUE "FileVersion", "1.0.2.1"
+            VALUE "FileVersion", "1.0.3.0"
             VALUE "LegalCopyright", "Copyright (C) 2014-2017"
             VALUE "ProductName", "Telegram Desktop"
-            VALUE "ProductVersion", "1.0.2.1"
+            VALUE "ProductVersion", "1.0.3.0"
         END
     END
     BLOCK "VarFileInfo"
diff --git a/Telegram/Resources/winrc/Updater.rc b/Telegram/Resources/winrc/Updater.rc
index e78702a93..23022ba42 100644
--- a/Telegram/Resources/winrc/Updater.rc
+++ b/Telegram/Resources/winrc/Updater.rc
@@ -25,8 +25,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 //
 
 VS_VERSION_INFO VERSIONINFO
- FILEVERSION 1,0,2,1
- PRODUCTVERSION 1,0,2,1
+ FILEVERSION 1,0,3,0
+ PRODUCTVERSION 1,0,3,0
  FILEFLAGSMASK 0x3fL
 #ifdef _DEBUG
  FILEFLAGS 0x1L
@@ -43,10 +43,10 @@ BEGIN
         BEGIN
             VALUE "CompanyName", "Telegram Messenger LLP"
             VALUE "FileDescription", "Telegram Updater"
-            VALUE "FileVersion", "1.0.2.1"
+            VALUE "FileVersion", "1.0.3.0"
             VALUE "LegalCopyright", "Copyright (C) 2014-2017"
             VALUE "ProductName", "Telegram Desktop"
-            VALUE "ProductVersion", "1.0.2.1"
+            VALUE "ProductVersion", "1.0.3.0"
         END
     END
     BLOCK "VarFileInfo"
diff --git a/Telegram/SourceFiles/application.cpp b/Telegram/SourceFiles/application.cpp
index a3adb57db..9a3a90637 100644
--- a/Telegram/SourceFiles/application.cpp
+++ b/Telegram/SourceFiles/application.cpp
@@ -1069,8 +1069,8 @@ void AppClass::checkMapVersion() {
     if (Local::oldMapVersion() < AppVersion) {
 		if (Local::oldMapVersion()) {
 			QString versionFeatures;
-			if ((cAlphaVersion() || cBetaVersion()) && Local::oldMapVersion() < 1000001) {
-				versionFeatures = QString::fromUtf8("\xe2\x80\x94 Resize chats list with mouse press-and-drag\n\xe2\x80\x94 Drag-n-drop images from Firefox fixed in Windows\n\xe2\x80\x94 Bug fixes and other minor improvements");
+			if ((cAlphaVersion() || cBetaVersion()) && Local::oldMapVersion() < 1000003) {
+				versionFeatures = QString::fromUtf8("\xe2\x80\x94 Audio device is opened only when some sound is played.\n\xe2\x80\x94 On Windows Vista and later audio device should switch after the system default changes.");
 			} else if (!(cAlphaVersion() || cBetaVersion()) && Local::oldMapVersion() < 1000002) {
 				versionFeatures = langNewVersionText();
 			} else {
diff --git a/Telegram/SourceFiles/core/version.h b/Telegram/SourceFiles/core/version.h
index e625a8ff1..ec6a4727e 100644
--- a/Telegram/SourceFiles/core/version.h
+++ b/Telegram/SourceFiles/core/version.h
@@ -22,9 +22,9 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
 
 #include "core/utils.h"
 
-#define BETA_VERSION_MACRO (1000002001ULL)
+#define BETA_VERSION_MACRO (0ULL)
 
-constexpr int AppVersion = 1000002;
-constexpr str_const AppVersionStr = "1.0.2";
-constexpr bool AppAlphaVersion = false;
+constexpr int AppVersion = 1000003;
+constexpr str_const AppVersionStr = "1.0.3";
+constexpr bool AppAlphaVersion = true;
 constexpr uint64 AppBetaVersion = BETA_VERSION_MACRO;
diff --git a/Telegram/SourceFiles/media/media_audio.cpp b/Telegram/SourceFiles/media/media_audio.cpp
index 0bb5dea64..c968c4882 100644
--- a/Telegram/SourceFiles/media/media_audio.cpp
+++ b/Telegram/SourceFiles/media/media_audio.cpp
@@ -297,6 +297,9 @@ void InitAudio() {
 
 	PrepareNotifySound();
 
+	auto loglevel = getenv("ALSOFT_LOGLEVEL");
+	LOG(("OpenAL Logging Level: ").arg(loglevel ? loglevel : "(not set)"));
+
 	EnumeratePlaybackDevices();
 	EnumerateCaptureDevices();
 
diff --git a/Telegram/build/version b/Telegram/build/version
index 386a3fbdc..47c451a74 100644
--- a/Telegram/build/version
+++ b/Telegram/build/version
@@ -1,6 +1,6 @@
-AppVersion         1000002
+AppVersion         1000003
 AppVersionStrMajor 1.0
-AppVersionStrSmall 1.0.2
-AppVersionStr      1.0.2
-AlphaChannel       0
-BetaVersion        1000002001
+AppVersionStrSmall 1.0.3
+AppVersionStr      1.0.3
+AlphaChannel       1
+BetaVersion        0