improved for old version of Qt

This commit is contained in:
John Preston 2016-02-29 20:30:18 +03:00
parent 99b52d4cc1
commit 616354b8e9
3 changed files with 13 additions and 13 deletions

View file

@ -294,8 +294,8 @@ History::History(const PeerId &peerId) : width(0), height(0)
, sendRequestId(0)
, textCachedFor(0)
, lastItemTextCache(st::dlgRichMinWidth)
, _sortKeyInChatList(0)
, typingText(st::dlgRichMinWidth) {
, typingText(st::dlgRichMinWidth)
, _sortKeyInChatList(0) {
if (peer->isChannel() || (peer->isUser() && peer->asUser()->botInfo)) {
outboxReadBefore = INT_MAX;
}

View file

@ -77,11 +77,11 @@ namespace MTP {
extern const uint32 cfg; // send(MTPhelp_GetConfig(), MTP::cfg + dc) - for dc enum
extern const uint32 lgt; // send(MTPauth_LogOut(), MTP::lgt + dc) - for logout of guest dcs enum
inline const uint32 dld(int32 index) { // send(req, callbacks, MTP::dld(i) + dc) - for download
inline uint32 dld(int32 index) { // send(req, callbacks, MTP::dld(i) + dc) - for download
t_assert(index >= 0 && index < MTPDownloadSessionsCount);
return (0x10 + index) * _mtp_internal::dcShift;
};
inline const uint32 upl(int32 index) { // send(req, callbacks, MTP::upl[i] + dc) - for upload
inline uint32 upl(int32 index) { // send(req, callbacks, MTP::upl(i) + dc) - for upload
t_assert(index >= 0 && index < MTPUploadSessionsCount);
return (0x20 + index) * _mtp_internal::dcShift;
};

View file

@ -339,10 +339,10 @@ namespace Shortcuts {
if (error.error == QJsonParseError::NoError && doc.isArray()) {
QJsonArray shortcuts(doc.array());
if (!shortcuts.isEmpty() && shortcuts.constBegin()->isObject()) {
QJsonObject versionObject(shortcuts.constBegin()->toObject());
if (!shortcuts.isEmpty() && (*shortcuts.constBegin()).isObject()) {
QJsonObject versionObject((*shortcuts.constBegin()).toObject());
QJsonObject::const_iterator version = versionObject.constFind(qsl("version"));
if (version != versionObject.constEnd() && version->isString() && version->toString() == QString::number(AppVersion)) {
if (version != versionObject.constEnd() && (*version).isString() && (*version).toString() == QString::number(AppVersion)) {
defaultValid = true;
}
}
@ -396,18 +396,18 @@ namespace Shortcuts {
QJsonArray shortcuts = doc.array();
int limit = ShortcutsCountLimit;
for (QJsonArray::const_iterator i = shortcuts.constBegin(), e = shortcuts.constEnd(); i != e; ++i) {
if (!i->isObject()) {
if (!(*i).isObject()) {
DataPtr->errors.push_back(qsl("Bad entry! Error: object expected"));
} else {
QKeySequence seq;
QJsonObject entry(i->toObject());
QJsonObject entry((*i).toObject());
QJsonObject::const_iterator keys = entry.constFind(qsl("keys")), command = entry.constFind(qsl("command"));
if (keys == entry.constEnd() || command == entry.constEnd() || !keys->isString() || (!command->isString() && !command->isNull())) {
if (keys == entry.constEnd() || command == entry.constEnd() || !(*keys).isString() || (!(*command).isString() && !(*command).isNull())) {
DataPtr->errors.push_back(qsl("Bad entry! {\"keys\": \"...\", \"command\": [ \"...\" | null ]} expected"));
} else if (command->isNull()) {
seq = _removeShortcut(keys->toString());
} else if ((*command).isNull()) {
seq = _removeShortcut((*keys).toString());
} else {
seq = _setShortcut(keys->toString(), command->toString());
seq = _setShortcut((*keys).toString(), (*command).toString());
}
if (!--limit) {
DataPtr->errors.push_back(qsl("Too many entries! Limit is %1").arg(ShortcutsCountLimit));