Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 246347
Collapse All | Expand All

(-)kdemultimedia-4.1.2.orig/kmix/kmix.h (+9 lines)
Lines 29-34 Link Here
29
class QLabel;
29
class QLabel;
30
#include <qlist.h>
30
#include <qlist.h>
31
#include <QVBoxLayout>
31
#include <QVBoxLayout>
32
#include <QProgressBar>
33
#include <QTimer>
32
class KTabWidget;
34
class KTabWidget;
33
35
34
// KDE
36
// KDE
Lines 115-120 Link Here
115
   QLabel      *m_errorLabel;
117
   QLabel      *m_errorLabel;
116
   ViewDockAreaPopup *_dockAreaPopup;
118
   ViewDockAreaPopup *_dockAreaPopup;
117
   unsigned int m_configVersion;
119
   unsigned int m_configVersion;
120
   QProgressBar* volumeDisplay;
121
   QTimer* volumeDisplayTimer;
122
   void showVolumeDisplay();
118
123
119
  private slots:
124
  private slots:
120
   void saveConfig();
125
   void saveConfig();
Lines 124-129 Link Here
124
   void plugged( const char* driverName, const QString& udi, QString& dev);
129
   void plugged( const char* driverName, const QString& udi, QString& dev);
125
   void unplugged( const QString& udi);
130
   void unplugged( const QString& udi);
126
   void hideOrClose();
131
   void hideOrClose();
132
   void slotIncreaseVolume();
133
   void slotDecreaseVolume();
134
   void slotHideVolumeDisplay();
135
   void slotMute();
127
};
136
};
128
137
129
#endif // KMIX_H
138
#endif // KMIX_H
(-)kdemultimedia-4.1.2.orig/kmix/kmix.cpp (+79 lines)
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";

Return to bug 246347