예제 #1
0
Settings::Settings(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::Settings)
{

    ui->setupUi(this);
    ui->txtVideoFrame->setValidator(new QIntValidator(0, 50 , this));
    ui->txtVideoFrame->setFixedWidth(30);

    ui->txtFrameToSkip->setValidator(new QIntValidator(1, 9999, this));
    ui->txtFrameToSkip->setFixedWidth(40);

    //Set the settings filename

    QSettings env(QSettings::UserScope, "Microsoft", "Windows");
    env.beginGroup("CurrentVersion/Explorer/Shell Folders");
    this->FileName = env.value("Personal").toString() + "/Human Detect and Track/settings.ini";


   // myProgSetting = new Settings(this);
    //Fill the combobox video codec

    connect(ui->btnCancel, SIGNAL(clicked()), this, SLOT(close()));
    connect(ui->btnSave, SIGNAL(clicked(bool)), this, SLOT(saveSetting(bool)));
    connect(ui->btnReset, SIGNAL(clicked()), this, SLOT(resetDefault()));
    connect(ui->btnBrowseSnap, SIGNAL(clicked()), this, SLOT(browseSnap()));
    connect(ui->btnBrowseExport, SIGNAL(clicked()), this, SLOT(browseExport()));

    //Load the application setting file
    if(QFile::exists(this->FileName)){
        initUserSetting();
    } else {
        initDefault();
    }
}
예제 #2
0
void MarginWidget::slotCustomMarginsToggled(bool b)
{
	m_bottom->setEnabled(b && !m_symetric);
	m_right->setEnabled(b && !m_symetric);
	if (!b)
		resetDefault();
}
예제 #3
0
StaticSpiritPage::StaticSpiritPage(QWidget *parent) :
    ConfigPage(parent)
{
    // life
    QGroupBox *lifeGroup = new QGroupBox(tr("Default Life Value"));
    QLabel *cheeseLifeLabel = new QLabel(tr("Cheese Life"));
    cheeseLifeEdit = new QLineEdit(g_config.getValue("StaticSpirit/Life/Cheese").toString());
    cheeseLifeEdit->setToolTip(tr("float (>0)"));
    QLabel *nailLifeLabel = new QLabel(tr("Nail Life"));
    nailLifeEdit = new QLineEdit(g_config.getValue("StaticSpirit/Life/Nail").toString());
    nailLifeEdit->setToolTip(tr("float (>0)"));

    QGridLayout *lifeLayout = new QGridLayout;
    lifeLayout->addWidget(cheeseLifeLabel, 0, 0);
    lifeLayout->addWidget(cheeseLifeEdit, 0, 1);
    lifeLayout->addWidget(nailLifeLabel, 1, 0);
    lifeLayout->addWidget(nailLifeEdit, 1, 1);
    lifeGroup->setLayout(lifeLayout);

    QPushButton *defaultButton = new QPushButton(tr("Default"));
    connect(defaultButton, SIGNAL(clicked()), this, SLOT(resetDefault()));
    QHBoxLayout *defaultLayout = new QHBoxLayout;
    defaultLayout->addWidget(defaultButton, 0, Qt::AlignRight);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addWidget(lifeGroup);
    mainLayout->addStretch(1);
    mainLayout->addLayout(defaultLayout);
    setLayout(mainLayout);
}
예제 #4
0
void
KnobGui::onResetDefaultValuesActionTriggered()
{
    QAction *action = qobject_cast<QAction *>( sender() );

    if (action) {
        resetDefault( action->data().toInt() );
    }
}
예제 #5
0
void MarginWidget::setDefaultMargins(float t, float b, float l, float r)
{
	int	dpi = m_top->resolution();
	m_default[0] = (t*dpi)/72;
	m_default[1] = (b*dpi)/72;
	m_default[2] = (l*dpi)/72;
	m_default[3] = (r*dpi)/72;
	if (!m_custom->isChecked())
		resetDefault();
}
예제 #6
0
void Options::run()
{
    StaticMenu optionsMenu(optionsStaticMenu);
    int8_t i;

    do {
        i = optionsMenu.runSimple();
        switch(i) {
        case 0: settings.edit(); break;
        case 1: Calibrate::run(); break;
        case 2: resetDefault(); break;
        }
    } while(i>=0);
}
예제 #7
0
GeneralPage::GeneralPage(QWidget *parent) :
    ConfigPage(parent)
{
    // note banner
    QLabel *noteLabel = new QLabel(tr("<i>Note:: All the changes are applied only to new created Scenes or Spirits.</i>"));

    // scene size
    QGroupBox *sizeGroup = new QGroupBox(tr("Scene Size"));
    QLabel *widthLabel = new QLabel(tr("width"));
    widthEdit = new QLineEdit(g_config.getValue("Scene/Size/Width").toString());
    widthEdit->setToolTip(tr("int (>0), unit: grid"));
    QLabel *heightLabel = new QLabel(tr("height"));
    heightEdit = new QLineEdit(g_config.getValue("Scene/Size/Height").toString());
    heightEdit->setToolTip(tr("int (>0), unit: grid"));

    QGridLayout *sizeLayout = new QGridLayout;
    sizeLayout->addWidget(widthLabel, 0, 0);
    sizeLayout->addWidget(widthEdit, 0, 1);
    sizeLayout->addWidget(heightLabel, 1, 0);
    sizeLayout->addWidget(heightEdit, 1, 1);
    sizeGroup->setLayout(sizeLayout);

    // hunt diagram
//    QGroupBox *huntGroup = new QGroupBox(tr("Hunting Diagram"));
//    HuntDia *huntDia = new HuntDia(this);

//    QVBoxLayout *huntLayout = new QVBoxLayout;
//    huntLayout->addWidget(huntDia);
//    huntGroup->setLayout(huntLayout);

    QPushButton *defaultButton = new QPushButton(tr("Default"));
    connect(defaultButton, SIGNAL(clicked()), this, SLOT(resetDefault()));
    QHBoxLayout *defaultLayout = new QHBoxLayout;
    defaultLayout->addWidget(defaultButton, 0, Qt::AlignRight);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addWidget(noteLabel);
    mainLayout->addSpacing(10);
    mainLayout->addWidget(sizeGroup);
//    mainLayout->setSpacing(10);
//    mainLayout->addWidget(huntGroup);
    mainLayout->addStretch(1);
    mainLayout->addLayout(defaultLayout);
    setLayout(mainLayout);
}
예제 #8
0
void LoggerXmlParser::parseDocument() {
	bool hadFoundClasses = false;
	bool hadFoundStyle = false;
	string aux;
	try {
		Document doc(xmlFileName);
		doc.LoadFile();

		Element* first = doc.FirstChildElement();
		first->GetValue(&aux);
#ifdef PARSER_DEBUG
		cout << "\tFirstElement=" << aux << endl;
#endif
		if (aux != "LoggerConfig") {
			throw LoggerException(
					"Error during parser xmlFile. Not found root element LoggerConfig.",
					"cpputil::Logger::LoggerXmlParser",
					"void parseDocument()");
		}

		if (first->HasAttribute("level")) {
			string value = first->GetAttribute("level");
			loggerLvl = Logger::stringToLoggerLvl(value);
#ifdef PARSER_DEBUG
			cout <<"\t\tlevel=" << value << endl;
			cout <<"\t\tlvl After been translated= " << Logger::loggerLvlToString(loggerLvl) << endl;
#endif
		}

		if (first->HasAttribute("region")) {
			string value = first->GetAttribute("region");
			regionalOpt = LoggerManager::stringToRegionalOpt(value);
#ifdef PARSER_DEBUG
			cout <<"\t\tregionalOpt= " << value << endl;
			cout <<"\t\tregionOpt After been translated= " << LoggerManager::regionalOptToString(regionalOpt) << endl;
#endif
		}

		ticpp::Iterator< ticpp::Node > child;
		child = child.begin(first);
		while (child != child.end()) {
			string name;

			if (child.Get()->Type() == TiXmlNode::COMMENT) {
				child++;
				continue;
				/* It's a comment... just ignore*/
			}
			child->GetValue(&name);
#ifdef PARSER_DEBUG
			cout <<"\n\tElement name=" << name << endl;
#endif
			if (name == "BlockedClasses" && !hadFoundClasses) {
				hadFoundClasses = true;
				Element* blockedClasses = child->ToElement();
				parseBlockedClasses(blockedClasses);

			} else if (name == "Style" && !hadFoundStyle) {
				hadFoundStyle = true;
				Element* style = child->ToElement();
				if (style->HasAttribute("name")) {
					string valeuAttName = style->GetAttribute("name");
#ifdef PARSER_DEBUG
					cout <<"\t\tStyle name=" << valeuAttName << endl;
#endif

					if (valeuAttName == "default") {
						parseDefault(style);
					} else if (valeuAttName == "networkstream") {
						parseNetworkStream(style);
					} else if (valeuAttName == "logfile") {
						this->parseLogFile(style);
					} else if (valeuAttName == "color") {
						parseColor(style);
					} else if (valeuAttName == "multilogger") {
						//TODO: Implementar o multilogger
					} else {
						throw LoggerException(
								"Error during parser xmlFile. A invalid style name specified.",
								"cpputil::Logger::LoggerXmlParser",
								"void parseDocument()");
					}
				} else {
					throw LoggerException(
							"Error during parser xmlFile. Name attbribute was no specified in Style.",
							"cpputil::Logger::LoggerXmlParser",
							"void parseDocument()");
				}
			} else {
				throw LoggerException(
						"Error during parser xmlFile. A invalid or duplicated element was found.",
						"cpputil::Logger::LoggerXmlParser",
						"void parseDocument()");
			}
			child++;
		}

	} catch (ticpp::Exception& ex) {
		cerr << ex.what() << endl;
		resetDefault();
		throw ex;
	}
}
예제 #9
0
AvatarSpiritPage::AvatarSpiritPage(QWidget *parent) :
    ConfigPage(parent)
{
    // life
    QGroupBox *lifeGroup = new QGroupBox(tr("Default Life Value"));
    QLabel *mouseLifeLabel = new QLabel(tr("Mouse Life"));
    mouseLifeEdit = new QLineEdit(g_config.getValue("AvatarSpirit/Life/Mouse").toString());
    mouseLifeEdit->setToolTip(tr("float (>0)"));
    QLabel *catLifeLabel = new QLabel(tr("Cat Life"));
    catLifeEdit = new QLineEdit(g_config.getValue("AvatarSpirit/Life/Cat").toString());
    catLifeEdit->setToolTip(tr("float (>0)"));
    QLabel *elephantLifeLabel = new QLabel(tr("Elephant Life"));
    elephantLifeEdit = new QLineEdit(g_config.getValue("AvatarSpirit/Life/Elephant").toString());
    elephantLifeEdit->setToolTip(tr("float (>0)"));

    QGridLayout *lifeLayout = new QGridLayout;
    lifeLayout->addWidget(mouseLifeLabel, 0, 0);
    lifeLayout->addWidget(mouseLifeEdit, 0, 1);
    lifeLayout->addWidget(catLifeLabel, 1, 0);
    lifeLayout->addWidget(catLifeEdit, 1, 1);
    lifeLayout->addWidget(elephantLifeLabel, 2, 0);
    lifeLayout->addWidget(elephantLifeEdit, 2, 1);
    lifeGroup->setLayout(lifeLayout);

    // sharing
    QGroupBox *shareGroup = new QGroupBox(tr("Default Sharing Params"));
    QLabel *rangeLabel = new QLabel(tr("Share Range"));
    rangeEdit = new QLineEdit(g_config.getValue("AvatarSpirit/ShareParams/ShareRange").toString());
    rangeEdit->setToolTip(tr("int (>=0, 0 to turn off sharing)"));
    QLabel *freqLabel = new QLabel(tr("Share Freq"));
    freqEdit = new QLineEdit(g_config.getValue("AvatarSpirit/ShareParams/ShareFreq").toString());
    freqEdit->setToolTip(tr("int (>0)"));

    QGridLayout *shareLayout = new QGridLayout;
    shareLayout->addWidget(rangeLabel, 0, 0);
    shareLayout->addWidget(rangeEdit, 0, 1);
    shareLayout->addWidget(freqLabel, 1, 0);
    shareLayout->addWidget(freqEdit, 1, 1);
    shareGroup->setLayout(shareLayout);

    // gamcs params
    QGroupBox *paramsGroup = new QGroupBox(tr("Default GAMCS Parameters"));
    QLabel *drLabel = new QLabel(tr("Discount Rate"));
    drEdit = new QLineEdit(g_config.getValue("AvatarSpirit/GAMCSParams/DiscountRate").toString());
    drEdit->setToolTip(tr("float (>=0, <1)"));
    QLabel *acuLabel = new QLabel(tr("Accuracy"));
    acuEdit = new QLineEdit(g_config.getValue("AvatarSpirit/GAMCSParams/Accuracy").toString());
    acuEdit->setToolTip(tr("float (>=0)"));
    QLabel *lmLabel = new QLabel(tr("Learning Mode"));
    lmCombo = new QComboBox;
    lmCombo->addItem(tr("Online"));
    lmCombo->addItem(tr("Explore"));
    if (g_config.getValue("AvatarSpirit/GAMCSParams/LearningMode").toString() == "Explore")
        lmCombo->setCurrentIndex(1);
    else	// online is the default
        lmCombo->setCurrentIndex(0);

    QGridLayout *paramsLayout = new QGridLayout;
    paramsLayout->addWidget(drLabel, 0, 0);
    paramsLayout->addWidget(drEdit, 0, 1);
    paramsLayout->addWidget(acuLabel, 1, 0);
    paramsLayout->addWidget(acuEdit, 1, 1);
    paramsLayout->addWidget(lmLabel, 2, 0);
    paramsLayout->addWidget(lmCombo, 2, 1);
    paramsGroup->setLayout(paramsLayout);

    QPushButton *defaultButton = new QPushButton(tr("Default"));
    connect(defaultButton, SIGNAL(clicked()), this, SLOT(resetDefault()));
    QHBoxLayout *defaultLayout = new QHBoxLayout;
    defaultLayout->addWidget(defaultButton, 0, Qt::AlignRight);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addWidget(lifeGroup);
    mainLayout->addSpacing(10);
    mainLayout->addWidget(shareGroup);
    mainLayout->addSpacing(10);
    mainLayout->addWidget(paramsGroup);
    mainLayout->addStretch(1);
    mainLayout->addLayout(defaultLayout);
    setLayout(mainLayout);
}