Example #1
0
/*!
 *\~english
 *	Writes variable to config file.
 *\~russian
 *	Пишет переменную в конфиг. 
 *\~
 *	\param name - \~english Variable name \~russian Имя переменной \~ 
 *	\param value - \~english Variable value \~russian Значение переменной \~ 
 *	\see loadSizeFromConfig(const QString &mdname)
 *	\see saveSize2Config(QRect windowSize, const QString &mdname)
 *	\see readConfigVariable(const QString &name, bool *ok)
*/
void
aService::writeConfigVariable(const QString &name, const QString &value)
{
	QSettings settings;
	settings.insertSearchPath( QSettings::Unix, QString(QDir::homeDirPath())+QString("/.ananas"));
	settings.insertSearchPath( QSettings::Windows, "/ananasgroup/ananas" );
	settings.beginGroup(QString("/config/variables"));
	settings.writeEntry(QString("/%1").arg(name), value);
}
Example #2
0
/*!
 *\~english
 *	Reads variable from config file.
 *\~russian
 *	Читает переменную из конфига. 
 *\~
 *	\param name - \~english variable name to read \~russian Имя переменной для чтения \~ 
 *	\param ok (out) -	\~english true if success, false otherwise 
 				\~russian true если успешно иначе false \~ 
 *	\return - \~english Variable value \~russian Значение переменной \~ 
 *	\see writeConfigVariable(const QString &name, const QString &value)
 *	\see loadSizeFromConfig(const QString &mdname)
 *	\see saveSize2Config(QRect windowSize, const QString &mdname)
*/
QString
aService::readConfigVariable(const QString &name, bool *ok)
{
	QSettings settings;
	settings.insertSearchPath( QSettings::Unix, QString(QDir::homeDirPath())+QString("/.ananas"));
	settings.insertSearchPath( QSettings::Windows, "/ananasgroup/ananas" );
	settings.beginGroup(QString("/config/variables"));
	return settings.readEntry(QString("/%1").arg(name), "", ok);
}
Example #3
0
/*!
 *\~english
 *	Writes window size to config file.
 *\~russian
 *	Пишет размер окна в конфиг. 
 *\~
 *	\param windowSize - \~english Rect of window geometry \~russian Прямоугольник, представляющий окно \~ 
 *	\param mdname - \~english Unical name \~russian Имя окна (должно быть уникальным) \~ 
 *	\see loadSizeFromConfig(const QString &mdname)
*/
void 
aService::saveSize2Config(QRect windowSize, const QString &mdname)
{
	QSettings settings;
	settings.insertSearchPath( QSettings::Unix, QString(QDir::homeDirPath())+QString("/.ananas"));
	settings.insertSearchPath( QSettings::Windows, "/ananasgroup/ananas" );
	settings.beginGroup(QString("/config/%1").arg(mdname));
	settings.writeEntry("/left", windowSize.left());
	settings.writeEntry("/top", windowSize.top());
	settings.writeEntry("/right", windowSize.right());
	settings.writeEntry("/bottom", windowSize.bottom());
}
Example #4
0
/*!
 *\~english
 *	Reads window size from config file.
 *\~russian
 *	Читает размер окна из конфиг. 
 *\~
 *	\param mdname - \~english 	Window name.
 *					If config not contains info about mdname,
 *					return default value (400x300)
 *			\~russian 	Имя окна.
 *					Если конфиг не содержит информации об окне с таким именем,
 *					возвращает значение по умолчанию (400x300) \~
 *	\return - \~english Window size \~russian Размер окна \~ 
 *	\see saveSize2Config(QRect windowSize, const QString &mdname)
 *	
*/
QRect
aService::loadSizeFromConfig(const QString &mdname)
{
	QSettings settings;
	settings.insertSearchPath( QSettings::Unix, QString(QDir::homeDirPath())+QString("/.ananas"));
	settings.insertSearchPath( QSettings::Windows, "/ananasgroup/ananas" );
	settings.beginGroup(QString("/config/%1").arg(mdname));
	int l = settings.readNumEntry("/left", 0);
	int t = settings.readNumEntry("/top", 0);
	int r = settings.readNumEntry("/right", 400);
	int b = settings.readNumEntry("/bottom", 300);
	return QRect(l,t,r,b);
}
Example #5
0
/*! 
  Reads the registry to determine the location of the main window, and whether
  or not to display the splash screen.  If so, it shows the GraspIt! logo
  splash screen in the center of the screen.
 */
