- implement: handle windows logout message
This commit is contained in:
parent
3e8200d307
commit
e6d4bdd43c
1
NEWS.md
1
NEWS.md
|
@ -24,6 +24,7 @@ Version 0.6.0
|
||||||
- fix: makefile generated for static / dynamic library projects not right
|
- fix: makefile generated for static / dynamic library projects not right
|
||||||
- fix: editors disappeared when close/close all
|
- fix: editors disappeared when close/close all
|
||||||
- implement: config shortcuts
|
- implement: config shortcuts
|
||||||
|
- implement: handle windows logout message
|
||||||
|
|
||||||
Version 0.5.0
|
Version 0.5.0
|
||||||
- enhancement: support C++ using type alias;
|
- enhancement: support C++ using type alias;
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
#include <QAbstractNativeEventFilter>
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "colorscheme.h"
|
#include "colorscheme.h"
|
||||||
#include "iconsmanager.h"
|
#include "iconsmanager.h"
|
||||||
|
@ -16,6 +17,27 @@
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
#include "parser/parserutils.h"
|
#include "parser/parserutils.h"
|
||||||
#include "editorlist.h"
|
#include "editorlist.h"
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
class WindowLogoutEventFilter : public QAbstractNativeEventFilter {
|
||||||
|
|
||||||
|
// QAbstractNativeEventFilter interface
|
||||||
|
public:
|
||||||
|
bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
bool WindowLogoutEventFilter::nativeEventFilter(const QByteArray &eventType, void *message, long *result){
|
||||||
|
MSG * pMsg = static_cast<MSG *>(message);
|
||||||
|
if (pMsg->message == WM_QUERYENDSESSION) {
|
||||||
|
if (!pMainWindow->close()) {
|
||||||
|
*result = 0;
|
||||||
|
} else {
|
||||||
|
*result = 1;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
QString getSettingFilename(const QString& filepath = QString()) {
|
QString getSettingFilename(const QString& filepath = QString()) {
|
||||||
QString filename;
|
QString filename;
|
||||||
|
@ -110,6 +132,8 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mainWindow.show();
|
mainWindow.show();
|
||||||
|
WindowLogoutEventFilter filter;
|
||||||
|
app.installNativeEventFilter(&filter);
|
||||||
int retCode = app.exec();
|
int retCode = app.exec();
|
||||||
// save settings
|
// save settings
|
||||||
// settings->compilerSets().saveSets();
|
// settings->compilerSets().saveSets();
|
||||||
|
|
Loading…
Reference in New Issue