bool MolecularFileDialog::finish_(const String& filename, const String& system_name, System* system) { // writing info to log setStatusbarText(String(tr("Read")) + " " + String(system->countAtoms()) + " " + (String)tr("atoms from file") + " \"" + filename + "\"", true); if (system->getName() == "") { system->setName(system_name); } if (filename[0] != FileSystem::PATH_SEPARATOR) { system->setProperty("FROM_FILE", getWorkingDir() + FileSystem::PATH_SEPARATOR + filename); } else { system->setProperty("FROM_FILE", filename); } // notify tree of a new composite CompositeMessage* new_message = new CompositeMessage; new_message->setComposite(*system); new_message->setCompositeName(system_name); new_message->setType(CompositeMessage::NEW_COMPOSITE); notify_(new_message); return true; }
VAULTFUNCTION ID Create(ID itemlist, Function<ID, ID, ID, State> notify, const String& format_) noexcept { char function_name[16]; std::snprintf(function_name, sizeof(function_name), "%p", reinterpret_cast<void*>(notify)); String notify_(function_name); MakePublic(notify, notify_); return static_cast<ID>(CallPublic("IlView::Create", itemlist, notify_.c_str(), format_.c_str())); }
void DockWidget::registerForHelpSystem(const QObject* widget, const String& url) { ModularWidget::registerForHelpSystem(widget, url); // also register Windows menu entry! RegisterHelpSystemMessage* msg = new RegisterHelpSystemMessage(); msg->setObject(window_menu_entry_); msg->setURL(url); notify_(msg); }
void RemoteNode::handle_(const Request& req, const bc::milliseconds& timeout_ms, ExtraSendFun* send_extra, ExtraRecvFun* recv_extra) { auto work = boost::make_shared<WorkItem>(req, send_extra, recv_extra); { LOCK(); queued_work_.push_back(work); notify_(); } switch (work->future.wait_for(timeout_ms)) { case boost::future_status::deferred: { LOG_ERROR(node_id() << ": " << work->request_desc << ", tag " << work->request_tag << ": future unexpectedly returned 'deferred' status"); drop_request_(*work); VERIFY(0 == "unexpected future_status 'deferred'"); } case boost::future_status::timeout: { LOG_INFO(node_id() << ": remote did not respond within " << timeout_ms << " milliseconds - giving up"); drop_request_(*work); throw RequestTimeoutException("request to remote node timed out"); } case boost::future_status::ready: { handle_response_(*work); break; } } }
bool add_parcel(parcel const& p) { naming::gid_type id(p.get_parcel_id()); // Add parcel to queue. { mutex_type::scoped_lock l(mtx_); std::pair<parcel_map_type::iterator, bool> ret = parcels_.insert(parcel_map_type::value_type(id, p)); if (!ret.second) { HPX_THROW_EXCEPTION(bad_parameter, "global_parcelhandler_queue::add_parcel", "Could not add received parcel to the parcelhandler " "queue"); return false; } } // do some work (notify event handlers) HPX_ASSERT(ph_ != 0); notify_(*ph_, id); return true; }
void DownloadPDBFile::downloadFinished() { String id = ascii(pdbId->currentText()); String url = prefix_; url += id; url += (checkbox_biounit->isChecked()) ? biounit_suffix_ : suffix_; Log.info() << "Url: " << url << std::endl; if (current_reply_->error() != QNetworkReply::NoError) { Log.error() << "Could not download PDBFile! Reason given was \"" + (String)(current_reply_->errorString()) + "\""<< std::endl; setStatusbarText("Could not download PDBFile! Reason given was \"" + (String)(current_reply_->errorString()) + "\""); error_ = true; } else { System *system = new System(); try { String temp_filename = VIEW::createTemporaryFilename(); QFile outfile(temp_filename.c_str()); outfile.open(QIODevice::ReadWrite); outfile.write(current_reply_->readAll()); outfile.close(); // if we download the biological unit, we have to decompress the pdb.gz file if (checkbox_biounit->isChecked()) { String unzipped_filename = VIEW::createTemporaryFilename(); std::ifstream file(temp_filename.c_str(), std::ios_base::in | std::ios_base::binary); boost::iostreams::filtering_streambuf<boost::iostreams::input> in; in.push(boost::iostreams::gzip_decompressor()); in.push(file); PDBFile pdb_file(unzipped_filename, std::ios::out | std::ios::binary); boost::iostreams::copy(in, pdb_file); pdb_file.reopen(std::ios::in); // the individual units are organized as MODELs // by default PDBFile only reads the first MODEL pdb_file.selectAllModels(); pdb_file >> *system; pdb_file.close(); removeFile_(unzipped_filename); } else { PDBFile pdb_file(temp_filename); pdb_file >> *system; pdb_file.close(); } removeFile_(temp_filename); if (system->countAtoms() == 0) { delete system; show(); setStatusbarText(tr("Could not fetch the given PDBFile"), true); return; } else { setStatusbarText(String("read ") + String(system->countAtoms()) + " atoms for: " + id, true); } if (system->getName() == "") { system->setName(ascii(pdbId->currentText())); } system->setProperty("FROM_FILE", url); close(); pdbId->clearEditText(); getMainControl()->insert(*system, ascii(pdbId->currentText())); notify_(new CompositeMessage(*system, CompositeMessage::CENTER_CAMERA)); download->setDefault(true); pdbId->setFocus(); } catch(...)