Example #1
0
// Read properties from the settings.
bool QsciLexerD::readProperties(QSettings &qs,const QString &prefix)
{
    int rc = true;

    bool ok, flag;

    flag = qs.readBoolEntry(prefix + "foldatelse", false, &ok);

    if (ok)
        fold_atelse = flag;
    else
        rc = false;

    flag = qs.readBoolEntry(prefix + "foldcomments", false, &ok);

    if (ok)
        fold_comments = flag;
    else
        rc = false;

    flag = qs.readBoolEntry(prefix + "foldcompact", true, &ok);

    if (ok)
        fold_compact = flag;
    else
        rc = false;

    return rc;
}
Example #2
0
RosterBox::RosterBox( QWidget* parent, const char* name )
	: QListView( parent, name ), QToolTip( viewport() )
{
	QSettings settings;
	settings.setPath( "qtlen.sf.net", "QTlen" );
	
	settings.beginGroup( "/look" );
	
	header()->hide();
	
	setResizeMode( QListView::AllColumns );
	addColumn( QString::null );
	setTreeStepSize( 5 );
	
	setPaletteBackgroundColor( (QColor)settings.readEntry( "/roster/background", "#eeeeee" ) );
	setPaletteForegroundColor( (QColor)settings.readEntry( "/roster/foreground", "#000000" ) );
	
	setSorting( -1 );
	
	connect( roster_manager, SIGNAL( refreshContext() ),
			this, SLOT( refreshContext() ) );
	
	connect( this, SIGNAL( clicked( QListViewItem * ) ),
			SLOT( clicked( QListViewItem * ) ) );
	connect( this, SIGNAL( doubleClicked( QListViewItem *, const QPoint &, int ) ),
			SLOT( doubleClicked( QListViewItem *, const QPoint &, int ) ) );
	connect( this, SIGNAL( contextMenuRequested( QListViewItem *, const QPoint &, int ) ),
			SLOT( contextMenuRequested( QListViewItem *, const QPoint &, int ) ) );
	
	connect( this, SIGNAL( itemRenamed(QListViewItem *, int, const QString &) ),
			SLOT( itemRenamed(QListViewItem *, int, const QString &) ) );
	
	menu = new QPopupMenu( this );
	menu->insertItem( QIconSet( takePixmap( "msg" ) ), tr( "New &message" ),  this, SLOT( newMessage() ), CTRL+Key_M );
	menu->insertItem( QIconSet( takePixmap( "msg-chat" ) ), tr( "New &chat" ),  this, SLOT( newChatMessage() ), CTRL+Key_C );
	menu->insertSeparator();
	menu->insertItem( QIconSet( takePixmap( "edit" ) ), tr( "Edit contact" ),  this, SLOT( edit() ) );
	menu->insertItem( QIconSet( takePixmap( "find" ) ), tr( "Check in pubdir" ),  this, SLOT( pubdir() ) );
	menu->insertSeparator();
	menu->insertItem( QIconSet( takePixmap( "rename" ) ), tr( "Rename contect" ),  this, SLOT( rename() ) );
	menu->insertItem( QIconSet( takePixmap( "delete" ) ), tr( "Remove contect" ),  this, SLOT( remove() ) );
	
	settings.endGroup();
	
	settings.beginGroup( "/roster" );
	
	setShowOffline( settings.readBoolEntry( "/showOffline", true ) );
	setShowAway( settings.readBoolEntry( "/showAway", true ) );
	
	settings.endGroup();
}
void QCPPDialogImpl::readSettings()
{
   QSettings settings;
   m_hardwareCb->setChecked(settings.readBoolEntry("/cutecom/HardwareHandshake", false));
   m_softwareCb->setChecked(settings.readBoolEntry("/cutecom/SoftwareHandshake", false));
   m_readCb->setChecked(settings.readBoolEntry("/cutecom/OpenForReading", true));
   m_writeCb->setChecked(settings.readBoolEntry("/cutecom/OpenForWriting", true));

   m_applyCb->setChecked(!settings.readBoolEntry("/cutecom/DontApplySettings", false));
   enableSettingWidgets(m_applyCb->isChecked());

   m_baudCb->setCurrentItem(settings.readNumEntry("/cutecom/Baud", 7));
   m_dataBitsCb->setCurrentItem(settings.readNumEntry("/cutecom/Databits", 3));
   m_parityCb->setCurrentItem(settings.readNumEntry("/cutecom/Parity", 0));
   m_stopCb->setCurrentItem(settings.readNumEntry("/cutecom/Stopbits", 0));
   m_protoPb->setCurrentItem(settings.readNumEntry("/cutecom/Protocol", 0));

   m_inputModeCb->setCurrentItem(settings.readNumEntry("/cutecom/LineMode", 0));
   m_hexOutputCb->setChecked(settings.readBoolEntry("/cutecom/HexOutput", false));
   m_charDelaySb->setValue(settings.readNumEntry("/cutecom/CharDelay", 1));

   m_sendFileDialogStartDir=settings.readEntry("/cutecom/SendFileDialogStartDir", QDir::homeDirPath());
   m_logFileLe->setText(settings.readEntry("/cutecom/LogFileName", QDir::homeDirPath()+"/cutecom.log"));

   m_logAppendCb->setCurrentItem(settings.readNumEntry("/cutecom/AppendToLogFile", 0));

   int x=settings.readNumEntry("/cutecom/width", -1);
   int y=settings.readNumEntry("/cutecom/height", -1);
   if ((x>100) && (y>100))
      resize(x,y);

   bool entryFound=false;
   QStringList devices=settings.readListEntry("/cutecom/AllDevices", &entryFound);
   if (!entryFound)
      devices<<"/dev/ttyS0"<<"/dev/ttyS1"<<"/dev/ttyS2"<<"/dev/ttyS3";

   m_deviceCb->insertStringList(devices);

   m_deviceCb->setCurrentText(settings.readEntry("/cutecom/CurrentDevice", "/dev/ttyS0"));

   QStringList history=settings.readListEntry("/cutecom/History");

   if (!history.empty())
   {
      m_oldCmdsLb->insertStringList(history);
      m_oldCmdsLb->setCurrentItem(m_oldCmdsLb->count()-1);
      m_oldCmdsLb->ensureCurrentVisible();
      m_oldCmdsLb->clearSelection();
   }
}
Example #4
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..." );
    }
}
Example #5
0
// Read properties from the settings.
bool QsciLexerCPP::readProperties(QSettings &qs,const QString &prefix)
{
    int rc = true;

    bool ok, flag;

    flag = qs.readBoolEntry(prefix + "foldatelse", false, &ok);

    if (ok)
        fold_atelse = flag;
    else
        rc = false;

    flag = qs.readBoolEntry(prefix + "foldcomments", false, &ok);

    if (ok)
        fold_comments = flag;
    else
        rc = false;

    flag = qs.readBoolEntry(prefix + "foldcompact", true, &ok);

    if (ok)
        fold_compact = flag;
    else
        rc = false;

    flag = qs.readBoolEntry(prefix + "foldpreprocessor", true, &ok);

    if (ok)
        fold_preproc = flag;
    else
        rc = false;

    flag = qs.readBoolEntry(prefix + "stylepreprocessor", false, &ok);

    if (ok)
        style_preproc = flag;
    else
        rc = false;

    flag = qs.readBoolEntry(prefix + "dollars", true, &ok);

    if (ok)
        dollars = flag;
    else
        rc = false;

    flag = qs.readBoolEntry(prefix + "highlighttriple", false, &ok);

    if (ok)
        highlight_triple = flag;
    else
        rc = false;

    return rc;
}
//
// ReportGridOptions method implementations
//
ReportGridOptions::ReportGridOptions(int rdx, int rdy, QObject * parent, const char * name)
  : QObject(parent, name) {
    QSettings settings;
    settings.setPath("OpenMFG.com", "OpenReports", QSettings::UserScope);
    show_grid = settings.readBoolEntry("/OpenMFG/rwShowGrid", FALSE);
    snap_grid = settings.readBoolEntry("/OpenMFG/rwSnapGrid", FALSE);
    _realDpiX = rdx;
    _realDpiY = rdy;
    setXInterval(settings.readDoubleEntry("/OpenMFG/rwXGridInterval",0.05));
    setYInterval(settings.readDoubleEntry("/OpenMFG/rwYGridInterval",0.05));
}
Example #7
0
void RcFile::loadData (Parm name, bool &value)
{ 
  QString k;
  k.append("/Qtstalker/");
  k.append(Key[name]);

  if (Def[name] == "TRUE") value = TRUE;
  else value = FALSE;
  
  QSettings settings;
  value = settings.readBoolEntry(k, value);
}
Example #8
0
QTlen::QTlen( QWidget *parent, const char *name )
	: QMainWindow( parent, name ),
	  v_tray( false ),
	  v_quit( false )
{
	QSettings settings;
	settings.setPath( "qtlen.berlios.de", "QTlen" );
	
	settings.beginGroup( "/window" );
	
	setGeometry( settings.readNumEntry( "/main/xpos", 50 ),
		     settings.readNumEntry( "/main/ypos", 50 ),
		     settings.readNumEntry( "/main/width", 225 ),
		     settings.readNumEntry( "/main/height", 450 ) );
	
	settings.resetGroup();
	
	PresenceManager::initModule();
	Tlen::initModule();
	MessageManager::initModule();
	RosterManager::initModule();
	
	PubdirManager::initModule();
	
	SoundManager::initModule();
	
	setCaption( "QTlen: "+tlen_manager->getJid() );
	setIcon( takePixmap("offline") );
	
	settings.beginGroup( "/general" );
	
	roster = new RosterBox( this );
	
	setCentralWidget( roster );
	
	addToolBars();
	
	if( settings.readBoolEntry( "/trayicon/activated" ) )
		activeTrayIcon();
	else
		v_quit = true;
	
	settings.resetGroup();
	
	connect( presence_manager, SIGNAL( statusChanged( PresenceManager::PresenceStatus, const QString& ) ),
			SLOT( statusChanged( PresenceManager::PresenceStatus, const QString& ) ) );
	
	connect( tlen_manager, SIGNAL( connecting() ), SLOT( connecting() ) );
}
Example #9
0
QString RosterBoxItem::expandTemplate( int )
{
	QSettings settings;
	settings.setPath( "qtlen.sf.net", "QTlen" );
	
	settings.beginGroup( "/look" );
	
	QString t = QString::null;
	
	if( settings.readBoolEntry( "/descriptionUnderContact", false ) )
	{
		t += QString( "<nobr>%1</nobr>" ).arg( text( 0 ) );
		if( !roster_manager->getContactDescription( text( 2 ) ).isEmpty() )
			t += QString( "<br><font size=\"-1\">%1</font>" ).arg( plain2rich( roster_manager->getContactDescription( text( 2 ) ) ) );
	}
	
	return t;
}
Example #10
0
void RosterBox::maybeTip( const QPoint &pos )
{
	QSettings settings;
	settings.setPath( "qtlen.sf.net", "QTlen" );
	
	settings.beginGroup( "/look" );
	
	if( !settings.readBoolEntry( "/showToolTip", true ) )
		return;
	
	QListViewItem* item = itemAt( pos );
	if( item )
	{
		QRect r(itemRect(item));
		QString s;
		
		if( item->text( 1 ) == "item" )
		{
			s += item->text( 2 );
			if( !roster_manager->getContactDescription( item->text( 2 ) ).isEmpty() )
			{
				s += "<br><hr>";
				s += plain2rich( roster_manager->getContactDescription( item->text( 2 ) ) );
			}
		}
		else if( item->text( 1 ) == "group" )
		{
			s += tr( "Group: " );
			s += item->text( 0 );
		}
		
		tip( r, s );
	}
	
	settings.endGroup();
}
Example #11
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 #12
0
QCString MIMECodec::encodeQuotedPrintable(const QCString &str, bool compat, bool footer)
{
  if (str.isEmpty() || !str.length())
    return "";

  const int wrap = 76;
  int i;
  QCString prestr = str;
  QSettings sett;
  bool addFooter = sett.readBoolEntry(AQ_KEYBASE + "/email/addFooter", true);
  qWarning(AQ_KEYBASE + "/email/addFooter");
  qWarning("addFooter %d", addFooter);
  if (footer && addFooter) {
    sett.setPath("InfoSiAL", "AbanQ", QSettings::User);
    QString filepre(sett.readEntry(AQ_KEYBASE + "/email/footerText",
                                   AQ_DATA + "/text_mail.txt"));
    if (filepre.isEmpty()) {
      sett.setPath("InfoSiAL", "FacturaLUX", QSettings::User);
      filepre = sett.readEntry("/facturalux/lite/email/footerText",
                               AQ_DATA + "/text_mail.txt");
    }
    QFile fipre(filepre);
    if (fipre.exists() && fipre.open(IO_ReadOnly)) {
      QTextStream t(&fipre);
      QCString pretxt = t.read().local8Bit();
      fipre.close();
      if (!pretxt.isEmpty())
        prestr += "\n" + pretxt;
    } else
      for (i = 0; i < 257; i++) prestr += preencode[i];
  }
  QCString outstr;
  unsigned uLength = prestr.length();
  const char *ptrStr = prestr.data();
  outstr.resize(uLength);
  outstr[0] = 0;
  unsigned index = 0, lindex = 0;
  char c = 0, c1 = 0, c2 = 0, c3 = 0;

  while (index < uLength) {
    c = ptrStr[index++];

    if (((c >= 33 && c <= 60) || (c >= 62 && c <= 126) || c == 9 || c == 32) &&
        !(compat && QCString("!\"#@[\\]^`{|}~").find(c) != -1)) {
      outstr += c;
      lindex++;
    } else {
      char h1 = (c & 240) / 16, h2 = c & 15;

      h1 = h1 < 10 ? h1 + '0' : h1 - 10 + 'A';
      h2 = h2 < 10 ? h2 + '0' : h2 - 10 + 'A';
      outstr += '=';
      outstr += h1;
      outstr += h2;
      lindex += 3;
    }

    c1 = index   < uLength ? ptrStr[index]   : 'a';
    c2 = index + 1 < uLength ? ptrStr[index + 1] : 'a';
    c3 = index + 2 < uLength ? ptrStr[index + 2] : 'a';

    if (lindex == wrap - 1 || ((c1 < 33 || (c1 > 60 && c1 < 62) || c1 > 126 || (compat && QCString("!\"#@[\\]^`{|}~").find(c1) != -1) ||
                                c2 < 33 || (c2 > 60 && c2 < 62) || c2 > 126 || (compat && QCString("!\"#@[\\]^`{|}~").find(c2) != -1) ||
                                c3 < 33 || (c3 > 60 && c3 < 62) || c3 > 126 || (compat && QCString("!\"#@[\\]^`{|}~").find(c3) != -1)) && lindex == wrap - 3)) {
      outstr += "=\r\n";
      lindex = 0;
    }
  }

  return outstr;
}
Example #13
0
int main( int argc, char ** argv ) {
	QApplication a( argc, argv );

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

	a.setLibraryPaths( FLPREFIX "/plugins" );

#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

	if ( argc <= 1 ) {
		Teddy *mw = new Teddy();
		mw->setCaption( "Teddy" );
		mw->show();
	}
	else {
		for (int i = 1; i < argc; i++) {
			Teddy *mw = new Teddy();
			mw->load( argv[i] );
			mw->show();
		}
	}

	a.connect( &a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()) );
	return a.exec();
}
Example #14
0
bool Config::completion( const QString &path )
{
    QSettings settings;
    bool ret = settings.readBoolEntry( path + QString::fromLatin1("/completion"), TRUE );
    return ret;
}
void OptionHandler::reloadSettings() {
	// gather options...
        QSettings config;
        config.beginGroup("/baghira/Style");
	//we need that first to make sure we use some proper settings ;)
	customButtonColor = QColor(config.readNumEntry("Design_ButtonColor",(int)qApp->palette().active().button().rgb()));
        // design handling:
        // first try file:
        QString tmpString;
        FILE *file = NULL;
        wmDesign = 5;
         for (int i = 0; i < 8; i++)
            custCols[i] = -1;
        if (qstrcmp( qApp->argv() [ 0 ], "ksplash" ) == 0)
        {
            style_ = Panther;
            _toolbuttonStyle = Panther;
            _buttonStyle = Panther;
            tabStyle_ = Clever;
            bgStipple = false;
            inactiveButtonColor = Background;
        }
        else
        {
        // first try for a tmp file from bab starter
         int tmpFile = 0;
         tmpString = QDir::homeDirPath() + "/.baghira/.bab/" + qApp->argv() [ 0 ];
         file = fopen(tmpString.latin1(), "r");
         if( file == NULL )
         {
            tmpFile = 1;
            tmpString = QDir::homeDirPath() + "/.baghira/" + qApp->argv() [ 0 ];
            file = fopen(tmpString.latin1(), "r");
            if( file == NULL )
            {
               tmpFile = 2;
               tmpString = QDir::homeDirPath() + "/.baghira/.bab/.style";
               file = fopen(tmpString.latin1(), "r");
            }
         }
         if (file != NULL)
         {
            style_ = _buttonStyle = _toolbuttonStyle = Panther; int i3 = inactiveButtonColor = -1; tabStyle_ = (tabStyle)-1;
            fscanf(file,"%u\n%u\n%u\n%u\n%u\n%u\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n",&style_, &wmDesign, &_buttonStyle, &_toolbuttonStyle, &tabStyle_, &i3, &custCols[0], &custCols[1], &custCols[2], &custCols[3], &custCols[4], &custCols[5], &custCols[6], &custCols[7], &inactiveButtonColor);
            fclose(file);
            if (_toolbuttonStyle < 0 || _toolbuttonStyle >= NUMSTYLES)
               _toolbuttonStyle = (Style)config.readNumEntry( "Special_ToolbuttonStyle", style_);
            if (_buttonStyle < 0 || _buttonStyle >= NUMSTYLES)
               _buttonStyle = (Style)config.readNumEntry( "Special_ButtonStyle", style_);
            if (tabStyle_ < 0 || tabStyle_ > 2)
               tabStyle_ = (tabStyle) config.readNumEntry( (style_ == Brushed)?"Design_TabStyleBrushed":"Design_TabStyleAqua", Clever);
            if (inactiveButtonColor < 0 || inactiveButtonColor > 3)
               inactiveButtonColor = config.readNumEntry( "Design_InactiveButtonStyle", Background);
            if (style_ == Brushed)
               bgStipple = TRUE;
            else if (i3 == 0)
               bgStipple = FALSE;
            else
               bgStipple = config.readBoolEntry( "Design_StippleBackground", true );
            	// inactive Button
            if (tmpFile == 0)
               remove(tmpString.latin1()); // remove TEMPORARY file
            else if (tmpFile == 2)
            {
               tmpString = QDir::homeDirPath() + "/.baghira/.bab/.deco";
               if ((file = fopen(tmpString.latin1(), "r")) != NULL)
               {
                  fscanf(file,"%u\n%u\n",&i3, &wmDesign);
                  fclose(file);
               }
            }
         }
         else
         {
            style_ = (Style)config.readNumEntry( "Design_Default", Panther );
            _toolbuttonStyle = (Style)config.readNumEntry( "Special_ToolbuttonStyle", style_);
            _buttonStyle = (Style)config.readNumEntry( "Special_ButtonStyle", style_);
            tabStyle_ = (tabStyle) config.readNumEntry( (style_ == Brushed)?"Design_TabStyleBrushed":"Design_TabStyleAqua", Clever);
            bgStipple = (style_ == Brushed) ? true : config.readBoolEntry( "Design_StippleBackground", true );
            inactiveButtonColor = config.readNumEntry( "Design_InactiveButtonStyle", Background);
         }
        }
        contrast = 0;
        if (wmDesign > 4)
           wmDesign = style_;
        if (style_ == Jaguar)
            contrast = 4;
        else if (style_ == Brushed)
            {
            tintBrush = config.readBoolEntry( "Colors_TintBrushedMetal", false );
            if (tintBrush)
                brushTint.setRgb( config.readNumEntry( "Colors_BrushTint", ( int ) bgColor().rgb()));
            }
	// menu stuff
   glossyMenus_ = config.readBoolEntry( "Menu_Glossy", true );
        menuBackground = config.readNumEntry( "Menu_Background", Standard);
	menuOpacity = config.readNumEntry( "Menu_Opacity", 70);
        int menuColorStyle = config.readNumEntry( "Menu_ColorStyle", 0);
        menuColorButton = (menuColorStyle == 1);
        useCustomMenuColor = (menuColorStyle == 2);
	shadowText = config.readBoolEntry( "Menu_ShadowText", false);
	if (useCustomMenuColor){
		color = QColor( config.readNumEntry( "Menu_Color1", 0 ) );
                color2 = QColor( config.readNumEntry( "Menu_Color2", 0 ) );
                colorHigh = QColor( config.readNumEntry( "Menu_ColorHighlight", 0 ) );
		fgColor = QColor( config.readNumEntry( "Menu_TextColor", 0 ) );
                fgColorHigh = QColor( config.readNumEntry( "Menu_TextColorHighlight", 0 ) );
	}
        else if (menuColorButton){
            color = customButtonColor;
            color2 = customButtonColor.dark(130);
        }
        else {
            color = qApp->palette().active().background();
            color2 = qApp->palette().active().background().dark(130);
        }
        drawMenuStripe_ = config.readBoolEntry("Menu_DrawMenuStripe", false);
        if (drawMenuStripe_)
            menuStripeColor_ = QColor(config.readNumEntry("Menu_StripeColor"),(int)Qt::white.rgb());
	// color stuff
	// widgets
	customWidgetColor  =  config.readBoolEntry( "Colors_UseCustomColors", false);
	if ( customWidgetColor ) {
		customColors[ CustomRadioOn ].setRgb( config.readNumEntry( "Colors_RadioOn", ( int ) buttonColor().rgb() ) );
		customColors[ CustomRadioOff ].setRgb( config.readNumEntry( "Colors_RadioOff", ( int ) bgColor().rgb() ) );
		customColors[ CustomCBOn ].setRgb( config.readNumEntry( "Colors_CheckOn", ( int ) buttonColor().rgb() ) );
		customColors[ CustomCBOff ].setRgb( config.readNumEntry( "Colors_CheckOff", ( int ) bgColor().rgb() ) );
		customColors[ CustomTabOn ].setRgb( config.readNumEntry( "Colors_TabActive", ( int ) buttonColor().rgb() ) );
		customColors[ CustomTabOff ].setRgb( config.readNumEntry( "Colors_TabInactive", ( int ) bgColor().rgb() ) );
		customColors[ CustomSBSlider ].setRgb( config.readNumEntry( "Colors_Slider", ( int ) bgColor().rgb() ) );
		customColors[ CustomSBSliderHover ].setRgb( config.readNumEntry( "Colors_SliderHovered", ( int ) buttonColor().rgb() ) );
		customColors[ CustomSBSliderPressed ].setRgb( config.readNumEntry( "Colors_SliderPressed", ( int ) buttonColor().dark(110).rgb() ) );
		customColors[ CustomSBGroove ].setRgb( config.readNumEntry( "Colors_SliderGroove", ( int ) bgColor().rgb() ) );
	}
   if (inactiveButtonColor == Custom)
      customInactiveButtonColor = QColor( config.readNumEntry( "Design_InactiveButtonColor", (int) bgColor().rgb()));
	contrast += config.readNumEntry( "Design_StippleContrast", 3);
        bevelHighlights_ = config.readBoolEntry( "Design_BevelAsHighlight", true);
	//shadows
groupboxshadow = (style_ == Brushed) ? false : config.readBoolEntry( "Design_ShadowGroupBoxes", true );
	shadowDarkness = config.readNumEntry( "Design_GroupBoxeShadowDarkness", 6);
	//ListViews
	expanderStyle = config.readNumEntry( "Special_ExpanderStyle", Apple);
	useCustomExpanderColor = config.readBoolEntry( "Special_CustomExpanderColor", false);
	if (useCustomExpanderColor)
		expanderColor = QColor( config.readNumEntry( "Special_ExpanderColor", (int) qApp->palette().active().text().rgb()));
	drawDotlines = config.readBoolEntry( "Special_DrawTreeLines", true);
	if (drawDotlines){
		dotlineStyle = config.readNumEntry( "Special_TreelineStyle", Line);
		dotlineColor = QColor( config.readNumEntry( "Special_TreelineColor", (int) qApp->palette().active().mid().rgb()));
	}
	//slider
	squeezesbslider = config.readBoolEntry( "Special_SqueezeSlider", false );
	shadowsbslider = config.readBoolEntry( "Special_ShadowSlider", false );
	animateSlider = config.readBoolEntry( "Special_AnimateSlider", true );
	// toolbar
        int utb = config.readNumEntry( "Special_UnhoveredToolButtons", 2 );
   tbFrame = (utb == 2) || ((style_ == Brushed) && (utb == 1)) || ((style_ != Brushed) && (utb == 0));

	// tweaks
	centerTabs = config.readBoolEntry( "Design_CenterTabs", true);
	smoothListViewHeaders = (style_ == Milk) ? true : !config.readBoolEntry( "Special_UseFlatLVH", false);
	smootherLVH = config.readBoolEntry( "Special_RoundTaskbuttons", false);
	icyButtons = config.readNumEntry( "Design_ButtonStyle", 0) == 0;
	progressBar = config.readNumEntry( "Special_ProgressStyle", baghira);
	removeKickerBevel = config.readBoolEntry( "Special_RemoveKickerBevel", false);
         animateButton = config.readBoolEntry( "Design_AnimateButtons", true);
      animateProgress = config.readBoolEntry( "Design_AnimateProgress", true);
	drawProgressLabel = config.readBoolEntry( "Special_ShowProgressValue", false);
   config.endGroup();
   
   config.beginGroup("/baghira/Deco");
   titleButtonColor_[0] = QColor((unsigned int)config.readNumEntry( "CloseButtonColor", QColor(200,85,70).rgb()));
   titleButtonColor_[1] = QColor((unsigned int)config.readNumEntry( "MinButtonColor", QColor(230,155,40).rgb()));
   titleButtonColor_[2] = QColor((unsigned int)config.readNumEntry( "MaxButtonColor", QColor(121,180,54).rgb()));
   if (style_ == Jaguar)
   {
      titleColor_[0] = QColor((unsigned int)config.readNumEntry( "inactiveColor1_1", QColor(204,214,230).rgb()));
      titleColor_[1] = QColor((unsigned int)config.readNumEntry( "inactiveColor2_1", QColor(194,196,211).rgb()));
   }
   else if (style_ != Brushed)
   {
      titleColor_[0] = QColor((unsigned int)config.readNumEntry( "activeColor1_2", QColor(238,238,238).rgb()));
      titleColor_[1] = QColor((unsigned int)config.readNumEntry( "activeColor2_2", QColor(205,202,205).rgb()));
   }
   if (style_ == Tiger)
   {
      int r,g,b;
      aDecoColor1_ = QColor((unsigned int)config.readNumEntry( "activeColor2_4", (unsigned int) QColor(205,202,205).rgb()));
      aDecoColor2_ = QColor((unsigned int)config.readNumEntry( "activeColor1_4", (unsigned int) QColor(238,238,238).rgb()));
      r = (int)CLAMP(aDecoColor1_.red() * pow((double)aDecoColor1_.red() / (double)aDecoColor2_.red(),2.0),0,255);
      g = (int)CLAMP(aDecoColor1_.green() * pow((double)aDecoColor1_.green() / (double)aDecoColor2_.green(),2.0),0,255);
      b = (int)CLAMP(aDecoColor1_.blue() * pow((double)aDecoColor1_.blue() / (double)aDecoColor2_.blue(),2.0),0,255);
      aDecoColor2_.setRgb(r,g,b);
   }
   else
   {
      aDecoColor1_ = Qt::black;
      aDecoColor2_ = Qt::black;
   }
   config.endGroup();
	// Option gathered
	}