void
GraspItApp::showSplash()
{
    QRect screen = QApplication::desktop()->screenGeometry();
    QSettings config;
    config.insertSearchPath( QSettings::Windows, "/Columbia" );

    QRect mainRect;
    QString keybase = "/GraspIt/0.9/";
    bool show = config.readBoolEntry( keybase + "SplashScreen", TRUE );
    mainRect.setX( config.readNumEntry( keybase + "Geometries/MainwindowX", 0 ) );
    mainRect.setY( config.readNumEntry( keybase + "Geometries/MainwindowY", 0 ) );
    mainRect.setWidth( config.readNumEntry( keybase + "Geometries/MainwindowWidth", 500 ) );
    mainRect.setHeight( config.readNumEntry( keybase + "Geometries/MainwindowHeight", 500 ) );
    screen = QApplication::desktop()->screenGeometry( QApplication::desktop()->screenNumber( mainRect.center() ) );

    if ( show ) {
		splash = new QLabel( 0, "splash",Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint | Qt::WindowStaysOnTopHint);
	// WStyle_Customize | WStyle_StaysOnTop
	splash->setAttribute(Qt::WA_DeleteOnClose,true);
	splash->setFrameStyle( QFrame::WinPanel | QFrame::Raised );
	splash->setPixmap(load_pixmap( "splash.jpg" ));
	splash->adjustSize();
	splash->setFixedSize(splash->sizeHint());
	splash->setCaption( "GraspIt!" );
	splash->move( screen.center() - QPoint( splash->width() / 2, splash->height() / 2 ) );
	splash->show();
	splash->repaint( FALSE );
	QApplication::flush();
	//	set_splash_status( "Initializing..." );
    }
}
/*!
  Unregisters the component with id \a cid from the system component registry and returns
  TRUE if the component was unregistered successfully, otherwise returns FALSE.

  Call this function for each component in an implementation of
  \link QComponentRegistrationInterface::unregisterComponents() unregisterComponents() \endlink.

  \sa registerComponent(), unregisterServer()
*/
bool QComponentFactory::unregisterComponent( const QUuid &cid )
{
    QSettings settings;
    bool ok = FALSE;
    settings.insertSearchPath( QSettings::Windows, "/Classes" );

    QString cidStr = cid.toString().upper();
    if ( cidStr.isEmpty() )
	return FALSE;

    // unregister the human readable part
    QString vName = settings.readEntry( "/CLSID/" + cidStr + "/ProgID/Default", QString::null, &ok );
    if ( ok ) {
	QString name = settings.readEntry( "/CLSID/" + cidStr + "/VersionIndependentProgID/Default", QString::null );
	if ( !!name && settings.readEntry( "/" + name + "/CurVer/Default" ) == vName ) {
	    // unregistering the current version -> change CurVer to previous version
	    QString version = vName.right( vName.length() - name.length() - 1 );
	    QString newVerName;
	    QString newCidStr;
	    if ( version.find( '.' ) == -1 ) {
		int ver = version.toInt();
		// see if a lesser version is installed, and make that the CurVer
		while ( ver-- ) {
		    newVerName = name + "." + QString::number( ver );
		    newCidStr = settings.readEntry( "/" + newVerName + "/CLSID/Default" );
		    if ( !!newCidStr )
			break;
		}
	    } else {
		// oh well...
	    }
	    if ( !!newCidStr ) {
		settings.writeEntry( "/" + name + "/CurVer/Default", newVerName );
		settings.writeEntry( "/" + name + "/CLSID/Default", newCidStr );
	    } else {
		settings.removeEntry( "/" + name + "/CurVer/Default" );
		settings.removeEntry( "/" + name + "/CLSID/Default" );
		settings.removeEntry( "/" + name + "/Default" );
	    }
	}

	settings.removeEntry( "/" + vName + "/CLSID/Default" );
	settings.removeEntry( "/" + vName + "/Default" );
    }

    settings.removeEntry( "/CLSID/" + cidStr + "/VersionIndependentProgID/Default" );
    settings.removeEntry( "/CLSID/" + cidStr + "/ProgID/Default" );
    settings.removeEntry( "/CLSID/" + cidStr + "/InprocServer32/Default" );
    ok = settings.removeEntry( "/CLSID/" + cidStr + "/Default" );

    return ok;
}
Example #7
0
void myQLoader::load_module_ex(const QString& name, bool module, const QString& nameModule, const QPixmap& pix)
{
  if(!module)
	{
	  worker->clearArguments();
	   //add code run program
	   
	  QStringList str = QStringList::split(" ",name);
	  
	   worker->setArguments(str);
	   
	   if(!worker->start());
	   		 
	}
	else
	{
		QLibrary lib(name);
		//add code run module
		
		QSettings settings;
		
		QString ApplicationPath; // = qApp->applicationDirPath();
		setAplDir(ApplicationPath);
	  
		QDir d = QDir::home();
  
		QString s1 = d.absPath();
	 
		settings.removeSearchPath( QSettings::Unix, s1+"/.qt");
		settings.insertSearchPath( QSettings::Unix, s1+"/.SCT" );
   
		QString slang = settings.readEntry("/SCT/Language_UI","en"); 
		
		QTranslator myapp( 0 );
		myapp.load( nameModule + "_" + slang, ApplicationPath+"/lang");
		qApp->installTranslator( &myapp );
	  	typedef  void (*showW)(const QPixmap& );
		showW shw = (showW)lib.resolve( "run_module" );
                		if ( shw )
                                  shw(pix);
		else
		  ;//QMessageBox::about(this,tr("Error"),tr("Can't load module"));
				
    	        lib.unload();
		//qApp->removeTranslator(&myapp);
	}
}
Example #8
0
int main(int argc,char *argv[])
{
  QApplication a(argc,argv);
  
  //
  // Load Translations
  //
  QString tr_path;
  QString qt_path;
#ifdef WIN32
  QSettings settings;
  settings.insertSearchPath(QSettings::Windows,"/SalemRadioLabs");
  tr_path=QString().sprintf("%s\\",
			    (const char *)settings.
			    readEntry("/Rivendell/InstallDir"));
  qt_path=tr_path;
#else
  tr_path=QString(PREFIX)+QString("/share/rivendell/");
  qt_path=QString(QTDIR)+QString("/translation/");
#endif  // WIN32
  QTranslator qt(0);
  qt.load(qt_path+QString("qt_")+QTextCodec::locale(),".");
  a.installTranslator(&qt);

  QTranslator rd(0);
  rd.load(tr_path+QString("librd_")+QTextCodec::locale(),".");
  a.installTranslator(&rd);

  QTranslator rdhpi(0);
  rdhpi.load(tr_path+QString("librdhpi_")+QTextCodec::locale(),".");
  a.installTranslator(&rdhpi);

  QTranslator tr(0);
  tr.load(tr_path+QString("rdlogmanager_")+QTextCodec::locale(),".");
  a.installTranslator(&tr);

  //
  // Start Event Loop
  //
  MainWidget *w=new MainWidget(NULL,"main");
  a.setMainWidget(w);
  w->setGeometry(QRect(QPoint(w->geometry().x(),w->geometry().y()),
		       w->sizeHint()));
  w->show();
  return a.exec();
}
/*!
  Searches for the component identifier \a cid in the system component registry,
  loads the corresponding component server and queries for the interface \a iid.
  \a iface is set to the resulting interface pointer. \a cid can either be the
  UUID or the name of the component.

  The parameter \a outer is a pointer to the outer interface used
  for containment and aggregation and is propagated to the \link
  QComponentFactoryInterface::createInstance() createInstance() \endlink
  implementation of the QComponentFactoryInterface in the component server if
  provided.

  The function returns QS_OK if the interface was successfully instantiated, QE_NOINTERFACE if
  the component does not provide an interface \a iid, or QE_NOCOMPONENT if there was
  an error loading the component.

  Example:
  \code
  QInterfacePtr<MyInterface> iface;
  if ( QComponentFactory::createInstance( IID_MyInterface, CID_MyComponent, (QUnknownInterface**)&iface ) == QS_OK )
      iface->doSomething();
      ...
  }
  \endcode
*/
QRESULT QComponentFactory::createInstance( const QString &cid, const QUuid &iid, QUnknownInterface** iface, QUnknownInterface *outer )
{
    QSettings settings;
    settings.insertSearchPath( QSettings::Windows, "/Classes" );
    bool ok = FALSE;
    QString cidStr = cid;
    QRESULT res = QE_NOCOMPONENT;

    QUuid uuid( cidStr ); // try to parse, and resolve CLSID if necessary
    if ( uuid.isNull() ) {
	uuid = settings.readEntry( "/" + cid + "/CLSID/Default", QString::null, &ok );
	cidStr = uuid.toString().upper();
    }

    if ( cidStr.isEmpty() )
	return res;

    QString file = settings.readEntry( "/CLSID/" + cidStr + "/InprocServer32/Default", QString::null, &ok );
    if ( !ok )
	return res;

    QComLibrary *library = new QComLibrary( file );
    library->setAutoUnload( FALSE );

    QComponentFactoryInterface *cfIface =0;
    library->queryInterface( IID_QComponentFactory, (QUnknownInterface**)&cfIface );

    if ( cfIface ) {
	res = cfIface->createInstance( uuid, iid, iface, outer );
	cfIface->release();
    } else {
	res = library->queryInterface( iid, iface );
    }
    QLibraryInterface *libiface = 0;
    if ( library->queryInterface( IID_QLibrary, (QUnknownInterface**)&libiface ) != QS_OK || !qApp ) {
	delete library; // only deletes the object, thanks to QLibrary::Manual
    } else {
	libiface->release();
	library->setAutoUnload( TRUE );
	liblist()->prepend( library );
    }
    return res;
}
Example #10
0
int main(int argc,char *argv[])
{
  QApplication a(argc,argv);
  QApplication::setStyle(new QWindowsStyle);
  
  //
  // Load Translations
  //
  QString tr_path;
  QString qt_path;
#ifdef WIN32
  QSettings settings;
  settings.insertSearchPath(QSettings::Windows,"/SalemRadioLabs");
  tr_path=QString().sprintf("%s\\",
			    (const char *)settings.
			    readEntry("/Rivendell/InstallDir"));
  qt_path=tr_path;
#else
  tr_path=QString(PREFIX)+QString("/share/srlabs/");
  qt_path=QString(QTDIR)+QString("/translation/");
#endif  // WIN32
  QTranslator qt(0);
  qt.load(qt_path+QString("qt_")+QTextCodec::locale(),".");
  a.installTranslator(&qt);

  QTranslator libradio(0);
  libradio.load(tr_path+QString("libradio_")+QTextCodec::locale(),".");
  a.installTranslator(&libradio);

  QTranslator tests(0);
  tests.load(tr_path+QString("rdsoftkeys_")+QTextCodec::locale(),".");
  a.installTranslator(&tests);

  //
  // Start Event Loop
  //
  MainWidget *w=new MainWidget(NULL,"main");
  a.setMainWidget(w);
  w->setGeometry(w->geometry().x(),w->geometry().y(),w->sizeHint().width(),w->sizeHint().height());
  w->show();
  return a.exec();
}
Example #11
0
void MldConfig::clear()
{
#ifdef WIN32
  QSettings settings;
  settings.setPath("SalemRadioLabs","CallCommander",QSettings::UserScope);
  settings.insertSearchPath(QSettings::Windows,"/SalemRadioLabs");
  conf_filename=
    QString().sprintf("%s\\%s",(const char *)settings.
		      readEntry("/InstallDir","C:\\etc"),
		      DEFAULT_WIN_CONF_FILE);
#else
  conf_filename=MLD_CONF_FILE;
#endif  // WIN32
  conf_mysql_hostname="";
  conf_mysql_username="";
  conf_mysql_password="";
  conf_mysql_dbname="";
  conf_mysql_dbtype="";
  conf_station_name="";
  conf_details_refresh_interval=ML_DEFAULT_DETAILS_REFRESH_INTERVAL;
  conf_mcidmd_max_bank=MAX_BANKS;
}
/*!
  Registers the component with id \a cid in the system component registry and
  returns TRUE if the component was registerd successfully, otherwise returns
  FALSE. The component is provided by the component server at \a filepath and
  registered with an optional \a name, \a version and \a description.

  This function does nothing and returns FALSE if a component with an identical
  \a cid does already exist on the system.

  A component that has been registered with a \a name can be created using both the
  \a cid and the \a name value using createInstance().

  Call this function for each component in an implementation of
  \link QComponentRegistrationInterface::registerComponents() registerComponents() \endlink.

  \sa unregisterComponent(), registerServer(), createInstance()
*/
bool QComponentFactory::registerComponent( const QUuid &cid, const QString &filepath, const QString &name, int version, const QString &description )
{
    bool ok = FALSE;
    QSettings settings;
    settings.insertSearchPath( QSettings::Windows, "/Classes" );

    QString cidStr = cid.toString().upper();
    settings.readEntry( "/CLSID/" + cidStr + "/InprocServer32/Default", QString::null, &ok );
    if ( ok ) // don't overwrite existing component
	return FALSE;

    ok = settings.writeEntry( "/CLSID/" + cidStr + "/InprocServer32/Default", filepath );
    if ( ok && !!description )
	settings.writeEntry( "/CLSID/" + cidStr + "/Default", description );

    // register the human readable part
    if ( ok && !!name ) {
	QString vName = version ? name + "." + QString::number( version ) : name;
	settings.writeEntry( "/CLSID/" + cidStr + "/ProgID/Default", vName );
	ok = settings.writeEntry( "/" + vName + "/CLSID/Default", cidStr );
	if ( ok && !!description )
	    settings.writeEntry( "/" + vName + "/Default", description );

	if ( ok && version ) {
	    settings.writeEntry( "/CLSID/" + cidStr + "/VersionIndependentProgID/Default", name );
	    QString curVer = settings.readEntry( "/" + name + "/CurVer/Default" );
	    if ( !curVer || curVer < vName ) { // no previous, or a lesser version installed
		settings.writeEntry( "/" + name + "/CurVer/Default", vName );
		ok = settings.writeEntry( "/" + name + "/CLSID/Default", cidStr );
		if ( ok && !!description )
		    settings.writeEntry( "/" + name + "/Default", description );
	    }
	}
    }

    return ok;
}
Example #13
0
void qsa_eval_check()
{
  QSettings settings;
  settings.insertSearchPath(QSettings::Windows, "/Trolltech");
  QString key = QString("/QSA/%1/expdt").arg(QSA_VERSION_STRING);

  bool ok;
  bool showWarning = FALSE;
  QString str = settings.readEntry(key, QString::null, &ok);
  if (ok) {
    QRegExp exp("(\\w\\w\\w\\w)(\\w\\w)(\\w\\w)");
    Q_ASSERT(exp.isValid());
    if (exp.search(str) >= 0) {
      int a = exp.cap(1).toInt(0, 16);
      int b = exp.cap(2).toInt(0, 16);
      int c = exp.cap(3).toInt(0, 16);
      showWarning = (QDate::currentDate() > QDate(a, b, c));
    } else {
      showWarning = TRUE;
    }
  } else {
    QDate date = QDate::currentDate().addMonths(1);
    QString str = QString().sprintf("%.4x%.2x%.2x", date.year(), date.month(), date.day());
    settings.writeEntry(key, str);
  }

  if (showWarning) {
    QMessageBox::warning(0,
                         QObject::tr("End of Evaluation Period"),
                         QObject::tr("The evaluation period of QSA has expired.\n\n"
                                     "Please check http://www.trolltech.com/products/qsa"
                                     "for updates\n"
                                     "or contact [email protected] for further information"),
                         QMessageBox::Ok,
                         QMessageBox::NoButton);
  }
}
Example #14
0
int main( int argc, char *argv[] )
{
    QApplication::setColorSpec( QApplication::ManyColor );

    DesignerApplication a( argc, argv );

    DesignerApplication::setOverrideCursor( Qt::WaitCursor );

    bool creatPid = FALSE;
    if ( a.argc() > 1 ) {
	QString arg1 = a.argv()[ 1 ];
	if ( arg1 == "-client" ) {
	    QFile pf( QDir::homeDirPath() + "/.designerpid" );
	    if ( pf.exists() && pf.open( IO_ReadOnly ) ) {
		QString pidStr;
		pf.readLine( pidStr, pf.size() );
		QFile f( QDir::homeDirPath() + "/.designerargs" );
		f.open( IO_WriteOnly );
		QTextStream ts( &f );
		for ( int i = 1; i < a.argc(); ++i )
		    ts << a.argv()[ i ] << " ";
		ts << endl;
		f.close();
#if defined(Q_OS_UNIX)
		if ( kill( pidStr.toInt(), SIGUSR1 ) == -1 )
		    creatPid = TRUE;
		else
		    return 0;
#elif defined(Q_OS_WIN32)
		if ( !GetProcessVersion( pidStr.toUInt() ) ) {
		    creatPid = TRUE;
		} else {
		    if ( a.winVersion() & Qt::WV_NT_based )
			    SendMessage( HWND_BROADCAST, RegisterWindowMessage((TCHAR*)"QT_DESIGNER_OPEN_FILE"), 0, 0 );
		    else
			    SendMessage( HWND_BROADCAST, RegisterWindowMessageA("QT_DESIGNER_OPEN_FILE"), 0, 0 );
		    return 0;
		}
#endif
	    } else {
		creatPid = TRUE;
	    }
	} else if(arg1 == "-debug_stderr") {
	    extern bool debugToStderr; //outputwindow.cpp
	    debugToStderr = TRUE;
	}
    }

    if ( creatPid ) {
	QFile pf( QDir::homeDirPath() + "/.designerpid" );
	pf.open( IO_WriteOnly );
	QTextStream ts( &pf );
#if defined(Q_OS_UNIX)
	signal( SIGUSR1, signalHandler );
#endif
	ts << getpid() << endl;

	pf.close();
	signal( SIGABRT, exitHandler );
	signal( SIGFPE, exitHandler );
	signal( SIGILL, exitHandler );
	signal( SIGINT, exitHandler );
	signal( SIGSEGV, exitHandler );
	signal( SIGTERM, exitHandler );
    }

    extern void qInitImages_designercore();
    qInitImages_designercore();

    QSettings config;
    QString keybase = DesignerApplication::settingsKey();
    config.insertSearchPath( QSettings::Windows, "/Trolltech" );
    QStringList pluginPaths = config.readListEntry( keybase + "PluginPaths" );
    if (pluginPaths.count())
	QApplication::setLibraryPaths(pluginPaths);

    QSplashScreen *splash = a.showSplash();

    MainWindow *mw = new MainWindow( creatPid );
    a.setMainWidget( mw );
#if defined(QT_NON_COMMERCIAL)
    mw->setCaption( "Qt Designer by Trolltech for non-commercial use" );
#else
    mw->setCaption( "Qt Designer by Trolltech" );
#endif
    if ( config.readBoolEntry( keybase + "Geometries/MainwindowMaximized", FALSE ) ) {
	int x = config.readNumEntry( keybase + "Geometries/MainwindowX", 0 );
	int y = config.readNumEntry( keybase + "Geometries/MainwindowY", 0 );
	mw->move( x, y );
	mw->showMaximized();
    } else {
	mw->show();
    }
    if ( splash )
	splash->finish( mw );
    delete splash;

    QApplication::restoreOverrideCursor();
    for ( int i = 1; i < a.argc(); ++i ) {
	QString arg = a.argv()[ i ];
	if ( arg[0] != '-' )
	    mw->fileOpen( "", "", arg );
    }

    return a.exec();
}
Example #15
0
bool MldConfig::load()
{
#ifdef WIN32
  conf_station_name=QString("windows");
  QSettings settings;
  settings.setPath("SalemRadioLabs","CallCommander",QSettings::UserScope);
  settings.insertSearchPath(QSettings::Windows,"/SalemRadioLabs");
  conf_mysql_hostname=
    settings.value("/MysqlHostname",DEFAULT_MYSQL_HOSTNAME).toString();
  conf_mysql_username=
    settings.value("/MysqlUsername",DEFAULT_MYSQL_USERNAME).toString();
  conf_mysql_password=
    settings.value("/MysqlPassword").toString();
  conf_mysql_dbname=
    settings.value("/MysqlDatabase",DEFAULT_MYSQL_DATABASE).toString();
  conf_mysql_dbtype=
    settings.value("/MysqlServerType",DEFAULT_MYSQL_DBTYPE).toString();
  conf_details_refresh_interval=
    settings.value("/DetailsRefreshInterval",
		   ML_DEFAULT_DETAILS_REFRESH_INTERVAL).toInt();
  return true;
#else
  char sname[256];
  QString group;
  QString str;

  conf_station_name=gethostname(sname,255);

  MLProfile *profile=new MLProfile();
  profile->setSource(conf_filename);

  //
  // [Global] Section
  //
  //
  // [mySQL] Section
  //
  conf_mysql_hostname=
    profile->stringValue("mySQL","Hostname",DEFAULT_MYSQL_HOSTNAME);
  conf_mysql_username=
    profile->stringValue("mySQL","Loginname",DEFAULT_MYSQL_USERNAME);
  conf_mysql_password=
    profile->stringValue("mySQL","Password",DEFAULT_MYSQL_PASSWORD);
  conf_mysql_dbname=
    profile->stringValue("mySQL","Database",DEFAULT_MYSQL_DATABASE);
  conf_mysql_dbtype=
    profile->stringValue("mySQL","ServerType",DEFAULT_MYSQL_DBTYPE);

  //
  // [MCallMan] Section
  //
  conf_details_refresh_interval=profile->
    intValue("MCallMan","DetailsRefreshInterval",
	     ML_DEFAULT_DETAILS_REFRESH_INTERVAL);

  //
  // [Mcidmd] Section
  //
  conf_mcidmd_max_bank=profile->intValue("Mcidmd","MaxBank",MAX_BANKS);

  delete profile;
  return true;
#endif
}
Example #16
0
int main(int argc, char *argv[])
{
  QApplication::setColorSpec(QApplication::ManyColor);

  DesignerApplication a(argc, argv);

  DesignerApplication::setOverrideCursor(Qt::WaitCursor);

  bool creatPid = FALSE;
  if (a.argc() > 1) {
    QString arg1 = a.argv()[ 1 ];
    if (arg1 == "-client") {
      QFile pf(QDir::homeDirPath() + "/.designerpid");
      if (pf.exists() && pf.open(IO_ReadOnly)) {
        QString pidStr;
        pf.readLine(pidStr, pf.size());
        QFile f(QDir::homeDirPath() + "/.designerargs");
        f.open(IO_WriteOnly);
        QTextStream ts(&f);
        for (int i = 1; i < a.argc(); ++i)
          ts << a.argv()[ i ] << " ";
        ts << endl;
        f.close();
#if defined(Q_OS_UNIX)
        if (kill(pidStr.toInt(), SIGUSR1) == -1)
          creatPid = TRUE;
        else
          return 0;
#elif defined(Q_OS_WIN32)
        if (!GetProcessVersion(pidStr.toUInt())) {
          creatPid = TRUE;
        } else {
          if (a.winVersion() & Qt::WV_NT_based)
            SendMessage(HWND_BROADCAST, RegisterWindowMessage((TCHAR *)"QT_DESIGNER_OPEN_FILE"), 0, 0);
          else
            SendMessage(HWND_BROADCAST, RegisterWindowMessageA("QT_DESIGNER_OPEN_FILE"), 0, 0);
          return 0;
        }
#endif
      } else {
        creatPid = TRUE;
      }
    } else if (arg1 == "-debug_stderr") {
      extern bool debugToStderr; //outputwindow.cpp
      debugToStderr = TRUE;
    }
  }

  if (creatPid) {
    QFile pf(QDir::homeDirPath() + "/.designerpid");
    pf.open(IO_WriteOnly);
    QTextStream ts(&pf);
#if defined(Q_OS_UNIX)
    signal(SIGUSR1, signalHandler);
#endif
    ts << getpid() << endl;

    pf.close();
    signal(SIGABRT, exitHandler);
    signal(SIGFPE, exitHandler);
    signal(SIGILL, exitHandler);
    signal(SIGINT, exitHandler);
    signal(SIGSEGV, exitHandler);
    signal(SIGTERM, exitHandler);
  }

  extern void qInitImages_designercore();
  qInitImages_designercore();

  QSettings settings;
  settings.setPath("InfoSiAL", "AbanQ", QSettings::User);
  QFont appFont;
  QString keybase("AbanQ/");

#if defined (Q_OS_LINUX)
  QPaintDeviceMetrics pdm(QApplication::desktop());
  float relDpi;
  if (pdm.logicalDpiX() < pdm.logicalDpiY())
    relDpi = 78. / pdm.logicalDpiY();
  else
    relDpi = 78. / pdm.logicalDpiX();
  int pointSize = 10 * relDpi;
#else
  int pointSize = 10;
#endif

#if defined(Q_OS_WIN32)
  appFont.setFamily(settings.readEntry(keybase + "fuente/familia", "Tahoma"));
  pointSize = 8;
#else

#if defined(Q_OS_MACX)
  appFont.setFamily(settings.readEntry(keybase + "fuente/familia", "Lucida Grande"));
  pointSize = 10;
#else
  appFont.setFamily(settings.readEntry(keybase + "fuente/familia", "Sans"));
#endif

#endif

  appFont.setPointSize(settings.readNumEntry(keybase + "fuente/puntos", pointSize));
  appFont.setBold(settings.readBoolEntry(keybase + "fuente/negrita", false));
  appFont.setItalic(settings.readBoolEntry(keybase + "fuente/cursiva", false));
  appFont.setUnderline(settings.readBoolEntry(keybase + "fuente/subrayado", false));
  appFont.setStrikeOut(settings.readBoolEntry(keybase + "fuente/tachado", false));

  a.setFont(appFont);

#if defined(Q_OS_WIN32)
  a.setStyle(settings.readEntry(keybase + "estilo", "Bluecurve"));
#else
  a.setStyle(settings.readEntry(keybase + "estilo", "Plastik"));
#endif

  keybase = DesignerApplication::settingsKey();
  QSettings config;
  config.insertSearchPath(QSettings::Windows, "/Trolltech");
  QStringList pluginPaths = config.readListEntry(keybase + "PluginPaths");
  pluginPaths << QString(qApp->applicationDirPath() + "/../plugins");
  if (pluginPaths.count())
    QApplication::setLibraryPaths(pluginPaths);

  QSplashScreen *splash = a.showSplash();

  MainWindow *mw = new MainWindow(creatPid);
  a.setMainWidget(mw);
#if defined(QT_NON_COMMERCIAL)
  mw->setCaption("Qt Designer by Trolltech for non-commercial use");
#else
  mw->setCaption("Qt Designer by Trolltech");
#endif
  if (config.readBoolEntry(keybase + "Geometries/MainwindowMaximized", FALSE)) {
    int x = config.readNumEntry(keybase + "Geometries/MainwindowX", 0);
    int y = config.readNumEntry(keybase + "Geometries/MainwindowY", 0);
    mw->move(x, y);
    mw->showMaximized();
  } else {
    mw->show();
  }
  if (splash)
    splash->finish(mw);
  delete splash;

  QApplication::restoreOverrideCursor();
  for (int i = 1; i < a.argc(); ++i) {
    QString arg = a.argv()[ i ];
    if (arg[0] != '-')
      mw->fileOpen("", "", arg);
  }

  return a.exec();
}
Example #17
0
/*!
    \fn myQLoader::loadList()
 */
