<commit_before>#include "profilecontainer.h"
#include "profilebuttons.h"
#include "profiletranslation.h"

#include <DuiButton>
#include <DuiSlider>
#include <DuiLabel>
#include <DuiLayout>
#include <DuiImage>
#include <DuiGridLayoutPolicy>
#include <DuiStylableWidget>
#include <QDebug>

namespace ProfileApplet{
    const int sliderMin = 0;
    const int sliderMax = 100;
}

ProfileContainer::ProfileContainer(int id, const QString &title, DuiWidget *parent) :
    DuiContainer(title, parent),
    slider(NULL),
    level(-2),
    profileId(id)
{
    qDebug() << "ProfileContainer::ProfileContainer()" << title;

    // TODO: hardcoded silent value!!
    if(profileId != 1) {
        slider = new DuiSlider(this, "continuous");
        slider->setOrientation(Qt::Horizontal);
        slider->setRange(ProfileApplet::sliderMin, ProfileApplet::sliderMax);
        slider->setThumbLabelVisible(false);
        connect(slider, SIGNAL(valueChanged(int)), this, SIGNAL(sliderValueChanged(int)));
    }

    button = new DuiButton(DcpProfile::VibrationText, this);
    button->setCheckable(true);
    button->setMaximumHeight(36);
    setVibration(true);
    connect(button, SIGNAL(toggled(bool)), this, SIGNAL(vibrationChanged(bool)));

    setLayout();
}

ProfileContainer::~ProfileContainer()
{
}

void ProfileContainer::setLayout()
{
    DuiLayout *layout = new DuiLayout();

    DuiGridLayoutPolicy *landscapePolicy = new DuiGridLayoutPolicy(layout);
    //landscapePolicy->setObjectName("profileContainerLayout.Landscape");
    layout->setLandscapePolicy(landscapePolicy); // ownership transferred

    DuiGridLayoutPolicy *portraitPolicy = new DuiGridLayoutPolicy(layout);
    //portraitPolicy->setObjectName("profileContainerLayout.Portrait");
    layout->setPortraitPolicy(portraitPolicy); // ownership transferred


    DuiImage* img = NULL;
    QGraphicsLayoutItem* item = NULL;

    if(slider)
    {
        img = new DuiImage("icon-m-volume-off", this);
        item = slider;
        qDebug() << "slider height" << slider->size().height();
        slider->setMaximumHeight(32);
    }
    else
    {
        img = new DuiImage("icon-m-volume", this);
        item = new DuiLabel(DcpProfile::NoRingingText, this);
    }
    img->setObjectName("speakerIcon");

    landscapePolicy->setColumnFixedWidth(0, img->imageSize().width());
    portraitPolicy->setColumnFixedWidth(0, img->imageSize().width());
    landscapePolicy->setRowFixedHeight(0, img->imageSize().height());<commit_msg>Icons switched to correct places<commit_after>#include "profilecontainer.h"
#include "profilebuttons.h"
#include "profiletranslation.h"

#include <DuiButton>
#include <DuiSlider>
#include <DuiLabel>
#include <DuiLayout>
#include <DuiImage>
#include <DuiGridLayoutPolicy>
#include <DuiStylableWidget>
#include <QDebug>

namespace ProfileApplet{
    const int sliderMin = 0;
    const int sliderMax = 100;
}

ProfileContainer::ProfileContainer(int id, const QString &title, DuiWidget *parent) :
    DuiContainer(title, parent),
    slider(NULL),
    level(-2),
    profileId(id)
{
    qDebug() << "ProfileContainer::ProfileContainer()" << title;

    // TODO: hardcoded silent value!!
    if(profileId != 1) {
        slider = new DuiSlider(this, "continuous");
        slider->setOrientation(Qt::Horizontal);
        slider->setRange(ProfileApplet::sliderMin, ProfileApplet::sliderMax);
        slider->setThumbLabelVisible(false);
        connect(slider, SIGNAL(valueChanged(int)), this, SIGNAL(sliderValueChanged(int)));
    }

    button = new DuiButton(DcpProfile::VibrationText, this);
    button->setCheckable(true);
    button->setMaximumHeight(36);
    setVibration(true);
    connect(button, SIGNAL(toggled(bool)), this, SIGNAL(vibrationChanged(bool)));

    setLayout();
}

ProfileContainer::~ProfileContainer()
{
}

void ProfileContainer::setLayout()
{
    DuiLayout *layout = new DuiLayout();

    DuiGridLayoutPolicy *landscapePolicy = new DuiGridLayoutPolicy(layout);
    //landscapePolicy->setObjectName("profileContainerLayout.Landscape");
    layout->setLandscapePolicy(landscapePolicy); // ownership transferred

    DuiGridLayoutPolicy *portraitPolicy = new DuiGridLayoutPolicy(layout);
    //portraitPolicy->setObjectName("profileContainerLayout.Portrait");
    layout->setPortraitPolicy(portraitPolicy); // ownership transferred


    DuiImage* img = NULL;
    QGraphicsLayoutItem* item = NULL;

    if(slider)
    {
        img = new DuiImage("icon-m-volume", this);
        item = slider;
        qDebug() << "slider height" << slider->size().height();
        slider->setMaximumHeight(32);
    }
    else
    {
        img = new DuiImage("icon-m-volume-off", this);
        item = new DuiLabel(DcpProfile::NoRingingText, this);
    }
    img->setObjectName("speakerIcon");

    landscapePolicy->setColumnFixedWidth(0, img->imageSize().width());
    portraitPolicy->setColumnFixedWidth(0, img->imageSize().width());
    landscapePolicy->setRowFixedHeight(0, img->imageSize().height());
{'fraction_non_alphanumeric': 0.13653653653653652, 'fraction_numerical': 0.005205205205205205, 'mean_word_length': 4.496149614961496, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 55, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7467522', 'n_tokens_mistral': 1542, 'n_tokens_neox': 1481, 'n_words': 271}