mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-29 12:45:40 +08:00
Found during T215, rectify CIdentifier issues
* null/anonymous identifier * CIdentifier can be linked with QObject and * CIdentifier reflects name changes of QObject (UI components change name after ctor call)
This commit is contained in:
@@ -1077,8 +1077,8 @@ namespace BlackCore
|
|||||||
model.updateMissingParts(aircraft.getModel());
|
model.updateMissingParts(aircraft.getModel());
|
||||||
// Use anonymous as originator here, since the remote aircraft provider is ourselves and the call to updateAircraftModel() would
|
// Use anonymous as originator here, since the remote aircraft provider is ourselves and the call to updateAircraftModel() would
|
||||||
// return without doing anything.
|
// return without doing anything.
|
||||||
this->updateAircraftModel(callsign, model, CIdentifier::anonymous());
|
this->updateAircraftModel(callsign, model, CIdentifier::null());
|
||||||
this->updateAircraftNetworkModel(callsign, model, CIdentifier::anonymous());
|
this->updateAircraftNetworkModel(callsign, model, CIdentifier::null());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ namespace BlackCore
|
|||||||
void CContextApplicationProxy::synchronizeLocalSettings()
|
void CContextApplicationProxy::synchronizeLocalSettings()
|
||||||
{
|
{
|
||||||
// note this proxy method does not call synchronizeLocalSettings in core
|
// note this proxy method does not call synchronizeLocalSettings in core
|
||||||
CSettingsCache::instance()->changeValuesFromRemote(this->getAllSettings(), CIdentifier::anonymous());
|
CSettingsCache::instance()->changeValuesFromRemote(this->getAllSettings(), CIdentifier::null());
|
||||||
}
|
}
|
||||||
|
|
||||||
BlackMisc::CStatusMessage CContextApplicationProxy::saveSettings(const QString &keyPrefix)
|
BlackMisc::CStatusMessage CContextApplicationProxy::saveSettings(const QString &keyPrefix)
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace BlackCore
|
|||||||
// todo: send weather grid to drivers from here
|
// todo: send weather grid to drivers from here
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWeatherManager::requestWeatherGrid(const CWeatherGrid &weatherGrid, const BlackMisc::CIdentifier &identifier)
|
void CWeatherManager::requestWeatherGrid(const CWeatherGrid &weatherGrid, const CIdentifier &identifier)
|
||||||
{
|
{
|
||||||
WeatherRequest request { identifier, weatherGrid, {} };
|
WeatherRequest request { identifier, weatherGrid, {} };
|
||||||
m_pendingRequests.append(request);
|
m_pendingRequests.append(request);
|
||||||
@@ -48,7 +48,7 @@ namespace BlackCore
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CWeatherManager::requestWeatherGrid(const CWeatherGrid &weatherGrid,
|
void CWeatherManager::requestWeatherGrid(const CWeatherGrid &weatherGrid,
|
||||||
const BlackMisc::CSlot<void(const BlackMisc::Weather::CWeatherGrid &)> &callback)
|
const CSlot<void(const CWeatherGrid &)> &callback)
|
||||||
{
|
{
|
||||||
if (m_isWeatherClear)
|
if (m_isWeatherClear)
|
||||||
{
|
{
|
||||||
@@ -56,7 +56,7 @@ namespace BlackCore
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
WeatherRequest weatherRequest { CIdentifier::anonymous(), weatherGrid, callback };
|
WeatherRequest weatherRequest { CIdentifier::null(), weatherGrid, callback };
|
||||||
m_pendingRequests.append(weatherRequest);
|
m_pendingRequests.append(weatherRequest);
|
||||||
|
|
||||||
// Serialize the requests, since plugins can handle only one at a time
|
// Serialize the requests, since plugins can handle only one at a time
|
||||||
|
|||||||
@@ -778,12 +778,6 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const CIdentifier &CFlightPlanComponent::flightPlanIdentifier()
|
|
||||||
{
|
|
||||||
static const CIdentifier i(QStringLiteral("FLIGHTPLANCOMPONENT"));
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CFlightPlanComponent::initCompleters()
|
void CFlightPlanComponent::initCompleters()
|
||||||
{
|
{
|
||||||
if (!sGui || !sGui->hasWebDataServices()) { return; }
|
if (!sGui || !sGui->hasWebDataServices()) { return; }
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ namespace BlackGui
|
|||||||
QScopedPointer<Ui::CFlightPlanComponent> ui;
|
QScopedPointer<Ui::CFlightPlanComponent> ui;
|
||||||
BlackMisc::Aviation::CFlightPlan m_flightPlan; //!< My flight plan
|
BlackMisc::Aviation::CFlightPlan m_flightPlan; //!< My flight plan
|
||||||
BlackMisc::Simulation::CAircraftModel m_model; //!< currently used model
|
BlackMisc::Simulation::CAircraftModel m_model; //!< currently used model
|
||||||
BlackMisc::CIdentifier m_identifier; //!< Flightplan identifier
|
BlackMisc::CIdentifier m_identifier { "FlightPlanComponent", this }; //!< Flightplan identifier
|
||||||
BlackMisc::CDataReadOnly<BlackMisc::Simulation::Data::TLastModel> m_lastAircraftModel { this }; //!< recently used aircraft model
|
BlackMisc::CDataReadOnly<BlackMisc::Simulation::Data::TLastModel> m_lastAircraftModel { this }; //!< recently used aircraft model
|
||||||
BlackMisc::CDataReadOnly<BlackMisc::Network::Data::TLastServer> m_lastServer { this }; //!< recently used server (VATSIM, other)
|
BlackMisc::CDataReadOnly<BlackMisc::Network::Data::TLastServer> m_lastServer { this }; //!< recently used server (VATSIM, other)
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ namespace BlackGui
|
|||||||
static const QString &defaultTime() { static const QString t("00:00"); return t; }
|
static const QString &defaultTime() { static const QString t("00:00"); return t; }
|
||||||
|
|
||||||
//! Identifier
|
//! Identifier
|
||||||
static const BlackMisc::CIdentifier &flightPlanIdentifier();
|
const BlackMisc::CIdentifier &flightPlanIdentifier() const { return m_identifier; }
|
||||||
|
|
||||||
//! Prefill with own aircraft data
|
//! Prefill with own aircraft data
|
||||||
void prefillWithOwnAircraftData();
|
void prefillWithOwnAircraftData();
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ namespace BlackGui
|
|||||||
void disableButtonBriefly();
|
void disableButtonBriefly();
|
||||||
|
|
||||||
QScopedPointer<Ui::CMainKeypadAreaComponent> ui;
|
QScopedPointer<Ui::CMainKeypadAreaComponent> ui;
|
||||||
BlackMisc::CIdentifier m_identifier { QStringLiteral("KEYPADAREACOMPONENT") };
|
BlackMisc::CIdentifier m_identifier { "MainKeypadAreaComponent", this };
|
||||||
};
|
};
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -374,15 +374,6 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CIdentifier CMappingComponent::mappingIdentifier()
|
|
||||||
{
|
|
||||||
if (m_identifier.getName().isEmpty())
|
|
||||||
{
|
|
||||||
m_identifier = CIdentifier(QStringLiteral("MAPPINGCOMPONENT"));
|
|
||||||
}
|
|
||||||
return m_identifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CMappingComponent::updateRenderedAircraftView(bool forceUpdate)
|
void CMappingComponent::updateRenderedAircraftView(bool forceUpdate)
|
||||||
{
|
{
|
||||||
m_updateTimer.start(); // restart
|
m_updateTimer.start(); // restart
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ namespace BlackGui
|
|||||||
void connectionStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to);
|
void connectionStatusChanged(BlackCore::INetwork::ConnectionStatus from, BlackCore::INetwork::ConnectionStatus to);
|
||||||
|
|
||||||
//! Identifier for data send from this component
|
//! Identifier for data send from this component
|
||||||
BlackMisc::CIdentifier mappingIdentifier();
|
const BlackMisc::CIdentifier &mappingIdentifier() const { return m_identifier; }
|
||||||
|
|
||||||
//! Update simulated aircraft view
|
//! Update simulated aircraft view
|
||||||
void updateRenderedAircraftView(bool forceUpdate = false);
|
void updateRenderedAircraftView(bool forceUpdate = false);
|
||||||
@@ -151,7 +151,7 @@ namespace BlackGui
|
|||||||
QTimer m_updateTimer { this };
|
QTimer m_updateTimer { this };
|
||||||
BlackMisc::CTokenBucket m_bucket { 3, BlackMisc::PhysicalQuantities::CTime(5.0, BlackMisc::PhysicalQuantities::CTimeUnit::s()), 1};
|
BlackMisc::CTokenBucket m_bucket { 3, BlackMisc::PhysicalQuantities::CTime(5.0, BlackMisc::PhysicalQuantities::CTimeUnit::s()), 1};
|
||||||
Views::CCheckBoxDelegate *m_currentMappingsViewDelegate = nullptr; //! checkbox in view
|
Views::CCheckBoxDelegate *m_currentMappingsViewDelegate = nullptr; //! checkbox in view
|
||||||
BlackMisc::CIdentifier m_identifier;
|
BlackMisc::CIdentifier m_identifier { "MappingComponent", this };
|
||||||
};
|
};
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -92,14 +92,10 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
switch (tab)
|
switch (tab)
|
||||||
{
|
{
|
||||||
case TextMessagesAll:
|
case TextMessagesAll: return ui->tb_TextMessagesAll;
|
||||||
return ui->tb_TextMessagesAll;
|
case TextMessagesCom1: return ui->tb_TextMessagesCOM1;
|
||||||
case TextMessagesCom1:
|
case TextMessagesCom2: return ui->tb_TextMessagesCOM2;
|
||||||
return ui->tb_TextMessagesCOM1;
|
case TextMessagesUnicom: return ui->tb_TextMessagesUnicom;
|
||||||
case TextMessagesCom2:
|
|
||||||
return ui->tb_TextMessagesCOM2;
|
|
||||||
case TextMessagesUnicom:
|
|
||||||
return ui->tb_TextMessagesUnicom;
|
|
||||||
default:
|
default:
|
||||||
Q_ASSERT_X(false, Q_FUNC_INFO, "Wrong index");
|
Q_ASSERT_X(false, Q_FUNC_INFO, "Wrong index");
|
||||||
break;
|
break;
|
||||||
@@ -120,7 +116,7 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
if (messages.isEmpty()) return;
|
if (messages.isEmpty()) return;
|
||||||
const CSimulatedAircraft ownAircraft(this->getOwnAircraft());
|
const CSimulatedAircraft ownAircraft(this->getOwnAircraft());
|
||||||
const CTextMessageSettings msgSettings(this->m_messageSettings.getThreadLocal());
|
const CTextMessageSettings msgSettings(m_messageSettings.getThreadLocal());
|
||||||
|
|
||||||
for (const CTextMessage &message : messages)
|
for (const CTextMessage &message : messages)
|
||||||
{
|
{
|
||||||
@@ -193,14 +189,6 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CIdentifier CTextMessageComponent::componentIdentifier()
|
|
||||||
{
|
|
||||||
if (m_identifier.getName().isEmpty())
|
|
||||||
m_identifier = CIdentifier(QStringLiteral("TEXTMESSAGECOMPONENT"));
|
|
||||||
|
|
||||||
return m_identifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CTextMessageComponent::onChangedAircraftCockpit()
|
void CTextMessageComponent::onChangedAircraftCockpit()
|
||||||
{
|
{
|
||||||
this->showCurrentFrequenciesFromCockpit();
|
this->showCurrentFrequenciesFromCockpit();
|
||||||
@@ -214,7 +202,7 @@ namespace BlackGui
|
|||||||
if (textMessage.isPrivateMessage())
|
if (textMessage.isPrivateMessage())
|
||||||
{
|
{
|
||||||
// private message
|
// private message
|
||||||
CCallsign cs = textMessage.getSenderCallsign();
|
const CCallsign cs = textMessage.getSenderCallsign();
|
||||||
if (cs.isEmpty()) return false;
|
if (cs.isEmpty()) return false;
|
||||||
QWidget *tab = this->findTextMessageTabByName(cs.getStringAsSet());
|
QWidget *tab = this->findTextMessageTabByName(cs.getStringAsSet());
|
||||||
if (!tab) { return false; }
|
if (!tab) { return false; }
|
||||||
@@ -292,12 +280,12 @@ namespace BlackGui
|
|||||||
if (!textMessage.isPrivateMessage()) { return; }
|
if (!textMessage.isPrivateMessage()) { return; }
|
||||||
const CCallsign cs = textMessage.wasSent() ? textMessage.getRecipientCallsign() : textMessage.getSenderCallsign();
|
const CCallsign cs = textMessage.wasSent() ? textMessage.getRecipientCallsign() : textMessage.getSenderCallsign();
|
||||||
if (cs.isEmpty()) { return; }
|
if (cs.isEmpty()) { return; }
|
||||||
QWidget *tab = this->findTextMessageTabByCallsign(cs);
|
const QWidget *tab = this->findTextMessageTabByCallsign(cs);
|
||||||
if (!tab) { tab = this->addNewTextMessageTab(cs); }
|
if (!tab) { tab = this->addNewTextMessageTab(cs); }
|
||||||
Q_ASSERT_X(tab, Q_FUNC_INFO, "Missing tab");
|
Q_ASSERT_X(tab, Q_FUNC_INFO, "Missing tab");
|
||||||
CTextMessageTextEdit *textEdit = tab->findChild<CTextMessageTextEdit *>();
|
CTextMessageTextEdit *textEdit = tab->findChild<CTextMessageTextEdit *>();
|
||||||
BLACK_VERIFY_X(textEdit, Q_FUNC_INFO, "Missing text edit");
|
BLACK_VERIFY_X(textEdit, Q_FUNC_INFO, "Missing text edit");
|
||||||
if (!textEdit) { return; } // do not crash, though this situation could not happen
|
if (!textEdit) { return; } // do not crash, though this situation should not happen
|
||||||
textEdit->insertTextMessage(textMessage);
|
textEdit->insertTextMessage(textMessage);
|
||||||
|
|
||||||
// sound
|
// sound
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ namespace BlackGui
|
|||||||
virtual ~CTextMessageComponent();
|
virtual ~CTextMessageComponent();
|
||||||
|
|
||||||
//! \copydoc CEnableForDockWidgetInfoArea::setParentDockWidgetInfoArea
|
//! \copydoc CEnableForDockWidgetInfoArea::setParentDockWidgetInfoArea
|
||||||
virtual bool setParentDockWidgetInfoArea(BlackGui::CDockWidgetInfoArea *parentDockableWidget) override;
|
virtual bool setParentDockWidgetInfoArea(CDockWidgetInfoArea *parentDockableWidget) override;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
//! Message to be displayed in info window
|
//! Message to be displayed in info window
|
||||||
@@ -80,8 +80,8 @@ namespace BlackGui
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QScopedPointer<Ui::CTextMessageComponent> ui;
|
QScopedPointer<Ui::CTextMessageComponent> ui;
|
||||||
BlackMisc::CIdentifier m_identifier;
|
BlackMisc::CIdentifier m_identifier { "TextMessageComponent", this };
|
||||||
BlackMisc::CSettingReadOnly<BlackGui::Settings::TextMessageSettings> m_messageSettings { this };
|
BlackMisc::CSettingReadOnly<Settings::TextMessageSettings> m_messageSettings { this };
|
||||||
|
|
||||||
//! Enum to widget
|
//! Enum to widget
|
||||||
QWidget *getTabWidget(Tab tab) const;
|
QWidget *getTabWidget(Tab tab) const;
|
||||||
@@ -124,7 +124,7 @@ namespace BlackGui
|
|||||||
QString textMessageToCommand(const QString &enteredLine);
|
QString textMessageToCommand(const QString &enteredLine);
|
||||||
|
|
||||||
//! Identifier
|
//! Identifier
|
||||||
BlackMisc::CIdentifier componentIdentifier();
|
const BlackMisc::CIdentifier &componentIdentifier() const { return m_identifier; }
|
||||||
|
|
||||||
//! Handle a text message entered
|
//! Handle a text message entered
|
||||||
void handleEnteredTextMessage(const QString &textMessage);
|
void handleEnteredTextMessage(const QString &textMessage);
|
||||||
|
|||||||
@@ -316,7 +316,7 @@ namespace BlackMisc
|
|||||||
if (! m_deferredChanges.isEmpty())
|
if (! m_deferredChanges.isEmpty())
|
||||||
{
|
{
|
||||||
m_deferredChanges.setSaved();
|
m_deferredChanges.setSaved();
|
||||||
emit valuesLoadedFromStore(m_deferredChanges, CIdentifier::anonymous());
|
emit valuesLoadedFromStore(m_deferredChanges, CIdentifier::null());
|
||||||
deliverPromises(m_cache->m_revision.loadedValuePromises());
|
deliverPromises(m_cache->m_revision.loadedValuePromises());
|
||||||
m_deferredChanges.clear();
|
m_deferredChanges.clear();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,16 @@ namespace BlackMisc
|
|||||||
m_processId(QCoreApplication::applicationPid())
|
m_processId(QCoreApplication::applicationPid())
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
CIdentifier::CIdentifier(const QString &name, QObject *object) : CIdentifier(name)
|
||||||
|
{
|
||||||
|
if (object)
|
||||||
|
{
|
||||||
|
// append object name
|
||||||
|
this->linkWithQObjectName(object);
|
||||||
|
this->appendName(object->objectName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CIdentifier::CIdentifier(const QString &name, const QString &machineId, const QString &machineName,
|
CIdentifier::CIdentifier(const QString &name, const QString &machineId, const QString &machineName,
|
||||||
const QString &processName, qint64 processId) :
|
const QString &processName, qint64 processId) :
|
||||||
ITimestampBased(QDateTime::currentMSecsSinceEpoch()),
|
ITimestampBased(QDateTime::currentMSecsSinceEpoch()),
|
||||||
@@ -41,7 +51,13 @@ namespace BlackMisc
|
|||||||
|
|
||||||
const CIdentifier &CIdentifier::anonymous()
|
const CIdentifier &CIdentifier::anonymous()
|
||||||
{
|
{
|
||||||
static const CIdentifier id("anonymous", "", "", "", 0);
|
static const CIdentifier id("");
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
const CIdentifier &CIdentifier::null()
|
||||||
|
{
|
||||||
|
static const CIdentifier id("", "", "", "", 0);
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,6 +83,18 @@ namespace BlackMisc
|
|||||||
return toUuid().toString();
|
return toUuid().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CIdentifier::appendName(const QString &name)
|
||||||
|
{
|
||||||
|
if (m_name.endsWith(name)) { return; }
|
||||||
|
m_name += QStringLiteral(":") + name;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CIdentifier::linkWithQObjectName(QObject *object)
|
||||||
|
{
|
||||||
|
if (!object) { return; }
|
||||||
|
QObject::connect(object, &QObject::objectNameChanged, object, [ = ](const QString & name) { this->appendName(name); });
|
||||||
|
}
|
||||||
|
|
||||||
QByteArray CIdentifier::getMachineId() const
|
QByteArray CIdentifier::getMachineId() const
|
||||||
{
|
{
|
||||||
return QByteArray::fromBase64(m_machineIdBase64.toLocal8Bit());
|
return QByteArray::fromBase64(m_machineIdBase64.toLocal8Bit());
|
||||||
@@ -97,6 +125,11 @@ namespace BlackMisc
|
|||||||
return &anonymous() == this || anonymous() == *this;
|
return &anonymous() == this || anonymous() == *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CIdentifier::isNull() const
|
||||||
|
{
|
||||||
|
return &null() == this || null() == *this;
|
||||||
|
}
|
||||||
|
|
||||||
QString CIdentifier::convertToQString(bool i18n) const
|
QString CIdentifier::convertToQString(bool i18n) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(i18n);
|
Q_UNUSED(i18n);
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
#include <QMetaType>
|
#include <QMetaType>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
#include <QObject>
|
||||||
#include <QUuid>
|
#include <QUuid>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
|
||||||
@@ -50,11 +51,22 @@ namespace BlackMisc
|
|||||||
};
|
};
|
||||||
|
|
||||||
//! Constructor.
|
//! Constructor.
|
||||||
CIdentifier(const QString &name = QString());
|
//! \private use CIdentifier::anonymous() if you need an identifier without name and CIdentifier::null() for an empty identifier
|
||||||
|
CIdentifier() : CIdentifier("") {}
|
||||||
|
|
||||||
//! Returns an anonymous identifier.
|
//! Constructor.
|
||||||
|
CIdentifier(const QString &name);
|
||||||
|
|
||||||
|
//! Constructor using object's name
|
||||||
|
CIdentifier(const QString &name, QObject *object);
|
||||||
|
|
||||||
|
//! Returns an anonymous identifier, which is a valid identifier without name
|
||||||
|
//! \remark same as CIdentifier()
|
||||||
static const CIdentifier &anonymous();
|
static const CIdentifier &anonymous();
|
||||||
|
|
||||||
|
//! Null (empty) identifier
|
||||||
|
static const CIdentifier &null();
|
||||||
|
|
||||||
//! Returns a fake identifier.
|
//! Returns a fake identifier.
|
||||||
static const CIdentifier &fake();
|
static const CIdentifier &fake();
|
||||||
|
|
||||||
@@ -70,6 +82,16 @@ namespace BlackMisc
|
|||||||
//! Has name
|
//! Has name
|
||||||
bool hasName() const { return !m_name.isEmpty(); }
|
bool hasName() const { return !m_name.isEmpty(); }
|
||||||
|
|
||||||
|
//! Set the name
|
||||||
|
void setName(const QString &name) { m_name = name; }
|
||||||
|
|
||||||
|
//! Set name or append name
|
||||||
|
//! \remark append makes sense if an object name changes after some time (like for UI components when the whole UI is setup)
|
||||||
|
void appendName(const QString &name);
|
||||||
|
|
||||||
|
//! Reflect changes of QObject::
|
||||||
|
void linkWithQObjectName(QObject *object);
|
||||||
|
|
||||||
//! Get machine id
|
//! Get machine id
|
||||||
QByteArray getMachineId() const;
|
QByteArray getMachineId() const;
|
||||||
|
|
||||||
@@ -100,6 +122,9 @@ namespace BlackMisc
|
|||||||
//! Check if it is anonymous identifier
|
//! Check if it is anonymous identifier
|
||||||
bool isAnonymous() const;
|
bool isAnonymous() const;
|
||||||
|
|
||||||
|
//! Null identifier (no name, ids etc)
|
||||||
|
bool isNull() const;
|
||||||
|
|
||||||
//! \copydoc BlackMisc::Mixin::String::toQString
|
//! \copydoc BlackMisc::Mixin::String::toQString
|
||||||
QString convertToQString(bool i18n = false) const;
|
QString convertToQString(bool i18n = false) const;
|
||||||
|
|
||||||
|
|||||||
@@ -80,12 +80,12 @@ namespace BlackMiscTest
|
|||||||
CHotkeyCombination comb1;
|
CHotkeyCombination comb1;
|
||||||
comb1.addKeyboardKey(Key_ControlLeft);
|
comb1.addKeyboardKey(Key_ControlLeft);
|
||||||
comb1.addKeyboardKey(Key_D);
|
comb1.addKeyboardKey(Key_D);
|
||||||
CActionHotkey actionHotkey1 (CIdentifier(), comb1, "action");
|
CActionHotkey actionHotkey1 (CIdentifier::anonymous(), comb1, "action");
|
||||||
|
|
||||||
CHotkeyCombination comb2;
|
CHotkeyCombination comb2;
|
||||||
comb2.addKeyboardKey(Key_ControlLeft);
|
comb2.addKeyboardKey(Key_ControlLeft);
|
||||||
comb2.addKeyboardKey(Key_D);
|
comb2.addKeyboardKey(Key_D);
|
||||||
CActionHotkey actionHotkey2 (CIdentifier(), comb2, "action");
|
CActionHotkey actionHotkey2 (CIdentifier::anonymous(), comb2, "action");
|
||||||
QVERIFY2(actionHotkey1 == actionHotkey2, "Objects should equal");
|
QVERIFY2(actionHotkey1 == actionHotkey2, "Objects should equal");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,24 +94,24 @@ namespace BlackMiscTest
|
|||||||
CHotkeyCombination comb;
|
CHotkeyCombination comb;
|
||||||
comb.addKeyboardKey(Key_ControlLeft);
|
comb.addKeyboardKey(Key_ControlLeft);
|
||||||
comb.addKeyboardKey(Key_D);
|
comb.addKeyboardKey(Key_D);
|
||||||
CActionHotkey actionHotkey1 (CIdentifier(), comb, "action");
|
CActionHotkey actionHotkey1 (CIdentifier::anonymous(), comb, "action");
|
||||||
|
|
||||||
CHotkeyCombination comb2;
|
CHotkeyCombination comb2;
|
||||||
comb2.addKeyboardKey(Key_ControlLeft);
|
comb2.addKeyboardKey(Key_ControlLeft);
|
||||||
comb2.addKeyboardKey(Key_C);
|
comb2.addKeyboardKey(Key_C);
|
||||||
CActionHotkey actionHotkey2 (CIdentifier(), comb2, "action");
|
CActionHotkey actionHotkey2 (CIdentifier::anonymous(), comb2, "action");
|
||||||
QVERIFY2(actionHotkey1 != actionHotkey2, "Objects should not be equal");
|
QVERIFY2(actionHotkey1 != actionHotkey2, "Objects should not be equal");
|
||||||
|
|
||||||
CHotkeyCombination comb3;
|
CHotkeyCombination comb3;
|
||||||
comb3.addKeyboardKey(Key_ShiftLeft);
|
comb3.addKeyboardKey(Key_ShiftLeft);
|
||||||
comb3.addKeyboardKey(Key_D);
|
comb3.addKeyboardKey(Key_D);
|
||||||
CActionHotkey actionHotkey3 (CIdentifier(), comb2, "action");
|
CActionHotkey actionHotkey3 (CIdentifier::anonymous(), comb2, "action");
|
||||||
QVERIFY2(actionHotkey1 != actionHotkey3, "Objects should not be equal");
|
QVERIFY2(actionHotkey1 != actionHotkey3, "Objects should not be equal");
|
||||||
|
|
||||||
CHotkeyCombination comb4;
|
CHotkeyCombination comb4;
|
||||||
comb4.addKeyboardKey(Key_ControlLeft);
|
comb4.addKeyboardKey(Key_ControlLeft);
|
||||||
comb4.addKeyboardKey(Key_D);
|
comb4.addKeyboardKey(Key_D);
|
||||||
CActionHotkey actionHotkey4 (CIdentifier(), comb2, "other_action");
|
CActionHotkey actionHotkey4 (CIdentifier::anonymous(), comb2, "other_action");
|
||||||
QVERIFY2(actionHotkey1 != actionHotkey4, "Objects should not be equal");
|
QVERIFY2(actionHotkey1 != actionHotkey4, "Objects should not be equal");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,14 +120,14 @@ namespace BlackMiscTest
|
|||||||
CHotkeyCombination comb1;
|
CHotkeyCombination comb1;
|
||||||
comb1.addKeyboardKey(Key_ControlLeft);
|
comb1.addKeyboardKey(Key_ControlLeft);
|
||||||
comb1.addKeyboardKey(Key_C);
|
comb1.addKeyboardKey(Key_C);
|
||||||
CActionHotkey actionHotkey1 (CIdentifier(), comb1, "action");
|
CActionHotkey actionHotkey1 (CIdentifier::anonymous(), comb1, "action");
|
||||||
CActionHotkeyList list1;
|
CActionHotkeyList list1;
|
||||||
list1.push_back(actionHotkey1);
|
list1.push_back(actionHotkey1);
|
||||||
|
|
||||||
CHotkeyCombination comb2;
|
CHotkeyCombination comb2;
|
||||||
comb2.addKeyboardKey(Key_ControlLeft);
|
comb2.addKeyboardKey(Key_ControlLeft);
|
||||||
comb2.addKeyboardKey(Key_D);
|
comb2.addKeyboardKey(Key_D);
|
||||||
CActionHotkey actionHotkey2 (CIdentifier(), comb2, "action");
|
CActionHotkey actionHotkey2 (CIdentifier::anonymous(), comb2, "action");
|
||||||
CActionHotkeyList list2;
|
CActionHotkeyList list2;
|
||||||
list2.push_back(actionHotkey2);
|
list2.push_back(actionHotkey2);
|
||||||
QVERIFY2(CVariant::fromValue(list1) != CVariant::fromValue(list2), "List should not be equal");
|
QVERIFY2(CVariant::fromValue(list1) != CVariant::fromValue(list2), "List should not be equal");
|
||||||
@@ -138,16 +138,16 @@ namespace BlackMiscTest
|
|||||||
CHotkeyCombination comb1;
|
CHotkeyCombination comb1;
|
||||||
comb1.addKeyboardKey(Key_ControlLeft);
|
comb1.addKeyboardKey(Key_ControlLeft);
|
||||||
comb1.addKeyboardKey(Key_D);
|
comb1.addKeyboardKey(Key_D);
|
||||||
CActionHotkey actionHotkey1 (CIdentifier(), comb1, "action");
|
CActionHotkey actionHotkey1 (CIdentifier::anonymous(), comb1, "action");
|
||||||
|
|
||||||
CHotkeyCombination comb2;
|
CHotkeyCombination comb2;
|
||||||
comb2.addKeyboardKey(Key_ControlLeft);
|
comb2.addKeyboardKey(Key_ControlLeft);
|
||||||
CActionHotkey actionHotkey2 (CIdentifier(), comb2, "action");
|
CActionHotkey actionHotkey2 (CIdentifier::anonymous(), comb2, "action");
|
||||||
|
|
||||||
CHotkeyCombination comb3;
|
CHotkeyCombination comb3;
|
||||||
comb3.addKeyboardKey(Key_ShiftLeft);
|
comb3.addKeyboardKey(Key_ShiftLeft);
|
||||||
comb3.addKeyboardKey(Key_D);
|
comb3.addKeyboardKey(Key_D);
|
||||||
CActionHotkey actionHotkey3 (CIdentifier(), comb3, "action");
|
CActionHotkey actionHotkey3 (CIdentifier::anonymous(), comb3, "action");
|
||||||
|
|
||||||
CActionHotkeyList list1;
|
CActionHotkeyList list1;
|
||||||
list1.push_back(actionHotkey1);
|
list1.push_back(actionHotkey1);
|
||||||
@@ -160,17 +160,17 @@ namespace BlackMiscTest
|
|||||||
{
|
{
|
||||||
CHotkeyCombination comb1;
|
CHotkeyCombination comb1;
|
||||||
comb1.addKeyboardKey(Key_ControlLeft);
|
comb1.addKeyboardKey(Key_ControlLeft);
|
||||||
CActionHotkey actionHotkey1 (CIdentifier(), comb1, "action");
|
CActionHotkey actionHotkey1 (CIdentifier::anonymous(), comb1, "action");
|
||||||
|
|
||||||
CHotkeyCombination comb2;
|
CHotkeyCombination comb2;
|
||||||
comb2.addKeyboardKey(Key_ControlLeft);
|
comb2.addKeyboardKey(Key_ControlLeft);
|
||||||
comb2.addKeyboardKey(Key_D);
|
comb2.addKeyboardKey(Key_D);
|
||||||
CActionHotkey actionHotkey2 (CIdentifier(), comb2, "action");
|
CActionHotkey actionHotkey2 (CIdentifier::anonymous(), comb2, "action");
|
||||||
|
|
||||||
CHotkeyCombination comb3;
|
CHotkeyCombination comb3;
|
||||||
comb3.addKeyboardKey(Key_ShiftLeft);
|
comb3.addKeyboardKey(Key_ShiftLeft);
|
||||||
comb3.addKeyboardKey(Key_D);
|
comb3.addKeyboardKey(Key_D);
|
||||||
CActionHotkey actionHotkey3 (CIdentifier(), comb3, "action");
|
CActionHotkey actionHotkey3 (CIdentifier::anonymous(), comb3, "action");
|
||||||
|
|
||||||
CActionHotkeyList list1;
|
CActionHotkeyList list1;
|
||||||
list1.push_back(actionHotkey1);
|
list1.push_back(actionHotkey1);
|
||||||
|
|||||||
Reference in New Issue
Block a user