Emit dbus captureSaved signal when saving files

New captureSaved signal contains the request ID and canonical path of the saved
file. This allows a dbus listener interested in postprocessing files access to
the path most recently written.
This commit is contained in:
brimston3
2021-01-14 18:45:00 -05:00
committed by borgmanJeremy
parent 635c2a3eef
commit e07829ec55
8 changed files with 42 additions and 5 deletions

View File

@@ -85,9 +85,9 @@ void CaptureRequest::exportCapture(const QPixmap& p)
{
if ((m_tasks & ExportTask::FILESYSTEM_SAVE_TASK) != ExportTask::NO_TASK) {
if (m_path.isEmpty()) {
ScreenshotSaver().saveToFilesystemGUI(p);
ScreenshotSaver(m_id).saveToFilesystemGUI(p);
} else {
ScreenshotSaver().saveToFilesystem(p, m_path, "");
ScreenshotSaver(m_id).saveToFilesystem(p, m_path, "");
}
}

View File

@@ -312,6 +312,11 @@ void Controller::showRecentScreenshots()
m_history->show();
}
void Controller::sendCaptureSaved(uint id, const QString& savePath)
{
emit captureSaved(id, savePath);
}
void Controller::startFullscreenCapture(const uint id)
{
bool ok = true;

View File

@@ -50,6 +50,7 @@ public:
signals:
void captureTaken(uint id, QPixmap p, QRect selection);
void captureFailed(uint id);
void captureSaved(uint id, QString savePath);
public slots:
void requestCapture(const CaptureRequest& request);
@@ -68,6 +69,8 @@ public slots:
void showRecentScreenshots();
void sendCaptureSaved(uint id, const QString& savePath);
private slots:
void startFullscreenCapture(const uint id = 0);
void startVisualCapture(const uint id = 0,

View File

@@ -34,6 +34,10 @@ FlameshotDBusAdapter::FlameshotDBusAdapter(QObject* parent)
&Controller::captureTaken,
this,
&FlameshotDBusAdapter::handleCaptureTaken);
connect(controller,
&Controller::captureSaved,
this,
&FlameshotDBusAdapter::captureSaved);
}
FlameshotDBusAdapter::~FlameshotDBusAdapter() {}

View File

@@ -32,6 +32,7 @@ public:
signals:
void captureTaken(uint id, QByteArray rawImage, QRect selection);
void captureFailed(uint id);
void captureSaved(uint id, QString savePath);
public slots:
Q_NOREPLY void graphicCapture(QString path, int delay, uint id);