Wt::WWidget* Tester::Input() { Wt::WContainerWidget* container = new Wt::WContainerWidget(); container->setStyleClass("input_container"); Wt::WText* t = new Wt::WText("Input", container); t->setStyleClass("area_title"); new Wt::WBreak(container); mInput = new Wt::WTextArea(container); mInput->setText("20131220T094700"); new Wt::WBreak(container); t = new Wt::WText("Grammar", container); t->setStyleClass("area_title"); new Wt::WBreak(container); mGrammar = new Wt::WTextArea(container); mGrammar->setRows(15); mGrammar->setText("local l = require 'lpeg'\nl.locale(l)\ngrammar = l.C(l.digit^-4)"); Wt::WPushButton* button = new Wt::WPushButton("Test Grammar", container); button->clicked().connect(this, &Tester::GrammarButton); button = new Wt::WPushButton("Benchmark Grammar", container); button->clicked().connect(this, &Tester::BenchmarkButton); button = new Wt::WPushButton("Share Grammar", container); button->clicked().connect(this, &Tester::ShareGrammar); return container; }
yearbookDownload::yearbookDownload(yearbookDB * ptr) : db(ptr), downloadFile(nullptr) { addStyleClass("well"); setContentAlignment(Wt::AlignCenter | Wt::AlignMiddle); addWidget(new Wt::WText("<p>Genereer een nieuwe versie van de PDF.</p> <p><b>Let op: </b>Bij ongeldige invoer kan de PDF onvolledig zijn.</p>")); Wt::WPushButton * button = new Wt::WPushButton("Maak PDF"); addWidget(button); button->clicked().connect(this, &yearbookDownload::generatePDF); downloadTitle = new Wt::WText("<h1>Download beschikbaar</h1>"); downloadTitle->addStyleClass("page-header"); addWidget(downloadTitle); downloadContainer = new Wt::WContainerWidget(); downloadContainer->addStyleClass("well"); downloadContainer->setContentAlignment(Wt::AlignCenter | Wt::AlignMiddle); addWidget(downloadContainer); downloadTitle->hide(); downloadContainer->hide(); downloadFile = new Wt::WFileResource(this); downloadFile->setFileName("yearbook_latex/main.pdf"); downloadFile->setMimeType("application/pdf"); downloadAnchor = new Wt::WAnchor(Wt::WLink(downloadFile), "Download"); downloadAnchor->setTarget(Wt::TargetNewWindow); downloadContainer->addWidget(downloadAnchor); }
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8/////////9/////////A Wt::WWidget * WelcomeScreen::makeRegistrationTab() { Wt::WContainerWidget *cont = new Wt::WContainerWidget(); rg_txt_ = new Wt::WText("Hier koennen Sie ihr neues Flugbuch eroeffnen.", cont); cont->addWidget(new Wt::WBreak()); cont->addWidget(new Wt::WBreak()); Wt::WTable *layout = new Wt::WTable(cont); Wt::WLabel *usernameLabel = new Wt::WLabel("Benutzername: ", layout->elementAt(0, 0)); layout->elementAt(0, 0)->resize(Wt::WLength(14, Wt::WLength::FontEx), Wt::WLength()); rg_username_ = new Wt::WLineEdit(layout->elementAt(0, 1)); usernameLabel->setBuddy(rg_username_); Wt::WLabel *passwordLabel = new Wt::WLabel("Passwort: ", layout->elementAt(1, 0)); rg_password_ = new Wt::WLineEdit(layout->elementAt(1, 1)); rg_password_->setEchoMode(Wt::WLineEdit::Password); passwordLabel->setBuddy(rg_password_); Wt::WLabel *passwordLabel2 = new Wt::WLabel("wiederholen: ", layout->elementAt(2, 0)); rg_password2_ = new Wt::WLineEdit(layout->elementAt(2, 1)); rg_password2_->setEchoMode(Wt::WLineEdit::Password); rg_password2_->enterPressed().connect(SLOT(this, WelcomeScreen::doRegister)); passwordLabel2->setBuddy(rg_password2_); Wt::WLabel *stdflareas = new Wt::WLabel("Standardfluggebiete importieren: ", layout->elementAt(3, 0)); rg_useStdLoc_ = new Wt::WCheckBox(layout->elementAt(3, 1)); stdflareas->setBuddy(rg_useStdLoc_); Wt::WPushButton *LoginButton = new Wt::WPushButton("Registrieren", layout->elementAt(4, 1)); LoginButton->clicked().connect(SLOT( this, WelcomeScreen::doRegister)); return cont; }
UserListWidget::UserListWidget(Wt::WContainerWidget* parent) : WContainerWidget(parent), nr_(0), b_(0) { m_ = new UserListModel(this); oo_ = new Wt::WCheckBox(tr("tc.user.Only_online"), this); oo_->setChecked(m_->only_online()); oo_->changed().connect(this, &UserListWidget::apply); if (tApp->user() && tApp->user()->has_permission(USER_REMOVER)) { nr_ = new Wt::WCheckBox(tr("tc.user.Not_removed"), this); nr_->setChecked(m_->not_removed()); nr_->changed().connect(this, &UserListWidget::apply); } if (tApp->user()) { b_ = new Wt::WCheckBox(tr("tc.user.My_blocklist"), this); b_->setChecked(m_->only_blocked()); b_->changed().connect(this, &UserListWidget::apply); } name_ = new Wt::WLineEdit(this); name_->setEmptyText(tr("tc.common.Name")); name_->enterPressed().connect(this, &UserListWidget::apply); if (!wApp->environment().ajax()) { Wt::WPushButton* b = new Wt::WPushButton(tr("tc.common.Apply"), this); b->clicked().connect(this, &UserListWidget::apply); } view_ = new UserListView(m_, this); }
Crianca::Crianca(Wt::WContainerWidget *parent): WContainerWidget(parent) { WTemplate *view = new WTemplate(WString::tr("App.nova-crianca")); WText *title = new WText("Cadastrar nova crianca:"); view->bindWidget("action", title); name = new WLineEdit("Nome: "); view->bindWidget("name", name); WText *text = new WText("Sexo: "); view->bindWidget("sex", text); selectSexo = new WButtonGroup(); WRadioButton *optionSexo = new WRadioButton("masculino"); selectSexo->addButton(optionSexo, 1); optionSexo = new WRadioButton("feminino"); selectSexo->addButton(optionSexo, 2); view->bindWidget("group", selectSexo); Wt::WPushButton *cadastrar = new Wt::WPushButton("Cadastrar"); cadastrar->clicked().connect(this, &Crianca::salvarDadosCrianca); view->bindWidget("button", cadastrar); WContainerWidget *container = new WContainerWidget(); WStackedWidget *stacked = new WStackedWidget(container); stacked->addWidget(view); }
Wt::WPushButton *createColorButton(const char *className, const Wt::WString& text) { Wt::WPushButton *button = new Wt::WPushButton(); button->setTextFormat(Wt::XHTMLText); button->setText(text); button->addStyleClass(className); return button; }
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8/////////9/////////A Wt::WWidget * WelcomeScreen::makeTestDbTab() { Wt::WContainerWidget *cont = new Wt::WContainerWidget(); td_txt_ = new Wt::WText("Hier koennen sie mit einer kleinen Test-Datenbank das Programm ausprobieren.", cont); Wt::WPushButton *LoginButton = new Wt::WPushButton("Testdatenbank laden", cont); LoginButton->clicked().connect(SLOT( this, WelcomeScreen::doTest)); return cont; }
TeamEdit::TeamEdit(const TeamPtr& team): team_(team) { dbo::Transaction t(tApp->session()); if (!can_edit_team(tApp->user(), team_)) { return; } add_record_inputs(team_.get(), this); Wt::WPushButton* save = new Wt::WPushButton(tr("tc.common.Save")); item("", "", save, save); save->clicked().connect(this, &TeamEdit::save); }
ProfileList::ProfileList(Ptr<org::esb::core::PluginContext> ctx,WContainerWidget *parent):Wt::WContainerWidget(parent),_ctx(ctx) { //Wt::WHBoxLayout *hbox = new Wt::WHBoxLayout(); //setLayout(hbox); LOGDEBUG("Height:"<<this->height().value()); Wt::WToolBar *toolBar = new Wt::WToolBar(this); Wt::WPushButton * createButton; toolBar->addButton(createButton=new Wt::WPushButton("Create")); createButton->clicked().connect(this, &ProfileList::createNewProfile); /* toolBar->addButton(new Wt::WPushButton("Stop")); toolBar->addButton(new Wt::WPushButton("Pause")); */ tableView = new Wt::WTableView(this); tableView->setModel(new ProfileTableModel(ctx->database, tableView)); //tableView->setModel(new VirtualModel(10000, 50, tableView)); tableView->setColumnResizeEnabled(true); tableView->setColumnAlignment(0, Wt::AlignCenter); tableView->setSortingEnabled(false); tableView->setHeaderAlignment(0, Wt::AlignCenter); tableView->setAlternatingRowColors(true); tableView->setRowHeight(28); tableView->setHeaderHeight(28); tableView->setSelectionMode(Wt::SingleSelection); tableView->setEditTriggers(Wt::WAbstractItemView::NoEditTrigger); //hbox->addWidget(tableView,0); //hbox->addWidget(new Wt::WText("Item 2"),1); /* * Configure column widths and matching table width */ const int WIDTH = 120; for (int i = 0; i < tableView->model()->columnCount(); ++i) tableView->setColumnWidth(i, 420); setLayoutSizeAware(true); //this->setHeight(300); //tableView->setHeight(300); tableView->resize(Wt::WLength::Auto,400); //this->addWidget(tableView); /* * 7 pixels are padding/border per column * 2 pixels are border of the entire table */ //tableView->setWidth((WIDTH + 7) * tableView->model()->columnCount() + 2); tableView->doubleClicked().connect(this,&ProfileList::doubleClicked); }
void IpList::initialize() { addWidget(new Header(tr("tc.user.IpList"))); last_used_ = new Wt::Wc::TimeDurationWidget( config::min::IP_LAST_USED, config::defaults::IP_LAST_USED, config::max::IP_LAST_USED, this); Wt::WPushButton* b = new Wt::WPushButton(tr("tc.common.Apply"), this); b->clicked().connect(this, &IpList::apply); IpListView* view = new IpListView(model_, this); }
/* **************************************************************************** * Edit Users */ EditUsers::EditUsers(Wt::Dbo::Session& aSession, const std::string& basePath) : session_(aSession), basePath_(basePath) { setStyleClass("user-editor"); setTemplateText(tr("edit-users-list")); limitEdit_ = new Wt::WLineEdit; Wt::WPushButton* goLimit = new Wt::WPushButton(tr("go-limit")); goLimit->clicked().connect(SLOT(this, EditUsers::LimitList)); bindWidget("limit-edit",limitEdit_); bindWidget("limit-button",goLimit); LimitList(); } // end EditUsers::EditUsers
AdminWidget::AdminWidget(Wt::WContainerWidget* p): Wt::WContainerWidget(p) { dbo::Transaction t(fApp->session()); Wt::WPushButton* save = new Wt::WPushButton(tr("facts.admin.Save"), this); save->clicked().connect(this, &AdminWidget::save_handler_); Wt::WPushButton* add = new Wt::WPushButton(tr("facts.admin.Add"), this); add->clicked().connect(this, &AdminWidget::add_handler_); Q query = fApp->session().find<Fact>(); FactListModel* model = new FactListModel(query, this); view_ = new FactListView(model, this); new BanWidget(this); t.commit(); }
AlunoList::AlunoList(Wt::Dbo::Session& dbSession, Wt::Dbo::ptr<SiconfModel::Disciplina> disciplina): _dbSession(dbSession), _disciplina(disciplina){ _table = new Wt::WTable(this); setTable(); Wt::WPushButton* close = new Wt::WPushButton("Voltar", this); close->setStyleClass("btn btn-primary"); close->clicked().connect(std::bind([this](){ delete this; })); }
void ProfileList::openEditDialog(db::Preset preset) { _dialog = new Wt::WDialog("Edit Preset", this); _dialog->setClosable(true); ProfileEditor * editor = new ProfileEditor(preset,_dialog->contents()); Wt::WPushButton *ok = new Wt::WPushButton("Analyze & Save", _dialog->footer()); ok->setDefault(true); ok->clicked().connect(editor, &ProfileEditor::saveProfile); Wt::WPushButton *cancel = new Wt::WPushButton("Cancel", _dialog->footer()); cancel->clicked().connect(_dialog, &Wt::WDialog::reject); editor->_presetSaved.connect(this, &ProfileList::dialogSave); _dialog->show(); }
Upload::Upload( Wt::WContainerWidget* pcw ) { //Wt::WContainerWidget *container = new Wt::WContainerWidget(); Wt::WFileUpload *fu = new Wt::WFileUpload( pcw ); fu->setFileTextSize( 10000 ); // Set the maximum file size (in KB ) fu->setProgressBar(new Wt::WProgressBar()); fu->setMargin(10, Wt::Right); // Provide a button to start uploading. Wt::WPushButton *uploadButton = new Wt::WPushButton("Send", pcw ); uploadButton->setMargin(10, Wt::Left | Wt::Right); Wt::WText *out = new Wt::WText( pcw ); // Upload when the button is clicked. uploadButton->clicked().connect(std::bind([=] () { fu->upload(); uploadButton->disable(); })); // Upload automatically when the user entered a file. fu->changed().connect(std::bind([=] () { fu->upload(); uploadButton->disable(); std::string s( "File upload is changed." ); out->setText( s ); })); // React to a succesfull upload. fu->uploaded().connect(std::bind([=] () { std::string s( "File upload is finished: " ); s += fu->clientFileName().toUTF8(); s += ","; //s += fu->fileTextSize() s += fu->spoolFileName(); //fu->stealSpooledFile() out->setText( s ); })); // React to a file upload problem. fu->fileTooLarge().connect(std::bind([=] () { out->setText("File is too large."); })); }
WeldingTypesPannel::WeldingTypesPannel() { this->setStyleClass("welding-type"); Wt::WVBoxLayout *vlayout = new Wt::WVBoxLayout(this); vlayout->setContentsMargins(5, 5, 5, 5); vlayout->addWidget(new Wt::WText(Wt::WString::tr("WeldingTypesPannel"))); Wt::WPushButton *button = new Wt::WPushButton(Wt::WString::tr("gas_check_button")); button->clicked().connect(std::bind([=] () { //canvas->clear(); })); vlayout->addWidget(button); vlayout->addWidget(new LightDiode("indication_standart_welding")); vlayout->addWidget(new LightDiode("indication_pulse_welding")); button = new Wt::WPushButton(Wt::WString::tr("welding_type_button")); button->clicked().connect(std::bind([=] () { //canvas->clear(); })); vlayout->addWidget(button); }
ForumCommentWidget::ForumCommentWidget(const CommentPtr& comment) { dbo::Transaction t(tApp->session()); if (comment->type() != Comment::FORUM_COMMENT) { return; } new Header(tr("tc.forum.Comment"), this); Wt::WText* text = new Wt::WText(forum_comment_text(comment), this); text->addStyleClass("thechess-forum-comments"); UserPtr user = comment->init(); if (user) { new Wt::WBreak(this); user_anchor(user, this); } CommentPtr post_text = comment->root(); CommentPtr post = post_text->parent(); new Wt::WBreak(this); Wt::WAnchor* a = new Wt::WAnchor(this); a->setLink(tApp->path().post()->get_link(post.id())); a->setText(tr("tc.forum.post_header") .arg(post.id()).arg(post->text_or_removed(tApp->user()))); CommentPtr parent = comment->parent(); if (parent->type() == Comment::FORUM_COMMENT) { new Wt::WBreak(this); Wt::WAnchor* g = new Wt::WAnchor(this); g->setLink(tApp->path().post_comment()->get_link(parent.id())); g->setText(tr("tc.forum.Goto_parent").arg(parent.id())); } if (comment->can_edit(tApp->user())) { new Wt::WBreak(this); Wt::WAnchor* e = new Wt::WAnchor(this); e->setLink(tApp->path().forum_edit()->get_link(comment.id())); e->setText(tr("tc.forum.Edit")); } Wt::WTextEdit* edit = new Wt::WTextEdit(this); patch_text_edit(edit); new Wt::WBreak(this); if (Comment::can_create(tApp->user(), Comment::FORUM_COMMENT, comment)) { Wt::WPushButton* add = new Wt::WPushButton(tr("tc.comment.Add"), this); add->clicked().connect(boost::bind(add_comment, comment, edit, this)); } add_remover_buttons(comment, this); }
TableView::TableView(const Wt::WEnvironment& env, Table *t) : Wt::WApplication(env), table(t) { setTitle("Push Test"); setCssTheme(""); useStyleSheet("data/style.css"); enableUpdates(true); messageResourceBundle().use(appRoot() + "i18n"); table->connect(this); Wt::WPushButton* button = new Wt::WPushButton("Increment", root()); sound = new Wt::WSound("data/click.mp3"); button->clicked().connect(this, &TableView::increment); text = new Wt::WText("Number will appear here", root()); }
ShareCreatePassword::ShareCreatePassword() { auto model = std::make_shared<ShareCreatePasswordFormModel>(); setTemplateText(tr("template-share-create-password")); addFunction("id", &WTemplate::Functions::id); addFunction("block", &WTemplate::Functions::id); // Password auto password = std::make_unique<Wt::WLineEdit>(); password->setEchoMode(Wt::EchoMode::Password); setFormWidget(ShareCreatePasswordFormModel::PasswordField, std::move(password)); // Buttons Wt::WPushButton* unlockBtn = bindNew<Wt::WPushButton>("unlock-btn", tr("msg-unlock")); unlockBtn->clicked().connect([=] { updateModel(model.get()); if (model->validate()) { FS_LOG(UI, DEBUG) << "Create password validation OK"; success().emit(); return; } FS_LOG(UI, DEBUG) << "Create password validation failed"; // Mitigate brute force attemps sleep(1); updateView(model.get()); }); updateView(model.get()); }
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8/////////9/////////A Wt::WWidget * WelcomeScreen::makeNormalLoginTab() { Wt::WContainerWidget *cont = new Wt::WContainerWidget(); nl_txt_ = new Wt::WText("Hier koennen Sie ihr bestehendes Flugbuch aufrufen.", cont); cont->addWidget(new Wt::WBreak()); cont->addWidget(new Wt::WBreak()); Wt::WTable *layout = new Wt::WTable(cont); Wt::WLabel *usernameLabel = new Wt::WLabel("Benutzername: ", layout->elementAt(0, 0)); layout->elementAt(0, 0)->resize(Wt::WLength(14, Wt::WLength::FontEx), Wt::WLength()); nl_username_ = new Wt::WLineEdit(layout->elementAt(0, 1)); usernameLabel->setBuddy(nl_username_); Wt::WLabel *passwordLabel = new Wt::WLabel("Password: "******"Login", layout->elementAt(2, 1)); LoginButton->clicked().connect(SLOT( this, WelcomeScreen::doLogin)); return cont; }
void AdsEditor::novoAnuncio() { AdsApplication *app = AdsApplication::adsApplication(); cppdb::session &db = app->db_; Wt::WDialog dialog("novo Anuncio"); Wt::WPushButton *ok = new WPushButton("Ok"); ok->setStyleClass("btn btn-primary"); ok->clicked().connect(&dialog, &Wt::WDialog::accept); Wt::WPushButton *cancel = new WPushButton("Cancela"); cancel->setStyleClass("btn"); cancel->clicked().connect(&dialog, &Wt::WDialog::reject); WLineEdit *lTitulo = new WLineEdit(); WLineEdit *lURL = new WLineEdit(); WLineEdit *lTexto = new WLineEdit(); WTemplate *t = new WTemplate(dialog.contents()); t->setTemplateText("<form>" " <fieldset>" " <legend>Dados do anuncio</legend>" " <table border=0>" " <tr><td>Titulo</td> <td>${titulo}</td></tr>" " <tr><td>URL</td> <td>${url}</td></tr>" " <tr><td>Texto</td> <td>${texto}</td></tr>" " </table>" " </fieldset>" " ${ok}${cancel}" "</form>" , XHTMLUnsafeText); t->bindWidget("titulo", lTitulo); t->bindWidget("url", lURL); t->bindWidget("texto", lTexto); t->bindWidget("ok", ok); t->bindWidget("cancel", cancel); if (dialog.exec() == Wt::WDialog::Accepted) { db << "insert into anuncio (id, titulo, url, texto, imagem) values " "(NULL, ?,?,?, '/img/cabure.png')" << lTitulo->text().narrow() << lURL->text().narrow() << lTexto->text().narrow() << cppdb::exec; } renderUI(); }
void ShareEdit::refresh(void) { if (!wApp->internalPathMatches("/share-edit")) return; clear(); std::string editUUID = wApp->internalPathNextPart("/share-edit/"); Wt::Dbo::Transaction transaction(FsApp->getDboSession()); Database::Share::pointer share = Database::Share::getByEditUUID(FsApp->getDboSession(), editUUID); if (!share || !boost::filesystem::exists(share->getPath())) { FS_LOG(UI, ERROR) << "Edit UUID '" << editUUID << "' not found"; displayNotFound(); return; } FS_LOG(UI, INFO) << "[" << share->getDownloadUUID() << "] Editing share from " << wApp->environment().clientAddress(); Wt::WTemplate *t = addNew<Wt::WTemplate>(tr("template-share-edit")); t->addFunction("tr", &Wt::WTemplate::Functions::tr); if (!share->getDesc().empty()) { t->setCondition("if-desc", true); t->bindString("file-desc", Wt::WString::fromUTF8(share->getDesc())); } t->bindString("file-name", Wt::WString::fromUTF8(share->getFileName())); t->bindString("file-size", sizeToString(share->getFileSize())); t->bindString("expiry-date-time", share->getExpiryTime().toString() + " UTC"); auto hits = std::to_string(share->getHits()); if (share->getMaxHits() > 0) hits += " / " + std::to_string(share->getMaxHits()); t->bindString("hits", hits); t->bindWidget("download-link", createShareDownloadAnchor(share)); Wt::WPushButton* deleteBtn = t->bindNew<Wt::WPushButton>("delete-btn", tr("msg-delete")); deleteBtn->clicked().connect([=] () { auto messageBox = deleteBtn->addChild(std::make_unique<Wt::WMessageBox>(tr("msg-share-delete"), tr("msg-confirm-action"), Wt::Icon::Question, Wt::StandardButton::Yes | Wt::StandardButton::No)); messageBox->setModal(true); messageBox->buttonClicked().connect([=] (Wt::StandardButton btn) { if (btn == Wt::StandardButton::Yes) { Wt::Dbo::Transaction transaction(FsApp->getDboSession()); Database::Share::pointer share = Database::Share::getByEditUUID(FsApp->getDboSession(), editUUID); if (share) { FS_LOG(UI, INFO) << "[" << share->getDownloadUUID() << "] Deleting share from " << wApp->environment().clientAddress(); share.modify()->destroy(); share.remove(); } displayRemoved(); } deleteBtn->removeChild(messageBox); }); messageBox->show(); }); }
std::string ProfileEditor::checkJsonProfile(JSONNode&root) { std::string result; /*check the root conatins required data*/ if (!root.contains("name")) { result = "no profile name given!"; } else if (!root.contains("format")) { result = "no format attribute found!"; } else if (!root.contains("video")) { result = "no video attribute found!"; } else if (!root.contains("audio")) { result = "no audio attribute found!"; } else if (!root["format"].contains("id")) { result = "no id attribute found in attribute \"format\"!"; } else if (!root["video"].contains("id")) { result = "no id attribute found in attribute \"video\"!"; } else if (!root["audio"].contains("id")) { result = "no id attribute found in attribute \"audio\"!"; }else{ //Wt::WApplication::instance()->attachThread(true); analyzerDialog=new Wt::WDialog(this); analyzerDialog->setWidth(800); analyzerDialog->setHeight(500); progressBar=new Wt::WProgressBar(); progressBar->setMinimum(0); progressBar->setMaximum(250); fpsText=new Wt::WText("FPS"); psnrText=new Wt::WText("PSNR"); Wt::WVBoxLayout *vbox = new Wt::WVBoxLayout(); analyzerDialog->contents()->setLayout(vbox); chart=new Wt::Chart::WCartesianChart(); chart->resize(700,350); //chart->setHidden(true); vbox->addWidget(progressBar); vbox->addWidget(fpsText); vbox->addWidget(psnrText); vbox->addWidget(chart); analyzerDialog->show(); //app->enableUpdates(); LOGDEBUG("thread attached"); _verifier=new org::esb::plugin::PresetVerifier(); _verifier->progress=boost::bind(&ProfileEditor::progress, this, _1); _verifier->completed=boost::bind(&ProfileEditor::completed, this, _1); Wt::WPushButton *ok = new Wt::WPushButton("Close", analyzerDialog->footer()); ok->setDefault(true); ok->setEnabled(false); ok->clicked().connect(this, &ProfileEditor::closeAnalyzer); _selfApp=Wt::WApplication::instance(); _selfApp->enableUpdates(); a=0; go(org::esb::plugin::PresetVerifier::verify, _verifier, root, true, true); //verifier.verify(root); //analyzerDialog->reject(); //go(ProfileEditor::startAnalyzeThread, this, root, Wt::WApplication::instance()); } return result; }
void CommentsWidget::show_button_() { Wt::WPushButton* add = new Wt::WPushButton(tr("facts.comment.Add")); add->clicked().connect(this, &CommentsWidget::show_form_); bindWidget("add", add); }
// Updates all ranks void RecentMatchesContainer::update() { this->clear(); std::vector<RecentMatch> recent_matches = Spartan_->getRecentMatches(); // Create halo api with an api key (get api key from 343i api site) //HaloAPI halo_api("05cdc66c52ca4465b0b6e3c56bb87b71"); for (int i = 0; i < recent_matches.size() && i < 10; i++) { // CUSTOM CONTAINERS Wt::WContainerWidget *myContainer = new Wt::WContainerWidget(); myContainer->decorationStyle().setBorder(Wt::WBorder(Wt::WBorder::Style::Solid, Wt::WBorder::Width::Thin, Wt::WColor(0, 0, 0))); myContainer->decorationStyle().setBackgroundColor(Wt::WColor(240, 240, 240)); myContainer->setPadding(3); myContainer->setMargin(3, Wt::Bottom); std::string title_string = "<b>" + getNameFromHopper(recent_matches[i].hopper_id_) + " / </b>" + getNameFromBaseVariant(recent_matches[i].base_variant_) + "<b> / </b>" + getNameFromMap(recent_matches[i].map_id_) + ""; Wt::WText *someText = new Wt::WText(title_string, myContainer); Wt::WPushButton *myButton = new Wt::WPushButton(" + ", myContainer); myButton->setFloatSide(Wt::Right); std::string game_time = time_from_double(recent_matches[i].match_length_); Wt::WText *someMoreText = new Wt::WText(game_time, myContainer); someMoreText->setFloatSide(Wt::Right); Wt::WStackedWidget *myStack = new Wt::WStackedWidget(myContainer); Wt::WText *text1 = new Wt::WText("text1", myStack); myButton->clicked().connect(std::bind([=]() { if (myStack->currentIndex() == 0) { myButton->setText(" - "); Wt::WContainerWidget *stats_table = new Wt::WContainerWidget(myStack); Wt::WTable *table = new Wt::WTable(stats_table); table->setHeaderCount(1); table->elementAt(0, 0)->addWidget(new Wt::WText("Gamertag")); HaloAPI halo_api("05cdc66c52ca4465b0b6e3c56bb87b71"); std::vector<std::string> gamertags; std::string json_data = halo_api.getPostGameCarnageArena(recent_matches[i].match_id_); Json::Value root; // will contains the root value after parsing. Json::Reader reader; bool parsingSuccessful = reader.parse( json_data, root ); if ( !parsingSuccessful ) { // report to the user the failure and their locations in the document. std::cout << "Failed to parse configuration\n" << reader.getFormattedErrorMessages(); } const Json::Value plugins = root; for (int j = 0; j < plugins["PlayerStats"].size(); j++) { std::string tag( plugins["PlayerStats"][j]["Player"]["Gamertag"].asString() ); gamertags.push_back(tag); table->elementAt(j+1, 0)->addWidget(new Wt::WText(tag)); } table->addStyleClass("table table-condensed"); myStack->setCurrentIndex(1); } else { delete myStack->currentWidget(); myStack->setCurrentIndex(0); myButton->setText(" + "); } })); this->addWidget(myContainer); } }
EarMobileUI::EarMobileUI(const Wt::WEnvironment& env) : Wt::WApplication(env) { setTitle("Ear Mobile interface"); this->log("notice")<<"Making mobile UI"; Wt::WBootstrapTheme *theme = new Wt::WBootstrapTheme(); /// theme->setResponsive(true); theme->setVersion(Wt::WBootstrapTheme::Version3); // this->removeMetaHeader(Wt::MetaHeaderType::MetaName,"viewport"); //this->addMetaHeader("viewport", // "width=device-width, height=device-height, initial-scale=2"); // this->addMetaHeader("viewport", // "width=1024"); setTheme(theme); Wt::WTemplate *html = new Wt::WTemplate(Wt::WString( "<div width='device-width' scale='4' >" "<div>" "${start-button} ${stop-button} ${play-time}" "</div>" "<div>" "${fragment-tree}" "</div>" "</div>" ),root()); this->log("notice")<<"Making button container"; //Wt::WContainerWidget *buttonContainer = new Wt::WContainerWidget(root()); //buttonContainer->setMaximumSize(500,Wt::WLength::Auto); //Wt::WHBoxLayout *buttonBox = new Wt::WHBoxLayout(); //buttonContainer->setLayout(buttonBox); playPauseButton = new Wt::WPushButton("Play from start"); //buttonBox->addWidget(playPauseButton); playPauseButton->clicked().connect(std::bind([=] () { this->log("notice")<<"interactnig to pause"; zmq_conn::interact(std::string("event:pause")); })); html->bindWidget("start-button",playPauseButton); Wt::WPushButton *stopButton = new Wt::WPushButton("Stop"); //buttonBox->addWidget(stopButton); html->bindWidget("stop-button",stopButton); stopButton->clicked().connect(std::bind([=] () { this->log("notice")<<"interactnig to stop"; zmq_conn::interact(std::string("event:stop")); })); stopButton->setMargin(5, Wt::Left); posText = new TimeWidget(); posText->setMargin(5, Wt::Left); html->bindWidget("play-time",posText); //buttonBox->addWidget(posText); // Wt::WContainerWidget *fragmentContainer = new Wt::WContainerWidget(root()); fragmentTree = new Wt::WTreeTable(); html->bindWidget("fragment-tree",fragmentTree); // fragmentTree->addColumn("",500); // fragmentTree->resize( // Wt::WLength(100,Wt::WLength::Unit::Percentage), //Width // Wt::WLength(80,Wt::WLength::Unit::Percentage)); //Heigth /* Wt::WTimer *inputtimer = new Wt::WTimer(); inputtimer->setInterval(2500); //For some reason, this actually segfaults (on a RPi) when it fires, before calling updateInputs. Calling updateInputs from any other place works, including the other timer. I'll try and find out the cause later, now it runs inputtimer->timeout().connect(std::bind([=] () { std::cout<< "updating inputs " <<std::endl; updateInputs(); })); inputtimer->start(); */ updateInputs(); Wt::WTimer *timer = new Wt::WTimer(); timer->setInterval(100); timer->timeout().connect(std::bind([=] () { Wt::Json::Object posj ; bool playing; Wt::Json::Object playingj; zmq::socket_t *socket = zmq_conn::connect(); posj = zmq_conn::interact(std::string("pos?"),socket); playingj = zmq_conn::interact(std::string("playing?"),socket); zmq_conn::disconnect(socket); Wt::Json::Value posjv = posj.get("pos"); const long long track_time = posjv; posText->setTime(track_time); mark_current_fragment(fragmentTree,track_time); playing = playingj.get("playing"); if (playing) { playPauseButton->setText("Pause"); } else { if(track_time > 0) { playPauseButton->setText("Continue"); } else { playPauseButton->setText("Play from start"); } } updateInputs(); })); timer->start(); }
// inline constructor UserFormView() { model_ = new UserFormModel(this); setTemplateText(tr("userForm-template")); addFunction("id", &WTemplate::Functions::id); /* * First Name */ setFormWidget(UserFormModel::FirstNameField, new Wt::WLineEdit()); /* * Last Name */ setFormWidget(UserFormModel::LastNameField, new Wt::WLineEdit()); /* * Country */ Wt::WComboBox *countryCB = new Wt::WComboBox(); countryCB->setModel(model_->countryModel()); countryCB->activated().connect(std::bind([=] () { std::string code = model_->countryCode(countryCB->currentIndex()); model_->updateCityModel(code); })); setFormWidget(UserFormModel::CountryField, countryCB, [=] () { // updateViewValue() std::string code = boost::any_cast<std::string> (model_->value(UserFormModel::CountryField)); int row = model_->countryModelRow(code); countryCB->setCurrentIndex(row); }, [=] () { // updateModelValue() std::string code = model_->countryCode(countryCB->currentIndex()); model_->setValue(UserFormModel::CountryField, code); }); /* * City */ Wt::WComboBox *cityCB = new Wt::WComboBox(); cityCB->setModel(model_->cityModel()); setFormWidget(UserFormModel::CityField, cityCB); /* * Birth Date */ Wt::WLineEdit *dateEdit = new Wt::WLineEdit(); Wt::WDatePicker *birthDP = new Wt::WDatePicker(dateEdit); bindWidget("birth-dp", birthDP); setFormWidget(UserFormModel::BirthField, dateEdit, [=] () { // updateViewValue() Wt::WDate date = boost::any_cast<Wt::WDate> (model_->value(UserFormModel::BirthField)); birthDP->setDate(date); }, [=] () { // updateModelValue() Wt::WDate date = birthDP->date(); model_->setValue(UserFormModel::BirthField, date); }); /* * Children */ setFormWidget(UserFormModel::ChildrenField, new Wt::WSpinBox()); /* * Remarks */ Wt::WTextArea *remarksTA = new Wt::WTextArea(); remarksTA->setColumns(40); remarksTA->setRows(5); setFormWidget(UserFormModel::RemarksField, remarksTA); /* * Title & Buttons */ Wt::WString title = Wt::WString("Create new user"); bindString("title", title); Wt::WPushButton *button = new Wt::WPushButton("Save"); bindWidget("submit-button", button); bindString("submit-info", Wt::WString()); button->clicked().connect(this, &UserFormView::process); updateView(model_); }
RSWappSearchFilesPage::RSWappSearchFilesPage(Wt::WContainerWidget *parent,RsFiles *mfiles) : WCompositeWidget(parent),mFiles(mfiles) { setImplementation(_impl = new Wt::WContainerWidget()) ; //_treeView = new Wt::WTreeView(_impl); _tableView = new Wt::WTableView(_impl); Wt::WVBoxLayout *layout = new Wt::WVBoxLayout() ; _impl->setLayout(layout) ; search_box = new Wt::WLineEdit(_impl) ; search_box->setText("mp3") ; search_box->enterPressed().connect(this,&RSWappSearchFilesPage::searchClicked) ; //search_box->setHeight(50) ; localcb = new Wt::WCheckBox(Wt::WString("Search Local"),_impl) ; remotecb = new Wt::WCheckBox(Wt::WString("Search Remote"),_impl) ; distantcb = new Wt::WCheckBox(Wt::WString("Search Distant"),_impl) ; localcb->setChecked(false); remotecb->setChecked(true); distantcb->setChecked(true); Wt::WPushButton *btn = new Wt::WPushButton("Search!") ; btn->clicked().connect(this,&RSWappSearchFilesPage::searchClicked) ; Wt::WContainerWidget *hSearchBox = new Wt::WContainerWidget(); Wt::WHBoxLayout *hSearchLayout = new Wt::WHBoxLayout ; hSearchBox->setLayout(hSearchLayout); hSearchLayout->addWidget(search_box) ; hSearchLayout->addWidget(localcb); hSearchLayout->addWidget(distantcb); hSearchLayout->addWidget(remotecb); hSearchLayout->addWidget(btn) ; layout->addWidget(hSearchBox) ; search_box->setWidth(1000); _tableView->setAlternatingRowColors(true); _tableView->setSelectionMode(Wt::ExtendedSelection); _tableView->setDragEnabled(true); _tableView->setColumnWidth(0, 250); _tableView->setColumnWidth(1, 150); _tableView->setColumnWidth(2, 250); _tableView->setColumnWidth(3, 150); _tableView->setColumnWidth(4, 150); _tableView->setColumnWidth(5, 100); _shared_files_model = new LocalSearchFilesModel(mfiles) ; _tableView->setModel(_shared_files_model) ; _tableView->doubleClicked().connect(this,&RSWappSearchFilesPage::tableClicked) ; layout->addWidget(_tableView,1) ; _tableView->setHeight(300) ; Wt::WPushButton *dlbtn = new Wt::WPushButton("Download selected") ; dlbtn->clicked().connect(this,&RSWappSearchFilesPage::searchClicked) ; layout->addWidget(dlbtn) ; _timer = new Wt::WTimer(this) ; _timer->setInterval(5000) ; _timer->timeout().connect(this,&RSWappSearchFilesPage::refresh) ; _timer->start() ; }
void studentPasswords::create() { Wt::WPanel * panel = new Wt::WPanel(this); panel->setStyleClass("panel panel-primary"); panel->setTitle("<h3>Wachtwoorden Administratie</h3>"); panel->setMinimumSize(800, 800); panel->setMaximumSize(800, Wt::WLength::Auto); panel->setMargin("0 auto"); Wt::WContainerWidget * content = new Wt::WContainerWidget(); panel->setCentralWidget(content); content->setPadding("1%"); buttons = new Wt::WContainerWidget(content); Wt::WHBoxLayout * buttonLayout = new Wt::WHBoxLayout(); buttons->setLayout(buttonLayout); Wt::WPopupMenu * popup = new Wt::WPopupMenu(); Wt::WPushButton * button = new Wt::WPushButton(); button->setMenu(popup); button->setText("Selecteer een klas"); buttonLayout->addWidget(button); Wt::WPushButton * button2 = new Wt::WPushButton(); button2->setText("Selectie Aanpassen"); button2->setStyleClass("btn btn-success"); buttonLayout->addWidget(button2); button2->clicked().connect(this, &studentPasswords::changePasswords); Wt::WContainerWidget * tableContent = new Wt::WContainerWidget(content); table = new Wt::WTable(tableContent); // add classes Wt::WPopupMenu * subMenu[7]; for(int i = 0; i < 7; i++) { subMenu[i] = new Wt::WPopupMenu(); if(i == 0) { popup->addMenu("1ste jaar", subMenu[i]); } else { string s = string(i+1) + "de jaar"; popup->addMenu(s.wt(), subMenu[i]); } } CLASSES & classes = server->getClasses(); for(int i = 0; i < classes.elms(); i++) { string name = classes[i].cn().get(); if(name.empty()) continue; int year = -1; switch(name[0]) { case '1': year = 0; break; case '2': year = 1; break; case '3': year = 2; break; case '4': year = 3; break; case '5': year = 4; break; case '6': year = 5; break; case '7': year = 6; break; } if(year < 0) continue; subMenu[year]->addItem(name.wt())->triggered().connect(std::bind([=] () { showClass(name); })); } progress = new Wt::WProgressBar(content); progress->hide(); anchor = new Wt::WAnchor(Wt::WLink(&pfile), "Download passwords", content); anchor->setTarget(Wt::TargetNewWindow); anchor->clicked().connect(this, &studentPasswords::reset); anchor->hide(); }
// Instantiate table widgets for a RowGroup. This doesn't give a value to any of the widgets, it only creates them. void WMemoryMap::instantiateTableWidgets(RowGroup &rg, size_t tableIdx) { Wt::WCssDecorationStyle addressDecor; addressDecor.setFont(Wt::WFont(Wt::WFont::Monospace)); // This widget typically serves as a key for looking up the RowGroup corresponding to a WTable row. rg.wId = new Wt::WText; wTable_->elementAt(tableIdx+DataRow, IdentColumn)->addWidget(rg.wId); //------------- // Table data //------------- rg.wDelete = new Wt::WImage("/images/delete-24x24.png"); rg.wDelete->setToolTip("Delete this segment."); rg.wDelete->resize(Wt::WLength(1, Wt::WLength::FontEm), Wt::WLength(1, Wt::WLength::FontEm)); rg.wDelete->clicked().connect(boost::bind(&WMemoryMap::startDeleteSegment, this, rg.wId)); wTable_->elementAt(tableIdx+DataRow, DeleteColumn)->addWidget(rg.wDelete); rg.wMove = new Wt::WImage("/images/move-24x24.png"); rg.wMove->setToolTip("Move this segment to a new address."); rg.wMove->resize(Wt::WLength(1, Wt::WLength::FontEm), Wt::WLength(1, Wt::WLength::FontEm)); rg.wMove->clicked().connect(boost::bind(&WMemoryMap::startMoveSegment, this, rg.wId)); wTable_->elementAt(tableIdx+DataRow, MoveColumn)->addWidget(rg.wMove); rg.wSplit = new Wt::WImage("/images/separate-24x24.png"); rg.wSplit->setToolTip("Split this segment into two segments."); rg.wSplit->resize(Wt::WLength(1, Wt::WLength::FontEm), Wt::WLength(1, Wt::WLength::FontEm)); rg.wSplit->clicked().connect(boost::bind(&WMemoryMap::startSplitSegment, this, rg.wId)); wTable_->elementAt(tableIdx+DataRow, SplitColumn)->addWidget(rg.wSplit); rg.wMerge = new Wt::WImage("/images/join-24x24.png"); rg.wMerge->setToolTip("Merge this segment with the following one."); rg.wMerge->resize(Wt::WLength(1, Wt::WLength::FontEm), Wt::WLength(1, Wt::WLength::FontEm)); rg.wMerge->clicked().connect(boost::bind(&WMemoryMap::startMergeSegments, this, rg.wId)); wTable_->elementAt(tableIdx+DataRow, MergeColumn)->addWidget(rg.wMerge); rg.wLeastVa = new Wt::WText(StringUtility::addrToString(0)); rg.wLeastVa->setDecorationStyle(addressDecor); rg.wLeastVa->clicked().connect(boost::bind(&WMemoryMap::startHexValueEdit, this, rg.wId, LeastVaColumn)); wTable_->elementAt(tableIdx+DataRow, LeastVaColumn)->addWidget(rg.wLeastVa); rg.wGreatestVa = new Wt::WText(StringUtility::addrToString(0)); rg.wGreatestVa->setDecorationStyle(addressDecor); rg.wGreatestVa->clicked().connect(boost::bind(&WMemoryMap::startHexValueEdit, this, rg.wId, GreatestVaColumn)); wTable_->elementAt(tableIdx+DataRow, GreatestVaColumn)->addWidget(rg.wGreatestVa); rg.wSize = new Wt::WText(StringUtility::addrToString(0)); rg.wSize->setDecorationStyle(addressDecor); rg.wSize->clicked().connect(boost::bind(&WMemoryMap::startHexValueEdit, this, rg.wId, SizeColumn)); wTable_->elementAt(tableIdx+DataRow, SizeColumn)->addWidget(rg.wSize); rg.wReadable = new Wt::WCheckBox; rg.wReadable->clicked().connect(boost::bind(&WMemoryMap::toggleAccess, this, rg.wId, rg.wReadable, MemoryMap::READABLE)); wTable_->elementAt(tableIdx+DataRow, ReadableColumn)->addWidget(rg.wReadable); rg.wWritable = new Wt::WCheckBox; rg.wWritable->clicked().connect(boost::bind(&WMemoryMap::toggleAccess, this, rg.wId, rg.wWritable, MemoryMap::WRITABLE)); wTable_->elementAt(tableIdx+DataRow, WritableColumn)->addWidget(rg.wWritable); rg.wExecutable = new Wt::WCheckBox; rg.wExecutable->clicked().connect(boost::bind(&WMemoryMap::toggleAccess, this, rg.wId, rg.wExecutable, MemoryMap::EXECUTABLE)); wTable_->elementAt(tableIdx+DataRow, ExecutableColumn)->addWidget(rg.wExecutable); rg.wName = new Wt::WInPlaceEdit; rg.wName->setPlaceholderText("(no name)"); wTable_->elementAt(tableIdx+DataRow, NameColumn)->addWidget(rg.wName); //--------------- // Table editing //--------------- rg.wEditStack = new Wt::WStackedWidget; // editing a hex value rg.wHexValueEdit = new WHexValueEdit; rg.wHexValueEdit->canceled().connect(boost::bind(&WMemoryMap::cancelEdit, this, rg.wId)); rg.wHexValueEdit->saved().connect(boost::bind(&WMemoryMap::finishHexValueEdit, this, rg.wId)); rg.wEditStack->addWidget(rg.wHexValueEdit); // deleting a segment rg.wDeleteConfirm = new Wt::WContainerWidget; new Wt::WText("Delete segment? ", rg.wDeleteConfirm); Wt::WPushButton *wYes = new Wt::WPushButton("Delete", rg.wDeleteConfirm); wYes->clicked().connect(boost::bind(&WMemoryMap::finishDeleteSegment, this, rg.wId)); Wt::WPushButton *wNo = new Wt::WPushButton("Cancel", rg.wDeleteConfirm); wNo->clicked().connect(boost::bind(&WMemoryMap::cancelEdit, this, rg.wId)); rg.wEditStack->addWidget(rg.wDeleteConfirm); // moving a segment rg.wMoveSegment = new WHexValueEdit; rg.wMoveSegment->canceled().connect(boost::bind(&WMemoryMap::cancelEdit, this, rg.wId)); rg.wMoveSegment->saved().connect(boost::bind(&WMemoryMap::finishMoveSegment, this, rg.wId)); rg.wMoveSegment->changed().connect(boost::bind(&WMemoryMap::checkMoveSegment, this, rg.wId, _1)); rg.wEditStack->addWidget(rg.wMoveSegment); // merging two segments rg.wMergeConfirm = new Wt::WContainerWidget; new Wt::WText("Merge segment with following segment? ", rg.wMergeConfirm); wYes = new Wt::WPushButton("Merge", rg.wMergeConfirm); wYes->clicked().connect(boost::bind(&WMemoryMap::finishMergeSegments, this, rg.wId)); wNo = new Wt::WPushButton("Cancel", rg.wMergeConfirm); wNo->clicked().connect(boost::bind(&WMemoryMap::cancelEdit, this, rg.wId)); rg.wEditStack->addWidget(rg.wMergeConfirm); wTable_->elementAt(tableIdx+EditRow, EditColumn)->addWidget(rg.wEditStack); wTable_->elementAt(tableIdx+EditRow, EditColumn)->setColumnSpan(NColumns-EditColumn); }