/***************************************************************************
 *   Copyright (C) 2008 by Manuel Schrape                                  *
 *   manuel.schrape@gmx.de                                                 *
 *                                                                         *
 *   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.        *
 *                                                                         *
 *   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.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#include "dlg_Config.h"

dlg_Config::dlg_Config(QWidget *parent) : QDialog(parent)
{
    setupUi(this);

    cb_Plot[0]  = cb_Plot_0;
    cb_Plot[1]  = cb_Plot_1;
    cb_Plot[2]  = cb_Plot_2;
    cb_Plot[3]  = cb_Plot_3;
    cb_Plot[4]  = cb_Plot_4;
    cb_Plot[5]  = cb_Plot_5;
    cb_Plot[6]  = cb_Plot_6;
    cb_Plot[7]  = cb_Plot_7;
    cb_Plot[8]  = cb_Plot_8;
    cb_Plot[9]  = cb_Plot_9;
    cb_Plot[10] = cb_Plot_10;
    cb_Plot[11] = cb_Plot_11;
    cb_Plot[12] = cb_Plot_12;
    cb_Plot[13] = cb_Plot_13;
    cb_Plot[14] = cb_Plot_14;
    cb_Plot[15] = cb_Plot_15;
    cb_Plot[16] = cb_Plot_16;
    cb_Plot[17] = cb_Plot_17;
    cb_Plot[18] = cb_Plot_18;
    cb_Plot[19] = cb_Plot_19;
    cb_Plot[20] = cb_Plot_20;
    cb_Plot[21] = cb_Plot_21;
    cb_Plot[22] = cb_Plot_22;
    cb_Plot[23] = cb_Plot_23;
    cb_Plot[24] = cb_Plot_24;
    cb_Plot[25] = cb_Plot_25;
    cb_Plot[26] = cb_Plot_26;
    cb_Plot[27] = cb_Plot_27;
    cb_Plot[28] = cb_Plot_28;
    cb_Plot[29] = cb_Plot_29;
    cb_Plot[30] = cb_Plot_30;
    cb_Plot[31] = cb_Plot_31;

    cb_Log[0]  = cb_Log_0;
    cb_Log[1]  = cb_Log_1;
    cb_Log[2]  = cb_Log_2;
    cb_Log[3]  = cb_Log_3;
    cb_Log[4]  = cb_Log_4;
    cb_Log[5]  = cb_Log_5;
    cb_Log[6]  = cb_Log_6;
    cb_Log[7]  = cb_Log_7;
    cb_Log[8]  = cb_Log_8;
    cb_Log[9]  = cb_Log_9;
    cb_Log[10] = cb_Log_10;
    cb_Log[11] = cb_Log_11;
    cb_Log[12] = cb_Log_12;
    cb_Log[13] = cb_Log_13;
    cb_Log[14] = cb_Log_14;
    cb_Log[15] = cb_Log_15;
    cb_Log[16] = cb_Log_16;
    cb_Log[17] = cb_Log_17;
    cb_Log[18] = cb_Log_18;
    cb_Log[19] = cb_Log_19;
    cb_Log[20] = cb_Log_20;
    cb_Log[21] = cb_Log_21;
    cb_Log[22] = cb_Log_22;
    cb_Log[23] = cb_Log_23;
    cb_Log[24] = cb_Log_24;
    cb_Log[25] = cb_Log_25;
    cb_Log[26] = cb_Log_26;
    cb_Log[27] = cb_Log_27;
    cb_Log[28] = cb_Log_28;
    cb_Log[29] = cb_Log_29;
    cb_Log[30] = cb_Log_30;
    cb_Log[31] = cb_Log_31;

}

void dlg_Config::set_Settings(cSettings *Set, int ID)
{
    Settings = Set;

    lb_Hardware->setText(HardwareType[ID]);

    for (int a = 0; a < MaxAnalog; a++)
    {
        cb_Plot[a]->setText(Settings->Analog1.Label[a]);
        cb_Plot[a]->setChecked(Settings->Analog1.PlotView[a]);
        cb_Log[a]->setText(Settings->Analog1.Label[a]);
        cb_Log[a]->setChecked(Settings->Analog1.LogView[a]);
    }
}

cSettings *dlg_Config::get_Settings()
{
    for (int a = 0; a < MaxAnalog; a++)
    {
        Settings->Analog1.PlotView.setBit(a,cb_Plot[a]->isChecked());
    }

    for (int a = 0; a < MaxAnalog; a++)
    {
        Settings->Analog1.LogView.setBit(a,cb_Log[a]->isChecked());
    }

    return Settings;
}

dlg_Config::~dlg_Config()
{
}


