Resource::ResOpResult Chanend:: out(Thread &thread, uint32_t value, ticks_t time) { updateOwner(thread); if (!openRoute()) { pausedOut = &thread; return DESCHEDULE; } if (junkPacket) return CONTINUE; if (!dest->canAcceptTokens(4)) { pausedOut = &thread; return DESCHEDULE; } // Channels are big endian uint8_t tokens[4] = { value >> 24, value >> 16, value >> 8, value }; dest->receiveDataTokens(time, tokens, 4); return CONTINUE; } Resource::ResOpResult Chanend:: outct(Thread &thread, uint8_t value, ticks_t time) { updateOwner(thread); if (!openRoute()) { pausedOut = &thread; return DESCHEDULE; } if (junkPacket) { if (value == CT_END || value == CT_PAUSE) { inPacket = false; junkPacket = false; } return CONTINUE; } if (!dest->canAcceptToken()) { pausedOut = &thread; return DESCHEDULE; } dest->receiveCtrlToken(time, value); if (value == CT_END || value == CT_PAUSE) { inPacket = false; dest = 0; } return CONTINUE; }
bool Player::setItem(size_t invIdx, size_t itemIdx, std::unique_ptr<Item>& item, std::unique_ptr<Item>& oldItem) { if (invIdx >= inventories.size()) { return false; } auto itemPtr = item.get(); auto& inventory = inventories[invIdx]; auto ret = inventory.set(itemIdx, item, oldItem); if (ret == true) { if (itemPtr != nullptr) { updateItemQuantityCache(itemPtr->Class()->IdHash16()); itemPtr->clearMapPosition(); itemPtr->updateOwner(this); } else if (oldItem != nullptr) { updateItemQuantityCache(oldItem->Class()->IdHash16()); oldItem->updateOwner(nullptr); } if (bodyInventoryIdx == invIdx) { updateProperties(); } } return ret; }
bool Chanend:: testct(Thread &thread, ticks_t time, bool &isCt) { updateOwner(thread); if (buf.empty()) { setPausedIn(thread, false); return false; } isCt = buf.front().isControl(); return true; }
bool Chanend::setData(Thread &thread, uint32_t value, ticks_t time) { updateOwner(thread); if (inPacket) return false; ResourceID id(value); if (id.type() != RES_TYPE_CHANEND && id.type() != RES_TYPE_CONFIG) return false; destID = value; return true; }
void EventableResource::eventDisable(Thread &thread) { if (eventsEnabled) { if (interruptMode) { owner->removeInterruptEnabledResource(this); } else { owner->removeEventEnabledResource(this); } } eventsEnabled = false; updateOwner(thread); }
std::unique_ptr<Item> Player::SelectedItem(std::unique_ptr<Item> item) noexcept { auto old = std::move(selectedItem); selectedItem = std::move(item); if (selectedItem != nullptr) { selectedItem->clearMapPosition(); selectedItem->updateOwner(this); } if (old != nullptr) { old->updateOwner(nullptr); } return old; }
void EventableResource::eventEnable(Thread &thread) { updateOwner(thread); if (!eventsEnabled) { if (interruptMode) { owner->addInterruptEnabledResource(this); } else { owner->addEventEnabledResource(this); } } eventsEnabled = true; if (eventsPermitted() && seeEventEnable(owner->time)) { event(owner->time); } }
Resource::ResOpResult Chanend:: outt(Thread &thread, uint8_t value, ticks_t time) { updateOwner(thread); if (!openRoute()) { pausedOut = &thread; return DESCHEDULE; } if (junkPacket) return CONTINUE; if (!dest->canAcceptToken()) { pausedOut = &thread; return DESCHEDULE; } dest->receiveDataToken(time, value); return CONTINUE; }
bool Chanend:: testwct(Thread &thread, ticks_t time, unsigned &position) { updateOwner(thread); position = 0; unsigned numTokens = std::min(buf.size(), 4U); for (unsigned i = 0; i < numTokens; i++) { if (buf[i].isControl()) { position = i + 1; return true; } } if (buf.size() < 4) { setPausedIn(thread, true); return false; } return true; }
void EventableResource::setInterruptMode(Thread &thread, bool Enable) { updateOwner(thread); if (Enable == interruptMode) return; if (eventsEnabled) { if (interruptMode) { owner->removeInterruptEnabledResource(this); owner->addEventEnabledResource(this); } else { owner->removeEventEnabledResource(this); owner->addInterruptEnabledResource(this); } } interruptMode = Enable; if (eventsPermitted() && seeEventEnable(thread.time)) { event(thread.time); } }
void EventableResource::setEV(Thread &thread, uint32_t ev) { updateOwner(thread); EV = ev; }
void EventableResource::setVector(Thread &thread, uint32_t v) { updateOwner(thread); vector = v; }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), logfileIndicator (new QLabel ( this)), ui(new Ui::MainWindow) { ui->setupUi(this); this->setWindowTitle( tr("QT Logger") ); version = "1.1.2"; this->setMouseTracking(true); this->setBackgroundRole(QPalette::Base); QCoreApplication::setOrganizationName("openhpsdr"); QCoreApplication::setOrganizationDomain("openhpsdr.org"); QCoreApplication::setApplicationName("QtLogger"); //logfileIndicator->setStyleSheet (QString ("QLabel {color:red}")); logfileIndicator->setPixmap(QPixmap(":/icons/filefoldergrey16.svg")); logfileIndicator->setToolTip(QString("Logfile: No file") ); About *about = new About(); about->setVersion( version ); Help *help = new Help(); data = new Data(); data->setMinimumHeader(); add = new addDialog( this ); readDefinitions(":/xml/adif_codes_2.2.7.xml"); add->loadmodeComboBox( modes ); add->loadcountryComboBox( country ); add->loadsubdivisionsComboBox( subdivisions ); add->loadbandsData( bands ); last = new lastContact( this ); pref = new Preferences( this ); pref->setPreferences( QString("radio"), settings.value("preference_radio").toString() ); pref->setPreferences( QString("location"), settings.value("preference_location").toString() ); pref->setPreferences( QString("event"), settings.value("preference_event").toString() ); pref->setPreferences( QString("owner"), settings.value("preference_owner").toString() ); pref->setPreferences( QString("qsl"), settings.value("preference_qsl").toString() ); pref->setPreferences( QString("callfilter"), settings.value("callsign_filter").toString() ); add->callsign_filter = pref->getPreferences("callfilter"); udpSocket = new QUdpSocket(this); udpSocket->bind( 11500, QUdpSocket::ShareAddress ); statusBar ()->addPermanentWidget (logfileIndicator); ui->tableView->verticalScrollBar()->setValue(ui->tableView->verticalScrollBar()->maximum()); deleteFlag = false; connect(udpSocket, SIGNAL(readyRead()), this, SLOT(processPendingDatagrams())); connect(ui->actionQuit,SIGNAL(triggered()),this,SLOT(closeDown())); connect(ui->actionAbout,SIGNAL(triggered()),about,SLOT(aboutMessage())); connect(ui->actionHelp,SIGNAL(triggered()),help,SLOT(show())); connect(ui->actionPreferences,SIGNAL(triggered()),pref,SLOT(show())); connect(pref,SIGNAL(preferencesChanged()),this,SLOT(updateView())); connect(ui->actionOpen,SIGNAL(triggered()),data,SLOT(readData())); connect(ui->actionLast_Contact,SIGNAL(triggered()),last,SLOT(show())); connect(ui->actionOpen,SIGNAL(triggered()),this,SLOT(updateStatus())); connect(ui->actionSave,SIGNAL(triggered()),this,SLOT(writeData())); connect(ui->actionSupport_Directory,SIGNAL(triggered()),this,SLOT(setSupportDirectory())); connect(ui->actionLog_Directory,SIGNAL(triggered()),this,SLOT(setLogDirectory())); connect(ui->tableView,SIGNAL(clicked(QModelIndex)),this,SLOT(removeTableRow(QModelIndex))); connect(ui->tableView,SIGNAL(activated(QModelIndex)),ui->tableView,SLOT(resizeRowsToContents())); connect(ui->actionAdd,SIGNAL(triggered()),add,SLOT(show())); connect(add,SIGNAL(newdata()),this,SLOT(update())); connect(data,SIGNAL(refresh()),this,SLOT(update())); connect(ui->actionDelete,SIGNAL(toggled(bool)),this,SLOT(setDeleteFlag(bool))); connect(add,SIGNAL(ownerChanged()),this,SLOT(updateOwner())); connect(add,SIGNAL(prefixChanged(QString)),last->proxyModel,SLOT(setFilterRegExp(QString))); connect(add,SIGNAL(prefixChanged(QString)),last,SLOT(setCallLabel(QString))); connect(add,SIGNAL(prefixChanged(QString)),add->proxyModel,SLOT(setFilterRegExp(QString))); }