|
Lines 25-30
Link Here
|
| 25 |
// include files for QT |
25 |
// include files for QT |
| 26 |
#include <QCheckBox> |
26 |
#include <QCheckBox> |
| 27 |
#include <QLabel> |
27 |
#include <QLabel> |
|
|
28 |
#include <QDesktopWidget> |
| 28 |
#include <qradiobutton.h> |
29 |
#include <qradiobutton.h> |
| 29 |
#include <KTabWidget> |
30 |
#include <KTabWidget> |
| 30 |
|
31 |
|
|
Lines 122-127
Link Here
|
| 122 |
action = actionCollection()->addAction("toggle_channels_currentview"); |
123 |
action = actionCollection()->addAction("toggle_channels_currentview"); |
| 123 |
action->setText(i18n("Configure &Channels...")); |
124 |
action->setText(i18n("Configure &Channels...")); |
| 124 |
connect(action, SIGNAL(triggered(bool) ), SLOT(slotConfigureCurrentView())); |
125 |
connect(action, SIGNAL(triggered(bool) ), SLOT(slotConfigureCurrentView())); |
|
|
126 |
|
| 127 |
KAction* globalAction = actionCollection()->addAction("increase_volume"); |
| 128 |
globalAction->setText(i18n("Increase Volume")); |
| 129 |
globalAction->setGlobalShortcut(KShortcut(Qt::Key_VolumeUp)); |
| 130 |
connect(globalAction, SIGNAL(triggered(bool) ), SLOT(slotIncreaseVolume())); |
| 131 |
|
| 132 |
globalAction = actionCollection()->addAction("decrease_volume"); |
| 133 |
globalAction->setText(i18n("Decrease Volume")); |
| 134 |
globalAction->setGlobalShortcut(KShortcut(Qt::Key_VolumeDown)); |
| 135 |
connect(globalAction, SIGNAL(triggered(bool) ), SLOT(slotDecreaseVolume())); |
| 136 |
|
| 137 |
globalAction = actionCollection()->addAction("mute"); |
| 138 |
globalAction->setText(i18n("Mute")); |
| 139 |
globalAction->setGlobalShortcut(KShortcut(Qt::Key_VolumeMute)); |
| 140 |
connect(globalAction, SIGNAL(triggered(bool) ), SLOT(slotMute())); |
| 141 |
|
| 142 |
volumeDisplay = new QProgressBar(); |
| 143 |
volumeDisplay->setWindowFlags(Qt::X11BypassWindowManagerHint); |
| 144 |
QDesktopWidget* desktop = KApplication::kApplication()->desktop(); |
| 145 |
QRect rect = desktop->screenGeometry(); |
| 146 |
int width = (rect.width()/2) - (volumeDisplay->width()/2); |
| 147 |
int height = (rect.height()/2) - (volumeDisplay->height()/2); |
| 148 |
volumeDisplay->move(width, height); |
| 149 |
volumeDisplayTimer = new QTimer(this); |
| 150 |
connect(volumeDisplayTimer, SIGNAL(timeout()), this, SLOT(slotHideVolumeDisplay())); |
| 151 |
|
| 125 |
createGUI( "kmixui.rc" ); |
152 |
createGUI( "kmixui.rc" ); |
| 126 |
} |
153 |
} |
| 127 |
|
154 |
|
|
Lines 570-575
Link Here
|
| 570 |
} |
597 |
} |
| 571 |
} |
598 |
} |
| 572 |
|
599 |
|
|
|
600 |
void KMixWindow::slotIncreaseVolume() |
| 601 |
{ |
| 602 |
Mixer* mixer = Mixer::getGlobalMasterMixer(); |
| 603 |
MixDevice *master = mixer->getLocalMasterMD(); |
| 604 |
mixer->setMute(master->id(), false); |
| 605 |
mixer->increaseVolume(master->id()); |
| 606 |
showVolumeDisplay(); |
| 607 |
} |
| 608 |
|
| 609 |
void KMixWindow::slotDecreaseVolume() |
| 610 |
{ |
| 611 |
Mixer* mixer = Mixer::getGlobalMasterMixer(); |
| 612 |
MixDevice *master = mixer->getLocalMasterMD(); |
| 613 |
mixer->setMute(master->id(), false); |
| 614 |
mixer->decreaseVolume(master->id()); |
| 615 |
showVolumeDisplay(); |
| 616 |
} |
| 617 |
|
| 618 |
void KMixWindow::showVolumeDisplay() |
| 619 |
{ |
| 620 |
Mixer* mixer = Mixer::getGlobalMasterMixer(); |
| 621 |
int currentVolume = mixer->masterVolume(); |
| 622 |
volumeDisplay->setValue(currentVolume); |
| 623 |
if (mixer->mute("Master:0")) { |
| 624 |
volumeDisplay->setValue(0); |
| 625 |
} |
| 626 |
volumeDisplay->show(); |
| 627 |
|
| 628 |
//FIXME, how to get this to work before it is displayed for the first time? |
| 629 |
QDesktopWidget* desktop = KApplication::kApplication()->desktop(); |
| 630 |
QRect rect = desktop->screenGeometry(); |
| 631 |
int width = (rect.width()/2) - (volumeDisplay->width()/2); |
| 632 |
int height = (rect.height()/2) - (volumeDisplay->height()/2); |
| 633 |
volumeDisplay->move(width, height); |
| 634 |
|
| 635 |
volumeDisplayTimer->setInterval(2000); |
| 636 |
volumeDisplayTimer->start(); |
| 637 |
} |
| 638 |
|
| 639 |
void KMixWindow::slotHideVolumeDisplay() |
| 640 |
{ |
| 641 |
volumeDisplay->hide(); |
| 642 |
} |
| 643 |
|
| 644 |
void KMixWindow::slotMute() |
| 645 |
{ |
| 646 |
Mixer* mixer = Mixer::getGlobalMasterMixer(); |
| 647 |
MixDevice *master = mixer->getLocalMasterMD(); |
| 648 |
mixer->toggleMute(master->id()); |
| 649 |
showVolumeDisplay(); |
| 650 |
} |
| 651 |
|
| 573 |
void KMixWindow::quit() |
652 |
void KMixWindow::quit() |
| 574 |
{ |
653 |
{ |
| 575 |
// kDebug(67100) << "quit"; |
654 |
// kDebug(67100) << "quit"; |