~ubuntu-branches/ubuntu/utopic/clementine/utopic

« back to all changes in this revision

Viewing changes to src/ui/globalshortcutgrabber.cpp

  • Committer: Package Import Robot
  • Author(s): Thomas PIERSON
  • Date: 2012-01-01 20:43:39 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20120101204339-lsb6nndwhfy05sde
Tags: 1.0.1+dfsg-1
New upstream release. (Closes: #653926, #651611, #657391)

Show diffs side-by-side

added added

removed removed

Lines of Context:
56
56
  QDialog::hideEvent(e);
57
57
}
58
58
 
 
59
void GlobalShortcutGrabber::grabKeyboard() {
 
60
#ifdef Q_OS_DARWIN
 
61
  SetupMacEventHandler();
 
62
#endif
 
63
  QDialog::grabKeyboard();
 
64
}
 
65
 
 
66
void GlobalShortcutGrabber::releaseKeyboard() {
 
67
#ifdef Q_OS_DARWIN
 
68
  TeardownMacEventHandler();
 
69
#endif
 
70
  QDialog::releaseKeyboard();
 
71
}
 
72
 
59
73
bool GlobalShortcutGrabber::event(QEvent* e) {
60
74
  if (e->type() == QEvent::ShortcutOverride) {
61
75
    QKeyEvent* ke = static_cast<QKeyEvent*>(e);
65
79
    else
66
80
      ret_ = QKeySequence(ke->modifiers() | ke->key());
67
81
 
68
 
    ui_->combo->setText("<b>" + ret_.toString(QKeySequence::NativeText) + "</b>");
 
82
    UpdateText();
69
83
 
70
84
    if (!modifier_keys_.contains(ke->key()))
71
85
      accept();
74
88
  return QDialog::event(e);
75
89
}
76
90
 
 
91
void GlobalShortcutGrabber::UpdateText() {
 
92
  ui_->combo->setText("<b>" + ret_.toString(QKeySequence::NativeText) + "</b>");
 
93
}
 
94
 
77
95