Esempio n. 1
0
MixerTray::MixerTray() : QSystemTrayIcon(){
  starting = true;
  //Initialize the settings backend
  settings = new QSettings("TrueOS", "pc-mixer");
  //Initialize all the widgets
  isMuted = false;
  slider = new QSlider(Qt::Vertical, 0);
    slider->setRange(0,100);
    slider->setTickPosition(QSlider::NoTicks);
  slideA  = new QWidgetAction(0);
	slideA->setDefaultWidget(slider);
  mute = new QToolButton(0);
  muteA = new QWidgetAction(0);
	muteA->setDefaultWidget(mute);
  mixer = new QToolButton(0);
	mixer->setText(tr("Mixer"));
	mixer->setIcon(QIcon(":icons/configure.png"));
	mixer->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
  mixerA = new QWidgetAction(0);
	mixerA->setDefaultWidget(mixer);

  //Get output devices


  actionMenu = new QMenu(0);
	actionMenu->addAction(slideA);
	actionMenu->addAction(muteA);
	actionMenu->addSeparator();
    soundOutput = new QMenu(tr("Output"));
    slotFillOutputDevices();
    if (soundOutput->actions().size()>1)
        actionMenu->addMenu(soundOutput);
	actionMenu->addAction(mixerA);
  //Now initialize the GUI
  GUI = new MixerGUI(settings);

  //Connect the signals/slots
  connect(this, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(trayActivated()) );
  connect(mixer, SIGNAL(clicked()), this, SLOT(openMixerGUI()) );
  connect(mute, SIGNAL(clicked()), this, SLOT(muteClicked()) );
  connect(slider, SIGNAL(valueChanged(int)), this, SLOT(sliderChanged(int)) );
  connect(GUI, SIGNAL(updateTray()), this, SLOT(loadVol()) );
  connect(GUI, SIGNAL(outChanged()), this, SLOT(slotFillOutputDevices()) );
  connect(actionMenu, SIGNAL(hovered(QAction*)), this, SLOT(hoverDisable(QAction*)) );
  
  //Show a quick icon to prevent a warning message
  this->setIcon(QIcon(":icons/audio-volume-high.png"));
  CVOL = 101; //quick default to maximize it
  CDIFF = 0;
  //Make sure no single-instance events for 30 seconds
  QTimer::singleShot(30000, this, SLOT(doneStarting()) );
  QTimer::singleShot(10, this, SLOT(loadVol()) ); //Update the UI
  
  //This timer will be fired in doneStarting()
  timer = new QTimer();
  timer->setInterval(500);
  connect(timer, SIGNAL(timeout()), this, SLOT(loadVol()) );
}
Esempio n. 2
0
void Renderer_gl2::toggleTexStream()
{
	tryTexStream = !(tryTexStream >0); // -1--resident, 0--off, 1--mixed, 2--force
	//qDebug( "	tryTexStream = %d", tryTexStream);
	try	{
		PROGRESS_DIALOG( QObject::tr((tryTexStream >0)? "Try Texture Stream": "No Texture Stream"), widget);
		PROGRESS_PERCENT(30);

		if (tryTexStream<=0)
		{
			cleanTexStreamBuffer();
			qDebug("	toggleTexStream: %s", try_vol_state());
		}
		else loadVol();

		PROGRESS_PERCENT(100);
	} CATCH_handler( "Renderer_gl2::toggleTexStream" );
}