Esempio n. 1
0
PageItem_LatexFrame::PageItem_LatexFrame(ScribusDoc *pa, double x, double y, double w, double h, double w2, QString fill, QString outline)
		: PageItem_ImageFrame(pa, x, y, w, h, w2, fill, outline)
{
	setUPixmap(Um::ILatexFrame);
	AnName = tr("Render") + QString::number(m_Doc->TotalItems);
	setUName(AnName);
	
	imgValid = false;
	m_usePreamble = true;
	err = 0;
	internalEditor = 0;
	killed = false;
	
	config = 0;
	if (PrefsManager::instance()->latexConfigs().count() > 0)
		setConfigFile(PrefsManager::instance()->latexConfigs()[0]);

	latex = new QProcess();
	connect(latex, SIGNAL(finished(int, QProcess::ExitStatus)),
		this, SLOT(updateImage(int, QProcess::ExitStatus)));
	connect(latex, SIGNAL(error(QProcess::ProcessError)),
		this, SLOT(latexError(QProcess::ProcessError)));
	latex->setProcessChannelMode(QProcess::MergedChannels);
	
	QTemporaryFile *tempfile = new QTemporaryFile(QDir::tempPath() + "/scribus_temp_render_XXXXXX");
	tempfile->open();
	tempFileBase = getLongPathName(tempfile->fileName());
	tempfile->setAutoRemove(false);
	tempfile->close();
	delete tempfile;
	Q_ASSERT(!tempFileBase.isEmpty());
	
	m_dpi = 0;
}
Esempio n. 2
0
DataStorage::DataStorage(const QString& configFile)
{
    if (myInstance)
    {
        qWarning() << "DataStorage Instance already exists. Not updating myInstance()";
        return;
    }
    myInstance=this;
    settings=0;
    setConfigFile(configFile);
}
Esempio n. 3
0
DataStorage::DataStorage()
{
    if (myInstance)
    {
        qWarning() << "DataStorage Instance already exists. Not updating myInstance()";
        return;
    }
    myInstance=this;
    settings=0;
    setConfigFile("gluxi.cfg");
}
/*!

  Default constructor.

  Does nothing more than setting the default configuration file 
  to /usr/share/BiclopsDefault.cfg.

  As shown in the following example,the turret need to be initialized 
  using init() function.

  \code
#include <visp/vpConfig.h>
#include <visp/vpRobotBiclops.h>

int main()
{
#ifdef VISP_HAVE_BICLOPS
  vpRobotBiclops robot; // Use the default config file in /usr/share/BiclopsDefault.cfg"

  // Specify the config file location
  robot.setConfigFile("/usr/share/BiclopsDefault.cfg"); // Not mandatory since the file is the default one
  
  // Initialize the head
  robot.init();

  // Move the robot to a specified pan and tilt
  robot.setRobotState(vpRobot::STATE_POSITION_CONTROL) ;
  vpColVector q(2);
  q[0] = vpMath::rad(20); // pan
  q[1] = vpMath::rad(40); // tilt
  robot.setPosition(vpRobot::ARTICULAR_FRAME, q);
#endif
  return 0;
}
  \endcode

*/
vpRobotBiclops::vpRobotBiclops ()
  :
  vpRobot ()
{
  vpDEBUG_TRACE (12, "Begin default constructor.");

  vpRobotBiclops::robotAlreadyCreated = false;
  controlThreadCreated = false;
  setConfigFile("/usr/share/BiclopsDefault.cfg");

  // Initialize the mutex dedicated to she shm protection
  pthread_mutex_init (&vpShm_mutex, NULL);
  pthread_mutex_init (&vpEndThread_mutex, NULL);
  pthread_mutex_init (&vpMeasure_mutex, NULL);
}
Esempio n. 5
0
bool ProRataParameters::setArguments(  int iArgCount,
		char ** cdpArgValues )
{
	int iOption; 

	// Please not print anything if you find unknown parameters.
	opterr = 0;

	// getopt is from the C function, getopt.c
	// getopt.c is a platform-independent implementation of Linux getopt function 
	while( ( iOption = getopt( iArgCount, cdpArgValues, "w:i:") ) != -1 )
	{
		switch (iOption)
		{
			case 'w':
				sWorkingDirectory = optarg;
				break;  
			case 'i':
				sIDFile = optarg;
				break;
			case '?':
				cout << "WARNING: Ignoring unknown input at"
					<< " the command line." << endl;
				break;
		}
	}

	// if the working directory is not given
	// set it to the default, which is assigned in the constructor
	if( !setWorkingDirectory( sWorkingDirectory ) )
		return false;

	// if the ID file name is not given
	// set it to the default, which is assigned in the constructor
	if( !setIDFile( sIDFile ) )
		return false;
		
	// set the configuration file name to the default
	// and read all configurations into memory
	if( !setConfigFile( sConfigFile ) )
		return false;

	return true;
}
/*!

  Default constructor.

  Initialize the biclops pan, tilt head by reading the
  configuration file provided by Traclabs
  and do the homing sequence.

  The following example shows how to use the constructor.

  \code
#include <visp/vpConfig.h>
#include <visp/vpRobotBiclops.h>

int main()
{
#ifdef VISP_HAVE_BICLOPS
  // Specify the config file location and initialize the turret
  vpRobotBiclops robot("/usr/share/BiclopsDefault.cfg"); 

  // Move the robot to a specified pan and tilt
  robot.setRobotState(vpRobot::STATE_POSITION_CONTROL) ;

  vpColVector q(2);
  q[0] = vpMath::rad(-20); // pan
  q[1] = vpMath::rad(10); // tilt
  robot.setPosition(vpRobot::ARTICULAR_FRAME, q);
#endif
  return 0;
}
  \endcode

*/
vpRobotBiclops::vpRobotBiclops (const char * filename)
  :
  vpRobot ()
{
  vpDEBUG_TRACE (12, "Begin default constructor.");

  vpRobotBiclops::robotAlreadyCreated = false;
  controlThreadCreated = false;
  setConfigFile(filename);

  // Initialize the mutex dedicated to she shm protection
  pthread_mutex_init (&vpShm_mutex, NULL);
  pthread_mutex_init (&vpEndThread_mutex, NULL);
  pthread_mutex_init (&vpMeasure_mutex
, NULL);

  init();

  return ;
}
Esempio n. 7
0
LogType::LogType(LogType& copy):
    LogSyslog(false)
{
    copy.closeUdp();

    setVerbose(copy.getVerbose());
    setConfigFile(copy.getConfigFile());
    setStorageType(copy.getStorageType());
    setIpAddress(copy.getIpAddress());
    setRemotePort(copy.getRemotePort());
    setSourcePort(copy.getSourcePort());
    setUdpBufferSize(copy.getUdpBufferSize());

    __swaParser = boost::make_shared<SWAParser>(
        boost::bind(&LogType::callbackSWA, this, _1, _2, _3));
    if (!__swaParser) {
        writeError ("SWA Parser not allocated");
        // impossible, but if something corrupt memory.
        throw std::runtime_error( "Wrong log priority." );
    }

    // check if config file exists
    if( !iniParse(getConfigFile()) )
    {
        writeError ("Can't parse config FILE = %s", getConfigFile().c_str());
        // impossible, but if something corrupt memory.
        throw std::runtime_error( "Wrong log priority." );
    }

    __threadRun = false;
    __swaHelloReceive = false;
    __terminate = false;

    __udp_socket = NULL;
    __udp_remote_endpoint = NULL;
}
Esempio n. 8
0
int
main(int argc, char *argv[], char *envp[])
{
	int i, poolid, classid;
	ssize_t len;
	key_t	key;
	char *msg;

	//	Parse the options and configure appropriate values. 
	parse_opt(argc, argv);

	//	Read the configuration
	setConfigFile();
	myConfigServerType = CONFIG_SERPLEX_EXECD;
	DoConfig(ConfigureExecD);

	//	Daemonize
	if (execd_daemonize) {
		daemonize();
		(void) freopen( "/dev/null", "r", stdin );
		(void) freopen( "/var/log/iserverout.log", "a", stdout );
		(void) freopen( "/var/log/iservererr.log", "a", stderr ); 
		for (i = 3; i < MAXFD; i++) {
			close(i);	
		}
	}

	//	Start the signal handler thread.
	SignalInit();

	NetSyslogOpen(pname, NETLOG_ASYNC);
	sprintf(pidf, "%s/%s", PIDS_DIRECTORY, EXECD_PID_FILE); 
	execdpid = ReadPid(pidf);
 
	if ( execdpid > 0 ) { 
		if ((kill(execdpid, 0) == 0) || (errno != ESRCH)) { 
			NETERROR(MRSD, ("%s seems to be running already - exiting\n", basename(argv[0])));
			exit(0);
		} 
		else  /* Get rid of the leftover file */ 
       		UnlinkPid(pidf);
    }

	StorePid(pidf);

	NETINFOMSG(MEXECD, ("*** NexTone Cmd Execution Server started ***\n"));

	// 	Start the thread which sends message to pm
	Initpoll(EXECD_ID, SERPLEX_GID);
	Sendpoll(0); 
	ThreadLaunch((PFVP)SendPMPoll, NULL, 1);

	// 	Get the msg_q id. If it does not exist then create it
	if ((key = ftok(ISERVER_FTOK_PATH, ISERVER_EXECD_Q)) < 0) {
		NETERROR(MEXECD, ("ftok: %s\n", strerror(errno)));
		exit(0);
	}
	
	if (q_vget(key, 0, MAX_NUM_MSG, MAX_MSGLEN, &msgqid) < 0) {
		NETERROR(MEXECD, ("q_vget: %s\n", strerror(errno)));
		exit(0);
	}

#ifdef USE_SYS_POPEN	
	sys_utils_init();
#endif

	// Start a threadpool of worker threads
	poolid = ThreadPoolInit("execcmd", nthreads, PTHREAD_SCOPE_PROCESS, -1, 0);
	classid = ThreadAddPoolClass("execcmd", poolid, 0, 0);
	ThreadPoolStart(poolid);

	// msgqid has to be valid if we reached here
	for( ; ; ) {
		if (!(msg = malloc(MAX_MSGLEN))) {
			NETERROR(MEXECD, ("malloc: %s\n", strerror(errno)));
			sleep(5);   // sleep and try again
			continue;
		}
		if (q_vreceive(msgqid, msg, MAX_MSGLEN, SRVR_MSG_TYP, 0, &len) < 0) {
			NETERROR(MEXECD, ("q_vreceive: %s\n", strerror(errno)));
			// Check error types
			if (errno == EIDRM) {
				printf("execd: stop messing with my message queue\n");
				// somebody deleted the queue
				if (q_vget(key, 0, MAX_NUM_MSG, MAX_MSGLEN, &msgqid) < 0) {
					NETERROR(MEXECD, ("q_vget: %s\n", strerror(errno)));
					exit(0);
				}
			}
			free(msg);
			continue;
		}
		if (ThreadDispatch(poolid, classid, (PFVP)CmdWorker, msg, 1, 
			PTHREAD_SCOPE_PROCESS, SCHED_FIFO, 59) < 0) {
			NETERROR(MRSD, ("ThreadDispatch: No free thread\n"));
			// Send response in a new thread
			ThreadLaunch((PFVP)SendFailMsg, msg, 1);
		}
	}
}