bool Notepad_plus::fileDelete(BufferID id) { BufferID bufferID = id; if (id == BUFFER_INVALID) bufferID = _pEditView->getCurrentBufferID(); Buffer * buf = MainFileManager->getBufferByID(bufferID); const TCHAR *fileNamePath = buf->getFullPathName(); if (doDeleteOrNot(fileNamePath) == IDYES) { if (!MainFileManager->deleteFile(bufferID)) { _nativeLangSpeaker.messageBox("DeleteFileFailed", getMainWindowHandle(), TEXT("Delete File failed"), TEXT("Delete File"), MB_OK); return false; } doClose(bufferID, MAIN_VIEW); doClose(bufferID, SUB_VIEW); return true; } return false; }
void CDavisLoggerSerial::readCallback(const char *data, size_t len) { boost::lock_guard<boost::mutex> l(readQueueMutex); try { //_log.Log(LOG_NORM,"Davis: received %ld bytes",len); switch (m_state) { case DSTATE_WAKEUP: if (len==2) { _log.Log(LOG_NORM,"Davis: System is Awake..."); m_state=DSTATE_LOOP; m_statecounter=DAVIS_READ_INTERVAL-1; } break; case DSTATE_LOOP: if (len==2) break; //could be a left over from the awake if (len!=100) { _log.Log(LOG_ERROR,"Davis: Invalid bytes received!..."); //lets try again try { clearReadCallback(); close(); doClose(); setErrorStatus(true); } catch(...) { //Don't throw from a Stop command } } else { if (!HandleLoopData((const unsigned char*)data,len)) { //error in data, try again... try { clearReadCallback(); close(); doClose(); setErrorStatus(true); } catch(...) { //Don't throw from a Stop command } } } break; } //onRFXMessage((const unsigned char *)data,len); } catch (...) { } }
bool BaseFile::close() { m_clearMode = Close; if(!clear()) return false; doClose(); return true; }
void WebSocketTransport::handlePongTimeout() { NFD_LOG_FACE_WARN(__func__); this->setState(TransportState::FAILED); doClose(); }
void UninstallForm::onButtonClicked(wxCommandEvent &event) { if (m_butCancel->GetId() == event.GetId()) { doClose(); } else if (m_butUninstall->GetId() == event.GetId()) { m_butCancel->Enable(false); m_butUninstall->Enable(false); m_butRepair->Enable(false); uint32 flags = 0; UDFSettingsPanel* settings = dynamic_cast<UDFSettingsPanel*>(m_pContent); if (settings) flags = settings->getFlags(); m_pContent = new UDFProgressPanel(this, m_pUser, flags); m_bContentSizer->Clear(true); m_bContentSizer->Add(m_pContent, 1, wxEXPAND, 5); this->Layout(); } else if (m_butRepair->GetId() == event.GetId()) { UTIL::WIN::launchExe("desura.exe", "-forceupdate"); SetExitCode(-1); GetParent()->Close(); } }
void SocketBase::doConnect() throw(NetworkException) { if ( state == CONFIGURED ) { int res = connect(sockfd, addr.getSockaddr(), addr.getSockaddrLen()); if(res == SOCKET_ERROR) { lastError = GET_NET_ERROR(); if ( !IS_CONNECT_INPROGRESS(lastError) ) { doClose(); std::stringstream msg; msg << "Couldn't connect to '" << addr.getIP() << "' port " << addr.getPort() << ": " << NETSTRERROR(lastError); throw NetworkException(msg.str()); } } state = CONNECTING; disconnectTimer.reset(); SocketManager::addSocket(this); } else { LOGGER.warning("Trying to connect to an unconfigured socket [%s]", getStateString()); } }
extern "C" JNIEXPORT void JNICALL Java_java_nio_channels_SocketChannel_natCloseSocket(JNIEnv *, jclass, jint socket) { doClose(socket); }
/** * Callback function registered to the ESP8266 environment that is * invoked when a new outbound connection has been formed. */ static void esp8266_callback_connectCB_outbound( void *arg //!< A pointer to a `struct espconn`. ) { os_printf(">> connectCB_outbound\n"); struct espconn *pEspconn = (struct espconn *)arg; assert(pEspconn != NULL); dumpEspConn(pEspconn); struct socketData *pSocketData = (struct socketData *)pEspconn->reverse; assert(pSocketData != NULL); esp8266_dumpSocket(pSocketData->socketId); // Flag the socket as connected to a partner. pSocketData->isConnected = true; assert(pSocketData->state == SOCKET_STATE_CONNECTING); if (pSocketData->shouldClose) { doClose(pSocketData->socketId); } else { pSocketData->state = SOCKET_STATE_IDLE; } os_printf("<< connectCB_outbound\n"); }
/** * Close a socket. */ void net_ESP8266_BOARD_closeSocket( JsNetwork *net, //!< The Network we are going to use to create the socket. int socketId //!< The socket to be closed. ) { os_printf("> net_ESP8266_BOARD_closeSocket, socket=%d\n", socketId); struct socketData *pSocketData = getSocketData(socketId); assert(pSocketData != NULL); assert(pSocketData->state != SOCKET_STATE_UNUSED); // Shouldn't be closing an unused socket. dumpEspConn(pSocketData->pEspconn); esp8266_dumpSocket(socketId); // How we close the socket is a function of what kind of socket it is. if (pSocketData->creationType == SOCKET_CREATED_SERVER) { int rc = espconn_delete(pSocketData->pEspconn); if (rc != 0) { os_printf("espconn_delete: rc=%d\n", rc); } } // End this is a server socket else { if (pSocketData->state == SOCKET_STATE_IDLE || pSocketData->state == SOCKET_STATE_CLOSING) { doClose(socketId); } else { pSocketData->shouldClose = true; } } // End this is a client socket }
void AsyncSerial::writeEnd(const boost::system::error_code& error) { if(!error) { boost::lock_guard<boost::mutex> l(pimpl->writeQueueMutex); if(pimpl->writeQueue.empty()) { pimpl->writeBuffer.reset(); pimpl->writeBufferSize=0; sleep_milliseconds(75); return; } pimpl->writeBufferSize=pimpl->writeQueue.size(); pimpl->writeBuffer.reset(new char[pimpl->writeQueue.size()]); copy(pimpl->writeQueue.begin(),pimpl->writeQueue.end(), pimpl->writeBuffer.get()); pimpl->writeQueue.clear(); async_write(pimpl->port,boost::asio::buffer(pimpl->writeBuffer.get(), pimpl->writeBufferSize), boost::bind(&AsyncSerial::writeEnd, this, boost::asio::placeholders::error)); } else { try { setErrorStatus(true); doClose(); } catch (...) { } } }
void TcpHandler::watchdogTimeout(const boost::system::error_code& error) { if (error != boost::asio::error::operation_aborted) { doClose(error); } }
extern "C" JNIEXPORT void JNICALL Java_java_nio_channels_DatagramChannel_close(JNIEnv *, jclass, jint socket) { doClose(socket); }
/* 初始化相应的信号与槽 */ void TextEditer::initConnection() { /* menuFile里的信号与槽 */ connect(actNew, SIGNAL(triggered()), this, SLOT(doNew())); connect(actOpen, SIGNAL(triggered()), this, SLOT(doOpen())); connect(actClose, SIGNAL(triggered()), this, SLOT(doClose())); connect(actSave, SIGNAL(triggered()), this, SLOT(doSave())); connect(actASave, SIGNAL(triggered()), this, SLOT(doASave())); connect(actExit, SIGNAL(triggered()), this, SLOT(doExit())); /* menuEdit里的信号与槽 */ connect(actUndo, SIGNAL(triggered()), this, SLOT(doUndo())); connect(actRedo, SIGNAL(triggered()), this, SLOT(doRedo())); connect(actCut, SIGNAL(triggered()), this, SLOT(doCut())); connect(actCopy, SIGNAL(triggered()), this, SLOT(doCopy())); connect(actPast, SIGNAL(triggered()), this, SLOT(doPast())); connect(actAll, SIGNAL(triggered()), this, SLOT(doSelectAll())); /* menuTool里的信号与槽 */ connect(actFont, SIGNAL(triggered()), this, SLOT(setFontForText())); /* 当当前文本内容改变后, 自动调用doModified() */ connect(textEdit->document(), SIGNAL(contentsChanged()), this, SLOT(doModified())); /* 当文档修改后, 刷新光标所在的位置 */ connect(textEdit->document(), SIGNAL(contentsChanged()), this, SLOT(doCursorChanged())); }
SketchMainHelpPrivate::SketchMainHelpPrivate ( const QString &viewString, const QString &htmlText, SketchMainHelp *parent) : QFrame() { setObjectName("sketchMainHelp"+viewString); m_parent = parent; QFrame *main = new QFrame(this); QHBoxLayout *mainLayout = new QHBoxLayout(main); QLabel *imageLabel = new QLabel(this); QLabel *imageLabelAux = new QLabel(imageLabel); imageLabelAux->setObjectName(QString("inviewHelpImage%1").arg(viewString)); QPixmap pixmap(QString(":/resources/images/helpImage%1.png").arg(viewString)); imageLabelAux->setPixmap(pixmap); imageLabel->setFixedWidth(pixmap.width()); imageLabel->setFixedHeight(pixmap.height()); imageLabelAux->setFixedWidth(pixmap.width()); imageLabelAux->setFixedHeight(pixmap.height()); ExpandingLabel *textLabel = new ExpandingLabel(this); textLabel->setLabelText(htmlText); textLabel->setFixedWidth(430 - 41 - pixmap.width()); textLabel->allTextVisible(); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum); textLabel->setToolTip(""); textLabel->setAlignment(Qt::AlignLeft); mainLayout->setSpacing(6); mainLayout->setMargin(2); mainLayout->addWidget(imageLabel); mainLayout->addWidget(textLabel); setFixedWidth(430); QVBoxLayout *layout = new QVBoxLayout(this); m_closeButton = new SketchMainHelpCloseButton(viewString,this); connect(m_closeButton, SIGNAL(clicked()), this, SLOT(doClose())); QFrame *bottomMargin = new QFrame(this); bottomMargin->setFixedHeight(m_closeButton->height()); layout->addWidget(m_closeButton); layout->addWidget(main); layout->addWidget(bottomMargin); layout->setSpacing(0); layout->setMargin(2); m_shouldGetTransparent = false; //m_closeButton->doHide(); QFile styleSheet(":/resources/styles/inviewhelp.qss"); if (!styleSheet.open(QIODevice::ReadOnly)) { qWarning("Unable to open :/resources/styles/inviewhelp.qss"); } else { setStyleSheet(styleSheet.readAll()); } }
void Q3TitleBar::mouseReleaseEvent(QMouseEvent *e) { Q_D(Q3TitleBar); if (e->button() == Qt::LeftButton && d->pressed) { e->accept(); QStyleOptionTitleBar opt = d->getStyleOption(); QStyle::SubControl ctrl = style()->hitTestComplexControl(QStyle::CC_TitleBar, &opt, e->pos(), this); d->pressed = false; if (ctrl == d->buttonDown) { d->buttonDown = QStyle::SC_None; repaint(); switch(ctrl) { case QStyle::SC_TitleBarShadeButton: case QStyle::SC_TitleBarUnshadeButton: if(d->flags & Qt::WindowShadeButtonHint) emit doShade(); break; case QStyle::SC_TitleBarNormalButton: if(d->flags & Qt::WindowMaximizeButtonHint) emit doNormal(); break; case QStyle::SC_TitleBarMinButton: if(d->flags & Qt::WindowMinimizeButtonHint) { if (d->window && d->window->isMinimized()) emit doNormal(); else emit doMinimize(); } break; case QStyle::SC_TitleBarMaxButton: if(d->flags & Qt::WindowMaximizeButtonHint) { if(d->window && d->window->isMaximized()) emit doNormal(); else emit doMaximize(); } break; case QStyle::SC_TitleBarCloseButton: if(d->flags & Qt::WindowSystemMenuHint) { d->buttonDown = QStyle::SC_None; repaint(); emit doClose(); return; } break; default: break; } } } else { e->ignore(); } }
void File::close() { if (isOpen()) { m_opened = false; doClose(); } }
void IModule::Close() { if (m_isinit) { doClose(); m_isinit = false; } }
void AbstractFont::close() { if(isOpened()) { doClose(); _size = 0.0f; _lineHeight = 0.0f; CORRADE_INTERNAL_ASSERT(!isOpened()); } }
void E1Popup::mouseReleaseEvent(QMouseEvent *) { if(-1 != m_selected) { emit selected(m_selected); update(); QTimer::singleShot(100, this, SLOT(doClose())); } }
DecoderIOFactoryUrl::~DecoderIOFactoryUrl(void) { doClose(); m_accessManager->deleteLater(); if (m_input) delete m_input; }
void IndexReader::decRef() { SyncLock syncLock(this); BOOST_ASSERT(refCount > 0); ensureOpen(); if (refCount == 1) { commit(); doClose(); } --refCount; }
bool SketchMainHelpPrivate::forwardMousePressEvent(QMouseEvent * event) { QPoint p = m_closeButton->mapFromParent(event->pos()); if (m_closeButton->rect().contains(p)) { doClose(); return true; } return false; }
//============================================================================= // METHOD : SPELLcontroller::doRecover //============================================================================= void SPELLcontroller::doRecover() { std::cerr << "############ TRY TO RECOVER ###############" << std::endl; if ((getStatus() != STATUS_ERROR) && !m_error) return; setMode( MODE_STEP ); m_recover = true; m_reload = true; doClose(); }
void VideoDialog::createControls() { // tab tabTransient = createControlsViewportTimeSteps(); tabAdaptivity = createControlsViewportAdaptiveSteps(); tabType = new QStackedWidget(); tabType->addWidget(tabAdaptivity); tabType->addWidget(tabTransient); btnClose = new QPushButton(tr("Close")); btnClose->setDefault(true); connect(btnClose, SIGNAL(clicked()), this, SLOT(doClose())); QPushButton *btnVideo = new QPushButton(tr("Show video")); btnVideo->setDefault(true); connect(btnVideo, SIGNAL(clicked()), this, SLOT(doVideo())); btnGenerate = new QPushButton(tr("Generate")); QHBoxLayout *layoutButton = new QHBoxLayout(); layoutButton->addStretch(); layoutButton->addWidget(btnGenerate); layoutButton->addWidget(btnVideo); layoutButton->addWidget(btnClose); QSettings settings; chkSaveImages = new QCheckBox(tr("Save images to disk")); chkSaveImages->setChecked(settings.value("VideoDialog/SaveImages", true).toBool()); chkFigureShowGrid = new QCheckBox(tr("Show grid")); chkFigureShowGrid->setChecked(settings.value("VideoDialog/ShowGrid", Agros2D::problem()->setting()->value(ProblemSetting::View_ShowGrid).toBool()).toBool()); chkFigureShowRulers = new QCheckBox(tr("Show rulers")); chkFigureShowRulers->setChecked(settings.value("VideoDialog/ShowRulers", Agros2D::problem()->setting()->value(ProblemSetting::View_ShowRulers).toBool()).toBool()); chkFigureShowAxes = new QCheckBox(tr("Show axes")); chkFigureShowAxes->setChecked(settings.value("VideoDialog/ShowAxes", Agros2D::problem()->setting()->value(ProblemSetting::View_ShowAxes).toBool()).toBool()); QHBoxLayout *layoutButtonViewport = new QHBoxLayout(); layoutButtonViewport->addStretch(); layoutButtonViewport->addWidget(btnGenerate); QGridLayout *layout = new QGridLayout(); layout->addWidget(tabType, 0, 0, 1, 2); layout->addWidget(chkSaveImages, 1, 0); layout->addWidget(chkFigureShowGrid, 1, 1); layout->addWidget(chkFigureShowRulers, 2, 1); layout->addWidget(chkFigureShowAxes, 3, 1); layout->addLayout(layoutButton, 10, 0, 1, 2); setLayout(layout); setMinimumWidth(300); }
void HippoBubble::setScreenSaverRunning(bool screenSaverRunning) { screenSaverRunning_ = screenSaverRunning; if (shown_) { if (!screenSaverRunning_) doShow(); else doClose(); } }
void UninstallForm::onCloseWindow(wxCloseEvent &event) { if (!m_bComplete && event.CanVeto()) { event.Veto(); } else { doClose(); event.Skip(); } }
void SocketListener::process() { Connection::ptr pack; while (!m_handler->m_term) { if (m_handler->m_packets.pop_front(pack, -1)) { if (pack->type == Net_Close) { doClose(pack); } else if (pack->type == Net_Packet) { doRequest(pack); } } } }
void TcpTransport::afterChangePersistency(ndn::nfd::FacePersistency oldPersistency) { // if persistency was changed from permanent to any other value if (oldPersistency == ndn::nfd::FACE_PERSISTENCY_PERMANENT) { if (this->getState() == TransportState::DOWN) { // non-permanent transport cannot be in DOWN state, so fail hard this->setState(TransportState::FAILED); doClose(); } } }
STDMETHODIMP HippoBubble::Close() { ui_->debugLogU("closing link notification"); shown_ = FALSE; if (!screenSaverRunning_) doClose(); return S_OK; }
/** * @brief EngineClient::~LocalServer * Destructor */ EngineClient::~EngineClient() { if(ipClient) { disconnect(this, SIGNAL(sendMessage(QString)), ipClient, SLOT(sendMessage(QString))); disconnect(ipClient, SIGNAL(messageIn(QString)), this, SLOT(slotOnData(QString))); disconnect(this, SIGNAL(closed()), ipClient, SLOT(doClose())); disconnect(this, SIGNAL(open()), ipClient, SLOT(doOpen())); disconnect(ipClient, SIGNAL(closeThread()), this, SLOT(connectionLost())); delete ipClient; } ipClient=NULL; }