Changeset View
Changeset View
Standalone View
Standalone View
src/KeyboardTranslator.cpp
Show First 20 Lines • Show All 54 Lines • ▼ Show 20 Line(s) | |||||
55 | 55 | | |||
56 | void KeyboardTranslatorWriter::writeHeader(const QString &description) | 56 | void KeyboardTranslatorWriter::writeHeader(const QString &description) | ||
57 | { | 57 | { | ||
58 | *_writer << "keyboard \"" << description << '\"' << '\n'; | 58 | *_writer << "keyboard \"" << description << '\"' << '\n'; | ||
59 | } | 59 | } | ||
60 | 60 | | |||
61 | void KeyboardTranslatorWriter::writeEntry(const KeyboardTranslator::Entry &entry) | 61 | void KeyboardTranslatorWriter::writeEntry(const KeyboardTranslator::Entry &entry) | ||
62 | { | 62 | { | ||
63 | QString result; | 63 | QString result = entry.command() != KeyboardTranslator::NoCommand | ||
64 | if (entry.command() != KeyboardTranslator::NoCommand) { | 64 | ? entry.resultToString() | ||
65 | result = entry.resultToString(); | 65 | : QLatin1Char('\"') + entry.resultToString() + QLatin1Char('\"'); | ||
66 | } else { | | |||
67 | result = QLatin1Char('\"') + entry.resultToString() + QLatin1Char('\"'); | | |||
68 | } | | |||
69 | 66 | | |||
70 | *_writer << "key " << entry.conditionToString() << " : " << result << '\n'; | 67 | *_writer << "key " << entry.conditionToString() << " : " << result << '\n'; | ||
71 | } | 68 | } | ||
72 | 69 | | |||
73 | // each line of the keyboard translation file is one of: | 70 | // each line of the keyboard translation file is one of: | ||
74 | // | 71 | // | ||
75 | // - keyboard "name" | 72 | // - keyboard "name" | ||
76 | // - key KeySequence : "characters" | 73 | // - key KeySequence : "characters" | ||
▲ Show 20 Lines • Show All 704 Lines • Show Last 20 Lines |