<commit_before>/* -*- Mode: C; indent-tabs-mode: s; c-basic-offset: 4; tab-width: 4 -*- */
/* vim:set et ai sw=4 ts=4 sts=4: tw=80 cino="(0,W2s,i2s,t0,l1,:0" */
#include "batterywidget.h"
#include "batteryimage.h"
#include "batterybusinesslogic.h"
#include "dcpbattery.h"
#include "slidercontainer.h"
#include "timecontainer.h"

#include <QGraphicsLinearLayout>
#include <QTimer>

#include <MButton>
#include <MContainer>
#include <MGridLayoutPolicy>
#include <MLayout>
#include <MLinearLayoutPolicy>

#define DEBUG
#include "../debug.h"

BatteryWidget::BatteryWidget (QGraphicsWidget *parent) :
        DcpWidget (parent),
        m_logic (0),
        m_UILocked (false),
        batteryImage (0),
        PSMButton (0),
        m_MainLayout (0),
        sliderContainer (0),
        standByTimeContainer (0),
        talkTimeContainer (0)
{
    SYS_DEBUG ("Starting in %p", this);
    /*
     * One can assume, that when the applet is started the power save mode is
     * not active. This way we show a value that makes sense even if the DBus
     * interface to the sysuid is not usable.
     */
    m_PSMButtonToggle = false;

    initWidget ();
}

BatteryWidget::~BatteryWidget ()
{
    SYS_DEBUG ("Destroying %p", this);

    if (m_logic)
    {
        delete m_logic;
        m_logic = 0;
    }
}

bool BatteryWidget::back ()
{
    return true; // back is handled by main window by default
}

void BatteryWidget::initWidget ()
{
    SYS_DEBUG ("Start");
    // instantiate the batterybusinesslogic
    m_logic = new BatteryBusinessLogic;

    // battery image
    batteryImage = new BatteryImage;

    // talkTimeContainer
    //% "Estimated talk time:"
    talkTimeContainer = new TimeContainer (
            qtTrId ("qtn_ener_tt"), batteryImage);

    // standByTimeContainer
    //% "Estimated stand-by time:"
    standByTimeContainer = new TimeContainer (
            qtTrId ("qtn_ener_st"), new MImageWidget);
                                  //"qgn_ener_standby" ^

    /*
     * PSMButton is used to immediately turn the power save mode on/off.
     */
    PSMButton = new MButton;
    updatePSMButton ();

    connect (PSMButton, SIGNAL (released ()),
             this, SLOT (PSMButtonReleased ()));

    // sliderContainer<commit_msg>Changes: a testability fix...<commit_after>/* -*- Mode: C; indent-tabs-mode: s; c-basic-offset: 4; tab-width: 4 -*- */
/* vim:set et ai sw=4 ts=4 sts=4: tw=80 cino="(0,W2s,i2s,t0,l1,:0" */
#include "batterywidget.h"
#include "batteryimage.h"
#include "batterybusinesslogic.h"
#include "dcpbattery.h"
#include "slidercontainer.h"
#include "timecontainer.h"

#include <QGraphicsLinearLayout>
#include <QTimer>

#include <MButton>
#include <MContainer>
#include <MGridLayoutPolicy>
#include <MLayout>
#include <MLinearLayoutPolicy>

#define DEBUG
#include "../debug.h"

BatteryWidget::BatteryWidget (QGraphicsWidget *parent) :
        DcpWidget (parent),
        m_logic (0),
        m_UILocked (false),
        batteryImage (0),
        PSMButton (0),
        m_MainLayout (0),
        sliderContainer (0),
        standByTimeContainer (0),
        talkTimeContainer (0)
{
    SYS_DEBUG ("Starting in %p", this);
    /*
     * One can assume, that when the applet is started the power save mode is
     * not active. This way we show a value that makes sense even if the DBus
     * interface to the sysuid is not usable.
     */
    m_PSMButtonToggle = false;

    initWidget ();
}

BatteryWidget::~BatteryWidget ()
{
    SYS_DEBUG ("Destroying %p", this);

    if (m_logic)
    {
        delete m_logic;
        m_logic = 0;
    }
}

bool BatteryWidget::back ()
{
    return true; // back is handled by main window by default
}

void BatteryWidget::initWidget ()
{
    SYS_DEBUG ("Start");
    // instantiate the batterybusinesslogic
    m_logic = new BatteryBusinessLogic;

    // battery image
    batteryImage = new BatteryImage;

    // talkTimeContainer
    //% "Estimated talk time:"
    talkTimeContainer = new TimeContainer (
            qtTrId ("qtn_ener_tt"), batteryImage);

    // standByTimeContainer
    //% "Estimated stand-by time:"
    standByTimeContainer = new TimeContainer (
            qtTrId ("qtn_ener_st"), new MImageWidget);
                                  //"qgn_ener_standby" ^

    /*
     * PSMButton is used to immediately turn the power save mode on/off.
     */
    PSMButton = new MButton;
    PSMButton->setObjectName ("PSMButton");
    updatePSMButton ();

    connect (PSMButton, SIGNAL (released ()),
             this, SLOT (PSMButtonReleased ()));

    // sliderContainer
{'fraction_non_alphanumeric': 0.12067455102934735, 'fraction_numerical': 0.009198423127463863, 'mean_word_length': 2.786898839137645, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2346655', 'n_tokens_mistral': 1517, 'n_tokens_neox': 1446, 'n_words': 394}