Merge pull request #915 from dustinlieu/master
Fixed gui writing invalid config for hotkeys with multiple actions
This commit is contained in:
commit
7ee94cca94
|
@ -68,8 +68,20 @@ void Hotkey::saveSettings(QSettings& settings) const
|
||||||
|
|
||||||
QTextStream& operator<<(QTextStream& outStream, const Hotkey& hotkey)
|
QTextStream& operator<<(QTextStream& outStream, const Hotkey& hotkey)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < hotkey.actions().size(); i++)
|
// Don't write config if there are no actions
|
||||||
outStream << "\t" << hotkey.text() << " = " << hotkey.actions()[i] << endl;
|
if (hotkey.actions().size() == 0) {
|
||||||
|
return outStream;
|
||||||
|
}
|
||||||
|
|
||||||
|
outStream << "\t" << hotkey.text() << " = ";
|
||||||
|
for (int i = 0; i < hotkey.actions().size(); i++) {
|
||||||
|
outStream << hotkey.actions()[i];
|
||||||
|
if (i != hotkey.actions().size() - 1) {
|
||||||
|
outStream << ", ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
outStream << "\n";
|
||||||
|
|
||||||
return outStream;
|
return outStream;
|
||||||
}
|
}
|
||||||
|
|
|
@ -316,5 +316,5 @@ TEST(HotkeyToTexStreamTests, KeysMultipleAction)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
ASSERT_EQ(hotkeyToStringViaTextStream(createHotkey(hotkey)),
|
ASSERT_EQ(hotkeyToStringViaTextStream(createHotkey(hotkey)),
|
||||||
"\tkeystroke(a+b) = keyDown(z,*)\n\tkeystroke(a+b) = switchToScreen(test_screen)\n");
|
"\tkeystroke(a+b) = keyDown(z,*), switchToScreen(test_screen)\n");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue