示例#1
0
文件: StyleLayout.C 项目: ReWeb3D/wt
WWidget *StyleLayout::wGridLayout()
{
  WContainerWidget *result = new WContainerWidget();
  topic("WGridLayout", result);

  addText(tr("layout-WGridLayout"), result);

  WContainerWidget *container;

  container = new WContainerWidget(result);
  container->resize(WLength::Auto, 400);
  container->setStyleClass("yellow-box");
  WGridLayout *grid = new WGridLayout();
  container->setLayout(grid);

  for (int row = 0; row < 3; ++row) {
    for (int column = 0; column < 4; ++column) {
      WText *t = addText(tr("grid-item").arg(row).arg(column));
      if (row == 1 || column == 1 || column == 2)
	t->setStyleClass("blue-box");
      else
	t->setStyleClass("green-box");
      grid->addWidget(t, row, column);
    }
  }

  grid->setRowStretch(1, 1);
  grid->setColumnStretch(1, 1);
  grid->setColumnStretch(2, 1);

  return result;
}
示例#2
0
WLayoutItemImpl *WContainerWidget::createLayoutItemImpl(WLayoutItem *item)
{
#ifndef WT_NO_LAYOUT
  {
    WWidgetItem *wi = dynamic_cast<WWidgetItem *>(item);
    if (wi)
      return new StdWidgetItemImpl(wi);
  }

  {
    WBorderLayout *l = dynamic_cast<WBorderLayout *>(item);
    if (l)
      return new GridLayoutImpl(l, l->grid());
  }

  {
    WBoxLayout *l = dynamic_cast<WBoxLayout *>(item);
    if (l)
      return new GridLayoutImpl(l, l->grid());
  }

  {
    WGridLayout *l = dynamic_cast<WGridLayout *>(item);
    if (l)
      return new GridLayoutImpl(l, l->grid());
  }
#endif

  assert(false);

  return 0;
}
示例#3
0
  /*! \brief Setup the user interface.
   */
  void createUI() {
    WContainerWidget *w = root();
    w->setStyleClass("maindiv");

    /*
     * The main layout is a 3x2 grid layout.
     */
    WGridLayout *layout = new WGridLayout();
    layout->addWidget(createTitle("Folders"), 0, 0);
    layout->addWidget(createTitle("Files"), 0, 1);
    layout->addWidget(folderView(), 1, 0);
    layout->setColumnResizable(0);

    // select the first folder
    folderView_->select(folderModel_->index(0, 0, folderModel_->index(0, 0)));

    WVBoxLayout *vbox = new WVBoxLayout();
    vbox->addWidget(fileView(), 1);
    vbox->addWidget(pieChart(), 1);
    vbox->setResizable(0);

    layout->addLayout(vbox, 1, 1);

    layout->addWidget(aboutDisplay(), 2, 0, 1, 2);

    /*
     * Let row 1 and column 1 take the excess space.
     */
    layout->setRowStretch(1, 1);
    layout->setColumnStretch(1, 1);

    w->setLayout(layout);
  }
