Commit 6755ffd3 authored by Simon Depiets's avatar Simon Depiets
Browse files

Clean up some deprecated warnings

parent 91f1d2b1
......@@ -281,7 +281,7 @@ void adaptCatalogString(CatalogString& target, const CatalogString& ref)
QList<InlineTag> oldTags = target.tags;
target.tags.clear();
//we actually walking from beginning to end:
std::sort(oldTags.begin(), oldTags.end(), qGreater<InlineTag>());
std::sort(oldTags.begin(), oldTags.end(), std::greater<InlineTag>());
i = oldTags.size();
while (--i >= 0) {
const InlineTag& targetTag = oldTags.at(i);
......
......@@ -126,6 +126,11 @@ struct InlineTag {
return start < other.start;
}
bool operator>(const InlineTag& other)const
{
return start > other.start;
}
};
Q_DECLARE_METATYPE(InlineTag)
Q_DECLARE_METATYPE(QList<InlineTag>)
......
......@@ -70,7 +70,7 @@ bool initPhaseForCatalog(Catalog* catalog, Phase& phase, int options)
QSet<QString> names;
QList<Phase> phases = catalog->allPhases();
std::sort(phases.begin(), phases.end(), qGreater<Phase>());
std::sort(phases.begin(), phases.end(), std::greater<Phase>());
foreach (const Phase& p, phases) {
if (!(options & ForceAdd) && p.contact == phase.contact && p.process == phase.process) {
phase = p;
......
......@@ -51,6 +51,10 @@ struct Phase {
{
return date < other.date;
}
bool operator>(const Phase& other) const
{
return date > other.date;
}
};
......
......@@ -506,7 +506,7 @@ void EditorTab::spellcheck()
m_sonnetChecker = new Sonnet::BackgroundChecker(this);
m_sonnetChecker->changeLanguage(enhanceLangCode(Project::instance()->langCode()));
m_sonnetDialog = new Sonnet::Dialog(m_sonnetChecker, this);
connect(m_sonnetDialog, QOverload<const QString &>::of(&Sonnet::Dialog::done), this, &EditorTab::spellcheckNext);
connect(m_sonnetDialog, QOverload<const QString &>::of(&Sonnet::Dialog::spellCheckDone), this, &EditorTab::spellcheckNext);
connect(m_sonnetDialog, &Sonnet::Dialog::replace, this, &EditorTab::spellcheckReplace);
connect(m_sonnetDialog, &Sonnet::Dialog::stop, this, &EditorTab::spellcheckStop);
connect(m_sonnetDialog, &Sonnet::Dialog::cancel, this, &EditorTab::spellcheckCancel);
......
......@@ -503,7 +503,7 @@ FileSearchTab::FileSearchTab(QWidget *parent)
//BEGIN resizeColumnToContents
static const int maxInitialWidths[] = {QApplication::desktop()->availableGeometry().width() / 3, QApplication::desktop()->availableGeometry().width() / 3};
static const int maxInitialWidths[] = {QGuiApplication::primaryScreen()->availableGeometry().width() / 3, QGuiApplication::primaryScreen()->availableGeometry().width() / 3};
int column = sizeof(maxInitialWidths) / sizeof(int);
while (--column >= 0)
view->setColumnWidth(column, maxInitialWidths[column]);
......
......@@ -30,6 +30,7 @@
#include "rule.h"
#include <QDockWidget>
#include <QScreen>
#include <QAbstractListModel>
#include <state.h>
#include <phase.h>
......
......@@ -194,7 +194,7 @@ int MergeCatalog::loadFromUrl(const QString& filePath)
while (--k >= 0)
scores << calcMatchItem(i, DocPosition(entries.at(k)));
std::sort(scores.begin(), scores.end(), qGreater<MatchItem>());
std::sort(scores.begin(), scores.end(), std::greater<MatchItem>());
m_map[i.entry] = scores.first().mergeEntry;
backMap.insert(scores.first().mergeEntry, i.entry);
......@@ -219,7 +219,7 @@ int MergeCatalog::loadFromUrl(const QString& filePath)
foreach (int value, basePositions)
scores << calcMatchItem(DocPosition(value), mergePosition);
std::sort(scores.begin(), scores.end(), qGreater<MatchItem>());
std::sort(scores.begin(), scores.end(), std::greater<MatchItem>());
int i = scores.size();
while (--i > 0) {
//qCDebug(LOKALIZE_LOG)<<"erasing"<<scores.at(i).baseEntry<<m_map[scores.at(i).baseEntry]<<",m_map["<<scores.at(i).baseEntry<<"]=-1";
......
......@@ -52,9 +52,9 @@ struct MatchItem {
, translationIsDifferent(d)
{}
bool operator<(const MatchItem& other) const
bool operator>(const MatchItem& other) const
{
return score < other.score;
return score > other.score;
}
};
......
......@@ -477,7 +477,7 @@ ProjectWidget::gotoIndexResult ProjectWidget::gotoIndexFind(
}
// Handle child recursively if index is not a leaf
QModelIndex child = index.child((direction == 1) ? 0 : (m_proxyModel->rowCount(index) - 1), index.column());
QModelIndex child = index.model()->index((direction == 1) ? 0 : (m_proxyModel->rowCount(index) - 1), index.column());
if (child.isValid()) {
ProjectWidget::gotoIndexResult result = gotoIndexFind(child, role, direction);
if (result != gotoIndex_notfound)
......
......@@ -1475,7 +1475,7 @@ void SelectJob::run()
doSelect(db, words, !isShort);
//qCWarning(LOKALIZE_LOG) <<"SelectJob: done "<<a.elapsed()<<m_entries.size();
std::sort(m_entries.begin(), m_entries.end(), qGreater<TMEntry>());
std::sort(m_entries.begin(), m_entries.end(), std::greater<TMEntry>());
const int limit = qMin(Settings::suggCount(), m_entries.size());
const int minScore = Settings::suggScore() * 100;
int i = m_entries.size() - 1;
......
......@@ -57,6 +57,15 @@ struct TMEntry {
QString accelExpr;
QString markupExpr;
bool operator>(const TMEntry& other) const
{
if (score == other.score) {
if (hits == other.hits)
return date > other.date;
return hits > other.hits;
}
return score > other.score;
}
bool operator<(const TMEntry& other) const
{
if (score == other.score) {
......
......@@ -484,7 +484,7 @@ TMTab::TMTab(QWidget *parent)
//connect(ui_queryOptions->dbName, SIGNAL(activated(QString)), this, SLOT(performQuery()));
//BEGIN resizeColumnToContents
static const int maxInitialWidths[4] = {QApplication::desktop()->availableGeometry().width() / 3, QApplication::desktop()->availableGeometry().width() / 3, 50, 200};
static const int maxInitialWidths[4] = {QGuiApplication::primaryScreen()->availableGeometry().width() / 3, QGuiApplication::primaryScreen()->availableGeometry().width() / 3, 50, 200};
int column = sizeof(maxInitialWidths) / sizeof(int);
while (--column >= 0)
view->setColumnWidth(column, maxInitialWidths[column]);
......
......@@ -33,6 +33,7 @@
#include <QSqlQueryModel>
#include <QSqlDatabase>
#include <QMutex>
#include <QScreen>
class KXMLGUIClient;
class QComboBox;
......
......@@ -402,7 +402,7 @@ void TMView::slotSuggestionsCame(SelectJob* j)
//check if this is an additional query, from secondary DBs
if (job.m_dbName != projectID) {
job.m_entries += m_entries;
std::sort(job.m_entries.begin(), job.m_entries.end(), qGreater<TMEntry>());
std::sort(job.m_entries.begin(), job.m_entries.end(), std::greater<TMEntry>());
const int limit = qMin(Settings::suggCount(), job.m_entries.size());
const int minScore = Settings::suggScore() * 100;
int i = job.m_entries.size() - 1;
......
......@@ -1306,7 +1306,7 @@ void insertContent(QTextCursor& cursor, const CatalogString& catStr, const Catal
m_completionBox->resize(m_completionBox->sizeHint());
QPoint p = cursorRect().bottomRight();
if (p.x() < 10) //workaround Qt bug
p.rx() += textCursor().verticalMovementX() + QFontMetrics(currentFont()).width('W');
p.rx() += textCursor().verticalMovementX() + QFontMetrics(currentFont()).horizontalAdvance('W');
m_completionBox->move(viewport()->mapToGlobal(p));
} else
m_completionBox->hide();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment