CAudioMute: implementation of CComponents

Origin commit data
------------------
Commit: 35444cb703
Author: Thilo Graf <dbt@novatux.de>
Date: 2013-05-10 (Fri, 10 May 2013)
This commit is contained in:
2013-05-10 18:07:48 +02:00
committed by Michael Liebmann
parent 4f521760ef
commit 12b8d96c0b
2 changed files with 14 additions and 25 deletions

View File

@@ -4,6 +4,8 @@
audioMute - Neutrino-GUI audioMute - Neutrino-GUI
Copyright (C) 2013 M. Liebmann (micha-bbg) Copyright (C) 2013 M. Liebmann (micha-bbg)
CComponents implementation
Copyright (C) 2013 Thilo Graf
License: GPL License: GPL
@@ -32,21 +34,11 @@
#include <gui/volumebar.h> #include <gui/volumebar.h>
#include <gui/audiomute.h> #include <gui/audiomute.h>
CAudioMute::CAudioMute() CAudioMute::CAudioMute():CComponentsPicture(0, 0, 0, 0, NEUTRINO_ICON_BUTTON_MUTE)
{ {
mute_ax = 0; y_old = -1;
mute_ay = 0;
mute_dx = 0;
mute_dy = 0;
mute_ay_old = -1;
CVolumeHelper::getInstance()->refresh(); CVolumeHelper::getInstance()->refresh();
CVolumeHelper::getInstance()->getMuteIconDimensions(&mute_ax, &mute_ay, &mute_dx, &mute_dy); CVolumeHelper::getInstance()->getMuteIconDimensions(&x, &y, &width, &height);
mIcon = new CComponentsPicture(mute_ax, mute_ay, mute_dx, mute_dy, NEUTRINO_ICON_BUTTON_MUTE);
}
CAudioMute::~CAudioMute()
{
delete mIcon;
} }
CAudioMute* CAudioMute::getInstance() CAudioMute* CAudioMute::getInstance()
@@ -68,19 +60,18 @@ void CAudioMute::AudioMute(int newValue, bool isEvent)
if( isEvent && ( neutrino->getMode() != CNeutrinoApp::mode_scart ) && ( neutrino->getMode() != CNeutrinoApp::mode_audio) && ( neutrino->getMode() != CNeutrinoApp::mode_pic)) 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); CVolumeHelper::getInstance()->getMuteIconDimensions(&x, &y, &width, &height);
if ((mIcon) && (mute_ay_old != mute_ay)) { if ((y_old != y)) {
mIcon->hide(); this->hide();
mIcon->setYPos(mute_ay); y_old = y;
mute_ay_old = mute_ay;
} }
if ((g_settings.mode_clock) && (doInit)) if ((g_settings.mode_clock) && (doInit))
CInfoClock::getInstance()->ClearDisplay(); CInfoClock::getInstance()->ClearDisplay();
if (newValue) if (newValue)
mIcon->paint(); this->paint();
else else
mIcon->hide(); this->hide();
if (doInit) if (doInit)
CVolumeHelper::getInstance()->refresh(); CVolumeHelper::getInstance()->refresh();

View File

@@ -29,17 +29,15 @@
#include <gui/components/cc.h> #include <gui/components/cc.h>
class CAudioMute class CAudioMute : public CComponentsPicture
{ {
private: private:
int mute_ay_old; int y_old;
int mute_ax, mute_ay, mute_dx, mute_dy;
CComponentsPicture *mIcon;
public: public:
CAudioMute(); CAudioMute();
~CAudioMute(); // ~CAudioMute();
static CAudioMute* getInstance(); static CAudioMute* getInstance();
void AudioMute(int newValue, bool isEvent= false); void AudioMute(int newValue, bool isEvent= false);