Brings the Qt uploader to parity with the web /manage page and the Android
app. Adds a stacked Manage page (reached from the post page) that lists
posts via GET /api/photos with thumbnails from GET /api/thumb/<slug>, edits
caption/date/tags in a QDialog via POST /api/edit, and deletes to trash via
POST /api/delete with a QMessageBox confirm. As a non-browser client it sends
no Origin and so passes the server's same-origin CSRF check.
Tag autocomplete now backs every tags field (post cards and the edit dialog)
via a per-token TagCompleter (QCompleter subclass, MatchContains) fed from
the unguarded GET /api/tags.json.
New files: managepostwidget.{h,cpp}, tagcompleter.{h,cpp}; network methods
and a RemotePhoto struct added to uploadclient. Built and linked clean; not
yet runtime-tested on a real display.
49 lines
1.3 KiB
C++
49 lines
1.3 KiB
C++
#pragma once
|
|
|
|
#include <QString>
|
|
#include <QStringList>
|
|
#include <QWidget>
|
|
|
|
class QImage;
|
|
class QLabel;
|
|
class QPushButton;
|
|
|
|
// One published post on the Manage page: thumbnail, caption/date/tags summary,
|
|
// and Edit / Delete buttons. Mirrors a row of the web /manage list and the
|
|
// Android manage screen.
|
|
class ManagePostWidget : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
ManagePostWidget(const QString &slug, const QString &caption, const QString &date,
|
|
const QStringList &tags, const QString &url, QWidget *parent = nullptr);
|
|
|
|
QString slug() const { return m_slug; }
|
|
QString caption() const { return m_caption; }
|
|
QString date() const { return m_date; }
|
|
QStringList tags() const { return m_tags; }
|
|
|
|
void setThumbnail(const QImage &image);
|
|
void applyEdit(const QString &caption, const QString &date, const QStringList &tags);
|
|
void setBusy(bool busy); // a save/delete is in flight
|
|
|
|
signals:
|
|
void editRequested(ManagePostWidget *self);
|
|
void deleteRequested(ManagePostWidget *self);
|
|
|
|
private:
|
|
void refreshSummary();
|
|
|
|
QString m_slug;
|
|
QString m_caption;
|
|
QString m_date;
|
|
QStringList m_tags;
|
|
QString m_url;
|
|
|
|
QLabel *m_thumb = nullptr;
|
|
QLabel *m_captionLabel = nullptr;
|
|
QLabel *m_metaLabel = nullptr;
|
|
QPushButton *m_edit = nullptr;
|
|
QPushButton *m_delete = nullptr;
|
|
};
|