示例#4
0
///
//  Constructor
//
SubjectPage::SubjectPage(WContainerWidget *parent) :
    WContainerWidget(parent)
{
    setStyleClass("tabdiv");

    WGridLayout *layout = new WGridLayout();
    mSelectScans = new SelectScans();
    //mPipelineConfigure = new PipelineConfigure(mSelectScans->getScansToProcess(),
      //                                         mSelectScans->getCurrentPipeline());

    mStackedStage = new WStackedWidget();
    mStackedStage->addWidget(mSelectScans);
    //mStackedStage->addWidget(mPipelineConfigure);

    layout->addWidget(mStackedStage, 0, 0);

    mNextButton = new WPushButton("Next ->");
    mNextButton->setMinimumSize(WLength(65, WLength::Pixel), WLength::Auto);
    mBackButton = new WPushButton("<- Back");
    mBackButton->setMinimumSize(WLength(65, WLength::Pixel), WLength::Auto);

    mRefreshMRIBrowserButton = new WPushButton("New scan received, click to refresh MRID list.");
    mLoadingImage = new WImage("icons/ajax-loader-2.gif");

    WGridLayout *navLayout = new WGridLayout();
    navLayout->addWidget(mLoadingImage, 0, 0, Wt::AlignRight | Wt::AlignMiddle);
    navLayout->addWidget(mRefreshMRIBrowserButton, 0, 1, Wt::AlignLeft | Wt::AlignMiddle);
    navLayout->addWidget(mBackButton, 0, 3, Wt::AlignRight);
    navLayout->addWidget(mNextButton, 0, 4, Wt::AlignLeft);
    navLayout->setColumnStretch(2, 1);
    layout->addLayout(navLayout, 1, 0);

    // Let row 0 take the excess space
    layout->setRowStretch(0, 1);
    mLoadingImage->hide();
    mRefreshMRIBrowserButton->hide();


    setLayout(layout);

    mMessageBox = new WMessageBox();
    mMessageBox->buttonClicked().connect(SLOT(this, SubjectPage::handleMessageBoxFinished));
//    mSubmitJobDialog = new SubmitJobDialog("Submit Scans");
  //  mSubmitJobDialog->finished().connect(SLOT(this, SubjectPage::handleSubmitScans));

    // Signal/slot connections
    mSelectScans->getScanAdded().connect(SLOT(this, SubjectPage::scanAdded));
    mNextButton->clicked().connect(SLOT(this, SubjectPage::nextClicked));
    mBackButton->clicked().connect(SLOT(this, SubjectPage::backClicked));
//    mSelectScans->getMRIBrowser()->mriListUpdated().connect(SLOT(this, SubjectPage::mriListUpdated));
    mRefreshMRIBrowserButton->clicked().connect(SLOT(this, SubjectPage::refreshMRIList));

    resetAll();
}
示例#5
0
文件: MRIInfoBox.cpp 项目: FNNDSC/web
///
//  Constructor
//
MRIInfoBox::MRIInfoBox(WContainerWidget *parent) :
    WGroupBox(parent)
{
    setTitle("MRI Info");

    // Create the patient info box
    WGridLayout *mriInfoLayout = new WGridLayout();
    mMRIInfoTextArea = new WTextArea("");
    mMRIInfoTextArea->setStyleClass("mriinfodiv");
    mriInfoLayout->addWidget(mMRIInfoTextArea, 0, 0);
    mriInfoLayout->setRowStretch(0, -1);
    setLayout(mriInfoLayout);

    mMRIInfoTextArea->decorationStyle().font().setFamily(WFont::Monospace);

    resetAll();
}
示例#6
0
///
//  Constructor
//
PatientInfoBox::PatientInfoBox(WContainerWidget *parent) :
    WGroupBox(parent)
{
    setTitle("Patient / Scanner");

    mModel = new WStandardItemModel(this);
    mModel->insertColumns(0, 2);
    mModel->invisibleRootItem()->setRowCount(0);

    mModel->insertRows(0, NUM_ROWS);
    mModel->setData(PATIENT_ID, 0, boost::any(std::string("Patient ID")));
    mModel->setData(PATIENT_NAME, 0, boost::any(std::string("Patient Name")));
    mModel->setData(PATIENT_AGE, 0, boost::any(std::string("Patient Age")));
    mModel->setData(PATIENT_SEX, 0, boost::any(std::string("Patient Sex")));
    mModel->setData(PATIENT_BIRTHDAY, 0, boost::any(std::string("Patient Birthday")));
    mModel->setData(IMAGE_SCAN_DATE, 0, boost::any(std::string("Image Scan Date")));
    mModel->setData(SCANNER_MANUFACTURER, 0, boost::any(std::string("Scanner Manufacturer")));
    mModel->setData(SCANNER_MODEL, 0, boost::any(std::string("Scanner Model")));
    mModel->setData(SOFTWARE_VERSION, 0, boost::any(std::string("Software Version")));

    mTreeView = new WTreeView();
    mTreeView->setModel(mModel);
    mTreeView->setRootIsDecorated(false);
    mTreeView->setSelectionMode(NoSelection);
    mTreeView->setSortingEnabled(false);
    mTreeView->setAlternatingRowColors(true);
    mTreeView->setHeaderHeight(0);
    mTreeView->resize(300, WLength::Auto);
    mTreeView->setMinimumSize(300, WLength::Auto);

    // Create the patient info box
    WGridLayout *patientInfoLayout = new WGridLayout();
    patientInfoLayout->addWidget(mTreeView, 0, 0);
    setLayout(patientInfoLayout);

    resetAll();
}
示例#7
0
///
//  Constructor
//
MonitorResultsTab::MonitorResultsTab(const MRIBrowser *mriBrowser,
                                     WContainerWidget *parent) :
    WContainerWidget(parent),
    mMRIBrowser(mriBrowser)
{
    setStyleClass("tabdiv");

    mResultsBrowser = new ResultsBrowser();
    mFilePreviewBox = new FilePreviewBox();
    mFilePreviewBox->setStyleClass("verysmallgroupdiv");

    WGridLayout *layout = new WGridLayout();
    layout->addWidget(mResultsBrowser, 0, 0);
    layout->addWidget(mFilePreviewBox, 0, 1);
    layout->setColumnStretch(1, 1);

    setLayout(layout);

    // Make connections
    mResultsBrowser->resultFileSelected().connect(SLOT(this, MonitorResultsTab::resultFileChanged));

    mResultsBrowser->hide();
    mFilePreviewBox->hide();
}
示例#8
0
void RootLogin::ForgotForm()
{
    if (!m_forgotFormFlag) {
        Div *dvForgotForm = new Div(m_dvForgot, "dvForgotForm", "form");
        WGridLayout *dvForgotFormLayout = new WGridLayout();

        m_forgotEmailEdit = new WLineEdit();
        m_forgotCaptchaEdit = new WLineEdit();

        dvForgotFormLayout->addWidget(new WText(m_lang->GetString("ROOT_LOGIN_FORM_EMAIL_TEXT")),
                                      0, 0, AlignLeft | AlignMiddle);
        dvForgotFormLayout->addWidget(m_forgotEmailEdit, 0, 1);

        dvForgotFormLayout->addWidget(new WText(m_lang->GetString("ROOT_LOGIN_FORM_CAPTCHA_TEXT")),
                                      1, 0, AlignLeft | AlignMiddle);
        dvForgotFormLayout->addWidget(m_forgotCaptchaEdit, 1, 1);

        dvForgotFormLayout->setVerticalSpacing(11);
        dvForgotFormLayout->setColumnStretch(0, 100);
        dvForgotFormLayout->setColumnStretch(1, 200);
        dvForgotForm->resize(300, WLength::Auto);
        dvForgotForm->setLayout(dvForgotFormLayout);

        m_errForgotText = new WText(m_dvForgot);
        WPushButton *btnForgot = new WPushButton(m_lang->GetString("ROOT_LOGIN_FORM_RECOVER_TEXT"),
                                                 m_dvForgot);
        btnForgot->setStyleClass("formButton");

        WRegExpValidator *forgotEmailValidator = new WRegExpValidator(Base::REGEX_EMAIL);
        forgotEmailValidator->setFlags(MatchCaseInsensitive);
        forgotEmailValidator->setMandatory(true);

        m_forgotCaptchaValidator = new WIntValidator(m_captcha->Result, m_captcha->Result);
        m_forgotCaptchaValidator->setMandatory(true);

        m_forgotEmailEdit->setValidator(forgotEmailValidator);
        m_forgotCaptchaEdit->setValidator(m_forgotCaptchaValidator);

        m_forgotEmailEdit->enterPressed().connect(this, &RootLogin::ForgotOK);
        m_forgotCaptchaEdit->enterPressed().connect(this, &RootLogin::ForgotOK);
        btnForgot->clicked().connect(this, &RootLogin::ForgotOK);

        m_forgotFormFlag = true;
    } else {
        m_dvForgot->clear();
        m_forgotFormFlag = false;
    }
}
示例#9
0
///
//  Constructor
//
ClusterLoadPage::ClusterLoadPage(WContainerWidget *parent) :
    WContainerWidget(parent)
{
    setStyleClass("tabdiv");

    mTopFileTailer = new LogFileTailer(getConfigOptionsPtr()->GetTopLogFile(), false, 1000, false);
    mClusterLoadChart = new ClusterLoadChart();

    WGridLayout *gridBox = new WGridLayout();
    gridBox->addWidget(createTitle("Cluster Usage"), 0, 0, AlignRight | AlignMiddle);
    gridBox->addWidget(mClusterLoadChart, 0, 1, AlignLeft);

    WGridLayout *layout = new WGridLayout();
    layout->addLayout(gridBox, 0, 0);
    layout->addWidget(mTopFileTailer, 1, 0);

    layout->setRowStretch(1, 1);
    setLayout(layout);
}
示例#10
0
///
//  Constructor
//
MonitorPage::MonitorPage(const MRIBrowser *mriBrowser,
                         WContainerWidget *parent) :
    WContainerWidget(parent),
    mMRIBrowser(mriBrowser)
{
    setStyleClass("tabdiv");

    WGridLayout *layout = new WGridLayout();
    layout->addWidget(createTitle("Cluster Jobs"), 0, 0);

    WTabWidget *tabWidget = new WTabWidget();
    tabWidget->setStyleClass("toptabdiv");
    mMonitorLogTab = new MonitorLogTab(mriBrowser);
    mMonitorResultsTab = new MonitorResultsTab(mriBrowser);
    tabWidget->addTab(mMonitorResultsTab, "Results");
    tabWidget->addTab(mMonitorLogTab, "Logs");
    layout->addWidget(tabWidget, 1, 1);

    WVBoxLayout *clusterJobsLayout = new WVBoxLayout();
    mClusterJobBrowser = new ClusterJobBrowser();
    mPatientInfoBox = new PatientInfoBox();
    mPatientInfoBox->setStyleClass("verysmallgroupdiv");

    clusterJobsLayout->addWidget(mClusterJobBrowser);
    clusterJobsLayout->addWidget(mPatientInfoBox);

    layout->addLayout(clusterJobsLayout, 1, 0);


    // Let row 1 and column 2 take the excess space.
    layout->setRowStretch(1, 1);
    layout->setColumnStretch(1, 1);

    setLayout(layout);

    // Make connections
    mClusterJobBrowser->clusterJobSelected().connect(SLOT(this, MonitorPage::jobSelectedChanged));

    // All items in the tabbed widget need to be resized to 100% to
    // fill the contents.  This trick came from the Wt WTabWidget
    // documentation and took me a good half a day to figure out.
    mMonitorLogTab->resize(WLength(100, WLength::Percentage),
                           WLength(100, WLength::Percentage));
    mMonitorResultsTab->resize(WLength(100, WLength::Percentage),
                               WLength(100, WLength::Percentage));

}
示例#11
0
///
//  Constructor
//
SelectScans::SelectScans(WContainerWidget *parent) :
    WContainerWidget(parent)
{
    setStyleClass("tabdiv");

    WGridLayout *layout = new WGridLayout();
    layout->addWidget(createTitle("MRIDs"), 0, 0);


    mMRIBrowser = new MRIBrowser();
    mScanBrowser = new ScanBrowser();

    layout->addWidget(mMRIBrowser, 1, 0);
    layout->addWidget(mScanBrowser, 1, 1);




    /*mClusterLoadChart = new ClusterLoadChart();
    WHBoxLayout *topHBox = new WHBoxLayout();
    topHBox->addWidget(createTitle("Info"), AlignTop);
    topHBox->addStretch(2000);
    topHBox->addWidget(mClusterText = createTitle("Cluster Usage"), AlignTop);
    topHBox->addWidget(mClusterLoadChart, AlignTop);
    layout->addLayout(topHBox, 0, 1);*/


    // Let row 1 and column 2 take the excess space.
    layout->setRowStretch(0, -1);
    layout->setRowStretch(1, 1);
    layout->setColumnStretch(1, 1);

    setLayout(layout);

    // Signal/slot connections
    mMRIBrowser->mriSelected().connect(SLOT(this, SelectScans::mriChanged));
    mScanBrowser->scanAdded().connect(SLOT(this, SelectScans::scanAdded));

    resetAll();
}
示例#12
0
///
//  Constructor
//
ProjectChooser::ProjectChooser(WContainerWidget *parent) :
    WContainerWidget(parent)
{
    setStyleClass("maindiv");

    WGroupBox *mainBox = new WGroupBox("Select Existing Project");
    mainBox->setStyleClass("groupdiv");

    mProjectSelectionBox = new WSelectionBox();
    mProjectSelectionBox->setSelectionMode(SingleSelection);

    WPushButton *loadButton = new WPushButton("Load");
    mDeleteButton = new WPushButton("Delete");
    WGridLayout *buttonLayout = new WGridLayout();
    buttonLayout->addWidget(loadButton, 0, 0, AlignCenter | AlignMiddle);
    buttonLayout->addWidget(mDeleteButton, 0, 1, AlignCenter | AlignMiddle);

    WGridLayout *boxLayout = new WGridLayout();
    boxLayout->addWidget(new WText("Projects:"), 0, 0);
    boxLayout->addWidget(mProjectSelectionBox, 1, 0);
    boxLayout->addLayout(buttonLayout, 2, 0, AlignCenter);
    boxLayout->setRowStretch(0, -1);
    boxLayout->setRowStretch(1, 1);
    boxLayout->setRowStretch(2, -1);
    mainBox->setLayout(boxLayout);

    WGridLayout *layout = new WGridLayout();
    layout->addWidget(mainBox, 0, 0);
    setLayout(layout);

    loadButton->clicked().connect(SLOT(this, ProjectChooser::loadClicked));
    mProjectSelectionBox->doubleClicked().connect(SLOT(this, ProjectChooser::loadClicked));
    mDeleteButton->clicked().connect(SLOT(this, ProjectChooser::deleteClicked));
    mProjectSelectionBox->clicked().connect(SLOT(this, ProjectChooser::selectionChanged));

    // Message Box
    mMessageBox = new WMessageBox();
    mMessageBox->buttonClicked().connect(SLOT(this, ProjectChooser::handleMessageBoxFinished));


    resetAll();
}
示例#13
0
  FileEditDialog(WAbstractItemModel *model, const WModelIndex& item)
    : WDialog("Edit..."),
      model_(model),
      item_(item)
  {
    int modelRow = item_.row();

    resize(300, WLength::Auto);

    /*
     * Create the form widgets, and load them with data from the model.
     */

    // name
    nameEdit_ = new WLineEdit(asString(model_->data(modelRow, 1)));

    // type
    typeEdit_ = new WComboBox();
    typeEdit_->addItem("Document");
    typeEdit_->addItem("Spreadsheet");
    typeEdit_->addItem("Presentation");
    typeEdit_->setCurrentIndex
      (typeEdit_->findText(asString(model_->data(modelRow, 2))));

    // size
    sizeEdit_ = new WLineEdit(asString(model_->data(modelRow, 3)));
    sizeEdit_->setValidator
      (new WIntValidator(0, std::numeric_limits<int>::max(), this));

    // created
    createdPicker_ = new WDatePicker();
    createdPicker_->lineEdit()->validator()->setMandatory(true);
    createdPicker_->setFormat(FileModel::dateEditFormat);
    createdPicker_->setDate(boost::any_cast<WDate>(model_->data(modelRow, 4)));

    // modified
    modifiedPicker_ = new WDatePicker();
    modifiedPicker_->lineEdit()->validator()->setMandatory(true);
    modifiedPicker_->setFormat(FileModel::dateEditFormat);
    modifiedPicker_->setDate(boost::any_cast<WDate>(model_->data(modelRow, 5)));

    /*
     * Use a grid layout for the labels and fields
     */
    WGridLayout *layout = new WGridLayout();

    WLabel *l;
    int row = 0;

    layout->addWidget(l = new WLabel("Name:"), row, 0);
    layout->addWidget(nameEdit_, row, 1);
    l->setBuddy(nameEdit_);
    ++row;

    layout->addWidget(l = new WLabel("Type:"), row, 0);
    layout->addWidget(typeEdit_, row, 1);
    l->setBuddy(typeEdit_);
    ++row;

    layout->addWidget(l = new WLabel("Size:"), row, 0);
    layout->addWidget(sizeEdit_, row, 1);
    l->setBuddy(sizeEdit_);
    ++row;

    layout->addWidget(l = new WLabel("Created:"), row, 0);
    layout->addWidget(createdPicker_->lineEdit(), row, 1);
    layout->addWidget(createdPicker_, row, 2);
    l->setBuddy(createdPicker_->lineEdit());
    ++row;

    layout->addWidget(l = new WLabel("Modified:"), row, 0);
    layout->addWidget(modifiedPicker_->lineEdit(), row, 1);
    layout->addWidget(modifiedPicker_, row, 2);
    l->setBuddy(modifiedPicker_->lineEdit());
    ++row;

    WPushButton *b;
    WContainerWidget *buttons = new WContainerWidget();
    buttons->addWidget(b = new WPushButton("Save"));
    b->clicked().connect(this, &WDialog::accept);
    contents()->enterPressed().connect(this, &WDialog::accept);
    buttons->addWidget(b = new WPushButton("Cancel"));
    b->clicked().connect(this, &WDialog::reject);

    /*
     * Focus the form widget that corresonds to the selected item.
     */
    switch (item.column()) {
    case 2:
      typeEdit_->setFocus(); break;
    case 3:
      sizeEdit_->setFocus(); break;
    case 4:
      createdPicker_->lineEdit()->setFocus(); break;
    case 5:
      modifiedPicker_->lineEdit()->setFocus(); break;
    default:
      nameEdit_->setFocus(); break;
    }

    layout->addWidget(buttons, row, 0, 0, 3, AlignCenter);
    layout->setColumnStretch(1, 1);

    contents()->setLayout(layout);

    finished().connect(this, &FileEditDialog::handleFinish);

    show();
  }
