//===================================== // slotName //------------------------------------- void SCCMonitorDualModel::slotName ( QListBoxItem* item ) { //===================================== // check manipulator access //------------------------------------- if (! mSaxDesktop ) { return; } //===================================== // include frequencies //------------------------------------- mCDBMonitorData = mSaxDesktop->getCDBMonitorData ( mVendorList->selectedItem()->text(),item->text() ); mHSpinMin -> setValue ( 30 ); mHSpinMax -> setValue ( 50 ); mVSpinMin -> setValue ( 50 ); mVSpinMax -> setValue ( 60 ); QDictIterator<QString> it (mCDBMonitorData); for (; it.current(); ++it) { QString key = it.currentKey(); QString val = *it.current(); if (key == "VertRefresh") { QStringList tokens = QStringList::split ( "-", val ); mVSpinMin -> setValue ( tokens.first().toInt() ); mVSpinMax -> setValue ( tokens.last().toInt() ); } if (key == "HorizSync") { QStringList tokens = QStringList::split ( "-", val ); mHSpinMin -> setValue ( tokens.first().toInt() ); mHSpinMax -> setValue ( tokens.last().toInt() ); } } }
//===================================== // XAccessX reset and switch to Intro //------------------------------------- void XAccessX::resetPage (int reload) { // ... // this function is called if the xaccess dialog is finished or canceled // AccessX is an X11 extension which need a seperate configuration file // which is outside of the normal configuration create via ISaX. Therefore // we don`t need to serialize any data here // --- if (reload == PAGE_RELOAD) { if (mEnable -> isChecked()) { QFile* mHandle = new QFile ( "/usr/X11R6/lib/X11/xkb/X0-config.keyboard" ); if (! mHandle -> open(IO_WriteOnly)) { log (L_ERROR, "XAccessX::open failed on: %s -> %s\n", mHandle->name().ascii(),strerror(errno) ); } QString* speed = new QString(); speed -> sprintf ( "%d",mLCD -> intValue() ); QDict<char> data; data.insert ("MouseKeysMaxSpeed=" , speed->ascii() ); data.insert ("MouseKeysDelay=" , "40"); data.insert ("MouseKeysInterval=" , "10" ); data.insert ("MouseKeysTimeToMax=", "1000" ); data.insert ("MouseKeysCurve=" , "0" ); data.insert ("Controls+=","MouseKeysAccel"); #if 0 data.insert ("Controls+=", "MouseKeysAccel + AccessxKeys" ); data.insert ("Feedback+=", "SlowKeysPress + SlowKeysAccept + StickyKeys + LatchToLock" ); #endif QDictIterator<char> it (data); for (; it.current(); ++it) { QString line; line.sprintf ("%s %s\n", it.currentKey().ascii(),it.current() ); mHandle -> writeBlock ( line.ascii(),line.length() ); } mHandle -> close(); } } if (reload == PAGE_RELOAD) { slotApply(); } mStatus -> clear(); slotIntro (mIndex); XTemplate::resetPage (); mStack -> raiseWidget (Intro); }
/** return the maximum resolution in the list of images */ float GeoImageList::maxResolution() { if (!minMaxResUptodate_) { minRes_ = -1; maxRes_ = 500; qDebug("GeoImageList::maxResolution"); QDictIterator < GeoImage > it = QDictIterator < GeoImage > (*this); for (; it.current(); ++it) { GeoImage *img = it.current(); qDebug("%s: xres: %f yres: %f", (img->filename()).latin1(), img->resolutionX(), img->resolutionY()); float res = it.current()->resolutionX(); if (res > minRes_) minRes_ = res; if (res < maxRes_) maxRes_ = res; res = it.current()->resolutionY(); if (res > minRes_) minRes_ = res; if (res < maxRes_) maxRes_ = res; } minMaxResUptodate_ = true; } return maxRes_; }
bool RKComponent::isValid () { RK_TRACE (PLUGIN); for (QDictIterator<RKComponentBase> it (child_map); it.current (); ++it) { if (!(it.current ()->isSatisfied ())) return false; } return true; }
bool KAccel::setKeyDict( QDict<KKeyEntry> nKeyDict ) { kdebug(KDEBUG_INFO, 125, "Disconenct and remove"); // Disconnect and remove all items in pAccel QDictIterator<KKeyEntry> *aKeyIt = new QDictIterator<KKeyEntry>( aKeyDict ); aKeyIt->toFirst(); #define pE aKeyIt->current() while( pE ) { QString s; if ( pE->aAccelId && pE->aCurrentKeyCode ) { pAccel->disconnectItem( pE->aAccelId, pE->receiver, pE->member ); pAccel->removeItem( pE->aAccelId ); } ++*aKeyIt; } #undef pE kdebug(KDEBUG_INFO, 125, "Clear the dictionary"); // Clear the dictionary aKeyDict.clear(); kdebug(KDEBUG_INFO, 125, "Insert new items"); // Insert the new items into the dictionary and reconnect if neccessary // Note also swap config and current key codes !!!!!! delete aKeyIt; // tanghus aKeyIt = new QDictIterator<KKeyEntry>( nKeyDict ); aKeyIt->toFirst(); #define pE aKeyIt->current() KKeyEntry *pEntry; while( pE ) { pEntry = new KKeyEntry; aKeyDict.insert( aKeyIt->currentKey(), pEntry ); pEntry->aDefaultKeyCode = pE->aDefaultKeyCode; // Note we write config key code to current key code !! pEntry->aCurrentKeyCode = pE->aConfigKeyCode; pEntry->aConfigKeyCode = pE->aConfigKeyCode; pEntry->bConfigurable = pE->bConfigurable; pEntry->aAccelId = pE->aAccelId; pEntry->receiver = pE->receiver; pEntry->member = pE->member; pEntry->descr = pE->descr; // tanghus if ( pEntry->aAccelId && pEntry->aCurrentKeyCode ) { pAccel->insertItem( pEntry->aCurrentKeyCode, pEntry->aAccelId ); pAccel->connectItem( pEntry->aAccelId, pEntry->receiver, pEntry->member); } ++*aKeyIt; } #undef pE delete aKeyIt; // tanghus return true; }
bool KGlobalAccel::x11EventFilter( const XEvent *event_ ) { if ( aKeyDict.isEmpty() ) return false; if ( event_->type != KeyPress ) return false; uint mod=event_->xkey.state & (ControlMask | ShiftMask | Mod1Mask); uint keysym= XKeycodeToKeysym(qt_xdisplay(), event_->xkey.keycode, 0); debug("Key press event :: mod = %d, sym =%d", mod, keysym ); KKeyEntry *pEntry =0; const char *action; QDictIterator<KKeyEntry> *aKeyIt = new QDictIterator<KKeyEntry>( aKeyDict ); aKeyIt->toFirst(); #define pE aKeyIt->current() while( pE ) { //&& //( mod != keyToXMod( pE->aCurrentKeyCode ) // || keysym != keyToXSym( pE->aCurrentKeyCode ) ) ) { int kc = pE->aCurrentKeyCode; if( mod == keyToXMod( kc ) ) debug("That's the right modifier"); if( keysym == keyToXSym( kc ) ) debug("That's the right symbol"); if ( mod == keyToXMod( kc ) && keysym == keyToXSym( kc ) ) { //pEntry = pE; //action = aKeyIt->currentKey(); //break; debug("Found key in dictionary for action %s", aKeyIt->currentKey()); break; } ++*aKeyIt; } if ( !pE ) { debug("Null KeyEntry object"); return false; } if ( !pE ) { debug("KeyEntry object not enabled"); return false; } debug("KGlobalAccel:: event action %s", aKeyIt->currentKey() ); XAllowEvents(qt_xdisplay(), AsyncKeyboard, CurrentTime); connect( this, SIGNAL( activated() ), pE->receiver, pE->member->data() ); emit activated(); disconnect( this, SIGNAL( activated() ), pE->receiver, pE->member->data() ); // warning("Signal has been sent!"); return true; }
bool KGlobalAccel::setKeyDict( QDict<KKeyEntry> nKeyDict ) { // ungrab all connected and enabled keys QDictIterator<KKeyEntry> *aKeyIt = new QDictIterator<KKeyEntry>( aKeyDict ); aKeyIt->toFirst(); #define pE aKeyIt->current() while( pE ) { QString s; if ( pE->bEnabled ) { uint keysym = keyToXSym( pE->aCurrentKeyCode ); uint mod = keyToXMod( pE->aCurrentKeyCode ); ungrabKey( keysym, mod ); } ++*aKeyIt; } #undef pE // Clear the dictionary aKeyDict.clear(); // Insert the new items into the dictionary and reconnect if neccessary // Note also swap config and current key codes !!!!!! aKeyIt = new QDictIterator<KKeyEntry>( nKeyDict ); aKeyIt->toFirst(); #define pE aKeyIt->current() KKeyEntry *pEntry; while( pE ) { pEntry = new KKeyEntry; aKeyDict.insert( aKeyIt->currentKey(), pEntry ); pEntry->aDefaultKeyCode = pE->aDefaultKeyCode; // Not we write config key code to current key code !! pEntry->aCurrentKeyCode = pE->aConfigKeyCode; pEntry->aConfigKeyCode = pE->aConfigKeyCode; pEntry->bConfigurable = pE->bConfigurable; pEntry->aAccelId = pE->aAccelId; pEntry->receiver = pE->receiver; pEntry->member = new QString( pE->member->data() ); pEntry->bEnabled = pE->bEnabled; if ( pEntry->bEnabled ) { uint keysym = keyToXSym( pEntry->aCurrentKeyCode ); uint mod = keyToXMod( pEntry->aCurrentKeyCode ); grabKey( keysym, mod ); } ++*aKeyIt; } #undef pE return true; }
//===================================== // XKeyboard::Layout/Model check //------------------------------------- void XKeyboard::validateLayout ( void ) { // log(L_INFO,"XKeyboard::validateLayout() called\n"); // ... // this function check if the currently used combination // of layout and model is valid according to the Keyboard.map // if not we will provide a warning // --- QString XkbModel; QString XkbLayout; QDictIterator<char> itModel (mModelHash); for (; itModel.current(); ++itModel) { if (QString::fromLocal8Bit(itModel.current()) == mType->currentText()) { XkbModel = itModel.currentKey(); } } // 2) primary XKB layout QDictIterator<char> itLayout (mLayoutHash); for (; itLayout.current(); ++itLayout) { if (QString::fromLocal8Bit(itLayout.current()) == mLayout->currentText()) { XkbLayout = itLayout.currentKey(); } } QString isValid = qx ( VALIDATELAYOUT,STDOUT,2,"%s %s", XkbModel.ascii(),XkbLayout.ascii() ); if (! isValid.toInt()) { setMessage ("noValidLayout"); } }
//===================================== // XKeyboard::update all variant lists //------------------------------------- void XKeyboard::updateVariants ( void ) { // log(L_INFO,"XKeyboard::updateVariants() called\n"); // ... // this function will update the variant lists for the // primary variant combobox and the additional variant // combobox. Currently set variants will be resetted // after the list update // --- // 1) Additional Variants... // --- mAddVariant -> clear(); QListViewItem* item = mAddView -> selectedItem(); if (item) { QStringList list = mRules.getVariants (item->text (2)); if (! list.empty()) { mAddVariant -> insertStringList ( list ); } else { mAddVariant -> insertItem ("basic"); } mAddVariant->setCurrentText ("basic"); if ((item->text(3)) && (! item->text(3).isEmpty())) { mAddVariant -> setCurrentText (item->text(3)); } } // 2) Primary Variant... // --- int curItem = mVariant -> currentItem(); QString curText = mVariant -> currentText(); mVariant -> clear(); QDictIterator<char> it (mRules.getLayouts()); bool emptyVariantList = true; for (; it.current(); ++it) { if (QString::fromLocal8Bit (it.current()) == mLayout->currentText()) { QStringList list = mRules.getVariants (it.currentKey()); if (! list.empty()) { mVariant -> insertStringList ( list ); emptyVariantList = false; } else { mVariant -> insertItem ("basic"); } break; } } mVariant->setCurrentText ("basic"); if (! emptyVariantList) { if (mVariant->text (curItem) == curText) { mVariant->setCurrentItem (curItem); } } }
void RKComponent::removeFromParent () { RK_TRACE (PLUGIN); if (!parentComponent ()) return; for (QDictIterator<RKComponentBase> it (parentComponent ()->child_map); it.current (); ++it) { if (it.current () == this) { QString key = it.currentKey (); // unfortunately, several items might hvae the same key, and there seems to be no way to selectively remove the current item only. // however, this function should only ever be called in cases of emergency and to prevent crashes. So we make extra sure to remove the child, // even if we remove a little more than necessary along the way. while (parentComponent ()->child_map.remove (key)); return; } } RK_ASSERT (false); }
//==================================== // getTabletDrivers //------------------------------------ QList<QString> SaXManipulateTablets::getTabletDrivers (void) { // .../ //! retrieve a list of supported tablet modules from the //! TabletModules file // ---- mCDBTabletDrivers.clear(); if ( ! mCDBTabletModules ) { mCDBTabletModules = new SaXProcess (); mCDBTabletModules -> start (CDB_TABLETMODULES); } QDict< QDict<QString> > CDBModules=mCDBTabletModules->getTablePointerCDB(); QDictIterator< QDict<QString> > it (CDBModules); for (; it.current(); ++it) { mCDBTabletDrivers.append (new QString(it.currentKey())); } return mCDBTabletDrivers; }
//==================================== // getCardDrivers //------------------------------------ QList<QString> SaXManipulateCard::getCardDrivers ( void ) { // .../ //! retrieve a list of X11 card driver names. The items //! if the list can be used to retrieve the coresponding //! option list using the getCardOptions() method // ---- mCDBCardDrivers.clear(); if ( ! mCDBCardModules ) { mCDBCardModules = new SaXProcess (); mCDBCardModules -> start (CDB_CARDMODULES); } QDict< QDict<QString> > CDBModules = mCDBCardModules->getTablePointerCDB(); QDictIterator< QDict<QString> > it (CDBModules); for (; it.current(); ++it) { mCDBCardDrivers.append (new QString(it.currentKey())); } return mCDBCardDrivers; }
//==================================== // getCDBPanelList //------------------------------------ QList<QString> SaXManipulateTouchscreens::getPanelList (void) { // .../ //! retrieve a list of supported panel groups. Each item //! contains the vendor and the model in its name separated //! by a colon // ---- mCDBPanelList.clear(); if ( ! mCDBPanels ) { mCDBPanels = new SaXProcess (); mCDBPanels -> start (CDB_TOUCHERS); } QDict< QDict<QString> > CDBData = mCDBPanels -> getTablePointerCDB (); QDictIterator< QDict<QString> > it (CDBData); for (; it.current(); ++it) { mCDBPanelList.append (new QString (it.currentKey())); } return mCDBPanelList; }
//==================================== // getMouseList //------------------------------------ QList<QString> SaXManipulateMice::getMouseList (void) { // .../ //! retrieve a list of supported standard mouse groups. Each item //! contains the vendor and the model in its name separated //! by a colon // ---- mCDBMouseList.clear(); if ( ! mCDBMice ) { mCDBMice = new SaXProcess (); mCDBMice -> start (CDB_POINTERS); } QDict< QDict<QString> > CDBData = mCDBMice -> getTablePointerCDB (); QDictIterator< QDict<QString> > it (CDBData); for (; it.current(); ++it) { mCDBMouseList.append (new QString (it.currentKey())); } return mCDBMouseList; }
void RKComponent::updateEnablednessRecursive () { RK_TRACE (PLUGIN); bool enabled; if (enabledness_property->boolValue ()) { enabled = ((!parentComponent ()) || (parentComponent ()->isEnabled ())); } else { enabled = false; } setEnabled (enabled); /* We do this, even if the state *seems* to be unchanged. This is needed, as isEnabled () also returns false, if the parent QWidget is not enabled. However, the parent QWidget may not always be the parent component. */ if (enabled != isEnabled ()) { for (QDictIterator<RKComponentBase> it (child_map); it.current (); ++it) { if (it.current ()->isComponent()) { static_cast<RKComponent*> (it.current ())->updateEnablednessRecursive (); } } } }
void RKComponent::updateEnablednessRecursive () { RK_TRACE (PLUGIN); bool enabled; if (enabledness_property->boolValue ()) { enabled = ((!parentComponent ()) || (parentComponent ()->isEnabled ())); } else { enabled = false; } if (enabled != isEnabled ()) { setEnabled (enabled); for (QDictIterator<RKComponentBase> it (child_map); it.current (); ++it) { if (it.current ()->isComponent()) { static_cast<RKComponent*> (it.current ())->updateEnablednessRecursive (); } } } }
//==================================== // merge data into object... //------------------------------------ void SaXStorage::merge (QList< QDict<QString> > data) { // .../ //! merge the data records from the list (data) into //! the corresponding data records of the object. If //! a record does not exist it will be created // ---- for (unsigned int n=0;n<data.count();n++) { QDict<QString>* table = data.at(n); QDictIterator<QString> it (*table); if (! table) { continue; } addID (n); setID (n); for (; it.current(); ++it) { setItem (it.currentKey(),*it.current()); } } }
//==================================== // getPenData //------------------------------------ QDict<QString> SaXManipulateTablets::getPenData ( const QString& group ) { // .../ //! return the pen data dictionary associated with the //! given CDB group name. // ---- mCDBTabletData.clear(); if ( ! mCDBPens ) { mCDBPens = new SaXProcess (); mCDBPens -> start (CDB_PENS); } QDict< QDict<QString> > CDBData = mCDBPens -> getTablePointerCDB (); QDictIterator< QDict<QString> > it (CDBData); for (; it.current(); ++it) { if ( it.currentKey() == group ) { mCDBTabletData = *it.current(); break; } } return mCDBTabletData; }
//==================================== // getMouseData //------------------------------------ QDict<QString> SaXManipulateMice::getMouseData ( const QString& group ) { // .../ //! return the mouse data dictionary associated with the //! given CDB group name. // ---- mCDBMouseData.clear(); if ( ! mCDBMice ) { mCDBMice = new SaXProcess (); mCDBMice -> start (CDB_POINTERS); } QDict< QDict<QString> > CDBData = mCDBMice -> getTablePointerCDB (); QDictIterator< QDict<QString> > it (CDBData); for (; it.current(); ++it) { if ( it.currentKey() == group ) { mCDBMouseData = *it.current(); break; } } return mCDBMouseData; }
void RKComponentBase::fetchPropertyValuesRecursive (QMap<QString, QString> *list, bool include_top_level, const QString &prefix) { RK_TRACE (PLUGIN); for (QDictIterator<RKComponentBase> it (child_map); it.current (); ++it) { if (it.currentKey () != "#noid#") { if (it.current ()->isProperty ()) { if (include_top_level) { list->insert (prefix + it.currentKey (), it.current ()->value ()); } } else { it.current ()->fetchPropertyValuesRecursive (list, true, prefix + it.currentKey () + '.'); } } } }
//==================================== // splitImport... //------------------------------------ void SaXImportProfile::splitImport (void) { // .../ //! Split the data from the profile into the appropriate //! ISAX sections. If the section does not exist a new one //! will be created. Each section can be obtained using the //! getImport() method. For the profile to take effect it is //! normally needed to merge this SaXImport objects into the //! basic imports which are the base for the configuration //! export: For example //! \code //! SaXImport* profile = this->getImport (SAX_CARD); //! baseImport->merge (profile->getTablePointerDATA()); //! \endcode // ---- for (int n=0;n < getCount();n++) { QDict<QString>* table = getTablePointer ( n ); QDictIterator<QString> it (*table); for (; it.current(); ++it) { QStringList tokens = QStringList::split ( ":", *it.current() ); QString section = tokens.last(); tokens.pop_back(); QString value = tokens.join(":"); if (section == "Layout") { if (! mLayout) { mLayout = new SaXImport (SAX_LAYOUT); } mLayout -> addID (n); mLayout -> setItem (it.currentKey(),value); } if (section == "Desktop") { if (! mDesktop) { mDesktop = new SaXImport (SAX_DESKTOP); } mDesktop -> addID (n); mDesktop -> setItem (it.currentKey(),value); } if (section == "Card") { if (! mCard) { mCard = new SaXImport (SAX_CARD); } mCard -> addID (n); mCard -> setItem (it.currentKey(),value); } if (section == "Mouse") { if (! mPointers) { mPointers = new SaXImport (SAX_POINTERS); } mPointers -> addID (n); mPointers -> setItem (it.currentKey(),value); } } } }
//===================================== // XKeyboard apply keyboard //------------------------------------- bool XKeyboard::apply ( void ) { // log(L_INFO,"XKeyboard::apply() called\n"); // ... // apply the keyboard to the X-Server for immediate // usage. This call will use the XKB extension // --- XWrapPointer< QDict<char> > mText (mTextPtr); QString* XkbModel = NULL; QString* XkbLayout = NULL; QString* XkbVariant = NULL; QString* XkbOptions = NULL; // 1) primary XKB model QDictIterator<char> itModel (mModelHash); for (; itModel.current(); ++itModel) { if (QString::fromLocal8Bit (itModel.current()) == mType->currentText()) { XkbModel = new QString (itModel.currentKey()); } } // 2) primary XKB layout QDictIterator<char> itLayout (mLayoutHash); for (; itLayout.current(); ++itLayout) { if (QString::fromLocal8Bit(itLayout.current()) == mLayout->currentText()) { XkbLayout = new QString (itLayout.currentKey()); } } // 3) variant for primary XKB layout XkbVariant = new QString(); if (mVariant->currentText()) { *XkbVariant = mVariant->currentText(); } // 4) additional layout and variant QListViewItemIterator itAdd (mAddView); for ( ; itAdd.current(); ++itAdd ) { QCheckListItem* item = (QCheckListItem*)itAdd.current(); if (item->isOn()) { QString layout = itAdd.current()->text(2); QString variant = ""; XkbLayout->sprintf("%s,%s", XkbLayout->ascii(),layout.ascii() ); if (itAdd.current()->text(3)) { variant = itAdd.current()->text(3); } XkbVariant->sprintf("%s,%s", XkbVariant->ascii(),variant.ascii() ); } } // 5) options if (mKeyboardOptions["XkbOptions"]) { if (! QString(mKeyboardOptions["XkbOptions"]).isEmpty()) { XkbOptions = new QString (mKeyboardOptions["XkbOptions"]); } } QString optm ("-model"); QString optl ("-layout"); QString opto ("-option"); QString optv ("-variant"); if ((XkbVariant) && (XkbOptions)) { #if 0 printf("%s %s %s %s %s %s %s %s\n", optm.ascii(),XkbModel->ascii(),optl.ascii(),XkbLayout->ascii(), opto.ascii(),XkbOptions->ascii(),optv.ascii(),XkbVariant->ascii() ); #endif #if 1 qx ( SETXKBMAP,STDNONE,8,"%s %s %s %s %s %s %s %s", optm.ascii(),XkbModel->ascii(),optl.ascii(),XkbLayout->ascii(), opto.ascii(),XkbOptions->ascii(),optv.ascii(),XkbVariant->ascii() ); #endif } else if (XkbVariant) { #if 0 printf("%s %s %s %s %s %s\n", optm.ascii(),XkbModel->ascii(),optl.ascii(),XkbLayout->ascii(), optv.ascii(),XkbVariant->ascii() ); #endif #if 1 qx ( SETXKBMAP,STDNONE,8,"%s %s %s %s %s %s", optm.ascii(),XkbModel->ascii(),optl.ascii(),XkbLayout->ascii(), optv.ascii(),XkbVariant->ascii() ); #endif } else if (XkbOptions) { #if 0 printf("%s %s %s %s %s %s\n", optm.ascii(),XkbModel->ascii(),optl.ascii(),XkbLayout->ascii(), opto.ascii(),XkbOptions->ascii() ); #endif #if 1 qx ( SETXKBMAP,STDNONE,8,"%s %s %s %s %s %s", optm.ascii(),XkbModel->ascii(),optl.ascii(),XkbLayout->ascii(), opto.ascii(),XkbOptions->ascii() ); #endif } else { #if 0 printf("%s %s %s %s\n", optm.ascii(),XkbModel->ascii(),optl.ascii(),XkbLayout->ascii() ); #endif #if 1 qx ( SETXKBMAP,STDNONE,8,"%s %s %s %s", optm.ascii(),XkbModel->ascii(),optl.ascii(),XkbLayout->ascii() ); #endif } return (true); }
//===================================== // XKeyboard Ok pressed for mTop //------------------------------------- void XKeyboard::slotTopOk ( void ) { // log (L_INFO,"XKeyboard::slotTopOk() called\n"); // ... // this function is called if you click onto the OK // button in the setup toplevel window // --- XWrapPointer< QDict<char> > mText (mTextPtr); mFrame -> enterEvent ( 0 ); QString* XkbOptions = NULL; QString* ScrollLock = NULL; QString* LeftAlt = NULL; QString* RightAlt = NULL; QString* RightCtl = NULL; for (int i=0;i<=6;i++) { QString selection = mXkbOption[i]->currentText(); QDictIterator<char> it (mOptionHash); for (; it.current(); ++it) { if (QString::fromLocal8Bit (it.current()) == selection) { selection = it.currentKey(); break; } } if (selection == mText["Default"]) { selection = ""; } switch (i) { case 0: case 1: case 6: if (! XkbOptions) { XkbOptions = new QString (selection); } else { if (XkbOptions->isEmpty()) { XkbOptions -> sprintf ("%s",selection.ascii()); } else { XkbOptions -> sprintf ("%s,%s", XkbOptions->ascii(),selection.ascii() ); } } break; case 2: LeftAlt = new QString (selection); break; case 3: RightAlt = new QString (selection); break; case 4: ScrollLock = new QString (selection); break; case 5: RightCtl = new QString (selection); break; } if (XkbOptions) { if (XkbOptions -> at(XkbOptions->length()-1) == ',') { XkbOptions -> remove (XkbOptions->length()-1,1); } } } // ... // save the values to the working keyboard if // they are available and valid // --- XWrapFile < QDict<XFile> > mFiles (mFilePtr); XWrapPointer<XData> workingKeyboard ( mFiles["sys_KEYBOARD"]->getDevice (0) ); if (XkbOptions) { mKeyboardOptions.insert ("XkbOptions",XkbOptions->ascii()); } if (LeftAlt) { mKeyboardOptions.insert ("LeftAlt",LeftAlt->ascii()); } if (RightAlt) { mKeyboardOptions.insert ("RightAlt",RightAlt->ascii()); } if (ScrollLock) { mKeyboardOptions.insert ("ScrollLock",ScrollLock->ascii()); } if (RightCtl) { mKeyboardOptions.insert ("RightCtl",RightCtl->ascii()); } // ... // save the values of the auto repeat sliders, if one // of them has another value than the default value // --- if ( (mDelay->value() != XKBDDELAY_DEFAULT) || (mRepeat->value() != XKBDRATE_DEFAULT) ) { QString* autoRepeat = new QString(); autoRepeat->sprintf("%d %d", mDelay->value(),mRepeat->value() ); mKeyboardOptions.insert ( "AutoRepeat",autoRepeat->ascii() ); } apply(); }
//===================================== // XTouchScreen slotTopOk... //------------------------------------- void XTouchScreen::slotTopOk (void) { // log (L_INFO,"XTouchScreen::slotTopOk() called\n"); // ... // this function is called if you click onto the OK // button in the setup toplevel window // --- mFrame -> enterEvent ( 0 ); bool newToucher = false; switch (mState) { case TOUCHER_NEW: if ( ! mIndexList.isEmpty()) { mWorkingIndex = *mIndexList.at ( touchList->count()-1 ); mWorkingIndex+= 2; } else { mWorkingIndex = 1; } newToucher = true; break; case TOUCHER_SETUP: mWorkingIndex = *mIndexList.at ( mSelected ); newToucher = false; break; } // ... // 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); // ... // get the workingToucher pointer wrapper. If a new toucher // should be added use addDevice to create a new object // otherwhise get the device according to the selection // made in touchList and clear the contents // --- XWrapPointer<XData> workingToucher; if (newToucher) { while (mFiles["sys_INPUT"]->getDevice (mWorkingIndex)) { mWorkingIndex+= 2; } workingToucher.init ( mFiles["sys_INPUT"]->addDevice (mWorkingIndex) ); } else { workingToucher.init ( mFiles["sys_INPUT"]->getDevice (mWorkingIndex) ); } // ... / // set the selection data from the CDB if the user requested // a new toucher from the list. The data set here may be overwritten // from the manual setup made after the vendor/name selection // ----- // NOTE: // ----- // At the time there are not other controls which can influence // the CDB selection. This means all the configuration data is // obtained from the CDB files // --- // check first if the selection differs from // the current settings // --- bool changeRequest = false; QString* toucherName = new QString(); toucherName -> sprintf ("%s;%s", mVendor->currentText().ascii(),mName->currentText().ascii() ); if (! newToucher) { if (*toucherName != QString(workingToucher["Name"])) { changeRequest = true; } } else { changeRequest = true; } QDict<char>* spec = NULL; XDb* pCDB = mFiles["cdb_TOUCHER"]->cdbGetSpec ( mVendor->currentText(),mName->currentText() ); if ((pCDB) && (changeRequest)) { spec = pCDB -> getHash(); // ... // clear the working toucher contents... // --- workingToucher.clear(); // ... // set base items for the touchscreen... // --- QString* ident = new QString; ident -> sprintf ("Mouse[%d]",mWorkingIndex); workingToucher.setPair ("InputFashion","Touchpanel"); workingToucher.setPair ("Identifier",ident->ascii()); workingToucher.setPair ("Name", toucherName->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; } if (*key == "Load") { // ... // The load key/value pair must go to the module // section. Therefore the data record is loaded now // --- QString* moduleList = new QString(); XData* workingPath = mFiles["sys_PATH"]->getDevice (0); moduleList -> sprintf ("%s,%s", workingPath->operator[]("ModuleLoad"), val->ascii() ); workingPath -> setPair ("ModuleLoad", moduleList->ascii() ); } else { workingToucher.setPair ( key->ascii(),val->ascii() ); } } // ... // check if the card is rotated... // --- int rotate = isRotated(); if (rotate > 0) { QString* degree = new QString(); degree->sprintf("%d",rotate); workingToucher.setPair ( "Rotation",degree->ascii() ); } } // ... // add an entry to touchList if a new touchscreen // should be added to the system. Otherwhise update // the current entry of the touchList if changed // --- if (newToucher) { if (pCDB) { QString topic; XData* sysData = mFiles["sys_INPUT"] -> getDevice(mWorkingIndex); if (sysData) { QDict<char> touchInfo = sysData -> getData(); topic.sprintf ("%s %s", mVendor->currentText().ascii(),mName->currentText().ascii() ); int* newIndex = (int*) malloc(sizeof(int)); *newIndex = mWorkingIndex; mIndexList.append (newIndex); touchList -> insertItem ( QPixmap(PIXINTROTOUCH),topic ); mSelected = mIndexList.find ( newIndex ); touchList -> setSelected ( mSelected,true ); touchList -> setCurrentItem ( mSelected ); mDel -> setDisabled ( false ); mSetup -> setDisabled ( false ); } } } else { if ((changeRequest) && (pCDB)) { QString topic; topic.sprintf ("%s %s", mVendor->currentText().ascii(),mName->currentText().ascii() ); touchList -> changeItem ( QPixmap(PIXINTROTOUCH),topic,mSelected ); } } }
//==================================== // remove and reorganize section ID... //------------------------------------ bool SaXStorage::delID ( int id ) { // .../ //! remove a data record and adapt the Identifier strings //! to provide consistency // ---- if ((! mData.at (id)) || (mData.at(id)->isEmpty())) { return false; } int step = 1; int type = SAX_DESKTOP_TYPE; QString ident = *mData.at(id)->find ("Identifier"); if (ident.contains ("Mouse")) { type = SAX_POINTER_TYPE; step = 2; } if (ident.contains ("Keyboard")) { type = SAX_KEYBOARD_TYPE; step = 2; } int index = -1; QListIterator < QDict<QString> > in (mData); for (; in.current(); ++in) { index++; QDict<QString>* data = in.current(); QString* ident = data->find ("Identifier"); if (! ident) { continue; } int curType = SAX_DESKTOP_TYPE; if (ident->contains("Mouse")) { curType = SAX_POINTER_TYPE; } if (ident->contains("Keyboard")) { curType = SAX_KEYBOARD_TYPE; } if ((data->isEmpty()) || (index <= id) || (curType != type)) { continue; } QString oIDstr; QString nIDstr; oIDstr.sprintf ("%d",index); nIDstr.sprintf ("%d",index - step); QString mouseIDstr ("Mouse[" + oIDstr +"]"); QString keyboardIDstr ("Keyboard["+ oIDstr +"]"); QString deviceIDstr ("Device[" + oIDstr +"]"); QString monitorIDstr ("Monitor[" + oIDstr +"]"); QString screenIDstr ("Screen[" + oIDstr +"]"); QDictIterator<QString> it (*data); for (; it.current(); ++it) { QString val = *it.current(); QString key = it.currentKey(); if (val == mouseIDstr) { QString* nMouseIDstr = new QString ("Mouse["+nIDstr+"]"); data -> replace (key,nMouseIDstr); } if (val == keyboardIDstr) { QString* nKbdIDstr = new QString ("Keyboard["+nIDstr+"]"); data -> replace (key,nKbdIDstr); } if (val == deviceIDstr) { QString* nDeviceIDstr = new QString ("Device["+nIDstr+"]"); data -> replace (key,nDeviceIDstr); } if (val == monitorIDstr) { QString* nMonitorIDstr = new QString ("Monitor["+nIDstr+"]"); data -> replace (key,nMonitorIDstr); } if (val == screenIDstr) { QString* nScreenIDstr = new QString ("Screen["+nIDstr+"]"); data -> replace (key,nScreenIDstr); } if ((key == "Screen") && (val == oIDstr)) { QString* nScreenIDstr = new QString (nIDstr); data -> replace (key,nScreenIDstr); } } } mData.remove (id); if ((mData.at(id)) && (mData.at(id)->isEmpty())) { mData.remove (id); } return true; }
//==================================== // 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; }
//==================================== // exportData //------------------------------------ bool SCCTablet::exportData ( void ) { //==================================== // create manipulators... //------------------------------------ SaXManipulateTablets saxTablet ( mSection["Pointers"],mSection["Layout"] ); SaXManipulateDevices saxDevice ( mSection["Pointers"],mSection["Layout"] ); //==================================== // search and remove tablet //------------------------------------ int inputCount = mSection["Pointers"]->getCount(); for (int i=inputCount;i>=0;i--) { if (saxTablet.selectPointer (i)) { if (saxTablet.isTablet()) { saxDevice.removeInputDevice (i); } if (saxTablet.isPen()) { saxDevice.removeInputDevice (i); } if (saxTablet.isEraser()) { saxDevice.removeInputDevice (i); } } } //==================================== // add tablet if enabled //------------------------------------ if (mTabletSelection->isEnabled()) { QString vendor = mTabletSelection->getVendor(); QString model = mTabletSelection->getModel(); if (! model.isEmpty()) { int tabletID = saxDevice.addInputDevice (SAX_INPUT_TABLET); saxTablet.selectPointer ( tabletID ); saxTablet.setTablet ( vendor,model ); QDict<QString> tabletDict = saxTablet.getTabletData ( vendor,model ); //==================================== // save tablet connection port //------------------------------------ if (! mTabletConnection->isAutoPort()) { QString port = mTabletConnection->getPortName(); if (port.contains ("ttyS0")) { saxTablet.setDevice ( "/dev/ttyS0" ); } if (port.contains ("ttyS1")) { saxTablet.setDevice ( "/dev/ttyS1" ); } if (port.contains ("USB")) { QProcess* proc = new QProcess (); proc -> addArgument ( USB_PORT ); if (proc -> start()) { while (proc->isRunning()) { usleep (1000); } QByteArray data = proc->readStdout(); QStringList lines = QStringList::split ("\n",data); saxTablet.setDevice ( lines.first() ); } } } //==================================== // save tablet options //------------------------------------ QString driver = saxTablet.getDriver(); QDict<QString> allOptions = saxTablet.getTabletOptions ( driver ); QDictIterator<QString> it (allOptions); for (; it.current(); ++it) { saxTablet.removeOption (it.currentKey()); } QDict<QString> tabletOptions = mTabletConnection->getOptions(); QDictIterator<QString> io (tabletOptions); for (; io.current(); ++io) { saxTablet.addOption (io.currentKey(),*io.current()); } //==================================== // save tablet mode //------------------------------------ int mode = mTabletConnection->getTabletMode(); if (mode == 0) { saxTablet.setMode ("Relative"); } else { saxTablet.setMode ("Absolute"); } int sticks[2] = {-1,-1}; //==================================== // handle Tablet Pen //------------------------------------ if (mTabletPens->hasPen()) { QString penLink = *tabletDict["StylusLink"]; sticks[0] = saxTablet.addPen ( vendor,penLink ); } //==================================== // handle Tablet Eraser //------------------------------------ if (mTabletPens->hasEraser()) { QString eraserLink = *tabletDict["EraserLink"]; sticks[1] = saxTablet.addPen ( vendor,eraserLink ); } //==================================== // save pen/eraser data //------------------------------------ for (int n=0;n<2;n++) { if (sticks[n] > 0) { SCCTabletPenProperty* pen = 0; switch (n) { case 0: pen = mTabletPens->getPenPropertyData(); break; case 1: pen = mTabletPens->getEraserPropertyData(); break; } //==================================== // create manipulators... //------------------------------------ SaXManipulateTablets saxPen ( mSection["Pointers"],mSection["Layout"] ); saxPen.selectPointer ( sticks[n] ); //==================================== // save pen's mode //------------------------------------ int mode = pen->getPenMode(); if (mode == 0) { saxPen.setMode ("Relative"); } else { saxPen.setMode ("Absolute"); } //==================================== // save pen's options //------------------------------------ QString driver = saxTablet.getDriver(); QDict<QString> allOptions = saxTablet.getTabletOptions (driver); QDictIterator<QString> it (allOptions); for (; it.current(); ++it) { saxPen.removeOption (it.currentKey()); } QDict<QString> penOptions = pen->getPenOptions(); QDictIterator<QString> io (penOptions); for (; io.current(); ++io) { saxPen.addOption (io.currentKey(),*io.current()); } //==================================== // save pen's device //------------------------------------ saxTablet.selectPointer ( tabletID ); QString device = saxTablet.getDevice(); saxPen.selectPointer ( sticks[n] ); saxPen.setDevice (device); } } } } return true; }
//===================================== // 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 ); } }
//===================================== // 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(); }
//==================================== // exportData //------------------------------------ bool SCCMouse::exportData ( void ) { int mouseID = 0; QListIterator<SCCMouseDisplay> it (mMouseDisplay); for (; it.current() ; ++it) { //==================================== // check for mouse display's //------------------------------------ SCCMouseDisplay* display = (SCCMouseDisplay*)it.current(); //if (display->isEnabled()) { //==================================== // create manipulators... //------------------------------------ SaXManipulateMice saxMouse ( mSection["Pointers"] ); SaXManipulateLayout saxLayout ( mSection["Layout"],mSection["Card"] ); //==================================== // select pointer device //------------------------------------ mouseID = display->getDisplay(); saxMouse.selectPointer ( mouseID ); //==================================== // save mouse selection data //------------------------------------ SCCMouseModel* modelData = display->getModelData(); QString vendor = modelData -> getVendorName(); QString model = modelData -> getModelName(); QString zmap; if (! model.isEmpty() ) { QDict<QString> mData = mSection["Pointers"]->getCurrentTable(); QDictIterator<QString> it (mData); for (; it.current() ; ++it) { QString key = it.currentKey(); QString val = *it.current(); if (key == "Identifier") { continue; } if (key == "ZAxisMapping") { zmap = val; } mSection["Pointers"]->removeEntry ( key ); } saxMouse.setMouse ( vendor,model ); } //==================================== // save 3-Button emulation data //------------------------------------ saxMouse.disable3ButtonEmulation(); if (display->isButtonEmulationEnabled()) { saxMouse.enable3ButtonEmulation(); } //==================================== // save mouse wheel data //------------------------------------ saxMouse.disableWheel(); if (display->isWheelEnabled()) { if (! zmap.isEmpty()) { QStringList tokens = QStringList::split ( " ",zmap ); int b1 = tokens.first().toInt(); int b2 = tokens.last().toInt(); saxMouse.enableWheelOn (b1,b2); } else { saxMouse.enableWheel(); } } //==================================== // save mouse X axis invertation data //------------------------------------ saxMouse.disableXAxisInvertation(); if (display->isXInverted()) { saxMouse.enableXAxisInvertation(); } //==================================== // save mouse Y axis invertation data //------------------------------------ saxMouse.disableYAxisInvertation(); if (display->isYInverted()) { saxMouse.enableYAxisInvertation(); } //==================================== // save mouse wheel emulation data //------------------------------------ saxMouse.disableWheelEmulation(); if (display->isWheelEmulationEnabled()) { saxMouse.enableWheelEmulation (display->getWheelButton()); } //==================================== // save input layout //------------------------------------ saxLayout.removeInputLayout (mouseID); if (display->isEnabled()) { saxLayout.addInputLayout (mouseID); } //} } return true; }