Fix - call the same HistoryWidget object on Shortcut and from the Menu
This commit is contained in:
@@ -17,14 +17,11 @@
|
||||
|
||||
#include "globalshortcutfilter.h"
|
||||
#include "src/core/controller.h"
|
||||
#include "src/widgets/historywidget.h"
|
||||
#include <qt_windows.h>
|
||||
|
||||
GlobalShortcutFilter::GlobalShortcutFilter(QObject* parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
m_history = nullptr;
|
||||
|
||||
// Forced Print Screen
|
||||
if (RegisterHotKey(NULL, 1, 0, VK_SNAPSHOT)) {
|
||||
// ok - capture screen
|
||||
@@ -35,11 +32,6 @@ GlobalShortcutFilter::GlobalShortcutFilter(QObject* parent)
|
||||
}
|
||||
}
|
||||
|
||||
GlobalShortcutFilter::~GlobalShortcutFilter()
|
||||
{
|
||||
delete m_history;
|
||||
}
|
||||
|
||||
bool GlobalShortcutFilter::nativeEventFilter(const QByteArray& eventType,
|
||||
void* message,
|
||||
long* result)
|
||||
@@ -56,11 +48,7 @@ bool GlobalShortcutFilter::nativeEventFilter(const QByteArray& eventType,
|
||||
|
||||
// Show screenshots history
|
||||
if (VK_SNAPSHOT == keycode && MOD_SHIFT == modifiers) {
|
||||
if (m_history == nullptr) {
|
||||
m_history = new HistoryWidget();
|
||||
}
|
||||
m_history->loadHistory();
|
||||
m_history->show();
|
||||
Controller::getInstance()->showRecentScreenshots();
|
||||
}
|
||||
|
||||
// Capture screen
|
||||
|
||||
@@ -20,8 +20,6 @@
|
||||
#include <QAbstractNativeEventFilter>
|
||||
#include <QObject>
|
||||
|
||||
class HistoryWidget;
|
||||
|
||||
class GlobalShortcutFilter
|
||||
: public QObject
|
||||
, public QAbstractNativeEventFilter
|
||||
@@ -29,7 +27,6 @@ class GlobalShortcutFilter
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit GlobalShortcutFilter(QObject* parent = nullptr);
|
||||
~GlobalShortcutFilter();
|
||||
|
||||
bool nativeEventFilter(const QByteArray& eventType,
|
||||
void* message,
|
||||
@@ -43,5 +40,4 @@ private:
|
||||
quint32 nativeKeycode(Qt::Key key);
|
||||
bool registerShortcut(quint32 nativeKey, quint32 nativeMods);
|
||||
bool unregisterShortcut(quint32 nativeKey, quint32 nativeMods);
|
||||
HistoryWidget* m_history;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user