void KSession::setHistorySize(int lines) { if ( historySize() != lines ) { if (lines < 0) m_session->setHistoryType(HistoryTypeFile()); else m_session->setHistoryType(HistoryTypeBuffer(lines)); emit historySizeChanged(); } }
int Gui::InputField::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QLineEdit::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 6) qt_static_metacall(this, _c, _id, _a); _id -= 6; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< QByteArray*>(_v) = paramGrpPath(); break; case 1: *reinterpret_cast< double*>(_v) = singleStep(); break; case 2: *reinterpret_cast< double*>(_v) = maximum(); break; case 3: *reinterpret_cast< double*>(_v) = minimum(); break; case 4: *reinterpret_cast< int*>(_v) = historySize(); break; } _id -= 5; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setParamGrpPath(*reinterpret_cast< QByteArray*>(_v)); break; case 1: setSingleStep(*reinterpret_cast< double*>(_v)); break; case 2: setMaximum(*reinterpret_cast< double*>(_v)); break; case 3: setMinimum(*reinterpret_cast< double*>(_v)); break; case 4: setHistorySize(*reinterpret_cast< int*>(_v)); break; } _id -= 5; } else if (_c == QMetaObject::ResetProperty) { _id -= 5; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 5; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 5; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 5; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 5; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 5; } #endif // QT_NO_PROPERTIES return _id; }
// revert the agent's internal model of the world // to that of a previous time cycle void Agent::modelRevert(const ModelUndo &mu) { // Revert excess actions and percepts while (historySize() > mu.historySize()) { if(m_last_update == percept_update) { // Undo percept m_ct->revert(m_env.perceptBits()); m_last_update = action_update; } else { // Undo action m_ct->revertHistory(m_env.actionBits()); m_last_update = percept_update; } } // revert agent parameters m_time_cycle = mu.age(); m_total_reward = mu.reward(); m_last_update = mu.lastUpdate(); }
void eraseSplit(historyIndex &h, int s, int u, int v, int weight) { //cout << "Called eraseSplit on s=" << s << ", u=" << u << ", v=" << v << ", weight=" << weight << endl; int startSize = historySize(h); //cout << "Current history size is " << startSize << endl; h.loc = h.last; history toErase(s, u, v, weight); if (*h.last == toErase) { //cout << "Went down last erase path." << endl; if (h.last->multiplicity == weight) { h.last->prev->next = nullptr; h.last = h.last->prev; } else h.last->multiplicity -= weight; return; } //cout << "Went down full path." << endl; h.loc = h.last; //cout << "This is h" << endl; //cout << "last:" << endl; //output(*h.last); //cout << "first: " << endl; //output(*h.first); //cout << "current:" << endl; //output(*h.loc); while (h.loc->prev != nullptr) { h.loc = h.loc->prev; //cout << "This is h" << endl; //cout << "last:" << endl; //output(*h.last); //cout << "first: " << endl; //output(*h.first); //cout << "current:" << endl; //output(*h.loc); if (toErase == *h.loc) { if (h.loc->multiplicity == weight) { if (!(h.loc->isFirst())) { h.loc->prev->next = h.loc->next; h.loc->next->prev = h.loc->prev; } else { cout << "Error: Could not find split in history. Quitting." << endl; throw logic_error(""); } } else h.loc->multiplicity -= weight; break; } } int endSize = historySize(h); //cout << "Ending history size is: " << endSize << endl; }
void MapGraphicsView::scanFinished(QList<WifiDataResult> results) { int fontSize = 10;// * (1/m_scaleFactor); #ifdef Q_OS_ANDROID fontSize = 5; #endif int margin = fontSize/2; int y = margin; int lineJump = (int)(fontSize * 1.33); #ifdef Q_OS_ANDROID margin = fontSize; y = margin; lineJump = fontSize * 4; #endif int numLines = results.size(); if(numLines <= 0) numLines = 1; // for a special message int imgWidth = 150; int imgHeight = numLines * lineJump + margin * 3; QImage img(imgWidth, imgHeight, QImage::Format_ARGB32_Premultiplied); memset(img.bits(), 0, img.byteCount()); QPainter p(&img); p.fillRect(img.rect(), QColor(0,0,0,150)); p.setFont(QFont("Monospace", fontSize, QFont::Bold)); QSize historySize( //(int)(imgWidth - margin * 2), margin * 4, (int)(lineJump - 4.)); foreach(WifiDataResult result, results) { if(!m_apSigHist.contains(result.mac)) m_apSigHist.insert(result.mac, new MapSignalHistory(m_gs->baseColorForAp(result.mac))); MapSignalHistory *hist = m_apSigHist.value(result.mac); hist->addValue(result.value); QColor color = m_gs->colorForSignal(1.0, result.mac).lighter(100); #ifdef Q_OS_ANDROID color = color.darker(300); #endif QColor outline = Qt::white; //qGray(color.rgb()) < 60 ? Qt::white : Qt::black; QPoint pnt(QPoint( margin/2 + historySize.width(), y += lineJump)); qDrawTextC(p, pnt.x(), pnt.y(), QString( "%1% %2" ) .arg(QString().sprintf("%02d", (int)round(result.value * 100.))) .arg(result.essid), outline, color); p.setOpacity(0.80); p.drawImage( QPoint( 0 /*margin*/, (int)(y - lineJump * .75) ), hist->renderGraph(historySize) .mirrored(true,false) ); p.setOpacity(1.0); } if(results.size() <= 0) { qDrawTextC(p, margin, margin + margin + p.font().pointSize() * 2, tr("No APs nearby or WiFi off"), Qt::red, Qt::white); } // Draw border on top of any text that may overflow p.setPen(Qt::black); p.drawRect(img.rect().adjusted(0,0,-1,-1)); // qDebug() << "MapGraphicsView::scanFinished(): Rendered "<<img.size()<<" size HUD"; // img.save("hud.png"); p.end(); m_hudLabel->setPixmap(QPixmap::fromImage(img)); //updateViewportLayout(); }