Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of git://github.com/zballina/razor-qt (#440)

  • Loading branch information...
commit fefccc81e0055eff670de5169fa9a04efc54c0c0 2 parents 48fa066 + dd9fed5
@amoskvin amoskvin authored
View
33 razorqt-panel/plugin-volume/razorvolume.cpp
@@ -58,27 +58,40 @@ RazorVolume::RazorVolume(const RazorPanelPluginStartInfo* startInfo, QWidget* pa
m_volumeButton = new VolumeButton(panel(), this);
addWidget(m_volumeButton);
+ m_notification = new RazorNotification("", this);
m_configWindow = new RazorVolumeConfiguration(settings(), this);
// global key shortcuts
m_keyVolumeUp = new QxtGlobalShortcut(this);
m_keyVolumeDown = new QxtGlobalShortcut(this);
m_keyMuteToggle = new QxtGlobalShortcut(this);
+ QString shortcutNotRegistered;
QKeySequence keySequenceVolumeUp(Qt::Key_VolumeUp);
- if (!m_keyVolumeUp->setShortcut(keySequenceVolumeUp)) {
- RazorNotification::notify(tr("Volume Control: Global shortcut '%1' cannot be registered").arg(keySequenceVolumeUp.toString()));
+ if (!m_keyVolumeUp->setShortcut(keySequenceVolumeUp))
+ {
+ shortcutNotRegistered = "'" + keySequenceVolumeUp.toString() + "' ";
}
QKeySequence keySequenceVolumeDown(Qt::Key_VolumeDown);
- if (!m_keyVolumeDown->setShortcut(keySequenceVolumeDown)) {
- RazorNotification::notify(tr("Volume Control: Global shortcut '%1' cannot be registered").arg(keySequenceVolumeDown.toString()));
+ if (!m_keyVolumeDown->setShortcut(keySequenceVolumeDown))
+ {
+ shortcutNotRegistered += "'" + keySequenceVolumeDown.toString() + "' ";
}
QKeySequence keySequenceMuteToggle(Qt::Key_VolumeMute);
- if (!m_keyMuteToggle->setShortcut(keySequenceMuteToggle)) {
- RazorNotification::notify(tr("Volume Control: Global shortcut '%1' cannot be registered").arg(keySequenceMuteToggle.toString()));
+ if (!m_keyMuteToggle->setShortcut(keySequenceMuteToggle))
+ {
+ shortcutNotRegistered += "'" + keySequenceMuteToggle.toString() + "' ";
}
+
+ if(!shortcutNotRegistered.isEmpty())
+ {
+ m_notification->setSummary(tr("Volume Control: The following shortcuts can not be registered: %1").arg(shortcutNotRegistered));
+ m_notification->update();
+ }
+
+ m_notification->setTimeout(1000);
connect(m_keyVolumeUp, SIGNAL(activated()), this, SLOT(handleShortcutVolumeUp()));
connect(m_keyVolumeDown, SIGNAL(activated()), this, SLOT(handleShortcutVolumeDown()));
@@ -155,13 +168,21 @@ void RazorVolume::updateConfigurationSinkList()
void RazorVolume::handleShortcutVolumeUp()
{
if (m_defaultSink)
+ {
m_defaultSink->setVolume(m_defaultSink->volume() + settings().value(SETTINGS_STEP, SETTINGS_DEFAULT_STEP).toInt());
+ m_notification->setSummary(tr("Volume: %1").arg(QString::number(m_defaultSink->volume())));
+ m_notification->update();
+ }
}
void RazorVolume::handleShortcutVolumeDown()
{
if (m_defaultSink)
+ {
m_defaultSink->setVolume(m_defaultSink->volume() - settings().value(SETTINGS_STEP, SETTINGS_DEFAULT_STEP).toInt());
+ m_notification->setSummary(tr("Volume: %1").arg(QString::number(m_defaultSink->volume())));
+ m_notification->update();
+ }
}
void RazorVolume::handleShortcutVolumeMute()
View
4 razorqt-panel/plugin-volume/razorvolume.h
@@ -36,7 +36,7 @@ class VolumeButton;
class AudioEngine;
class AudioDevice;
class RazorVolumeConfiguration;
-
+class RazorNotification;
class QxtGlobalShortcut;
class RazorVolume : public RazorPanelPlugin
@@ -66,7 +66,7 @@ protected slots:
QxtGlobalShortcut *m_keyVolumeUp;
QxtGlobalShortcut *m_keyVolumeDown;
QxtGlobalShortcut *m_keyMuteToggle;
-
+ RazorNotification *m_notification;
};
EXPORT_RAZOR_PANEL_PLUGIN_H
Please sign in to comment.
Something went wrong with that request. Please try again.