mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
refactor: remove commented code, use QStringLiteral
This commit is contained in:
parent
d1afc7f6df
commit
4fdf73f2f0
@ -89,9 +89,10 @@ protected:
|
||||
static QVariant extractData(sqlite3_stmt* stmt, int col);
|
||||
static void regexpInsensitive(sqlite3_context* ctx, int argc, sqlite3_value** argv);
|
||||
static void regexpSensitive(sqlite3_context* ctx, int argc, sqlite3_value** argv);
|
||||
static void regexp(sqlite3_context* ctx, int argc, sqlite3_value** argv, const Qt::CaseSensitivity cs);
|
||||
|
||||
private:
|
||||
static void regexp(sqlite3_context* ctx, int argc, sqlite3_value** argv, const Qt::CaseSensitivity cs);
|
||||
|
||||
struct Transaction
|
||||
{
|
||||
QVector<Query> queries;
|
||||
|
@ -328,22 +328,22 @@ QDateTime History::getDateWhereFindPhrase(const QString& friendPk, const QDateTi
|
||||
|
||||
switch (parameter.filter) {
|
||||
case FilterSearch::Register:
|
||||
message = QString("message LIKE '%%1%'").arg(phrase);
|
||||
message = QStringLiteral("message LIKE '%%1%'").arg(phrase);
|
||||
break;
|
||||
case FilterSearch::WordsOnly:
|
||||
message = QString("message REGEXP '\\b%1\\b'").arg(phrase.toLower());
|
||||
message = QStringLiteral("message REGEXP '\\b%1\\b'").arg(phrase.toLower());
|
||||
break;
|
||||
case FilterSearch::RegisterAndWordsOnly:
|
||||
message = QString("REGEXPSENSITIVE(message, '\\b%1\\b')").arg(phrase);
|
||||
message = QStringLiteral("REGEXPSENSITIVE(message, '\\b%1\\b')").arg(phrase);
|
||||
break;
|
||||
case FilterSearch::Regular:
|
||||
message = QString("message REGEXP '%1'").arg(phrase);
|
||||
message = QStringLiteral("message REGEXP '%1'").arg(phrase);
|
||||
break;
|
||||
case FilterSearch::RegisterAndRegular:
|
||||
message = QString("REGEXPSENSITIVE(message '%1')").arg(phrase);
|
||||
message = QStringLiteral("REGEXPSENSITIVE(message '%1')").arg(phrase);
|
||||
break;
|
||||
default:
|
||||
message = QString("LOWER(message) LIKE '%%1%'").arg(phrase.toLower());
|
||||
message = QStringLiteral("LOWER(message) LIKE '%%1%'").arg(phrase.toLower());
|
||||
break;
|
||||
}
|
||||
|
||||
@ -355,21 +355,21 @@ QDateTime History::getDateWhereFindPhrase(const QString& friendPk, const QDateTi
|
||||
QString period;
|
||||
switch (parameter.period) {
|
||||
case PeriodSearch::WithTheFirst:
|
||||
period = QString("ORDER BY timestamp ASC LIMIT 1;");
|
||||
period = QStringLiteral("ORDER BY timestamp ASC LIMIT 1;");
|
||||
break;
|
||||
case PeriodSearch::AfterDate:
|
||||
period = QString("AND timestamp > '%1' ORDER BY timestamp ASC LIMIT 1;").arg(date.toMSecsSinceEpoch());
|
||||
period = QStringLiteral("AND timestamp > '%1' ORDER BY timestamp ASC LIMIT 1;").arg(date.toMSecsSinceEpoch());
|
||||
break;
|
||||
case PeriodSearch::BeforeDate:
|
||||
period = QString("AND timestamp < '%1' ORDER BY timestamp DESC LIMIT 1;").arg(date.toMSecsSinceEpoch());
|
||||
period = QStringLiteral("AND timestamp < '%1' ORDER BY timestamp DESC LIMIT 1;").arg(date.toMSecsSinceEpoch());
|
||||
break;
|
||||
default:
|
||||
period = QString("AND timestamp < '%1' ORDER BY timestamp DESC LIMIT 1;").arg(date.toMSecsSinceEpoch());
|
||||
period = QStringLiteral("AND timestamp < '%1' ORDER BY timestamp DESC LIMIT 1;").arg(date.toMSecsSinceEpoch());
|
||||
break;
|
||||
}
|
||||
|
||||
QString queryText =
|
||||
QString("SELECT timestamp "
|
||||
QStringLiteral("SELECT timestamp "
|
||||
"FROM history "
|
||||
"LEFT JOIN faux_offline_pending ON history.id = faux_offline_pending.id "
|
||||
"JOIN peers chat ON chat_id = chat.id "
|
||||
@ -397,7 +397,7 @@ QDateTime History::getStartDateChatHistory(const QString &friendPk)
|
||||
};
|
||||
|
||||
QString queryText =
|
||||
QString("SELECT timestamp "
|
||||
QStringLiteral("SELECT timestamp "
|
||||
"FROM history "
|
||||
"LEFT JOIN faux_offline_pending ON history.id = faux_offline_pending.id "
|
||||
"JOIN peers chat ON chat_id = chat.id "
|
||||
|
@ -540,17 +540,6 @@ void ChatForm::onSearchUp(const QString& phrase, const ParameterSearch& paramete
|
||||
int startLine = numLines - searchPoint.x();
|
||||
|
||||
if (startLine == 0 && loadHistory(phrase, parameter)) {
|
||||
// QString pk = f->getPublicKey().toString();
|
||||
// QDateTime newBaseDate = history->getDateWhereFindPhrase(pk, earliestMessage, phrase, parameter);
|
||||
|
||||
// if (!newBaseDate.isValid()) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
// searchAfterLoadHistory = true;
|
||||
// loadHistoryByDateRange(newBaseDate);
|
||||
|
||||
// return;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -934,7 +934,7 @@ void GenericChatForm::onSearchTriggered()
|
||||
void GenericChatForm::onContinueSearch()
|
||||
{
|
||||
QString phrase = searchForm->getSearchPhrase();
|
||||
ParameterSearch parameter = searchForm->getParametrSearch();
|
||||
ParameterSearch parameter = searchForm->getParameterSearch();
|
||||
if (!phrase.isEmpty() && searchAfterLoadHistory) {
|
||||
searchAfterLoadHistory = false;
|
||||
|
||||
|
@ -82,7 +82,7 @@ QString SearchForm::getSearchPhrase() const
|
||||
return searchPhrase;
|
||||
}
|
||||
|
||||
ParameterSearch SearchForm::getParametrSearch()
|
||||
ParameterSearch SearchForm::getParameterSearch()
|
||||
{
|
||||
return parameter;
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ public:
|
||||
explicit SearchForm(QWidget* parent = nullptr);
|
||||
void removeSearchPhrase();
|
||||
QString getSearchPhrase() const;
|
||||
ParameterSearch getParametrSearch();
|
||||
ParameterSearch getParameterSearch();
|
||||
void setFocusEditor();
|
||||
void insertEditor(const QString &text);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user