本文整理汇总了C++中WAnchor类的典型用法代码示例。如果您正苦于以下问题:C++ WAnchor类的具体用法?C++ WAnchor怎么用?C++ WAnchor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WAnchor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: WAnchor
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;
}
开发者ID:arlukin,项目名称:avshop,代码行数:30,代码来源:ProductMenuItem.cpp
示例2: showArchive
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;
}
}
开发者ID:DTidd,项目名称:wt,代码行数:27,代码来源:BlogView.C
示例3: modelDataChanged
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));
}
}
开发者ID:Unss,项目名称:wt,代码行数:29,代码来源:WSuggestionPopup.C
示例4: setResizable
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));
}
}
开发者ID:GuLinux,项目名称:Pandorica,代码行数:32,代码来源:latestcommentsdialog.cpp
示例5: anchor
void WMenuItem::setLink(const WLink& link)
{
WAnchor *a = anchor();
if (a)
a->setLink(link);
customLink_ = true;
}
开发者ID:chr-thien,项目名称:wt,代码行数:8,代码来源:WMenuItem.C
示例6: bindWidget
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);
}
开发者ID:GuLinux,项目名称:wt,代码行数:12,代码来源:WNavigationBar.C
示例7: WContainerWidget
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();
}
开发者ID:geolffrey,项目名称:Pandorica,代码行数:48,代码来源:playlist.cpp
示例8: pathComponent
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());
}
}
}
开发者ID:chr-thien,项目名称:wt,代码行数:18,代码来源:WMenuItem.C
示例9: implementStateless
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);
}
}
}
}
开发者ID:chr-thien,项目名称:wt,代码行数:40,代码来源:WMenuItem.C
示例10: WAnchor
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;
}
开发者ID:NeilNienaber,项目名称:wt,代码行数:37,代码来源:WItemDelegate.C
示例11: WAnchor
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);
}
开发者ID:913862627,项目名称:wt,代码行数:24,代码来源:WMediaPlayer.C
示例12: bindString
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;
}
}
开发者ID:bryongloden,项目名称:wt,代码行数:84,代码来源:RegistrationWidget.C
示例13: clear
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);
}
开发者ID:913862627,项目名称:wt,代码行数:99,代码来源:PostView.C
示例14: createEditor
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;
}
开发者ID:NeilNienaber,项目名称:wt,代码行数:99,代码来源:WItemDelegate.C
示例15: clear
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 );
//.........这里部分代码省略.........
开发者ID:geolffrey,项目名称:Pandorica,代码行数:101,代码来源:mediainfopanel.cpp
注:本文中的WAnchor类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论