mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-29 08:21:07 +02:00
CVolumeBar: rework volumebar handling
Use CComponenets and separates the gui part from driver part
- add new class CVolumeBar as CComponentsForm
- Various changes for reworked volume bar handling in some classes
- Move AudioMute() from CVolume to new class CAudioMute
- Use CComponentsPicture to paint muteicon
Origin commit data
------------------
Commit: 8baec6d62a
Author: Thilo Graf <dbt@novatux.de>
Date: 2013-05-04 (Sat, 04 May 2013)
This commit is contained in:
87
src/gui/audiomute.cpp
Normal file
87
src/gui/audiomute.cpp
Normal file
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
Based up Neutrino-GUI - Tuxbox-Project
|
||||
Copyright (C) 2001 by Steffen Hehn 'McClean'
|
||||
|
||||
audioMute - Neutrino-GUI
|
||||
Copyright (C) 2013 M. Liebmann (micha-bbg)
|
||||
|
||||
License: GPL
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public
|
||||
License along with this program; if not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include <global.h>
|
||||
#include <neutrino.h>
|
||||
#include <gui/infoclock.h>
|
||||
#include <gui/volumebar.h>
|
||||
#include <gui/audiomute.h>
|
||||
|
||||
CAudioMute::CAudioMute()
|
||||
{
|
||||
mute_ax = 0;
|
||||
mute_ay = 0;
|
||||
mute_dx = 0;
|
||||
mute_dy = 0;
|
||||
mute_ay_old = -1;
|
||||
CVolumeHelper::getInstance()->getMuteIconDimensions(&mute_ax, &mute_ay, &mute_dx, &mute_dy);
|
||||
mIcon = new CComponentsPicture(mute_ax, mute_ay, mute_dx, mute_dy, NEUTRINO_ICON_BUTTON_MUTE);
|
||||
}
|
||||
|
||||
CAudioMute::~CAudioMute()
|
||||
{
|
||||
delete mIcon;
|
||||
}
|
||||
|
||||
CAudioMute* CAudioMute::getInstance()
|
||||
{
|
||||
static CAudioMute* Mute = NULL;
|
||||
if(!Mute)
|
||||
Mute = new CAudioMute();
|
||||
return Mute;
|
||||
}
|
||||
|
||||
void CAudioMute::AudioMute(int newValue, bool isEvent)
|
||||
{
|
||||
CNeutrinoApp* neutrino = CNeutrinoApp::getInstance();
|
||||
bool doInit = newValue != (int) neutrino->isMuted();
|
||||
|
||||
CVFD::getInstance()->setMuted(newValue);
|
||||
neutrino->setCurrentMuted(newValue);
|
||||
g_Zapit->muteAudio(newValue);
|
||||
|
||||
if( isEvent && ( neutrino->getMode() != CNeutrinoApp::mode_scart ) && ( neutrino->getMode() != CNeutrinoApp::mode_audio) && ( neutrino->getMode() != CNeutrinoApp::mode_pic))
|
||||
{
|
||||
CVolumeHelper::getInstance()->getMuteIconDimensions(&mute_ax, &mute_ay, &mute_dx, &mute_dy);
|
||||
if ((mIcon) && (mute_ay_old != mute_ay)) {
|
||||
mIcon->hide();
|
||||
mIcon->setYPos(mute_ay);
|
||||
mute_ay_old = mute_ay;
|
||||
}
|
||||
if ((g_settings.mode_clock) && (doInit))
|
||||
CInfoClock::getInstance(true)->ClearDisplay();
|
||||
|
||||
if (newValue)
|
||||
mIcon->paint();
|
||||
else
|
||||
mIcon->hide();
|
||||
|
||||
if (doInit)
|
||||
CInfoClock::getInstance(true)->Init(true);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user