void rice::p2p::scribe::messaging::AnycastMessage::setContent(::rice::p2p::scribe::ScribeContent* content) { if(dynamic_cast< ::rice::p2p::scribe::rawserialization::RawScribeContent* >(content) != nullptr) { setContent(content); } else { setContent(static_cast< ::rice::p2p::scribe::rawserialization::RawScribeContent* >(new ::rice::p2p::scribe::rawserialization::JavaSerializedScribeContent(content))); } }
void GameBuySystem::showBuyTips( BuyType type ) { auto widget = CommonWidget::create(); if ( BuyType_Gem == type ) widget->setContent( "宝石不足" ); else if ( BuyType_Gold == type ) widget->setContent( "金币不足" ); Director::getInstance()->getRunningScene()->addChild( widget ); }
/** * Create the application window * * @param argc - number of arguments passed into main() * @param argv[] - the arguments passed into main() * @param config - the application configuration settings */ AppWindow::AppWindow(int argc, char *argv[], ConfigContainer config) { menuBar = NULL; statusBar = NULL; gtk_set_locale(); std::cout << "locale set" << std::endl; gtk_init(&argc, &argv); std::cout << "gtk init() called" << std::endl; window = GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL)); windowContainer = gtk_vbox_new(false, 0); // Set up the global keyboard accelerator interface accelGroup = gtk_accel_group_new(); // Set up the window setConfig(config); Geometry geom = config.getWindowGeom(); gtk_window_move(window, geom.getLeft(), geom.getTop()); posEventFirstPass = true; gtk_window_set_default_size(window, geom.getWidth(), geom.getHeight()); setTitle(config.getAppTitle()); string iconPath = config.getAppIcon(); if (fs::is_regular(fs::path(iconPath))) { // Set the icon, if it exists setIcon(iconPath); } else { cout << "could not load icon, file does not exist: " << iconPath << endl; } // Attach the menu bar if (config.hasMenuBar() == true) { menuBar = new MenuBar(config.getMenuBar(), &gecko, accelGroup); setContent(menuBar->getMenuWidget(), false); } // Attach the Gecko engine gecko.init(config); setContent(gecko.getFrame(), true); // Attach the status bar if (config.hasStatusBar() == true) { statusBar = new StatusBar(); setContent(statusBar->getWidget(), false); gecko.attachStatusBar(statusBar); } // Set up window callback events setupCallbacks(); gtk_window_add_accel_group(window, accelGroup); }
//! [process command] void FtpReply::processCommand(int, bool err) { if (err) { setError(ContentNotFoundError, tr("Unknown command")); emit error(ContentNotFoundError); return; } switch (ftp->currentCommand()) { case QFtp::ConnectToHost: ftp->login(); break; case QFtp::Login: ftp->list(url().path()); break; case QFtp::List: if (items.size() == 1) ftp->get(url().path()); else setListContent(); break; case QFtp::Get: setContent(); default: ; } }
void compiler::doLex() { setContent("The result of lex:\n", "inputSyn.txt"); lex->setDisabled(true); synSem->setDisabled(false); return; }
void PeerListBox::prepare() { setContent(setInnerWidget( object_ptr<PeerListContent>( this, _controller.get(), st::peerListBox), st::boxLayerScroll)); content()->resizeToWidth(st::boxWideWidth); _controller->setDelegate(this); setDimensions(st::boxWideWidth, st::boxMaxListHeight); if (_select) { _select->finishAnimating(); Ui::SendPendingMoveResizeEvents(_select); _scrollBottomFixed = true; onScrollToY(0); } content()->scrollToRequests( ) | rpl::start_with_next([this](Ui::ScrollToRequest request) { onScrollToY(request.ymin, request.ymax); }, lifetime()); if (_init) { _init(this); } }
ModifyFullNamePage::ModifyFullNamePage(User *u, QWidget *parent) : ContentWidget(parent), m_user(u) { m_fullnameWidget = new LineEditWidget; m_fullnameWidget->setTitle(tr("Fullname:")); m_fullnameWidget->textEdit()->setText(m_user->fullname()); QPushButton *confirmBtn = new QPushButton; confirmBtn->setText(tr("OK")); SettingsGroup *grp = new SettingsGroup; grp->appendItem(m_fullnameWidget); QVBoxLayout *centralLayout = new QVBoxLayout; centralLayout->addWidget(grp); centralLayout->addWidget(confirmBtn); centralLayout->setSpacing(10); centralLayout->setContentsMargins(0, 10, 0, 0); QWidget *centralWidget = new TranslucentFrame; centralWidget->setLayout(centralLayout); setContent(centralWidget); setTitle(tr("Fullname Settings")); connect(m_user, &User::fullnameChanged, this, &ModifyFullNamePage::onFullnameChanged); connect(confirmBtn, &QPushButton::clicked, this, [=] { emit requestSetFullname(m_user, m_fullnameWidget->textEdit()->text()); }); }
void icnVideoChunkingServer::OnInterest(std::shared_ptr<const ndn::Interest> interest) { // ndn::App::OnInterest(interest); // forward call to perform app-level tracing // // do nothing else (hijack interest) // NS_LOG_DEBUG("Do nothing for incoming interest for" << interest->getName()); ndn::App::OnInterest(interest); // std::cout << "Producer received interest " << interest->getName() << std::endl; // Note that Interests send out by the app will not be sent back to the app ! auto data = std::make_shared<ndn::Data>(interest->getName()); data->setFreshnessPeriod(ndn::time::seconds(1000)); this->total_bytes_served += 1000; data->setContent(std::make_shared< ::ndn::Buffer>(this->chunk_size)); ndn::StackHelper::getKeyChain().sign(*data); // Call trace (for logging purposes) m_transmittedDatas(data, this, m_face); m_face->onReceiveData(*data); // Call trace (for logging purposes) // printf("OnInterest\n"); }
void ExtraCompiler::onTargetsBuilt(Project *project) { if (project != d->project || BuildManager::isBuilding(project)) return; // This is mostly a fall back for the cases when the generator couldn't be run. // It pays special attention to the case where a source file was newly created const QDateTime sourceTime = d->source.toFileInfo().lastModified(); if (d->compileTime.isValid() && d->compileTime >= sourceTime) return; foreach (const Utils::FileName &target, d->targets) { QFileInfo fi(target.toFileInfo()); QDateTime generateTime = fi.exists() ? fi.lastModified() : QDateTime(); if (generateTime.isValid() && (generateTime > sourceTime)) { if (d->compileTime >= generateTime) continue; QFile file(target.toString()); if (file.open(QFile::ReadOnly | QFile::Text)) { QTextStream stream(&file); d->compileTime = generateTime; setContent(target, stream.readAll()); } } } }
HtmlInfoView::HtmlInfoView(QWidget * parent) : QScrollArea(parent) { this->setWidgetResizable(true); this->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); m_lastTitleItemBase = NULL; m_lastTagsModelPart = NULL; m_lastConnectorItem = NULL; m_lastIconItemBase = NULL; m_lastPropsModelPart = NULL; m_lastPropsItemBase = NULL; m_tinyMode = false; m_partTitle = NULL; m_partUrl = NULL; m_partVersion = NULL; m_lockCheckbox = NULL; m_stickyCheckbox = NULL; m_connDescr = NULL; m_tagsTextLabel = NULL; m_lastSwappingEnabled = false; m_lastItemBase = NULL; m_setContentTimer.setSingleShot(true); m_setContentTimer.setInterval(10); connect(&m_setContentTimer, SIGNAL(timeout()), this, SLOT(setContent())); m_currentItem = NULL; m_currentSwappingEnabled = false; m_layerWidget = NULL; }
void SE_PropertySet::setChar(const char* name, char c) { _Property p; p.type = CHAR; p.prop.c = c; setContent(name, p); }
void UITool::showMessageBox(const char* title, const char* content) { auto gui = GUIMessageBox::createGUI(); gui->setTitle(title); gui->setContent(content); SceneMan::getInstance()->getCrrentScene()->addChild(gui); }
LuaConsole::LuaConsole(UserInterface *ui, Container* parent) : BasicDialog(parent, ButtonFlags::ROLL_UPDOWN | ButtonFlags::CLOSE) , m_ui(ui) { setTitleText("Lua-Console"); setButtonText(""); CellStrip *panel = new CellStrip(this, Orientation::VERTICAL, 2); setContent(panel); Anchors inputAnchors(Anchor(AnchorType::RIGID, 2)); m_inputBox = new LuaInputBox(this, panel); m_inputBox->setCell(0); m_inputBox->setAnchors(inputAnchors); m_inputBox->setText(""); m_inputBox->setAlignment(Alignment::FLUSH_LEFT); m_inputBox->setTextPos(Vec2i(3, 3)); m_inputBox->InputEntered.connect(this, &LuaConsole::onLineEntered); int h = int(m_inputBox->getFont()->getMetrics()->getHeight()) * 2; panel->setSizeHint(0, SizeHint(-1, h)); Anchors outputAnchors(Anchor(AnchorType::RIGID, 0)); m_outputBox = new CodeBox(panel); m_outputBox->setCell(1); m_outputBox->setAnchors(outputAnchors); m_outputBox->setText(""); m_outputBox->setAlignment(Alignment::NONE); }
bool XMLMetadata::initFromRaw(const unsigned char *raw, size_t len) { char *_name = initDoc((const char *)raw, len); if (!_name) { fprintf(stderr, "Could not create document\n"); if (doc) xmlFreeDoc(doc); doc = NULL; return false; } if (!parseXML(xmlDocGetRootElement(doc))) { fprintf(stderr, "Parse XML failed\n"); xmlFreeDoc(doc); doc = NULL; return false; } name = _name; xmlChar *content = xmlNodeGetContent(xmlDocGetRootElement(doc)); if (content) { setContent((char *)content); xmlFree(content); } xmlFreeDoc(doc); doc = NULL; return true; }
void Trie::addWord(string& word) { std::transform(word.begin(), word.end(), word.begin(), ::tolower); auto current = m_root; if ( word.length() == 0 ) { current->setWordMarker(); // an empty word return; } for ( size_t i = 0; i < word.length(); i++ ) { auto child = current->findChild(word[i]); if (child) { current = child; } else { auto tmp = new Node(); tmp->setContent(word[i]); current->appendChild(tmp); current = tmp; } if ( i == word.length() - 1 ) current->setWordMarker(); } }
void QPlaceContentReplyImpl::replyFinished() { if (m_reply->isOpen()) { QJsonDocument document = QJsonDocument::fromJson(m_reply->readAll()); if (!document.isObject()) { setError(ParseError, QCoreApplication::translate(NOKIA_PLUGIN_CONTEXT_NAME, PARSE_ERROR)); return; } QJsonObject object = document.object(); QPlaceContent::Collection collection; int totalCount; QPlaceContentRequest previous; QPlaceContentRequest next; parseCollection(request().contentType(), object, &collection, &totalCount, &previous, &next, m_engine); setTotalCount(totalCount); setContent(collection); setPreviousPageRequest(previous); setNextPageRequest(next); } m_reply->deleteLater(); m_reply = 0; setFinished(true); emit finished(); }
void SE_PropertySet::setData(const char* name, SE_Data* data) { _Property p; p.type = DATA; p.prop.data = data; setContent(name, p); }
DetailPage::DetailPage(const Adapter *adapter, const Device *device) : ContentWidget(), m_adapter(adapter), m_device(device), m_ignoreButton(new QPushButton(tr("Ignore"))), m_disconnectButton(new QPushButton(tr("Disconnect"))) { setTitle(device->name()); dcc::widgets::TranslucentFrame *frame = new dcc::widgets::TranslucentFrame; QVBoxLayout *layout = new QVBoxLayout(frame); layout->setSpacing(0); layout->setMargin(0); layout->addSpacing(10); layout->addWidget(m_disconnectButton); layout->addSpacing(10); layout->addWidget(m_ignoreButton); setContent(frame); device->state() == Device::StateConnected ? m_disconnectButton->show() : m_disconnectButton->hide(); connect(m_ignoreButton, &QPushButton::clicked, [this] { emit requestIgnoreDevice(m_adapter, m_device); emit back(); }); connect(m_disconnectButton, &QPushButton::clicked, [this] { emit requestDisconnectDevice(m_device); emit back(); }); }
ScrollArea::~ScrollArea() { if (gui) gui->removeDragged(this); // Garbage collection delete getContent(); instances--; if (instances == 0) { Theme::unloadRect(background); Theme::unloadRect(vMarker); Theme::unloadRect(vMarkerHi); Theme::unloadRect(vBackground); Theme::unloadRect(hBackground); for (int i = 0; i < 2; i ++) { for (int f = UP; f < BUTTONS_DIR; f ++) { if (buttons[f][i]) buttons[f][i]->decRef(); } } } delete2(mVertexes); delete2(mVertexes2); setContent(nullptr); }
void Producer::populateSegments(std::ifstream& ifs) { BOOST_ASSERT(m_segments.size() == 0); // calculate how many segments are needed std::streampos begin, end; begin = ifs.tellg(); ifs.seekg(0, std::ios::end); end = ifs.tellg(); int num_segments = (end-begin) / m_maxSegmentSize; if ((end-begin) % m_maxSegmentSize != 0) num_segments++; std::cout << "Size of the file: " << (end-begin) << " bytes." << std::endl; std::cout << "Maximum size of a segment: " << m_maxSegmentSize << " bytes." << std::endl; std::cout << "Number of segments: " << num_segments << std::endl; std::vector<uint8_t> buffer(m_maxSegmentSize); ifs.seekg(0, std::ios::beg); for (int i = 0; i < (end-begin) / m_maxSegmentSize; ++i) { ifs.read(reinterpret_cast<char*>(buffer.data()), m_maxSegmentSize); std::string seg_str = "/segment" + std::to_string(i); auto data = make_shared<Data>(Name(m_prefix.toUri()+seg_str).appendSegment(i)); data->setFreshnessPeriod(m_freshnessPeriod); data->setContent(&buffer[0], m_maxSegmentSize); //std::cout << *data << std::endl; m_segments.push_back(data); } if ((end-begin) % m_maxSegmentSize != 0) { ifs.read(reinterpret_cast<char*>(buffer.data()), (end-begin) % m_maxSegmentSize); std::string seg_str = "/segment" + std::to_string(m_segments.size()); auto data = make_shared<Data>(Name(m_prefix.toUri()+seg_str).appendSegment(m_segments.size())); data->setFreshnessPeriod(m_freshnessPeriod); data->setContent(&buffer[0], (end-begin) % m_maxSegmentSize); //std::cout << *data << std::endl; m_segments.push_back(data); } auto finalBlockId = name::Component::fromSegment(m_segments.size() - 1); for (const auto& data : m_segments) { data->setFinalBlockId(finalBlockId); m_keyChain.sign(*data, m_signingInfo); } }
void SE_PropertySet::setUChar(const char* name, unsigned char uc) { _Property p; p.type = UCHAR; p.prop.uc = uc; setContent(name, p); }
AppCover::AppCover(QObject* parent) : bb::cascades::SceneCover(this) { bb::cascades::QmlDocument *qml = bb::cascades::QmlDocument::create("asset:///cover.qml").parent(this); m_mainContainer = qml->createRootObject<bb::cascades::Container>(); setContent(m_mainContainer); //setText("hhhhhh"); }
void SE_PropertySet::setFloat(const char* name, float f) { _Property p; p.type = FLOAT; p.prop.f = f; setContent(name, p); }
void SE_PropertySet::setUInt(const char* name, unsigned int ui) { _Property p; p.type = UINT; p.prop.ui = ui; setContent(name, p); }
void SE_PropertySet::setInt(const char* name, int i) { _Property p; p.type = INT; p.prop.i = i; setContent(name, p); }
void Editor::openExample(const QString& example, const QString& exampleName) { if (newFile()) { setContent(example); editor->document()->setModified(false); setCurrentUrl(QUrl::fromLocalFile(exampleName)); } }
QWidget *ZStringParameter::actualCreateWidget(QWidget *parent) { QLineEdit* le = new QLineEdit(parent); le->setText(m_value); connect(le, SIGNAL(textChanged(QString)), this, SLOT(setContent(QString))); connect(this, SIGNAL(strChanged(QString)), le, SLOT(setText(QString))); return le; }
void HttpResponseData::set_success(const std::string& content_type, StreamInterface* document, uint32 scode) { this->scode = scode; message.erase(message.begin(), message.end()); setContent(content_type, document); }
PostedItem::PostedItem(FeedHolder *parent, uint32_t feedId, const RsPostedPost &post, bool isHome) :GxsFeedItem(parent, feedId, post.mMeta.mGroupId, post.mMeta.mMsgId, isHome, rsPosted, false), mPost(post) { setup(); setContent(mPost); }
bool BlockExplorer::switchTo(const QString& query) { bool IsOk; int64_t AsInt = query.toInt(&IsOk); // If query is integer, get hash from height if (IsOk && AsInt >= 0 && AsInt <= chainActive.Tip()->nHeight) { std::string hex = getexplorerBlockHash(AsInt); uint256 hash = uint256S(hex); CBlockIndex* pIndex = mapBlockIndex[hash]; if (pIndex) { setBlock(pIndex); return true; } } // If the query is not an integer, assume it is a block hash uint256 hash = uint256S(query.toUtf8().constData()); // std::map<uint256, CBlockIndex*>::iterator iter = mapBlockIndex.find(hash); BlockMap::iterator iter = mapBlockIndex.find(hash); if (iter != mapBlockIndex.end()) { setBlock(iter->second); return true; } // If the query is neither an integer nor a block hash, assume a transaction hash CTransaction tx; uint256 hashBlock = 0; if (GetTransaction(hash, tx, hashBlock, true)) { setContent(TxToString(hashBlock, tx)); return true; } // If the query is not an integer, nor a block hash, nor a transaction hash, assume an address CBitcoinAddress Address; Address.SetString(query.toUtf8().constData()); if (Address.IsValid()) { std::string Content = AddressToString(Address); if (Content.empty()) return false; setContent(Content); return true; } return false; }