Merge branch 'dev' into bugfix/win_check_ps
This commit is contained in:
commit
c9cd860654
57 changed files with 434 additions and 1379 deletions
|
@ -69,14 +69,13 @@ QString Utils::getNextDriverLetter()
|
|||
|
||||
QString Utils::getRandomString(int len)
|
||||
{
|
||||
const QString possibleCharacters("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
|
||||
|
||||
const QString possibleCharacters = QStringLiteral("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
|
||||
QString randomString;
|
||||
|
||||
for (int i = 0; i < len; ++i) {
|
||||
quint32 index = QRandomGenerator::global()->generate() % possibleCharacters.length();
|
||||
QChar nextChar = possibleCharacters.at(index);
|
||||
randomString.append(nextChar);
|
||||
randomString.append(possibleCharacters.at(QRandomGenerator::system()->bounded(possibleCharacters.length())));
|
||||
}
|
||||
|
||||
return randomString;
|
||||
}
|
||||
|
||||
|
@ -335,3 +334,22 @@ bool Utils::signalCtrl(DWORD dwProcessId, DWORD dwCtrlEvent)
|
|||
}
|
||||
|
||||
#endif
|
||||
|
||||
void Utils::logException(const std::exception &e)
|
||||
{
|
||||
qCritical() << e.what();
|
||||
try {
|
||||
std::rethrow_if_nested(e);
|
||||
} catch (const std::exception &nested) {
|
||||
logException(nested);
|
||||
} catch (...) {}
|
||||
}
|
||||
|
||||
void Utils::logException(const std::exception_ptr &eptr)
|
||||
{
|
||||
try {
|
||||
if (eptr) std::rethrow_exception(eptr);
|
||||
} catch (const std::exception &e) {
|
||||
logException(e);
|
||||
} catch (...) {}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue