mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 06:53:53 +00:00
Qt4 protected signal workaround and signed/unsigned mismatch.
This commit is contained in:
parent
455d227f3c
commit
acdb636935
4 changed files with 39 additions and 14 deletions
|
@ -125,6 +125,25 @@ namespace CSMPrefs
|
|||
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
|
||||
{
|
||||
return QString(State::get().getShortcutManager().sequenceToString(std::make_pair(mSequence, mModifier)).data());
|
||||
|
|
|
@ -66,6 +66,13 @@ namespace CSMPrefs
|
|||
void setActivationStatus(ActivationStatus 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;
|
||||
|
||||
private:
|
||||
|
@ -83,7 +90,6 @@ namespace CSMPrefs
|
|||
ActivationStatus mActivationStatus;
|
||||
bool mModifierStatus;
|
||||
|
||||
|
||||
signals:
|
||||
|
||||
/// 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)
|
||||
{
|
||||
shortcut->setActivationStatus(Shortcut::AS_Inactive);
|
||||
emit shortcut->activated(false);
|
||||
shortcut->signalActivated(false);
|
||||
}
|
||||
else if (shortcut->getActivationStatus() == Shortcut::AS_Secondary)
|
||||
{
|
||||
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)
|
||||
{
|
||||
shortcut->setActivationStatus(Shortcut::AS_Secondary);
|
||||
emit shortcut->secondary(true);
|
||||
emit shortcut->secondary();
|
||||
shortcut->signalSecondary(true);
|
||||
shortcut->signalSecondary();
|
||||
}
|
||||
else
|
||||
{
|
||||
shortcut->setActivationStatus(Shortcut::AS_Regular);
|
||||
emit shortcut->activated(true);
|
||||
emit shortcut->activated();
|
||||
shortcut->signalActivated(true);
|
||||
shortcut->signalActivated();
|
||||
}
|
||||
|
||||
used = true;
|
||||
|
@ -170,13 +170,13 @@ namespace CSMPrefs
|
|||
if (shortcut->getActivationStatus() == Shortcut::AS_Regular)
|
||||
{
|
||||
shortcut->setActivationStatus(Shortcut::AS_Inactive);
|
||||
emit shortcut->activated(false);
|
||||
shortcut->signalActivated(false);
|
||||
used = true;
|
||||
}
|
||||
else if (shortcut->getActivationStatus() == Shortcut::AS_Secondary)
|
||||
{
|
||||
shortcut->setActivationStatus(Shortcut::AS_Inactive);
|
||||
emit shortcut->secondary(false);
|
||||
shortcut->signalSecondary(false);
|
||||
used = true;
|
||||
}
|
||||
}
|
||||
|
@ -201,12 +201,12 @@ namespace CSMPrefs
|
|||
{
|
||||
if (activate)
|
||||
{
|
||||
emit shortcut->secondary(true);
|
||||
emit shortcut->secondary();
|
||||
shortcut->signalSecondary(true);
|
||||
shortcut->signalSecondary();
|
||||
}
|
||||
else
|
||||
{
|
||||
emit shortcut->secondary(false);
|
||||
shortcut->signalSecondary(false);
|
||||
}
|
||||
|
||||
used = true;
|
||||
|
@ -215,7 +215,7 @@ namespace CSMPrefs
|
|||
{
|
||||
shortcut->setActivationStatus(Shortcut::AS_Inactive);
|
||||
shortcut->setPosition(0);
|
||||
emit shortcut->secondary(false);
|
||||
shortcut->signalSecondary(false);
|
||||
used = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ namespace CSMPrefs
|
|||
std::string output;
|
||||
|
||||
// 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)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue