1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

refactor: add code for work in Qt5.5

This commit is contained in:
TriKriSta 2018-07-21 00:48:56 +03:00
parent 7977c80a52
commit 81587d0fbb
2 changed files with 18 additions and 8 deletions

View File

@ -19,8 +19,8 @@
# stop as soon as one of steps will fail # stop as soon as one of steps will fail
set -e -o pipefail set -e -o pipefail
# Qt 5.6, since that's the lowest supported version # Qt 5.5, since that's the lowest supported version
sudo add-apt-repository -y ppa:beineri/opt-qt562-trusty sudo add-apt-repository -y ppa:beineri/opt-qt551-trusty
sudo apt-get update -qq sudo apt-get update -qq
# install needed Qt, OpenAL, opus, qrencode, GTK tray deps, sqlcipher # install needed Qt, OpenAL, opus, qrencode, GTK tray deps, sqlcipher
@ -42,15 +42,15 @@ sudo apt-get install -y --force-yes \
libtool \ libtool \
libvpx-dev \ libvpx-dev \
libxss-dev qrencode \ libxss-dev qrencode \
qt56base \ qt55base \
qt56script \ qt55script \
qt56svg \ qt55svg \
qt56tools \ qt55tools \
qt56xmlpatterns \ qt55xmlpatterns \
pkg-config || yes pkg-config || yes
# Qt # Qt
source /opt/qt56/bin/qt56-env.sh || yes source /opt/qt55/bin/qt55-env.sh || yes
# ffmpeg # ffmpeg
if [ ! -e "libs" ]; then mkdir libs; fi if [ ! -e "libs" ]; then mkdir libs; fi

View File

@ -600,6 +600,7 @@ bool GenericChatForm::searchInText(const QString& phrase, const ParameterSearch&
startLine = static_cast<int>(std::distance(lines.begin(), find)); startLine = static_cast<int>(std::distance(lines.begin(), find));
} }
} else if (parameter.period == PeriodSearch::BeforeDate) { } else if (parameter.period == PeriodSearch::BeforeDate) {
#if QT_VERSION > QT_VERSION_CHECK(5, 6, 0)
const auto lambda = [=](const ChatLine::Ptr& item) { const auto lambda = [=](const ChatLine::Ptr& item) {
const auto d = getDate(item); const auto d = getDate(item);
return d.isValid() && parameter.date >= d; return d.isValid() && parameter.date >= d;
@ -610,6 +611,15 @@ bool GenericChatForm::searchInText(const QString& phrase, const ParameterSearch&
if (find != lines.rend()) { if (find != lines.rend()) {
startLine = static_cast<int>(std::distance(find, lines.rend())) - 1; startLine = static_cast<int>(std::distance(find, lines.rend())) - 1;
} }
#else
for (int i = lines.size() - 1; i >= 0; --i) {
auto d = getDate(lines[i]);
if (d.isValid() && parameter.date >= d) {
startLine = i;
break;
}
}
#endif
} }
if (startLine < 0 || startLine >= numLines) { if (startLine < 0 || startLine >= numLines) {