mirror of
https://github.com/fergalmoran/flameshot.git
synced 2025-12-22 09:51:06 +00:00
reformatted to Mozilla code style
This commit is contained in:
committed by
borgmanJeremy
parent
c0e2e48db4
commit
c8d15205be
@@ -18,46 +18,59 @@
|
||||
#include "dbusutils.h"
|
||||
#include "src/utils/systemnotification.h"
|
||||
#include <QApplication>
|
||||
#include <QTextStream>
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
|
||||
DBusUtils::DBusUtils(QObject *parent) : QObject(parent) {
|
||||
DBusUtils::DBusUtils(QObject* parent)
|
||||
: QObject(parent)
|
||||
{}
|
||||
|
||||
void
|
||||
DBusUtils::connectPrintCapture(QDBusConnection& session, uint id)
|
||||
{
|
||||
m_id = id;
|
||||
// captureTaken
|
||||
session.connect(QStringLiteral("org.dharkael.Flameshot"),
|
||||
QStringLiteral("/"),
|
||||
QLatin1String(""),
|
||||
QStringLiteral("captureTaken"),
|
||||
this,
|
||||
SLOT(captureTaken(uint, QByteArray)));
|
||||
// captureFailed
|
||||
session.connect(QStringLiteral("org.dharkael.Flameshot"),
|
||||
QStringLiteral("/"),
|
||||
QLatin1String(""),
|
||||
QStringLiteral("captureFailed"),
|
||||
this,
|
||||
SLOT(captureFailed(uint)));
|
||||
}
|
||||
|
||||
void DBusUtils::connectPrintCapture(QDBusConnection &session, uint id) {
|
||||
m_id = id;
|
||||
// captureTaken
|
||||
session.connect(QStringLiteral("org.dharkael.Flameshot"),
|
||||
QStringLiteral("/"), QLatin1String(""), QStringLiteral("captureTaken"),
|
||||
this,
|
||||
SLOT(captureTaken(uint, QByteArray)));
|
||||
// captureFailed
|
||||
session.connect(QStringLiteral("org.dharkael.Flameshot"),
|
||||
QStringLiteral("/"), QLatin1String(""), QStringLiteral("captureFailed"),
|
||||
this,
|
||||
SLOT(captureFailed(uint)));
|
||||
void
|
||||
DBusUtils::checkDBusConnection(const QDBusConnection& connection)
|
||||
{
|
||||
if (!connection.isConnected()) {
|
||||
SystemNotification().sendMessage(tr("Unable to connect via DBus"));
|
||||
qApp->exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
void DBusUtils::checkDBusConnection(const QDBusConnection &connection) {
|
||||
if (!connection.isConnected()) {
|
||||
SystemNotification().sendMessage(tr("Unable to connect via DBus"));
|
||||
qApp->exit(1);
|
||||
}
|
||||
void
|
||||
DBusUtils::captureTaken(uint id, QByteArray rawImage)
|
||||
{
|
||||
if (m_id == id) {
|
||||
QFile file;
|
||||
file.open(stdout, QIODevice::WriteOnly);
|
||||
file.write(rawImage);
|
||||
file.close();
|
||||
qApp->exit();
|
||||
}
|
||||
}
|
||||
|
||||
void DBusUtils::captureTaken(uint id, QByteArray rawImage) {
|
||||
if (m_id == id) {
|
||||
QFile file;
|
||||
file.open(stdout, QIODevice::WriteOnly);
|
||||
file.write(rawImage);
|
||||
file.close();
|
||||
qApp->exit();
|
||||
}
|
||||
}
|
||||
|
||||
void DBusUtils::captureFailed(uint id) {
|
||||
if (m_id == id) {
|
||||
QTextStream(stdout) << "screenshot aborted\n";
|
||||
qApp->exit(1);
|
||||
}
|
||||
void
|
||||
DBusUtils::captureFailed(uint id)
|
||||
{
|
||||
if (m_id == id) {
|
||||
QTextStream(stdout) << "screenshot aborted\n";
|
||||
qApp->exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user