swift
datalink.cpp
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 2017 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
5 
7 
8 #include "misc/promise.h"
9 #include "misc/variant.h"
10 
12 {
13  void CDataLinkConnectionWatcher::setStatus(bool status)
14  {
15  if (status != m_connected)
16  {
17  m_connected = status;
18  if (m_connected) { emit connected(); }
19  else { emit disconnected(); }
20  }
21  }
22 
23  IDataLink::~IDataLink() = default;
24 
25  IDataLink::IDataLink() { qRegisterMetaType<CPromise<CVariant>>(); }
26 
27  QString IDataLink::getChannelName(const QObject *object)
28  {
29  const QMetaObject *meta = object->parent()->metaObject();
30  const char *info = meta->classInfo(meta->indexOfClassInfo("SharedStateChannel")).value();
31  const QString name = object->parent()->objectName();
32  return name.isEmpty() ? QString(info) : (info % QLatin1Char(':') % name);
33  }
34 } // namespace swift::misc::shared_state
Utilities for sharing state between multiple objects.
Definition: application.h:48