void PieceTableChangeHistory::openGroupedChange( const QString& description ) { GroupPieceTableChange *groupChange = new GroupPieceTableChange( mActiveGroupChange, description ); appendChange( groupChange ); mActiveGroupChange = groupChange; }
int DevPoller::waitAndProcessEvents(int iTimeoutMilliSec) { if (m_curChanges) if (applyChanges() == -1) return LS_FAIL; struct dvpoll dvp; dvp.dp_fds = m_events; dvp.dp_nfds = MAX_EVENTS; dvp.dp_timeout = iTimeoutMilliSec; int ret = ioctl(m_fdDP, DP_POLL, &dvp); if (ret > 0) { struct pollfd *pBegin = m_events; struct pollfd *pEnd = &m_events[ret]; for (; pBegin < pEnd; ++pBegin) { int fd = pBegin->fd; //LS_DBG_L( "DevPoller: fd: %d, revents: %hd", fd, pBegin->revents ); if (fd > m_reactorIndex.getCapacity()) { //LS_DBG_L( "DevPoller: overflow, remove fd: %d", fd ); appendChange(fd, POLLREMOVE); } else { EventReactor *pReactor = m_reactorIndex.get(fd); //if ( !pReactor ) // LS_DBG_L( "DevPoller: pReactor is NULL, remove fd: %d", fd ); if ((pReactor) && (pBegin->fd == pReactor->getfd())) { pReactor->setRevent(pBegin->revents); pReactor->handleEvents(pBegin->revents); } else { //LS_DBG_L( "DevPoller: does not match, remove fd: %d", fd ); appendChange(fd, POLLREMOVE); } } } } return ret; }
int DevPoller::remove(EventReactor *pHandler) { if (!pHandler) return LS_FAIL; int fd = pHandler->getfd(); if (!m_reactorIndex.get(fd)) return LS_OK; if (!appendChange(fd, POLLREMOVE)) m_reactorIndex.set(fd, NULL); applyChanges(); return LS_OK; }
void DevPoller::modEvent(EventReactor *pHandler, short maskIn, int add_remove) { int mod; short mask; mask = pHandler->getEvents() & maskIn; if (add_remove == 0) { if (mask == 0) return; pHandler->andMask2(~mask); appendChange(pHandler->getfd(), POLLREMOVE); } else { mask = mask ^ maskIn; if (mask == 0) return; pHandler->orMask2(mask); } appendChange(pHandler->getfd(), pHandler->getEvents()); }
int DevPoller::add(EventReactor *pHandler, short mask) { if (!pHandler) return LS_FAIL; int fd = pHandler->getfd(); if (m_reactorIndex.get(fd)) { errno = EEXIST; return LS_FAIL; } pHandler->setPollfd(); pHandler->setMask2(mask); if (!appendChange(fd, mask)) m_reactorIndex.set(fd, pHandler); return LS_OK; }
ChangeDialog::ChangeDialog(ServerDialog *parent, ItWindow * win, ItAlignment * a, aligned_doc d, QDomNodeList &changes, bool * mark, bool acceptonly) : QDialog(parent), ui(new Ui::ChangeDialog) { ui->setupUi(this); server = parent; window = win; alignment = a; doc = d; changeList = changes; markState = mark; ui->markCheckBox->setChecked(*mark); setTextFont(window->view->font()); setAttribute(Qt::WA_DeleteOnClose, true); appendButton = new QPushButton(QIcon(":/images/16/list-add.png"), QString()); connect(appendButton, SIGNAL(clicked()), this, SLOT(appendChange())); appendButton->setEnabled(false); ui->buttonBox->addButton(appendButton, QDialogButtonBox::ActionRole); detachButton = new QPushButton(QIcon(":/images/16/list-remove.png"), QString()); connect(detachButton, SIGNAL(clicked()), this, SLOT(detachChange())); detachButton->setEnabled(false); ui->buttonBox->addButton(detachButton, QDialogButtonBox::ActionRole); if (acceptonly) { ui->buttonBox->button(QDialogButtonBox::No)->setVisible(false); } connect(ui->markCheckBox, SIGNAL(stateChanged(int)), this, SLOT(changeMark(int))); connect(ui->buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(action(QAbstractButton*))); ui->buttonBox->button(QDialogButtonBox::Yes)->setEnabled(false); ui->buttonBox->button(QDialogButtonBox::YesToAll)->setEnabled(false); ui->buttonBox->button(QDialogButtonBox::No)->setEnabled(false); //ui->buttonBox->button(QDialogButtonBox::NoToAll)->setEnabled(false); changenum = 0; nextChangeNum = 0; autoAccept = false; joinConsChanges = -1; nextChange(); }