Ejemplo n.º 1
0
void LLPanelPickInfo::onOpen(const LLSD& key)
{
	LLUUID avatar_id = key["avatar_id"];
	if(avatar_id.isNull())
	{
		return;
	}

	if(getAvatarId().notNull())
	{
		LLAvatarPropertiesProcessor::getInstance()->removeObserver(
			getAvatarId(), this);
	}

	setAvatarId(avatar_id);

	resetData();
	resetControls();

	setPickId(key["pick_id"]);
	setPickName(key["pick_name"]);
	setPickDesc(key["pick_desc"]);
	setSnapshotId(key["snapshot_id"]);

	LLAvatarPropertiesProcessor::getInstance()->addObserver(
		getAvatarId(), this);
	LLAvatarPropertiesProcessor::getInstance()->sendPickInfoRequest(
		getAvatarId(), getPickId());
}
Ejemplo n.º 2
0
void LLPanelClassifiedEdit::onOpen(const LLSD& key)
{
	mIsNew = key.isUndefined();
	
	scrollToTop();

	// classified is not created yet
	bool is_new = isNew() || isNewWithErrors();

	if(is_new)
	{
		resetData();
		resetControls();

		fillIn(key);

		if(isNew())
		{
			LLAvatarPropertiesProcessor::getInstance()->addObserver(getAvatarId(), this);
		}
	}
	else
	{
		LLPanelClassifiedInfo::onOpen(key);
	}

	std::string save_btn_label = is_new ? getString("publish_label") : getString("save_label");
	getChild<LLUICtrl>("save_changes_btn")->setLabelArg("[LABEL]", save_btn_label);

	enableVerbs(is_new);
	enableEditing(is_new);
	showEditing(!is_new);
	resetDirty();
	setInfoLoaded(false);
}
Ejemplo n.º 3
0
BoardRight::BoardRight(QWidget *parent, SubteStatus * subte, EventHandler *eventHandler) :
    BaseBoard(parent,subte,eventHandler),
    ui(new Ui::BoardRight)
{
    ui->setupUi(this);

    QSize buttonSize;
    buttonSize.setWidth(78);
    buttonSize.setHeight(78);
    ui->CONDisy_widget->setSize(buttonSize);
    ui->DESDisy_widget->setSize(buttonSize);
    ui->calientapies->setSize(buttonSize);
    ui->frenoRetencion->setSize(buttonSize);
    ui->desacople->setSize(buttonSize);

    connect(m_eventHandler,SIGNAL(controlReady()),this,SLOT(startBoard()));
    connect(m_eventHandler,SIGNAL(controlDisable()),this,SLOT(disableScreen()));
    connect(m_eventHandler,SIGNAL(controlEnable()),this,SLOT(enableScreen()));
    connect(m_eventHandler,SIGNAL(controlReset()),this,SLOT(resetControls()));
    connect(m_eventHandler,SIGNAL(cargarEstado(int)),this,SLOT(loadState(int)));

    m_manometer = NULL;
    m_CON_Disyuntor = NULL;
    m_DES_Disyuntor = NULL;
    m_sicasmac = NULL;
    m_modoConduccion = NULL;
    m_frenoRetencion = NULL;
}
Ejemplo n.º 4
0
BOOL LLPanelAvatarNotes::postBuild()
{
    childSetCommitCallback("status_check", boost::bind(&LLPanelAvatarNotes::onCommitRights, this), NULL);
    childSetCommitCallback("map_check", boost::bind(&LLPanelAvatarNotes::onCommitRights, this), NULL);
    childSetCommitCallback("objects_check", boost::bind(&LLPanelAvatarNotes::onCommitRights, this), NULL);

    childSetCommitCallback("add_friend", boost::bind(&LLPanelAvatarNotes::onAddFriendButtonClick, this),NULL);
    childSetCommitCallback("im", boost::bind(&LLPanelAvatarNotes::onIMButtonClick, this), NULL);
    childSetCommitCallback("call", boost::bind(&LLPanelAvatarNotes::onCallButtonClick, this), NULL);
    childSetCommitCallback("teleport", boost::bind(&LLPanelAvatarNotes::onTeleportButtonClick, this), NULL);
    childSetCommitCallback("share", boost::bind(&LLPanelAvatarNotes::onShareButtonClick, this), NULL);
    childSetCommitCallback("show_on_map_btn", (boost::bind(
                               &LLPanelAvatarNotes::onMapButtonClick, this)), NULL);

    LLTextEditor* te = getChild<LLTextEditor>("notes_edit");
    te->setCommitCallback(boost::bind(&LLPanelAvatarNotes::onCommitNotes,this));
    te->setCommitOnFocusLost(TRUE);

    resetControls();
    resetData();

    LLVoiceClient::getInstance()->addObserver((LLVoiceClientStatusObserver*)this);

    return TRUE;
}
Ejemplo n.º 5
0
BoardHardware::BoardHardware(QWidget *parent, SubteStatus * subte, EventHandler *eventHandler) :
    BaseBoard(parent,subte,eventHandler),
    ui(new Ui::BoardHardware)
{
    ui->setupUi(this);

    connect(m_eventHandler,SIGNAL(controlReady()),this,SLOT(startBoard()));
    connect(m_eventHandler,SIGNAL(controlDisable()),this,SLOT(disableScreen()));
    connect(m_eventHandler,SIGNAL(controlEnable()),this,SLOT(enableScreen()));
    connect(m_eventHandler,SIGNAL(controlReset()),this,SLOT(resetControls()));
    connect(m_eventHandler,SIGNAL(cargarEstado(int)),this,SLOT(loadState(int)));
    connect(m_eventHandler,SIGNAL(bPressed()),this,SLOT(bocinaON()));
    connect(m_eventHandler,SIGNAL(bReleased()),this,SLOT(bocinaOFF()));
//    connect(m_eventHandler,SIGNAL(aPressed()),this,SLOT(ranaAD()));
//    connect(m_eventHandler,SIGNAL(ceroPressed()),this,SLOT(ranaCERO()));
//    connect(m_eventHandler,SIGNAL(rPressed()),this,SLOT(ranaAT()));
    connect(m_eventHandler,SIGNAL(fPressed()),this,SLOT(setaON()));
    connect(m_eventHandler,SIGNAL(tPressed()),this,SLOT(setaOFF()));

    m_horn = NULL;
//    m_tractionLever = NULL;
//    m_rana = NULL;
//    m_hombreMuerto = NULL;
    m_setaButton = NULL;

    m_tractionHardware = NULL;

}
Ejemplo n.º 6
0
/**
 * \brief	This will load input settings that were saved previously by the user at past session.
 */
void CInput::loadControlconfig(void)
{
	CConfiguration Configuration(CONFIGFILENAME);
	if(Configuration.Parse())
	{
		std::string section;
		for(size_t i=0 ; i<NUM_INPUTS ; i++)
		{
			// setup input from proper string
			section = "input" + itoa(i);

			std::string value;
            Configuration.ReadString( section, "Left", value, "Left");
			setupInputCommand( InputCommand[i], IC_LEFT, value );
            Configuration.ReadString( section, "Up", value, "Up");
			setupInputCommand( InputCommand[i], IC_UP, value );
            Configuration.ReadString( section, "Right", value, "Right");
			setupInputCommand( InputCommand[i], IC_RIGHT, value );
            Configuration.ReadString( section, "Down", value, "Down");
			setupInputCommand( InputCommand[i], IC_DOWN, value );

            Configuration.ReadString( section, "Lower-Left", value, "End");
			setupInputCommand( InputCommand[i], IC_LOWERLEFT, value );
            Configuration.ReadString( section, "Lower-Right", value, "Page Down");
			setupInputCommand( InputCommand[i], IC_LOWERRIGHT, value );
            Configuration.ReadString( section, "Upper-Left", value, "Home");
			setupInputCommand( InputCommand[i], IC_UPPERLEFT, value );
            Configuration.ReadString( section, "Upper-Right", value, "Page Up");
			setupInputCommand( InputCommand[i], IC_UPPERRIGHT, value );

            Configuration.ReadString( section, "Jump", value, "Left ctrl");
			setupInputCommand( InputCommand[i], IC_JUMP, value );
            Configuration.ReadString( section, "Pogo", value, "Left alt");
			setupInputCommand( InputCommand[i], IC_POGO, value );
            Configuration.ReadString( section, "Fire", value, "Space");
			setupInputCommand( InputCommand[i], IC_FIRE, value );
            Configuration.ReadString( section, "Status", value, "Return");
			setupInputCommand( InputCommand[i], IC_STATUS, value );
            Configuration.ReadString( section, "Camlead", value, "c");
			setupInputCommand( InputCommand[i], IC_CAMLEAD, value );
            Configuration.ReadString( section, "Help", value, "F11");
			setupInputCommand( InputCommand[i], IC_HELP, value );
            Configuration.ReadString( section, "Back", value, "Escape");
			setupInputCommand( InputCommand[i], IC_BACK, value );

			Configuration.ReadKeyword( section, "TwoButtonFiring", &TwoButtonFiring[i], false);
			Configuration.ReadKeyword( section, "Analog", &mAnalogAxesMovement[i], false);
		}
	}
	else
	{
		for(size_t c=1 ; c<= NUM_INPUTS ; c++)
			resetControls(c);
	}
}
Ejemplo n.º 7
0
void LLPanelPickEdit::onOpen(const LLSD& key)
{
	LLUUID pick_id = key["pick_id"];
	mNeedData = true;

	// creating new Pick
	if(pick_id.isNull())
	{
		mNewPick = true;

		setAvatarId(gAgent.getID());

		resetData();
		resetControls();

		setPosGlobal(gAgent.getPositionGlobal());

		LLUUID parcel_id = LLUUID::null, snapshot_id = LLUUID::null;
		std::string pick_name, pick_desc, region_name;

		LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
		if(parcel)
		{
			parcel_id = parcel->getID();
			pick_name = parcel->getName();
			pick_desc = parcel->getDesc();
			snapshot_id = parcel->getSnapshotID();
		}

		LLViewerRegion* region = gAgent.getRegion();
		if(region)
		{
			region_name = region->getName();
		}

		setParcelID(parcel_id);
		childSetValue("pick_name", pick_name.empty() ? region_name : pick_name);
		childSetValue("pick_desc", pick_desc);
		setSnapshotId(snapshot_id);
		setPickLocation(createLocationText(getLocationNotice(), pick_name, region_name, getPosGlobal()));

		enableSaveButton(true);
	}
	// editing existing pick
	else
	{
		mNewPick = false;
		LLPanelPickInfo::onOpen(key);

		enableSaveButton(false);
	}

	resetDirty();
}
Ejemplo n.º 8
0
BOOL LLPanelMyProfile::postBuild()
{
    LLPanelAvatarProfile::postBuild();

    childSetCommitCallback("status_me_message_text", boost::bind(&LLPanelMyProfile::onStatusMessageChanged, this), NULL);

    resetControls();
    resetData();

    return TRUE;
}
Ejemplo n.º 9
0
BoardLeft::BoardLeft(QWidget *parent, SubteStatus * subte, EventHandler *eventHandler) :
    BaseBoard(parent,subte,eventHandler),
    ui(new Ui::BoardLeft)
{
    ui->setupUi(this);

    connect(m_eventHandler,SIGNAL(controlReady()),this,SLOT(startBoard()));
    connect(m_eventHandler,SIGNAL(controlDisable()),this,SLOT(disableScreen()));
    connect(m_eventHandler,SIGNAL(controlEnable()),this,SLOT(enableScreen()));
    connect(m_eventHandler,SIGNAL(controlReset()),this,SLOT(resetControls()));
    connect(m_eventHandler,SIGNAL(cargarEstado(int)),this,SLOT(loadState(int)));
}
Ejemplo n.º 10
0
/**
 * \brief	This will load input settings that were saved previously by the user at past session.
 */
