• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ wt::WPushButton类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中wt::WPushButton的典型用法代码示例。如果您正苦于以下问题:C++ WPushButton类的具体用法?C++ WPushButton怎么用?C++ WPushButton使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了WPushButton类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: Input

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;
}
开发者ID:cluo,项目名称:lpeg_tester,代码行数:32,代码来源:lpeg_tester.cpp


示例2: db

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);
}
开发者ID:yvanvds,项目名称:yATools,代码行数:28,代码来源:yearbookDownload.cpp


示例3:

/////////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;
}
开发者ID:ulrichard,项目名称:flugbuch,代码行数:36,代码来源:WelcomeScreen.cpp


示例4: WContainerWidget

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);
}
开发者ID:starius,项目名称:thechess,代码行数:25,代码来源:UserListWidget.cpp


示例5: WContainerWidget

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);
}
开发者ID:paulossm,项目名称:adoteApplication,代码行数:30,代码来源:Crianca.cpp


示例6:

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;
}
开发者ID:psychobob666,项目名称:MediaEncodingCluster,代码行数:8,代码来源:ProfileList.cpp


示例7: t

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);
}
开发者ID:starius,项目名称:thechess,代码行数:11,代码来源:TeamEdit.cpp


示例8: LOGDEBUG

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);

}
开发者ID:psychobob666,项目名称:MediaEncodingCluster,代码行数:54,代码来源:ProfileList.cpp


示例9: initialize

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);
}
开发者ID:starius,项目名称:thechess,代码行数:11,代码来源:IpList.cpp


示例10: setStyleClass

/* ****************************************************************************
 * 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
开发者ID:lyase,项目名称:install,代码行数:14,代码来源:EditUsers.cpp


示例11: t

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();
}
开发者ID:starius,项目名称:facts,代码行数:13,代码来源:AdminWidget.cpp


示例12:

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;
	}));
}
开发者ID:MichaelSantosSim,项目名称:Siconf,代码行数:13,代码来源:AlunoList.cpp


示例13: openEditDialog

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();
}
开发者ID:psychobob666,项目名称:MediaEncodingCluster,代码行数:16,代码来源:ProfileList.cpp


示例14: s

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.");
  }));
}
开发者ID:rburkholder,项目名称:nodestar,代码行数:45,代码来源:Upload.cpp


示例15: LightDiode

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);
}
开发者ID:runya-v,项目名称:sinta,代码行数:19,代码来源:WeldingTypesPannel.cpp


示例16: t

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);
}
开发者ID:starius,项目名称:thechess,代码行数:42,代码来源:ForumCommentWidget.cpp


示例17: table

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());
}
开发者ID:opatut,项目名称:playgrounds,代码行数:20,代码来源:TableView.cpp


示例18: tr

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());
}
开发者ID:epoupon,项目名称:fileshelter,代码行数:37,代码来源:ShareCreatePassword.cpp


示例19: novoAnuncio

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();
}
开发者ID:trumae,项目名称:PractWave,代码行数:42,代码来源:AdsEditor.cpp


示例20: transaction

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();
	});

}
开发者ID:epoupon,项目名称:fileshelter,代码行数:76,代码来源:ShareEdit.cpp



注:本文中的wt::WPushButton类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ wt::WString类代码示例发布时间:2022-05-31
下一篇:
C++ wt::WModelIndex类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap