diff --git a/README.md b/README.md index 2dae81eef..d502e6b3a 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/Telegram/FixMake.sh b/Telegram/FixMake.sh new file mode 100755 index 000000000..567e7e672 --- /dev/null +++ b/Telegram/FixMake.sh @@ -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 + diff --git a/Telegram/PrepareUbuntu.sh b/Telegram/PrepareUbuntu.sh new file mode 100755 index 000000000..7a74be670 --- /dev/null +++ b/Telegram/PrepareUbuntu.sh @@ -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!"; + diff --git a/Telegram/SourceFiles/_other/updater_linux.cpp b/Telegram/SourceFiles/_other/updater_linux.cpp index 17644207f..0fc462be6 100644 --- a/Telegram/SourceFiles/_other/updater_linux.cpp +++ b/Telegram/SourceFiles/_other/updater_linux.cpp @@ -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.."); diff --git a/Telegram/SourceFiles/app.cpp b/Telegram/SourceFiles/app.cpp index 06d69d125..ef21d548a 100644 --- a/Telegram/SourceFiles/app.cpp +++ b/Telegram/SourceFiles/app.cpp @@ -23,7 +23,7 @@ Copyright (c) 2014 John Preston, https://tdesktop.com #include "application.h" #include "fileuploader.h" #include "mainwidget.h" -//#include +#include #include 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 EmojisMap; @@ -221,7 +221,7 @@ namespace App { const QVector &v(users.c_vector().v); for (QVector::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 &v(chats.c_vector().v); for (QVector::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() { diff --git a/Telegram/SourceFiles/application.cpp b/Telegram/SourceFiles/application.cpp index 2ad2a0aca..c30a4c46b 100644 --- a/Telegram/SourceFiles/application.cpp +++ b/Telegram/SourceFiles/application.cpp @@ -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 @@ -115,7 +116,7 @@ Application::Application(int &argc, char **argv) : PsApplication(argc, argv), anim::startManager(); historyInit(); - window = new Window(); + window = new Window(); psInstallEventFilter(); @@ -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()); diff --git a/Telegram/SourceFiles/art/fonts/DejaVuSans.ttf b/Telegram/SourceFiles/art/fonts/DejaVuSans.ttf new file mode 100644 index 000000000..7e411a71b Binary files /dev/null and b/Telegram/SourceFiles/art/fonts/DejaVuSans.ttf differ diff --git a/Telegram/SourceFiles/art/OpenSans-Bold.ttf b/Telegram/SourceFiles/art/fonts/OpenSans-Bold.ttf similarity index 100% rename from Telegram/SourceFiles/art/OpenSans-Bold.ttf rename to Telegram/SourceFiles/art/fonts/OpenSans-Bold.ttf diff --git a/Telegram/SourceFiles/art/OpenSans-Regular.ttf b/Telegram/SourceFiles/art/fonts/OpenSans-Regular.ttf similarity index 100% rename from Telegram/SourceFiles/art/OpenSans-Regular.ttf rename to Telegram/SourceFiles/art/fonts/OpenSans-Regular.ttf diff --git a/Telegram/SourceFiles/art/OpenSans-Semibold.ttf b/Telegram/SourceFiles/art/fonts/OpenSans-Semibold.ttf similarity index 100% rename from Telegram/SourceFiles/art/OpenSans-Semibold.ttf rename to Telegram/SourceFiles/art/fonts/OpenSans-Semibold.ttf diff --git a/Telegram/SourceFiles/etc/qt.conf b/Telegram/SourceFiles/etc/qt.conf new file mode 100644 index 000000000..6d80862b5 --- /dev/null +++ b/Telegram/SourceFiles/etc/qt.conf @@ -0,0 +1,2 @@ +[Paths] +Libraries=:/gui/art diff --git a/Telegram/SourceFiles/gui/text.cpp b/Telegram/SourceFiles/gui/text.cpp index ceb30c163..edabf19c8 100644 --- a/Telegram/SourceFiles/gui/text.cpp +++ b/Telegram/SourceFiles/gui/text.cpp @@ -2716,6 +2716,9 @@ void Text::clean() { namespace { struct ScriptLine { + ScriptLine() : length(0), textWidth(0) { + } + int32 length; QFixed textWidth; }; diff --git a/Telegram/SourceFiles/localimageloader.cpp b/Telegram/SourceFiles/localimageloader.cpp index c912c833c..a1e9df5d7 100644 --- a/Telegram/SourceFiles/localimageloader.cpp +++ b/Telegram/SourceFiles/localimageloader.cpp @@ -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()); diff --git a/Telegram/SourceFiles/pspecific_linux.cpp b/Telegram/SourceFiles/pspecific_linux.cpp index e19f4cd2f..db256a83f 100644 --- a/Telegram/SourceFiles/pspecific_linux.cpp +++ b/Telegram/SourceFiles/pspecific_linux.cpp @@ -22,6 +22,12 @@ Copyright (c) 2014 John Preston, https://tdesktop.com #include "application.h" #include "mainwidget.h" +#include +#include +#include +#include +#include + 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) { diff --git a/Telegram/SourceFiles/telegram.qrc b/Telegram/SourceFiles/telegram.qrc index a255b114c..025c2b665 100644 --- a/Telegram/SourceFiles/telegram.qrc +++ b/Telegram/SourceFiles/telegram.qrc @@ -1,8 +1,8 @@ - art/OpenSans-Regular.ttf - art/OpenSans-Bold.ttf - art/OpenSans-Semibold.ttf + art/fonts/OpenSans-Regular.ttf + art/fonts/OpenSans-Bold.ttf + art/fonts/OpenSans-Semibold.ttf art/newmsg.wav art/bg.png art/bg_125x.png @@ -18,6 +18,7 @@ art/emoji_200x.png art/blank.gif art/iconround256.png + art/fonts/DejaVuSans.ttf art/chatcolor1.png diff --git a/Telegram/SourceFiles/telegram_linux.qrc b/Telegram/SourceFiles/telegram_linux.qrc new file mode 100644 index 000000000..e6ebb00de --- /dev/null +++ b/Telegram/SourceFiles/telegram_linux.qrc @@ -0,0 +1,43 @@ + + + art/fonts/OpenSans-Regular.ttf + art/fonts/OpenSans-Bold.ttf + art/fonts/OpenSans-Semibold.ttf + art/newmsg.wav + art/bg.png + art/bg_125x.png + art/bg_150x.png + art/bg_200x.png + art/sprite.png + art/sprite_125x.png + art/sprite_150x.png + art/sprite_200x.png + art/emoji.png + art/emoji_125x.png + art/emoji_150x.png + art/emoji_200x.png + art/blank.gif + art/iconround256.png + art/fonts/DejaVuSans.ttf + + + art/chatcolor1.png + art/chatcolor2.png + art/chatcolor3.png + art/chatcolor4.png + art/usercolor1.png + art/usercolor2.png + art/usercolor3.png + art/usercolor4.png + art/usercolor5.png + art/usercolor6.png + art/usercolor7.png + art/usercolor8.png + + + qmime/freedesktop.org.xml + + + etc/qt.conf + + diff --git a/Telegram/Telegram.pro b/Telegram/Telegram.pro index 0a910a515..d7f4fac62 100644 --- a/Telegram/Telegram.pro +++ b/Telegram/Telegram.pro @@ -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 diff --git a/Telegram/_qt_5_3_1_patch/qtmultimedia/src/plugins/pulseaudio/pulseaudio.pro b/Telegram/_qt_5_3_1_patch/qtmultimedia/src/plugins/pulseaudio/pulseaudio.pro new file mode 100644 index 000000000..fe8de004f --- /dev/null +++ b/Telegram/_qt_5_3_1_patch/qtmultimedia/src/plugins/pulseaudio/pulseaudio.pro @@ -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 diff --git a/XCODE.md b/XCODE.md index 3c606de05..989b20d06 100644 --- a/XCODE.md +++ b/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)