Qt4 protected signal workaround and signed/unsigned mismatch.

coverity_scan^2
Aesylwinn 9 years ago
parent 455d227f3c
commit acdb636935

@ -125,6 +125,25 @@ namespace CSMPrefs
mModifierStatus = status; mModifierStatus = status;
} }
void Shortcut::signalActivated(bool state)
{
emit activated(state);
}
void Shortcut::signalActivated()
{
emit activated();
}
void Shortcut::signalSecondary(bool state)
{
emit secondary(state);
}
void Shortcut::signalSecondary()
{
emit secondary();
}
QString Shortcut::toString() const QString Shortcut::toString() const
{ {
return QString(State::get().getShortcutManager().sequenceToString(std::make_pair(mSequence, mModifier)).data()); return QString(State::get().getShortcutManager().sequenceToString(std::make_pair(mSequence, mModifier)).data());

@ -66,6 +66,13 @@ namespace CSMPrefs
void setActivationStatus(ActivationStatus status); void setActivationStatus(ActivationStatus status);
void setModifierStatus(bool status); void setModifierStatus(bool status);
// Workaround for Qt4 signals being "protected"
void signalActivated(bool state);
void signalActivated();
void signalSecondary(bool state);
void signalSecondary();
QString toString() const; QString toString() const;
private: private:
@ -83,7 +90,6 @@ namespace CSMPrefs
ActivationStatus mActivationStatus; ActivationStatus mActivationStatus;
bool mModifierStatus; bool mModifierStatus;
signals: signals:
/// Triggered when the shortcut is activated or deactivated; can be determined from \p state /// Triggered when the shortcut is activated or deactivated; can be determined from \p state

@ -76,12 +76,12 @@ namespace CSMPrefs
if (shortcut->getActivationStatus() == Shortcut::AS_Regular) if (shortcut->getActivationStatus() == Shortcut::AS_Regular)
{ {
shortcut->setActivationStatus(Shortcut::AS_Inactive); shortcut->setActivationStatus(Shortcut::AS_Inactive);
emit shortcut->activated(false); shortcut->signalActivated(false);
} }
else if (shortcut->getActivationStatus() == Shortcut::AS_Secondary) else if (shortcut->getActivationStatus() == Shortcut::AS_Secondary)
{ {
shortcut->setActivationStatus(Shortcut::AS_Inactive); shortcut->setActivationStatus(Shortcut::AS_Inactive);
emit shortcut->secondary(false); shortcut->signalSecondary(false);
} }
} }
} }
@ -131,14 +131,14 @@ namespace CSMPrefs
if (shortcut->getModifierStatus() && shortcut->getSecondaryMode() == Shortcut::SM_Replace) if (shortcut->getModifierStatus() && shortcut->getSecondaryMode() == Shortcut::SM_Replace)
{ {
shortcut->setActivationStatus(Shortcut::AS_Secondary); shortcut->setActivationStatus(Shortcut::AS_Secondary);
emit shortcut->secondary(true); shortcut->signalSecondary(true);
emit shortcut->secondary(); shortcut->signalSecondary();
} }
else else
{ {
shortcut->setActivationStatus(Shortcut::AS_Regular); shortcut->setActivationStatus(Shortcut::AS_Regular);
emit shortcut->activated(true); shortcut->signalActivated(true);
emit shortcut->activated(); shortcut->signalActivated();
} }
used = true; used = true;
@ -170,13 +170,13 @@ namespace CSMPrefs
if (shortcut->getActivationStatus() == Shortcut::AS_Regular) if (shortcut->getActivationStatus() == Shortcut::AS_Regular)
{ {
shortcut->setActivationStatus(Shortcut::AS_Inactive); shortcut->setActivationStatus(Shortcut::AS_Inactive);
emit shortcut->activated(false); shortcut->signalActivated(false);
used = true; used = true;
} }
else if (shortcut->getActivationStatus() == Shortcut::AS_Secondary) else if (shortcut->getActivationStatus() == Shortcut::AS_Secondary)
{ {
shortcut->setActivationStatus(Shortcut::AS_Inactive); shortcut->setActivationStatus(Shortcut::AS_Inactive);
emit shortcut->secondary(false); shortcut->signalSecondary(false);
used = true; used = true;
} }
} }
@ -201,12 +201,12 @@ namespace CSMPrefs
{ {
if (activate) if (activate)
{ {
emit shortcut->secondary(true); shortcut->signalSecondary(true);
emit shortcut->secondary(); shortcut->signalSecondary();
} }
else else
{ {
emit shortcut->secondary(false); shortcut->signalSecondary(false);
} }
used = true; used = true;
@ -215,7 +215,7 @@ namespace CSMPrefs
{ {
shortcut->setActivationStatus(Shortcut::AS_Inactive); shortcut->setActivationStatus(Shortcut::AS_Inactive);
shortcut->setPosition(0); shortcut->setPosition(0);
emit shortcut->secondary(false); shortcut->signalSecondary(false);
used = true; used = true;
} }
} }

@ -82,7 +82,7 @@ namespace CSMPrefs
std::string output; std::string output;
// KeySequence // KeySequence
for (unsigned int i = 0; i < data.first.count(); ++i) for (int i = 0; i < data.first.count(); ++i)
{ {
if (data.first[i] & ModMask) if (data.first[i] & ModMask)
{ {

Loading…
Cancel
Save