Example #16
0
bool Config::wordWrap( const QString &path )
{
    QSettings settings;
    bool ret = settings.readBoolEntry( path + QString::fromLatin1("/wordWrap"), TRUE );
    return ret;
}
Example #17
0
QMap<QString, ConfigStyle> Config::readStyles( const QString &path )
{
    QMap<QString, ConfigStyle> styles;
    styles = defaultStyles();

    QString family;
    int size = 10;
    bool bold = FALSE, italic = FALSE, underline = FALSE;
    int red = 0, green = 0, blue = 0;

    QString elements[] = {
	QT_TR_NOOP( QString::fromLatin1("Comment") ),
	QT_TR_NOOP( QString::fromLatin1("Number") ),
	QT_TR_NOOP( QString::fromLatin1("String") ),
	QT_TR_NOOP( QString::fromLatin1("Type") ),
	QT_TR_NOOP( QString::fromLatin1("Keyword") ),
	QT_TR_NOOP( QString::fromLatin1("Preprocessor") ),
	QT_TR_NOOP( QString::fromLatin1("Label") ),
	QT_TR_NOOP( QString::fromLatin1("Standard") ),
	QString::null
    };

    for ( int i = 0; elements[ i ] != QString::null; ++i ) {
	QSettings settings;
	bool ok = TRUE;
	for (;;) {
	    family = settings.readEntry( path + elements[ i ] + "/family", QString::null, &ok );
	    if ( !ok )
		break;
	    size = settings.readNumEntry( path + elements[ i ] + "/size", 10, &ok );
	    if ( !ok )
		break;
	    bold = settings.readBoolEntry( path + elements[ i ] + "/bold", FALSE, &ok );
	    if ( !ok )
		break;
	    italic = settings.readBoolEntry( path + elements[ i ] + "/italic", FALSE, &ok );
	    if ( !ok )
		break;
	    underline = settings.readBoolEntry( path + elements[ i ] + "/underline", FALSE, &ok );
	    if ( !ok )
		break;
	    red = settings.readNumEntry( path + elements[ i ] + "/red", 0, &ok );
	    if ( !ok )
		break;
	    green = settings.readNumEntry( path + elements[ i ] + "/green", 0, &ok );
	    if ( !ok )
		break;
	    blue = settings.readNumEntry( path + elements[ i ] + "/blue", 0, &ok );
	    if ( !ok )
		break;
	    break;
	}
	if ( !ok )
	    continue;
	QFont f( family );
	f.setPointSize( size );
	f.setBold( bold );
	f.setItalic( italic );
	f.setUnderline( underline );
	QColor c( red, green, blue );
	ConfigStyle s;
	s.font = f;
	s.color = c;
	styles.remove( elements[ i ] );
	styles.insert( elements[ i ], s );
    }
    return styles;
}
Example #18
0
bool Config::indentAutoIndent( const QString &path )
{
    QSettings settings;
    bool ret = settings.readBoolEntry( path + QString::fromLatin1("/indentAutoIndent"), TRUE );
    return ret;
}
Example #19
0
bool Config::parenMatching( const QString &path )
{
    QSettings settings;
    bool ret = settings.readBoolEntry( path + QString::fromLatin1("/parenMatching"), TRUE );
    return ret;
}
Example #20
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 #21
0
void KCMStyle::loadEffects( KConfig& config )
{
	// Load effects.
	config.setGroup("KDE");

	cbEnableEffects->setChecked( config.readBoolEntry( "EffectsEnabled", false) );

	if ( config.readBoolEntry( "EffectAnimateCombo", false) )
		comboComboEffect->setCurrentItem( 1 );
	else
		comboComboEffect->setCurrentItem( 0 );

	if ( config.readBoolEntry( "EffectAnimateTooltip", false) )
		comboTooltipEffect->setCurrentItem( 1 );
	else if ( config.readBoolEntry( "EffectFadeTooltip", false) )
		comboTooltipEffect->setCurrentItem( 2 );
	else
		comboTooltipEffect->setCurrentItem( 0 );

	if ( config.readBoolEntry( "EffectAnimateMenu", false) )
		comboMenuEffect->setCurrentItem( 1 );
	else if ( config.readBoolEntry( "EffectFadeMenu", false) )
		comboMenuEffect->setCurrentItem( 2 );
	else
		comboMenuEffect->setCurrentItem( 0 );

	comboMenuHandle->setCurrentItem(config.readNumEntry("InsertTearOffHandle", 0));

	// KStyle Menu transparency and drop-shadow options...
	QSettings settings;
	QString effectEngine = settings.readEntry("/KStyle/Settings/MenuTransparencyEngine", "Disabled");

#ifdef HAVE_XRENDER
	if (effectEngine == "XRender") {
		comboMenuEffectType->setCurrentItem(2);
		comboMenuEffect->setCurrentItem(3);
	} else if (effectEngine == "SoftwareBlend") {
		comboMenuEffectType->setCurrentItem(1);
		comboMenuEffect->setCurrentItem(3);
#else
	if (effectEngine == "XRender" || effectEngine == "SoftwareBlend") {
		comboMenuEffectType->setCurrentItem(1);	// Software Blend
		comboMenuEffect->setCurrentItem(3);
#endif
	} else if (effectEngine == "SoftwareTint") {
		comboMenuEffectType->setCurrentItem(0);
		comboMenuEffect->setCurrentItem(3);
	} else
		comboMenuEffectType->setCurrentItem(0);

	if (comboMenuEffect->currentItem() != 3)	// If not translucency...
		menuPreview->setPreviewMode( MenuPreview::Tint );
	else if (comboMenuEffectType->currentItem() == 0)
		menuPreview->setPreviewMode( MenuPreview::Tint );
	else
		menuPreview->setPreviewMode( MenuPreview::Blend );

	slOpacity->setValue( (int)(100 * settings.readDoubleEntry("/KStyle/Settings/MenuOpacity", 0.90)) );

	// Menu Drop-shadows...
	cbMenuShadow->setChecked( settings.readBoolEntry("/KStyle/Settings/MenuDropShadow", false) );

	if (cbEnableEffects->isChecked()) {
		containerFrame->setEnabled( true );
		menuContainer->setEnabled( comboMenuEffect->currentItem() == 3 );
	} else {
		menuContainer->setEnabled( false );
		containerFrame->setEnabled( false );
	}

	m_bEffectsDirty = false;
}


void KCMStyle::menuEffectTypeChanged()
{
	MenuPreview::PreviewMode mode;

	if (comboMenuEffect->currentItem() != 3)
		mode = MenuPreview::Tint;
	else if (comboMenuEffectType->currentItem() == 0)
		mode = MenuPreview::Tint;
	else
		mode = MenuPreview::Blend;

	menuPreview->setPreviewMode(mode);

	m_bEffectsDirty = true;
}