void ConfigTreeObject_Math::slotMathFirst_chanSelectchanged()
{
    QString chanNumF;
    QString chanNumL;
    ConfigObject *pObj = ConfigTreeObject::getConfigObject(MATH_DELEGATE_FIRSTCHAN);
    ConfigObject *qObj = ConfigTreeObject::getConfigObject(MATH_DELEGATE_LASTCHAN);

    if(pObj && qObj){
        chanNumF = pObj->getData().toString();
        chanNumL = qObj->getData().toString();

        pObj->setStrShowOn(chanNumF);
        qObj->changeData(chanNumF, false);
    }
}
void ConfigTreeObject_EventAction::slotEventAction_GrpNumchanged()
{
    ConfigObject *pObj = ConfigTreeObject::getConfigObject(EVENT_DELEGATE_GRPNUM);
    if(pObj) {
        quint32 groupNum = pObj->getData().toUInt();
        pObj->setStrShowOn(QString("%1").arg(groupNum+1));
    }
}
void ConfigTreeObject_Math::slotMathConstantKItemChanged()
{
    Menu *menu = static_cast<Menu *>(this->sender());
    QString strName = menu->objectName();
    ConfigObject *pConfigObj = ConfigTreeObject::getConfigObject(QString(MATH_DELEGATE_CONSTANTNUM_X).arg(strName));
    QString valueStr = pConfigObj->getData().toString().toUpper();
    pConfigObj->setStrShowOn(valueStr);
}
void ConfigTreeObject_Math::updateAllConstKInfoMenu()
{
    ConfigObject *pConfigObj;
    QString valueStr;
    for(int i=0;i<100;++i) {
        pConfigObj = ConfigTreeObject::getConfigObject(QString(MATH_DELEGATE_CONSTANTNUM_INDEX).arg(i+1, 3, 10, QChar('0')));
        valueStr = pConfigObj->getData().toString().toUpper();
        pConfigObj->setStrShowOn(valueStr);
    }
}
void ConfigTreeObject_Report::slotReportChannelNumberChange()
{
    QString num;
    ConfigObject *pObj = ConfigTreeObject::getConfigObject(Config_Report_Delegate_ReportChannnel_Number);

    if(pObj){
        num = pObj->getData().toString();
        pObj->setStrShowOn(QString("%1").arg(num.toInt()+1));
    }
}
void ConfigTreeObject_Math::slotMathLast_chanSelectchanged()
{
    QString chanNumF;
    QString chanNumL;
    ConfigObject *pObj = ConfigTreeObject::getConfigObject(MATH_DELEGATE_FIRSTCHAN);
    ConfigObject *qObj = ConfigTreeObject::getConfigObject(MATH_DELEGATE_LASTCHAN);

    if(pObj && qObj){
        chanNumL = qObj->getData().toString();
        chanNumF = pObj->getData().toString();
        int value = QString::compare(chanNumF, chanNumL);
        if(value <= 0) {
            qObj->setStrShowOn(chanNumL);
        }
        else{
            qObj->setStrShowOn(chanNumL);
            pObj->changeData(chanNumL ,false);
        }
    }
}
void ConfigTreeObject_EventAction::slotEventAction_A_Typechanged()
{
    QFile file;
    Operation_Mode_Type mode = (Operation_Mode_Type)ConfigTreeObject \
            ::getConfigObject(EVENT_DELEGATE_EVENT_MODE)->getData().toUInt();

    switch(mode) {
    case Operation_Mode_Type_RisingEdge:
    case Operation_Mode_Type_FallingEdge:
    case Operation_Mode_Type_Edge:
        file.setFileName(XML_EVENT_ACTION_TYPE);
        break;
    case Operation_Mode_Type_Both:
        file.setFileName(XML_EVENT_ACTION_TYPE_C);
        break;
    }

    QVariant value = ConfigTreeObject::getConfigObject(EVENT_DELEGATE_ACTION_TYPE)->getData();

    if(!file.open(QFile::ReadOnly | QFile::Text)){
        qWarning()<< "Can't open the file:EventAction_ActionType!";
    }else{
        XmlConfigParser::parseValueChangeXml(file, value);
        file.close();
    }

    QMap<quint32,QString> m_map;

    Action_Type valueCur = (Action_Type)value.toUInt();
    if(Action_Type1_Recorded == valueCur) {
        m_map.insert(Action_Detail_Start, tr("Start"));
        m_map.insert(Action_Detail_Stop, tr("Stop"));
    } else if (Action_Type1_Computation == valueCur) {
        m_map.insert(Action_Detail_Start, tr("Start"));
        m_map.insert(Action_Detail_Stop, tr("Stop"));
        m_map.insert(Action_Detail_Reset, tr("Reset"));
    } else if (Action_Type1_Message == valueCur) {
        m_map.insert(Action_Detail_AllGrp, tr("All groups"));
        m_map.insert(Action_Detail_SpecGrp, tr("Specified group"));
    } else {
        return;
    }

    ConfigObject* pObj = ConfigTreeObject::getConfigObject(EVENT_DELEGATE_ACTION_DETAIL);
    if(pObj) {
        Action_Detail detailCur = (Action_Detail)pObj->getData().toUInt();
        if(!(m_map.contains(detailCur))) {
            pObj->changeData(m_map.firstKey(), false);
        }
    }

}
void ConfigTreeObject_Report::slotReportBasicTimeMinuteChange()
{
    QString num;

    ConfigObject *pObj = ConfigTreeObject::getConfigObject(Config_Report_Delegate_Basic_Time_Minute);


    if(pObj){
        num = pObj->getData().toString();

        pObj->setStrShowOn(QString("%1").arg(num.toInt()));
    }
}
void ConfigTreeObject_Math::resetPartialSettings()
{
    ConfigObject* pObj = ConfigTreeObject::getConfigObject(DISP_DELEGATE_TREND_PARTIAL_SWITCH);
    if(pObj) {
        QVariant valueSwitch = pObj->getData();
        if(valueSwitch.toUInt() == 1) {
            ConfigTreeObject::getConfigObject(MATH_DELEGATE_DISP_PART)->setHideFlag(false);
            ConfigTreeObject::getConfigObject(MATH_DELEGATE_DISP_PART_ONOFF)->setHideFlag(false);
            ConfigTreeObject::getConfigObject(MATH_DELEGATE_DISP_PART_ONOFF)->changeData(0, false, false);
            ConfigTreeObject::getConfigObject(MATH_DELEGATE_DISP_PART_BOUND)->setHideFlag(true);
            ConfigTreeObject::getConfigObject(MATH_DELEGATE_DISP_PART_EXPAND)->setHideFlag(true);
        }
    }
}
Exemple #10
0
void WinDIAlarmLvl1Type::initMenu()
{
    m_map.clear();

    ConfigObject* pObj = ConfigTreeObject::getConfigObject(DI_DELEGATE_RANG_RANGE_CALCU);
    if(pObj) {
        DI_Range_Calculate calcu = (DI_Range_Calculate)pObj->getData().toUInt();
        if(calcu == DI_Range_Calculate_Delta) {
            m_map = m_map_AlarmLvl1Type_Delta;
        } else {
            m_map = m_map_AlarmLvl1Type;
        }
    }

    slotResetMenus();
}
Exemple #11
0
void WinDIRangeRangeType::initMenu()
{
    m_map.clear();
    //此处有问题,只有一个模块能被设置为远程输入 TODO
    ConfigObject* pObj = ConfigTreeObject::getConfigObject(MEASURE_DELEGATE_U_M_DIMODE_MODE);
    if(pObj) {
        DI_OpeMode mode = (DI_OpeMode)pObj->getData().toUInt();

        if(DI_OpeMode_Remote == mode) {
            m_map = m_map_RangeRangeType_noPluse;
        } else {
            m_map = m_map_RangeRangeType;
        }
    }

    slotResetMenus();
}
Exemple #12
0
void WinDIRangeCalculation::initMenu()
{
    m_map.clear();

    ConfigObject* pObj = ConfigTreeObject::getConfigObject(DI_DELEGATE_RANG_RANGE_TYPE);
    if(pObj) {
        DI_Range_Type type = (DI_Range_Type)pObj->getData().toUInt();

        if(DI_Range_Type_Disabled == type) {

        } else if(DI_Range_Type_Pluse == type) {
            m_map = m_map_RangeCalcu_off;
        } else {
            m_map = m_map_RangeCalcu;
        }
    }

    slotResetMenus();
}
Exemple #13
0
void WinDispTrendTrendIntervalSecond::initMenu()
{
    m_map.clear();

    //不同测量周期会影响趋势周期备选项的最小值
    ConfigObject* pObj = ConfigTreeObject::getConfigObject(MEASURE_DELEGATE_INTERVAL_INTERVAL);
    Measure_Interval testPeriod;
    if(pObj) {
        testPeriod = (Measure_Interval)pObj->getData().toUInt();
        switch(testPeriod) {
        case Measure_Interval_100ms:
            m_map = m_map_TrendTrendInterval_5s;
            break;
        case Measure_Interval_200ms:
            m_map = m_map_TrendTrendInterval_10s;
            break;
        case Measure_Interval_500ms:
            m_map = m_map_TrendTrendInterval_15s;
            break;
        case Measure_Interval_1s:
            m_map = m_map_TrendTrendInterval_30s;
            break;
        case Measure_Interval_2s:
            m_map = m_map_TrendTrendInterval_1min;
            break;
        case Measure_Interval_5s:
            m_map = m_map_TrendTrendInterval_5min;
            break;
        }
    }

    quint32 trendTimeDiv;
    Record_Mode Recmode;
    quint8 sw;
    quint8 countDIV;
    ConfigObject* qObj = ConfigTreeObject::getConfigObject(RECORD_DELEGATE_BASIC_MODE_VALUE);
    ConfigObject* rObj = ConfigTreeObject::getConfigObject(DISP_DELEGATE_TREND_INTERVAL_SWITCH);
    if(qObj && rObj) {
        Recmode = (Record_Mode)qObj->getData().toUInt();
        sw = rObj->getData().toUInt();

        if ((Record_Mode_Event == Recmode) && (sw == 0)) {
            //Do nothing 事件记录模式时,参考事件记录周期与趋势周期关系表,与配置无关,内定
        } else {
            Trend_Interval first = (Trend_Interval)ConfigTreeObject::\
                    getConfigObject(DISP_DELEGATE_TREND_INTERVAL_INTERVAL)->getData().toUInt();
            Trend_Interval backup;

            for(quint8 i=0;i<m_map.size();++i) {
                backup = (Trend_Interval)m_map.keys().at(i);
                if (1 == sw) {
                    trendTimeDiv = qMin(first, backup);
                } else {
                    trendTimeDiv = first;
                }

                countDIV = trendTimeDiv>Trend_Interval_10s ? 30 : 50;
                quint32 x = trendTimeDiv * 1000;
                quint32 y = countDIV * testPeriod;
                if(x%y != 0) {
                    m_map.remove((quint32)backup);
                }
            }
        }
    }

    slotResetMenus();
}
void ConfigTreeObject_EventAction::slotEventAction_E_Typechanged()
{
    QVariant value = ConfigTreeObject::getConfigObject(EVENT_DELEGATE_EVENT_TYPE)->getData();

    QFile file(XML_EVENT_EVENT_TYPE);
    if(!file.open(QFile::ReadOnly | QFile::Text)){
        qWarning()<< "Can't open the file:EventAction_EventType!";
    }else{
        XmlConfigParser::parseValueChangeXml(file, value);
        file.close();
    }

    QMap<quint32,QString> m_map_EventMode;
    m_map_EventMode.insert(Operation_Mode_Type_RisingEdge, tr("Rising edge"));
    m_map_EventMode.insert(Operation_Mode_Type_FallingEdge, tr("Falling edge"));
    m_map_EventMode.insert(Operation_Mode_Type_Both, tr("Rising / Falling edge"));
    m_map_EventMode.insert(Operation_Mode_Type_Edge, tr("Edge"));

    Event_Type valueCur = (Event_Type)value.toUInt();
    if ((Event_Type_Timer == valueCur) || (Event_Type_Timer_Match == valueCur)
            || (Event_Type_UserFunc == valueCur)) {
        m_map_EventMode.remove(Operation_Mode_Type_RisingEdge);
        m_map_EventMode.remove(Operation_Mode_Type_FallingEdge);
        m_map_EventMode.remove(Operation_Mode_Type_Both);
    } else {
        m_map_EventMode.remove(Operation_Mode_Type_Edge);
    }

    ConfigObject* pObj = ConfigTreeObject::getConfigObject(EVENT_DELEGATE_EVENT_MODE);
    if(pObj) {
        Operation_Mode_Type modeCur = (Operation_Mode_Type)pObj->getData().toUInt();
        if(!(m_map_EventMode.contains(modeCur))) {
            pObj->changeData(m_map_EventMode.firstKey(), false);
        }
    }

    ConfigObject* qObj = ConfigTreeObject::getConfigObject(EVENT_DELEGATE_EVENT_NUMBER);
    if(qObj) {
        switch(valueCur) {
        case Event_Type_InterSwitch:
        case Event_Type_Timer:
        case Event_Type_Timer_Match:
        case Event_Type_UserFunc:
            qObj->changeData(1, false);
            break;
        case Event_Type_Remote://need to modify TODO
            qObj->changeData(CfgChannel::instance()->getExistChannelDI().first(), false);
            break;
        case Event_Type_Relay:
            qObj->changeData(CfgChannel::instance()->getExistChannelDO().first(), false);
            break;
        case Event_Type_Alarm_IO:
            qObj->changeData(CfgChannel::instance()->getExistChannel().first(), false);
            break;
        case Event_Type_Alarm_Math:
            qObj->changeData(CfgChannel::instance()->getExistChannelMath().first(), false);
            break;
        case Event_Type_Alarm_Comm:
            qObj->changeData(CfgChannel::instance()->getExistChannelComm().first(), false);
            break;
        case Event_Type_Alarm_All:
        case Event_Type_Status:
            break;
        default:
            break;
        }
    }
}