mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 06:35:52 +08:00
Another attempt to fix copyed hotkeys by updating the identifier
* check on name OR id * remote keys not updated, but lenient check on local machine * Remark: Sometimes copied hotkeys d not work
This commit is contained in:
committed by
Mat Sutcliffe
parent
eb1427e55f
commit
d8a730302a
@@ -38,11 +38,26 @@ namespace BlackMisc
|
||||
m_combination = combination;
|
||||
}
|
||||
|
||||
bool CActionHotkey::isForSameMachine(const CActionHotkey &key) const
|
||||
bool CActionHotkey::isForSameMachineId(const CActionHotkey &key) const
|
||||
{
|
||||
return this->getApplicableMachine().hasSameMachineId(key.getApplicableMachine());
|
||||
}
|
||||
|
||||
bool CActionHotkey::isForSameMachineName(const CActionHotkey &key) const
|
||||
{
|
||||
return this->getApplicableMachine().hasSameMachineName(key.getApplicableMachine());
|
||||
}
|
||||
|
||||
bool CActionHotkey::isForSameMachine(const CActionHotkey &key) const
|
||||
{
|
||||
return this->isForSameMachineId(key) || this->isForSameMachineName(key);
|
||||
}
|
||||
|
||||
void CActionHotkey::updateToCurrentMachine()
|
||||
{
|
||||
m_identifier.updateToCurrentMachine();
|
||||
}
|
||||
|
||||
void CActionHotkey::setObject(const CActionHotkey &obj)
|
||||
{
|
||||
m_action = obj.m_action;
|
||||
|
||||
@@ -64,15 +64,27 @@ namespace BlackMisc
|
||||
//! Set function
|
||||
void setAction(const QString &action) { m_action = action; }
|
||||
|
||||
//! The identifier
|
||||
const CIdentifier &getIdentifier() const { return m_identifier; }
|
||||
|
||||
//! Set applicable machine
|
||||
void setApplicableMachine(const CIdentifier &identifier) { m_identifier = identifier; }
|
||||
|
||||
//! Get applicable machine
|
||||
const CIdentifier &getApplicableMachine() const { return m_identifier; }
|
||||
|
||||
//! Key for the same machine?
|
||||
//! Key for the same machine id?
|
||||
bool isForSameMachineId(const CActionHotkey &key) const;
|
||||
|
||||
//! Key for the same machine name
|
||||
bool isForSameMachineName(const CActionHotkey &key) const;
|
||||
|
||||
//! Key for the same machine (same name or id)?
|
||||
bool isForSameMachine(const CActionHotkey &key) const;
|
||||
|
||||
//! Local machine
|
||||
void updateToCurrentMachine();
|
||||
|
||||
//! Set object
|
||||
void setObject(const CActionHotkey &obj);
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace BlackMisc
|
||||
CActionHotkeyList sameMachineKeys;
|
||||
for (const CActionHotkey &actionHotkey : *this)
|
||||
{
|
||||
if (!actionHotkey.isForSameMachine(key)) { continue; }
|
||||
if (!actionHotkey.isForSameMachineId(key)) { continue; }
|
||||
sameMachineKeys.push_back(actionHotkey);
|
||||
}
|
||||
return sameMachineKeys;
|
||||
@@ -61,5 +61,15 @@ namespace BlackMisc
|
||||
{
|
||||
return this->contains(&CActionHotkey::getAction, action);
|
||||
}
|
||||
|
||||
void CActionHotkeyList::updateToCurrentMachine()
|
||||
{
|
||||
const CIdentifier comparison("comparison for local machine");
|
||||
for (CActionHotkey &actionHotkey : *this)
|
||||
{
|
||||
const bool sameMachine = actionHotkey.getIdentifier().hasSameMachineNameOrId(comparison);
|
||||
if (sameMachine) { actionHotkey.updateToCurrentMachine(); }
|
||||
}
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -57,6 +57,9 @@ namespace BlackMisc
|
||||
|
||||
//! Contains action?
|
||||
bool containsAction(const QString &action) const;
|
||||
|
||||
//! Update for my machine
|
||||
void updateToCurrentMachine();
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
Reference in New Issue
Block a user