Newer
Older
CasicIrisIdentify / utils / SettingConfig.cpp
#include "SettingConfig.h"
#include <QApplication>

SettingConfig::SettingConfig()
{
    filename = QApplication::applicationDirPath() + "/conf/config.ini";
    setting = new QSettings(this->filename, QSettings::IniFormat);

    WINDOW_WIDTH = getProperty("window", "width").toInt();
    WINDOW_HEIGHT = getProperty("window", "height").toInt();
    WINDOW_BACKGROUND_COLOR = getProperty("window", "backgroundColor").toString();
    WINDOW_TITLE = getProperty("window", "title").toString();
    WINDOW_RIGHTS = getProperty("window", "copyright").toString();
    WINDOW_VERSION = getProperty("window", "version").toString();
    DEVICE_CODE = getProperty("window", "deviceCode").toString();

    IRIS_FRAME_WIDTH = getProperty("camera", "irisFrameWidth").toInt();
    IRIS_FRAME_HEIGHT = getProperty("camera", "irisFrameHeight").toInt();
    IRIS_WIDTH = getProperty("camera", "irisWidth").toInt();
    IRIS_HEIGHT = getProperty("camera", "irisHeight").toInt();
    IRIS_FRAME_INTERVAL = getProperty("camera", "irisFrameInterval").toInt();
    IRIS_DISPLAY_WIDTH = getProperty("camera", "irisDisplayWidth").toInt();
    IRIS_DISPLAY_HEIGHT = getProperty("camera", "irisDisplayHeight").toInt();
    LOCK_FRAME_INTERVAL = getProperty("camera", "lockFrameInterval").toInt();

    MAX_MATCH_TIME = getProperty("recognize", "maxMatchTime").toInt();
    SUCCESS_TIPS_LAST = getProperty("recognize", "successTipsLast").toInt();
    FAILURE_TIPS_LAST = getProperty("recognize", "failureTipsLast").toInt();
    MAX_FACE_TRY_COUNT = getProperty("recognize", "maxFaceTryCount").toInt();
    MAX_FACE_NOT_FOUND_COUNT = getProperty("recognize", "maxFaceNotFoundCount").toInt();
    MAX_IRIS_TRY_COUNT = getProperty("recognize", "maxIrisTryCount").toInt();
    MAX_EYE_NOT_FOUND_COUNT = getProperty("recognize", "maxEyeNotFoundCount").toInt();
    MIN_EYE_SIZE = getProperty("recognize", "minEyeSize").toInt();

    LOG_FILE = getProperty("log", "logFile").toString();
    LOG_LEVEL = getProperty("log", "logLevel").toString();

    DEBUG_CAMERA_ROTATE = getProperty("debug", "cameraRotate").toString();
    DEBUG_SEGMENT_IP = getProperty("debug", "segmentIp").toString();
    DEBUG_SAVE_IMAGE = getProperty("debug", "saveImage").toBool();
    DEBUG_IMAGE_BASE_PATH = getProperty("debug", "imageBasePath").toString();
}


QVariant SettingConfig::getProperty(QString nodeName, QString keyName) {
    QVariant var = this->setting->value(QString("/%1/%2").arg(nodeName).arg(keyName));
    return var;
}