mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-14 19:25:39 +08:00
Fix clang warnings as discussed here: https://swift-project.slack.com/archives/G7GD2UP9C/p1526463295000266
Reported in CLANG test build here: https://build.swift-project.org/job/macos_test_job/4/warnings10Result/
This commit is contained in:
@@ -648,9 +648,13 @@ namespace BlackCore
|
|||||||
multiPart->moveToThread(m_accessManager->thread());
|
multiPart->moveToThread(m_accessManager->thread());
|
||||||
}
|
}
|
||||||
|
|
||||||
return httpRequestImpl(request, logId, callback, NoRedirects, [ this, multiPart ](QNetworkAccessManager & qam, const QNetworkRequest & request)
|
QPointer<CApplication> myself(this);
|
||||||
|
return httpRequestImpl(request, logId, callback, NoRedirects, [ = ](QNetworkAccessManager & qam, const QNetworkRequest & request)
|
||||||
{
|
{
|
||||||
QNetworkReply *nr = qam.post(request, multiPart);
|
QNetworkReply *nr = nullptr;
|
||||||
|
if (!myself) { return nr; }
|
||||||
|
if (!multiPart) { return nr; }
|
||||||
|
nr = qam.post(request, multiPart);
|
||||||
multiPart->setParent(nr);
|
multiPart->setParent(nr);
|
||||||
return nr;
|
return nr;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -51,29 +51,37 @@ namespace BlackCore
|
|||||||
CContext(mode, runtime)
|
CContext(mode, runtime)
|
||||||
{
|
{
|
||||||
if (mode == CCoreFacadeConfig::NotUsed) { return; }
|
if (mode == CCoreFacadeConfig::NotUsed) { return; }
|
||||||
connect(CLogHandler::instance(), &CLogHandler::localMessageLogged, this, [this](const CStatusMessage & message)
|
QPointer<IContextApplication> myself(this);
|
||||||
|
|
||||||
|
connect(CLogHandler::instance(), &CLogHandler::localMessageLogged, this, [ = ](const CStatusMessage & message)
|
||||||
{
|
{
|
||||||
|
if (!myself) { return; }
|
||||||
this->logMessage(message, {});
|
this->logMessage(message, {});
|
||||||
});
|
});
|
||||||
connect(CLogHandler::instance(), &CLogHandler::subscriptionAdded, this, [this](const CLogPattern & pattern)
|
connect(CLogHandler::instance(), &CLogHandler::subscriptionAdded, this, [ = ](const CLogPattern & pattern)
|
||||||
{
|
{
|
||||||
|
if (!myself) { return; }
|
||||||
this->addLogSubscription({}, pattern);
|
this->addLogSubscription({}, pattern);
|
||||||
});
|
});
|
||||||
connect(CLogHandler::instance(), &CLogHandler::subscriptionRemoved, this, [this](const CLogPattern & pattern)
|
connect(CLogHandler::instance(), &CLogHandler::subscriptionRemoved, this, [ = ](const CLogPattern & pattern)
|
||||||
{
|
{
|
||||||
|
if (!myself) { return; }
|
||||||
this->removeLogSubscription({}, pattern);
|
this->removeLogSubscription({}, pattern);
|
||||||
});
|
});
|
||||||
connect(this, &IContextApplication::logSubscriptionAdded, this, [this](const CIdentifier & subscriber, const CLogPattern & pattern)
|
connect(this, &IContextApplication::logSubscriptionAdded, this, [ = ](const CIdentifier & subscriber, const CLogPattern & pattern)
|
||||||
{
|
{
|
||||||
this->m_logSubscriptions[subscriber].push_back(pattern);
|
if (!myself) { return; }
|
||||||
|
m_logSubscriptions[subscriber].push_back(pattern);
|
||||||
});
|
});
|
||||||
connect(this, &IContextApplication::logSubscriptionRemoved, this, [this](const CIdentifier & subscriber, const CLogPattern & pattern)
|
connect(this, &IContextApplication::logSubscriptionRemoved, this, [ = ](const CIdentifier & subscriber, const CLogPattern & pattern)
|
||||||
{
|
{
|
||||||
this->m_logSubscriptions[subscriber].removeAll(pattern);
|
if (!myself) { return; }
|
||||||
|
m_logSubscriptions[subscriber].removeAll(pattern);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(CSettingsCache::instance(), &CSettingsCache::valuesChangedByLocal, [this](const CValueCachePacket & settings)
|
connect(CSettingsCache::instance(), &CSettingsCache::valuesChangedByLocal, [ = ](const CValueCachePacket & settings)
|
||||||
{
|
{
|
||||||
|
if (!myself) { return; }
|
||||||
this->changeSettings(settings, {});
|
this->changeSettings(settings, {});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -83,14 +91,15 @@ namespace BlackCore
|
|||||||
CSettingsCache::instance()->changeValuesFromRemote(settings, origin);
|
CSettingsCache::instance()->changeValuesFromRemote(settings, origin);
|
||||||
});
|
});
|
||||||
|
|
||||||
bool s = connect(CInputManager::instance(), &CInputManager::hotkeyActionRegistered, [this](const QStringList & actions)
|
bool s = connect(CInputManager::instance(), &CInputManager::hotkeyActionRegistered, [ = ](const QStringList & actions)
|
||||||
{
|
{
|
||||||
|
if (!myself) { return; }
|
||||||
this->registerHotkeyActions(actions, {});
|
this->registerHotkeyActions(actions, {});
|
||||||
});
|
});
|
||||||
Q_ASSERT_X(s, Q_FUNC_INFO, "Connect hotkey action failed");
|
Q_ASSERT_X(s, Q_FUNC_INFO, "Connect hotkey action failed");
|
||||||
Q_UNUSED(s);
|
Q_UNUSED(s);
|
||||||
|
|
||||||
s = connect(this, &IContextApplication::hotkeyActionsRegistered, [this](const QStringList & actions, const CIdentifier & origin)
|
s = connect(this, &IContextApplication::hotkeyActionsRegistered, [ = ](const QStringList & actions, const CIdentifier & origin)
|
||||||
{
|
{
|
||||||
if (origin.hasApplicationProcessId()) { return; }
|
if (origin.hasApplicationProcessId()) { return; }
|
||||||
CInputManager::instance()->registerRemoteActions(actions);
|
CInputManager::instance()->registerRemoteActions(actions);
|
||||||
@@ -98,15 +107,17 @@ namespace BlackCore
|
|||||||
Q_ASSERT_X(s, Q_FUNC_INFO, "Connect hotkey actions failed");
|
Q_ASSERT_X(s, Q_FUNC_INFO, "Connect hotkey actions failed");
|
||||||
Q_UNUSED(s);
|
Q_UNUSED(s);
|
||||||
|
|
||||||
s = connect(CInputManager::instance(), &CInputManager::remoteActionFromLocal, [this](const QString & action, bool argument)
|
s = connect(CInputManager::instance(), &CInputManager::remoteActionFromLocal, [ = ](const QString & action, bool argument)
|
||||||
{
|
{
|
||||||
|
if (!myself) { return; }
|
||||||
this->callHotkeyAction(action, argument, {});
|
this->callHotkeyAction(action, argument, {});
|
||||||
});
|
});
|
||||||
Q_ASSERT_X(s, Q_FUNC_INFO, "Connect remote action failed");
|
Q_ASSERT_X(s, Q_FUNC_INFO, "Connect remote action failed");
|
||||||
Q_UNUSED(s);
|
Q_UNUSED(s);
|
||||||
|
|
||||||
s = connect(this, &IContextApplication::remoteHotkeyAction, [this](const QString & action, bool argument, const CIdentifier & origin)
|
s = connect(this, &IContextApplication::remoteHotkeyAction, [ = ](const QString & action, bool argument, const CIdentifier & origin)
|
||||||
{
|
{
|
||||||
|
if (!myself) { return; }
|
||||||
if (origin.isFromLocalMachine()) { return; }
|
if (origin.isFromLocalMachine()) { return; }
|
||||||
CInputManager::instance()->callFunctionsBy(action, argument);
|
CInputManager::instance()->callFunctionsBy(action, argument);
|
||||||
CLogMessage(this, CLogCategory::contextSlot()).debug() << "Calling function" << action << "from origin" << origin.getMachineName();
|
CLogMessage(this, CLogCategory::contextSlot()).debug() << "Calling function" << action << "from origin" << origin.getMachineName();
|
||||||
|
|||||||
@@ -445,7 +445,8 @@ namespace BlackGui
|
|||||||
QMenu *sm = menu.addMenu(CIcons::appSettings16(), "Settings");
|
QMenu *sm = menu.addMenu(CIcons::appSettings16(), "Settings");
|
||||||
sm->setIcon(CIcons::appSettings16());
|
sm->setIcon(CIcons::appSettings16());
|
||||||
QAction *a = sm->addAction(CIcons::disk16(), "Settings directory");
|
QAction *a = sm->addAction(CIcons::disk16(), "Settings directory");
|
||||||
bool c = connect(a, &QAction::triggered, this, [a, this]()
|
QPointer<CGuiApplication> myself(this);
|
||||||
|
bool c = connect(a, &QAction::triggered, this, [ = ]()
|
||||||
{
|
{
|
||||||
const QString path(QDir::toNativeSeparators(CSettingsCache::persistentStore()));
|
const QString path(QDir::toNativeSeparators(CSettingsCache::persistentStore()));
|
||||||
if (QDir(path).exists())
|
if (QDir(path).exists())
|
||||||
@@ -456,25 +457,27 @@ namespace BlackGui
|
|||||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
||||||
|
|
||||||
a = sm->addAction("Reset settings");
|
a = sm->addAction("Reset settings");
|
||||||
c = connect(a, &QAction::triggered, this, [this]()
|
c = connect(a, &QAction::triggered, this, [ = ]
|
||||||
{
|
{
|
||||||
|
if (myself.isNull()) { return; }
|
||||||
CSettingsCache::instance()->clearAllValues();
|
CSettingsCache::instance()->clearAllValues();
|
||||||
this->displayTextInConsole("Cleared all settings!");
|
myself->displayTextInConsole("Cleared all settings!");
|
||||||
});
|
});
|
||||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
||||||
|
|
||||||
a = sm->addAction("List settings files");
|
a = sm->addAction("List settings files");
|
||||||
c = connect(a, &QAction::triggered, this, [this]()
|
c = connect(a, &QAction::triggered, this, [ = ]()
|
||||||
{
|
{
|
||||||
|
if (myself.isNull()) { return; }
|
||||||
const QStringList files(CSettingsCache::instance()->enumerateStore());
|
const QStringList files(CSettingsCache::instance()->enumerateStore());
|
||||||
this->displayTextInConsole(files.join("\n"));
|
myself->displayTextInConsole(files.join("\n"));
|
||||||
});
|
});
|
||||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
||||||
|
|
||||||
sm = menu.addMenu("Cache");
|
sm = menu.addMenu("Cache");
|
||||||
sm->setIcon(CIcons::appSettings16());
|
sm->setIcon(CIcons::appSettings16());
|
||||||
a = sm->addAction(CIcons::disk16(), "Cache directory");
|
a = sm->addAction(CIcons::disk16(), "Cache directory");
|
||||||
c = connect(a, &QAction::triggered, this, [this]()
|
c = connect(a, &QAction::triggered, this, [ = ]()
|
||||||
{
|
{
|
||||||
const QString path(QDir::toNativeSeparators(CDataCache::persistentStore()));
|
const QString path(QDir::toNativeSeparators(CDataCache::persistentStore()));
|
||||||
if (QDir(path).exists())
|
if (QDir(path).exists())
|
||||||
@@ -485,23 +488,25 @@ namespace BlackGui
|
|||||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
||||||
|
|
||||||
a = sm->addAction("Reset cache");
|
a = sm->addAction("Reset cache");
|
||||||
c = connect(a, &QAction::triggered, this, [this]()
|
c = connect(a, &QAction::triggered, this, [ = ]()
|
||||||
{
|
{
|
||||||
|
if (myself.isNull()) { return; }
|
||||||
const QStringList files = CApplication::clearCaches();
|
const QStringList files = CApplication::clearCaches();
|
||||||
this->displayTextInConsole("Cleared caches! " + QString::number(files.size()) + " files");
|
this->displayTextInConsole("Cleared caches! " + QString::number(files.size()) + " files");
|
||||||
});
|
});
|
||||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
||||||
|
|
||||||
a = sm->addAction("List cache files");
|
a = sm->addAction("List cache files");
|
||||||
c = connect(a, &QAction::triggered, this, [this]()
|
c = connect(a, &QAction::triggered, this, [ = ]()
|
||||||
{
|
{
|
||||||
|
if (myself.isNull()) { return; }
|
||||||
const QStringList files(CDataCache::instance()->enumerateStore());
|
const QStringList files(CDataCache::instance()->enumerateStore());
|
||||||
this->displayTextInConsole(files.join("\n"));
|
myself->displayTextInConsole(files.join("\n"));
|
||||||
});
|
});
|
||||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
||||||
|
|
||||||
a = menu.addAction(CIcons::disk16(), "Log directory");
|
a = menu.addAction(CIcons::disk16(), "Log directory");
|
||||||
c = connect(a, &QAction::triggered, this, [this]()
|
c = connect(a, &QAction::triggered, this, [ = ]()
|
||||||
{
|
{
|
||||||
const QString path(QDir::toNativeSeparators(CDirectoryUtils::logDirectory()));
|
const QString path(QDir::toNativeSeparators(CDirectoryUtils::logDirectory()));
|
||||||
if (QDir(path).exists())
|
if (QDir(path).exists())
|
||||||
@@ -519,18 +524,21 @@ namespace BlackGui
|
|||||||
|
|
||||||
void CGuiApplication::addMenuForStyleSheets(QMenu &menu)
|
void CGuiApplication::addMenuForStyleSheets(QMenu &menu)
|
||||||
{
|
{
|
||||||
|
QPointer<CGuiApplication> myself(this);
|
||||||
QMenu *sm = menu.addMenu("Style sheet");
|
QMenu *sm = menu.addMenu("Style sheet");
|
||||||
QAction *aReload = sm->addAction(CIcons::refresh16(), "Reload");
|
QAction *aReload = sm->addAction(CIcons::refresh16(), "Reload");
|
||||||
bool c = connect(aReload, &QAction::triggered, this, [aReload, this]()
|
bool c = connect(aReload, &QAction::triggered, this, [ = ]()
|
||||||
{
|
{
|
||||||
this->reloadStyleSheets();
|
if (myself.isNull()) { return; }
|
||||||
|
myself->reloadStyleSheets();
|
||||||
});
|
});
|
||||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
||||||
|
|
||||||
QAction *aOpen = sm->addAction(CIcons::text16(), "Open qss file");
|
QAction *aOpen = sm->addAction(CIcons::text16(), "Open qss file");
|
||||||
c = connect(aOpen, &QAction::triggered, this, [aOpen, this]()
|
c = connect(aOpen, &QAction::triggered, this, [ = ]()
|
||||||
{
|
{
|
||||||
this->openStandardWidgetStyleSheet();
|
if (myself.isNull()) { return; }
|
||||||
|
myself->openStandardWidgetStyleSheet();
|
||||||
});
|
});
|
||||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
||||||
Q_UNUSED(c);
|
Q_UNUSED(c);
|
||||||
@@ -553,11 +561,13 @@ namespace BlackGui
|
|||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
a = menu.addAction("E&xit");
|
a = menu.addAction("E&xit");
|
||||||
a->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q));
|
a->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q));
|
||||||
c = connect(a, &QAction::triggered, this, [a, this]()
|
QPointer<CGuiApplication> myself(this);
|
||||||
|
c = connect(a, &QAction::triggered, this, [ = ]()
|
||||||
{
|
{
|
||||||
// a close event might already trigger a shutdown
|
// a close event might already trigger a shutdown
|
||||||
this->mainApplicationWidget()->close();
|
if (!myself) { return; }
|
||||||
this->gracefulShutdown();
|
myself->mainApplicationWidget()->close();
|
||||||
|
myself->gracefulShutdown();
|
||||||
});
|
});
|
||||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
||||||
Q_UNUSED(c);
|
Q_UNUSED(c);
|
||||||
@@ -565,38 +575,43 @@ namespace BlackGui
|
|||||||
|
|
||||||
void CGuiApplication::addMenuInternals(QMenu &menu)
|
void CGuiApplication::addMenuInternals(QMenu &menu)
|
||||||
{
|
{
|
||||||
|
QPointer<CGuiApplication> myself(this);
|
||||||
QMenu *sm = menu.addMenu("Templates");
|
QMenu *sm = menu.addMenu("Templates");
|
||||||
QAction *a = sm->addAction("JSON bootstrap");
|
QAction *a = sm->addAction("JSON bootstrap");
|
||||||
bool c = connect(a, &QAction::triggered, this, [a, this]()
|
bool c = connect(a, &QAction::triggered, this, [ = ]()
|
||||||
{
|
{
|
||||||
|
if (!myself) { return; }
|
||||||
const CGlobalSetup s = this->getGlobalSetup();
|
const CGlobalSetup s = this->getGlobalSetup();
|
||||||
this->displayTextInConsole(s.toJsonString());
|
this->displayTextInConsole(s.toJsonString());
|
||||||
});
|
});
|
||||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
||||||
|
|
||||||
a = sm->addAction("JSON update info (for info only)");
|
a = sm->addAction("JSON update info (for info only)");
|
||||||
c = connect(a, &QAction::triggered, this, [a, this]()
|
c = connect(a, &QAction::triggered, this, [ = ]()
|
||||||
{
|
{
|
||||||
|
if (!myself) { return; }
|
||||||
const CUpdateInfo info = this->getUpdateInfo();
|
const CUpdateInfo info = this->getUpdateInfo();
|
||||||
this->displayTextInConsole(info.toJsonString());
|
myself->displayTextInConsole(info.toJsonString());
|
||||||
});
|
});
|
||||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
||||||
|
|
||||||
if (this->hasWebDataServices())
|
if (this->hasWebDataServices())
|
||||||
{
|
{
|
||||||
a = menu.addAction("Services log.(console)");
|
a = menu.addAction("Services log.(console)");
|
||||||
c = connect(a, &QAction::triggered, this, [a, this]()
|
c = connect(a, &QAction::triggered, this, [ = ]()
|
||||||
{
|
{
|
||||||
this->displayTextInConsole(this->getWebDataServices()->getReadersLog());
|
if (!myself) { return; }
|
||||||
|
myself->displayTextInConsole(this->getWebDataServices()->getReadersLog());
|
||||||
CLogMessage(this).info("Displayed services log.");
|
CLogMessage(this).info("Displayed services log.");
|
||||||
});
|
});
|
||||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
a = menu.addAction("Metadata (slow)");
|
a = menu.addAction("Metadata (slow)");
|
||||||
c = connect(a, &QAction::triggered, this, [a, this]()
|
c = connect(a, &QAction::triggered, this, [ = ]()
|
||||||
{
|
{
|
||||||
this->displayTextInConsole(getAllUserMetatypesTypes());
|
if (!myself) { return; }
|
||||||
|
myself->displayTextInConsole(getAllUserMetatypesTypes());
|
||||||
});
|
});
|
||||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
||||||
Q_UNUSED(c);
|
Q_UNUSED(c);
|
||||||
@@ -604,44 +619,44 @@ namespace BlackGui
|
|||||||
|
|
||||||
void CGuiApplication::addMenuWindow(QMenu &menu)
|
void CGuiApplication::addMenuWindow(QMenu &menu)
|
||||||
{
|
{
|
||||||
QWidget *w = mainApplicationWidget();
|
QPointer<QWidget> w = mainApplicationWidget();
|
||||||
if (!w) { return; }
|
if (!w) { return; }
|
||||||
const QSize iconSize = CIcons::empty16().size();
|
const QSize iconSize = CIcons::empty16().size();
|
||||||
QPixmap icon = w->style()->standardIcon(QStyle::SP_TitleBarMaxButton).pixmap(iconSize);
|
QPixmap icon = w->style()->standardIcon(QStyle::SP_TitleBarMaxButton).pixmap(iconSize);
|
||||||
QAction *a = menu.addAction(icon.scaled(iconSize), "Fullscreen");
|
QAction *a = menu.addAction(icon.scaled(iconSize), "Fullscreen");
|
||||||
bool c = connect(a, &QAction::triggered, this, [a, w]()
|
bool c = connect(a, &QAction::triggered, this, [ = ]()
|
||||||
{
|
{
|
||||||
|
if (!w) { return; }
|
||||||
w->showFullScreen();
|
w->showFullScreen();
|
||||||
});
|
});
|
||||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
||||||
|
|
||||||
icon = w->style()->standardIcon(QStyle::SP_TitleBarMinButton).pixmap(iconSize);
|
icon = w->style()->standardIcon(QStyle::SP_TitleBarMinButton).pixmap(iconSize);
|
||||||
a = menu.addAction(icon.scaled(iconSize), "Minimize");
|
a = menu.addAction(icon.scaled(iconSize), "Minimize");
|
||||||
c = connect(a, &QAction::triggered, this, [a, w]()
|
c = connect(a, &QAction::triggered, this, [ = ]()
|
||||||
{
|
{
|
||||||
|
if (!w) { return; }
|
||||||
w->showMinimized();
|
w->showMinimized();
|
||||||
});
|
});
|
||||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
||||||
|
|
||||||
icon = w->style()->standardIcon(QStyle::SP_TitleBarNormalButton).pixmap(iconSize);
|
icon = w->style()->standardIcon(QStyle::SP_TitleBarNormalButton).pixmap(iconSize);
|
||||||
a = menu.addAction(icon.scaled(iconSize), "Normal");
|
a = menu.addAction(icon.scaled(iconSize), "Normal");
|
||||||
c = connect(a, &QAction::triggered, this, [a, w]()
|
c = connect(a, &QAction::triggered, this, [ = ]()
|
||||||
{
|
{
|
||||||
|
if (!w) { return; }
|
||||||
w->showNormal();
|
w->showNormal();
|
||||||
});
|
});
|
||||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
||||||
|
|
||||||
a = menu.addAction("Toggle stay on top");
|
a = menu.addAction("Toggle stay on top");
|
||||||
c = connect(a, &QAction::triggered, this, [a, w]()
|
c = connect(a, &QAction::triggered, this, [ = ]()
|
||||||
{
|
{
|
||||||
if (CGuiUtility::toggleStayOnTop(w))
|
if (!w) { return; }
|
||||||
{
|
const bool onTop = CGuiUtility::toggleStayOnTop(w);
|
||||||
CLogMessage(w).info("Window on top");
|
CLogMessage(w.data()).info(onTop ?
|
||||||
}
|
QStringLiteral("Window on top") :
|
||||||
else
|
QStringLiteral("Window not always on top"));
|
||||||
{
|
|
||||||
CLogMessage(w).info("Window not always on top");
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
||||||
Q_UNUSED(c);
|
Q_UNUSED(c);
|
||||||
@@ -649,18 +664,22 @@ namespace BlackGui
|
|||||||
|
|
||||||
void CGuiApplication::addMenuHelp(QMenu &menu)
|
void CGuiApplication::addMenuHelp(QMenu &menu)
|
||||||
{
|
{
|
||||||
QWidget *w = mainApplicationWidget();
|
QPointer<QWidget> w = mainApplicationWidget();
|
||||||
if (!w) { return; }
|
if (!w) { return; }
|
||||||
QAction *a = menu.addAction(w->style()->standardIcon(QStyle::SP_TitleBarContextHelpButton), "Online help");
|
QAction *a = menu.addAction(w->style()->standardIcon(QStyle::SP_TitleBarContextHelpButton), "Online help");
|
||||||
bool c = connect(a, &QAction::triggered, this, [this]()
|
QPointer<CGuiApplication> myself(this);
|
||||||
|
|
||||||
|
bool c = connect(a, &QAction::triggered, this, [ = ]()
|
||||||
{
|
{
|
||||||
this->showHelp();
|
if (!myself) { return; }
|
||||||
|
myself->showHelp();
|
||||||
});
|
});
|
||||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
|
||||||
|
|
||||||
a = menu.addAction(QApplication::windowIcon(), "About swift");
|
a = menu.addAction(QApplication::windowIcon(), "About swift");
|
||||||
c = connect(a, &QAction::triggered, this, [w]()
|
c = connect(a, &QAction::triggered, this, [ = ]()
|
||||||
{
|
{
|
||||||
|
if (!w) { return; }
|
||||||
CAboutDialog dialog(w);
|
CAboutDialog dialog(w);
|
||||||
dialog.exec();
|
dialog.exec();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
#include "simulatorxplane.h"
|
#include "simulatorxplane.h"
|
||||||
|
|
||||||
#include <QLatin1String>
|
#include <QLatin1String>
|
||||||
|
#include <QPointer>
|
||||||
|
|
||||||
class QDBusConnection;
|
class QDBusConnection;
|
||||||
|
|
||||||
@@ -28,8 +29,10 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
void CXSwiftBusServiceProxy::getOwnAircraftSituationData(XPlaneData *o_xplaneData)
|
void CXSwiftBusServiceProxy::getOwnAircraftSituationData(XPlaneData *o_xplaneData)
|
||||||
{
|
{
|
||||||
std::function<void(QDBusPendingCallWatcher *)> callback = [this, o_xplaneData](QDBusPendingCallWatcher * watcher)
|
QPointer<CXSwiftBusServiceProxy> myself(this);
|
||||||
|
std::function<void(QDBusPendingCallWatcher *)> callback = [ = ](QDBusPendingCallWatcher * watcher)
|
||||||
{
|
{
|
||||||
|
if (!myself) { return; }
|
||||||
QDBusPendingReply<double, double, double, double, double, double, double, double> reply = *watcher;
|
QDBusPendingReply<double, double, double, double, double, double, double, double> reply = *watcher;
|
||||||
if (!reply.isError())
|
if (!reply.isError())
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user