2026-09-26 10:17:13 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <QString>
|
|
|
|
|
#include <QWidget>
|
|
|
|
|
|
|
|
|
|
class QDateEdit;
|
|
|
|
|
class QLabel;
|
|
|
|
|
class QLineEdit;
|
|
|
|
|
class QPushButton;
|
2026-11-04 22:04:06 +01:00
|
|
|
class TagCompleter;
|
2026-09-26 10:17:13 +02:00
|
|
|
|
|
|
|
|
// One photo in the batch: thumbnail, caption, date, and its own upload status.
|
|
|
|
|
// A single-photo post is just a batch of one, so the window runs one code path.
|
|
|
|
|
class PhotoItemWidget : public QWidget
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
enum class Status { Pending, Preparing, Uploading, Success, Error };
|
|
|
|
|
|
|
|
|
|
explicit PhotoItemWidget(QString sourcePath, QWidget *parent = nullptr);
|
|
|
|
|
|
|
|
|
|
QString sourcePath() const { return m_sourcePath; }
|
|
|
|
|
QString caption() const;
|
|
|
|
|
QString date() const; // yyyy-MM-dd
|
2026-10-08 16:19:25 +02:00
|
|
|
QString tags() const; // raw comma-separated; the server normalizes
|
2026-09-26 10:17:13 +02:00
|
|
|
Status status() const { return m_status; }
|
|
|
|
|
|
|
|
|
|
void setStatus(Status status, const QString &message = {}, const QString &url = {});
|
|
|
|
|
|
2026-11-04 22:04:06 +01:00
|
|
|
// Fills the tags field's autocomplete with the known tag names.
|
|
|
|
|
void setTagSuggestions(const QStringList &tags);
|
|
|
|
|
|
2026-09-26 10:17:13 +02:00
|
|
|
signals:
|
|
|
|
|
void removeRequested(PhotoItemWidget *self);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
QString m_sourcePath;
|
|
|
|
|
Status m_status = Status::Pending;
|
|
|
|
|
|
|
|
|
|
QLabel *m_thumb = nullptr;
|
|
|
|
|
QLineEdit *m_caption = nullptr;
|
|
|
|
|
QDateEdit *m_date = nullptr;
|
2026-10-08 16:19:25 +02:00
|
|
|
QLineEdit *m_tags = nullptr;
|
2026-09-26 10:17:13 +02:00
|
|
|
QLabel *m_statusLabel = nullptr;
|
|
|
|
|
QPushButton *m_remove = nullptr;
|
2026-11-04 22:04:06 +01:00
|
|
|
TagCompleter *m_tagCompleter = nullptr;
|
2026-09-26 10:17:13 +02:00
|
|
|
};
|