/* * Create contents from list created by FileHandler */ void Settings::createContents(QPtrList <QString> &list) { for (QString* s = list.next(); s != NULL; s = list.next()) { if (*s == QString("Entry")) { s = list.prev(); break; } else { set(*s, *(list.next())); } } }
void QueueList::moveSelectedDown() // SLOT { QPtrList<QListViewItem> list = selectedItems(); for( QListViewItem *item = list.last(); item; item = list.prev() ) { QListViewItem *after = item->nextSibling(); if( !after ) continue; moveItem( item, 0, after ); } ensureItemVisible( list.last() ); }
// // Create joystick plugin contents... now what the heck is this // doing here??? // void App::createJoystickContents(QPtrList <QString> &list) { QString name; QString fdName; for (QString* s = list.next(); s != NULL; s = list.next()) { if (*s == QString("Entry")) { s = list.prev(); break; } else if (*s == QString("FDName")) { fdName = *(list.next()); } else if (*s == QString("Name")) { name = *(list.next()); } } }
void QtCalculator::temp_stack_prev(){ CALCAMNT *number; if( temp_stack.current() == temp_stack.getFirst()){ KNotifyClient::beep(); return; } number = temp_stack.prev(); if(number == NULL){ KNotifyClient::beep(); return; } else{ // printf("Number: %Lg\n",*number); last_input = RECALL; DISPLAY_AMOUNT = *number; UpdateDisplay(); } }
void VCFrame::createContents(QPtrList <QString> &list) { QRect rect(30, 30, 30, 30); for (QString* s = list.next(); s != NULL; s = list.next()) { if (*s == QString("Entry")) { s = list.prev(); break; } else if (*s == QString("ID")) { setID(list.next()->toInt()); } else if (*s == QString("ButtonBehaviour")) { setButtonBehaviour(static_cast<ButtonBehaviour> (list.next()->toInt())); } else if (*s == QString("Parent")) { if (m_bottomFrame == false) { VCFrame* parent = _app->virtualConsole()->getFrame(list.next()->toInt()); if (parent != NULL) { reparent((QWidget*) parent, 0, QPoint(0, 0), true); } } else { list.next(); } } else if (*s == QString("Textcolor")) { QColor qc; qc.setRgb(list.next()->toUInt()); setPaletteForegroundColor(qc); } else if (*s == QString("Backgroundcolor")) { QColor qc; qc.setRgb(list.next()->toUInt()); setPaletteBackgroundColor(qc); } else if (*s == QString("Color")) { // Backwards compatibility for frame background color QString t = *(list.next()); int i = t.find(QString(",")); int r = t.left(i).toInt(); int j = t.find(QString(","), i + 1); int g = t.mid(i+1, j-i-1).toInt(); int b = t.mid(j+1).toInt(); QColor qc(r, g, b); setPaletteBackgroundColor(qc); } else if (*s == QString("Pixmap")) { QString t; t = *(list.next()); QPixmap pm(t); if (pm.isNull() == false) { setIconText(t); setPaletteBackgroundPixmap(pm); } } else if (*s == QString("Font")) { QFont f = font(); QString q = *(list.next()); f.fromString(q); setFont(f); } else if (*s == QString("X")) { rect.setX(list.next()->toInt()); } else if (*s == QString("Y")) { rect.setY(list.next()->toInt()); } else if (*s == QString("Width")) { rect.setWidth(list.next()->toInt()); } else if (*s == QString("Height")) { rect.setHeight(list.next()->toInt()); } else { // Unknown keyword, ignore *list.next(); } } if (m_bottomFrame == false) { setGeometry(rect); } }
// // Create this slider's contents from list // void VCDockSlider::createContents(QPtrList <QString> &list) { QRect rect(0, 0, 60, 200); for (QString* s = list.next(); s != NULL; s = list.next()) { if (*s == QString("Entry")) { s = list.prev(); break; } else if (*s == QString("Name")) { setCaption(*(list.next())); } else if (*s == QString("Parent")) { VCFrame* parent = _app->virtualConsole()->getFrame(list.next()->toInt()); if (parent != NULL) { reparent((QFrame*)parent, 0, QPoint(0, 0), true); } } else if (*s == QString("X")) { rect.setX(list.next()->toInt()); } else if (*s == QString("Y")) { rect.setY(list.next()->toInt()); } else if (*s == QString("Width")) { rect.setWidth(list.next()->toInt()); } else if (*s == QString("Height")) { rect.setHeight(list.next()->toInt()); } else if (*s == QString("Textcolor")) { QColor qc; qc.setRgb(list.next()->toUInt()); setPaletteForegroundColor(qc); } else if (*s == QString("Backgroundcolor")) { QColor qc; qc.setRgb(list.next()->toUInt()); setPaletteBackgroundColor(qc); } else if (*s == QString("Color")) { // Backwards compatibility for slider background color QString t = *(list.next()); int i = t.find(QString(",")); int r = t.left(i).toInt(); int j = t.find(QString(","), i + 1); int g = t.mid(i+1, j-i-1).toInt(); int b = t.mid(j+1).toInt(); QColor qc(r, g, b); setPaletteBackgroundColor(qc); } else if (*s == QString("Pixmap")) { QString t; t = *(list.next()); QPixmap pm(t); if (pm.isNull() == false) { setIconText(t); unsetPalette(); setPaletteBackgroundPixmap(pm); m_valueLabel->setBackgroundOrigin(ParentOrigin); m_slider->setBackgroundOrigin(ParentOrigin); } } else if (*s == QString("Frame")) { if (*(list.next()) == Settings::trueValue()) { setFrameStyle(KFrameStyle); } else { setFrameStyle(NoFrame); } } else if (*s == QString("Font")) { QFont f = font(); QString q = *(list.next()); f.fromString(q); setFont(f); } else if (*s == QString("Bus")) { QString t = *(list.next()); t_bus_value value; if (Bus::value(t.toInt(), value)) { setBusID(t.toInt()); } } else if (*s == QString("BusLowLimit")) { m_busLowLimit = list.next()->toInt(); } else if (*s == QString("BusHighLimit")) { m_busHighLimit = list.next()->toInt(); } else if (*s == QString("Channels")) { QString t; unsigned int i = 0; int j = 0; s = list.next(); while (i < s->length()) { j = s->find(QChar(' '), i, false); if (j == -1) { j = s->length(); } t = s->mid(i, j-i); // Check for duplicates if (m_channels.find(t.toInt()) == m_channels.end()) { m_channels.append(t.toInt()); } i = j + 1; } } else if (*s == QString("LevelLowLimit")) { m_levelLowLimit = list.next()->toInt(); } else if (*s == QString("LevelHighLimit")) { m_levelHighLimit = list.next()->toInt(); } else if (*s == QString("Mode")) { QString t = *list.next(); if (t == modeString(Speed)) { m_mode = Speed; } else if (t == modeString(Level)) { m_mode = Level; } else { m_mode = Submaster; } } else if (*s == QString("Value")) { m_slider->setValue(list.next()->toInt()); } else { // Unknown keyword, ignore *list.next(); } } setLevelRange(m_levelLowLimit, m_levelHighLimit); setBusRange(m_busLowLimit, m_busHighLimit); setGeometry(rect); if (m_mode == Submaster) { assignSubmasters(true); } setMode(m_mode); }
void VirtualConsole::createContents(QPtrList <QString> &list) { QString t; VCFrame::ResetID(); if (m_drawArea != NULL) { delete m_drawArea; m_drawArea = NULL; } for (QString* s = list.next(); s != NULL; s = list.next()) { if (*s == QString("Entry")) { s = list.next(); if (*s == QString("Virtual Console")) { createVirtualConsole(list); } else if (*s == QString("Frame")) { list.prev(); createWidget(list); } else if (*s == QString("Button")) { list.prev(); createWidget(list); } else if (*s == QString("Label")) { list.prev(); createWidget(list); } else if (*s == QString("Slider")) { list.prev(); createWidget(list); } else { // Unknown keyword, skip list.next(); } } else { list.next(); } } // Virtual console sometimes loses its parent (or vice versa) // when loading a new document... try to handle it with this. reparent((QWidget*) _app->workspace(), 0, pos(), isVisible()); // Check if VC should be open QString config; _app->settings()->get(KEY_VIRTUAL_CONSOLE_OPEN, config); if (config == Settings::trueValue()) { _app->slotViewVirtualConsole(); } else { hide(); _app->slotVirtualConsoleClosed(); } }
void VCButton::createContents(QPtrList <QString> &list) { QRect rect(30, 30, 30, 30); for (QString* s = list.next(); s != NULL; s = list.next()) { if (*s == QString("Entry")) { s = list.prev(); break; } else if (*s == QString("Name")) { setCaption(*(list.next())); } else if (*s == QString("Parent")) { VCFrame* parent = _app->virtualConsole()->getFrame(list.next()->toInt()); if (parent != NULL) { reparent((QWidget*)parent, 0, QPoint(0, 0), true); } // each Button should set if (parent->buttonBehaviour() == VCFrame::Exclusive) { setExclusive(true); } else { setExclusive(false); } } else if (*s == QString("X")) { rect.setX(list.next()->toInt()); } else if (*s == QString("Y")) { rect.setY(list.next()->toInt()); } else if (*s == QString("Width")) { rect.setWidth(list.next()->toInt()); } else if (*s == QString("Height")) { rect.setHeight(list.next()->toInt()); } else if (*s == QString("Textcolor")) { QColor qc; qc.setRgb(list.next()->toUInt()); setPaletteForegroundColor(qc); } else if (*s == QString("Backgroundcolor")) { QColor qc; qc.setRgb(list.next()->toUInt()); setPaletteBackgroundColor(qc); } else if (*s == QString("Color")) { // Backwards compatibility for button background color QString t = *(list.next()); int i = t.find(QString(",")); int r = t.left(i).toInt(); int j = t.find(QString(","), i + 1); int g = t.mid(i+1, j-i-1).toInt(); int b = t.mid(j+1).toInt(); QColor qc(r, g, b); setPaletteBackgroundColor(qc); } else if (*s == QString("Pixmap")) { QString t; t = *(list.next()); QPixmap pm(t); if (pm.isNull() == false) { setIconText(t); setPaletteBackgroundPixmap(pm); } } else if (*s == QString("Font")) { QFont f = font(); QString q = *(list.next()); f.fromString(q); setFont(f); } else if (*s == QString("Function")) { attachFunction(list.next()->toInt()); } else if (*s == QString("BindKey")) { assert(m_keyBind); QString t = *(list.next()); m_keyBind->setKey(t.toInt()); } else if (*s == QString("BindMod")) { assert(m_keyBind); QString t = *(list.next()); m_keyBind->setMod(t.toInt()); } else if (*s == QString("BindPress")) { assert(m_keyBind); QString t = *(list.next()); m_keyBind->setPressAction((KeyBind::PressAction) t.toInt()); } else if (*s == QString("BindRelease")) { assert(m_keyBind); QString t = *(list.next()); m_keyBind->setReleaseAction((KeyBind::ReleaseAction) t.toInt()); } else { // Unknown keyword, ignore *list.next(); } } setGeometry(rect); }
void VariablesListView::replaceVariable(DebuggerVariable* oldvar, DebuggerVariable* newvar) { KListViewItem * item; // Remove children that doesen't exist anymore QPtrList<DebuggerVariable> oldlist = oldvar->values(); for(DebuggerVariable* oldchild = oldlist.last(); oldchild; oldchild = oldlist.prev()) { bool found = false; QPtrList<DebuggerVariable> newlist = newvar->values(); for(DebuggerVariable* newchild = newlist.last(); newchild; newchild = newlist.prev()) { if(newchild->name() == oldchild->name()) { found = true; break; } } if(!found) oldvar->deleteChild(oldchild); } // Update and add children QPtrList<DebuggerVariable> newlist = newvar->values(); for(DebuggerVariable* newchild = newlist.last(); newchild; newchild = newlist.prev()) { bool found = false; QPtrList<DebuggerVariable> oldlist = oldvar->values(); for(DebuggerVariable* oldchild = oldlist.last(); oldchild; oldchild = oldlist.prev()) { if(newchild->name() == oldchild->name()) { found = true; replaceVariable( oldchild, newchild); break; } } if(!found) { DebuggerVariable* child = new DebuggerVariable(); item = new KListViewItem(oldvar->item()); child->setItem(item); replaceVariable( child, newchild); oldvar->append(child); } } item = oldvar->item(); if(oldvar->value() != newvar->value()) item->setPixmap(VariablesListViewColumns::Status, SmallIcon("ok")); else item->setPixmap(VariablesListViewColumns::Status, KPixmap()); oldvar->copy(newvar, false); item->setText(VariablesListViewColumns::Name, oldvar->name()); item->setText(VariablesListViewColumns::Type, oldvar->typeName()); item->setText(VariablesListViewColumns::Size, oldvar->sizeName()); item->setText(VariablesListViewColumns::Value, (newvar->isScalar() ? oldvar->value() : QString())); }