Version 1.0.5: new audio code + reorder pinned chats.

This commit is contained in:
John Preston 2017-01-31 12:13:51 +03:00
parent 6df0591e82
commit 33d2ec0f54
10 changed files with 60 additions and 26 deletions

View file

@ -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"

View file

@ -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"

View file

@ -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();

View file

@ -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;

View file

@ -925,8 +925,7 @@ HistoryDocument::HistoryDocument(HistoryItem *parent, DocumentData *document, co
, _data(document) {
createComponents(!caption.isEmpty());
if (auto named = Get<HistoryDocumentNamed>()) {
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<HistoryDocumentCaptioned>();
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<HistoryDocumentVoice>()) {
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));

View file

@ -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

View file

@ -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<QList<QString>> executableTypes(([] {
std_::unique_ptr<QList<QString>> result = std_::make_unique<QList<QString>>();
#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);
}

View file

@ -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:

View file

@ -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();

View file

@ -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