示例#14
0
///
//  Constructor
//
ResultsPage::ResultsPage(const MRIBrowser *mriBrowser, WContainerWidget *parent) :
    mMRIBrowser(mriBrowser),
    WContainerWidget(parent)
{
    setStyleClass("tabdiv");

    mResultsTable = new ResultsTable();

    WContainerWidget *browserContainer = new WContainerWidget();
    WContainerWidget *resultsContainer = new WContainerWidget;

    WText *showText = new WText("Show Results by User:"******"<user>");
    mUserComboBox->addItem("All");

    mSearchLineEdit = new WLineEdit("");
    mSearchLineEdit->setMinimumSize(150, WLength::Auto);
    mSearchLineEdit->resize(150, WLength::Auto);

    mSearchPushButton = new WPushButton("GO");
    WPushButton *clearButton = new WPushButton("Clear");
    WPushButton *refreshButton = new WPushButton("Refresh");

    userBox->addWidget(new WText("Search:"), 0, 2, AlignRight | AlignMiddle);
    userBox->addWidget(mSearchLineEdit, 0, 3, AlignLeft| AlignMiddle);
    userBox->addWidget(mSearchPushButton, 0, 4, AlignLeft | AlignMiddle);
    userBox->addWidget(clearButton, 0, 5, AlignLeft | AlignMiddle);
    userBox->addWidget(refreshButton, 0, 6, AlignRight | AlignMiddle);
    userBox->setColumnStretch(2, 1);
    userBox->setColumnStretch(6, 1);
    userBox->setColumnStretch(7, 3);

    mPipelineArgTable = new PipelineArgTable();
    mPipelineArgTable->resize(WLength::Auto, 150);
    mPipelineArgTable->setMinimumSize(WLength::Auto,
                                      WLength(150, WLength::Pixel));
    mPipelineArgTable->setMaximumSize(WLength::Auto,
                                      WLength(150, WLength::Pixel));

    mJobStatus = new JobStatus();
    WHBoxLayout *bottomLayout = new WHBoxLayout();
    bottomLayout->addWidget(mPipelineArgTable);
    bottomLayout->addWidget(mJobStatus);



    WGridLayout *browserLayout = new WGridLayout();
    browserLayout->addLayout(userBox, 0, 0);
    browserLayout->addWidget(mResultsTable, 1, 0);
    browserLayout->addLayout(bottomLayout, 2, 0);
    browserLayout->setRowStretch(0, -1);
    browserLayout->setRowStretch(1, 1);
    browserLayout->setRowStretch(2, -1);
    browserContainer->setLayout(browserLayout);


    mBackButton = new WPushButton("<- Back");

    WTabWidget *tabWidget = new WTabWidget();
    tabWidget->setStyleClass("toptabdiv");
    mMonitorLogTab = new MonitorLogTab(mriBrowser);
    mMonitorResultsTab = new MonitorResultsTab(mriBrowser);
    tabWidget->addTab(mMonitorResultsTab, "Results");
    tabWidget->addTab(mMonitorLogTab, "Logs");

    WGridLayout *resultsLayout = new WGridLayout();
    resultsLayout->addWidget(mBackButton, 0, 0, AlignLeft | AlignMiddle);
    resultsLayout->addWidget(tabWidget, 1, 0);
    resultsLayout->setRowStretch(0, -1);
    resultsLayout->setRowStretch(1, 1);
    resultsContainer->setLayout(resultsLayout);

    mStackedWidget = new WStackedWidget();
    mStackedWidget->addWidget(browserContainer);
    mStackedWidget->addWidget(resultsContainer);

    WGridLayout *layout = new WGridLayout();
    layout->addWidget(mStackedWidget, 0, 0);
    layout->setRowStretch(0, -1);
    setLayout(layout);

    mUserComboBox->activated().connect(SLOT(this, ResultsPage::userChanged));
    mSearchPushButton->clicked().connect(SLOT(this, ResultsPage::searchPushed));
    clearButton->clicked().connect(SLOT(this, ResultsPage::clearPushed));
    mResultsTable->resultSelected().connect(SLOT(this, ResultsPage::resultSelected));
    mResultsTable->resultClicked().connect(SLOT(this, ResultsPage::resultClicked));
    mBackButton->clicked().connect(SLOT(this, ResultsPage::backPushed));
    refreshButton->clicked().connect(SLOT(this, ResultsPage::refreshClicked));

    // All items in the tabbed widget need to be resized to 100% to
    // fill the contents.  This trick came from the Wt WTabWidget
    // documentation and took me a good half a day to figure out.
    mMonitorLogTab->resize(WLength(100, WLength::Percentage),
                           WLength(100, WLength::Percentage));
    mMonitorResultsTab->resize(WLength(100, WLength::Percentage),
                               WLength(100, WLength::Percentage));
}
示例#15
0
文件: GitView.C 项目: Spencerx/wt
  /*! \brief Constructor.
   */
  GitViewApplication(const WEnvironment& env) 
    : WApplication(env)
  {
    useStyleSheet("gitview.css");
    setTitle("Git model example");

    const char *gitRepo = getenv("GITVIEW_REPOSITORY_PATH");

    WGridLayout *grid = new WGridLayout();
    grid->addWidget(new WText("Git repository path:"), 0, 0);
    grid->addWidget(repositoryEdit_ = new WLineEdit(gitRepo ? gitRepo : "")
		    , 0, 1, AlignLeft);
    grid->addWidget(repositoryError_ = new WText(), 0, 2);
    grid->addWidget(new WText("Revision:"), 1, 0);
    grid->addWidget(revisionEdit_ = new WLineEdit("master"), 1, 1, AlignLeft);
    grid->addWidget(revisionError_ = new WText(), 1, 2);

    repositoryEdit_->setTextSize(30);
    revisionEdit_->setTextSize(20);
    repositoryError_->setStyleClass("error-msg");
    revisionError_->setStyleClass("error-msg");

    repositoryEdit_->enterPressed()
      .connect(this, &GitViewApplication::loadGitModel);
    revisionEdit_->enterPressed()
      .connect(this, &GitViewApplication::loadGitModel);

    WPushButton *b = new WPushButton("Load");
    b->clicked().connect(this, &GitViewApplication::loadGitModel);
    grid->addWidget(b, 2, 0, AlignLeft);

    gitView_ = new WTreeView();
    gitView_->resize(300, WLength::Auto);
    gitView_->setSortingEnabled(false);
    gitView_->setModel(gitModel_ = new GitModel(this));
    gitView_->setSelectionMode(SingleSelection);
    gitView_->selectionChanged().connect(this, &GitViewApplication::showFile);

    sourceView_ = new SourceView(DisplayRole, 
				 GitModel::ContentsRole, 
				 GitModel::FilePathRole);
    sourceView_->setStyleClass("source-view");

    if (environment().javaScript()) {
      /*
       * We have JavaScript: We can use layout managers so everything will
       * always fit nicely in the window.
       */
      WVBoxLayout *topLayout = new WVBoxLayout();
      topLayout->addLayout(grid, 0, AlignTop | AlignLeft);

      WHBoxLayout *gitLayout = new WHBoxLayout();
      gitLayout->setLayoutHint("table-layout", "fixed");
      gitLayout->addWidget(gitView_, 0);
      gitLayout->addWidget(sourceView_, 1);
      topLayout->addLayout(gitLayout, 1);

      root()->setLayout(topLayout);
      root()->setStyleClass("maindiv");
    } else {
      /*
       * No JavaScript: let's make the best of the situation using regular
       * CSS-based layout
       */
      root()->setStyleClass("maindiv");
      WContainerWidget *top = new WContainerWidget();
      top->setLayout(grid, AlignTop | AlignLeft);
      root()->addWidget(top);
      root()->addWidget(gitView_);
      gitView_->setFloatSide(Left);
      gitView_->setMargin(6);
      root()->addWidget(sourceView_);
      sourceView_->setMargin(6);
    }
  }
