diff --git a/Telegram/Resources/winrc/Telegram.rc b/Telegram/Resources/winrc/Telegram.rc index 20762902c..61f4579db 100644 --- a/Telegram/Resources/winrc/Telegram.rc +++ b/Telegram/Resources/winrc/Telegram.rc @@ -34,8 +34,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,4,0 - PRODUCTVERSION 1,0,4,0 + FILEVERSION 1,0,5,0 + PRODUCTVERSION 1,0,5,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -51,10 +51,10 @@ BEGIN BLOCK "040904b0" BEGIN VALUE "CompanyName", "Telegram Messenger LLP" - VALUE "FileVersion", "1.0.4.0" + VALUE "FileVersion", "1.0.5.0" VALUE "LegalCopyright", "Copyright (C) 2014-2017" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "1.0.4.0" + VALUE "ProductVersion", "1.0.5.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/Resources/winrc/Updater.rc b/Telegram/Resources/winrc/Updater.rc index 0bf29c3b9..f1cbdaba4 100644 --- a/Telegram/Resources/winrc/Updater.rc +++ b/Telegram/Resources/winrc/Updater.rc @@ -25,8 +25,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,4,0 - PRODUCTVERSION 1,0,4,0 + FILEVERSION 1,0,5,0 + PRODUCTVERSION 1,0,5,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -43,10 +43,10 @@ BEGIN BEGIN VALUE "CompanyName", "Telegram Messenger LLP" VALUE "FileDescription", "Telegram Updater" - VALUE "FileVersion", "1.0.4.0" + VALUE "FileVersion", "1.0.5.0" VALUE "LegalCopyright", "Copyright (C) 2014-2017" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "1.0.4.0" + VALUE "ProductVersion", "1.0.5.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/SourceFiles/application.cpp b/Telegram/SourceFiles/application.cpp index c2c5082da..e22461404 100644 --- a/Telegram/SourceFiles/application.cpp +++ b/Telegram/SourceFiles/application.cpp @@ -1071,7 +1071,7 @@ void AppClass::checkMapVersion() { QString versionFeatures; if ((cAlphaVersion() || cBetaVersion()) && Local::oldMapVersion() < 1000004) { versionFeatures = QString::fromUtf8("\xe2\x80\x94 Click and drag to reorder pinned chats."); - } else if (!(cAlphaVersion() || cBetaVersion()) && Local::oldMapVersion() < 1000002) { + } else if (!(cAlphaVersion() || cBetaVersion()) && Local::oldMapVersion() < 1000005) { versionFeatures = langNewVersionText(); } else { versionFeatures = lang(lng_new_version_minor).trimmed(); diff --git a/Telegram/SourceFiles/core/version.h b/Telegram/SourceFiles/core/version.h index 3330da0ba..3a8cef9fb 100644 --- a/Telegram/SourceFiles/core/version.h +++ b/Telegram/SourceFiles/core/version.h @@ -24,7 +24,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org #define BETA_VERSION_MACRO (0ULL) -constexpr int AppVersion = 1000004; -constexpr str_const AppVersionStr = "1.0.4"; -constexpr bool AppAlphaVersion = true; +constexpr int AppVersion = 1000005; +constexpr str_const AppVersionStr = "1.0.5"; +constexpr bool AppAlphaVersion = false; constexpr uint64 AppBetaVersion = BETA_VERSION_MACRO; diff --git a/Telegram/SourceFiles/history/history_media_types.cpp b/Telegram/SourceFiles/history/history_media_types.cpp index 0bf167b2c..dba7184d8 100644 --- a/Telegram/SourceFiles/history/history_media_types.cpp +++ b/Telegram/SourceFiles/history/history_media_types.cpp @@ -925,8 +925,7 @@ HistoryDocument::HistoryDocument(HistoryItem *parent, DocumentData *document, co , _data(document) { createComponents(!caption.isEmpty()); if (auto named = Get()) { - named->_name = documentName(_data); - named->_namew = st::semiboldFont->width(named->_name); + fillNamedFromData(named); } setDocumentLinks(_data); @@ -948,8 +947,7 @@ HistoryDocument::HistoryDocument(HistoryItem *parent, const HistoryDocument &oth named->_name = othernamed->_name; named->_namew = othernamed->_namew; } else { - named->_name = documentName(_data); - named->_namew = st::semiboldFont->width(named->_name); + fillNamedFromData(named); } } @@ -968,7 +966,11 @@ void HistoryDocument::createComponents(bool caption) { mask |= HistoryDocumentVoice::Bit(); } else { mask |= HistoryDocumentNamed::Bit(); - if (!_data->song() && !_data->thumb->isNull() && _data->thumb->width() && _data->thumb->height()) { + if (!_data->song() + && !documentIsExecutableName(_data->name) + && !_data->thumb->isNull() + && _data->thumb->width() + && _data->thumb->height()) { mask |= HistoryDocumentThumbed::Bit(); } } @@ -982,6 +984,11 @@ void HistoryDocument::createComponents(bool caption) { } } +void HistoryDocument::fillNamedFromData(HistoryDocumentNamed *named) { + auto name = named->_name = documentName(_data); + named->_namew = st::semiboldFont->width(name); +} + void HistoryDocument::initDimensions() { auto captioned = Get(); if (captioned && captioned->_caption.hasSkipBlock()) { @@ -1202,6 +1209,7 @@ void HistoryDocument::draw(Painter &p, const QRect &r, TextSelection selection, icon->paintInCenter(p, inner); } auto namewidth = _width - nameleft - nameright; + auto statuswidth = namewidth; if (auto voice = Get()) { const VoiceWaveform *wf = nullptr; @@ -1267,7 +1275,7 @@ void HistoryDocument::draw(Painter &p, const QRect &r, TextSelection selection, p.setFont(st::semiboldFont); p.setPen(outbg ? st::historyFileNameOutFg : st::historyFileNameInFg); if (namewidth < named->_namew) { - p.drawTextLeft(nameleft, nametop, _width, st::semiboldFont->elided(named->_name, namewidth)); + p.drawTextLeft(nameleft, nametop, _width, st::semiboldFont->elided(named->_name, namewidth, Qt::ElideMiddle)); } else { p.drawTextLeft(nameleft, nametop, _width, named->_name, named->_namew); } @@ -1280,7 +1288,7 @@ void HistoryDocument::draw(Painter &p, const QRect &r, TextSelection selection, if (_parent->isMediaUnread()) { int32 w = st::normalFont->width(_statusText); - if (w + st::mediaUnreadSkip + st::mediaUnreadSize <= namewidth) { + if (w + st::mediaUnreadSkip + st::mediaUnreadSize <= statuswidth) { p.setPen(Qt::NoPen); p.setBrush(outbg ? (selected ? st::msgFileOutBgSelected : st::msgFileOutBg) : (selected ? st::msgFileInBgSelected : st::msgFileInBg)); diff --git a/Telegram/SourceFiles/history/history_media_types.h b/Telegram/SourceFiles/history/history_media_types.h index 5c4477dbf..98b8fa8f2 100644 --- a/Telegram/SourceFiles/history/history_media_types.h +++ b/Telegram/SourceFiles/history/history_media_types.h @@ -406,6 +406,7 @@ protected: private: void createComponents(bool caption); + void fillNamedFromData(HistoryDocumentNamed *named); void setStatusSize(int32 newSize, qint64 realDuration = 0) const; bool updateStatusText() const; // returns showPause diff --git a/Telegram/SourceFiles/layout.cpp b/Telegram/SourceFiles/layout.cpp index 7b62afc27..34bdd6a2e 100644 --- a/Telegram/SourceFiles/layout.cpp +++ b/Telegram/SourceFiles/layout.cpp @@ -141,7 +141,7 @@ QString formatPlayedText(qint64 played, qint64 duration) { } QString documentName(DocumentData *document) { - SongData *song = document->song(); + auto song = document->song(); if (!song || (song->title.isEmpty() && song->performer.isEmpty())) { return document->name.isEmpty() ? qsl("Unknown File") : document->name; } @@ -264,7 +264,7 @@ mka mks mcf m2p ps ts m2ts ifo aaf avchd cam dat dsh dvr-ms m1v fla flr sol wrap wtv 8svx 16svx iff aiff aif aifc au bwf cdda raw wav flac la pac m4a ape ofr ofs off rka \ shn tak tta wv brstm dts dtshd dtsma ast amr mp3 spx gsm aac mpc vqf ra ots swa vox voc \ dwd smp aup cust mid mus sib sid ly gym vgm psf nsf mod ptb s3m xm it mt2 minipsf psflib \ -2sf dsf gsf psf2 qsf ssf usf rmj spc niff mxl xml txm ym jam mp1 mscz \ +2sf dsf gsf psf2 qsf ssf usf rmj spc niff mxl xml txm ym jam mp1 mscz\ ").split(' '); return result.release(); })()); @@ -273,3 +273,27 @@ dwd smp aup cust mid mus sib sid ly gym vgm psf nsf mod ptb s3m xm it mt2 minips auto parts = info.fileName().split('.', QString::SkipEmptyParts); return !parts.isEmpty() && (validMediaTypes->indexOf(parts.back().toLower()) >= 0); } + +bool documentIsExecutableName(const QString &filename) { + static StaticNeverFreedPointer> executableTypes(([] { + std_::unique_ptr> result = std_::make_unique>(); +#ifdef Q_OS_MAC + *result = qsl("\ +action app bin command csh osx workflow\ +").split(' '); +#elif defined Q_OS_LINUX // Q_OS_MAC + *result = qsl("\ +bin csh ksh out run\ +").split(' '); +#elif defined Q_OS_WINRT || defined Q_OS_WIN // Q_OS_MAC || Q_OS_LINUX + *result = qsl("\ +bat bin cmd com cpl exe gadget inf ins inx isu job jse lnk msc msi \ +msp mst paf pif ps1 reg rgs sct shb shs u3p vb vbe vbs vbscript ws wsf\ +").split(' '); +#endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WINRT || Q_OS_WIN + return result.release(); + })()); + + auto lastDotIndex = filename.lastIndexOf('.'); + return (lastDotIndex >= 0) && (executableTypes->indexOf(filename.mid(lastDotIndex + 1).toLower()) >= 0); +} diff --git a/Telegram/SourceFiles/layout.h b/Telegram/SourceFiles/layout.h index 56ac336d0..16e2e86ed 100644 --- a/Telegram/SourceFiles/layout.h +++ b/Telegram/SourceFiles/layout.h @@ -90,6 +90,7 @@ style::color documentOverColor(int colorIndex); style::color documentSelectedColor(int colorIndex); RoundCorners documentCorners(int colorIndex); bool documentIsValidMediaFile(const QString &filepath); +bool documentIsExecutableName(const QString &filename); class PaintContextBase { public: diff --git a/Telegram/SourceFiles/overview/overview_layout.h b/Telegram/SourceFiles/overview/overview_layout.h index 8a705ea35..bff86275e 100644 --- a/Telegram/SourceFiles/overview/overview_layout.h +++ b/Telegram/SourceFiles/overview/overview_layout.h @@ -327,7 +327,7 @@ private: int32 _thumbw, _colorIndex; bool withThumb() const { - return !_data->thumb->isNull() && _data->thumb->width() && _data->thumb->height(); + return !_data->song() && !_data->thumb->isNull() && _data->thumb->width() && _data->thumb->height() && !documentIsExecutableName(_data->name); } bool updateStatusText(); diff --git a/Telegram/build/version b/Telegram/build/version index 6f8460cdc..c6e2ab595 100644 --- a/Telegram/build/version +++ b/Telegram/build/version @@ -1,6 +1,6 @@ -AppVersion 1000004 +AppVersion 1000005 AppVersionStrMajor 1.0 -AppVersionStrSmall 1.0.4 -AppVersionStr 1.0.4 -AlphaChannel 1 +AppVersionStrSmall 1.0.5 +AppVersionStr 1.0.5 +AlphaChannel 0 BetaVersion 0