Пример #1
0
/** merge inodes labelimage into the result image */
void INode::mergeResultImage(GeoImage & resultImg)
{
  qDebug("INode::mergeResultImage: name=%s", name_.latin1());
  QListIterator < INode > it = QListIterator < INode > (children());
  for (; it.current(); ++it) {
    INode *node = it.current();
    if (node->status() == TRASH)
      continue;
    if (node->labelImage() && node->attributeInt("id")) {
      // id==0 is background and should not be merged into the result image
      if (!resultImg.
          mergeInto(*(node->labelImage()), attributeInt("IDStart"),
                    node->attributeInt("id"), node->attributeInt("IDStart")))
        node->attribute("status", "deleted");
    }
    else {
      node->attribute("status", "no labelimage");
      qDebug("INode::mergeResultImage: %s ommitted",
             (const char *) node->name());
    }
  }
  for (it.toFirst(); it.current(); ++it) {
    INode *node = it.current();
    if (node->status() == TRASH)
      continue;
    if (node->attributeInt("id")) {
      // id==0 is background and should not be merged into the result image
      node->mergeResultImage(resultImg);
    }
    else {
      qDebug("INode::mergeResultImage: %s ommitted",
             (const char *) node->name());
    }
  }
}
Пример #2
0
//====================================
// exportData
//------------------------------------
bool SCCMonitor::exportData ( void ) {
	int card = 0;
	//====================================
	// save particular monitor data
	//------------------------------------
	QListIterator<SCCMonitorDisplay> it (mMonitorDisplay);
	for (; it.current() ; ++it) {
		//====================================
		// remove current layout
		//------------------------------------
		if ( mMonitorArrange ) {
			QString screenID;
			QTextOStream (&screenID) << "Screen:Screen[" << card << "]";
			mSection["Layout"]->removeEntry( screenID );
		}
		//====================================
		// check for monitor display's
		//------------------------------------
		SCCMonitorDisplay* display = (SCCMonitorDisplay*)it.current();
		//if (display->isEnabled()) {
		//====================================
		// create manipulators...
		//------------------------------------
		SaXManipulateCard saxCard (
			mSection["Card"]
		);
		SaXManipulateDesktop saxDesktop ( 
			mSection["Desktop"],mSection["Card"],mSection["Path"]
		);
		//====================================
		// select card and desktop
		//------------------------------------
		saxDesktop.selectDesktop ( card );
		saxCard.selectCard ( card );

		//====================================
		// save resolution list
		//------------------------------------
		int colorDepths[4] = {8,15,16,24};
		for (int n=0;n<4;n++) {
			int color = colorDepths[n];
			QString modesKey;
			QTextOStream (&modesKey) << "Modes:" << color;
			mSection["Desktop"] -> removeEntry ( modesKey );
			QList<QString> resList = display->getResolution();
			QListIterator<QString> it ( resList );
			for (; it.current(); ++it) {
				QStringList tokens = QStringList::split ( "x",*it.current() );
				int xaxis = tokens.first().toInt();
				int yaxis = tokens.last().toInt();
				saxDesktop.addResolution (
					color,xaxis,yaxis
				);
			}
		}
		//====================================
		// save monitor settings
		//------------------------------------
		SCCMonitorModel* monitorData = display->getMonitorData();
		saxDesktop.setMonitorVendor (monitorData->getVendorName());
		saxDesktop.setMonitorName   (monitorData->getModelName());
		saxDesktop.setHsyncRange (
			(double)monitorData->getHSmin(),
			(double)monitorData->getHSmax()
		);
		saxDesktop.setVsyncRange (
			(double)monitorData->getVSmin(),
			(double)monitorData->getVSmax()
		);
		int sizeX = monitorData->getSizeX();
		int sizeY = monitorData->getSizeY();
		if ((sizeX > 0) && (sizeY > 0)) {
			saxDesktop.setDisplaySize ( sizeX,sizeY );
		}
		saxDesktop.disableDPMS();
		if (monitorData->isDPMSEnabled()) {
			saxDesktop.enableDPMS();
		}
		QString algorithm = saxDesktop.getModelineAlgorithm();
		if (algorithm != "XServerPool") {
			saxDesktop.calculateModelines ( true );
		}
		//====================================
		// save card options
		//------------------------------------
		SCCMonitorCard* cardData = display->getCardData();
		QDict<QString> optList = cardData->getOptions();
		mSection["Card"] -> removeEntry ("Option");
		mSection["Card"] -> removeEntry ("RawData");
		QDictIterator<QString> io (optList);
		for (; io.current(); ++io) {
			saxCard.addCardOption ( io.currentKey(),*io.current());
		}
		int rotateID = cardData->getRotate();
		mSection["Card"] -> removeEntry ("Rotate");
		saxCard.setRotate ( rotateID );

		//====================================
		// check for dual head mode
		//------------------------------------
		QString profile = saxDesktop.getDualHeadProfile();
		if ((! profile.isEmpty()) && (! saxDesktop.isXineramaMode())) {
			SaXImportProfile* pProfile = SaXWidgetProfile->getProfile (profile);
			SaXImport* mImport = pProfile -> getImport ( SAX_CARD );
			if ( mImport ) {
				//====================================
				// pick up card profile data
				//------------------------------------
				QString driver = saxCard.getCardDriver();
				QDict<QString> profileDriverOptions;
				SaXManipulateCard saxProfileCard ( mImport );
				profileDriverOptions = saxProfileCard.getOptions();
				QDictIterator<QString> it ( profileDriverOptions );

				//====================================
				// delete profile data keys
				//------------------------------------
				for (; it.current(); ++it) {
					saxCard.removeCardOption (it.currentKey());
				}
				#if 1 // to be removed as soon as possible
				//====================================               
				// fix broken cards                                     
				//------------------------------------
				fixBrokenCards (saxCard);
				#endif
				//====================================
				// init special modelines
				//------------------------------------
				//mSection["Desktop"] -> removeEntry ("SpecialModeline");
				saxDesktop.setExtraModelineString (
					monitorData->getExtraModeline()
				);
				//====================================
				// setup profile data
				//------------------------------------
				if (display->isDualModeEnabled()) {
					it.toFirst();
					SCCMonitorDual* dualData;
					SCCMonitorDualModel* dualModel;
					dualData  = display->getDualData();
					dualModel = dualData->getDualModelData();
					//====================================
					// call ok slot from dualhead setup
					//------------------------------------
					dualData->slotOk();
					//====================================
					// setup dualhead options
					//------------------------------------
					saxCard.addCardOption ("SaXDualHead",0);
					for (; it.current(); ++it) {
						QString key = it.currentKey();
						QString val = *it.current();
						//====================================
						// setup profile "off"-line data
						//------------------------------------
						if (val == "off") {
							saxCard.addCardOption ( key,val );
							continue;
						}
						//====================================
						// setup profile meta data
						//------------------------------------
						if (key == "SaXDualMonitorVendor") {
							QString vendor = dualModel ->getVendorName();
							saxCard.addCardOption ( key,vendor );
						}
						if (key == "SaXDualMonitorModel") {
							QString model = dualModel ->getModelName();
							saxCard.addCardOption ( key,model );
						}
						if (key == "SaXDualResolution") {
							QString resolution = dualData->getResolution();
							saxCard.addCardOption ( key,resolution );
						}
						if (key == "SaXDualOrientation") {
							int orientation  = dualData->getLayout();
							QString position = DUAL_LEFTOF_KEY;
							switch (orientation) {
								case DUAL_ABOVEOF:
									position = DUAL_ABOVEOF_KEY;
								break;
								case DUAL_RIGHTOF:
									position = DUAL_RIGHTOF_KEY;
								break;
								case DUAL_BELOWOF:
									position = DUAL_BELOWOF_KEY;
								break;
								default:
								break;
							}
							saxCard.addCardOption ( key,position );
						}
						if (key == "SaXDualMode") {
							int mode = dualData->getMode();
							QString dualMode = DUAL_TRADITIONAL_KEY;
							switch (mode) {
								case DUAL_CLONE:
									dualMode = DUAL_CLONE_KEY;
								break;
								case DUAL_XINERAMA:
									dualMode = DUAL_XINERAMA_KEY;
								break;
								default:
								break;
							}
							saxCard.addCardOption ( key,dualMode );
						}
						if (key == "SaXDualHSync") {
							QString hsync;
							int hsmax = dualModel->getHSmax();
							int hsmin = dualModel->getHSmin();
							QTextOStream (&hsync) << hsmin << "-" << hsmax;
							saxCard.addCardOption ( key,hsync );	
						}
						if (key == "SaXDualVSync") {
							QString vsync;
							int hsmax = dualModel->getHSmax();
							int vsmax = dualModel->getVSmax();
							int vsmin = dualModel->getVSmin();
							QTextOStream (&vsync) << vsmin << "-" << vsmax;
							saxCard.addCardOption ( key,vsync );
							//====================================
							// calculate one modeline for each res
							//------------------------------------
							QString algorithm=saxDesktop.getModelineAlgorithm();
							if (algorithm != "XServerPool") {
								QList<QString> rList;
								rList=dualData->getResolutionList();
								QListIterator<QString> ir (rList);
								for (; ir.current(); ++ir) {
									QStringList xy = QStringList::split (
										"x",*ir.current()
									);
									int x = xy.first().toInt();
									int y = xy.last().toInt();
									log (L_INFO,
										"Add special mode: %dx%d@%d\n",x,y,vsmax
									);
									saxDesktop.addExtraModeline (
										x,y,vsmax,hsmax
									);
								}
							}
						}
						//====================================
						// setup profile NVidia data
						//------------------------------------
						if (key == "TwinView") {
							saxCard.addCardOption ( key,0 );
						}
						if (key == "ConnectedMonitor") {
							QStringList cs = QStringList::split (",",val);
							QString channelA = cs.first();
							QString channelB = cs.last();
							if ((channelA == "AUTO") || (channelB == "AUTO")) {
								saxCard.removeCardOption ( key );
							} else {
								saxCard.addCardOption ( key,val );
							}
						}
						if ((key== "MetaModes") && (driver == "nvidia")) {
							QString channelA = "AUTO:";
							QString channelB = "AUTO:";
							if (profileDriverOptions["ConnectedMonitor"]) {
								QStringList cs = QStringList::split (",",
									*profileDriverOptions["ConnectedMonitor"]
								);
								channelA = cs.first() + ":";
								channelB = cs.last()  + ":";
							}
							if ((channelA=="AUTO:") || (channelB=="AUTO:")) {
								channelA = "";
								channelB = "";
							}
							QList<QString> rList1=display->getResolution();
							QString resolution1 = *rList1.at(0);
							QList<QString> rList2=dualData->getResolutionList();
							QString resolution2 = *rList2.at(0);
							//====================================
							// add primary meta mode
							//------------------------------------
							QString metaItem;
							QString resolution;
							QTextOStream (&metaItem) <<
								channelA << resolution1 << "," <<
								channelB << resolution2;
							resolution.append (";"+metaItem);
							//====================================
							// add secondary meta modes
							//------------------------------------
							bool startMeta = false;
							QListIterator<QString> ir (rList1);
							for (; ir.current(); ++ir) {
								if (! startMeta) {
									startMeta = true; continue;
								}
								QString metaItem;
								int cmpr = compareResolution (
									*ir.current(),resolution2
								);
								if (cmpr >= 0) {
									QTextOStream (&metaItem) <<
										channelA << *ir.current() << "," <<
										channelB << resolution2;
								} else {
									QTextOStream (&metaItem) <<
										channelA << *ir.current() << "," <<
										channelB << *ir.current();
								}
								resolution.append (";"+metaItem);
							}
							resolution.replace(QRegExp("^;"),"");
							saxCard.addCardOption ( key,resolution );
						}
						if (key == "SecondMonitorHorizSync") {
							QString hsync;
							int hsmax = dualModel->getHSmax();
							int hsmin = dualModel->getHSmin();
							QTextOStream (&hsync) << hsmin << "-" << hsmax;
							saxCard.addCardOption ( key,hsync );
						}
						if (key == "SecondMonitorVertRefresh") {
							QString vsync;
							int vsmax = dualModel->getVSmax();
							int vsmin = dualModel->getVSmin();
							QTextOStream (&vsync) << vsmin << "-" << vsmax;
							saxCard.addCardOption ( key,vsync );
						}
						if (key == "TwinViewOrientation") {
							int orientation  = dualData->getLayout();
							QString position = DUAL_LEFTOF_KEY;
							switch (orientation) {
								case DUAL_ABOVEOF:
									position = DUAL_ABOVEOF_KEY;
								break;
								case DUAL_RIGHTOF:
									position = DUAL_RIGHTOF_KEY;
								break;
								case DUAL_BELOWOF:
									position = DUAL_BELOWOF_KEY;
								break;
								default:
								break;
							}
							saxCard.addCardOption ( key,position );
							int mode = dualData->getMode();
							if ( mode == DUAL_CLONE ) {
								saxCard.removeCardOption (key);
								saxCard.addCardOption (key,DUAL_CLONE_KEY);
							}
						}
						//====================================
                        // setup profile Matrox data
                        //------------------------------------
						if ((key == "MergedFB") && (driver == "mga")) {
							saxCard.addCardOption ( key,0 );
						}
						if (key == "Monitor2HSync") {
							QString hsync;
							int hsmax = dualModel->getHSmax();
							int hsmin = dualModel->getHSmin();
							QTextOStream (&hsync) << hsmin << "-" << hsmax;
							saxCard.addCardOption ( key,hsync );
						}
						if (key == "Monitor2VRefresh") {
							QString vsync;
							int vsmax = dualModel->getVSmax();
							int vsmin = dualModel->getVSmin();
							QTextOStream (&vsync) << vsmin << "-" << vsmax;
							saxCard.addCardOption ( key,vsync );
						}
						if ((key== "MetaModes") && (driver == "mga")) {
							QList<QString> rList1=display->getResolution();
							QString resolution1 = *rList1.at(0);
							QList<QString> rList2=dualData->getResolutionList();
							QString resolution2 = *rList2.at(0);
							//====================================
							// add primary meta mode
							//------------------------------------
							QString metaItem;
							QTextOStream (&metaItem) <<
								resolution1 << "-" << resolution2;
							saxCard.addCardOption ( key,metaItem );
							//====================================
							// add virtual size
							//------------------------------------
							for (int color=8;color<=24;color+=8) {
								saxDesktop.removeVirtualResolution (color);
							}
							int mode = dualData->getMode();
							if ( mode != DUAL_CLONE ) {
								QStringList r1 = QStringList::split (
									"x",resolution1
								);
								QStringList r2 = QStringList::split (
									"x",resolution2
								);
								int x1 = r1.first().toInt();
								int y1 = r1.last().toInt();
								int x2 = r2.first().toInt();
								int y2 = r2.last().toInt();
								int orientation  = dualData->getLayout();
								int x = 0;
								int y = 0;
								switch (orientation) {
									case DUAL_ABOVEOF:
									case DUAL_BELOWOF:
										y = y1 + y2;
										if (x1 > x2) x = x1; else x = x2;
									break;
									case DUAL_RIGHTOF:
									case DUAL_LEFTOF:
										x = x1 + x2;
										if (y1 > y2) y = y1; else y = y2;
									break;
									default:
									break;
								}
								for (int color=8;color<=24;color+=8) {
									saxDesktop.setVirtualResolution (color,x,y);
								}
							}
						}
						if (key == "Monitor2Position") {
							int orientation  = dualData->getLayout();
							QString position = DUAL_LEFTOF_KEY;
							switch (orientation) {
								case DUAL_ABOVEOF:
									position = DUAL_ABOVEOF_KEY;
								break;
								case DUAL_RIGHTOF:
									position = DUAL_RIGHTOF_KEY;
								break;
								case DUAL_BELOWOF:
									position = DUAL_BELOWOF_KEY;
								break;
								default:
								break;
							}
							saxCard.addCardOption ( key,position );
							int mode = dualData->getMode();
							if ( mode == DUAL_CLONE ) {
								saxCard.removeCardOption (key);
								saxCard.addCardOption (key,DUAL_CLONE_KEY);
							}
						}
						//====================================
						// setup profile Radeon data
						//------------------------------------
						if (key == "MergedFB") {
							saxCard.addCardOption ( key,0 );
						}
						if (key == "CRT2HSync") {
							QString hsync;
							int hsmax = dualModel->getHSmax();
							int hsmin = dualModel->getHSmin();
							QTextOStream (&hsync) << hsmin << "-" << hsmax;
							saxCard.addCardOption ( key,hsync );
						}
						if (key == "CRT2VRefresh") {
							QString vsync;
							int vsmax = dualModel->getVSmax();
							int vsmin = dualModel->getVSmin();
							QTextOStream (&vsync) << vsmin << "-" << vsmax;
							saxCard.addCardOption ( key,vsync );
						}
						if (key == "IgnoreEDID") {
							saxCard.addCardOption ( key,0 );
						}
						if ((key== "MetaModes") && (driver == "radeon")) {
							QList<QString> rList1=display->getResolution();
							QString resolution1 = *rList1.at(0);
							QList<QString> rList2=dualData->getResolutionList();
							QString resolution2 = *rList2.at(0);
							//====================================
							// add primary meta mode
							//------------------------------------
							QString metaItem;
							QString resolution;
							QTextOStream (&metaItem) <<
								resolution1 << "," << resolution2;
							resolution.append (";"+metaItem);
							//====================================
							// add secondary meta modes
							//------------------------------------
							bool startMeta = false;
							QListIterator<QString> ir (rList1);
							for (; ir.current(); ++ir) {
								if (! startMeta) {
									startMeta = true; continue;
								}
								QString metaItem;
								int cmpr = compareResolution (
									*ir.current(),resolution2
								);
								if (cmpr >= 0) {
									QTextOStream (&metaItem) <<
										*ir.current() << "," << resolution2;
								} else {
									QTextOStream (&metaItem) <<
										*ir.current() << "," << *ir.current();
								}
								resolution.append (";"+metaItem);
							}
							resolution.replace(QRegExp("^;"),"");
							saxCard.addCardOption ( key,resolution );
						}
						if (key == "CRT2Position") {
							int orientation  = dualData->getLayout();
							QString position = DUAL_LEFTOF_KEY;
							switch (orientation) {
								case DUAL_ABOVEOF:
									position = DUAL_ABOVEOF_KEY;
								break;
								case DUAL_RIGHTOF:
									position = DUAL_RIGHTOF_KEY;
								break;
								case DUAL_BELOWOF:
									position = DUAL_BELOWOF_KEY;
								break;
								default:
								break;
							}
							saxCard.addCardOption ( key,position );
							int mode = dualData->getMode();
							if ( mode == DUAL_CLONE ) {
								saxCard.removeCardOption (key);
								saxCard.addCardOption (key,DUAL_CLONE_KEY);
							}
						}
						//====================================
						// setup profile Intel data
						//------------------------------------
						if ((key== "MonitorLayout") && (driver == "i810")) {
							saxCard.addCardOption ( key,val );
						}
						if (key == "Clone") {
							saxCard.addCardOption ( key,0 );
						}
						if (key == "CloneRefresh") {
							QString vsync;
							int vsmax = dualModel->getVSmax();
							int vsmin = dualModel->getVSmin();
							QTextOStream (&vsync) << vsmin << "-" << vsmax;
							saxCard.addCardOption ( key,vsync );
						}
						//====================================
						// setup profile FGLRX data
						//------------------------------------
						if (key== "ForceMonitors") {
							saxCard.addCardOption ( key,val );
						}
						if (key == "DesktopSetup") {
							int orientation  = dualData->getLayout();
							QString position = DUAL_FGLRX_LEFTOF_KEY;
							switch (orientation) {
								case DUAL_ABOVEOF:
									position = DUAL_FGLRX_ABOVEOF_KEY;
								break;
								case DUAL_RIGHTOF:
									position = DUAL_FGLRX_RIGHTOF_KEY;
								break;
								case DUAL_BELOWOF:
									position = DUAL_FGLRX_BELOWOF_KEY;
								break;
								default:
								break;
							}
							saxCard.addCardOption ( key,position );
							int mode = dualData->getMode();
							if ( mode == DUAL_CLONE ) {
								saxCard.removeCardOption (key);
								saxCard.addCardOption (key,DUAL_CLONE_KEY);
							}
						}
						if (key == "HSync2") {
							QString hsync;
							int hsmax = dualModel->getHSmax();
							int hsmin = dualModel->getHSmin();
							QTextOStream (&hsync) << hsmin << "-" << hsmax;
							saxCard.addCardOption ( key,hsync );
						}
						if (key == "VRefresh2") {
							QString vsync;
							int vsmax = dualModel->getVSmax();
							int vsmin = dualModel->getVSmin();
							QTextOStream (&vsync) << vsmin << "-" << vsmax;
							saxCard.addCardOption ( key,vsync );
						}
						if (key == "Mode2") {
							QString resolution;
							QList<QString> rList2=dualData->getResolutionList();
							QListIterator<QString> ir (rList2);
							for (; ir.current(); ++ir) {
								resolution.append(","+*ir.current());
							}
							resolution.replace(QRegExp("^,"),"");
							saxCard.addCardOption ( key,resolution );
						}
					}
				}
			}
		}
		//}
		card++;
	}
	//====================================
	// save arrangement
	//------------------------------------
	if ( mMonitorArrange ) {
		//====================================
		// create manipulators...
		//------------------------------------
		SaXManipulateLayout saxLayout (
			mSection["Layout"],mSection["Card"]
		);
		//====================================
		// save multihead state
		//------------------------------------
		int multiheadMode = mMonitorArrange->getMultiheadMode();
		switch (multiheadMode) {
			case 0:
				saxLayout.setXOrgMultiheadMode ( SAX_TRADITIONAL );
			break;
			case 1:
				saxLayout.setXOrgMultiheadMode ( SAX_CLONE );
			break;
			case 2:
				saxLayout.setXOrgMultiheadMode ( SAX_XINERAMA );
			break;
			default:
			break;
		};
		//====================================
		// save XOrg layout
		//------------------------------------
		QDict<QString> arrangeDict = mMonitorArrange->getArrangement();
		QDictIterator<QString> it (arrangeDict);
		for (; it.current(); ++it) {
			QString item (it.currentKey());
			item.replace (QRegExp("Screen:Screen\\["),"");
			item.replace (QRegExp("\\]"),"");
			int index = item.toInt();

			int count = 0;
			int left=-1,right=-1,above=-1,below=-1;
			QStringList tokens = QStringList::split (" ", *it.current());
			for (QStringList::Iterator it=tokens.begin();it!=tokens.end();++it){
				QString value (*it);
				int id = -1;
				if (value != "<none>") {
					value.replace (QRegExp("Screen\\["),"");
					value.replace (QRegExp("\\]"),"");
					id = value.toInt();
				}
				switch (count) {
					case 0: left  = id; break;
					case 1: right = id; break;
					case 2: above = id; break;
					case 3: below = id; break;
					default:
					break;
				}
				count++;
			}
			saxLayout.setXOrgLayout (
				index,left,right,above,below
			);
		}
	}
	//====================================
	// save 3D status
	//------------------------------------
	SaXManipulateDesktop saxDesktop (
		mSection["Desktop"],mSection["Card"],mSection["Path"]
	);
	saxDesktop.disable3D();
	if (mCheck3D->isChecked()) {
		saxDesktop.enable3D();
	}
	//====================================
	// save default color depth
	//------------------------------------
	it.toFirst(); card = 0;
	for (; it.current() ; ++it) {
		SCCMonitorDisplay* display = (SCCMonitorDisplay*)it.current();
		SaXManipulateDesktop saxDesktop (
			mSection["Desktop"],mSection["Card"],mSection["Path"]
		);
		SaXManipulateCard saxCard (
			mSection["Card"]
		);
		saxDesktop.selectDesktop ( card );
		saxCard.selectCard ( card );
		if (saxCard.getCardDriver() != "fbdev") {
			saxDesktop.setColorDepth ( display->getColorDepth() );
		}
		card++;
	}
	return true;
}
Пример #3
0
Expert::Expert( QWidget *parent ) : QTabDialog( parent )
{

  m_dependencies = new QDict< QList<IInput> >(257);
  m_dependencies->setAutoDelete(TRUE);
  m_inputWidgets = new QDict< IInput >;
  m_switches = new QDict< QObject >;
  m_changed = FALSE;

  setHelpButton();
  
  QListIterator<ConfigOption> options = Config::instance()->iterator();
  QVBoxLayout *pageLayout = 0;
  QFrame *page = 0;
  ConfigOption *option = 0;
  for (options.toFirst();(option=options.current());++options)
  {
    switch(option->kind())
    {
      case ConfigOption::O_Info:
        {
          if (pageLayout) pageLayout->addStretch(1);
          QScrollView *view = new QScrollView(this);
          view->setVScrollBarMode(QScrollView::Auto);
          view->setHScrollBarMode(QScrollView::AlwaysOff);
          view->setResizePolicy(QScrollView::AutoOneFit);
          page = new QFrame( view->viewport(), option->name() );
          pageLayout = new QVBoxLayout(page);
          pageLayout->setMargin(10);
          view->addChild(page);
          addTab(view,option->name());
          QWhatsThis::add(page, option->docs().simplifyWhiteSpace() );
          QToolTip::add(page, option->docs() );
        }
        break;
      case ConfigOption::O_String:
        {
          ASSERT(page!=0);
          InputString::StringMode sm=InputString::StringFree;
          switch(((ConfigString *)option)->widgetType())
          {
            case ConfigString::String: sm=InputString::StringFree; break;
            case ConfigString::File:   sm=InputString::StringFile; break;
            case ConfigString::Dir:    sm=InputString::StringDir;  break;
          }
          InputString *inputString = new InputString( 
                         option->name(),                        // name
                         page,                                  // widget
                         *((ConfigString *)option)->valueRef(), // variable 
                         sm                                     // type
                       ); 
          pageLayout->addWidget(inputString);
          QWhatsThis::add(inputString, option->docs().simplifyWhiteSpace() );
          QToolTip::add(inputString,option->docs());
          connect(inputString,SIGNAL(changed()),SLOT(changed()));
          m_inputWidgets->insert(option->name(),inputString);
          addDependency(m_switches,option->dependsOn(),option->name());
        }
        break;
      case ConfigOption::O_Enum:
        {
          ASSERT(page!=0);
          InputString *inputString = new InputString( 
                         option->name(),                        // name
                         page,                                  // widget
                         *((ConfigEnum *)option)->valueRef(),   // variable 
                         InputString::StringFixed               // type
                       ); 
          pageLayout->addWidget(inputString);
          QStrListIterator sli=((ConfigEnum *)option)->iterator();
          for (sli.toFirst();sli.current();++sli)
          {
            inputString->addValue(sli.current());
          }
          inputString->init();
          QWhatsThis::add(inputString, option->docs().simplifyWhiteSpace() );
          QToolTip::add(inputString, option->docs());
          connect(inputString,SIGNAL(changed()),SLOT(changed()));
          m_inputWidgets->insert(option->name(),inputString);
          addDependency(m_switches,option->dependsOn(),option->name());
        }
        break;
      case ConfigOption::O_List:
        {
          ASSERT(page!=0);
          InputStrList::ListMode lm=InputStrList::ListString;
          switch(((ConfigList *)option)->widgetType())
          {
            case ConfigList::String:     lm=InputStrList::ListString;  break;
            case ConfigList::File:       lm=InputStrList::ListFile;    break;
            case ConfigList::Dir:        lm=InputStrList::ListDir;     break;
            case ConfigList::FileAndDir: lm=InputStrList::ListFileDir; break;
          }
          InputStrList *inputStrList = new InputStrList(
                          option->name(),                         // name
                          page,                                   // widget
                          *((ConfigList *)option)->valueRef(),    // variable
                          lm                                      // type
                        );
          pageLayout->addWidget(inputStrList);
          QWhatsThis::add(inputStrList, option->docs().simplifyWhiteSpace() );
          QToolTip::add(inputStrList, option->docs());
          connect(inputStrList,SIGNAL(changed()),SLOT(changed()));
          m_inputWidgets->insert(option->name(),inputStrList);
          addDependency(m_switches,option->dependsOn(),option->name());
        }
        break;
        break;
      case ConfigOption::O_Bool:
        {
          ASSERT(page!=0);
          InputBool *inputBool = new InputBool(
                          option->name(),                         // name
                          page,                                   // widget
                          *((ConfigBool *)option)->valueRef()     // variable
                        );
          pageLayout->addWidget(inputBool);
          QWhatsThis::add(inputBool, option->docs().simplifyWhiteSpace() );
          QToolTip::add(inputBool, option->docs() );
          connect(inputBool,SIGNAL(changed()),SLOT(changed()));
          m_inputWidgets->insert(option->name(),inputBool);
          addDependency(m_switches,option->dependsOn(),option->name());
        }
        break;
      case ConfigOption::O_Int:
        {
          ASSERT(page!=0);
          InputInt *inputInt = new InputInt(
                          option->name(),                         // name
                          page,                                   // widget
                          *((ConfigInt *)option)->valueRef(),     // variable
                          ((ConfigInt *)option)->minVal(),        // min value
                          ((ConfigInt *)option)->maxVal()         // max value
                        );
          pageLayout->addWidget(inputInt);
          QWhatsThis::add(inputInt, option->docs().simplifyWhiteSpace() );
          QToolTip::add(inputInt, option->docs() );
          connect(inputInt,SIGNAL(changed()),SLOT(changed()));
          m_inputWidgets->insert(option->name(),inputInt);
          addDependency(m_switches,option->dependsOn(),option->name());
        }
        break;
      case ConfigOption::O_Obsolete:
        break;
    } 
  }
  if (pageLayout) pageLayout->addStretch(1);

  QDictIterator<QObject> di(*m_switches);
  QObject *obj = 0;
  for (di.toFirst();(obj=di.current());++di)
  {
    connect(obj,SIGNAL(toggle(const char *,bool)),SLOT(toggle(const char *,bool)));
    // UGLY HACK: assumes each item depends on a boolean without checking!
    emit toggle(di.currentKey(),((InputBool *)obj)->getState());
  }

  connect(this,SIGNAL(helpButtonPressed()),this,SLOT(handleHelp()));
  
}