コード例 #1
0
ファイル: teapot.C プロジェクト: 913862627/wt
WebGLDemo::WebGLDemo(const WEnvironment& env)
  : WApplication(env)
{
  setTitle("WebGL Demo");

  root()->addWidget(new WText("If your browser supports WebGL, you'll "
    "see a teapot below.<br/>Use your mouse to move around the teapot.<br/>"
    "Edit the shaders below the teapot to change how the teapot is rendered."));
  root()->addWidget(new WBreak());

  paintWidget_ = 0;

  glContainer_ = new WContainerWidget(root());
  glContainer_->resize(500, 500);
  glContainer_->setInline(false);

  WPushButton *updateButton = new WPushButton("Update shaders", root());
  updateButton->clicked().connect(this, &WebGLDemo::updateShaders);
  WPushButton *resetButton = new WPushButton("Reset shaders", root());
  resetButton->clicked().connect(this, &WebGLDemo::resetShaders);

  WTabWidget *tabs = new WTabWidget(root());

  fragmentShaderText_ = new WTextArea;
  fragmentShaderText_->resize(750, 250);
  tabs->addTab(fragmentShaderText_, "Fragment Shader");
  WText *shaderInfo = new WText(root());
  vertexShaderText_ = new WTextArea;
  vertexShaderText_->resize(750, 250);
  tabs->addTab(vertexShaderText_, "Vertex Shader");

  resetShaders();
}
コード例 #2
0
ファイル: MonitorPage.cpp プロジェクト: FNNDSC/web
///
//  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));

}
コード例 #3
0
ファイル: ResultsPage.cpp プロジェクト: FNNDSC/web
///
//  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));
}
コード例 #4
0
ファイル: PipelineApp.cpp プロジェクト: FNNDSC/web
///
//  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());
   // }
}