diff --git a/MSVC.md b/MSVC.md
new file mode 100644
index 000000000..eb0104b24
--- /dev/null
+++ b/MSVC.md
@@ -0,0 +1,113 @@
+##Build instructions for Visual Studio 2013
+
+###Prepare folder
+
+Choose a folder for the future build, for example **D:\TBuild\**. There you will have two folders, **Libraries** for third-party libs and **tdesktop** (or **tdesktop-master**) for the app.
+
+###Clone source code
+
+By git – in [Git Bash](http://git-scm.com/downloads) go to **/d/tbuild** and run
+
+     git clone https://github.com/telegramdesktop/tdesktop.git
+
+or download in ZIP and extract to **D:\TBuild\**, rename **tdesktop-master** to **tdesktop** to have **D:\TBuild\tdesktop\Telegram.sln** solution
+
+###Prepare libraries
+
+####OpenSSL 1.0.1g
+
+https://www.openssl.org/related/binaries.html > **OpenSSL for Windows** > Download [**Win32 OpenSSL v1.0.1g** (16 Mb)](http://slproweb.com/download/Win32OpenSSL-1_0_1g.exe)
+
+Install to **D:\TBuild\Libraries\OpenSSL-Win32**, while installing **Copy OpenSSL DLLs to** choose **The OpenSSL binaries (/bin) directory**
+
+####LZMA SDK 9.20
+
+http://www.7-zip.org/sdk.html > Download [**LZMA SDK (C, C++, C#, Java)** 9.20](http://downloads.sourceforge.net/sevenzip/lzma920.tar.bz2)
+
+Extract to **D:\TBuild\Libraries**
+
+#####Building library
+
+* Open in VS2013 **D:\TBuild\Libraries\lzma\C\Util\LzmaLib\LzmaLib.dsw** > One-way upgrade – **OK**
+* For **Debug** and **Release** configurations
+  * LzmaLib Properties > General > Configuration Type = **Static library (.lib)** – **OK**
+  * LzmaLib Properties > Librarian > General > Target Machine = **MachineX86 (/MACHINE:X86)** – **OK**
+* Build Debug configuration
+* Build Release configuration
+
+####zlib 1.2.8
+
+http://www.zlib.net/ > Download [**zlib source code, version 1.2.8, zipfile format**](http://zlib.net/zlib128.zip)
+
+Extract to **D:\TBuild\Libraries\**
+
+#####Building library
+
+* Open in VS2013 **D:\TBuild\Libraries\zlib-1.2.8\contrib\vstudio\vc11\zlibvc.sln** > One-way upgrade – **OK**
+* We are interested only in **zlibstat** project, but it depends on some custom pre-build step, so build all
+* For **Debug** configuration
+  * zlibstat Properties > C/C++ > Code Generation > Runtime Library = **Multi-threaded Debug (/MTd)** – **OK**
+* For **Release** configuration
+  * zlibstat Properties > C/C++ > Code Generation > Runtime Library = **Multi-threaded (/MT)** – **OK**
+* Build Solution for Debug configuration – only **zlibstat** project builds successfully
+* Build Solution for Release configuration – only **zlibstat** project builds successfully
+
+####libexif 0.6.20
+
+Get sources from https://github.com/telegramdesktop/libexif-0.6.20, by git – in [Git Bash](http://git-scm.com/downloads) go to **/d/tbuild/libraries** and run
+
+    git clone https://github.com/telegramdesktop/libexif-0.6.20.git
+
+or download in ZIP and extract to **D:\TBuild\Libraries\**, rename **libexif-0.6.20-master** to **libexif-0.6.20** to have **D:\TBuild\Libraries\libexif-0.6.20\win32\lib_exif.sln** solution
+
+#####Building library
+
+* Open in VS2013 **D:\TBuild\Libraries\libexif-0.6.20\win32\lib_exif.sln**
+* Build Debug configuration
+* Build Release configuration
+
+####Qt 5.3.0, slightly patched
+
+http://download.qt-project.org/official_releases/qt/5.3/5.3.0/single/qt-everywhere-opensource-src-5.3.0.zip
+
+Extract to **D:\TBuild\Libraries\**, rename **qt-everywhere-opensource-src-5.3.0** to **QtStatic** to have **D:\TBuild\Libraries\QtStatic\qtbase\** folder
+
+Apply patch – copy (with overwrite!) everything from **D:\TBuild\tdesktop\\\_qt\_5\_3\_0\_patch\** to **D:\TBuild\Libraries\QtStatic\**
+
+#####Building library
+
+* Install Python 3.3.2 from https://www.python.org/download/releases/3.3.2 > [**Windows x86 MSI Installer (3.3.2)**](https://www.python.org/ftp/python/3.3.2/python-3.3.2.msi)
+* Open **VS2013 x86 Native Tools Command Prompt.bat** (should be in **\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\Shortcuts\** folder)
+
+There go to Qt directory
+
+    D:
+    cd TBuild\Libraries\QtStatic
+
+and after that run configure
+
+    configure -debug-and-release -opensource -static -opengl desktop -mp -nomake examples -platform win32-msvc2013
+    y
+
+to configure Qt build. After configuration is complete run
+
+    nmake
+    nmake install
+
+building (**nmake** command) will take really long time.
+
+####Qt Visual Studio Addin 1.2.3
+
+http://download.qt-project.org/official_releases/vsaddin/qt-vs-addin-1.2.3-opensource.exe
+
+Close all VS2013 instances and install to default location
+
+###Building Telegram Desktop
+
+* Launch VS2013 for configuring Qt Addin
+* QT5 > Qt Options > Add
+  * Version name: **QtStatic.5.3.0**
+  * Path: **D:\TBuild\Libraries\QtStatic\qtbase**
+* Default Qt/Win version: **QtStatic.5.3.0** – **OK**
+* File > Open > Project/Solution > **D:\TBuild\tdesktop\Telegram.sln**
+* Build \ Build Solution (Debug and Release configurations)
diff --git a/README.md b/README.md
index 548046310..b1422e9e0 100644
--- a/README.md
+++ b/README.md
@@ -6,13 +6,15 @@ Source code is published under GPL v3, license is available [here](https://githu
 
 ###Supported systems
 
-Only Windows systems are supported at this moment, OS X and Linux builds are on their way.
+Only Windows and OS X systems are supported at this moment, Linux builds are on their way.
 
 * Windows XP
 * Windows Vista
 * Windows 7
 * Windows 8 (**not** RT)
 * Windows 8.1 (**not** RT)
+* OS X 10.9
+* OS X 10.7-10.8 (not tested)
 
 ###Third-party
 
@@ -21,121 +23,12 @@ Only Windows systems are supported at this moment, OS X and Linux builds are on
 * zlib 1.2.8 ([zlib License](http://www.zlib.net/zlib_license.html))
 * libexif 0.6.20 ([LGPL](https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html))
 * LZMA SDK 9.20 ([public domain](http://www.7-zip.org/sdk.html))
+* liblzma ([public domain](http://tukaani.org/xz/))
 * Open Sans font ([Apache License](http://www.apache.org/licenses/LICENSE-2.0.html))
 
-##Build instructions for Visual Studio 2013
+###[Build instructions for Visual Studio 2013](https://github.com/telegramdesktop/tdesktop/blob/master/MSVC.md)
 
-###Prepare folder
-
-Choose a folder for the future build, for example **D:\TBuild\**. There you will have two folders, **Libraries** for third-party libs and **tdesktop** (or **tdesktop-master**) for the app.
-
-###Clone source code
-
-By git – in [Git Bash](http://git-scm.com/downloads) go to **/d/tbuild** and run
-
-     git clone https://github.com/telegramdesktop/tdesktop.git
-
-or download in ZIP and extract to **D:\TBuild\**, rename **tdesktop-master** to **tdesktop** to have **D:\TBuild\tdesktop\Telegram.sln** solution
-
-###Prepare libraries
-
-####OpenSSL 1.0.1g
-
-https://www.openssl.org/related/binaries.html > **OpenSSL for Windows** > Download [**Win32 OpenSSL v1.0.1g** (16 Mb)](http://slproweb.com/download/Win32OpenSSL-1_0_1g.exe)
-
-Install to **D:\TBuild\Libraries\OpenSSL-Win32**, while installing **Copy OpenSSL DLLs to** choose **The OpenSSL binaries (/bin) directory**
-
-####LZMA SDK 9.20
-
-http://www.7-zip.org/sdk.html > Download [**LZMA SDK (C, C++, C#, Java)** 9.20](http://downloads.sourceforge.net/sevenzip/lzma920.tar.bz2)
-
-Extract to **D:\TBuild\Libraries**
-
-#####Building library
-
-* Open in VS2013 **D:\TBuild\Libraries\lzma\C\Util\LzmaLib\LzmaLib.dsw** > One-way upgrade – **OK**
-* For **Debug** and **Release** configurations
-  * LzmaLib Properties > General > Configuration Type = **Static library (.lib)** – **OK**
-  * LzmaLib Properties > Librarian > General > Target Machine = **MachineX86 (/MACHINE:X86)** – **OK**
-* Build Debug configuration
-* Build Release configuration
-
-####zlib 1.2.8
-
-http://www.zlib.net/ > Download [**zlib source code, version 1.2.8, zipfile format**](http://zlib.net/zlib128.zip)
-
-Extract to **D:\TBuild\Libraries\**
-
-#####Building library
-
-* Open in VS2013 **D:\TBuild\Libraries\zlib-1.2.8\contrib\vstudio\vc11\zlibvc.sln** > One-way upgrade – **OK**
-* We are interested only in **zlibstat** project, but it depends on some custom pre-build step, so build all
-* For **Debug** configuration
-  * zlibstat Properties > C/C++ > Code Generation > Runtime Library = **Multi-threaded Debug (/MTd)** – **OK**
-* For **Release** configuration
-  * zlibstat Properties > C/C++ > Code Generation > Runtime Library = **Multi-threaded (/MT)** – **OK**
-* Build Solution for Debug configuration – only **zlibstat** project builds successfully
-* Build Solution for Release configuration – only **zlibstat** project builds successfully
-
-####libexif 0.6.20
-
-Get sources from https://github.com/telegramdesktop/libexif-0.6.20, by git – in [Git Bash](http://git-scm.com/downloads) go to **/d/tbuild/libraries** and run
-
-    git clone https://github.com/telegramdesktop/libexif-0.6.20.git
-
-or download in ZIP and extract to **D:\TBuild\Libraries\**, rename **libexif-0.6.20-master** to **libexif-0.6.20** to have **D:\TBuild\Libraries\libexif-0.6.20\win32\lib_exif.sln** solution
-
-#####Building library
-
-* Open in VS2013 **D:\TBuild\Libraries\libexif-0.6.20\win32\lib_exif.sln**
-* Build Debug configuration
-* Build Release configuration
-
-####Qt 5.3.0, slightly patched
-
-http://download.qt-project.org/official_releases/qt/5.3/5.3.0/single/qt-everywhere-opensource-src-5.3.0.zip
-
-Extract to **D:\TBuild\Libraries\**, rename **qt-everywhere-opensource-src-5.3.0** to **QtStatic** to have **D:\TBuild\Libraries\QtStatic\qtbase\** folder
-
-Apply patch – copy (with overwrite!) everything from **D:\TBuild\tdesktop\\\_qt\_5\_3\_0\_patch\** to **D:\TBuild\Libraries\QtStatic\**
-
-#####Building library
-
-* Install Python 3.3.2 from https://www.python.org/download/releases/3.3.2 > [**Windows x86 MSI Installer (3.3.2)**](https://www.python.org/ftp/python/3.3.2/python-3.3.2.msi)
-* Open **VS2013 x86 Native Tools Command Prompt.bat** (should be in **\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\Shortcuts\** folder)
-
-There go to Qt directory
-
-    D:
-    cd TBuild\Libraries\QtStatic
-
-and after that run configure
-
-    configure -debug-and-release -opensource -static -opengl desktop -mp -nomake examples -platform win32-msvc2013
-    y
-
-to configure Qt build. After configuration is complete run
-
-    nmake
-    nmake install
-
-building (**nmake** command) will take really long time.
-
-####Qt Visual Studio Addin 1.2.3
-
-http://download.qt-project.org/official_releases/vsaddin/qt-vs-addin-1.2.3-opensource.exe
-
-Close all VS2013 instances and install to default location
-
-###Building Telegram Desktop
-
-* Launch VS2013 for configuring Qt Addin
-* QT5 > Qt Options > Add
-  * Version name: **QtStatic.5.3.0**
-  * Path: **D:\TBuild\Libraries\QtStatic\qtbase**
-* Default Qt/Win version: **QtStatic.5.3.0** – **OK**
-* File > Open > Project/Solution > **D:\TBuild\tdesktop\Telegram.sln**
-* Build \ Build Solution (Debug and Release configurations)
+###[Build instructions for XCode 5.1.1](https://github.com/telegramdesktop/tdesktop/blob/master/XCODE.md)
 
 ##Projects in Telegram solution
 
@@ -153,12 +46,17 @@ compiles given files to single update file, compresses it with lzma and signs wi
 
 ####Prepare
 
-prepares a release for deployment, puts all files to deploy/{version} folder
+prepares a release for deployment, puts all files to deploy/{version} folder, for Win:
 * current tsetup{version}exe installer
 * current Telegram.exe
 * current Telegram.pdb (debug info for crash minidumps view)
 * current tupdate{updversion} binary lzma update archive
 
+for Mac:
+* current tsetup{version}dmg
+* current Telegram.app
+* current tmacupd{updversion} binary lzma update archive
+
 ####MetaEmoji
 
 from two folders
diff --git a/Telegram/Emoji.plist b/Telegram/Emoji.plist
new file mode 100644
index 000000000..622dd607d
--- /dev/null
+++ b/Telegram/Emoji.plist
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>CFBundleExecutable</key>
+	<string>MetaEmoji</string>
+	<key>CFBundleGetInfoString</key>
+	<string>MetaEmoji compiler</string>
+	<key>CFBundleIdentifier</key>
+	<string>com.tdesktop.${PRODUCT_NAME:rfc1034identifier}</string>
+	<key>CFBundlePackageType</key>
+	<string>APPL</string>
+	<key>CFBundleSignature</key>
+	<string>????</string>
+	<key>NOTE</key>
+	<string></string>
+	<key>NSPrincipalClass</key>
+	<string>NSApplication</string>
+</dict>
+</plist>
diff --git a/Telegram/MetaEmoji.pro b/Telegram/MetaEmoji.pro
new file mode 100644
index 000000000..77927fb41
--- /dev/null
+++ b/Telegram/MetaEmoji.pro
@@ -0,0 +1,31 @@
+QT += core 
+
+CONFIG(debug, debug|release) {
+    DEFINES += _DEBUG
+    OBJECTS_DIR = ./../Mac/DebugIntermediateEmoji
+    MOC_DIR = ./GeneratedFiles/Debug
+    DESTDIR = ./../Mac/DebugEmoji
+}
+CONFIG(release, debug|release) {
+    OBJECTS_DIR = ./../Mac/ReleaseIntermediateEmoji
+    MOC_DIR = ./GeneratedFiles/Release
+    DESTDIR = ./../Mac/ReleaseEmoji
+}
+
+macx {
+    QMAKE_INFO_PLIST = ./SourceFiles/_other/Emoji.plist
+    QMAKE_LFLAGS += -framework Cocoa
+}
+
+SOURCES += \
+    ./SourceFiles/_other/memain.cpp \
+    ./SourceFiles/_other/genemoji.cpp \
+
+HEADERS += \
+    ./SourceFiles/_other/memain.h \
+    ./SourceFiles/_other/genemoji.h \
+
+INCLUDEPATH += ./../../Libraries/QtStatic/qtbase/include/QtGui/5.3.0/QtGui\
+               ./../../Libraries/QtStatic/qtbase/include/QtCore/5.3.0/QtCore\
+               ./../../Libraries/QtStatic/qtbase/include\
+
diff --git a/Telegram/MetaEmoji.xcodeproj/project.pbxproj b/Telegram/MetaEmoji.xcodeproj/project.pbxproj
new file mode 100644
index 000000000..fb5bf86ab
--- /dev/null
+++ b/Telegram/MetaEmoji.xcodeproj/project.pbxproj
@@ -0,0 +1,801 @@
+// !$*UTF8*$!
+{
+	archiveVersion = 1;
+	classes = {
+	};
+	objectVersion = 46;
+	objects = {
+
+/* Begin PBXAggregateTarget section */
+		D93715D85BD26B270C3CC80B /* Preprocess */ = {
+			isa = PBXAggregateTarget;
+			buildConfigurationList = 6CC3B5D2136C7CD6A5CF5A59 /* Build configuration list for PBXNativeTarget "MetaEmoji" */;
+			buildPhases = (
+				7EF0942E79C014DCEC8976BC /* Qt Preprocessors */,
+			);
+			dependencies = (
+			);
+			name = Preprocess;
+			productName = "Qt Preprocess";
+		};
+/* End PBXAggregateTarget section */
+
+/* Begin PBXBuildFile section */
+		1A681B886F50EE30FBE62B4B /* Qt5PrintSupport in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = DBF506D10449BFABD45B82DA /* Qt5PrintSupport */; };
+		1BB705CDB741E2B7450201A5 /* Cocoa.framework in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = AEA456A2F75ED9F5CDA7BCBE /* Cocoa.framework */; };
+		328FD74542F6E2C873EE4D4B /* ApplicationServices.framework in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = DFD7912080BC557230093752 /* ApplicationServices.framework */; };
+		496FD9CEEB508016AFB9F928 /* qico in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = 8F500B5166907B6D9A7C3E3D /* qico */; };
+		4B166C0FE4A3C31F5E3D05CE /* metaemoji_plugin_import.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = A9341A7B02F69BC5802268AA /* metaemoji_plugin_import.cpp */; settings = {ATTRIBUTES = (); }; };
+		59789101736112A570B8EFE6 /* qjp2 in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = F0681BC551FC8A2B132FC646 /* qjp2 */; };
+		668DDDA0C55405E7FCFD6CA5 /* CoreServices.framework in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = 9742F24EE18EA44D52824F1E /* CoreServices.framework */; };
+		7CA5405B8503BFFC60932D2B /* qicns in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = 31120EDB269DFF13E1D49847 /* qicns */; };
+		7F76437B577F737145996DC3 /* qtga in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = DCEFD9167C239650120B0145 /* qtga */; };
+		83425F7776C9E52C29BE0E6F /* memain.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 3AC2626B26B65AA88F06BFB5 /* memain.cpp */; settings = {ATTRIBUTES = (); }; };
+		8771A8C96E9C391044035D99 /* OpenGL.framework in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = D4B32C2222F82AC56BADEB21 /* OpenGL.framework */; };
+		8D267F2E4776F0ECA2F49DC8 /* IOKit.framework in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = A1A67BEAA744704B29168D39 /* IOKit.framework */; };
+		8D33FE22B9BBADC7FA46C15B /* qtharfbuzzng in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = D6193B79CECC9DD0142D1200 /* qtharfbuzzng */; };
+		9F33AC0693BC81B27D8F518D /* Qt5Gui in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = 04391BE7A8B9D811E255100A /* Qt5Gui */; };
+		A3F8F2284013928A02AE5C38 /* qwbmp in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = 8CF51323544B886B8F4A2232 /* qwbmp */; };
+		A9563D9C9FD0D76FAAF1CA96 /* qdds in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = D3D1BE0BEA3AEE0551AD39AC /* qdds */; };
+		B9ADD90C014EA3FBE351DF03 /* Qt5Core in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = 5A80A1907B6CFFB524C1E57D /* Qt5Core */; };
+		BE6AB9DF1C4880624131C669 /* Qt5Widgets in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = 4689C06178B60B84E7F3A3B7 /* Qt5Widgets */; };
+		C06DDE378A7AC1FA9E6FF69A /* qtiff in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = F2453BA07315EB9F34F1CD57 /* qtiff */; };
+		C4F1177BDAACCF1E50ACCED9 /* moc_genemoji.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 93E4BE1A02365B73BAF00B73 /* moc_genemoji.cpp */; settings = {ATTRIBUTES = (); }; };
+		C5357D951917482510CE3E54 /* genemoji.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 1F47C130E1F45B4A5A91DB5E /* genemoji.cpp */; settings = {ATTRIBUTES = (); }; };
+		D1FA8AF31837B51C762A9D4D /* qcocoa in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = D53D8E6A188E05078A114294 /* qcocoa */; };
+		D22929A2B8C5281567FCACDC /* Qt5PlatformSupport in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = E7B2F248E3F7970788F35BF5 /* Qt5PlatformSupport */; };
+		E45E51A644D5FC9F942ECE55 /* AGL.framework in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = 8D9815BDB5BD9F90D2BC05C5 /* AGL.framework */; };
+		F26454630C80841CBDCFE1CA /* Foundation.framework in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = FCC237CA5AD60B9BA4447615 /* Foundation.framework */; };
+		F4D3747C3A03B25EDC9057BB /* qwebp in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = ADC6308023253CEA51F86E21 /* qwebp */; };
+		F8B465CE34D8DF87AAE95913 /* CoreFoundation.framework in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = 4D765E1B1EA6C757220C63E7 /* CoreFoundation.framework */; };
+		F8ED42CF8679BF83227DAFC4 /* Carbon.framework in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = 9DFF62A901D70814B8A323D4 /* Carbon.framework */; };
+		FBD56E2AC34F76BFFDB68619 /* qmng in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = 83D37373949868693FB7816D /* qmng */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+		0708466E1954218200B5AE3A /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 6DB9C3763D02B1415CD9D565 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = D93715D85BD26B270C3CC80B;
+			remoteInfo = "Qt Preprocess";
+		};
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXFileReference section */
+		04391BE7A8B9D811E255100A /* Qt5Gui */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = Qt5Gui; path = "/usr/local/Qt-5.3.0/lib/libQt5Gui$(QT_LIBRARY_SUFFIX).a"; sourceTree = "<absolute>"; };
+		060A694B42A4555240009936 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtga.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtga.pri"; sourceTree = "<absolute>"; };
+		075EB50EB07CF69FD62FB8DF /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_sql_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_sql_private.pri"; sourceTree = "<absolute>"; };
+		0ABCEA8D0DD45589040B0AF2 /* /usr/local/Qt-5.3.0/mkspecs/common/unix.conf */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/common/unix.conf"; sourceTree = "<absolute>"; };
+		111BBEE3D1432C3B517FD539 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qdds.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qdds.pri"; sourceTree = "<absolute>"; };
+		16DD53E17C65AC8B450CC6C3 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_quick.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_quick.pri"; sourceTree = "<absolute>"; };
+		1F47C130E1F45B4A5A91DB5E /* genemoji.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = genemoji.cpp; path = SourceFiles/_other/genemoji.cpp; sourceTree = "<absolute>"; };
+		1FAE75C970AA73F2DEDDB508 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qavfcamera.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qavfcamera.pri"; sourceTree = "<absolute>"; };
+		23BC8B0FC3279421D41CA268 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_gui.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_gui.pri"; sourceTree = "<absolute>"; };
+		2440CD1D4CEF80443BCA1B8B /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qgenericbearer.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qgenericbearer.pri"; sourceTree = "<absolute>"; };
+		247D8DF3B1DDB665B80BBA25 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtaccessiblequick.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtaccessiblequick.pri"; sourceTree = "<absolute>"; };
+		24B6929EE3952310F2DAECB1 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtaudio_coreaudio.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtaudio_coreaudio.pri"; sourceTree = "<absolute>"; };
+		28BD0D10214709D95B161E24 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_multimediawidgets.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_multimediawidgets.pri"; sourceTree = "<absolute>"; };
+		293C8DEEE270847AC20E70F9 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_network.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_network.pri"; sourceTree = "<absolute>"; };
+		2E48BB382B895A5ACD79AF9F /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_bluetooth_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_bluetooth_private.pri"; sourceTree = "<absolute>"; };
+		2E6D9B1D2743D24E31B0B284 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_xmlpatterns.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_xmlpatterns.pri"; sourceTree = "<absolute>"; };
+		311004331A04F3D69C98643C /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_serialport_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_serialport_private.pri"; sourceTree = "<absolute>"; };
+		31120EDB269DFF13E1D49847 /* qicns */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = qicns; path = "/usr/local/Qt-5.3.0/plugins/imageformats/libqicns$(QT_LIBRARY_SUFFIX).a"; sourceTree = "<absolute>"; };
+		33F165B1DB8CBF182C56FAB5 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_macextras_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_macextras_private.pri"; sourceTree = "<absolute>"; };
+		346287C9E754E7C458153F03 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qwbmp.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qwbmp.pri"; sourceTree = "<absolute>"; };
+		360D4B3ED25D126430DE27D4 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_enginio.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_enginio.pri"; sourceTree = "<absolute>"; };
+		3685604BDB64DD6E92169B73 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qdeclarativeview.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qdeclarativeview.pri"; sourceTree = "<absolute>"; };
+		382E89A91A34F7898C25FD0D /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_network_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_network_private.pri"; sourceTree = "<absolute>"; };
+		3AC2626B26B65AA88F06BFB5 /* memain.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = memain.cpp; path = SourceFiles/_other/memain.cpp; sourceTree = "<absolute>"; };
+		3F08D430CEC8D2117735CCB4 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qmldbg_tcp_qtdeclarative.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qmldbg_tcp_qtdeclarative.pri"; sourceTree = "<absolute>"; };
+		45B95DB3B70B47A910FC847B /* /usr/local/Qt-5.3.0/mkspecs/common/gcc-base.conf */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/common/gcc-base.conf"; sourceTree = "<absolute>"; };
+		45DB132B756499D4DF38430E /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qjp2.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qjp2.pri"; sourceTree = "<absolute>"; };
+		4689C06178B60B84E7F3A3B7 /* Qt5Widgets */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = Qt5Widgets; path = "/usr/local/Qt-5.3.0/lib/libQt5Widgets$(QT_LIBRARY_SUFFIX).a"; sourceTree = "<absolute>"; };
+		4C6C71914B1926119120DACD /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_enginio_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_enginio_private.pri"; sourceTree = "<absolute>"; };
+		4D765E1B1EA6C757220C63E7 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = "<absolute>"; };
+		4FB6657DA22BC68B819B64B3 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_qmldevtools_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_qmldevtools_private.pri"; sourceTree = "<absolute>"; };
+		5597304BEC94BFB9EAAEBC4B /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_openglextensions_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_openglextensions_private.pri"; sourceTree = "<absolute>"; };
+		58308B26DE991A86E8589883 /* genemoji.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = genemoji.h; path = SourceFiles/_other/genemoji.h; sourceTree = "<absolute>"; };
+		5A80A1907B6CFFB524C1E57D /* Qt5Core */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = Qt5Core; path = "/usr/local/Qt-5.3.0/lib/libQt5Core$(QT_LIBRARY_SUFFIX).a"; sourceTree = "<absolute>"; };
+		5B22E9E4EE9AAE42ABC24AB3 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_qtmultimediaquicktools_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_qtmultimediaquicktools_private.pri"; sourceTree = "<absolute>"; };
+		5CEA7A2DB2136425A88D1254 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_opengl.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_opengl.pri"; sourceTree = "<absolute>"; };
+		5F781C7FD8422D359EA1D2FE /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_core_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_core_private.pri"; sourceTree = "<absolute>"; };
+		6102C69805B6398AF6FA5BEB /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_qml_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_qml_private.pri"; sourceTree = "<absolute>"; };
+		63E722139886C87BC82DBDF5 /* /usr/local/Qt-5.3.0/mkspecs/macx-clang/qmake.conf */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/macx-clang/qmake.conf"; sourceTree = "<absolute>"; };
+		669FB007C4A3D58424D85EC8 /* /usr/local/Qt-5.3.0/mkspecs/common/shell-unix.conf */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/common/shell-unix.conf"; sourceTree = "<absolute>"; };
+		69347C39E4D922E94D0860BF /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_designercomponents_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_designercomponents_private.pri"; sourceTree = "<absolute>"; };
+		6C08BFC27C4C303A3A5181DB /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_printsupport.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_printsupport.pri"; sourceTree = "<absolute>"; };
+		6E67D23B15FC4B628DB2E0B2 /* /usr/local/Qt-5.3.0/mkspecs/qdevice.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/qdevice.pri"; sourceTree = "<absolute>"; };
+		74C1C232DFAA71028A0412CA /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtmultimedia_m3u.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtmultimedia_m3u.pri"; sourceTree = "<absolute>"; };
+		77FF486B1F9BCD55A8A3F35D /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_concurrent.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_concurrent.pri"; sourceTree = "<absolute>"; };
+		7A94C7168B3FCBE5F04A013B /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_declarative.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_declarative.pri"; sourceTree = "<absolute>"; };
+		7C2F42B222EE88E26A6FED62 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_designer_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_designer_private.pri"; sourceTree = "<absolute>"; };
+		7D28E9003CE64D8A7F2E292E /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_concurrent_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_concurrent_private.pri"; sourceTree = "<absolute>"; };
+		7DE30A90667C03C4F91A2A91 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_sql.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_sql.pri"; sourceTree = "<absolute>"; };
+		7ECCC1F9442988B4F2707CC1 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_core.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_core.pri"; sourceTree = "<absolute>"; };
+		817A0F5A41B553A6DE67FDEB /* /usr/local/Qt-5.3.0/mkspecs/common/macx.conf */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/common/macx.conf"; sourceTree = "<absolute>"; };
+		82E7DCFD95559532D8FC6CDD /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_quickparticles_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_quickparticles_private.pri"; sourceTree = "<absolute>"; };
+		83D37373949868693FB7816D /* qmng */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = qmng; path = "/usr/local/Qt-5.3.0/plugins/imageformats/libqmng$(QT_LIBRARY_SUFFIX).a"; sourceTree = "<absolute>"; };
+		85061B1DA49D125991117950 /* /usr/local/Qt-5.3.0/mkspecs/macx-xcode/qmake.conf */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/macx-xcode/qmake.conf"; sourceTree = "<absolute>"; };
+		85B6936EDBE61D9BB8F8B33B /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_sensors.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_sensors.pri"; sourceTree = "<absolute>"; };
+		87A4C1983FD641360BF80A02 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtaccessiblewidgets.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtaccessiblewidgets.pri"; sourceTree = "<absolute>"; };
+		87EEF25EE25CF21572D1438C /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_websockets_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_websockets_private.pri"; sourceTree = "<absolute>"; };
+		8849E60AEC7DB97A475C17EA /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_testlib_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_testlib_private.pri"; sourceTree = "<absolute>"; };
+		892D36BEF797BA4AF48D378A /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtsensors_dummy.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtsensors_dummy.pri"; sourceTree = "<absolute>"; };
+		89863CCAF1D29037AE95755D /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_declarative_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_declarative_private.pri"; sourceTree = "<absolute>"; };
+		8A04A4A3625204D12A1207F6 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_nfc.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_nfc.pri"; sourceTree = "<absolute>"; };
+		8B4BB4E74F8A4442EF563D7D /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtsensorgestures_shakeplugin.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtsensorgestures_shakeplugin.pri"; sourceTree = "<absolute>"; };
+		8C31D89BDFCDF466DAED19A0 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_quick_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_quick_private.pri"; sourceTree = "<absolute>"; };
+		8C5164D4E37556D40C5E6AA2 /* /usr/local/Qt-5.3.0/mkspecs/common/clang.conf */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/common/clang.conf"; sourceTree = "<absolute>"; };
+		8CF51323544B886B8F4A2232 /* qwbmp */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = qwbmp; path = "/usr/local/Qt-5.3.0/plugins/imageformats/libqwbmp$(QT_LIBRARY_SUFFIX).a"; sourceTree = "<absolute>"; };
+		8D9815BDB5BD9F90D2BC05C5 /* AGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AGL.framework; path = /System/Library/Frameworks/AGL.framework; sourceTree = "<absolute>"; };
+		8DDE1D26B3206CDB8B57FABE /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_svg_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_svg_private.pri"; sourceTree = "<absolute>"; };
+		8E9136256AFFBA6EF048AA55 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_widgets_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_widgets_private.pri"; sourceTree = "<absolute>"; };
+		8F500B5166907B6D9A7C3E3D /* qico */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = qico; path = "/usr/local/Qt-5.3.0/plugins/imageformats/libqico$(QT_LIBRARY_SUFFIX).a"; sourceTree = "<absolute>"; };
+		8F572030CE9AB8CC5F672201 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_platformsupport_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_platformsupport_private.pri"; sourceTree = "<absolute>"; };
+		8F97C9CAE38CA3AFAC0B3953 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_websockets.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_websockets.pri"; sourceTree = "<absolute>"; };
+		93E4BE1A02365B73BAF00B73 /* moc_genemoji.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_genemoji.cpp; path = GeneratedFiles/Debug/moc_genemoji.cpp; sourceTree = "<absolute>"; };
+		946BEA667170DC1A7A8F9DB0 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qmng.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qmng.pri"; sourceTree = "<absolute>"; };
+		9742F24EE18EA44D52824F1E /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = /System/Library/Frameworks/CoreServices.framework; sourceTree = "<absolute>"; };
+		9A0BDF67E013BB4FFB8685B0 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qqt7engine.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qqt7engine.pri"; sourceTree = "<absolute>"; };
+		9DFF62A901D70814B8A323D4 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; };
+		A022AF919D1977534CA66BB8 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_widgets.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_widgets.pri"; sourceTree = "<absolute>"; };
+		A1A67BEAA744704B29168D39 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; sourceTree = "<absolute>"; };
+		A4D8AC60897F435C1C3B9D02 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtsensors_generic.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtsensors_generic.pri"; sourceTree = "<absolute>"; };
+		A59F74CD76FDC2B4B9910E18 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_scripttools_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_scripttools_private.pri"; sourceTree = "<absolute>"; };
+		A5B17ABEFBA1C2F43443D644 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_macextras.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_macextras.pri"; sourceTree = "<absolute>"; };
+		A9341A7B02F69BC5802268AA /* metaemoji_plugin_import.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = metaemoji_plugin_import.cpp; sourceTree = "<absolute>"; };
+		A9E30FA27827990C5F182223 /* /usr/local/Qt-5.3.0/mkspecs/common/gcc-base-mac.conf */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/common/gcc-base-mac.conf"; sourceTree = "<absolute>"; };
+		AA73DC3C2901E2979FE8AD5B /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_xml.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_xml.pri"; sourceTree = "<absolute>"; };
+		AB1C02DDBD8E88DD9A9AFDDD /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtsensorgestures_plugin.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtsensorgestures_plugin.pri"; sourceTree = "<absolute>"; };
+		AB745978DF0F41D1801ABDA6 /* .qmake.stash */ = {isa = PBXFileReference; lastKnownFileType = file; path = .qmake.stash; sourceTree = "<absolute>"; };
+		ABA9AB4619F09DCFD2D4A27F /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_qmltest_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_qmltest_private.pri"; sourceTree = "<absolute>"; };
+		ACC8A73268E5D9AF64E97AF4 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_bluetooth.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_bluetooth.pri"; sourceTree = "<absolute>"; };
+		ADC6308023253CEA51F86E21 /* qwebp */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = qwebp; path = "/usr/local/Qt-5.3.0/plugins/imageformats/libqwebp$(QT_LIBRARY_SUFFIX).a"; sourceTree = "<absolute>"; };
+		ADFC79902C14A612AE93A89A /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_svg.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_svg.pri"; sourceTree = "<absolute>"; };
+		AEA456A2F75ED9F5CDA7BCBE /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
+		AFD721AA33A2F785E77B1698 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qcocoa.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qcocoa.pri"; sourceTree = "<absolute>"; };
+		B064BF3B496A7BF7A449CA1E /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qsqlite.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qsqlite.pri"; sourceTree = "<absolute>"; };
+		B2246267D4C0D789259A86B0 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_quickwidgets_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_quickwidgets_private.pri"; sourceTree = "<absolute>"; };
+		B26239063A068F800A2C95F4 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qwebp.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qwebp.pri"; sourceTree = "<absolute>"; };
+		B382B645B34234E451AE5D94 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_qml.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_qml.pri"; sourceTree = "<absolute>"; };
+		B518DA4EE7376002AFC71FD5 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_uitools_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_uitools_private.pri"; sourceTree = "<absolute>"; };
+		B51B01657BFE9EAEF5590561 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_nfc_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_nfc_private.pri"; sourceTree = "<absolute>"; };
+		B678DA730B4ECE863AD631AE /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qminimal.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qminimal.pri"; sourceTree = "<absolute>"; };
+		B8525798C5AA7D7C6D68E1B3 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qmldbg_qtquick2.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qmldbg_qtquick2.pri"; sourceTree = "<absolute>"; };
+		B8C1F6C965A7A14FBA8D4518 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtmedia_audioengine.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtmedia_audioengine.pri"; sourceTree = "<absolute>"; };
+		BD22EFEFCC02644B1883CE19 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtiff.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtiff.pri"; sourceTree = "<absolute>"; };
+		BD4D97801B547471B37A4CDC /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_bootstrap_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_bootstrap_private.pri"; sourceTree = "<absolute>"; };
+		BDC9ECADEE40D11E3C2EA93F /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_sensors_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_sensors_private.pri"; sourceTree = "<absolute>"; };
+		BFF0C38FB0EC140C5F0304AE /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_serialport.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_serialport.pri"; sourceTree = "<absolute>"; };
+		C3345709A0BD182590087379 /* MetaEmoji.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MetaEmoji.app; sourceTree = BUILT_PRODUCTS_DIR; };
+		C4295BE59CCEBCDD16268349 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qico.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qico.pri"; sourceTree = "<absolute>"; };
+		C505A18319B9B63C63877858 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_script_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_script_private.pri"; sourceTree = "<absolute>"; };
+		C84546C18DCBB04166195DCF /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtposition_positionpoll.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtposition_positionpoll.pri"; sourceTree = "<absolute>"; };
+		CCF75CFFB857487FB18F99F9 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qoffscreen.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qoffscreen.pri"; sourceTree = "<absolute>"; };
+		CE829DD126DD2B97E8D70A7A /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_scripttools.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_scripttools.pri"; sourceTree = "<absolute>"; };
+		CF86CD5BB01B9011E6B6FD3E /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_clucene_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_clucene_private.pri"; sourceTree = "<absolute>"; };
+		CFCB992BEC24B71BFB8A2F30 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_script.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_script.pri"; sourceTree = "<absolute>"; };
+		CFFBE05DB004895080314289 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qsvgicon.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qsvgicon.pri"; sourceTree = "<absolute>"; };
+		D0CDC87DAFDA7F18A7AF450F /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_printsupport_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_printsupport_private.pri"; sourceTree = "<absolute>"; };
+		D1FA7CAB5ACC09D563AE569F /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_multimediawidgets_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_multimediawidgets_private.pri"; sourceTree = "<absolute>"; };
+		D2FE4D909926A0D1656068C4 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_multimedia.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_multimedia.pri"; sourceTree = "<absolute>"; };
+		D3D1BE0BEA3AEE0551AD39AC /* qdds */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = qdds; path = "/usr/local/Qt-5.3.0/plugins/imageformats/libqdds$(QT_LIBRARY_SUFFIX).a"; sourceTree = "<absolute>"; };
+		D4B32C2222F82AC56BADEB21 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = "<absolute>"; };
+		D4DE537C1FBBD48BD989FAD1 /* /usr/local/Qt-5.3.0/mkspecs/qconfig.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/qconfig.pri"; sourceTree = "<absolute>"; };
+		D5141F795670589C8CC41CBC /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_cocoaprintersupport.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_cocoaprintersupport.pri"; sourceTree = "<absolute>"; };
+		D53D8E6A188E05078A114294 /* qcocoa */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = qcocoa; path = "/usr/local/Qt-5.3.0/plugins/platforms/libqcocoa$(QT_LIBRARY_SUFFIX).a"; sourceTree = "<absolute>"; };
+		D6193B79CECC9DD0142D1200 /* qtharfbuzzng */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = qtharfbuzzng; path = "/usr/local/Qt-5.3.0/lib/libqtharfbuzzng$(QT_LIBRARY_SUFFIX).a"; sourceTree = "<absolute>"; };
+		D7A0618DE39A427EBF41940E /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_help_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_help_private.pri"; sourceTree = "<absolute>"; };
+		D81E3D9A18202BE8EC3D0E2C /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_gui_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_gui_private.pri"; sourceTree = "<absolute>"; };
+		D948D4D8F949D45158F8DE35 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_quickwidgets.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_quickwidgets.pri"; sourceTree = "<absolute>"; };
+		DB0A26DDC377B2004F61BFE3 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_testlib.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_testlib.pri"; sourceTree = "<absolute>"; };
+		DBF506D10449BFABD45B82DA /* Qt5PrintSupport */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = Qt5PrintSupport; path = "/usr/local/Qt-5.3.0/lib/libQt5PrintSupport$(QT_LIBRARY_SUFFIX).a"; sourceTree = "<absolute>"; };
+		DCEFD9167C239650120B0145 /* qtga */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = qtga; path = "/usr/local/Qt-5.3.0/plugins/imageformats/libqtga$(QT_LIBRARY_SUFFIX).a"; sourceTree = "<absolute>"; };
+		DF8188E30892A4654B984221 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_qmltest.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_qmltest.pri"; sourceTree = "<absolute>"; };
+		DFD7912080BC557230093752 /* ApplicationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = /System/Library/Frameworks/ApplicationServices.framework; sourceTree = "<absolute>"; };
+		E0F4563EA350EB65112A0EF4 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_opengl_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_opengl_private.pri"; sourceTree = "<absolute>"; };
+		E37365B4489B4918BEBB707D /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_xml_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_xml_private.pri"; sourceTree = "<absolute>"; };
+		E432DA897A5F027987342E8F /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_openglextensions.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_openglextensions.pri"; sourceTree = "<absolute>"; };
+		E50FA73B8A23BC179A642B27 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_uitools.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_uitools.pri"; sourceTree = "<absolute>"; };
+		E66B9EC81C285CA9A7FB6A2E /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_positioning_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_positioning_private.pri"; sourceTree = "<absolute>"; };
+		E7B2F248E3F7970788F35BF5 /* Qt5PlatformSupport */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = Qt5PlatformSupport; path = "/usr/local/Qt-5.3.0/lib/libQt5PlatformSupport$(QT_LIBRARY_SUFFIX).a"; sourceTree = "<absolute>"; };
+		E7D67CB158408BB7DEA74764 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_multimedia_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_multimedia_private.pri"; sourceTree = "<absolute>"; };
+		E981470FA003A8DCE3C52E59 /* memain.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = memain.h; path = SourceFiles/_other/memain.h; sourceTree = "<absolute>"; };
+		EA5D4FF9DE4AC4215D7DCE0D /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qcorewlanbearer.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qcorewlanbearer.pri"; sourceTree = "<absolute>"; };
+		EB1F99FD112917157F3C3F6E /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qicns.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qicns.pri"; sourceTree = "<absolute>"; };
+		EB29AC635054C09EFA749AE1 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qmldbg_tcp.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qmldbg_tcp.pri"; sourceTree = "<absolute>"; };
+		EBD39B69F368CEEAC360A16D /* /usr/local/Qt-5.3.0/mkspecs/common/mac.conf */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/common/mac.conf"; sourceTree = "<absolute>"; };
+		F0681BC551FC8A2B132FC646 /* qjp2 */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = qjp2; path = "/usr/local/Qt-5.3.0/plugins/imageformats/libqjp2$(QT_LIBRARY_SUFFIX).a"; sourceTree = "<absolute>"; };
+		F0A58515945747E36783CC21 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qmldbg_inspector.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qmldbg_inspector.pri"; sourceTree = "<absolute>"; };
+		F13124A218B58585B027D96A /* MetaEmoji.pro */ = {isa = PBXFileReference; lastKnownFileType = text; path = MetaEmoji.pro; sourceTree = "<absolute>"; };
+		F2453BA07315EB9F34F1CD57 /* qtiff */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = qtiff; path = "/usr/local/Qt-5.3.0/plugins/imageformats/libqtiff$(QT_LIBRARY_SUFFIX).a"; sourceTree = "<absolute>"; };
+		F2F823087EA182CCBD5748B8 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_designer.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_designer.pri"; sourceTree = "<absolute>"; };
+		F33BE16353DD1557A9AB3558 /* /usr/local/Qt-5.3.0/mkspecs/common/clang-mac.conf */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/common/clang-mac.conf"; sourceTree = "<absolute>"; };
+		F4EB01857048DCFCFFAAC4D0 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qavfmediaplayer.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qavfmediaplayer.pri"; sourceTree = "<absolute>"; };
+		F7ADBF552F6B9A5982915164 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_positioning.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_positioning.pri"; sourceTree = "<absolute>"; };
+		F83F87F8A60C9DF666911D42 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qsvg.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qsvg.pri"; sourceTree = "<absolute>"; };
+		F9BEAA743A908603687DA204 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_xmlpatterns_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_xmlpatterns_private.pri"; sourceTree = "<absolute>"; };
+		FCC237CA5AD60B9BA4447615 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
+		FD944B80F033DFE737D401A2 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_help.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_help.pri"; sourceTree = "<absolute>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+		D1C883685E82D5676953459A /* Link Binary With Libraries */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				1BB705CDB741E2B7450201A5 /* Cocoa.framework in Link Binary With Libraries */,
+				328FD74542F6E2C873EE4D4B /* ApplicationServices.framework in Link Binary With Libraries */,
+				668DDDA0C55405E7FCFD6CA5 /* CoreServices.framework in Link Binary With Libraries */,
+				F8B465CE34D8DF87AAE95913 /* CoreFoundation.framework in Link Binary With Libraries */,
+				F26454630C80841CBDCFE1CA /* Foundation.framework in Link Binary With Libraries */,
+				8771A8C96E9C391044035D99 /* OpenGL.framework in Link Binary With Libraries */,
+				E45E51A644D5FC9F942ECE55 /* AGL.framework in Link Binary With Libraries */,
+				D1FA8AF31837B51C762A9D4D /* qcocoa in Link Binary With Libraries */,
+				F8ED42CF8679BF83227DAFC4 /* Carbon.framework in Link Binary With Libraries */,
+				8D267F2E4776F0ECA2F49DC8 /* IOKit.framework in Link Binary With Libraries */,
+				1A681B886F50EE30FBE62B4B /* Qt5PrintSupport in Link Binary With Libraries */,
+				D22929A2B8C5281567FCACDC /* Qt5PlatformSupport in Link Binary With Libraries */,
+				BE6AB9DF1C4880624131C669 /* Qt5Widgets in Link Binary With Libraries */,
+				A9563D9C9FD0D76FAAF1CA96 /* qdds in Link Binary With Libraries */,
+				7CA5405B8503BFFC60932D2B /* qicns in Link Binary With Libraries */,
+				496FD9CEEB508016AFB9F928 /* qico in Link Binary With Libraries */,
+				59789101736112A570B8EFE6 /* qjp2 in Link Binary With Libraries */,
+				FBD56E2AC34F76BFFDB68619 /* qmng in Link Binary With Libraries */,
+				7F76437B577F737145996DC3 /* qtga in Link Binary With Libraries */,
+				C06DDE378A7AC1FA9E6FF69A /* qtiff in Link Binary With Libraries */,
+				A3F8F2284013928A02AE5C38 /* qwbmp in Link Binary With Libraries */,
+				F4D3747C3A03B25EDC9057BB /* qwebp in Link Binary With Libraries */,
+				9F33AC0693BC81B27D8F518D /* Qt5Gui in Link Binary With Libraries */,
+				8D33FE22B9BBADC7FA46C15B /* qtharfbuzzng in Link Binary With Libraries */,
+				B9ADD90C014EA3FBE351DF03 /* Qt5Core in Link Binary With Libraries */,
+			);
+			name = "Link Binary With Libraries";
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+		25B08E2869634E9BCBA333A2 /* Generated Sources */ = {
+			isa = PBXGroup;
+			children = (
+				D0B536A85E53302E4F66CE23 /* GeneratedFiles */,
+			);
+			name = "Generated Sources";
+			sourceTree = "<Group>";
+		};
+		2EB56BE3C2D93CDAB0C52E67 /* Sources */ = {
+			isa = PBXGroup;
+			children = (
+				73F2E45FDEB381A085D37A49 /* SourceFiles */,
+				A9341A7B02F69BC5802268AA /* metaemoji_plugin_import.cpp */,
+			);
+			name = Sources;
+			sourceTree = "<Group>";
+		};
+		31562E815E3DF5B1A777D3EF /* _other */ = {
+			isa = PBXGroup;
+			children = (
+				3AC2626B26B65AA88F06BFB5 /* memain.cpp */,
+				1F47C130E1F45B4A5A91DB5E /* genemoji.cpp */,
+				E981470FA003A8DCE3C52E59 /* memain.h */,
+				58308B26DE991A86E8589883 /* genemoji.h */,
+			);
+			name = _other;
+			sourceTree = "<Group>";
+		};
+		73F2E45FDEB381A085D37A49 /* SourceFiles */ = {
+			isa = PBXGroup;
+			children = (
+				31562E815E3DF5B1A777D3EF /* _other */,
+			);
+			name = SourceFiles;
+			sourceTree = "<Group>";
+		};
+		74B182DB50CB5611B5C1C297 /* Supporting Files */ = {
+			isa = PBXGroup;
+			children = (
+				F13124A218B58585B027D96A /* MetaEmoji.pro */,
+				6E67D23B15FC4B628DB2E0B2 /* /usr/local/Qt-5.3.0/mkspecs/qdevice.pri */,
+				669FB007C4A3D58424D85EC8 /* /usr/local/Qt-5.3.0/mkspecs/common/shell-unix.conf */,
+				0ABCEA8D0DD45589040B0AF2 /* /usr/local/Qt-5.3.0/mkspecs/common/unix.conf */,
+				EBD39B69F368CEEAC360A16D /* /usr/local/Qt-5.3.0/mkspecs/common/mac.conf */,
+				817A0F5A41B553A6DE67FDEB /* /usr/local/Qt-5.3.0/mkspecs/common/macx.conf */,
+				45B95DB3B70B47A910FC847B /* /usr/local/Qt-5.3.0/mkspecs/common/gcc-base.conf */,
+				A9E30FA27827990C5F182223 /* /usr/local/Qt-5.3.0/mkspecs/common/gcc-base-mac.conf */,
+				8C5164D4E37556D40C5E6AA2 /* /usr/local/Qt-5.3.0/mkspecs/common/clang.conf */,
+				F33BE16353DD1557A9AB3558 /* /usr/local/Qt-5.3.0/mkspecs/common/clang-mac.conf */,
+				D4DE537C1FBBD48BD989FAD1 /* /usr/local/Qt-5.3.0/mkspecs/qconfig.pri */,
+				ACC8A73268E5D9AF64E97AF4 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_bluetooth.pri */,
+				2E48BB382B895A5ACD79AF9F /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_bluetooth_private.pri */,
+				BD4D97801B547471B37A4CDC /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_bootstrap_private.pri */,
+				CF86CD5BB01B9011E6B6FD3E /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_clucene_private.pri */,
+				77FF486B1F9BCD55A8A3F35D /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_concurrent.pri */,
+				7D28E9003CE64D8A7F2E292E /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_concurrent_private.pri */,
+				7ECCC1F9442988B4F2707CC1 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_core.pri */,
+				5F781C7FD8422D359EA1D2FE /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_core_private.pri */,
+				7A94C7168B3FCBE5F04A013B /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_declarative.pri */,
+				89863CCAF1D29037AE95755D /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_declarative_private.pri */,
+				F2F823087EA182CCBD5748B8 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_designer.pri */,
+				7C2F42B222EE88E26A6FED62 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_designer_private.pri */,
+				69347C39E4D922E94D0860BF /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_designercomponents_private.pri */,
+				360D4B3ED25D126430DE27D4 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_enginio.pri */,
+				4C6C71914B1926119120DACD /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_enginio_private.pri */,
+				23BC8B0FC3279421D41CA268 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_gui.pri */,
+				D81E3D9A18202BE8EC3D0E2C /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_gui_private.pri */,
+				FD944B80F033DFE737D401A2 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_help.pri */,
+				D7A0618DE39A427EBF41940E /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_help_private.pri */,
+				A5B17ABEFBA1C2F43443D644 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_macextras.pri */,
+				33F165B1DB8CBF182C56FAB5 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_macextras_private.pri */,
+				D2FE4D909926A0D1656068C4 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_multimedia.pri */,
+				E7D67CB158408BB7DEA74764 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_multimedia_private.pri */,
+				28BD0D10214709D95B161E24 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_multimediawidgets.pri */,
+				D1FA7CAB5ACC09D563AE569F /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_multimediawidgets_private.pri */,
+				293C8DEEE270847AC20E70F9 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_network.pri */,
+				382E89A91A34F7898C25FD0D /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_network_private.pri */,
+				8A04A4A3625204D12A1207F6 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_nfc.pri */,
+				B51B01657BFE9EAEF5590561 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_nfc_private.pri */,
+				5CEA7A2DB2136425A88D1254 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_opengl.pri */,
+				E0F4563EA350EB65112A0EF4 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_opengl_private.pri */,
+				E432DA897A5F027987342E8F /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_openglextensions.pri */,
+				5597304BEC94BFB9EAAEBC4B /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_openglextensions_private.pri */,
+				8F572030CE9AB8CC5F672201 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_platformsupport_private.pri */,
+				F7ADBF552F6B9A5982915164 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_positioning.pri */,
+				E66B9EC81C285CA9A7FB6A2E /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_positioning_private.pri */,
+				6C08BFC27C4C303A3A5181DB /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_printsupport.pri */,
+				D0CDC87DAFDA7F18A7AF450F /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_printsupport_private.pri */,
+				B382B645B34234E451AE5D94 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_qml.pri */,
+				6102C69805B6398AF6FA5BEB /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_qml_private.pri */,
+				4FB6657DA22BC68B819B64B3 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_qmldevtools_private.pri */,
+				DF8188E30892A4654B984221 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_qmltest.pri */,
+				ABA9AB4619F09DCFD2D4A27F /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_qmltest_private.pri */,
+				5B22E9E4EE9AAE42ABC24AB3 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_qtmultimediaquicktools_private.pri */,
+				16DD53E17C65AC8B450CC6C3 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_quick.pri */,
+				8C31D89BDFCDF466DAED19A0 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_quick_private.pri */,
+				82E7DCFD95559532D8FC6CDD /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_quickparticles_private.pri */,
+				D948D4D8F949D45158F8DE35 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_quickwidgets.pri */,
+				B2246267D4C0D789259A86B0 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_quickwidgets_private.pri */,
+				CFCB992BEC24B71BFB8A2F30 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_script.pri */,
+				C505A18319B9B63C63877858 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_script_private.pri */,
+				CE829DD126DD2B97E8D70A7A /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_scripttools.pri */,
+				A59F74CD76FDC2B4B9910E18 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_scripttools_private.pri */,
+				85B6936EDBE61D9BB8F8B33B /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_sensors.pri */,
+				BDC9ECADEE40D11E3C2EA93F /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_sensors_private.pri */,
+				BFF0C38FB0EC140C5F0304AE /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_serialport.pri */,
+				311004331A04F3D69C98643C /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_serialport_private.pri */,
+				7DE30A90667C03C4F91A2A91 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_sql.pri */,
+				075EB50EB07CF69FD62FB8DF /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_sql_private.pri */,
+				ADFC79902C14A612AE93A89A /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_svg.pri */,
+				8DDE1D26B3206CDB8B57FABE /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_svg_private.pri */,
+				DB0A26DDC377B2004F61BFE3 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_testlib.pri */,
+				8849E60AEC7DB97A475C17EA /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_testlib_private.pri */,
+				E50FA73B8A23BC179A642B27 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_uitools.pri */,
+				B518DA4EE7376002AFC71FD5 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_uitools_private.pri */,
+				8F97C9CAE38CA3AFAC0B3953 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_websockets.pri */,
+				87EEF25EE25CF21572D1438C /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_websockets_private.pri */,
+				A022AF919D1977534CA66BB8 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_widgets.pri */,
+				8E9136256AFFBA6EF048AA55 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_widgets_private.pri */,
+				AA73DC3C2901E2979FE8AD5B /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_xml.pri */,
+				E37365B4489B4918BEBB707D /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_xml_private.pri */,
+				2E6D9B1D2743D24E31B0B284 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_xmlpatterns.pri */,
+				F9BEAA743A908603687DA204 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_xmlpatterns_private.pri */,
+				D5141F795670589C8CC41CBC /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_cocoaprintersupport.pri */,
+				1FAE75C970AA73F2DEDDB508 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qavfcamera.pri */,
+				F4EB01857048DCFCFFAAC4D0 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qavfmediaplayer.pri */,
+				AFD721AA33A2F785E77B1698 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qcocoa.pri */,
+				EA5D4FF9DE4AC4215D7DCE0D /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qcorewlanbearer.pri */,
+				111BBEE3D1432C3B517FD539 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qdds.pri */,
+				3685604BDB64DD6E92169B73 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qdeclarativeview.pri */,
+				2440CD1D4CEF80443BCA1B8B /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qgenericbearer.pri */,
+				EB1F99FD112917157F3C3F6E /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qicns.pri */,
+				C4295BE59CCEBCDD16268349 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qico.pri */,
+				45DB132B756499D4DF38430E /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qjp2.pri */,
+				B678DA730B4ECE863AD631AE /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qminimal.pri */,
+				F0A58515945747E36783CC21 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qmldbg_inspector.pri */,
+				B8525798C5AA7D7C6D68E1B3 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qmldbg_qtquick2.pri */,
+				EB29AC635054C09EFA749AE1 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qmldbg_tcp.pri */,
+				3F08D430CEC8D2117735CCB4 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qmldbg_tcp_qtdeclarative.pri */,
+				946BEA667170DC1A7A8F9DB0 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qmng.pri */,
+				CCF75CFFB857487FB18F99F9 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qoffscreen.pri */,
+				9A0BDF67E013BB4FFB8685B0 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qqt7engine.pri */,
+				B064BF3B496A7BF7A449CA1E /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qsqlite.pri */,
+				F83F87F8A60C9DF666911D42 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qsvg.pri */,
+				CFFBE05DB004895080314289 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qsvgicon.pri */,
+				247D8DF3B1DDB665B80BBA25 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtaccessiblequick.pri */,
+				87A4C1983FD641360BF80A02 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtaccessiblewidgets.pri */,
+				24B6929EE3952310F2DAECB1 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtaudio_coreaudio.pri */,
+				060A694B42A4555240009936 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtga.pri */,
+				BD22EFEFCC02644B1883CE19 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtiff.pri */,
+				B8C1F6C965A7A14FBA8D4518 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtmedia_audioengine.pri */,
+				74C1C232DFAA71028A0412CA /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtmultimedia_m3u.pri */,
+				C84546C18DCBB04166195DCF /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtposition_positionpoll.pri */,
+				AB1C02DDBD8E88DD9A9AFDDD /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtsensorgestures_plugin.pri */,
+				8B4BB4E74F8A4442EF563D7D /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtsensorgestures_shakeplugin.pri */,
+				892D36BEF797BA4AF48D378A /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtsensors_dummy.pri */,
+				A4D8AC60897F435C1C3B9D02 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtsensors_generic.pri */,
+				346287C9E754E7C458153F03 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qwbmp.pri */,
+				B26239063A068F800A2C95F4 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qwebp.pri */,
+				63E722139886C87BC82DBDF5 /* /usr/local/Qt-5.3.0/mkspecs/macx-clang/qmake.conf */,
+				85061B1DA49D125991117950 /* /usr/local/Qt-5.3.0/mkspecs/macx-xcode/qmake.conf */,
+				AB745978DF0F41D1801ABDA6 /* .qmake.stash */,
+			);
+			name = "Supporting Files";
+			sourceTree = "<Group>";
+		};
+		801973D3334D0FCA849CF485 /* Debug */ = {
+			isa = PBXGroup;
+			children = (
+				93E4BE1A02365B73BAF00B73 /* moc_genemoji.cpp */,
+			);
+			name = Debug;
+			sourceTree = "<Group>";
+		};
+		AF39DD055C3EF8226FBE929D /* Frameworks */ = {
+			isa = PBXGroup;
+			children = (
+				AEA456A2F75ED9F5CDA7BCBE /* Cocoa.framework */,
+				DFD7912080BC557230093752 /* ApplicationServices.framework */,
+				9742F24EE18EA44D52824F1E /* CoreServices.framework */,
+				4D765E1B1EA6C757220C63E7 /* CoreFoundation.framework */,
+				FCC237CA5AD60B9BA4447615 /* Foundation.framework */,
+				D4B32C2222F82AC56BADEB21 /* OpenGL.framework */,
+				8D9815BDB5BD9F90D2BC05C5 /* AGL.framework */,
+				D53D8E6A188E05078A114294 /* qcocoa */,
+				9DFF62A901D70814B8A323D4 /* Carbon.framework */,
+				A1A67BEAA744704B29168D39 /* IOKit.framework */,
+				DBF506D10449BFABD45B82DA /* Qt5PrintSupport */,
+				E7B2F248E3F7970788F35BF5 /* Qt5PlatformSupport */,
+				4689C06178B60B84E7F3A3B7 /* Qt5Widgets */,
+				D3D1BE0BEA3AEE0551AD39AC /* qdds */,
+				31120EDB269DFF13E1D49847 /* qicns */,
+				8F500B5166907B6D9A7C3E3D /* qico */,
+				F0681BC551FC8A2B132FC646 /* qjp2 */,
+				83D37373949868693FB7816D /* qmng */,
+				DCEFD9167C239650120B0145 /* qtga */,
+				F2453BA07315EB9F34F1CD57 /* qtiff */,
+				8CF51323544B886B8F4A2232 /* qwbmp */,
+				ADC6308023253CEA51F86E21 /* qwebp */,
+				04391BE7A8B9D811E255100A /* Qt5Gui */,
+				D6193B79CECC9DD0142D1200 /* qtharfbuzzng */,
+				5A80A1907B6CFFB524C1E57D /* Qt5Core */,
+			);
+			name = Frameworks;
+			sourceTree = "<Group>";
+		};
+		D0B536A85E53302E4F66CE23 /* GeneratedFiles */ = {
+			isa = PBXGroup;
+			children = (
+				801973D3334D0FCA849CF485 /* Debug */,
+			);
+			name = GeneratedFiles;
+			sourceTree = "<Group>";
+		};
+		E8C543AB96796ECAA2E65C57 /* MetaEmoji */ = {
+			isa = PBXGroup;
+			children = (
+				2EB56BE3C2D93CDAB0C52E67 /* Sources */,
+				25B08E2869634E9BCBA333A2 /* Generated Sources */,
+				74B182DB50CB5611B5C1C297 /* Supporting Files */,
+				AF39DD055C3EF8226FBE929D /* Frameworks */,
+				FE0A091FDBFB3E9C31B7A1BD /* Products */,
+			);
+			name = MetaEmoji;
+			sourceTree = "<Group>";
+		};
+		FE0A091FDBFB3E9C31B7A1BD /* Products */ = {
+			isa = PBXGroup;
+			children = (
+				C3345709A0BD182590087379 /* MetaEmoji.app */,
+			);
+			name = Products;
+			sourceTree = "<Group>";
+		};
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+		E4122523B1AB28431125160A /* MetaEmoji */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 6CC3B5D2136C7CD6A5CF5A59 /* Build configuration list for PBXNativeTarget "MetaEmoji" */;
+			buildPhases = (
+				F7E50F631C51CD5B5DC0BC43 /* Compile Sources */,
+				D1C883685E82D5676953459A /* Link Binary With Libraries */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+				8F9AEC020DB94B2A3918B1FE /* PBXTargetDependency */,
+			);
+			name = MetaEmoji;
+			productInstallPath = ../Mac/DebugEmoji/;
+			productName = MetaEmoji;
+			productReference = C3345709A0BD182590087379 /* MetaEmoji.app */;
+			productType = "com.apple.product-type.application";
+		};
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+		6DB9C3763D02B1415CD9D565 /* Project object */ = {
+			isa = PBXProject;
+			attributes = {
+				LastUpgradeCheck = 0510;
+			};
+			buildConfigurationList = DAC4C1AA5EDEA1C85E9CA5E6 /* Build configuration list for PBXProject "MetaEmoji" */;
+			compatibilityVersion = "Xcode 3.2";
+			developmentRegion = English;
+			hasScannedForEncodings = 1;
+			knownRegions = (
+				en,
+			);
+			mainGroup = E8C543AB96796ECAA2E65C57 /* MetaEmoji */;
+			productRefGroup = FE0A091FDBFB3E9C31B7A1BD /* Products */;
+			projectDirPath = "";
+			projectRoot = "";
+			targets = (
+				E4122523B1AB28431125160A /* MetaEmoji */,
+				D93715D85BD26B270C3CC80B /* Preprocess */,
+			);
+		};
+/* End PBXProject section */
+
+/* Begin PBXShellScriptBuildPhase section */
+		7EF0942E79C014DCEC8976BC /* Qt Preprocessors */ = {
+			isa = PBXShellScriptBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			name = "Qt Preprocessors";
+			runOnlyForDeploymentPostprocessing = 0;
+			shellPath = /bin/sh;
+			shellScript = "make -C . -f MetaEmoji.xcodeproj/qt_preprocess.mak";
+		};
+/* End PBXShellScriptBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+		F7E50F631C51CD5B5DC0BC43 /* Compile Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				83425F7776C9E52C29BE0E6F /* memain.cpp in Compile Sources */,
+				C5357D951917482510CE3E54 /* genemoji.cpp in Compile Sources */,
+				4B166C0FE4A3C31F5E3D05CE /* metaemoji_plugin_import.cpp in Compile Sources */,
+				C4F1177BDAACCF1E50ACCED9 /* moc_genemoji.cpp in Compile Sources */,
+			);
+			name = "Compile Sources";
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXTargetDependency section */
+		8F9AEC020DB94B2A3918B1FE /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = D93715D85BD26B270C3CC80B /* Preprocess */;
+			targetProxy = 0708466E1954218200B5AE3A /* PBXContainerItemProxy */;
+		};
+/* End PBXTargetDependency section */
+
+/* Begin XCBuildConfiguration section */
+		339EE1B2CC4FC24589A0EA95 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				CC = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang;
+				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_EMPTY_BODY = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)Emoji$(EFFECTIVE_PLATFORM_NAME)";
+				COPY_PHASE_STRIP = YES;
+				DYLIB_COMPATIBILITY_VERSION = 1.0;
+				DYLIB_CURRENT_VERSION = 1.0.0;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES;
+				GCC_WARN_UNUSED_FUNCTION = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				HEADER_SEARCH_PATHS = (
+					../../Libraries/QtStatic/qtbase/include/QtGui/5.3.0/QtGui,
+					../../Libraries/QtStatic/qtbase/include/QtCore/5.3.0/QtCore,
+					../../Libraries/QtStatic/qtbase/include,
+					"/usr/local/Qt-5.3.0/include",
+					"/usr/local/Qt-5.3.0/include/QtGui",
+					"/usr/local/Qt-5.3.0/include/QtCore",
+					GeneratedFiles/Debug,
+					/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers,
+					/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/AGL.framework/Headers,
+					"/usr/local/Qt-5.3.0/mkspecs/macx-clang",
+				);
+				INFOPLIST_FILE = Emoji.plist;
+				INSTALL_DIR = ../Mac/ReleaseEmoji/;
+				LDPLUSPLUS = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++";
+				LIBRARY_SEARCH_PATHS = (
+					/System/Library/Frameworks/,
+					"/usr/local/Qt-5.3.0/lib",
+					"/usr/local/Qt-5.3.0/plugins/platforms",
+					"/usr/local/Qt-5.3.0/plugins/imageformats",
+				);
+				MACOSX_DEPLOYMENT_TARGET = 10.7;
+				OBJROOT = ./../Mac/ReleaseIntermediateEmoji/;
+				OTHER_CFLAGS = (
+					"-pipe",
+					"-g",
+					"-Wall",
+					"-W",
+					"-fPIE",
+					"-D_DEBUG",
+					"-DQT_GUI_LIB",
+					"-DQT_CORE_LIB",
+				);
+				OTHER_CPLUSPLUSFLAGS = (
+					"-pipe",
+					"-g",
+					"-std=c++11",
+					"-stdlib=libc++",
+					"-Wall",
+					"-W",
+					"-fPIE",
+					"-D_DEBUG",
+					"-DQT_GUI_LIB",
+					"-DQT_CORE_LIB",
+				);
+				OTHER_LDFLAGS = (
+					"-headerpad_max_install_names",
+					"-stdlib=libc++",
+					"-L/usr/local/Qt-5.3.0/lib",
+					"-L/usr/local/Qt-5.3.0/plugins/platforms",
+					"-lcups",
+					"-L/usr/local/Qt-5.3.0/plugins/imageformats",
+					"-lz",
+					"-lm",
+				);
+				PRODUCT_NAME = MetaEmoji;
+				QT_LIBRARY_SUFFIX = "";
+				SDKROOT = macosx;
+				SYMROOT = ./../Mac;
+			};
+			name = Release;
+		};
+		3AA6C32AC930069E80220CF1 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				CC = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang;
+				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_EMPTY_BODY = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)Emoji$(EFFECTIVE_PLATFORM_NAME)";
+				COPY_PHASE_STRIP = NO;
+				DEBUG_INFORMATION_FORMAT = dwarf;
+				DYLIB_COMPATIBILITY_VERSION = 1.0;
+				DYLIB_CURRENT_VERSION = 1.0.0;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES;
+				GCC_WARN_UNUSED_FUNCTION = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				HEADER_SEARCH_PATHS = (
+					../../Libraries/QtStatic/qtbase/include/QtGui/5.3.0/QtGui,
+					../../Libraries/QtStatic/qtbase/include/QtCore/5.3.0/QtCore,
+					../../Libraries/QtStatic/qtbase/include,
+					"/usr/local/Qt-5.3.0/include",
+					"/usr/local/Qt-5.3.0/include/QtGui",
+					"/usr/local/Qt-5.3.0/include/QtCore",
+					GeneratedFiles/Debug,
+					/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers,
+					/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/AGL.framework/Headers,
+					"/usr/local/Qt-5.3.0/mkspecs/macx-clang",
+				);
+				INFOPLIST_FILE = Emoji.plist;
+				INSTALL_DIR = ../Mac/DebugEmoji/;
+				LDPLUSPLUS = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++";
+				LIBRARY_SEARCH_PATHS = (
+					/System/Library/Frameworks/,
+					"/usr/local/Qt-5.3.0/lib",
+					"/usr/local/Qt-5.3.0/plugins/platforms",
+					"/usr/local/Qt-5.3.0/plugins/imageformats",
+				);
+				MACOSX_DEPLOYMENT_TARGET = 10.7;
+				OBJROOT = ./../Mac/DebugIntermediateEmoji/;
+				ONLY_ACTIVE_ARCH = YES;
+				OTHER_CFLAGS = (
+					"-pipe",
+					"-g",
+					"-Wall",
+					"-W",
+					"-fPIE",
+					"-D_DEBUG",
+					"-DQT_GUI_LIB",
+					"-DQT_CORE_LIB",
+				);
+				OTHER_CPLUSPLUSFLAGS = (
+					"-pipe",
+					"-g",
+					"-std=c++11",
+					"-stdlib=libc++",
+					"-Wall",
+					"-W",
+					"-fPIE",
+					"-D_DEBUG",
+					"-DQT_GUI_LIB",
+					"-DQT_CORE_LIB",
+				);
+				OTHER_LDFLAGS = (
+					"-headerpad_max_install_names",
+					"-stdlib=libc++",
+					"-L/usr/local/Qt-5.3.0/lib",
+					"-L/usr/local/Qt-5.3.0/plugins/platforms",
+					"-lcups",
+					"-L/usr/local/Qt-5.3.0/plugins/imageformats",
+					"-lz",
+					"-lm",
+				);
+				PRODUCT_NAME = MetaEmoji;
+				QT_LIBRARY_SUFFIX = _debug;
+				SDKROOT = macosx;
+				SYMROOT = ./../Mac;
+			};
+			name = Debug;
+		};
+		6666AA5E688052234F6758D8 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				COMBINE_HIDPI_IMAGES = YES;
+				COPY_PHASE_STRIP = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				PRODUCT_NAME = MetaEmoji;
+				QT_LIBRARY_SUFFIX = "";
+				SDKROOT = macosx;
+			};
+			name = Release;
+		};
+		77418F46922677BB04ED38DD /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				COMBINE_HIDPI_IMAGES = YES;
+				COPY_PHASE_STRIP = NO;
+				DEBUG_INFORMATION_FORMAT = dwarf;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				PRODUCT_NAME = MetaEmoji;
+				QT_LIBRARY_SUFFIX = _debug;
+				SDKROOT = macosx;
+			};
+			name = Debug;
+		};
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+		6CC3B5D2136C7CD6A5CF5A59 /* Build configuration list for PBXNativeTarget "MetaEmoji" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				77418F46922677BB04ED38DD /* Debug */,
+				6666AA5E688052234F6758D8 /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Debug;
+		};
+		DAC4C1AA5EDEA1C85E9CA5E6 /* Build configuration list for PBXProject "MetaEmoji" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				3AA6C32AC930069E80220CF1 /* Debug */,
+				339EE1B2CC4FC24589A0EA95 /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Debug;
+		};
+/* End XCConfigurationList section */
+	};
+	rootObject = 6DB9C3763D02B1415CD9D565 /* Project object */;
+}
diff --git a/Telegram/MetaEmoji.xcodeproj/qt_makeqmake.mak b/Telegram/MetaEmoji.xcodeproj/qt_makeqmake.mak
new file mode 100644
index 000000000..d9877c992
--- /dev/null
+++ b/Telegram/MetaEmoji.xcodeproj/qt_makeqmake.mak
@@ -0,0 +1,345 @@
+#############################################################################
+# Makefile for building: ../Mac/DebugEmoji/MetaEmoji.app/Contents/MacOS/MetaEmoji
+# Generated by qmake (3.0) (Qt 5.3.0)
+# Project:  MetaEmoji.pro
+# Template: app
+# Command: /usr/local/Qt-5.3.0/bin/qmake -spec macx-xcode -o MetaEmoji.xcodeproj/project.pbxproj MetaEmoji.pro
+#############################################################################
+
+MAKEFILE      = project.pbxproj
+
+QMAKE    = /usr/local/Qt-5.3.0/bin/qmake
+MetaEmoji.xcodeproj/project.pbxproj: MetaEmoji.pro /usr/local/Qt-5.3.0/mkspecs/macx-clang/qmake.conf /usr/local/Qt-5.3.0/mkspecs/features/spec_pre.prf \
+		/usr/local/Qt-5.3.0/mkspecs/qdevice.pri \
+		/usr/local/Qt-5.3.0/mkspecs/features/device_config.prf \
+		/usr/local/Qt-5.3.0/mkspecs/common/shell-unix.conf \
+		/usr/local/Qt-5.3.0/mkspecs/common/unix.conf \
+		/usr/local/Qt-5.3.0/mkspecs/common/mac.conf \
+		/usr/local/Qt-5.3.0/mkspecs/common/macx.conf \
+		/usr/local/Qt-5.3.0/mkspecs/common/gcc-base.conf \
+		/usr/local/Qt-5.3.0/mkspecs/common/gcc-base-mac.conf \
+		/usr/local/Qt-5.3.0/mkspecs/common/clang.conf \
+		/usr/local/Qt-5.3.0/mkspecs/common/clang-mac.conf \
+		/usr/local/Qt-5.3.0/mkspecs/qconfig.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_bluetooth.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_bluetooth_private.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_bootstrap_private.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_clucene_private.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_concurrent.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_concurrent_private.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_core.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_core_private.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_declarative.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_declarative_private.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_designer.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_designer_private.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_designercomponents_private.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_enginio.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_enginio_private.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_gui.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_gui_private.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_help.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_help_private.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_macextras.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_macextras_private.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_multimedia.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_multimedia_private.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_multimediawidgets.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_multimediawidgets_private.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_network.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_network_private.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_nfc.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_nfc_private.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_opengl.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_opengl_private.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_openglextensions.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_openglextensions_private.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_platformsupport_private.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_positioning.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_positioning_private.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_printsupport.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_printsupport_private.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_qml.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_qml_private.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_qmldevtools_private.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_qmltest.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_qmltest_private.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_qtmultimediaquicktools_private.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_quick.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_quick_private.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_quickparticles_private.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_quickwidgets.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_quickwidgets_private.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_script.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_script_private.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_scripttools.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_scripttools_private.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_sensors.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_sensors_private.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_serialport.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_serialport_private.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_sql.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_sql_private.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_svg.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_svg_private.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_testlib.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_testlib_private.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_uitools.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_uitools_private.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_websockets.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_websockets_private.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_widgets.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_widgets_private.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_xml.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_xml_private.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_xmlpatterns.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_xmlpatterns_private.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_cocoaprintersupport.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qavfcamera.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qavfmediaplayer.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qcocoa.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qcorewlanbearer.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qdds.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qdeclarativeview.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qgenericbearer.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qicns.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qico.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qjp2.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qminimal.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qmldbg_inspector.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qmldbg_qtquick2.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qmldbg_tcp.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qmldbg_tcp_qtdeclarative.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qmng.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qoffscreen.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qqt7engine.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qsqlite.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qsvg.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qsvgicon.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtaccessiblequick.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtaccessiblewidgets.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtaudio_coreaudio.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtga.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtiff.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtmedia_audioengine.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtmultimedia_m3u.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtposition_positionpoll.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtsensorgestures_plugin.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtsensorgestures_shakeplugin.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtsensors_dummy.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtsensors_generic.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qwbmp.pri \
+		/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qwebp.pri \
+		/usr/local/Qt-5.3.0/mkspecs/features/qt_functions.prf \
+		/usr/local/Qt-5.3.0/mkspecs/features/qt_config.prf \
+		/usr/local/Qt-5.3.0/mkspecs/macx-clang/qmake.conf \
+		/usr/local/Qt-5.3.0/mkspecs/macx-xcode/qmake.conf \
+		/usr/local/Qt-5.3.0/mkspecs/features/spec_post.prf \
+		.qmake.stash \
+		/usr/local/Qt-5.3.0/mkspecs/features/exclusive_builds.prf \
+		/usr/local/Qt-5.3.0/mkspecs/features/default_pre.prf \
+		/usr/local/Qt-5.3.0/mkspecs/features/mac/default_pre.prf \
+		/usr/local/Qt-5.3.0/mkspecs/features/resolve_config.prf \
+		/usr/local/Qt-5.3.0/mkspecs/features/default_post.prf \
+		/usr/local/Qt-5.3.0/mkspecs/features/mac/sdk.prf \
+		/usr/local/Qt-5.3.0/mkspecs/features/mac/default_post.prf \
+		/usr/local/Qt-5.3.0/mkspecs/features/c++11.prf \
+		/usr/local/Qt-5.3.0/mkspecs/features/mac/objective_c.prf \
+		/usr/local/Qt-5.3.0/mkspecs/features/warn_on.prf \
+		/usr/local/Qt-5.3.0/mkspecs/features/qt.prf \
+		/usr/local/Qt-5.3.0/mkspecs/features/resources.prf \
+		/usr/local/Qt-5.3.0/mkspecs/features/moc.prf \
+		/usr/local/Qt-5.3.0/mkspecs/features/unix/opengl.prf \
+		/usr/local/Qt-5.3.0/mkspecs/features/unix/thread.prf \
+		/usr/local/Qt-5.3.0/mkspecs/features/mac/rez.prf \
+		/usr/local/Qt-5.3.0/mkspecs/features/testcase_targets.prf \
+		/usr/local/Qt-5.3.0/mkspecs/features/exceptions.prf \
+		/usr/local/Qt-5.3.0/mkspecs/features/yacc.prf \
+		/usr/local/Qt-5.3.0/mkspecs/features/lex.prf \
+		MetaEmoji.pro \
+		/usr/local/Qt-5.3.0/lib/libQt5Gui_debug.prl \
+		/usr/local/Qt-5.3.0/lib/libQt5Core_debug.prl \
+		/usr/local/Qt-5.3.0/lib/libqtharfbuzzng_debug.prl \
+		/usr/local/Qt-5.3.0/plugins/platforms/libqcocoa_debug.prl \
+		/usr/local/Qt-5.3.0/lib/libQt5PrintSupport_debug.prl \
+		/usr/local/Qt-5.3.0/lib/libQt5Widgets_debug.prl \
+		/usr/local/Qt-5.3.0/lib/libQt5PlatformSupport_debug.prl \
+		/usr/local/Qt-5.3.0/plugins/imageformats/libqdds_debug.prl \
+		/usr/local/Qt-5.3.0/plugins/imageformats/libqicns_debug.prl \
+		/usr/local/Qt-5.3.0/plugins/imageformats/libqico_debug.prl \
+		/usr/local/Qt-5.3.0/plugins/imageformats/libqjp2_debug.prl \
+		/usr/local/Qt-5.3.0/plugins/imageformats/libqmng_debug.prl \
+		/usr/local/Qt-5.3.0/plugins/imageformats/libqtga_debug.prl \
+		/usr/local/Qt-5.3.0/plugins/imageformats/libqtiff_debug.prl \
+		/usr/local/Qt-5.3.0/plugins/imageformats/libqwbmp_debug.prl \
+		/usr/local/Qt-5.3.0/plugins/imageformats/libqwebp_debug.prl
+	$(QMAKE) -spec macx-xcode -o MetaEmoji.xcodeproj/project.pbxproj MetaEmoji.pro
+/usr/local/Qt-5.3.0/mkspecs/features/spec_pre.prf:
+/usr/local/Qt-5.3.0/mkspecs/qdevice.pri:
+/usr/local/Qt-5.3.0/mkspecs/features/device_config.prf:
+/usr/local/Qt-5.3.0/mkspecs/common/shell-unix.conf:
+/usr/local/Qt-5.3.0/mkspecs/common/unix.conf:
+/usr/local/Qt-5.3.0/mkspecs/common/mac.conf:
+/usr/local/Qt-5.3.0/mkspecs/common/macx.conf:
+/usr/local/Qt-5.3.0/mkspecs/common/gcc-base.conf:
+/usr/local/Qt-5.3.0/mkspecs/common/gcc-base-mac.conf:
+/usr/local/Qt-5.3.0/mkspecs/common/clang.conf:
+/usr/local/Qt-5.3.0/mkspecs/common/clang-mac.conf:
+/usr/local/Qt-5.3.0/mkspecs/qconfig.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_bluetooth.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_bluetooth_private.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_bootstrap_private.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_clucene_private.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_concurrent.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_concurrent_private.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_core.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_core_private.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_declarative.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_declarative_private.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_designer.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_designer_private.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_designercomponents_private.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_enginio.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_enginio_private.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_gui.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_gui_private.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_help.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_help_private.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_macextras.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_macextras_private.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_multimedia.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_multimedia_private.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_multimediawidgets.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_multimediawidgets_private.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_network.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_network_private.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_nfc.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_nfc_private.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_opengl.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_opengl_private.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_openglextensions.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_openglextensions_private.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_platformsupport_private.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_positioning.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_positioning_private.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_printsupport.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_printsupport_private.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_qml.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_qml_private.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_qmldevtools_private.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_qmltest.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_qmltest_private.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_qtmultimediaquicktools_private.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_quick.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_quick_private.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_quickparticles_private.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_quickwidgets.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_quickwidgets_private.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_script.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_script_private.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_scripttools.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_scripttools_private.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_sensors.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_sensors_private.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_serialport.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_serialport_private.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_sql.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_sql_private.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_svg.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_svg_private.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_testlib.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_testlib_private.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_uitools.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_uitools_private.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_websockets.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_websockets_private.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_widgets.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_widgets_private.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_xml.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_xml_private.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_xmlpatterns.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_xmlpatterns_private.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_cocoaprintersupport.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qavfcamera.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qavfmediaplayer.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qcocoa.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qcorewlanbearer.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qdds.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qdeclarativeview.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qgenericbearer.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qicns.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qico.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qjp2.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qminimal.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qmldbg_inspector.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qmldbg_qtquick2.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qmldbg_tcp.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qmldbg_tcp_qtdeclarative.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qmng.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qoffscreen.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qqt7engine.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qsqlite.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qsvg.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qsvgicon.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtaccessiblequick.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtaccessiblewidgets.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtaudio_coreaudio.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtga.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtiff.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtmedia_audioengine.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtmultimedia_m3u.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtposition_positionpoll.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtsensorgestures_plugin.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtsensorgestures_shakeplugin.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtsensors_dummy.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtsensors_generic.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qwbmp.pri:
+/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qwebp.pri:
+/usr/local/Qt-5.3.0/mkspecs/features/qt_functions.prf:
+/usr/local/Qt-5.3.0/mkspecs/features/qt_config.prf:
+/usr/local/Qt-5.3.0/mkspecs/macx-clang/qmake.conf:
+/usr/local/Qt-5.3.0/mkspecs/macx-xcode/qmake.conf:
+/usr/local/Qt-5.3.0/mkspecs/features/spec_post.prf:
+.qmake.stash:
+/usr/local/Qt-5.3.0/mkspecs/features/exclusive_builds.prf:
+/usr/local/Qt-5.3.0/mkspecs/features/default_pre.prf:
+/usr/local/Qt-5.3.0/mkspecs/features/mac/default_pre.prf:
+/usr/local/Qt-5.3.0/mkspecs/features/resolve_config.prf:
+/usr/local/Qt-5.3.0/mkspecs/features/default_post.prf:
+/usr/local/Qt-5.3.0/mkspecs/features/mac/sdk.prf:
+/usr/local/Qt-5.3.0/mkspecs/features/mac/default_post.prf:
+/usr/local/Qt-5.3.0/mkspecs/features/c++11.prf:
+/usr/local/Qt-5.3.0/mkspecs/features/mac/objective_c.prf:
+/usr/local/Qt-5.3.0/mkspecs/features/warn_on.prf:
+/usr/local/Qt-5.3.0/mkspecs/features/qt.prf:
+/usr/local/Qt-5.3.0/mkspecs/features/resources.prf:
+/usr/local/Qt-5.3.0/mkspecs/features/moc.prf:
+/usr/local/Qt-5.3.0/mkspecs/features/unix/opengl.prf:
+/usr/local/Qt-5.3.0/mkspecs/features/unix/thread.prf:
+/usr/local/Qt-5.3.0/mkspecs/features/mac/rez.prf:
+/usr/local/Qt-5.3.0/mkspecs/features/testcase_targets.prf:
+/usr/local/Qt-5.3.0/mkspecs/features/exceptions.prf:
+/usr/local/Qt-5.3.0/mkspecs/features/yacc.prf:
+/usr/local/Qt-5.3.0/mkspecs/features/lex.prf:
+MetaEmoji.pro:
+/usr/local/Qt-5.3.0/lib/libQt5Gui_debug.prl:
+/usr/local/Qt-5.3.0/lib/libQt5Core_debug.prl:
+/usr/local/Qt-5.3.0/lib/libqtharfbuzzng_debug.prl:
+/usr/local/Qt-5.3.0/plugins/platforms/libqcocoa_debug.prl:
+/usr/local/Qt-5.3.0/lib/libQt5PrintSupport_debug.prl:
+/usr/local/Qt-5.3.0/lib/libQt5Widgets_debug.prl:
+/usr/local/Qt-5.3.0/lib/libQt5PlatformSupport_debug.prl:
+/usr/local/Qt-5.3.0/plugins/imageformats/libqdds_debug.prl:
+/usr/local/Qt-5.3.0/plugins/imageformats/libqicns_debug.prl:
+/usr/local/Qt-5.3.0/plugins/imageformats/libqico_debug.prl:
+/usr/local/Qt-5.3.0/plugins/imageformats/libqjp2_debug.prl:
+/usr/local/Qt-5.3.0/plugins/imageformats/libqmng_debug.prl:
+/usr/local/Qt-5.3.0/plugins/imageformats/libqtga_debug.prl:
+/usr/local/Qt-5.3.0/plugins/imageformats/libqtiff_debug.prl:
+/usr/local/Qt-5.3.0/plugins/imageformats/libqwbmp_debug.prl:
+/usr/local/Qt-5.3.0/plugins/imageformats/libqwebp_debug.prl:
+qmake: FORCE
+	@$(QMAKE) -spec macx-xcode -o MetaEmoji.xcodeproj/project.pbxproj MetaEmoji.pro
+
+qmake_all: FORCE
+
diff --git a/Telegram/MetaEmoji.xcodeproj/qt_preprocess.mak b/Telegram/MetaEmoji.xcodeproj/qt_preprocess.mak
new file mode 100644
index 000000000..7ac849028
--- /dev/null
+++ b/Telegram/MetaEmoji.xcodeproj/qt_preprocess.mak
@@ -0,0 +1,70 @@
+#############################################################################
+# Makefile for building: ../Mac/DebugEmoji/MetaEmoji.app/Contents/MacOS/MetaEmoji
+# Generated by qmake (3.0) (Qt 5.3.0)
+# Project:  MetaEmoji.pro
+# Template: app
+# Command: /usr/local/Qt-5.3.0/bin/qmake -spec macx-xcode -o MetaEmoji.xcodeproj/project.pbxproj MetaEmoji.pro
+#############################################################################
+
+MAKEFILE      = project.pbxproj
+
+MOC       = /usr/local/Qt-5.3.0/bin/moc
+UIC       = 
+LEX       = flex
+LEXFLAGS  = 
+YACC      = yacc
+YACCFLAGS = -d
+DEFINES       = -D_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB
+INCPATH       = -I/usr/local/Qt-5.3.0/mkspecs/macx-clang -I. -I../../Libraries/QtStatic/qtbase/include/QtGui/5.3.0/QtGui -I../../Libraries/QtStatic/qtbase/include/QtCore/5.3.0/QtCore -I../../Libraries/QtStatic/qtbase/include -I/usr/local/Qt-5.3.0/include -I/usr/local/Qt-5.3.0/include/QtGui -I/usr/local/Qt-5.3.0/include/QtCore -IGeneratedFiles/Debug -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/AGL.framework/Headers
+DEL_FILE  = rm -f
+MOVE      = mv -f
+
+IMAGES = 
+PARSERS =
+preprocess: $(PARSERS) compilers
+clean preprocess_clean: parser_clean compiler_clean
+
+parser_clean:
+mocclean: compiler_moc_header_clean compiler_moc_source_clean
+
+mocables: compiler_moc_header_make_all compiler_moc_source_make_all
+
+check: first
+
+compilers: GeneratedFiles/Debug/moc_genemoji.cpp
+compiler_objective_c_make_all:
+compiler_objective_c_clean:
+compiler_rcc_make_all:
+compiler_rcc_clean:
+compiler_moc_header_make_all: GeneratedFiles/Debug/moc_genemoji.cpp
+compiler_moc_header_clean:
+	-$(DEL_FILE) GeneratedFiles/Debug/moc_genemoji.cpp
+GeneratedFiles/Debug/moc_genemoji.cpp: ../../Libraries/QtStatic/qtbase/include/QtCore/QMap \
+		../../Libraries/QtStatic/qtbase/include/QtCore/QVector \
+		../../Libraries/QtStatic/qtbase/include/QtCore/QFile \
+		../../Libraries/QtStatic/qtbase/include/QtCore/QFileInfo \
+		../../Libraries/QtStatic/qtbase/include/QtCore/QBuffer \
+		../../Libraries/QtStatic/qtbase/include/QtCore/QDir \
+		../../Libraries/QtStatic/qtbase/include/QtCore/QRegularExpression \
+		../../Libraries/QtStatic/qtbase/include/QtGui/QImage \
+		../../Libraries/QtStatic/qtbase/include/QtGui/QPixmap \
+		../../Libraries/QtStatic/qtbase/include/QtGui/QPainter \
+		../../Libraries/QtStatic/qtbase/include/QtCore/QTextStream \
+		../../Libraries/QtStatic/qtbase/include/QtCore/QString \
+		../../Libraries/QtStatic/qtbase/include/QtCore/QCoreApplication \
+		../../Libraries/QtStatic/qtbase/include/QtGui/QGuiApplication \
+		SourceFiles/_other/genemoji.h
+	/usr/local/Qt-5.3.0/bin/moc $(DEFINES) -D__APPLE__ -D__GNUC__=4 -I/usr/local/Qt-5.3.0/mkspecs/macx-clang -I. -I/usr/local/Qt-5.3.0/include/QtGui/5.3.0/QtGui -I/usr/local/Qt-5.3.0/include/QtCore/5.3.0/QtCore -I/usr/local/Qt-5.3.0/include -I/usr/local/Qt-5.3.0/include/QtGui -I/usr/local/Qt-5.3.0/include/QtCore -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/backward -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/5.1/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include SourceFiles/_other/genemoji.h -o GeneratedFiles/Debug/moc_genemoji.cpp
+
+compiler_moc_source_make_all:
+compiler_moc_source_clean:
+compiler_rez_source_make_all:
+compiler_rez_source_clean:
+compiler_yacc_decl_make_all:
+compiler_yacc_decl_clean:
+compiler_yacc_impl_make_all:
+compiler_yacc_impl_clean:
+compiler_lex_make_all:
+compiler_lex_clean:
+compiler_clean: compiler_moc_header_clean 
+
diff --git a/Telegram/MetaLang.xcodeproj/project.pbxproj b/Telegram/MetaLang.xcodeproj/project.pbxproj
index 9fc24cce8..d71d0a7cf 100644
--- a/Telegram/MetaLang.xcodeproj/project.pbxproj
+++ b/Telegram/MetaLang.xcodeproj/project.pbxproj
@@ -599,6 +599,7 @@
 				CLANG_WARN_ENUM_CONVERSION = YES;
 				CLANG_WARN_INT_CONVERSION = YES;
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)Lang$(EFFECTIVE_PLATFORM_NAME)";
 				COPY_PHASE_STRIP = YES;
 				DYLIB_COMPATIBILITY_VERSION = 1.0;
 				DYLIB_CURRENT_VERSION = 1.0.0;
@@ -633,7 +634,7 @@
 					"/usr/local/Qt-5.3.0/plugins/imageformats",
 				);
 				MACOSX_DEPLOYMENT_TARGET = 10.7;
-				OBJROOT = ../Mac/DebugIntermediateLang/;
+				OBJROOT = ./../Mac/ReleaseIntermediateLang;
 				OTHER_CFLAGS = (
 					"-pipe",
 					"-g",
@@ -669,7 +670,7 @@
 				PRODUCT_NAME = MetaLang;
 				QT_LIBRARY_SUFFIX = "";
 				SDKROOT = macosx;
-				SYMROOT = ../Mac/ReleaseLang;
+				SYMROOT = ./../Mac;
 			};
 			name = Release;
 		};
@@ -683,6 +684,7 @@
 				CLANG_WARN_ENUM_CONVERSION = YES;
 				CLANG_WARN_INT_CONVERSION = YES;
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)Lang$(EFFECTIVE_PLATFORM_NAME)";
 				COPY_PHASE_STRIP = NO;
 				DEBUG_INFORMATION_FORMAT = dwarf;
 				DYLIB_COMPATIBILITY_VERSION = 1.0;
@@ -719,7 +721,7 @@
 					"/usr/local/Qt-5.3.0/plugins/imageformats",
 				);
 				MACOSX_DEPLOYMENT_TARGET = 10.7;
-				OBJROOT = ../Mac/DebugIntermediateLang/;
+				OBJROOT = ./../Mac/DebugIntermediateLang;
 				ONLY_ACTIVE_ARCH = YES;
 				OTHER_CFLAGS = (
 					"-pipe",
@@ -756,7 +758,7 @@
 				PRODUCT_NAME = MetaLang;
 				QT_LIBRARY_SUFFIX = _debug;
 				SDKROOT = macosx;
-				SYMROOT = ../Mac/DebugLang;
+				SYMROOT = ./../Mac;
 			};
 			name = Debug;
 		};
@@ -764,7 +766,6 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				COMBINE_HIDPI_IMAGES = YES;
-				CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)Lang$(EFFECTIVE_PLATFORM_NAME)";
 				COPY_PHASE_STRIP = YES;
 				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
 				HEADER_SEARCH_PATHS = (
@@ -779,11 +780,9 @@
 					"/usr/local/Qt-5.3.0/mkspecs/macx-clang",
 				);
 				INSTALL_DIR = ../Mac/ReleaseLang/;
-				OBJROOT = ../Mac/ReleaseIntermediateLang;
 				PRODUCT_NAME = MetaLang;
 				QT_LIBRARY_SUFFIX = "";
 				SDKROOT = macosx;
-				SYMROOT = ./../Mac;
 			};
 			name = Release;
 		};
@@ -791,7 +790,6 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				COMBINE_HIDPI_IMAGES = YES;
-				CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)Lang$(EFFECTIVE_PLATFORM_NAME)";
 				COPY_PHASE_STRIP = NO;
 				DEBUG_INFORMATION_FORMAT = dwarf;
 				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
@@ -808,11 +806,9 @@
 					"/usr/local/Qt-5.3.0/mkspecs/macx-clang",
 				);
 				INSTALL_DIR = ../Mac/DebugLang/;
-				OBJROOT = ../Mac/DebugIntermediateLang;
 				PRODUCT_NAME = MetaLang;
 				QT_LIBRARY_SUFFIX = _debug;
 				SDKROOT = macosx;
-				SYMROOT = ./../Mac;
 			};
 			name = Debug;
 		};
diff --git a/Telegram/MetaStyle.xcodeproj/project.pbxproj b/Telegram/MetaStyle.xcodeproj/project.pbxproj
index 71438b9d9..83f857ccb 100644
--- a/Telegram/MetaStyle.xcodeproj/project.pbxproj
+++ b/Telegram/MetaStyle.xcodeproj/project.pbxproj
@@ -519,6 +519,7 @@
 		6DB9C3763D02B1415CD9D565 /* Project object */ = {
 			isa = PBXProject;
 			attributes = {
+				LastUpgradeCheck = 0510;
 			};
 			buildConfigurationList = DAC4C1AA5EDEA1C85E9CA5E6 /* Build configuration list for PBXProject "MetaStyle" */;
 			compatibilityVersion = "Xcode 3.2";
@@ -591,14 +592,26 @@
 		339EE1B2CC4FC24589A0EA95 /* Release */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
-				ARCHS = x86_64;
 				CC = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang;
+				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_EMPTY_BODY = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)Style$(EFFECTIVE_PLATFORM_NAME)";
 				COPY_PHASE_STRIP = YES;
 				DYLIB_COMPATIBILITY_VERSION = 1.0;
 				DYLIB_CURRENT_VERSION = 1.0.0;
 				FRAMEWORK_SEARCH_PATHS = "";
 				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
 				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES;
+				GCC_WARN_UNUSED_FUNCTION = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
 				HEADER_SEARCH_PATHS = (
 					../../Libraries/QtStatic/qtbase/include/QtGui/5.3.0/QtGui,
 					../../Libraries/QtStatic/qtbase/include/QtCore/5.3.0/QtCore,
@@ -621,7 +634,7 @@
 					"/usr/local/Qt-5.3.0/plugins/imageformats",
 				);
 				MACOSX_DEPLOYMENT_TARGET = 10.7;
-				OBJROOT = ../Mac/DebugIntermediateStyle/;
+				OBJROOT = ./../Mac/ReleaseIntermediateStyle;
 				OTHER_CFLAGS = (
 					"-pipe",
 					"-g",
@@ -657,15 +670,21 @@
 				PRODUCT_NAME = MetaStyle;
 				QT_LIBRARY_SUFFIX = "";
 				SDKROOT = macosx;
-				SYMROOT = ../Mac/ReleaseStyle;
+				SYMROOT = ./../Mac;
 			};
 			name = Release;
 		};
 		3AA6C32AC930069E80220CF1 /* Debug */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
-				ARCHS = x86_64;
 				CC = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang;
+				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_EMPTY_BODY = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)Style$(EFFECTIVE_PLATFORM_NAME)";
 				COPY_PHASE_STRIP = NO;
 				DEBUG_INFORMATION_FORMAT = dwarf;
 				DYLIB_COMPATIBILITY_VERSION = 1.0;
@@ -674,6 +693,12 @@
 				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
 				GCC_OPTIMIZATION_LEVEL = 0;
 				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES;
+				GCC_WARN_UNUSED_FUNCTION = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
 				HEADER_SEARCH_PATHS = (
 					../../Libraries/QtStatic/qtbase/include/QtGui/5.3.0/QtGui,
 					../../Libraries/QtStatic/qtbase/include/QtCore/5.3.0/QtCore,
@@ -696,7 +721,8 @@
 					"/usr/local/Qt-5.3.0/plugins/imageformats",
 				);
 				MACOSX_DEPLOYMENT_TARGET = 10.7;
-				OBJROOT = ../Mac/DebugIntermediateStyle/;
+				OBJROOT = ./../Mac/DebugIntermediateStyle;
+				ONLY_ACTIVE_ARCH = YES;
 				OTHER_CFLAGS = (
 					"-pipe",
 					"-g",
@@ -732,14 +758,14 @@
 				PRODUCT_NAME = MetaStyle;
 				QT_LIBRARY_SUFFIX = _debug;
 				SDKROOT = macosx;
-				SYMROOT = ../Mac/DebugStyle;
+				SYMROOT = ./../Mac;
 			};
 			name = Debug;
 		};
 		6666AA5E688052234F6758D8 /* Release */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
-				CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)Style$(EFFECTIVE_PLATFORM_NAME)";
+				COMBINE_HIDPI_IMAGES = YES;
 				COPY_PHASE_STRIP = YES;
 				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
 				HEADER_SEARCH_PATHS = (
@@ -754,18 +780,16 @@
 					"/usr/local/Qt-5.3.0/mkspecs/macx-clang",
 				);
 				INSTALL_DIR = ./../Mac/ReleaseStyle/;
-				OBJROOT = ./../Mac/ReleaseIntermediateStyle;
 				PRODUCT_NAME = MetaStyle;
 				QT_LIBRARY_SUFFIX = "";
 				SDKROOT = macosx;
-				SYMROOT = ./../Mac;
 			};
 			name = Release;
 		};
 		77418F46922677BB04ED38DD /* Debug */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
-				CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)Style$(EFFECTIVE_PLATFORM_NAME)";
+				COMBINE_HIDPI_IMAGES = YES;
 				COPY_PHASE_STRIP = NO;
 				DEBUG_INFORMATION_FORMAT = dwarf;
 				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
@@ -782,11 +806,9 @@
 					"/usr/local/Qt-5.3.0/mkspecs/macx-clang",
 				);
 				INSTALL_DIR = ./../Mac/DebugStyle/;
-				OBJROOT = ./../Mac/DebugIntermediateStyle;
 				PRODUCT_NAME = MetaStyle;
 				QT_LIBRARY_SUFFIX = _debug;
 				SDKROOT = macosx;
-				SYMROOT = ./../Mac;
 			};
 			name = Debug;
 		};
diff --git a/Telegram/SourceFiles/_other/Style.plist b/Telegram/Packer.plist
similarity index 73%
rename from Telegram/SourceFiles/_other/Style.plist
rename to Telegram/Packer.plist
index 2df9c0113..f1583971a 100644
--- a/Telegram/SourceFiles/_other/Style.plist
+++ b/Telegram/Packer.plist
@@ -2,21 +2,21 @@
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
 <dict>
-	<key>NSPrincipalClass</key>
-	<string>NSApplication</string>
+	<key>CFBundleExecutable</key>
+	<string>Packer</string>
+	<key>CFBundleGetInfoString</key>
+	<string>Update packer utility for tdesktop</string>
 	<key>CFBundleIconFile</key>
 	<string></string>
+	<key>CFBundleIdentifier</key>
+	<string>com.ddesktop.${PRODUCT_NAME:rfc1034identifier}</string>
 	<key>CFBundlePackageType</key>
 	<string>APPL</string>
-	<key>CFBundleGetInfoString</key>
-	<string>Created by Qt/QMake</string>
 	<key>CFBundleSignature</key>
 	<string>????</string>
-	<key>CFBundleExecutable</key>
-	<string>MetaStyle</string>
-	<key>CFBundleIdentifier</key>
-	<string>com.yourcompany.${PRODUCT_NAME:rfc1034identifier}</string>
 	<key>NOTE</key>
-	<string>This file was generated by Qt/QMake.</string>
+	<string></string>
+	<key>NSPrincipalClass</key>
+	<string>NSApplication</string>
 </dict>
 </plist>
diff --git a/Telegram/Packer.pro b/Telegram/Packer.pro
new file mode 100644
index 000000000..4fb98d457
--- /dev/null
+++ b/Telegram/Packer.pro
@@ -0,0 +1,32 @@
+QT += core 
+
+CONFIG(debug, debug|release) {
+    DEFINES += _DEBUG
+    OBJECTS_DIR = ./../Mac/DebugIntermediatePacker
+    MOC_DIR = ./GeneratedFiles/Debug
+    DESTDIR = ./../Mac/DebugPacker
+}
+CONFIG(release, debug|release) {
+    OBJECTS_DIR = ./../Mac/ReleaseIntermediatePacker
+    MOC_DIR = ./GeneratedFiles/Release
+    DESTDIR = ./../Mac/ReleasePacker
+}
+
+macx {
+    QMAKE_INFO_PLIST = ./SourceFiles/_other/Packer.plist
+    QMAKE_LFLAGS += -framework Cocoa
+}
+
+SOURCES += \
+    ./SourceFiles/_other/packer.cpp \
+
+HEADERS += \
+    ./SourceFiles/_other/packer.h \
+
+INCLUDEPATH += ./../../Libraries/QtStatic/qtbase/include/QtGui/5.3.0/QtGui\
+               ./../../Libraries/QtStatic/qtbase/include/QtCore/5.3.0/QtCore\
+               ./../../Libraries/QtStatic/qtbase/include\
+               ./../../Libraries/lzma/C
+
+LIBS += -lcrypto -lssl -lz
+
diff --git a/Telegram/Packer.xcodeproj/project.pbxproj b/Telegram/Packer.xcodeproj/project.pbxproj
new file mode 100644
index 000000000..4ae0e10f9
--- /dev/null
+++ b/Telegram/Packer.xcodeproj/project.pbxproj
@@ -0,0 +1,823 @@
+// !$*UTF8*$!
+{
+	archiveVersion = 1;
+	classes = {
+	};
+	objectVersion = 46;
+	objects = {
+
+/* Begin PBXAggregateTarget section */
+		6E977D353048DB44129F752B /* Preprocess */ = {
+			isa = PBXAggregateTarget;
+			buildConfigurationList = 6CC3B5D2136C7CD6A5CF5A59 /* Build configuration list for PBXNativeTarget "Packer" */;
+			buildPhases = (
+				7EF0942E79C014DCEC8976BC /* Qt Preprocessors */,
+			);
+			dependencies = (
+			);
+			name = Preprocess;
+			productName = "Qt Preprocess";
+		};
+/* End PBXAggregateTarget section */
+
+/* Begin PBXBuildFile section */
+		1A681B886F50EE30FBE62B4B /* Qt5PrintSupport in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = DBF506D10449BFABD45B82DA /* Qt5PrintSupport */; };
+		1BB705CDB741E2B7450201A5 /* Cocoa.framework in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = AEA456A2F75ED9F5CDA7BCBE /* Cocoa.framework */; };
+		328FD74542F6E2C873EE4D4B /* ApplicationServices.framework in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = DFD7912080BC557230093752 /* ApplicationServices.framework */; };
+		496FD9CEEB508016AFB9F928 /* qico in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = 8F500B5166907B6D9A7C3E3D /* qico */; };
+		52B661A713AE959F9084E291 /* packer_plugin_import.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = CB20BF73330AAF80B8BC8907 /* packer_plugin_import.cpp */; settings = {ATTRIBUTES = (); }; };
+		59789101736112A570B8EFE6 /* qjp2 in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = F0681BC551FC8A2B132FC646 /* qjp2 */; };
+		668DDDA0C55405E7FCFD6CA5 /* CoreServices.framework in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = 9742F24EE18EA44D52824F1E /* CoreServices.framework */; };
+		7CA5405B8503BFFC60932D2B /* qicns in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = 31120EDB269DFF13E1D49847 /* qicns */; };
+		7F76437B577F737145996DC3 /* qtga in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = DCEFD9167C239650120B0145 /* qtga */; };
+		8771A8C96E9C391044035D99 /* OpenGL.framework in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = D4B32C2222F82AC56BADEB21 /* OpenGL.framework */; };
+		8D267F2E4776F0ECA2F49DC8 /* IOKit.framework in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = A1A67BEAA744704B29168D39 /* IOKit.framework */; };
+		8D33FE22B9BBADC7FA46C15B /* qtharfbuzzng in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = D6193B79CECC9DD0142D1200 /* qtharfbuzzng */; };
+		9F33AC0693BC81B27D8F518D /* Qt5Gui in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = 04391BE7A8B9D811E255100A /* Qt5Gui */; };
+		A3F8F2284013928A02AE5C38 /* qwbmp in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = 8CF51323544B886B8F4A2232 /* qwbmp */; };
+		A9563D9C9FD0D76FAAF1CA96 /* qdds in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = D3D1BE0BEA3AEE0551AD39AC /* qdds */; };
+		B9ADD90C014EA3FBE351DF03 /* Qt5Core in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = 5A80A1907B6CFFB524C1E57D /* Qt5Core */; };
+		BE6AB9DF1C4880624131C669 /* Qt5Widgets in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = 4689C06178B60B84E7F3A3B7 /* Qt5Widgets */; };
+		C06DDE378A7AC1FA9E6FF69A /* qtiff in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = F2453BA07315EB9F34F1CD57 /* qtiff */; };
+		D1FA8AF31837B51C762A9D4D /* qcocoa in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = D53D8E6A188E05078A114294 /* qcocoa */; };
+		D22929A2B8C5281567FCACDC /* Qt5PlatformSupport in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = E7B2F248E3F7970788F35BF5 /* Qt5PlatformSupport */; };
+		E45E51A644D5FC9F942ECE55 /* AGL.framework in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = 8D9815BDB5BD9F90D2BC05C5 /* AGL.framework */; };
+		EAA05789DF6EBAD24D3EFF96 /* packer.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = E3790AE49DBDB3F5EFA42FE1 /* packer.cpp */; settings = {ATTRIBUTES = (); }; };
+		F26454630C80841CBDCFE1CA /* Foundation.framework in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = FCC237CA5AD60B9BA4447615 /* Foundation.framework */; };
+		F4D3747C3A03B25EDC9057BB /* qwebp in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = ADC6308023253CEA51F86E21 /* qwebp */; };
+		F8B465CE34D8DF87AAE95913 /* CoreFoundation.framework in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = 4D765E1B1EA6C757220C63E7 /* CoreFoundation.framework */; };
+		F8ED42CF8679BF83227DAFC4 /* Carbon.framework in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = 9DFF62A901D70814B8A323D4 /* Carbon.framework */; };
+		FBD56E2AC34F76BFFDB68619 /* qmng in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = 83D37373949868693FB7816D /* qmng */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+		072AB35C1955F39D00328D9B /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 6DB9C3763D02B1415CD9D565 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 6E977D353048DB44129F752B;
+			remoteInfo = "Qt Preprocess";
+		};
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXFileReference section */
+		04391BE7A8B9D811E255100A /* Qt5Gui */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = Qt5Gui; path = "/usr/local/Qt-5.3.0/lib/libQt5Gui$(QT_LIBRARY_SUFFIX).a"; sourceTree = "<absolute>"; };
+		060A694B42A4555240009936 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtga.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtga.pri"; sourceTree = "<absolute>"; };
+		075EB50EB07CF69FD62FB8DF /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_sql_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_sql_private.pri"; sourceTree = "<absolute>"; };
+		0ABCEA8D0DD45589040B0AF2 /* /usr/local/Qt-5.3.0/mkspecs/common/unix.conf */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/common/unix.conf"; sourceTree = "<absolute>"; };
+		111BBEE3D1432C3B517FD539 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qdds.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qdds.pri"; sourceTree = "<absolute>"; };
+		16DD53E17C65AC8B450CC6C3 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_quick.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_quick.pri"; sourceTree = "<absolute>"; };
+		1FAE75C970AA73F2DEDDB508 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qavfcamera.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qavfcamera.pri"; sourceTree = "<absolute>"; };
+		23BC8B0FC3279421D41CA268 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_gui.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_gui.pri"; sourceTree = "<absolute>"; };
+		2440CD1D4CEF80443BCA1B8B /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qgenericbearer.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qgenericbearer.pri"; sourceTree = "<absolute>"; };
+		247D8DF3B1DDB665B80BBA25 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtaccessiblequick.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtaccessiblequick.pri"; sourceTree = "<absolute>"; };
+		24B6929EE3952310F2DAECB1 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtaudio_coreaudio.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtaudio_coreaudio.pri"; sourceTree = "<absolute>"; };
+		28BD0D10214709D95B161E24 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_multimediawidgets.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_multimediawidgets.pri"; sourceTree = "<absolute>"; };
+		293C8DEEE270847AC20E70F9 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_network.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_network.pri"; sourceTree = "<absolute>"; };
+		2E48BB382B895A5ACD79AF9F /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_bluetooth_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_bluetooth_private.pri"; sourceTree = "<absolute>"; };
+		2E6D9B1D2743D24E31B0B284 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_xmlpatterns.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_xmlpatterns.pri"; sourceTree = "<absolute>"; };
+		311004331A04F3D69C98643C /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_serialport_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_serialport_private.pri"; sourceTree = "<absolute>"; };
+		31120EDB269DFF13E1D49847 /* qicns */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = qicns; path = "/usr/local/Qt-5.3.0/plugins/imageformats/libqicns$(QT_LIBRARY_SUFFIX).a"; sourceTree = "<absolute>"; };
+		33F165B1DB8CBF182C56FAB5 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_macextras_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_macextras_private.pri"; sourceTree = "<absolute>"; };
+		346287C9E754E7C458153F03 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qwbmp.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qwbmp.pri"; sourceTree = "<absolute>"; };
+		360D4B3ED25D126430DE27D4 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_enginio.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_enginio.pri"; sourceTree = "<absolute>"; };
+		3685604BDB64DD6E92169B73 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qdeclarativeview.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qdeclarativeview.pri"; sourceTree = "<absolute>"; };
+		382E89A91A34F7898C25FD0D /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_network_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_network_private.pri"; sourceTree = "<absolute>"; };
+		3F08D430CEC8D2117735CCB4 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qmldbg_tcp_qtdeclarative.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qmldbg_tcp_qtdeclarative.pri"; sourceTree = "<absolute>"; };
+		45B95DB3B70B47A910FC847B /* /usr/local/Qt-5.3.0/mkspecs/common/gcc-base.conf */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/common/gcc-base.conf"; sourceTree = "<absolute>"; };
+		45DB132B756499D4DF38430E /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qjp2.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qjp2.pri"; sourceTree = "<absolute>"; };
+		4689C06178B60B84E7F3A3B7 /* Qt5Widgets */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = Qt5Widgets; path = "/usr/local/Qt-5.3.0/lib/libQt5Widgets$(QT_LIBRARY_SUFFIX).a"; sourceTree = "<absolute>"; };
+		4C6C71914B1926119120DACD /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_enginio_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_enginio_private.pri"; sourceTree = "<absolute>"; };
+		4D765E1B1EA6C757220C63E7 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = "<absolute>"; };
+		4FB6657DA22BC68B819B64B3 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_qmldevtools_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_qmldevtools_private.pri"; sourceTree = "<absolute>"; };
+		5520A59148EC5EC44EF0D3CD /* Packer.pro */ = {isa = PBXFileReference; lastKnownFileType = text; path = Packer.pro; sourceTree = "<absolute>"; };
+		5597304BEC94BFB9EAAEBC4B /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_openglextensions_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_openglextensions_private.pri"; sourceTree = "<absolute>"; };
+		5A80A1907B6CFFB524C1E57D /* Qt5Core */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = Qt5Core; path = "/usr/local/Qt-5.3.0/lib/libQt5Core$(QT_LIBRARY_SUFFIX).a"; sourceTree = "<absolute>"; };
+		5AA25EFD83BC060B26945285 /* packer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = packer.h; path = SourceFiles/_other/packer.h; sourceTree = "<absolute>"; };
+		5B22E9E4EE9AAE42ABC24AB3 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_qtmultimediaquicktools_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_qtmultimediaquicktools_private.pri"; sourceTree = "<absolute>"; };
+		5CEA7A2DB2136425A88D1254 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_opengl.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_opengl.pri"; sourceTree = "<absolute>"; };
+		5F781C7FD8422D359EA1D2FE /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_core_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_core_private.pri"; sourceTree = "<absolute>"; };
+		6102C69805B6398AF6FA5BEB /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_qml_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_qml_private.pri"; sourceTree = "<absolute>"; };
+		63E722139886C87BC82DBDF5 /* /usr/local/Qt-5.3.0/mkspecs/macx-clang/qmake.conf */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/macx-clang/qmake.conf"; sourceTree = "<absolute>"; };
+		669FB007C4A3D58424D85EC8 /* /usr/local/Qt-5.3.0/mkspecs/common/shell-unix.conf */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/common/shell-unix.conf"; sourceTree = "<absolute>"; };
+		69347C39E4D922E94D0860BF /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_designercomponents_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_designercomponents_private.pri"; sourceTree = "<absolute>"; };
+		6C08BFC27C4C303A3A5181DB /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_printsupport.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_printsupport.pri"; sourceTree = "<absolute>"; };
+		6E67D23B15FC4B628DB2E0B2 /* /usr/local/Qt-5.3.0/mkspecs/qdevice.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/qdevice.pri"; sourceTree = "<absolute>"; };
+		74C1C232DFAA71028A0412CA /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtmultimedia_m3u.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtmultimedia_m3u.pri"; sourceTree = "<absolute>"; };
+		77FF486B1F9BCD55A8A3F35D /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_concurrent.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_concurrent.pri"; sourceTree = "<absolute>"; };
+		7A94C7168B3FCBE5F04A013B /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_declarative.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_declarative.pri"; sourceTree = "<absolute>"; };
+		7C2F42B222EE88E26A6FED62 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_designer_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_designer_private.pri"; sourceTree = "<absolute>"; };
+		7D28E9003CE64D8A7F2E292E /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_concurrent_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_concurrent_private.pri"; sourceTree = "<absolute>"; };
+		7DE30A90667C03C4F91A2A91 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_sql.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_sql.pri"; sourceTree = "<absolute>"; };
+		7ECCC1F9442988B4F2707CC1 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_core.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_core.pri"; sourceTree = "<absolute>"; };
+		817A0F5A41B553A6DE67FDEB /* /usr/local/Qt-5.3.0/mkspecs/common/macx.conf */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/common/macx.conf"; sourceTree = "<absolute>"; };
+		82E7DCFD95559532D8FC6CDD /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_quickparticles_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_quickparticles_private.pri"; sourceTree = "<absolute>"; };
+		83D37373949868693FB7816D /* qmng */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = qmng; path = "/usr/local/Qt-5.3.0/plugins/imageformats/libqmng$(QT_LIBRARY_SUFFIX).a"; sourceTree = "<absolute>"; };
+		85061B1DA49D125991117950 /* /usr/local/Qt-5.3.0/mkspecs/macx-xcode/qmake.conf */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/macx-xcode/qmake.conf"; sourceTree = "<absolute>"; };
+		85B6936EDBE61D9BB8F8B33B /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_sensors.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_sensors.pri"; sourceTree = "<absolute>"; };
+		87A4C1983FD641360BF80A02 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtaccessiblewidgets.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtaccessiblewidgets.pri"; sourceTree = "<absolute>"; };
+		87EEF25EE25CF21572D1438C /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_websockets_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_websockets_private.pri"; sourceTree = "<absolute>"; };
+		8849E60AEC7DB97A475C17EA /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_testlib_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_testlib_private.pri"; sourceTree = "<absolute>"; };
+		892D36BEF797BA4AF48D378A /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtsensors_dummy.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtsensors_dummy.pri"; sourceTree = "<absolute>"; };
+		89863CCAF1D29037AE95755D /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_declarative_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_declarative_private.pri"; sourceTree = "<absolute>"; };
+		8A04A4A3625204D12A1207F6 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_nfc.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_nfc.pri"; sourceTree = "<absolute>"; };
+		8B4BB4E74F8A4442EF563D7D /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtsensorgestures_shakeplugin.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtsensorgestures_shakeplugin.pri"; sourceTree = "<absolute>"; };
+		8C31D89BDFCDF466DAED19A0 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_quick_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_quick_private.pri"; sourceTree = "<absolute>"; };
+		8C5164D4E37556D40C5E6AA2 /* /usr/local/Qt-5.3.0/mkspecs/common/clang.conf */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/common/clang.conf"; sourceTree = "<absolute>"; };
+		8CF51323544B886B8F4A2232 /* qwbmp */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = qwbmp; path = "/usr/local/Qt-5.3.0/plugins/imageformats/libqwbmp$(QT_LIBRARY_SUFFIX).a"; sourceTree = "<absolute>"; };
+		8D9815BDB5BD9F90D2BC05C5 /* AGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AGL.framework; path = /System/Library/Frameworks/AGL.framework; sourceTree = "<absolute>"; };
+		8DDE1D26B3206CDB8B57FABE /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_svg_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_svg_private.pri"; sourceTree = "<absolute>"; };
+		8E9136256AFFBA6EF048AA55 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_widgets_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_widgets_private.pri"; sourceTree = "<absolute>"; };
+		8F500B5166907B6D9A7C3E3D /* qico */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = qico; path = "/usr/local/Qt-5.3.0/plugins/imageformats/libqico$(QT_LIBRARY_SUFFIX).a"; sourceTree = "<absolute>"; };
+		8F572030CE9AB8CC5F672201 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_platformsupport_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_platformsupport_private.pri"; sourceTree = "<absolute>"; };
+		8F97C9CAE38CA3AFAC0B3953 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_websockets.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_websockets.pri"; sourceTree = "<absolute>"; };
+		946BEA667170DC1A7A8F9DB0 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qmng.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qmng.pri"; sourceTree = "<absolute>"; };
+		9742F24EE18EA44D52824F1E /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = /System/Library/Frameworks/CoreServices.framework; sourceTree = "<absolute>"; };
+		9A0BDF67E013BB4FFB8685B0 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qqt7engine.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qqt7engine.pri"; sourceTree = "<absolute>"; };
+		9DFF62A901D70814B8A323D4 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; };
+		A022AF919D1977534CA66BB8 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_widgets.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_widgets.pri"; sourceTree = "<absolute>"; };
+		A1A67BEAA744704B29168D39 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; sourceTree = "<absolute>"; };
+		A4D8AC60897F435C1C3B9D02 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtsensors_generic.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtsensors_generic.pri"; sourceTree = "<absolute>"; };
+		A5588D4B50885E2A9CAA5505 /* Packer.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Packer.app; sourceTree = BUILT_PRODUCTS_DIR; };
+		A59F74CD76FDC2B4B9910E18 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_scripttools_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_scripttools_private.pri"; sourceTree = "<absolute>"; };
+		A5B17ABEFBA1C2F43443D644 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_macextras.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_macextras.pri"; sourceTree = "<absolute>"; };
+		A9E30FA27827990C5F182223 /* /usr/local/Qt-5.3.0/mkspecs/common/gcc-base-mac.conf */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/common/gcc-base-mac.conf"; sourceTree = "<absolute>"; };
+		AA73DC3C2901E2979FE8AD5B /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_xml.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_xml.pri"; sourceTree = "<absolute>"; };
+		AB1C02DDBD8E88DD9A9AFDDD /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtsensorgestures_plugin.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtsensorgestures_plugin.pri"; sourceTree = "<absolute>"; };
+		AB745978DF0F41D1801ABDA6 /* .qmake.stash */ = {isa = PBXFileReference; lastKnownFileType = file; path = .qmake.stash; sourceTree = "<absolute>"; };
+		ABA9AB4619F09DCFD2D4A27F /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_qmltest_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_qmltest_private.pri"; sourceTree = "<absolute>"; };
+		ACC8A73268E5D9AF64E97AF4 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_bluetooth.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_bluetooth.pri"; sourceTree = "<absolute>"; };
+		ADC6308023253CEA51F86E21 /* qwebp */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = qwebp; path = "/usr/local/Qt-5.3.0/plugins/imageformats/libqwebp$(QT_LIBRARY_SUFFIX).a"; sourceTree = "<absolute>"; };
+		ADFC79902C14A612AE93A89A /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_svg.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_svg.pri"; sourceTree = "<absolute>"; };
+		AEA456A2F75ED9F5CDA7BCBE /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
+		AFD721AA33A2F785E77B1698 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qcocoa.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qcocoa.pri"; sourceTree = "<absolute>"; };
+		B064BF3B496A7BF7A449CA1E /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qsqlite.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qsqlite.pri"; sourceTree = "<absolute>"; };
+		B2246267D4C0D789259A86B0 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_quickwidgets_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_quickwidgets_private.pri"; sourceTree = "<absolute>"; };
+		B26239063A068F800A2C95F4 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qwebp.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qwebp.pri"; sourceTree = "<absolute>"; };
+		B382B645B34234E451AE5D94 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_qml.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_qml.pri"; sourceTree = "<absolute>"; };
+		B518DA4EE7376002AFC71FD5 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_uitools_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_uitools_private.pri"; sourceTree = "<absolute>"; };
+		B51B01657BFE9EAEF5590561 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_nfc_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_nfc_private.pri"; sourceTree = "<absolute>"; };
+		B678DA730B4ECE863AD631AE /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qminimal.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qminimal.pri"; sourceTree = "<absolute>"; };
+		B8525798C5AA7D7C6D68E1B3 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qmldbg_qtquick2.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qmldbg_qtquick2.pri"; sourceTree = "<absolute>"; };
+		B8C1F6C965A7A14FBA8D4518 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtmedia_audioengine.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtmedia_audioengine.pri"; sourceTree = "<absolute>"; };
+		BD22EFEFCC02644B1883CE19 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtiff.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtiff.pri"; sourceTree = "<absolute>"; };
+		BD4D97801B547471B37A4CDC /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_bootstrap_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_bootstrap_private.pri"; sourceTree = "<absolute>"; };
+		BDC9ECADEE40D11E3C2EA93F /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_sensors_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_sensors_private.pri"; sourceTree = "<absolute>"; };
+		BFF0C38FB0EC140C5F0304AE /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_serialport.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_serialport.pri"; sourceTree = "<absolute>"; };
+		C4295BE59CCEBCDD16268349 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qico.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qico.pri"; sourceTree = "<absolute>"; };
+		C505A18319B9B63C63877858 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_script_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_script_private.pri"; sourceTree = "<absolute>"; };
+		C84546C18DCBB04166195DCF /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtposition_positionpoll.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtposition_positionpoll.pri"; sourceTree = "<absolute>"; };
+		CB20BF73330AAF80B8BC8907 /* packer_plugin_import.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = packer_plugin_import.cpp; sourceTree = "<absolute>"; };
+		CCF75CFFB857487FB18F99F9 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qoffscreen.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qoffscreen.pri"; sourceTree = "<absolute>"; };
+		CE829DD126DD2B97E8D70A7A /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_scripttools.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_scripttools.pri"; sourceTree = "<absolute>"; };
+		CF86CD5BB01B9011E6B6FD3E /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_clucene_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_clucene_private.pri"; sourceTree = "<absolute>"; };
+		CFCB992BEC24B71BFB8A2F30 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_script.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_script.pri"; sourceTree = "<absolute>"; };
+		CFFBE05DB004895080314289 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qsvgicon.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qsvgicon.pri"; sourceTree = "<absolute>"; };
+		D0CDC87DAFDA7F18A7AF450F /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_printsupport_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_printsupport_private.pri"; sourceTree = "<absolute>"; };
+		D1FA7CAB5ACC09D563AE569F /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_multimediawidgets_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_multimediawidgets_private.pri"; sourceTree = "<absolute>"; };
+		D2FE4D909926A0D1656068C4 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_multimedia.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_multimedia.pri"; sourceTree = "<absolute>"; };
+		D3D1BE0BEA3AEE0551AD39AC /* qdds */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = qdds; path = "/usr/local/Qt-5.3.0/plugins/imageformats/libqdds$(QT_LIBRARY_SUFFIX).a"; sourceTree = "<absolute>"; };
+		D4B32C2222F82AC56BADEB21 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = "<absolute>"; };
+		D4DE537C1FBBD48BD989FAD1 /* /usr/local/Qt-5.3.0/mkspecs/qconfig.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/qconfig.pri"; sourceTree = "<absolute>"; };
+		D5141F795670589C8CC41CBC /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_cocoaprintersupport.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_cocoaprintersupport.pri"; sourceTree = "<absolute>"; };
+		D53D8E6A188E05078A114294 /* qcocoa */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = qcocoa; path = "/usr/local/Qt-5.3.0/plugins/platforms/libqcocoa$(QT_LIBRARY_SUFFIX).a"; sourceTree = "<absolute>"; };
+		D6193B79CECC9DD0142D1200 /* qtharfbuzzng */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = qtharfbuzzng; path = "/usr/local/Qt-5.3.0/lib/libqtharfbuzzng$(QT_LIBRARY_SUFFIX).a"; sourceTree = "<absolute>"; };
+		D7A0618DE39A427EBF41940E /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_help_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_help_private.pri"; sourceTree = "<absolute>"; };
+		D81E3D9A18202BE8EC3D0E2C /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_gui_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_gui_private.pri"; sourceTree = "<absolute>"; };
+		D948D4D8F949D45158F8DE35 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_quickwidgets.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_quickwidgets.pri"; sourceTree = "<absolute>"; };
+		DB0A26DDC377B2004F61BFE3 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_testlib.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_testlib.pri"; sourceTree = "<absolute>"; };
+		DBF506D10449BFABD45B82DA /* Qt5PrintSupport */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = Qt5PrintSupport; path = "/usr/local/Qt-5.3.0/lib/libQt5PrintSupport$(QT_LIBRARY_SUFFIX).a"; sourceTree = "<absolute>"; };
+		DCEFD9167C239650120B0145 /* qtga */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = qtga; path = "/usr/local/Qt-5.3.0/plugins/imageformats/libqtga$(QT_LIBRARY_SUFFIX).a"; sourceTree = "<absolute>"; };
+		DF8188E30892A4654B984221 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_qmltest.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_qmltest.pri"; sourceTree = "<absolute>"; };
+		DFD7912080BC557230093752 /* ApplicationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = /System/Library/Frameworks/ApplicationServices.framework; sourceTree = "<absolute>"; };
+		E0F4563EA350EB65112A0EF4 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_opengl_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_opengl_private.pri"; sourceTree = "<absolute>"; };
+		E37365B4489B4918BEBB707D /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_xml_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_xml_private.pri"; sourceTree = "<absolute>"; };
+		E3790AE49DBDB3F5EFA42FE1 /* packer.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = packer.cpp; path = SourceFiles/_other/packer.cpp; sourceTree = "<absolute>"; };
+		E432DA897A5F027987342E8F /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_openglextensions.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_openglextensions.pri"; sourceTree = "<absolute>"; };
+		E50FA73B8A23BC179A642B27 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_uitools.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_uitools.pri"; sourceTree = "<absolute>"; };
+		E66B9EC81C285CA9A7FB6A2E /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_positioning_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_positioning_private.pri"; sourceTree = "<absolute>"; };
+		E7B2F248E3F7970788F35BF5 /* Qt5PlatformSupport */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = Qt5PlatformSupport; path = "/usr/local/Qt-5.3.0/lib/libQt5PlatformSupport$(QT_LIBRARY_SUFFIX).a"; sourceTree = "<absolute>"; };
+		E7D67CB158408BB7DEA74764 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_multimedia_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_multimedia_private.pri"; sourceTree = "<absolute>"; };
+		EA5D4FF9DE4AC4215D7DCE0D /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qcorewlanbearer.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qcorewlanbearer.pri"; sourceTree = "<absolute>"; };
+		EB1F99FD112917157F3C3F6E /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qicns.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qicns.pri"; sourceTree = "<absolute>"; };
+		EB29AC635054C09EFA749AE1 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qmldbg_tcp.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qmldbg_tcp.pri"; sourceTree = "<absolute>"; };
+		EBD39B69F368CEEAC360A16D /* /usr/local/Qt-5.3.0/mkspecs/common/mac.conf */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/common/mac.conf"; sourceTree = "<absolute>"; };
+		F0681BC551FC8A2B132FC646 /* qjp2 */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = qjp2; path = "/usr/local/Qt-5.3.0/plugins/imageformats/libqjp2$(QT_LIBRARY_SUFFIX).a"; sourceTree = "<absolute>"; };
+		F0A58515945747E36783CC21 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qmldbg_inspector.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qmldbg_inspector.pri"; sourceTree = "<absolute>"; };
+		F2453BA07315EB9F34F1CD57 /* qtiff */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = qtiff; path = "/usr/local/Qt-5.3.0/plugins/imageformats/libqtiff$(QT_LIBRARY_SUFFIX).a"; sourceTree = "<absolute>"; };
+		F2F823087EA182CCBD5748B8 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_designer.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_designer.pri"; sourceTree = "<absolute>"; };
+		F33BE16353DD1557A9AB3558 /* /usr/local/Qt-5.3.0/mkspecs/common/clang-mac.conf */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/common/clang-mac.conf"; sourceTree = "<absolute>"; };
+		F4EB01857048DCFCFFAAC4D0 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qavfmediaplayer.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qavfmediaplayer.pri"; sourceTree = "<absolute>"; };
+		F7ADBF552F6B9A5982915164 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_positioning.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_positioning.pri"; sourceTree = "<absolute>"; };
+		F83F87F8A60C9DF666911D42 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qsvg.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qsvg.pri"; sourceTree = "<absolute>"; };
+		F9BEAA743A908603687DA204 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_xmlpatterns_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_xmlpatterns_private.pri"; sourceTree = "<absolute>"; };
+		FCC237CA5AD60B9BA4447615 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
+		FD944B80F033DFE737D401A2 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_help.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_help.pri"; sourceTree = "<absolute>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+		D1C883685E82D5676953459A /* Link Binary With Libraries */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				1BB705CDB741E2B7450201A5 /* Cocoa.framework in Link Binary With Libraries */,
+				328FD74542F6E2C873EE4D4B /* ApplicationServices.framework in Link Binary With Libraries */,
+				668DDDA0C55405E7FCFD6CA5 /* CoreServices.framework in Link Binary With Libraries */,
+				F8B465CE34D8DF87AAE95913 /* CoreFoundation.framework in Link Binary With Libraries */,
+				F26454630C80841CBDCFE1CA /* Foundation.framework in Link Binary With Libraries */,
+				8771A8C96E9C391044035D99 /* OpenGL.framework in Link Binary With Libraries */,
+				E45E51A644D5FC9F942ECE55 /* AGL.framework in Link Binary With Libraries */,
+				D1FA8AF31837B51C762A9D4D /* qcocoa in Link Binary With Libraries */,
+				F8ED42CF8679BF83227DAFC4 /* Carbon.framework in Link Binary With Libraries */,
+				8D267F2E4776F0ECA2F49DC8 /* IOKit.framework in Link Binary With Libraries */,
+				1A681B886F50EE30FBE62B4B /* Qt5PrintSupport in Link Binary With Libraries */,
+				D22929A2B8C5281567FCACDC /* Qt5PlatformSupport in Link Binary With Libraries */,
+				BE6AB9DF1C4880624131C669 /* Qt5Widgets in Link Binary With Libraries */,
+				A9563D9C9FD0D76FAAF1CA96 /* qdds in Link Binary With Libraries */,
+				7CA5405B8503BFFC60932D2B /* qicns in Link Binary With Libraries */,
+				496FD9CEEB508016AFB9F928 /* qico in Link Binary With Libraries */,
+				59789101736112A570B8EFE6 /* qjp2 in Link Binary With Libraries */,
+				FBD56E2AC34F76BFFDB68619 /* qmng in Link Binary With Libraries */,
+				7F76437B577F737145996DC3 /* qtga in Link Binary With Libraries */,
+				C06DDE378A7AC1FA9E6FF69A /* qtiff in Link Binary With Libraries */,
+				A3F8F2284013928A02AE5C38 /* qwbmp in Link Binary With Libraries */,
+				F4D3747C3A03B25EDC9057BB /* qwebp in Link Binary With Libraries */,
+				9F33AC0693BC81B27D8F518D /* Qt5Gui in Link Binary With Libraries */,
+				8D33FE22B9BBADC7FA46C15B /* qtharfbuzzng in Link Binary With Libraries */,
+				B9ADD90C014EA3FBE351DF03 /* Qt5Core in Link Binary With Libraries */,
+			);
+			name = "Link Binary With Libraries";
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+		2EB56BE3C2D93CDAB0C52E67 /* Sources */ = {
+			isa = PBXGroup;
+			children = (
+				73F2E45FDEB381A085D37A49 /* SourceFiles */,
+				CB20BF73330AAF80B8BC8907 /* packer_plugin_import.cpp */,
+			);
+			name = Sources;
+			sourceTree = "<Group>";
+		};
+		31562E815E3DF5B1A777D3EF /* _other */ = {
+			isa = PBXGroup;
+			children = (
+				E3790AE49DBDB3F5EFA42FE1 /* packer.cpp */,
+				5AA25EFD83BC060B26945285 /* packer.h */,
+			);
+			name = _other;
+			sourceTree = "<Group>";
+		};
+		73F2E45FDEB381A085D37A49 /* SourceFiles */ = {
+			isa = PBXGroup;
+			children = (
+				31562E815E3DF5B1A777D3EF /* _other */,
+			);
+			name = SourceFiles;
+			sourceTree = "<Group>";
+		};
+		74B182DB50CB5611B5C1C297 /* Supporting Files */ = {
+			isa = PBXGroup;
+			children = (
+				5520A59148EC5EC44EF0D3CD /* Packer.pro */,
+				6E67D23B15FC4B628DB2E0B2 /* /usr/local/Qt-5.3.0/mkspecs/qdevice.pri */,
+				669FB007C4A3D58424D85EC8 /* /usr/local/Qt-5.3.0/mkspecs/common/shell-unix.conf */,
+				0ABCEA8D0DD45589040B0AF2 /* /usr/local/Qt-5.3.0/mkspecs/common/unix.conf */,
+				EBD39B69F368CEEAC360A16D /* /usr/local/Qt-5.3.0/mkspecs/common/mac.conf */,
+				817A0F5A41B553A6DE67FDEB /* /usr/local/Qt-5.3.0/mkspecs/common/macx.conf */,
+				45B95DB3B70B47A910FC847B /* /usr/local/Qt-5.3.0/mkspecs/common/gcc-base.conf */,
+				A9E30FA27827990C5F182223 /* /usr/local/Qt-5.3.0/mkspecs/common/gcc-base-mac.conf */,
+				8C5164D4E37556D40C5E6AA2 /* /usr/local/Qt-5.3.0/mkspecs/common/clang.conf */,
+				F33BE16353DD1557A9AB3558 /* /usr/local/Qt-5.3.0/mkspecs/common/clang-mac.conf */,
+				D4DE537C1FBBD48BD989FAD1 /* /usr/local/Qt-5.3.0/mkspecs/qconfig.pri */,
+				ACC8A73268E5D9AF64E97AF4 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_bluetooth.pri */,
+				2E48BB382B895A5ACD79AF9F /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_bluetooth_private.pri */,
+				BD4D97801B547471B37A4CDC /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_bootstrap_private.pri */,
+				CF86CD5BB01B9011E6B6FD3E /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_clucene_private.pri */,
+				77FF486B1F9BCD55A8A3F35D /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_concurrent.pri */,
+				7D28E9003CE64D8A7F2E292E /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_concurrent_private.pri */,
+				7ECCC1F9442988B4F2707CC1 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_core.pri */,
+				5F781C7FD8422D359EA1D2FE /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_core_private.pri */,
+				7A94C7168B3FCBE5F04A013B /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_declarative.pri */,
+				89863CCAF1D29037AE95755D /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_declarative_private.pri */,
+				F2F823087EA182CCBD5748B8 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_designer.pri */,
+				7C2F42B222EE88E26A6FED62 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_designer_private.pri */,
+				69347C39E4D922E94D0860BF /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_designercomponents_private.pri */,
+				360D4B3ED25D126430DE27D4 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_enginio.pri */,
+				4C6C71914B1926119120DACD /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_enginio_private.pri */,
+				23BC8B0FC3279421D41CA268 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_gui.pri */,
+				D81E3D9A18202BE8EC3D0E2C /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_gui_private.pri */,
+				FD944B80F033DFE737D401A2 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_help.pri */,
+				D7A0618DE39A427EBF41940E /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_help_private.pri */,
+				A5B17ABEFBA1C2F43443D644 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_macextras.pri */,
+				33F165B1DB8CBF182C56FAB5 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_macextras_private.pri */,
+				D2FE4D909926A0D1656068C4 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_multimedia.pri */,
+				E7D67CB158408BB7DEA74764 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_multimedia_private.pri */,
+				28BD0D10214709D95B161E24 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_multimediawidgets.pri */,
+				D1FA7CAB5ACC09D563AE569F /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_multimediawidgets_private.pri */,
+				293C8DEEE270847AC20E70F9 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_network.pri */,
+				382E89A91A34F7898C25FD0D /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_network_private.pri */,
+				8A04A4A3625204D12A1207F6 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_nfc.pri */,
+				B51B01657BFE9EAEF5590561 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_nfc_private.pri */,
+				5CEA7A2DB2136425A88D1254 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_opengl.pri */,
+				E0F4563EA350EB65112A0EF4 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_opengl_private.pri */,
+				E432DA897A5F027987342E8F /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_openglextensions.pri */,
+				5597304BEC94BFB9EAAEBC4B /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_openglextensions_private.pri */,
+				8F572030CE9AB8CC5F672201 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_platformsupport_private.pri */,
+				F7ADBF552F6B9A5982915164 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_positioning.pri */,
+				E66B9EC81C285CA9A7FB6A2E /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_positioning_private.pri */,
+				6C08BFC27C4C303A3A5181DB /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_printsupport.pri */,
+				D0CDC87DAFDA7F18A7AF450F /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_printsupport_private.pri */,
+				B382B645B34234E451AE5D94 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_qml.pri */,
+				6102C69805B6398AF6FA5BEB /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_qml_private.pri */,
+				4FB6657DA22BC68B819B64B3 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_qmldevtools_private.pri */,
+				DF8188E30892A4654B984221 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_qmltest.pri */,
+				ABA9AB4619F09DCFD2D4A27F /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_qmltest_private.pri */,
+				5B22E9E4EE9AAE42ABC24AB3 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_qtmultimediaquicktools_private.pri */,
+				16DD53E17C65AC8B450CC6C3 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_quick.pri */,
+				8C31D89BDFCDF466DAED19A0 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_quick_private.pri */,
+				82E7DCFD95559532D8FC6CDD /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_quickparticles_private.pri */,
+				D948D4D8F949D45158F8DE35 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_quickwidgets.pri */,
+				B2246267D4C0D789259A86B0 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_quickwidgets_private.pri */,
+				CFCB992BEC24B71BFB8A2F30 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_script.pri */,
+				C505A18319B9B63C63877858 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_script_private.pri */,
+				CE829DD126DD2B97E8D70A7A /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_scripttools.pri */,
+				A59F74CD76FDC2B4B9910E18 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_scripttools_private.pri */,
+				85B6936EDBE61D9BB8F8B33B /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_sensors.pri */,
+				BDC9ECADEE40D11E3C2EA93F /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_sensors_private.pri */,
+				BFF0C38FB0EC140C5F0304AE /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_serialport.pri */,
+				311004331A04F3D69C98643C /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_serialport_private.pri */,
+				7DE30A90667C03C4F91A2A91 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_sql.pri */,
+				075EB50EB07CF69FD62FB8DF /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_sql_private.pri */,
+				ADFC79902C14A612AE93A89A /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_svg.pri */,
+				8DDE1D26B3206CDB8B57FABE /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_svg_private.pri */,
+				DB0A26DDC377B2004F61BFE3 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_testlib.pri */,
+				8849E60AEC7DB97A475C17EA /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_testlib_private.pri */,
+				E50FA73B8A23BC179A642B27 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_uitools.pri */,
+				B518DA4EE7376002AFC71FD5 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_uitools_private.pri */,
+				8F97C9CAE38CA3AFAC0B3953 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_websockets.pri */,
+				87EEF25EE25CF21572D1438C /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_websockets_private.pri */,
+				A022AF919D1977534CA66BB8 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_widgets.pri */,
+				8E9136256AFFBA6EF048AA55 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_widgets_private.pri */,
+				AA73DC3C2901E2979FE8AD5B /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_xml.pri */,
+				E37365B4489B4918BEBB707D /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_xml_private.pri */,
+				2E6D9B1D2743D24E31B0B284 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_xmlpatterns.pri */,
+				F9BEAA743A908603687DA204 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_xmlpatterns_private.pri */,
+				D5141F795670589C8CC41CBC /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_cocoaprintersupport.pri */,
+				1FAE75C970AA73F2DEDDB508 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qavfcamera.pri */,
+				F4EB01857048DCFCFFAAC4D0 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qavfmediaplayer.pri */,
+				AFD721AA33A2F785E77B1698 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qcocoa.pri */,
+				EA5D4FF9DE4AC4215D7DCE0D /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qcorewlanbearer.pri */,
+				111BBEE3D1432C3B517FD539 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qdds.pri */,
+				3685604BDB64DD6E92169B73 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qdeclarativeview.pri */,
+				2440CD1D4CEF80443BCA1B8B /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qgenericbearer.pri */,
+				EB1F99FD112917157F3C3F6E /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qicns.pri */,
+				C4295BE59CCEBCDD16268349 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qico.pri */,
+				45DB132B756499D4DF38430E /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qjp2.pri */,
+				B678DA730B4ECE863AD631AE /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qminimal.pri */,
+				F0A58515945747E36783CC21 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qmldbg_inspector.pri */,
+				B8525798C5AA7D7C6D68E1B3 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qmldbg_qtquick2.pri */,
+				EB29AC635054C09EFA749AE1 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qmldbg_tcp.pri */,
+				3F08D430CEC8D2117735CCB4 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qmldbg_tcp_qtdeclarative.pri */,
+				946BEA667170DC1A7A8F9DB0 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qmng.pri */,
+				CCF75CFFB857487FB18F99F9 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qoffscreen.pri */,
+				9A0BDF67E013BB4FFB8685B0 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qqt7engine.pri */,
+				B064BF3B496A7BF7A449CA1E /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qsqlite.pri */,
+				F83F87F8A60C9DF666911D42 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qsvg.pri */,
+				CFFBE05DB004895080314289 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qsvgicon.pri */,
+				247D8DF3B1DDB665B80BBA25 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtaccessiblequick.pri */,
+				87A4C1983FD641360BF80A02 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtaccessiblewidgets.pri */,
+				24B6929EE3952310F2DAECB1 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtaudio_coreaudio.pri */,
+				060A694B42A4555240009936 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtga.pri */,
+				BD22EFEFCC02644B1883CE19 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtiff.pri */,
+				B8C1F6C965A7A14FBA8D4518 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtmedia_audioengine.pri */,
+				74C1C232DFAA71028A0412CA /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtmultimedia_m3u.pri */,
+				C84546C18DCBB04166195DCF /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtposition_positionpoll.pri */,
+				AB1C02DDBD8E88DD9A9AFDDD /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtsensorgestures_plugin.pri */,
+				8B4BB4E74F8A4442EF563D7D /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtsensorgestures_shakeplugin.pri */,
+				892D36BEF797BA4AF48D378A /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtsensors_dummy.pri */,
+				A4D8AC60897F435C1C3B9D02 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtsensors_generic.pri */,
+				346287C9E754E7C458153F03 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qwbmp.pri */,
+				B26239063A068F800A2C95F4 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qwebp.pri */,
+				63E722139886C87BC82DBDF5 /* /usr/local/Qt-5.3.0/mkspecs/macx-clang/qmake.conf */,
+				85061B1DA49D125991117950 /* /usr/local/Qt-5.3.0/mkspecs/macx-xcode/qmake.conf */,
+				AB745978DF0F41D1801ABDA6 /* .qmake.stash */,
+			);
+			name = "Supporting Files";
+			sourceTree = "<Group>";
+		};
+		AF39DD055C3EF8226FBE929D /* Frameworks */ = {
+			isa = PBXGroup;
+			children = (
+				AEA456A2F75ED9F5CDA7BCBE /* Cocoa.framework */,
+				DFD7912080BC557230093752 /* ApplicationServices.framework */,
+				9742F24EE18EA44D52824F1E /* CoreServices.framework */,
+				4D765E1B1EA6C757220C63E7 /* CoreFoundation.framework */,
+				FCC237CA5AD60B9BA4447615 /* Foundation.framework */,
+				D4B32C2222F82AC56BADEB21 /* OpenGL.framework */,
+				8D9815BDB5BD9F90D2BC05C5 /* AGL.framework */,
+				D53D8E6A188E05078A114294 /* qcocoa */,
+				9DFF62A901D70814B8A323D4 /* Carbon.framework */,
+				A1A67BEAA744704B29168D39 /* IOKit.framework */,
+				DBF506D10449BFABD45B82DA /* Qt5PrintSupport */,
+				E7B2F248E3F7970788F35BF5 /* Qt5PlatformSupport */,
+				4689C06178B60B84E7F3A3B7 /* Qt5Widgets */,
+				D3D1BE0BEA3AEE0551AD39AC /* qdds */,
+				31120EDB269DFF13E1D49847 /* qicns */,
+				8F500B5166907B6D9A7C3E3D /* qico */,
+				F0681BC551FC8A2B132FC646 /* qjp2 */,
+				83D37373949868693FB7816D /* qmng */,
+				DCEFD9167C239650120B0145 /* qtga */,
+				F2453BA07315EB9F34F1CD57 /* qtiff */,
+				8CF51323544B886B8F4A2232 /* qwbmp */,
+				ADC6308023253CEA51F86E21 /* qwebp */,
+				04391BE7A8B9D811E255100A /* Qt5Gui */,
+				D6193B79CECC9DD0142D1200 /* qtharfbuzzng */,
+				5A80A1907B6CFFB524C1E57D /* Qt5Core */,
+			);
+			name = Frameworks;
+			sourceTree = "<Group>";
+		};
+		E8C543AB96796ECAA2E65C57 /* Packer */ = {
+			isa = PBXGroup;
+			children = (
+				2EB56BE3C2D93CDAB0C52E67 /* Sources */,
+				74B182DB50CB5611B5C1C297 /* Supporting Files */,
+				AF39DD055C3EF8226FBE929D /* Frameworks */,
+				FE0A091FDBFB3E9C31B7A1BD /* Products */,
+			);
+			name = Packer;
+			sourceTree = "<Group>";
+		};
+		FE0A091FDBFB3E9C31B7A1BD /* Products */ = {
+			isa = PBXGroup;
+			children = (
+				A5588D4B50885E2A9CAA5505 /* Packer.app */,
+			);
+			name = Products;
+			sourceTree = "<Group>";
+		};
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+		FD92333211119EF3CA40F70D /* Packer */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 6CC3B5D2136C7CD6A5CF5A59 /* Build configuration list for PBXNativeTarget "Packer" */;
+			buildPhases = (
+				F7E50F631C51CD5B5DC0BC43 /* Compile Sources */,
+				D1C883685E82D5676953459A /* Link Binary With Libraries */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+				A7CD3B627B093BF0A5BBA9AE /* PBXTargetDependency */,
+			);
+			name = Packer;
+			productInstallPath = ../Mac/DebugPacker/;
+			productName = Packer;
+			productReference = A5588D4B50885E2A9CAA5505 /* Packer.app */;
+			productType = "com.apple.product-type.application";
+		};
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+		6DB9C3763D02B1415CD9D565 /* Project object */ = {
+			isa = PBXProject;
+			attributes = {
+				LastUpgradeCheck = 0510;
+			};
+			buildConfigurationList = DAC4C1AA5EDEA1C85E9CA5E6 /* Build configuration list for PBXProject "Packer" */;
+			compatibilityVersion = "Xcode 3.2";
+			developmentRegion = English;
+			hasScannedForEncodings = 1;
+			knownRegions = (
+				en,
+			);
+			mainGroup = E8C543AB96796ECAA2E65C57 /* Packer */;
+			productRefGroup = FE0A091FDBFB3E9C31B7A1BD /* Products */;
+			projectDirPath = "";
+			projectRoot = "";
+			targets = (
+				FD92333211119EF3CA40F70D /* Packer */,
+				6E977D353048DB44129F752B /* Preprocess */,
+			);
+		};
+/* End PBXProject section */
+
+/* Begin PBXShellScriptBuildPhase section */
+		7EF0942E79C014DCEC8976BC /* Qt Preprocessors */ = {
+			isa = PBXShellScriptBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			name = "Qt Preprocessors";
+			runOnlyForDeploymentPostprocessing = 0;
+			shellPath = /bin/sh;
+			shellScript = "make -C . -f Packer.xcodeproj/qt_preprocess.mak";
+		};
+/* End PBXShellScriptBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+		F7E50F631C51CD5B5DC0BC43 /* Compile Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				EAA05789DF6EBAD24D3EFF96 /* packer.cpp in Compile Sources */,
+				52B661A713AE959F9084E291 /* packer_plugin_import.cpp in Compile Sources */,
+			);
+			name = "Compile Sources";
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXTargetDependency section */
+		A7CD3B627B093BF0A5BBA9AE /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 6E977D353048DB44129F752B /* Preprocess */;
+			targetProxy = 072AB35C1955F39D00328D9B /* PBXContainerItemProxy */;
+		};
+/* End PBXTargetDependency section */
+
+/* Begin XCBuildConfiguration section */
+		339EE1B2CC4FC24589A0EA95 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				CC = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang;
+				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_EMPTY_BODY = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				COPY_PHASE_STRIP = YES;
+				DYLIB_COMPATIBILITY_VERSION = 1.0;
+				DYLIB_CURRENT_VERSION = 1.0.0;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES;
+				GCC_WARN_UNUSED_FUNCTION = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				HEADER_SEARCH_PATHS = (
+					../../Libraries/QtStatic/qtbase/include/QtGui/5.3.0/QtGui,
+					../../Libraries/QtStatic/qtbase/include/QtCore/5.3.0/QtCore,
+					../../Libraries/QtStatic/qtbase/include,
+					/usr/local/include,
+					"/usr/local/Qt-5.3.0/include",
+					"/usr/local/Qt-5.3.0/include/QtGui",
+					"/usr/local/Qt-5.3.0/include/QtCore",
+					GeneratedFiles/Debug,
+					/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers,
+					/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/AGL.framework/Headers,
+					"/usr/local/Qt-5.3.0/mkspecs/macx-clang",
+				);
+				INFOPLIST_FILE = Packer.plist;
+				INSTALL_DIR = "../Mac/$(CONFIGURATION)";
+				LDPLUSPLUS = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++";
+				LIBRARY_SEARCH_PATHS = (
+					/System/Library/Frameworks/,
+					"/usr/local/Qt-5.3.0/lib",
+					"/usr/local/Qt-5.3.0/plugins/platforms",
+					"/usr/local/Qt-5.3.0/plugins/imageformats",
+				);
+				MACOSX_DEPLOYMENT_TARGET = 10.7;
+				OBJROOT = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)IntermediatePacker/";
+				OTHER_CFLAGS = (
+					"-pipe",
+					"-g",
+					"-Wall",
+					"-W",
+					"-fPIE",
+					"-D_DEBUG",
+					"-DQT_GUI_LIB",
+					"-DQT_CORE_LIB",
+				);
+				OTHER_CPLUSPLUSFLAGS = (
+					"-pipe",
+					"-g",
+					"-std=c++11",
+					"-stdlib=libc++",
+					"-Wall",
+					"-W",
+					"-fPIE",
+					"-D_DEBUG",
+					"-DQT_GUI_LIB",
+					"-DQT_CORE_LIB",
+				);
+				OTHER_LDFLAGS = (
+					"-headerpad_max_install_names",
+					"-stdlib=libc++",
+					"-lcrypto",
+					"-lssl",
+					"-L/usr/local/Qt-5.3.0/lib",
+					"-L/usr/local/Qt-5.3.0/plugins/platforms",
+					"-lcups",
+					"-L/usr/local/Qt-5.3.0/plugins/imageformats",
+					"-lz",
+					"-lm",
+					"-llzma",
+				);
+				PRODUCT_NAME = Packer;
+				QT_LIBRARY_SUFFIX = "";
+				SDKROOT = macosx;
+				SYMROOT = ../Mac;
+			};
+			name = Release;
+		};
+		3AA6C32AC930069E80220CF1 /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				CC = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang;
+				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_EMPTY_BODY = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				COPY_PHASE_STRIP = NO;
+				DEBUG_INFORMATION_FORMAT = dwarf;
+				DYLIB_COMPATIBILITY_VERSION = 1.0;
+				DYLIB_CURRENT_VERSION = 1.0.0;
+				FRAMEWORK_SEARCH_PATHS = "";
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES;
+				GCC_WARN_UNUSED_FUNCTION = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				HEADER_SEARCH_PATHS = (
+					../../Libraries/QtStatic/qtbase/include/QtGui/5.3.0/QtGui,
+					../../Libraries/QtStatic/qtbase/include/QtCore/5.3.0/QtCore,
+					../../Libraries/QtStatic/qtbase/include,
+					/usr/local/include,
+					"/usr/local/Qt-5.3.0/include",
+					"/usr/local/Qt-5.3.0/include/QtGui",
+					"/usr/local/Qt-5.3.0/include/QtCore",
+					GeneratedFiles/Debug,
+					/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers,
+					/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/AGL.framework/Headers,
+					"/usr/local/Qt-5.3.0/mkspecs/macx-clang",
+				);
+				INFOPLIST_FILE = Packer.plist;
+				INSTALL_DIR = "../Mac/$(CONFIGURATION)";
+				LDPLUSPLUS = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++";
+				LIBRARY_SEARCH_PATHS = (
+					/System/Library/Frameworks/,
+					"/usr/local/Qt-5.3.0/lib",
+					"/usr/local/Qt-5.3.0/plugins/platforms",
+					"/usr/local/Qt-5.3.0/plugins/imageformats",
+				);
+				MACOSX_DEPLOYMENT_TARGET = 10.7;
+				OBJROOT = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)IntermediatePacker/";
+				ONLY_ACTIVE_ARCH = YES;
+				OTHER_CFLAGS = (
+					"-pipe",
+					"-g",
+					"-Wall",
+					"-W",
+					"-fPIE",
+					"-D_DEBUG",
+					"-DQT_GUI_LIB",
+					"-DQT_CORE_LIB",
+				);
+				OTHER_CPLUSPLUSFLAGS = (
+					"-pipe",
+					"-g",
+					"-std=c++11",
+					"-stdlib=libc++",
+					"-Wall",
+					"-W",
+					"-fPIE",
+					"-D_DEBUG",
+					"-DQT_GUI_LIB",
+					"-DQT_CORE_LIB",
+				);
+				OTHER_LDFLAGS = (
+					"-headerpad_max_install_names",
+					"-stdlib=libc++",
+					"-lcrypto",
+					"-lssl",
+					"-L/usr/local/Qt-5.3.0/lib",
+					"-L/usr/local/Qt-5.3.0/plugins/platforms",
+					"-lcups",
+					"-L/usr/local/Qt-5.3.0/plugins/imageformats",
+					"-lz",
+					"-lm",
+					"-llzma",
+				);
+				PRODUCT_NAME = Packer;
+				QT_LIBRARY_SUFFIX = _debug;
+				SDKROOT = macosx;
+				SYMROOT = ../Mac;
+			};
+			name = Debug;
+		};
+		6666AA5E688052234F6758D8 /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				COMBINE_HIDPI_IMAGES = YES;
+				COPY_PHASE_STRIP = YES;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				OBJROOT = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)IntermediatePacker";
+				OTHER_CFLAGS = (
+					"-pipe",
+					"-g",
+					"-Wall",
+					"-W",
+					"-fPIE",
+					"-D_DEBUG",
+					"-DQT_GUI_LIB",
+					"-DQT_CORE_LIB",
+					"-I./../../Libraries/openssl-xcode/include",
+				);
+				OTHER_CPLUSPLUSFLAGS = (
+					"-pipe",
+					"-g",
+					"-std=c++11",
+					"-stdlib=libc++",
+					"-Wall",
+					"-W",
+					"-fPIE",
+					"-D_DEBUG",
+					"-DQT_GUI_LIB",
+					"-DQT_CORE_LIB",
+					"-I./../../Libraries/openssl-xcode/include",
+				);
+				PRODUCT_NAME = Packer;
+				QT_LIBRARY_SUFFIX = "";
+				SDKROOT = macosx;
+			};
+			name = Release;
+		};
+		77418F46922677BB04ED38DD /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				COMBINE_HIDPI_IMAGES = YES;
+				COPY_PHASE_STRIP = NO;
+				DEBUG_INFORMATION_FORMAT = dwarf;
+				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				OBJROOT = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)IntermediatePacker";
+				OTHER_CFLAGS = (
+					"-pipe",
+					"-g",
+					"-Wall",
+					"-W",
+					"-fPIE",
+					"-D_DEBUG",
+					"-DQT_GUI_LIB",
+					"-DQT_CORE_LIB",
+					"-I./../../Libraries/openssl-xcode/include",
+				);
+				OTHER_CPLUSPLUSFLAGS = (
+					"-pipe",
+					"-g",
+					"-std=c++11",
+					"-stdlib=libc++",
+					"-Wall",
+					"-W",
+					"-fPIE",
+					"-D_DEBUG",
+					"-DQT_GUI_LIB",
+					"-DQT_CORE_LIB",
+					"-I./../../Libraries/openssl-xcode/include",
+				);
+				PRODUCT_NAME = Packer;
+				QT_LIBRARY_SUFFIX = _debug;
+				SDKROOT = macosx;
+			};
+			name = Debug;
+		};
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+		6CC3B5D2136C7CD6A5CF5A59 /* Build configuration list for PBXNativeTarget "Packer" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				77418F46922677BB04ED38DD /* Debug */,
+				6666AA5E688052234F6758D8 /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Debug;
+		};
+		DAC4C1AA5EDEA1C85E9CA5E6 /* Build configuration list for PBXProject "Packer" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				3AA6C32AC930069E80220CF1 /* Debug */,
+				339EE1B2CC4FC24589A0EA95 /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Debug;
+		};
+/* End XCConfigurationList section */
+	};
+	rootObject = 6DB9C3763D02B1415CD9D565 /* Project object */;
+}
diff --git a/Telegram/Packer.xcodeproj/qt_preprocess.mak b/Telegram/Packer.xcodeproj/qt_preprocess.mak
new file mode 100644
index 000000000..cb1a0f014
--- /dev/null
+++ b/Telegram/Packer.xcodeproj/qt_preprocess.mak
@@ -0,0 +1,52 @@
+#############################################################################
+# Makefile for building: ../Mac/DebugPacker/Packer.app/Contents/MacOS/Packer
+# Generated by qmake (3.0) (Qt 5.3.0)
+# Project:  Packer.pro
+# Template: app
+# Command: /usr/local/Qt-5.3.0/bin/qmake -spec macx-xcode -o Packer.xcodeproj/project.pbxproj Packer.pro
+#############################################################################
+
+MAKEFILE      = project.pbxproj
+
+MOC       = /usr/local/Qt-5.3.0/bin/moc
+UIC       = 
+LEX       = flex
+LEXFLAGS  = 
+YACC      = yacc
+YACCFLAGS = -d
+DEFINES       = -D_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB
+INCPATH       = -I/usr/local/Qt-5.3.0/mkspecs/macx-clang -I. -I../../Libraries/QtStatic/qtbase/include/QtGui/5.3.0/QtGui -I../../Libraries/QtStatic/qtbase/include/QtCore/5.3.0/QtCore -I../../Libraries/QtStatic/qtbase/include -I../../Libraries/lzma/C -I/usr/local/Qt-5.3.0/include -I/usr/local/Qt-5.3.0/include/QtGui -I/usr/local/Qt-5.3.0/include/QtCore -IGeneratedFiles/Debug -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/AGL.framework/Headers
+DEL_FILE  = rm -f
+MOVE      = mv -f
+
+IMAGES = 
+PARSERS =
+preprocess: $(PARSERS) compilers
+clean preprocess_clean: parser_clean compiler_clean
+
+parser_clean:
+mocclean: compiler_moc_header_clean compiler_moc_source_clean
+
+mocables: compiler_moc_header_make_all compiler_moc_source_make_all
+
+check: first
+
+compilers:
+compiler_objective_c_make_all:
+compiler_objective_c_clean:
+compiler_rcc_make_all:
+compiler_rcc_clean:
+compiler_moc_header_make_all:
+compiler_moc_header_clean:
+compiler_moc_source_make_all:
+compiler_moc_source_clean:
+compiler_rez_source_make_all:
+compiler_rez_source_clean:
+compiler_yacc_decl_make_all:
+compiler_yacc_decl_clean:
+compiler_yacc_impl_make_all:
+compiler_yacc_impl_clean:
+compiler_lex_make_all:
+compiler_lex_clean:
+compiler_clean: 
+
diff --git a/Telegram/Prepare.sh b/Telegram/Prepare.sh
new file mode 100755
index 000000000..dfdbb5c5a
--- /dev/null
+++ b/Telegram/Prepare.sh
@@ -0,0 +1,32 @@
+AppVersionStr=0.5.5
+AppVersion=5005
+
+if [ -d "deploy/$AppVersionStr" ]; then
+  echo "Deploy folder for version $AppVersionStr already exists!"
+  exit 1
+fi
+
+if [ -f "tupdate$AppVersion" ]; then
+  echo "Update file for version $AppVersion already exists!"
+  exit 1
+fi
+
+if [ ! -d "Telegram.app" ]; then
+  echo "Telegram.app not found!"
+  exit 1
+fi
+echo "Preparing version $AppVersionStr, executing Packer.."
+./Packer.app/Contents/MacOS/Packer -path Telegram.app -version $AppVersion
+echo "Packer done!"
+
+if [ ! -d "deploy/" ]; then
+  mkdir "deploy"
+fi
+echo "Copying Telegram.app and tmacupd$AppVersion to deploy/$AppVersionStr..";
+mkdir "deploy/$AppVersionStr"
+mkdir "deploy/$AppVersionStr/Telegram"
+mv Telegram.app deploy/$AppVersionStr/Telegram/
+mv tmacupd$AppVersion deploy/$AppVersionStr/
+mv Telegram.dmg deploy/$AppVersionStr/
+echo "Version $AppVersionStr prepared!";
+
diff --git a/Telegram/Resources/lang.txt b/Telegram/Resources/lang.txt
index e3a010172..2824bf74f 100644
--- a/Telegram/Resources/lang.txt
+++ b/Telegram/Resources/lang.txt
@@ -161,6 +161,7 @@ lng_settings_view_emojis: "View list";
 lng_settings_emoji_list: "List of supported emojis";
 lng_settings_send_enter: "Send by Enter";
 lng_settings_send_ctrlenter: "Send by Ctrl+Enter";
+lng_settings_send_cmdenter: "Send by Cmd+Enter";
 lng_settings_cats_and_dogs: "Allow cats and dogs";
 
 lng_download_path_dont_ask: "Don't ask download path for each file";
@@ -313,6 +314,7 @@ lng_context_copy_image: "Copy Image";
 lng_context_close_image: "Close Image";
 lng_context_cancel_download: "Cancel Download";
 lng_context_show_in_folder: "Show in Folder";
+lng_context_show_in_finder: "Show in Finder";
 lng_context_open_video: "Open Video";
 lng_context_save_video: "Save Video As...";
 lng_context_open_audio: "Open Audio";
@@ -378,4 +380,16 @@ This software is licensed under [a href=\"https://github.com/telegramdesktop/tde
 source code is available on [a href=\"https://github.com/telegramdesktop/tdesktop\"]GitHub[/a].";
 lng_about_done: "Done";
 
+// Mac specific
+
+lng_mac_choose_app: "Choose Application";
+lng_mac_choose_text: "Choose an application to open the document \"{file}\".";
+lng_mac_enable_filter: "Enable:";
+lng_mac_recommended_apps: "Recommended Applications";
+lng_mac_all_apps: "All Applications";
+lng_mac_always_open_with: "Always Open With";
+lng_mac_this_app_can_open: "This application can open \"{file}\".";
+lng_mac_not_known_app: "It's not known if this application can open \"{file}\".";
+
 // Keys finished
+
diff --git a/Telegram/Resources/style.txt b/Telegram/Resources/style.txt
index 29c0f95c4..a7aa82ee4 100644
--- a/Telegram/Resources/style.txt
+++ b/Telegram/Resources/style.txt
@@ -20,8 +20,9 @@ semibold: 'Open Sans Semibold';
 
 fsize: 13px;
 
-spriteFile: ':/gui/art/sprite.png' / 2:':/gui/art/sprite_125x.png' / 3:':/gui/art/sprite_150x.png' / 4:':/gui/art/sprite_200x.png';
-emojisFile: ':/gui/art/emoji.png' / 2:':/gui/art/emoji_125x.png' / 3:':/gui/art/emoji_150x.png' / 4:':/gui/art/emoji_200x.png';
+spriteFile: ':/gui/art/sprite.png' / 2:':/gui/art/sprite_125x.png' / 3:':/gui/art/sprite_150x.png' / 4:':/gui/art/sprite_200x.png'; // exceptional value for retina
+emojisFile: ':/gui/art/emoji.png' / 2:':/gui/art/emoji_125x.png' / 3:':/gui/art/emoji_150x.png' / 4:':/gui/art/emoji_200x.png'; // exceptional value for retina
+emojiImgSize: 16px; // exceptional value for retina
 emojiSize: 16px;
 emojiPadding: 1px;
 
@@ -1384,3 +1385,13 @@ emojiPanSub: 0px;
 emojiPanDuration: 200;
 emojiPanHover: #f0f0f0;
 emojiPanRound: 2px;
+
+// Mac specific
+
+macAccessoryHeight: 90;
+macEnableFilterAdd: 2;
+macEnableFilterTop: 5;
+macSelectorTop: 6;
+macAlwaysThisAppTop: 4;
+macAppHintTop: 8;
+macCautionIconSize: size(16, 16);
diff --git a/Telegram/SourceFiles/_other/genemoji.cpp b/Telegram/SourceFiles/_other/genemoji.cpp
index 817e23a24..1ff8d796a 100644
--- a/Telegram/SourceFiles/_other/genemoji.cpp
+++ b/Telegram/SourceFiles/_other/genemoji.cpp
@@ -17,8 +17,10 @@ Copyright (c) 2014 John Preston, https://tdesktop.com
 */
 #include "genemoji.h"
 
+#ifdef Q_OS_WIN
 #include <QtCore/QtPlugin>
 Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
+#endif
 
 typedef unsigned int uint32;
 
@@ -938,7 +940,7 @@ void writeEmojiCategory(QTextStream &tcpp, uint32 *emojiCategory, uint32 size, c
 	tcpp << "\t\tstatic QVector<EmojiPtr> v" << name << ";\n";
 	tcpp << "\t\tif (v" << name << ".isEmpty()) {\n";
 	tcpp << "\t\t\tv" << name << ".resize(" << size << ");\n";
-	for (int i = 0; i < size; ++i) {
+	for (uint32 i = 0; i < size; ++i) {
 		int index = 0;
 		for (EmojisData::const_iterator j = emojisData.cbegin(), e = emojisData.cend(); j != e; ++j) {
 			if (j->code == emojiCategory[i]) {
@@ -947,7 +949,7 @@ void writeEmojiCategory(QTextStream &tcpp, uint32 *emojiCategory, uint32 size, c
 			++index;
 		}
 		if (index == emojisData.size()) {
-			throw exception(QString("Could not find emoji from category '%1' with index %2, code %3").arg(name).arg(i).arg(emojiCategory[i]).toUtf8().constData());
+			throw Exception(QString("Could not find emoji from category '%1' with index %2, code %3").arg(name).arg(i).arg(emojiCategory[i]).toUtf8().constData());
 		}
 		tcpp << "\t\t\tv" << name << "[" << i << "] = &emojis[" << index << "];\n";
 	}
@@ -956,7 +958,7 @@ void writeEmojiCategory(QTextStream &tcpp, uint32 *emojiCategory, uint32 size, c
 	tcpp << "\t} break;\n\n";
 }
 
-bool genEmoji(QString emoji_in, const QString &emoji_out) {
+bool genEmoji(QString emoji_in, const QString &emoji_out, const QString &emoji_png) {
 	QDir d(emoji_in);
 	if (!d.exists()) {
 		cout << "Could not open emoji input dir '" << emoji_in.toUtf8().constData() << "'!\n";
@@ -1012,7 +1014,7 @@ bool genEmoji(QString emoji_in, const QString &emoji_out) {
 					if (data.code < min1) min1 = data.code;
 					if (data.code > max1) max1 = data.code;
 				}
-			} else if (high == 35 || high >= 48 && high < 58) { // digits
+			} else if (high == 35 || (high >= 48 && high < 58)) { // digits
 			} else {
 				if (data.code < min2) min2 = data.code;
 				if (data.code > max2) max2 = data.code;
@@ -1055,7 +1057,8 @@ bool genEmoji(QString emoji_in, const QString &emoji_out) {
 				cout << "Could not read image '" << name.toUtf8().constData() << "'!\n";
 			}
 		}
-		QString postfix = variantPostfix[variantIndex], emojif = "./SourceFiles/art/emoji" + postfix + ".png";
+		QString postfix = variantPostfix[variantIndex], emojif = emoji_png + postfix + ".png";
+		const char *tmp = emojif.toUtf8().constData();
 		QByteArray emojib;
 		{
 			QBuffer ebuf(&emojib);
@@ -1126,7 +1129,8 @@ Copyright (c) 2014 John Preston, https://tdesktop.com\n\
 
 			tcpp << "void initEmoji() {\n";
 			tcpp << "\tEmojiData *toFill = emojis = (EmojiData*)emojisData;\n\n";
-			tcpp << "\tswitch (cScale()) {\n\n";
+			tcpp << "\tDBIScale emojiForScale = cRetina() ? dbisTwo : cScale();\n\n";
+			tcpp << "\tswitch (emojiForScale) {\n\n";
 			for (int variantIndex = 0; variantIndex < variantsCount; ++variantIndex) {
 				int imSize = imSizes[variantIndex];
 				tcpp << "\tcase " << variantNames[variantIndex] << ":\n";
@@ -1165,7 +1169,7 @@ Copyright (c) 2014 John Preston, https://tdesktop.com\n\
 			tcpp << "\t\treturn 0;\n";
 			tcpp << "\t}\n\n";
 
-			tcpp << "\tif (highCode == 35 || highCode >= 48 && highCode < 58) {\n"; // digits
+			tcpp << "\tif (highCode == 35 || (highCode >= 48 && highCode < 58)) {\n"; // digits
 			tcpp << "\t\tif ((code & 0xFFFF) != 0x20E3) return 0;\n\n";
 			tcpp << "\t\tswitch (code) {\n";
 			for (; i != e; ++i) {
@@ -1194,7 +1198,7 @@ Copyright (c) 2014 John Preston, https://tdesktop.com\n\
 			tcpp << "\tswitch (ch->unicode()) {\n";
 
 			QString tab("\t");
-			for (int i = 0; i < replacesCount; ++i) {
+			for (uint32 i = 0; i < replacesCount; ++i) {
 				QString key = QString::fromUtf8(replaces[i].replace);
 				replaceMap[key] = replaces[i].code;
 			}
@@ -1268,8 +1272,8 @@ Copyright (c) 2014 John Preston, https://tdesktop.com\n\
 		}
 		if (write_cpp) {
 			cout << "Emoji updated, writing " << currentRow << " rows, full count " << emojisData.size() << " emojis.\n";
-			if (!cpp.open(QIODevice::WriteOnly)) throw exception("Could not open style_auto.cpp for writing!");
-			if (cpp.write(cppText) != cppText.size()) throw exception("Could not open style_auto.cpp for writing!");
+			if (!cpp.open(QIODevice::WriteOnly)) throw Exception("Could not open style_auto.cpp for writing!");
+			if (cpp.write(cppText) != cppText.size()) throw Exception("Could not open style_auto.cpp for writing!");
 		}/**/
 	} catch (exception &e) {
 		cout << e.what() << "\n";
diff --git a/Telegram/SourceFiles/_other/genemoji.h b/Telegram/SourceFiles/_other/genemoji.h
index 029c62e41..bd3dcee0d 100644
--- a/Telegram/SourceFiles/_other/genemoji.h
+++ b/Telegram/SourceFiles/_other/genemoji.h
@@ -37,19 +37,35 @@ using std::cout;
 using std::cerr;
 using std::exception;
 
-bool genEmoji(QString emoji_in, const QString &emoji_out);
+class Exception : public exception {
+public:
+
+    Exception(const QString &msg) : _msg(msg.toUtf8()) {
+	}
+
+    virtual const char *what() const throw() {
+        return _msg.constData();
+    }
+    virtual ~Exception() throw() {
+    }
+
+private:
+	QByteArray _msg;
+};
+
+bool genEmoji(QString emoji_in, const QString &emoji_out, const QString &emoji_png);
 
 class GenEmoji : public QObject {
 	Q_OBJECT
 
 public:
-	GenEmoji(const QString &emoji_in, const QString &emoji_out) : QObject(0),
-		_emoji_in(emoji_in), _emoji_out(emoji_out) {
+	GenEmoji(const QString &emoji_in, const QString &emoji_out, const QString &emoji_png) : QObject(0),
+		_emoji_in(emoji_in), _emoji_out(emoji_out), _emoji_png(emoji_png) {
 	}
 
 	public slots :
 		void run()  {
-			if (genEmoji(_emoji_in, _emoji_out)) {
+			if (genEmoji(_emoji_in, _emoji_out, _emoji_png)) {
 				emit finished();
 			}
 		}
@@ -59,5 +75,5 @@ signals:
 
 private:
 
-	QString _emoji_in, _emoji_out;
+	QString _emoji_in, _emoji_out, _emoji_png;
 };
diff --git a/Telegram/SourceFiles/_other/genlang.cpp b/Telegram/SourceFiles/_other/genlang.cpp
index ce3cee61b..c02a9bbe0 100644
--- a/Telegram/SourceFiles/_other/genlang.cpp
+++ b/Telegram/SourceFiles/_other/genlang.cpp
@@ -53,8 +53,8 @@ bool skipComment(const char *&from, const char *end) {
 			while (from < end && *from != '\n' && *from != '\r') {
 				++from;
 			}
-			++from;
-			return (from < end);
+            if (from < end) ++from;
+			return true;
 		} else {
 			return true;
 		}
diff --git a/Telegram/SourceFiles/_other/genlang.h b/Telegram/SourceFiles/_other/genlang.h
index e4bc246dd..0648ad953 100644
--- a/Telegram/SourceFiles/_other/genlang.h
+++ b/Telegram/SourceFiles/_other/genlang.h
@@ -38,17 +38,17 @@ using std::exception;
 class Exception : public exception {
 public:
     
-    Exception(const QString &msg) : _msg(msg) {
+	Exception(const QString &msg) : _msg(msg.toUtf8()) {
 	}
     
     virtual const char *what() const throw() {
-        return _msg.toUtf8().constData();
+        return _msg.constData();
     }
     virtual ~Exception() throw() {
     }
     
 private:
-	QString _msg;
+	QByteArray _msg;
 };
 
 bool genLang(const QString &lang_in, const QString &lang_out);
diff --git a/Telegram/SourceFiles/_other/genstyles.cpp b/Telegram/SourceFiles/_other/genstyles.cpp
index b2dddf68b..9c05054a4 100644
--- a/Telegram/SourceFiles/_other/genstyles.cpp
+++ b/Telegram/SourceFiles/_other/genstyles.cpp
@@ -60,7 +60,7 @@ string outputTypeNames[] = {
 	"color",
 	"point",
 	"rect",
-	"rect",
+	"sprite",
 	"size",
 	"transition",
 	"cursor",
@@ -1302,7 +1302,11 @@ string prepareObject(const string &cls, Fields fields, const string &obj, int va
 		} else if (f.value().first != j.value()) {
 			throw Exception(QString("Bad type of field %1 while parsing %2").arg(j.key().c_str()).arg(obj.c_str()));
 		} else {
-			result += findScalarVariant(f.value().second, variant);
+            if (variant == -1) { // retina
+                result += findScalarVariant(f.value().second, (j.value() == scSprite) ? 4 : 0);
+            } else {
+                result += findScalarVariant(f.value().second, variant);
+            }
 		}
 		fields.erase(f);
 		if (++j != e) {
@@ -1518,7 +1522,7 @@ GNU General Public License for more details.\n\
 Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE\n\
 Copyright (c) 2014 John Preston, https://tdesktop.com\n\
 */\n";
-			tcpp << "#include \"stdafx.h\"\n#include \"style_auto.h\"\n\n";
+			tcpp << "#include \"stdafx.h\"\n#include \"style_auto.h\"\n\nnamespace {\n";
 			for (int i = 0, l = scalars.size(); i < l; ++i) {
 				Scalar &sc(scalars[i]);
 				tout << "\textern const style::" << outputTypeNames[sc.second.first].c_str() << " &" << sc.first.c_str() << ";\n";
@@ -1531,7 +1535,8 @@ Copyright (c) 2014 John Preston, https://tdesktop.com\n\
 				tout << "\textern const style::" << obj.second.first.c_str() << " &" << obj.first.c_str() << ";\n";
 				tcpp << "\tstyle::" << obj.second.first.c_str() << " _" << obj.first.c_str() << prepareObject(obj.second.first, obj.second.second, obj.first, variant).c_str() << ";\n";
 			}
-			tout << "\n};\n";
+			tout << "};\n";
+            tcpp << "};\n";
 
 			tcpp << "\nnamespace st {\n";
 			for (int i = 0, l = scalars.size(); i < l; ++i) {
@@ -1543,15 +1548,33 @@ Copyright (c) 2014 John Preston, https://tdesktop.com\n\
 				Object &obj(objects[i]);
 				tcpp << "\tconst style::" << obj.second.first.c_str() << " &" << obj.first.c_str() << "(_" << obj.first.c_str() << ");\n";
 			}
-			tcpp << "\n};\n";
+			tcpp << "};\n";
 
 			tcpp << "\nnamespace style {\n\n";
 			tcpp << "\tFontFamilies _fontFamilies;\n";
 			tcpp << "\tFontDatas _fontsMap;\n";
 			tcpp << "\tColorDatas _colorsMap;\n\n";
 			tcpp << "\tvoid startManager() {\n";
-
-			tcpp << "\n\t\tswitch (cScale()) {\n\n";
+            
+            tcpp << "\n\t\tif (cRetina()) {\n";
+            tcpp << "\t\t\tcSetRealScale(dbisOne);\n\n";
+            for (int i = 0, l = scalars.size(); i < l; ++i) {
+                Scalar &sc(scalars[i]);
+                if (sc.second.first == scSprite || sc.first == "spriteFile" || sc.first == "emojisFile" || sc.first == "emojiImgSize") {
+                    string v = findScalarVariant(sc.second.second, 4);
+                    if (v != findScalarVariant(sc.second.second, 0)) {
+                        tcpp << "\t\t\t_" << sc.first.c_str() << " = style::" << outputTypeNames[sc.second.first].c_str() << v.c_str() << ";\n";
+                    }
+                }
+            }
+            for (int i = 0, l = objects.size(); i < l; ++i) {
+                Object &obj(objects[i]);
+                string v = prepareObject(obj.second.first, obj.second.second, obj.first, -1); // retina
+                if (v != prepareObject(obj.second.first, obj.second.second, obj.first, 0)) {
+                    tcpp << "\t\t\t_" << obj.first.c_str() << " = style::" << obj.second.first.c_str() << v.c_str() << ";\n";
+                }
+            }
+            tcpp << "\t\t} else switch (cScale()) {\n\n";
 			for (int i = 1; i < variantsCount; ++i) {
 				variant = variants[i];
 				const char *varName = variantNames[i];
diff --git a/Telegram/SourceFiles/_other/genstyles.h b/Telegram/SourceFiles/_other/genstyles.h
index 855ce8668..6066654d0 100644
--- a/Telegram/SourceFiles/_other/genstyles.h
+++ b/Telegram/SourceFiles/_other/genstyles.h
@@ -37,17 +37,17 @@ using std::exception;
 class Exception : public exception {
 public:
     
-    Exception(const QString &msg) : _msg(msg) {
+    Exception(const QString &msg) : _msg(msg.toUtf8()) {
 	}
     
     virtual const char *what() const throw() {
-        return _msg.toUtf8().constData();
+        return _msg.constData();
     }
     virtual ~Exception() throw() {
     }
     
 private:
-	QString _msg;
+	QByteArray _msg;
 };
 
 bool genStyles(const QString &classes_in, const QString &classes_out, const QString &styles_in, const QString &styles_out, const QString &path_to_sprites);
diff --git a/Telegram/SourceFiles/_other/memain.cpp b/Telegram/SourceFiles/_other/memain.cpp
index 0db58a523..c5f5cf335 100644
--- a/Telegram/SourceFiles/_other/memain.cpp
+++ b/Telegram/SourceFiles/_other/memain.cpp
@@ -18,15 +18,32 @@ Copyright (c) 2014 John Preston, https://tdesktop.com
 #include "memain.h"
 
 int main(int argc, char *argv[]) {
-	QString emoji_in("."), emoji_out("emoji_config.cpp");
+	QString emoji_in("."), emoji_out("emoji_config.cpp"), emoji_png("./SourceFiles/art/emoji");
 	for (int i = 0; i < argc; ++i) {
 		if (string("-emoji_in") == argv[i]) {
 			if (++i < argc) emoji_in = argv[i];
 		} else if (string("-emoji_out") == argv[i]) {
 			if (++i < argc) emoji_out = argv[i];
+		} else if (string("-emoji_png") == argv[i]) {
+			if (++i < argc) emoji_png = argv[i];
 		}
 	}
-	QObject *taskImpl = new GenEmoji(emoji_in, emoji_out);
+#ifdef Q_OS_MAC
+    if (QDir(QString()).absolutePath() == "/") {
+        QString first = argc ? QString::fromLocal8Bit(argv[0]) : QString();
+        if (!first.isEmpty()) {
+            QFileInfo info(first);
+            if (info.exists()) {
+                QDir result(info.absolutePath() + "/../../..");
+                QString basePath = result.absolutePath() + '/';
+                emoji_in = basePath + emoji_in;
+                emoji_out = basePath + emoji_out;
+				emoji_png = basePath + emoji_png;
+            }
+        }
+    }
+#endif
+	QObject *taskImpl = new GenEmoji(emoji_in, emoji_out, emoji_png);
 
 	QGuiApplication a(argc, argv);
 
diff --git a/Telegram/SourceFiles/_other/packer.cpp b/Telegram/SourceFiles/_other/packer.cpp
index b3b6097fb..49fe55453 100644
--- a/Telegram/SourceFiles/_other/packer.cpp
+++ b/Telegram/SourceFiles/_other/packer.cpp
@@ -111,12 +111,26 @@ int32 *hashSha1(const void *data, uint32 len, void *dest) {
 
 int main(int argc, char *argv[])
 {
+	QString workDir;
+#ifdef Q_OS_MAC
+    if (QDir(QString()).absolutePath() == "/") {
+		QString first = argc ? QString::fromLocal8Bit(argv[0]) : QString();
+		if (!first.isEmpty()) {
+			QFileInfo info(first);
+			if (info.exists()) {
+				QDir result(info.absolutePath() + "/../../..");
+				workDir = result.absolutePath() + '/';
+			}
+		}
+	}
+#endif
+
 	QString remove;
 	int version = 0;
 	QFileInfoList files;
 	for (int i = 0; i < argc; ++i) {
 		if (string("-path") == argv[i] && i + 1 < argc) {
-			QString path = QString(argv[i + 1]);
+			QString path = workDir + QString(argv[i + 1]);
 			QFileInfo info(path);
 			files.push_back(info);
 			if (remove.isEmpty()) remove = info.canonicalPath() + "/";
@@ -126,8 +140,12 @@ int main(int argc, char *argv[])
 	}
 
 	if (files.isEmpty() || remove.isEmpty() || version <= 1016 || version > 999999) { // not for release =)
+#ifdef Q_OS_WIN
 		cout << "Usage: Packer.exe -path {file} -version {version} OR Packer.exe -path {dir} -version {version}\n";
-		return 0;
+#elif defined Q_OS_MAC
+		cout << "Usage: Packer.app -path {file} -version {version} OR Packer.app -path {dir} -version {version}\n";
+#endif
+		return -1;
 	}
 
 	bool hasDirs = true;
@@ -147,6 +165,10 @@ int main(int argc, char *argv[])
 			} else if (!info.isReadable()) {
 				cout << "Can't read: " << info.absoluteFilePath().toUtf8().constData() << "\n";
 				return -1;
+			} else if (info.isHidden()) {
+				hasDirs = true;
+				files.erase(i);
+				break;
 			}
 		}
 	}
@@ -182,6 +204,9 @@ int main(int argc, char *argv[])
 			}
 			QByteArray inner = f.readAll();
 			stream << name << quint32(inner.size()) << inner;
+#if defined Q_OS_MAC || defined Q_OS_LINUX
+			stream << (QFileInfo(fullName).isExecutable() ? true : false);
+#endif
 		}
 		if (stream.status() != QDataStream::Ok) {
 			cout << "Stream status is bad: " << stream.status() << "\n";
@@ -193,20 +218,19 @@ int main(int argc, char *argv[])
 	cout << "Compression start, size: " << resultSize << "\n";
 
 	QByteArray compressed, resultCheck;
-
+#ifdef Q_OS_WIN // use Lzma SDK for win
 	const int32 hSigLen = 128, hShaLen = 20, hPropsLen = LZMA_PROPS_SIZE, hOriginalSizeLen = sizeof(int32), hSize = hSigLen + hShaLen + hPropsLen + hOriginalSizeLen; // header
 
 	compressed.resize(hSize + resultSize + 1024 * 1024); // rsa signature + sha1 + lzma props + max compressed size
 
 	size_t compressedLen = compressed.size() - hSize;
-	uchar outProps[LZMA_PROPS_SIZE];
 	size_t outPropsSize = LZMA_PROPS_SIZE;
 	int res = LzmaCompress((uchar*)(compressed.data() + hSize), &compressedLen, (const uchar*)(result.constData()), result.size(), (uchar*)(compressed.data() + hSigLen + hShaLen), &outPropsSize, 9, 64 * 1024 * 1024, 0, 0, 0, 0, 0);
 	if (res != SZ_OK) {
 		cout << "Error in compression: " << res << "\n";
 		return -1;
 	}
-	compressed.resize(hSize + compressedLen);
+	compressed.resize(int(hSize + compressedLen));
 	memcpy(compressed.data() + hSigLen + hShaLen + hPropsLen, &resultSize, hOriginalSizeLen);
 
 	cout << "Compressed to size: " << compressedLen << "\n";
@@ -228,10 +252,112 @@ int main(int argc, char *argv[])
 		cout << "Uncompress failed: " << uncompressRes << "\n";
 		return -1;
 	}
-	if (resultLen != result.size()) {
+	if (resultLen != size_t(result.size())) {
 		cout << "Uncompress bad size: " << resultLen << ", was: " << result.size() << "\n";
 		return -1;
 	}
+#else // use liblzma for others
+	const int32 hSigLen = 128, hShaLen = 20, hPropsLen = 0, hOriginalSizeLen = sizeof(int32), hSize = hSigLen + hShaLen + hOriginalSizeLen; // header
+
+	compressed.resize(hSize + resultSize + 1024 * 1024); // rsa signature + sha1 + lzma props + max compressed size
+
+	size_t compressedLen = compressed.size() - hSize;
+
+	lzma_stream stream = LZMA_STREAM_INIT;
+
+	int preset = 9 | LZMA_PRESET_EXTREME;
+	lzma_ret ret = lzma_easy_encoder(&stream, preset, LZMA_CHECK_CRC64);
+	if (ret != LZMA_OK) {
+		const char *msg;
+		switch (ret) {
+			case LZMA_MEM_ERROR: msg = "Memory allocation failed"; break;
+			case LZMA_OPTIONS_ERROR: msg = "Specified preset is not supported"; break;
+			case LZMA_UNSUPPORTED_CHECK: msg = "Specified integrity check is not supported"; break;
+			default: msg = "Unknown error, possibly a bug"; break;
+		}
+		cout << "Error initializing the encoder: " << msg << " (error code " << ret << ")\n";
+		return -1;
+	}
+
+	stream.avail_in = resultSize;
+	stream.next_in = (uint8_t*)result.constData();
+	stream.avail_out = compressedLen;
+	stream.next_out = (uint8_t*)(compressed.data() + hSize);
+
+	lzma_ret res = lzma_code(&stream, LZMA_FINISH);
+	compressedLen -= stream.avail_out;
+	lzma_end(&stream);
+	if (res != LZMA_OK && res != LZMA_STREAM_END) {
+		const char *msg;
+		switch (res) {
+			case LZMA_MEM_ERROR: msg = "Memory allocation failed"; break;
+			case LZMA_DATA_ERROR: msg = "File size limits exceeded"; break;
+			default: msg = "Unknown error, possibly a bug"; break;
+		}
+		cout << "Error in compression: " << msg << " (error code " << res << ")\n";
+		return -1;
+	}
+
+	compressed.resize(int(hSize + compressedLen));
+	memcpy(compressed.data() + hSigLen + hShaLen, &resultSize, hOriginalSizeLen);
+
+	cout << "Compressed to size: " << compressedLen << "\n";
+
+	cout << "Checking uncompressed..\n";
+
+	int32 resultCheckLen;
+	memcpy(&resultCheckLen, compressed.constData() + hSigLen + hShaLen, hOriginalSizeLen);
+	if (resultCheckLen <= 0 || resultCheckLen > 1024 * 1024 * 1024) {
+		cout << "Bad result len: " << resultCheckLen << "\n";
+		return -1;
+	}
+	resultCheck.resize(resultCheckLen);
+
+	size_t resultLen = resultCheck.size();
+
+	stream = LZMA_STREAM_INIT;
+
+	ret = lzma_stream_decoder(&stream, UINT64_MAX, LZMA_CONCATENATED);
+	if (ret != LZMA_OK) {
+		const char *msg;
+		switch (ret) {
+			case LZMA_MEM_ERROR: msg = "Memory allocation failed"; break;
+			case LZMA_OPTIONS_ERROR: msg = "Specified preset is not supported"; break;
+			case LZMA_UNSUPPORTED_CHECK: msg = "Specified integrity check is not supported"; break;
+			default: msg = "Unknown error, possibly a bug"; break;
+		}
+		cout << "Error initializing the decoder: " << msg << " (error code " << ret << ")\n";
+		return -1;
+	}
+
+	stream.avail_in = compressedLen;
+	stream.next_in = (uint8_t*)(compressed.constData() + hSize);
+	stream.avail_out = resultLen;
+	stream.next_out = (uint8_t*)resultCheck.data();
+
+	res = lzma_code(&stream, LZMA_FINISH);
+	if (stream.avail_in) {
+		cout << "Error in decompression, " << stream.avail_in << " bytes left in _in of " << compressedLen << " whole.\n";
+		return -1;
+	} else if (stream.avail_out) {
+		cout << "Error in decompression, " << stream.avail_out << " bytes free left in _out of " << resultLen << " whole.\n";
+		return -1;
+	}
+	lzma_end(&stream);
+	if (res != LZMA_OK && res != LZMA_STREAM_END) {
+		const char *msg;
+		switch (res) {
+			case LZMA_MEM_ERROR: msg = "Memory allocation failed"; break;
+			case LZMA_FORMAT_ERROR: msg = "The input data is not in the .xz format"; break;
+			case LZMA_OPTIONS_ERROR: msg = "Unsupported compression options"; break;
+			case LZMA_DATA_ERROR: msg = "Compressed file is corrupt"; break;
+			case LZMA_BUF_ERROR: msg = "Compressed data is truncated or otherwise corrupt"; break;
+			default: msg = "Unknown error, possibly a bug"; break;
+		}
+		cout << "Error in decompression: " << msg << " (error code " << res << ")\n";
+		return -1;
+	}
+#endif
 	if (memcmp(result.constData(), resultCheck.constData(), resultLen)) {
 		cout << "Data differ :(\n";
 		return -1;
@@ -242,7 +368,7 @@ int main(int argc, char *argv[])
 	cout << "Counting SHA1 hash..\n";
 
 	uchar sha1Buffer[20];
-	memcpy(compressed.data() + hSigLen, hashSha1(compressed.constData() + hSigLen + hShaLen, compressedLen + hPropsLen + hOriginalSizeLen, sha1Buffer), hShaLen); // count sha1
+	memcpy(compressed.data() + hSigLen, hashSha1(compressed.constData() + hSigLen + hShaLen, uint32(compressedLen + hPropsLen + hOriginalSizeLen), sha1Buffer), hShaLen); // count sha1
 
 	uint32 siglen = 0;
 
@@ -283,7 +409,15 @@ int main(int argc, char *argv[])
 	cout << "Signature verified!\n";
 	RSA_free(pbKey);
 
+#ifdef Q_OS_WIN
 	QString outName(QString("tupdate%1").arg(version));
+#elif defined Q_OS_MAC
+	QString outName(QString("tmacupd%1").arg(version));
+#elif defined Q_OS_LINUX
+	QString outName(QString("tlinuxupd%1").arg(version));
+#else
+#error Unknown platform!
+#endif
 	QFile out(outName);
 	if (!out.open(QIODevice::WriteOnly)) {
 		cout << "Can't open '" << outName.toUtf8().constData() << "' for write..\n";
diff --git a/Telegram/SourceFiles/_other/packer.h b/Telegram/SourceFiles/_other/packer.h
index 5679cfdad..3ce13e004 100644
--- a/Telegram/SourceFiles/_other/packer.h
+++ b/Telegram/SourceFiles/_other/packer.h
@@ -34,7 +34,11 @@ Copyright (c) 2014 John Preston, https://tdesktop.com
 #include <openssl/aes.h>
 #include <openssl/evp.h>
 
+#ifdef Q_OS_WIN // use Lzma SDK for win
 #include <LzmaLib.h>
+#else
+#include <lzma.h>
+#endif
 
 #include <string>
 #include <iostream>
diff --git a/Telegram/SourceFiles/_other/updater_osx.m b/Telegram/SourceFiles/_other/updater_osx.m
new file mode 100644
index 000000000..7fe9d245e
--- /dev/null
+++ b/Telegram/SourceFiles/_other/updater_osx.m
@@ -0,0 +1,207 @@
+/*
+This file is part of Telegram Desktop,
+an unofficial desktop messaging app, see https://telegram.org
+
+Telegram Desktop is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+It is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
+Copyright (c) 2014 John Preston, https://tdesktop.com
+*/
+#import <Cocoa/Cocoa.h>
+
+NSString *appName = @"Telegram.app";
+NSString *appDir = nil;
+NSString *workDir = nil;
+
+#ifdef _DEBUG
+BOOL _debug = YES;
+#else
+BOOL _debug = NO;
+#endif
+
+NSFileHandle *_logFile = nil;
+void openLog() {
+	if (!_debug || _logFile) return;
+	NSString *logDir = [workDir stringByAppendingString:@"DebugLogs"];
+	if (![[NSFileManager defaultManager] createDirectoryAtPath:logDir withIntermediateDirectories:YES attributes:nil error:nil]) {
+		return;
+	}
+
+	NSDateFormatter *fmt = [[NSDateFormatter alloc] initWithDateFormat:@"DebugLogs/%Y%m%d %H%M%S_upd.txt" allowNaturalLanguage:NO];
+	NSString *logPath = [workDir stringByAppendingString:[fmt stringFromDate:[NSDate date]]];
+	[[NSFileManager defaultManager] createFileAtPath:logPath contents:nil attributes:nil];
+	_logFile = [NSFileHandle fileHandleForWritingAtPath:logPath];
+}
+
+void closeLog() {
+	if (!_logFile) return;
+
+	[_logFile closeFile];
+}
+
+void writeLog(NSString *msg) {
+	if (!_logFile) return;
+
+	[_logFile writeData:[[msg stringByAppendingString:@"\n"] dataUsingEncoding:NSUTF8StringEncoding]];
+	[_logFile synchronizeFile];
+}
+
+void delFolder() {
+	[[NSFileManager defaultManager] removeItemAtPath:[workDir stringByAppendingString:@"tupdates/ready"] error:nil];
+	rmdir([[workDir stringByAppendingString:@"tupdates"] fileSystemRepresentation]);
+}
+
+int main(int argc, const char * argv[]) {
+	NSString *path = [[NSBundle mainBundle] bundlePath];
+	if (!path) {
+		return -1;
+	}
+	NSRange range = [path rangeOfString:appName options:NSBackwardsSearch];
+	if (range.location == NSNotFound) {
+		return -1;
+	}
+	appDir = [path substringToIndex:range.location > 0 ? range.location : 0];
+
+	openLog();
+	pid_t procId = 0;
+	BOOL update = YES, toSettings = NO, autoStart = NO;
+	NSString *key = nil;
+	for (int i = 0; i < argc; ++i) {
+		if ([@"-workpath" isEqualToString:[NSString stringWithUTF8String:argv[i]]]) {
+			if (++i < argc) {
+				workDir = [NSString stringWithUTF8String:argv[i]];
+			}
+		} else if ([@"-procid" isEqualToString:[NSString stringWithUTF8String:argv[i]]]) {
+			if (++i < argc) {
+				NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
+				[formatter setNumberStyle:NSNumberFormatterDecimalStyle];
+				procId = [[formatter numberFromString:[NSString stringWithUTF8String:argv[i]]] intValue];
+			}
+		} else if ([@"-noupdate" isEqualToString:[NSString stringWithUTF8String:argv[i]]]) {
+			update = NO;
+		} else if ([@"-tosettings" isEqualToString:[NSString stringWithUTF8String:argv[i]]]) {
+			toSettings = YES;
+		} else if ([@"-autostart" isEqualToString:[NSString stringWithUTF8String:argv[i]]]) {
+			autoStart = YES;
+		} else if ([@"-debug" isEqualToString:[NSString stringWithUTF8String:argv[i]]]) {
+			_debug = YES;
+		} else if ([@"-key" isEqualToString:[NSString stringWithUTF8String:argv[i]]]) {
+			if (++i < argc) key = [NSString stringWithUTF8String:argv[i]];
+		}
+	}
+	if (!workDir) workDir = appDir;
+	openLog();
+	NSMutableArray *argsArr = [[NSMutableArray alloc] initWithCapacity:argc];
+	for (int i = 0; i < argc; ++i) {
+		[argsArr addObject:[NSString stringWithUTF8String:argv[i]]];
+	}
+	writeLog([[NSArray arrayWithObjects:@"Arguments: '", [argsArr componentsJoinedByString:@"' '"], @"'..", nil] componentsJoinedByString:@""]);
+	if (key) writeLog([@"Key: " stringByAppendingString:key]);
+	if (toSettings) writeLog(@"To Settings!");
+
+	if (procId) {
+		NSRunningApplication *app = [NSRunningApplication runningApplicationWithProcessIdentifier:procId];
+		for (int i = 0; i < 5 && app != nil && ![app isTerminated]; ++i) {
+			usleep(200000);
+			app = [NSRunningApplication runningApplicationWithProcessIdentifier:procId];
+		}
+		if (app) [app forceTerminate];
+		app = [NSRunningApplication runningApplicationWithProcessIdentifier:procId];
+		for (int i = 0; i < 5 && app != nil && ![app isTerminated]; ++i) {
+			usleep(200000);
+			app = [NSRunningApplication runningApplicationWithProcessIdentifier:procId];
+		}
+	}
+
+	if (update) {
+		writeLog(@"Starting update files iteration!");
+
+		NSFileManager *fileManager = [NSFileManager defaultManager];
+		NSString *srcDir = [workDir stringByAppendingString:@"tupdates/ready/"];
+		NSArray *keys = [NSArray arrayWithObject:NSURLIsDirectoryKey];
+		NSDirectoryEnumerator *enumerator = [fileManager
+											 enumeratorAtURL:[NSURL fileURLWithPath:[workDir stringByAppendingString:@"tupdates/ready"]]
+											 includingPropertiesForKeys:keys
+											 options:0
+											 errorHandler:^(NSURL *url, NSError *error) {
+												 return NO;
+											 }];
+		for (NSURL *url in enumerator) {
+			NSString *srcPath = [url path];
+			writeLog([@"Handling file " stringByAppendingString:srcPath]);
+			NSRange r = [srcPath rangeOfString:srcDir];
+			if (r.location != 0) {
+				writeLog([@"Bad file found, no base path " stringByAppendingString:srcPath]);
+				delFolder();
+				break;
+			}
+			NSString *pathPart = [srcPath substringFromIndex:r.length];
+			if ([pathPart rangeOfString:appName].location != 0) {
+				writeLog([@"Skipping not app file " stringByAppendingString:srcPath]);
+				continue;
+			}
+			NSString *dstPath = [appDir stringByAppendingString:pathPart];
+			NSError *error;
+			NSNumber *isDirectory = nil;
+			writeLog([[NSArray arrayWithObjects: @"Copying file ", srcPath, @" to ", dstPath, nil] componentsJoinedByString:@""]);
+			if (![url getResourceValue:&isDirectory forKey:NSURLIsDirectoryKey error:&error]) {
+				writeLog([@"Failed to get IsDirectory for file " stringByAppendingString:[url path]]);
+				delFolder();
+				break;
+			}
+			if ([isDirectory boolValue]) {
+				if (![fileManager createDirectoryAtPath:dstPath withIntermediateDirectories:YES attributes:nil error:nil]) {
+					writeLog([@"Failed to force path for directory " stringByAppendingString:dstPath]);
+					delFolder();
+					break;
+				}
+			} else if ([fileManager fileExistsAtPath:dstPath]) {
+				if (![[NSData dataWithContentsOfFile:srcPath] writeToFile:dstPath atomically:YES]) {
+					writeLog([@"Failed to edit file " stringByAppendingString:dstPath]);
+					delFolder();
+					break;
+				}
+			} else {
+				if (![fileManager copyItemAtPath:srcPath toPath:dstPath error:nil]) {
+					writeLog([@"Failed to copy file to " stringByAppendingString:dstPath]);
+					delFolder();
+					break;
+				}
+			}
+		}
+		delFolder();
+	}
+
+	NSString *appPath = [[NSArray arrayWithObjects:appDir, appName, nil] componentsJoinedByString:@""];
+	NSMutableArray *args = [[NSMutableArray alloc] initWithObjects:@"-noupdate", nil];
+	if (toSettings) [args addObject:@"-tosettings"];
+	if (_debug) [args addObject:@"-debug"];
+	if (autoStart) [args addObject:@"-autostart"];
+	if (key) {
+		[args addObject:@"-key"];
+		[args addObject:key];
+	}
+	writeLog([[NSArray arrayWithObjects:@"Running application '", appPath, @"' with args '", [args componentsJoinedByString:@"' '"], @"'..", nil] componentsJoinedByString:@""]);
+	NSError *error = nil;
+	NSRunningApplication *result = [[NSWorkspace sharedWorkspace]
+					launchApplicationAtURL:[NSURL fileURLWithPath:appPath]
+					options:NSWorkspaceLaunchDefault
+					configuration:[NSDictionary
+								   dictionaryWithObject:args
+								   forKey:NSWorkspaceLaunchConfigurationArguments]
+					error:&error];
+	if (!result) {
+		writeLog([@"Could not run application, error: " stringByAppendingString:error ? [error localizedDescription] : @"(nil)"]);
+	}
+	closeLog();
+	return result ? 0 : -1;
+}
+
diff --git a/Telegram/SourceFiles/app.cpp b/Telegram/SourceFiles/app.cpp
index 6cb8f499e..7f0f2c03c 100644
--- a/Telegram/SourceFiles/app.cpp
+++ b/Telegram/SourceFiles/app.cpp
@@ -156,6 +156,13 @@ namespace App {
 		return (peer_id & 0x100000000L) ? MTP_peerChat(MTP_int(int32(peer_id & 0xFFFFFFFFL))) : MTP_peerUser(MTP_int(int32(peer_id & 0xFFFFFFFFL)));
 	}
 
+    int32 userFromPeer(const PeerId &peer_id) {
+        return (peer_id & 0x100000000L) ? 0 : int32(peer_id & 0xFFFFFFFFL);
+    }
+    int32 chatFromPeer(const PeerId &peer_id) {
+        return (peer_id & 0x100000000L) ? int32(peer_id & 0xFFFFFFFFL) : 0;
+    }
+
 	int32 onlineWillChangeIn(int32 online, int32 now) {
 		if (online <= 0) return 86400;
 		if (online > now) {
@@ -314,7 +321,7 @@ namespace App {
 			case mtpc_userStatusOnline: data->onlineTill = status->c_userStatusOnline().vexpires.v; break;
 			}
 
-			if (data->contact < 0 && !data->phone.isEmpty() && data->id != MTP::authedId()) {
+			if (data->contact < 0 && !data->phone.isEmpty() && (data->id & 0xFFFFFFFF) != MTP::authedId()) {
 				data->contact = 0;
 			}
 			if (data->contact > 0 && !wasContact) {
@@ -605,7 +612,7 @@ namespace App {
 			}
 			if (user->contact > 0) {
 				if (!wasContact) {
-					App::main()->addNewContact(user->id & 0xFFFFFFFF, false);
+					App::main()->addNewContact(App::userFromPeer(user->id), false);
 					user->input = MTP_inputPeerContact(userId);
 					user->inputUser = MTP_inputUserContact(userId);
 				}
@@ -614,7 +621,7 @@ namespace App {
 					user->input = MTP_inputPeerForeign(userId, MTP_long(user->access));
 					user->inputUser = MTP_inputUserForeign(userId, MTP_long(user->access));
 				}
-				if (user->contact < 0 && !user->phone.isEmpty() && user->id != MTP::authedId()) {
+				if (user->contact < 0 && !user->phone.isEmpty() && App::userFromPeer(user->id) != MTP::authedId()) {
 					user->contact = 0;
 				}
 				if (wasContact) {
@@ -1204,9 +1211,11 @@ namespace App {
 
 		if (!::sprite) {
 			::sprite = new QPixmap(st::spriteFile);
+            if (cRetina()) ::sprite->setDevicePixelRatio(cRetinaFactor());
 		}
 		if (!::emojis) {
 			::emojis = new QPixmap(st::emojisFile);
+            if (cRetina()) ::emojis->setDevicePixelRatio(cRetinaFactor());
 		}
 		initEmoji();
 	}
@@ -1216,7 +1225,9 @@ namespace App {
 		textlnkDown(TextLinkPtr());
 
 		if (completely) {
+			LOG(("Deleting sound.."));
 			delete newMsgSound;
+			LOG(("Sound deleted!"));
 			newMsgSound = 0;
 
 			delete ::sprite;
@@ -1300,12 +1311,13 @@ namespace App {
 		EmojisMap *map = &(fontHeight == st::taDefFlat.font->height ? mainEmojisMap : otherEmojisMap[fontHeight]);
 		EmojisMap::const_iterator i = map->constFind(emoji->code);
 		if (i == map->cend()) {
-			QImage img(st::emojiSize + st::emojiPadding * 2, fontHeight, QImage::Format_ARGB32_Premultiplied);
+			QImage img(st::emojiImgSize + st::emojiPadding * cIntRetinaFactor() * 2, fontHeight * cIntRetinaFactor(), QImage::Format_ARGB32_Premultiplied);
+            if (cRetina()) img.setDevicePixelRatio(cRetinaFactor());
 			{
 				QPainter p(&img);
 				p.setCompositionMode(QPainter::CompositionMode_Source);
 				p.fillRect(0, 0, img.width(), img.height(), Qt::transparent);
-				p.drawPixmap(QPoint(st::emojiPadding, (fontHeight - st::emojiSize) / 2), App::emojis(), QRect(emoji->x, emoji->y, st::emojiSize, st::emojiSize));
+				p.drawPixmap(QPoint(st::emojiPadding * cIntRetinaFactor(), (fontHeight * cIntRetinaFactor() - st::emojiImgSize) / 2), App::emojis(), QRect(emoji->x, emoji->y, st::emojiImgSize, st::emojiImgSize));
 			}
 			i = map->insert(emoji->code, QPixmap::fromImage(img));
 		}
@@ -1605,7 +1617,7 @@ namespace App {
 					continue;
 				}
 				uint32 dataLen = *(const uint32*)decrypted.constData();
-				if (dataLen > decrypted.size() || dataLen <= fullDataLen - 16 || dataLen < 4) {
+				if (dataLen > uint32(decrypted.size()) || dataLen <= fullDataLen - 16 || dataLen < 4) {
 					LOG(("App Error: bad decrypted part size: %1, fullDataLen: %2, decrypted size: %3").arg(dataLen).arg(fullDataLen).arg(decrypted.size()));
 					continue;
 				}
@@ -1771,7 +1783,7 @@ namespace App {
 		quint32 count;
 		stream >> count;
 
-		for (int32 i = 0; i < count; ++i) {
+		for (uint32 i = 0; i < count; ++i) {
 			readOneMuted(stream);
 		}
 	}
diff --git a/Telegram/SourceFiles/app.h b/Telegram/SourceFiles/app.h
index ee74e191e..8a20785ac 100644
--- a/Telegram/SourceFiles/app.h
+++ b/Telegram/SourceFiles/app.h
@@ -60,6 +60,8 @@ namespace App {
 		return peerFromUser(user_id.v);
 	}
 	MTPpeer peerToMTP(const PeerId &peer_id);
+    int32 userFromPeer(const PeerId &peer_id);
+    int32 chatFromPeer(const PeerId &peer_id);
 
 	int32 onlineWillChangeIn(int32 onlineOnServer, int32 nowOnServer);
 	QString onlineText(int32 onlineOnServer, int32 nowOnServer);
diff --git a/Telegram/SourceFiles/application.cpp b/Telegram/SourceFiles/application.cpp
index 6f6a4f2e6..395b23c56 100644
--- a/Telegram/SourceFiles/application.cpp
+++ b/Telegram/SourceFiles/application.cpp
@@ -96,6 +96,12 @@ Application::Application(int &argc, char **argv) : PsApplication(argc, argv),
 		cSetScreenScale(dbisTwo);
 	}
 
+    if (devicePixelRatio() > 1) {
+        cSetRetina(true);
+        cSetRetinaFactor(devicePixelRatio());
+        cSetIntRetinaFactor(int32(cRetinaFactor()));
+    }
+
 	if (!cLangFile().isEmpty()) {
 		LangLoaderPlain loader(cLangFile());
 		if (!loader.errors().isEmpty()) {
@@ -177,7 +183,7 @@ void Application::updateGotCurrent() {
 		if (updates.exists()) {
 			QFileInfoList list = updates.entryInfoList(QDir::Files);
 			for (QFileInfoList::iterator i = list.begin(), e = list.end(); i != e; ++i) {
-				if (QRegularExpression("^tupdate\\d+$", QRegularExpression::CaseInsensitiveOption).match(i->fileName()).hasMatch()) {
+				if (QRegularExpression("^(tupdate|tmacupd|tlinuxupd)\\d+$", QRegularExpression::CaseInsensitiveOption).match(i->fileName()).hasMatch()) {
 					QFile(i->absoluteFilePath()).remove();
 				}
 			}
@@ -185,6 +191,7 @@ void Application::updateGotCurrent() {
 		emit updateLatest();
 	}
 	startUpdateCheck(true);
+	App::writeConfig();
 }
 
 void Application::updateFailedCurrent(QNetworkReply::NetworkError e) {
@@ -403,16 +410,16 @@ void Application::startUpdateCheck(bool forceWait) {
 		if (updates.exists()) {
 			QFileInfoList list = updates.entryInfoList(QDir::Files);
 			for (QFileInfoList::iterator i = list.begin(), e = list.end(); i != e; ++i) {
-				if (QRegularExpression("^tupdate\\d+$", QRegularExpression::CaseInsensitiveOption).match(i->fileName()).hasMatch()) {
+				if (QRegularExpression("^(tupdate|tmacupd|tlinuxupd)\\d+$", QRegularExpression::CaseInsensitiveOption).match(i->fileName()).hasMatch()) {
 					sendRequest = true;
 				}
 			}
 		}
 	}
-	if (cManyInstance() && !cDebug() || cPlatform() == dbipMac) return; // only main instance is updating
+	if ((cManyInstance() && !cDebug()) || cPlatform() == dbipLinux) return; // only main instance is updating
 
 	if (sendRequest) {
-		QNetworkRequest checkVersion(QUrl(qsl("http://tdesktop.com/win/tupdates/current")));
+		QNetworkRequest checkVersion(cUpdateURL());
 		if (updateReply) updateReply->deleteLater();
 
 		App::setProxySettings(updateManager);
@@ -497,10 +504,6 @@ void Application::startApp() {
 		App::writeUserConfig();
 		cSetNeedConfigResave(false);
 	}
-    if (devicePixelRatio() > 1) {
-        cSetRetina(true);
-        cSetRetinaFactor(devicePixelRatio());
-    }
 
 	window->createWinId();
 	window->init();
diff --git a/Telegram/SourceFiles/art/grid.png b/Telegram/SourceFiles/art/grid.png
deleted file mode 100644
index b886b374d..000000000
Binary files a/Telegram/SourceFiles/art/grid.png and /dev/null differ
diff --git a/Telegram/SourceFiles/art/grid_125x.png b/Telegram/SourceFiles/art/grid_125x.png
deleted file mode 100644
index 40409c8b8..000000000
Binary files a/Telegram/SourceFiles/art/grid_125x.png and /dev/null differ
diff --git a/Telegram/SourceFiles/art/grid_150x.png b/Telegram/SourceFiles/art/grid_150x.png
deleted file mode 100644
index ceaa29ce4..000000000
Binary files a/Telegram/SourceFiles/art/grid_150x.png and /dev/null differ
diff --git a/Telegram/SourceFiles/art/grid_200x.png b/Telegram/SourceFiles/art/grid_200x.png
deleted file mode 100644
index 2316f49f3..000000000
Binary files a/Telegram/SourceFiles/art/grid_200x.png and /dev/null differ
diff --git a/Telegram/SourceFiles/art/sprite_125x.png b/Telegram/SourceFiles/art/sprite_125x.png
deleted file mode 100644
index ddac976c6..000000000
Binary files a/Telegram/SourceFiles/art/sprite_125x.png and /dev/null differ
diff --git a/Telegram/SourceFiles/art/sprite_150x.png b/Telegram/SourceFiles/art/sprite_150x.png
deleted file mode 100644
index 5e9e4ab3a..000000000
Binary files a/Telegram/SourceFiles/art/sprite_150x.png and /dev/null differ
diff --git a/Telegram/SourceFiles/boxes/aboutbox.cpp b/Telegram/SourceFiles/boxes/aboutbox.cpp
index 81e107af3..188e8bf15 100644
--- a/Telegram/SourceFiles/boxes/aboutbox.cpp
+++ b/Telegram/SourceFiles/boxes/aboutbox.cpp
@@ -22,10 +22,10 @@ Copyright (c) 2014 John Preston, https://tdesktop.com
 #include "mainwidget.h"
 #include "window.h"
 
-AboutBox::AboutBox() : _hiding(false),
-_text(this, lang(lng_about_text), st::aboutLabel, st::aboutTextStyle),
+AboutBox::AboutBox() :
 _done(this, lang(lng_about_done), st::aboutCloseButton),
-a_opacity(0, 1) {
+_text(this, lang(lng_about_text), st::aboutLabel, st::aboutTextStyle),
+_hiding(false), a_opacity(0, 1) {
 
 	_width = st::aboutWidth;
 	_height = st::aboutHeight;
@@ -80,7 +80,7 @@ void AboutBox::paintEvent(QPaintEvent *e) {
 			// fill bg
 			p.fillRect(0, 0, _width, _height, st::boxBG->b);
 
-			p.drawPixmap(QPoint((_width - st::aboutIcon.width()) / 2, st::aboutIconTop), App::sprite(), st::aboutIcon);
+			p.drawPixmap(QPoint((_width - st::aboutIcon.pxWidth()) / 2, st::aboutIconTop), App::sprite(), st::aboutIcon);
 
 			p.setPen(st::black->p);
 			p.setFont(st::aboutHeaderFont->f);
diff --git a/Telegram/SourceFiles/boxes/addcontactbox.cpp b/Telegram/SourceFiles/boxes/addcontactbox.cpp
index 566b7428e..2ac12c875 100644
--- a/Telegram/SourceFiles/boxes/addcontactbox.cpp
+++ b/Telegram/SourceFiles/boxes/addcontactbox.cpp
@@ -24,14 +24,14 @@ Copyright (c) 2014 John Preston, https://tdesktop.com
 #include "window.h"
 
 AddContactBox::AddContactBox(QString fname, QString lname, QString phone) :
-	_hiding(false), _peer(0), _addRequest(0), _contactId(0),
-	_firstInput(this, st::inpAddContact, lang(lng_signup_firstname), fname),
-	_lastInput(this, st::inpAddContact, lang(lng_signup_lastname), lname),
-	_phoneInput(this, st::inpAddContact, lang(lng_contact_phone), phone.isEmpty() ? phone : App::formatPhone(phone)),
+	_peer(0),
 	_addButton(this, lang(lng_add_contact), st::btnSelectDone),
 	_retryButton(this, lang(lng_try_other_contact), st::btnSelectDone),
 	_cancelButton(this, lang(lng_cancel), st::btnSelectCancel),
-	a_opacity(0, 1) {
+    _firstInput(this, st::inpAddContact, lang(lng_signup_firstname), fname),
+    _lastInput(this, st::inpAddContact, lang(lng_signup_lastname), lname),
+    _phoneInput(this, st::inpAddContact, lang(lng_contact_phone), phone.isEmpty() ? phone : App::formatPhone(phone)),
+	_contactId(0), _addRequest(0), a_opacity(0, 1), _hiding(false) {
 
 	if (!phone.isEmpty()) {
 		_phoneInput.setDisabled(true);
@@ -41,14 +41,14 @@ AddContactBox::AddContactBox(QString fname, QString lname, QString phone) :
 }
 
 AddContactBox::AddContactBox(PeerData *peer) :
-	_hiding(false), _peer(peer), _addRequest(0), _contactId(0),
-	_firstInput(this, st::inpAddContact, lang(peer->chat ? lng_dlg_new_group_name : lng_signup_firstname), peer->chat ? peer->name : peer->asUser()->firstName),
-	_lastInput(this, st::inpAddContact, lang(lng_signup_lastname), peer->chat ? QString() : peer->asUser()->lastName),
-	_phoneInput(this, st::inpAddContact, lang(lng_contact_phone)),
+	_peer(peer),
 	_addButton(this, lang(lng_settings_save), st::btnSelectDone),
 	_retryButton(this, lang(lng_try_other_contact), st::btnSelectDone),
 	_cancelButton(this, lang(lng_cancel), st::btnSelectCancel),
-	a_opacity(0, 1) {
+    _firstInput(this, st::inpAddContact, lang(peer->chat ? lng_dlg_new_group_name : lng_signup_firstname), peer->chat ? peer->name : peer->asUser()->firstName),
+    _lastInput(this, st::inpAddContact, lang(lng_signup_lastname), peer->chat ? QString() : peer->asUser()->lastName),
+    _phoneInput(this, st::inpAddContact, lang(lng_contact_phone)),
+	_contactId(0), _addRequest(0), a_opacity(0, 1), _hiding(false) {
 
 	initBox();
 }
@@ -204,7 +204,7 @@ void AddContactBox::animStep(float64 dt) {
 		_cache = QPixmap();
 		if (!_hiding) {
 			showAll();
-			if (_firstInput.text().isEmpty() && _lastInput.text().isEmpty() || _phoneInput.isHidden() || !_phoneInput.isEnabled()) {
+			if ((_firstInput.text().isEmpty() && _lastInput.text().isEmpty()) || _phoneInput.isHidden() || !_phoneInput.isEnabled()) {
 				_firstInput.setFocus();
 			} else {
 				_phoneInput.setFocus();
@@ -238,7 +238,7 @@ void AddContactBox::onSend() {
 		_addRequest = MTP::send(MTPaccount_UpdateProfile(MTP_string(firstName), MTP_string(lastName)), rpcDone(&AddContactBox::onSaveSelfDone), rpcFail(&AddContactBox::onSaveSelfFail));
 	} else if (_peer) {
 		if (_peer->chat) {
-			_addRequest = MTP::send(MTPmessages_EditChatTitle(MTP_int(int32(_peer->id & 0xFFFFFFFF)), MTP_string(firstName)), rpcDone(&AddContactBox::onSaveChatDone), rpcFail(&AddContactBox::onSaveFail));
+			_addRequest = MTP::send(MTPmessages_EditChatTitle(MTP_int(App::chatFromPeer(_peer->id)), MTP_string(firstName)), rpcDone(&AddContactBox::onSaveChatDone), rpcFail(&AddContactBox::onSaveFail));
 		} else {
 			_contactId = MTP::nonce<uint64>();
 			QVector<MTPInputContact> v(1, MTP_inputPhoneContact(MTP_long(_contactId), MTP_string(_peer->asUser()->phone), MTP_string(firstName), MTP_string(lastName)));
diff --git a/Telegram/SourceFiles/boxes/addparticipantbox.cpp b/Telegram/SourceFiles/boxes/addparticipantbox.cpp
index 9a6cf34c4..3253f76f0 100644
--- a/Telegram/SourceFiles/boxes/addparticipantbox.cpp
+++ b/Telegram/SourceFiles/boxes/addparticipantbox.cpp
@@ -22,8 +22,8 @@ Copyright (c) 2014 John Preston, https://tdesktop.com
 #include "mainwidget.h"
 #include "window.h"
 
-AddParticipantInner::AddParticipantInner(ChatData *chat) : _chat(chat), _selCount(0),
-	_contacts(&App::main()->contactsList()), _sel(0), _filteredSel(-1), _mouseSel(false) {
+AddParticipantInner::AddParticipantInner(ChatData *chat) : _chat(chat),
+	_contacts(&App::main()->contactsList()), _sel(0), _filteredSel(-1), _mouseSel(false), _selCount(0) {
 	
 	_filter = qsl("a");
 	updateFilter();
@@ -151,7 +151,7 @@ void AddParticipantInner::paintDialog(QPainter &p, DialogRow *row, bool sel) {
 	data->name.drawElided(p, left + st::profileListPhotoSize + st::profileListPadding.width(), st::profileListNameTop, width() - st::participantDelta - st::profileListPadding.width() * 2 - st::profileListPhotoSize - st::profileListPadding.width() * 2);
 
 	if (sel || data->check) {
-		p.drawPixmap(QPoint(width() - st::profileCheckRect.width() - st::profileCheckDeltaX, st::profileListPadding.height() + (st::profileListPhotoSize - st::profileCheckRect.height()) / 2 - st::profileCheckDeltaY), App::sprite(), (data->check ? st::profileCheckActiveRect : st::profileCheckRect));
+		p.drawPixmap(QPoint(width() - st::profileCheckRect.pxWidth() - st::profileCheckDeltaX, st::profileListPadding.height() + (st::profileListPhotoSize - st::profileCheckRect.pxHeight()) / 2 - st::profileCheckDeltaY), App::sprite(), (data->check ? st::profileCheckActiveRect : st::profileCheckRect));
 	}
 
 	p.setFont(st::profileSubFont->f);
@@ -507,12 +507,12 @@ void AddParticipantInner::selectSkipPage(int32 h, int32 dir) {
 	selectSkip(points * dir);
 }
 
-AddParticipantBox::AddParticipantBox(ChatData *chat) : _inner(chat), _hiding(false),
-	_scroll(this, st::newGroupScroll),
+AddParticipantBox::AddParticipantBox(ChatData *chat) :
+	_scroll(this, st::newGroupScroll), _inner(chat),
 	_filter(this, st::contactsFilter, lang(lng_participant_filter)),
 	_invite(this, lang(lng_participant_invite), st::btnSelectDone),
 	_cancel(this, lang(lng_cancel), st::btnSelectCancel),
-	a_opacity(0, 1), af_opacity(anim::linear) {
+	_hiding(false), a_opacity(0, 1), af_opacity(anim::linear) {
 
 	_width = st::participantWidth;
 	_height = App::wnd()->height() - st::boxPadding.top() - st::boxPadding.bottom();
diff --git a/Telegram/SourceFiles/boxes/confirmbox.cpp b/Telegram/SourceFiles/boxes/confirmbox.cpp
index 0c6f86fcf..e1dfdf6ef 100644
--- a/Telegram/SourceFiles/boxes/confirmbox.cpp
+++ b/Telegram/SourceFiles/boxes/confirmbox.cpp
@@ -22,10 +22,10 @@ Copyright (c) 2014 John Preston, https://tdesktop.com
 #include "mainwidget.h"
 #include "window.h"
 
-ConfirmBox::ConfirmBox(QString text, QString doneText, QString cancelText) : _hiding(false), _text(100),
+ConfirmBox::ConfirmBox(QString text, QString doneText, QString cancelText) :
 	_confirm(this, doneText.isEmpty() ? lang(lng_continue) : doneText, st::btnSelectDone),
 	_cancel(this, cancelText.isEmpty() ? lang(lng_cancel) : cancelText, st::btnSelectCancel),
-	a_opacity(0, 1), af_opacity(anim::linear) {
+	_text(100), _hiding(false), a_opacity(0, 1), af_opacity(anim::linear) {
 
 	_text.setText(st::boxFont, text, _textPlainOptions);
 
diff --git a/Telegram/SourceFiles/boxes/connectionbox.cpp b/Telegram/SourceFiles/boxes/connectionbox.cpp
index e975e2678..047270462 100644
--- a/Telegram/SourceFiles/boxes/connectionbox.cpp
+++ b/Telegram/SourceFiles/boxes/connectionbox.cpp
@@ -22,17 +22,17 @@ Copyright (c) 2014 John Preston, https://tdesktop.com
 #include "mainwidget.h"
 #include "window.h"
 
-ConnectionBox::ConnectionBox() : _hiding(false),
-	_hostInput(this, st::inpConnectionHost, lang(lng_connection_host_ph), cConnectionProxy().host),
-	_portInput(this, st::inpConnectionPort, lang(lng_connection_port_ph), QString::number(cConnectionProxy().port)),
-	_userInput(this, st::inpConnectionUser, lang(lng_connection_user_ph), cConnectionProxy().user),
+ConnectionBox::ConnectionBox() :
+    _saveButton(this, lang(lng_connection_save), st::btnSelectDone),
+    _cancelButton(this, lang(lng_cancel), st::btnSelectCancel),
+    _hostInput(this, st::inpConnectionHost, lang(lng_connection_host_ph), cConnectionProxy().host),
+    _portInput(this, st::inpConnectionPort, lang(lng_connection_port_ph), QString::number(cConnectionProxy().port)),
+    _userInput(this, st::inpConnectionUser, lang(lng_connection_user_ph), cConnectionProxy().user),
 	_passwordInput(this, st::inpConnectionPassword, lang(lng_connection_password_ph), cConnectionProxy().password),
-	_saveButton(this, lang(lng_connection_save), st::btnSelectDone),
-	_cancelButton(this, lang(lng_cancel), st::btnSelectCancel),
 	_autoRadio(this, qsl("conn_type"), dbictAuto, lang(lng_connection_auto_rb), (cConnectionType() == dbictAuto)),
 	_httpProxyRadio(this, qsl("conn_type"), dbictHttpProxy, lang(lng_connection_http_proxy_rb), (cConnectionType() == dbictHttpProxy)),
 	_tcpProxyRadio(this, qsl("conn_type"), dbictTcpProxy, lang(lng_connection_tcp_proxy_rb), (cConnectionType() == dbictTcpProxy)),
-	a_opacity(0, 1) {
+	a_opacity(0, 1), _hiding(false) {
 
 	_width = st::addContactWidth;
 
diff --git a/Telegram/SourceFiles/boxes/contactsbox.cpp b/Telegram/SourceFiles/boxes/contactsbox.cpp
index 3fa8f74bb..1009be8eb 100644
--- a/Telegram/SourceFiles/boxes/contactsbox.cpp
+++ b/Telegram/SourceFiles/boxes/contactsbox.cpp
@@ -120,10 +120,10 @@ void ContactsInner::paintDialog(QPainter &p, DialogRow *row, bool sel) {
 	p.drawPixmap(left, st::profileListPadding.height(), user->photo->pix(st::profileListPhotoSize));
 
 	p.setPen(st::profileListNameColor->p);
-	data->name.drawElided(p, left + st::profileListPhotoSize + st::participantDelta, st::profileListNameTop, width() - st::profileListPadding.width() - st::profileListPhotoSize - st::profileListPadding.width() - st::participantDelta - st::scrollDef.width - st::contactsImg.width());
+	data->name.drawElided(p, left + st::profileListPhotoSize + st::participantDelta, st::profileListNameTop, width() - st::profileListPadding.width() - st::profileListPhotoSize - st::profileListPadding.width() - st::participantDelta - st::scrollDef.width - st::contactsImg.pxWidth());
 
 	if (sel) {
-		p.drawPixmap(QPoint(width() - st::contactsImg.width() - st::profileCheckDeltaX, st::profileListPadding.height() + (st::profileListPhotoSize - st::contactsImg.height()) / 2 - st::profileCheckDeltaY), App::sprite(), st::contactsImg);
+		p.drawPixmap(QPoint(width() - st::contactsImg.pxWidth() - st::profileCheckDeltaX, st::profileListPadding.height() + (st::profileListPhotoSize - st::contactsImg.pxHeight()) / 2 - st::profileCheckDeltaY), App::sprite(), st::contactsImg);
 	}
 
 	p.setFont(st::profileSubFont->f);
@@ -394,11 +394,11 @@ void ContactsInner::selectSkipPage(int32 h, int32 dir) {
 	selectSkip(points * dir);
 }
 
-ContactsBox::ContactsBox() : _inner(), _hiding(false), _scroll(this, st::newGroupScroll),
+ContactsBox::ContactsBox() : _scroll(this, st::newGroupScroll), _inner(),
 	_addContact(this, lang(lng_add_contact_button), st::contactsAdd),
 	_filter(this, st::contactsFilter, lang(lng_participant_filter)),
 	_close(this, lang(lng_contacts_done), st::contactsClose),
-	a_opacity(0, 1) {
+	_hiding(false), a_opacity(0, 1) {
 
 	_width = st::participantWidth;
 	_height = App::wnd()->height() - st::boxPadding.top() - st::boxPadding.bottom();
diff --git a/Telegram/SourceFiles/boxes/downloadpathbox.cpp b/Telegram/SourceFiles/boxes/downloadpathbox.cpp
index 0283d4e41..0b5d76c19 100644
--- a/Telegram/SourceFiles/boxes/downloadpathbox.cpp
+++ b/Telegram/SourceFiles/boxes/downloadpathbox.cpp
@@ -21,14 +21,14 @@ Copyright (c) 2014 John Preston, https://tdesktop.com
 #include "downloadpathbox.h"
 #include "gui/filedialog.h"
 
-DownloadPathBox::DownloadPathBox() : _hiding(false),
+DownloadPathBox::DownloadPathBox() :
 	_path(cDownloadPath()),
 	_tempRadio(this, qsl("dir_type"), 0, lang(lng_download_path_temp_radio), _path.isEmpty()),
 	_dirRadio(this, qsl("dir_type"), 1, lang(lng_download_path_dir_radio), !_path.isEmpty()),
 	_dirInput(this, st::inpDownloadDir, QString(), QDir::toNativeSeparators(_path)),
 	_saveButton(this, lang(lng_connection_save), st::btnSelectDone),
 	_cancelButton(this, lang(lng_cancel), st::btnSelectCancel),
-	a_opacity(0, 1) {
+	a_opacity(0, 1), _hiding(false) {
 
 	_width = st::addContactWidth;
 
diff --git a/Telegram/SourceFiles/boxes/emojibox.cpp b/Telegram/SourceFiles/boxes/emojibox.cpp
index 6f5312d2a..27e262971 100644
--- a/Telegram/SourceFiles/boxes/emojibox.cpp
+++ b/Telegram/SourceFiles/boxes/emojibox.cpp
@@ -65,9 +65,8 @@ namespace {
 	const uint32 replacesCount = sizeof(replaces) / sizeof(EmojiReplace), replacesInRow = 8;
 }
 
-EmojiBox::EmojiBox() : _hiding(false),
-	_done(this, lang(lng_about_done), st::aboutCloseButton),
-	a_opacity(0, 1) {
+EmojiBox::EmojiBox() : _done(this, lang(lng_about_done), st::aboutCloseButton),
+    _hiding(false), a_opacity(0, 1) {
 
 	fillBlocks();
 
@@ -96,7 +95,7 @@ EmojiBox::EmojiBox() : _hiding(false),
 void EmojiBox::fillBlocks() {
 	BlockRow currentRow;
 	currentRow.reserve(replacesInRow);
-	for (int32 i = 0; i < replacesCount; ++i) {
+	for (uint32 i = 0; i < replacesCount; ++i) {
 		Block block(getEmoji(replaces[i].code), QString::fromUtf8(replaces[i].replace));
 		currentRow.push_back(block);
 		if (currentRow.size() == replacesInRow) {
@@ -150,7 +149,7 @@ void EmojiBox::paintEvent(QPaintEvent *e) {
 				for (BlockRow::const_iterator j = i->cbegin(), en = i->cend(); j != en; ++j) {
 					if (j->emoji) {
 						QPoint pos(left + (st::emojiReplaceWidth - st::emojiSize) / 2, top + (st::emojiReplaceHeight - _blockHeight) / 2);
-						p.drawPixmap(pos, App::emojis(), QRect(j->emoji->x, j->emoji->y, st::emojiSize, st::emojiSize));
+						p.drawPixmap(pos, App::emojis(), QRect(j->emoji->x, j->emoji->y, st::emojiImgSize, st::emojiImgSize));
 					}
 					QRect trect(left, top + (st::emojiReplaceHeight + _blockHeight) / 2 - st::emojiTextFont->height, st::emojiReplaceWidth, st::emojiTextFont->height);
 					p.drawText(trect, j->text, QTextOption(Qt::AlignHCenter | Qt::AlignTop));
diff --git a/Telegram/SourceFiles/boxes/newgroupbox.cpp b/Telegram/SourceFiles/boxes/newgroupbox.cpp
index bc664fd8b..3030a59e4 100644
--- a/Telegram/SourceFiles/boxes/newgroupbox.cpp
+++ b/Telegram/SourceFiles/boxes/newgroupbox.cpp
@@ -129,10 +129,10 @@ void NewGroupInner::paintDialog(QPainter &p, DialogRow *row, bool sel) {
 	} else {
 		p.setPen(st::profileListNameColor->p);
 	}
-	data->name.drawElided(p, left + st::profileListPhotoSize + st::participantDelta, st::profileListNameTop, width() - st::profileListPadding.width() - st::profileListPhotoSize - st::profileListPadding.width() - st::participantDelta - st::scrollDef.width - st::profileCheckRect.width());
+	data->name.drawElided(p, left + st::profileListPhotoSize + st::participantDelta, st::profileListNameTop, width() - st::profileListPadding.width() - st::profileListPhotoSize - st::profileListPadding.width() - st::participantDelta - st::scrollDef.width - st::profileCheckRect.pxWidth());
 
 	if (sel || data->check) {
-		p.drawPixmap(QPoint(width() - st::profileCheckRect.width() - st::profileCheckDeltaX, st::profileListPadding.height() + (st::profileListPhotoSize - st::profileCheckRect.height()) / 2 - st::profileCheckDeltaY), App::sprite(), (data->check ? st::profileCheckActiveRect : st::profileCheckRect));
+		p.drawPixmap(QPoint(width() - st::profileCheckRect.pxWidth() - st::profileCheckDeltaX, st::profileListPadding.height() + (st::profileListPhotoSize - st::profileCheckRect.pxHeight()) / 2 - st::profileCheckDeltaY), App::sprite(), (data->check ? st::profileCheckActiveRect : st::profileCheckRect));
 	}
 
 	p.setFont(st::profileSubFont->f);
@@ -438,11 +438,11 @@ QVector<MTPInputUser> NewGroupInner::selectedInputs() {
 	return result;
 }
 
-NewGroupBox::NewGroupBox() : _inner(), _hiding(false), _scroll(this, st::newGroupScroll),
+NewGroupBox::NewGroupBox() : _scroll(this, st::newGroupScroll), _inner(),
 	_filter(this, st::contactsFilter, lang(lng_participant_filter)),
 	_next(this, lang(lng_create_group_next), st::btnSelectDone),
 	_cancel(this, lang(lng_cancel), st::btnSelectCancel),
-	a_opacity(0, 1) {
+    _hiding(false),	a_opacity(0, 1) {
 
 	_width = st::participantWidth;
 	_height = App::wnd()->height() - st::boxPadding.top() - st::boxPadding.bottom();
@@ -596,11 +596,11 @@ NewGroupBox::~NewGroupBox() {
 }
 
 CreateGroupBox::CreateGroupBox(const MTPVector<MTPInputUser> &users) : _users(users),
-	_hiding(false), _createRequestId(0),
+	_createRequestId(0),
 	_name(this, st::newGroupName, lang(lng_dlg_new_group_name)),
 	_create(this, lang(lng_dlg_create_group), st::btnSelectDone),
 	_cancel(this, lang(lng_cancel), st::btnSelectCancel),
-	a_opacity(0, 1) {
+    _hiding(false),	a_opacity(0, 1) {
 	_width = st::addContactWidth;
 
 	_height = st::addContactTitleHeight + st::addContactPadding.top() + _name.height() + st::addContactPadding.bottom() + _create.height();
diff --git a/Telegram/SourceFiles/boxes/photocropbox.cpp b/Telegram/SourceFiles/boxes/photocropbox.cpp
index 2f0b173e2..8729aabd6 100644
--- a/Telegram/SourceFiles/boxes/photocropbox.cpp
+++ b/Telegram/SourceFiles/boxes/photocropbox.cpp
@@ -25,10 +25,10 @@ Copyright (c) 2014 John Preston, https://tdesktop.com
 #include "photocropbox.h"
 #include "fileuploader.h"
 
-PhotoCropBox::PhotoCropBox(const QImage &img, const PeerId &peer) : _img(img), _downState(0), _peerId(peer),
+PhotoCropBox::PhotoCropBox(const QImage &img, const PeerId &peer) : _downState(0),
 	_sendButton(this, lang(lng_settings_save), st::btnSelectDone),
 	_cancelButton(this, lang(lng_cancel), st::btnSelectCancel),
-	a_opacity(0, 1) {
+    _img(img), _peerId(peer), a_opacity(0, 1) {
 
 	connect(&_sendButton, SIGNAL(clicked()), this, SLOT(onSend()));
 	connect(&_cancelButton, SIGNAL(clicked()), this, SLOT(onCancel()));
diff --git a/Telegram/SourceFiles/config.h b/Telegram/SourceFiles/config.h
index ce996a5c8..bc4f5f8fd 100644
--- a/Telegram/SourceFiles/config.h
+++ b/Telegram/SourceFiles/config.h
@@ -17,9 +17,13 @@ Copyright (c) 2014 John Preston, https://tdesktop.com
 */
 #pragma once
 
-static const int32 AppVersion = 5004;
-static const wchar_t *AppVersionStr = L"0.5.4";
+static const int32 AppVersion = 5005;
+static const wchar_t *AppVersionStr = L"0.5.5";
+#ifdef Q_OS_WIN
 static const wchar_t *AppName = L"Telegram Win (Unofficial)";
+#else
+static const wchar_t *AppName = L"Telegram Desktop";
+#endif
 static const wchar_t *AppId = L"{53F49750-6209-4FBF-9CA8-7A333C87D1ED}";
 
 #include "settings.h"
diff --git a/Telegram/SourceFiles/dialogswidget.cpp b/Telegram/SourceFiles/dialogswidget.cpp
index 46e45ab3d..f76fa9426 100644
--- a/Telegram/SourceFiles/dialogswidget.cpp
+++ b/Telegram/SourceFiles/dialogswidget.cpp
@@ -76,7 +76,7 @@ void DialogsListWidget::paintEvent(QPaintEvent *e) {
 }
 
 void DialogsListWidget::activate() {
-	if (filter.isEmpty() && !sel || !filter.isEmpty() && (filteredSel < 0 || filteredSel >= filtered.size())) {
+	if ((filter.isEmpty() && !sel) || (!filter.isEmpty() && (filteredSel < 0 || filteredSel >= filtered.size()))) {
 		selectSkip(1);
 	}
 }
@@ -90,7 +90,7 @@ void DialogsListWidget::mouseMoveEvent(QMouseEvent *e) {
 
 void DialogsListWidget::onUpdateSelected(bool force) {
 	QPoint mouse(mapFromGlobal(lastMousePos));
-	if (!force && !rect().contains(mouse) || !selByMouse) return;
+	if ((!force && !rect().contains(mouse)) || !selByMouse) return;
 
 	int w = width(), mouseY = mouse.y();
 	if (filter.isEmpty()) {
@@ -704,9 +704,19 @@ DialogsIndexed &DialogsListWidget::dialogsList() {
 	return dialogs;
 }
 
-DialogsWidget::DialogsWidget(MainWidget *parent) : QWidget(parent), _configLoaded(false), _drawShadow(true),
-scroll(this, st::dlgScroll), list(&scroll, parent), _filter(this, st::dlgFilter, lang(lng_dlg_filter)), dlgOffset(0), dlgCount(-1), dlgPreloading(0), contactsRequest(0),
-_newGroup(this, st::btnNewGroup), _addContact(this, st::btnAddContact) {
+DialogsWidget::DialogsWidget(MainWidget *parent) : QWidget(parent)
+, _configLoaded(false)
+, _drawShadow(true)
+, dlgOffset(0)
+, dlgCount(-1)
+, dlgPreloading(0)
+, contactsRequest(0)
+, _filter(this, st::dlgFilter, lang(lng_dlg_filter))
+, _newGroup(this, st::btnNewGroup)
+, _addContact(this, st::btnAddContact)
+, scroll(this, st::dlgScroll)
+, list(&scroll, parent)
+{
 	scroll.setWidget(&list);
 	scroll.setFocusPolicy(Qt::NoFocus);
 	connect(&list, SIGNAL(mustScrollTo(int, int)), &scroll, SLOT(scrollToY(int, int)));
@@ -726,6 +736,7 @@ _newGroup(this, st::btnNewGroup), _addContact(this, st::btnAddContact) {
 	_filter.show();
 	_filter.move(st::dlgPaddingHor, st::dlgFilterPadding);
 	_filter.setFocusPolicy(Qt::StrongFocus);
+	_filter.customUpDown(true);
 	_addContact.hide();
 	_newGroup.show();
 	_newGroup.move(width() - _newGroup.width() - st::dlgPaddingHor, 0);
diff --git a/Telegram/SourceFiles/dropdown.cpp b/Telegram/SourceFiles/dropdown.cpp
index 039d01620..51c81c16a 100644
--- a/Telegram/SourceFiles/dropdown.cpp
+++ b/Telegram/SourceFiles/dropdown.cpp
@@ -23,7 +23,7 @@ Copyright (c) 2014 John Preston, https://tdesktop.com
 #include "lang.h"
 
 Dropdown::Dropdown(QWidget *parent) : TWidget(parent),
-	_shadow(st::dropdownShadow), a_opacity(0), _hiding(false) {
+	_hiding(false), a_opacity(0), _shadow(st::dropdownShadow) {
 	_width = st::dropdownPadding.left() + st::dropdownPadding.right();
 	_height = st::dropdownPadding.top() + st::dropdownPadding.bottom();
 	resize(_width, _height);
@@ -173,7 +173,7 @@ bool Dropdown::eventFilter(QObject *obj, QEvent *e) {
 }
 
 DragArea::DragArea(QWidget *parent) : TWidget(parent),
-	_shadow(st::boxShadow), a_opacity(0), a_color(st::dragColor->c), _hiding(false), _in(false) {
+	_hiding(false), _in(false), a_opacity(0), a_color(st::dragColor->c), _shadow(st::boxShadow) {
 	setMouseTracking(true);
 	setAcceptDrops(true);
 }
@@ -311,7 +311,7 @@ bool DragArea::animStep(float64 ms) {
 
 static const int emojiPerRow = 7, emojiRowsPerPage = 6;
 
-EmojiPanInner::EmojiPanInner(QWidget *parent) : QWidget(parent), _selected(-1), _pressedSel(-1), _tab(cEmojiTab()) {
+EmojiPanInner::EmojiPanInner(QWidget *parent) : QWidget(parent), _tab(cEmojiTab()), _selected(-1), _pressedSel(-1) {
 	resize(emojiPerRow * st::emojiPanSize.width(), emojiRowsPerPage * st::emojiPanSize.height() - st::emojiPanSub);
 	setMouseTracking(true);
 	setFocusPolicy(Qt::NoFocus);
@@ -348,7 +348,7 @@ void EmojiPanInner::paintEvent(QPaintEvent *e) {
 				p.drawRoundedRect(QRect(w, st::emojiPanSize), st::emojiPanRound, st::emojiPanRound);
 				p.setOpacity(1);
 			}
-			QRect r(_emojis[index]->x, _emojis[index]->y, st::emojiSize, st::emojiSize);
+			QRect r(_emojis[index]->x, _emojis[index]->y, st::emojiImgSize, st::emojiImgSize);
 			p.drawPixmap(w + QPoint((st::emojiPanSize.width() - st::emojiSize) / 2, (st::emojiPanSize.height() - st::emojiSize) / 2), App::emojis(), r);
 		}
 	}
@@ -481,13 +481,14 @@ void EmojiPanInner::showEmojiPack(DBIEmojiTab packIndex) {
 }
 
 EmojiPan::EmojiPan(QWidget *parent) : TWidget(parent),
+_hiding(false), a_opacity(0), _shadow(st::dropdownShadow),
 _recent (this, qsl("emoji_group"), dbietRecent , QString(), cEmojiTab() == dbietRecent , st::rbEmojiRecent),
 _people (this, qsl("emoji_group"), dbietPeople , QString(), cEmojiTab() == dbietPeople , st::rbEmojiPeople),
 _nature (this, qsl("emoji_group"), dbietNature , QString(), cEmojiTab() == dbietNature , st::rbEmojiNature),
 _objects(this, qsl("emoji_group"), dbietObjects, QString(), cEmojiTab() == dbietObjects, st::rbEmojiObjects),
 _places (this, qsl("emoji_group"), dbietPlaces , QString(), cEmojiTab() == dbietPlaces , st::rbEmojiPlaces),
 _symbols(this, qsl("emoji_group"), dbietSymbols, QString(), cEmojiTab() == dbietSymbols, st::rbEmojiSymbols),
-_shadow(st::dropdownShadow), a_opacity(0), _hiding(false), _scroll(this, st::emojiScroll), _inner() {
+_scroll(this, st::emojiScroll), _inner() {
 	setFocusPolicy(Qt::NoFocus);
 	_scroll.setFocusPolicy(Qt::NoFocus);
 	_scroll.viewport()->setFocusPolicy(Qt::NoFocus);
@@ -666,9 +667,8 @@ void EmojiPan::hideAll() {
 }
 
 void EmojiPan::onTabChange() {
-	DBIEmojiTab newTab;
-	if (_recent.checked()) newTab = dbietRecent;
-	else if (_people.checked()) newTab = dbietPeople;
+	DBIEmojiTab newTab = dbietRecent;
+	if (_people.checked()) newTab = dbietPeople;
 	else if (_nature.checked()) newTab = dbietNature;
 	else if (_objects.checked()) newTab = dbietObjects;
 	else if (_places.checked()) newTab = dbietPlaces;
diff --git a/Telegram/SourceFiles/fileuploader.cpp b/Telegram/SourceFiles/fileuploader.cpp
index 0293863c8..a1988fcee 100644
--- a/Telegram/SourceFiles/fileuploader.cpp
+++ b/Telegram/SourceFiles/fileuploader.cpp
@@ -18,7 +18,7 @@ Copyright (c) 2014 John Preston, https://tdesktop.com
 #include "stdafx.h"
 #include "fileuploader.h"
 
-FileUploader::FileUploader() : uploading(0), sentSize(0) {
+FileUploader::FileUploader() : sentSize(0), uploading(0) {
 	nextTimer.setSingleShot(true);
 	connect(&nextTimer, SIGNAL(timeout()), this, SLOT(sendNext()));
 }
@@ -116,7 +116,7 @@ void FileUploader::sendNext() {
 		} else {
 			toSend = i->media.data.mid(i->docSentParts * i->docPartSize, i->docPartSize);
 		}
-		if (toSend.size() > i->docPartSize || toSend.size() < i->docPartSize && i->docSentParts + 1 != i->docPartsCount) {
+		if (toSend.size() > i->docPartSize || (toSend.size() < i->docPartSize && i->docSentParts + 1 != i->docPartsCount)) {
 			currentFailed();
 			return;
 		}
diff --git a/Telegram/SourceFiles/gui/boxshadow.cpp b/Telegram/SourceFiles/gui/boxshadow.cpp
index c3751bb13..245c8e514 100644
--- a/Telegram/SourceFiles/gui/boxshadow.cpp
+++ b/Telegram/SourceFiles/gui/boxshadow.cpp
@@ -19,7 +19,7 @@ Copyright (c) 2014 John Preston, https://tdesktop.com
 
 #include "boxshadow.h"
 
-BoxShadow::BoxShadow(const style::rect &topLeft) : _size(topLeft.width()) {
+BoxShadow::BoxShadow(const style::rect &topLeft) : _size(topLeft.width() / cIntRetinaFactor()) {
 	QImage cornersImage(_size * 2, _size * 2, QImage::Format_ARGB32_Premultiplied);
 	{
 		QPainter p(&cornersImage);
diff --git a/Telegram/SourceFiles/gui/countryinput.cpp b/Telegram/SourceFiles/gui/countryinput.cpp
index 04f7212da..45ad9de78 100644
--- a/Telegram/SourceFiles/gui/countryinput.cpp
+++ b/Telegram/SourceFiles/gui/countryinput.cpp
@@ -61,7 +61,7 @@ namespace {
 			CountriesByISO2::const_iterator already = countriesByISO2.constFind(info->iso2);
 			if (already != countriesByISO2.cend()) {
 				QString badISO = info->iso2;
-				badISO;
+				(void)badISO;
 			}
 			countriesByISO2.insert(info->iso2, info);
 		}
@@ -82,7 +82,7 @@ QString findValidCode(QString fullCode) {
 	return "";
 }
 
-CountryInput::CountryInput(QWidget *parent, const style::countryInput &st) : QWidget(parent), _st(st), _active(false), _select(0), _text(lang(lng_country_code)) {
+CountryInput::CountryInput(QWidget *parent, const style::countryInput &st) : QWidget(parent), _st(st), _active(false), _text(lang(lng_country_code)), _select(0) {
 	initCountries();
 
 	resize(_st.width, _st.height + _st.ptrSize.height());
@@ -204,8 +204,8 @@ CountryInput::~CountryInput() {
 	delete _select;
 }
 
-CountryList::CountryList(QWidget *parent, const style::countryList &st) : QWidget(parent), _sel(0), _mouseSel(false),
-	_st(st) {
+CountryList::CountryList(QWidget *parent, const style::countryList &st) : QWidget(parent), _sel(0),
+	_st(st), _mouseSel(false) {
 	CountriesByISO2::const_iterator l = countriesByISO2.constFind(lastValidISO);
 	bool seenLastValid = false;
 	int already = countriesAll.size();
@@ -338,7 +338,7 @@ void CountryList::mouseMoveEvent(QMouseEvent *e) {
 
 void CountryList::onUpdateSelected(bool force) {
 	QPoint p(mapFromGlobal(_mousePos));
-	if (!force && !rect().contains(p) || !_mouseSel) return;
+	if ((!force && !rect().contains(p)) || !_mouseSel) return;
 
 	int newSelected = p.y();
 	newSelected = (newSelected > _st.verticalMargin) ? (newSelected - _st.verticalMargin) / _st.rowHeight : 0;
@@ -413,11 +413,11 @@ QString CountryList::getSelectedCountry() const {
 }
 
 CountrySelect::CountrySelect() : QWidget(App::wnd()),
-	_scroll(this, st::scrollCountries), _list(&_scroll),
-	_filter(this, st::inpCountry, lang(lng_country_ph)),
-	_doneButton(this, lang(lng_country_done), st::btnSelectDone),
-	_cancelButton(this, lang(lng_cancel), st::btnSelectCancel),
-	_innerLeft(0), _innerTop(0), _innerWidth(0), _innerHeight(0), _result("none"),
+	_result("none"),
+    _filter(this, st::inpCountry, lang(lng_country_ph)), _scroll(this, st::scrollCountries), _list(&_scroll),
+    _doneButton(this, lang(lng_country_done), st::btnSelectDone),
+    _cancelButton(this, lang(lng_cancel), st::btnSelectCancel),
+    _innerLeft(0), _innerTop(0), _innerWidth(0), _innerHeight(0),
 	a_alpha(0), a_bgAlpha(0), a_coord(st::countriesSlideShift), _shadow(st::boxShadow) {
 	setGeometry(App::wnd()->rect());
 	
diff --git a/Telegram/SourceFiles/gui/emoji_config.cpp b/Telegram/SourceFiles/gui/emoji_config.cpp
index 8d313f193..6881d8144 100644
--- a/Telegram/SourceFiles/gui/emoji_config.cpp
+++ b/Telegram/SourceFiles/gui/emoji_config.cpp
@@ -1,5 +1,9 @@
 /*
-This file is part of Telegram Desktop,
+Created from emoji config by '/MetaEmoji' project
+
+WARNING! All changes made in this file will be lost!
+
+This file is part of Telegram Desktop, 
 an unofficial desktop messaging app, see https://telegram.org
 
 Telegram Desktop is free software: you can redistribute it and/or modify
@@ -26,7 +30,9 @@ namespace {
 void initEmoji() {
 	EmojiData *toFill = emojis = (EmojiData*)emojisData;
 
-	switch (cScale()) {
+	DBIScale emojiForScale = cRetina() ? dbisTwo : cScale();
+
+	switch (emojiForScale) {
 
 	case dbisOne:
 		new (toFill++) EmojiData(176, 0, 169, 0, 1);
@@ -3556,7 +3562,7 @@ const EmojiData *getEmoji(uint32 code) {
 		return 0;
 	}
 
-	if (highCode == 35 || highCode >= 48 && highCode < 58) {
+	if (highCode == 35 || (highCode >= 48 && highCode < 58)) {
 		if ((code & 0xFFFF) != 0x20E3) return 0;
 
 		switch (code) {
diff --git a/Telegram/SourceFiles/gui/flatbutton.cpp b/Telegram/SourceFiles/gui/flatbutton.cpp
index 500570d25..152cabf72 100644
--- a/Telegram/SourceFiles/gui/flatbutton.cpp
+++ b/Telegram/SourceFiles/gui/flatbutton.cpp
@@ -19,9 +19,9 @@ Copyright (c) 2014 John Preston, https://tdesktop.com
 #include "gui/flatbutton.h"
 
 FlatButton::FlatButton(QWidget *parent, const QString &text, const style::flatButton &st) : Button(parent),
-	_text(text), _opacity(1),
+	_text(text),
 	_st(st),
-	a_bg(st.bgColor->c), a_text(st.color->c) {
+	a_bg(st.bgColor->c), a_text(st.color->c), _opacity(1) {
 	if (_st.width < 0) {
 		_st.width = _st.font->m.width(text) - _st.width;
 	} else if (!_st.width) {
@@ -133,8 +133,8 @@ void LinkButton::onStateChange(int oldState, ButtonStateChangeSource source) {
 LinkButton::~LinkButton() {
 }
 
-IconedButton::IconedButton(QWidget *parent, const style::iconedButton &st, const QString &text) : Button(parent), _opacity(1),
-	_text(text), _st(st), a_opacity(_st.opacity), a_bg(_st.bgColor->c) {
+IconedButton::IconedButton(QWidget *parent, const style::iconedButton &st, const QString &text) : Button(parent),
+	_text(text), _st(st), a_opacity(_st.opacity), a_bg(_st.bgColor->c), _opacity(1) {
 
 	if (_st.width < 0) {
 		_st.width = _st.font->m.width(text) - _st.width;
diff --git a/Telegram/SourceFiles/gui/flatcheckbox.cpp b/Telegram/SourceFiles/gui/flatcheckbox.cpp
index bf3a538b8..69609810e 100644
--- a/Telegram/SourceFiles/gui/flatcheckbox.cpp
+++ b/Telegram/SourceFiles/gui/flatcheckbox.cpp
@@ -22,13 +22,13 @@ Copyright (c) 2014 John Preston, https://tdesktop.com
 #include "flatcheckbox.h"
 
 FlatCheckbox::FlatCheckbox(QWidget *parent, const QString &text, bool checked, const style::flatCheckbox &st) : Button(parent),
-	_text(text), _checked(checked), _st(st), _opacity(1), a_over(0, 0) {
+	_st(st), a_over(0, 0), _text(text), _opacity(1), _checked(checked) {
 	connect(this, SIGNAL(clicked()), this, SLOT(onClicked()));
 	connect(this, SIGNAL(stateChanged(int, ButtonStateChangeSource)), this, SLOT(onStateChange(int, ButtonStateChangeSource)));
 	setCursor(_st.cursor);
 	int32 w = _st.width, h = _st.height;
 	if (w <= 0) w = _st.textLeft + _st.font->m.width(_text) + 1;
-	if (h <= 0) h = qMax(_st.font->height, _st.imageRect.height());
+	if (h <= 0) h = qMax(_st.font->height, _st.imageRect.pxHeight());
 	resize(QSize(w, h));
 }
 
@@ -92,7 +92,7 @@ void FlatCheckbox::paintEvent(QPaintEvent *e) {
 	if (_state & StateDisabled) {
 		QRect sRect(_checked ? _st.chkDisImageRect : _st.disImageRect);
 		p.drawPixmap(_st.imagePos, App::sprite(), sRect);
-	} else if (_checked && _st.chkImageRect == _st.chkOverImageRect || !_checked && _st.imageRect == _st.overImageRect) {
+	} else if ((_checked && _st.chkImageRect == _st.chkOverImageRect) || (!_checked && _st.imageRect == _st.overImageRect)) {
 		p.setOpacity(_opacity);
 		QRect sRect(_checked ? _st.chkImageRect : _st.imageRect);
 		p.drawPixmap(_st.imagePos, App::sprite(), sRect);
@@ -185,7 +185,7 @@ void RadiobuttonsGroup::remove(FlatRadiobutton * const &radio) {
 }
 
 FlatRadiobutton::FlatRadiobutton(QWidget *parent, const QString &group, int32 value, const QString &text, bool checked, const style::flatCheckbox &st) :
-	FlatCheckbox(parent, text, checked, st), _value(value), _group(radioButtons.reg(group)) {
+	FlatCheckbox(parent, text, checked, st), _group(radioButtons.reg(group)), _value(value) {
 	_group->insert(this);
 	connect(this, SIGNAL(changed()), this, SLOT(onChanged()));
 	if (this->checked()) onChanged();
diff --git a/Telegram/SourceFiles/gui/flatinput.cpp b/Telegram/SourceFiles/gui/flatinput.cpp
index 9b6fb08eb..f032001f4 100644
--- a/Telegram/SourceFiles/gui/flatinput.cpp
+++ b/Telegram/SourceFiles/gui/flatinput.cpp
@@ -41,9 +41,9 @@ namespace {
 	FlatInputStyle _flatInputStyle;
 }
 
-FlatInput::FlatInput(QWidget *parent, const style::flatInput &st, const QString &pholder, const QString &v) : QLineEdit(v, parent), _oldtext(v),
-	_st(st), _phVisible(!v.length()), _kev(0), a_borderColor(st.borderColor->c), a_bgColor(st.bgColor->c), _notingBene(0),
-	a_phLeft(_phVisible ? 0 : st.phShift), a_phAlpha(_phVisible ? 1 : 0), a_phColor(st.phColor->c) {
+FlatInput::FlatInput(QWidget *parent, const style::flatInput &st, const QString &pholder, const QString &v) : QLineEdit(v, parent), _oldtext(v), _kev(0), _customUpDown(false), _phVisible(!v.length()),
+	a_phLeft(_phVisible ? 0 : st.phShift), a_phAlpha(_phVisible ? 1 : 0), a_phColor(st.phColor->c),
+    a_borderColor(st.borderColor->c), a_bgColor(st.bgColor->c), _notingBene(0), _st(st) {
 	resize(_st.width, _st.height);
 	
 	setFont(_st.font->f);
@@ -67,6 +67,10 @@ FlatInput::FlatInput(QWidget *parent, const style::flatInput &st, const QString
 	connect(&_touchTimer, SIGNAL(timeout()), this, SLOT(onTouchTimer()));
 }
 
+void FlatInput::customUpDown(bool custom) {
+	_customUpDown = custom;
+}
+
 void FlatInput::onTouchTimer() {
 	_touchRightButton = true;
 }
@@ -134,7 +138,7 @@ void FlatInput::paintEvent(QPaintEvent *e) {
 			p.drawRect(i, i, width() - 2 * i - 1, height() - 2 * i - 1);
 		}
 	}
-	if (_st.imgRect.width()) {
+	if (_st.imgRect.pxWidth()) {
 		p.drawPixmap(_st.imgPos, App::sprite(), _st.imgRect);
 	}
 
@@ -231,7 +235,12 @@ void FlatInput::correctValue(QKeyEvent *e, const QString &was) {
 void FlatInput::keyPressEvent(QKeyEvent *e) {
 	QString was(text());
 	_kev = e;
-	QLineEdit::keyPressEvent(e);
+	if (_customUpDown && (e->key() == Qt::Key_Up || e->key() == Qt::Key_Down)) {
+		e->ignore();
+	} else {
+		QLineEdit::keyPressEvent(e);
+	}
+
 	if (was == text()) { // call correct manually
 		correctValue(_kev, was);
 		_oldtext = text();
diff --git a/Telegram/SourceFiles/gui/flatinput.h b/Telegram/SourceFiles/gui/flatinput.h
index b77d8a44e..ea7012ef2 100644
--- a/Telegram/SourceFiles/gui/flatinput.h
+++ b/Telegram/SourceFiles/gui/flatinput.h
@@ -47,6 +47,8 @@ public:
 	QSize sizeHint() const;
 	QSize minimumSizeHint() const;
 
+	void customUpDown(bool isCustom);
+
 public slots:
 
 	void onTextChange(const QString &text);
@@ -71,6 +73,8 @@ private:
 	QString _ph, _oldtext;
 	QKeyEvent *_kev;
 
+	bool _customUpDown;
+
 	bool _phVisible;
 	anim::ivalue a_phLeft;
 	anim::fvalue a_phAlpha;
diff --git a/Telegram/SourceFiles/gui/flatlabel.cpp b/Telegram/SourceFiles/gui/flatlabel.cpp
index ca95c4040..d4335e0ee 100644
--- a/Telegram/SourceFiles/gui/flatlabel.cpp
+++ b/Telegram/SourceFiles/gui/flatlabel.cpp
@@ -29,7 +29,7 @@ namespace {
 }
 
 FlatLabel::FlatLabel(QWidget *parent, const QString &text, const style::flatLabel &st, const style::textStyle &tst) : TWidget(parent),
-_st(st), _tst(tst), _text(_st.width ? _st.width : QFIXED_MAX), _opacity(1) {
+_text(st.width ? st.width : QFIXED_MAX), _st(st), _tst(tst), _opacity(1) {
 	setRichText(text);
 }
 
diff --git a/Telegram/SourceFiles/gui/flattextarea.cpp b/Telegram/SourceFiles/gui/flattextarea.cpp
index ab76cdcda..8383763dc 100644
--- a/Telegram/SourceFiles/gui/flattextarea.cpp
+++ b/Telegram/SourceFiles/gui/flattextarea.cpp
@@ -20,10 +20,11 @@ Copyright (c) 2014 John Preston, https://tdesktop.com
 
 #include "flattextarea.h"
 
-FlatTextarea::FlatTextarea(QWidget *parent, const style::flatTextarea &st, const QString &pholder, const QString &v) : QTextEdit(v, parent), _oldtext(v),
-	_st(st), _phVisible(!v.length()), _ph(pholder), _fakeMargin(0),
-	a_phLeft(_phVisible ? 0 : st.phShift), a_phAlpha(_phVisible ? 1 : 0), a_phColor(st.phColor->c),
-	_touchPress(false), _touchRightButton(false), _touchMove(false), _replacingEmojis(false) {
+FlatTextarea::FlatTextarea(QWidget *parent, const style::flatTextarea &st, const QString &pholder, const QString &v) : QTextEdit(v, parent),
+	_ph(pholder), _oldtext(v), _phVisible(!v.length()),
+    a_phLeft(_phVisible ? 0 : st.phShift), a_phAlpha(_phVisible ? 1 : 0), a_phColor(st.phColor->c),
+    _st(st), _fakeMargin(0),
+    _touchPress(false), _touchRightButton(false), _touchMove(false), _replacingEmojis(false) {
 	setAcceptRichText(false);
 	resize(_st.width, _st.font->height);
 	
@@ -270,8 +271,8 @@ void FlatTextarea::insertEmoji(EmojiPtr emoji, QTextCursor c) {
 	QString url = qsl("emoji://") + QString::number(emoji->code, 16);
 	document()->addResource(QTextDocument::ImageResource, QUrl(url), QVariant(img));
 	QTextImageFormat imageFormat;
-	imageFormat.setWidth(img.width());
-	imageFormat.setHeight(img.height());
+	imageFormat.setWidth(img.width() / cIntRetinaFactor());
+	imageFormat.setHeight(img.height() / cIntRetinaFactor());
 	imageFormat.setName(url);
 	imageFormat.setVerticalAlignment(QTextCharFormat::AlignBaseline);
 	c.insertImage(imageFormat);
@@ -300,10 +301,10 @@ void FlatTextarea::processDocumentContentsChange(int position, int charsAdded) {
 
 				QString t(fragment.text());
 				for (const QChar *ch = t.constData(), *e = ch + t.size(); ch != e; ++ch) {
-					if (ch + 1 < e && (ch->isHighSurrogate() || (ch->unicode() >= 48 && ch->unicode() < 58 || ch->unicode() == 35) && (ch + 1)->unicode() == 0x20E3)) {
+					if (ch + 1 < e && (ch->isHighSurrogate() || (((ch->unicode() >= 48 && ch->unicode() < 58) || ch->unicode() == 35) && (ch + 1)->unicode() == 0x20E3))) {
 						emoji = getEmoji((ch->unicode() << 16) | (ch + 1)->unicode());
 						if (emoji) {
-							if (emoji->len == 4 && (ch + 3 >= e || (((ch + 2)->unicode() << 16) | (ch + 3)->unicode()) != emoji->code2)) {
+							if (emoji->len == 4 && (ch + 3 >= e || ((uint32((ch + 2)->unicode()) << 16) | uint32((ch + 3)->unicode())) != emoji->code2)) {
 								emoji = 0;
 							} else {
 								emojiPosition = p + (ch - t.constData());
@@ -438,7 +439,7 @@ QMimeData *FlatTextarea::createMimeDataFromSelection() const {
 
 void FlatTextarea::keyPressEvent(QKeyEvent *e) {
 	bool shift = e->modifiers().testFlag(Qt::ShiftModifier);
-	bool ctrl = e->modifiers().testFlag(Qt::ControlModifier), ctrlGood = ctrl && cCtrlEnter() || !ctrl && !shift && !cCtrlEnter();
+	bool ctrl = e->modifiers().testFlag(Qt::ControlModifier), ctrlGood = (ctrl && cCtrlEnter()) || (!ctrl && !shift && !cCtrlEnter());
 	bool enter = (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return);
 
 	if (enter && ctrlGood) {
diff --git a/Telegram/SourceFiles/gui/images.cpp b/Telegram/SourceFiles/gui/images.cpp
index b9e807cad..c73f8d3af 100644
--- a/Telegram/SourceFiles/gui/images.cpp
+++ b/Telegram/SourceFiles/gui/images.cpp
@@ -60,18 +60,16 @@ const QPixmap &Image::pix(int32 w, int32 h) const {
 	checkload();
 
 	if (w <= 0 || !width() || !height()) {
-        w = width() * cRetinaFactor();
+        w = width() * cIntRetinaFactor();
     } else if (cRetina()) {
-        w *= cRetinaFactor();
-        h *= cRetinaFactor();
+        w *= cIntRetinaFactor();
+        h *= cIntRetinaFactor();
     }
 	uint64 k = (uint64(w) << 32) | uint64(h);
 	Sizes::const_iterator i = _sizesCache.constFind(k);
 	if (i == _sizesCache.cend()) {
 		QPixmap p(pixNoCache(w, h, true));
-        if (cRetina()) {
-            p.setDevicePixelRatio(cRetinaFactor());
-        }
+        if (cRetina()) p.setDevicePixelRatio(cRetinaFactor());
 		i = _sizesCache.insert(k, p);
 		if (!p.isNull()) {
 			globalAquiredSize += int64(p.width()) * p.height() * 4;
@@ -192,10 +190,10 @@ int64 imageCacheSize() {
 	return globalAquiredSize;
 }
 
-StorageImage::StorageImage(int32 width, int32 height, int32 dc, const int64 &volume, int32 local, const int64 &secret) : loader(new mtpFileLoader(dc, volume, local, secret)), w(width), h(height) {
+StorageImage::StorageImage(int32 width, int32 height, int32 dc, const int64 &volume, int32 local, const int64 &secret) : w(width), h(height), loader(new mtpFileLoader(dc, volume, local, secret)) {
 }
 
-StorageImage::StorageImage(int32 width, int32 height, int32 dc, const int64 &volume, int32 local, const int64 &secret, QByteArray &bytes) : loader(0), w(width), h(height) {
+StorageImage::StorageImage(int32 width, int32 height, int32 dc, const int64 &volume, int32 local, const int64 &secret, QByteArray &bytes) : w(width), h(height), loader(0) {
 	setData(bytes);
 }
 
diff --git a/Telegram/SourceFiles/gui/scrollarea.cpp b/Telegram/SourceFiles/gui/scrollarea.cpp
index dffe381c6..3900aed22 100644
--- a/Telegram/SourceFiles/gui/scrollarea.cpp
+++ b/Telegram/SourceFiles/gui/scrollarea.cpp
@@ -36,10 +36,12 @@ void ScrollShadow::changeVisibility(bool shown) {
 }
 
 ScrollBar::ScrollBar(ScrollArea *parent, bool vert, const style::flatScroll *st) : QWidget(parent),
-	_st(st), _area(parent), _vertical(vert), _hideIn(-1),
+	_area(parent), _st(st), _vertical(vert),
 	_over(false), _overbar(false), _moving(false), _topSh(false), _bottomSh(false),
-	a_bg((_st->hiding ? st::transparent : _st->bgColor)->c), a_bar((_st->hiding ? st::transparent : _st->barColor)->c),
-	_connected(vert ? parent->verticalScrollBar() : parent->horizontalScrollBar()), _scrollMax(_connected->maximum()) {
+	_connected(vert ? parent->verticalScrollBar() : parent->horizontalScrollBar()),
+    _scrollMax(_connected->maximum()), _hideIn(-1),
+    a_bg((_st->hiding ? st::transparent : _st->bgColor)->c),
+    a_bar((_st->hiding ? st::transparent : _st->barColor)->c) {
 	recountSize();
 
 	_hideTimer.setSingleShot(true);
@@ -249,10 +251,12 @@ void ScrollBar::resizeEvent(QResizeEvent *e) {
 	updateBar();
 }
 
-ScrollArea::ScrollArea(QWidget *parent, const style::flatScroll &st, bool handleTouch) : QScrollArea(parent), _st(st), _touchEnabled(handleTouch),
+ScrollArea::ScrollArea(QWidget *parent, const style::flatScroll &st, bool handleTouch) : QScrollArea(parent),
+    _st(st),
 	hor(this, false, &_st), vert(this, true, &_st), topSh(this, &_st), bottomSh(this, &_st),
-	_touchScroll(false), _touchPress(false), _touchRightButton(false), _widgetAcceptsTouch(false),
-	_touchScrollState(TouchScrollManual), _touchPrevPosValid(false), _touchWaitingAcceleration(false), _touchSpeedTime(0), _touchAccelerationTime(0), _touchTime(0) {
+    _touchEnabled(handleTouch), _touchScroll(false), _touchPress(false), _touchRightButton(false),
+	_touchScrollState(TouchScrollManual), _touchPrevPosValid(false), _touchWaitingAcceleration(false),
+    _touchSpeedTime(0), _touchAccelerationTime(0), _touchTime(0), _widgetAcceptsTouch(false) {
 	connect(horizontalScrollBar(), SIGNAL(valueChanged(int)), this, SIGNAL(scrolled()));
 	connect(verticalScrollBar(), SIGNAL(valueChanged(int)), this, SIGNAL(scrolled()));
 	connect(&vert, SIGNAL(topShadowVisibility(bool)), &topSh, SLOT(changeVisibility(bool)));
@@ -365,8 +369,8 @@ void ScrollArea::touchUpdateSpeed() {
 			if (_touchScrollState == TouchScrollAuto) {
 				const int oldSpeedY = _touchSpeed.y();
 				const int oldSpeedX = _touchSpeed.x();
-				if ((oldSpeedY <= 0 && newSpeedY <= 0) || (oldSpeedY >= 0 && newSpeedY >= 0)
-					&& (oldSpeedX <= 0 && newSpeedX <= 0) || (oldSpeedX >= 0 && newSpeedX >= 0)) {
+				if ((oldSpeedY <= 0 && newSpeedY <= 0) || ((oldSpeedY >= 0 && newSpeedY >= 0)
+					&& (oldSpeedX <= 0 && newSpeedX <= 0)) || (oldSpeedX >= 0 && newSpeedX >= 0)) {
 					_touchSpeed.setY(snap((oldSpeedY + (newSpeedY / 4)), -MaxScrollAccelerated, +MaxScrollAccelerated));
 					_touchSpeed.setX(snap((oldSpeedX + (newSpeedX / 4)), -MaxScrollAccelerated, +MaxScrollAccelerated));
 				} else {
diff --git a/Telegram/SourceFiles/gui/style_core.cpp b/Telegram/SourceFiles/gui/style_core.cpp
index 93b252759..561953587 100644
--- a/Telegram/SourceFiles/gui/style_core.cpp
+++ b/Telegram/SourceFiles/gui/style_core.cpp
@@ -23,7 +23,7 @@ namespace {
 }
 
 namespace style {
-	FontData::FontData(uint32 size, uint32 flags, uint32 family, Font *other) : _size(size), _flags(flags), _family(family), f(_fontFamilies[family]), m(f) {
+	FontData::FontData(uint32 size, uint32 flags, uint32 family, Font *other) : f(_fontFamilies[family]), m(f), _size(size), _flags(flags), _family(family) {
 		if (other) {
 			memcpy(modified, other, sizeof(modified));
 		} else {
diff --git a/Telegram/SourceFiles/gui/style_core.h b/Telegram/SourceFiles/gui/style_core.h
index 746009829..3148f13e1 100644
--- a/Telegram/SourceFiles/gui/style_core.h
+++ b/Telegram/SourceFiles/gui/style_core.h
@@ -200,6 +200,32 @@ inline bool operator!=(const Font &a, const Font &b) {
 	typedef float64 number;
 	typedef QString string;
 	typedef QRect rect;
+    class sprite : public rect {
+    public:
+        sprite() {
+        }
+        sprite(int left, int top, int width, int height) : rect(left, top, width, height) {
+        }
+        inline int pxWidth() const {
+            return rect::width() / cIntRetinaFactor();
+        }
+        inline int pxHeight() const {
+            return rect::height() / cIntRetinaFactor();
+        }
+        inline QSize pxSize() const {
+            return rect::size() / cIntRetinaFactor();
+        }
+    private:
+        inline int width() const {
+            return rect::width();
+        }
+        inline int height() const {
+            return rect::height();
+        }
+        inline QSize size() const {
+            return rect::size();
+        }
+    };
 	typedef QPoint point;
 	typedef QSize size;
 	typedef anim::transition transition;
diff --git a/Telegram/SourceFiles/gui/text.cpp b/Telegram/SourceFiles/gui/text.cpp
index 75666f256..f7522142b 100644
--- a/Telegram/SourceFiles/gui/text.cpp
+++ b/Telegram/SourceFiles/gui/text.cpp
@@ -372,7 +372,7 @@ public:
 					} else if (ch == ')' || ch == ']' || ch == '}' || ch == '>') {
 						if (parenth.isEmpty()) break;
 						const QChar *q = parenth.pop(), open(*q);
-						if (ch == ')' && open != '(' || ch == ']' && open != '[' || ch == '}' && open != '{' || ch == '>' && open != '<') {
+						if ((ch == ')' && open != '(') || (ch == ']' && open != '[') || (ch == '}' && open != '{') || (ch == '>' && open != '<')) {
 							p = q;
 							break;
 						}
@@ -623,7 +623,7 @@ public:
 				ch = *ptr;
 				chInt = (chInt << 16) | ch.unicode();
 			}
-		} else if (ch >= 48 && ch < 58 || ch == 35) { // check for digit emoji
+		} else if ((ch >= 48 && ch < 58) || ch == 35) { // check for digit emoji
 			if (ptr + 1 < end && (ptr + 1)->unicode() == 0x20E3) {
 				_t->_text.push_back(ch);
 				skipBack = -1;
@@ -657,7 +657,7 @@ public:
 		if (!e) return;
 
 		if (e->len > 2) {
-			if (ptr + 2 >= end || e->code2 != (((ptr + 1)->unicode() << 16) | (ptr + 2)->unicode())) {
+			if (ptr + 2 >= end || e->code2 != ((uint32((ptr + 1)->unicode()) << 16) | uint32((ptr + 2)->unicode()))) {
 				return;
 			} else {
 				_t->_text.push_back(*++ptr);
@@ -669,8 +669,8 @@ public:
 		emoji = e;
 	}
 
-	TextParser(Text *t, const QString &text, const TextParseOptions &options) : _t(t), src(text), stopAfterWidth(QFIXED_MAX),
-		rich(options.flags & TextParseRichText), multiline(options.flags & TextParseMultiline), flags(0), lnkIndex(0), maxLnkIndex(0) {
+	TextParser(Text *t, const QString &text, const TextParseOptions &options) : _t(t), src(text),
+		rich(options.flags & TextParseRichText), multiline(options.flags & TextParseMultiline), maxLnkIndex(0), flags(0), lnkIndex(0), stopAfterWidth(QFIXED_MAX) {
 		int flags = options.flags;
 		if (options.maxw > 0 && options.maxh > 0) {
 			stopAfterWidth = ((options.maxh / _t->_font->height) + 1) * options.maxw;
@@ -884,7 +884,7 @@ public:
 		return _blockEnd(t, i, e) - (*i)->from();
 	}
 
-	TextPainter(QPainter *p, const Text *t) : _p(p), _t(t), _elideLast(false), _elideSavedBlock(0), _lnkResult(0), _inTextFlag(0), _getSymbol(0), _getSymbolAfter(0), _getSymbolUpon(0), _str(0) {
+	TextPainter(QPainter *p, const Text *t) : _p(p), _t(t), _elideLast(false), _str(0), _elideSavedBlock(0), _lnkResult(0), _inTextFlag(0), _getSymbol(0), _getSymbolAfter(0), _getSymbolUpon(0) {
 	}
 
 	void initNextParagraph(Text::TextBlocks::const_iterator i) {
@@ -1228,12 +1228,12 @@ public:
 		bool selectFromStart = (_selectedTo > _lineStart) && (_lineStart > 0) && (_selectedFrom <= _lineStart);
 		bool selectTillEnd = (_selectedTo >= _lineEnd) && (_lineEnd < _t->_text.size()) && (_selectedFrom < _lineEnd) && (!_endBlock || _endBlock->type() != TextBlockSkip);
 
-		if (selectFromStart && _parDirection == Qt::LeftToRight || selectTillEnd && _parDirection == Qt::RightToLeft) {
+		if ((selectFromStart && _parDirection == Qt::LeftToRight) || (selectTillEnd && _parDirection == Qt::RightToLeft)) {
 			if (x > _x) {
 				_p->fillRect(QRectF(_x.toReal(), _y + _yDelta, (x - _x).toReal(), _fontHeight), _textStyle->selectBG->b);
 			}
 		}
-		if (selectTillEnd && _parDirection == Qt::LeftToRight || selectFromStart && _parDirection == Qt::RightToLeft) {
+		if ((selectTillEnd && _parDirection == Qt::LeftToRight) || (selectFromStart && _parDirection == Qt::RightToLeft)) {
 			if (x < _x + _wLeft) {
 				_p->fillRect(QRectF((x + _w - _wLeft).toReal(), _y + _yDelta, (_x + _wLeft - x).toReal(), _fontHeight), _textStyle->selectBG->b);
 			}
@@ -1405,7 +1405,7 @@ public:
 							}
 						}
 					}
-					_p->drawPixmap(QPoint((glyphX + int(st::emojiPadding)).toInt(), _y + _yDelta + emojiY), App::emojis(), QRect(static_cast<EmojiBlock*>(currentBlock)->emoji->x, static_cast<EmojiBlock*>(currentBlock)->emoji->y, st::emojiSize, st::emojiSize));
+					_p->drawPixmap(QPoint((glyphX + int(st::emojiPadding)).toInt(), _y + _yDelta + emojiY), App::emojis(), QRect(static_cast<EmojiBlock*>(currentBlock)->emoji->x, static_cast<EmojiBlock*>(currentBlock)->emoji->y, st::emojiImgSize, st::emojiImgSize));
 //				} else if (_p && currentBlock->type() == TextBlockSkip) { // debug
 //					_p->fillRect(QRect(x.toInt(), _y, currentBlock->width(), static_cast<SkipBlock*>(currentBlock)->height()), QColor(0, 0, 0, 32));
 				}
@@ -1452,11 +1452,11 @@ public:
 					for (int charsCount = (ch2 - ch); ch < ch2; ++ch) {
 						QFixed shift1 = QFixed(2 * (charsCount - (ch2 - ch)) + 2) * gwidth / QFixed(2 * charsCount),
 						       shift2 = QFixed(2 * (charsCount - (ch2 - ch)) + 1) * gwidth / QFixed(2 * charsCount);
-						if (rtl && _lnkX >= tmpx - shift1 ||
-							!rtl && _lnkX < tmpx + shift1) {
+						if ((rtl && _lnkX >= tmpx - shift1) ||
+							(!rtl && _lnkX < tmpx + shift1)) {
 							*_getSymbol = _localFrom + itemStart + ch;
-							if (rtl && _lnkX >= tmpx - shift2 ||
-								!rtl && _lnkX < tmpx + shift2) {
+							if ((rtl && _lnkX >= tmpx - shift2) ||
+								(!rtl && _lnkX < tmpx + shift2)) {
 								*_getSymbolAfter = false;
 							} else {
 								*_getSymbolAfter = true;
@@ -2807,7 +2807,7 @@ namespace {
 class BlockParser {
 public:
 
-	BlockParser(QTextEngine *e, TextBlock *b, QFixed minResizeWidth, int32 blockFrom) : eng(e), block(b) {
+	BlockParser(QTextEngine *e, TextBlock *b, QFixed minResizeWidth, int32 blockFrom) : block(b), eng(e) {
 		parseWords(minResizeWidth, blockFrom);
 	}
 
diff --git a/Telegram/SourceFiles/gui/text.h b/Telegram/SourceFiles/gui/text.h
index d547dfef9..7f804c5c9 100644
--- a/Telegram/SourceFiles/gui/text.h
+++ b/Telegram/SourceFiles/gui/text.h
@@ -18,7 +18,6 @@ Copyright (c) 2014 John Preston, https://tdesktop.com
 #pragma once
 
 #include "gui/emoji_config.h"
-#include "gui/style_core.h"
 
 #include "../../../QtStatic/qtbase/src/gui/text/qfontengine_p.h"
 
@@ -126,8 +125,8 @@ private:
 struct TextWord {
 	TextWord() {
 	}
-	TextWord(uint16 from, QFixed width, QFixed rbearing, QFixed rpadding = 0) : from(from), width(width),
-		_rbearing(rbearing.value() > 0x7FFF ? 0x7FFF : (rbearing.value() < -0x7FFF ? -0x7FFF : rbearing.value())), rpadding(rpadding) {
+	TextWord(uint16 from, QFixed width, QFixed rbearing, QFixed rpadding = 0) : from(from),
+		_rbearing(rbearing.value() > 0x7FFF ? 0x7FFF : (rbearing.value() < -0x7FFF ? -0x7FFF : rbearing.value())), width(width), rpadding(rpadding) {
 	}
 	QFixed f_rbearing() const {
 		return QFixed::fromFixed(_rbearing);
@@ -358,7 +357,7 @@ public:
 
 	QString original(uint16 selectedFrom = 0, uint16 selectedTo = 0xFFFF, bool expandLinks = true) const;
 
-	bool lastDots(uint32 dots, int32 maxdots = 3) { // hack for typing animation
+	bool lastDots(int32 dots, int32 maxdots = 3) { // hack for typing animation
 		if (_text.size() < maxdots) return false;
 
 		int32 nowDots = 0, from = _text.size() - maxdots, to = _text.size();
diff --git a/Telegram/SourceFiles/gui/twidget.h b/Telegram/SourceFiles/gui/twidget.h
index 559b9e2f9..5fbf1600c 100644
--- a/Telegram/SourceFiles/gui/twidget.h
+++ b/Telegram/SourceFiles/gui/twidget.h
@@ -31,7 +31,7 @@ public:
 		return dynamic_cast<const TWidget*>(parentWidget());
 	}
 
-	virtual void leaveToChildEvent(QEvent */*e*/) { // e -- from enterEvent() of child TWidget
+	virtual void leaveToChildEvent(QEvent *e) { // e -- from enterEvent() of child TWidget
 	}
 
 protected:
diff --git a/Telegram/SourceFiles/history.cpp b/Telegram/SourceFiles/history.cpp
index 2f176661e..226293581 100644
--- a/Telegram/SourceFiles/history.cpp
+++ b/Telegram/SourceFiles/history.cpp
@@ -120,8 +120,16 @@ void historyInit() {
 NotifySettings globalNotifyAll, globalNotifyUsers, globalNotifyChats;
 NotifySettingsPtr globalNotifyAllPtr = UnknownNotifySettings, globalNotifyUsersPtr = UnknownNotifySettings, globalNotifyChatsPtr = UnknownNotifySettings;
 
-PeerData::PeerData(const PeerId &id) : id(id), access(0), chat(App::isChat(id)), loaded(false), notify(UnknownNotifySettings),
-	colorIndex(peerColorIndex(id)), color(peerColor(colorIndex)), photo(chat ? chatDefPhoto(colorIndex) : userDefPhoto(colorIndex)), nameVersion(0) {
+PeerData::PeerData(const PeerId &id) : id(id)
+, loaded(false)
+, chat(App::isChat(id))
+, access(0)
+, colorIndex(peerColorIndex(id))
+, color(peerColor(colorIndex))
+, photo(chat ? chatDefPhoto(colorIndex) : userDefPhoto(colorIndex))
+, nameVersion(0)
+, notify(UnknownNotifySettings)
+{
 }
 
 UserData *PeerData::asUser() {
@@ -259,11 +267,11 @@ QString saveFileName(const QString &title, const QString &filter, const QString
 
 void VideoOpenLink::onClick(Qt::MouseButton button) const {
 	VideoData *data = video();
-	if (!data->user && !data->date || button != Qt::LeftButton) return;
+	if ((!data->user && !data->date) || button != Qt::LeftButton) return;
 
 	QString already = data->already(true);
 	if (!already.isEmpty()) {
-		QDesktopServices::openUrl(QUrl::fromLocalFile(already));
+        psOpenFile(already);
 		return;
 	}
 	
@@ -304,7 +312,7 @@ void VideoSaveLink::onClick(Qt::MouseButton button) const {
 
 void VideoCancelLink::onClick(Qt::MouseButton button) const {
 	VideoData *data = video();
-	if (!data->user && !data->date || button != Qt::LeftButton) return;
+	if ((!data->user && !data->date) || button != Qt::LeftButton) return;
 
 	data->cancel();
 }
@@ -319,11 +327,11 @@ void VideoData::save(const QString &toFile) {
 
 void AudioOpenLink::onClick(Qt::MouseButton button) const {
 	AudioData *data = audio();
-	if (!data->user && !data->date || button != Qt::LeftButton) return;
+	if ((!data->user && !data->date) || button != Qt::LeftButton) return;
 
 	QString already = data->already(true);
 	if (!already.isEmpty()) {
-		QDesktopServices::openUrl(QUrl::fromLocalFile(already));
+        psOpenFile(already);
 		return;
 	}
 	
@@ -364,7 +372,7 @@ void AudioSaveLink::onClick(Qt::MouseButton button) const {
 
 void AudioCancelLink::onClick(Qt::MouseButton button) const {
 	AudioData *data = audio();
-	if (!data->user && !data->date || button != Qt::LeftButton) return;
+	if ((!data->user && !data->date) || button != Qt::LeftButton) return;
 
 	data->cancel();
 }
@@ -379,11 +387,11 @@ void AudioData::save(const QString &toFile) {
 
 void DocumentOpenLink::onClick(Qt::MouseButton button) const {
 	DocumentData *data = document();
-	if (!data->user && !data->date || button != Qt::LeftButton) return;
+	if ((!data->user && !data->date) || button != Qt::LeftButton) return;
 
 	QString already = data->already(true);
 	if (!already.isEmpty()) {
-		QDesktopServices::openUrl(QUrl::fromLocalFile(already));
+        psOpenFile(already);
 		return;
 	}
 	
@@ -451,7 +459,7 @@ void DocumentSaveLink::onClick(Qt::MouseButton button) const {
 
 void DocumentCancelLink::onClick(Qt::MouseButton button) const {
 	DocumentData *data = document();
-	if (!data->user && !data->date || button != Qt::LeftButton) return;
+	if ((!data->user && !data->date) || button != Qt::LeftButton) return;
 
 	data->cancel();
 }
@@ -520,7 +528,7 @@ void DialogRow::paint(QPainter &p, int32 w, bool act, bool sel) const {
 
 		// draw check
 		if (last->out() && last->needCheck()) {
-			const QRect *check;
+			const style::sprite *check;
 			if (last->id > 0) {
 				if (last->unread()) {
 					check = act ? &st::dlgActiveCheckImg : &st::dlgCheckImg;
@@ -530,7 +538,7 @@ void DialogRow::paint(QPainter &p, int32 w, bool act, bool sel) const {
 			} else {
 				check = act ? &st::dlgActiveSendImg : &st::dlgSendImg;
 			}
-			rectForName.setWidth(rectForName.width() - check->width() - st::dlgCheckSkip);
+			rectForName.setWidth(rectForName.width() - check->pxWidth() - st::dlgCheckSkip);
 			p.drawPixmap(QPoint(rectForName.left() + rectForName.width() + st::dlgCheckLeft, rectForName.top() + st::dlgCheckTop), App::sprite(), *check);
 		}
 
@@ -563,9 +571,26 @@ void DialogRow::paint(QPainter &p, int32 w, bool act, bool sel) const {
 	history->nameText.drawElided(p, rectForName.left(), rectForName.top(), rectForName.width());
 }
 
-History::History(const PeerId &peerId) : width(0), height(0), myTyping(0), showFrom(0), unreadLoaded(true), unreadBar(0), notifyFrom(0),
-	msgCount(0), offset(0), peer(App::peer(peerId)), posInDialogs(0), unreadCount(0), inboxReadTill(0), outboxReadTill(0), lastWidth(0), lastScrollTop(History::ScrollMax),
-	lastItemTextCache(st::dlgRichMinWidth), textCachedFor(0), typingText(st::dlgRichMinWidth), mute(isNotifyMuted(peer->notify)) {
+History::History(const PeerId &peerId) : width(0), height(0)
+, msgCount(0)
+, offset(0)
+, unreadCount(0)
+, inboxReadTill(0)
+, outboxReadTill(0)
+, showFrom(0)
+, notifyFrom(0)
+, unreadBar(0)
+, unreadLoaded(true)
+, peer(App::peer(peerId))
+, lastWidth(0)
+, lastScrollTop(History::ScrollMax)
+, mute(isNotifyMuted(peer->notify))
+, textCachedFor(0)
+, lastItemTextCache(st::dlgRichMinWidth)
+, posInDialogs(0)
+, typingText(st::dlgRichMinWidth)
+, myTyping(0)
+{
 }
 
 void History::updateNameText() {
@@ -1360,7 +1385,7 @@ void HistoryBlock::removeItem(HistoryItem *item) {
 				}
 			} else if (myIndex > 0) {
 				HistoryBlock *prevBlock = (*history)[myIndex - 1];
-				if (prevBlock->isEmpty() || (myIndex == 1) && (prevBlock->size() != 1 || (*prevBlock->cbegin())->itemType() != HistoryItem::DateType)) {
+				if (prevBlock->isEmpty() || ((myIndex == 1) && (prevBlock->size() != 1 || (*prevBlock->cbegin())->itemType() != HistoryItem::DateType))) {
 					LOG(("App Error: Found bad history, with no first date block: %1").arg((*history)[0]->size()));
 				} else if ((*prevBlock)[prevBlock->size() - 1]->itemType() == HistoryItem::DateType) {
 					(*prevBlock)[prevBlock->size() - 1]->destroy();
@@ -1411,8 +1436,16 @@ void HistoryBlock::removeItem(HistoryItem *item) {
 	}
 }
 
-HistoryItem::HistoryItem(History *history, HistoryBlock *block, MsgId msgId, bool out, bool unread, QDateTime msgDate, int32 from) :
-	y(0), id(msgId), _history(history), _block(block), _out(out), _unread(unread), date(msgDate), _from(App::user(from)), _fromVersion(_from->nameVersion) {
+HistoryItem::HistoryItem(History *history, HistoryBlock *block, MsgId msgId, bool out, bool unread, QDateTime msgDate, int32 from) : y(0)
+, id(msgId)
+, date(msgDate)
+, _from(App::user(from))
+, _fromVersion(_from->nameVersion)
+, _history(history)
+, _block(block)
+, _out(out)
+, _unread(unread)
+{
 }
 
 void HistoryItem::markRead() {
@@ -1442,7 +1475,10 @@ HistoryItem *regItem(HistoryItem *item) {
 	return 0;
 }
 
-HistoryPhoto::HistoryPhoto(const MTPDphoto &photo, int32 width) : data(App::feedPhoto(photo)), w(width), openl(new PhotoLink(data)) {
+HistoryPhoto::HistoryPhoto(const MTPDphoto &photo, int32 width) : data(App::feedPhoto(photo))
+, openl(new PhotoLink(data))
+, w(width)
+{
 	int32 tw = data->full->width(), th = data->full->height();
 	if (!tw || !th) {
 		tw = th = 1;
@@ -1522,7 +1558,7 @@ void HistoryPhoto::draw(QPainter &p, const HistoryItem *parent, const QString &t
 	int32 dateX = _maxw - timeWidth - st::msgDateImgDelta - 2 * st::msgDateImgPadding.x();
 	int32 dateY = _height - st::msgDateFont->height - 2 * st::msgDateImgPadding.y() - st::msgDateImgDelta;
 	if (parent->out()) {
-		dateX -= st::msgCheckRect.width() + st::msgDateImgCheckSpace;
+		dateX -= st::msgCheckRect.pxWidth() + st::msgDateImgCheckSpace;
 	}
 	int32 dateW = _maxw - dateX - st::msgDateImgDelta;
 	int32 dateH = _height - dateY - st::msgDateImgDelta;
@@ -1532,7 +1568,7 @@ void HistoryPhoto::draw(QPainter &p, const HistoryItem *parent, const QString &t
 	p.setPen(st::msgDateImgColor->p);
 	p.drawText(dateX + st::msgDateImgPadding.x(), dateY + st::msgDateImgPadding.y() + st::msgDateFont->ascent, time);
 	if (out) {
-		QPoint iconPos(dateX - 2 + dateW - st::msgDateImgCheckSpace - st::msgCheckRect.width(), dateY + (dateH - st::msgCheckRect.height()) / 2);
+		QPoint iconPos(dateX - 2 + dateW - st::msgDateImgCheckSpace - st::msgCheckRect.pxWidth(), dateY + (dateH - st::msgCheckRect.pxHeight()) / 2);
 		const QRect *iconRect;
 		if (parent->id > 0) {
 			if (parent->unread()) {
@@ -1583,7 +1619,14 @@ QString formatDurationAndSizeText(qint64 duration, qint64 size) {
 
 int32 _downloadWidth = 0, _openWithWidth = 0, _cancelWidth = 0, _buttonWidth = 0;
 
-HistoryVideo::HistoryVideo(const MTPDvideo &video, int32 width) : data(App::feedVideo(video)), w(width), _openl(new VideoOpenLink(data)), _savel(new VideoSaveLink(data)), _cancell(new VideoCancelLink(data)), _dldDone(0), _uplDone(0) {
+HistoryVideo::HistoryVideo(const MTPDvideo &video, int32 width) : data(App::feedVideo(video))
+, _openl(new VideoOpenLink(data))
+, _savel(new VideoSaveLink(data))
+, _cancell(new VideoCancelLink(data))
+, w(width)
+, _dldDone(0)
+, _uplDone(0)
+{
 	_maxw = st::mediaMaxWidth;
 
 	_size = formatDurationAndSizeText(data->duration, data->size);
@@ -1725,7 +1768,8 @@ void HistoryVideo::draw(QPainter &p, const HistoryItem *parent, const QString &t
 	p.fillRect(0, _height, width, st::msgShadow, shadow->b);
 
 	if (_thumbw) {
-		p.drawPixmap(QPoint(st::mediaPadding.left(), st::mediaPadding.top()), data->thumb->pix(_thumbw), QRect(_thumbx, _thumby, st::mediaThumbSize, st::mediaThumbSize));
+        int32 rf(cIntRetinaFactor());
+		p.drawPixmap(QPoint(st::mediaPadding.left(), st::mediaPadding.top()), data->thumb->pix(_thumbw), QRect(_thumbx * rf, _thumby * rf, st::mediaThumbSize * rf, st::mediaThumbSize * rf));
 	} else {
 		p.drawPixmap(QPoint(st::mediaPadding.left(), st::mediaPadding.top()), App::sprite(), (out ? st::mediaDocOutImg : st::mediaDocInImg));
 	}
@@ -1735,7 +1779,7 @@ void HistoryVideo::draw(QPainter &p, const HistoryItem *parent, const QString &t
 
 	int32 tleft = st::mediaPadding.left() + st::mediaThumbSize + st::mediaPadding.right();
 	int32 twidth = width - tleft - st::mediaPadding.right();
-	int32 fullTimeWidth = timeWidth + st::msgDateSpace + (out ? st::msgDateCheckSpace + st::msgCheckRect.width() : 0) + st::msgPadding.right() - st::msgDateDelta.x();
+	int32 fullTimeWidth = timeWidth + st::msgDateSpace + (out ? st::msgDateCheckSpace + st::msgCheckRect.pxWidth() : 0) + st::msgPadding.right() - st::msgDateDelta.x();
 	int32 secondwidth = width - tleft - fullTimeWidth;
 
 	p.setFont(st::mediaFont->f);
@@ -1775,7 +1819,7 @@ void HistoryVideo::draw(QPainter &p, const HistoryItem *parent, const QString &t
 
 	p.drawText(width + st::msgDateDelta.x() - fullTimeWidth + st::msgDateSpace, _height - st::msgPadding.bottom() + st::msgDateDelta.y() - st::msgDateFont->descent, time);
 	if (out) {
-		QPoint iconPos(width + 5 - st::msgPadding.right() - st::msgCheckRect.width(), _height + 1 - st::msgPadding.bottom() + st::msgDateDelta.y() - st::msgCheckRect.height());
+		QPoint iconPos(width + 5 - st::msgPadding.right() - st::msgCheckRect.pxWidth(), _height + 1 - st::msgPadding.bottom() + st::msgDateDelta.y() - st::msgCheckRect.pxHeight());
 		const QRect *iconRect;
 		if (parent->id > 0) {
 			if (parent->unread()) {
@@ -1790,7 +1834,14 @@ void HistoryVideo::draw(QPainter &p, const HistoryItem *parent, const QString &t
 	}
 }
 
-HistoryAudio::HistoryAudio(const MTPDaudio &audio, int32 width) : data(App::feedAudio(audio)), w(width), _openl(new AudioOpenLink(data)), _savel(new AudioSaveLink(data)), _cancell(new AudioCancelLink(data)), _dldDone(0), _uplDone(0) {
+HistoryAudio::HistoryAudio(const MTPDaudio &audio, int32 width) : data(App::feedAudio(audio))
+, _openl(new AudioOpenLink(data))
+, _savel(new AudioSaveLink(data))
+, _cancell(new AudioCancelLink(data))
+, w(width)
+, _dldDone(0)
+, _uplDone(0)
+{
 	_maxw = st::mediaMaxWidth;
 
 	_size = formatDurationAndSizeText(data->duration, data->size);
@@ -1857,7 +1908,7 @@ void HistoryAudio::draw(QPainter &p, const HistoryItem *parent, const QString &t
 
 	int32 tleft = st::mediaPadding.left() + st::mediaThumbSize + st::mediaPadding.right();
 	int32 twidth = width - tleft - st::mediaPadding.right();
-	int32 fullTimeWidth = timeWidth + st::msgDateSpace + (out ? st::msgDateCheckSpace + st::msgCheckRect.width() : 0) + st::msgPadding.right() - st::msgDateDelta.x();
+	int32 fullTimeWidth = timeWidth + st::msgDateSpace + (out ? st::msgDateCheckSpace + st::msgCheckRect.pxWidth() : 0) + st::msgPadding.right() - st::msgDateDelta.x();
 	int32 secondwidth = width - tleft - fullTimeWidth;
 
 	p.setFont(st::mediaFont->f);
@@ -1897,7 +1948,7 @@ void HistoryAudio::draw(QPainter &p, const HistoryItem *parent, const QString &t
 
 	p.drawText(width + st::msgDateDelta.x() - fullTimeWidth + st::msgDateSpace, _height - st::msgPadding.bottom() + st::msgDateDelta.y() - st::msgDateFont->descent, time);
 	if (out) {
-		QPoint iconPos(width + 5 - st::msgPadding.right() - st::msgCheckRect.width(), _height + 1 - st::msgPadding.bottom() + st::msgDateDelta.y() - st::msgCheckRect.height());
+		QPoint iconPos(width + 5 - st::msgPadding.right() - st::msgCheckRect.pxWidth(), _height + 1 - st::msgPadding.bottom() + st::msgDateDelta.y() - st::msgCheckRect.pxHeight());
 		const QRect *iconRect;
 		if (parent->id > 0) {
 			if (parent->unread()) {
@@ -1966,7 +2017,15 @@ HistoryMedia *HistoryAudio::clone() const {
 	return n;
 }
 
-HistoryDocument::HistoryDocument(const MTPDdocument &document, int32 width) : data(App::feedDocument(document)), w(width), _openl(new DocumentOpenLink(data)), _savel(new DocumentSaveLink(data)), _cancell(new DocumentCancelLink(data)), _name(data->name), _dldDone(0), _uplDone(0) {
+HistoryDocument::HistoryDocument(const MTPDdocument &document, int32 width) : data(App::feedDocument(document))
+, _openl(new DocumentOpenLink(data))
+, _savel(new DocumentSaveLink(data))
+, _cancell(new DocumentCancelLink(data))
+, w(width)
+, _name(data->name)
+, _dldDone(0)
+, _uplDone(0)
+{
 	_maxw = st::mediaMaxWidth;
 	_namew = st::mediaFont->m.width(_name.isEmpty() ? qsl("Document") : _name);
 
@@ -2048,7 +2107,8 @@ void HistoryDocument::draw(QPainter &p, const HistoryItem *parent, const QString
 	p.fillRect(0, _height, width, st::msgShadow, shadow->b);
 
 	if (_thumbw) {
-		p.drawPixmap(QPoint(st::mediaPadding.left(), st::mediaPadding.top()), data->thumb->pix(_thumbw), QRect(_thumbx, _thumby, st::mediaThumbSize, st::mediaThumbSize));
+        int32 rf(cIntRetinaFactor());
+		p.drawPixmap(QPoint(st::mediaPadding.left(), st::mediaPadding.top()), data->thumb->pix(_thumbw), QRect(_thumbx * rf, _thumby * rf, st::mediaThumbSize * rf, st::mediaThumbSize * rf));
 	} else {
 		p.drawPixmap(QPoint(st::mediaPadding.left(), st::mediaPadding.top()), App::sprite(), (out ? st::mediaDocOutImg : st::mediaDocInImg));
 	}
@@ -2058,7 +2118,7 @@ void HistoryDocument::draw(QPainter &p, const HistoryItem *parent, const QString
 
 	int32 tleft = st::mediaPadding.left() + st::mediaThumbSize + st::mediaPadding.right();
 	int32 twidth = width - tleft - st::mediaPadding.right();
-	int32 fullTimeWidth = timeWidth + st::msgDateSpace + (out ? st::msgDateCheckSpace + st::msgCheckRect.width() : 0) + st::msgPadding.right() - st::msgDateDelta.x();
+	int32 fullTimeWidth = timeWidth + st::msgDateSpace + (out ? st::msgDateCheckSpace + st::msgCheckRect.pxWidth() : 0) + st::msgPadding.right() - st::msgDateDelta.x();
 	int32 secondwidth = width - tleft - fullTimeWidth;
 
 	p.setFont(st::mediaFont->f);
@@ -2102,7 +2162,7 @@ void HistoryDocument::draw(QPainter &p, const HistoryItem *parent, const QString
 
 	p.drawText(width + st::msgDateDelta.x() - fullTimeWidth + st::msgDateSpace, _height - st::msgPadding.bottom() + st::msgDateDelta.y() - st::msgDateFont->descent, time);
 	if (out) {
-		QPoint iconPos(width + 5 - st::msgPadding.right() - st::msgCheckRect.width(), _height + 1 - st::msgPadding.bottom() + st::msgDateDelta.y() - st::msgCheckRect.height());
+		QPoint iconPos(width + 5 - st::msgPadding.right() - st::msgCheckRect.pxWidth(), _height + 1 - st::msgPadding.bottom() + st::msgDateDelta.y() - st::msgCheckRect.pxHeight());
 		const QRect *iconRect;
 		if (parent->id > 0) {
 			if (parent->unread()) {
@@ -2177,7 +2237,11 @@ HistoryMedia *HistoryDocument::clone() const {
 	return n;
 }
 
-HistoryContact::HistoryContact(int32 userId, const QString &first, const QString &last, const QString &phone) : userId(userId), phone(App::formatPhone(phone)), contact(App::userLoaded(userId)), w(0) {
+HistoryContact::HistoryContact(int32 userId, const QString &first, const QString &last, const QString &phone) : userId(userId)
+, w(0)
+, phone(App::formatPhone(phone))
+, contact(App::userLoaded(userId))
+{
 	_maxw = st::mediaMaxWidth;
 	name.setText(st::mediaFont, (first + ' ' + last).trimmed(), _textNameOptions);
 
@@ -2197,7 +2261,7 @@ HistoryContact::HistoryContact(int32 userId, const QString &first, const QString
 
 void HistoryContact::initDimensions(const HistoryItem *parent, int32 timeWidth) {
 	int32 tleft = st::mediaPadding.left() + st::mediaThumbSize + st::mediaPadding.right();
-	int32 fullTimeWidth = timeWidth + st::msgDateSpace + (parent->out() ? st::msgDateCheckSpace + st::msgCheckRect.width() : 0) + st::msgPadding.right() - st::msgDateDelta.x();
+	int32 fullTimeWidth = timeWidth + st::msgDateSpace + (parent->out() ? st::msgDateCheckSpace + st::msgCheckRect.pxWidth() : 0) + st::msgPadding.right() - st::msgDateDelta.x();
 	if (name.maxWidth() + tleft + fullTimeWidth > _maxw) {
 		_maxw = name.maxWidth() + tleft + fullTimeWidth;
 	}
@@ -2256,7 +2320,7 @@ void HistoryContact::draw(QPainter &p, const HistoryItem *parent, const QString
 
 	int32 tleft = st::mediaPadding.left() + st::mediaThumbSize + st::mediaPadding.right();
 	int32 twidth = width - tleft - st::mediaPadding.right();
-	int32 fullTimeWidth = timeWidth + st::msgDateSpace + (out ? st::msgDateCheckSpace + st::msgCheckRect.width() : 0) + st::msgPadding.right() - st::msgDateDelta.x();
+	int32 fullTimeWidth = timeWidth + st::msgDateSpace + (out ? st::msgDateCheckSpace + st::msgCheckRect.pxWidth() : 0) + st::msgPadding.right() - st::msgDateDelta.x();
 	int32 secondwidth = width - tleft - fullTimeWidth;
 
 	p.setFont(st::mediaFont->f);
@@ -2279,7 +2343,7 @@ void HistoryContact::draw(QPainter &p, const HistoryItem *parent, const QString
 
 	p.drawText(width + st::msgDateDelta.x() - fullTimeWidth + st::msgDateSpace, _height - st::msgPadding.bottom() + st::msgDateDelta.y() - st::msgDateFont->descent, time);
 	if (out) {
-		QPoint iconPos(width + 5 - st::msgPadding.right() - st::msgCheckRect.width(), _height + 1 - st::msgPadding.bottom() + st::msgDateDelta.y() - st::msgCheckRect.height());
+		QPoint iconPos(width + 5 - st::msgPadding.right() - st::msgCheckRect.pxWidth(), _height + 1 - st::msgPadding.bottom() + st::msgDateDelta.y() - st::msgCheckRect.pxHeight());
 		const QRect *iconRect;
 		if (parent->id > 0) {
 			if (parent->unread()) {
@@ -2295,7 +2359,12 @@ void HistoryContact::draw(QPainter &p, const HistoryItem *parent, const QString
 }
 
 HistoryMessage::HistoryMessage(History *history, HistoryBlock *block, const MTPDmessage &msg) :
-	HistoryItem(history, block, msg.vid.v, msg.vout.v, msg.vunread.v, ::date(msg.vdate), msg.vfrom_id.v), media(0), _text(st::msgMinWidth), _textWidth(0), _textHeight(0) {
+	HistoryItem(history, block, msg.vid.v, msg.vout.v, msg.vunread.v, ::date(msg.vdate), msg.vfrom_id.v)
+, _text(st::msgMinWidth)
+, _textWidth(0)
+, _textHeight(0)
+, media(0)
+{
 	QString text(textClean(qs(msg.vmessage)));
 	initMedia(msg.vmedia, text);
 	initDimensions(text);
@@ -2314,14 +2383,24 @@ HistoryMessage::HistoryMessage(History *history, HistoryBlock *block, const MTPD
 //}
 
 HistoryMessage::HistoryMessage(History *history, HistoryBlock *block, MsgId msgId, bool out, bool unread, QDateTime date, int32 from, const QString &msg, const MTPMessageMedia &media) :
-	HistoryItem(history, block, msgId, out, unread, date, from), media(0), _text(st::msgMinWidth), _textWidth(0), _textHeight(0) {
+	HistoryItem(history, block, msgId, out, unread, date, from)
+, _text(st::msgMinWidth)
+, _textWidth(0)
+, _textHeight(0)
+, media(0)
+{
 	QString text(msg);
 	initMedia(media, text);
 	initDimensions(text);
 }
 
 HistoryMessage::HistoryMessage(History *history, HistoryBlock *block, MsgId msgId, bool out, bool unread, QDateTime date, int32 from, const QString &msg, HistoryMedia *fromMedia) :
-	HistoryItem(history, block, msgId, out, unread, date, from), media(0), _text(st::msgMinWidth), _textWidth(0), _textHeight(0) {
+	HistoryItem(history, block, msgId, out, unread, date, from)
+, _text(st::msgMinWidth)
+, _textWidth(0)
+, _textHeight(0)
+, media(0)
+{
 	QString text(msg);
 	if (fromMedia) {
 		media = fromMedia->clone();
@@ -2383,7 +2462,7 @@ void HistoryMessage::initDimensions(const QString &text) {
 		_maxw = media->maxWidth();
 		_minh = media->height();
 	} else {
-		timeWidth += st::msgDateSpace + (out() ? st::msgDateCheckSpace + st::msgCheckRect.width() : 0) - st::msgDateDelta.x();
+		timeWidth += st::msgDateSpace + (out() ? st::msgDateCheckSpace + st::msgCheckRect.pxWidth() : 0) - st::msgDateDelta.x();
 		_text.setText(st::msgFont, text + textcmdSkipBlock(timeWidth, st::msgDateFont->height - st::msgDateDelta.y()), _historyTextOptions);
 		_maxw = _text.maxWidth();
 		_minh = _text.minHeight();
@@ -2470,7 +2549,7 @@ void HistoryMessage::draw(QPainter &p, uint32 selection) const {
 
 		p.drawText(r.right() - st::msgPadding.right() + st::msgDateDelta.x() - timeWidth + st::msgDateSpace, r.bottom() - st::msgPadding.bottom() + st::msgDateDelta.y() - st::msgDateFont->descent, time);
 		if (_out) {
-			QPoint iconPos(r.right() + 5 - st::msgPadding.right() - st::msgCheckRect.width(), r.bottom() + 1 - st::msgPadding.bottom() + st::msgDateDelta.y() - st::msgCheckRect.height());
+			QPoint iconPos(r.right() + 5 - st::msgPadding.right() - st::msgCheckRect.pxWidth(), r.bottom() + 1 - st::msgPadding.bottom() + st::msgDateDelta.y() - st::msgCheckRect.pxHeight());
 			const QRect *iconRect;
 			if (id > 0) {
 				if (unread()) {
@@ -2712,17 +2791,23 @@ HistoryMessage::~HistoryMessage() {
 	delete media;
 }
 
-HistoryForwarded::HistoryForwarded(History *history, HistoryBlock *block, const MTPDmessageForwarded &msg) :
-	HistoryMessage(history, block, msg.vid.v, msg.vout.v, msg.vunread.v, ::date(msg.vdate), msg.vfrom_id.v, textClean(qs(msg.vmessage)), msg.vmedia),
-	fwdFrom(App::user(msg.vfwd_from_id.v)), fwdFromVersion(fwdFrom->nameVersion), fwdDate(::date(msg.vfwd_date)), fromWidth(st::msgServiceFont->m.width(lang(lng_forwarded_from))), fwdFromName(4096) {
+HistoryForwarded::HistoryForwarded(History *history, HistoryBlock *block, const MTPDmessageForwarded &msg) : HistoryMessage(history, block, msg.vid.v, msg.vout.v, msg.vunread.v, ::date(msg.vdate), msg.vfrom_id.v, textClean(qs(msg.vmessage)), msg.vmedia)
+, fwdDate(::date(msg.vfwd_date))
+, fwdFrom(App::user(msg.vfwd_from_id.v))
+, fwdFromName(4096)
+, fwdFromVersion(fwdFrom->nameVersion)
+, fromWidth(st::msgServiceFont->m.width(lang(lng_forwarded_from)))
+{
 	fwdNameUpdated();
 }
 
-HistoryForwarded::HistoryForwarded(History *history, HistoryBlock *block, MsgId id, HistoryMessage *msg) :
-	HistoryMessage(history, block, id, true, true, ::date(unixtime()), MTP::authedId(), msg->HistoryMessage::selectedText(FullItemSel), msg->getMedia()),
-	fwdFrom(dynamic_cast<HistoryForwarded*>(msg) ? dynamic_cast<HistoryForwarded*>(msg)->fromForwarded() : msg->from()), fwdFromVersion(fwdFrom->nameVersion),
-	fwdDate(dynamic_cast<HistoryForwarded*>(msg) ? dynamic_cast<HistoryForwarded*>(msg)->dateForwarded() : msg->date),
-	fromWidth(st::msgServiceFont->m.width(lang(lng_forwarded_from))), fwdFromName(4096) {
+HistoryForwarded::HistoryForwarded(History *history, HistoryBlock *block, MsgId id, HistoryMessage *msg) : HistoryMessage(history, block, id, true, true, ::date(unixtime()), MTP::authedId(), msg->HistoryMessage::selectedText(FullItemSel), msg->getMedia())
+, fwdDate(dynamic_cast<HistoryForwarded*>(msg) ? dynamic_cast<HistoryForwarded*>(msg)->dateForwarded() : msg->date)
+, fwdFrom(dynamic_cast<HistoryForwarded*>(msg) ? dynamic_cast<HistoryForwarded*>(msg)->fromForwarded() : msg->from())
+, fwdFromName(4096)
+, fwdFromVersion(fwdFrom->nameVersion)
+, fromWidth(st::msgServiceFont->m.width(lang(lng_forwarded_from)))
+{
 	fwdNameUpdated();
 }
 
@@ -2945,7 +3030,10 @@ QString HistoryServiceMsg::messageByAction(const MTPmessageAction &action, TextL
 }
 
 HistoryServiceMsg::HistoryServiceMsg(History *history, HistoryBlock *block, const MTPDmessageService &msg) :
-	HistoryItem(history, block, msg.vid.v, msg.vout.v, msg.vunread.v, ::date(msg.vdate), msg.vfrom_id.v), media(0), _text(st::msgMinWidth) {
+	HistoryItem(history, block, msg.vid.v, msg.vout.v, msg.vunread.v, ::date(msg.vdate), msg.vfrom_id.v)
+, _text(st::msgMinWidth)
+, media(0)
+{
 
 	TextLinkPtr second;
 	QString text(messageByAction(msg.vaction, second));
@@ -2975,7 +3063,10 @@ HistoryServiceMsg::HistoryServiceMsg(History *history, HistoryBlock *block, cons
 }
 /**/
 HistoryServiceMsg::HistoryServiceMsg(History *history, HistoryBlock *block, MsgId msgId, QDateTime date, const QString &msg, bool out, bool unread, HistoryMedia *media) :
-	HistoryItem(history, block, msgId, out, unread, date, 0), media(media), _text(st::msgServiceFont, msg, _historySrvOptions, st::dlgMinWidth) {
+	HistoryItem(history, block, msgId, out, unread, date, 0)
+, _text(st::msgServiceFont, msg, _historySrvOptions, st::dlgMinWidth)
+, media(media)
+{
 	_maxw = _text.maxWidth() + st::msgServicePadding.left() + st::msgServicePadding.right();
 	_minh = _text.minHeight();
 }
diff --git a/Telegram/SourceFiles/history.h b/Telegram/SourceFiles/history.h
index bb965cc35..167f02219 100644
--- a/Telegram/SourceFiles/history.h
+++ b/Telegram/SourceFiles/history.h
@@ -57,7 +57,7 @@ struct ChatData;
 struct UserData;
 struct PeerData {
 	PeerData(const PeerId &id);
-	~PeerData() {
+	virtual ~PeerData() {
 		if (notify != UnknownNotifySettings && notify != EmptyNotifySettings) {
 			delete notify;
 			notify = UnknownNotifySettings;
@@ -212,7 +212,7 @@ enum FileStatus {
 
 struct VideoData {
 	VideoData(const VideoId &id, const uint64 &access = 0, int32 user = 0, int32 date = 0, int32 duration = 0, int32 w = 0, int32 h = 0, const ImagePtr &thumb = ImagePtr(), int32 dc = 0, int32 size = 0) :
-		id(id), access(access), user(user), date(date), duration(duration), w(w), h(h), thumb(thumb), dc(dc), size(size), openOnSave(0), loader(0), fileType(0), status(FileReady), uploadOffset(0) {
+		id(id), access(access), user(user), date(date), duration(duration), w(w), h(h), thumb(thumb), dc(dc), size(size), status(FileReady), uploadOffset(0), fileType(0), openOnSave(0), loader(0) {
 		memset(md5, 0, sizeof(md5));
 	}
 	void forget() {
@@ -314,7 +314,7 @@ public:
 
 struct AudioData {
 	AudioData(const AudioId &id, const uint64 &access = 0, int32 user = 0, int32 date = 0, int32 duration = 0, int32 dc = 0, int32 size = 0) : 
-		id(id), access(access), user(user), date(date), dc(dc), duration(duration), size(size), openOnSave(0), loader(0), status(FileReady), uploadOffset(0) {
+		id(id), access(access), user(user), date(date), duration(duration), dc(dc), size(size), status(FileReady), uploadOffset(0), openOnSave(0), loader(0) {
 		memset(md5, 0, sizeof(md5));
 	}
 	void forget() {
@@ -412,7 +412,7 @@ public:
 
 struct DocumentData {
 	DocumentData(const DocumentId &id, const uint64 &access = 0, int32 user = 0, int32 date = 0, const QString &name = QString(), const QString &mime = QString(), const ImagePtr &thumb = ImagePtr(), int32 dc = 0, int32 size = 0) :
-		id(id), access(access), user(user), date(date), name(name), mime(mime), thumb(thumb), dc(dc), size(size), openOnSave(0), loader(0), status(FileReady), uploadOffset(0) {
+		id(id), access(access), user(user), date(date), name(name), mime(mime), thumb(thumb), dc(dc), size(size), status(FileReady), uploadOffset(0), openOnSave(0), loader(0) {
 		memset(md5, 0, sizeof(md5));
 	}
 	void forget() {
@@ -628,7 +628,7 @@ struct History : public QList<HistoryBlock*> {
 };
 
 struct DialogsList {
-	DialogsList(bool sortByName) : end(&last), begin(&last), current(&last), byName(sortByName), count(0) {
+	DialogsList(bool sortByName) : begin(&last), end(&last), byName(sortByName), count(0), current(&last) {
 	}
 
 	void adjustCurrent(int32 y, int32 h) const {
@@ -985,7 +985,7 @@ public:
 		return _out;
 	}
 	bool unread() const {
-		if (_out && (id > 0 && id < _history->outboxReadTill) || !_out && id > 0 && id < _history->inboxReadTill) return false;
+		if ((_out && (id > 0 && id < _history->outboxReadTill)) || (!_out && id > 0 && id < _history->inboxReadTill)) return false;
 		return _unread;
 	}
 	virtual bool needCheck() const {
diff --git a/Telegram/SourceFiles/historywidget.cpp b/Telegram/SourceFiles/historywidget.cpp
index a4055172b..843df4654 100644
--- a/Telegram/SourceFiles/historywidget.cpp
+++ b/Telegram/SourceFiles/historywidget.cpp
@@ -30,13 +30,30 @@ Copyright (c) 2014 John Preston, https://tdesktop.com
 
 // flick scroll taken from http://qt-project.org/doc/qt-4.8/demos-embedded-anomaly-src-flickcharm-cpp.html
 
-HistoryList::HistoryList(HistoryWidget *historyWidget, ScrollArea *scroll, History *history) : QWidget(0), 
-	historyWidget(historyWidget), scrollArea(scroll), hist(history), currentBlock(0), currentItem(0), _menu(0),
-	_dragAction(NoDrag), _dragItem(0), _dragSelFrom(0), _dragSelTo(0), _dragSelecting(false),
-	_dragSelType(TextSelectLetters), _dragWasInactive(false),
-	_touchScroll(false), _touchSelect(false), _touchInProgress(false),
-	_touchScrollState(TouchScrollManual), _touchPrevPosValid(false), _touchWaitingAcceleration(false), _touchSpeedTime(0), _touchAccelerationTime(0), _touchTime(0),
-	_cursor(style::cur_default) {
+HistoryList::HistoryList(HistoryWidget *historyWidget, ScrollArea *scroll, History *history) : QWidget(0)
+    , hist(history)
+    , historyWidget(historyWidget)
+    , scrollArea(scroll)
+    , currentBlock(0)
+    , currentItem(0)
+    , _cursor(style::cur_default)
+    , _dragAction(NoDrag)
+    , _dragSelType(TextSelectLetters)
+    , _dragItem(0)
+    , _dragWasInactive(false)
+    , _dragSelFrom(0)
+    , _dragSelTo(0)
+    , _dragSelecting(false)
+    , _touchScroll(false)
+    , _touchSelect(false)
+    , _touchInProgress(false)
+    , _touchScrollState(TouchScrollManual)
+    , _touchPrevPosValid(false)
+    , _touchWaitingAcceleration(false)
+    , _touchSpeedTime(0)
+    , _touchAccelerationTime(0)
+    , _touchTime(0)
+    , _menu(0) {
 
 	linkTipTimer.setSingleShot(true);
 	connect(&linkTipTimer, SIGNAL(timeout()), this, SLOT(showLinkTip()));
@@ -72,7 +89,7 @@ void HistoryList::paintEvent(QPaintEvent *e) {
 	}
 
 	if (hist->isEmpty()) {
-		QPoint dogPos((width() - st::msgDogImg.width()) / 2, ((height() - st::msgDogImg.height()) * 4) / 9);
+		QPoint dogPos((width() - st::msgDogImg.pxWidth()) / 2, ((height() - st::msgDogImg.pxHeight()) * 4) / 9);
 		p.drawPixmap(dogPos, App::sprite(), st::msgDogImg);
 	} else {
 		adjustCurrent(r.top());
@@ -167,8 +184,8 @@ void HistoryList::touchUpdateSpeed() {
 			if (_touchScrollState == TouchScrollAuto) {
 				const int oldSpeedY = _touchSpeed.y();
 				const int oldSpeedX = _touchSpeed.x();
-				if ((oldSpeedY <= 0 && newSpeedY <= 0) || (oldSpeedY >= 0 && newSpeedY >= 0)
-					&& (oldSpeedX <= 0 && newSpeedX <= 0) || (oldSpeedX >= 0 && newSpeedX >= 0)) {
+				if ((oldSpeedY <= 0 && newSpeedY <= 0) || ((oldSpeedY >= 0 && newSpeedY >= 0)
+					&& (oldSpeedX <= 0 && newSpeedX <= 0)) || (oldSpeedX >= 0 && newSpeedX >= 0)) {
 					_touchSpeed.setY(snap((oldSpeedY + (newSpeedY / 4)), -MaxScrollAccelerated, +MaxScrollAccelerated));
 					_touchSpeed.setX(snap((oldSpeedX + (newSpeedX / 4)), -MaxScrollAccelerated, +MaxScrollAccelerated));
 				} else {
@@ -615,11 +632,11 @@ void HistoryList::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
 				_menu->addAction(lang(lng_context_save_image), this, SLOT(saveContextImage()))->setEnabled(true);
 				_menu->addAction(lang(lng_context_copy_image), this, SLOT(copyContextImage()))->setEnabled(true);
 			} else {
-				if (lnkVideo && lnkVideo->video()->loader || lnkAudio && lnkAudio->audio()->loader || lnkDocument && lnkDocument->document()->loader) {
+				if ((lnkVideo && lnkVideo->video()->loader) || (lnkAudio && lnkAudio->audio()->loader) || (lnkDocument && lnkDocument->document()->loader)) {
 					_menu->addAction(lang(lng_context_cancel_download), this, SLOT(cancelContextDownload()))->setEnabled(true);
 				} else {
-					if (lnkVideo && !lnkVideo->video()->already(true).isEmpty() || lnkAudio && !lnkAudio->audio()->already(true).isEmpty() || lnkDocument && !lnkDocument->document()->already(true).isEmpty()) {
-						_menu->addAction(lang(lng_context_show_in_folder), this, SLOT(showContextInFolder()))->setEnabled(true);
+					if ((lnkVideo && !lnkVideo->video()->already(true).isEmpty()) || (lnkAudio && !lnkAudio->audio()->already(true).isEmpty()) || (lnkDocument && !lnkDocument->document()->already(true).isEmpty())) {
+						_menu->addAction(lang(cPlatform() == dbipMac ? lng_context_show_in_finder : lng_context_show_in_folder), this, SLOT(showContextInFolder()))->setEnabled(true);
 					}
 					_menu->addAction(lang(lnkVideo ? lng_context_open_video : (lnkAudio ? lng_context_open_audio : lng_context_open_document)), this, SLOT(openContextFile()))->setEnabled(true);
 					_menu->addAction(lang(lnkVideo ? lng_context_save_video : (lnkAudio ? lng_context_save_audio : lng_context_save_document)), this, SLOT(saveContextFile()))->setEnabled(true);
@@ -961,7 +978,7 @@ void HistoryList::fillSelectedItems(HistoryItemSet &sel, bool forDelete) {
 
 	for (SelectedItems::const_iterator i = _selected.cbegin(), e = _selected.cend(); i != e; ++i) {
 		HistoryItem *item = i.key();
-		if (item->itemType() == HistoryItem::MsgType && (item->id > 0 && !item->serviceMsg() || forDelete)) {
+		if (item->itemType() == HistoryItem::MsgType && ((item->id > 0 && !item->serviceMsg()) || forDelete)) {
 			sel.insert(item->y + item->block()->y, item);
 		}
 	}
@@ -1031,15 +1048,15 @@ void HistoryList::onUpdateSelected(bool force) {
 				_selected[_dragItem] = _dragItem->adjustSelection(qMin(second, _dragSymbol), qMax(second, _dragSymbol), _dragSelType);
 				updateDragSelection(0, 0, false);
 			} else {
-				bool selectingDown = (_dragItem->block()->y < item->block()->y) || (_dragItem->block() == item->block()) && (_dragItem->y < item->y || _dragItem == item && _dragStartPos.y() < m.y());
+				bool selectingDown = (_dragItem->block()->y < item->block()->y) || ((_dragItem->block() == item->block()) && (_dragItem->y < item->y || (_dragItem == item && _dragStartPos.y() < m.y())));
 				HistoryItem *dragSelFrom = _dragItem, *dragSelTo = item;
 				if (!dragSelFrom->hasPoint(_dragStartPos.x(), _dragStartPos.y())) { // maybe exclude dragSelFrom
 					if (selectingDown) {
-						if (_dragStartPos.y() >= dragSelFrom->height() - st::msgMargin.bottom() || (item == dragSelFrom) && (m.y() < _dragStartPos.y() + QApplication::startDragDistance())) {
+						if (_dragStartPos.y() >= dragSelFrom->height() - st::msgMargin.bottom() || ((item == dragSelFrom) && (m.y() < _dragStartPos.y() + QApplication::startDragDistance()))) {
 							dragSelFrom = (dragSelFrom == dragSelTo) ? 0 : nextItem(dragSelFrom);
 						}
 					} else {
-						if (_dragStartPos.y() < st::msgMargin.top() || (item == dragSelFrom) && (m.y() >= _dragStartPos.y() - QApplication::startDragDistance())) {
+						if (_dragStartPos.y() < st::msgMargin.top() || ((item == dragSelFrom) && (m.y() >= _dragStartPos.y() - QApplication::startDragDistance()))) {
 							dragSelFrom = (dragSelFrom == dragSelTo) ? 0 : prevItem(dragSelFrom);
 						}
 					}
@@ -1218,11 +1235,19 @@ void MessageField::focusInEvent(QFocusEvent *e) {
 	emit focused();
 }
 
-HistoryHider::HistoryHider(MainWidget *parent, bool forwardSelected) : QWidget(parent),
-	aOpacity(0, 1), aOpacityFunc(anim::easeOutCirc), hiding(false), offered(0), _forwardRequest(0),
-	toTextWidth(0), _forwardSelected(forwardSelected), sharedContact(0), shadow(st::boxShadow),
-	forwardButton(this, lang(lng_forward), st::btnSelectDone),
-	cancelButton(this, lang(lng_cancel), st::btnSelectCancel) {
+HistoryHider::HistoryHider(MainWidget *parent, bool forwardSelected) : QWidget(parent)
+    , sharedContact(0)
+    , _forwardSelected(forwardSelected)
+    , forwardButton(this, lang(lng_forward), st::btnSelectDone)
+    , cancelButton(this, lang(lng_cancel), st::btnSelectCancel)
+    , offered(0)
+    , aOpacity(0, 1)
+    , aOpacityFunc(anim::easeOutCirc)
+    , hiding(false)
+    , _forwardRequest(0)
+    , toTextWidth(0)
+    , shadow(st::boxShadow)
+{
 
 	connect(&forwardButton, SIGNAL(clicked()), this, SLOT(forward()));
 	connect(&cancelButton, SIGNAL(clicked()), this, SLOT(startHide()));
@@ -1234,11 +1259,19 @@ HistoryHider::HistoryHider(MainWidget *parent, bool forwardSelected) : QWidget(p
 	anim::start(this);
 }
 
-HistoryHider::HistoryHider(MainWidget *parent, UserData *sharedContact) : QWidget(parent),
-	aOpacity(0, 1), aOpacityFunc(anim::easeOutCirc), hiding(false), offered(0), _forwardRequest(0),
-	toTextWidth(0), _forwardSelected(false), sharedContact(sharedContact), shadow(st::boxShadow),
-	forwardButton(this, lang(lng_forward), st::btnSelectDone),
-	cancelButton(this, lang(lng_cancel), st::btnSelectCancel) {
+HistoryHider::HistoryHider(MainWidget *parent, UserData *sharedContact) : QWidget(parent)
+    , sharedContact(sharedContact)
+    , _forwardSelected(false)
+    , forwardButton(this, lang(lng_forward), st::btnSelectDone)
+    , cancelButton(this, lang(lng_cancel), st::btnSelectCancel)
+    , offered(0)
+    , aOpacity(0, 1)
+    , aOpacityFunc(anim::easeOutCirc)
+    , hiding(false)
+    , _forwardRequest(0)
+    , toTextWidth(0)
+    , shadow(st::boxShadow)
+{
 
 	connect(&forwardButton, SIGNAL(clicked()), this, SLOT(forward()));
 	connect(&cancelButton, SIGNAL(clicked()), this, SLOT(startHide()));
@@ -1382,7 +1415,7 @@ void HistoryHider::resizeEvent(QResizeEvent *e) {
 
 void HistoryHider::offerPeer(PeerId peer) {
 	offered = App::peer(peer);
-	toText.setText(st::boxFont, lang(sharedContact ? lng_forward_share_contact : lng_forward_confirm).replace(qsl("{recipient}"), offered->chat ? '�' + offered->name + '�' : offered->name), _textNameOptions);
+	toText.setText(st::boxFont, lang(sharedContact ? lng_forward_share_contact : lng_forward_confirm).replace(qsl("{recipient}"), offered->chat ? '\xAB' + offered->name + '\xBB' : offered->name), _textNameOptions);
 	toTextWidth = toText.maxWidth();
 	if (toTextWidth > box.width() - st::boxPadding.left() - st::boxPadding.right()) {
 		toTextWidth = box.width() - st::boxPadding.left() - st::boxPadding.right();
@@ -1402,14 +1435,38 @@ HistoryHider::~HistoryHider() {
 	parent()->noHider(this);
 }
 
-HistoryWidget::HistoryWidget(QWidget *parent) : QWidget(parent), noTypingUpdate(false), serviceImageCacheSize(0),
-	_scroll(this, st::historyScroll, false), _list(0), histPeer(0), _activePeer(0), histOffset(0), histCount(-1),
-	hist(0), histPreloading(0), histReadRequestId(0), hiderOffered(false), _histInited(false),
-	_send(this, lang(lng_send_button), st::btnSend), histRequestsCount(0),
-	_attachDocument(this, st::btnAttachDocument), _attachPhoto(this, st::btnAttachPhoto), _attachEmoji(this, st::btnAttachEmoji),
-	confirmImageId(0), loadingChatId(0), loadingRequestId(0), titlePeerTextWidth(0),
-	_field(this, st::taMsgField, lang(lng_message_ph)), bg(st::msgBG), imageLoader(this),
-	_attachType(this), _emojiPan(this), _attachDrag(DragStateNone), _attachDragDocument(this), _attachDragPhoto(this), _scrollDelta(0) {
+HistoryWidget::HistoryWidget(QWidget *parent) : QWidget(parent)
+    , histOffset(0)
+    , histCount(-1)
+    , histReadRequestId(0)
+    , histRequestsCount(0)
+    , histPeer(0)
+    , _activePeer(0)
+    , histPreloading(0)
+    , _scroll(this, st::historyScroll, false)
+    , _list(0)
+    , hist(0)
+    , _histInited(false)
+    , _send(this, lang(lng_send_button), st::btnSend)
+    , _attachDocument(this, st::btnAttachDocument)
+    , _attachPhoto(this, st::btnAttachPhoto)
+    , _attachEmoji(this, st::btnAttachEmoji)
+    , _field(this, st::taMsgField, lang(lng_message_ph))
+    , _attachType(this)
+    , _emojiPan(this)
+    , _attachDrag(DragStateNone)
+    , _attachDragDocument(this)
+    , _attachDragPhoto(this)
+    , imageLoader(this)
+    , noTypingUpdate(false)
+    , loadingChatId(0)
+    , loadingRequestId(0)
+    , serviceImageCacheSize(0)
+    , confirmImageId(0)
+    , titlePeerTextWidth(0)
+    , bg(st::msgBG)
+    , hiderOffered(false)
+    , _scrollDelta(0) {
 	_scroll.setFocusPolicy(Qt::NoFocus);
 
 	setAcceptDrops(true);
@@ -1462,7 +1519,7 @@ void HistoryWidget::onTextChange() {
 
 void HistoryWidget::updateTyping(bool typing) {
 	uint64 ms = getms() + 10000;
-	if (noTypingUpdate || !hist || typing && (hist->myTyping + 5000 > ms) || !typing && (hist->myTyping + 5000 <= ms)) return;
+	if (noTypingUpdate || !hist || (typing && (hist->myTyping + 5000 > ms)) || (!typing && (hist->myTyping + 5000 <= ms))) return;
 
 	hist->myTyping = typing ? ms : 0;
 	if (typing) MTP::send(MTPmessages_SetTyping(histPeer->input, MTP_bool(typing)));
@@ -1746,20 +1803,7 @@ void HistoryWidget::historyToDown(History *history) {
 }
 
 void HistoryWidget::historyWasRead(bool force) {
-	if (histReadRequestId || !hist || !force && (!hist->unreadCount || !hist->unreadLoaded)) return;
-	hist->inboxRead(true);
-	histReadRequestId = MTP::send(MTPmessages_ReadHistory(histPeer->input, MTP_int(0), MTP_int(0)), rpcDone(&HistoryWidget::partWasRead, histPeer));
-}
-
-void HistoryWidget::partWasRead(PeerData *peer, const MTPmessages_AffectedHistory &result) {
-	const MTPDmessages_affectedHistory &d(result.c_messages_affectedHistory());
-	App::main()->updUpdated(d.vpts.v, 0, 0, d.vseq.v);
-
-	histReadRequestId = 0;
-	int32 offset = d.voffset.v;
-	if (!MTP::authedId() || offset <= 0) return;
-
-	histReadRequestId = MTP::send(MTPmessages_ReadHistory(peer->input, MTP_int(0), MTP_int(offset)), rpcDone(&HistoryWidget::partWasRead, peer));
+    App::main()->readServerHistory(hist, force);
 }
 
 bool HistoryWidget::messagesFailed(const RPCError &e, mtpRequestId requestId) {
@@ -1890,7 +1934,7 @@ void HistoryWidget::loadMessages() {
 void HistoryWidget::onListScroll() {
 	App::checkImageCacheSize();
 
-	if (histPreloading || !hist || (_list->isHidden() || _scroll.isHidden() || !App::wnd()->windowHandle()->isVisible()) && hist->unreadLoaded) {
+	if (histPreloading || !hist || ((_list->isHidden() || _scroll.isHidden() || !App::wnd()->windowHandle()->isVisible()) && hist->unreadLoaded)) {
 		checkUnreadLoaded(true);
 		return;
 	}
@@ -1906,9 +1950,7 @@ void HistoryWidget::onVisibleChanged() {
 	QTimer::singleShot(0, this, SLOT(onListScroll()));
 }
 
-QString HistoryWidget::prepareMessage() {
-	QString result = _field.getText();
-	
+QString HistoryWidget::prepareMessage(QString result) {
 	result = result.replace('\t', qsl(" "));
 
 	result = result.replace(" --", QString::fromUtf8(" \xe2\x80\x94"));
@@ -1922,7 +1964,7 @@ QString HistoryWidget::prepareMessage() {
 void HistoryWidget::onSend() {
 	if (!hist) return;
 
-	QString text = prepareMessage();
+	QString text = prepareMessage(_field.getText());
 	if (!text.isEmpty()) {
 		MsgId newId = clientMsgId();
 		uint64 randomId = MTP::nonce<uint64>();
@@ -1937,6 +1979,8 @@ void HistoryWidget::onSend() {
 
 		MTP::send(MTPmessages_SendMessage(histInputPeer, msgText, MTP_long(randomId)), App::main()->rpcDone(&MainWidget::sentDataReceived, randomId));
 		_field.setPlainText("");
+		if (!_attachType.isHidden()) _attachType.hideStart();
+		if (!_emojiPan.isHidden()) _emojiPan.hideStart();
 	}
 	_field.setFocus();
 }
@@ -1966,7 +2010,7 @@ mtpRequestId HistoryWidget::onForward(const PeerId &peer, bool forwardSelected)
 			newId = clientMsgId();
 			hist->addToBackForwarded(newId, msg);
 			MTP::send(MTPmessages_ForwardMessage(histPeer->input, MTP_int(item->id), MTP_long(randomId)), App::main()->rpcDone(&MainWidget::sentFullDataReceived, randomId));
-		} else if (srv || msg && msg->selectedText(FullItemSel).isEmpty()) {
+		} else if (srv || (msg && msg->selectedText(FullItemSel).isEmpty())) {
 	//		newId = clientMsgId();
 	//		MTP::send(MTPmessages_ForwardMessage(histPeer->input, MTP_int(item->id), MTP_long(randomId)), App::main()->rpcDone(&MainWidget::sentFullDataReceived, randomId));
 		} else if (msg) {
@@ -2314,7 +2358,7 @@ void HistoryWidget::paintTopBar(QPainter &p, float64 over, int32 decreaseWidth)
 
 	if (!decreaseWidth) {
 		p.setOpacity(st::topBarForwardAlpha + (1 - st::topBarForwardAlpha) * over);
-		p.drawPixmap(QPoint(width() - (st::topBarForwardPadding.right() + st::topBarForwardImg.width()) / 2, (st::topBarHeight - st::topBarForwardImg.height()) / 2), App::sprite(), st::topBarForwardImg);
+		p.drawPixmap(QPoint(width() - (st::topBarForwardPadding.right() + st::topBarForwardImg.pxWidth()) / 2, (st::topBarHeight - st::topBarForwardImg.pxHeight()) / 2), App::sprite(), st::topBarForwardImg);
 	}
 }
 
@@ -2424,7 +2468,6 @@ void HistoryWidget::onPhotoReady() {
 }
 
 void HistoryWidget::onPhotoFailed(quint64 id) {
-	id = id;
 }
 
 void HistoryWidget::confirmSendImage(const ReadyLocalMedia &img) {
@@ -2562,7 +2605,7 @@ void HistoryWidget::resizeEvent(QResizeEvent *e) {
 }
 
 void HistoryWidget::updateListSize(int32 addToY, bool initial) {
-	if (!hist || !_histInited && !initial) return;
+	if (!hist || (!_histInited && !initial)) return;
 
 	if (!App::wnd()->isVisible()) return; // scrollTopMax etc are not working after recountHeight()
 
@@ -2792,11 +2835,11 @@ void HistoryWidget::paintEvent(QPaintEvent *e) {
 				p.fillRect(0, _field.y() - st::sendPadding, width(), _field.height() + 2 * st::sendPadding, st::taMsgField.bgColor->b);
 			}
 		} else {
-			QPoint dogPos((width() - st::msgDogImg.width()) / 2, ((height() - _field.height() - 2 * st::sendPadding - st::msgDogImg.height()) * 4) / 9);
+			QPoint dogPos((width() - st::msgDogImg.pxWidth()) / 2, ((height() - _field.height() - 2 * st::sendPadding - st::msgDogImg.pxHeight()) * 4) / 9);
 			p.drawPixmap(dogPos, App::sprite(), st::msgDogImg);
 
 			int32 pointsCount = 8, w = pointsCount * (st::introPointWidth + 2 * st::introPointDelta), h = st::introPointHeight;
-			int32 pointsLeft = (width() - w) / 2 + st::introPointDelta - st::introPointLeft, pointsTop = dogPos.y() + (st::msgDogImg.height() * 6) / 5;
+			int32 pointsLeft = (width() - w) / 2 + st::introPointDelta - st::introPointLeft, pointsTop = dogPos.y() + (st::msgDogImg.pxHeight() * 6) / 5;
 
 			int32 curPoint = histRequestsCount % pointsCount;
 
@@ -2805,8 +2848,8 @@ void HistoryWidget::paintEvent(QPaintEvent *e) {
 
 			// points
 			p.setOpacity(st::introPointAlpha);
-			int x = pointsLeft + st::introPointLeft;
-			for (uint32 i = 0; i < pointsCount; ++i) {
+			int32 x = pointsLeft + st::introPointLeft;
+			for (int32 i = 0; i < pointsCount; ++i) {
 				p.fillRect(x, pointsTop + st::introPointTop, st::introPointWidth, st::introPointHeight, st::introPointColor->b);
 				x += (st::introPointWidth + 2 * st::introPointDelta);
 			}
diff --git a/Telegram/SourceFiles/historywidget.h b/Telegram/SourceFiles/historywidget.h
index 017d91058..363e8589b 100644
--- a/Telegram/SourceFiles/historywidget.h
+++ b/Telegram/SourceFiles/historywidget.h
@@ -311,6 +311,8 @@ public:
 	void noSelectingScroll();
 
 	bool touchScroll(const QPoint &delta);
+    
+	QString prepareMessage(QString text);
 
 	~HistoryWidget();
 
@@ -365,7 +367,6 @@ public slots:
 private:
 
 	bool messagesFailed(const RPCError &error, mtpRequestId requestId);
-	void partWasRead(PeerData *peer, const MTPmessages_AffectedHistory &result);
 	void updateListSize(int32 addToY = 0, bool initial = false);
 	void addMessagesToFront(const QVector<MTPMessage> &messages);
 	void chatLoaded(const MTPmessages_ChatFull &res);
@@ -375,8 +376,6 @@ private:
 
 	void updateDragAreas();
 
-	QString prepareMessage();
-
 	int32 histOffset, histCount, histReadRequestId;
 	int32 histRequestsCount;
 	PeerData *histPeer, *_activePeer;
diff --git a/Telegram/SourceFiles/intro/intro.cpp b/Telegram/SourceFiles/intro/intro.cpp
index 6b1eed49a..9e9416a64 100644
--- a/Telegram/SourceFiles/intro/intro.cpp
+++ b/Telegram/SourceFiles/intro/intro.cpp
@@ -45,8 +45,8 @@ namespace {
 }
 
 IntroWidget::IntroWidget(Window *window) : QWidget(window),
-	wnd(window), cacheForHideInd(0), cacheForShowInd(0), _callTimeout(60),
-	steps(new IntroSteps(this)), phone(0), code(0), signup(0), current(0), moving(0), visibilityChanging(0) {
+	cacheForHideInd(0), cacheForShowInd(0), wnd(window), steps(new IntroSteps(this)),
+    phone(0), code(0), signup(0), current(0), moving(0), visibilityChanging(0), _callTimeout(60) {
 	setGeometry(QRect(0, st::titleHeight, wnd->width(), wnd->height() - st::titleHeight));
 
 	countryForReg = psCurrentCountry();
diff --git a/Telegram/SourceFiles/intro/introcode.cpp b/Telegram/SourceFiles/intro/introcode.cpp
index 371c07978..5da3d88d0 100644
--- a/Telegram/SourceFiles/intro/introcode.cpp
+++ b/Telegram/SourceFiles/intro/introcode.cpp
@@ -67,10 +67,10 @@ void CodeInput::correctValue(QKeyEvent *e, const QString &was) {
 	if (strict) emit codeEntered();
 }
 
-IntroCode::IntroCode(IntroWidget *parent) : IntroStage(parent),
+IntroCode::IntroCode(IntroWidget *parent) : IntroStage(parent), errorAlpha(0),
 	next(this, lang(lng_intro_next), st::btnIntroNext),
 	back(this, lang(lng_intro_back), st::btnIntroBack),
-	code(this, st::inpIntroCode, lang(lng_code_ph)), errorAlpha(0), waitTillCall(intro()->getCallTimeout()) {
+	code(this, st::inpIntroCode, lang(lng_code_ph)), waitTillCall(intro()->getCallTimeout()) {
 	setVisible(false);
 	setGeometry(parent->innerRect());
 
diff --git a/Telegram/SourceFiles/intro/introphone.cpp b/Telegram/SourceFiles/intro/introphone.cpp
index 4ee34782f..f7905d43f 100644
--- a/Telegram/SourceFiles/intro/introphone.cpp
+++ b/Telegram/SourceFiles/intro/introphone.cpp
@@ -40,10 +40,13 @@ namespace {
 	};
 }
 
-IntroPhone::IntroPhone(IntroWidget *parent) : IntroStage(parent), changed(false),
+IntroPhone::IntroPhone(IntroWidget *parent) : IntroStage(parent),
+    errorAlpha(0), changed(false),
 	next(this, lang(lng_intro_next), st::btnIntroStart),
-	country(this, st::introCountry), errorAlpha(0), _signup(this, lang(lng_phone_notreg).replace(qsl("{signup}"), textcmdStartLink(1)).replace(qsl("{/signup}"), textcmdStopLink()), st::introErrLabel), _showSignup(false),
-	phone(this, st::inpIntroPhone, lang(lng_phone_ph)), code(this, st::inpIntroCountryCode) {
+	country(this, st::introCountry),
+	phone(this, st::inpIntroPhone, lang(lng_phone_ph)), code(this, st::inpIntroCountryCode),
+    _signup(this, lang(lng_phone_notreg).replace(qsl("{signup}"), textcmdStartLink(1)).replace(qsl("{/signup}"), textcmdStopLink()), st::introErrLabel),
+    _showSignup(false) {
 	setVisible(false);
 	setGeometry(parent->innerRect());
 
diff --git a/Telegram/SourceFiles/intro/introsignup.cpp b/Telegram/SourceFiles/intro/introsignup.cpp
index 9b597eb4d..f4547fb94 100644
--- a/Telegram/SourceFiles/intro/introsignup.cpp
+++ b/Telegram/SourceFiles/intro/introsignup.cpp
@@ -28,7 +28,8 @@ Copyright (c) 2014 John Preston, https://tdesktop.com
 #include "intro/intro.h"
 
 IntroSignup::IntroSignup(IntroWidget *parent) : IntroStage(parent),
-	next(this, lang(lng_intro_finish), st::btnIntroFinish), errorAlpha(0), a_photo(0),
+	errorAlpha(0), a_photo(0),
+    next(this, lang(lng_intro_finish), st::btnIntroFinish), 
 	first(this, st::inpIntroName, lang(lng_signup_firstname)),
 	last(this, st::inpIntroName, lang(lng_signup_lastname)) {
 	setVisible(false);
@@ -124,7 +125,7 @@ void IntroSignup::paintEvent(QPaintEvent *e) {
 
 void IntroSignup::resizeEvent(QResizeEvent *e) {
 	textRect = QRect((width() - st::introTextSize.width()) / 2, 0, st::introTextSize.width(), st::introTextSize.height());
-	_phLeft = (width() - st::setPhotoImg.width()) / 2;
+	_phLeft = (width() - st::setPhotoImg.pxWidth()) / 2;
 	_phTop = st::introHeaderFont->height + st::introFinishSkip;
 	if (e->oldSize().width() != width()) {
 		int sumNext = st::btnIntroNext.width - st::btnIntroBack.width - st::btnIntroSep;
@@ -132,7 +133,7 @@ void IntroSignup::resizeEvent(QResizeEvent *e) {
 	}
 	if (e->oldSize().width() != width()) {
 		next.move((width() - next.width()) / 2, st::introSize.height() - st::btnIntroNext.height);
-		first.move((width() - first.width()) / 2, _phTop + st::setPhotoImg.height() + st::introFinishSkip);
+		first.move((width() - first.width()) / 2, _phTop + st::setPhotoImg.pxHeight() + st::introFinishSkip);
 		last.move((width() - last.width()) / 2, first.y() + first.height() + st::introFinishSkip);
 	}
 }
diff --git a/Telegram/SourceFiles/langloaderplain.cpp b/Telegram/SourceFiles/langloaderplain.cpp
index 8286e0a4c..b7a555444 100644
--- a/Telegram/SourceFiles/langloaderplain.cpp
+++ b/Telegram/SourceFiles/langloaderplain.cpp
@@ -66,7 +66,7 @@ namespace {
 		if (!skipJunk(from, end)) return false;
 
 		const char *nameStart = from;
-		while (from < end && (*from >= 'a' && *from <= 'z' || *from >= 'A' && *from <= 'Z' || *from == '_' || *from >= '0' && *from <= '9')) {
+		while (from < end && ((*from >= 'a' && *from <= 'z') || (*from >= 'A' && *from <= 'Z') || *from == '_' || (*from >= '0' && *from <= '9'))) {
 			++from;
 		}
 
diff --git a/Telegram/SourceFiles/layerwidget.cpp b/Telegram/SourceFiles/layerwidget.cpp
index 86421e353..ff8e33ec2 100644
--- a/Telegram/SourceFiles/layerwidget.cpp
+++ b/Telegram/SourceFiles/layerwidget.cpp
@@ -126,9 +126,23 @@ BackgroundWidget::~BackgroundWidget() {
 	if (_hidden) _hidden->deleteLater();
 }
 
-LayerWidget::LayerWidget(QWidget *parent, PhotoData *photo, HistoryItem *item) : QWidget(parent), photo(photo), video(0),
-	aBackground(0), aOver(0), iX(App::wnd()->width() / 2), iY(App::wnd()->height() / 2), iW(0), iCoordFunc(anim::sineInOut), aOverFunc(anim::linear), aBackgroundFunc(anim::easeOutCirc), hiding(false),
-	_touchPress(false), _touchMove(false), _touchRightButton(false), _menu(0) {
+LayerWidget::LayerWidget(QWidget *parent, PhotoData *photo, HistoryItem *item) : QWidget(parent)
+, photo(photo)
+, video(0)
+, aBackground(0)
+, aOver(0)
+, iX(App::wnd()->width() / 2)
+, iY(App::wnd()->height() / 2)
+, iW(0)
+, iCoordFunc(anim::sineInOut)
+, aBackgroundFunc(anim::easeOutCirc)
+, aOverFunc(anim::linear)
+, hiding(false)
+, _touchPress(false)
+, _touchMove(false)
+, _touchRightButton(false)
+, _menu(0)
+{
 	int32 x, y, w;
 	if (App::wnd()->getPhotoCoords(photo, x, y, w)) {
 		iX = anim::ivalue(x);
@@ -149,9 +163,23 @@ LayerWidget::LayerWidget(QWidget *parent, PhotoData *photo, HistoryItem *item) :
 	connect(&_touchTimer, SIGNAL(timeout()), this, SLOT(onTouchTimer()));
 }
 
-LayerWidget::LayerWidget(QWidget *parent, VideoData *video, HistoryItem *item) : QWidget(parent), photo(0), video(video),
-	aBackground(0), aOver(0), iX(App::wnd()->width() / 2), iY(App::wnd()->height() / 2), iW(0), iCoordFunc(anim::sineInOut), aOverFunc(anim::linear), aBackgroundFunc(anim::easeOutCirc), hiding(false),
-	_touchPress(false), _touchMove(false), _touchRightButton(false), _menu(0) {
+LayerWidget::LayerWidget(QWidget *parent, VideoData *video, HistoryItem *item) : QWidget(parent)
+, photo(0)
+, video(video)
+, aBackground(0)
+, aOver(0)
+, iX(App::wnd()->width() / 2)
+, iY(App::wnd()->height() / 2)
+, iW(0)
+, iCoordFunc(anim::sineInOut)
+, aBackgroundFunc(anim::easeOutCirc)
+, aOverFunc(anim::linear)
+, hiding(false)
+, _touchPress(false)
+, _touchMove(false)
+, _touchRightButton(false)
+, _menu(0)
+{
 	int32 x, y, w;
 	if (App::wnd()->getVideoCoords(video, x, y, w)) {
 		iX = anim::ivalue(x);
@@ -279,7 +307,7 @@ void LayerWidget::keyPressEvent(QKeyEvent *e) {
 				photo->full->pix().toImage().save(file, "JPG");
 			}
 		}
-	} else if (photo && photo->full->loaded() && (e->key() == Qt::Key_Copy || e->key() == Qt::Key_C && e->modifiers().testFlag(Qt::ControlModifier))) {
+	} else if (photo && photo->full->loaded() && (e->key() == Qt::Key_Copy || (e->key() == Qt::Key_C && e->modifiers().testFlag(Qt::ControlModifier)))) {
 		QApplication::clipboard()->setPixmap(photo->full->pix());
 	}
 }
@@ -304,7 +332,7 @@ void LayerWidget::contextMenuEvent(QContextMenuEvent *e) {
 				_menu->addAction(lang(lng_context_forward_image), this, SLOT(forwardMessage()))->setEnabled(true);
 			}
 			_menu->addAction(lang(lng_context_delete_image), this, SLOT(deleteMessage()))->setEnabled(true);
-		} else if (App::self() && App::self()->photoId == photo->id || photo->chat && photo->chat->photoId == photo->id) {
+		} else if ((App::self() && App::self()->photoId == photo->id) || (photo->chat && photo->chat->photoId == photo->id)) {
 			_menu->addAction(lang(lng_context_delete_image), this, SLOT(deleteMessage()))->setEnabled(true);
 		}
 		_menu->setAttribute(Qt::WA_DeleteOnClose);
diff --git a/Telegram/SourceFiles/localimageloader.cpp b/Telegram/SourceFiles/localimageloader.cpp
index ed6d97b85..8b180efc2 100644
--- a/Telegram/SourceFiles/localimageloader.cpp
+++ b/Telegram/SourceFiles/localimageloader.cpp
@@ -19,7 +19,10 @@ Copyright (c) 2014 John Preston, https://tdesktop.com
 #include "localimageloader.h"
 #include <libexif/exif-data.h>
 
-LocalImageLoaderPrivate::LocalImageLoaderPrivate(int32 currentUser, LocalImageLoader *loader, QThread *thread) : QObject(0), user(currentUser), loader(loader) {
+LocalImageLoaderPrivate::LocalImageLoaderPrivate(int32 currentUser, LocalImageLoader *loader, QThread *thread) : QObject(0)
+    , loader(loader)
+    , user(currentUser)
+{
 	moveToThread(thread);
 	connect(loader, SIGNAL(needToPrepare()), this, SLOT(prepareImages()));
 	connect(this, SIGNAL(imageReady()), loader, SLOT(onImageReady()));
@@ -101,7 +104,7 @@ void LocalImageLoaderPrivate::prepareImages() {
 		filesize = 0;
 	}
 
-	if (img.isNull() && (type != ToPrepareDocument || !filesize) || type == ToPrepareAuto || img.isNull() && file.isEmpty() && data.isEmpty()) { // if could not decide what type
+	if ((img.isNull() && (type != ToPrepareDocument || !filesize)) || type == ToPrepareAuto || (img.isNull() && file.isEmpty() && data.isEmpty())) { // if could not decide what type
 		{
 			QMutexLocker lock(loader->toPrepareMutex());
 			ToPrepareMedias &list(loader->toPrepareMedias());
diff --git a/Telegram/SourceFiles/localimageloader.h b/Telegram/SourceFiles/localimageloader.h
index a0cf22097..ff5449ecd 100644
--- a/Telegram/SourceFiles/localimageloader.h
+++ b/Telegram/SourceFiles/localimageloader.h
@@ -25,11 +25,11 @@ enum ToPrepareMediaType {
 };
 
 struct ToPrepareMedia {
-	ToPrepareMedia(const QString &file, const PeerId &peer, ToPrepareMediaType t) : file(file), peer(peer), id(MTP::nonce<PhotoId>()), type(t) {
+	ToPrepareMedia(const QString &file, const PeerId &peer, ToPrepareMediaType t) : id(MTP::nonce<PhotoId>()), file(file), peer(peer), type(t) {
 	}
-	ToPrepareMedia(const QImage &img, const PeerId &peer, ToPrepareMediaType t) : img(img), peer(peer), id(MTP::nonce<PhotoId>()), type(t) {
+	ToPrepareMedia(const QImage &img, const PeerId &peer, ToPrepareMediaType t) : id(MTP::nonce<PhotoId>()), img(img), peer(peer), type(t) {
 	}
-	ToPrepareMedia(const QByteArray &data, const PeerId &peer, ToPrepareMediaType t) : data(data), peer(peer), id(MTP::nonce<PhotoId>()), type(t) {
+	ToPrepareMedia(const QByteArray &data, const PeerId &peer, ToPrepareMediaType t) : id(MTP::nonce<PhotoId>()), data(data), peer(peer), type(t) {
 	}
 	PhotoId id;
 	QString file;
@@ -43,7 +43,7 @@ typedef QList<ToPrepareMedia> ToPrepareMedias;
 typedef QMap<int32, QByteArray> LocalFileParts;
 struct ReadyLocalMedia {
 	ReadyLocalMedia(ToPrepareMediaType type, const QString &file, const QString &filename, int32 filesize, const QByteArray &data, const uint64 &id, const uint64 &jpeg_id, const PeerId &peer, const MTPPhoto &photo, const PreparedPhotoThumbs &photoThumbs, const MTPDocument &document, const QByteArray &jpeg) :
-		type(type), file(file), filename(filename), filesize(filesize), data(data), id(id), jpeg_id(jpeg_id), peer(peer), photo(photo), photoThumbs(photoThumbs), document(document) {
+		type(type), file(file), filename(filename), filesize(filesize), data(data), id(id), jpeg_id(jpeg_id), peer(peer), photo(photo), document(document), photoThumbs(photoThumbs) {
 		if (!jpeg.isEmpty()) {
 			int32 size = jpeg.size();
 			for (int32 i = 0, part = 0; i < size; i += UploadPartSize, ++part) {
diff --git a/Telegram/SourceFiles/logs.cpp b/Telegram/SourceFiles/logs.cpp
index 8d281b13d..8b6c30e41 100644
--- a/Telegram/SourceFiles/logs.cpp
+++ b/Telegram/SourceFiles/logs.cpp
@@ -69,9 +69,8 @@ void debugLogWrite(const char *file, int32 line, const QString &v) {
 		debugLogStream->flush();
 #ifdef Q_OS_WIN
 		OutputDebugString(reinterpret_cast<const wchar_t *>(msg.utf16()));
-#endif
-#ifdef Q_OS_MAC
-        _outputDebugString(msg.toUtf8().constData());
+#elif defined Q_OS_MAC
+        objc_outputDebugString(msg);
 #endif
 	}
 }
@@ -118,9 +117,7 @@ void logsInit() {
 	if (mainLogStream) return;
     
 #ifdef Q_OS_MAC
-    if (QDir(cWorkingDir()).absolutePath() == qsl("/")) {
-        cSetWorkingDir(cExeDir());
-    }
+	cForceWorkingDir(psAppDataPath());
 #endif
 
 	QString oldDir = cWorkingDir();
diff --git a/Telegram/SourceFiles/main.cpp b/Telegram/SourceFiles/main.cpp
index 8174807e2..f579b141c 100644
--- a/Telegram/SourceFiles/main.cpp
+++ b/Telegram/SourceFiles/main.cpp
@@ -45,8 +45,15 @@ int main(int argc, char *argv[]) {
 
 	DEBUG_LOG(("Application Info: ideal thread count: %1, using %2 connections per session").arg(QThread::idealThreadCount()).arg(cConnectionsInSession()));
 
-	Application app(argc, argv);
-	int result = App::quiting() ? 0 : app.exec();
+	int result = 0;
+	{
+		Application app(argc, argv);
+		if (!App::quiting()) {
+			result = app.exec();
+		}
+	}
+    
+    psFinish();
 
 	DEBUG_LOG(("Application Info: Telegram done, result: %1").arg(result));
 
diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp
index 51177d996..8be1ecf1f 100644
--- a/Telegram/SourceFiles/mainwidget.cpp
+++ b/Telegram/SourceFiles/mainwidget.cpp
@@ -260,9 +260,9 @@ MainWidget *TopBarWidget::main() {
 	return static_cast<MainWidget*>(parentWidget());
 }
 
-MainWidget::MainWidget(Window *window) : QWidget(window), profile(0), _dialogsWidth(st::dlgMinWidth),
-	updPts(0), updDate(0), updQts(0), updSeq(0), updInited(false), failedObjId(0),
-	dialogs(this), history(this), onlineRequest(0), hider(0), _topBar(this) {
+MainWidget::MainWidget(Window *window) : QWidget(window), failedObjId(0), _dialogsWidth(st::dlgMinWidth),
+	dialogs(this), history(this), profile(0), _topBar(this), hider(0),
+    updPts(0), updDate(0), updQts(0), updSeq(0), updInited(false), onlineRequest(0) {
 	setGeometry(QRect(0, st::titleHeight, App::wnd()->width(), App::wnd()->height() - st::titleHeight));
 
 	connect(window, SIGNAL(resized(const QSize &)), this, SLOT(onParentResize(const QSize &)));
@@ -272,7 +272,6 @@ MainWidget::MainWidget(Window *window) : QWidget(window), profile(0), _dialogsWi
 	connect(this, SIGNAL(peerPhotoChanged(PeerData *)), this, SIGNAL(dialogsUpdated()));
 	connect(&noUpdatesTimer, SIGNAL(timeout()), this, SLOT(getDifference()));
 	connect(&onlineTimer, SIGNAL(timeout()), this, SLOT(setOnline()));
-	connect(window->windowHandle(), SIGNAL(windowStateChanged(Qt::WindowState)), this, SLOT(mainStateChanged(Qt::WindowState)));
 	connect(&onlineUpdater, SIGNAL(timeout()), this, SLOT(updateOnlineDisplay()));
 	connect(this, SIGNAL(peerUpdated(PeerData*)), &history, SLOT(peerUpdated(PeerData*)));
 	connect(&_topBar, SIGNAL(clicked()), this, SLOT(onTopBarClick()));
@@ -358,7 +357,7 @@ void MainWidget::dialogsActivate() {
 
 bool MainWidget::leaveChatFailed(PeerData *peer, const RPCError &e) {
 	if (e.type() == "CHAT_ID_INVALID") { // left this chat already
-		if (profile && profile->peer() == peer || profileStack.indexOf(peer) >= 0 || history.peer() == peer) {
+		if ((profile && profile->peer() == peer) || profileStack.indexOf(peer) >= 0 || history.peer() == peer) {
 			showPeer(0);
 		}
 		dialogs.removePeer(peer);
@@ -370,7 +369,7 @@ bool MainWidget::leaveChatFailed(PeerData *peer, const RPCError &e) {
 
 void MainWidget::deleteHistory(PeerData *peer, const MTPmessages_StatedMessage &result) {
 	sentFullDataReceived(0, result);
-	if (profile && profile->peer() == peer || profileStack.indexOf(peer) >= 0 || history.peer() == peer) {
+	if ((profile && profile->peer() == peer) || profileStack.indexOf(peer) >= 0 || history.peer() == peer) {
 		showPeer(0);
 	}
 	dialogs.removePeer(peer);
@@ -398,7 +397,7 @@ void MainWidget::deleteHistoryAndContact(UserData *user, const MTPcontacts_Link
 	App::feedUsers(MTP_vector<MTPUser>(QVector<MTPUser>(1, d.vuser)));
 	App::feedUserLink(MTP_int(user->id & 0xFFFFFFFF), d.vmy_link, d.vforeign_link);
 
-	if (profile && profile->peer() == user || profileStack.indexOf(user) >= 0 || history.peer() == user) {
+	if ((profile && profile->peer() == user) || profileStack.indexOf(user) >= 0 || history.peer() == user) {
 		showPeer(0);
 	}
 	dialogs.removePeer(user);
@@ -472,7 +471,7 @@ void MainWidget::checkedHistory(PeerData *peer, const MTPmessages_Messages &resu
 	if (!v) return;
 
 	if (v->isEmpty()) {
-		if (profile && profile->peer() == peer || profileStack.indexOf(peer) >= 0 || history.peer() == peer) {
+		if ((profile && profile->peer() == peer) || profileStack.indexOf(peer) >= 0 || history.peer() == peer) {
 			showPeer(0);
 		}
 		dialogs.removePeer(peer);
@@ -496,16 +495,52 @@ void MainWidget::clearSelectedItems() {
 	history.onClearSelected();
 }
 
-QRect MainWidget::rectForTitleAnim() const {
-	int w = width();
-	w -= history.x() + st::sysBtnDelta * 2 + st::sysCls.img.width() + st::sysRes.img.width() + st::sysMin.img.width();
-	return QRect(history.x(), 0, w, App::wnd()->getTitle()->height());
-}
-
 DialogsIndexed &MainWidget::contactsList() {
 	return dialogs.contactsList();
 }
 
+void MainWidget::sendMessage(History *hist, const QString &text) {
+    readServerHistory(hist);
+    QString msg = history.prepareMessage(text);
+	if (!msg.isEmpty()) {
+		MsgId newId = clientMsgId();
+		uint64 randomId = MTP::nonce<uint64>();
+        
+		App::historyRegRandom(randomId, newId);
+        
+		MTPstring msgText(MTP_string(msg));
+		hist->addToBack(MTP_message(MTP_int(newId), MTP_int(MTP::authedId()), App::peerToMTP(hist->peer->id), MTP_bool(true), MTP_bool(true), MTP_int(unixtime()), msgText, MTP_messageMediaEmpty()));
+		historyToDown(hist);
+		if (history.peer() == hist->peer) {
+            history.peerMessagesUpdated();
+        }
+        
+		MTP::send(MTPmessages_SendMessage(hist->peer->input, msgText, MTP_long(randomId)), App::main()->rpcDone(&MainWidget::sentDataReceived, randomId));
+    }
+}
+
+void MainWidget::readServerHistory(History *hist, bool force) {
+    if (!hist || (!force && (!hist->unreadCount || !hist->unreadLoaded))) return;
+    
+    ReadRequests::const_iterator i = _readRequests.constFind(hist->peer);
+    if (i == _readRequests.cend()) {
+        hist->inboxRead(true);
+        _readRequests.insert(hist->peer, MTP::send(MTPmessages_ReadHistory(hist->peer->input, MTP_int(0), MTP_int(0)), rpcDone(&MainWidget::partWasRead, hist->peer)));
+    }
+}
+
+void MainWidget::partWasRead(PeerData *peer, const MTPmessages_AffectedHistory &result) {
+	const MTPDmessages_affectedHistory &d(result.c_messages_affectedHistory());
+	App::main()->updUpdated(d.vpts.v, 0, 0, d.vseq.v);
+    
+	int32 offset = d.voffset.v;
+	if (!MTP::authedId() || offset <= 0) {
+        _readRequests.remove(peer);
+    } else {
+        _readRequests[peer] = MTP::send(MTPmessages_ReadHistory(peer->input, MTP_int(0), MTP_int(offset)), rpcDone(&MainWidget::partWasRead, peer));
+    }
+}
+
 void MainWidget::videoLoadProgress(mtpFileLoader *loader) {
 	VideoData *video = App::video(loader->objId());
 	if (video->loader) {
@@ -619,7 +654,7 @@ void MainWidget::onParentResize(const QSize &newSize) {
 }
 
 void MainWidget::updateOnlineDisplay() {
-	history.updateOnlineDisplay(history.x(), width() - history.x() - st::sysBtnDelta * 2 - st::sysCls.img.width() - st::sysRes.img.width() - st::sysMin.img.width());
+	history.updateOnlineDisplay(history.x(), width() - history.x() - st::sysBtnDelta * 2 - st::sysCls.img.pxWidth() - st::sysRes.img.pxWidth() - st::sysMin.img.pxWidth());
 	if (profile) profile->updateOnlineDisplay();
 	if (App::wnd()->settingsWidget()) App::wnd()->settingsWidget()->updateOnlineDisplay();
 }
@@ -1077,7 +1112,7 @@ void MainWidget::onTopBarClick() {
 }
 
 void MainWidget::onPeerShown(PeerData *peer) {
-	if (profile || peer && peer->id) {
+	if (profile || (peer && peer->id)) {
 		_topBar.show();
 	} else {
 		_topBar.hide();
diff --git a/Telegram/SourceFiles/mainwidget.h b/Telegram/SourceFiles/mainwidget.h
index 5a2b80a27..491365a9c 100644
--- a/Telegram/SourceFiles/mainwidget.h
+++ b/Telegram/SourceFiles/mainwidget.h
@@ -25,7 +25,7 @@ Copyright (c) 2014 John Preston, https://tdesktop.com
 #include "profilewidget.h"
 
 class Window;
-class DialogRow;
+struct DialogRow;
 class MainWidget;
 
 class TopBarWidget : public QWidget, public Animated {
@@ -187,9 +187,11 @@ public:
 	void deleteSelectedItems();
 	void clearSelectedItems();
 
-	QRect rectForTitleAnim() const;
-
 	DialogsIndexed &contactsList();
+    
+    void sendMessage(History *history, const QString &text);
+    
+    void readServerHistory(History *history, bool force = true);
 
 	~MainWidget();
 
@@ -233,6 +235,8 @@ public slots:
 
 private:
 
+    void partWasRead(PeerData *peer, const MTPmessages_AffectedHistory &result);
+    
 	uint64 failedObjId;
 	QString failedFileName;
 	void loadFailed(mtpFileLoader *loader, bool started, const char *retrySlot);
@@ -278,4 +282,7 @@ private:
 
 	QSet<PeerData*> updateNotifySettingPeers;
 	QTimer updateNotifySettingTimer;
+    
+    typedef QMap<PeerData*, mtpRequestId> ReadRequests;
+    ReadRequests _readRequests;
 };
diff --git a/Telegram/SourceFiles/mtproto/mtp.cpp b/Telegram/SourceFiles/mtproto/mtp.cpp
index a6df55806..f3d5f0052 100644
--- a/Telegram/SourceFiles/mtproto/mtp.cpp
+++ b/Telegram/SourceFiles/mtproto/mtp.cpp
@@ -483,7 +483,7 @@ namespace MTP {
 		if (!started) return;
 
 		int32 m = mainSession->getDC();
-		if (!dc || m == dc || m && fromZeroOnly) return;
+		if (!dc || m == dc || (m && fromZeroOnly)) return;
 		mtpSetDC(dc);
 		mainSession = _mtp_internal::getSession(dc);
 	}
diff --git a/Telegram/SourceFiles/mtproto/mtpConnection.cpp b/Telegram/SourceFiles/mtproto/mtpConnection.cpp
index c11fac3a0..a114c0f57 100644
--- a/Telegram/SourceFiles/mtproto/mtpConnection.cpp
+++ b/Telegram/SourceFiles/mtproto/mtpConnection.cpp
@@ -517,7 +517,7 @@ namespace {
 }
 
 MTPabstractTcpConnection::MTPabstractTcpConnection() :
-currentPos((char*)shortBuffer), packetRead(0), packetLeft(0), readingToShort(true), packetNum(0) {
+packetNum(0), packetRead(0), packetLeft(0), readingToShort(true), currentPos((char*)shortBuffer) {
 }
 
 void MTPabstractTcpConnection::socketRead() {
@@ -1033,22 +1033,22 @@ void MTProtoConnectionPrivate::createConn() {
 
 MTProtoConnectionPrivate::MTProtoConnectionPrivate(QThread *thread, MTProtoConnection *owner, MTPSessionData *data, uint32 _dc)
 	: QObject(0)
-	, dc(_dc)
-	, conn(0)
-	, retryTimeout(1)
-	, receiveDelay(MinReceiveDelay)
-	, firstSentAt(-1)
-	, oldConnection(true)
 	, _state(MTProtoConnection::Disconnected)
-	, _owner(owner)
-	, sessionData(data)
-	, keyId(0)
-	, pingId(0)
-	, toSendPingId(0)
-	, pingMsgId(0)
-	, restarted(false)
+    , dc(_dc)
+    , _owner(owner)
+    , conn(0)
+    , retryTimeout(1)
+    , oldConnection(true)
+    , receiveDelay(MinReceiveDelay)
+    , firstSentAt(-1)
 	, ackRequest(MTP_msgs_ack(MTPVector<MTPlong>()))
-	, myKeyLock(false)
+    , pingId(0)
+    , toSendPingId(0)
+    , pingMsgId(0)
+    , restarted(false)
+    , keyId(0)
+    , sessionData(data)
+    , myKeyLock(false)
 	, authKeyData(0) {
 
 	ackRequestData = &ackRequest._msgs_ack().vmsg_ids._vector().v;
@@ -1405,7 +1405,7 @@ void MTProtoConnectionPrivate::onReceivedSome() {
 		int32 ms = getms() - firstSentAt;
 		DEBUG_LOG(("MTP Info: response in %1ms, receiveDelay: %2ms").arg(ms).arg(receiveDelay));
 
-		if (ms > 0 && ms * 2 < receiveDelay) receiveDelay = qMax(ms * 2, int32(MinReceiveDelay));
+		if (ms > 0 && ms * 2 < int32(receiveDelay)) receiveDelay = qMax(ms * 2, int32(MinReceiveDelay));
 		firstSentAt = -1;
 	}
 }
@@ -1502,7 +1502,7 @@ void MTProtoConnectionPrivate::handleReceived() {
 		uint32 seqNo = *(uint32*)&data[6], msgLen = *(uint32*)&data[7];
 		bool needAck = (seqNo & 0x01);
 
-		if (dataBuffer.size() < msgLen + 8 * sizeof(mtpPrime) || (msgLen & 0x03)) {
+		if (uint32(dataBuffer.size()) < msgLen + 8 * sizeof(mtpPrime) || (msgLen & 0x03)) {
 			LOG(("TCP Error: bad msg_len received %1, data size: %2").arg(msgLen).arg(dataBuffer.size()));
 			TCP_LOG(("TCP Error: bad message %1").arg(mb(encrypted, len * sizeof(mtpPrime)).str()));
 			conn->received().pop_front();
@@ -1987,7 +1987,7 @@ int32 MTProtoConnectionPrivate::handleOneReceived(const mtpPrime *from, const mt
 		}
 
 		mtpRequestId requestId = wasSent(reqMsgId.v);
-		if (requestId && requestId != 0xFFFFFFFF) {
+		if (requestId && requestId != mtpRequestId(0xFFFFFFFF)) {
 			QWriteLocker locker(sessionData->haveReceivedMutex());
 			sessionData->haveReceivedMap().insert(requestId, response); // save rpc_result for processing in main mtp thread
 		} else {
@@ -2899,12 +2899,12 @@ bool MTProtoConnectionPrivate::sendRequest(mtpRequest &request, bool needAnyResp
 }
 
 mtpRequestId MTProtoConnectionPrivate::wasSent(mtpMsgId msgId) const {
-	if (msgId == pingMsgId) return 0xFFFFFFFF;
+	if (msgId == pingMsgId) return mtpRequestId(0xFFFFFFFF);
 	{
 		QReadLocker locker(sessionData->haveSentMutex());
 		const mtpRequestMap &haveSent(sessionData->haveSentMap());
 		mtpRequestMap::const_iterator i = haveSent.constFind(msgId);
-		if (i != haveSent.cend()) return i.value()->requestId || 0xFFFFFFFF;
+		if (i != haveSent.cend()) return i.value()->requestId ? i.value()->requestId : mtpRequestId(0xFFFFFFFF);
 	}
 	{
 		QReadLocker locker(sessionData->toResendMutex());
diff --git a/Telegram/SourceFiles/mtproto/mtpDC.cpp b/Telegram/SourceFiles/mtproto/mtpDC.cpp
index 0116805fc..699f74cd5 100644
--- a/Telegram/SourceFiles/mtproto/mtpDC.cpp
+++ b/Telegram/SourceFiles/mtproto/mtpDC.cpp
@@ -84,7 +84,7 @@ namespace {
 					continue;
 				}
 				uint32 dataLen = *(const uint32*)decrypted.constData();
-				if (dataLen > decrypted.size() || dataLen <= fullDataLen - 16 || dataLen < 4) {
+				if (dataLen > uint32(decrypted.size()) || dataLen <= fullDataLen - 16 || dataLen < 4) {
 					LOG(("MTP Error: bad decrypted part size: %1, fullDataLen: %2, decrypted size: %3").arg(dataLen).arg(fullDataLen).arg(decrypted.size()));
 					continue;
 				}
@@ -200,7 +200,7 @@ namespace {
 			DEBUG_LOG(("MTP Info: keys file opened for reading"));
 			int32 oldFound = readAuthKeys(keysFile);
 
-			if (gDCOptions.isEmpty() || mainDC && gDCOptions.find(mainDC) == gDCOptions.cend()) { // load first dc info
+			if (gDCOptions.isEmpty() || (mainDC && gDCOptions.find(mainDC) == gDCOptions.cend())) { // load first dc info
 				gDCOptions.insert(1, mtpDcOption(1, "", cFirstDCIp(), cFirstDCPort()));
 				userId = 0;
 				mainDC = 0;
diff --git a/Telegram/SourceFiles/mtproto/mtpFileLoader.cpp b/Telegram/SourceFiles/mtproto/mtpFileLoader.cpp
index c6f57145c..f441bbd03 100644
--- a/Telegram/SourceFiles/mtproto/mtpFileLoader.cpp
+++ b/Telegram/SourceFiles/mtproto/mtpFileLoader.cpp
@@ -34,8 +34,10 @@ namespace {
 	LoaderQueues queues;
 }
 
-mtpFileLoader::mtpFileLoader(int32 dc, const int64 &volume, int32 local, const int64 &secret) : next(0), prev(0), inQueue(false), complete(false), requestId(0), priority(0), initialSize(0),
-	dc(dc), volume(volume), local(local), secret(secret), size(0), type(MTP_storage_fileUnknown()), locationType(0), id(0), access(0) {
+mtpFileLoader::mtpFileLoader(int32 dc, const int64 &volume, int32 local, const int64 &secret) : prev(0), next(0),
+    priority(0), inQueue(false), complete(false), requestId(0),
+    dc(dc), locationType(0), volume(volume), local(local), secret(secret),
+    id(0), access(0), initialSize(0), size(0), type(MTP_storage_fileUnknown()) {
 	LoaderQueues::iterator i = queues.find(dc);
 	if (i == queues.cend()) {
 		i = queues.insert(dc, mtpFileLoaderQueue());
@@ -43,8 +45,10 @@ mtpFileLoader::mtpFileLoader(int32 dc, const int64 &volume, int32 local, const i
 	queue = &i.value();
 }
 
-mtpFileLoader::mtpFileLoader(int32 dc, const uint64 &id, const uint64 &access, mtpTypeId locType, const QString &to, int32 size) : next(0), prev(0), inQueue(false), complete(false), requestId(0), priority(0),
-	dc(dc), id(id), access(access), type(MTP_storage_fileUnknown()), locationType(locType), file(to), initialSize(size) {
+mtpFileLoader::mtpFileLoader(int32 dc, const uint64 &id, const uint64 &access, mtpTypeId locType, const QString &to, int32 size) : prev(0), next(0),
+    priority(0), inQueue(false), complete(false), requestId(0),
+	dc(dc), locationType(locType),
+    id(id), access(access), file(to), initialSize(size), type(MTP_storage_fileUnknown()) {
 	LoaderQueues::iterator i = queues.find(MTP::dld + dc);
 	if (i == queues.cend()) {
 		i = queues.insert(MTP::dld + dc, mtpFileLoaderQueue());
@@ -145,7 +149,7 @@ void mtpFileLoader::partLoaded(int32 offset, const MTPupload_File &result) {
 		const string &bytes(d.vbytes.c_string().v);
 		if (bytes.size()) {
 			if (file.isOpen()) {
-				if (file.write(bytes.data(), bytes.size()) != bytes.size()) {
+				if (file.write(bytes.data(), bytes.size()) != qint64(bytes.size())) {
 					return finishFail();
 				}
 			} else {
@@ -318,7 +322,7 @@ bool mtpFileLoader::loading() const {
 }
 
 void mtpFileLoader::started(bool loadFirst, bool prior) {
-	if (queue->queries >= MaxFileQueries && (!loadFirst || !prior) || complete) return;
+	if ((queue->queries >= MaxFileQueries && (!loadFirst || !prior)) || complete) return;
 	loadPart();
 }
 
diff --git a/Telegram/SourceFiles/mtproto/mtpRPC.h b/Telegram/SourceFiles/mtproto/mtpRPC.h
index fdf3d8e26..8fa3a8886 100644
--- a/Telegram/SourceFiles/mtproto/mtpRPC.h
+++ b/Telegram/SourceFiles/mtproto/mtpRPC.h
@@ -457,7 +457,7 @@ class RPCBindedDoneHandlerOwned : public RPCOwnedDoneHandler { // done(b, result
 	typedef TReturn (TReceiver::*CallbackType)(T, const TResponse &);
 
 public:
-    RPCBindedDoneHandlerOwned(T b, TReceiver *receiver, CallbackType onDone) : RPCOwnedDoneHandler(receiver), _b(b), _onDone(onDone) {
+    RPCBindedDoneHandlerOwned(T b, TReceiver *receiver, CallbackType onDone) : RPCOwnedDoneHandler(receiver), _onDone(onDone), _b(b) {
 	}
 	virtual void operator()(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end) const {
 		if (_owner) (static_cast<TReceiver*>(_owner)->*_onDone)(_b, TResponse(from, end));
@@ -589,7 +589,7 @@ class RPCBindedFailHandlerOwned : public RPCOwnedFailHandler { // fail(b, error)
 	typedef bool (TReceiver::*CallbackType)(T, const RPCError &);
 
 public:
-	RPCBindedFailHandlerOwned(T b, TReceiver *receiver, CallbackType onFail) : RPCOwnedFailHandler(receiver), _b(b), _onFail(onFail) {
+	RPCBindedFailHandlerOwned(T b, TReceiver *receiver, CallbackType onFail) : RPCOwnedFailHandler(receiver), _onFail(onFail), _b(b) {
 	}
 	virtual bool operator()(mtpRequestId requestId, const RPCError &e) const {
 		return _owner ? (static_cast<TReceiver*>(_owner)->*_onFail)(_b, e) : true;
@@ -623,7 +623,7 @@ class RPCBindedFailHandlerOwnedNo : public RPCOwnedFailHandler { // fail(b)
 	typedef bool (TReceiver::*CallbackType)(T);
 
 public:
-	RPCBindedFailHandlerOwnedNo(T b, TReceiver *receiver, CallbackType onFail) : RPCOwnedFailHandler(receiver), _b(b), _onFail(onFail) {
+	RPCBindedFailHandlerOwnedNo(T b, TReceiver *receiver, CallbackType onFail) : RPCOwnedFailHandler(receiver), _onFail(onFail), _b(b) {
 	}
 	virtual bool operator()(mtpRequestId requestId, const RPCError &e) const {
 		return _owner ? (static_cast<TReceiver*>(_owner)->*_onFail)(_b) : true;
@@ -640,7 +640,7 @@ class RPCBindedFailHandlerOwnedNoReq : public RPCOwnedFailHandler { // fail(b, r
 	typedef bool (TReceiver::*CallbackType)(T, mtpRequestId);
 
 public:
-	RPCBindedFailHandlerOwnedNoReq(T b, TReceiver *receiver, CallbackType onFail) : RPCOwnedFailHandler(receiver), _b(b), _onFail(onFail) {
+	RPCBindedFailHandlerOwnedNoReq(T b, TReceiver *receiver, CallbackType onFail) : RPCOwnedFailHandler(receiver), _onFail(onFail), _b(b) {
 	}
 	virtual bool operator()(mtpRequestId requestId, const RPCError &e) const {
 		return _owner ? (static_cast<TReceiver*>(_owner)->*_onFail)(_b, requestId) : true;
diff --git a/Telegram/SourceFiles/mtproto/mtpSession.cpp b/Telegram/SourceFiles/mtproto/mtpSession.cpp
index c510769b6..0a69076bb 100644
--- a/Telegram/SourceFiles/mtproto/mtpSession.cpp
+++ b/Telegram/SourceFiles/mtproto/mtpSession.cpp
@@ -63,7 +63,7 @@ void MTPSessionData::clear() {
 }
 
 
-MTProtoSession::MTProtoSession() : data(this), dc(0), dcId(0), msSendCall(0), msWait(0) {
+MTProtoSession::MTProtoSession() : data(this), dcId(0), dc(0), msSendCall(0), msWait(0) {
 }
 
 void MTProtoSession::start(int32 dcenter, uint32 connects) {
@@ -158,7 +158,7 @@ void MTProtoSession::checkRequestsByTimer() {
 						stateRequestIds.push_back(MTP_long(i.key()));
 					}
 				}
-			} else if (unixtime() > (uint32)(i.key() >> 32) + MTPContainerLives) {
+			} else if (unixtime() > (int32)(i.key() >> 32) + MTPContainerLives) {
 				removingIds.reserve(haveSentCount);
 				removingIds.push_back(i.key());
 			}
@@ -216,7 +216,7 @@ int32 MTProtoSession::requestState(mtpRequestId requestId) const {
 				result = MTP::RequestConnecting;
 			}
 		} else if (s < 0) {
-			if (result < 0 && s > result || result == MTP::RequestSent) {
+			if ((result < 0 && s > result) || result == MTP::RequestSent) {
 				result = s;
 			}
 		}
diff --git a/Telegram/SourceFiles/mtproto/mtpSession.h b/Telegram/SourceFiles/mtproto/mtpSession.h
index 1f198e142..eb2220f43 100644
--- a/Telegram/SourceFiles/mtproto/mtpSession.h
+++ b/Telegram/SourceFiles/mtproto/mtpSession.h
@@ -27,9 +27,9 @@ class MTPSessionData {
 public:
 	
 	MTPSessionData(MTProtoSession *creator)
-	: _session(0), _salt(0), fakeRequestId(-2000000000)
-	, _messagesSent(0), keyChecked(false)
-	, _owner(creator) {
+	: _session(0), _salt(0)
+	, _messagesSent(0), fakeRequestId(-2000000000)
+	, _owner(creator), keyChecked(false) {
 	}
 
 	void setSession(uint64 session) {
diff --git a/Telegram/SourceFiles/profilewidget.cpp b/Telegram/SourceFiles/profilewidget.cpp
index e0eac83d4..15c7bb823 100644
--- a/Telegram/SourceFiles/profilewidget.cpp
+++ b/Telegram/SourceFiles/profilewidget.cpp
@@ -619,7 +619,7 @@ bool ProfileInner::animStep(float64 ms) {
 }
 
 bool ProfileInner::getPhotoCoords(PhotoData *photo, int32 &x, int32 &y, int32 &w) const {
-	if (_peerUser && photo->id == _peerUser->photoId || _peerChat && photo->id == _peerChat->photoId) {
+	if ((_peerUser && photo->id == _peerUser->photoId) || (_peerChat && photo->id == _peerChat->photoId)) {
 		x = _left;
 		y = st::profilePadding.top();
 		w = st::setPhotoSize;
@@ -704,8 +704,11 @@ void ProfileInner::showAll() {
 	resize(width(), h);
 }
 
-ProfileWidget::ProfileWidget(QWidget *parent, const PeerData *peer) : QWidget(parent),
-	_inner(this, &_scroll, peer), _scroll(this, st::setScroll), _showing(false) {
+ProfileWidget::ProfileWidget(QWidget *parent, const PeerData *peer) : QWidget(parent)
+    , _scroll(this, st::setScroll)
+    , _inner(this, &_scroll, peer)
+    , _showing(false)
+{
 	_scroll.setWidget(&_inner);
 	_scroll.move(0, 0);
 	_inner.move(0, 0);
@@ -761,10 +764,10 @@ void ProfileWidget::paintTopBar(QPainter &p, float64 over, int32 decreaseWidth)
 		p.drawPixmap(a_coord.current(), 0, _animTopBarCache);
 	} else {
 		p.setOpacity(st::topBarBackAlpha + (1 - st::topBarBackAlpha) * over);
-		p.drawPixmap(QPoint(st::topBarBackPadding.left(), (st::topBarHeight - st::topBarBackImg.height()) / 2), App::sprite(), st::topBarBackImg);
+		p.drawPixmap(QPoint(st::topBarBackPadding.left(), (st::topBarHeight - st::topBarBackImg.pxHeight()) / 2), App::sprite(), st::topBarBackImg);
 		p.setFont(st::topBarBackFont->f);
 		p.setPen(st::topBarBackColor->p);
-		p.drawText(st::topBarBackPadding.left() + st::topBarBackImg.width() + st::topBarBackPadding.right(), (st::topBarHeight - st::titleFont->height) / 2 + st::titleFont->ascent, lang(peer()->chat ? lng_profile_group_info : lng_profile_info));
+		p.drawText(st::topBarBackPadding.left() + st::topBarBackImg.pxWidth() + st::topBarBackPadding.right(), (st::topBarHeight - st::titleFont->height) / 2 + st::titleFont->ascent, lang(peer()->chat ? lng_profile_group_info : lng_profile_info));
 	}
 }
 
diff --git a/Telegram/SourceFiles/pspecific_mac.cpp b/Telegram/SourceFiles/pspecific_mac.cpp
index 43c76d461..27045ad52 100644
--- a/Telegram/SourceFiles/pspecific_mac.cpp
+++ b/Telegram/SourceFiles/pspecific_mac.cpp
@@ -34,63 +34,9 @@ namespace {
 		bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) {
 			Window *wnd = Application::wnd();
 			if (!wnd) return false;
-/*
-			MSG *msg = (MSG*)message;
-			if (msg->message == WM_ENDSESSION) {
-				App::quit();
-				return false;
-			}
-			if (msg->hwnd == wnd->psHwnd() || msg->hwnd && !wnd->psHwnd()) {
-				return mainWindowEvent(msg->hwnd, msg->message, msg->wParam, msg->lParam, (LRESULT*)result);
-			}*/
+
 			return false;
 		}
-/*
-		bool mainWindowEvent(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *result) {
-			if (tbCreatedMsgId && msg == tbCreatedMsgId) {
-				if (CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_ALL, IID_ITaskbarList3, (void**)&tbListInterface) != S_OK) {
-					tbListInterface = 0;
-				}
-			}
-			switch (msg) {
-
-			case WM_DESTROY: {
-				App::quit();
-			} return false;
-
-			case WM_ACTIVATE: {
-				if (LOWORD(wParam) == WA_CLICKACTIVE) {
-					App::wnd()->inactivePress(true);
-				}
-			} return false;
-
-            case WM_SIZE: {
-				if (App::wnd()) {
-					if (wParam == SIZE_MAXIMIZED || wParam == SIZE_RESTORED || wParam == SIZE_MINIMIZED) {
-						if (wParam != SIZE_RESTORED || App::wnd()->windowState() != Qt::WindowNoState) {
-							Qt::WindowState state = Qt::WindowNoState;
-							if (wParam == SIZE_MAXIMIZED) {
-								state = Qt::WindowMaximized;
-							} else if (wParam == SIZE_MINIMIZED) {
-								state = Qt::WindowMinimized;
-							}
-							emit App::wnd()->windowHandle()->windowStateChanged(state);
-						} else {
-							App::wnd()->psUpdatedPosition();
-						}
-						int changes = (wParam == SIZE_MINIMIZED || wParam == SIZE_MAXIMIZED) ? _PsShadowHidden : (_PsShadowResized | _PsShadowShown);
-						_psShadowWindows.update(changes);
-					}
-				}
-			} return false;
-
-			case WM_MOVE: {
-				_psShadowWindows.update(_PsShadowMoved);
-				App::wnd()->psUpdatedPosition();
-			} return false;
-            }
-			return false;
-		}*/
 	};
     _PsEventFilter *_psEventFilter = 0;
 
@@ -112,30 +58,37 @@ void MacPrivate::notifyClicked(unsigned long long peer) {
 }
 
 void MacPrivate::notifyReplied(unsigned long long peer, const char *str) {
+    History *history = App::history(PeerId(peer));
     
+    App::main()->sendMessage(history, QString::fromUtf8(str));
 }
 
 PsMainWindow::PsMainWindow(QWidget *parent) : QMainWindow(parent),
 posInited(false), trayIcon(0), trayIconMenu(0), icon256(qsl(":/gui/art/iconround256.png")) {
-    
-    //tbCreatedMsgId = RegisterWindowMessage(L"TaskbarButtonCreated");
-    icon16 = icon256.scaledToWidth(16, Qt::SmoothTransformation);
-    icon32 = icon256.scaledToWidth(32, Qt::SmoothTransformation);
     connect(&psIdleTimer, SIGNAL(timeout()), this, SLOT(psIdleTimeout()));
     psIdleTimer.setSingleShot(false);
 	connect(&notifyWaitTimer, SIGNAL(timeout()), this, SLOT(psNotifyFire()));
 	notifyWaitTimer.setSingleShot(true);
 }
 
+void PsMainWindow::psNotIdle() const {
+	psIdleTimer.stop();
+	if (psIdle) {
+		psIdle = false;
+		if (App::main()) App::main()->setOnline();
+		if (App::wnd()) App::wnd()->checkHistoryActivation();
+	}
+}
+
 void PsMainWindow::psIdleTimeout() {
-    int64 idleTime = _idleTime();
+    int64 idleTime = objc_idleTime();
     if (idleTime >= 0) {
         if (idleTime <= IdleMsecs) {
-            psIdle = false;
-            psIdleTimer.stop();
-            if (App::main()) App::main()->setOnline();
+			psNotIdle();
 		}
-    }
+    } else { // error
+		psNotIdle();
+	}
 }
 
 bool PsMainWindow::psIsOnline(int state) const {
@@ -145,7 +98,7 @@ bool PsMainWindow::psIsOnline(int state) const {
 	} else if (!isVisible()) {
 		return false;
 	}
-    int64 idleTime = _idleTime();
+    int64 idleTime = objc_idleTime();
     LOG(("App Info: idle time %1").arg(idleTime));
     if (idleTime >= 0) {
         if (idleTime > IdleMsecs) {
@@ -155,63 +108,23 @@ bool PsMainWindow::psIsOnline(int state) const {
 			}
 			return false;
 		} else {
-			psIdle = false;
-			psIdleTimer.stop();
+			psNotIdle();
 		}
-    }
+    } else { // error
+		psNotIdle();
+	}
 	return true;
 }
 
 bool PsMainWindow::psIsActive(int state) const {
 	if (state < 0) state = this->windowState();
-    return isActiveWindow() && isVisible() && !(state & Qt::WindowMinimized);
+    return isActiveWindow() && isVisible() && !(state & Qt::WindowMinimized) && !psIdle;
 }
 
 void PsMainWindow::psRefreshTaskbarIcon() {
-    /*QWidget *w = new QWidget(this);
-	w->setWindowFlags(Qt::Tool | Qt::FramelessWindowHint);
-	w->setGeometry(x() + 1, y() + 1, 1, 1);
-	QPalette p(w->palette());
-	p.setColor(QPalette::Background, st::titleBG->c);
-	QWindow *wnd = w->windowHandle();
-	w->setPalette(p);
-	w->show();
-	w->activateWindow();
-    delete w;*/
 }
 
 void PsMainWindow::psUpdateWorkmode() {
-    /*switch (cWorkMode()) {
-	case dbiwmWindowAndTray: {
-		setupTrayIcon();
-		HWND psOwner = (HWND)GetWindowLong(ps_hWnd, GWL_HWNDPARENT);
-		if (psOwner) {
-			SetWindowLong(ps_hWnd, GWL_HWNDPARENT, 0);
-			psRefreshTaskbarIcon();
-		}
-	} break;
-
-	case dbiwmTrayOnly: {
-		setupTrayIcon();
-		HWND psOwner = (HWND)GetWindowLong(ps_hWnd, GWL_HWNDPARENT);
-		if (!psOwner) {
-			SetWindowLong(ps_hWnd, GWL_HWNDPARENT, (LONG)ps_tbHider_hWnd);
-		}
-	} break;
-
-	case dbiwmWindowOnly: {
-		if (trayIconMenu) trayIconMenu->deleteLater();
-		trayIconMenu = 0;
-		if (trayIcon) trayIcon->deleteLater();
-		trayIcon = 0;
-
-		HWND psOwner = (HWND)GetWindowLong(ps_hWnd, GWL_HWNDPARENT);
-		if (psOwner) {
-			SetWindowLong(ps_hWnd, GWL_HWNDPARENT, 0);
-			psRefreshTaskbarIcon();
-		}
-	} break;
-    }*/
 }
 
 void PsMainWindow::psUpdateCounter() {
@@ -220,59 +133,38 @@ void PsMainWindow::psUpdateCounter() {
     setWindowTitle((counter > 0) ? qsl("Telegram (%1)").arg(counter) : qsl("Telegram"));
 
     QString cnt = (counter < 1000) ? QString("%1").arg(counter) : QString("..%1").arg(counter % 100, 2, 10, QChar('0'));
-    _private.setWindowBadge(counter ? cnt.toUtf8().constData() : "");
+    _private.setWindowBadge(counter ? cnt : QString());
 }
 
-/*namespace {
-	HMONITOR enumMonitor = 0;
-	RECT enumMonitorWork;
-
-	BOOL CALLBACK _monitorEnumProc(
-	  _In_  HMONITOR hMonitor,
-	  _In_  HDC hdcMonitor,
-	  _In_  LPRECT lprcMonitor,
-	  _In_  LPARAM dwData
-	) {
-		MONITORINFOEX info;
-		info.cbSize = sizeof(info);
-		GetMonitorInfo(hMonitor, &info);
-		if (dwData == hashCrc32(info.szDevice, sizeof(info.szDevice))) {
-			enumMonitor = hMonitor;
-			enumMonitorWork = info.rcWork;
-			return FALSE;
-		}
-		return TRUE;
-	}
-}*/
-
 void PsMainWindow::psInitSize() {
 	setMinimumWidth(st::wndMinWidth);
 	setMinimumHeight(st::wndMinHeight);
 
 	TWindowPos pos(cWindowPos());
-	if (cDebug()) { // temp while design
-		pos.w = 800;
-		pos.h = 600;
-	}
 	QRect avail(QDesktopWidget().availableGeometry());
 	bool maximized = false;
 	QRect geom(avail.x() + (avail.width() - st::wndDefWidth) / 2, avail.y() + (avail.height() - st::wndDefHeight) / 2, st::wndDefWidth, st::wndDefHeight);
 	if (pos.w && pos.h) {
-		if (pos.y < 0) pos.y = 0;
-        //enumMonitor = 0;
-        //EnumDisplayMonitors(0, 0, &_monitorEnumProc, pos.moncrc);
-        /*if (enumMonitor) {
-			int32 w = enumMonitorWork.right - enumMonitorWork.left, h = enumMonitorWork.bottom - enumMonitorWork.top;
-			if (w >= st::wndMinWidth && h >= st::wndMinHeight) {
-				if (pos.w > w) pos.w = w;
-				if (pos.h > h) pos.h = h;
-				pos.x += enumMonitorWork.left;
-				pos.y += enumMonitorWork.top;
-				if (pos.x < enumMonitorWork.right - 10 && pos.y < enumMonitorWork.bottom - 10) {
-					geom = QRect(pos.x, pos.y, pos.w, pos.h);
+		QList<QScreen*> screens = App::app()->screens();
+		for (QList<QScreen*>::const_iterator i = screens.cbegin(), e = screens.cend(); i != e; ++i) {
+			QByteArray name = (*i)->name().toUtf8();
+			if (pos.moncrc == hashCrc32(name.constData(), name.size())) {
+				QRect screen((*i)->geometry());
+				int32 w = screen.width(), h = screen.height();
+				if (w >= st::wndMinWidth && h >= st::wndMinHeight) {
+					if (pos.w > w) pos.w = w;
+					if (pos.h > h) pos.h = h;
+					pos.x += screen.x();
+					pos.y += screen.y();
+					if (pos.x < screen.x() + screen.width() - 10 && pos.y < screen.y() + screen.height() - 10) {
+						geom = QRect(pos.x, pos.y, pos.w, pos.h);
+					}
 				}
+				break;
 			}
-        }*/
+		}
+
+		if (pos.y < 0) pos.y = 0;
 		maximized = pos.maximized;
 	}
 	setGeometry(geom);
@@ -283,7 +175,7 @@ void PsMainWindow::psInitFrameless() {
 	connect(&psUpdatedPositionTimer, SIGNAL(timeout()), this, SLOT(psSavePosition()));
 
 	if (frameless) {
-//		setWindowFlags(Qt::FramelessWindowHint);
+		//setWindowFlags(Qt::FramelessWindowHint);
 	}
 
     connect(windowHandle(), SIGNAL(windowStateChanged(Qt::WindowState)), this, SLOT(psStateChanged(Qt::WindowState)));
@@ -292,31 +184,36 @@ void PsMainWindow::psInitFrameless() {
 void PsMainWindow::psSavePosition(Qt::WindowState state) {
     if (state == Qt::WindowActive) state = windowHandle()->windowState();
 	if (state == Qt::WindowMinimized || !posInited) return;
-/*
+
 	TWindowPos pos(cWindowPos()), curPos = pos;
 
 	if (state == Qt::WindowMaximized) {
 		curPos.maximized = 1;
 	} else {
-		RECT w;
-		GetWindowRect(ps_hWnd, &w);
-		curPos.x = w.left;
-		curPos.y = w.top;
-		curPos.w = w.right - w.left;
-		curPos.h = w.bottom - w.top;
+		QRect r(geometry());
+		curPos.x = r.x();
+		curPos.y = r.y();
+		curPos.w = r.width();
+		curPos.h = r.height();
 		curPos.maximized = 0;
 	}
 
-	HMONITOR hMonitor = MonitorFromWindow(ps_hWnd, MONITOR_DEFAULTTONEAREST);
-	if (hMonitor) {
-		MONITORINFOEX info;
-		info.cbSize = sizeof(info);
-		GetMonitorInfo(hMonitor, &info);
-		if (!curPos.maximized) {
-			curPos.x -= info.rcWork.left;
-			curPos.y -= info.rcWork.top;
+	int px = curPos.x + curPos.w / 2, py = curPos.y + curPos.h / 2, d = 0;
+	QScreen *chosen = 0;
+	QList<QScreen*> screens = App::app()->screens();
+	for (QList<QScreen*>::const_iterator i = screens.cbegin(), e = screens.cend(); i != e; ++i) {
+		int dx = (*i)->geometry().x() + (*i)->geometry().width() / 2 - px; if (dx < 0) dx = -dx;
+		int dy = (*i)->geometry().y() + (*i)->geometry().height() / 2 - py; if (dy < 0) dy = -dy;
+		if (!chosen || dx + dy < d) {
+			d = dx + dy;
+			chosen = *i;
 		}
-		curPos.moncrc = hashCrc32(info.szDevice, sizeof(info.szDevice));
+	}
+	if (chosen) {
+		curPos.x -= chosen->geometry().x();
+		curPos.y -= chosen->geometry().y();
+		QByteArray name = chosen->name().toUtf8();
+		curPos.moncrc = hashCrc32(name.constData(), name.size());
 	}
 
 	if (curPos.w >= st::wndMinWidth && curPos.h >= st::wndMinHeight) {
@@ -324,20 +221,20 @@ void PsMainWindow::psSavePosition(Qt::WindowState state) {
 			cSetWindowPos(curPos);
 			App::writeConfig();
 		}
-    }*/
+    }
 }
 
 void PsMainWindow::psUpdatedPosition() {
-    //psUpdatedPositionTimer.start(4000);
+    psUpdatedPositionTimer.start(4000);
 }
 
 void PsMainWindow::psStateChanged(Qt::WindowState state) {
 	psUpdateSysMenu(state);
 	psUpdateMargins();
-    /*if (state == Qt::WindowMinimized && GetWindowLong(ps_hWnd, GWL_HWNDPARENT)) {
-		minimizeToTray();
-    }
-    psSavePosition(state);*/
+//    if (state == Qt::WindowMinimized && GetWindowLong(ps_hWnd, GWL_HWNDPARENT)) {
+//		minimizeToTray();
+//    }
+    psSavePosition(state);
 }
 
 void PsMainWindow::psFirstShow() {
@@ -348,6 +245,7 @@ void PsMainWindow::psFirstShow() {
 	bool showShadows = true;
 
 	show();
+    _private.enableShadow(winId());
 	if (cWindowPos().maximized) {
 		setWindowState(Qt::WindowMaximized);
 	}
@@ -371,7 +269,7 @@ void PsMainWindow::psFirstShow() {
 }
 
 bool PsMainWindow::psHandleTitle() {
-    return true;
+    return false;
 }
 
 void PsMainWindow::psInitSysMenu() {
@@ -611,7 +509,7 @@ void PsMainWindow::psShowNextNotify(PsNotifyWindow *remove) {
                     _private.showOverAll(notify->winId());
                     --count;
                 } else {
-                    _private.showNotify(notifyItem->history()->peer->id, notifyItem->history()->peer->name.toUtf8().constData(), notifyItem->notificationHeader().toUtf8().constData(), notifyItem->notificationText().toUtf8().constData());
+                    _private.showNotify(notifyItem->history()->peer->id, notifyItem->history()->peer->name, notifyItem->notificationHeader(), notifyItem->notificationText());
                 }
                 
 				uint64 ms = getms();
@@ -681,14 +579,12 @@ void PsMainWindow::psUpdateNotifies() {
     }
 }
 
-PsNotifyWindow::PsNotifyWindow(HistoryItem *item, int32 x, int32 y) : history(item->history()), aOpacity(0), _index(0), hiding(false),// started(GetTickCount()),
-alphaDuration(st::notifyFastAnim), posDuration(st::notifyFastAnim), aY(y + st::notifyHeight + st::notifyDeltaY), close(this, st::notifyClose), aOpacityFunc(st::notifyFastAnimFunc) {
+PsNotifyWindow::PsNotifyWindow(HistoryItem *item, int32 x, int32 y) : history(item->history()),// started(GetTickCount()),
+close(this, st::notifyClose), alphaDuration(st::notifyFastAnim), posDuration(st::notifyFastAnim), hiding(false), _index(0), aOpacity(0), aOpacityFunc(st::notifyFastAnimFunc), aY(y + st::notifyHeight + st::notifyDeltaY) {
     
 	int32 w = st::notifyWidth, h = st::notifyHeight;
-	QImage img(w * cRetinaFactor(), h * cRetinaFactor(), QImage::Format_ARGB32_Premultiplied);
-    if (cRetina()) {
-        img.setDevicePixelRatio(cRetinaFactor());
-    }
+	QImage img(w * cIntRetinaFactor(), h * cIntRetinaFactor(), QImage::Format_ARGB32_Premultiplied);
+    if (cRetina()) img.setDevicePixelRatio(cRetinaFactor());
 	img.fill(st::notifyBG->c);
     
 	{
@@ -1076,23 +972,7 @@ void PsUpdateDownloader::partFailed(QNetworkReply::NetworkError e) {
 }
 
 void PsUpdateDownloader::deleteDir(const QString &dir) {
-    /*std::wstring wDir = QDir::toNativeSeparators(dir).toStdWString();
-	WCHAR path[4096];
-	memcpy(path, wDir.c_str(), (wDir.size() + 1) * sizeof(WCHAR));
-	path[wDir.size() + 1] = 0;
-	SHFILEOPSTRUCT file_op = {
-		NULL,
-		FO_DELETE,
-		path,
-		L"",
-		FOF_NOCONFIRMATION |
-		FOF_NOERRORUI |
-		FOF_SILENT,
-		false,
-		0,
-		L""
-	};
-    int res = SHFileOperation(&file_op);*/
+	objc_deleteDir(dir);
 }
 
 void PsUpdateDownloader::fatalFail() {
@@ -1104,15 +984,25 @@ void PsUpdateDownloader::clearAll() {
 	deleteDir(cWorkingDir() + qsl("tupdates"));
 }
 
+#ifdef Q_OS_WIN
+typedef DWORD VerInt;
+typedef WCHAR VerChar;
+#else
+typedef int VerInt;
+typedef wchar_t VerChar;
+#endif
+
 void PsUpdateDownloader::unpackUpdate() {
-    /*QByteArray packed;
+    QByteArray packed;
 	if (!outputFile.open(QIODevice::ReadOnly)) {
 		LOG(("Update Error: cant read updates file!"));
 		return fatalFail();
 	}
-
+#ifdef Q_OS_WIN // use Lzma SDK for win
 	const int32 hSigLen = 128, hShaLen = 20, hPropsLen = LZMA_PROPS_SIZE, hOriginalSizeLen = sizeof(int32), hSize = hSigLen + hShaLen + hPropsLen + hOriginalSizeLen; // header
-
+#else
+	const int32 hSigLen = 128, hShaLen = 20, hPropsLen = 0, hOriginalSizeLen = sizeof(int32), hSize = hSigLen + hShaLen + hOriginalSizeLen; // header
+#endif
 	QByteArray compressed = outputFile.readAll();
 	int32 compressedLen = compressed.size() - hSize;
 	if (compressedLen <= 0) {
@@ -1157,12 +1047,57 @@ void PsUpdateDownloader::unpackUpdate() {
 	uncompressed.resize(uncompressedLen);
 
 	size_t resultLen = uncompressed.size();
+#ifdef Q_OS_WIN // use Lzma SDK for win
 	SizeT srcLen = compressedLen;
 	int uncompressRes = LzmaUncompress((uchar*)uncompressed.data(), &resultLen, (const uchar*)(compressed.constData() + hSize), &srcLen, (const uchar*)(compressed.constData() + hSigLen + hShaLen), LZMA_PROPS_SIZE);
 	if (uncompressRes != SZ_OK) {
 		LOG(("Update Error: could not uncompress lzma, code: %1").arg(uncompressRes));
 		return fatalFail();
 	}
+#else
+	lzma_stream stream = LZMA_STREAM_INIT;
+
+	lzma_ret ret = lzma_stream_decoder(&stream, UINT64_MAX, LZMA_CONCATENATED);
+	if (ret != LZMA_OK) {
+		const char *msg;
+		switch (ret) {
+			case LZMA_MEM_ERROR: msg = "Memory allocation failed"; break;
+			case LZMA_OPTIONS_ERROR: msg = "Specified preset is not supported"; break;
+			case LZMA_UNSUPPORTED_CHECK: msg = "Specified integrity check is not supported"; break;
+			default: msg = "Unknown error, possibly a bug"; break;
+		}
+		LOG(("Error initializing the decoder: %1 (error code %2)").arg(msg).arg(ret));
+		return fatalFail();
+	}
+
+	stream.avail_in = compressedLen;
+	stream.next_in = (uint8_t*)(compressed.constData() + hSize);
+	stream.avail_out = resultLen;
+	stream.next_out = (uint8_t*)uncompressed.data();
+
+	lzma_ret res = lzma_code(&stream, LZMA_FINISH);
+	if (stream.avail_in) {
+		LOG(("Error in decompression, %1 bytes left in _in of %2 whole.").arg(stream.avail_in).arg(compressedLen));
+		return fatalFail();
+	} else if (stream.avail_out) {
+		LOG(("Error in decompression, %1 bytes free left in _out of %2 whole.").arg(stream.avail_out).arg(resultLen));
+		return fatalFail();
+	}
+	lzma_end(&stream);
+	if (res != LZMA_OK && res != LZMA_STREAM_END) {
+		const char *msg;
+		switch (res) {
+			case LZMA_MEM_ERROR: msg = "Memory allocation failed"; break;
+			case LZMA_FORMAT_ERROR: msg = "The input data is not in the .xz format"; break;
+			case LZMA_OPTIONS_ERROR: msg = "Unsupported compression options"; break;
+			case LZMA_DATA_ERROR: msg = "Compressed file is corrupt"; break;
+			case LZMA_BUF_ERROR: msg = "Compressed data is truncated or otherwise corrupt"; break;
+			default: msg = "Unknown error, possibly a bug"; break;
+		}
+		LOG(("Error in decompression: %1 (error code %2)").arg(msg).arg(res));
+		return fatalFail();
+	}
+#endif
 
 	tempDir.mkdir(tempDir.absolutePath());
 
@@ -1193,22 +1128,30 @@ void PsUpdateDownloader::unpackUpdate() {
 			LOG(("Update Error: update is empty!"));
 			return fatalFail();
 		}
-		for (int32 i = 0; i < filesCount; ++i) {
+		for (uint32 i = 0; i < filesCount; ++i) {
 			QString relativeName;
 			quint32 fileSize;
 			QByteArray fileInnerData;
+			bool executable = false;
 
 			stream >> relativeName >> fileSize >> fileInnerData;
+#if defined Q_OS_MAC || defined Q_OS_LINUX
+			stream >> executable;
+#endif
 			if (stream.status() != QDataStream::Ok) {
 				LOG(("Update Error: cant read file from downloaded stream, status: %1").arg(stream.status()));
 				return fatalFail();
 			}
-			if (fileSize != fileInnerData.size()) {
+			if (fileSize != quint32(fileInnerData.size())) {
 				LOG(("Update Error: bad file size %1 not matching data size %2").arg(fileSize).arg(fileInnerData.size()));
 				return fatalFail();
 			}
 
 			QFile f(tempDirPath + '/' + relativeName);
+			if (!QDir().mkpath(QFileInfo(f).absolutePath())) {
+				LOG(("Update Error: cant mkpath for file '%1'").arg(tempDirPath + '/' + relativeName));
+				return fatalFail();
+			}
 			if (!f.open(QIODevice::WriteOnly)) {
 				LOG(("Update Error: cant open file '%1' for writing").arg(tempDirPath + '/' + relativeName));
 				return fatalFail();
@@ -1219,13 +1162,19 @@ void PsUpdateDownloader::unpackUpdate() {
 				return fatalFail();
 			}
 			f.close();
+			if (executable) {
+				QFileDevice::Permissions p = f.permissions();
+				p |= QFileDevice::ExeOwner | QFileDevice::ExeUser | QFileDevice::ExeGroup | QFileDevice::ExeOther;
+				f.setPermissions(p);
+			}
 		}
 
 		// create tdata/version file
 		tempDir.mkdir(QDir(tempDirPath + qsl("/tdata")).absolutePath());
 		std::wstring versionString = ((version % 1000) ? QString("%1.%2.%3").arg(int(version / 1000000)).arg(int((version % 1000000) / 1000)).arg(int(version % 1000)) : QString("%1.%2").arg(int(version / 1000000)).arg(int((version % 1000000) / 1000))).toStdWString();
-		DWORD versionNum = DWORD(version), versionLen = DWORD(versionString.size() * sizeof(WCHAR));
-		WCHAR versionStr[32];
+
+		VerInt versionNum = VerInt(version), versionLen = VerInt(versionString.size() * sizeof(VerChar));
+		VerChar versionStr[32];
 		memcpy(versionStr, versionString.c_str(), versionLen);
 
 		QFile fVersion(tempDirPath + qsl("/tdata/version"));		
@@ -1233,8 +1182,8 @@ void PsUpdateDownloader::unpackUpdate() {
 			LOG(("Update Error: cant write version file '%1'").arg(tempDirPath + qsl("/version")));
 			return fatalFail();
 		}
-		fVersion.write((const char*)&versionNum, sizeof(DWORD));
-		fVersion.write((const char*)&versionLen, sizeof(DWORD));
+		fVersion.write((const char*)&versionNum, sizeof(VerInt));
+		fVersion.write((const char*)&versionLen, sizeof(VerInt));
 		fVersion.write((const char*)&versionStr[0], versionLen);
 		fVersion.close();
 	}
@@ -1246,7 +1195,7 @@ void PsUpdateDownloader::unpackUpdate() {
 	deleteDir(tempDirPath);
 	outputFile.remove();
 
-    emit App::app()->updateReady();*/
+    emit App::app()->updateReady();
 }
 
 PsUpdateDownloader::~PsUpdateDownloader() {
@@ -1254,208 +1203,22 @@ PsUpdateDownloader::~PsUpdateDownloader() {
 	reply = 0;
 }
 
-/*namespace {
-	BOOL CALLBACK _ActivateProcess(HWND hWnd, LPARAM lParam) {
-		uint64 &processId(*(uint64*)lParam);
-
-		DWORD dwProcessId;
-		::GetWindowThreadProcessId(hWnd, &dwProcessId);
-
-		if ((uint64)dwProcessId == processId) { // found top-level window
-			static const int32 nameBufSize = 1024;
-			WCHAR nameBuf[nameBufSize];
-			int32 len = GetWindowText(hWnd, nameBuf, nameBufSize);
-			if (len && len < nameBufSize) {
-				if (QRegularExpression(qsl("^Telegram(\\s*\\(\\d+\\))?$")).match(QString::fromStdWString(nameBuf)).hasMatch()) {
-					BOOL res = ::SetForegroundWindow(hWnd);
-					return FALSE;
-				}
-			}
-		}
-		return TRUE;
-	}
-}*/
-
 void psActivateProcess(uint64 pid) {
-    //::EnumWindows((WNDENUMPROC)_ActivateProcess, (LPARAM)&pid);
+	objc_activateProgram();
 }
 
 QString psCurrentCountry() {
-    /*int chCount = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SISO3166CTRYNAME, 0, 0);
-	if (chCount && chCount < 128) {
-		WCHAR wstrCountry[128];
-		int len = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SISO3166CTRYNAME, wstrCountry, chCount);
-		return len ? QString::fromStdWString(std::wstring(wstrCountry)) : QString::fromLatin1(DefaultCountry);
-	}
-    return QString::fromLatin1(DefaultCountry);*/
-    return QString("");
-    //TODO
+	QString country = objc_currentCountry();
+	return country.isEmpty() ? QString::fromLatin1(DefaultCountry) : country;
 }
 
-/*namespace {
-    QString langById(int lngId) {
-		int primary = lngId & 0xFF;
-		switch (primary) {
-			case 0x36: return qsl("af");
-			case 0x1C: return qsl("sq");
-			case 0x5E: return qsl("am");
-			case 0x01: return qsl("ar");
-			case 0x2B: return qsl("hy");
-			case 0x4D: return qsl("as");
-			case 0x2C: return qsl("az");
-			case 0x45: return qsl("bn");
-			case 0x6D: return qsl("ba");
-			case 0x2D: return qsl("eu");
-			case 0x23: return qsl("be");
-			case 0x1A:
-				if (lngId == LANG_CROATIAN) {
-					return qsl("hr");
-				} else if (lngId == LANG_BOSNIAN_NEUTRAL || lngId == LANG_BOSNIAN) {
-					return qsl("bs");
-				}
-				return qsl("sr");
-			break;
-			case 0x7E: return qsl("br");
-			case 0x02: return qsl("bg");
-			case 0x92: return qsl("ku");
-			case 0x03: return qsl("ca");
-			case 0x04: return qsl("zh");
-			case 0x83: return qsl("co");
-			case 0x05: return qsl("cs");
-			case 0x06: return qsl("da");
-			case 0x65: return qsl("dv");
-			case 0x13: return qsl("nl");
-			case 0x09: return qsl("en");
-			case 0x25: return qsl("et");
-			case 0x38: return qsl("fo");
-			case 0x0B: return qsl("fi");
-			case 0x0c: return qsl("fr");
-			case 0x62: return qsl("fy");
-			case 0x56: return qsl("gl");
-			case 0x37: return qsl("ka");
-			case 0x07: return qsl("de");
-			case 0x08: return qsl("el");
-			case 0x6F: return qsl("kl");
-			case 0x47: return qsl("gu");
-			case 0x68: return qsl("ha");
-			case 0x0D: return qsl("he");
-			case 0x39: return qsl("hi");
-			case 0x0E: return qsl("hu");
-			case 0x0F: return qsl("is");
-			case 0x70: return qsl("ig");
-			case 0x21: return qsl("id");
-			case 0x5D: return qsl("iu");
-			case 0x3C: return qsl("ga");
-			case 0x34: return qsl("xh");
-			case 0x35: return qsl("zu");
-			case 0x10: return qsl("it");
-			case 0x11: return qsl("ja");
-			case 0x4B: return qsl("kn");
-			case 0x3F: return qsl("kk");
-			case 0x53: return qsl("kh");
-			case 0x87: return qsl("rw");
-			case 0x12: return qsl("ko");
-			case 0x40: return qsl("ky");
-			case 0x54: return qsl("lo");
-			case 0x26: return qsl("lv");
-			case 0x27: return qsl("lt");
-			case 0x6E: return qsl("lb");
-			case 0x2F: return qsl("mk");
-			case 0x3E: return qsl("ms");
-			case 0x4C: return qsl("ml");
-			case 0x3A: return qsl("mt");
-			case 0x81: return qsl("mi");
-			case 0x4E: return qsl("mr");
-			case 0x50: return qsl("mn");
-			case 0x61: return qsl("ne");
-			case 0x14: return qsl("no");
-			case 0x82: return qsl("oc");
-			case 0x48: return qsl("or");
-			case 0x63: return qsl("ps");
-			case 0x29: return qsl("fa");
-			case 0x15: return qsl("pl");
-			case 0x16: return qsl("pt");
-			case 0x67: return qsl("ff");
-			case 0x46: return qsl("pa");
-			case 0x18: return qsl("ro");
-			case 0x17: return qsl("rm");
-			case 0x19: return qsl("ru");
-			case 0x3B: return qsl("se");
-			case 0x4F: return qsl("sa");
-			case 0x32: return qsl("tn");
-			case 0x59: return qsl("sd");
-			case 0x5B: return qsl("si");
-			case 0x1B: return qsl("sk");
-			case 0x24: return qsl("sl");
-			case 0x0A: return qsl("es");
-			case 0x41: return qsl("sw");
-			case 0x1D: return qsl("sv");
-			case 0x28: return qsl("tg");
-			case 0x49: return qsl("ta");
-			case 0x44: return qsl("tt");
-			case 0x4A: return qsl("te");
-			case 0x1E: return qsl("th");
-			case 0x51: return qsl("bo");
-			case 0x73: return qsl("ti");
-			case 0x1F: return qsl("tr");
-			case 0x42: return qsl("tk");
-			case 0x22: return qsl("uk");
-			case 0x20: return qsl("ur");
-			case 0x80: return qsl("ug");
-			case 0x43: return qsl("uz");
-			case 0x2A: return qsl("vi");
-			case 0x52: return qsl("cy");
-			case 0x88: return qsl("wo");
-			case 0x78: return qsl("ii");
-			case 0x6A: return qsl("yo");
-		}
-		return QString::fromLatin1(DefaultLanguage);
-	}
-}*/
-
 QString psCurrentLanguage() {
-/*	int chCount = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SNAME, 0, 0);
-	if (chCount && chCount < 128) {
-		WCHAR wstrLocale[128];
-		int len = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SNAME, wstrLocale, chCount);
-		if (!len) return QString::fromLatin1(DefaultLanguage);
-		QString locale = QString::fromStdWString(std::wstring(wstrLocale));
-		QRegularExpressionMatch m = QRegularExpression("(^|[^a-z])([a-z]{2})-").match(locale);
-		if (m.hasMatch()) {
-			return m.captured(2);
-		}
-	}
-	chCount = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ILANGUAGE, 0, 0);
-	if (chCount && chCount < 128) {
-		WCHAR wstrLocale[128];
-		int len = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ILANGUAGE, wstrLocale, chCount), lngId = 0;
-		if (len < 5) return QString::fromLatin1(DefaultLanguage);
-
-		for (int i = 0; i < 4; ++i) {
-			WCHAR ch = wstrLocale[i];
-			lngId *= 16;
-			if (ch >= WCHAR('0') && ch <= WCHAR('9')) {
-				lngId += (ch - WCHAR('0'));
-			} else if (ch >= WCHAR('A') && ch <= WCHAR('F')) {
-				lngId += (10 + ch - WCHAR('A'));
-			} else {
-				return QString::fromLatin1(DefaultLanguage);
-			}
-		}
-		return langById(lngId);
-	}
-    return QString::fromLatin1(DefaultLanguage);*/
-    return QString("en");
+	QString lng = objc_currentLang();
+	return lng.isEmpty() ? QString::fromLatin1(DefaultLanguage) : lng;
 }
 
 QString psAppDataPath() {
-    /*static const int maxFileLen = MAX_PATH * 10;
-	WCHAR wstrPath[maxFileLen];
-	if (GetEnvironmentVariable(L"APPDATA", wstrPath, maxFileLen)) {
-		QDir appData(QString::fromStdWString(std::wstring(wstrPath)));
-		return appData.absolutePath() + "/" + QString::fromWCharArray(AppName) + "/";
-    }*/
-	return QString();
+	return objc_appDataPath();
 }
 
 QString psCurrentExeDirectory(int argc, char *argv[]) {
@@ -1478,81 +1241,20 @@ void psDoCleanup() {
 }
 
 int psCleanup() {
-    /*__try
-	{
-		psDoCleanup();
-	}
-	__except(EXCEPTION_EXECUTE_HANDLER)
-	{
-		return 0;
-    }*/
+	psDoCleanup();
 	return 0;
 }
 
 void psDoFixPrevious() {
-    /*try {
-		static const int bufSize = 4096;
-		DWORD checkType, checkSize = bufSize * 2;
-		WCHAR checkStr[bufSize];
-
-		QString appId = QString::fromStdWString(AppId);
-		QString newKeyStr1 = QString("Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%1_is1").arg(appId);
-		QString newKeyStr2 = QString("Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%1_is1").arg(appId);
-		QString oldKeyStr1 = QString("SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%1_is1").arg(appId);
-		QString oldKeyStr2 = QString("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%1_is1").arg(appId);
-		HKEY newKey1, newKey2, oldKey1, oldKey2;
-		LSTATUS newKeyRes1 = RegOpenKeyEx(HKEY_CURRENT_USER, newKeyStr1.toStdWString().c_str(), 0, KEY_READ, &newKey1);
-		LSTATUS newKeyRes2 = RegOpenKeyEx(HKEY_CURRENT_USER, newKeyStr2.toStdWString().c_str(), 0, KEY_READ, &newKey2);
-		LSTATUS oldKeyRes1 = RegOpenKeyEx(HKEY_LOCAL_MACHINE, oldKeyStr1.toStdWString().c_str(), 0, KEY_READ, &oldKey1);
-		LSTATUS oldKeyRes2 = RegOpenKeyEx(HKEY_LOCAL_MACHINE, oldKeyStr2.toStdWString().c_str(), 0, KEY_READ, &oldKey2);
-		
-		bool existNew1 = (newKeyRes1 == ERROR_SUCCESS) && (RegQueryValueEx(newKey1, L"InstallDate", 0, &checkType, (BYTE*)checkStr, &checkSize) == ERROR_SUCCESS); checkSize = bufSize * 2;
-		bool existNew2 = (newKeyRes2 == ERROR_SUCCESS) && (RegQueryValueEx(newKey2, L"InstallDate", 0, &checkType, (BYTE*)checkStr, &checkSize) == ERROR_SUCCESS); checkSize = bufSize * 2;
-		bool existOld1 = (oldKeyRes1 == ERROR_SUCCESS) && (RegQueryValueEx(oldKey1, L"InstallDate", 0, &checkType, (BYTE*)checkStr, &checkSize) == ERROR_SUCCESS); checkSize = bufSize * 2;
-		bool existOld2 = (oldKeyRes2 == ERROR_SUCCESS) && (RegQueryValueEx(oldKey2, L"InstallDate", 0, &checkType, (BYTE*)checkStr, &checkSize) == ERROR_SUCCESS); checkSize = bufSize * 2;
-
-		if (newKeyRes1 == ERROR_SUCCESS) RegCloseKey(newKey1);
-		if (newKeyRes2 == ERROR_SUCCESS) RegCloseKey(newKey2);
-		if (oldKeyRes1 == ERROR_SUCCESS) RegCloseKey(oldKey1);
-		if (oldKeyRes2 == ERROR_SUCCESS) RegCloseKey(oldKey2);
-
-		if (existNew1 || existNew2) {
-			oldKeyRes1 = existOld1 ? RegDeleteKey(HKEY_LOCAL_MACHINE, oldKeyStr1.toStdWString().c_str()) : ERROR_SUCCESS;
-			oldKeyRes2 = existOld2 ? RegDeleteKey(HKEY_LOCAL_MACHINE, oldKeyStr2.toStdWString().c_str()) : ERROR_SUCCESS;
-		}
-
-		QString userDesktopLnk, commonDesktopLnk;
-		WCHAR userDesktopFolder[MAX_PATH], commonDesktopFolder[MAX_PATH];
-		HRESULT userDesktopRes = SHGetFolderPath(0, CSIDL_DESKTOPDIRECTORY, 0, SHGFP_TYPE_CURRENT, userDesktopFolder);
-		HRESULT commonDesktopRes = SHGetFolderPath(0, CSIDL_COMMON_DESKTOPDIRECTORY, 0, SHGFP_TYPE_CURRENT, commonDesktopFolder);
-		if (SUCCEEDED(userDesktopRes)) {
-			userDesktopLnk = QString::fromWCharArray(userDesktopFolder) + "\\Telegram.lnk";
-		}
-		if (SUCCEEDED(commonDesktopRes)) {
-			commonDesktopLnk = QString::fromWCharArray(commonDesktopFolder) + "\\Telegram.lnk";
-		}
-		QFile userDesktopFile(userDesktopLnk), commonDesktopFile(commonDesktopLnk);
-		if (QFile::exists(userDesktopLnk) && QFile::exists(commonDesktopLnk) && userDesktopLnk != commonDesktopLnk) {
-			bool removed = QFile::remove(commonDesktopLnk);
-		}
-	} catch (...) {
-    }*/
 }
 
 int psFixPrevious() {
-    /*__try
-	{
-		psDoFixPrevious();
-	}
-	__except(EXCEPTION_EXECUTE_HANDLER)
-	{
-		return 0;
-    }*/
+	psDoFixPrevious();
 	return 0;
 }
 
 bool psCheckReadyUpdate() {
-    /*QString readyPath = cWorkingDir() + qsl("tupdates/ready");
+    QString readyPath = cWorkingDir() + qsl("tupdates/ready");
 	if (!QDir(readyPath).exists()) {
 		return false;
 	}
@@ -1566,8 +1268,8 @@ bool psCheckReadyUpdate() {
 			PsUpdateDownloader::clearAll();
 			return false;
 		}
-		DWORD versionNum;
-		if (fVersion.read((char*)&versionNum, sizeof(DWORD)) != sizeof(DWORD)) {
+		VerInt versionNum;
+		if (fVersion.read((char*)&versionNum, sizeof(VerInt)) != sizeof(VerInt)) {
 			LOG(("Update Error: cant read version from file '%1'").arg(versionPath));
 			PsUpdateDownloader::clearAll();
 			return false;
@@ -1580,19 +1282,25 @@ bool psCheckReadyUpdate() {
 		}
 	}
 
+#ifdef Q_OS_WIN
 	QString curUpdater = (cExeDir() + "Updater.exe");
 	QFileInfo updater(cWorkingDir() + "tupdates/ready/Updater.exe");
+#elif defined Q_OS_MAC
+	QString curUpdater = (cExeDir() + "Telegram.app/Contents/Frameworks/Updater");
+	QFileInfo updater(cWorkingDir() + "tupdates/ready/Telegram.app/Contents/Frameworks/Updater");
+#endif
 	if (!updater.exists()) {
 		QFileInfo current(curUpdater);
 		if (!current.exists()) {
 			PsUpdateDownloader::clearAll();
 			return false;
 		}
-		if (CopyFile(current.absoluteFilePath().toStdWString().c_str(), updater.absoluteFilePath().toStdWString().c_str(), TRUE) == FALSE) {
+		if (!QFile(current.absoluteFilePath()).copy(updater.absoluteFilePath())) {
 			PsUpdateDownloader::clearAll();
 			return false;
 		}
 	}
+#ifdef Q_OS_WIN
 	if (CopyFile(updater.absoluteFilePath().toStdWString().c_str(), curUpdater.toStdWString().c_str(), FALSE) == FALSE) {
 		PsUpdateDownloader::clearAll();
 		return false;
@@ -1600,115 +1308,43 @@ bool psCheckReadyUpdate() {
 	if (DeleteFile(updater.absoluteFilePath().toStdWString().c_str()) == FALSE) {
 		PsUpdateDownloader::clearAll();
 		return false;
-    }*/
-    return false; // TODO
+    }
+#elif defined Q_OS_MAC
+	QFileInfo to(curUpdater);
+	QDir().mkpath(to.absolutePath());
+	if (!objc_moveFile(updater.absoluteFilePath(), curUpdater)) {
+		PsUpdateDownloader::clearAll();
+		return false;
+	}
+#endif
+    return true;
 }
 
 void psPostprocessFile(const QString &name) {
-    /*std::wstring zoneFile = QDir::toNativeSeparators(name).toStdWString() + L":Zone.Identifier";
-	HANDLE f = CreateFile(zoneFile.c_str(), GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
-	if (f == INVALID_HANDLE_VALUE) { // :(
-		return;
-	}
-
-	const char data[] = "[ZoneTransfer]\r\nZoneId=3\r\n";
-
-	DWORD written = 0;
-	BOOL result = WriteFile(f, data, sizeof(data), &written, NULL);
-	CloseHandle(f);
-
-	if (!result || written != sizeof(data)) { // :(
-		return;
-    }*/
 }
 
 void psOpenFile(const QString &name, bool openWith) {
-    /*std::wstring wname = QDir::toNativeSeparators(name).toStdWString();
-
-	if (openWith && useOpenAs) {
-		if (shOpenWithDialog) {
-			OPENASINFO info;
-			info.oaifInFlags = OAIF_ALLOW_REGISTRATION | OAIF_REGISTER_EXT | OAIF_EXEC;
-			info.pcszClass = NULL;
-			info.pcszFile = wname.c_str();
-			shOpenWithDialog(0, &info);
-		} else {
-			openAs_RunDLL(0, 0, wname.c_str(), SW_SHOWNORMAL);
-		}
-	} else {
-		ShellExecute(0, L"open", wname.c_str(), 0, 0, SW_SHOWNORMAL);
-    }*/
+    objc_openFile(name, openWith);
 }
 
 void psShowInFolder(const QString &name) {
-    //QString nameEscaped = QDir::toNativeSeparators(name).replace('"', qsl("\"\""));
-    //ShellExecute(0, 0, qsl("explorer").toStdWString().c_str(), (qsl("/select,") + nameEscaped).toStdWString().c_str(), 0, SW_SHOWNORMAL);
+    objc_showInFinder(name, QFileInfo(name).absolutePath());
+}
+
+void psFinish() {
+    objc_finish();
 }
 
 void psExecUpdater() {
-    /*QString targs = qsl("-update");
-	if (cFromAutoStart()) targs += qsl(" -autostart");
-	if (cDebug()) targs += qsl(" -debug");
-
-	QString updater(QDir::toNativeSeparators(cExeDir() + "Updater.exe")), wdir(QDir::toNativeSeparators(cWorkingDir()));
-
-	DEBUG_LOG(("Application Info: executing %1 %2").arg(cExeDir() + "Updater.exe").arg(targs));
-	HINSTANCE r = ShellExecute(0, 0, updater.toStdWString().c_str(), targs.toStdWString().c_str(), wdir.isEmpty() ? 0 : wdir.toStdWString().c_str(), SW_SHOWNORMAL);
-	if (long(r) < 32) {
-		DEBUG_LOG(("Application Error: failed to execute %1, working directory: '%2', result: %3").arg(updater).arg(wdir).arg(long(r)));
+	if (!objc_execUpdater()) {
 		QString readyPath = cWorkingDir() + qsl("tupdates/ready");
 		PsUpdateDownloader::deleteDir(readyPath);
-    }*/
+	}
 }
 
 void psExecTelegram() {
-    /*QString targs = qsl("-noupdate -tosettings");
-	if (cFromAutoStart()) targs += qsl(" -autostart");
-	if (cDebug()) targs += qsl(" -debug");
-	if (cDataFile() != (cTestMode() ? qsl("data_test") : qsl("data"))) targs += qsl(" -key \"") + cDataFile() + '"';
-
-	QString telegram(QDir::toNativeSeparators(cExeDir() + "Telegram.exe")), wdir(QDir::toNativeSeparators(cWorkingDir()));
-
-	DEBUG_LOG(("Application Info: executing %1 %2").arg(cExeDir() + "Telegram.exe").arg(targs));
-	HINSTANCE r = ShellExecute(0, 0, telegram.toStdWString().c_str(), targs.toStdWString().c_str(), wdir.isEmpty() ? 0 : wdir.toStdWString().c_str(), SW_SHOWNORMAL);
-	if (long(r) < 32) {
-		DEBUG_LOG(("Application Error: failed to execute %1, working directory: '%2', result: %3").arg(telegram).arg(wdir).arg(long(r)));
-    }*/
+	objc_execTelegram();
 }
 
 void psAutoStart(bool start, bool silent) {
-    /*WCHAR startupFolder[MAX_PATH];
-	HRESULT hres = SHGetFolderPath(0, CSIDL_STARTUP, 0, SHGFP_TYPE_CURRENT, startupFolder);
-	if (SUCCEEDED(hres)) {
-		QString lnk = QString::fromWCharArray(startupFolder) + "\\Telegram.lnk"; 
-		if (start) {
-			IShellLink* psl; 
-			hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (LPVOID*)&psl); 
-			if (SUCCEEDED(hres)) { 
-				IPersistFile* ppf; 
- 
-				QString exe = QDir::toNativeSeparators(QDir(cExeDir()).absolutePath() + "//Telegram.exe"), dir = QDir::toNativeSeparators(QDir(cWorkingDir()).absolutePath());
-				psl->SetArguments(L"-autostart");
-				psl->SetPath(exe.toStdWString().c_str());
-				psl->SetWorkingDirectory(dir.toStdWString().c_str());
-				psl->SetDescription(L"Telegram autorun link.\nYou can disable autorun in Telegram settings."); 
- 
-				hres = psl->QueryInterface(IID_IPersistFile, (LPVOID*)&ppf); 
- 
-				if (SUCCEEDED(hres)) { 
-					hres = ppf->Save(lnk.toStdWString().c_str(), TRUE); 
-					ppf->Release(); 
-				}  else {
-					if (!silent) LOG(("App Error: could not create interface IID_IPersistFile %1").arg(hres));
-				}
-				psl->Release(); 
-			} else {
-				if (!silent) LOG(("App Error: could not create instance of IID_IShellLink %1").arg(hres));
-			}
-		} else {
-			QFile::remove(lnk);
-		}
-	} else {
-		if (!silent) LOG(("App Error: could not get CSIDL_STARTUP folder %1").arg(hres));
-    }*/
 }
diff --git a/Telegram/SourceFiles/pspecific_mac.h b/Telegram/SourceFiles/pspecific_mac.h
index 5d3ff10b1..ff26e4909 100644
--- a/Telegram/SourceFiles/pspecific_mac.h
+++ b/Telegram/SourceFiles/pspecific_mac.h
@@ -151,10 +151,12 @@ public slots:
 
 protected:
 
+	void psNotIdle() const;
+
 	bool posInited;
     QSystemTrayIcon *trayIcon;
     QMenu *trayIconMenu;
-    QImage icon16, icon32, icon256;
+    QImage icon256;
     virtual void setupTrayIcon() {
     }
     
@@ -265,3 +267,4 @@ void psExecTelegram();
 void psPostprocessFile(const QString &name);
 void psOpenFile(const QString &name, bool openWith = false);
 void psShowInFolder(const QString &name);
+void psFinish();
diff --git a/Telegram/SourceFiles/pspecific_mac_p.h b/Telegram/SourceFiles/pspecific_mac_p.h
index 0e822470f..b11bfc561 100644
--- a/Telegram/SourceFiles/pspecific_mac_p.h
+++ b/Telegram/SourceFiles/pspecific_mac_p.h
@@ -24,14 +24,16 @@ public:
 
 	PsMacWindowPrivate();
 
-    void setWindowBadge(const char *utf8str);
+    void setWindowBadge(const QString &str);
     void startBounce();
     
     void holdOnTop(WId winId);
     void showOverAll(WId winId);
     void activateWnd(WId winId);
-    void showNotify(unsigned long long peer, const char *utf8title, const char *subtitle, const char *utf8msg);
-    void clearNotifies(unsigned long long peer = 0);
+    void showNotify(uint64 peer, const QString &title, const QString &subtitle, const QString &msg);
+    void clearNotifies(uint64 peer = 0);
+    
+    void enableShadow(WId winId);
         
     virtual void activeSpaceChanged() {
     }
@@ -46,6 +48,20 @@ public:
     
 };
 
-void _debugShowAlert(const char *utf8str);
-void _outputDebugString(const char *utf8str);
-int64 _idleTime();
+void objc_debugShowAlert(const QString &str);
+void objc_outputDebugString(const QString &str);
+int64 objc_idleTime();
+
+void objc_showInFinder(const QString &file, const QString &path);
+void objc_openFile(const QString &file, bool openwith);
+void objc_finish();
+bool objc_execUpdater();
+void objc_execTelegram();
+
+void objc_activateProgram();
+bool objc_moveFile(const QString &from, const QString &to);
+void objc_deleteDir(const QString &dir);
+
+QString objc_appDataPath();
+QString objc_currentCountry();
+QString objc_currentLang();
diff --git a/Telegram/SourceFiles/pspecific_mac_p.mm b/Telegram/SourceFiles/pspecific_mac_p.mm
index c5828bb15..3f3fbf7f2 100644
--- a/Telegram/SourceFiles/pspecific_mac_p.mm
+++ b/Telegram/SourceFiles/pspecific_mac_p.mm
@@ -18,9 +18,33 @@ Copyright (c) 2014 John Preston, https://tdesktop.com
 #include "stdafx.h"
 #include "pspecific_mac_p.h"
 
-#include <AppKit/AppKit.h>
+#include "lang.h"
+
 #include <Cocoa/Cocoa.h>
 #include <IOKit/IOKitLib.h>
+#include <CoreFoundation/CFURL.h>
+
+class QNSString {
+public:
+    QNSString(const QString &str) : _str([NSString stringWithUTF8String:str.toUtf8().constData()]) {
+    }
+    NSString *s() {
+        return _str;
+    }
+private:
+    NSString *_str;
+};
+
+typedef QMap<LangKey, QNSString> ObjcLang;
+ObjcLang objcLang;
+
+QNSString objc_lang(LangKey key) {
+    ObjcLang::const_iterator i = objcLang.constFind(key);
+    if (i == objcLang.cend()) {
+        i = objcLang.insert(key, lang(key));
+    }
+    return i.value();
+}
 
 @interface ObserverHelper : NSObject {
 }
@@ -57,7 +81,9 @@ public:
     }
     
     void onNotifyReply(NSUserNotification *notification) {
-//        notification.response
+        NSNumber *peerObj = [[notification userInfo] objectForKey:@"peer"];
+        unsigned long long peerLong = [peerObj unsignedLongLongValue];
+        wnd->notifyReplied(peerLong, [[[notification response] string] UTF8String]);
     }
     
     ~PsMacWindowData() {
@@ -99,6 +125,11 @@ public:
 }
 
 - (void) userNotificationCenter:(NSUserNotificationCenter *)center didActivateNotification:(NSUserNotification *)notification {
+    NSNumber *instObj = [[notification userInfo] objectForKey:@"inst"];
+    unsigned long long instLong = [instObj unsignedLongLongValue];
+    if (instLong != cInstance()) { // other app instance notification
+        return;
+    }
     if (notification.activationType == NSUserNotificationActivationTypeReplied){
         wnd->data->onNotifyReply(notification);
     } else if (notification.activationType == NSUserNotificationActivationTypeContentsClicked) {
@@ -119,10 +150,8 @@ PsMacWindowPrivate::PsMacWindowPrivate() : data(new PsMacWindowData(this)) {
     [center setDelegate:data->notifyHandler];
 }
 
-void PsMacWindowPrivate::setWindowBadge(const char *utf8str) {
-    NSString *badgeString = [[NSString alloc] initWithUTF8String:utf8str];
-    [[NSApp dockTile] setBadgeLabel:badgeString];
-    [badgeString release];
+void PsMacWindowPrivate::setWindowBadge(const QString &str) {
+    [[NSApp dockTile] setBadgeLabel:QNSString(str).s()];
 }
 
 void PsMacWindowPrivate::startBounce() {
@@ -146,26 +175,16 @@ void PsMacWindowPrivate::activateWnd(WId winId) {
     [wnd orderFront:wnd];
 }
 
-void PsMacWindowPrivate::showNotify(unsigned long long peer, const char *utf8title, const char *utf8subtitle, const char *utf8msg) {
+void PsMacWindowPrivate::showNotify(uint64 peer, const QString &title, const QString &subtitle, const QString &msg) {
     NSUserNotification *notification = [[NSUserNotification alloc] init];
     
-    NSDictionary *uinfo = [[NSDictionary alloc] initWithObjectsAndKeys:[NSNumber numberWithUnsignedLongLong:peer],@"peer",nil];
-    [notification setUserInfo:uinfo];
-    [uinfo release];
+    [notification setUserInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedLongLong:peer],@"peer",[NSNumber numberWithUnsignedLongLong:cInstance()],@"inst",nil]];
 
-    NSString *title = [[NSString alloc] initWithUTF8String:utf8title];
-    [notification setTitle:title];
-    [title release];
-    
-    NSString *subtitle = [[NSString alloc] initWithUTF8String:utf8subtitle];
-    [notification setSubtitle:subtitle];
-    [subtitle release];
+	[notification setTitle:QNSString(title).s()];
+    [notification setSubtitle:QNSString(subtitle).s()];
+    [notification setInformativeText:QNSString(msg).s()];
 
-    NSString *msg = [[NSString alloc] initWithUTF8String:utf8msg];
-    [notification setInformativeText:msg];
-    [msg release];
-    
-//    [notification setHasReplyButton:YES];
+    [notification setHasReplyButton:YES];
 
     [notification setSoundName:nil];
     
@@ -175,6 +194,11 @@ void PsMacWindowPrivate::showNotify(unsigned long long peer, const char *utf8tit
     [notification release];
 }
 
+void PsMacWindowPrivate::enableShadow(WId winId) {
+//    [[(NSView*)winId window] setStyleMask:NSBorderlessWindowMask];
+//    [[(NSView*)winId window] setHasShadow:YES];
+}
+
 void PsMacWindowPrivate::clearNotifies(unsigned long long peer) {
     NSUserNotificationCenter *center = [NSUserNotificationCenter defaultUserNotificationCenter];
     if (peer) {
@@ -189,25 +213,19 @@ void PsMacWindowPrivate::clearNotifies(unsigned long long peer) {
     }
 }
 
-void _debugShowAlert(const char *utf8str) {
-    NSString *text = [[NSString alloc] initWithUTF8String: utf8str];
-    NSAlert *alert = [NSAlert alertWithMessageText:@"Debug Message" defaultButton:@"OK" alternateButton:nil otherButton:nil informativeTextWithFormat:@"%@", text];
-    [alert runModal];
-    [alert release];
-    [text release];
+void objc_debugShowAlert(const QString &str) {
+    [[NSAlert alertWithMessageText:@"Debug Message" defaultButton:@"OK" alternateButton:nil otherButton:nil informativeTextWithFormat:@"%@", QNSString(str).s()] runModal];
 }
 
-void _outputDebugString(const char *utf8str) {
-    NSString *text = [[NSString alloc] initWithUTF8String:utf8str];
-    NSLog(@"%@", text);
-    [text release];
+void objc_outputDebugString(const QString &str) {
+    NSLog(@"%@", QNSString(str).s());
 }
 
 PsMacWindowPrivate::~PsMacWindowPrivate() {
     delete data;
 }
 
-int64 _idleTime() { // taken from https://github.com/trueinteractions/tint/issues/53
+int64 objc_idleTime() { // taken from https://github.com/trueinteractions/tint/issues/53
     CFMutableDictionaryRef properties = 0;
     CFTypeRef obj;
     mach_port_t masterPort;
@@ -256,3 +274,391 @@ int64 _idleTime() { // taken from https://github.com/trueinteractions/tint/issue
     IOObjectRelease(iter);
     return (result == err) ? -1 : int64(result);
 }
+
+void objc_showInFinder(const QString &file, const QString &path) {
+    [[NSWorkspace sharedWorkspace] selectFile:QNSString(file).s() inFileViewerRootedAtPath:QNSString(path).s()];
+}
+
+@interface NSURL(CompareUrls)
+
+- (BOOL) isEquivalent:(NSURL *)aURL;
+
+@end
+
+@implementation NSURL(CompareUrls)
+
+- (BOOL) isEquivalent:(NSURL *)aURL {
+    if ([self isEqual:aURL]) return YES;
+    if ([[self scheme] caseInsensitiveCompare:[aURL scheme]] != NSOrderedSame) return NO;
+    if ([[self host] caseInsensitiveCompare:[aURL host]] != NSOrderedSame) return NO;
+    if ([[self path] compare:[aURL path]] != NSOrderedSame) return NO;
+    if ([[self port] compare:[aURL port]] != NSOrderedSame) return NO;
+    if ([[self query] compare:[aURL query]] != NSOrderedSame) return NO;
+    return YES;
+}
+
+@end
+
+@interface ChooseApplicationDelegate : NSObject<NSOpenSavePanelDelegate> {
+}
+
+- (id) init:(NSArray *)recommendedApps withPanel:(NSOpenPanel *)creator withSelector:(NSPopUpButton *)menu withGood:(NSTextField *)goodLabel withBad:(NSTextField *)badLabel withIcon:(NSImageView *)badIcon withAccessory:(NSView *)acc;
+- (BOOL) panel:(id)sender shouldEnableURL:(NSURL *)url;
+- (void) panelSelectionDidChange:(id)sender;
+- (void) menuDidClose;
+- (void) dealloc;
+
+@end
+
+@implementation ChooseApplicationDelegate {
+    BOOL onlyRecommended;
+    NSArray *apps;
+    NSOpenPanel *panel;
+    NSPopUpButton *selector;
+    NSTextField *good, *bad;
+    NSImageView *icon;
+    NSString *recom;
+    NSView *accessory;
+}
+
+- (id) init:(NSArray *)recommendedApps withPanel:(NSOpenPanel *)creator withSelector:(NSPopUpButton *)menu withGood:(NSTextField *)goodLabel withBad:(NSTextField *)badLabel withIcon:(NSImageView *)badIcon withAccessory:(NSView *)acc {
+    if (self = [super init]) {
+        onlyRecommended = YES;
+        recom = [objc_lang(lng_mac_recommended_apps).s() copy];
+        apps = recommendedApps;
+        panel = creator;
+        selector = menu;
+        good = goodLabel;
+        bad = badLabel;
+        icon = badIcon;
+        accessory = acc;
+        [selector setAction:@selector(menuDidClose)];
+    }
+    return self;
+}
+
+- (BOOL) isRecommended:(NSURL *)url {
+    if (apps) {
+        for (id app in apps) {
+            if ([(NSURL*)app isEquivalent:url]) {
+                return YES;
+            }
+        }
+    }
+    return NO;
+}
+
+- (BOOL) panel:(id)sender shouldEnableURL:(NSURL *)url {
+    NSNumber *isDirectory;
+    if ([url getResourceValue:&isDirectory forKey:NSURLIsDirectoryKey error:nil] && isDirectory != nil && [isDirectory boolValue]) {
+        if (onlyRecommended) {
+            CFStringRef ext = CFURLCopyPathExtension((CFURLRef)url);
+            NSNumber *isPackage;
+            if ([url getResourceValue:&isPackage forKey:NSURLIsPackageKey error:nil] && isPackage != nil && [isPackage boolValue]) {
+                return [self isRecommended:url];
+            }
+        }
+        return YES;
+    }
+    return NO;
+}
+
+- (void) panelSelectionDidChange:(id)sender {
+    NSArray *urls = [panel URLs];
+    if ([urls count]) {
+        if ([self isRecommended:[urls firstObject]]) {
+            [bad removeFromSuperview];
+            [icon removeFromSuperview];
+            [accessory addSubview:good];
+        } else {
+            [good removeFromSuperview];
+            [accessory addSubview:bad];
+            [accessory addSubview:icon];
+        }
+    } else {
+        [good removeFromSuperview];
+        [bad removeFromSuperview];
+        [icon removeFromSuperview];
+    }
+}
+
+- (void) menuDidClose {
+    onlyRecommended = [[[selector selectedItem] title] isEqualToString:recom];
+    [self refreshPanelTable];
+}
+
+- (BOOL) refreshDataInViews: (NSArray*)subviews {
+    for (id view in subviews) {
+        NSString *cls = [view className];
+        if ([cls isEqualToString:@"FI_TBrowserTableView"]) {
+            [view reloadData];
+        } else if ([cls isEqualToString:@"FI_TListView"] || [cls isEqualToString:@"FI_TIconView"]) {
+            [view reloadData];
+            return YES;
+        } else {
+            NSArray *next = [view subviews];
+            if ([next count] && [self refreshDataInViews:next]) {
+                return YES;
+            }
+        }
+    }
+    
+    return NO;
+}
+
+
+- (void) refreshPanelTable {
+    [self refreshDataInViews:[[panel contentView] subviews]];
+    [panel validateVisibleColumns];
+}
+
+- (void) dealloc {
+    if (apps) {
+        [apps release];
+        [recom release];
+    }
+    [super dealloc];
+}
+
+@end
+
+void objc_openFile(const QString &f, bool openwith) {
+    NSString *file = QNSString(f).s();
+    if (openwith || [[NSWorkspace sharedWorkspace] openFile:file] == NO) {
+        @try {
+            NSURL *url = [NSURL fileURLWithPath:file];
+            NSString *ext = [url pathExtension];
+            NSArray *names =[url pathComponents];
+            NSString *name = [names count] ? [names lastObject] : @"";
+            NSArray *apps = (NSArray*)LSCopyApplicationURLsForURL(CFURLRef(url), kLSRolesAll);
+            
+            NSOpenPanel *openPanel = [NSOpenPanel openPanel];
+            
+            NSView *accessory = [[NSView alloc] init];
+            
+            [openPanel setAccessoryView:accessory];
+            NSRect fullRect = [[accessory superview] frame];
+            fullRect.origin = NSMakePoint(0, 0);
+            fullRect.size.height = st::macAccessoryHeight;
+            [accessory setFrame:fullRect];
+            [accessory setAutoresizesSubviews:YES];
+            
+            NSPopUpButton *selector = [[NSPopUpButton alloc] init];
+            [accessory addSubview:selector];
+            [selector addItemWithTitle:objc_lang(lng_mac_recommended_apps).s()];
+            [selector addItemWithTitle:objc_lang(lng_mac_all_apps).s()];
+            [selector sizeToFit];
+            
+            NSTextField *enableLabel = [[NSTextField alloc] init];
+            [accessory addSubview:enableLabel];
+            [enableLabel setStringValue:objc_lang(lng_mac_enable_filter).s()];
+            [enableLabel setFont:[selector font]];
+            [enableLabel setBezeled:NO];
+            [enableLabel setDrawsBackground:NO];
+            [enableLabel setEditable:NO];
+            [enableLabel setSelectable:NO];
+            [enableLabel sizeToFit];
+
+            NSRect selectorFrame = [selector frame], enableFrame = [enableLabel frame];
+            enableFrame.size.width += st::macEnableFilterAdd;
+            enableFrame.origin.x = (fullRect.size.width - selectorFrame.size.width - enableFrame.size.width) / 2.;
+            selectorFrame.origin.x = (fullRect.size.width - selectorFrame.size.width + enableFrame.size.width) / 2.;
+            enableFrame.origin.y = fullRect.size.height - selectorFrame.size.height - st::macEnableFilterTop + (selectorFrame.size.height - enableFrame.size.height) / 2.;
+            selectorFrame.origin.y = fullRect.size.height - selectorFrame.size.height - st::macSelectorTop;
+            [enableLabel setFrame:enableFrame];
+            [enableLabel setAutoresizingMask:NSViewMinXMargin|NSViewMaxXMargin];
+            [selector setFrame:selectorFrame];
+            [selector setAutoresizingMask:NSViewMinXMargin|NSViewMaxXMargin];
+
+            NSButton *button = [[NSButton alloc] init];
+            [accessory addSubview:button];
+            [button setButtonType:NSSwitchButton];
+            [button setFont:[selector font]];
+            [button setTitle:objc_lang(lng_mac_always_open_with).s()];
+            [button sizeToFit];
+            NSRect alwaysRect = [button frame];
+            alwaysRect.origin.x = (fullRect.size.width - alwaysRect.size.width) / 2;
+            alwaysRect.origin.y = selectorFrame.origin.y - alwaysRect.size.height - st::macAlwaysThisAppTop;
+            [button setFrame:alwaysRect];
+            [button setAutoresizingMask:NSViewMinXMargin|NSViewMaxXMargin];
+            
+            NSTextField *goodLabel = [[NSTextField alloc] init];
+            [goodLabel setStringValue:[objc_lang(lng_mac_this_app_can_open).s() stringByReplacingOccurrencesOfString:@"{file}" withString:name]];
+            [goodLabel setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+            [goodLabel setBezeled:NO];
+            [goodLabel setDrawsBackground:NO];
+            [goodLabel setEditable:NO];
+            [goodLabel setSelectable:NO];
+            [goodLabel sizeToFit];
+            NSRect goodFrame = [goodLabel frame];
+            goodFrame.origin.x = (fullRect.size.width - goodFrame.size.width) / 2.;
+            goodFrame.origin.y = alwaysRect.origin.y - goodFrame.size.height - st::macAppHintTop;
+            [goodLabel setFrame:goodFrame];
+            
+            NSTextField *badLabel = [[NSTextField alloc] init];
+            [badLabel setStringValue:[objc_lang(lng_mac_not_known_app).s() stringByReplacingOccurrencesOfString:@"{file}" withString:name]];
+            [badLabel setFont:[goodLabel font]];
+            [badLabel setBezeled:NO];
+            [badLabel setDrawsBackground:NO];
+            [badLabel setEditable:NO];
+            [badLabel setSelectable:NO];
+            [badLabel sizeToFit];
+            NSImageView *badIcon = [[NSImageView alloc] init];
+            NSImage *badImage = [NSImage imageNamed:NSImageNameCaution];
+            [badIcon setImage:badImage];
+            [badIcon setFrame:NSMakeRect(0, 0, st::macCautionIconSize.width(), st::macCautionIconSize.height())];
+            
+            NSRect badFrame = [badLabel frame], badIconFrame = [badIcon frame];
+            badFrame.origin.x = (fullRect.size.width - badFrame.size.width + badIconFrame.size.width) / 2.;
+            badIconFrame.origin.x = (fullRect.size.width - badFrame.size.width - badIconFrame.size.width) / 2.;
+            badFrame.origin.y = alwaysRect.origin.y - badFrame.size.height - st::macAppHintTop;
+            badIconFrame.origin.y = badFrame.origin.y;
+            [badLabel setFrame:badFrame];
+            [badIcon setFrame:badIconFrame];
+            
+            ChooseApplicationDelegate *delegate = [[ChooseApplicationDelegate alloc] init:apps withPanel:openPanel withSelector:selector withGood:goodLabel withBad:badLabel withIcon:badIcon withAccessory:accessory];
+            [openPanel setDelegate:delegate];
+            
+            [openPanel setCanChooseDirectories:NO];
+            [openPanel setCanChooseFiles:YES];
+            [openPanel setAllowsMultipleSelection:NO];
+            [openPanel setResolvesAliases:YES];
+            [openPanel setTitle:objc_lang(lng_mac_choose_app).s()];
+            [openPanel setMessage:[[objc_lang(lng_mac_choose_text).s() stringByReplacingOccurrencesOfString:@"{file}" withString:name] stringByAppendingFormat:@"%d", [[NSProcessInfo processInfo] processIdentifier]]];
+            
+            NSArray *appsPaths = [[NSFileManager defaultManager] URLsForDirectory:NSApplicationDirectory inDomains:NSLocalDomainMask];
+            if ([appsPaths count]) [openPanel setDirectoryURL:[appsPaths firstObject]];
+            [openPanel beginWithCompletionHandler:^(NSInteger result){
+                if (result == NSFileHandlingPanelOKButton) {
+                    if ([[openPanel URLs] count] > 0) {
+                        NSURL *app = [[openPanel URLs] objectAtIndex:0];
+                        NSString *path = [app path];
+                        if ([button state] == NSOnState) {
+                            NSArray *UTIs = (NSArray *)UTTypeCreateAllIdentifiersForTag(kUTTagClassFilenameExtension,
+                                                                                        (CFStringRef)ext,
+                                                                                        nil);
+                            for (NSString *UTI in UTIs) {
+                                LSSetDefaultRoleHandlerForContentType((CFStringRef)UTI,
+                                                                      kLSRolesEditor,
+                                                                      (CFStringRef)[[NSBundle bundleWithPath:path] bundleIdentifier]);
+                            }
+                            
+                            [UTIs release];
+                        }
+                        [[NSWorkspace sharedWorkspace] openFile:file withApplication:[app path]];
+                    }
+                }
+                [selector release];
+                [button release];
+                [enableLabel release];
+                [goodLabel release];
+                [badLabel release];
+                [badIcon release];
+                [accessory release];
+                [delegate release];
+            }];
+        }
+        @catch (NSException *exception) {
+            [[NSWorkspace sharedWorkspace] openFile:file];
+        }
+        @finally {
+        }
+    }
+    [file release];
+}
+
+void objc_finish() {
+    if (!objcLang.isEmpty()) {
+        objcLang.clear();
+    }
+}
+
+BOOL _execUpdater(BOOL update = YES) {
+	NSString *path = @"", *args = @"";
+	@try {
+		path = [[NSBundle mainBundle] bundlePath];
+		if (!path) {
+			LOG(("Could not get bundle path!!"));
+			return NO;
+		}
+		path = [path stringByAppendingString:@"/Contents/Frameworks/Updater"];
+
+		NSMutableArray *args = [[NSMutableArray alloc] initWithObjects:@"-workpath", QNSString(cWorkingDir()).s(), @"-tosettings", @"-procid", nil];
+		[args addObject:[NSString stringWithFormat:@"%d", [[NSProcessInfo processInfo] processIdentifier]]];
+		if (!update) [args addObject:@"-noupdate"];
+		if (cFromAutoStart()) [args addObject:@"-autostart"];
+		if (cDebug()) [args addObject:@"-debug"];
+		if (cDataFile() != (cTestMode() ? qsl("data_test") : qsl("data"))) {
+			[args addObject:@"-key"];
+			[args addObject:QNSString(cDataFile()).s()];
+		}
+
+		DEBUG_LOG(("Application Info: executing %1 %2").arg(QString::fromUtf8([path cStringUsingEncoding:NSUTF8StringEncoding])).arg(QString::fromUtf8([[args componentsJoinedByString:@" "] cStringUsingEncoding:NSUTF8StringEncoding])));
+		if (![NSTask launchedTaskWithLaunchPath:path arguments:args]) {
+			LOG(("Task not launched while executing %1 %2").arg(QString::fromUtf8([path cStringUsingEncoding:NSUTF8StringEncoding])).arg(QString::fromUtf8([[args componentsJoinedByString:@" "] cStringUsingEncoding:NSUTF8StringEncoding])));
+			return NO;
+		}
+	}
+	@catch (NSException *exception) {
+		LOG(("Exception caught while executing %1 %2").arg(QString::fromUtf8([path cStringUsingEncoding:NSUTF8StringEncoding])).arg(QString::fromUtf8([args cStringUsingEncoding:NSUTF8StringEncoding])));
+		return NO;
+	}
+	@finally {
+	}
+	return YES;
+}
+
+bool objc_execUpdater() {
+	return !!_execUpdater();
+}
+
+void objc_execTelegram() {
+	_execUpdater(NO);
+}
+
+void objc_activateProgram() {
+	[NSApp activateIgnoringOtherApps:YES];
+}
+
+bool objc_moveFile(const QString &from, const QString &to) {
+	NSString *f = QNSString(from).s(), *t = QNSString(to).s();
+	if ([[NSFileManager defaultManager] fileExistsAtPath:t]) {
+		NSData *data = [NSData dataWithContentsOfFile:f];
+		if (data) {
+			if ([data writeToFile:t atomically:YES]) {
+				if ([[NSFileManager defaultManager] removeItemAtPath:f error:nil]) {
+					return true;
+				}
+			}
+		}
+	} else {
+		if ([[NSFileManager defaultManager] moveItemAtPath:f toPath:t error:nil]) {
+			return true;
+		}
+	}
+	return false;
+}
+
+void objc_deleteDir(const QString &dir) {
+	[[NSFileManager defaultManager] removeItemAtPath:QNSString(dir).s() error:nil];
+}
+
+QString objc_appDataPath() {
+	NSURL *url = [[NSFileManager defaultManager] URLForDirectory:NSApplicationSupportDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:YES error:nil];
+	if (url) {
+		return QString::fromUtf8([[url path] fileSystemRepresentation]) + '/' + QString::fromWCharArray(AppName) + '/';
+	}
+	return QString();
+}
+
+QString objc_currentCountry() {
+	NSLocale *currentLocale = [NSLocale currentLocale];  // get the current locale.
+	NSString *countryCode = [currentLocale objectForKey:NSLocaleCountryCode];
+	return countryCode ? QString::fromUtf8([countryCode cStringUsingEncoding:NSUTF8StringEncoding]) : QString();
+}
+
+QString objc_currentLang() {
+	NSLocale *currentLocale = [NSLocale currentLocale];  // get the current locale.
+	NSString *currentLang = [currentLocale objectForKey:NSLocaleLanguageCode];
+	return currentLang ? QString::fromUtf8([currentLang cStringUsingEncoding:NSUTF8StringEncoding]) : QString();
+}
diff --git a/Telegram/SourceFiles/pspecific_wnd.cpp b/Telegram/SourceFiles/pspecific_wnd.cpp
index 4bf579be4..45fa01185 100644
--- a/Telegram/SourceFiles/pspecific_wnd.cpp
+++ b/Telegram/SourceFiles/pspecific_wnd.cpp
@@ -872,6 +872,15 @@ PsMainWindow::PsMainWindow(QWidget *parent) : QMainWindow(parent), ps_hWnd(0), p
 	notifyWaitTimer.setSingleShot(true);
 }
 
+void PsMainWindow::psNotIdle() const {
+	psIdleTimer.stop();
+	if (psIdle) {
+		psIdle = false;
+		if (App::main()) App::main()->setOnline();
+		if (App::wnd()) App::wnd()->checkHistoryActivation();
+	}
+}
+
 void PsMainWindow::psIdleTimeout() {
 	LASTINPUTINFO lii;
 	lii.cbSize = sizeof(LASTINPUTINFO);
@@ -879,15 +888,16 @@ void PsMainWindow::psIdleTimeout() {
 	if (res) {
 		uint64 ticks = GetTickCount();
 		if (lii.dwTime >= ticks - IdleMsecs) {
-			psIdle = false;
-			psIdleTimer.stop();
-			if (App::main()) App::main()->setOnline();
+			psNotIdle();
 		}
+	} else { // error {
+		psNotIdle();
 	}
 }
 
-bool PsMainWindow::psIsActive() const {
-	return isActiveWindow() && isVisible() && !(windowState() & Qt::WindowMinimized);
+bool PsMainWindow::psIsActive(int state) const {
+	if (state < 0) state = this->windowState();
+	return isActiveWindow() && isVisible() && !(state & Qt::WindowMinimized) && !psIdle;
 }
 
 bool PsMainWindow::psIsOnline(int windowState) const {
@@ -909,9 +919,10 @@ bool PsMainWindow::psIsOnline(int windowState) const {
 			}
 			return false;
 		} else {
-			psIdle = false;
-			psIdleTimer.stop();
+			psNotIdle();
 		}
+	} else { // error
+		psNotIdle();
 	}
 	return true;
 }
@@ -2639,6 +2650,9 @@ void psShowInFolder(const QString &name) {
 	ShellExecute(0, 0, qsl("explorer").toStdWString().c_str(), (qsl("/select,") + nameEscaped).toStdWString().c_str(), 0, SW_SHOWNORMAL);
 }
 
+void psFinish() {
+}
+
 void psExecUpdater() {
 	QString targs = qsl("-update");
 	if (cFromAutoStart()) targs += qsl(" -autostart");
diff --git a/Telegram/SourceFiles/pspecific_wnd.h b/Telegram/SourceFiles/pspecific_wnd.h
index 6189c380d..cb188d63c 100644
--- a/Telegram/SourceFiles/pspecific_wnd.h
+++ b/Telegram/SourceFiles/pspecific_wnd.h
@@ -102,7 +102,7 @@ public:
 	void psFlash();
 	void psNotifySettingGot();
 
-	bool psIsActive() const;
+	bool psIsActive(int state = -1) const;
 	bool psIsOnline(int windowState) const;
 
 	void psUpdateWorkmode();
@@ -136,6 +136,8 @@ public slots:
 
 protected:
 
+	void psNotIdle() const;
+
 	bool posInited;
 	QSystemTrayIcon *trayIcon;
     QMenu *trayIconMenu;
@@ -259,3 +261,4 @@ void psExecTelegram();
 void psPostprocessFile(const QString &name);
 void psOpenFile(const QString &name, bool openWith = false);
 void psShowInFolder(const QString &name);
+void psFinish();
diff --git a/Telegram/SourceFiles/settings.cpp b/Telegram/SourceFiles/settings.cpp
index c9e24dcb1..7fd4066fc 100644
--- a/Telegram/SourceFiles/settings.cpp
+++ b/Telegram/SourceFiles/settings.cpp
@@ -67,19 +67,26 @@ QString gLangFile;
 
 bool gRetina = false;
 float64 gRetinaFactor = 1.;
+int32 gIntRetinaFactor = 1;
 bool gCustomNotifies = false;
 
+uint64 gInstance = 0.;
+
 #ifdef Q_OS_WIN
 DBIPlatform gPlatform = dbipWindows;
+QUrl gUpdateURL = QUrl(qsl("http://tdesktop.com/win/tupdates/current"));
 #elif defined Q_OS_MAC
 DBIPlatform gPlatform = dbipMac;
+QUrl gUpdateURL = QUrl(qsl("http://tdesktop.com/mac/tupdates/current"));
 #elif defined Q_OS_LINUX
 DBIPlatform gPlatform = dbipLinux;
+QUrl gUpdateURL = QUrl(qsl("http://tdesktop.com/linux/tupdates/current"));
 #else
 #error Unknown platform
 #endif
 
 void settingsParseArgs(int argc, char *argv[]) {
+    memset_rand(&gInstance, sizeof(gInstance));
 	gExeDir = psCurrentExeDirectory(argc, argv);
 	for (int32 i = 0; i < argc; ++i) {
 		if (string("-release") == argv[i]) {
diff --git a/Telegram/SourceFiles/settings.h b/Telegram/SourceFiles/settings.h
index d69ae3df2..48572950f 100644
--- a/Telegram/SourceFiles/settings.h
+++ b/Telegram/SourceFiles/settings.h
@@ -132,8 +132,12 @@ DeclareReadSetting(QString, LangFile);
 
 DeclareSetting(bool, Retina);
 DeclareSetting(float64, RetinaFactor);
+DeclareSetting(int32, IntRetinaFactor);
 DeclareSetting(bool, CustomNotifies);
 
+DeclareReadSetting(uint64, Instance);
+
 DeclareReadSetting(DBIPlatform, Platform);
+DeclareReadSetting(QUrl, UpdateURL);
 
 void settingsParseArgs(int argc, char *argv[]);
diff --git a/Telegram/SourceFiles/settingswidget.cpp b/Telegram/SourceFiles/settingswidget.cpp
index ae8e83937..5fced5e7b 100644
--- a/Telegram/SourceFiles/settingswidget.cpp
+++ b/Telegram/SourceFiles/settingswidget.cpp
@@ -32,7 +32,7 @@ Copyright (c) 2014 John Preston, https://tdesktop.com
 
 Slider::Slider(QWidget *parent, const style::slider &st, int32 count, int32 sel) : QWidget(parent),
 _count(count), _sel(snap(sel, 0, _count)), _wasSel(_sel), _st(st), _pressed(false) {
-	resize(_st.width, _st.bar.height());
+	resize(_st.width, _st.bar.pxHeight());
 	setCursor(style::cur_pointer);
 }
 
@@ -43,7 +43,7 @@ void Slider::mousePressEvent(QMouseEvent *e) {
 
 void Slider::mouseMoveEvent(QMouseEvent *e) {
 	if (_pressed) {
-		int32 newSel = snap(qRound((_count - 1) * float64(e->pos().x() - _st.bar.width() / 2) / (width() - _st.bar.width())), 0, _count - 1);
+		int32 newSel = snap(qRound((_count - 1) * float64(e->pos().x() - _st.bar.pxWidth() / 2) / (width() - _st.bar.pxWidth())), 0, _count - 1);
 		if (newSel != _sel) {
 			_sel = newSel;
 			update();
@@ -81,7 +81,7 @@ void Slider::paintEvent(QPaintEvent *e) {
 		p.drawLine(0, i, width() - 1, i);
 	}
 
-	int32 x = qFloor(_sel * float64(width() - _st.bar.width()) / (_count - 1)), y = (height() - _st.bar.height()) / 2;
+	int32 x = qFloor(_sel * float64(width() - _st.bar.pxWidth()) / (_count - 1)), y = (height() - _st.bar.pxHeight()) / 2;
 	p.drawPixmap(QPoint(x, y), App::sprite(), _st.bar);
 }
 
@@ -135,10 +135,10 @@ SettingsInner::SettingsInner(Settings *parent) : QWidget(parent),
 	_viewEmojis(this, lang(lng_settings_view_emojis)),
 
 	_enterSend(this, qsl("send_key"), 0, lang(lng_settings_send_enter), !cCtrlEnter()),
-	_ctrlEnterSend(this, qsl("send_key"), 1, lang(lng_settings_send_ctrlenter), cCtrlEnter()),
+    _ctrlEnterSend(this, qsl("send_key"), 1, lang((cPlatform() == dbipMac) ? lng_settings_send_cmdenter : lng_settings_send_ctrlenter), cCtrlEnter()),
 
-	_downloadPathWidth(st::linkFont->m.width(lang(lng_download_path_label))),
 	_dontAskDownloadPath(this, lang(lng_download_path_dont_ask), !cAskDownloadPath()),
+    _downloadPathWidth(st::linkFont->m.width(lang(lng_download_path_label))),
 	_downloadPathEdit(this, cDownloadPath().isEmpty() ? lang(lng_download_path_temp) : st::linkFont->m.elidedText(QDir::toNativeSeparators(cDownloadPath()), Qt::ElideRight, st::setWidth - st::setVersionLeft - _downloadPathWidth)),
 	_downloadPathClear(this, lang(lng_download_path_clear)),
 	_tempDirClearingWidth(st::linkFont->m.width(lang(lng_download_path_clearing))),
@@ -150,8 +150,8 @@ SettingsInner::SettingsInner(Settings *parent) : QWidget(parent),
 	// advanced
 	_connectionType(this, lang(lng_connection_auto)),
 	_resetSessions(this, lang(lng_settings_reset)),
-	_resetDone(false),
-	_logOut(this, lang(lng_settings_logout), st::btnLogout)
+	_logOut(this, lang(lng_settings_logout), st::btnLogout),
+    _resetDone(false)
 {
 	if (_self) {
 		_nameText.setText(st::setNameFont, _nameCache, _textNameOptions);
@@ -345,36 +345,40 @@ void SettingsInner::paintEvent(QPaintEvent *e) {
 	p.drawText(_left + st::setVersionLeft, top + st::setVersionTop + st::linkFont->ascent, textToDraw);
 	top += st::setVersionHeight;
 
-	top += _workmodeTray.height() + st::setLittleSkip;
-	top += _workmodeWindow.height() + st::setSectionSkip;
-
-	top += _autoStart.height() + st::setLittleSkip;
-	top += _startMinimized.height();
-
-	p.setFont(st::setHeaderFont->f);
-	p.setPen(st::setHeaderColor->p);
-	p.drawText(_left + st::setHeaderLeft, top + st::setHeaderTop + st::setHeaderFont->ascent, lang(lng_settings_scale_label));
-	top += st::setHeaderSkip;
-	top += _dpiAutoScale.height() + st::setLittleSkip;
-
-	top += _dpiSlider.height() + st::dpiFont4->height;
-	int32 sLeft = _dpiSlider.x() + _dpiWidth1 / 2, sWidth = _dpiSlider.width();
-	float64 sStep = (sWidth - _dpiWidth1 / 2 - _dpiWidth4 / 2) / float64(dbisScaleCount - 2);
-	p.setFont(st::dpiFont1->f);
-
-	p.setPen((scaleIs(dbisOne) ? st::dpiActive : st::dpiInactive)->p);
-	p.drawText(sLeft + qRound(0 * sStep) - _dpiWidth1 / 2, top - (st::dpiFont4->height - st::dpiFont1->height) / 2 - st::dpiFont1->descent, scaleLabel(dbisOne));
-	p.setFont(st::dpiFont2->f);
-	p.setPen((scaleIs(dbisOneAndQuarter) ? st::dpiActive : st::dpiInactive)->p);
-	p.drawText(sLeft + qRound(1 * sStep) - _dpiWidth2 / 2, top - (st::dpiFont4->height - st::dpiFont2->height) / 2 - st::dpiFont2->descent, scaleLabel(dbisOneAndQuarter));
-	p.setFont(st::dpiFont3->f);
-	p.setPen((scaleIs(dbisOneAndHalf) ? st::dpiActive : st::dpiInactive)->p);
-	p.drawText(sLeft + qRound(2 * sStep) - _dpiWidth3 / 2, top - (st::dpiFont4->height - st::dpiFont3->height) / 2 - st::dpiFont3->descent, scaleLabel(dbisOneAndHalf));
-	p.setFont(st::dpiFont4->f);
-	p.setPen((scaleIs(dbisTwo) ? st::dpiActive : st::dpiInactive)->p);
-	p.drawText(sLeft + qRound(3 * sStep) - _dpiWidth4 / 2, top - (st::dpiFont4->height - st::dpiFont4->height) / 2 - st::dpiFont4->descent, scaleLabel(dbisTwo));
-	p.setFont(st::linkFont->f);
-
+    if (cPlatform() == dbipWindows) {
+        top += _workmodeTray.height() + st::setLittleSkip;
+        top += _workmodeWindow.height() + st::setSectionSkip;
+        
+        top += _autoStart.height() + st::setLittleSkip;
+        top += _startMinimized.height();
+    }
+    
+    if (!cRetina()) {
+        p.setFont(st::setHeaderFont->f);
+        p.setPen(st::setHeaderColor->p);
+        p.drawText(_left + st::setHeaderLeft, top + st::setHeaderTop + st::setHeaderFont->ascent, lang(lng_settings_scale_label));
+        top += st::setHeaderSkip;
+        top += _dpiAutoScale.height() + st::setLittleSkip;
+        
+        top += _dpiSlider.height() + st::dpiFont4->height;
+        int32 sLeft = _dpiSlider.x() + _dpiWidth1 / 2, sWidth = _dpiSlider.width();
+        float64 sStep = (sWidth - _dpiWidth1 / 2 - _dpiWidth4 / 2) / float64(dbisScaleCount - 2);
+        p.setFont(st::dpiFont1->f);
+        
+        p.setPen((scaleIs(dbisOne) ? st::dpiActive : st::dpiInactive)->p);
+        p.drawText(sLeft + qRound(0 * sStep) - _dpiWidth1 / 2, top - (st::dpiFont4->height - st::dpiFont1->height) / 2 - st::dpiFont1->descent, scaleLabel(dbisOne));
+        p.setFont(st::dpiFont2->f);
+        p.setPen((scaleIs(dbisOneAndQuarter) ? st::dpiActive : st::dpiInactive)->p);
+        p.drawText(sLeft + qRound(1 * sStep) - _dpiWidth2 / 2, top - (st::dpiFont4->height - st::dpiFont2->height) / 2 - st::dpiFont2->descent, scaleLabel(dbisOneAndQuarter));
+        p.setFont(st::dpiFont3->f);
+        p.setPen((scaleIs(dbisOneAndHalf) ? st::dpiActive : st::dpiInactive)->p);
+        p.drawText(sLeft + qRound(2 * sStep) - _dpiWidth3 / 2, top - (st::dpiFont4->height - st::dpiFont3->height) / 2 - st::dpiFont3->descent, scaleLabel(dbisOneAndHalf));
+        p.setFont(st::dpiFont4->f);
+        p.setPen((scaleIs(dbisTwo) ? st::dpiActive : st::dpiInactive)->p);
+        p.drawText(sLeft + qRound(3 * sStep) - _dpiWidth4 / 2, top - (st::dpiFont4->height - st::dpiFont4->height) / 2 - st::dpiFont4->descent, scaleLabel(dbisTwo));
+        p.setFont(st::linkFont->f);
+    }
+    
 	if (_self) {
 		// chat options
 		p.setFont(st::setHeaderFont->f);
@@ -451,16 +455,19 @@ void SettingsInner::resizeEvent(QResizeEvent *e) {
 	_restartNow.move(_left + st::setWidth - _restartNow.width(), top + st::setVersionTop);
 	top += st::setVersionHeight;
 
-	_workmodeTray.move(_left, top); top += _workmodeTray.height() + st::setLittleSkip;
-	_workmodeWindow.move(_left, top); top += _workmodeWindow.height() + st::setSectionSkip;
-
-	_autoStart.move(_left, top); top += _autoStart.height() + st::setLittleSkip;
-	_startMinimized.move(_left, top); top += _startMinimized.height();
-
-	top += st::setHeaderSkip;
-	_dpiAutoScale.move(_left, top); top += _dpiAutoScale.height() + st::setLittleSkip;
-	_dpiSlider.move(_left, top); top += _dpiSlider.height() + st::dpiFont4->height;
-
+    if (cPlatform() == dbipWindows) {
+        _workmodeTray.move(_left, top); top += _workmodeTray.height() + st::setLittleSkip;
+        _workmodeWindow.move(_left, top); top += _workmodeWindow.height() + st::setSectionSkip;
+        
+        _autoStart.move(_left, top); top += _autoStart.height() + st::setLittleSkip;
+        _startMinimized.move(_left, top); top += _startMinimized.height();
+    }
+    if (!cRetina()) {
+        top += st::setHeaderSkip;
+        _dpiAutoScale.move(_left, top); top += _dpiAutoScale.height() + st::setLittleSkip;
+        _dpiSlider.move(_left, top); top += _dpiSlider.height() + st::dpiFont4->height;
+    }
+    
 	// chat options
 	if (_self) {
 		top += st::setHeaderSkip;
@@ -625,14 +632,27 @@ void SettingsInner::showAll() {
 
 	// general
 	_autoUpdate.show();
-
-	_workmodeTray.show();
-	_workmodeWindow.show();
-
-	_autoStart.show();
 	setUpdatingState(_updatingState, true);
-	_startMinimized.show();
-	_dpiSlider.show();
+    if (cPlatform() == dbipWindows) {
+        _workmodeTray.show();
+        _workmodeWindow.show();
+
+        _autoStart.show();
+        _startMinimized.show();
+    } else {
+        _workmodeTray.hide();
+        _workmodeWindow.hide();
+        
+        _autoStart.hide();
+        _startMinimized.hide();
+    }
+    if (cRetina()) {
+        _dpiSlider.hide();
+        _dpiAutoScale.hide();
+    } else {
+        _dpiSlider.show();
+        _dpiAutoScale.show();
+    }
 
 	// chat options
 	if (_self) {
diff --git a/Telegram/SourceFiles/stdafx.h b/Telegram/SourceFiles/stdafx.h
index 49b2f0e36..6ac7aec17 100644
--- a/Telegram/SourceFiles/stdafx.h
+++ b/Telegram/SourceFiles/stdafx.h
@@ -34,7 +34,11 @@ Copyright (c) 2014 John Preston, https://tdesktop.com
 #include <QtNetwork/QNetworkReply>
 #include <QtNetwork/QNetworkProxy>
 
+#ifdef Q_OS_WIN // use Lzma SDK for win
 #include <LzmaLib.h>
+#else
+#include <lzma.h>
+#endif
 
 #if defined Q_OS_WIN
 #define _NEED_WIN_GENERATE_DUMP
diff --git a/Telegram/SourceFiles/sysbuttons.cpp b/Telegram/SourceFiles/sysbuttons.cpp
index d482d54ff..0e3e5b0b1 100644
--- a/Telegram/SourceFiles/sysbuttons.cpp
+++ b/Telegram/SourceFiles/sysbuttons.cpp
@@ -45,8 +45,8 @@ void SysBtn::onStateChange(int oldState, ButtonStateChangeSource source) {
 void SysBtn::paintEvent(QPaintEvent *e) {
 	QPainter p(this);
 
-	int x = (width() - _st.img.width()) / 2, y = (height() - _st.img.height()) / 2;
-	p.fillRect(x, y, _st.img.width(), _st.img.height(), a_color.current());
+	int x = (width() - _st.img.pxWidth()) / 2, y = (height() - _st.img.pxHeight()) / 2;
+	p.fillRect(x, y, _st.img.pxWidth(), _st.img.pxHeight(), a_color.current());
 	p.drawPixmap(QPoint(x, y), App::sprite(), _st.img);
 }
 
diff --git a/Telegram/SourceFiles/title.cpp b/Telegram/SourceFiles/title.cpp
index b2528b795..03c61d304 100644
--- a/Telegram/SourceFiles/title.cpp
+++ b/Telegram/SourceFiles/title.cpp
@@ -49,7 +49,8 @@ void TitleHider::setLevel(float64 level) {
 TitleWidget::TitleWidget(Window *window)
 	: QWidget(window)
 	, wnd(window)
-	, availWidth(460)
+    , hideLevel(0)
+    , hider(0)
 	, _settings(this, lang(lng_menu_settings), st::titleTextButton)
 	, _contacts(this, lang(lng_menu_contacts), st::titleTextButton)
 	, _about(this, lang(lng_menu_about), st::titleTextButton)
@@ -58,9 +59,8 @@ TitleWidget::TitleWidget(Window *window)
 	, _maximize(this, window)
 	, _restore(this, window)
 	, _close(this, window)
-	, lastMaximized(!(window->windowState() & Qt::WindowMaximized))
-	, hider(0)
-	, hideLevel(0) {
+    , lastMaximized(!(window->windowState() & Qt::WindowMaximized))
+{
 
 	setGeometry(0, 0, wnd->width(), st::titleHeight);
 	stateChanged();
@@ -76,6 +76,13 @@ TitleWidget::TitleWidget(Window *window)
 	connect(&_about, SIGNAL(clicked()), this, SLOT(onAbout()));
 	connect(wnd->windowHandle(), SIGNAL(windowStateChanged(Qt::WindowState)), this, SLOT(stateChanged(Qt::WindowState)));
 	connect(App::app(), SIGNAL(updateReady()), this, SLOT(showUpdateBtn()));
+        
+    if (cPlatform() == dbipMac) {
+        _minimize.hide();
+        _maximize.hide();
+        _restore.hide();
+        _close.hide();
+    }
 }
 
 void TitleWidget::paintEvent(QPaintEvent *e) {
@@ -118,17 +125,19 @@ TitleWidget::~TitleWidget() {
 }
 
 void TitleWidget::resizeEvent(QResizeEvent *e) {
-	QPoint p(width() - (lastMaximized ? 0 : st::sysBtnDelta), 0);
+	QPoint p(width() - ((cPlatform() == dbipWindows && lastMaximized) ? 0 : st::sysBtnDelta), 0);
 	
-	p.setX(p.x() - _close.width());
-	_close.move(p);
-
-	p.setX(p.x() - _maximize.width());
-	_restore.move(p); _maximize.move(p);
-
-	p.setX(p.x() - _minimize.width());
-	_minimize.move(p);
-
+    if (cPlatform() != dbipMac) {
+        p.setX(p.x() - _close.width());
+        _close.move(p);
+        
+        p.setX(p.x() - _maximize.width());
+        _restore.move(p); _maximize.move(p);
+        
+        p.setX(p.x() - _minimize.width());
+        _minimize.move(p);
+    }
+    
 	if (!_update.isHidden()) {
 		p.setX(p.x() - _update.width());
 		_update.move(p);
@@ -184,6 +193,8 @@ void TitleWidget::maximizedChanged(bool maximized) {
 	if (lastMaximized == maximized) return;
 
 	lastMaximized = maximized;
+
+    if (cPlatform() == dbipMac) return;
 	if (maximized) {
 		_maximize.clearState();
 	} else {
@@ -202,7 +213,7 @@ HitTestType TitleWidget::hitTest(const QPoint &p) {
 	int x(p.x()), y(p.y()), w(width()), h(height() - st::titleShadow);
 	if (hider && x >= App::main()->dlgsWidth()) return HitTestNone;
 
-	if (x >= st::titleIconPos.x() && y >= st::titleIconPos.y() && x < st::titleIconPos.x() + st::titleIconRect.width() && y < st::titleIconPos.y() + st::titleIconRect.height()) {
+	if (x >= st::titleIconPos.x() && y >= st::titleIconPos.y() && x < st::titleIconPos.x() + st::titleIconRect.pxWidth() && y < st::titleIconPos.y() + st::titleIconRect.pxHeight()) {
 		return HitTestIcon;
 	} else if (false
 		|| (_update.hitTest(p - _update.geometry().topLeft()) == HitTestSysButton) && _update.isVisible()
@@ -215,7 +226,7 @@ HitTestType TitleWidget::hitTest(const QPoint &p) {
 	} else if (x >= 0 && x < w && y >= 0 && y < h) {
 		if (false
 			|| _settings.geometry().contains(x, y)
-			|| !_contacts.isHidden() && _contacts.geometry().contains(x, y)
+			|| (!_contacts.isHidden() && _contacts.geometry().contains(x, y))
 			|| _about.geometry().contains(x, y)
 		) {
 			return HitTestClient;
diff --git a/Telegram/SourceFiles/title.h b/Telegram/SourceFiles/title.h
index 75aa58b54..7ce806fbf 100644
--- a/Telegram/SourceFiles/title.h
+++ b/Telegram/SourceFiles/title.h
@@ -84,8 +84,6 @@ private:
 	RestoreBtn _restore;
 	CloseBtn _close;
 
-	int32 availWidth;
-
 	bool lastMaximized;
 
 };
diff --git a/Telegram/SourceFiles/types.cpp b/Telegram/SourceFiles/types.cpp
index 8ae68c213..a08383dce 100644
--- a/Telegram/SourceFiles/types.cpp
+++ b/Telegram/SourceFiles/types.cpp
@@ -34,9 +34,8 @@ namespace {
 	class _TypeSizeCheckerHelper {
 	public:
 		_TypeSizeCheckerHelper() {
-#ifndef Q_OS_MAC
-			_BadTypeSize<T> field;
-#endif
+            int _BadTypeSize[N ? -1 : 1];
+            (void)sizeof(_BadTypeSize);
 		}
 	};
 
@@ -398,11 +397,11 @@ namespace {
 	}
 
 	inline uint32 _md5_F(uint32 x, uint32 y, uint32 z) {
-		return x & y | ~x & z;
+		return (x & y) | (~x & z);
 	}
 
 	inline uint32 _md5_G(uint32 x, uint32 y, uint32 z) {
-		return x & z | y & ~z;
+		return (x & z) | (y & ~z);
 	}
 
 	inline uint32 _md5_H(uint32 x, uint32 y, uint32 z) {
diff --git a/Telegram/SourceFiles/types.h b/Telegram/SourceFiles/types.h
index 363286ba2..81bbc3323 100644
--- a/Telegram/SourceFiles/types.h
+++ b/Telegram/SourceFiles/types.h
@@ -49,7 +49,7 @@ using std::swap;
 class Exception : public exception {
 public:
 
-    Exception(const QString &msg, bool isFatal = true) : _fatal(isFatal), _msg(msg) {
+    Exception(const QString &msg, bool isFatal = true) : _fatal(isFatal), _msg(msg.toUtf8()) {
 		LOG(("Exception: %1").arg(msg));
 	}
 	bool fatal() const {
@@ -57,14 +57,14 @@ public:
 	}
 
     virtual const char *what() const throw() {
-        return _msg.toUtf8().constData();
+        return _msg.constData();
     }
     virtual ~Exception() throw() {
     }
 
 private:
 	bool _fatal;
-    QString _msg;
+    QByteArray _msg;
 };
 
 class MTPint;
diff --git a/Telegram/SourceFiles/window.cpp b/Telegram/SourceFiles/window.cpp
index dab1fc75f..7d0f6e4db 100644
--- a/Telegram/SourceFiles/window.cpp
+++ b/Telegram/SourceFiles/window.cpp
@@ -29,7 +29,7 @@ Copyright (c) 2014 John Preston, https://tdesktop.com
 #include "layerwidget.h"
 #include "settingswidget.h"
 
-ConnectingWidget::ConnectingWidget(QWidget *parent, const QString &text, const QString &reconnect) : QWidget(parent), _reconnect(this, QString()), _shadow(st::boxShadow) {
+ConnectingWidget::ConnectingWidget(QWidget *parent, const QString &text, const QString &reconnect) : QWidget(parent), _shadow(st::boxShadow), _reconnect(this, QString()) {
 	set(text, reconnect);
 	connect(&_reconnect, SIGNAL(clicked()), this, SLOT(onReconnect()));
 }
@@ -43,20 +43,20 @@ void ConnectingWidget::set(const QString &text, const QString &reconnect) {
 	} else {
 		_reconnect.setText(reconnect);
 		_reconnect.show();
-		_reconnect.move(st::connectingPadding.left() + _textWidth, st::boxShadow.height() + st::connectingPadding.top());
+		_reconnect.move(st::connectingPadding.left() + _textWidth, st::boxShadow.pxHeight() + st::connectingPadding.top());
 		_reconnectWidth = _reconnect.width();
 	}
-	resize(st::connectingPadding.left() + _textWidth + _reconnectWidth + st::connectingPadding.right() + st::boxShadow.width(), st::boxShadow.height() + st::connectingPadding.top() + st::linkFont->height + st::connectingPadding.bottom());
+	resize(st::connectingPadding.left() + _textWidth + _reconnectWidth + st::connectingPadding.right() + st::boxShadow.pxWidth(), st::boxShadow.pxHeight() + st::connectingPadding.top() + st::linkFont->height + st::connectingPadding.bottom());
 	update();
 }
 void ConnectingWidget::paintEvent(QPaintEvent *e) {
 	QPainter p(this);
 
-	_shadow.paint(p, QRect(0, st::boxShadow.height(), width() - st::boxShadow.width(), height() - st::boxShadow.height()), QPoint(0, 0), BoxShadow::Top | BoxShadow::Right);
-	p.fillRect(0, st::boxShadow.height(), width() - st::boxShadow.width(), height() - st::boxShadow.height(), st::connectingBG->b);
+	_shadow.paint(p, QRect(0, st::boxShadow.pxHeight(), width() - st::boxShadow.pxWidth(), height() - st::boxShadow.pxHeight()), QPoint(0, 0), BoxShadow::Top | BoxShadow::Right);
+	p.fillRect(0, st::boxShadow.pxHeight(), width() - st::boxShadow.pxWidth(), height() - st::boxShadow.pxHeight(), st::connectingBG->b);
 	p.setFont(st::linkFont->f);
 	p.setPen(st::connectingColor->p);
-	p.drawText(st::connectingPadding.left(), st::boxShadow.height() + st::connectingPadding.top() + st::linkFont->ascent, _text);
+	p.drawText(st::connectingPadding.left(), st::boxShadow.pxHeight() + st::connectingPadding.top() + st::linkFont->ascent, _text);
 }
 
 void ConnectingWidget::onReconnect() {
@@ -77,8 +77,8 @@ void TempDirDeleter::onStart() {
 }
 
 Window::Window(QWidget *parent)	: PsMainWindow(parent),
-	dragging(false), intro(0), main(0), settings(0), layer(0), layerBG(0), myIcon(QPixmap::fromImage(icon256)), _topWidget(0),
-	_connecting(0), _inactivePress(false), _tempDeleter(0), _tempDeleterThread(0) {
+	intro(0), main(0), settings(0), layer(0), layerBG(0), _topWidget(0),
+	_connecting(0), _tempDeleter(0), _tempDeleterThread(0), myIcon(QPixmap::fromImage(icon256)), dragging(false), _inactivePress(false) {
 
 	if (objectName().isEmpty())
 		setObjectName(qsl("MainWindow"));
@@ -253,7 +253,7 @@ void Window::mtpStateChanged(int32 dc, int32 state) {
 
 void Window::updateTitleStatus() {
 	int32 state = MTP::dcstate();
-	if (state == MTProtoConnection::Connecting || state == MTProtoConnection::Disconnected || state < 0 && state > -600) {
+	if (state == MTProtoConnection::Connecting || state == MTProtoConnection::Disconnected || (state < 0 && state > -600)) {
 		if (main || getms() > 5000 || _connecting) {
 			showConnecting(lang(lng_connecting));
 		}
@@ -384,7 +384,7 @@ void Window::paintEvent(QPaintEvent *e) {
 HitTestType Window::hitTest(const QPoint &p) const {
 	int x(p.x()), y(p.y()), w(width()), h(height());
 	
-	const uint32 raw = psResizeRowWidth();
+	const int32 raw = psResizeRowWidth();
 	if (!windowState().testFlag(Qt::WindowMaximized)) {
 		if (y < raw) {
 			if (x < raw) {
@@ -438,12 +438,20 @@ bool Window::getVideoCoords(VideoData *video, int32 &x, int32 &y, int32 &w) cons
 }
 
 QRect Window::iconRect() const {
-	return QRect(st::titleIconPos + title->geometry().topLeft(), st::titleIconRect.size());
+	return QRect(st::titleIconPos + title->geometry().topLeft(), st::titleIconRect.pxSize());
 }
 
 bool Window::eventFilter(QObject *obj, QEvent *evt) {
 	if (obj == App::app() && (evt->type() == QEvent::ApplicationActivate)) {
         QTimer::singleShot(1, this, SLOT(checkHistoryActivation()));
+	} else if (obj == this && evt->type() == QEvent::WindowStateChange) {
+		Qt::WindowState state = (windowState() & Qt::WindowMinimized) ? Qt::WindowMinimized : ((windowState() & Qt::WindowMaximized) ? Qt::WindowMaximized : ((windowState() & Qt::WindowFullScreen) ? Qt::WindowFullScreen : Qt::WindowNoState));
+		psStateChanged(state);
+		if (App::main()) {
+			App::main()->mainStateChanged(state);
+		}
+	} else if (obj == this && (evt->type() == QEvent::Move || evt->type() == QEvent::Resize)) {
+		psUpdatedPosition();
 	}
 	return PsMainWindow::eventFilter(obj, evt);
 }
diff --git a/Telegram/Telegram.plist b/Telegram/Telegram.plist
index 053296071..c4e8ffab3 100644
--- a/Telegram/Telegram.plist
+++ b/Telegram/Telegram.plist
@@ -11,7 +11,7 @@
 	<key>CFBundlePackageType</key>
 	<string>APPL</string>
 	<key>CFBundleShortVersionString</key>
-	<string>0.5.1</string>
+	<string>0.5.5</string>
 	<key>CFBundleSignature</key>
 	<string>????</string>
 	<key>NOTE</key>
diff --git a/Telegram/Telegram.pro b/Telegram/Telegram.pro
index f21d06e91..1f9496cf2 100644
--- a/Telegram/Telegram.pro
+++ b/Telegram/Telegram.pro
@@ -194,6 +194,3 @@ LIBS += ./../../Libraries/libexif-0.6.20/libexif/.libs/libexif.a
 RESOURCES += \
     ./SourceFiles/telegram.qrc
 
-CONFIG(debug, debug|release) {
-    DEFINES += _DEBUG
-}
diff --git a/Telegram/Telegram.vcxproj b/Telegram/Telegram.vcxproj
index 6110d47d1..735b600e7 100644
--- a/Telegram/Telegram.vcxproj
+++ b/Telegram/Telegram.vcxproj
@@ -793,11 +793,11 @@
     </CustomBuild>
     <CustomBuild Include="Resources\style_classes.txt">
       <Outputs>.\GeneratedFiles\style_classes.h</Outputs>
-      <Command>"$(SolutionDir)$(Platform)\$(Configuration)Style\MetaStyle.exe" -classes_in ".\Resources\style_classes.txt" -classes_out ".\GeneratedFiles\style_classes.h" -styles_in ".\Resources\style.txt" -styles_out ".\GeneratedFiles\style_auto.h"</Command>
+      <Command>"$(SolutionDir)$(Platform)\$(Configuration)Style\MetaStyle.exe" -classes_in ".\Resources\style_classes.txt" -classes_out ".\GeneratedFiles\style_classes.h" -styles_in ".\Resources\style.txt" -styles_out ".\GeneratedFiles\style_auto.h" -path_to_sprites ".\SourceFiles\art\\"</Command>
     </CustomBuild>
     <CustomBuild Include="Resources\style.txt">
       <Outputs>.\GeneratedFiles\style_auto.h</Outputs>
-      <Command>"$(SolutionDir)$(Platform)\$(Configuration)Style\MetaStyle.exe" -classes_in ".\Resources\style_classes.txt" -classes_out ".\GeneratedFiles\style_classes.h" -styles_in ".\Resources\style.txt" -styles_out ".\GeneratedFiles\style_auto.h"</Command>
+      <Command>"$(SolutionDir)$(Platform)\$(Configuration)Style\MetaStyle.exe" -classes_in ".\Resources\style_classes.txt" -classes_out ".\GeneratedFiles\style_classes.h" -styles_in ".\Resources\style.txt" -styles_out ".\GeneratedFiles\style_auto.h" -path_to_sprites ".\SourceFiles\art\\"</Command>
     </CustomBuild>
     <CustomBuild Include="Resources\lang.txt">
       <Outputs>.\GeneratedFiles\lang.h</Outputs>
diff --git a/Telegram/Telegram.xcodeproj/project.pbxproj b/Telegram/Telegram.xcodeproj/project.pbxproj
index f75a0bff4..e2b170c38 100644
--- a/Telegram/Telegram.xcodeproj/project.pbxproj
+++ b/Telegram/Telegram.xcodeproj/project.pbxproj
@@ -38,7 +38,8 @@
 		02F93BF511880983D3C57B84 /* dialogswidget.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = E466873F01ABA1E55E914489 /* dialogswidget.cpp */; settings = {ATTRIBUTES = (); }; };
 		03270F718426CFE84729079E /* flattextarea.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 5C7FD422BBEDA858D7237AE9 /* flattextarea.cpp */; settings = {ATTRIBUTES = (); }; };
 		06EABCC49D2EEE4076322BE7 /* moc_mtp.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 924D4939FD169BB4B8AEB1C9 /* moc_mtp.cpp */; settings = {ATTRIBUTES = (); }; };
-		07C3AF26194336250016CFF1 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 07C3AF24194335ED0016CFF1 /* Images.xcassets */; };
+		07055CC4194EE85B0008DEF6 /* libcrypto.a in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = 07055CC3194EE85B0008DEF6 /* libcrypto.a */; };
+		0749CE69194D723400345D61 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 07C3AF24194335ED0016CFF1 /* Images.xcassets */; };
 		0A49F3A5DC0680FB31519670 /* phoneinput.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 7C8F9CA4FCE8AF8FCCCB961E /* phoneinput.cpp */; settings = {ATTRIBUTES = (); }; };
 		0CB7DE9A54CC9BF86FB7B5CA /* mtp.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 6D50D70712776D7ED3B00E5C /* mtp.cpp */; settings = {ATTRIBUTES = (); }; };
 		0F0FC25286E16E5F78962FEE /* moc_newgroupbox.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 69FE16874104731CE2A66E0D /* moc_newgroupbox.cpp */; settings = {ATTRIBUTES = (); }; };
@@ -201,6 +202,13 @@
 /* End PBXBuildFile section */
 
 /* Begin PBXContainerItemProxy section */
+		07084688195445A700B5AE3A /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 07084684195445A600B5AE3A /* Updater.xcodeproj */;
+			proxyType = 2;
+			remoteGlobalIDString = 07084678195445A600B5AE3A;
+			remoteInfo = Updater;
+		};
 		07C3AF22194335970016CFF1 /* PBXContainerItemProxy */ = {
 			isa = PBXContainerItemProxy;
 			containerPortal = 6DB9C3763D02B1415CD9D565 /* Project object */;
@@ -224,6 +232,8 @@
 		047DAFB0A7DE92C63033A43C /* mainwidget.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = mainwidget.cpp; path = SourceFiles/mainwidget.cpp; sourceTree = "<absolute>"; };
 		060A694B42A4555240009936 /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtga.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_plugin_qtga.pri"; sourceTree = "<absolute>"; };
 		06E379415713F34B83F99C35 /* app.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = app.cpp; path = SourceFiles/app.cpp; sourceTree = "<absolute>"; };
+		07055CC3194EE85B0008DEF6 /* libcrypto.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcrypto.a; path = "./../../Libraries/openssl-xcode/libcrypto.a"; sourceTree = "<group>"; };
+		07084684195445A600B5AE3A /* Updater.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; path = Updater.xcodeproj; sourceTree = SOURCE_ROOT; };
 		075EB50EB07CF69FD62FB8DF /* /usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_sql_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.3.0/mkspecs/modules/qt_lib_sql_private.pri"; sourceTree = "<absolute>"; };
 		0771C4C94B623FC34BF62983 /* intro.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = intro.cpp; path = SourceFiles/intro/intro.cpp; sourceTree = "<absolute>"; };
 		07C3AF24194335ED0016CFF1 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = Telegram/Images.xcassets; sourceTree = SOURCE_ROOT; };
@@ -593,6 +603,7 @@
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				07055CC4194EE85B0008DEF6 /* libcrypto.a in Link Binary With Libraries */,
 				1BB705CDB741E2B7450201A5 /* Cocoa.framework in Link Binary With Libraries */,
 				B58956C9C026BD3A7FD9ECDF /* libexif.a in Link Binary With Libraries */,
 				328FD74542F6E2C873EE4D4B /* ApplicationServices.framework in Link Binary With Libraries */,
@@ -649,6 +660,14 @@
 /* End PBXFrameworksBuildPhase section */
 
 /* Begin PBXGroup section */
+		07084685195445A600B5AE3A /* Products */ = {
+			isa = PBXGroup;
+			children = (
+				07084689195445A700B5AE3A /* Updater */,
+			);
+			name = Products;
+			sourceTree = "<group>";
+		};
 		130BDDB6FC4D60CF394D95AF /* GeneratedFiles */ = {
 			isa = PBXGroup;
 			children = (
@@ -1069,6 +1088,7 @@
 		AF39DD055C3EF8226FBE929D /* Frameworks */ = {
 			isa = PBXGroup;
 			children = (
+				07055CC3194EE85B0008DEF6 /* libcrypto.a */,
 				AEA456A2F75ED9F5CDA7BCBE /* Cocoa.framework */,
 				4AF15B5A0A43EB62D6DAF211 /* libexif.a */,
 				DFD7912080BC557230093752 /* ApplicationServices.framework */,
@@ -1135,13 +1155,13 @@
 		E8C543AB96796ECAA2E65C57 /* Telegram */ = {
 			isa = PBXGroup;
 			children = (
+				07084684195445A600B5AE3A /* Updater.xcodeproj */,
 				2EB56BE3C2D93CDAB0C52E67 /* Sources */,
 				25B08E2869634E9BCBA333A2 /* Generated Sources */,
 				74B182DB50CB5611B5C1C297 /* Supporting Files */,
 				87DF60DE337FB58864343E39 /* Resources */,
 				AF39DD055C3EF8226FBE929D /* Frameworks */,
 				FE0A091FDBFB3E9C31B7A1BD /* Products */,
-				07C3AF40194CCC310016CFF1 /* Preprocess copy-Info.plist */,
 			);
 			name = Telegram;
 			sourceTree = "<Group>";
@@ -1183,6 +1203,7 @@
 		6DB9C3763D02B1415CD9D565 /* Project object */ = {
 			isa = PBXProject;
 			attributes = {
+				LastUpgradeCheck = 0510;
 			};
 			buildConfigurationList = DAC4C1AA5EDEA1C85E9CA5E6 /* Build configuration list for PBXProject "Telegram" */;
 			compatibilityVersion = "Xcode 3.2";
@@ -1194,6 +1215,12 @@
 			mainGroup = E8C543AB96796ECAA2E65C57 /* Telegram */;
 			productRefGroup = FE0A091FDBFB3E9C31B7A1BD /* Products */;
 			projectDirPath = "";
+			projectReferences = (
+				{
+					ProductGroup = 07084685195445A600B5AE3A /* Products */;
+					ProjectRef = 07084684195445A600B5AE3A /* Updater.xcodeproj */;
+				},
+			);
 			projectRoot = "";
 			targets = (
 				7CCA95B9FCAD34D929431AD6 /* Telegram */,
@@ -1203,12 +1230,22 @@
 		};
 /* End PBXProject section */
 
+/* Begin PBXReferenceProxy section */
+		07084689195445A700B5AE3A /* Updater */ = {
+			isa = PBXReferenceProxy;
+			fileType = "compiled.mach-o.executable";
+			path = Updater;
+			remoteRef = 07084688195445A700B5AE3A /* PBXContainerItemProxy */;
+			sourceTree = BUILT_PRODUCTS_DIR;
+		};
+/* End PBXReferenceProxy section */
+
 /* Begin PBXResourcesBuildPhase section */
 		07C3AF25194336160016CFF1 /* Resources */ = {
 			isa = PBXResourcesBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
-				07C3AF26194336250016CFF1 /* Images.xcassets in Resources */,
+				0749CE69194D723400345D61 /* Images.xcassets in Resources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -1418,7 +1455,7 @@
 				GCC_OPTIMIZATION_LEVEL = 0;
 				GCC_PREFIX_HEADER = ./SourceFiles/stdafx.h;
 				OBJROOT = ./../Mac/DebugIntermediate;
-				PRODUCT_NAME = "Preprocess copy";
+				PRODUCT_NAME = "Meta Compile";
 				QT_LIBRARY_SUFFIX = _debug;
 				SDKROOT = macosx;
 				SYMROOT = ./../Mac;
@@ -1436,7 +1473,7 @@
 				GCC_PREFIX_HEADER = ./SourceFiles/stdafx.h;
 				LLVM_LTO = YES;
 				OBJROOT = ./../Mac/ReleaseIntermediate;
-				PRODUCT_NAME = "Preprocess copy";
+				PRODUCT_NAME = "Meta Compile";
 				QT_LIBRARY_SUFFIX = "";
 				SDKROOT = macosx;
 				SYMROOT = ./../Mac;
@@ -1446,24 +1483,33 @@
 		339EE1B2CC4FC24589A0EA95 /* Release */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
-				ARCHS = x86_64;
 				CC = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang;
+				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_EMPTY_BODY = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
 				COPY_PHASE_STRIP = YES;
+				CURRENT_PROJECT_VERSION = 0.5.4;
 				DYLIB_COMPATIBILITY_VERSION = 0.5;
-				DYLIB_CURRENT_VERSION = 0.5.1;
+				DYLIB_CURRENT_VERSION = 0.5.5;
 				FRAMEWORK_SEARCH_PATHS = "";
 				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
 				GCC_OPTIMIZATION_LEVEL = fast;
 				GCC_PRECOMPILE_PREFIX_HEADER = YES;
 				GCC_PREFIX_HEADER = SourceFiles/stdafx.h;
 				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES;
 				HEADER_SEARCH_PATHS = (
 					./../../Libraries/QtStatic/qtbase/include/QtGui/5.3.0/QtGui,
 					./../../Libraries/QtStatic/qtbase/include/QtCore/5.3.0/QtCore,
 					./../../Libraries/QtStatic/qtbase/include,
 					./SourceFiles,
 					./GeneratedFiles,
-					./../../Libraries/lzma/C,
+					/usr/local/include,
 					"./../../Libraries/libexif-0.6.20",
 					"/usr/local/Qt-5.3.0/include",
 					"/usr/local/Qt-5.3.0/include/QtMultimedia",
@@ -1489,22 +1535,29 @@
 					"/usr/local/Qt-5.3.0/plugins/bearer",
 					"/usr/local/Qt-5.3.0/plugins/platforms",
 					"/usr/local/Qt-5.3.0/plugins/imageformats",
+					"./../../Libraries/openssl-xcode",
 				);
 				MACOSX_DEPLOYMENT_TARGET = 10.7;
-				OBJROOT = ./../Mac/DebugIntermediate/;
+				OBJROOT = "./../Mac/$(CONFIGURATION)Intermediate";
 				OTHER_CFLAGS = (
 					"-pipe",
 					"-g",
 					"-Wall",
 					"-W",
 					"-fPIE",
-					"-D_DEBUG",
-					"-D_DEBUG",
+					"-D_WITH_DEBUG",
 					"-DQT_MULTIMEDIA_LIB",
 					"-DQT_WIDGETS_LIB",
 					"-DQT_NETWORK_LIB",
 					"-DQT_GUI_LIB",
 					"-DQT_CORE_LIB",
+					"-Wno-unused-variable",
+					"-Wno-unused-parameter",
+					"-Wno-unused-function",
+					"-Wno-switch",
+					"-Wno-comment",
+					"-I./../../Libraries/openssl-xcode/include",
+					"-DCUSTOM_API_ID",
 				);
 				OTHER_CPLUSPLUSFLAGS = (
 					"-pipe",
@@ -1514,19 +1567,23 @@
 					"-Wall",
 					"-W",
 					"-fPIE",
-					"-D_DEBUG",
-					"-D_DEBUG",
+					"-D_WITH_DEBUG",
 					"-DQT_MULTIMEDIA_LIB",
 					"-DQT_WIDGETS_LIB",
 					"-DQT_NETWORK_LIB",
 					"-DQT_GUI_LIB",
 					"-DQT_CORE_LIB",
+					"-Wno-unused-variable",
+					"-Wno-unused-parameter",
+					"-Wno-unused-function",
+					"-Wno-switch",
+					"-Wno-comment",
+					"-I./../../Libraries/openssl-xcode/include",
+					"-DCUSTOM_API_ID",
 				);
 				OTHER_LDFLAGS = (
 					"-headerpad_max_install_names",
 					"-stdlib=libc++",
-					"-lcrypto",
-					"-lssl",
 					"-L/usr/local/Qt-5.3.0/lib",
 					"-L/usr/local/Qt-5.3.0/plugins/mediaservice",
 					"-L/usr/local/Qt-5.3.0/plugins/audio",
@@ -1538,36 +1595,46 @@
 					"-L/usr/local/Qt-5.3.0/plugins/imageformats",
 					"-lz",
 					"-lm",
+					"-llzma",
 				);
 				PRODUCT_NAME = Telegram;
 				QT_LIBRARY_SUFFIX = "";
 				SDKROOT = macosx;
-				SYMROOT = ./;
+				SYMROOT = ./../Mac;
 			};
 			name = Release;
 		};
 		3AA6C32AC930069E80220CF1 /* Debug */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
-				ARCHS = x86_64;
 				CC = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang;
+				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_EMPTY_BODY = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
 				COPY_PHASE_STRIP = NO;
+				CURRENT_PROJECT_VERSION = 0.5.4;
 				DEBUG_INFORMATION_FORMAT = dwarf;
 				DYLIB_COMPATIBILITY_VERSION = 0.5;
-				DYLIB_CURRENT_VERSION = 0.5.1;
+				DYLIB_CURRENT_VERSION = 0.5.5;
 				FRAMEWORK_SEARCH_PATHS = "";
 				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
 				GCC_OPTIMIZATION_LEVEL = 0;
 				GCC_PRECOMPILE_PREFIX_HEADER = YES;
 				GCC_PREFIX_HEADER = SourceFiles/stdafx.h;
 				GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES;
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES;
 				HEADER_SEARCH_PATHS = (
 					./../../Libraries/QtStatic/qtbase/include/QtGui/5.3.0/QtGui,
 					./../../Libraries/QtStatic/qtbase/include/QtCore/5.3.0/QtCore,
 					./../../Libraries/QtStatic/qtbase/include,
 					./SourceFiles,
 					./GeneratedFiles,
-					./../../Libraries/lzma/C,
+					/usr/local/include,
 					"./../../Libraries/libexif-0.6.20",
 					"/usr/local/Qt-5.3.0/include",
 					"/usr/local/Qt-5.3.0/include/QtMultimedia",
@@ -1593,9 +1660,11 @@
 					"/usr/local/Qt-5.3.0/plugins/bearer",
 					"/usr/local/Qt-5.3.0/plugins/platforms",
 					"/usr/local/Qt-5.3.0/plugins/imageformats",
+					"./../../Libraries/openssl-xcode",
 				);
 				MACOSX_DEPLOYMENT_TARGET = 10.7;
-				OBJROOT = ./../Mac/DebugIntermediate/;
+				OBJROOT = "./../Mac/$(CONFIGURATION)Intermediate";
+				ONLY_ACTIVE_ARCH = YES;
 				OTHER_CFLAGS = (
 					"-pipe",
 					"-g",
@@ -1603,12 +1672,17 @@
 					"-W",
 					"-fPIE",
 					"-D_DEBUG",
-					"-D_DEBUG",
 					"-DQT_MULTIMEDIA_LIB",
 					"-DQT_WIDGETS_LIB",
 					"-DQT_NETWORK_LIB",
 					"-DQT_GUI_LIB",
 					"-DQT_CORE_LIB",
+					"-Wno-unused-variable",
+					"-Wno-unused-parameter",
+					"-Wno-unused-function",
+					"-Wno-switch",
+					"-Wno-comment",
+					"-I./../../Libraries/openssl-xcode/include",
 				);
 				OTHER_CPLUSPLUSFLAGS = (
 					"-pipe",
@@ -1619,18 +1693,21 @@
 					"-W",
 					"-fPIE",
 					"-D_DEBUG",
-					"-D_DEBUG",
 					"-DQT_MULTIMEDIA_LIB",
 					"-DQT_WIDGETS_LIB",
 					"-DQT_NETWORK_LIB",
 					"-DQT_GUI_LIB",
 					"-DQT_CORE_LIB",
+					"-Wno-unused-variable",
+					"-Wno-unused-parameter",
+					"-Wno-unused-function",
+					"-Wno-switch",
+					"-Wno-comment",
+					"-I./../../Libraries/openssl-xcode/include",
 				);
 				OTHER_LDFLAGS = (
 					"-headerpad_max_install_names",
 					"-stdlib=libc++",
-					"-lcrypto",
-					"-lssl",
 					"-L/usr/local/Qt-5.3.0/lib",
 					"-L/usr/local/Qt-5.3.0/plugins/mediaservice",
 					"-L/usr/local/Qt-5.3.0/plugins/audio",
@@ -1642,11 +1719,12 @@
 					"-L/usr/local/Qt-5.3.0/plugins/imageformats",
 					"-lz",
 					"-lm",
+					"-llzma",
 				);
 				PRODUCT_NAME = Telegram;
 				QT_LIBRARY_SUFFIX = _debug;
 				SDKROOT = macosx;
-				SYMROOT = ./;
+				SYMROOT = ./../Mac;
 			};
 			name = Debug;
 		};
@@ -1654,9 +1732,10 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+				COMBINE_HIDPI_IMAGES = YES;
 				COPY_PHASE_STRIP = YES;
-				CURRENT_PROJECT_VERSION = 0.5.1;
 				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+				GCC_LINK_WITH_DYNAMIC_LIBRARIES = NO;
 				GCC_OPTIMIZATION_LEVEL = fast;
 				GCC_PREFIX_HEADER = ./SourceFiles/stdafx.h;
 				LLVM_LTO = YES;
@@ -1672,10 +1751,11 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+				COMBINE_HIDPI_IMAGES = YES;
 				COPY_PHASE_STRIP = NO;
-				CURRENT_PROJECT_VERSION = 0.5.1;
 				DEBUG_INFORMATION_FORMAT = dwarf;
 				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+				GCC_LINK_WITH_DYNAMIC_LIBRARIES = NO;
 				GCC_OPTIMIZATION_LEVEL = 0;
 				GCC_PREFIX_HEADER = ./SourceFiles/stdafx.h;
 				OBJROOT = ./../Mac/DebugIntermediate;
diff --git a/Telegram/Telegram.xcodeproj/qt_preprocess.mak b/Telegram/Telegram.xcodeproj/qt_preprocess.mak
index aebaafdaf..034888753 100644
--- a/Telegram/Telegram.xcodeproj/qt_preprocess.mak
+++ b/Telegram/Telegram.xcodeproj/qt_preprocess.mak
@@ -65,15 +65,14 @@ GeneratedFiles/qrc_telegram.cpp: SourceFiles/telegram.qrc \
 		SourceFiles/art/bg_150x.png \
 		SourceFiles/art/sprite_200x.png \
 		SourceFiles/art/newmsg.wav \
-		SourceFiles/art/ThoolikaTrditionalUnicode.ttf \
 		SourceFiles/art/sprite_125x.png \
-		SourceFiles/art/segoe_wp_semibold.ttf \
 		SourceFiles/art/emoji_200x.png \
 		SourceFiles/art/bg_200x.png \
 		SourceFiles/art/emoji_125x.png \
-		SourceFiles/art/segoe_ui.ttf \
 		SourceFiles/art/bg_125x.png \
-		SourceFiles/art/segoe_ui_semibold.ttf \
+		SourceFiles/art/OpenSans-Regular.ttf \
+                SourceFiles/art/OpenSans-Bold.ttf \
+                SourceFiles/art/OpenSans-Semibold.ttf \
 		SourceFiles/qmime/freedesktop.org.xml \
 		SourceFiles/art/usercolor4.png \
 		SourceFiles/art/chatcolor1.png \
diff --git a/Telegram/Telegram/Images.xcassets/AppIcon-2.appiconset/Contents.json b/Telegram/Telegram/Images.xcassets/AppIcon-2.appiconset/Contents.json
deleted file mode 100644
index 50ab7bd32..000000000
--- a/Telegram/Telegram/Images.xcassets/AppIcon-2.appiconset/Contents.json
+++ /dev/null
@@ -1,58 +0,0 @@
-{
-  "images" : [
-    {
-      "idiom" : "mac",
-      "scale" : "1x",
-      "size" : "16x16"
-    },
-    {
-      "idiom" : "mac",
-      "scale" : "2x",
-      "size" : "16x16"
-    },
-    {
-      "idiom" : "mac",
-      "scale" : "1x",
-      "size" : "32x32"
-    },
-    {
-      "idiom" : "mac",
-      "scale" : "2x",
-      "size" : "32x32"
-    },
-    {
-      "idiom" : "mac",
-      "scale" : "1x",
-      "size" : "128x128"
-    },
-    {
-      "idiom" : "mac",
-      "scale" : "2x",
-      "size" : "128x128"
-    },
-    {
-      "idiom" : "mac",
-      "scale" : "1x",
-      "size" : "256x256"
-    },
-    {
-      "idiom" : "mac",
-      "scale" : "2x",
-      "size" : "256x256"
-    },
-    {
-      "idiom" : "mac",
-      "scale" : "1x",
-      "size" : "512x512"
-    },
-    {
-      "idiom" : "mac",
-      "scale" : "2x",
-      "size" : "512x512"
-    }
-  ],
-  "info" : {
-    "version" : 1,
-    "author" : "xcode"
-  }
-}
\ No newline at end of file
diff --git a/Telegram/Updater.xcodeproj/project.pbxproj b/Telegram/Updater.xcodeproj/project.pbxproj
new file mode 100644
index 000000000..bc88eefa7
--- /dev/null
+++ b/Telegram/Updater.xcodeproj/project.pbxproj
@@ -0,0 +1,237 @@
+// !$*UTF8*$!
+{
+	archiveVersion = 1;
+	classes = {
+	};
+	objectVersion = 46;
+	objects = {
+
+/* Begin PBXBuildFile section */
+		070846A619544CDD00B5AE3A /* updater_osx.m in Sources */ = {isa = PBXBuildFile; fileRef = 070846A519544CDD00B5AE3A /* updater_osx.m */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXCopyFilesBuildPhase section */
+		07084676195445A600B5AE3A /* CopyFiles */ = {
+			isa = PBXCopyFilesBuildPhase;
+			buildActionMask = 2147483647;
+			dstPath = /usr/share/man/man1/;
+			dstSubfolderSpec = 0;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 1;
+		};
+/* End PBXCopyFilesBuildPhase section */
+
+/* Begin PBXFileReference section */
+		07084678195445A600B5AE3A /* Updater */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = Updater; sourceTree = BUILT_PRODUCTS_DIR; };
+		070846A519544CDD00B5AE3A /* updater_osx.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = updater_osx.m; path = SourceFiles/_other/updater_osx.m; sourceTree = SOURCE_ROOT; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+		07084675195445A600B5AE3A /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+		0708466F195445A600B5AE3A = {
+			isa = PBXGroup;
+			children = (
+				0708467A195445A600B5AE3A /* Updater */,
+				07084679195445A600B5AE3A /* Products */,
+			);
+			sourceTree = "<group>";
+		};
+		07084679195445A600B5AE3A /* Products */ = {
+			isa = PBXGroup;
+			children = (
+				07084678195445A600B5AE3A /* Updater */,
+			);
+			name = Products;
+			sourceTree = "<group>";
+		};
+		0708467A195445A600B5AE3A /* Updater */ = {
+			isa = PBXGroup;
+			children = (
+				070846A519544CDD00B5AE3A /* updater_osx.m */,
+			);
+			path = Updater;
+			sourceTree = "<group>";
+		};
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+		07084677195445A600B5AE3A /* Updater */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 07084681195445A600B5AE3A /* Build configuration list for PBXNativeTarget "Updater" */;
+			buildPhases = (
+				07084674195445A600B5AE3A /* Sources */,
+				07084675195445A600B5AE3A /* Frameworks */,
+				07084676195445A600B5AE3A /* CopyFiles */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = Updater;
+			productName = Updater;
+			productReference = 07084678195445A600B5AE3A /* Updater */;
+			productType = "com.apple.product-type.tool";
+		};
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+		07084670195445A600B5AE3A /* Project object */ = {
+			isa = PBXProject;
+			attributes = {
+				LastUpgradeCheck = 0510;
+			};
+			buildConfigurationList = 07084673195445A600B5AE3A /* Build configuration list for PBXProject "Updater" */;
+			compatibilityVersion = "Xcode 3.2";
+			developmentRegion = English;
+			hasScannedForEncodings = 0;
+			knownRegions = (
+				en,
+			);
+			mainGroup = 0708466F195445A600B5AE3A;
+			productRefGroup = 07084679195445A600B5AE3A /* Products */;
+			projectDirPath = "";
+			projectRoot = "";
+			targets = (
+				07084677195445A600B5AE3A /* Updater */,
+			);
+		};
+/* End PBXProject section */
+
+/* Begin PBXSourcesBuildPhase section */
+		07084674195445A600B5AE3A /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				070846A619544CDD00B5AE3A /* updater_osx.m in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXSourcesBuildPhase section */
+
+/* Begin XCBuildConfiguration section */
+		0708467F195445A600B5AE3A /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+				CLANG_CXX_LIBRARY = "libc++";
+				CLANG_ENABLE_MODULES = YES;
+				CLANG_ENABLE_OBJC_ARC = YES;
+				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+				CLANG_WARN_EMPTY_BODY = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Telegram.app/Contents/Frameworks";
+				COPY_PHASE_STRIP = NO;
+				GCC_C_LANGUAGE_STANDARD = gnu99;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"DEBUG=1",
+					"$(inherited)",
+				);
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+				GCC_WARN_UNUSED_FUNCTION = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				MACOSX_DEPLOYMENT_TARGET = 10.9;
+				OBJROOT = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)IntermediateUpdater";
+				ONLY_ACTIVE_ARCH = YES;
+				OTHER_CFLAGS = "-D_DEBUG";
+				SDKROOT = macosx;
+				SYMROOT = ../Mac;
+			};
+			name = Debug;
+		};
+		07084680195445A600B5AE3A /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+				CLANG_CXX_LIBRARY = "libc++";
+				CLANG_ENABLE_MODULES = YES;
+				CLANG_ENABLE_OBJC_ARC = YES;
+				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+				CLANG_WARN_EMPTY_BODY = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Telegram.app/Contents/Frameworks";
+				COPY_PHASE_STRIP = YES;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				ENABLE_NS_ASSERTIONS = NO;
+				GCC_C_LANGUAGE_STANDARD = gnu99;
+				GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+				GCC_WARN_UNUSED_FUNCTION = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				MACOSX_DEPLOYMENT_TARGET = 10.9;
+				OBJROOT = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)IntermediateUpdater";
+				SDKROOT = macosx;
+				SYMROOT = ../Mac;
+			};
+			name = Release;
+		};
+		07084682195445A600B5AE3A /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				PRODUCT_NAME = "$(TARGET_NAME)";
+			};
+			name = Debug;
+		};
+		07084683195445A600B5AE3A /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				PRODUCT_NAME = "$(TARGET_NAME)";
+			};
+			name = Release;
+		};
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+		07084673195445A600B5AE3A /* Build configuration list for PBXProject "Updater" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				0708467F195445A600B5AE3A /* Debug */,
+				07084680195445A600B5AE3A /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		07084681195445A600B5AE3A /* Build configuration list for PBXNativeTarget "Updater" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				07084682195445A600B5AE3A /* Debug */,
+				07084683195445A600B5AE3A /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+/* End XCConfigurationList section */
+	};
+	rootObject = 07084670195445A600B5AE3A /* Project object */;
+}
diff --git a/Telegram/_qt_5_3_0_patch/qtbase/src/plugins/platforms/cocoa/qcocoawindow.mm b/Telegram/_qt_5_3_0_patch/qtbase/src/plugins/platforms/cocoa/qcocoawindow.mm
new file mode 100644
index 000000000..11ad1d63a
--- /dev/null
+++ b/Telegram/_qt_5_3_0_patch/qtbase/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -0,0 +1,1778 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia.  For licensing terms and
+** conditions see http://qt.digia.com/licensing.  For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights.  These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "qcocoawindow.h"
+#include "qcocoaintegration.h"
+#include "qnswindowdelegate.h"
+#include "qcocoaautoreleasepool.h"
+#include "qcocoaeventdispatcher.h"
+#include "qcocoaglcontext.h"
+#include "qcocoahelpers.h"
+#include "qcocoanativeinterface.h"
+#include "qnsview.h"
+#include <QtCore/qfileinfo.h>
+#include <QtCore/private/qcore_mac_p.h>
+#include <qwindow.h>
+#include <private/qwindow_p.h>
+#include <qpa/qwindowsysteminterface.h>
+#include <qpa/qplatformscreen.h>
+
+#include <Cocoa/Cocoa.h>
+#include <Carbon/Carbon.h>
+
+#include <QDebug>
+
+enum {
+    defaultWindowWidth = 160,
+    defaultWindowHeight = 160
+};
+
+static bool isMouseEvent(NSEvent *ev)
+{
+    switch ([ev type]) {
+    case NSLeftMouseDown:
+    case NSLeftMouseUp:
+    case NSRightMouseDown:
+    case NSRightMouseUp:
+    case NSMouseMoved:
+    case NSLeftMouseDragged:
+    case NSRightMouseDragged:
+        return true;
+    default:
+        return false;
+    }
+}
+
+@interface NSWindow (CocoaWindowCategory)
+- (NSRect) legacyConvertRectFromScreen:(NSRect) rect;
+@end
+
+@implementation NSWindow (CocoaWindowCategory)
+- (NSRect) legacyConvertRectFromScreen:(NSRect) rect
+{
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
+    if (QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) {
+        return [self convertRectFromScreen: rect];
+    }
+#endif
+    NSRect r = rect;
+    r.origin = [self convertScreenToBase:rect.origin];
+    return r;
+}
+@end
+
+
+@implementation QNSWindowHelper
+
+@synthesize window = _window;
+@synthesize platformWindow = _platformWindow;
+@synthesize grabbingMouse = _grabbingMouse;
+@synthesize releaseOnMouseUp = _releaseOnMouseUp;
+
+- (id)initWithNSWindow:(QCocoaNSWindow *)window platformWindow:(QCocoaWindow *)platformWindow
+{
+    self = [super init];
+    if (self) {
+        _window = window;
+        _platformWindow = platformWindow;
+
+        _window.delegate = [[QNSWindowDelegate alloc] initWithQCocoaWindow:_platformWindow];
+
+        // Prevent Cocoa from releasing the window on close. Qt
+        // handles the close event asynchronously and we want to
+        // make sure that m_nsWindow stays valid until the
+        // QCocoaWindow is deleted by Qt.
+        [_window setReleasedWhenClosed:NO];
+    }
+
+    return self;
+}
+
+- (void)handleWindowEvent:(NSEvent *)theEvent
+{
+    QCocoaWindow *pw = self.platformWindow;
+    if (pw && pw->m_forwardWindow) {
+        if (theEvent.type == NSLeftMouseUp || theEvent.type == NSLeftMouseDragged) {
+            QNSView *forwardView = pw->m_qtView;
+            if (theEvent.type == NSLeftMouseUp) {
+                [forwardView mouseUp:theEvent];
+                pw->m_forwardWindow = 0;
+            } else {
+                [forwardView mouseDragged:theEvent];
+            }
+        }
+
+        if (!pw->m_isNSWindowChild && theEvent.type == NSLeftMouseDown) {
+            pw->m_forwardWindow = 0;
+        }
+    }
+
+    if (theEvent.type == NSLeftMouseDown) {
+        self.grabbingMouse = YES;
+    } else if (theEvent.type == NSLeftMouseUp) {
+        self.grabbingMouse = NO;
+        if (self.releaseOnMouseUp) {
+            [self detachFromPlatformWindow];
+            [self.window release];
+            return;
+        }
+    }
+
+    // The call to -[NSWindow sendEvent] may result in the window being deleted
+    // (e.g., when closing the window by pressing the title bar close button).
+    [self retain];
+    [self.window superSendEvent:theEvent];
+    bool windowStillAlive = self.window != nil; // We need to read before releasing
+    [self release];
+    if (!windowStillAlive)
+        return;
+
+    if (!self.window.delegate)
+        return; // Already detached, pending NSAppKitDefined event
+
+    if (pw && pw->frameStrutEventsEnabled() && pw->m_synchedWindowState != Qt::WindowMinimized && isMouseEvent(theEvent)) {
+        NSPoint loc = [theEvent locationInWindow];
+        NSRect windowFrame = [self.window legacyConvertRectFromScreen:[self.window frame]];
+        NSRect contentFrame = [[self.window contentView] frame];
+        if (NSMouseInRect(loc, windowFrame, NO) &&
+            !NSMouseInRect(loc, contentFrame, NO))
+        {
+            QNSView *contentView = (QNSView *)pw->contentView();
+            [contentView handleFrameStrutMouseEvent: theEvent];
+        }
+    }
+}
+
+- (void)detachFromPlatformWindow
+{
+    [self.window.delegate release];
+    self.window.delegate = nil;
+}
+
+- (void)clearWindow
+{
+    _window = nil;
+}
+
+- (void)dealloc
+{
+    _window = nil;
+    _platformWindow = 0;
+    [super dealloc];
+}
+
+@end
+
+@implementation QNSWindow
+
+@synthesize helper = _helper;
+
+- (id)initWithContentRect:(NSRect)contentRect
+      styleMask:(NSUInteger)windowStyle
+      qPlatformWindow:(QCocoaWindow *)qpw
+{
+    self = [super initWithContentRect:contentRect
+            styleMask:windowStyle
+            backing:NSBackingStoreBuffered
+            defer:NO]; // Deferring window creation breaks OpenGL (the GL context is
+                       // set up before the window is shown and needs a proper window)
+
+    if (self) {
+        _helper = [[QNSWindowHelper alloc] initWithNSWindow:self platformWindow:qpw];
+    }
+    return self;
+}
+
+- (BOOL)canBecomeKeyWindow
+{
+    // Prevent child NSWindows from becoming the key window in
+    // order keep the active apperance of the top-level window.
+    QCocoaWindow *pw = self.helper.platformWindow;
+    if (!pw || pw->m_isNSWindowChild)
+        return NO;
+
+    // The default implementation returns NO for title-bar less windows,
+    // override and return yes here to make sure popup windows such as
+    // the combobox popup can become the key window.
+    return YES;
+}
+
+- (BOOL)canBecomeMainWindow
+{
+    BOOL canBecomeMain = YES; // By default, windows can become the main window
+
+    // Windows with a transient parent (such as combobox popup windows)
+    // cannot become the main window:
+    QCocoaWindow *pw = self.helper.platformWindow;
+    if (!pw || pw->m_isNSWindowChild || pw->window()->transientParent())
+        canBecomeMain = NO;
+
+    return canBecomeMain;
+}
+
+- (void) sendEvent: (NSEvent*) theEvent
+{
+    [self.helper handleWindowEvent:theEvent];
+}
+
+- (void)superSendEvent:(NSEvent *)theEvent
+{
+    [super sendEvent:theEvent];
+}
+
+- (void)closeAndRelease
+{
+    [self close];
+
+    QCocoaIntegration::instance()->setWindow(self, 0);
+
+    if (self.helper.grabbingMouse) {
+        self.helper.releaseOnMouseUp = YES;
+    } else {
+        [self.helper detachFromPlatformWindow];
+        [self release];
+    }
+}
+
+- (void)dealloc
+{
+    [_helper clearWindow];
+    [_helper release];
+    _helper = nil;
+    [super dealloc];
+}
+
+@end
+
+@implementation QNSPanel
+
+@synthesize helper = _helper;
+
+- (id)initWithContentRect:(NSRect)contentRect
+      styleMask:(NSUInteger)windowStyle
+      qPlatformWindow:(QCocoaWindow *)qpw
+{
+    self = [super initWithContentRect:contentRect
+            styleMask:windowStyle
+            backing:NSBackingStoreBuffered
+            defer:NO]; // Deferring window creation breaks OpenGL (the GL context is
+                       // set up before the window is shown and needs a proper window)
+
+    if (self) {
+        _helper = [[QNSWindowHelper alloc] initWithNSWindow:self platformWindow:qpw];
+    }
+    return self;
+}
+
+- (BOOL)canBecomeKeyWindow
+{
+    QCocoaWindow *pw = self.helper.platformWindow;
+    if (!pw)
+        return NO;
+
+    // Only tool or dialog windows should become key:
+    Qt::WindowType type = pw->window()->type();
+    if (type == Qt::Tool || type == Qt::Dialog)
+        return YES;
+
+    return NO;
+}
+
+- (void) sendEvent: (NSEvent*) theEvent
+{
+    [self.helper handleWindowEvent:theEvent];
+}
+
+- (void)superSendEvent:(NSEvent *)theEvent
+{
+    [super sendEvent:theEvent];
+}
+
+- (void)closeAndRelease
+{
+    [self.helper detachFromPlatformWindow];
+    [self close];
+    QCocoaIntegration::instance()->setWindow(self, 0);
+    [self release];
+}
+
+- (void)dealloc
+{
+    [_helper clearWindow];
+    [_helper release];
+    _helper = nil;
+    [super dealloc];
+}
+
+@end
+
+const int QCocoaWindow::NoAlertRequest = -1;
+
+QCocoaWindow::QCocoaWindow(QWindow *tlw)
+    : QPlatformWindow(tlw)
+    , m_contentView(nil)
+    , m_qtView(nil)
+    , m_nsWindow(0)
+    , m_forwardWindow(0)
+    , m_contentViewIsEmbedded(false)
+    , m_contentViewIsToBeEmbedded(false)
+    , m_parentCocoaWindow(0)
+    , m_isNSWindowChild(false)
+    , m_effectivelyMaximized(false)
+    , m_synchedWindowState(Qt::WindowActive)
+    , m_windowModality(Qt::NonModal)
+    , m_windowUnderMouse(false)
+    , m_inConstructor(true)
+    , m_glContext(0)
+    , m_menubar(0)
+    , m_windowCursor(0)
+    , m_hasModalSession(false)
+    , m_frameStrutEventsEnabled(false)
+    , m_geometryUpdateExposeAllowed(false)
+    , m_isExposed(false)
+    , m_registerTouchCount(0)
+    , m_resizableTransientParent(false)
+    , m_hiddenByClipping(false)
+    , m_hiddenByAncestor(false)
+    , m_alertRequest(NoAlertRequest)
+    , monitor(nil)
+    , m_drawContentBorderGradient(false)
+    , m_topContentBorderThickness(0)
+    , m_bottomContentBorderThickness(0)
+    , m_normalGeometry(QRect(0,0,-1,-1))
+{
+#ifdef QT_COCOA_ENABLE_WINDOW_DEBUG
+    qDebug() << "QCocoaWindow::QCocoaWindow" << this;
+#endif
+    QCocoaAutoReleasePool pool;
+
+    if (tlw->type() == Qt::ForeignWindow) {
+        NSView *foreignView = (NSView *)WId(tlw->property("_q_foreignWinId").value<WId>());
+        setContentView(foreignView);
+    } else {
+        m_qtView = [[QNSView alloc] initWithQWindow:tlw platformWindow:this];
+        m_contentView = m_qtView;
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
+        // Enable high-dpi OpenGL for retina displays. Enabling has the side
+        // effect that Cocoa will start calling glViewport(0, 0, width, height),
+        // overriding any glViewport calls in application code. This is usually not a
+        // problem, except if the appilcation wants to have a "custom" viewport.
+        // (like the hellogl example)
+        if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7
+            && tlw->supportsOpenGL()) {
+            BOOL enable = qt_mac_resolveOption(YES, tlw, "_q_mac_wantsBestResolutionOpenGLSurface",
+                                                          "QT_MAC_WANTS_BEST_RESOLUTION_OPENGL_SURFACE");
+            [m_contentView setWantsBestResolutionOpenGLSurface:enable];
+        }
+#endif
+        BOOL enable = qt_mac_resolveOption(NO, tlw, "_q_mac_wantsLayer",
+                                                     "QT_MAC_WANTS_LAYER");
+        [m_contentView setWantsLayer:enable];
+    }
+    setGeometry(tlw->geometry());
+    recreateWindow(parent());
+    tlw->setGeometry(geometry());
+    if (tlw->isTopLevel())
+        setWindowIcon(tlw->icon());
+    m_inConstructor = false;
+}
+
+QCocoaWindow::~QCocoaWindow()
+{
+#ifdef QT_COCOA_ENABLE_WINDOW_DEBUG
+    qDebug() << "QCocoaWindow::~QCocoaWindow" << this;
+#endif
+
+    if (QCocoaIntegration *ci = QCocoaIntegration::instance())
+        ci->setWindow(m_nsWindow, 0);
+
+    QCocoaAutoReleasePool pool;
+    [m_nsWindow setContentView:nil];
+    [m_nsWindow.helper detachFromPlatformWindow];
+    if (m_isNSWindowChild) {
+        if (m_parentCocoaWindow)
+            m_parentCocoaWindow->removeChildWindow(this);
+    } else if (parent()) {
+        [m_contentView removeFromSuperview];
+    } else if (m_qtView) {
+        [[NSNotificationCenter defaultCenter] removeObserver:m_qtView
+                                              name:nil object:m_nsWindow];
+    }
+
+    foreach (QCocoaWindow *child, m_childWindows) {
+       [m_nsWindow removeChildWindow:child->m_nsWindow];
+        child->m_parentCocoaWindow = 0;
+    }
+
+    [m_contentView release];
+    [m_nsWindow release];
+    [m_windowCursor release];
+}
+
+QSurfaceFormat QCocoaWindow::format() const
+{
+    return window()->requestedFormat();
+}
+
+void QCocoaWindow::setGeometry(const QRect &rectIn)
+{
+    QRect rect = rectIn;
+    // This means it is a call from QWindow::setFramePosition() and
+    // the coordinates include the frame (size is still the contents rectangle).
+    if (qt_window_private(const_cast<QWindow *>(window()))->positionPolicy
+            == QWindowPrivate::WindowFrameInclusive) {
+        const QMargins margins = frameMargins();
+        rect.moveTopLeft(rect.topLeft() + QPoint(margins.left(), margins.top()));
+    }
+    if (geometry() == rect)
+        return;
+#ifdef QT_COCOA_ENABLE_WINDOW_DEBUG
+    qDebug() << "QCocoaWindow::setGeometry" << this << rect;
+#endif
+    setCocoaGeometry(rect);
+}
+
+QRect QCocoaWindow::geometry() const
+{
+    // QWindows that are embedded in a NSView hiearchy may be considered
+    // top-level from Qt's point of view but are not from Cocoa's point
+    // of view. Embedded QWindows get global (screen) geometry.
+    if (m_contentViewIsEmbedded) {
+        NSPoint windowPoint = [m_contentView convertPoint:NSMakePoint(0, 0) toView:nil];
+        NSPoint screenPoint = [[m_contentView window] convertBaseToScreen:windowPoint]; // ### use convertRectToScreen after 10.6 removal
+        QPoint position = qt_mac_flipPoint(screenPoint).toPoint();
+        QSize size = qt_mac_toQRect([m_contentView bounds]).size();
+        return QRect(position, size);
+    }
+
+    return QPlatformWindow::geometry();
+}
+
+void QCocoaWindow::setCocoaGeometry(const QRect &rect)
+{
+    QCocoaAutoReleasePool pool;
+
+    if (m_contentViewIsEmbedded) {
+        QPlatformWindow::setGeometry(rect);
+        return;
+    }
+
+    if (m_isNSWindowChild) {
+        QPlatformWindow::setGeometry(rect);
+        NSWindow *parentNSWindow = m_parentCocoaWindow->m_nsWindow;
+        NSRect parentWindowFrame = [parentNSWindow contentRectForFrameRect:parentNSWindow.frame];
+        clipWindow(parentWindowFrame);
+
+        // call this here: updateGeometry in qnsview.mm is a no-op for this case
+        QWindowSystemInterface::handleGeometryChange(window(), rect);
+        QWindowSystemInterface::handleExposeEvent(window(), rect);
+    } else if (m_nsWindow) {
+        NSRect bounds = qt_mac_flipRect(rect);
+        [m_nsWindow setFrame:[m_nsWindow frameRectForContentRect:bounds] display:YES animate:NO];
+    } else {
+        [m_contentView setFrame : NSMakeRect(rect.x(), rect.y(), rect.width(), rect.height())];
+    }
+
+    if (!m_qtView)
+        QPlatformWindow::setGeometry(rect);
+
+    // will call QPlatformWindow::setGeometry(rect) during resize confirmation (see qnsview.mm)
+}
+
+void QCocoaWindow::clipChildWindows()
+{
+    foreach (QCocoaWindow *childWindow, m_childWindows) {
+        childWindow->clipWindow(m_nsWindow.frame);
+    }
+}
+
+void QCocoaWindow::clipWindow(const NSRect &clipRect)
+{
+    if (!m_isNSWindowChild)
+        return;
+
+    NSRect clippedWindowRect = NSZeroRect;
+    if (!NSIsEmptyRect(clipRect)) {
+        NSRect windowFrame = qt_mac_flipRect(QRect(window()->mapToGlobal(QPoint(0, 0)), geometry().size()));
+        clippedWindowRect = NSIntersectionRect(windowFrame, clipRect);
+        // Clipping top/left offsets the content. Move it back.
+        NSPoint contentViewOffset = NSMakePoint(qMax(CGFloat(0), NSMinX(clippedWindowRect) - NSMinX(windowFrame)),
+                                                qMax(CGFloat(0), NSMaxY(windowFrame) - NSMaxY(clippedWindowRect)));
+        [m_contentView setBoundsOrigin:contentViewOffset];
+    }
+
+    if (NSIsEmptyRect(clippedWindowRect)) {
+        if (!m_hiddenByClipping) {
+            // We dont call hide() here as we will recurse further down
+            [m_nsWindow orderOut:nil];
+            m_hiddenByClipping = true;
+        }
+    } else {
+        [m_nsWindow setFrame:clippedWindowRect display:YES animate:NO];
+        if (m_hiddenByClipping) {
+            m_hiddenByClipping = false;
+            if (!m_hiddenByAncestor) {
+                [m_nsWindow orderFront:nil];
+                m_parentCocoaWindow->reinsertChildWindow(this);
+            }
+        }
+    }
+
+    // recurse
+    foreach (QCocoaWindow *childWindow, m_childWindows) {
+        childWindow->clipWindow(clippedWindowRect);
+    }
+}
+
+void QCocoaWindow::hide(bool becauseOfAncestor)
+{
+    bool visible = [m_nsWindow isVisible];
+
+    if (!m_hiddenByAncestor && !visible) // Already explicitly hidden
+        return;
+    if (m_hiddenByAncestor && becauseOfAncestor) // Trying to hide some child again
+        return;
+
+    m_hiddenByAncestor = becauseOfAncestor;
+
+    if (!visible) // Could have been clipped before
+        return;
+
+    foreach (QCocoaWindow *childWindow, m_childWindows)
+        childWindow->hide(true);
+
+    [m_nsWindow orderOut:nil];
+}
+
+void QCocoaWindow::show(bool becauseOfAncestor)
+{
+    if ([m_nsWindow isVisible])
+        return;
+
+    if (m_parentCocoaWindow && ![m_parentCocoaWindow->m_nsWindow isVisible]) {
+        m_hiddenByAncestor = true; // Parent still hidden, don't show now
+    } else if ((becauseOfAncestor == m_hiddenByAncestor) // Was NEITHER explicitly hidden
+               && !m_hiddenByClipping) { // ... NOR clipped
+        if (m_isNSWindowChild) {
+            m_hiddenByAncestor = false;
+            setCocoaGeometry(window()->geometry());
+        }
+        if (!m_hiddenByClipping) { // setCocoaGeometry() can change the clipping status
+            [m_nsWindow orderFront:nil];
+            if (m_isNSWindowChild)
+                m_parentCocoaWindow->reinsertChildWindow(this);
+            foreach (QCocoaWindow *childWindow, m_childWindows)
+                childWindow->show(true);
+        }
+    }
+}
+
+void QCocoaWindow::setVisible(bool visible)
+{
+    if (m_isNSWindowChild && m_hiddenByClipping)
+        return;
+
+    QCocoaAutoReleasePool pool;
+    QCocoaWindow *parentCocoaWindow = 0;
+    if (window()->transientParent())
+        parentCocoaWindow = static_cast<QCocoaWindow *>(window()->transientParent()->handle());
+#ifdef QT_COCOA_ENABLE_WINDOW_DEBUG
+    qDebug() << "QCocoaWindow::setVisible" << window() << visible;
+#endif
+    if (visible) {
+        // We need to recreate if the modality has changed as the style mask will need updating
+        if (m_windowModality != window()->modality())
+            recreateWindow(parent());
+        if (parentCocoaWindow) {
+            // The parent window might have moved while this window was hidden,
+            // update the window geometry if there is a parent.
+            setGeometry(window()->geometry());
+
+            // Register popup windows so that the parent window can close them when needed.
+            if (window()->type() == Qt::Popup || window()->type() == Qt::ToolTip) {
+                // qDebug() << "transientParent and popup" << window()->type() << Qt::Popup << (window()->type() & Qt::Popup);
+                parentCocoaWindow->m_activePopupWindow = window();
+            }
+
+            if (window()->type() == Qt::Popup) {
+                // QTBUG-30266: a window should not be resizable while a transient popup is open
+                // Since this isn't a native popup, the window manager doesn't close the popup when you click outside
+                NSUInteger parentStyleMask = [parentCocoaWindow->m_nsWindow styleMask];
+                if ((m_resizableTransientParent = (parentStyleMask & NSResizableWindowMask))
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
+                    && QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7
+                    && !([parentCocoaWindow->m_nsWindow styleMask] & NSFullScreenWindowMask)
+#endif
+                    )
+                    [parentCocoaWindow->m_nsWindow setStyleMask:parentStyleMask & ~NSResizableWindowMask];
+            }
+
+        }
+
+        // This call is here to handle initial window show correctly:
+        // - top-level windows need to have backing store content ready when the
+        //   window is shown, sendin the expose event here makes that more likely.
+        // - QNSViews for child windows are initialy not hidden and won't get the
+        //   viewDidUnhide message.
+        exposeWindow();
+
+        if (m_nsWindow) {
+            QWindowSystemInterface::flushWindowSystemEvents();
+
+            // setWindowState might have been called while the window was hidden and
+            // will not change the NSWindow state in that case. Sync up here:
+            syncWindowState(window()->windowState());
+
+            if (window()->windowState() != Qt::WindowMinimized) {
+                if ((window()->modality() == Qt::WindowModal
+                     || window()->type() == Qt::Sheet)
+                        && parentCocoaWindow) {
+                    // show the window as a sheet
+                    [NSApp beginSheet:m_nsWindow modalForWindow:parentCocoaWindow->m_nsWindow modalDelegate:nil didEndSelector:nil contextInfo:nil];
+                } else if (window()->modality() != Qt::NonModal) {
+                    // show the window as application modal
+                    QCocoaEventDispatcher *cocoaEventDispatcher = qobject_cast<QCocoaEventDispatcher *>(QGuiApplication::instance()->eventDispatcher());
+                    Q_ASSERT(cocoaEventDispatcher != 0);
+                    QCocoaEventDispatcherPrivate *cocoaEventDispatcherPrivate = static_cast<QCocoaEventDispatcherPrivate *>(QObjectPrivate::get(cocoaEventDispatcher));
+                    cocoaEventDispatcherPrivate->beginModalSession(window());
+                    m_hasModalSession = true;
+                } else if ([m_nsWindow canBecomeKeyWindow]) {
+                    [m_nsWindow makeKeyAndOrderFront:nil];
+                    foreach (QCocoaWindow *childWindow, m_childWindows)
+                        childWindow->show(true);
+                } else {
+                    show();
+                }
+
+                // We want the events to properly reach the popup, dialog, and tool
+                if ((window()->type() == Qt::Popup || window()->type() == Qt::Dialog || window()->type() == Qt::Tool)
+                    && [m_nsWindow isKindOfClass:[NSPanel class]]) {
+                    [(NSPanel *)m_nsWindow setWorksWhenModal:YES];
+                    if (!(parentCocoaWindow && window()->transientParent()->isActive()) && window()->type() == Qt::Popup) {
+                        monitor = [NSEvent addGlobalMonitorForEventsMatchingMask:NSLeftMouseDownMask|NSRightMouseDownMask|NSOtherMouseDown handler:^(NSEvent *) {
+                            QWindowSystemInterface::handleMouseEvent(window(), QPointF(-1, -1), QPointF(window()->framePosition() - QPointF(1, 1)), Qt::LeftButton);
+                        }];
+                    }
+                }
+            }
+        }
+        // In some cases, e.g. QDockWidget, the content view is hidden before moving to its own
+        // Cocoa window, and then shown again. Therefore, we test for the view being hidden even
+        // if it's attached to an NSWindow.
+        if ([m_contentView isHidden])
+            [m_contentView setHidden:NO];
+    } else {
+        // qDebug() << "close" << this;
+        if (m_glContext)
+            m_glContext->windowWasHidden();
+        QCocoaEventDispatcher *cocoaEventDispatcher = qobject_cast<QCocoaEventDispatcher *>(QGuiApplication::instance()->eventDispatcher());
+        QCocoaEventDispatcherPrivate *cocoaEventDispatcherPrivate = 0;
+        if (cocoaEventDispatcher)
+            cocoaEventDispatcherPrivate = static_cast<QCocoaEventDispatcherPrivate *>(QObjectPrivate::get(cocoaEventDispatcher));
+        if (m_nsWindow) {
+            if (m_hasModalSession) {
+                if (cocoaEventDispatcherPrivate)
+                    cocoaEventDispatcherPrivate->endModalSession(window());
+                m_hasModalSession = false;
+            } else {
+                if ([m_nsWindow isSheet])
+                    [NSApp endSheet:m_nsWindow];
+            }
+
+            hide();
+            if (m_nsWindow == [NSApp keyWindow]
+                && !(cocoaEventDispatcherPrivate && cocoaEventDispatcherPrivate->currentModalSession())) {
+                // Probably because we call runModalSession: outside [NSApp run] in QCocoaEventDispatcher
+                // (e.g., when show()-ing a modal QDialog instead of exec()-ing it), it can happen that
+                // the current NSWindow is still key after being ordered out. Then, after checking we
+                // don't have any other modal session left, it's safe to make the main window key again.
+                NSWindow *mainWindow = [NSApp mainWindow];
+                if (mainWindow && [mainWindow canBecomeKeyWindow])
+                    [mainWindow makeKeyWindow];
+            }
+        } else {
+            [m_contentView setHidden:YES];
+        }
+        if (monitor && window()->type() == Qt::Popup) {
+            [NSEvent removeMonitor:monitor];
+            monitor = nil;
+        }
+        if (parentCocoaWindow && window()->type() == Qt::Popup) {
+            parentCocoaWindow->m_activePopupWindow = 0;
+            if (m_resizableTransientParent
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
+                && QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7
+                && !([parentCocoaWindow->m_nsWindow styleMask] & NSFullScreenWindowMask)
+#endif
+                )
+                // QTBUG-30266: a window should not be resizable while a transient popup is open
+                [parentCocoaWindow->m_nsWindow setStyleMask:[parentCocoaWindow->m_nsWindow styleMask] | NSResizableWindowMask];
+        }
+    }
+}
+
+NSInteger QCocoaWindow::windowLevel(Qt::WindowFlags flags)
+{
+    Qt::WindowType type = static_cast<Qt::WindowType>(int(flags & Qt::WindowType_Mask));
+
+    NSInteger windowLevel = NSNormalWindowLevel;
+
+    if (type == Qt::Tool)
+        windowLevel = NSFloatingWindowLevel;
+    else if ((type & Qt::Popup) == Qt::Popup)
+        windowLevel = NSPopUpMenuWindowLevel;
+
+    // StayOnTop window should appear above Tool windows.
+    if (flags & Qt::WindowStaysOnTopHint)
+        windowLevel = NSModalPanelWindowLevel;
+    // Tooltips should appear above StayOnTop windows.
+    if (type == Qt::ToolTip)
+        windowLevel = NSScreenSaverWindowLevel;
+
+    // Any "special" window should be in at least the same level as its parent.
+    if (type != Qt::Window) {
+        const QWindow * const transientParent = window()->transientParent();
+        const QCocoaWindow * const transientParentWindow = transientParent ? static_cast<QCocoaWindow *>(transientParent->handle()) : 0;
+        if (transientParentWindow)
+            windowLevel = qMax([transientParentWindow->m_nsWindow level], windowLevel);
+    }
+
+    return windowLevel;
+}
+
+NSUInteger QCocoaWindow::windowStyleMask(Qt::WindowFlags flags)
+{
+    Qt::WindowType type = static_cast<Qt::WindowType>(int(flags & Qt::WindowType_Mask));
+    NSInteger styleMask = NSBorderlessWindowMask;
+    if (flags & Qt::FramelessWindowHint)
+        return styleMask;
+    if ((type & Qt::Popup) == Qt::Popup) {
+        if (!windowIsPopupType(type))
+            styleMask = (NSUtilityWindowMask | NSResizableWindowMask | NSClosableWindowMask |
+                         NSMiniaturizableWindowMask | NSTitledWindowMask);
+    } else {
+        if (type == Qt::Window && !(flags & Qt::CustomizeWindowHint)) {
+            styleMask = (NSResizableWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSTitledWindowMask);
+        } else if (type == Qt::Dialog) {
+            if (flags & Qt::CustomizeWindowHint) {
+                if (flags & Qt::WindowMaximizeButtonHint)
+                    styleMask = NSResizableWindowMask;
+                if (flags & Qt::WindowTitleHint)
+                    styleMask |= NSTitledWindowMask;
+                if (flags & Qt::WindowCloseButtonHint)
+                    styleMask |= NSClosableWindowMask;
+                if (flags & Qt::WindowMinimizeButtonHint)
+                    styleMask |= NSMiniaturizableWindowMask;
+            } else {
+                styleMask = NSResizableWindowMask | NSClosableWindowMask | NSTitledWindowMask;
+            }
+        } else {
+            if (flags & Qt::WindowMaximizeButtonHint)
+                styleMask |= NSResizableWindowMask;
+            if (flags & Qt::WindowTitleHint)
+                styleMask |= NSTitledWindowMask;
+            if (flags & Qt::WindowCloseButtonHint)
+                styleMask |= NSClosableWindowMask;
+            if (flags & Qt::WindowMinimizeButtonHint)
+                styleMask |= NSMiniaturizableWindowMask;
+        }
+    }
+
+    if (m_drawContentBorderGradient)
+        styleMask |= NSTexturedBackgroundWindowMask;
+
+#ifdef QT_COCOA_ENABLE_WINDOW_DEBUG
+    qDebug("windowStyleMask of '%s': flags %X -> styleMask %lX", qPrintable(window()->title()), (int)flags, styleMask);
+#endif
+    return styleMask;
+}
+
+void QCocoaWindow::setWindowShadow(Qt::WindowFlags flags)
+{
+    bool keepShadow = !(flags & Qt::NoDropShadowWindowHint);
+    [m_nsWindow setHasShadow:(keepShadow ? YES : NO)];
+}
+
+void QCocoaWindow::setWindowZoomButton(Qt::WindowFlags flags)
+{
+    // Disable the zoom (maximize) button for fixed-sized windows and customized
+    // no-WindowMaximizeButtonHint windows. From a Qt perspective it migth be expected
+    // that the button would be removed in the latter case, but disabling it is more
+    // in line with the platform style guidelines.
+    bool fixedSizeNoZoom = (window()->minimumSize().isValid() && window()->maximumSize().isValid()
+                            && window()->minimumSize() == window()->maximumSize());
+    bool customizeNoZoom = ((flags & Qt::CustomizeWindowHint) && !(flags & Qt::WindowMaximizeButtonHint));
+    [[m_nsWindow standardWindowButton:NSWindowZoomButton] setEnabled:!(fixedSizeNoZoom || customizeNoZoom)];
+}
+
+void QCocoaWindow::setWindowFlags(Qt::WindowFlags flags)
+{
+    if (m_nsWindow && !m_isNSWindowChild) {
+        NSUInteger styleMask = windowStyleMask(flags);
+        NSInteger level = this->windowLevel(flags);
+        [m_nsWindow setStyleMask:styleMask];
+        [m_nsWindow setLevel:level];
+        setWindowShadow(flags);
+        if (!(styleMask & NSBorderlessWindowMask)) {
+            setWindowTitle(window()->title());
+        }
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
+        if (QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) {
+            Qt::WindowType type = window()->type();
+            if ((type & Qt::Popup) != Qt::Popup && (type & Qt::Dialog) != Qt::Dialog) {
+                NSWindowCollectionBehavior behavior = [m_nsWindow collectionBehavior];
+                if (flags & Qt::WindowFullscreenButtonHint)
+                    behavior |= NSWindowCollectionBehaviorFullScreenPrimary;
+                else
+                    behavior &= ~NSWindowCollectionBehaviorFullScreenPrimary;
+                [m_nsWindow setCollectionBehavior:behavior];
+            }
+        }
+#endif
+        setWindowZoomButton(flags);
+    }
+
+    m_windowFlags = flags;
+}
+
+void QCocoaWindow::setWindowState(Qt::WindowState state)
+{
+    if (window()->isVisible())
+        syncWindowState(state);  // Window state set for hidden windows take effect when show() is called.
+}
+
+void QCocoaWindow::setWindowTitle(const QString &title)
+{
+    QCocoaAutoReleasePool pool;
+    if (!m_nsWindow)
+        return;
+
+    CFStringRef windowTitle = QCFString::toCFStringRef(title);
+    [m_nsWindow setTitle: const_cast<NSString *>(reinterpret_cast<const NSString *>(windowTitle))];
+    CFRelease(windowTitle);
+}
+
+void QCocoaWindow::setWindowFilePath(const QString &filePath)
+{
+    QCocoaAutoReleasePool pool;
+    if (!m_nsWindow)
+        return;
+
+    QFileInfo fi(filePath);
+    [m_nsWindow setRepresentedFilename: fi.exists() ? QCFString::toNSString(filePath) : @""];
+}
+
+void QCocoaWindow::setWindowIcon(const QIcon &icon)
+{
+    QCocoaAutoReleasePool pool;
+
+    NSButton *iconButton = [m_nsWindow standardWindowButton:NSWindowDocumentIconButton];
+    if (iconButton == nil) {
+        if (icon.isNull())
+            return;
+        NSString *title = QCFString::toNSString(window()->title());
+        [m_nsWindow setRepresentedURL:[NSURL fileURLWithPath:title]];
+        iconButton = [m_nsWindow standardWindowButton:NSWindowDocumentIconButton];
+    }
+    if (icon.isNull()) {
+        [iconButton setImage:nil];
+    } else {
+        QPixmap pixmap = icon.pixmap(QSize(22, 22));
+        NSImage *image = static_cast<NSImage *>(qt_mac_create_nsimage(pixmap));
+        [iconButton setImage:image];
+        [image release];
+    }
+}
+
+void QCocoaWindow::setAlertState(bool enabled)
+{
+    if (m_alertRequest == NoAlertRequest && enabled) {
+        m_alertRequest = [NSApp requestUserAttention:NSCriticalRequest];
+    } else if (m_alertRequest != NoAlertRequest && !enabled) {
+        [NSApp cancelUserAttentionRequest:m_alertRequest];
+        m_alertRequest = NoAlertRequest;
+    }
+}
+
+bool QCocoaWindow::isAlertState() const
+{
+    return m_alertRequest != NoAlertRequest;
+}
+
+void QCocoaWindow::raise()
+{
+    //qDebug() << "raise" << this;
+    // ### handle spaces (see Qt 4 raise_sys in qwidget_mac.mm)
+    if (!m_nsWindow)
+        return;
+    if (m_isNSWindowChild) {
+        QList<QCocoaWindow *> &siblings = m_parentCocoaWindow->m_childWindows;
+        siblings.removeOne(this);
+        siblings.append(this);
+        if (m_hiddenByClipping)
+            return;
+    }
+    if ([m_nsWindow isVisible]) {
+        if (m_isNSWindowChild) {
+            // -[NSWindow orderFront:] doesn't work with attached windows.
+            // The only solution is to remove and add the child window.
+            // This will place it on top of all the other NSWindows.
+            NSWindow *parentNSWindow = m_parentCocoaWindow->m_nsWindow;
+            [parentNSWindow removeChildWindow:m_nsWindow];
+            [parentNSWindow addChildWindow:m_nsWindow ordered:NSWindowAbove];
+        } else {
+            [m_nsWindow orderFront: m_nsWindow];
+            ProcessSerialNumber psn;
+            GetCurrentProcess(&psn);
+            SetFrontProcessWithOptions(&psn, kSetFrontProcessFrontWindowOnly);
+        }
+    }
+}
+
+void QCocoaWindow::lower()
+{
+    if (!m_nsWindow)
+        return;
+    if (m_isNSWindowChild) {
+        QList<QCocoaWindow *> &siblings = m_parentCocoaWindow->m_childWindows;
+        siblings.removeOne(this);
+        siblings.prepend(this);
+        if (m_hiddenByClipping)
+            return;
+    }
+    if ([m_nsWindow isVisible]) {
+        if (m_isNSWindowChild) {
+            // -[NSWindow orderBack:] doesn't work with attached windows.
+            // The only solution is to remove and add all the child windows except this one.
+            // This will keep the current window at the bottom while adding the others on top of it,
+            // hopefully in the same order (this is not documented anywhere in the Cocoa documentation).
+            NSWindow *parentNSWindow = m_parentCocoaWindow->m_nsWindow;
+            NSArray *children = [parentNSWindow.childWindows copy];
+            for (NSWindow *child in children)
+                if (m_nsWindow != child) {
+                    [parentNSWindow removeChildWindow:child];
+                    [parentNSWindow addChildWindow:child ordered:NSWindowAbove];
+                }
+        } else {
+            [m_nsWindow orderBack: m_nsWindow];
+        }
+    }
+}
+
+bool QCocoaWindow::isExposed() const
+{
+    return m_isExposed;
+}
+
+bool QCocoaWindow::isOpaque() const
+{
+    bool translucent = (window()->format().alphaBufferSize() > 0
+                        || window()->opacity() < 1
+                        || (m_qtView && [m_qtView hasMask]));
+    return !translucent;
+}
+
+void QCocoaWindow::propagateSizeHints()
+{
+    QCocoaAutoReleasePool pool;
+    if (!m_nsWindow)
+        return;
+
+#ifdef QT_COCOA_ENABLE_WINDOW_DEBUG
+    qDebug() << "QCocoaWindow::propagateSizeHints" << this;
+    qDebug() << "     min/max " << window()->minimumSize() << window()->maximumSize();
+    qDebug() << "size increment" << window()->sizeIncrement();
+    qDebug() << "     basesize" << window()->baseSize();
+    qDebug() << "     geometry" << geometry();
+#endif
+
+    // Set the minimum content size.
+    const QSize minimumSize = window()->minimumSize();
+    if (!minimumSize.isValid()) // minimumSize is (-1, -1) when not set. Make that (0, 0) for Cocoa.
+        [m_nsWindow setContentMinSize : NSMakeSize(0.0, 0.0)];
+    [m_nsWindow setContentMinSize : NSMakeSize(minimumSize.width(), minimumSize.height())];
+
+    // Set the maximum content size.
+    const QSize maximumSize = window()->maximumSize();
+    [m_nsWindow setContentMaxSize : NSMakeSize(maximumSize.width(), maximumSize.height())];
+
+    // The window may end up with a fixed size; in this case the zoom button should be disabled.
+    setWindowZoomButton(m_windowFlags);
+
+    // sizeIncrement is observed to take values of (-1, -1) and (0, 0) for windows that should be
+    // resizable and that have no specific size increment set. Cocoa expects (1.0, 1.0) in this case.
+    if (!window()->sizeIncrement().isEmpty())
+        [m_nsWindow setResizeIncrements : qt_mac_toNSSize(window()->sizeIncrement())];
+    else
+        [m_nsWindow setResizeIncrements : NSMakeSize(1.0, 1.0)];
+
+    QRect rect = geometry();
+    QSize baseSize = window()->baseSize();
+    if (!baseSize.isNull() && baseSize.isValid()) {
+        [m_nsWindow setFrame:NSMakeRect(rect.x(), rect.y(), baseSize.width(), baseSize.height()) display:YES];
+    }
+}
+
+void QCocoaWindow::setOpacity(qreal level)
+{
+    if (m_nsWindow) {
+        [m_nsWindow setAlphaValue:level];
+        [m_nsWindow setOpaque: isOpaque()];
+    }
+}
+
+void QCocoaWindow::setMask(const QRegion &region)
+{
+    if (m_nsWindow)
+        [m_nsWindow setBackgroundColor:[NSColor clearColor]];
+
+    [m_qtView setMaskRegion:&region];
+    [m_nsWindow setOpaque: isOpaque()];
+}
+
+bool QCocoaWindow::setKeyboardGrabEnabled(bool grab)
+{
+    if (!m_nsWindow)
+        return false;
+
+    if (grab && ![m_nsWindow isKeyWindow])
+        [m_nsWindow makeKeyWindow];
+    else if (!grab && [m_nsWindow isKeyWindow])
+        [m_nsWindow resignKeyWindow];
+    return true;
+}
+
+bool QCocoaWindow::setMouseGrabEnabled(bool grab)
+{
+    if (!m_nsWindow)
+        return false;
+
+    if (grab && ![m_nsWindow isKeyWindow])
+        [m_nsWindow makeKeyWindow];
+    else if (!grab && [m_nsWindow isKeyWindow])
+        [m_nsWindow resignKeyWindow];
+    return true;
+}
+
+WId QCocoaWindow::winId() const
+{
+    return WId(m_contentView);
+}
+
+void QCocoaWindow::setParent(const QPlatformWindow *parentWindow)
+{
+    // recreate the window for compatibility
+    bool unhideAfterRecreate = parentWindow && !m_contentViewIsToBeEmbedded && ![m_contentView isHidden];
+    recreateWindow(parentWindow);
+    if (unhideAfterRecreate)
+        [m_contentView setHidden:NO];
+    setCocoaGeometry(geometry());
+}
+
+NSView *QCocoaWindow::contentView() const
+{
+    return m_contentView;
+}
+
+void QCocoaWindow::setContentView(NSView *contentView)
+{
+    // Remove and release the previous content view
+    [m_contentView removeFromSuperview];
+    [m_contentView release];
+
+    // Insert and retain the new content view
+    [contentView retain];
+    m_contentView = contentView;
+    m_qtView = 0; // The new content view is not a QNSView.
+    recreateWindow(parent()); // Adds the content view to parent NSView
+}
+
+QNSView *QCocoaWindow::qtView() const
+{
+    return m_qtView;
+}
+
+NSWindow *QCocoaWindow::nativeWindow() const
+{
+    return m_nsWindow;
+}
+
+void QCocoaWindow::setEmbeddedInForeignView(bool embedded)
+{
+    m_contentViewIsToBeEmbedded = embedded;
+    // Release any previosly created NSWindow.
+    [m_nsWindow closeAndRelease];
+    m_nsWindow = 0;
+}
+
+void QCocoaWindow::windowWillMove()
+{
+    // Close any open popups on window move
+    if (m_activePopupWindow) {
+        QWindowSystemInterface::handleCloseEvent(m_activePopupWindow);
+        QWindowSystemInterface::flushWindowSystemEvents();
+        m_activePopupWindow = 0;
+    }
+}
+
+void QCocoaWindow::windowDidMove()
+{
+    if (m_isNSWindowChild)
+        return;
+
+    [m_qtView updateGeometry];
+}
+
+void QCocoaWindow::windowDidResize()
+{
+    if (!m_nsWindow)
+        return;
+
+    if (m_isNSWindowChild)
+        return;
+
+    clipChildWindows();
+    [m_qtView updateGeometry];
+}
+
+void QCocoaWindow::windowDidEndLiveResize()
+{
+    if (m_synchedWindowState == Qt::WindowMaximized && ![m_nsWindow isZoomed]) {
+        m_effectivelyMaximized = false;
+        [m_qtView notifyWindowStateChanged:Qt::WindowNoState];
+    }
+}
+
+bool QCocoaWindow::windowShouldClose()
+{
+    bool accepted = false;
+    QWindowSystemInterface::handleCloseEvent(window(), &accepted);
+    QWindowSystemInterface::flushWindowSystemEvents();
+    return accepted;
+}
+
+void QCocoaWindow::setSynchedWindowStateFromWindow()
+{
+    if (QWindow *w = window())
+        m_synchedWindowState = w->windowState();
+}
+
+bool QCocoaWindow::windowIsPopupType(Qt::WindowType type) const
+{
+    if (type == Qt::Widget)
+        type = window()->type();
+    if (type == Qt::Tool)
+        return false; // Qt::Tool has the Popup bit set but isn't, at least on Mac.
+
+    return ((type & Qt::Popup) == Qt::Popup);
+}
+
+void QCocoaWindow::setCurrentContext(QCocoaGLContext *context)
+{
+    m_glContext = context;
+}
+
+QCocoaGLContext *QCocoaWindow::currentContext() const
+{
+    return m_glContext;
+}
+
+void QCocoaWindow::recreateWindow(const QPlatformWindow *parentWindow)
+{
+    bool wasNSWindowChild = m_isNSWindowChild;
+    m_isNSWindowChild = parentWindow && (window()->property("_q_platform_MacUseNSWindow").toBool());
+    bool needsNSWindow = m_isNSWindowChild || !parentWindow;
+
+    QCocoaWindow *oldParentCocoaWindow = m_parentCocoaWindow;
+    m_parentCocoaWindow = const_cast<QCocoaWindow *>(static_cast<const QCocoaWindow *>(parentWindow));
+    if (m_parentCocoaWindow && m_isNSWindowChild) {
+        QWindow *parentQWindow = m_parentCocoaWindow->window();
+        if (!parentQWindow->property("_q_platform_MacUseNSWindow").toBool()) {
+            parentQWindow->setProperty("_q_platform_MacUseNSWindow", QVariant(true));
+            m_parentCocoaWindow->recreateWindow(m_parentCocoaWindow->m_parentCocoaWindow);
+        }
+    }
+
+    bool usesNSPanel = [m_nsWindow isKindOfClass:[QNSPanel class]];
+
+    // No child QNSWindow should notify its QNSView
+    if (m_nsWindow && m_qtView && m_parentCocoaWindow && !oldParentCocoaWindow)
+        [[NSNotificationCenter defaultCenter] removeObserver:m_qtView
+                                              name:nil object:m_nsWindow];
+
+    // Remove current window (if any)
+    if ((m_nsWindow && !needsNSWindow) || (usesNSPanel != shouldUseNSPanel())) {
+        [m_nsWindow closeAndRelease];
+        if (wasNSWindowChild && oldParentCocoaWindow)
+            oldParentCocoaWindow->removeChildWindow(this);
+        m_nsWindow = 0;
+    }
+
+    if (needsNSWindow) {
+        bool noPreviousWindow = m_nsWindow == 0;
+        if (noPreviousWindow)
+            m_nsWindow = createNSWindow();
+
+        // Only non-child QNSWindows should notify their QNSViews
+        // (but don't register more than once).
+        if (m_qtView && (noPreviousWindow || (wasNSWindowChild && !m_isNSWindowChild)))
+            [[NSNotificationCenter defaultCenter] addObserver:m_qtView
+                                                  selector:@selector(windowNotification:)
+                                                  name:nil // Get all notifications
+                                                  object:m_nsWindow];
+
+        if (oldParentCocoaWindow) {
+            if (!m_isNSWindowChild || oldParentCocoaWindow != m_parentCocoaWindow)
+                oldParentCocoaWindow->removeChildWindow(this);
+            m_forwardWindow = oldParentCocoaWindow;
+        }
+
+        setNSWindow(m_nsWindow);
+    }
+
+    if (m_contentViewIsToBeEmbedded) {
+        // An embedded window doesn't have its own NSWindow.
+    } else if (!parentWindow) {
+        // QPlatformWindow subclasses must sync up with QWindow on creation:
+        propagateSizeHints();
+        setWindowFlags(window()->flags());
+        setWindowTitle(window()->title());
+        setWindowState(window()->windowState());
+    } else if (m_isNSWindowChild) {
+        m_nsWindow.styleMask = NSBorderlessWindowMask;
+        m_nsWindow.hasShadow = NO;
+        m_nsWindow.level = NSNormalWindowLevel;
+        NSWindowCollectionBehavior collectionBehavior =
+                NSWindowCollectionBehaviorManaged | NSWindowCollectionBehaviorIgnoresCycle;
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
+        if (QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) {
+            collectionBehavior |= NSWindowCollectionBehaviorFullScreenAuxiliary;
+            m_nsWindow.animationBehavior = NSWindowAnimationBehaviorNone;
+        }
+#endif
+        m_nsWindow.collectionBehavior = collectionBehavior;
+        setCocoaGeometry(window()->geometry());
+
+        QList<QCocoaWindow *> &siblings = m_parentCocoaWindow->m_childWindows;
+        if (siblings.contains(this)) {
+            if (!m_hiddenByClipping)
+                m_parentCocoaWindow->reinsertChildWindow(this);
+        } else {
+            if (!m_hiddenByClipping)
+                [m_parentCocoaWindow->m_nsWindow addChildWindow:m_nsWindow ordered:NSWindowAbove];
+            siblings.append(this);
+        }
+    } else {
+        // Child windows have no NSWindow, link the NSViews instead.
+        [m_parentCocoaWindow->m_contentView addSubview : m_contentView];
+        QRect rect = window()->geometry();
+        // Prevent setting a (0,0) window size; causes opengl context
+        // "Invalid Drawable" warnings.
+        if (rect.isNull())
+            rect.setSize(QSize(1, 1));
+        NSRect frame = NSMakeRect(rect.x(), rect.y(), rect.width(), rect.height());
+        [m_contentView setFrame:frame];
+        [m_contentView setHidden: YES];
+    }
+
+    const qreal opacity = qt_window_private(window())->opacity;
+    if (!qFuzzyCompare(opacity, qreal(1.0)))
+        setOpacity(opacity);
+
+    // top-level QWindows may have an attached NSToolBar, call
+    // update function which will attach to the NSWindow.
+    if (!parentWindow)
+        updateNSToolbar();
+}
+
+void QCocoaWindow::reinsertChildWindow(QCocoaWindow *child)
+{
+    int childIndex = m_childWindows.indexOf(child);
+    Q_ASSERT(childIndex != -1);
+
+    for (int i = childIndex; i < m_childWindows.size(); i++) {
+        NSWindow *nsChild = m_childWindows[i]->m_nsWindow;
+        if (i != childIndex)
+            [m_nsWindow removeChildWindow:nsChild];
+        [m_nsWindow addChildWindow:nsChild ordered:NSWindowAbove];
+    }
+}
+
+void QCocoaWindow::requestActivateWindow()
+{
+    NSWindow *window = [m_contentView window];
+    [ window makeFirstResponder : m_contentView ];
+    [ window makeKeyWindow ];
+}
+
+bool QCocoaWindow::shouldUseNSPanel()
+{
+    Qt::WindowType type = window()->type();
+
+    return !m_isNSWindowChild &&
+           ((type & Qt::Popup) == Qt::Popup || (type & Qt::Dialog) == Qt::Dialog);
+}
+
+QCocoaNSWindow * QCocoaWindow::createNSWindow()
+{
+    QCocoaAutoReleasePool pool;
+
+    QRect rect = initialGeometry(window(), window()->geometry(), defaultWindowWidth, defaultWindowHeight);
+    NSRect frame = qt_mac_flipRect(rect);
+
+    Qt::WindowType type = window()->type();
+    Qt::WindowFlags flags = window()->flags();
+
+    NSUInteger styleMask;
+    if (m_isNSWindowChild) {
+        styleMask = NSBorderlessWindowMask;
+    } else {
+        styleMask = windowStyleMask(flags);
+    }
+    QCocoaNSWindow *createdWindow = 0;
+
+    // Use NSPanel for popup-type windows. (Popup, Tool, ToolTip, SplashScreen)
+    // and dialogs
+    if (shouldUseNSPanel()) {
+        QNSPanel *window;
+        window  = [[QNSPanel alloc] initWithContentRect:frame
+                                    styleMask: styleMask
+                                    qPlatformWindow:this];
+        if ((type & Qt::Popup) == Qt::Popup)
+            [window setHasShadow:YES];
+
+        [window setHidesOnDeactivate:(type & Qt::Tool) == Qt::Tool];
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
+        if (QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) {
+            // Make popup winows show on the same desktop as the parent full-screen window.
+            [window setCollectionBehavior:NSWindowCollectionBehaviorFullScreenAuxiliary];
+
+            if ((type & Qt::Popup) == Qt::Popup)
+                [window setAnimationBehavior:NSWindowAnimationBehaviorUtilityWindow];
+        }
+#endif
+        createdWindow = window;
+    } else {
+        QNSWindow *window;
+        window  = [[QNSWindow alloc] initWithContentRect:frame
+                                     styleMask: styleMask
+                                     qPlatformWindow:this];
+        createdWindow = window;
+    }
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
+    if ([createdWindow respondsToSelector:@selector(setRestorable:)])
+        [createdWindow setRestorable: NO];
+#endif
+
+    NSInteger level = windowLevel(flags);
+    [createdWindow setLevel:level];
+
+    if (window()->format().alphaBufferSize() > 0) {
+        [createdWindow setBackgroundColor:[NSColor clearColor]];
+        [createdWindow setOpaque:NO];
+    }
+
+    m_windowModality = window()->modality();
+
+    applyContentBorderThickness(createdWindow);
+
+    QCocoaIntegration::instance()->setWindow(createdWindow, this);
+
+    return createdWindow;
+}
+
+void QCocoaWindow::setNSWindow(QCocoaNSWindow *window)
+{
+    if (window.contentView != m_contentView) {
+        [m_contentView setPostsFrameChangedNotifications: NO];
+        [window setContentView:m_contentView];
+        [m_contentView setPostsFrameChangedNotifications: YES];
+    }
+}
+
+void QCocoaWindow::removeChildWindow(QCocoaWindow *child)
+{
+    m_childWindows.removeOne(child);
+    [m_nsWindow removeChildWindow:child->m_nsWindow];
+}
+
+// Returns the current global screen geometry for the nswindow associated with this window.
+QRect QCocoaWindow::windowGeometry() const
+{
+    if (!m_nsWindow || m_isNSWindowChild)
+        return geometry();
+
+    NSRect rect = [m_nsWindow frame];
+    QPlatformScreen *onScreen = QPlatformScreen::platformScreenForWindow(window());
+    int flippedY = onScreen->geometry().height() - rect.origin.y - rect.size.height;  // account for nswindow inverted y.
+    QRect qRect = QRect(rect.origin.x, flippedY, rect.size.width, rect.size.height);
+    return qRect;
+}
+
+// Returns a pointer to the parent QCocoaWindow for this window, or 0 if there is none.
+QCocoaWindow *QCocoaWindow::parentCocoaWindow() const
+{
+    if (window() && window()->transientParent()) {
+        return static_cast<QCocoaWindow*>(window()->transientParent()->handle());
+    }
+    return 0;
+}
+
+// Syncs the NSWindow minimize/maximize/fullscreen state with the current QWindow state
+void QCocoaWindow::syncWindowState(Qt::WindowState newState)
+{
+    if (!m_nsWindow)
+        return;
+    // if content view width or height is 0 then the window animations will crash so
+    // do nothing except set the new state
+    NSRect contentRect = [contentView() frame];
+    if (contentRect.size.width <= 0 || contentRect.size.height <= 0) {
+        qWarning() << Q_FUNC_INFO << "invalid window content view size, check your window geometry";
+        m_synchedWindowState = newState;
+        return;
+    }
+
+    Qt::WindowState predictedState = newState;
+
+    if ((m_synchedWindowState & Qt::WindowMinimized) != (newState & Qt::WindowMinimized)) {
+        if (newState & Qt::WindowMinimized) {
+            [m_nsWindow performMiniaturize : m_nsWindow];
+        } else {
+            [m_nsWindow deminiaturize : m_nsWindow];
+        }
+    }
+
+    if ((m_synchedWindowState & Qt::WindowMaximized) != (newState & Qt::WindowMaximized) || (m_effectivelyMaximized && newState == Qt::WindowNoState)) {
+        if ((m_synchedWindowState & Qt::WindowFullScreen) == (newState & Qt::WindowFullScreen)) {
+            [m_nsWindow zoom : m_nsWindow]; // toggles
+            m_effectivelyMaximized = !m_effectivelyMaximized;
+        } else if (!(newState & Qt::WindowMaximized)) {
+            // it would be nice to change the target geometry that toggleFullScreen will animate toward
+            // but there is no known way, so the maximized state is not possible at this time
+            predictedState = static_cast<Qt::WindowState>(static_cast<int>(newState) | Qt::WindowMaximized);
+            m_effectivelyMaximized = true;
+        }
+    }
+
+    if ((m_synchedWindowState & Qt::WindowFullScreen) != (newState & Qt::WindowFullScreen)) {
+        bool fakeFullScreen = true;
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
+        if (QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) {
+            if (window()->flags() & Qt::WindowFullscreenButtonHint) {
+                fakeFullScreen = false;
+                if (m_effectivelyMaximized && m_synchedWindowState == Qt::WindowFullScreen)
+                    predictedState = Qt::WindowMaximized;
+                [m_nsWindow toggleFullScreen : m_nsWindow];
+            }
+        }
+#endif
+        if (fakeFullScreen) {
+            if (newState & Qt::WindowFullScreen) {
+                QScreen *screen = window()->screen();
+                if (screen) {
+                    if (m_normalGeometry.width() < 0) {
+                        m_oldWindowFlags = m_windowFlags;
+                        window()->setFlags(window()->flags() | Qt::FramelessWindowHint);
+                        m_normalGeometry = windowGeometry();
+                        setGeometry(screen->geometry());
+                        m_presentationOptions = [NSApp presentationOptions];
+                        [NSApp setPresentationOptions : m_presentationOptions | NSApplicationPresentationAutoHideMenuBar | NSApplicationPresentationAutoHideDock];
+                    }
+                }
+            } else {
+                window()->setFlags(m_oldWindowFlags);
+                setGeometry(m_normalGeometry);
+                m_normalGeometry.setRect(0, 0, -1, -1);
+                [NSApp setPresentationOptions : m_presentationOptions];
+            }
+        }
+    }
+
+#ifdef QT_COCOA_ENABLE_WINDOW_DEBUG
+    qDebug() << "QCocoaWindow::syncWindowState" << newState << "actual" << predictedState << "was" << m_synchedWindowState << "effectively maximized" << m_effectivelyMaximized;
+#endif
+
+    // New state is now the current synched state
+    m_synchedWindowState = predictedState;
+}
+
+bool QCocoaWindow::setWindowModified(bool modified)
+{
+    if (!m_nsWindow)
+        return false;
+    [m_nsWindow setDocumentEdited:(modified?YES:NO)];
+    return true;
+}
+
+void QCocoaWindow::setMenubar(QCocoaMenuBar *mb)
+{
+    m_menubar = mb;
+}
+
+QCocoaMenuBar *QCocoaWindow::menubar() const
+{
+    return m_menubar;
+}
+
+void QCocoaWindow::setWindowCursor(NSCursor *cursor)
+{
+    // This function is called (via QCocoaCursor) by Qt to set
+    // the cursor for this window. It can be called for a window
+    // that is not currenly under the mouse pointer (for example
+    // for a popup window.) Qt expects the set cursor to "stick":
+    // it should be accociated with the window until a different
+    // cursor is set.
+    if (m_windowCursor != cursor) {
+        [m_windowCursor release];
+        m_windowCursor = [cursor retain];
+    }
+
+    // Use the built in cursor rect API if the QCocoaWindow has a NSWindow.
+    // Othervise, set the cursor if this window is under the mouse. In
+    // this case QNSView::cursorUpdate will set the cursor as the pointer
+    // moves.
+    if (m_nsWindow && m_qtView) {
+        [m_nsWindow invalidateCursorRectsForView : m_qtView];
+    } else {
+        if (m_windowUnderMouse)
+            [cursor set];
+    }
+}
+
+void QCocoaWindow::registerTouch(bool enable)
+{
+    m_registerTouchCount += enable ? 1 : -1;
+    if (enable && m_registerTouchCount == 1)
+        [m_contentView setAcceptsTouchEvents:YES];
+    else if (m_registerTouchCount == 0)
+        [m_contentView setAcceptsTouchEvents:NO];
+}
+
+void QCocoaWindow::setContentBorderThickness(int topThickness, int bottomThickness)
+{
+    m_topContentBorderThickness = topThickness;
+    m_bottomContentBorderThickness = bottomThickness;
+    bool enable = (topThickness > 0 || bottomThickness > 0);
+    m_drawContentBorderGradient = enable;
+
+    applyContentBorderThickness(m_nsWindow);
+}
+
+void QCocoaWindow::registerContentBorderArea(quintptr identifier, int upper, int lower)
+{
+    m_contentBorderAreas.insert(identifier, BorderRange(identifier, upper, lower));
+    applyContentBorderThickness(m_nsWindow);
+}
+
+void QCocoaWindow::setContentBorderAreaEnabled(quintptr identifier, bool enable)
+{
+    m_enabledContentBorderAreas.insert(identifier, enable);
+    applyContentBorderThickness(m_nsWindow);
+}
+
+void QCocoaWindow::setContentBorderEnabled(bool enable)
+{
+    m_drawContentBorderGradient = enable;
+    applyContentBorderThickness(m_nsWindow);
+}
+
+void QCocoaWindow::applyContentBorderThickness(NSWindow *window)
+{
+    if (!window)
+        return;
+
+    if (!m_drawContentBorderGradient) {
+        [window setStyleMask:[window styleMask] & ~NSTexturedBackgroundWindowMask];
+        return;
+    }
+
+    // Find consecutive registered border areas, starting from the top.
+    QList<BorderRange> ranges = m_contentBorderAreas.values();
+    std::sort(ranges.begin(), ranges.end());
+    int effectiveTopContentBorderThickness = m_topContentBorderThickness;
+    foreach (BorderRange range, ranges) {
+        // Skip disiabled ranges (typically hidden tool bars)
+        if (!m_enabledContentBorderAreas.value(range.identifier, false))
+            continue;
+
+        // Is this sub-range adjacent to or overlaping the
+        // existing total border area range? If so merge
+        // it into the total range,
+        if (range.upper <= (effectiveTopContentBorderThickness + 1))
+            effectiveTopContentBorderThickness = qMax(effectiveTopContentBorderThickness, range.lower);
+        else
+            break;
+    }
+
+    int effectiveBottomContentBorderThickness = m_bottomContentBorderThickness;
+
+    [window setStyleMask:[window styleMask] | NSTexturedBackgroundWindowMask];
+
+    [window setContentBorderThickness:effectiveTopContentBorderThickness forEdge:NSMaxYEdge];
+    [window setAutorecalculatesContentBorderThickness:NO forEdge:NSMaxYEdge];
+
+    [window setContentBorderThickness:effectiveBottomContentBorderThickness forEdge:NSMinYEdge];
+    [window setAutorecalculatesContentBorderThickness:NO forEdge:NSMinYEdge];
+}
+
+void QCocoaWindow::updateNSToolbar()
+{
+    if (!m_nsWindow)
+        return;
+
+    NSToolbar *toolbar = QCocoaIntegration::instance()->toolbar(window());
+
+    if ([m_nsWindow toolbar] == toolbar)
+       return;
+
+    [m_nsWindow setToolbar: toolbar];
+    [m_nsWindow setShowsToolbarButton:YES];
+}
+
+bool QCocoaWindow::testContentBorderAreaPosition(int position) const
+{
+    return m_nsWindow && m_drawContentBorderGradient &&
+            0 <= position && position < [m_nsWindow contentBorderThicknessForEdge: NSMaxYEdge];
+}
+
+qreal QCocoaWindow::devicePixelRatio() const
+{
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
+    if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) {
+        NSWindow* window = [m_contentView window];
+        if (window) {
+          return qreal([window backingScaleFactor]);
+        } else {
+          return 1.0;
+        }
+    } else
+#endif
+    {
+        return 1.0;
+    }
+}
+
+// Returns whether the window can be expose, which it can
+// if it is on screen and has a valid geometry.
+bool QCocoaWindow::isWindowExposable()
+{
+    QSize size = geometry().size();
+    bool validGeometry = (size.width() > 0 && size.height() > 0);
+    bool validScreen = ([[m_contentView window] screen] != 0);
+    bool nonHiddenSuperView = ![[m_contentView superview] isHidden];
+    return (validGeometry && validScreen && nonHiddenSuperView);
+}
+
+// Exposes the window by posting an expose event to QWindowSystemInterface
+void QCocoaWindow::exposeWindow()
+{
+    m_geometryUpdateExposeAllowed = true;
+
+    if (!isWindowExposable())
+        return;
+
+    if (!m_isExposed) {
+        m_isExposed = true;
+        m_exposedGeometry = geometry();
+        m_exposedDevicePixelRatio = devicePixelRatio();
+        QWindowSystemInterface::handleExposeEvent(window(), QRegion(geometry()));
+    }
+}
+
+// Obscures the window by posting an empty expose event to QWindowSystemInterface
+void QCocoaWindow::obscureWindow()
+{
+    if (m_isExposed) {
+        m_geometryUpdateExposeAllowed = false;
+        m_isExposed = false;
+        QWindowSystemInterface::handleExposeEvent(window(), QRegion());
+    }
+}
+
+// Updates window geometry by posting an expose event to QWindowSystemInterface
+void QCocoaWindow::updateExposedGeometry()
+{
+    // updateExposedGeometry is not allowed to send the initial expose. If you want
+    // that call exposeWindow();
+    if (!m_geometryUpdateExposeAllowed)
+        return;
+
+    if (!isWindowExposable())
+        return;
+
+    if (m_exposedGeometry == geometry() && m_exposedDevicePixelRatio == devicePixelRatio())
+        return;
+
+    m_isExposed = true;
+    m_exposedGeometry = geometry();
+    m_exposedDevicePixelRatio = devicePixelRatio();
+    QWindowSystemInterface::handleExposeEvent(window(), QRegion(geometry()));
+}
+
+QWindow *QCocoaWindow::childWindowAt(QPoint windowPoint)
+{
+    QWindow *targetWindow = window();
+    foreach (QObject *child, targetWindow->children())
+        if (QWindow *childWindow = qobject_cast<QWindow *>(child))
+            if (QPlatformWindow *handle = childWindow->handle())
+                if (handle->isExposed() && childWindow->geometry().contains(windowPoint))
+                    targetWindow = static_cast<QCocoaWindow*>(handle)->childWindowAt(windowPoint - childWindow->position());
+
+    return targetWindow;
+}
+
+QMargins QCocoaWindow::frameMargins() const
+{
+    NSRect frameW = [m_nsWindow frame];
+    NSRect frameC = [m_nsWindow contentRectForFrameRect:frameW];
+
+    return QMargins(frameW.origin.x - frameC.origin.x,
+        (frameW.origin.y + frameW.size.height) - (frameC.origin.y + frameC.size.height),
+        (frameW.origin.x + frameW.size.width) - (frameC.origin.x + frameC.size.width),
+        frameC.origin.y - frameW.origin.y);
+}
+
+void QCocoaWindow::setFrameStrutEventsEnabled(bool enabled)
+{
+    m_frameStrutEventsEnabled = enabled;
+}
diff --git a/Telegram/metaemoji_plugin_import.cpp b/Telegram/metaemoji_plugin_import.cpp
new file mode 100644
index 000000000..7c0d09542
--- /dev/null
+++ b/Telegram/metaemoji_plugin_import.cpp
@@ -0,0 +1,13 @@
+// This file is autogenerated by qmake. It imports static plugin classes for
+// static plugins specified using QTPLUGIN and QT_PLUGIN_CLASS.<plugin> variables.
+#include <QtPlugin>
+Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin)
+Q_IMPORT_PLUGIN(QDDSPlugin)
+Q_IMPORT_PLUGIN(QICNSPlugin)
+Q_IMPORT_PLUGIN(QICOPlugin)
+Q_IMPORT_PLUGIN(QJp2Plugin)
+Q_IMPORT_PLUGIN(QMngPlugin)
+Q_IMPORT_PLUGIN(QTgaPlugin)
+Q_IMPORT_PLUGIN(QTiffPlugin)
+Q_IMPORT_PLUGIN(QWbmpPlugin)
+Q_IMPORT_PLUGIN(QWebpPlugin)
diff --git a/Telegram/packer_plugin_import.cpp b/Telegram/packer_plugin_import.cpp
new file mode 100644
index 000000000..7c0d09542
--- /dev/null
+++ b/Telegram/packer_plugin_import.cpp
@@ -0,0 +1,13 @@
+// This file is autogenerated by qmake. It imports static plugin classes for
+// static plugins specified using QTPLUGIN and QT_PLUGIN_CLASS.<plugin> variables.
+#include <QtPlugin>
+Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin)
+Q_IMPORT_PLUGIN(QDDSPlugin)
+Q_IMPORT_PLUGIN(QICNSPlugin)
+Q_IMPORT_PLUGIN(QICOPlugin)
+Q_IMPORT_PLUGIN(QJp2Plugin)
+Q_IMPORT_PLUGIN(QMngPlugin)
+Q_IMPORT_PLUGIN(QTgaPlugin)
+Q_IMPORT_PLUGIN(QTiffPlugin)
+Q_IMPORT_PLUGIN(QWbmpPlugin)
+Q_IMPORT_PLUGIN(QWebpPlugin)
diff --git a/XCODE.md b/XCODE.md
new file mode 100644
index 000000000..8d4865014
--- /dev/null
+++ b/XCODE.md
@@ -0,0 +1,97 @@
+##Build instructions for Xcode 5.1.1
+
+###Prepare folder
+
+Choose a folder for the future build, for example **/Users/user/TBuild** There you will have two folders, **Libraries** for third-party libs and **tdesktop** (or **tdesktop-master**) for the app.
+
+###Clone source code
+
+By git – in Terminal go to **/Users/user/TBuild** and run
+
+     git clone https://github.com/telegramdesktop/tdesktop.git
+
+or download in ZIP and extract to **/Users/user/TBuild** rename **tdesktop-master** to **tdesktop** to have **/Users/user/TBuild/tdesktop/Telegram/Telegram.xcodeproj** project
+
+###Prepare libraries
+
+####OpenSSL 1.0.1g
+
+Get sources from https://github.com/telegramdesktop/openssl-xcode, by git – in Terminal go to **/Users/user/TBuild/Libraries** and run
+
+    git clone https://github.com/telegramdesktop/openssl-xcode.git
+
+or download in ZIP and extract to **/Users/user/TBuild/Libraries**, rename **openssl-xcode-master** to **openssl-xcode** to have **/Users/user/TBuild/Libraries/openssl-xcode/openssl.xcodeproj** project
+
+http://www.openssl.org/source/ > Download [**openssl-1.0.1h.tar.gz**](http://www.openssl.org/source/openssl-1.0.1h.tar.gz) (4.3 Mb)
+
+Extract openssl-1.0.1h.tar.gz and copy everything from **openssl-1.0.1h** to **/Users/user/TBuild/Libraries/openssl-xcode** to have **/Users/user/TBuild/Libraries/openssl-xcode/include**
+
+#####Building library
+
+* Open **/Users/user/TBuild/Libraries/openssl-xcode/openssl.xcodeproj** with Xcode
+* Product > Build
+
+####liblzma
+
+http://tukaani.org/xz/ > Download [**xz-5.0.5.tar.gz](http://tukaani.org/xz/xz-5.0.5.tar.gz)
+
+Extract to **/Users/user/TBuild/Libraries**
+
+#####Building library
+
+* in Terminal go to **/Users/user/TBuild/Libraries/xz-5.0.5**
+* there run
+
+    ./configure
+    make
+    sudo make install
+
+####zlib 1.2.8
+
+Using se system lib
+
+####libexif 0.6.20
+
+Get sources from https://github.com/telegramdesktop/libexif-0.6.20, by git – in Terminal go to **/Users/user/TBuild/Libraries** and run
+
+    git clone https://github.com/telegramdesktop/libexif-0.6.20.git
+
+or download in ZIP and extract to **/Users/user/TBuild/Libraries**, rename **libexif-0.6.20-master** to **libexif-0.6.20** to have **/Users/user/TBuild/Libraries/libexif-0.6.20/configure** script
+
+#####Building library
+
+* in Terminal go to **/Users/user/TBuild/Libraries/libexif-0.6.20**
+* there run
+
+    ./configure
+    make
+    sudo make install
+
+####Qt 5.3.0, slightly patched
+
+http://download.qt-project.org/official_releases/qt/5.3/5.3.0/single/qt-everywhere-opensource-src-5.3.0.tar.gz
+
+Extract to **/Users/user/TBuild/Libraries**, rename **qt-everywhere-opensource-src-5.3.0** to **QtStatic** to have **/Users/user/TBuild/Libraries/QtStatic/qtbase** folder
+
+Apply patch – copy (with overwrite!) everything from **/Users/user/TBuild/tdesktop/\_qt\_5\_3\_0\_patch/** to **/Users/user/TBuild/Libraries/QtStatic/**
+
+#####Building library
+
+* in Terminal go to **/Users/user/TBuild/Libraries/QtStatic**
+* there run
+
+    ./configure -debug-and-release -opensource -static -opengl desktop -nomake examples -platform macx-clang
+    y
+    make
+    sudo make install
+
+building (**make** command) will take really long time.
+
+###Building Telegram Desktop
+
+* Launch Xcode, all projects will be taken from **/Users/user/TBuild/tdesktop/Telegram**
+* Open MetaStyle.xcodeproj and build for Debug (Release optionally)
+* Open MetaEmoji.xcodeproj and build for Debug (Release optionally)
+* Open MetaLang.xcodeproj and build for Debug (Release optionally)
+* Open Telegram.xcodeproj and build for Debug
+* Release Telegram build will require removing **CUSTOM_API_ID** definition in Telegram target settings (Apple LLVM 5.1 - Custom Compiler Flags > Other C / C++ Flags > Release)
diff --git a/build-msvc2013.txt b/build-msvc2013.txt
deleted file mode 100644
index 18e8ebd5e..000000000
--- a/build-msvc2013.txt
+++ /dev/null
@@ -1,141 +0,0 @@
-Build with Visual Studio 2013, Windows 8.1
-
-Prepare folder:
-
-  Choose folder for future build, for example "D:\TBuild\".
-  There you will have two folders, "Libraries" for third-party libs and "tdesktop" for the app.
-
-Clone sources:
-
-  - By git: in Git Bash go to "/d/tbuild" and run "git clone https://github.com/telegramdesktop/tdesktop.git"
-  - Or download in ZIP and extract to "D:\TBuild\", rename "tdesktop-master" to "tdesktop" to have "D:\TBuild\tdesktop\Telegram.sln" solution
-
-Prepare libraries:
-
-OpenSSL (1.0.1g)
-
-  https://www.openssl.org/related/binaries.html > "OpenSSL for Windows" > "Win32 OpenSSL v1.0.1g" (16 Mb)
-  - Install to "D:\TBuild\Libraries\OpenSSL-Win32", while installing "Copy OpenSSL DLLs to" choose "The OpenSSL binaries (/bin) directory"
-
-LZMA (9.20)
-
-  http://www.7-zip.org/sdk.html > Download 9.20 "LZMA SDK (C, C++, C#, Java)"
-  - Extract to "D:\TBuild\Libraries\lzma\"
-
-  Building Lib:
-
-    - Open "D:\TBuild\Libraries\lzma\C\Util\LzmaLib\LzmaLib.dsw" with Visual Studio 2013 > One-way upgrade OK
-    - For Debug and Release configurations:
-      - LzmaLib Properties > General > Configuration Type = "Static library (.lib)" > OK
-      - LzmaLib Properties > Librarian > General > Target Machine = "MachineX86 (/MACHINE:X86)" > OK
-    - Build Debug
-    - Build Release
-
-zlib (1.2.8)
-
-  http://www.zlib.net/ > "zlib source code, version 1.2.8, zipfile format" > http://zlib.net/zlib128.zip
-  - Extract to "D:\TBuild\Libraries\"
-
-  Building Lib:
-    - Open "D:\TBuild\Libraries\zlib-1.2.8\contrib\vstudio\vc11\zlibvc.sln" > Upgrade .. > OK
-    - We are interested in only "zlibstat" project, but it depends on some custom pre-build step
-    - For Debug configuration:
-      - zlibstat Properties > C/C++ > Code Generation > Runtime Library = "Multi-threaded Debug (/MTd)" > OK
-    - For Release configuration:
-      - zlibstat Properties > C/C++ > Code Generation > Runtime Library = "Multi-threaded (/MT)" > OK
-    - Build Solution for Debug - only "zlibstat" project build successfully, and we need only it
-    - Build Solution for Release - only "zlibstat" project build successfully, and we need only it
-
-libexif (0.6.20) - prepared
-
-  https://github.com/telegramdesktop/libexif-0.6.20
-  - By git: in Git Bash go to "/d/tbuild/libraries" and run "git clone https://github.com/telegramdesktop/libexif-0.6.20.git"
-  - Or download in ZIP and extract to "D:\TBuild\Libraries\", rename "libexif-0.6.20-master" to "libexif-0.6.20" to have "D:\TBuild\Libraries\libexif-0.6.20\win32\lib_exif.sln" solution
-
-  Building Lib:
-    - Open "D:\TBuild\Libraries\libexif-0.6.20\win32\lib_exif.sln"
-    - Build Debug
-    - Build Release
-
-Qt (5.3.0)
-
-  http://download.qt-project.org/official_releases/qt/5.3/5.3.0/single/qt-everywhere-opensource-src-5.3.0.zip
-  - Extract to "D:\TBuild\Libraries\Tmp\"
-  - Copy everything from "D:\TBuild\Libraries\Tmp\qt-everywhere-opensource-src-5.3.0" to "D:\TBuild\Libraries\QtStatic"
-  - Copy (with overwrite) everything from "D:\TBuild\tdesktop\_qt_5_3_0_patch" to "D:\TBuild\Libraries\QtStatic"
-
-  Building Lib:
-
-    - Install Python (3.3.2) from https://www.python.org/download/releases/3.3.2 > "Windows x86 MSI Installer (3.3.2)" (https://www.python.org/ftp/python/3.3.2/python-3.3.2.msi)
-    - Open "VS2013 x86 Native Tools Command Prompt.bat" (should be in "\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\Shortcuts")
-
-    Go to Qt directory ("D:" > Enter > "cd TBuild\Libraries\QtStatic" > Enter) and run "configure -debug-and-release -opensource -static -opengl desktop -mp -nomake examples -platform win32-msvc2013", then "y" (accept), after configuration is complete run "nmake" and then "nmake install", nmake will take really long time.
-
-Qt Visual Studio Addin 1.2.3
-
-  http://download.qt-project.org/official_releases/vsaddin/qt-vs-addin-1.2.3-opensource.exe
-  - Install to default location
-
-Building Telegram Desktop:
-
-  - Launch Microsoft Visual Studio 2013
-  - QT5 > Qt Options > Add:
-    Version name: QtStatic.5.3.0
-    Path: D:\TBuild\Libraries\QtStatic\qtbase
-  - Default Qt/Win version: QtStatic.5.3.0 > OK
-  - File > Open > Project/Solution > D:\TBuild\tdesktop\Telegram.sln
-  - Build > Build Solution
-
-Projects in Telegram solution:
-
-  Telegram:
-    tdesktop messenger
-
-  Updater:
-    little app, that is launched by Telegram when update is ready, replaces all files and launches it back
-
-  Packer:
-    compiles given files to single update file, compresses it with lzma and signs with a private key,
-    it was not included to Telegram solution, because private key is inaccessible
-
-  Prepare:
-    prepares a release for deployment: puts all files to deploy/{version} folder
-      current tsetup{version}exe installer
-      current Telegram.exe
-      current Telegram.pdb (debug info for crash minidumps view)
-      current tupdate{updversion} binary lzma update archive
-
-  MetaEmoji:
-    from two folders
-      SourceFiles/art/Emoji
-      SourceFiles/art/Emoji_200x
-    and some inner config creates four sprites and text2emoji replace code:
-      SourceFiles/art/emoji.png
-      SourceFiles/art/emoji_125x.png
-      SourceFiles/art/emoji_150x.png
-      SourceFiles/art/emoji_200x.png
-      SourceFiles/gui/emoji_config.cpp
-
-  MetaStyle:
-    from two files and two sprites
-      Resources/style_classes.txt
-      Resources/style.txt
-      SourceFiles/art/sprite.png
-      SourceFiles/art/sprite_200x.png
-    creates two other sprites, four sprite grids and style constants code:
-      SourceFiles/art/sprite_125x.png
-      SourceFiles/art/sprite_150x.png
-      SourceFiles/art/grid.png
-      SourceFiles/art/grid_125x.png
-      Sourcefiles/art/grid_150x.png
-      SourceFiles/art/grid_200x.png
-      GeneratedFiles/style_classes.h
-      GeneratedFiles/style_auto.h
-      GeneratedFiles/style_auto.cpp
-
-  MetaLang:
-    from langpack file
-      Resources/lang.txt
-    creates lang constants code and lang file parse code:
-      GeneratedFiles/lang.h
-      GeneratedFiles/lang.cpp