Create sticky note tool

This commit is contained in:
Jakub Melka
2020-12-04 19:22:20 +01:00
parent 4d0c1e0ab1
commit da95ffc748
6 changed files with 91 additions and 1 deletions

View File

@ -18,6 +18,8 @@
#include "pdfutils.h"
#include "pdfexception.h"
#include <QtGlobal>
#include <jpeglib.h>
#include <ft2build.h>
#include <freetype/freetype.h>
@ -25,6 +27,14 @@
#include <openssl/opensslv.h>
#include <zlib.h>
#ifdef Q_OS_WIN
#define WIN32_LEAN_AND_MEAN
#define SECURITY_WIN32
#include <Windows.h>
#include <security.h>
#pragma comment(lib, "Secur32.lib")
#endif
#pragma warning(push)
#pragma warning(disable:5033)
#include <lcms2.h>
@ -481,4 +491,30 @@ bool PDFClosedIntervalSet::overlapsOrAdjacent(ClosedInterval a, ClosedInterval b
return b.first <= a.second + 1;
}
QString PDFSysUtils::getUserName()
{
#ifdef Q_OS_WIN
const EXTENDED_NAME_FORMAT nameFormat = NameDisplay;
std::vector<WCHAR> buffer;
ULONG size = 0;
GetUserNameExW(nameFormat, NULL, &size);
if (GetLastError() == ERROR_MORE_DATA)
{
++size;
buffer.resize(size);
if (GetUserNameExW(nameFormat, buffer.data(), &size))
{
return QString::fromWCharArray(buffer.data());
}
}
#endif
QString userName = qgetenv("USER");
if (userName.isEmpty())
{
userName = qgetenv("USERNAME");
}
return userName;
}
} // namespace pdf