Fix export messages pagination.

Also fix reply highlight.
Also fix channel service messages.
Also improve single chat export progress display.
This commit is contained in:
John Preston 2018-07-25 10:38:36 +03:00
parent f852813734
commit 95eab45108
3 changed files with 29 additions and 12 deletions

View file

@ -275,7 +275,7 @@ div.selected {
padding: 10px;
}
.default.joined {
padding-top: 0;
margin-top: -10px;
}
.default .from_name {
color: #3892db;

View file

@ -958,6 +958,9 @@ auto HtmlWriter::Wrap::pushMessage(
return wrapMessageLink(message.replyToMsgId, text);
};
using DialogType = Data::DialogInfo::Type;
const auto isChannel = (dialog.type == DialogType::PrivateChannel)
|| (dialog.type == DialogType::PublicChannel);
const auto serviceFrom = peers.wrapUserName(message.fromId);
const auto serviceText = message.action.content.match(
[&](const ActionChatCreate &data) {
@ -967,14 +970,20 @@ auto HtmlWriter::Wrap::pushMessage(
? QByteArray()
: " with members " + peers.wrapUserNames(data.userIds));
}, [&](const ActionChatEditTitle &data) {
return serviceFrom
+ " changed group title to «" + data.title + "»";
return isChannel
? ("Channel title changed to «" + data.title + "»")
: (serviceFrom
+ " changed group title to «"
+ data.title
+ "»");
}, [&](const ActionChatEditPhoto &data) {
return serviceFrom
+ " changed group photo";
return isChannel
? QByteArray("Channel photo changed")
: (serviceFrom + " changed group photo");
}, [&](const ActionChatDeletePhoto &data) {
return serviceFrom
+ " deleted group photo";
return isChannel
? QByteArray("Channel photo removed")
: (serviceFrom + " removed group photo");
}, [&](const ActionChatAddUser &data) {
return serviceFrom
+ " invited "
@ -2263,7 +2272,9 @@ Result HtmlWriter::writeDialogSlice(const Data::MessagesSlice &data) {
const auto messageLinkWrapper = [&](int messageId, QByteArray text) {
return wrapMessageLink(messageId, text);
};
auto oldIndex = (_messagesCount / kMessagesInFile);
auto oldIndex = (_messagesCount > 0)
? ((_messagesCount - 1) / kMessagesInFile)
: 0;
auto previous = _lastMessageInfo.get();
auto saved = base::optional<MessageInfo>();
auto block = QByteArray();

View file

@ -41,10 +41,16 @@ Content ContentFromState(const ProcessingState &state) {
const auto done = state.substepsPassed;
const auto add = state.substepsNow;
const auto doneProgress = done / float64(substepsTotal);
const auto addProgress = (state.entityCount > 0)
? ((float64(add) * state.entityIndex)
/ (float64(substepsTotal) * state.entityCount))
: 0.;
const auto addPart = [&](int index, int count) {
return (count > 0)
? ((float64(add) * index)
/ (float64(substepsTotal) * count))
: 0.;
};
const auto addProgress = (state.entityCount == 1
&& !state.entityIndex)
? addPart(state.itemIndex, state.itemCount)
: addPart(state.entityIndex, state.entityCount);
push("main", label, info, doneProgress + addProgress);
};
const auto pushBytes = [&](const QString &id, const QString &label) {