Mercurial > hg > svgui
comparison widgets/KeyReference.cpp @ 771:a964151832a7
Merge from branch tony_integration
author | Chris Cannam |
---|---|
date | Wed, 14 May 2014 09:54:34 +0100 |
parents | 394caa98d21a |
children | 44675ab217a3 |
comparison
equal
deleted
inserted
replaced
768:8b614632568c | 771:a964151832a7 |
---|---|
47 KeyReference::registerShortcut(QAction *action, QString overrideName) | 47 KeyReference::registerShortcut(QAction *action, QString overrideName) |
48 { | 48 { |
49 QString name = action->text(); | 49 QString name = action->text(); |
50 if (overrideName != "") name = overrideName; | 50 if (overrideName != "") name = overrideName; |
51 | 51 |
52 QString shortcut = action->shortcut().toString(); | 52 QString shortcut = action->shortcut().toString(QKeySequence::NativeText); |
53 QString tip = action->statusTip(); | 53 QString tip = action->statusTip(); |
54 | 54 |
55 registerShortcut(name, shortcut, tip); | 55 registerShortcut(name, shortcut, tip); |
56 } | 56 } |
57 | 57 |
85 QString name = action->text(); | 85 QString name = action->text(); |
86 registerAlternativeShortcut(name, alternative); | 86 registerAlternativeShortcut(name, alternative); |
87 } | 87 } |
88 | 88 |
89 void | 89 void |
90 KeyReference::registerAlternativeShortcut(QAction *action, QKeySequence shortcut) | |
91 { | |
92 QString name = action->text(); | |
93 registerAlternativeShortcut(name, shortcut.toString(QKeySequence::NativeText)); | |
94 } | |
95 | |
96 void | |
90 KeyReference::registerAlternativeShortcut(QString name, QString alternative) | 97 KeyReference::registerAlternativeShortcut(QString name, QString alternative) |
91 { | 98 { |
92 name.replace(tr("&"), ""); | 99 name.replace(tr("&"), ""); |
93 | 100 |
94 KeyList &list = m_map[m_currentCategory]; | 101 KeyList &list = m_map[m_currentCategory]; |
97 if (i->actionName == name) { | 104 if (i->actionName == name) { |
98 i->alternatives.push_back(alternative); | 105 i->alternatives.push_back(alternative); |
99 return; | 106 return; |
100 } | 107 } |
101 } | 108 } |
109 } | |
110 | |
111 void | |
112 KeyReference::registerAlternativeShortcut(QString name, QKeySequence shortcut) | |
113 { | |
114 registerAlternativeShortcut(name, shortcut.toString(QKeySequence::NativeText)); | |
102 } | 115 } |
103 | 116 |
104 void | 117 void |
105 KeyReference::show() | 118 KeyReference::show() |
106 { | 119 { |
145 altdesc += tr("<i>or</i> <b>%1</b>").arg(alt); | 158 altdesc += tr("<i>or</i> <b>%1</b>").arg(alt); |
146 } | 159 } |
147 altdesc = tr("</b> (%1)<b>").arg(altdesc); | 160 altdesc = tr("</b> (%1)<b>").arg(altdesc); |
148 } | 161 } |
149 | 162 |
150 text += QString("<tr><td> <b>%1%2</b></td><td> %3</td><td>%4</td></tr>\n") | 163 text += QString("<tr><td width=\"12%\"> <b>%1%2</b></td><td> %3</td><td>%4</td></tr>\n") |
151 .arg(shortcut).arg(altdesc).arg(actionName).arg(tip); | 164 .arg(shortcut).arg(altdesc).arg(actionName).arg(tip); |
152 } | 165 } |
153 } | 166 } |
154 | 167 |
155 text += "</table></center>\n"; | 168 text += "</table></center>\n"; |
157 m_text = new QTextEdit; | 170 m_text = new QTextEdit; |
158 m_text->setHtml(text); | 171 m_text->setHtml(text); |
159 m_text->setReadOnly(true); | 172 m_text->setReadOnly(true); |
160 | 173 |
161 m_dialog = new QDialog; | 174 m_dialog = new QDialog; |
162 m_dialog->setWindowTitle(tr("Sonic Visualiser: Key and Mouse Reference")); | 175 m_dialog->setWindowTitle(tr("%1: Key and Mouse Reference") |
176 .arg(QApplication::applicationName())); | |
163 | 177 |
164 QVBoxLayout *layout = new QVBoxLayout; | 178 QVBoxLayout *layout = new QVBoxLayout; |
165 m_dialog->setLayout(layout); | 179 m_dialog->setLayout(layout); |
166 layout->addWidget(m_text); | 180 layout->addWidget(m_text); |
167 | 181 |