void myQLoader::loadList()
{
	QSettings settings;
	QDir d = QDir::home();
  
	QString s = d.absPath();
	settings.insertSearchPath( QSettings::Unix, s+"/.SCT" );
   
	//read settings
	QString boot1 = settings.readEntry(APP_KEY+"Boot");
	
	QString mount = settings.readEntry(APP_KEY+"Mount");
	
	QString keyboard1 = settings.readEntry(APP_KEY+"Keyboard");
	QString sound1 = settings.readEntry(APP_KEY+"Sound","");
	QString xserver1 = settings.readEntry(APP_KEY+"XServer","");
	QString hwinfo1 = settings.readEntry(APP_KEY+"Hardware","");
	QString printer1 = settings.readEntry(APP_KEY+"Printer","");
	QString mouse1 = settings.readEntry(APP_KEY+"Mouse","");
	QString scaner1 = settings.readEntry(APP_KEY+"Scaner","");
	
	QString ftp1 = settings.readEntry(APP_KEY+"FTPSrv","");
	QString Apache1 = settings.readEntry(APP_KEY+"WebSrv","");
	QString nfs1 = settings.readEntry(APP_KEY+"NFS","");
	QString netw1 = settings.readEntry(APP_KEY+"Network","");
	QString mail1 = settings.readEntry(APP_KEY+"MailSrv","");
	QString smb1 = settings.readEntry(APP_KEY+"SambaSrv","");
	QString dns1 = settings.readEntry(APP_KEY+"DNSSrv","");
	QString DHCP1 = settings.readEntry(APP_KEY+"DHCPSrv","");
	QString proxy = settings.readEntry(APP_KEY+"ProxySrv","");
	
	QString package1 = settings.readEntry(APP_KEY+"PackageManager","");
        
        QString sct_rpm; // = qApp->applicationDirPath();
        setAplDir(sct_rpm);
        sct_rpm += "/modules/rpm";
        QFile fi(sct_rpm);
        if(!fi.exists())
          sct_rpm = "";
        	
	QString user1 = settings.readEntry(APP_KEY+"Config_User","");
	QString root1 = settings.readEntry(APP_KEY+"Conf_Root_Psw","");
	QString servic = settings.readEntry(APP_KEY+"Conf_Service","");
	QString date = settings.readEntry(APP_KEY+"Conf_Data_Time","");
	QString Secur = settings.readEntry(APP_KEY+"Conf_Security","");
	QString syslog = settings.readEntry(APP_KEY+"ViewLog","");
	QString lang = settings.readEntry(APP_KEY+"Lang","");
  
	myInfo_modules data;	
	
	if(!boot1.isEmpty()) 
	{
	  data.description = tr("Configure your boot loader");
	  data.name = tr("boot");
	  data.group = tr("Boot config");
	  data.exec = boot1;
	  data.module = false;
	  data.pixModule = pixBootRedHat;
	  
	  addToList(data);
	}
		 
	if(!hwinfo1.isEmpty())
	{
	  data.description = tr("Listen information of your computer");
	  data.name = tr("Hardware");
	  data.group = tr("Devices");
	  data.exec = hwinfo1;
	  data.module = false;
	  data.pixModule = pixHwBrowser;
	  
	  addToList(data);
	}
 
	if(!xserver1.isEmpty())
	{
	  data.description = tr("Configure your display");
	  data.name = tr("Display");
	  data.group = tr("Devices");
	  data.exec = xserver1;
	  data.module = false;
	  data.pixModule = pixDisplay;
	  
	  addToList(data);
	}
  
	if(!sound1.isEmpty())
	{
	  data.description = tr("Configure your sound cart");
	  data.name = tr("Soundcart");
	  data.group = tr("Devices");
	  data.exec = sound1;
	  data.module = false;
	  data.pixModule = pixSoundcard;
	  
	  addToList(data);
	}
 
	if(!keyboard1.isEmpty())
	{
	  data.description = tr("Configure your keyboard");
	  data.name = tr("Keyboard");
	  data.group = tr("Devices");
	  data.exec = keyboard1;
	  data.module = false;
	  data.pixModule = pixKeyboard;
	  
	  addToList(data);
	}
  
	if(!printer1.isEmpty())
	{
	  data.description = tr("Configure your printer");
	  data.name = tr("Printer");
	  data.group = tr("Devices");
	  data.exec = printer1;
	  data.module = false;
	  data.pixModule = pixPrinter;
	  
	  addToList(data);
	}
  
	if(!scaner1.isEmpty())
	{
	  data.description = tr("Configure your scaner");
	  data.name = tr("Scaner");
	  data.group = tr("Devices");
	  data.exec = scaner1;
	  data.module = false;
	  data.pixModule = pixScaner;
	  
	  addToList(data);
	}
  
  
	if(!mouse1.isEmpty())
	{
	  data.description = tr("Configure your mouse");
	  data.name = tr("Mouse");
	  data.group = tr("Devices");
	  data.exec = mouse1;
	  data.module = false;
	  data.pixModule = pixMouse;
	  
	  addToList(data);
	}
	
	if(!mount.isEmpty())
	{
	  data.description = tr("Your mount manager");
	  data.name = tr("Mount Points");
	  data.group = tr("Hard Disk");
	  data.exec = mount;
	  data.module = false;
	  data.pixModule = pixRedHatUserMount;
	  
	  addToList(data);
	} 
	
	if(!netw1.isEmpty()){
	  data.description = tr("Configure your network");
	  data.name = tr("Network");
	  data.group = tr("Network");
	  data.exec = netw1;
	  data.module = false;
	  data.pixModule = pixNet;
	  
	  addToList(data);
	}
   
	if(!Apache1.isEmpty()){
	  data.description = tr("Configure Web server");
	  data.name = tr("Web Server");
	  data.group = tr("Network");
	  data.exec = Apache1;
	  data.module = false;
	  data.pixModule = pixHTTP;
	  
	  addToList(data);
	}
  
	if(!smb1.isEmpty()){
	  data.description = tr("Configure Samba server");
	  data.name = tr("Samba");
	  data.group = tr("Network");
	  data.exec = smb1;
	  data.module = false;
	  data.pixModule = pixSamba;
	  
	  addToList(data);
	}
 
	if(!nfs1.isEmpty()){
	  data.description = tr("Configure NFS server");
	  data.name = tr("NFS");
	  data.group = tr("Network");
	  data.exec = nfs1;
	  data.module = false;
	  data.pixModule = pixNFS;
	  
	  addToList(data);
	}
  
	if(!ftp1.isEmpty()){
	  data.description = tr("Configure FTP server");
	  data.name = tr("FTP");
	  data.group = tr("Network");
	  data.exec = ftp1;
	  data.module = false;
	  data.pixModule = pixFTP;
	  
	  addToList(data);
	}
  
	if(!mail1.isEmpty()){
	  data.description = tr("Configure mail in your computer");
	  data.name = tr("Mail");
	  data.group = tr("Network");
	  data.exec = mail1;
	  data.module = false;
	  data.pixModule = pixMail;
	  
	  addToList(data);
	}
  
	if(!dns1.isEmpty()){
	  data.description = tr("Configure DNS Server");
	  data.name = tr("DNS");
	  data.group = tr("Network");
	  data.exec = dns1;
	  data.module = false;
	  data.pixModule = pixDNS;
	  
	  addToList(data);
	}
  
	if(!DHCP1.isEmpty()){
	  data.description = tr("Configure DHCP Server");
	  data.name = tr("DHCP");
	  data.group = tr("Network");
	  data.exec = DHCP1;
	  data.module = false;
	  data.pixModule = pixDHCP;
	  
	  addToList(data);
	}
  
	if(!proxy.isEmpty()){
	  data.description = tr("Configure Proxy");
	  data.name = tr("Proxy");
	  data.group = tr("Network");
	  data.exec = proxy;
	  data.module = false;
	  data.pixModule = pixProxy;
	  
	  addToList(data);
	}
	  
	if(!package1.isEmpty())
	{
	  data.description = tr("Your package manager");
	  data.name = tr("Packages");
	  data.group = tr("Software");
	  data.exec = package1;
	  data.module = false;
	  data.pixModule = pixPackage;
	  
	  addToList(data);
	}
        
        if(!sct_rpm.isEmpty())
        {
          data.description = tr("(Add packages)");
          data.name = tr("Add rpm");
          data.group = tr("Software");
          data.exec = sct_rpm+" -i";
          data.module = false;
          data.pixModule = pixRpm_add;
	  
          addToList(data);
          
          data.description = tr("(Remove packages)");
          data.name = tr("Remove rpm");
          data.group = tr("Software");
          data.exec = sct_rpm;
          data.module = false;
          data.pixModule = pixRpm_rem;
	  
          addToList(data);
        }
		
	if(!user1.isEmpty()){
	  data.description = tr("Configure users or groups in your computer");
	  data.name = tr("Users and Groups");
	  data.group = tr("System");
	  data.exec = user1;
	  data.module = false;
	  data.pixModule = pixUserConfig;
	  
	  addToList(data);  
	}
  
	if(!date.isEmpty()){
	  data.description = tr("Configure date and time");
	  data.name = tr("Date and Time");
	  data.group = tr("System");
	  data.exec = date;
	  data.module = false;
	  data.pixModule = pixDateTime;
	  
	  addToList(data);
	}
  
	if(!syslog.isEmpty()){
	  data.description = tr("Listen System Log files");
	  data.name = tr("Sys Log");
	  data.group = tr("System");
	  data.exec = syslog;
	  data.module = false;
	  data.pixModule = pixSysLog;
	  
	  addToList(data);
	}
  
	if(!servic.isEmpty()){ 
	  data.description = tr("Configure Services in your Computer");
	  data.name = tr("Services");
	  data.group = tr("System");
	  data.exec = servic;
	  data.module = false;
	  data.pixModule = pixServicess;
	  
	  addToList(data);
	}
  
	if(!root1.isEmpty()){
	  data.description = tr("Change root password");
	  data.name = tr("Root Password");
	  data.group = tr("System");
	  data.exec = root1;
	  data.module = false;
	  data.pixModule = pixRoot;
	  
	  addToList(data);
	}
  
	if(!Secur.isEmpty()){
	  data.description = tr("Configure Security in your Computer");
	  data.name = tr("Security");
	  data.group = tr("System");
	  data.exec = Secur;
	  data.module = false;
	  data.pixModule = pixSequrytiLevel;
	  
	  addToList(data);
	}
  	
	if(!lang.isEmpty()){
	  data.description = tr("Select languange in your computer");
	  data.name = tr("Language");
	  data.group = tr("System");
	  data.exec = lang;
	  data.module = false;
	  data.pixModule = pixLang;
	  
	  addToList(data);
	}
}