mirror of https://github.com/procxx/kepka.git
				
				
				
			Merge branch 'master' into games
This commit is contained in:
		
						commit
						578cf4ed61
					
				|  | @ -34,8 +34,8 @@ IDI_ICON1               ICON                    "..\\art\\icon256.ico" | ||||||
| // | // | ||||||
| 
 | 
 | ||||||
| VS_VERSION_INFO VERSIONINFO | VS_VERSION_INFO VERSIONINFO | ||||||
|  FILEVERSION 0,10,5,0 |  FILEVERSION 0,10,6,0 | ||||||
|  PRODUCTVERSION 0,10,5,0 |  PRODUCTVERSION 0,10,6,0 | ||||||
|  FILEFLAGSMASK 0x3fL |  FILEFLAGSMASK 0x3fL | ||||||
| #ifdef _DEBUG | #ifdef _DEBUG | ||||||
|  FILEFLAGS 0x1L |  FILEFLAGS 0x1L | ||||||
|  | @ -51,10 +51,10 @@ BEGIN | ||||||
|         BLOCK "040904b0" |         BLOCK "040904b0" | ||||||
|         BEGIN |         BEGIN | ||||||
|             VALUE "CompanyName", "Telegram Messenger LLP" |             VALUE "CompanyName", "Telegram Messenger LLP" | ||||||
|             VALUE "FileVersion", "0.10.5.0" |             VALUE "FileVersion", "0.10.6.0" | ||||||
|             VALUE "LegalCopyright", "Copyright (C) 2014-2016" |             VALUE "LegalCopyright", "Copyright (C) 2014-2016" | ||||||
|             VALUE "ProductName", "Telegram Desktop" |             VALUE "ProductName", "Telegram Desktop" | ||||||
|             VALUE "ProductVersion", "0.10.5.0" |             VALUE "ProductVersion", "0.10.6.0" | ||||||
|         END |         END | ||||||
|     END |     END | ||||||
|     BLOCK "VarFileInfo" |     BLOCK "VarFileInfo" | ||||||
|  |  | ||||||
|  | @ -25,8 +25,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US | ||||||
| // | // | ||||||
| 
 | 
 | ||||||
