diff --git a/README.md b/README.md index 9812c7ec..43b0eb43 100644 --- a/README.md +++ b/README.md @@ -112,6 +112,8 @@ If you are not using any of these distros you'll need to compile the program :( but don't worry, it's pretty easy! ## Compilation +The compilation requires Qt version 5.3 or higher (this is the version that Debian 8 has in its repos, so most modern distros should be able to compile without installing newer Qt versions). + ### Debian Compilation Dependencies: ```` diff --git a/src/core/flameshotdbusadapter.cpp b/src/core/flameshotdbusadapter.cpp index 90eae176..388834bf 100644 --- a/src/core/flameshotdbusadapter.cpp +++ b/src/core/flameshotdbusadapter.cpp @@ -21,6 +21,22 @@ #include "src/core/controller.h" #include "src/core/resourceexporter.h" #include +#include + +namespace { + using std::function; + using lambda = function; + + // replace QTimer::singleShot introduced in QT 5.4 + // the actual target QT version is QT 5.3 + void doLater(int msec, QObject *receiver, lambda func) { + QTimer *timer = new QTimer(receiver); + QObject::connect(timer, &QTimer::timeout, receiver, + [timer, func](){ func(); timer->deleteLater(); }); + timer->setInterval(msec); + timer->start(); + } +} FlameshotDBusAdapter::FlameshotDBusAdapter(QObject *parent) : QDBusAbstractAdaptor(parent) @@ -37,7 +53,8 @@ void FlameshotDBusAdapter::graphicCapture(QString path, int delay) { auto f = [controller, path, this]() { controller->createVisualCapture(path); }; - QTimer::singleShot(delay, controller, f); + // QTimer::singleShot(delay, controller, f); // requires Qt 5.4 + doLater(delay, controller, f); } void FlameshotDBusAdapter::fullScreen(QString path, bool toClipboard, int delay) { @@ -52,8 +69,8 @@ void FlameshotDBusAdapter::fullScreen(QString path, bool toClipboard, int delay) ResourceExporter().captureToFile(p, path); } }; - QTimer::singleShot(delay, this, f); - + //QTimer::singleShot(delay, this, f); // // requires Qt 5.4 + doLater(delay, this, f); } void FlameshotDBusAdapter::openConfig() { diff --git a/src/utils/filenamehandler.cpp b/src/utils/filenamehandler.cpp index cb6187b3..cda357b4 100644 --- a/src/utils/filenamehandler.cpp +++ b/src/utils/filenamehandler.cpp @@ -23,7 +23,7 @@ #include FileNameHandler::FileNameHandler(QObject *parent) : QObject(parent) { - std::locale::global(std::locale(std::locale("").name())); + std::locale::global(std::locale("")); } QString FileNameHandler::parsedPattern() {