void CInput::loadControlconfig(void)
{
	CConfiguration Configuration(CONFIGFILENAME);
	if(Configuration.Parse())
	{
		std::string section;
		for(size_t i=0 ; i<NUM_INPUTS ; i++)
		{
			// setup input from proper string
			section = "input" + itoa(i);

			std::string value;
			Configuration.ReadString( section, "Left", value, "Key 276 (left)");
			setupInputCommand( InputCommand[i], IC_LEFT, value );
			Configuration.ReadString( section, "Up", value, "Key 273 (up)");
			setupInputCommand( InputCommand[i], IC_UP, value );
			Configuration.ReadString( section, "Right", value, "Key 275 (right)");
			setupInputCommand( InputCommand[i], IC_RIGHT, value );
			Configuration.ReadString( section, "Down", value, "Key 274 (down)");
			setupInputCommand( InputCommand[i], IC_DOWN, value );

			Configuration.ReadString( section, "Lower-Left", value, "Key 279 (end)");
			setupInputCommand( InputCommand[i], IC_LOWERLEFT, value );
			Configuration.ReadString( section, "Lower-Right", value, "Key 281 (page down)");
			setupInputCommand( InputCommand[i], IC_LOWERRIGHT, value );
			Configuration.ReadString( section, "Upper-Left", value, "Key 278 (home)");
			setupInputCommand( InputCommand[i], IC_UPPERLEFT, value );
			Configuration.ReadString( section, "Upper-Right", value, "Key 280 (page up)");
			setupInputCommand( InputCommand[i], IC_UPPERRIGHT, value );

			Configuration.ReadString( section, "Jump", value, "Key 306 (left ctrl)");
			setupInputCommand( InputCommand[i], IC_JUMP, value );
			Configuration.ReadString( section, "Pogo", value, "Key 308 (left alt)");
			setupInputCommand( InputCommand[i], IC_POGO, value );
			Configuration.ReadString( section, "Fire", value, "Key 32 (space)");
			setupInputCommand( InputCommand[i], IC_FIRE, value );
			Configuration.ReadString( section, "Status", value, "Key 13 (return)");
			setupInputCommand( InputCommand[i], IC_STATUS, value );
			Configuration.ReadString( section, "Help", value, "Key 282 (f1)");
			setupInputCommand( InputCommand[i], IC_HELP, value );
			Configuration.ReadString( section, "Quit", value, "Key 27 (escape)");
			setupInputCommand( InputCommand[i], IC_QUIT, value );
			Configuration.ReadKeyword( section, "TwoButtonFiring", &TwoButtonFiring[i], false);
		}
	}
	else
	{
		for(size_t c=1 ; c<= NUM_INPUTS ; c++)
			resetControls(c);
	}
}
Ejemplo n.º 11
0
void LLPanelClassifiedInfo::onOpen(const LLSD& key)
{
	LLUUID avatar_id = key["classified_creator_id"];
	if(avatar_id.isNull())
	{
		return;
	}

	if(getAvatarId().notNull())
	{
		LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(), this);
	}

	setAvatarId(avatar_id);

	resetData();
	resetControls();
	scrollToTop();

	setClassifiedId(key["classified_id"]);
	setClassifiedName(key["classified_name"]);
	setDescription(key["classified_desc"]);
	setSnapshotId(key["classified_snapshot_id"]);
	setFromSearch(key["from_search"]);

	LL_INFOS() << "Opening classified [" << getClassifiedName() << "] (" << getClassifiedId() << ")" << LL_ENDL;

	LLAvatarPropertiesProcessor::getInstance()->addObserver(getAvatarId(), this);
	LLAvatarPropertiesProcessor::getInstance()->sendClassifiedInfoRequest(getClassifiedId());
	gGenericDispatcher.addHandler("classifiedclickthrough", &sClassifiedClickThrough);

	// While we're at it let's get the stats from the new table if that
	// capability exists.
	std::string url = gAgent.getRegion()->getCapability("SearchStatRequest");
	if (!url.empty())
	{
		LL_INFOS() << "Classified stat request via capability" << LL_ENDL;
		LLSD body;
		body["classified_id"] = getClassifiedId();
		LLHTTPClient::post(url, body, new LLClassifiedStatsResponder(getClassifiedId()));
	}

	// Update classified click stats.
	// *TODO: Should we do this when opening not from search?
	sendClickMessage("profile");

	setInfoLoaded(false);
}
Ejemplo n.º 12
0
void LLPanelProfileTab::onOpen(const LLSD& key)
{
    // Don't reset panel if we are opening it for same avatar.
    if(getAvatarId() != key.asUUID())
    {
        resetControls();
        resetData();

        scrollToTop();
    }

    // Update data even if we are viewing same avatar profile as some data might been changed.
    setAvatarId(key.asUUID());
    updateData();
    updateButtons();
}
Ejemplo n.º 13
0
CInput::CInput()
{
#if defined(WIZ) || defined(GP2X)
    volume_direction = VOLUME_NOCHG;
	volume = 60-VOLUME_CHANGE_RATE;
	WIZ_AdjustVolume(VOLUME_UP);
#endif
	g_pLogFile->ftextOut("Starting the input driver...<br>");
	memset(InputCommand, 0, NUM_INPUTS*MAX_COMMANDS*sizeof(stInputCommand));

	for(size_t c=1 ; c<= NUM_INPUTS ; c++)
		resetControls(c);
	memset(&Event,0,sizeof(Event));
#if !defined(TARGET_OS_IPHONE) && !defined(TARGET_IPHONE_SIMULATOR)
	loadControlconfig(); // we want to have the default settings in all cases
	startJoyDriver(); // not for iPhone for now, could cause trouble (unwanted input events)
#endif
}
Ejemplo n.º 14
0
BOOL LLPanelAvatarProfile::postBuild()
{
    childSetCommitCallback("add_friend",(boost::bind(&LLPanelAvatarProfile::onAddFriendButtonClick,this)),NULL);
    childSetCommitCallback("im",(boost::bind(&LLPanelAvatarProfile::onIMButtonClick,this)),NULL);
    childSetCommitCallback("call",(boost::bind(&LLPanelAvatarProfile::onCallButtonClick,this)),NULL);
    childSetCommitCallback("teleport",(boost::bind(&LLPanelAvatarProfile::onTeleportButtonClick,this)),NULL);
    childSetCommitCallback("overflow_btn", boost::bind(&LLPanelAvatarProfile::onOverflowButtonClicked, this), NULL);
    childSetCommitCallback("share",(boost::bind(&LLPanelAvatarProfile::onShareButtonClick,this)),NULL);
    childSetCommitCallback("show_on_map_btn", (boost::bind(
                               &LLPanelAvatarProfile::onMapButtonClick, this)), NULL);

    LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
    registrar.add("Profile.ShowOnMap",  boost::bind(&LLPanelAvatarProfile::onMapButtonClick, this));
    registrar.add("Profile.Pay",  boost::bind(&LLPanelAvatarProfile::pay, this));
    registrar.add("Profile.Share", boost::bind(&LLPanelAvatarProfile::share, this));
    registrar.add("Profile.BlockUnblock", boost::bind(&LLPanelAvatarProfile::toggleBlock, this));
    registrar.add("Profile.Kick", boost::bind(&LLPanelAvatarProfile::kick, this));
    registrar.add("Profile.Freeze", boost::bind(&LLPanelAvatarProfile::freeze, this));
    registrar.add("Profile.Unfreeze", boost::bind(&LLPanelAvatarProfile::unfreeze, this));
    registrar.add("Profile.CSR", boost::bind(&LLPanelAvatarProfile::csr, this));

    LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable;
    enable.add("Profile.EnableShowOnMap", boost::bind(&LLPanelAvatarProfile::enableShowOnMap, this));
    enable.add("Profile.EnableGod", boost::bind(&enable_god));
    enable.add("Profile.EnableBlock", boost::bind(&LLPanelAvatarProfile::enableBlock, this));
    enable.add("Profile.EnableUnblock", boost::bind(&LLPanelAvatarProfile::enableUnblock, this));

    mProfileMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_profile_overflow.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());

    LLVoiceClient::getInstance()->addObserver((LLVoiceClientStatusObserver*)this);

    resetControls();
    resetData();

    return TRUE;
}
Ejemplo n.º 15
0
LRESULT CGridDlg::OnMsgResetControls(WPARAM wp, LPARAM lp) {
  resetControls();
  return 0;
}
Ejemplo n.º 16
0
void ReportDialog::createControls()
{
    logMessage("ReportDialog::createControls()");

    chkDescription = new QCheckBox(tr("Description"));
    chkProblemInformation = new QCheckBox(tr("Problem information"));
    chkStartupScript = new QCheckBox(tr("Startup script"));
    chkPhysicalProperties = new QCheckBox(tr("Physical properties"));
    chkGeometry = new QCheckBox(tr("Geometry"));
    connect(chkGeometry, SIGNAL(clicked()), this, SLOT(resetControls()));
    chkMeshAndSolution = new QCheckBox(tr("Mesh and solution"));
    connect(chkMeshAndSolution, SIGNAL(clicked()), this, SLOT(resetControls()));
    chkScript = new QCheckBox(tr("Script"));

    chkFigureGeometry = new QCheckBox(tr("Geometry"));
    chkFigureMesh = new QCheckBox(tr("Mesh"));
    chkFigureOrder = new QCheckBox(tr("Order"));
    chkFigureScalarView = new QCheckBox(tr("Scalar view"));
    chkFigureContourView = new QCheckBox(tr("Contour view"));
    chkFigureVectorView = new QCheckBox(tr("Vector view"));
    chkShowGrid = new QCheckBox(tr("Show grid"));
    chkShowRulers = new QCheckBox(tr("Show rulers"));

    txtTemplate = new QLineEdit();
    connect(txtTemplate, SIGNAL(textChanged(QString)), this, SLOT(checkPaths()));
    txtStyleSheet = new QLineEdit();
    connect(txtStyleSheet, SIGNAL(textChanged(QString)), this, SLOT(checkPaths()));

    txtFigureWidth = new ValueLineEdit();
    txtFigureWidth->setValue(Value("600"));
    txtFigureWidth->setMinimum(200);
    txtFigureHeight = new ValueLineEdit();
    txtFigureHeight->setValue(Value("400"));
    txtFigureHeight->setMinimum(200);

    btnDefault = new QPushButton(tr("Default"));
    connect(btnDefault, SIGNAL(clicked()), this, SLOT(defaultValues()));

    btnShowReport = new QPushButton(tr("Show report"));
    connect(btnShowReport, SIGNAL(clicked()), this, SLOT(doShowReport()));

    btnClose = new QPushButton(tr("Close"));
    btnClose->setDefault(true);
    connect(btnClose, SIGNAL(clicked()), this, SLOT(doClose()));

    QVBoxLayout *layoutSections = new QVBoxLayout();
    layoutSections->addWidget(chkDescription);
    layoutSections->addWidget(chkProblemInformation);
    layoutSections->addWidget(chkStartupScript);
    layoutSections->addWidget(chkPhysicalProperties);
    layoutSections->addWidget(chkGeometry);
    layoutSections->addWidget(chkMeshAndSolution);
    layoutSections->addWidget(chkScript);

    QVBoxLayout *layoutFigures = new QVBoxLayout();
    layoutFigures->addWidget(chkFigureGeometry);
    layoutFigures->addWidget(chkFigureMesh);
    layoutFigures->addWidget(chkFigureOrder);
    layoutFigures->addWidget(chkFigureScalarView);
    layoutFigures->addWidget(chkFigureContourView);
    layoutFigures->addWidget(chkFigureVectorView);
    layoutFigures->addWidget(new QLabel());
    layoutFigures->addWidget(chkShowGrid);
    layoutFigures->addWidget(chkShowRulers);

    QGridLayout *layoutSection = new QGridLayout();
    layoutSection->addLayout(layoutSections, 0, 0);

    QGridLayout *layoutTemplate = new QGridLayout();
    layoutTemplate->addWidget(new QLabel(tr("Template")), 0, 0);
    layoutTemplate->addWidget(txtTemplate, 0, 1);
    layoutTemplate->addWidget(new QLabel(tr("Style sheet")), 1, 0);
    layoutTemplate->addWidget(txtStyleSheet, 1, 1);

    QGridLayout *layoutFigureSize = new QGridLayout();
    layoutFigureSize->addWidget(new QLabel(tr("Width")), 0, 0);
    layoutFigureSize->addWidget(txtFigureWidth, 0, 1);
    layoutFigureSize->addWidget(new QLabel(tr("Height")), 1, 0);
    layoutFigureSize->addWidget(txtFigureHeight, 1, 1);
    layoutFigureSize->setRowStretch(2, 1);

    QHBoxLayout *layoutFigure = new QHBoxLayout();
    layoutFigure->addLayout(layoutFigures);
    layoutFigure->addLayout(layoutFigureSize);
    layoutFigure->addStretch();

    QHBoxLayout *layoutButtons = new QHBoxLayout();
    layoutButtons->addStretch();
    layoutButtons->addWidget(btnShowReport);
    layoutButtons->addWidget(btnDefault);
    layoutButtons->addWidget(btnClose);

    QGroupBox *grpBasicProperties = new QGroupBox(tr("Sections"));
    grpBasicProperties->setLayout(layoutSection);

    QGroupBox *grpFigure = new QGroupBox(tr("Figures properties"));
    grpFigure->setLayout(layoutFigure);

    QGroupBox *grpAdditionalProperties = new QGroupBox(tr("Additional properties"));
    grpAdditionalProperties->setLayout(layoutTemplate);

    QGridLayout *layout = new QGridLayout();
    layout->addWidget(grpBasicProperties, 0, 0);
    layout->addWidget(grpFigure, 0, 1);
    // layout->addWidget(grpAdditionalProperties, 1, 0, 1, 2);
    layout->addLayout(layoutButtons, 2, 0, 2, 2);

    setLayout(layout);
}
Ejemplo n.º 17
0
void loadConfig()
{
	FILE *fp;
	char settingsFile[MAX_PATH_LENGTH], *line, *savePtr;
	unsigned char *buffer;
	long length;

	resetGameSettings();

	game.hasConfig = FALSE;

	snprintf(settingsFile, sizeof(settingsFile), "%sconfig", gameSavePath);

	resetControls(FALSE);

	fp = fopen(settingsFile, "rb");

	if (fp == NULL)
	{
		game.firstRun = TRUE;

		return;
	}

	game.firstRun = FALSE;

	fseek(fp, 0L, SEEK_END);

	length = ftell(fp);

	buffer = malloc((length + 1) * sizeof(unsigned char));

	if (buffer == NULL)
	{
		showErrorAndExit("Failed to allocate a whole %ld bytes for config file...", length);

		exit(1);
	}

	fseek(fp, 0L, SEEK_SET);

	fread(buffer, length, 1, fp);

	buffer[length] = '\0';

	fclose(fp);

	savePtr = NULL;

	line = strtok_r((char *)buffer, "\n", &savePtr);

	while (line != NULL)
	{
		if (strcmpignorecase(line, "CONTROLS") == 0)
		{
			readControlsFromFile(savePtr);
		}

		else if (strcmpignorecase(line, "GAME_SETTINGS") == 0)
		{
			readGameSettingsFromFile(savePtr);
		}

		line = strtok_r(NULL, "\n", &savePtr);
	}

	game.hasConfig = TRUE;

	free(buffer);
}