| VS_VERSION_INFO VERSIONINFO | VS_VERSION_INFO VERSIONINFO | ||||||
|  FILEVERSION 0,10,5,0 |  FILEVERSION 0,10,6,0 | ||||||
|  PRODUCTVERSION 0,10,5,0 |  PRODUCTVERSION 0,10,6,0 | ||||||
|  FILEFLAGSMASK 0x3fL |  FILEFLAGSMASK 0x3fL | ||||||
| #ifdef _DEBUG | #ifdef _DEBUG | ||||||
|  FILEFLAGS 0x1L |  FILEFLAGS 0x1L | ||||||
|  | @ -43,10 +43,10 @@ BEGIN | ||||||
|         BEGIN |         BEGIN | ||||||
|             VALUE "CompanyName", "Telegram Messenger LLP" |             VALUE "CompanyName", "Telegram Messenger LLP" | ||||||
|             VALUE "FileDescription", "Telegram Updater" |             VALUE "FileDescription", "Telegram Updater" | ||||||
|             VALUE "FileVersion", "0.10.5.0" |             VALUE "FileVersion", "0.10.6.0" | ||||||
|             VALUE "LegalCopyright", "Copyright (C) 2014-2016" |             VALUE "LegalCopyright", "Copyright (C) 2014-2016" | ||||||
|             VALUE "ProductName", "Telegram Desktop" |             VALUE "ProductName", "Telegram Desktop" | ||||||
|             VALUE "ProductVersion", "0.10.5.0" |             VALUE "ProductVersion", "0.10.6.0" | ||||||
|         END |         END | ||||||
|     END |     END | ||||||
|     BLOCK "VarFileInfo" |     BLOCK "VarFileInfo" | ||||||
|  |  | ||||||
|  | @ -160,6 +160,21 @@ int main(int argc, const char * argv[]) { | ||||||
| 
 | 
 | ||||||
| 		writeLog([@"Starting update files iteration, path: " stringByAppendingString: srcEnum]); | 		writeLog([@"Starting update files iteration, path: " stringByAppendingString: srcEnum]); | ||||||
| 
 | 
 | ||||||
|  | 		// Take the Updater (this currently running binary) from the place where it was placed by Telegram | ||||||
|  | 		// and copy it to the folder with the new version of the app (ready), | ||||||
|  | 		// so it won't be deleted when we will clear the "Telegram.app/Contents" folder. | ||||||
|  | 		NSString *oldVersionUpdaterPath = [appDirFull stringByAppendingString: @"/Contents/Frameworks/Updater" ]; | ||||||
|  | 		NSString *newVersionUpdaterPath = [srcEnum stringByAppendingString:[[NSArray arrayWithObjects:@"/", appName, @"/Contents/Frameworks/Updater", nil] componentsJoinedByString:@""]]; | ||||||
|  | 		writeLog([[NSArray arrayWithObjects: @"Copying Updater from old path ", oldVersionUpdaterPath, @" to new path ", newVersionUpdaterPath, nil] componentsJoinedByString:@""]); | ||||||
|  | 		if (![fileManager fileExistsAtPath:newVersionUpdaterPath]) { | ||||||
|  | 			if (![fileManager copyItemAtPath:oldVersionUpdaterPath toPath:newVersionUpdaterPath error:nil]) { | ||||||
|  | 				writeLog([[NSArray arrayWithObjects: @"Failed to copy file from ", oldVersionUpdaterPath, @" to ", newVersionUpdaterPath, nil] componentsJoinedByString:@""]); | ||||||
|  | 				delFolder(); | ||||||
|  | 				return -1; | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| 		NSString *contentsPath = [appDirFull stringByAppendingString: @"/Contents"]; | 		NSString *contentsPath = [appDirFull stringByAppendingString: @"/Contents"]; | ||||||
| 		writeLog([[NSArray arrayWithObjects: @"Clearing dir ", contentsPath, nil] componentsJoinedByString:@""]); | 		writeLog([[NSArray arrayWithObjects: @"Clearing dir ", contentsPath, nil] componentsJoinedByString:@""]); | ||||||
| 		if (![fileManager removeItemAtPath:contentsPath error:nil]) { | 		if (![fileManager removeItemAtPath:contentsPath error:nil]) { | ||||||
|  |  | ||||||
|  | @ -126,6 +126,13 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv) { | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | bool Application::event(QEvent *e) { | ||||||
|  | 	if (e->type() == QEvent::Close) { | ||||||
|  | 		App::quit(); | ||||||
|  | 	} | ||||||
|  | 	return QApplication::event(e); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void Application::socketConnected() { | void Application::socketConnected() { | ||||||
| 	LOG(("Socket connected, this is not the first application instance, sending show command...")); | 	LOG(("Socket connected, this is not the first application instance, sending show command...")); | ||||||
| 	_secondInstance = true; | 	_secondInstance = true; | ||||||
|  |  | ||||||
|  | @ -28,12 +28,12 @@ class Application : public QApplication { | ||||||
| 	Q_OBJECT | 	Q_OBJECT | ||||||
| 
 | 
 | ||||||
| public: | public: | ||||||
| 
 |  | ||||||
| 	Application(int &argc, char **argv); | 	Application(int &argc, char **argv); | ||||||
| 
 | 
 | ||||||
|  | 	bool event(QEvent *e) override; | ||||||
|  | 
 | ||||||
| // Single instance application
 | // Single instance application
 | ||||||
| public slots: | public slots: | ||||||
| 
 |  | ||||||
| 	void socketConnected(); | 	void socketConnected(); | ||||||
| 	void socketError(QLocalSocket::LocalSocketError e); | 	void socketError(QLocalSocket::LocalSocketError e); | ||||||
| 	void socketDisconnected(); | 	void socketDisconnected(); | ||||||
|  | @ -48,7 +48,6 @@ public slots: | ||||||
| 	void closeApplication(); // will be done in aboutToQuit()
 | 	void closeApplication(); // will be done in aboutToQuit()
 | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
| 
 |  | ||||||
| 	typedef QPair<QLocalSocket*, QByteArray> LocalClient; | 	typedef QPair<QLocalSocket*, QByteArray> LocalClient; | ||||||
| 	typedef QList<LocalClient> LocalClients; | 	typedef QList<LocalClient> LocalClients; | ||||||
| 
 | 
 | ||||||
|  | @ -64,7 +63,6 @@ private: | ||||||
| 
 | 
 | ||||||
| // Autoupdating
 | // Autoupdating
 | ||||||
| public: | public: | ||||||
| 
 |  | ||||||
| 	void startUpdateCheck(bool forceWait); | 	void startUpdateCheck(bool forceWait); | ||||||
| 	void stopUpdate(); | 	void stopUpdate(); | ||||||
| 
 | 
 | ||||||
|  | @ -78,7 +76,6 @@ public: | ||||||
| 	int32 updatingReady(); | 	int32 updatingReady(); | ||||||
| 
 | 
 | ||||||
| signals: | signals: | ||||||
| 
 |  | ||||||
| 	void updateChecking(); | 	void updateChecking(); | ||||||
| 	void updateLatest(); | 	void updateLatest(); | ||||||
| 	void updateProgress(qint64 ready, qint64 total); | 	void updateProgress(qint64 ready, qint64 total); | ||||||
|  | @ -86,7 +83,6 @@ signals: | ||||||
| 	void updateFailed(); | 	void updateFailed(); | ||||||
| 
 | 
 | ||||||
| public slots: | public slots: | ||||||
| 
 |  | ||||||
| 	void updateCheck(); | 	void updateCheck(); | ||||||
| 
 | 
 | ||||||
| 	void updateGotCurrent(); | 	void updateGotCurrent(); | ||||||
|  | @ -96,7 +92,6 @@ public slots: | ||||||
| 	void onUpdateFailed(); | 	void onUpdateFailed(); | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
| 
 |  | ||||||
| 	SingleTimer _updateCheckTimer; | 	SingleTimer _updateCheckTimer; | ||||||
| 	QNetworkReply *_updateReply = nullptr; | 	QNetworkReply *_updateReply = nullptr; | ||||||
| 	QNetworkAccessManager _updateManager; | 	QNetworkAccessManager _updateManager; | ||||||
|  |  | ||||||
|  | @ -24,7 +24,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org | ||||||
| 
 | 
 | ||||||
| #define BETA_VERSION_MACRO (0ULL) | #define BETA_VERSION_MACRO (0ULL) | ||||||
| 
 | 
 | ||||||
| constexpr int AppVersion = 10005; | constexpr int AppVersion = 10006; | ||||||
| constexpr str_const AppVersionStr = "0.10.5"; | constexpr str_const AppVersionStr = "0.10.6"; | ||||||
| constexpr bool AppAlphaVersion = false; | constexpr bool AppAlphaVersion = false; | ||||||
| constexpr uint64 AppBetaVersion = BETA_VERSION_MACRO; | constexpr uint64 AppBetaVersion = BETA_VERSION_MACRO; | ||||||
|  |  | ||||||
|  | @ -5902,7 +5902,9 @@ void LocationManager::init() { | ||||||
| 	App::setProxySettings(*manager); | 	App::setProxySettings(*manager); | ||||||
| 
 | 
 | ||||||
| 	connect(manager, SIGNAL(authenticationRequired(QNetworkReply*, QAuthenticator*)), this, SLOT(onFailed(QNetworkReply*))); | 	connect(manager, SIGNAL(authenticationRequired(QNetworkReply*, QAuthenticator*)), this, SLOT(onFailed(QNetworkReply*))); | ||||||
|  | #ifndef OS_MAC_OLD | ||||||
| 	connect(manager, SIGNAL(sslErrors(QNetworkReply*, const QList<QSslError>&)), this, SLOT(onFailed(QNetworkReply*))); | 	connect(manager, SIGNAL(sslErrors(QNetworkReply*, const QList<QSslError>&)), this, SLOT(onFailed(QNetworkReply*))); | ||||||
|  | #endif // OS_MAC_OLD
 | ||||||
| 	connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(onFinished(QNetworkReply*))); | 	connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(onFinished(QNetworkReply*))); | ||||||
| 
 | 
 | ||||||
| 	if (black) { | 	if (black) { | ||||||
|  |  | ||||||
|  | @ -581,6 +581,7 @@ namespace { | ||||||
| 	FileKey _backgroundKey = 0; | 	FileKey _backgroundKey = 0; | ||||||
| 	bool _backgroundWasRead = false; | 	bool _backgroundWasRead = false; | ||||||
| 
 | 
 | ||||||
|  | 	bool _readingUserSettings = false; | ||||||
| 	FileKey _userSettingsKey = 0; | 	FileKey _userSettingsKey = 0; | ||||||
| 	FileKey _recentHashtagsAndBotsKey = 0; | 	FileKey _recentHashtagsAndBotsKey = 0; | ||||||
| 	bool _recentHashtagsAndBotsWereRead = false; | 	bool _recentHashtagsAndBotsWereRead = false; | ||||||
|  | @ -1548,6 +1549,12 @@ namespace { | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	void _writeUserSettings() { | 	void _writeUserSettings() { | ||||||
|  | 		if (_readingUserSettings) { | ||||||
|  | 			LOG(("App Error: attempt to write settings while reading them!")); | ||||||
|  | 			return; | ||||||
|  | 		} | ||||||
|  | 		LOG(("App Info: writing encrypted user settings...")); | ||||||
|  | 
 | ||||||
| 		if (!_userSettingsKey) { | 		if (!_userSettingsKey) { | ||||||
| 			_userSettingsKey = genKey(); | 			_userSettingsKey = genKey(); | ||||||
| 			_mapChanged = true; | 			_mapChanged = true; | ||||||
|  | @ -1622,22 +1629,28 @@ namespace { | ||||||
| 	void _readUserSettings() { | 	void _readUserSettings() { | ||||||
| 		FileReadDescriptor userSettings; | 		FileReadDescriptor userSettings; | ||||||
| 		if (!readEncryptedFile(userSettings, _userSettingsKey)) { | 		if (!readEncryptedFile(userSettings, _userSettingsKey)) { | ||||||
|  | 			LOG(("App Info: could not read encrypted user settings...")); | ||||||
| 			_readOldUserSettings(); | 			_readOldUserSettings(); | ||||||
| 			return _writeUserSettings(); | 			return _writeUserSettings(); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		LOG(("App Info: reading encrypted user settings...")); | 		LOG(("App Info: reading encrypted user settings...")); | ||||||
|  | 		_readingUserSettings = true; | ||||||
| 		while (!userSettings.stream.atEnd()) { | 		while (!userSettings.stream.atEnd()) { | ||||||
| 			quint32 blockId; | 			quint32 blockId; | ||||||
| 			userSettings.stream >> blockId; | 			userSettings.stream >> blockId; | ||||||
| 			if (!_checkStreamStatus(userSettings.stream)) { | 			if (!_checkStreamStatus(userSettings.stream)) { | ||||||
|  | 				_readingUserSettings = false; | ||||||
| 				return _writeUserSettings(); | 				return _writeUserSettings(); | ||||||
| 			} | 			} | ||||||
| 
 | 
 | ||||||
| 			if (!_readSetting(blockId, userSettings.stream, userSettings.version)) { | 			if (!_readSetting(blockId, userSettings.stream, userSettings.version)) { | ||||||
|  | 				_readingUserSettings = false; | ||||||
| 				return _writeUserSettings(); | 				return _writeUserSettings(); | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  | 		_readingUserSettings = false; | ||||||
|  | 		LOG(("App Info: encrypted user settings read.")); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	void _writeMtpData() { | 	void _writeMtpData() { | ||||||
|  |  | ||||||
|  | @ -520,6 +520,74 @@ void MediaView::step_radial(uint64 ms, bool timer) { | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void MediaView::zoomIn() { | ||||||
|  | 	int32 newZoom = _zoom; | ||||||
|  | 	if (newZoom == ZoomToScreenLevel) { | ||||||
|  | 		if (qCeil(_zoomToScreen) <= MaxZoomLevel) { | ||||||
|  | 			newZoom = qCeil(_zoomToScreen); | ||||||
|  | 		} | ||||||
|  | 	} else { | ||||||
|  | 		if (newZoom < _zoomToScreen && (newZoom + 1 > _zoomToScreen || (_zoomToScreen > MaxZoomLevel && newZoom == MaxZoomLevel))) { | ||||||
|  | 			newZoom = ZoomToScreenLevel; | ||||||
|  | 		} else if (newZoom < MaxZoomLevel) { | ||||||
|  | 			++newZoom; | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 	zoomUpdate(newZoom); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void MediaView::zoomOut() { | ||||||
|  | 	int32 newZoom = _zoom; | ||||||
|  | 	if (newZoom == ZoomToScreenLevel) { | ||||||
|  | 		if (qFloor(_zoomToScreen) >= -MaxZoomLevel) { | ||||||
|  | 			newZoom = qFloor(_zoomToScreen); | ||||||
|  | 		} | ||||||
|  | 	} else { | ||||||
|  | 		if (newZoom > _zoomToScreen && (newZoom - 1 < _zoomToScreen || (_zoomToScreen < -MaxZoomLevel && newZoom == -MaxZoomLevel))) { | ||||||
|  | 			newZoom = ZoomToScreenLevel; | ||||||
|  | 		} else if (newZoom > -MaxZoomLevel) { | ||||||
|  | 			--newZoom; | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 	zoomUpdate(newZoom); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void MediaView::zoomReset() { | ||||||
|  | 	int32 newZoom = _zoom; | ||||||
|  | 	if (_zoom == 0) { | ||||||
|  | 		if (qFloor(_zoomToScreen) == qCeil(_zoomToScreen) && qRound(_zoomToScreen) >= -MaxZoomLevel && qRound(_zoomToScreen) <= MaxZoomLevel) { | ||||||
|  | 			newZoom = qRound(_zoomToScreen); | ||||||
|  | 		} else { | ||||||
|  | 			newZoom = ZoomToScreenLevel; | ||||||
|  | 		} | ||||||
|  | 	} else { | ||||||
|  | 		newZoom = 0; | ||||||
|  | 	} | ||||||
|  | 	_x = -_width / 2; | ||||||
|  | 	_y = -((gifShown() ? _gif->height() : (_current.height() / cIntRetinaFactor())) / 2); | ||||||
|  | 	float64 z = (_zoom == ZoomToScreenLevel) ? _zoomToScreen : _zoom; | ||||||
|  | 	if (z >= 0) { | ||||||
|  | 		_x = qRound(_x * (z + 1)); | ||||||
|  | 		_y = qRound(_y * (z + 1)); | ||||||
|  | 	} else { | ||||||
|  | 		_x = qRound(_x / (-z + 1)); | ||||||
|  | 		_y = qRound(_y / (-z + 1)); | ||||||
|  | 	} | ||||||
|  | 	_x += width() / 2; | ||||||
|  | 	_y += height() / 2; | ||||||
|  | 	update(); | ||||||
|  | 	zoomUpdate(newZoom); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void MediaView::zoomUpdate(int32 &newZoom) { | ||||||
|  | 	if (newZoom != ZoomToScreenLevel) { | ||||||
|  | 		while ((newZoom < 0 && (-newZoom + 1) > _w) || (-newZoom + 1) > _h) { | ||||||
|  | 			++newZoom; | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 	setZoomLevel(newZoom); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void MediaView::clearData() { | void MediaView::clearData() { | ||||||
| 	if (!isHidden()) { | 	if (!isHidden()) { | ||||||
| 		hide(); | 		hide(); | ||||||
|  | @ -1811,61 +1879,48 @@ void MediaView::keyPressEvent(QKeyEvent *e) { | ||||||
| 	} else if (e->key() == Qt::Key_Right) { | 	} else if (e->key() == Qt::Key_Right) { | ||||||
| 		moveToNext(1); | 		moveToNext(1); | ||||||
| 	} else if (e->modifiers().testFlag(Qt::ControlModifier) && (e->key() == Qt::Key_Plus || e->key() == Qt::Key_Equal || e->key() == ']' || e->key() == Qt::Key_Asterisk || e->key() == Qt::Key_Minus || e->key() == Qt::Key_Underscore || e->key() == Qt::Key_0)) { | 	} else if (e->modifiers().testFlag(Qt::ControlModifier) && (e->key() == Qt::Key_Plus || e->key() == Qt::Key_Equal || e->key() == ']' || e->key() == Qt::Key_Asterisk || e->key() == Qt::Key_Minus || e->key() == Qt::Key_Underscore || e->key() == Qt::Key_0)) { | ||||||
| 		int32 newZoom = _zoom; |  | ||||||
| 		if (e->key() == Qt::Key_Plus || e->key() == Qt::Key_Equal || e->key() == Qt::Key_Asterisk || e->key() == ']') { | 		if (e->key() == Qt::Key_Plus || e->key() == Qt::Key_Equal || e->key() == Qt::Key_Asterisk || e->key() == ']') { | ||||||
| 			if (newZoom == ZoomToScreenLevel) { | 			zoomIn(); | ||||||
| 				if (qCeil(_zoomToScreen) <= MaxZoomLevel) { |  | ||||||
| 					newZoom = qCeil(_zoomToScreen); |  | ||||||
| 				} |  | ||||||
| 			} else { |  | ||||||
| 				if (newZoom < _zoomToScreen && (newZoom + 1 > _zoomToScreen || (_zoomToScreen > MaxZoomLevel && newZoom == MaxZoomLevel))) { |  | ||||||
| 					newZoom = ZoomToScreenLevel; |  | ||||||
| 				} else if (newZoom < MaxZoomLevel) { |  | ||||||
| 					++newZoom; |  | ||||||
| 				} |  | ||||||
| 			} |  | ||||||
| 		} else if (e->key() == Qt::Key_Minus || e->key() == Qt::Key_Underscore) { | 		} else if (e->key() == Qt::Key_Minus || e->key() == Qt::Key_Underscore) { | ||||||
| 			if (newZoom == ZoomToScreenLevel) { | 			zoomOut(); | ||||||
| 				if (qFloor(_zoomToScreen) >= -MaxZoomLevel) { | 		} else { | ||||||
| 					newZoom = qFloor(_zoomToScreen); | 			zoomReset(); | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void MediaView::wheelEvent(QWheelEvent *e) { | ||||||
|  | #ifdef OS_MAC_OLD | ||||||
|  | 	constexpr auto step = 120; | ||||||
|  | #else // OS_MAC_OLD
 | ||||||
|  | 	constexpr auto step = static_cast<int>(QWheelEvent::DefaultDeltasPerStep); | ||||||
|  | #endif // OS_MAC_OLD
 | ||||||
|  | 
 | ||||||
|  | 	_verticalWheelDelta += e->angleDelta().y(); | ||||||
|  | 	while (qAbs(_verticalWheelDelta) >= step) { | ||||||
|  | 		if (_verticalWheelDelta < 0) { | ||||||
|  | 			_verticalWheelDelta += step; | ||||||
|  | 			if (e->modifiers().testFlag(Qt::ControlModifier)) { | ||||||
|  | 				zoomOut(); | ||||||
|  | 			} else { | ||||||
|  | #ifndef OS_MAC_OLD | ||||||
|  | 				if (e->source() == Qt::MouseEventNotSynthesized) { | ||||||
|  | 					moveToNext(1); | ||||||
|  | 				} | ||||||
|  | #endif // OS_MAC_OLD
 | ||||||
| 			} | 			} | ||||||
| 		} else { | 		} else { | ||||||
| 				if (newZoom > _zoomToScreen && (newZoom - 1 < _zoomToScreen || (_zoomToScreen < -MaxZoomLevel && newZoom == -MaxZoomLevel))) { | 			_verticalWheelDelta -= step; | ||||||
| 					newZoom = ZoomToScreenLevel; | 			if (e->modifiers().testFlag(Qt::ControlModifier)) { | ||||||
| 				} else if (newZoom > -MaxZoomLevel) { | 				zoomIn(); | ||||||
| 					--newZoom; |  | ||||||
| 				} |  | ||||||
| 			} |  | ||||||
| 			} else { | 			} else { | ||||||
| 			if (_zoom == 0) { | #ifndef OS_MAC_OLD | ||||||
| 				if (qFloor(_zoomToScreen) == qCeil(_zoomToScreen) && qRound(_zoomToScreen) >= -MaxZoomLevel && qRound(_zoomToScreen) <= MaxZoomLevel) { | 				if (e->source() == Qt::MouseEventNotSynthesized) { | ||||||
| 					newZoom = qRound(_zoomToScreen); | 					moveToNext(-1); | ||||||
| 				} else { |  | ||||||
| 					newZoom = ZoomToScreenLevel; |  | ||||||
| 				} | 				} | ||||||
| 			} else { | #endif // OS_MAC_OLD
 | ||||||
| 				newZoom = 0; |  | ||||||
| 			} |  | ||||||
| 			_x = -_width / 2; |  | ||||||
| 			_y = -((gifShown() ? _gif->height() : (_current.height() / cIntRetinaFactor())) / 2); |  | ||||||
| 			float64 z = (_zoom == ZoomToScreenLevel) ? _zoomToScreen : _zoom; |  | ||||||
| 			if (z >= 0) { |  | ||||||
| 				_x = qRound(_x * (z + 1)); |  | ||||||
| 				_y = qRound(_y * (z + 1)); |  | ||||||
| 			} else { |  | ||||||
| 				_x = qRound(_x / (-z + 1)); |  | ||||||
| 				_y = qRound(_y / (-z + 1)); |  | ||||||
| 			} |  | ||||||
| 			_x += width() / 2; |  | ||||||
| 			_y += height() / 2; |  | ||||||
| 			update(); |  | ||||||
| 		} |  | ||||||
| 		if (newZoom != ZoomToScreenLevel) { |  | ||||||
| 			while ((newZoom < 0 && (-newZoom + 1) > _w) || (-newZoom + 1) > _h) { |  | ||||||
| 				++newZoom; |  | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 		setZoomLevel(newZoom); |  | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -2114,6 +2169,8 @@ void MediaView::mousePressEvent(QMouseEvent *e) { | ||||||
| 				_yStart = _y; | 				_yStart = _y; | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  | 	} else if (e->button() == Qt::MiddleButton) { | ||||||
|  | 		zoomReset(); | ||||||
| 	} | 	} | ||||||
| 	activateControls(); | 	activateControls(); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -107,6 +107,7 @@ protected: | ||||||
| 	void paintEvent(QPaintEvent *e) override; | 	void paintEvent(QPaintEvent *e) override; | ||||||
| 
 | 
 | ||||||
| 	void keyPressEvent(QKeyEvent *e) override; | 	void keyPressEvent(QKeyEvent *e) override; | ||||||
|  | 	void wheelEvent(QWheelEvent *e) override; | ||||||
| 	void mousePressEvent(QMouseEvent *e) override; | 	void mousePressEvent(QMouseEvent *e) override; | ||||||
| 	void mouseDoubleClickEvent(QMouseEvent *e) override; | 	void mouseDoubleClickEvent(QMouseEvent *e) override; | ||||||
| 	void mouseMoveEvent(QMouseEvent *e) override; | 	void mouseMoveEvent(QMouseEvent *e) override; | ||||||
|  | @ -170,6 +171,11 @@ private: | ||||||
| 	void step_state(uint64 ms, bool timer); | 	void step_state(uint64 ms, bool timer); | ||||||
| 	void step_radial(uint64 ms, bool timer); | 	void step_radial(uint64 ms, bool timer); | ||||||
| 
 | 
 | ||||||
|  | 	void zoomIn(); | ||||||
|  | 	void zoomOut(); | ||||||
|  | 	void zoomReset(); | ||||||
|  | 	void zoomUpdate(int32 &newZoom); | ||||||
|  | 
 | ||||||
| 	void paintDocRadialLoading(Painter &p, bool radial, float64 radialOpacity); | 	void paintDocRadialLoading(Painter &p, bool radial, float64 radialOpacity); | ||||||
| 
 | 
 | ||||||
| 	QBrush _transparentBrush; | 	QBrush _transparentBrush; | ||||||
|  | @ -316,6 +322,8 @@ private: | ||||||
| 	typedef QMap<OverState, anim::fvalue> ShowingOpacities; | 	typedef QMap<OverState, anim::fvalue> ShowingOpacities; | ||||||
| 	ShowingOpacities _animOpacities; | 	ShowingOpacities _animOpacities; | ||||||
| 
 | 
 | ||||||
|  | 	int _verticalWheelDelta = 0; | ||||||
|  | 
 | ||||||
| 	void updateOverRect(OverState state); | 	void updateOverRect(OverState state); | ||||||
| 	bool updateOverState(OverState newState); | 	bool updateOverState(OverState newState); | ||||||
| 	float64 overLevel(OverState control) const; | 	float64 overLevel(OverState control) const; | ||||||
|  |  | ||||||
|  | @ -818,7 +818,9 @@ WebLoadManager::WebLoadManager(QThread *thread) { | ||||||
| 	connect(this, SIGNAL(error(webFileLoader*)), _webLoadMainManager, SLOT(error(webFileLoader*))); | 	connect(this, SIGNAL(error(webFileLoader*)), _webLoadMainManager, SLOT(error(webFileLoader*))); | ||||||
| 
 | 
 | ||||||
| 	connect(&_manager, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), this, SLOT(onFailed(QNetworkReply*))); | 	connect(&_manager, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), this, SLOT(onFailed(QNetworkReply*))); | ||||||
|  | #ifndef OS_MAC_OLD | ||||||
| 	connect(&_manager, SIGNAL(sslErrors(QNetworkReply*,const QList<QSslError>&)), this, SLOT(onFailed(QNetworkReply*))); | 	connect(&_manager, SIGNAL(sslErrors(QNetworkReply*,const QList<QSslError>&)), this, SLOT(onFailed(QNetworkReply*))); | ||||||
|  | #endif // OS_MAC_OLD
 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void WebLoadManager::append(webFileLoader *loader, const QString &url) { | void WebLoadManager::append(webFileLoader *loader, const QString &url) { | ||||||
|  |  | ||||||
|  | @ -1,6 +1,6 @@ | ||||||
| AppVersion         10005 | AppVersion         10006 | ||||||
| AppVersionStrMajor 0.10 | AppVersionStrMajor 0.10 | ||||||
| AppVersionStrSmall 0.10.5 | AppVersionStrSmall 0.10.6 | ||||||
| AppVersionStr      0.10.5 | AppVersionStr      0.10.6 | ||||||
| AlphaChannel       0 | AlphaChannel       0 | ||||||
| BetaVersion        0 | BetaVersion        0 | ||||||
|  |  | ||||||
|  | @ -102,6 +102,8 @@ function(add_precompiled_header _target _input) | ||||||
|       OUTPUT "${_pchfile}" |       OUTPUT "${_pchfile}" | ||||||
|       COMMAND "${CMAKE_COMMAND}" -E copy "${_pch_header}" "${_pchfile}" |       COMMAND "${CMAKE_COMMAND}" -E copy "${_pch_header}" "${_pchfile}" | ||||||
|       DEPENDS "${_pch_header}" |       DEPENDS "${_pch_header}" | ||||||
|  |       IMPLICIT_DEPENDS CXX "${_pch_header}" | ||||||
|  |       IMPLICIT_DEPENDS C "${_pch_header}" | ||||||
|       COMMENT "Updating ${_name}") |       COMMENT "Updating ${_name}") | ||||||
| 
 | 
 | ||||||
|     if(_source_for_c_flags) |     if(_source_for_c_flags) | ||||||
|  | @ -112,6 +114,7 @@ function(add_precompiled_header _target _input) | ||||||
|         OUTPUT "${_output_c}" |         OUTPUT "${_output_c}" | ||||||
|         COMMAND "${CMAKE_C_COMPILER}" ${_compiler_FLAGS} -x c-header -o "${_output_c}" -c "${_pchfile}" |         COMMAND "${CMAKE_C_COMPILER}" ${_compiler_FLAGS} -x c-header -o "${_output_c}" -c "${_pchfile}" | ||||||
|         DEPENDS "${_pchfile}" "${_pch_c_flags_file}" |         DEPENDS "${_pchfile}" "${_pch_c_flags_file}" | ||||||
|  |         IMPLICIT_DEPENDS C "${_pch_header}" | ||||||
|         COMMENT "Precompiling ${_name} for ${_target} (C)") |         COMMENT "Precompiling ${_name} for ${_target} (C)") | ||||||
|     endif() |     endif() | ||||||
|     if(_source_for_cpp_flags) |     if(_source_for_cpp_flags) | ||||||
|  | @ -122,6 +125,7 @@ function(add_precompiled_header _target _input) | ||||||
|         OUTPUT "${_output_cxx}" |         OUTPUT "${_output_cxx}" | ||||||
|         COMMAND "${CMAKE_CXX_COMPILER}" ${_compiler_FLAGS} -x c++-header -o "${_output_cxx}" -c "${_pchfile}" |         COMMAND "${CMAKE_CXX_COMPILER}" ${_compiler_FLAGS} -x c++-header -o "${_output_cxx}" -c "${_pchfile}" | ||||||
|         DEPENDS "${_pchfile}" "${_pch_cpp_flags_file}" |         DEPENDS "${_pchfile}" "${_pch_cpp_flags_file}" | ||||||
|  |         IMPLICIT_DEPENDS CXX "${_pch_header}" | ||||||
|         COMMENT "Precompiling ${_name} for ${_target} (C++)") |         COMMENT "Precompiling ${_name} for ${_target} (C++)") | ||||||
|     endif() |     endif() | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -101,7 +101,6 @@ | ||||||
|               'fontconfig', |               'fontconfig', | ||||||
|               'expat', |               'expat', | ||||||
|               'freetype', |               'freetype', | ||||||
|               'xcb', |  | ||||||
|               'xcb-shm', |               'xcb-shm', | ||||||
|               'xcb-xfixes', |               'xcb-xfixes', | ||||||
|               'xcb-render', |               'xcb-render', | ||||||
|  | @ -192,7 +191,6 @@ | ||||||
|     '<(qt_loc)/plugins/bearer', |     '<(qt_loc)/plugins/bearer', | ||||||
|     '<(qt_loc)/plugins/platforms', |     '<(qt_loc)/plugins/platforms', | ||||||
|     '<(qt_loc)/plugins/imageformats', |     '<(qt_loc)/plugins/imageformats', | ||||||
|     '<(qt_loc)/plugins/platforminputcontexts', |  | ||||||
|   ], |   ], | ||||||
|   'defines': [ |   'defines': [ | ||||||
|     'QT_WIDGETS_LIB', |     'QT_WIDGETS_LIB', | ||||||
|  | @ -203,11 +201,12 @@ | ||||||
|   'conditions': [ |   'conditions': [ | ||||||
|     [ 'build_linux', { |     [ 'build_linux', { | ||||||
|       'library_dirs': [ |       'library_dirs': [ | ||||||
|         '<(qt_loc)/plugins/platforms/xcb/xcb-static', |         '<(qt_loc)/plugins/platforminputcontexts', | ||||||
|       ], |       ], | ||||||
|       'libraries': [ |       'libraries': [ | ||||||
|         '/usr/local/lib/libxkbcommon.a', |         '/usr/local/lib/libxkbcommon.a', | ||||||
|         '<@(qt_libs_release)', |         '<@(qt_libs_release)', | ||||||
|  |         'xcb', | ||||||
|         'X11', |         'X11', | ||||||
|         'X11-xcb', |         'X11-xcb', | ||||||
|         'dbus-1', |         'dbus-1', | ||||||
|  |  | ||||||
|  | @ -19,7 +19,7 @@ else | ||||||
|   #gyp --depth=. --generator-output=../.. -Goutput_dir=out Telegram.gyp --format=xcode-ninja |   #gyp --depth=. --generator-output=../.. -Goutput_dir=out Telegram.gyp --format=xcode-ninja | ||||||
|   #gyp --depth=. --generator-output=../.. -Goutput_dir=out Telegram.gyp --format=xcode |   #gyp --depth=. --generator-output=../.. -Goutput_dir=out Telegram.gyp --format=xcode | ||||||
|   # use patched gyp with Xcode project generator |   # use patched gyp with Xcode project generator | ||||||
|   ../../../Libraries/gyp/gyp --depth=. --generator-output=../.. -Goutput_dir=out Telegram.gyp --format=xcode |   ../../../Libraries/gyp/gyp --depth=. --generator-output=../.. -Goutput_dir=out Telegram.gyp -Gxcode_upgrade_check_project_version=800 --format=xcode | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
| cd ../.. | cd ../.. | ||||||
|  |  | ||||||
|  | @ -91,6 +91,12 @@ | ||||||
|           'lzma', |           'lzma', | ||||||
|         ], |         ], | ||||||
|       }], |       }], | ||||||
|  |       [ 'build_mac', { | ||||||
|  |         'include_dirs': [ | ||||||
|  |           '<(libs_loc)/openssl-xcode/include' | ||||||
|  |         ], | ||||||
|  |         'library_dirs': [ | ||||||
|  |           '<(libs_loc)/openssl-xcode', | ||||||
|         ], |         ], | ||||||
|         'xcode_settings': { |         'xcode_settings': { | ||||||
|           'OTHER_LDFLAGS': [ |           'OTHER_LDFLAGS': [ | ||||||
|  | @ -99,6 +105,8 @@ | ||||||
|             '-llzma', |             '-llzma', | ||||||
|           ], |           ], | ||||||
|         }, |         }, | ||||||
|  |       }], | ||||||
|  |     ], | ||||||
|     'include_dirs': [ |     'include_dirs': [ | ||||||
|       '<(src_loc)', |       '<(src_loc)', | ||||||
|       '<(libs_loc)/lzma/C', |       '<(libs_loc)/lzma/C', | ||||||
|  |  | ||||||
|  | @ -205,6 +205,11 @@ If you didn't install Windows SDKs before, you need to install them now. To inst | ||||||
| If you already have Windows SDKs then find the library folder and correct it at configure's command below (like **C:\Program Files (x86)\Windows Kits\8.0\Lib\win8\um\x86**). | If you already have Windows SDKs then find the library folder and correct it at configure's command below (like **C:\Program Files (x86)\Windows Kits\8.0\Lib\win8\um\x86**). | ||||||
| 
 | 
 | ||||||
| #### Building library | #### Building library | ||||||
|  | go to Libraries directory | ||||||
|  | 
 | ||||||
|  |     D: | ||||||
|  |     cd /tbuild/libraries/qt5_6_0/qtbase | ||||||
|  | and run | ||||||
| 
 | 
 | ||||||
|     configure -debug-and-release -force-debug-info -opensource -confirm-license -static -I "D:\TBuild\Libraries\openssl\Release\include" -L "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib" -l Gdi32 -no-opengl -openssl-linked OPENSSL_LIBS_DEBUG="D:\TBuild\Libraries\openssl_debug\Debug\lib\ssleay32.lib D:\TBuild\Libraries\openssl_debug\Debug\lib\libeay32.lib" OPENSSL_LIBS_RELEASE="D:\TBuild\Libraries\openssl\Release\lib\ssleay32.lib D:\TBuild\Libraries\openssl\Release\lib\libeay32.lib" -mp -nomake examples -nomake tests -platform win32-msvc2015 |     configure -debug-and-release -force-debug-info -opensource -confirm-license -static -I "D:\TBuild\Libraries\openssl\Release\include" -L "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib" -l Gdi32 -no-opengl -openssl-linked OPENSSL_LIBS_DEBUG="D:\TBuild\Libraries\openssl_debug\Debug\lib\ssleay32.lib D:\TBuild\Libraries\openssl_debug\Debug\lib\libeay32.lib" OPENSSL_LIBS_RELEASE="D:\TBuild\Libraries\openssl\Release\lib\ssleay32.lib D:\TBuild\Libraries\openssl\Release\lib\libeay32.lib" -mp -nomake examples -nomake tests -platform win32-msvc2015 | ||||||
|     nmake |     nmake | ||||||
|  | @ -247,8 +252,8 @@ and run | ||||||
| #### Build | #### Build | ||||||
| 
 | 
 | ||||||
| * Open in VS2015 **D:\TBuild\Libraries\breakpad\src\client\windows\breakpad_client.sln** | * Open in VS2015 **D:\TBuild\Libraries\breakpad\src\client\windows\breakpad_client.sln** | ||||||
| * Change "Treat WChar_t As Built in Type" to "No" in all projects & configurations | * Change "Treat WChar_t As Built in Type" to "No" in all projects & configurations (should be in project>>properties>>C/C++>>Language) | ||||||
| * Change "Treat Warnings As Errors" to "No" in all projects & configurations | * Change "Treat Warnings As Errors" to "No" in all projects & configurations (should be in project>>properties>>C/C++>>General) | ||||||
| * Build Debug configuration | * Build Debug configuration | ||||||
| * Build Release configuration | * Build Release configuration | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue