WWidget *ProductMenuItem::createItemWidget() { //<div class="collection" style="background: url(productimages/QEES_Dimmer_billed_tekst_01_thumb.jpg) no-repeat;"> WAnchor *result = new WAnchor(); WContainerWidget *collection = new WContainerWidget(result); result->mouseWentOver().connect(SLOT(this, ProductMenuItem::_mouseWentOver)); result->mouseWentOut().connect(SLOT(this, ProductMenuItem::_mouseWentOut)); collection->setStyleClass("collection"); WString imageName = _product->imageThumbName("var/www/", "resources/images/productimages/"); collection->decorationStyle().setBackgroundImage(imageName.toUTF8()); _faderInvisible = new WContainerWidget(collection); _faderInvisible->setStyleClass("fader invisible"); WContainerWidget *faderInvisible2 = new WContainerWidget(_faderInvisible); new WText(_description(), faderInvisible2); // @todo: Add this? Change picutre // <!--<div class="sale_label"></div>--> //WContainerWidget *salesLabel = new WContainerWidget(collection); //salesLabel->setStyleClass("sale_label"); // @todo: Add this? Change picutre // <!--<div class="sale_label"></div>--> //WContainerWidget *offerLabel = new WContainerWidget(collection); //offerLabel->setStyleClass("offer_label"); return result; }
void showArchive(WContainerWidget *parent) { static const char* dateFormat = "MMMM yyyy"; new WText(tr("archive-title"), parent); Posts posts = session_.find<Post>("order by date desc"); WDateTime formerDate; for (Posts::const_iterator i = posts.begin(); i != posts.end(); ++i) { if ((*i)->state != Post::Published) continue; if (formerDate.isNull() || yearMonthDiffer(formerDate, (*i)->date)) { WText *title = new WText((*i)->date.date().toString(dateFormat), parent); title->setStyleClass("archive-month-title"); } WAnchor *a = new WAnchor(WLink(WLink::InternalPath, basePath_ + (*i)->permaLink()), (*i)->title, parent); a->setInline(false); formerDate = (*i)->date; } }
void WSuggestionPopup::modelDataChanged(const WModelIndex& topLeft, const WModelIndex& bottomRight) { if (topLeft.parent().isValid()) return; if (modelColumn_ < topLeft.column() || modelColumn_ > bottomRight.column()) return; for (int i = topLeft.row(); i <= bottomRight.row(); ++i) { WContainerWidget *w = dynamic_cast<WContainerWidget *>(impl_->widget(i)); WAnchor *anchor = dynamic_cast<WAnchor *>(w->widget(0)); WText *value = dynamic_cast<WText *>(anchor->widget(0)); WModelIndex index = model_->index(i, modelColumn_); boost::any d = index.data(); value->setText(asString(d)); TextFormat format = index.flags() & ItemIsXHTMLText ? XHTMLText : PlainText; value->setTextFormat(format); boost::any d2 = model_->data(i, modelColumn_, UserRole); if (d2.empty()) d2 = d; value->setAttributeValue("sug", asString(d2)); } }
LatestCommentsDialog::LatestCommentsDialog(Session* session, MediaCollection *mediaCollection, WObject* parent): WDialog{parent} { setResizable(true); setWindowTitle(wtr("menu.latest.comments")); setClosable(true); setTransient(true); setMaximumSize(700, WLength::Auto); Dbo::Transaction t(*session); Dbo::collection<CommentPtr> latestComments = session->find<Comment>().orderBy("last_updated desc").limit(5); if(!latestComments.size()) contents()->addWidget(new WText{wtr("comments.empty")}); for(CommentPtr comment: latestComments) { WContainerWidget* commentWidget = new WContainerWidget; Media media = mediaCollection->media(comment->mediaId()); WContainerWidget *header = WW<WContainerWidget>(); header->setContentAlignment(AlignCenter); WAnchor *videoLink = WW<WAnchor>("", media.title(t)).css("link-hand label label-info comment-box-element"); header->addWidget(videoLink); Dbo::ptr<AuthInfo> authInfo = session->find<AuthInfo>().where("user_id = ?").bind(comment->user().id()); header->addWidget(WW<WText>(WString("{1} ({2})").arg(authInfo->identity("loginname")).arg(comment->lastUpdated().toString())) .css("label label-success comment-box-element")); commentWidget->addWidget(header); videoLink->clicked().connect([=](WMouseEvent){ _mediaClicked.emit(media); accept(); }); commentWidget->addWidget(WW<WText>(WString::fromUTF8(comment->content())).css("well comment-text comment-box-element").setInline(false)); contents()->addWidget(WW<WContainerWidget>().css("comment-text").add(commentWidget)); } }
void WMenuItem::setLink(const WLink& link) { WAnchor *a = anchor(); if (a) a->setLink(link); customLink_ = true; }
void WMenuItem::setItemPadding(bool padding) { if (!checkBox_ && !icon_) { WAnchor *a = anchor(); if (a) a->toggleStyleClass("Wt-padded", padding); } }
WLink WMenuItem::link() const { WAnchor *a = anchor(); if (a) return a->link(); else return std::string(); }
void WNavigationBar::setTitle(const WString& title, const WLink& link) { WAnchor *titleLink = resolve<WAnchor *>("title-link"); if (!titleLink) { bindWidget("title-link", titleLink = new WAnchor()); wApp->theme()->apply(this, titleLink, NavBrandRole); } titleLink->setText(title); titleLink->setLink(link); }
QueueItem::QueueItem(Media media, std::list< QueueItem* >& queue, WContainerWidget* container, Session* session, WContainerWidget* parent) : WContainerWidget(parent), PlaylistItem(media) { QueueItem *queueItem = this; Dbo::Transaction t(*session); WAnchor *anchor = new WAnchor{this}; anchor->addWidget(WW<WText>(media.title(t)).css("link-hand").onClick([=](WMouseEvent&){ playSignal.emit(this); })); WContainerWidget *actionsContainer = WW<WContainerWidget>(anchor).css("pull-right"); auto fixButtons = [=,&queue] { for(QueueItem *item: queue) { item->upButton->setHidden(item == queue.front()); item->downButton->setHidden(item == queue.back()); } }; auto moveElement = [=,&queue](int direction) { auto element = std::find(begin(queue), end(queue), queueItem); auto nextElement = element; direction>0 ? nextElement++ : nextElement--; swap(*nextElement, *element); int index = container->indexOf(queueItem); container->removeWidget(queueItem); container->insertWidget(index + direction, queueItem); fixButtons(); }; actionsContainer->addWidget(upButton = WW<WImage>(Settings::staticPath("/icons/actions/up.png")) .css("link-hand").onClick([=,&queue](WMouseEvent){ if(queue.front() == queueItem) return; moveElement(-1); })); actionsContainer->addWidget(downButton = WW<WImage>(Settings::staticPath("/icons/actions/down.png")) .css("link-hand").onClick([=,&queue](WMouseEvent){ if(queue.back() == queueItem) return; moveElement(+1); })); actionsContainer->addWidget(removeButton = WW<WImage>(Settings::staticPath("/icons/actions/delete.png")) .css("link-hand").onClick([=,&queue](WMouseEvent){ queue.erase(std::remove(begin(queue), end(queue), queueItem)); delete queueItem; fixButtons(); })); upButton->setHiddenKeepsGeometry(true); downButton->setHiddenKeepsGeometry(true); container->addWidget(this); queue.push_back(this); fixButtons(); }
void WMenuItem::setIcon(const std::string& path) { if (!icon_) { WAnchor *a = anchor(); if (!a) return; icon_ = new WText(" "); a->insertWidget(0, icon_); WApplication *app = WApplication::instance(); app->theme()->apply(this, icon_, MenuItemIconRole); } icon_->decorationStyle().setBackgroundImage(WLink(path)); }
void WMenuItem::updateInternalPath() { if (menu_ && menu_->internalPathEnabled() && internalPathEnabled()) { std::string internalPath = menu_->internalBasePath() + pathComponent(); WLink link(WLink::InternalPath, internalPath); WAnchor *a = anchor(); if (a) a->setLink(link); } else { WAnchor *a = anchor(); if (a && !customLink_) { if (WApplication::instance()->environment().agent() == WEnvironment::IE6) a->setLink(WLink("#")); else a->setLink(WLink()); } } }
void WMenuItem::connectSignals() { if (!signalsConnected_) { signalsConnected_ = true; if (!contents_ || contentsLoaded()) implementStateless(&WMenuItem::selectVisual, &WMenuItem::undoSelectVisual); WAnchor *a = anchor(); if (a) { SignalBase *as; bool selectFromCheckbox = false; if (checkBox_ && !checkBox_->clicked().propagationPrevented()) { as = &checkBox_->changed(); /* * Because the checkbox is not a properly exposed form object, * we need to relay its value ourselves */ checkBox_->checked().connect(this, &WMenuItem::setCheckBox); checkBox_->unChecked().connect(this, &WMenuItem::setUnCheckBox); selectFromCheckbox = true; } else as = &a->clicked(); if (checkBox_) a->setLink(WLink()); if (contentsContainer_ && contentsContainer_->count() == 0) as->connect(this, &WMenuItem::selectNotLoaded); else { as->connect(this, &WMenuItem::selectVisual); if (!selectFromCheckbox) as->connect(this, &WMenuItem::select); } } } }
WAnchor *WItemDelegate::anchorWidget(WidgetRef& w) { WAnchor *anchor = dynamic_cast<WAnchor *>(w.w->find("a")); if (anchor) return anchor; anchor = new WAnchor(); anchor->setObjectName("a"); WContainerWidget *wc = dynamic_cast<WContainerWidget *>(w.w->find("o")); if (wc) { /* * Convert (2) -> (4) */ int firstToMove = 0; WCheckBox *cb = dynamic_cast<WCheckBox *>(wc->widget(0)); if (cb) firstToMove = 1; wc->insertWidget(firstToMove, anchor); while (wc->count() > firstToMove + 1) { WWidget *c = wc->widget(firstToMove + 1); wc->removeWidget(c); anchor->addWidget(c); } } else { /* * Convert (1) -> (3) */ anchor->addWidget(w.w); w.w = anchor; } return anchor; }
void WMediaPlayer::addAnchor(WTemplate *t, ButtonControlId id, const char *bindId, const std::string& styleClass, const std::string& altText) { std::string text; if (altText.empty()) text = styleClass.substr(3).c_str(); else text = altText; text = "Wt.WMediaPlayer." + text; WAnchor *anchor = new WAnchor(WLink("javascript:;"), WString::tr(text)); anchor->setStyleClass(styleClass); anchor->setAttributeValue("tabindex", "1"); anchor->setToolTip(WString::tr(text)); anchor->setInline(false); t->bindWidget(bindId, anchor); setButton(id, anchor); }
void RegistrationWidget::update() { if (model_->passwordAuth()) bindString("password-description", tr("Wt.Auth.password-registration")); else bindEmpty("password-description"); updateView(model_); if (!created_) { WLineEdit *password = resolve<WLineEdit *> (RegistrationModel::ChoosePasswordField); WLineEdit *password2 = resolve<WLineEdit *> (RegistrationModel::RepeatPasswordField); WText *password2Info = resolve<WText *> (RegistrationModel::RepeatPasswordField + std::string("-info")); if (password && password2 && password2Info) model_->validatePasswordsMatchJS(password, password2, password2Info); } WAnchor *isYou = resolve<WAnchor *>("confirm-is-you"); if (!isYou) { isYou = new WAnchor(std::string("#"), tr("Wt.Auth.confirm-is-you")); isYou->hide(); bindWidget("confirm-is-you", isYou); } if (model_->isConfirmUserButtonVisible()) { if (!isYou->clicked().isConnected()) isYou->clicked().connect(this, &RegistrationWidget::confirmIsYou); isYou->show(); } else isYou->hide(); if (model_->isFederatedLoginVisible()) { if (!conditionValue("if:oauth")) { setCondition("if:oauth", true); if (model_->passwordAuth()) bindString("oauth-description", tr("Wt.Auth.or-oauth-registration")); else bindString("oauth-description", tr("Wt.Auth.oauth-registration")); WContainerWidget *icons = new WContainerWidget(); icons->addStyleClass("Wt-field"); for (unsigned i = 0; i < model_->oAuth().size(); ++i) { const OAuthService *service = model_->oAuth()[i]; WImage *w = new WImage("css/oauth-" + service->name() + ".png", icons); w->setToolTip(service->description()); w->setStyleClass("Wt-auth-icon"); w->setVerticalAlignment(AlignMiddle); OAuthProcess *const process = service->createProcess(service->authenticationScope()); w->clicked().connect(process, &OAuthProcess::startAuthenticate); process->authenticated().connect (boost::bind(&RegistrationWidget::oAuthDone, this, process, _1)); WObject::addChild(process); } bindWidget("icons", icons); } } else { setCondition("if:oauth", false); bindEmpty("icons"); } if (!created_) { WPushButton *okButton = new WPushButton(tr("Wt.Auth.register")); WPushButton *cancelButton = new WPushButton(tr("Wt.WMessageBox.Cancel")); bindWidget("ok-button", okButton); bindWidget("cancel-button", cancelButton); okButton->clicked().connect(this, &RegistrationWidget::doRegister); cancelButton->clicked().connect(this, &RegistrationWidget::close); created_ = true; } }
void PostView::render(RenderType type) { if (type != Edit) viewType_ = type; clear(); switch (type) { case Detail: { setTemplateText(tr("blog-post")); commentCount_ = new WText(post_->commentCount()); CommentView *comments = new CommentView(session_, post_->rootComment()); session_.commentsChanged().connect(this, &PostView::updateCommentCount); bindWidget("comment-count", commentCount_); bindWidget("comments", comments); bindString("anchor", basePath_ + post_->permaLink()); break; } case Brief: { setTemplateText(tr("blog-post-brief")); WAnchor *titleAnchor = new WAnchor(WLink(WLink::InternalPath, basePath_ + post_->permaLink()), post_->title); bindWidget("title", titleAnchor); if (!post_->briefSrc.empty()) { WAnchor *moreAnchor = new WAnchor(WLink(WLink::InternalPath, basePath_ + post_->permaLink() + "/more"), tr("blog-read-more")); bindWidget("read-more", moreAnchor); } else { bindString("read-more", WString::Empty); } commentCount_ = new WText("(" + post_->commentCount() + ")"); WAnchor *commentsAnchor = new WAnchor(WLink(WLink::InternalPath, basePath_ + post_->permaLink() + "/comments")); commentsAnchor->addWidget(commentCount_); bindWidget("comment-count", commentsAnchor); break; } case Edit: { setTemplateText(tr("blog-post-edit")); bindWidget("title-edit", titleEdit_ = new WLineEdit(post_->title)); bindWidget("brief-edit", briefEdit_ = new WTextArea(post_->briefSrc)); bindWidget("body-edit", bodyEdit_ = new WTextArea(post_->bodySrc)); WPushButton *saveButton = new WPushButton(tr("save")); WPushButton *cancelButton = new WPushButton(tr("cancel")); bindWidget("save", saveButton); bindWidget("cancel", cancelButton); saveButton->clicked().connect(this, &PostView::saveEdit); cancelButton->clicked().connect(this, &PostView::showView); break; } } if (type == Detail || type == Brief) { if (session_.user() == post_->author) { WPushButton *publishButton; if (post_->state != Post::Published) { publishButton = new WPushButton(tr("publish")); publishButton->clicked().connect(this, &PostView::publish); } else { publishButton = new WPushButton(tr("retract")); publishButton->clicked().connect(this, &PostView::retract); } bindWidget("publish", publishButton); WPushButton *editButton = new WPushButton(tr("edit")); editButton->clicked().connect(this, &PostView::showEdit); bindWidget("edit", editButton); WPushButton *deleteButton = new WPushButton(tr("delete")); deleteButton->clicked().connect(this, &PostView::rm); bindWidget("delete", deleteButton); } else { bindString("publish", WString::Empty); bindString("edit", WString::Empty); bindString("delete", WString::Empty); } } WAnchor *postAnchor = new WAnchor(WLink(WLink::InternalPath, basePath_ + "author/" + post_->author->name.toUTF8()), post_->author->name); bindWidget("author", postAnchor); }
WWidget *WItemDelegate::update(WWidget *widget, const WModelIndex& index, WFlags<ViewItemRenderFlag> flags) { bool editing = widget && widget->find("t") == 0; if (flags & RenderEditing) { if (!editing) { widget = createEditor(index, flags); WInteractWidget *iw = dynamic_cast<WInteractWidget *>(widget); if (iw) { // Disable drag & drop and selection behaviour iw->mouseWentDown().preventPropagation(); iw->clicked().preventPropagation(); } } } else { if (editing) widget = 0; } WidgetRef widgetRef(widget); bool isNew = false; if (!(flags & RenderEditing)) { if (!widgetRef.w) { isNew = true; WText *t = new WText(); t->setObjectName("t"); if (index.isValid() && !(index.flags() & ItemIsXHTMLText)) t->setTextFormat(PlainText); t->setWordWrap(true); widgetRef.w = t; } if (!index.isValid()) return widgetRef.w; bool haveCheckBox = false; if (index.flags() & ItemIsUserCheckable) { boost::any checkedData = index.data(CheckStateRole); CheckState state = checkedData.empty() ? Unchecked : (checkedData.type() == typeid(bool) ? (boost::any_cast<bool>(checkedData) ? Checked : Unchecked) : (checkedData.type() == typeid(CheckState) ? boost::any_cast<CheckState>(checkedData) : Unchecked)); checkBox(widgetRef, index, true, index.flags() & ItemIsTristate) ->setCheckState(state); haveCheckBox = true; } else if (!isNew) delete checkBox(widgetRef, index, false); boost::any linkData = index.data(LinkRole); if (!linkData.empty()) { WLink link = boost::any_cast<WLink>(linkData); WAnchor *a = anchorWidget(widgetRef); a->setLink(link); if (link.type() == WLink::Resource) a->setTarget(TargetNewWindow); } WText *t = textWidget(widgetRef); WString label = asString(index.data(), textFormat_); if (label.empty() && haveCheckBox) label = WString::fromUTF8(" "); t->setText(label); std::string iconUrl = asString(index.data(DecorationRole)).toUTF8(); if (!iconUrl.empty()) { iconWidget(widgetRef, true)->setImageLink(WLink(iconUrl)); } else if (!isNew) delete iconWidget(widgetRef, false); } WString tooltip = asString(index.data(ToolTipRole)); if (!tooltip.empty() || !isNew) widgetRef.w->setToolTip(tooltip); WT_USTRING sc = asString(index.data(StyleClassRole)); if (flags & RenderSelected) sc += WT_USTRING::fromUTF8 (" " + WApplication::instance()->theme()->activeClass()); if (flags & RenderEditing) sc += WT_USTRING::fromUTF8(" Wt-delegate-edit"); widgetRef.w->setStyleClass(sc); if (index.flags() & ItemIsDropEnabled) widgetRef.w->setAttributeValue("drop", WString::fromUTF8("true")); else if (!widgetRef.w->attributeValue("drop").empty()) widgetRef.w->setAttributeValue("drop", WString::fromUTF8("f")); return widgetRef.w; }
void WMenuItem::setLinkTarget(AnchorTarget target) { WAnchor *a = anchor(); if (a) a->setTarget(target); }
void MediaInfoPanel::info( Media &media ) { clear(); WContainerWidget *header = WW<WContainerWidget>().setContentAlignment( AlignCenter ); Dbo::Transaction t( *d->session ); WString title = media.title( t ); header->addWidget( WW<WText>( title ).css( "media-title" ) ); Dbo::ptr<MediaAttachment> previewAttachment = media.preview( t, Media::PreviewPlayer ); if( previewAttachment ) { WLink previewLink = previewAttachment->link( previewAttachment, t, header ); WLink fullImage = previewLink; Dbo::ptr<MediaAttachment> fullImageAttachment = media.preview( t, Media::PreviewFull ); if( fullImageAttachment ) fullImage = fullImageAttachment->link( fullImageAttachment, t, header ); WAnchor *fullImageLink = new WAnchor {fullImage, WW<WImage>(previewLink, title).css("img-responsive img-rounded")}; fullImageLink->setTarget( Wt::AnchorTarget::TargetNewWindow ); header->addWidget( fullImageLink ); } else { auto iconType = ( media.mimetype().find( "video" ) == string::npos ) ? Settings::AudioFile : Settings::VideoFile; WImage *icon = new WImage { d->settings->icon( iconType ) }; header->addWidget( icon ); } auto mediaMediaInfoPanel = d->createPanel( "mediabrowser.information" ); WTable *table = new WTable( mediaMediaInfoPanel.second ); table->setWidth( WLength( 100, WLength::Percentage ) ); d->labelValueBox( "mediabrowser.filename", WString::fromUTF8(media.filename()), table ); d->labelValueBox( "mediabrowser.filesize", Utils::formatFileSize( fs::file_size( media.path() ) ), table ); MediaPropertiesPtr mediaProperties = media.properties( t ); if( mediaProperties ) { d->labelValueBox( "mediabrowser.creation_time", mediaProperties->creationTime().toString(), table ); d->labelValueBox( "mediabrowser.medialength", WTime( 0, 0, 0 ).addSecs( mediaProperties->duration() ).toString(), table ); if( media.mimetype().find( "video" ) != string::npos && mediaProperties->width() > 0 && mediaProperties->height() > 0 ) d->labelValueBox( "mediabrowser.resolution", WString( "{1}x{2}" ).arg( mediaProperties->width() ).arg( mediaProperties->height() ), table ); } Ratings rating = MediaRating::ratingFor( media, t ); if( rating.users > 0 ) { WContainerWidget *avgRatingWidget = new WContainerWidget; for( int i = 1; i <= 5; i++ ) { avgRatingWidget->addWidget( WW<WImage>( Settings::staticPath( "/icons/rating_small.png" ) ).css( rating.ratingAverage < i ? "rating-unrated" : "" ) ); } d->labelValueBox( "mediabrowser.rating", avgRatingWidget, table ); } auto actions = d->createPanel( "mediabrowser.actions" ); actions.second->addWidget( WW<WPushButton>( wtr( "mediabrowser.play" ) ).css( "btn btn-block btn-sm btn-primary" ).onClick( [ = ]( WMouseEvent ) { d->play.emit( media ); } ) ); actions.second->addWidget( WW<WPushButton>( wtr( "mediabrowser.queue" ) ).css( "btn btn-block btn-sm" ).onClick( [ = ]( WMouseEvent ) { d->queue.emit( media ); } ) ); actions.second->addWidget( WW<WPushButton>( wtr( "mediabrowser.share" ) ).css( "btn btn-block btn-sm" ).onClick( [ = ]( WMouseEvent ) { Wt::Dbo::Transaction t( *d->session ); WW<WMessageBox>(wtr( "mediabrowser.share" ), wtr( "mediabrowser.share.dialog" ) .arg( media.title( t ) ) .arg( d->settings->shareLink( media.uid() ).url() ), Wt::Information, Ok) .button(Ok, [=](WMessageBox *msgBox){ msgBox->accept(); }).get()->show(); } ) ); addWidget( WW<WPushButton>( wtr( "button.close.info" ) ).css( "btn btn-primary btn-block hidden-lg hidden-md" ) .onClick( [ = ]( WMouseEvent ) { wasResetted().emit(); } ) ); actions.second->addWidget( WW<WPushButton>( wtr( "player.downloadlink" ) ).css( "btn btn-block btn-sm btn-success" ).onClick( [ = ]( WMouseEvent ) { WDialog *downloadDialog = new WDialog(wtr("player.downloadlink")); downloadDialog->contents()->addWidget(new WText{wtr("player.downloadlink.message").arg(d->settings->linkFor( media.path() , d->session).url()), XHTMLUnsafeText}); downloadDialog->footer()->addWidget(WW<WPushButton>(wtr("button.ok")).css("btn btn-primary").onClick([=](WMouseEvent){ downloadDialog->accept(); })); downloadDialog->show(); } ) ); addWidget( WW<WPushButton>( wtr( "button.close.info" ) ).css( "btn btn-primary btn-block hidden-lg hidden-md" ) .onClick( [ = ]( WMouseEvent ) { wasResetted().emit(); } ) ); addWidget( header ); addWidget( mediaMediaInfoPanel.first ); addWidget( actions.first ); if( d->isAdmin ) { auto adminActions = d->createPanel( "mediabrowser.admin.actions" ); adminActions.first->addStyleClass( "visible-lg visible-md" ); adminActions.first->collapse(); adminActions.second->addWidget( WW<WPushButton>( wtr( "mediabrowser.admin.settitle" ) ).css( "btn btn-block btn-sm btn-primary" ).onClick( [ = ]( WMouseEvent ) { setTitle().emit( media ); } ) ); adminActions.second->addWidget( WW<WPushButton>( wtr( "mediabrowser.admin.setposter" ) ).css( "btn btn-block btn-sm btn-primary" ).onClick( [ = ]( WMouseEvent ) { setPoster().emit( media ); } ) ); adminActions.second->addWidget( WW<WPushButton>( wtr( "mediabrowser.admin.deletepreview" ) ).css( "btn btn-block btn-sm btn-danger" ).onClick( [ = ]( WMouseEvent ) { deletePoster().emit( media ); } ) ); adminActions.second->addWidget( WW<WPushButton>( wtr( "mediabrowser.admin.deleteattachments" ) ).css( "btn btn-block btn-sm btn-danger" ).onClick( [ = ]( WMouseEvent ) { deleteAttachments().emit( media ); } ) ); addWidget( adminActions.first ); } gotInfo().emit(); }