Example #1
0
/*	Initializes the API used by the client for all the communication functions.
*	If the initialization is correct, a prompt is shown as part of the shell.
*/
int main (int argc, char const *argv[]) {

	signal(SIGINT, csignal);
	loadCommands();
	__connect();
	printf(MSG_CLIENT_CONNECTED);
	char input[INPUT_SIZE];
	int n;

	while (1) {

		printf(MSG_PROMPT);
		fflush(stdout);
		//	getLine(input);
		fgets(input, INPUT_SIZE - 16, stdin);
		int len = strlen(input);
		if (len > 0 && input[len - 1] == '\n')
			input[len - 1] = '\0';
		parse(input);
	}

	printf(ANSI_COLOR_RESET "Cliente termina\n");

	return 0;
}
Example #2
0
void KXmlCommandSelector::slotAddCommand()
{
    bool ok(false);
    QString cmdId = KInputDialog::getText(i18n("Command Name"), i18n("Enter an identification name for the new command:"), QString::null, &ok, this);
    if(ok)
    {
        bool added(true);

        if(m_cmdlist.findIndex(cmdId) != -1)
        {
            if(KMessageBox::warningContinueCancel(this, i18n("A command named %1 already exists. Do you want "
                                                  "to continue and edit the existing one?")
                                                  .arg(cmdId),
                                                  QString::null, KStdGuiItem::cont())
                    == KMessageBox::Cancel)
            {
                return;
            }
            else
                added = false;
        }

        KXmlCommand *xmlCmd = KXmlCommandManager::self()->loadCommand(cmdId);
        if(KXmlCommandDlg::editCommand(xmlCmd, this))
            KXmlCommandManager::self()->saveCommand(xmlCmd);

        if(added)
            loadCommands();
    }
}
Example #3
0
void
Application::start()
{
	startThreads();
	loadCommands();
	decryptLuts();
}
Example #4
0
ServerManager::ServerManager() {
	servSock = new TCPServerSocket(defaultPort);
	serverStatus = true;

	cmdPrototypes = new vector<Command*>();
	cmdMap = new std::map<string, Command*>();

	// Load Available Commands
	loadCommands();
}
    Map::Map(std::string directory) {
        boost::filesystem::path base(directory);

        locationOnDisk = directory;

        std::ifstream commandFile((base / "speeds.sl").string().c_str());
        loadCommands(commandFile);

        std::ifstream poseFile((base / "positions.pl").string().c_str());
        loadPositions(poseFile);

        std::ifstream anchorPointsFile((base / "anchorPoints.apd").string().c_str());
        loadAnchorPoints(anchorPointsFile);
    }
void SettingsDialog::on_saveButtonRobotClass_clicked()
{

    printf("testing");
    int ID = autonomous.loadedCommandBlocksByName.find(ui->menuCommands->selectedItems().at(0)->text().toStdString())->second->ID;

    autonomous.loadedCommandBlocks.find(ID)->second->relativeRobotClass = ui->robotClassEdit->text().toStdString();

    //Reload Changes Made To A Command

    autonomous.exportCommands();
    autonomous.loadJsonCommands();

    loadCommands();
}
Example #7
0
	bool Pipeline::load()
	{
		std::string path = getPath();
		std::string directory = core::FileSystem::getDirectory(path);
		// Parse XML file
		TiXmlDocument xml(path.c_str());
		if (!loadResourceFile(xml))
		{
			finishLoading(false);
			return false;
		}
		// Load XML file
		TiXmlNode *root = xml.FirstChild("Pipeline");
		if (!root)
		{
			getManager()->getLog()->error("%s: <Pipeline> not found.",
			                              getName().c_str());
			finishLoading(false);
			return false;
		}
		// Load render target setup
		TiXmlElement *setupelem = root->FirstChildElement("Setup");
		if (setupelem)
		{
			if (!loadSetup(setupelem))
			{
				finishLoading(false);
				return false;
			}
		}
		// Load commands
		TiXmlElement *commandelem = root->FirstChildElement("Commands");
		if (!commandelem)
		{
			getManager()->getLog()->error("%s: <Commands> not found.",
			                              getName().c_str());
			finishLoading(false);
			return false;
		}
		if (!loadCommands(commandelem))
		{
			finishLoading(false);
			return false;
		}
		finishLoading(true);
		return true;
	}
