feat: allow access from LAN (tray action)

This commit is contained in:
arm64v8a
2022-08-27 09:44:32 +08:00
parent 6873a7e1ba
commit b48583ae1b
7 changed files with 56 additions and 25 deletions

View File

@@ -77,12 +77,18 @@ bool IsIpAddressV6(const QString &str) {
return false;
}
QWidget *GetMessageBoxParent() {
if (mainwindow == nullptr) return nullptr;
if (mainwindow->isVisible()) return mainwindow;
return nullptr;
}
int MessageBoxWarning(const QString &title, const QString &text) {
return QMessageBox::warning(nullptr, title, text);
return QMessageBox::warning(GetMessageBoxParent(), title, text);
}
int MessageBoxInfo(const QString &title, const QString &text) {
return QMessageBox::information(nullptr, title, text);
return QMessageBox::information(GetMessageBoxParent(), title, text);
}
void runOnUiThread(const std::function<void()> &callback, QObject *parent) {