示例#16
0
void PriceEditDialog::update()
{


    /// 0 id
    /// 1 group type Группа / Элемент
    /// 2 value
    /// 3 value type Процент / Цена
    /// 4 price type Динамический / Статический
    /// 5 Изменять фиксированные цены
    /// 6 Дата принятия изменений

    //resize(450, WLength::Auto);

    char number[50];
    int modelRow = m_item.row();
    m_id            = boost::any_cast<std::string>(m_model->data(modelRow, 0,UserRole));
    //double price    = boost::any_cast<double>(m_model->data(modelRow, 2,UserRole));
    double value    = boost::any_cast<double>(m_model->data(modelRow, 2,UserRole));
    int valueType   = boost::any_cast<int>(m_model->data(modelRow, 3,UserRole));
    int button      = boost::any_cast<int>(m_model->data(modelRow, 4,UserRole));
    WDate chDate    = boost::any_cast<WDate>(m_model->data(modelRow,6,UserRole));
    int roundIndex  = boost::any_cast<int>(m_model->data(modelRow,7,UserRole));

    log("info")<<asString(m_model->data(modelRow, 5,UserRole))<<"  "<<__LINE__;
    //log("info")<<asString(m_model->data(modelRow, 5,UserRole))<<"  "<<__LINE__;

    std::string parent = boost::any_cast<std::string>(m_model->data(modelRow, 5,UserRole));
    int modifyStatic = 0;

    setWindowTitle(asString(m_model->data(modelRow, 3)));
    WGroupBox *container = new Wt::WGroupBox(WString("Вид расчета цены",UTF8));
    //container->setHeight(65);
    m_chbPercentEnabled = new WCheckBox();
    m_chbCostEnabled  = new WCheckBox();
    m_chbModifyStatic  = new WCheckBox(WString("Изменять статические цены ?:",UTF8));
    m_rbGroup = new WButtonGroup(this);
    m_rbDynamicCalc = new WRadioButton(WString("Динамически:",UTF8),container);
    new WBreak(container);
    m_rbStaticCalc = new WRadioButton(WString("Статически",UTF8),container);

    //boost::any d = m_model->data(modelRow, 2,UserRole);
    //int v = boost::lexical_cast<int>(d);
    m_rbGroup->addButton(m_rbDynamicCalc,Dynamic);
    m_rbGroup->addButton(m_rbStaticCalc,Static);

    if(button == 1)
        m_rbGroup->setCheckedButton(m_rbGroup->button(1));
    else
        m_rbGroup->setCheckedButton(m_rbGroup->button(2));

    m_rbGroup->checkedChanged().connect(this,&PriceEditDialog::onCalcTypeChanged);
    m_chbModifyStatic->setChecked(modifyStatic);

    /// Прицент / Цена

    m_leCost = new WLineEdit("0.00");
    m_lePercent = new WLineEdit("0.00");

    if(valueType == 2)
    {
        sprintf(number,"%.2f",value);
        m_chbPercentEnabled->setChecked();
        m_lePercent->setText(number);
    }
    else if(valueType == 1)
    {
        sprintf(number,"%.2f",value);
        m_chbCostEnabled->setChecked();
        m_leCost->setText(number);

    }

    m_lePercent->setValidator(new WRegExpValidator("[0-9]+\\.[0-9]{2}"));
    m_leCost->setValidator(new WRegExpValidator("[0-9]+\\.[0-9]{2}"));


    // created
    m_dpModified = new WDatePicker();
    m_dpModified->lineEdit()->validator()->setMandatory(true);
    m_dpModified->setFormat(FileModel::dateEditFormat);
    m_dpModified->setDate(chDate);
    m_dpModified->setGlobalPopup (true);
    //WDate d = WDate::fromString(item->text(), FileModel::dateEditFormat);
    //item->setData(boost::any(d), DisplayRole);


    /*
         * Use a grid layout for the labels and fields
         */
    WGridLayout *layout = new WGridLayout();

    WLabel *l;
    int row = 0;

    //layout->setContentsMargins(0,0,0,0);
    //layout->setVerticalSpacing(3);
    layout->addWidget(container, row, 0,3,0);
    layout->setRowStretch(1, 1);

    layout->addWidget(m_chbPercentEnabled, row, 1,AlignRight);
    layout->addWidget(m_lePercent, row, 2);
    layout->addWidget(l = new WLabel(WString("Процент:",UTF8)), row, 3);
    l->setBuddy(m_lePercent);
    ++row;

    layout->addWidget(m_chbCostEnabled, row, 1,AlignRight);
    layout->addWidget(m_leCost, row, 2);
    layout->addWidget(l = new WLabel(WString("Цена:",UTF8)), row, 3);
    l->setBuddy(m_leCost);
    ++row;
    ++row;
    //layout->addWidget(new WBreak(),row,0);
    layout->addWidget(l = new WLabel(WString("Дата принятия изменения:",UTF8)), row, 2,0,4,AlignLeft);
    layout->setColumnStretch(2, 1);
    //++row;
    //layout->addWidget(new WBreak(),row,0);
    ++row;
    layout->addWidget(m_chbModifyStatic, row, 0);
    layout->addWidget(m_dpModified->lineEdit(), row, 2);
    layout->addWidget(m_dpModified, row, 3);
    l->setBuddy(m_dpModified->lineEdit());
    ++row;

    WLabel* roundingMethodLabel = new WLabel(WString::fromUTF8("Метод округления:"));
    m_roundingMethod = ((Portal *)WApplication::instance())->getSession()->getRoundList(new WComboBox());
    roundingMethodLabel->setBuddy(m_roundingMethod) ;
    layout->addWidget(roundingMethodLabel, row, 0);
    m_roundingMethod->setCurrentIndex(roundIndex-1);
    layout->addWidget(m_roundingMethod, row, 2);

    //roundingMethod->setModel(model);


    WPushButton *b;
    //WContainerWidget *buttons = new WContainerWidget();
    footer()->addWidget(b = new WPushButton(tr("save")));
    b->clicked().connect(this, &WDialog::accept);
    b->setDefault(true);
    contents()->enterPressed().connect(this, &WDialog::accept);
    footer()->addWidget(b = new WPushButton(tr("cancel")));
    b->clicked().connect(this, &WDialog::reject);

    //layout->addWidget(buttons, row, 0, 0, 4, AlignCenter);
    layout->setColumnStretch(1, 1);

    contents()->setLayout(layout);

    finished().connect(this, &PriceEditDialog::handleFinish);

    show();

}
示例#17
0
DetailManipulation::DetailManipulation(bool enhance, WContainerWidget *parent)
	: WContainerWidget(parent), onlySmooth(!enhance)
{

	resize(WLength::Auto, WLength::Auto);

	// Image bar
	prepareInputImages();
	WContainerWidget *imageBar = new WContainerWidget;
	WVBoxLayout *imageBarLayout = new WVBoxLayout();
	for (size_t i = 0; i < inputImages.size(); ++i) {
		WImage *img = inputImages[i]->getOriginalImage();
		img->setStyleClass("image_button");
		img->resize(160, 120);
		img->setAttributeValue("onMouseOver", "this.width=192; this.height=144;");
		img->setAttributeValue("onMouseOut", "this.width=160; this.height=120;");
		img->clicked().connect(
				boost::bind(&DetailManipulation::selectImage,
							this,
							i
							)
		);
		imageBarLayout->addWidget(img);
	}
	imageBar->resize(200, WLength::Auto);
	imageBar->setLayout(imageBarLayout);
	selectedImageId = 0;

	// Main component
	imageTab = new WTabWidget();
	imageTab->addTab(inputImages[selectedImageId]->getOriginalImage(), "Original");
	if (onlySmooth) {
		imageTab->addTab(new WImage(smoothedResult[selectedImageId].second), smoothedResult[selectedImageId].first);
	}
	else {
		imageTab->addTab(new WImage(enhancedResult[selectedImageId].second), enhancedResult[selectedImageId].first);
	}
	imageTab->resize(600, WLength::Auto);


	WGridLayout *controllerLayout = new WGridLayout();
	WSlider *rSlider = new WSlider(Wt::Vertical);
	rSlider->setRange(SLIDER_MINIMUM, SLIDER_MAXIMUM);
	rSlider->setTickPosition(Wt::WSlider::TicksBothSides);
	WDoubleSpinBox *rSpinBox = new WDoubleSpinBox();
	rSpinBox->setMinimum(R_MINIMUM);
	rSpinBox->setMaximum(R_MAXIMUM);
	rSlider->sliderMoved().connect(
			boost::bind(&DetailManipulation::changeDoubleSpinBoxValue,
						this,
						rSpinBox,
						true,
						_1)
	);
	rSpinBox->valueChanged().connect(
			boost::bind(&DetailManipulation::changeSliderValue,
						this,
						rSlider,
						1.f/(R_MAXIMUM-R_MINIMUM),
						_1)
	);
	controllerLayout->addWidget(rSlider, 2, 0, 6, 1);
	controllerLayout->addWidget(rSpinBox, 9, 0);
	controllerLayout->addWidget(new WText("radius"), 10, 0);


	WSlider *epsSlider = new WSlider(Wt::Vertical);
	epsSlider->setMinimum(SLIDER_MINIMUM);
	epsSlider->setMaximum(SLIDER_MAXIMUM);
	epsSlider->setRange(SLIDER_MINIMUM, SLIDER_MAXIMUM);
	epsSlider->setTickPosition(WSlider::TicksBothSides);
	WDoubleSpinBox *epsSpinBox = new WDoubleSpinBox();
	epsSpinBox->setMinimum(EPS_MINIMUM);
	epsSpinBox->setMaximum(EPS_MAXIMUM);
	epsSlider->sliderMoved().connect(
			boost::bind(&DetailManipulation::changeDoubleSpinBoxValue,
						this,
						epsSpinBox,
						false,
						_1)
	);
	epsSpinBox->valueChanged().connect(
			boost::bind(&DetailManipulation::changeSliderValue,
						this,
						epsSlider,
						1.f/(EPS_MAXIMUM-EPS_MINIMUM),
						_1)
	);
	controllerLayout->addWidget(epsSlider, 2, 1, 6, 1);
	controllerLayout->addWidget(epsSpinBox, 9, 1);
	controllerLayout->addWidget(new WText("epsilon"), 10, 1);

	WPushButton *apply = new WPushButton("Apply");
	apply->clicked().connect(
			boost::bind(&DetailManipulation::applyEnhancement,
					this,
					rSpinBox,
					epsSpinBox
					)
	);
	controllerLayout->addWidget(apply, 1, 0, 1, 2);


	WContainerWidget *controller = new WContainerWidget();
	controller->resize(120, WLength::Auto);
	controller->setLayout(controllerLayout);


	WBorderLayout *mainLayout = new WBorderLayout(this);
	mainLayout->addWidget(imageBar, WBorderLayout::West);
	mainLayout->addWidget(imageTab, WBorderLayout::Center);
	mainLayout->addWidget(controller, WBorderLayout::East);
	//setLayout(mainLayout, Wt::AlignTop | Wt::AlignJustify);
	/*
		doJavaScript(
			    "(function () { \
						     var imageTags = document.getElementsByClassName(\"image_button\"); \
						     for (var i=0; image=imageTags[i]; ++i) { \
						         if (image.width>200 && image.height>0) { \
						             image.width = 192;  \
						         } \
						     }\
				 })();"
		);*/

}
示例#18
0
WWidget *RootLogin::Layout()
{
    m_cgiRoot->setTitle(m_lang->GetString("ROOT_LOGIN_TITLE"));

    Div *root = new Div("RootLogin");

    Div *dvNoScript = new Div(root, "dvNoScript");
    new WText(m_lang->GetString("WARN_NO_SCRIPT"), dvNoScript);

    Div *dvLogin = new Div(root, "dvLogin");
    new WText(m_lang->GetString("ROOT_LOGIN_FORM_TITLE"), dvLogin);

    Div *dvLangBar = new Div(dvLogin, "dvLangBar");
    new WText(L"<span style=\"color: #333; font-family: Tahoma !important; letter-spacing: 1px;\">"
	          "<a href=\"?enroot\" style=\"color: #666; text-decoration: none;\">EN</a>"
              "&nbsp;|&nbsp;"
              "<a href=\"?faroot\" style=\"color: #666; text-decoration: none;\">فا</a>"
			  "</span>", dvLangBar);

    Div *dvLoginForm = new Div(dvLogin, "dvLoginForm", "form");
    WGridLayout *dvLoginFormLayout = new WGridLayout();

    m_loginUserEdit = new WLineEdit();
    m_loginPwdEdit = new WLineEdit();
    m_loginPwdEdit->setEchoMode(WLineEdit::Password);
    m_loginCaptchaEdit = new WLineEdit();

    dvLoginFormLayout->addWidget(new WText(m_lang->GetString("ROOT_LOGIN_FORM_USER_TEXT")),
                                 0, 0, AlignLeft | AlignMiddle);
    dvLoginFormLayout->addWidget(m_loginUserEdit, 0, 1);

    dvLoginFormLayout->addWidget(new WText(m_lang->GetString("ROOT_LOGIN_FORM_PWD_TEXT")),
                                 1, 0, AlignLeft | AlignMiddle);
    dvLoginFormLayout->addWidget(m_loginPwdEdit, 1, 1);

    dvLoginFormLayout->addWidget(new WText(m_lang->GetString("ROOT_LOGIN_FORM_CAPTCHA_TEXT")),
                                 2, 0, AlignLeft | AlignMiddle);
    dvLoginFormLayout->addWidget(m_loginCaptchaEdit, 2, 1);

    dvLoginFormLayout->setVerticalSpacing(11);
    dvLoginFormLayout->setColumnStretch(0, 100);
    dvLoginFormLayout->setColumnStretch(1, 200);
    dvLoginForm->resize(300, WLength::Auto);
    dvLoginForm->setLayout(dvLoginFormLayout);

    m_loginCaptchaImage = m_captcha->GenCap();
    dvLogin->addWidget(m_loginCaptchaImage);

    m_errLoginText = new WText(dvLogin);
    WPushButton *loginBtn = new WPushButton(m_lang->GetString("ROOT_LOGIN_FORM_LOGIN_TEXT"),
                                            dvLogin);
    loginBtn->setStyleClass("formButton");

    WText *forgotLink = new WText(
            L"<p style=\"text-align: right !important; margin-top: 25px;\">"
            + m_lang->GetString("ROOT_LOGIN_FORM_FORGOT_TEXT") + L"</p>",
            dvLogin);
    forgotLink->setStyleClass("link");

    m_dvForgot = new Div(dvLogin, "dvForgot");
    m_forgotFormFlag = false;

    Div *dvCopyright = new Div(root, "dvCopyright");
    new WText(Base::Copyright(m_cgiEnv->CurrentLang), dvCopyright);

    WSignalMapper<WText *> *forgotMap = new WSignalMapper<WText *>(this);
    forgotMap->mapped().connect(this, &RootLogin::ForgotForm);
    forgotMap->mapConnect(forgotLink->clicked(), forgotLink);

    WLengthValidator *loginUserValidator = new WLengthValidator(Base::MIN_USERNAME_LENGTH,
                                                                Base::MAX_USERNAME_LENGTH);
    loginUserValidator->setMandatory(true);
    m_loginUserEdit->setValidator(loginUserValidator);

    WLengthValidator *loginPwdValidator = new WLengthValidator(Base::MIN_PASSWORD_LENGTH,
                                                               Base::MAX_PASSWORD_LENGTH);
    loginPwdValidator->setMandatory(true);
    m_loginPwdEdit->setValidator(loginPwdValidator);

    m_loginCaptchaValidator = new WIntValidator(m_captcha->Result, m_captcha->Result);
    m_loginCaptchaValidator->setMandatory(true);
    m_loginCaptchaEdit->setValidator(m_loginCaptchaValidator);

    m_loginUserEdit->enterPressed().connect(this, &RootLogin::LoginOK);
    m_loginPwdEdit->enterPressed().connect(this, &RootLogin::LoginOK);
    m_loginCaptchaEdit->enterPressed().connect(this, &RootLogin::LoginOK);
    loginBtn->clicked().connect(this, &RootLogin::LoginOK);

    return root;
}
示例#19
0
///
//  Create the user interface widgets
//
void PipelineApp::createUI()
{
    WApplication::instance()->log("debug") << "createUI: START";
    WContainerWidget *w = root();
    w->setStyleClass("maindiv");

    // Create the top tab
    WTabWidget *topTab = new WTabWidget();
    topTab->setStyleClass("toptabdiv");
    mSubjectPage = new SubjectPage();
    //mResultsPage = new ResultsPage(mSubjectPage->getMRIBrowser());
    //mMonitorPage = new MonitorPage(mSubjectPage->getMRIBrowser());
    topTab->addTab(mSubjectPage, "Subjects");
    //topTab->addTab(mResultsPage, "Results");
    //topTab->addTab(mMonitorPage, "Monitor Cluster");
    //topTab->addTab(new WText(w->tr("cluster-load-page"), XHTMLUnsafeText), "Cluster Load");
    //topTab->currentChanged().connect(this, &PipelineApp::mainTabChanged);

    WGridLayout *layout = new WGridLayout();
    layout->addWidget(topTab, 0, 0);
    layout->addWidget(new WLabel(w->tr("file-bug")), 2, 0, Wt::AlignCenter);
    layout->setRowStretch(0, 1);

    mMainSiteWidget = new WContainerWidget();
    //mProjectPage = new ProjectPage();


    // All items in the tabbed widget need to be resized to 100% to
    // fill the contents.  This trick came from the Wt WTabWidget
    // documentation and took me a good half a day to figure out.
    mSubjectPage->resize(WLength(100.0, WLength::Percentage),
                         WLength(100.0, WLength::Percentage));
    //mResultsPage->resize(WLength(100.0, WLength::Percentage),
   //                      WLength(100.0, WLength::Percentage));
    //mMonitorPage->resize(WLength(100.0, WLength::Percentage),
      //                   WLength(100.0, WLength::Percentage));

    mMainSiteWidget->setLayout(layout);

    //mLoginPage = new LoginPage();
    //mLoginPage->userLoggedIn().connect(this, &PipelineApp::userLoggedIn);
    //mProjectPage->projectChosen().connect(this, &PipelineApp::projectChosen);
    //mProjectPage->logoutUser().connect(this, &PipelineApp::logout);
    //changeProjectButton->clicked().connect(this, &PipelineApp::goHome);
    //logoutButton->clicked().connect(this, &PipelineApp::logout);

    //mStackedWidget = new WStackedWidget();
    //mStackedWidget->addWidget(mLoginPage);
    //mStackedWidget->addWidget(mainSite);
    //mStackedWidget->setCurrentIndex(0);

    WVBoxLayout *primaryLayout = new WVBoxLayout();
    primaryLayout->addWidget(mMainSiteWidget);

    w->setLayout(primaryLayout);

    requestTooLarge().connect(this, &PipelineApp::largeRequest);

    setTitle(w->tr("page-title"));

    WApplication::instance()->log("debug") << "createUI: FINISH";

    // See if the user is already logged in via a cookie
//    if (mLoginPage->getLoggedIn())
   // {
     //   userLoggedIn(mLoginPage->getCurrentUserName(), mLoginPage->getCurrentEmail());
   // }
}
示例#20
0
文件: LoginPage.cpp 项目: FNNDSC/web
///
//  Constructor
//
LoginPage::LoginPage(WContainerWidget *parent) :
    WContainerWidget(parent),
    mLoggedIn(false),
    mLogoutRequested(false)
{
    setStyleClass("maindiv");

    WLabel* loginText = new WLabel("Enter username and password:"******"");
    WText *userNameText = new WText("User Name:");

    mPasswordLineEdit = new WLineEdit("");
    mPasswordLineEdit->setEchoMode(WLineEdit::Password);

    WText *passwordText = new WText("Password:"******"Login");

    WGridLayout *loginLayout = new WGridLayout();
    loginLayout->addWidget(userNameText, 0, 0, AlignRight);
    loginLayout->addWidget(mUserNameLineEdit, 0, 1, AlignLeft);
    loginLayout->addWidget(passwordText, 1, 0, AlignRight);
    loginLayout->addWidget(mPasswordLineEdit, 1, 1, AlignLeft);

    WGridLayout *textLayout = new WGridLayout();
    textLayout->addWidget(loginText, 0, 0, AlignCenter);

    WGridLayout *buttonLayout = new WGridLayout();
    buttonLayout->addWidget(loginButton, 0, 0, AlignCenter | AlignMiddle);

    WImage *chbLogo = new WImage(tr("logo-image").toUTF8());
    WGridLayout *chbLogoLayout = new WGridLayout();
    chbLogoLayout->addWidget(chbLogo, 0, 0, AlignCenter);

    WLabel *titleLabel = new WLabel(tr("page-top-text"));
    titleLabel->setStyleClass("logintitlediv");
    WGridLayout *titleLayout = new WGridLayout();
    titleLayout->addWidget(titleLabel, 0, 0, AlignCenter);

    WContainerWidget *loginContainer = new WContainerWidget();
    loginContainer->setStyleClass("logindiv");

    mFailureLabel = new WLabel("Invalid username and/or password.  Try again.");
    mFailureLabel->setStyleClass("redtext");

    WVBoxLayout *layout = new WVBoxLayout();
    layout->addLayout(chbLogoLayout, AlignCenter);
    layout->addLayout(titleLayout, AlignCenter);
    layout->addLayout(textLayout, AlignCenter);
    layout->addLayout(loginLayout);
    layout->addWidget(mFailureLabel);
    layout->addLayout(buttonLayout, AlignCenter | AlignMiddle);

    mFailureLabel->hide();

    loginContainer->setLayout(layout, AlignTop);

    WVBoxLayout *pageLayout = new WVBoxLayout();
    pageLayout->addWidget(loginContainer);
    pageLayout->addWidget(new WText(tr("login-page-text")));

    setLayout(pageLayout, AlignMiddle | AlignCenter);

    loginButton->clicked().connect(SLOT(this, LoginPage::login));
    mPasswordLineEdit->enterPressed().connect(SLOT(this, LoginPage::login));

    resetAll();
}