Example #8
0
File: main.c Project: orls/Tigger
int main (int argc, char * argv[]) {
	loadCommands();

        /* option parsing */
        int c = 0;
        int option_index = 0;

        while ((c = getopt_long(argc, argv, "cf", long_options, &option_index)) != -1)
        {
                switch (c)
                {
                        case 0: /* longopt detected */
                                break;
                        case 'c': /* short option, color enabled */
                                COLOR_FLAG = 1;
                                break;
                        case 'f':
                                FORCE_FLAG = 1;
                                break;
                        default:
                                fprintf(stdout, "Unknown option code %d\n", c);
                                printUsage();
                                return EXIT_FAILURE;
                }
        }

        /* argument loop */
	if(optind < argc && argv[optind] && isCommand(argv[optind])){
		//then we want to process the command
		if (!processCommand(argv, optind)){
			if (COLOR_FLAG)
                                fprintf_red(stdout, "Your command was not processed.\n");
                        else
                                printf("Your command was not processed.\n");
		}
	}else{
		printUsage();
	}
    return 0;
}
Example #9
0
void CommandStringTable::load(void)
{
    loadCommands();
    loadCommandButtons();
}
Example #10
0
KXmlCommandSelector::KXmlCommandSelector(bool canBeNull, QWidget *parent, const char *name, KDialogBase *dlg) : QWidget(parent, name)
{
    m_cmd = new QComboBox(this);
    connect(m_cmd, SIGNAL(activated(int)), SLOT(slotCommandSelected(int)));
    QPushButton *m_add = new KPushButton(this);
    QPushButton *m_edit = new KPushButton(this);
    m_add->setPixmap(SmallIcon("filenew"));
    m_edit->setPixmap(SmallIcon("configure"));
    connect(m_add, SIGNAL(clicked()), SLOT(slotAddCommand()));
    connect(m_edit, SIGNAL(clicked()), SLOT(slotEditCommand()));
    QToolTip::add(m_add, i18n("New command"));
    QToolTip::add(m_edit, i18n("Edit command"));
    m_shortinfo = new QLabel(this);
    m_helpbtn = new KPushButton(this);
    m_helpbtn->setIconSet(SmallIconSet("help"));
    connect(m_helpbtn, SIGNAL(clicked()), SLOT(slotHelpCommand()));
    QToolTip::add(m_helpbtn, i18n("Information"));
    m_helpbtn->setEnabled(false);

    m_line = 0;
    m_usefilter = 0;
    QPushButton *m_browse = 0;

    QVBoxLayout *l0 = new QVBoxLayout(this, 0, 10);

    if(canBeNull)
    {
        m_line = new QLineEdit(this);
        m_browse = new KPushButton(KGuiItem(i18n("&Browse..."), "fileopen"), this);
        m_usefilter = new QCheckBox(i18n("Use co&mmand:"), this);
        connect(m_browse, SIGNAL(clicked()), SLOT(slotBrowse()));
        connect(m_usefilter, SIGNAL(toggled(bool)), m_line, SLOT(setDisabled(bool)));
        connect(m_usefilter, SIGNAL(toggled(bool)), m_browse, SLOT(setDisabled(bool)));
        connect(m_usefilter, SIGNAL(toggled(bool)), m_cmd, SLOT(setEnabled(bool)));
        connect(m_usefilter, SIGNAL(toggled(bool)), m_add, SLOT(setEnabled(bool)));
        connect(m_usefilter, SIGNAL(toggled(bool)), m_edit, SLOT(setEnabled(bool)));
        connect(m_usefilter, SIGNAL(toggled(bool)), m_shortinfo, SLOT(setEnabled(bool)));
        connect(m_usefilter, SIGNAL(toggled(bool)), SLOT(slotXmlCommandToggled(bool)));
        m_usefilter->setChecked(true);
        m_usefilter->setChecked(false);
        // setFocusProxy(m_line);
        setTabOrder(m_usefilter, m_cmd);
        setTabOrder(m_cmd, m_add);
        setTabOrder(m_add, m_edit);

        QHBoxLayout *l1 = new QHBoxLayout(0, 0, 10);
        l0->addLayout(l1);
        l1->addWidget(m_line);
        l1->addWidget(m_browse);

        KSeparator *sep = new KSeparator(Qt::Horizontal, this);
        l0->addWidget(sep);
    }
    else
        setFocusProxy(m_cmd);

    QGridLayout *l2 = new QGridLayout(0, 2, (m_usefilter ? 3 : 2), 0, 5);
    int c(0);
    l0->addLayout(l2);
    if(m_usefilter)
    {
        l2->addWidget(m_usefilter, 0, c++);
    }
    l2->addWidget(m_cmd, 0, c);
    QHBoxLayout *l4 = new QHBoxLayout(0, 0, 5);
    l2->addLayout(l4, 1, c);
    l4->addWidget(m_helpbtn, 0);
    l4->addWidget(m_shortinfo, 1);
    QHBoxLayout *l3 = new QHBoxLayout(0, 0, 0);
    l2->addLayout(l3, 0, c + 1);
    l3->addWidget(m_add);
    l3->addWidget(m_edit);

    if(dlg)
        connect(this, SIGNAL(commandValid(bool)), dlg, SLOT(enableButtonOK(bool)));

    loadCommands();
}
void SettingsDialog::on_loadedMenus_itemSelectionChanged()
{

    loadCommands();
}