api work
This commit is contained in:
parent
87ccee3938
commit
c2432a24aa
@ -181,6 +181,7 @@ QJsonObject Message::toJson() const {
|
|||||||
obj.insert(QSL("url"), m_url);
|
obj.insert(QSL("url"), m_url);
|
||||||
obj.insert(QSL("id"), m_id);
|
obj.insert(QSL("id"), m_id);
|
||||||
obj.insert(QSL("custom_id"), m_customId);
|
obj.insert(QSL("custom_id"), m_customId);
|
||||||
|
obj.insert(QSL("account_id"), m_accountId);
|
||||||
obj.insert(QSL("custom_hash"), m_customHash);
|
obj.insert(QSL("custom_hash"), m_customHash);
|
||||||
obj.insert(QSL("feed_custom_id"), m_feedId);
|
obj.insert(QSL("feed_custom_id"), m_feedId);
|
||||||
obj.insert(QSL("feed_title"), m_feedTitle);
|
obj.insert(QSL("feed_title"), m_feedTitle);
|
||||||
|
@ -1185,6 +1185,8 @@ QList<Message> DatabaseQueries::getArticlesSlice(const QSqlDatabase& db,
|
|||||||
QList<Message> messages;
|
QList<Message> messages;
|
||||||
QSqlQuery q(db);
|
QSqlQuery q(db);
|
||||||
QString feed_clause = !feed_custom_id.isEmpty() ? QSL("Messages.feed = :feed AND") : QString();
|
QString feed_clause = !feed_custom_id.isEmpty() ? QSL("Messages.feed = :feed AND") : QString();
|
||||||
|
QString is_read_clause = unread_only ? QSL("Messages.is_read = :is_read AND ") : QString();
|
||||||
|
QString account_id_clause = account_id > 0 ? QSL("Messages.account_id = :account_id AND ") : QString();
|
||||||
QString date_created_clause;
|
QString date_created_clause;
|
||||||
|
|
||||||
if (start_after_article_date > 0) {
|
if (start_after_article_date > 0) {
|
||||||
@ -1200,32 +1202,27 @@ QList<Message> DatabaseQueries::getArticlesSlice(const QSqlDatabase& db,
|
|||||||
q.prepare(QSL("SELECT %1 "
|
q.prepare(QSL("SELECT %1 "
|
||||||
"FROM Messages LEFT JOIN Feeds ON Messages.feed = Feeds.custom_id AND "
|
"FROM Messages LEFT JOIN Feeds ON Messages.feed = Feeds.custom_id AND "
|
||||||
" Messages.account_id = Feeds.account_id "
|
" Messages.account_id = Feeds.account_id "
|
||||||
"WHERE Messages.is_deleted = 0 AND "
|
"WHERE %3 "
|
||||||
" Messages.is_pdeleted = 0 AND "
|
|
||||||
" Messages.is_read = :is_read AND "
|
|
||||||
//" date_created > :date_created AND "
|
|
||||||
" %3 "
|
|
||||||
" %4 "
|
" %4 "
|
||||||
" Messages.account_id = :account_id "
|
" %5 "
|
||||||
|
" %6 "
|
||||||
|
" Messages.is_deleted = 0 AND "
|
||||||
|
" Messages.is_pdeleted = 0 "
|
||||||
"ORDER BY Messages.date_created %2 "
|
"ORDER BY Messages.date_created %2 "
|
||||||
"LIMIT :row_limit OFFSET :row_offset;")
|
"LIMIT :row_limit OFFSET :row_offset;")
|
||||||
.arg(messageTableAttributes(false, db.driverName() == QSL(APP_DB_SQLITE_DRIVER)).values().join(QSL(", ")),
|
.arg(messageTableAttributes(false, db.driverName() == QSL(APP_DB_SQLITE_DRIVER)).values().join(QSL(", ")),
|
||||||
newest_first ? QSL("DESC") : QSL("ASC"),
|
newest_first ? QSL("DESC") : QSL("ASC"),
|
||||||
feed_clause,
|
feed_clause,
|
||||||
date_created_clause));
|
date_created_clause,
|
||||||
|
account_id_clause,
|
||||||
|
is_read_clause));
|
||||||
q.bindValue(QSL(":account_id"), account_id);
|
q.bindValue(QSL(":account_id"), account_id);
|
||||||
q.bindValue(QSL(":row_limit"), row_limit);
|
q.bindValue(QSL(":row_limit"), row_limit);
|
||||||
q.bindValue(QSL(":row_offset"), row_offset);
|
q.bindValue(QSL(":row_offset"), row_offset);
|
||||||
q.bindValue(QSL(":feed"), feed_custom_id);
|
q.bindValue(QSL(":feed"), feed_custom_id);
|
||||||
|
q.bindValue(QSL(":is_read"), 0);
|
||||||
q.bindValue(QSL(":date_created"), start_after_article_date);
|
q.bindValue(QSL(":date_created"), start_after_article_date);
|
||||||
|
|
||||||
if (unread_only) {
|
|
||||||
q.bindValue(QSL(":is_read"), 0);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
q.bindValue(QSL(":is_read"), QSL("is_read"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (q.exec()) {
|
if (q.exec()) {
|
||||||
while (q.next()) {
|
while (q.next()) {
|
||||||
bool decoded;
|
bool decoded;
|
||||||
|
@ -464,6 +464,16 @@ bool LibMpvBackend::eventFilter(QObject* watched, QEvent* event) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (event->type() == QEvent::Type::MouseButtonDblClick && watched == this) {
|
||||||
|
qDebugNN << LOGSEC_MPV << "Mouse double-click.";
|
||||||
|
|
||||||
|
const char* args[] = {"keypress", "MOUSE_BTN0_DBL", nullptr};
|
||||||
|
|
||||||
|
mpv_command_async(m_mpvHandle, 0, args);
|
||||||
|
event->accept();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (event->type() == QEvent::Type::MouseMove && watched == this) {
|
if (event->type() == QEvent::Type::MouseMove && watched == this) {
|
||||||
auto* mouse_event = dynamic_cast<QMouseEvent*>(event);
|
auto* mouse_event = dynamic_cast<QMouseEvent*>(event);
|
||||||
auto position = mouse_event->pos();
|
auto position = mouse_event->pos();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user