Add a button to the global shortcuts dialog to open gnome's keybinding properties dialog.

This commit is contained in:
David Sansome 2010-05-17 00:31:39 +00:00
parent 56765caf64
commit 6806d78f96
27 changed files with 308 additions and 4 deletions

View File

@ -44,6 +44,14 @@ void GlobalShortcuts::Init() {
if (RegisterQxt()) return;
}
bool GlobalShortcuts::IsGsdAvailable() const {
#ifdef QT_DBUS_LIB
return QDBusConnection::sessionBus().interface()->isServiceRegistered(kGsdService);
#else // QT_DBUS_LIB
return false;
#endif
}
bool GlobalShortcuts::RegisterGnome() {
#ifdef QT_DBUS_LIB
// Check if the GSD service is available

View File

@ -31,6 +31,8 @@ public:
void MacMediaKeyPressed(const QString& key);
bool IsGsdAvailable() const;
signals:
void PlayPause();
void Stop();

View File

@ -812,6 +812,10 @@ msgstr ""
msgid "Shortcut for %1"
msgstr ""
#, qt-format
msgid "The \"%1\" command could not be started."
msgstr ""
msgid "Music (*.mp3 *.ogg *.flac *.mpc *.m4a *.aac *.wma)"
msgstr ""
@ -898,6 +902,12 @@ msgstr ""
msgid "Configure Shortcuts"
msgstr ""
msgid "Use Gnome's shortcut keys"
msgstr ""
msgid "Open..."
msgstr ""
msgid "Shortcut"
msgstr ""

View File

@ -815,6 +815,10 @@ msgstr ""
msgid "Shortcut for %1"
msgstr ""
#, qt-format
msgid "The \"%1\" command could not be started."
msgstr ""
msgid "Music (*.mp3 *.ogg *.flac *.mpc *.m4a *.aac *.wma)"
msgstr ""
@ -901,6 +905,12 @@ msgstr ""
msgid "Configure Shortcuts"
msgstr ""
msgid "Use Gnome's shortcut keys"
msgstr ""
msgid "Open..."
msgstr ""
msgid "Shortcut"
msgstr ""

View File

@ -811,6 +811,10 @@ msgstr ""
msgid "Shortcut for %1"
msgstr ""
#, qt-format
msgid "The \"%1\" command could not be started."
msgstr ""
msgid "Music (*.mp3 *.ogg *.flac *.mpc *.m4a *.aac *.wma)"
msgstr ""
@ -897,6 +901,12 @@ msgstr ""
msgid "Configure Shortcuts"
msgstr ""
msgid "Use Gnome's shortcut keys"
msgstr ""
msgid "Open..."
msgstr ""
msgid "Shortcut"
msgstr ""

View File

@ -814,6 +814,10 @@ msgstr ""
msgid "Shortcut for %1"
msgstr ""
#, qt-format
msgid "The \"%1\" command could not be started."
msgstr ""
msgid "Music (*.mp3 *.ogg *.flac *.mpc *.m4a *.aac *.wma)"
msgstr ""
@ -900,6 +904,12 @@ msgstr ""
msgid "Configure Shortcuts"
msgstr ""
msgid "Use Gnome's shortcut keys"
msgstr ""
msgid "Open..."
msgstr ""
msgid "Shortcut"
msgstr ""

View File

@ -810,6 +810,10 @@ msgstr ""
msgid "Shortcut for %1"
msgstr ""
#, qt-format
msgid "The \"%1\" command could not be started."
msgstr ""
msgid "Music (*.mp3 *.ogg *.flac *.mpc *.m4a *.aac *.wma)"
msgstr ""
@ -896,6 +900,12 @@ msgstr ""
msgid "Configure Shortcuts"
msgstr ""
msgid "Use Gnome's shortcut keys"
msgstr ""
msgid "Open..."
msgstr ""
msgid "Shortcut"
msgstr ""

View File

@ -817,6 +817,10 @@ msgstr ""
msgid "Shortcut for %1"
msgstr ""
#, qt-format
msgid "The \"%1\" command could not be started."
msgstr ""
msgid "Music (*.mp3 *.ogg *.flac *.mpc *.m4a *.aac *.wma)"
msgstr ""
@ -903,6 +907,12 @@ msgstr ""
msgid "Configure Shortcuts"
msgstr "Configurar Accesos Rápidos"
msgid "Use Gnome's shortcut keys"
msgstr ""
msgid "Open..."
msgstr ""
msgid "Shortcut"
msgstr "Acceso rápido"

View File

@ -806,6 +806,10 @@ msgstr ""
msgid "Shortcut for %1"
msgstr ""
#, qt-format
msgid "The \"%1\" command could not be started."
msgstr ""
msgid "Music (*.mp3 *.ogg *.flac *.mpc *.m4a *.aac *.wma)"
msgstr ""
@ -892,6 +896,12 @@ msgstr ""
msgid "Configure Shortcuts"
msgstr ""
msgid "Use Gnome's shortcut keys"
msgstr ""
msgid "Open..."
msgstr ""
msgid "Shortcut"
msgstr ""

View File

@ -818,6 +818,10 @@ msgstr ""
msgid "Shortcut for %1"
msgstr ""
#, qt-format
msgid "The \"%1\" command could not be started."
msgstr ""
msgid "Music (*.mp3 *.ogg *.flac *.mpc *.m4a *.aac *.wma)"
msgstr ""
@ -904,6 +908,12 @@ msgstr ""
msgid "Configure Shortcuts"
msgstr ""
msgid "Use Gnome's shortcut keys"
msgstr ""
msgid "Open..."
msgstr ""
msgid "Shortcut"
msgstr ""

View File

@ -808,6 +808,10 @@ msgstr ""
msgid "Shortcut for %1"
msgstr ""
#, qt-format
msgid "The \"%1\" command could not be started."
msgstr ""
msgid "Music (*.mp3 *.ogg *.flac *.mpc *.m4a *.aac *.wma)"
msgstr ""
@ -894,6 +898,12 @@ msgstr ""
msgid "Configure Shortcuts"
msgstr ""
msgid "Use Gnome's shortcut keys"
msgstr ""
msgid "Open..."
msgstr ""
msgid "Shortcut"
msgstr ""

View File

@ -815,6 +815,10 @@ msgstr ""
msgid "Shortcut for %1"
msgstr ""
#, qt-format
msgid "The \"%1\" command could not be started."
msgstr ""
msgid "Music (*.mp3 *.ogg *.flac *.mpc *.m4a *.aac *.wma)"
msgstr "Musica (*.mp3 *.ogg *.flac *.mpc *.m4a *.aac *.wma)"
@ -901,6 +905,12 @@ msgstr ""
msgid "Configure Shortcuts"
msgstr ""
msgid "Use Gnome's shortcut keys"
msgstr ""
msgid "Open..."
msgstr ""
msgid "Shortcut"
msgstr ""

View File

@ -808,6 +808,10 @@ msgstr ""
msgid "Shortcut for %1"
msgstr ""
#, qt-format
msgid "The \"%1\" command could not be started."
msgstr ""
msgid "Music (*.mp3 *.ogg *.flac *.mpc *.m4a *.aac *.wma)"
msgstr ""
@ -894,6 +898,12 @@ msgstr ""
msgid "Configure Shortcuts"
msgstr ""
msgid "Use Gnome's shortcut keys"
msgstr ""
msgid "Open..."
msgstr ""
msgid "Shortcut"
msgstr ""

View File

@ -812,6 +812,10 @@ msgstr ""
msgid "Shortcut for %1"
msgstr ""
#, qt-format
msgid "The \"%1\" command could not be started."
msgstr ""
msgid "Music (*.mp3 *.ogg *.flac *.mpc *.m4a *.aac *.wma)"
msgstr ""
@ -898,6 +902,12 @@ msgstr ""
msgid "Configure Shortcuts"
msgstr ""
msgid "Use Gnome's shortcut keys"
msgstr ""
msgid "Open..."
msgstr ""
msgid "Shortcut"
msgstr ""

View File

@ -810,6 +810,10 @@ msgstr ""
msgid "Shortcut for %1"
msgstr ""
#, qt-format
msgid "The \"%1\" command could not be started."
msgstr ""
msgid "Music (*.mp3 *.ogg *.flac *.mpc *.m4a *.aac *.wma)"
msgstr ""
@ -896,6 +900,12 @@ msgstr ""
msgid "Configure Shortcuts"
msgstr ""
msgid "Use Gnome's shortcut keys"
msgstr ""
msgid "Open..."
msgstr ""
msgid "Shortcut"
msgstr ""

View File

@ -813,6 +813,10 @@ msgstr ""
msgid "Shortcut for %1"
msgstr ""
#, qt-format
msgid "The \"%1\" command could not be started."
msgstr ""
msgid "Music (*.mp3 *.ogg *.flac *.mpc *.m4a *.aac *.wma)"
msgstr ""
@ -899,6 +903,12 @@ msgstr ""
msgid "Configure Shortcuts"
msgstr ""
msgid "Use Gnome's shortcut keys"
msgstr ""
msgid "Open..."
msgstr ""
msgid "Shortcut"
msgstr ""

View File

@ -806,6 +806,10 @@ msgstr ""
msgid "Shortcut for %1"
msgstr ""
#, qt-format
msgid "The \"%1\" command could not be started."
msgstr ""
msgid "Music (*.mp3 *.ogg *.flac *.mpc *.m4a *.aac *.wma)"
msgstr ""
@ -892,6 +896,12 @@ msgstr ""
msgid "Configure Shortcuts"
msgstr ""
msgid "Use Gnome's shortcut keys"
msgstr ""
msgid "Open..."
msgstr ""
msgid "Shortcut"
msgstr ""

View File

@ -807,6 +807,10 @@ msgstr ""
msgid "Shortcut for %1"
msgstr ""
#, qt-format
msgid "The \"%1\" command could not be started."
msgstr ""
msgid "Music (*.mp3 *.ogg *.flac *.mpc *.m4a *.aac *.wma)"
msgstr ""
@ -893,6 +897,12 @@ msgstr ""
msgid "Configure Shortcuts"
msgstr ""
msgid "Use Gnome's shortcut keys"
msgstr ""
msgid "Open..."
msgstr ""
msgid "Shortcut"
msgstr ""

View File

@ -810,6 +810,10 @@ msgstr ""
msgid "Shortcut for %1"
msgstr ""
#, qt-format
msgid "The \"%1\" command could not be started."
msgstr ""
msgid "Music (*.mp3 *.ogg *.flac *.mpc *.m4a *.aac *.wma)"
msgstr "Композиции (*.mp3 *.ogg *.flac *.mpc *.m4a *.aac *.wma)"
@ -896,6 +900,12 @@ msgstr ""
msgid "Configure Shortcuts"
msgstr ""
msgid "Use Gnome's shortcut keys"
msgstr ""
msgid "Open..."
msgstr ""
msgid "Shortcut"
msgstr ""

View File

@ -812,6 +812,10 @@ msgstr ""
msgid "Shortcut for %1"
msgstr ""
#, qt-format
msgid "The \"%1\" command could not be started."
msgstr ""
msgid "Music (*.mp3 *.ogg *.flac *.mpc *.m4a *.aac *.wma)"
msgstr ""
@ -898,6 +902,12 @@ msgstr ""
msgid "Configure Shortcuts"
msgstr "Nastaviť skratky"
msgid "Use Gnome's shortcut keys"
msgstr ""
msgid "Open..."
msgstr ""
msgid "Shortcut"
msgstr "Skratka"

View File

@ -813,6 +813,10 @@ msgstr ""
msgid "Shortcut for %1"
msgstr ""
#, qt-format
msgid "The \"%1\" command could not be started."
msgstr ""
msgid "Music (*.mp3 *.ogg *.flac *.mpc *.m4a *.aac *.wma)"
msgstr ""
@ -899,6 +903,12 @@ msgstr ""
msgid "Configure Shortcuts"
msgstr ""
msgid "Use Gnome's shortcut keys"
msgstr ""
msgid "Open..."
msgstr ""
msgid "Shortcut"
msgstr ""

View File

@ -806,6 +806,10 @@ msgstr ""
msgid "Shortcut for %1"
msgstr ""
#, qt-format
msgid "The \"%1\" command could not be started."
msgstr ""
msgid "Music (*.mp3 *.ogg *.flac *.mpc *.m4a *.aac *.wma)"
msgstr ""
@ -892,6 +896,12 @@ msgstr ""
msgid "Configure Shortcuts"
msgstr ""
msgid "Use Gnome's shortcut keys"
msgstr ""
msgid "Open..."
msgstr ""
msgid "Shortcut"
msgstr ""

View File

@ -797,6 +797,10 @@ msgstr ""
msgid "Shortcut for %1"
msgstr ""
#, qt-format
msgid "The \"%1\" command could not be started."
msgstr ""
msgid "Music (*.mp3 *.ogg *.flac *.mpc *.m4a *.aac *.wma)"
msgstr ""
@ -883,6 +887,12 @@ msgstr ""
msgid "Configure Shortcuts"
msgstr ""
msgid "Use Gnome's shortcut keys"
msgstr ""
msgid "Open..."
msgstr ""
msgid "Shortcut"
msgstr ""

View File

@ -17,24 +17,32 @@
#include "globalshortcutgrabber.h"
#include "globalshortcutsdialog.h"
#include "ui_globalshortcutsdialog.h"
#include "core/globalshortcuts.h"
#include <QtDebug>
#include <QSettings>
#include <QPushButton>
#include <QKeyEvent>
#include <QProcess>
#include <QMessageBox>
const char* GlobalShortcutsDialog::kSettingsGroup = "Shortcuts";
GlobalShortcutsDialog::GlobalShortcutsDialog(QWidget* parent)
GlobalShortcutsDialog::GlobalShortcutsDialog(GlobalShortcuts* manager,
QWidget* parent)
: QDialog(parent),
ui_(new Ui_GlobalShortcutsDialog),
manager_(manager),
grabber_(new GlobalShortcutGrabber)
{
ui_->setupUi(this);
ui_->shortcut_options->setEnabled(false);
ui_->list->header()->setResizeMode(QHeaderView::ResizeToContents);
if (!manager->IsGsdAvailable()) {
ui_->gnome_container->hide();
}
settings_.beginGroup(kSettingsGroup);
AddShortcut("play", tr("Play"));
@ -58,6 +66,9 @@ GlobalShortcutsDialog::GlobalShortcutsDialog(QWidget* parent)
connect(ui_->radio_default, SIGNAL(clicked()), SLOT(DefaultClicked()));
connect(ui_->radio_custom, SIGNAL(clicked()), SLOT(ChangeClicked()));
connect(ui_->change, SIGNAL(clicked()), SLOT(ChangeClicked()));
connect(ui_->gnome_open, SIGNAL(clicked()), SLOT(OpenGnomeKeybindingProperties()));
ItemClicked(ui_->list->topLevelItem(0));
}
GlobalShortcutsDialog::~GlobalShortcutsDialog() {
@ -135,3 +146,11 @@ void GlobalShortcutsDialog::ChangeClicked() {
ui_->radio_custom->setChecked(true);
SetShortcut(current_id_, key);
}
void GlobalShortcutsDialog::OpenGnomeKeybindingProperties() {
if (!QProcess::startDetached("gnome-keybinding-properties")) {
QMessageBox::warning(this, "Error",
tr("The \"%1\" command could not be started.")
.arg("gnome-keybinding-properties"));
}
}

View File

@ -27,12 +27,13 @@ class QTreeWidgetItem;
class Ui_GlobalShortcutsDialog;
class GlobalShortcutGrabber;
class GlobalShortcuts;
class GlobalShortcutsDialog : public QDialog {
Q_OBJECT
public:
GlobalShortcutsDialog(QWidget* parent = 0);
GlobalShortcutsDialog(GlobalShortcuts* manager, QWidget* parent = 0);
~GlobalShortcutsDialog();
static const char* kSettingsGroup;
@ -47,6 +48,8 @@ class GlobalShortcutsDialog : public QDialog {
void DefaultClicked();
void ChangeClicked();
void OpenGnomeKeybindingProperties();
void Save();
private:
@ -66,6 +69,7 @@ class GlobalShortcutsDialog : public QDialog {
private:
Ui_GlobalShortcutsDialog* ui_;
GlobalShortcuts* manager_;
boost::scoped_ptr<GlobalShortcutGrabber> grabber_;
QSettings settings_;

View File

@ -14,6 +14,35 @@
<string>Configure Shortcuts</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QWidget" name="gnome_container" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="gnome_checkbox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Use Gnome's shortcut keys</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="gnome_open">
<property name="text">
<string>Open...</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QTreeWidget" name="list">
<property name="editTriggers">
@ -156,5 +185,37 @@
</hint>
</hints>
</connection>
<connection>
<sender>gnome_checkbox</sender>
<signal>toggled(bool)</signal>
<receiver>list</receiver>
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>63</x>
<y>25</y>
</hint>
<hint type="destinationlabel">
<x>82</x>
<y>63</y>
</hint>
</hints>
</connection>
<connection>
<sender>gnome_checkbox</sender>
<signal>toggled(bool)</signal>
<receiver>shortcut_options</receiver>
<slot>setDisabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>244</x>
<y>26</y>
</hint>
<hint type="destinationlabel">
<x>122</x>
<y>298</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -111,7 +111,7 @@ MainWindow::MainWindow(NetworkAccessManager* network, Engine::Type engine, QWidg
cover_manager_(new AlbumCoverManager(network, library_->model()->backend())),
equalizer_(new Equalizer),
transcode_dialog_(new TranscodeDialog),
global_shortcuts_dialog_(new GlobalShortcutsDialog),
global_shortcuts_dialog_(new GlobalShortcutsDialog(global_shortcuts_)),
playlist_menu_(new QMenu(this)),
library_sort_model_(new QSortFilterProxyModel(this)),
track_position_timer_(new QTimer(this)),