mirror of https://github.com/procxx/kepka.git
				
				
				
			Merge branch 'dev' of https://github.com/telegramdesktop/tdesktop into dev
This commit is contained in:
		
						commit
						7c338f3940
					
				|  | @ -25,6 +25,7 @@ Only Windows and OS X systems are supported at this moment, Linux builds are on | |||
| * 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)) | ||||
| * DejaVu Sans font ([Free license](http://dejavu-fonts.org/wiki/License)) | ||||
| 
 | ||||
| ###[Build instructions for Visual Studio 2013](https://github.com/telegramdesktop/tdesktop/blob/master/MSVC.md) | ||||
| 
 | ||||
|  |  | |||
|  | @ -0,0 +1,12 @@ | |||
| sed -i 's/\-lxcb\-render\-util/\/usr\/lib\/x86_64\-linux\-gnu\/libxcb\-render\-util\.a/g' Makefile | ||||
| sed -i 's/\-lxcb\-render/\/usr\/lib\/x86_64\-linux\-gnu\/libxcb\-render\.a/g' Makefile | ||||
| sed -i 's/\-lxcb\-sync/\/usr\/lib\/x86_64\-linux\-gnu\/libxcb\-sync\.a/g' Makefile | ||||
| sed -i 's/\-lxcb\-keysyms/\/usr\/lib\/x86_64\-linux\-gnu\/libxcb\-keysyms\.a/g' Makefile | ||||
| sed -i 's/\-lxcb\-icccm/\/usr\/lib\/x86_64\-linux\-gnu\/libxcb\-icccm\.a/g' Makefile | ||||
| sed -i 's/\-lxcb\-xfixes/\/usr\/lib\/x86_64\-linux\-gnu\/libxcb\-xfixes\.a/g' Makefile | ||||
| sed -i 's/\-lxcb\-shm/\/usr\/lib\/x86_64\-linux\-gnu\/libxcb\-shm\.a/g' Makefile | ||||
| sed -i 's/\-lxcb\-randr/\/usr\/lib\/x86_64\-linux\-gnu\/libxcb\-randr\.a/g' Makefile | ||||
| sed -i 's/\-lxcb\-shape/\/usr\/lib\/x86_64\-linux\-gnu\/libxcb\-shape\.a/g' Makefile | ||||
| sed -i 's/\-llzma/\/usr\/local\/lib\/liblzma\.a/g' Makefile | ||||
| sed -i 's/\-lglib\-2\.0/\/usr\/lib\/x86_64\-linux\-gnu\/libglib\-2\.0\.a/g' Makefile | ||||
| 
 | ||||
|  | @ -0,0 +1,39 @@ | |||
| AppVersionStr=0.5.7 | ||||
| AppVersion=5007 | ||||
| 
 | ||||
| if [ -d "./../Linux/Release/deploy/$AppVersionStr" ]; then | ||||
|   echo "Deploy folder for version $AppVersionStr already exists!" | ||||
|   exit 1 | ||||
| fi | ||||
| 
 | ||||
| if [ -f "./../Linux/Release/tlinuxupd$AppVersion" ]; then | ||||
|   echo "Update file for version $AppVersion already exists!" | ||||
|   exit 1 | ||||
| fi | ||||
| 
 | ||||
| if [ ! -f "./../Linux/Release/Telegram" ]; then | ||||
|   echo "Telegram not found!" | ||||
|   exit 1 | ||||
| fi | ||||
| 
 | ||||
| if [ ! -f "./../Linux/Release/Updater" ]; then | ||||
|   echo "Updater not found!" | ||||
|   exit 1 | ||||
| fi | ||||
| 
 | ||||
| echo "Preparing version $AppVersionStr, executing Packer.." | ||||
| cd ./../Linux/Release && ./Packer -path Telegram -path Updater -version $AppVersion && cd ./../../Telegram | ||||
| echo "Packer done!" | ||||
| 
 | ||||
| if [ ! -d "./../Linux/Release/deploy" ]; then | ||||
|   mkdir "./../Linux/Release/deploy" | ||||
| fi | ||||
| echo "Copying Telegram, Updater and tlinuxupd$AppVersion to deploy/$AppVersionStr.."; | ||||
| mkdir "./../Linux/Release/deploy/$AppVersionStr" | ||||
| mkdir "./../Linux/Release/deploy/$AppVersionStr/Telegram" | ||||
| mv ./../Linux/Release/Telegram ./../Linux/Release/deploy/$AppVersionStr/Telegram/ | ||||
| mv ./../Linux/Release/Updater ./../Linux/Release/deploy/$AppVersionStr/Telegram/ | ||||
| mv ./../Linux/Release/tlinuxupd$AppVersion ./../Linux/Release/deploy/$AppVersionStr/ | ||||
| cd ./../Linux/Release/deploy/$AppVersionStr && tar -czvf tsetup.$AppVersionStr.tar.gz Telegram/ && cd ./../../../../Telegram | ||||
| echo "Version $AppVersionStr prepared!"; | ||||
| 
 | ||||
|  | @ -34,6 +34,59 @@ using std::string; | |||
| using std::deque; | ||||
| using std::cout; | ||||
| 
 | ||||
| bool do_mkdir(const char *path) { // from http://stackoverflow.com/questions/675039/how-can-i-create-directory-tree-in-c-linux
 | ||||
|     struct stat statbuf; | ||||
|     if (stat(path, &statbuf) != 0) { | ||||
|         /* Directory does not exist. EEXIST for race condition */ | ||||
|         if (mkdir(path, S_IRWXU) != 0 && errno != EEXIST) return false; | ||||
|     } else if (!S_ISDIR(statbuf.st_mode)) { | ||||
|         errno = ENOTDIR; | ||||
|         return false; | ||||
|     } | ||||
| 
 | ||||
|     return true; | ||||
| } | ||||
| 
 | ||||
| bool _debug = false; | ||||
| 
 | ||||
| FILE *_logFile = 0; | ||||
| void openLog() { | ||||
|     if (!_debug || _logFile) return; | ||||
| 
 | ||||
|     if (!do_mkdir("DebugLogs")) { | ||||
|         return; | ||||
|     } | ||||
| 
 | ||||
|     time_t timer; | ||||
| 
 | ||||
|     time(&timer); | ||||
|     struct tm *t = localtime(&timer); | ||||
| 
 | ||||
|     static const int maxFileLen = 65536; | ||||
|     char logName[maxFileLen]; | ||||
|     sprintf(logName, "DebugLogs/%04d%02d%02d_%02d%02d%02d_upd.txt", | ||||
|         t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec); | ||||
|     _logFile = fopen(logName, "w"); | ||||
| } | ||||
| 
 | ||||
| void closeLog() { | ||||
|     if (!_logFile) return; | ||||
| 
 | ||||
|     fclose(_logFile); | ||||
|     _logFile = 0; | ||||
| } | ||||
| 
 | ||||
| void writeLog(const char *format, ...) { | ||||
|     if (!_logFile) return; | ||||
| 
 | ||||
|     va_list args; | ||||
|     va_start(args, format); | ||||
|     vfprintf(_logFile, format, args); | ||||
|     fprintf(_logFile, "\n"); | ||||
|     fflush(_logFile); | ||||
|     va_end(args); | ||||
| } | ||||
| 
 | ||||
| bool copyFile(const char *from, const char *to) { | ||||
|     FILE *ffrom = fopen(from, "rb"), *fto = fopen(to, "wb"); | ||||
|     if (!ffrom) { | ||||
|  | @ -78,7 +131,12 @@ bool copyFile(const char *from, const char *to) { | |||
| 
 | ||||
| bool remove_directory(const string &path) { // from http://stackoverflow.com/questions/2256945/removing-a-non-empty-directory-programmatically-in-c-or-c
 | ||||
|     DIR *d = opendir(path.c_str()); | ||||
|     if (!d) return false; | ||||
|     writeLog("Removing dir '%s'", path.c_str()); | ||||
| 
 | ||||
|     if (!d) { | ||||
|         writeLog("Could not open dir '%s'", path.c_str()); | ||||
|         return false; | ||||
|     } | ||||
| 
 | ||||
|     while (struct dirent *p = readdir(d)) { | ||||
|         /* Skip the names "." and ".." as we don't want to recurse on them. */ | ||||
|  | @ -86,38 +144,31 @@ bool remove_directory(const string &path) { // from http://stackoverflow.com/que | |||
| 
 | ||||
|         string fname = path + '/' + p->d_name; | ||||
|         struct stat statbuf; | ||||
|         if (stat(fname.c_str(), &statbuf) != 0) { | ||||
|         writeLog("Trying to get stat() for '%s'", fname.c_str()); | ||||
|         if (!stat(fname.c_str(), &statbuf)) { | ||||
|             if (S_ISDIR(statbuf.st_mode)) { | ||||
|                 if (remove_directory(fname.c_str())) { | ||||
|                 if (!remove_directory(fname.c_str())) { | ||||
|                     closedir(d); | ||||
|                     return false; | ||||
|                 } | ||||
|             } else { | ||||
|                 writeLog("Unlinking file '%s'", fname.c_str()); | ||||
|                 if (unlink(fname.c_str())) { | ||||
|                     writeLog("Failed to unlink '%s'", fname.c_str()); | ||||
|                     closedir(d); | ||||
|                     return false; | ||||
|                 } | ||||
|             } | ||||
|         } else { | ||||
|             writeLog("Failed to call stat() on '%s'", fname.c_str()); | ||||
|         } | ||||
|     } | ||||
|     closedir(d); | ||||
| 
 | ||||
|     writeLog("Finally removing dir '%s'", path.c_str()); | ||||
|     return !rmdir(path.c_str()); | ||||
| } | ||||
| 
 | ||||
| bool do_mkdir(const char *path) { // from http://stackoverflow.com/questions/675039/how-can-i-create-directory-tree-in-c-linux
 | ||||
|     struct stat statbuf; | ||||
|     if (stat(path, &statbuf) != 0) { | ||||
|         /* Directory does not exist. EEXIST for race condition */ | ||||
|         if (mkdir(path, S_IRWXU) != 0 && errno != EEXIST) return false; | ||||
|     } else if (!S_ISDIR(statbuf.st_mode)) { | ||||
|         errno = ENOTDIR; | ||||
|         return false; | ||||
|     } | ||||
| 
 | ||||
|     return true; | ||||
| } | ||||
| 
 | ||||
| bool mkpath(const char *path) { | ||||
|     int status = 0, pathsize = strlen(path) + 1; | ||||
|     char *copypath = new char[pathsize]; | ||||
|  | @ -140,8 +191,6 @@ bool mkpath(const char *path) { | |||
|     return do_mkdir(path); | ||||
| } | ||||
| 
 | ||||
| bool _debug = false; | ||||
| 
 | ||||
| string exeName, exeDir; | ||||
| 
 | ||||
| bool equal(string a, string b) { | ||||
|  | @ -150,44 +199,6 @@ bool equal(string a, string b) { | |||
|     return a == b; | ||||
| } | ||||
| 
 | ||||
| FILE *_logFile = 0; | ||||
| void openLog() { | ||||
| 	if (!_debug || _logFile) return; | ||||
| 
 | ||||
|     if (!do_mkdir("DebugLogs")) { | ||||
|         return; | ||||
| 	} | ||||
| 
 | ||||
|     time_t timer; | ||||
| 
 | ||||
|     time(&timer); | ||||
|     struct tm *t = localtime(&timer); | ||||
| 
 | ||||
|     static const int maxFileLen = 65536; | ||||
|     char logName[maxFileLen]; | ||||
|     sprintf(logName, "DebugLogs/%04d%02d%02d_%02d%02d%02d_upd.txt", | ||||
|         t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec); | ||||
|     _logFile = fopen(logName, "w"); | ||||
| } | ||||
| 
 | ||||
| void closeLog() { | ||||
| 	if (!_logFile) return; | ||||
| 
 | ||||
|     fclose(_logFile); | ||||
| 	_logFile = 0; | ||||
| } | ||||
| 
 | ||||
| void writeLog(const char *format, ...) { | ||||
|     if (!_logFile) return; | ||||
| 
 | ||||
|     va_list args; | ||||
|     va_start(args, format); | ||||
|     vfprintf(_logFile, format, args); | ||||
|     fprintf(_logFile, "\n"); | ||||
|     fflush(_logFile); | ||||
|     va_end(args); | ||||
| } | ||||
| 
 | ||||
| void delFolder() { | ||||
|     string delPath = "tupdates/ready", delFolder = "tupdates"; | ||||
|     writeLog("Fully clearing path '%s'..", delPath.c_str()); | ||||
|  | @ -291,11 +302,11 @@ int main(int argc, char *argv[]) { | |||
| 
 | ||||
|     writeLog("Updater started.."); | ||||
| 
 | ||||
|     bool needupdate = false, autostart = false, debug = false, tosettings = false; | ||||
|     bool needupdate = true, autostart = false, debug = false, tosettings = false; | ||||
|     char *key = 0; | ||||
|     for (int i = 1; i < argc; ++i) { | ||||
|         if (equal(argv[i], "-update")) { | ||||
|             needupdate = true; | ||||
|         if (equal(argv[i], "-noupdate")) { | ||||
|             needupdate = false; | ||||
|         } else if (equal(argv[i], "-autostart")) { | ||||
|             autostart = true; | ||||
|         } else if (equal(argv[i], "-debug")) { | ||||
|  | @ -326,9 +337,14 @@ int main(int argc, char *argv[]) { | |||
|         writeLog("Error: short exe name!"); | ||||
|     } | ||||
| 
 | ||||
|     static const int MaxArgsCount = 128; | ||||
|     static const int MaxLen = 65536, MaxArgsCount = 128; | ||||
| 
 | ||||
|     char path[MaxLen] = {0}; | ||||
|     strcpy(path, (exeDir + "Telegram").c_str()); | ||||
| 
 | ||||
|     char *args[MaxArgsCount] = {0}, p_noupdate[] = "-noupdate", p_autostart[] = "-autostart", p_debug[] = "-debug", p_tosettings[] = "-tosettings", p_key[] = "-key"; | ||||
|     int argIndex = 0; | ||||
|     args[argIndex++] = path; | ||||
|     args[argIndex++] = p_noupdate; | ||||
|     if (autostart) args[argIndex++] = p_autostart; | ||||
|     if (debug) args[argIndex++] = p_debug; | ||||
|  | @ -341,7 +357,7 @@ int main(int argc, char *argv[]) { | |||
|     pid_t pid = fork(); | ||||
|     switch (pid) { | ||||
|     case -1: writeLog("fork() failed!"); return 1; | ||||
|     case 0: execv((exeDir + "Telegram").c_str(), args); return 1; | ||||
|     case 0: execv(path, args); return 1; | ||||
|     } | ||||
| 
 | ||||
|     writeLog("Executed Telegram, closing log and quiting.."); | ||||
|  |  | |||
|  | @ -23,7 +23,7 @@ Copyright (c) 2014 John Preston, https://tdesktop.com | |||
| #include "application.h" | ||||
| #include "fileuploader.h" | ||||
| #include "mainwidget.h" | ||||
| //#include <QtMultimedia/QSoundEffect>
 | ||||
| #include <QtMultimedia/QSoundEffect> | ||||
| #include <libexif/exif-data.h> | ||||
| 
 | ||||
| namespace { | ||||
|  | @ -61,7 +61,7 @@ namespace { | |||
| 
 | ||||
| 	HistoryItem *hoveredItem = 0, *pressedItem = 0, *hoveredLinkItem = 0, *pressedLinkItem = 0, *contextItem = 0, *mousedItem = 0; | ||||
| 
 | ||||
| //	QSoundEffect *newMsgSound = 0;
 | ||||
|     QSoundEffect *newMsgSound = 0; | ||||
| 	QPixmap *sprite = 0, *emojis = 0; | ||||
| 
 | ||||
| 	typedef QMap<uint32, QPixmap> EmojisMap; | ||||
|  | @ -221,7 +221,7 @@ namespace App { | |||
| 		const QVector<MTPUser> &v(users.c_vector().v); | ||||
| 		for (QVector<MTPUser>::const_iterator i = v.cbegin(), e = v.cend(); i != e; ++i) { | ||||
| 			const MTPuser &user(*i); | ||||
| 			UserData *data; | ||||
|             UserData *data = 0; | ||||
| 			bool wasContact = false; | ||||
| 			const MTPUserStatus *status = 0; | ||||
| 
 | ||||
|  | @ -315,6 +315,8 @@ namespace App { | |||
| 			} break; | ||||
| 			} | ||||
| 
 | ||||
|             if (!data) continue; | ||||
| 
 | ||||
| 			data->loaded = true; | ||||
| 			if (status) switch (status->type()) { | ||||
| 			case mtpc_userStatusOffline: data->onlineTill = status->c_userStatusOffline().vwas_online.v; break; | ||||
|  | @ -338,7 +340,7 @@ namespace App { | |||
| 		const QVector<MTPChat> &v(chats.c_vector().v); | ||||
| 		for (QVector<MTPChat>::const_iterator i = v.cbegin(), e = v.cend(); i != e; ++i) { | ||||
| 			const MTPchat &chat(*i); | ||||
| 			ChatData *data; | ||||
|             ChatData *data = 0; | ||||
| 			QString title; | ||||
| 			switch (chat.type()) { | ||||
| 			case mtpc_chat: { | ||||
|  | @ -1222,11 +1224,11 @@ namespace App { | |||
| 
 | ||||
| 	void initMedia() { | ||||
| 		deinitMedia(false); | ||||
| //		if (!newMsgSound) {
 | ||||
| //			newMsgSound = new QSoundEffect();
 | ||||
| //			newMsgSound->setSource(QUrl::fromLocalFile(st::newMsgSound));
 | ||||
| //			newMsgSound->setVolume(1);
 | ||||
| //		}
 | ||||
|         if (!newMsgSound) { | ||||
|             newMsgSound = new QSoundEffect(); | ||||
|             newMsgSound->setSource(QUrl::fromLocalFile(st::newMsgSound)); | ||||
|             newMsgSound->setVolume(1); | ||||
|         } | ||||
| 
 | ||||
| 		if (!::sprite) { | ||||
| 			::sprite = new QPixmap(st::spriteFile); | ||||
|  | @ -1251,9 +1253,9 @@ namespace App { | |||
| 
 | ||||
| 		if (completely) { | ||||
| 			LOG(("Deleting sound..")); | ||||
| //			delete newMsgSound;
 | ||||
|             delete newMsgSound; | ||||
| 			LOG(("Sound deleted!")); | ||||
| //			newMsgSound = 0;
 | ||||
|             newMsgSound = 0; | ||||
| 
 | ||||
| 			delete ::sprite; | ||||
| 			::sprite = 0; | ||||
|  | @ -1344,7 +1346,7 @@ namespace App { | |||
| 	} | ||||
| 
 | ||||
| 	void playSound() { | ||||
| //		if (cSoundNotify() && newMsgSound) newMsgSound->play();
 | ||||
|         if (cSoundNotify() && newMsgSound) newMsgSound->play(); | ||||
| 	} | ||||
| 
 | ||||
| 	void writeConfig() { | ||||
|  |  | |||
|  | @ -81,9 +81,10 @@ Application::Application(int &argc, char **argv) : PsApplication(argc, argv), | |||
| 
 | ||||
| 	installEventFilter(new _DebugWaiter(this)); | ||||
| 
 | ||||
| 	QFontDatabase::addApplicationFont(qsl(":/gui/art/OpenSans-Regular.ttf")); | ||||
| 	QFontDatabase::addApplicationFont(qsl(":/gui/art/OpenSans-Bold.ttf")); | ||||
| 	QFontDatabase::addApplicationFont(qsl(":/gui/art/OpenSans-Semibold.ttf")); | ||||
|     QFontDatabase::addApplicationFont(qsl(":/gui/art/fonts/DejaVuSans.ttf")); | ||||
|     QFontDatabase::addApplicationFont(qsl(":/gui/art/fonts/OpenSans-Regular.ttf")); | ||||
|     QFontDatabase::addApplicationFont(qsl(":/gui/art/fonts/OpenSans-Bold.ttf")); | ||||
|     QFontDatabase::addApplicationFont(qsl(":/gui/art/fonts/OpenSans-Semibold.ttf")); | ||||
| 
 | ||||
| 	float64 dpi = primaryScreen()->logicalDotsPerInch(); | ||||
| 	if (dpi <= 108) { // 0-96-108
 | ||||
|  | @ -417,7 +418,7 @@ void Application::startUpdateCheck(bool forceWait) { | |||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| 	if ((cManyInstance() && !cDebug()) || cPlatform() == dbipLinux) return; // only main instance is updating
 | ||||
|     if (cManyInstance() && !cDebug()) return; // only main instance is updating
 | ||||
| 
 | ||||
| 	if (sendRequest) { | ||||
| 		QNetworkRequest checkVersion(cUpdateURL()); | ||||
|  |  | |||
										
											Binary file not shown.
										
									
								
							|  | @ -0,0 +1,2 @@ | |||
| [Paths] | ||||
| Libraries=:/gui/art | ||||
|  | @ -2716,6 +2716,9 @@ void Text::clean() { | |||
| namespace { | ||||
| 
 | ||||
| 	struct ScriptLine { | ||||
|         ScriptLine() : length(0), textWidth(0) { | ||||
|         } | ||||
| 
 | ||||
| 		int32 length; | ||||
| 		QFixed textWidth; | ||||
| 	}; | ||||
|  |  | |||
|  | @ -31,11 +31,11 @@ LocalImageLoaderPrivate::LocalImageLoaderPrivate(int32 currentUser, LocalImageLo | |||
| 
 | ||||
| void LocalImageLoaderPrivate::prepareImages() { | ||||
| 	QString file, filename, mime; | ||||
| 	int32 filesize; | ||||
|     int32 filesize = 0; | ||||
| 	QImage img; | ||||
| 	QByteArray data; | ||||
| 	PeerId peer; | ||||
| 	uint64 id, jpeg_id; | ||||
|     uint64 id, jpeg_id = 0; | ||||
| 	ToPrepareMediaType type; | ||||
| 	{ | ||||
| 		QMutexLocker lock(loader->toPrepareMutex()); | ||||
|  |  | |||
|  | @ -22,6 +22,12 @@ Copyright (c) 2014 John Preston, https://tdesktop.com | |||
| #include "application.h" | ||||
| #include "mainwidget.h" | ||||
| 
 | ||||
| #include <sys/stat.h> | ||||
| #include <sys/types.h> | ||||
| #include <cstdlib> | ||||
| #include <unistd.h> | ||||
| #include <dirent.h> | ||||
| 
 | ||||
| namespace { | ||||
| 	bool frameless = true; | ||||
| 	bool finished = true; | ||||
|  | @ -483,8 +489,39 @@ void PsUpdateDownloader::partFailed(QNetworkReply::NetworkError e) { | |||
| 	emit App::app()->updateFailed(); | ||||
| } | ||||
| 
 | ||||
| bool _removeDirectory(const QString &path) { // from http://stackoverflow.com/questions/2256945/removing-a-non-empty-directory-programmatically-in-c-or-c
 | ||||
|     QByteArray pathRaw = path.toUtf8(); | ||||
|     DIR *d = opendir(pathRaw.constData()); | ||||
|     if (!d) return false; | ||||
| 
 | ||||
|     while (struct dirent *p = readdir(d)) { | ||||
|         /* Skip the names "." and ".." as we don't want to recurse on them. */ | ||||
|         if (!strcmp(p->d_name, ".") || !strcmp(p->d_name, "..")) continue; | ||||
| 
 | ||||
|         QString fname = path + '/' + p->d_name; | ||||
|         QByteArray fnameRaw = fname.toUtf8(); | ||||
|         struct stat statbuf; | ||||
|         if (!stat(fnameRaw.constData(), &statbuf)) { | ||||
|             if (S_ISDIR(statbuf.st_mode)) { | ||||
|                 if (!_removeDirectory(fname)) { | ||||
|                     closedir(d); | ||||
|                     return false; | ||||
|                 } | ||||
|             } else { | ||||
|                 if (unlink(fnameRaw.constData())) { | ||||
|                     closedir(d); | ||||
|                     return false; | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|     closedir(d); | ||||
| 
 | ||||
|     return !rmdir(pathRaw.constData()); | ||||
| } | ||||
| 
 | ||||
| void PsUpdateDownloader::deleteDir(const QString &dir) { | ||||
| //	objc_deleteDir(dir);
 | ||||
|     _removeDirectory(dir); | ||||
| } | ||||
| 
 | ||||
| void PsUpdateDownloader::fatalFail() { | ||||
|  | @ -765,6 +802,54 @@ int psFixPrevious() { | |||
| 	return 0; | ||||
| } | ||||
| 
 | ||||
| #ifdef Q_OS_LINUX | ||||
| bool moveFile(const char *from, const char *to) { | ||||
|     FILE *ffrom = fopen(from, "rb"), *fto = fopen(to, "wb"); | ||||
|     if (!ffrom) { | ||||
|         if (fto) fclose(fto); | ||||
|         return false; | ||||
|     } | ||||
|     if (!fto) { | ||||
|         fclose(ffrom); | ||||
|         return false; | ||||
|     } | ||||
|     static const int BufSize = 65536; | ||||
|     char buf[BufSize]; | ||||
|     while (size_t size = fread(buf, 1, BufSize, ffrom)) { | ||||
|         fwrite(buf, 1, size, fto); | ||||
|     } | ||||
| 
 | ||||
|     struct stat fst; // from http://stackoverflow.com/questions/5486774/keeping-fileowner-and-permissions-after-copying-file-in-c
 | ||||
|     //let's say this wont fail since you already worked OK on that fp
 | ||||
|     if (fstat(fileno(ffrom), &fst) != 0) { | ||||
|         fclose(ffrom); | ||||
|         fclose(fto); | ||||
|         return false; | ||||
|     } | ||||
|     //update to the same uid/gid
 | ||||
|     if (fchown(fileno(fto), fst.st_uid, fst.st_gid) != 0) { | ||||
|         fclose(ffrom); | ||||
|         fclose(fto); | ||||
|         return false; | ||||
|     } | ||||
|     //update the permissions
 | ||||
|     if (fchmod(fileno(fto), fst.st_mode) != 0) { | ||||
|         fclose(ffrom); | ||||
|         fclose(fto); | ||||
|         return false; | ||||
|     } | ||||
| 
 | ||||
|     fclose(ffrom); | ||||
|     fclose(fto); | ||||
| 
 | ||||
|     if (unlink(from)) { | ||||
|         return false; | ||||
|     } | ||||
| 
 | ||||
|     return true; | ||||
| } | ||||
| #endif | ||||
| 
 | ||||
| bool psCheckReadyUpdate() { | ||||
|     QString readyPath = cWorkingDir() + qsl("tupdates/ready"); | ||||
| 	if (!QDir(readyPath).exists()) { | ||||
|  | @ -801,8 +886,8 @@ bool psCheckReadyUpdate() { | |||
| 	QString curUpdater = (cExeDir() + "Telegram.app/Contents/Frameworks/Updater"); | ||||
| 	QFileInfo updater(cWorkingDir() + "tupdates/ready/Telegram.app/Contents/Frameworks/Updater"); | ||||
| #elif defined Q_OS_LINUX | ||||
|     QString curUpdater; | ||||
|     QFileInfo updater; | ||||
|     QString curUpdater = (cExeDir() + "Updater"); | ||||
|     QFileInfo updater(cWorkingDir() + "tupdates/ready/Updater"); | ||||
| #endif | ||||
| 	if (!updater.exists()) { | ||||
| 		QFileInfo current(curUpdater); | ||||
|  | @ -831,6 +916,12 @@ bool psCheckReadyUpdate() { | |||
| 		PsUpdateDownloader::clearAll(); | ||||
| 		return false; | ||||
| 	} | ||||
| #elif defined Q_OS_LINUX | ||||
|     QFileInfo to(curUpdater); | ||||
|     if (!moveFile(updater.absoluteFilePath().toUtf8().constData(), curUpdater.toUtf8().constData())) { | ||||
|         PsUpdateDownloader::clearAll(); | ||||
|         return false; | ||||
|     } | ||||
| #endif | ||||
|     return true; | ||||
| } | ||||
|  | @ -854,10 +945,16 @@ void psFinish() { | |||
| } | ||||
| 
 | ||||
| bool _execUpdater(bool update = true) { | ||||
|     static const int MaxArgsCount = 128, MaxLen = 65536; | ||||
|     static const int MaxLen = 65536, MaxArgsCount = 128; | ||||
| 
 | ||||
|     char path[MaxLen] = {0}; | ||||
|     QByteArray data((cExeDir() + "Updater").toUtf8()); | ||||
|     memcpy(path, data.constData(), data.size()); | ||||
| 
 | ||||
|     char *args[MaxArgsCount] = {0}, p_noupdate[] = "-noupdate", p_autostart[] = "-autostart", p_debug[] = "-debug", p_tosettings[] = "-tosettings", p_key[] = "-key"; | ||||
|     char p_datafile[MaxLen] = {0}; | ||||
|     int argIndex = 0; | ||||
|     args[argIndex++] = path; | ||||
|     if (!update) { | ||||
|         args[argIndex++] = p_noupdate; | ||||
|         args[argIndex++] = p_tosettings; | ||||
|  | @ -872,9 +969,6 @@ bool _execUpdater(bool update = true) { | |||
|             args[argIndex++] = p_datafile; | ||||
|         } | ||||
|     } | ||||
|     char path[MaxLen] = {0}; | ||||
|     QByteArray data((cExeDir() + "Updater").toUtf8()); | ||||
|     memcpy(path, data.constData(), data.size()); | ||||
| 
 | ||||
|     pid_t pid = fork(); | ||||
|     switch (pid) { | ||||
|  |  | |||
|  | @ -1,8 +1,8 @@ | |||
| <RCC> | ||||
|     <qresource prefix="/gui"> | ||||
|         <file>art/OpenSans-Regular.ttf</file> | ||||
|         <file>art/OpenSans-Bold.ttf</file> | ||||
|         <file>art/OpenSans-Semibold.ttf</file> | ||||
|         <file>art/fonts/OpenSans-Regular.ttf</file> | ||||
|         <file>art/fonts/OpenSans-Bold.ttf</file> | ||||
|         <file>art/fonts/OpenSans-Semibold.ttf</file> | ||||
|         <file>art/newmsg.wav</file> | ||||
|         <file>art/bg.png</file> | ||||
|         <file>art/bg_125x.png</file> | ||||
|  | @ -18,6 +18,7 @@ | |||
|         <file>art/emoji_200x.png</file> | ||||
|         <file>art/blank.gif</file> | ||||
|         <file>art/iconround256.png</file> | ||||
|         <file>art/fonts/DejaVuSans.ttf</file> | ||||
|     </qresource> | ||||
|     <qresource prefix="/ava"> | ||||
|         <file>art/chatcolor1.png</file> | ||||
|  |  | |||
|  | @ -0,0 +1,43 @@ | |||
| <RCC> | ||||
|     <qresource prefix="/gui"> | ||||
|         <file>art/fonts/OpenSans-Regular.ttf</file> | ||||
|         <file>art/fonts/OpenSans-Bold.ttf</file> | ||||
|         <file>art/fonts/OpenSans-Semibold.ttf</file> | ||||
|         <file>art/newmsg.wav</file> | ||||
|         <file>art/bg.png</file> | ||||
|         <file>art/bg_125x.png</file> | ||||
|         <file>art/bg_150x.png</file> | ||||
|         <file>art/bg_200x.png</file> | ||||
|         <file>art/sprite.png</file> | ||||
|         <file>art/sprite_125x.png</file> | ||||
|         <file>art/sprite_150x.png</file> | ||||
|         <file>art/sprite_200x.png</file> | ||||
|         <file>art/emoji.png</file> | ||||
|         <file>art/emoji_125x.png</file> | ||||
|         <file>art/emoji_150x.png</file> | ||||
|         <file>art/emoji_200x.png</file> | ||||
|         <file>art/blank.gif</file> | ||||
|         <file>art/iconround256.png</file> | ||||
|         <file>art/fonts/DejaVuSans.ttf</file> | ||||
|     </qresource> | ||||
|     <qresource prefix="/ava"> | ||||
|         <file>art/chatcolor1.png</file> | ||||
|         <file>art/chatcolor2.png</file> | ||||
|         <file>art/chatcolor3.png</file> | ||||
|         <file>art/chatcolor4.png</file> | ||||
|         <file>art/usercolor1.png</file> | ||||
|         <file>art/usercolor2.png</file> | ||||
|         <file>art/usercolor3.png</file> | ||||
|         <file>art/usercolor4.png</file> | ||||
|         <file>art/usercolor5.png</file> | ||||
|         <file>art/usercolor6.png</file> | ||||
|         <file>art/usercolor7.png</file> | ||||
|         <file>art/usercolor8.png</file> | ||||
|     </qresource> | ||||
|     <qresource prefix="/qt-project.org"> | ||||
|         <file>qmime/freedesktop.org.xml</file> | ||||
|     </qresource> | ||||
|     <qresource prefix="/qt"> | ||||
|         <file>etc/qt.conf</file> | ||||
|     </qresource> | ||||
| </RCC> | ||||
|  | @ -1,20 +1,19 @@ | |||
| QT += core gui network widgets | ||||
| #QT += multimedia | ||||
| QT += core gui network multimedia widgets | ||||
| 
 | ||||
| CONFIG += plugin static | ||||
| 
 | ||||
| CONFIG(debug, debug|release) { | ||||
|     DEFINES += _DEBUG | ||||
|     OBJECTS_DIR = ./../DebugIntermediate | ||||
|     MOC_DIR = ./GeneratedFiles/Debug | ||||
|     RCC_DIR = ./GeneratedFiles | ||||
|     MOC_DIR = ./GenFiles/Debug | ||||
|     RCC_DIR = ./GenFiles | ||||
|     DESTDIR = ./../Debug | ||||
| } | ||||
| CONFIG(release, debug|release) { | ||||
|     DEFINES += CUSTOM_API_ID | ||||
|     OBJECTS_DIR = ./../ReleaseIntermediate | ||||
|     MOC_DIR = ./GeneratedFiles/Release | ||||
|     RCC_DIR = ./GeneratedFiles | ||||
|     MOC_DIR = ./GenFiles/Release | ||||
|     RCC_DIR = ./GenFiles | ||||
|     DESTDIR = ./../Release | ||||
| } | ||||
| 
 | ||||
|  | @ -30,29 +29,29 @@ linux { | |||
|     HEADERS += ./SourceFiles/pspecific_linux.h | ||||
| } | ||||
| 
 | ||||
| style_auto_cpp.target = ./../../Telegram/GeneratedFiles/style_auto.cpp | ||||
| style_auto_cpp.target = ./GeneratedFiles/style_auto.cpp | ||||
| style_auto_cpp.depends = FORCE | ||||
| style_auto_cpp.commands = ./../DebugStyle/MetaStyle -classes_in ./../../Telegram/Resources/style_classes.txt -classes_out ./../../Telegram/GeneratedFiles/style_classes.h -styles_in ./../../Telegram/Resources/style.txt -styles_out ./../../Telegram/GeneratedFiles/style_auto.h -path_to_sprites ./../../Telegram/SourceFiles/art/ | ||||
| style_auto_cpp.commands = mkdir -p ./../../Telegram/GeneratedFiles && ./../DebugStyle/MetaStyle -classes_in ./../../Telegram/Resources/style_classes.txt -classes_out ./../../Telegram/GeneratedFiles/style_classes.h -styles_in ./../../Telegram/Resources/style.txt -styles_out ./../../Telegram/GeneratedFiles/style_auto.h -path_to_sprites ./../../Telegram/SourceFiles/art/ | ||||
| style_auto_cpp.depends = ./../../Telegram/Resources/style.txt ./../../Telegram/Resources/style_classes.txt | ||||
| 
 | ||||
| style_auto_h.target = ./../../Telegram/GeneratedFiles/style_auto.h | ||||
| style_auto_h.target = ./GeneratedFiles/style_auto.h | ||||
| style_auto_h.depends = FORCE | ||||
| style_auto_h.commands = ./../DebugStyle/MetaStyle -classes_in ./../../Telegram/Resources/style_classes.txt -classes_out ./../../Telegram/GeneratedFiles/style_classes.h -styles_in ./../../Telegram/Resources/style.txt -styles_out ./../../Telegram/GeneratedFiles/style_auto.h -path_to_sprites ./../../Telegram/SourceFiles/art/ | ||||
| style_auto_h.commands = mkdir -p ./../../Telegram/GeneratedFiles && ./../DebugStyle/MetaStyle -classes_in ./../../Telegram/Resources/style_classes.txt -classes_out ./../../Telegram/GeneratedFiles/style_classes.h -styles_in ./../../Telegram/Resources/style.txt -styles_out ./../../Telegram/GeneratedFiles/style_auto.h -path_to_sprites ./../../Telegram/SourceFiles/art/ | ||||
| style_auto_h.depends = ./../../Telegram/Resources/style.txt ./../../Telegram/Resources/style_classes.txt | ||||
| 
 | ||||
| style_classes_h.target = ./../../Telegram/GeneratedFiles/style_classes.h | ||||
| style_classes_h.target = ./GeneratedFiles/style_classes.h | ||||
| style_classes_h.depends = FORCE | ||||
| style_classes_h.commands = ./../DebugStyle/MetaStyle -classes_in ./../../Telegram/Resources/style_classes.txt -classes_out ./../../Telegram/GeneratedFiles/style_classes.h -styles_in ./../../Telegram/Resources/style.txt -styles_out ./../../Telegram/GeneratedFiles/style_auto.h -path_to_sprites ./../../Telegram/SourceFiles/art/ | ||||
| style_classes_h.commands = mkdir -p ./../../Telegram/GeneratedFiles && ./../DebugStyle/MetaStyle -classes_in ./../../Telegram/Resources/style_classes.txt -classes_out ./../../Telegram/GeneratedFiles/style_classes.h -styles_in ./../../Telegram/Resources/style.txt -styles_out ./../../Telegram/GeneratedFiles/style_auto.h -path_to_sprites ./../../Telegram/SourceFiles/art/ | ||||
| style_classes_h.depends = ./../../Telegram/Resources/style.txt ./../../Telegram/Resources/style_classes.txt | ||||
| 
 | ||||
| lang_cpp.target = ./../../Telegram/GeneratedFiles/lang.cpp | ||||
| lang_cpp.target = ./GeneratedFiles/lang.cpp | ||||
| lang_cpp.depends = FORCE | ||||
| lang_cpp.commands = ./../DebugLang/MetaLang -lang_in ./../../Telegram/Resources/lang.txt -lang_out ./../../Telegram/GeneratedFiles/lang | ||||
| lang_cpp.commands = mkdir -p ./../../Telegram/GeneratedFiles && ./../DebugLang/MetaLang -lang_in ./../../Telegram/Resources/lang.txt -lang_out ./../../Telegram/GeneratedFiles/lang | ||||
| lang_cpp.depends = ./../../Telegram/Resources/lang.txt | ||||
| 
 | ||||
| lang_h.target = ./../../Telegram/GeneratedFiles/lang.h | ||||
| lang_h.target = ./GeneratedFiles/lang.h | ||||
| lang_h.depends = FORCE | ||||
| lang_h.commands = ./../DebugLang/MetaLang -lang_in ./../../Telegram/Resources/lang.txt -lang_out ./../../Telegram/GeneratedFiles/lang | ||||
| lang_h.commands = mkdir -p ./../../Telegram/GeneratedFiles && ./../DebugLang/MetaLang -lang_in ./../../Telegram/Resources/lang.txt -lang_out ./../../Telegram/GeneratedFiles/lang | ||||
| lang_h.depends = ./../../Telegram/Resources/lang.txt | ||||
| 
 | ||||
| hook.depends = style_auto_cpp style_auto_h style_classes_h lang_cpp lang_h | ||||
|  | @ -63,6 +62,8 @@ QMAKE_EXTRA_TARGETS += style_auto_cpp style_auto_h style_classes_h lang_cpp lang | |||
| 
 | ||||
| PRE_TARGETDEPS += ./GeneratedFiles/style_auto.cpp ./GeneratedFiles/style_auto.h ./GeneratedFiles/style_classes.h ./GeneratedFiles/lang.h ./GeneratedFiles/lang.cpp | ||||
| 
 | ||||
| CONFIG(release,debug|release):QMAKE_PRE_LINK = ./../../Telegram/FixMake.sh | ||||
| 
 | ||||
| SOURCES += \ | ||||
|     ./SourceFiles/main.cpp \ | ||||
|     ./SourceFiles/stdafx.cpp \ | ||||
|  | @ -224,19 +225,31 @@ CONFIG += precompile_header | |||
| 
 | ||||
| PRECOMPILED_HEADER = ./SourceFiles/stdafx.h | ||||
| 
 | ||||
| QMAKE_CXXFLAGS += -fno-strict-aliasing | ||||
| QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-parameter -Wno-unused-variable -Wno-switch -Wno-comment -Wno-unused-but-set-variable | ||||
| 
 | ||||
| CONFIG(release, debug|release) { | ||||
|     QMAKE_CXXFLAGS_RELEASE -= -O2 | ||||
|     QMAKE_CXXFLAGS_RELEASE += -Ofast -flto -fno-strict-aliasing | ||||
|     QMAKE_LFLAGS_RELEASE -= -O1 | ||||
|     QMAKE_LFLAGS_RELEASE += -Ofast -flto | ||||
| } | ||||
| 
 | ||||
| INCLUDEPATH += ./../../Libraries/QtStatic/qtbase/include/QtGui/5.3.1/QtGui\ | ||||
|                ./../../Libraries/QtStatic/qtbase/include/QtCore/5.3.1/QtCore\ | ||||
|                ./../../Libraries/QtStatic/qtbase/include\ | ||||
|                ./SourceFiles\ | ||||
|                ./GeneratedFiles\ | ||||
|                ./../../Telegram/GeneratedFiles\ # qmake bug?.. Sometimes ./GeneratedFiles does not mean this path :( | ||||
|                ./../../Libraries/libexif-0.6.20\ | ||||
|                /usr/local/ssl/include | ||||
| LIBS += -L/usr/local/ssl/lib -lcrypto -lssl -lz -ldl -llzma | ||||
| LIBS += -L/usr/local/ssl/lib -lcrypto -lssl -lz -ldl -llzma -lpulse | ||||
| LIBS += ./../../../Libraries/libexif-0.6.20/libexif/.libs/libexif.a | ||||
| LIBS += ./../../../Libraries/QtStatic/qtmultimedia/plugins/audio/libqtmedia_pulse.a | ||||
| RESOURCES += \ | ||||
|     ./SourceFiles/telegram.qrc | ||||
|     ./SourceFiles/telegram_linux.qrc | ||||
| 
 | ||||
| OTHER_FILES += \ | ||||
|     Resources/style_classes.txt \ | ||||
|     Resources/style.txt \ | ||||
|     Resources/lang.txt | ||||
| 
 | ||||
|  |  | |||
|  | @ -0,0 +1,26 @@ | |||
| TARGET = qtmedia_pulse | ||||
| QT += multimedia-private | ||||
| 
 | ||||
| PLUGIN_TYPE = audio | ||||
| PLUGIN_CLASS_NAME = QPulseAudioPlugin | ||||
| load(qt_plugin) | ||||
| 
 | ||||
| CONFIG += link_pkgconfig | ||||
| PKGCONFIG += libpulse | ||||
| CONFIG += static plugin | ||||
| HEADERS += qpulseaudioplugin.h \ | ||||
|            qaudiodeviceinfo_pulse.h \ | ||||
|            qaudiooutput_pulse.h \ | ||||
|            qaudioinput_pulse.h \ | ||||
|            qpulseaudioengine.h \ | ||||
|            qpulsehelpers.h | ||||
| 
 | ||||
| SOURCES += qpulseaudioplugin.cpp \ | ||||
|            qaudiodeviceinfo_pulse.cpp \ | ||||
|            qaudiooutput_pulse.cpp \ | ||||
|            qaudioinput_pulse.cpp \ | ||||
|            qpulseaudioengine.cpp \ | ||||
|            qpulsehelpers.cpp | ||||
| 
 | ||||
| OTHER_FILES += \ | ||||
|     pulseaudio.json | ||||
							
								
								
									
										1
									
								
								XCODE.md
								
								
								
								
							
							
						
						
									
										1
									
								
								XCODE.md
								
								
								
								
							|  | @ -91,4 +91,5 @@ building (**make** command) will take really long time. | |||
| * 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 | ||||
| * Build Updater target as well, it is required for Telegram relaunch | ||||
| * 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) | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue