mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
Create sticky note tool
This commit is contained in:
@ -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
|
||||
|
||||
Reference in New Issue
Block a user