Example #1
0
//====================================
// getCardName
//------------------------------------
QString SaXManipulateCard::getCardName (void) {
	// .../
	//! retrieve the card vendor and name as one string
	//! separated by a colon from the currently selected card
	// ----
	if (! mImport) {
		return QString();
	}
	//====================================
	// search name in SYSP data
	//------------------------------------
	SaXImportSysp* pCard = new SaXImportSysp (SYSP_CARD);
	pCard -> doImport();
	if (pCard -> setID ( mCard )) {
		QString mCardName;
		QTextOStream (&mCardName) <<
			pCard->getItem("Vendor") << ":" << pCard->getItem("Device");
		return mCardName;
	}
	//====================================
	// search name in ISAX data
	//------------------------------------
	QString mCardName;
	QTextOStream (&mCardName) <<
		mImport->getItem("Vendor") << ":" << mImport->getItem("Name");
	return mCardName;
}
//=====================================
// setToolTip
//-------------------------------------
void SCCMonitorArrange::setToolTip ( SCCMonitorDisplay* display ) {
	SCCWrapPointer< QDict<QString> > mText (mTextPtr);
	SCCFig* mFig = mMatrix->searchWidget ( display->getDisplay() );
	if ( mFig ) {
		SCCMonitorModel* monitorData = display -> getMonitorData();
		QString vendor = monitorData->getVendorName();
		QString model  = monitorData->getModelName();
		QString monitorInfo;
		if ( vendor != model ) {
			QTextOStream (&monitorInfo) << "<b>[" << mFig->getID() << "]</b> "<<
				mText["PrimaryMonitor"] << " " << vendor << " " << model;
		} else {
			QTextOStream (&monitorInfo) << "<b>[" << mFig->getID() << "]</b> "<<
				mText["UnknownMonitor"];
		}
		QString toolTip;
		QTextOStream (&toolTip)
			<< "<table border=0 cellspacing=0>"
			<< "<tr>"
			<< "<th rowspan=2><img src=\"" << TIP_PIXMAP << "\"></th>"
			<< "<td><nobr>" << monitorInfo << "</nobr></td>"
			<< "</tr>"
			<< "<tr>"
			<< "<td><nobr><hr>" << mText["ConnectedTo"] << " "
			<< display->getCardName() << "</nobr></td>"
			<< "</tr>"
			<< "</table>";
		mFig -> setToolTip ( toolTip );
	}
}
Example #3
0
//=====================================
// XTablet slotIntro...
//-------------------------------------
void XTablet::slotIntro (int index) {
	if (index == mIndex) {
	XWrapPointer< QDict<char> > mText (mTextPtr);
	XTextBrowser* info;
	QString     message;
	QString     idents;
	QDict<char> input;
	XData*      data;
	bool        gotTablet = FALSE;

	// wrap file pointer...
	// ---------------------
	XWrapFile < QDict<XFile> > mFiles (mFilePtr);

	info    = mIntro -> getTextView();
	message = mText["tablet_header"];
	info    -> setText (message);
	message += "<br><br><table border=1 bgcolor=lightgrey ";
	message += "cellspacing=1 width=90%>";

	int count = -1;
	for (int n=0; n<mFiles["sys_INPUT"]->getDeviceCount(); n++) {
		count += 2;
		data = mFiles["sys_INPUT"] -> getDevice(count);
		if (! data) {
		continue;
		}
		input = data -> getData();
		if (QString(input["InputFashion"]) != "Tablet") {
		continue;
		}
		if (n > 0) {
		message += "<tr>";
		QTextOStream (&idents) 
			<< "<td>" << input["Vendor"] << " " << input["Name"] << "</td>";
		message += idents;
		message += "</tr>";
		gotTablet = TRUE;
		// ...
		// more than one tablet does not make 
		// any sense I think, therefore we will break now
		// ---
		break;
		}
	}
	if (! gotTablet) {
		message += "<tr>";
		QTextOStream (&idents) 
			<< "<td>" << mText["notConfigured"] << "</td>";
		message += idents;
		message += "</tr>";
	}
	message += "</table>";
	info -> setText (message);
	}
}
Example #4
0
//=====================================
// testConfiguration
//-------------------------------------
void SCCFrame::testConfiguration ( void ) {
	if (! prepareConfiguration()) {
		return;
	}
	mConfig -> setMode (SAX_NEW);
	SCCWrapPointer< Q3Dict<QString> > mText (getTextPtr());
	qApp->setOverrideCursor ( Qt::forbiddenCursor );
	mModuleList -> setDisabled ( true );
	mFinish -> setDisabled ( true );
	mCancel -> setDisabled ( true );
	SCCTestThread testConfiguration ( mConfig );
	testConfiguration.start();
	while (1) {
		usleep (1000);
		qApp->processEvents();
		if (! testConfiguration.running()) {
			break;
		}
	}
	qApp->restoreOverrideCursor();
	mModuleList -> setDisabled ( false );
	mFinish -> setDisabled ( false );
	mCancel -> setDisabled ( false );
	int status = testConfiguration.status();
	if ( status == -1 ) {
		QString message;
		QString library = mConfig->errorString();
		QString parser1 = mConfig->getParseError();
		QString parser2 = mConfig->getParseErrorValue();
		if (library.isEmpty()) {
			library = "No information";
		}
		if (parser1.isEmpty()) {
			parser1 = "No information";
		}
		QTextOStream (&message) <<
			mText["TestingFailed"] << "<br><br>" <<
			"SaX library: " << library << "<br>" <<
			"X configuration: " << parser1 << " " << parser2;
		SCCMessage* mMessageBox = new SCCMessage (
			this, getTextPtr(), SaXMessage::OK,
			message,"MessageCaption",SaXMessage::Critical
		);
		mMessageBox -> showMessage();
	}
	if ( status == 0 ) {
		installConfiguration();
		SCCMessage* mMessageBox = new SCCMessage (
			this, getTextPtr(), SaXMessage::YES_NO,
			"SavingDone","MessageCaption"
		);
		QString result = mMessageBox -> showMessage();
		if (result == mText["Yes"]) {
			exitSaX();
		}
	}
}
Example #5
0
//=====================================
// XAccessX slotIntro...
//-------------------------------------
void XAccessX::slotIntro (int index) {
	if (index == mIndex) {
	XWrapPointer< QDict<char> > mText (mTextPtr);
	XTextBrowser* info;
    QString     message;
	QString     idents;
	bool        active = FALSE;

	info    = mIntro -> getTextView();
    message = mText["accessx_header"];

	XkbGetControls(x11Display(), XkbAllControlsMask, xkb);
	if (xkb->ctrls == NULL) {
		active = FALSE;
	} else {
		if (xkb->ctrls->enabled_ctrls == XACCESS_CODE) {
		active = TRUE;
		} else {
		active = FALSE;
		}
	}

	// begin table
	message += "<br><br><table border=1 bgcolor=lightgrey ";
	message += "cellspacing=1 width=90%>";
	message += idents;

	// first row
	message += "<tr>";
	if (active) {
	QTextOStream (&idents)
		<<"<td width=200>"<< mText["xaccess"] <<" "<< mText["on"] <<"</td>";
	} else {
	QTextOStream (&idents)
		<<"<td width=200>"<< mText["xaccess"] <<" "<< mText["off"] <<"</td>";
	}
	message += idents;
	message += "</tr>";

	// end table...
	message += "</table>";
	info -> setText (message);
	}
}
Example #6
0
//====================================
// Constructor
//------------------------------------
SCCMouse::SCCMouse (
	QWidgetStack* stack,QDict<QString>* text,
	QDict<SaXImport> section, QWidget* parent
) : SCCDialog ( stack,text,section,parent ) {
	//=====================================
	// get translation pointer
	//-------------------------------------
	SCCWrapPointer< QDict<QString> > mText (mTextPtr);

	//=====================================
	// check for mouse devices
	//-------------------------------------
	mMouse = 0;
	SaXManipulateMice saxMouse ( mSection["Pointers"] );
	saxMouse.selectPointer (SAX_CORE_POINTER);
	for (int i=SAX_CORE_POINTER;i<mSection["Pointers"]->getCount();i+=2) {
		if (saxMouse.selectPointer (i)) {
		if (saxMouse.isMouse()) {
			mMouse++;
		}
		}
	}
	//=====================================
	// create mouse dialog
	//-------------------------------------
	mMouseTab = new QTabWidget ( mDialogFrame );

	//=====================================
	// add widgets to the layout
	//-------------------------------------
	mDialogLayout -> addWidget ( mMouseTab );

	//=====================================
	// create basic mouse display tabs
	//-------------------------------------
	int mouseID = SAX_CORE_POINTER;
	for (int n=0;n<mMouse;n++) {
		QString displayName;
		QTextOStream (&displayName) << mText["Mouse"] << " " << (n + 1);
		SCCMouseDisplay* mouse = new SCCMouseDisplay (
			text,section,mouseID,this
		);
		mMouseTab -> addTab ( mouse, displayName );
		mouse -> init();
		mouse -> import();
		//=====================================
		// connect mouse activate checkbox
		//-------------------------------------
		QObject::connect (
			mouse , SIGNAL (sigActivate  ( void )),
			this  , SLOT   (slotActivate ( void ))
		);
		mMouseDisplay.append ( mouse );
		mouseID += 2;
	}
}
Example #7
0
//====================================
// enableWheel
//------------------------------------
void SaXManipulateMice::enableWheelOn  (int b1, int b2) {
	// .../
	//! enable the mouse wheel. This function uses b1 and b2
	//! as buttons to map the wheel on
	// ----
	if (! mImport) {
		return;
	}
	QString val;
	QTextOStream (&val) << b1 << " " << b2;
	mImport -> setItem ("ZAxisMapping",val);
}
Example #8
0
//====================================
// enableHTTPAccess
//------------------------------------
void SaXManipulateVNC::enableHTTPAccess (int port) {
	// .../
	//! enable VNC HTTP access on the given port. This is
	//! done by setting up the httpdir option in combination
	//! with the httpport option
	// ----
	QString HTTPport;
	QTextOStream (&HTTPport) << port;
	disableHTTPAccess();
	addCardOption ("httpdir","/usr/share/vnc/classes");
	addCardOption ("httpport",HTTPport);
}
Example #9
0
//=====================================
// XOpenGL slotIntro...
//-------------------------------------
void XOpenGL::slotIntro (int index) {
	if (index == mIndex) {
	XWrapPointer< QDict<char> > mText (mTextPtr);
	XTextBrowser* info;
	QString     message;
	QString     idents;
	QDict<char> layout;

	info    = mIntro -> getTextView();
	message = mText["opengl_header"];
	info    -> setText (message);
	message += "<br><br><table border=1 bgcolor=lightgrey ";
	message += "cellspacing=1 width=90%>";

	message += "<tr>";
	if (global3DActive) {
		QTextOStream (&idents) << "<td>" << mText["on"] << "</td>";
	} else {
		QString noscan ("noscan");
		XStringList packageInfo (
			qx (GET3D,STDOUT,1,"%s",noscan.ascii())
		);
		packageInfo.setSeperator (":");
		QList<char> result = packageInfo.getList();
		QString answer3D = result.at(5);
		if (answer3D == "yes") {
			QTextOStream (&idents)
			<< "<td>" << mText["unavailable"] << "</td>";
		} else {
			QTextOStream (&idents)
			<< "<td>" << mText["notConfigured"] << "</td>";
		}
	}
	message += idents;
	message += "</tr>";
	message += "</table>";
	info -> setText (message);
	}
}
Example #10
0
//====================================
// addVNCMouse
//------------------------------------
void SaXManipulateVNC::addVNCMouse (void) {
	// .../
	//! add the VNC mouse to handle mouse events properly
	// ----
	if (! mLayout) {
		return;
	}
	if (mVNCMouse == -1) {
		QString extraLink;
		mVNCMouse = mManipPointer->addInputDevice (SAX_INPUT_VNC);
		QTextOStream (&extraLink) << mVNCMouse << " " << mVNCKeyboard;
		mLayout -> setItem ( "VNC", extraLink );
	}
}
Example #11
0
//====================================
// addDisableModule
//------------------------------------
void SaXManipulatePath::addDisableModule (const QString& module) {
	// .../
	//! add module name to the current list of disabled modules. The
	//! comma separator is used for each item
	// ----
	if (! mImport) {
		return;
	}
	QString val;
	QString key ("ModuleDisable");
	if (! mImport -> getItem (key).isEmpty()) {
		val = mImport -> getItem (key);
	}
	QTextOStream (&val) << "," << module;
	mImport -> setItem ( key,val );
}
Example #12
0
//====================================
// add standard key/value item...
//------------------------------------
void SaXStorage::addItem ( const QString & key, const QString & val ) {
	// .../
	//! add a value to the current value of (key) seperated by
	//! the comma sign. If there is no data behind (key) nothing
	//! will happen
	// ----
	QString* currentValue = mData.at (mCurrentID) -> take (key);
	if ((currentValue) && (! currentValue->isEmpty())) {
		QString newValue;
		QTextOStream(&newValue) << *currentValue << "," << val;
		newValue.replace (QRegExp("^,"),"");
		setItem (key,newValue);
	} else {
		setItem (key,val);
	}
}
Example #13
0
//====================================
// addServerFlag
//------------------------------------
void SaXManipulatePath::addServerFlag (const QString& flag) {
	// .../
	//! add server flag to the current list of flags. The
	//! comma separator is used for each item
	// ----
	if (! mImport) {
		return;
	}
	QString val;
	QString key ("ServerFlags");
	if (! mImport -> getItem (key).isEmpty()) {
		val = mImport -> getItem (key);
	}
	QTextOStream (&val) << "," << flag;
	mImport -> setItem ( key,val );
}
Example #14
0
//====================================
// addFontPath
//------------------------------------
void SaXManipulatePath::addFontPath (const QString& path) {
	// .../
	//! add FontPath to the current list of font pathes. The
	//! comma separator is used for each item
	// ----
	if (! mImport) {
		return;
	}
	QString val;
	QString key ("FontPath");
	if (! mImport -> getItem (key).isEmpty()) {
		val = mImport -> getItem (key);
	}
	QTextOStream (&val) << "," << path;
	mImport -> setItem ( key,val );
}
Example #15
0
//====================================
// setVendor
//------------------------------------
void SaXManipulatePointers::setNamePair (
	const QString& vendor , const QString& name
) {
	// .../
	//! set a name tag to the configuration which consists of a
	//! vendor and a model name separated by a semicolon. xorg's
	//! config file does not provide native keywords for vendor or
	//! name tags, but they are needed to be able so select a
	//! component within a user interface.
	// ----
	if (! mImport) {
		return;
	}
	QString val;
	QTextOStream (&val) << vendor << ";" << name;
	mImport -> setItem ( "Name",val );
}
Example #16
0
inline void stringListFromFlList(QStringList& sl, const FileLocationList& fll)
{
	FileLocationList* pList;
	FileLocation* pLoc;
	QString sLoc;

	// Nasty...
	pList = (FileLocationList*)&fll;
	sl.clear();
	
	// Turn the object list into a string list, so that it can be written in
	// the configuration file
	for (pLoc = pList->first(); pLoc != NULL; pLoc = pList->next()) {
		sLoc = "";
		QTextOStream(&sLoc) << pLoc->m_sPath << ":" << pLoc->m_nLine << ":" 
				<< pLoc->m_nCol;
		sl.append(sLoc);
	}
}
void
SummaryWidget::createDiskMaps()
{
    DiskList disks;

    const QCString free = i18n( "Free" ).local8Bit();
    const QCString used = i18n( "Used" ).local8Bit();

    KIconLoader loader;

    oldScheme = Config::scheme;
    Config::scheme = (Filelight::MapScheme)2000;

    for (DiskList::ConstIterator it = disks.begin(), end = disks.end(); it != end; ++it)
    {
        Disk const &disk = *it;

        if (disk.free == 0 && disk.used == 0)
            continue;

        QWidget *box = new QVBox( this );
        RadialMap::Widget *map = new MyRadialMap( box );

        QString text; QTextOStream( &text )
            << "<img src='" << loader.iconPath( disk.icon, KIcon::Toolbar ) << "'>"
            << " &nbsp;" << disk.mount << " "
            << "<i>(" << disk.device << ")</i>";

        QLabel *label = new QLabel( text, box );
        label->setAlignment( Qt::AlignCenter );
        label->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Maximum );

        box->show(); // will show its children too

        Directory *tree = new Directory( disk.mount.local8Bit() );
        tree->append( free, disk.free );
        tree->append( used, disk.used );

        map->create( tree ); //must be done when visible

        connect( map, SIGNAL(activated( const KURL& )), SIGNAL(activated( const KURL& )) );
    }
}
Example #18
0
//====================================
// Add to raw item...
//------------------------------------
void SaXStorage::addRawItem (
	const QString & key, const QString & optname,const QString & optval
) {
	// .../
	//! set special item value used for options including a value
	//! if the key is some sort of Raw* the value behind this key
	//! is a comma separated list of key value pairs separated by
	//! a space each. This method will add such a value pair
	// ----
	QString* currentValue = mData.at (mCurrentID) -> take (key);
	if ((currentValue) && (! currentValue->isEmpty())) {
		QString newValue;
		QString newOptVal (optname+" "+optval);
		QTextOStream(&newValue) << *currentValue << "," << newOptVal;
		newValue.replace (QRegExp("^,"),"");
		setItem (key,newValue);
	} else {
		setRawItem (key,optname,optval);
	}
}
Example #19
0
//=====================================
// saveConfiguration
//-------------------------------------
void SCCFrame::saveConfiguration ( void ) {
	if (! prepareConfiguration()) {
		return;
	}
	mConfig -> setMode (SAX_NEW);
	SCCWrapPointer< Q3Dict<QString> > mText (getTextPtr());
	if ( ! mConfig -> createConfiguration() ) {
		QString message;
		QString library = mConfig->errorString();
		QString parser1 = mConfig->getParseError();
		QString parser2 = mConfig->getParseErrorValue();
		if (library.isEmpty()) {
			library = "No information";
		}
		if (parser1.isEmpty()) {
			parser1 = "No information";
		}
		QTextOStream (&message) <<
			mText["SavingFailed"] << "<br><br>" <<
			"SaX library: " << library << "<br>" <<
			"X configuration: " << parser1 << " " << parser2;
		SCCMessage* mMessageBox = new SCCMessage (
			this, getTextPtr(), SaXMessage::OK,
			message,"MessageCaption",SaXMessage::Critical
		);
		mMessageBox -> showMessage();
	} else {
		installConfiguration();
		SCCMessage* mMessageBox = new SCCMessage (
			this, getTextPtr(), SaXMessage::YES_NO,
			"SavingDone","MessageCaption"
		);
		QString result = mMessageBox -> showMessage();
		if (result == mText["Yes"]) {
			exitSaX();
		}
	}
}
Example #20
0
//====================================
// updateLayout
//------------------------------------
void SaXManipulateDevices::updateLayout (int newID) {
	// .../
	//! update the ServerLayout while adding or deleting a desktop
	//! this method is called only privately and is not published.
	//! Adding or deleting a desktop will overwrite the current
	//! layout specification to use a standard horizontal left to
	//! right layout specification.
	// ----
	//====================================
	// remove current screen layout
	//------------------------------------
	for (int n=0;n<=newID;n++) {
		QString idString; idString.sprintf ("%d",n);
		mLayout -> removeEntry (QString("Screen:Screen["+ idString + "]"));
	}
	//====================================
	// check number of existing screens
	//------------------------------------
	int existing = newID;
	for (int n=0;n<=newID;n++) {
		if (! mCard -> getTablePointer (n)) {
			existing--;
		}
	}
	//====================================
	// set standard layout if existing=0
	//------------------------------------
	if (existing == 0) {
		mLayout -> setItem (
			"Screen:Screen[0]","<none> <none> <none> <none>"
		);
		return;
	}
	//====================================
	// create standard horizontal layout
	//------------------------------------
	for (int n=0;n<=existing;n++) {
		QString baseID,val;
		baseID.sprintf ("%d",n);
		QString key ("Screen:Screen[" + baseID + "]");
		for (int pos=0;pos<4;pos++) {
			int posID = 0;
			QString idString;
			switch (pos) {
				case 0:
					posID = n - 1;
				break;
				case 1:
					posID = n + 1;
				break;
				default:
					idString = "<none>";
				break;
			};
			if (idString.isEmpty()) {
			if ((posID < 0) || (posID > newID)) {
				idString.sprintf ("<none>");
			} else {
				idString.sprintf ("Screen[%d]",posID);
			}
			}
			QTextOStream (&val)
				<< val << " " << idString;
		}
		val = val.stripWhiteSpace();
		mLayout -> setItem (key,val);
	}
}
Example #21
0
//====================================
// addInputDevice
//------------------------------------
int SaXManipulateDevices::addInputDevice (const char* fashion) {
	// .../
	//! add a new input device at the end of the current input
	//! device list. The new input device ID is returned. pointer
	//! input devices are following the odd order (1,3,5,7...)
	//! whereas keyboard input devices use the even order (0,2,4,6...)
	// ----
	if (! inputHandlingAllowed) {
		return -1;
	}
	//====================================
	// check fashion string...
	//------------------------------------
	QString inputFashion (fashion);
	if (
		(inputFashion != SAX_INPUT_TOUCHPANEL) &&
		(inputFashion != SAX_INPUT_TABLET)     &&
		(inputFashion != SAX_INPUT_PEN)        &&
		(inputFashion != SAX_INPUT_ERASER)     &&
		(inputFashion != SAX_INPUT_MOUSE)      &&
		(inputFashion != SAX_INPUT_VNC)        &&
		(inputFashion != SAX_INPUT_KEYBOARD)
	) {
		excWrongInputFashion (fashion);
		qError (errorString(),EXC_WRONGINPUTFASHION);
		return -1;
	}
	//====================================
	// determine new input device ID...
	//------------------------------------
	QString baseID ("Mouse");
	QString baseDriver ("mouse");
	if (fashion == SAX_INPUT_VNC) {
		baseDriver = "rfbmouse";
	}
	QDict<QString>* data = mInput->getTablePointer (0);
	int newID = mInput->getCount (true) * 2 + 1;
	if ((data) && (! data->isEmpty())) {
		baseDriver ="kbd";
		if (fashion == SAX_INPUT_VNC) {
			baseDriver = "rfbkeyb";
		}
		baseID = "Keyboard";
		newID  = mInput->getCount (true) * 2;
	}
	if (! mInput -> addID (newID)) {
		return -1;
	}
	//====================================
	// add new input device section...
	//------------------------------------
	QString newIDstring;
	newIDstring.sprintf ("%d",newID);
	mInput -> setItem ("Identifier",baseID + "[" + newIDstring + "]");
	mInput -> setItem ("InputFashion",fashion);
	//====================================
	// set some defaults...
	//------------------------------------
	mInput -> setItem ("Driver",baseDriver);
	//====================================
	// update server layout
	//------------------------------------
	if (baseID == "Mouse") {
		QString inputDevice; QTextOStream (&inputDevice) 
			<< mLayout -> getItem ("InputDevice")
			<< ",Mouse[" << newIDstring << "]";
		mLayout -> setItem ("InputDevice",inputDevice);
	}
	if (baseID == "Keyboard") {
		QString inputDevice; QTextOStream (&inputDevice)
			<< mLayout -> getItem ("Keyboard")
			<< ",Keyboard[" << newIDstring << "]";
		mLayout -> setItem ("Keyboard",inputDevice);
	}
	return mInput -> getCurrentID();
}
void panel_control_hand::enviarDatoAlServidorSlot()    
{
    // Detener el timer del Socket
    //timerSocket->stop();
    
    // Velocidad y aceleración
    QTextOStream( &str ) << 1000.0 << " # " ;
    s.append( str );
    str = ' \0 ';
    QTextOStream( &str ) << 1000.0 << " # " ;
    s.append( str );
    str = ' \0 ';
    
    
    // Convertir el float a string para enviarlo por el socket
    QTextOStream( &str ) << degree(kinechain->list_plug[14].pval) - 90.0 << " # " ;
    s.append( str );
    str = ' \0 ';
    QTextOStream( &str ) << degree(kinechain->list_plug[15].pval) + 7.5 << " # " ;
    s.append( str );
    str = ' \0 ';
    QTextOStream( &str ) << degree(kinechain->list_plug[16].pval) << " # " ;
    s.append( str );
    str = ' \0 ';
    QTextOStream( &str ) << degree(kinechain->list_plug[17].pval) + 16.65 << " # " ;
    s.append( str );
    str = ' \0 ';
    
    QTextOStream( &str ) << degree(kinechain->list_plug[10].pval) - 90.0 << " # " ;
    s.append( str );
    str = ' \0 ';
    QTextOStream( &str ) << degree(kinechain->list_plug[11].pval) + 7.5 << " # " ;
    s.append( str );
    str = ' \0 ';
    QTextOStream( &str ) << degree(kinechain->list_plug[12].pval) << " # " ;
    s.append( str );
    str = ' \0 ';
    QTextOStream( &str ) << degree(kinechain->list_plug[13].pval) + 16.65 << " # " ;
    s.append( str );
    str = ' \0 ';

    QTextOStream( &str ) << degree(kinechain->list_plug[6].pval) - 90.0 << " # " ;
    s.append( str );
    str = ' \0 ';
    QTextOStream( &str ) << degree(kinechain->list_plug[7].pval) + 7.5 << " # " ;
    s.append( str );
    str = ' \0 ';
    QTextOStream( &str ) << degree(kinechain->list_plug[8].pval) << " # " ;
    s.append( str );
    str = ' \0 ';
    QTextOStream( &str ) << degree(kinechain->list_plug[9].pval) + 16.65 << " # " ;
    s.append( str );
    str = ' \0 ';
    
    QTextOStream( &str ) << degree(kinechain->list_plug[18].pval) - 45.44<< " # " ;
    s.append( str );
    str = ' \0 ';
    QTextOStream( &str ) << degree(kinechain->list_plug[19].pval) + 7.5 << " # " ;
    s.append( str );
    str = ' \0 ';
    QTextOStream( &str ) << degree(kinechain->list_plug[20].pval) << " # " ;
    s.append( str );
    str = ' \0 ';
    QTextOStream( &str ) << degree(kinechain->list_plug[21].pval) + 12.73 << " # " ;
    s.append( str );
    str = ' \0 ';

    // Enviar el caracter que indica el final de los datos
    QTextOStream( &str ) << " @ " ;
    s.append( str );
    str = ' \0 ';
    
    // Escribimos al servidor
    QTextStream os(socket);
    os << s << "\n";
    s = ' \0 ';
    
    // Verificamos si existe el socket y las restricciones e iniciamos o no el timer
    if ( haySocket == 1 && connect_active == TRUE )
    timer_socket->start(400, TRUE);
}
Example #23
0
//====================================
// getHeads
//------------------------------------
int SaXManipulateCard::getHeads ( void ) {
	// .../
	//! returns the number of configurable VGA heads This value may
	//! differ from the getCards() return value because there are
	//! possibly more than one head available on one card
	// ----
	if (! mImport) {
		return -1;
	}
	int mBoards  = getCards();
	int mDevices = mImport -> getCount();
	//====================================
	// check for NoteBooks, assume *2
	//------------------------------------
	if ( isNoteBook() ) {
		return mBoards * 2;
	}
	//====================================
	// get sysp card name
	//------------------------------------
	SaXImportSysp* pCard = new SaXImportSysp (SYSP_CARD);
	pCard -> doImport();
	QString mCardName;
	QTextOStream (&mCardName) <<
		pCard->getItem("Vendor") << ":" << pCard->getItem("Device");
	//====================================
	// import CDB DB for profile names
	//------------------------------------
	SaXProcess* pCDB = new SaXProcess();
	pCDB -> start ( CDB_CARDS );
	QDict< QDict<QString> > CDBData = pCDB -> getTablePointerCDB();
	//====================================
	// check profile names
	//------------------------------------
	int headCount = 0;
	int realCount = 0;
	int currentCard = mCard;
	while (1) {
		if (realCount >= mDevices) {
			selectCard (currentCard);
			return headCount;
		}
		selectCard (realCount);
		if ( CDBData[mCardName] ) {
			QDict<QString> CDBTable = *CDBData[mCardName];
			if (CDBTable["Profile"]) {
				QString mProfile = *CDBTable["Profile"];
				if (mProfile == "NVidia_DualHead_DriverOptions") {
					headCount += 2;
					realCount += 1;
					continue;
				}
				if (mProfile == "NVidia_DualHead") {
					headCount += 2;
					realCount += 2;
					continue;
				}
				if (mProfile == "Radeon_DualHead_DriverOptions") {
					headCount += 2;
					realCount += 1;
					continue;
				}
				if (mProfile == "Radeon_DualHead") {
					headCount += 2;
					realCount += 2;
					continue;
				}
				if (mProfile == "FGLRX_DualHead_DriverOptions") {
					headCount += 2;
					realCount += 1;
					continue;
				}
				if (mProfile == "FGLRX_DualHead") {
					headCount += 2;
					realCount += 2;
					continue;
				}
				if (mProfile == "Matrox_G400") {
					headCount += 2;
					realCount += 2;
					continue;
				}
				if (mProfile == "Matrox_G450") {
					headCount += 2;
					realCount += 2;
					continue;
				}
				if (mProfile == "Matrox_G550") {
					headCount += 2;
					realCount += 2;
					continue;
				}
			}
		}
		realCount++;
		headCount++;
	}
	//====================================
	// return board count, last chance
	//------------------------------------
	return mBoards;
}
Example #24
0
//=====================================
// XMouse virtual slots...
//-------------------------------------
bool XMouse::slotRun (int index) {
	if (XTemplate::slotRun (index)) {
	// log(L_INFO,"XMouse::slotRun() called: %d\n",index);
	// ...
	// this function is called if the mouse page is activated.
	// use this function to init the dialog with the current
	// setup of the mice
	// ---
	XWrapPointer< QDict<char> > mText (mTextPtr);	
	mStatus -> message (mText["RunXMouse"]);
	mFrame  -> nextButton() -> setText (mText["finish"]);

	// ...
	// get the mFiles pointer wrapper from the Intro
	// object which has read all the data files
	// ---
	QDict<XFile>* mFilePtr = mIntro->getFiles();
	XWrapFile < QDict<XFile> > mFiles (mFilePtr);

	// ...
	// fill the mouseList listbox with the 
	// configured simple pointer devices
	// --- 
	mouseList -> clear();
	mIndexList.clear();
	QString topic;
	XData* sysData;
	QDict<char> mouseInfo;
	int mice;
	mice = mFiles["sys_INPUT"]->getDeviceCount();
	int count = -1;
	for (int n=0; n<mice; n++) {
		count += 2;
		sysData = mFiles["sys_INPUT"] -> getDevice(count);
		if (! sysData) {
		continue;
		}
		mouseInfo = sysData -> getData();
		if (QString(mouseInfo["InputFashion"]).isNull()) {
			mouseInfo.insert ("InputFashion","Mouse");
		}
		if (QString(mouseInfo["InputFashion"]) != "Mouse") {
		continue;
		}
		QString topic (mouseInfo["Name"]);
		XStringList name (mouseInfo["Name"]);
		name.setSeperator (";");
		QList<char> mouseName = name.getList();
		if (mouseName.count() == 2) {
			topic.sprintf("%s %s",mouseName.at(0),mouseName.at(1));
		}
		QString topicStream;
		QTextOStream (&topicStream)
			<< topic << " ( " << mouseInfo["Protocol"] << " "
			<< mText["at"] << " " << mouseInfo["Device"] << " )";
		topic = topicStream;
		int* index = (int*) malloc (sizeof(int));
		*index = count;
		mIndexList.append (index);
		mouseList -> insertItem (
			QPixmap(PIXINTROMOUSE),topic
		);
	}
	// ...
	// enable/disable configure/remove buttons
	// and select first element of the listbox
	// ---
	if (mice > 0) {
		mDel   -> setDisabled ( false );
		mSetup -> setDisabled ( false );
		mouseList -> setCurrentItem ( 0 );
		mouseList -> setSelected    ( 0,true );
		mSelected = 0;
	} else {
		mDel   -> setDisabled ( true );
		mSetup -> setDisabled ( true );
	}
	}
	return (TRUE);
}
Example #25
0
//=====================================
// XMouse slotTopOk...
//-------------------------------------
void XMouse::slotTopOk (void) {
	// log (L_INFO,"XMouse::slotTopOk() called\n");
	// ...
	// this function is called if you click onto the OK 
	// button in the setup toplevel window
	// ---
	mFrame -> enterEvent ( 0 );
	bool newMouse = false;
	switch (mState) {
	case MOUSE_NEW:
		if (mouseList->count() > 0) {
			mWorkingIndex = *mIndexList.at(mouseList->count()-1);
			mWorkingIndex+= 2;
		} else {
			mWorkingIndex = 1;
		}
		newMouse = true;
	break;
	case MOUSE_SETUP:
		mWorkingIndex = *mIndexList.at(mSelected);
		newMouse = false;
	break; 
	}

	// ...
	// create the text pointer wrapper object and
	// get the mFiles pointer wrapper from the Intro
	// object which has read all the data files
	// ---
	XWrapPointer< QDict<char> > mText (mTextPtr);
	QDict<XFile>* mFilePtr = mIntro->getFiles();
	XWrapFile < QDict<XFile> > mFiles (mFilePtr);

	// ...
	// get the workingMouse pointer wrapper. If a new mouse
	// should be added use addDevice to create a new object
	// otherwhise get the device according to the selection 
	// made in mouseList and clear the contents
	// ---
	XWrapPointer<XData> workingMouse;
	if (newMouse) {
		while (mFiles["sys_INPUT"]->getDevice (mWorkingIndex)) {
			mWorkingIndex+= 2;
		}
		workingMouse.init (
		mFiles["sys_INPUT"]->addDevice (mWorkingIndex)
		);
	} else {
		workingMouse.init (
		mFiles["sys_INPUT"]->getDevice (mWorkingIndex)
		);
	}

	// ...
	// set the selection data from the CDB if the user requested 
	// a new mouse from the list. The data set here may be overwritten
	// from the manual setup made after the vendor/name selection
	// ---
	// check first if the selection differs from
	// the current settings
	// ---
	bool changeRequest = false;
	QString* mouseName = new QString();
	mouseName -> sprintf ("%s;%s",
		mVendor->currentText().ascii(),mName->currentText().ascii()
	);
	if (! newMouse) {
	if (*mouseName != QString(workingMouse["Name"])) {
		changeRequest = true;
	}
	} else {
		changeRequest = true;
	}
	QDict<char>* spec = NULL;
	XDb* pCDB = mFiles["cdb_POINTER"]->cdbGetSpec (
		mVendor->currentText(),mName->currentText()
	);
	if ((pCDB) && (changeRequest)) {
		spec = pCDB -> getHash();
		// ...
		// clear the working mouse contents...
		// ---
		workingMouse.clear();
		// ...
		// set base items for the mouse...
		// ---
		QString* ident  = new QString;
		ident -> sprintf ("Mouse[%d]",mWorkingIndex);
		workingMouse.setPair ("InputFashion","Mouse");
		workingMouse.setPair ("Identifier",ident->ascii());
		workingMouse.setPair ("Name", mouseName->ascii());
		// ...
		// set CDB data information...
		// ---
		QDictIterator<char> it (*spec);
		for (; it.current(); ++it) {
		QString* key = new QString (it.currentKey());
		QString* val = new QString;
		val->sprintf("%s",it.current());
		if (val->isEmpty()) {
			continue;
		}
		workingMouse.setPair (
			key->ascii(),val->ascii()
		);
		}
	}

	// ...
	// handle manual setup parameters outside the CDB vendor/name
	// selection: Port setup and special features like
	// Wheel, WheelEmulation and ButtonEmulation
	// ---
	// Port
	QString* currentPort = new QString (mPort -> currentText());
	workingMouse.setPair ("Device",
		currentPort->ascii()
	);
	// Emulate3Buttons
	workingMouse.setPair ("Emulate3Buttons","no");
	if (mCheckEmulate -> isChecked()) {
		workingMouse.setPair ("Emulate3Buttons","on");
	}
	// Wheel
	workingMouse.setPair ("ZAxisMapping","off");
	if (mCheckWheel -> isChecked()) {
		workingMouse.setPair (
			"ZAxisMapping","4 5"
		);
		if ( spec ) {
		XWrapPointer< QDict<char> > selectedMouse ( spec );
		if (selectedMouse["ZAxisMapping"]) {
			QString* zmap = new QString(
				selectedMouse["ZAxisMapping"]
			);
			workingMouse.setPair (
				"ZAxisMapping",zmap->ascii()
			);
		} 
		}
	}
	// Emulate Wheel
	workingMouse.setPair ("EmulateWheel","no");
	if (mCheckWheelEmu -> isChecked()) {
		QString* button = new QString(mWheelKey->text());
		workingMouse.setPair ("EmulateWheel",button->ascii());
	}
	
	// ...
	// add an entry to mouseList if a new mouse 
	// should be added to the system. Otherwhise update
	// the current entry of the mouseList if changed
	// ---
	if (newMouse) {
	if (pCDB) {
		QString topic;
		XData* sysData = mFiles["sys_INPUT"] -> getDevice(mWorkingIndex);
		if (sysData) {
			QDict<char> mouseInfo = sysData -> getData();
			QTextOStream (&topic)
				<< mVendor->currentText() << " " << mName->currentText()
				<< " ( " << mouseInfo["Protocol"] << " " << mText["at"] << " "
				<< mouseInfo["Device"] << " )";
			int* newIndex = (int*) malloc(sizeof(int));
			*newIndex = mWorkingIndex;
			mIndexList.append (newIndex);
			mouseList -> insertItem (
				QPixmap(PIXINTROMOUSE),topic
			);
			mSelected = mIndexList.find ( newIndex );
			mouseList -> setSelected ( mSelected,true );
			mouseList -> setCurrentItem ( mSelected );
			mDel      -> setDisabled ( false );
			mSetup    -> setDisabled ( false );
		}
	}
	} else {
		QString topic;
		if (pCDB) {
			QTextOStream (&topic)
				<< mVendor->currentText() << " " << mName->currentText()
				<< " ( " << workingMouse["Protocol"] << " " << mText["at"] 
				<< " " << workingMouse["Device"] << " )";
		} else {
			QTextOStream (&topic)
				<< workingMouse["Name"]
				<< " ( " << workingMouse["Protocol"] << " " << mText["at"]
				<< " " << workingMouse["Device"] << " )";
		}
		mouseList -> changeItem (
			QPixmap(PIXINTROMOUSE),topic,mSelected
		);
	}
}
Example #26
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;
}
Example #27
0
//====================================
// Constructor
//------------------------------------
SCCMonitor::SCCMonitor (
	QWidgetStack* stack, QDict<QString>* text,
	QDict<SaXImport> section, QWidget* parent
) : SCCDialog ( stack,text,section,parent ) {
	//=====================================
	// get translation pointer
	//-------------------------------------
	SCCWrapPointer< QDict<QString> > mText (mTextPtr);

	//=====================================
	// check for graphics cards
	//-------------------------------------
	SaXManipulateCard saxCard ( mSection["Card"] );
	mCard = saxCard.getDevices();

	//=====================================
	// create monitor dialog
	//-------------------------------------
	mMonitorTab = new QTabWidget ( mDialogFrame );
	mCheck3D    = new QCheckBox  ( mText["Activate3D"],mDialogFrame );

	//=====================================
	// connect widgets
	//-------------------------------------
	QObject::connect (
		mCheck3D , SIGNAL (clicked        ( void )),
		this     , SLOT   (slotActivate3D ( void ))
	);
	//=====================================
	// add widgets to the layout
	//-------------------------------------
	mDialogLayout -> addWidget  ( mMonitorTab );
	mDialogLayout -> addSpacing ( 15 );
	mDialogLayout -> addWidget  ( mCheck3D );

	//=====================================
	// create arrangement dialog
	//-------------------------------------
	mMonitorArrange = 0;
	if ( mCard > 1 ) {
		mMonitorArrange = new SCCMonitorArrange ( text,section,this );
	}
	//=====================================
	// create basic display tabs
	//-------------------------------------
	for ( int n=0;n<mCard;n++) {
		QString displayName;
		QTextOStream (&displayName) << mText["Display"] << " " << (n + 1);
		SCCMonitorDisplay* display = new SCCMonitorDisplay (
			text,section,n,this
		);
		mMonitorTab -> addTab (
			display, displayName
		);
		display -> init();
		display -> import();
		//=====================================
		// connect monitors activate checkbox
		//-------------------------------------
		QObject::connect (
			display , SIGNAL (sigActivate  ( void )),
			this    , SLOT   (slotActivate ( void ))
		);
		//=====================================
		// connect monitors dualhead checkbox
		//-------------------------------------
		if ( mMonitorArrange ) {
			QObject::connect (
				display, SIGNAL (
					sigDualModeChanged ( SCCMonitorDisplay* )
				),
				mMonitorArrange, SLOT (
					slotDualModeChanged ( SCCMonitorDisplay* )
				)
			);
		}
		//=====================================
		// connect monitor dual popup slotOk
		//-------------------------------------
		if ( mMonitorArrange ) {
			SCCMonitorDual* mMonitorDual = display->getDualData();
			QObject::connect (
				mMonitorDual, SIGNAL (
					sigDualModeChanged (SCCMonitorDisplay*)
				),
				mMonitorArrange, SLOT (
					slotDualModeChanged ( SCCMonitorDisplay* )
				)
			);
		}
		//=====================================
		// connect monitor model popup slotOk
		//-------------------------------------
		if ( mMonitorArrange ) {
			SCCMonitorModel* mMonitorModel = display->getMonitorData();
			QObject::connect (
				mMonitorModel, SIGNAL (
					sigMonitorChanged  (SCCMonitorDisplay*)
				),
				mMonitorArrange, SLOT (
					slotMonitorChanged (SCCMonitorDisplay*)
				)
			);
		}
		mMonitorDisplay.append ( display );
	}
	//=====================================
	// finish creation of arrangement dialog
	//-------------------------------------
	if ( mMonitorArrange ) {
		mMonitorTab -> addTab (
			mMonitorArrange,mText["Arrange"]
		);
		mMonitorArrange -> init();
		mMonitorArrange -> import();
	}
}
HistoryDialog::HistoryDialog(Kopete::MetaContact *mc, QWidget* parent,
	const char* name) : KDialogBase(parent, name, false,
		i18n("History for %1").arg(mc->displayName()), 0), mSearching(false)
{
	QString fontSize;
	QString htmlCode;
	QString fontStyle;

	kdDebug(14310) << k_funcinfo << "called." << endl;
	setWFlags(Qt::WDestructiveClose);	// send SIGNAL(closing()) on quit

	// FIXME: Allow to show this dialog for only one contact
	mMetaContact = mc;

	

	// Widgets initializations
	mMainWidget = new HistoryViewer(this, "HistoryDialog::mMainWidget");
	mMainWidget->searchLine->setFocus(); 
	mMainWidget->searchLine->setTrapReturnKey (true);
	mMainWidget->searchLine->setTrapReturnKey(true);
	mMainWidget->searchErase->setPixmap(BarIcon("locationbar_erase"));

	mMainWidget->contactComboBox->insertItem(i18n("All"));
	mMetaContactList = Kopete::ContactList::self()->metaContacts();
	QPtrListIterator<Kopete::MetaContact> it(mMetaContactList);
	for(; it.current(); ++it)
	{
		mMainWidget->contactComboBox->insertItem((*it)->displayName());
	}

	if (mMetaContact)
		mMainWidget->contactComboBox->setCurrentItem(mMetaContactList.find(mMetaContact)+1);

	mMainWidget->dateSearchLine->setListView(mMainWidget->dateListView);
	mMainWidget->dateListView->setSorting(0, 0); //newest-first

	setMainWidget(mMainWidget);

	// Initializing HTML Part
	mMainWidget->htmlFrame->setFrameStyle(QFrame::WinPanel | QFrame::Sunken);
	QVBoxLayout *l = new QVBoxLayout(mMainWidget->htmlFrame);
	mHtmlPart = new KHTMLPart(mMainWidget->htmlFrame, "htmlHistoryView");

	//Security settings, we don't need this stuff
	mHtmlPart->setJScriptEnabled(false);
	mHtmlPart->setJavaEnabled(false);
	mHtmlPart->setPluginsEnabled(false);
	mHtmlPart->setMetaRefreshEnabled(false);
        mHtmlPart->setOnlyLocalReferences(true);

	mHtmlView = mHtmlPart->view();
	mHtmlView->setMarginWidth(4);
	mHtmlView->setMarginHeight(4);
	mHtmlView->setFocusPolicy(NoFocus);
	mHtmlView->setSizePolicy(
	QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
	l->addWidget(mHtmlView);

	QTextOStream( &fontSize ) << KopetePrefs::prefs()->fontFace().pointSize();
	fontStyle = "<style>.hf { font-size:" + fontSize + ".0pt; font-family:" + KopetePrefs::prefs()->fontFace().family() + "; color: " + KopetePrefs::prefs()->textColor().name() + "; }</style>";

	mHtmlPart->begin();
	htmlCode = "<html><head>" + fontStyle + "</head><body class=\"hf\"></body></html>";
	mHtmlPart->write( QString::fromLatin1( htmlCode.latin1() ) );
	mHtmlPart->end();

	
	connect(mHtmlPart->browserExtension(), SIGNAL(openURLRequestDelayed(const KURL &, const KParts::URLArgs &)),
		this, SLOT(slotOpenURLRequest(const KURL &, const KParts::URLArgs &)));
	connect(mMainWidget->dateListView, SIGNAL(clicked(QListViewItem*)), this, SLOT(dateSelected(QListViewItem*)));
	connect(mMainWidget->searchButton, SIGNAL(clicked()), this, SLOT(slotSearch()));
	connect(mMainWidget->searchLine, SIGNAL(returnPressed()), this, SLOT(slotSearch()));
	connect(mMainWidget->searchLine, SIGNAL(textChanged(const QString&)), this, SLOT(slotSearchTextChanged(const QString&)));
	connect(mMainWidget->searchErase, SIGNAL(clicked()), this, SLOT(slotSearchErase()));
	connect(mMainWidget->contactComboBox, SIGNAL(activated(int)), this, SLOT(slotContactChanged(int)));
	connect(mMainWidget->messageFilterBox, SIGNAL(activated(int)), this, SLOT(slotFilterChanged(int )));
	connect(mHtmlPart, SIGNAL(popupMenu(const QString &, const QPoint &)), this, SLOT(slotRightClick(const QString &, const QPoint &)));

	//initActions
	KActionCollection* ac = new KActionCollection(this);
	mCopyAct = KStdAction::copy( this, SLOT(slotCopy()), ac );
	mCopyURLAct = new KAction( i18n( "Copy Link Address" ), QString::fromLatin1( "editcopy" ), 0, this, SLOT( slotCopyURL() ), ac );

	resize(650, 700);
	centerOnScreen(this);

	// show the dialog before people get impatient
	show();

	// Load history dates in the listview
	init();
}
Example #29
0
//=====================================
// main program...
//-------------------------------------
int main(int argc,char*argv[]) {
	//=====================================
	// init variables...
	//-------------------------------------
	bool uniFont    = false;
	bool noBorder   = false;
	bool fastSetup  = false;
	bool withDialog = false;
	bool yastMode   = false;
	bool useHwData  = false;
	bool fullScreen = false;
	bool setInfo    = false;
	bool set3D      = false;
	bool setXIdle   = false;
	bool checkPacs  = false;
	for (int n=0;n<argc;n++) {
	if (strcmp(argv[n],"-style") == 0) {
		globalStyle = (char*) malloc (sizeof(char) * 128);
		sprintf(globalStyle,"%s",argv[n+1]);
		break;
	}
	}

	//=====================================
	// check for root priviliges...
	//-------------------------------------
	if (! accessAllowed()) {
		fprintf (stderr,"xapi: only root can do this\n");
		usage();
	}

	//=====================================
	// start logging...
	//-------------------------------------
	logInit();

	//=====================================
	// allocate main qt object...
	//-------------------------------------
	for (int i=0;i<argc;i++) {
	QString item (argv[i]);
	if ((item == "-h") || (item == "--help")) {
		logExit(); usage(); exit(0);
	}
	}
	QApplication app(argc,argv);

	//=====================================
	// get additional options...
	//-------------------------------------
	QString* idlePID     = NULL;
	QString* cardName3D  = NULL;
	QString* popUpDialog = NULL;
	QString* cardDriver  = NULL;
	while (1) {
	int option_index = 0;
	static struct option long_options[] =
	{
		{"usehwdata"  , 0 , 0 , 'u'},
		{"fullscreen" , 0 , 0 , 'l'},
		{"info"       , 0 , 0 , 'i'},
		{"yast"       , 0 , 0 , 'y'},
		{"checkpacs"  , 0 , 0 , 'c'},
		{"noborder"   , 0 , 0 , 'n'},
		{"3d"         , 1 , 0 , 'D'},
		{"driver"     , 1 , 0 , 'd'},
		{"frameWidth" , 1 , 0 , 'w'},
		{"dialog"     , 1 , 0 , 'O'},
		{"unifont"    , 0 , 0 , 'U'},
		{"xidle"      , 0 , 0 , 'x'},
		{"pid"        , 1 , 0 , 'p'},
		{"fast"       , 0 , 0 , 'f'},
		{"help"       , 0 , 0 , 'h'},
		{0            , 0 , 0 , 0  }
	};
	int c = getopt_long (
		argc, argv, "uicD:fhxlw:d:yp:nUO:",long_options, &option_index
	);
	if (c == -1)
	break;

	switch (c) {
	case 0:
		fprintf (stderr,"xapi: option %s", long_options[option_index].name);
		if (optarg)
		fprintf (stderr," with arg %s", optarg);
		fprintf (stderr,"\n");
	break;

	case 'f':
		fastSetup  = true;
	break;

	case 'U':
		uniFont  = true;
	break;

	case 'O':
		withDialog  = true;
		popUpDialog = new QString (optarg);
	break;

	case 'n':
		noBorder = true;
	break;

	case 'y':
		yastMode = true;
	break;

	case 'w':
		globalFrameWidth = atoi (optarg);
	break;

	case 'u':
		useHwData  = true;
	break;

	case 'l':
		fullScreen = true;
	break;

	case 'i':
		setInfo    = true;
	break;

	case 'c':
		checkPacs  = true;
	break;

	case 'D':
		set3D      = true;
		cardName3D = new QString (optarg);
	break;

	case 'p':
		idlePID    = new QString (optarg);
	break;

	case 'd':
		cardDriver = new QString (optarg);
	break;

	case 'x':
		setXIdle   = true;
	break;

	case 'h':
		logExit(); usage();
	break;
	default:
		logExit(); exit(1);
	}
	}

	//=====================================
	// check if xapi should act as xidle
    //-------------------------------------
	if (setXIdle) {
		XTimeElapsed* idleTimer = new XTimeElapsed ( idlePID );
		app.setMainWidget (idleTimer);
		idleTimer->show();
		return app.exec();
	}

	//=====================================
	// check md5 sum of current config
	//-------------------------------------
	if ((! setInfo) && (! set3D) && (! checkPacs) &&
		(! useHwData) && (! fastSetup)
	) {
	bool createMD5sum = false;
	QFileInfo xc (MD5CONFIG);
	if (xc.exists()) {
		QString mD5Sum = qx(MD5,STDOUT,1,"%s",XCONFIG);
		QFile mHandle (MD5CONFIG); 
		if (mHandle.open(IO_ReadOnly)) {
		QString compare;
		mHandle.readLine(compare,MAX_LINE_LENGTH);
		mHandle.close();
		compare = compare.stripWhiteSpace();
		if (compare == mD5Sum) {
			fastSetup = true;
		} else {
			fastSetup = false;
		}
		} 
	} else {
		fastSetup = false;
	}
	if (createMD5sum) {
		QString mD5Sum = qx(MD5,STDOUT,1,"%s",XCONFIG);
		QFile mHandle (MD5CONFIG);
		if (mHandle.open(IO_WriteOnly)) {
			mHandle.writeBlock (mD5Sum.ascii(),mD5Sum.length());
			mHandle.close();
		}
	}
	} 

	//=====================================
	// check option combinations...
	//-------------------------------------
	if (useHwData == true) {
		fastSetup = false;
	}

	//=====================================
	// set root window cursor to the watch
	//-------------------------------------
	setMouseCursor ("watch");

	//=====================================
	// init program...
	//-------------------------------------
	QWidget::WFlags wflags = Qt::WType_TopLevel;
	if (noBorder) {
		wflags |= Qt::WStyle_Customize | Qt::WStyle_NoBorder;
	}
	if (uniFont) {
		QFont currentFont = QFont( "Helvetica", 12 );
		currentFont.setStyleHint( QFont::SansSerif, QFont::PreferBitmap );
		currentFont.setRawName (UNIFONT);
		qApp->setFont (currentFont);
	}
	xapi = new XFrame (
		globalFrameWidth, wflags
	);
	if (setInfo) {
		signal (SIGHUP ,gotKill);
		signal (SIGKILL,gotKill);
		signal (SIGABRT,gotKill);
		signal (SIGTERM,gotKill);
		XInfo infoBox (xapi);
		infoBox.showIntroBox();
		logExit();
		setMouseCursor ();
		exit (
			infoBox.returnCode()
		);
	}
	if (set3D) {
		XInfo infoBox (xapi);
		infoBox.show3DBox (*cardName3D,cardDriver);
		printf("%d\n",infoBox.returnCode());
		logExit();
		setMouseCursor ();
		exit (
			infoBox.returnCode()
		);
	}
	if (fastSetup) {
		xapi->fastSetup  = true;
	}
	if (useHwData) {
		xapi->useHwData  = true;
	}
	if (fullScreen) {
		xapi->fullScreen = true;
	}
	if (yastMode) {
		xapi->yastMode   = true;
	}

	//=====================================
	// check 3D environment
	//-------------------------------------
	XStringList packageInfo ( qx (GET3D,STDOUT) );
	packageInfo.setSeperator (":");
	QString package = packageInfo.getList().at(0);
	QString real3d  = packageInfo.getList().at(1);
	QString soft3d  = packageInfo.getList().at(2);
	QString general = packageInfo.getList().at(3);
	QString active  = packageInfo.getList().at(4);
	QString answer  = packageInfo.getList().at(5);
	QString flag    = packageInfo.getList().at(6);
	global3DActive  = active.toInt();
	QString status1 ("1");
	if (checkPacs) {
		// ...
		// if the 3D Answer was no, there is no need
		// to check for any packages or scripts
		// ---
		if (answer == "no") {
			setMouseCursor (); exit (0);
		}
		// ...
		// install the missing packages using YaST2
		// sw_single mode
		// ---
		if (package != "<none>") {
		if (setMessage("InstallPackage",xapi)) {
		status1 = qx (
			GETINSTALLED,STDOUT,1,"%s",package.ascii()
		);
		}
		}
		setMouseCursor ();
		exit (0);
	}

	//=====================================
	// remove lilo code file...
	//-------------------------------------
	unlink (LILOCODE);

	//=====================================
	// init main frame...
	//-------------------------------------
	if (! xapi->frameInitialized()) {
		xapi->setFrame ();
	}

	//=====================================
	// set signal handler...
	//-------------------------------------
	signal (SIGUSR2,SIG_IGN);
	signal (SIGINT ,gotInterrupted);

	//=====================================
	// init dialogs...
	//-------------------------------------
	XIntro*			intro    = new XIntro();
	XAccessX*		xaccess  = new XAccessX();
	XMouse*			mouse    = new XMouse();
	XCard*			card     = new XCard();
	XDesktop*		desktop  = new XDesktop();
	XDisplayGeometry*	geo  = new XDisplayGeometry();
	XKeyboard*		keyboard = new XKeyboard();
	XLayout*		layout   = new XLayout();
	XMonitor*		monitor  = new XMonitor();
	XMultihead*		multi    = new XMultihead();
	XTablet*		tablet   = new XTablet();
	XTouchScreen*	toucher  = new XTouchScreen();
	XOpenGL*        opengl   = new XOpenGL();
	XVirtual*       virtuals = new XVirtual();
	Xvnc*           vnc      = new Xvnc();

	intro     -> addTo (xapi);
	xaccess   -> addTo (xapi,intro);
	mouse     -> addTo (xapi,intro);
	card      -> addTo (xapi,intro);
	desktop   -> addTo (xapi,intro);
	geo       -> addTo (xapi,intro);
	keyboard  -> addTo (xapi,intro);
	layout    -> addTo (xapi,intro);
	monitor   -> addTo (xapi,intro);
	multi     -> addTo (xapi,intro);
	tablet    -> addTo (xapi,intro);
	toucher   -> addTo (xapi,intro);
	opengl    -> addTo (xapi,intro);
	virtuals  -> addTo (xapi,intro);
	vnc       -> addTo (xapi,intro);

	//=====================================
	// save intro pointer...
	//-------------------------------------
	introPointer = intro;

	//=====================================
	// make sure the serverlayout structure
	// is created at least one time
	//-------------------------------------
	XLayout* layoutDialog;
	layoutDialog = (XLayout*) intro -> retrieve (Layout);
	layoutDialog -> setupLayout();

	//=====================================
	// make sure the card dialog was build
	// in init stage
	//-------------------------------------
	XCard* cardDialog;
	cardDialog = (XCard*) intro -> retrieve (Card);
	cardDialog -> showSetupWindow (false);
	cardDialog -> slotRun (Card);
	cardDialog -> showSetupWindow (true);

	//=====================================
	// call resetPage of the desktop dialog
	// to check for framebuffer usage
	//-------------------------------------
	XDesktop* desktopDialog;
	desktopDialog = (XDesktop*) intro -> retrieve (Colors);
	desktopDialog -> resetPage ( PAGE_RELOAD );

	//=====================================
	// add margin around pushbutton texts 
	// this is only needed for QT3 
	//------------------------------------- 
	#if 1
	QObject* obj;
	QObjectList* l = xapi->queryList( "QPushButton" );
	QObjectListIt it( *l );
	QDict<char>* mText = xapi->getTextPointer();
	while ( (obj=it.current()) != 0 ) {
	++it;
	QPushButton* btn = (QPushButton*) obj;
	QString text = btn->text();
	if (! text.isNull()) {
		QDictIterator<char> n (*mText);
		for (; n.current(); ++n) {
		if (n.current() == text) {
			QString* newText = new QString();
			QTextOStream (newText) << "  " << text << "  ";
			mText->replace (n.currentKey(),*newText);
			break;
		}
		}
		QString addText;
		QTextOStream (&addText) << "  " << text << "  ";
		btn->setText (addText);
	}
	}
	delete l;
	// ...
	// special keys which are used dynamically on widgets
	// with initially other texts
	// ---
	QList<char> keyList;
	keyList.append ( "finish" );
	keyList.append ( "Next" );
	QListIterator<char> io ( keyList );
	for (; io.current(); ++io) {
		QString key ( io.current() );
		QString curText (mText->operator[](key));
		QString* newText = new QString();
		QTextOStream (newText) << "  " << curText << "  ";
		mText->replace (key,*newText);
	}
	#endif

	//=====================================
	// remove xfine cache directory...
	//-------------------------------------
	removeXFineCache();

	//=====================================
    // go to main event loop...
    //-------------------------------------
	app.setMainWidget(xapi);
	xapi -> show();
	xapi -> enterEvent ( 0 );
	xapi -> activateFirstItem();
	setMouseCursor();
	if (! withDialog) {
		intro -> checkDetected();
	} else {
		if ( *popUpDialog == "Monitor" ) {
			xapi -> runDialog (Monitor);
		} else
		if ( *popUpDialog == "Card") {
			xapi -> runDialog (Card);
		} else {
			fprintf (stderr,"xapi: no such dialog: %s\n",popUpDialog->ascii());
			exit (1);
		}
	}
	return app.exec();
}
Example #30
0
//====================================
// storeDataCDB...
//------------------------------------
void SaXProcess::storeDataCDB (int fileID) {
	// .../
	//! Store CDB based group records into the CDB
	//! dictionary. The given file ID must be able to
	//! become resolved into a valid CDB file
	// ----
	QString file;
	switch (fileID) {
		case CDB_CARDS:
			file = CDBCARDS;
		break;
		case CDB_MONITORS:
			file = CDBMONITORS;
		break;
		case CDB_PENS:
			file = CDBPENS;
		break;
		case CDB_PADS:
			file = CDBPADS;
		break;
		case CDB_POINTERS:
			file = CDBPOINTERS;
		break;
		case CDB_TABLETS:
			file = CDBTABLETS;
		break;
		case CDB_TOUCHERS:
			file = CDBTOUCHERS;
		break;
		default:
			excCDBFileFailed ();
			qError (errorString(),EXC_CDBFILEFAILED);
		break;
	}
	//====================================
	// search all entries for file
	//------------------------------------
	DIR* CDBDir = 0;
	struct dirent* entry = 0;
	CDBDir = opendir (CDBDIR);
	QList<QString> fileList;
	if (! CDBDir) {
		excFileOpenFailed ( errno );
		qError (errorString(),EXC_FILEOPENFAILED);
		return;
	}
	while (1) {
		entry = readdir (CDBDir);
		if (! entry) {
			break;
		}
		QString* updateFile = new QString();
		QTextOStream (updateFile) << CDBDIR << entry->d_name;
		if (*updateFile == file) {
			continue;
		}
		if ((updateFile->contains(file)) && (entry->d_type != DT_DIR)) {
			fileList.append (*updateFile);
		}
	}
	closedir (CDBDir);
	fileList.append (file);
	QString it;

	//====================================
	// read in file list
	//------------------------------------
	foreach (it,fileList) {
		QFile* handle = new QFile (it.ascii());
		if (! handle -> open(IO_ReadOnly)) {
			excFileOpenFailed ( errno );
			qError (errorString(),EXC_FILEOPENFAILED);
			return;
		}
		char line[MAX_LINE_LENGTH];
		QString group,key,val;
		while ((handle->readLine (line,MAX_LINE_LENGTH)) != 0) {
			QString string_line(line);
			string_line.truncate(string_line.length()-1);
			if ((string_line[0] == '#') || (string_line.isEmpty())) {
				if (handle->atEnd()) {
					break;
				}
				continue;
			}
			int bp = string_line.find('{');
			if (bp >= 0) {
				QStringList tokens = QStringList::split ( ":", string_line );
				QString vendor = tokens.first();
				QString name   = tokens.last();
				name.truncate(
					name.find('{')
				);
				name   = name.stripWhiteSpace();
				vendor = vendor.stripWhiteSpace();
				group = vendor+":"+name;
			} else {
				bp = string_line.find('}');
				if (bp >= 0) {
					continue;
				}
				QStringList tokens = QStringList::split ( "=", string_line );
				key = tokens.first();
				val = tokens.last();
				val = val.stripWhiteSpace();
				key = key.stripWhiteSpace();
				// ... /
				// CDB keys and ISAX keys are not the same,
				// check this and adapt to ISAX keys
				// ---
				if (key == "Hsync") {
					key = "HorizSync";
				}
				if (key == "Vsync") {
					key = "VertRefresh";
				}
				if (key == "Modeline") {
					key = "SpecialModeline";
				}
				addGroup (group,key,val);
			}
			if (handle->atEnd()) {
				break;
			}
		}
		handle -> close();
	}