Exemplo n.º 1
0
About::About() {
	WContainerWidget *cw = new 	WContainerWidget();
	
	cw->addWidget(new WBreak());
	cw->addWidget(new WBreak());

	
	this->addWidget(cw);
Wt::WContainerWidget *j = new Wt::WContainerWidget(this);
 j->resize(WLength::Auto, 200);

Wt::WGridLayout *lay = new Wt::WGridLayout();
store="<p>jonny jonny yes papa," 
      " Eating sugar no papa "
      "Telling lie, no papa " 
      "Open your mouth .</p>haha. ";


//lay->addWidget(new Wt::WText("this site is made by parvinder rajput. \n who are pursuing is b.tech from gndec ludhiana."),0,0);
// lay->addWidget(new Wt::WText("this is dean of consultancy cell"), 0, 2);
 //lay->addWidget(new Wt::WText("Hello"), 0, 0);
 
//lay->addWidget(new Wt::WImage("/images/Footer.jpg"), 0,0);
lay->addWidget(new Wt::WText(store ), 0,3);
lay->addWidget(new Wt::WImage("/images/jj.jpg"), 0,0);
lay->addWidget(new Wt::WImage("/images/uu.gif"), 0,2);
j->setLayout(lay); 
}
Exemplo n.º 2
0
/**
  Constructor for View

  /usr/lib/Wt/examples/widgetgallery/examples/ComboBoxModel.cpp
  https://www.webtoolkit.eu/widgets/forms/combo-box
  https://www.webtoolkit.eu/wt/doc/reference/html/classWt_1_1WComboBox.html

 */
View::View(const Wt::WEnvironment& env)
    : Wt::WApplication(env)
{
  setTitle("DropDown Demo");


  log("info") << "Test";

  // This is the container for the full screen.
  Wt::WContainerWidget *pScreenContainer = new Wt::WContainerWidget();
  pScreenContainer->resize(Wt::WLength::Auto, Wt::WLength::Auto);
  // Add the primary container to the root widget?
  root()->addWidget(pScreenContainer);

  // Choose the grid layout.
  Wt::WGridLayout *pScreenLayout = new Wt::WGridLayout();
  pScreenContainer->setLayout(pScreenLayout);

  int nRow = 0;
  int nColoumn = 0;

 
  // Create the label
  Wt::WText *lblSeriesChoice = new Wt::WText("Series:");
  // set right align the label
  lblSeriesChoice->setTextAlignment(Wt::AlignRight);
  pScreenLayout->addWidget(lblSeriesChoice, nRow, nColoumn+0);

  // Create the dropdown
  Wt::WComboBox *cbSeries = new Wt::WComboBox();
  cbSeries->addItem("");
  cbSeries->addItem("New");
  cbSeries->addItem("Krakken awoke");
  cbSeries->addItem("Appocalypse survival");
  cbSeries->setCurrentIndex(0); // Empty string
  pScreenLayout->addWidget(cbSeries, nRow, nColoumn+1);


  // Create the connection
  cbSeries->activated().connect(this, &View::DropDownSelectionChangeOtherDropDown);
  cbSeries->activated().connect(this, &View::DropDownSelectionChangeTab);
  /* Signals connect to Slots.
  * You may specify up to 6 arguments which may be of arbitrary types that are Copyable, that may be passed through the signal to connected slots.
  *   https://www.webtoolkit.eu/wt/doc/reference/html/group__signalslot.html
  * I think the 
  *   first parm - is a pointer to the target class.
  *   second parm - is the name of the method?
  * 
  * See: Wt::Signal.
  */


  /*
  * Let row 1 and column 1 take the excess space.?
  */
  pScreenLayout->setRowStretch(0, 0);
  pScreenLayout->setColumnStretch(0, 0);
} // end
Exemplo n.º 3
0
void AdsEditor::renderUI() {
  AdsApplication *app = AdsApplication::adsApplication();
  cppdb::session &db = app->db_;
  
  clear();
  WPushButton *btn = new WPushButton("Criar Anuncio", this);
  btn->clicked().connect(this, &AdsEditor::novoAnuncio);
  WPushButton *update = new WPushButton("Atualiza", this);
  update->clicked().connect(this, &AdsEditor::renderUI);
  new WBreak(this);
  new WBreak(this);
  new WText("<h3>Lista de Anuncios</h3>",this);
  
  Wt::WContainerWidget *w = new Wt::WContainerWidget(this);
  w->resize(600, WLength::Auto);
  WVBoxLayout *layout = new Wt::WVBoxLayout();
  cppdb::result res = db <<
    "select id, titulo, url, imagem, texto, ativo "
    " from anuncio";
  while(res.next()) {
    WContainerWidget *cont = new WContainerWidget();
    AdsAnuncio *anuncio = new AdsAnuncio(cont);
    
    res >>  anuncio->id >> anuncio->titulo_ >> anuncio->link_ >>
      anuncio->imagem_ >> anuncio->texto_ >> anuncio->ativo_;    
    
    WPushButton *tituloBtn = new WPushButton("Titulo",cont);
    tituloBtn->clicked().connect(anuncio, &AdsAnuncio::editarTitulo);
    
    WPushButton *urlBtn = new WPushButton("URL",cont);
    urlBtn->clicked().connect(anuncio, &AdsAnuncio::editarURL);
    
    WPushButton *imagemBtn = new WPushButton("Imagem",cont);
    imagemBtn->clicked().connect(anuncio, &AdsAnuncio::editarImagem);
    
    WPushButton *textoBtn = new WPushButton("Texto",cont);
    textoBtn->clicked().connect(anuncio, &AdsAnuncio::editarTexto);
    
    WCheckBox *ativoCheck = new Wt::WCheckBox("Ativo",cont);
    if(anuncio->ativo_ == 1)
      ativoCheck->setChecked(true);
    else 
      ativoCheck->setChecked(false);
    ativoCheck->changed().connect(anuncio, &AdsAnuncio::changeAtiva);

    WPushButton *deletaBtn = new WPushButton("Deleta",cont);
    deletaBtn->clicked().connect(anuncio, &AdsAnuncio::deletaAnuncio);

    anuncio->renderUI();
    layout->addWidget(cont);
  }
  w->setLayout(layout);
}
Exemplo n.º 4
0
Home::Home() {
	
Wt::WContainerWidget *p = new Wt::WContainerWidget(this);
 p->resize(WLength::Auto, 200);

 Wt::WGridLayout *lay = new Wt::WGridLayout();
//lay->addWidget(new Wt::WText("this site is made by parvinder rajput. \n who are pursuing is b.tech from gndec ludhiana."),0,0);
// lay->addWidget(new Wt::WText("this is dean of consultancy cell"), 0, 2);
 //lay->addWidget(new Wt::WText("Hello"), 0, 0);
 
//lay->addWidget(new Wt::WImage("/images/Footer.jpg"), 0,0);
lay->addWidget(new Wt::WText("HERE GOES A SMALL RHYMES WEBSITE FOR NURSERY KIDS TO MAKE THEIR LEARNING INTERESTING."), 0,0);
lay->addWidget(new Wt::WImage("/images/images.jpeg"), 0,2);
lay->addWidget(new Wt::WImage("/images/images8.jpeg"), 0,1);
p->setLayout(lay);
}
      VideoPanel::VideoPanel(std::map<std::string, std::string>& p) : _parameter(p), Wt::Ext::Panel() {
        //        setLayout(new Wt::WFitLayout());
        Wt::WBorderLayout*l = new Wt::WBorderLayout();
        setLayout(l);
        std::set<std::string> avail_codecs;
        if (_parameter.count("available_codecs") > 0) {
          LOGDEBUG("Available codes" << _parameter["available_codecs"]);
          org::esb::util::StringTokenizer st(_parameter["available_codecs"], ",");
          while (st.hasMoreTokens()) {
            std::string codec_id = st.nextToken();
            avail_codecs.insert(codec_id);
            LOGDEBUG("avalable codec list" << codec_id);
          }
        }
        /*
         * Combobox for the Codec Selector
         */
        KeyValueModel * codec_model = new KeyValueModel();
        codec_model->addModelData("novideo", "No Video");
        codec_model->addModelData("copy", "Stream Copy");

        AVCodec *codec = NULL;
        int a = 0;
        while ((codec = av_codec_next(codec))) {
          if (codec->encode && codec->type == AVMEDIA_TYPE_VIDEO) {
            if (avail_codecs.count(codec->name) > 0) {
              codec_model->addModelData(codec->name, codec->long_name);
            } else {
              if (avail_codecs.size() == 0)
                codec_model->addModelData(codec->name, codec->long_name);
            }
          }
        }
        codec_model->sort(1);

        _codec = new ComboBox();

        _codec->setModel(codec_model);
        _codec->setModelColumn(1);
        _codec->setSelectedEntry(_parameter["codec_id"]);
        _codec->setTextSize(50);
        _codec->resize(300, Wt::WLength());


        _codec->activated().connect(SLOT(this, VideoPanel::codecSelected));


        main_panel = new Wt::Ext::Panel();
        Wt::WFitLayout * fit = new Wt::WFitLayout();
        main_panel->setLayout(fit);
        //main_panel->setBorder(false);

        l->addWidget(main_panel, Wt::WBorderLayout::Center);

        Wt::Ext::Panel * top_panel = new Wt::Ext::Panel();
        top_panel->resize(Wt::WLength(), 40);
        top_panel->setLayout(new Wt::WFitLayout());
        top_panel->setBorder(false);
        //        top_panel->layout()->addWidget(_codec);

        Wt::WContainerWidget *top = new Wt::WContainerWidget();
        top_panel->layout()->addWidget(top);
        Wt::WGridLayout * grid = new Wt::WGridLayout();
        top->setLayout(grid);
        top->resize(Wt::WLength(), 40);

        l->addWidget(top_panel, Wt::WBorderLayout::North);
        Wt::WLabel * label = new Wt::WLabel("Codec:");
        label->setBuddy(_codec);

        grid->addWidget(label, 0, 0);
        grid->addWidget(_codec, 0, 1);
        grid->addWidget(new Wt::WText(""), 0, 2);
        grid->setColumnStretch(1, 1);




        setCodecGui(_parameter["codec_id"]);
        //l->addWidget(builder,Wt::WBorderLayout::Center);
        //        return;
      }
Exemplo n.º 6
0
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8/////////9/////////A
// We have a FlightpredApp object for each session (user...)
FlightpredApp::FlightpredApp(const Wt::WEnvironment& env)
 : Wt::WApplication(env)
{
	setTitle(_("free flight prediction system")); // application title
	useStyleSheet("flightpred.css");
//    std::cout << "create a new session. locale is : " << locale() << std::endl;

    try
    {
        // assemble the database connection information
        string db_host = "localhost";
//        string db_host = "192.168.2.47";
        Wt::WApplication::readConfigurationProperty("db-host", db_host);
        string db_port = "5432";
        Wt::WApplication::readConfigurationProperty("db-port", db_port);
        string db_name = "flightpred";
        Wt::WApplication::readConfigurationProperty("db-name", db_name);
        string db_user = "******";
        Wt::WApplication::readConfigurationProperty("db-user", db_user);
        string db_password = "******";
        Wt::WApplication::readConfigurationProperty("db-password", db_password);
        std::stringstream sstr;
        std::cout << "Connecting to the database:  host=" << db_host << " port=" << db_port
                  << " dbname=" << db_name << " user="******" password=********" << std::endl;
        sstr << "host=" << db_host << " port=" << db_port << " dbname=" << db_name
             << " user="******" password="******"web prediction");
            pqxx::result res = trans.exec("SELECT pred_site_id FROM pred_sites");
        }
        catch(std::exception &ex)
        {
            throw std::runtime_error(string("Failed to connect to the database. You may have to configure the database server, so that the webserver can access it. -> ") + ex.what());
        }

        string lacyLoadTabs = "lacyLoadTabs";
        Wt::WApplication::readConfigurationProperty("lacyLoadTabs", lacyLoadTabs);
        const Wt::WTabWidget::LoadPolicy loadpoly = (lacyLoadTabs == "1" || boost::to_lower_copy(lacyLoadTabs) == "true"
                        ? Wt::WTabWidget::LazyLoading : Wt::WTabWidget::PreLoading);

        Wt::WTabWidget *tabw = new Wt::WTabWidget(root());

        string forecast_days_str = "3";
        Wt::WApplication::readConfigurationProperty("forecast_days", forecast_days_str);
        const size_t forecast_days = boost::lexical_cast<size_t>(forecast_days_str);
        FlightForecast *forecastpanel = new FlightForecast(db_conn_str, forecast_days);
        tabw->addTab(forecastpanel, _("Flight Forecasts\n"), loadpoly);

        WeatherMap *weatherpanel = new WeatherMap(db_conn_str, "GFS");
        tabw->addTab(weatherpanel, _("Weather data"), loadpoly);

        Populations *populations = new Populations(db_conn_str);
        tabw->addTab(populations, _("Populations"), loadpoly);

        Wt::WContainerWidget *docupanel = new Wt::WContainerWidget();
        tabw->addTab(docupanel, _("Documentation"), loadpoly);
        sstr.str("");
        sstr << "<iframe src=\"http://flightpred.svn.sourceforge.net/viewvc/flightpred/trunk/doc/index.html\" width=\"100%\" height=\"100%\"></iframe>";
        Wt::WText *txIFrame = new Wt::WText(sstr.str(), Wt::XHTMLUnsafeText);
        docupanel->addWidget(txIFrame);
        docupanel->resize(Wt::WLength(100.0, Wt::WLength::Percentage), Wt::WLength(100.0, Wt::WLength::Percentage));

    }
    catch(std::exception &ex)
    {
        std::cout << _("critical error during session initialization : ") << ex.what() << std::endl;
        new Wt::WText(ex.what(), root());
    }
}
Exemplo n.º 7
0
Wt::WApplication *createApplication(const Wt::WEnvironment& env)
{
    // uncomment to get error checking (slow)
    //Wt::WGLWidget::enableClientErrorChecks();
    OSGWTApp * w = new OSGWTApp (env);
        
    w->setTitle("osgGeometry");

	Wt::WContainerWidget* glContainer = new Wt::WContainerWidget(w->root());
    glContainer->resize(500, 500);
    glContainer->setInline(false);
    
    osg::ref_ptr<osg::Group> g = new osg::Group();

    osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFile("glider.osgt");

    osg::ref_ptr<osg::Node> rootnode = createRoom(loadedModel);

    // use vertex buffer objects only (no client side arrays are supported by webgl)
    osgUtil::GLObjectsVisitor glov(osgUtil::GLObjectsVisitor::SWITCH_ON_VERTEX_BUFFER_OBJECTS);
    rootnode->accept(glov);
    
    // ReWeb3D: add uniforms for the lights!
    // best solution would be that osg::Light provides these
    {
        osg::Uniform* light0Ambient = new osg::Uniform( "glLightSource0.ambient",Light0->getAmbient() );
        osg::Uniform* light0Diffuse = new osg::Uniform( "glLightSource0.diffuse",Light0->getDiffuse());
        osg::Uniform* light0Specular = new osg::Uniform( "glLightSource0.specular", Light0->getSpecular());
        osg::Uniform* light0SpotExponent = new osg::Uniform( "glLightSource0.spotExponent", Light0->getSpotExponent());
        osg::Uniform* light0SpotCutoff = new osg::Uniform( "glLightSource0.spotCutoff", Light0->getSpotCutoff());
        osg::Uniform* light0linearAttenuation = new osg::Uniform( "glLightSource0.linearAttenuation",Light0->getLinearAttenuation() );
        osg::Uniform* light0constantAttenuation = new osg::Uniform( "glLightSource0.constantAttenuation",Light0->getConstantAttenuation() );
        osg::Uniform* light0quadraticAttenuation = new osg::Uniform( "glLightSource0.quadraticAttenuation",Light0->getQuadraticAttenuation() );
        osg::Uniform* light0spotDirection = new osg::Uniform( "glLightSource0.spotDirection", Light0->getDirection());
        osg::Uniform* light0position = new osg::Uniform( "glLightSource0.position", Light0->getPosition());
        
        osg::Uniform* light1Ambient = new osg::Uniform( "glLightSource1.ambient",Light1->getAmbient() );
        osg::Uniform* light1Diffuse = new osg::Uniform( "glLightSource1.diffuse",Light1->getDiffuse());
        osg::Uniform* light1Specular = new osg::Uniform( "glLightSource1.specular", Light1->getSpecular());
        osg::Uniform* light1SpotExponent = new osg::Uniform( "glLightSource1.spotExponent", Light1->getSpotExponent());
        osg::Uniform* light1SpotCutoff = new osg::Uniform( "glLightSource1.spotCutoff", Light1->getSpotCutoff());
        osg::Uniform* light1linearAttenuation = new osg::Uniform( "glLightSource1.linearAttenuation",Light1->getLinearAttenuation() );
        osg::Uniform* light1constantAttenuation = new osg::Uniform( "glLightSource1.constantAttenuation",Light1->getConstantAttenuation() );
        osg::Uniform* light1quadraticAttenuation = new osg::Uniform( "glLightSource1.quadraticAttenuation",Light1->getQuadraticAttenuation() );
        osg::Uniform* light1spotDirection = new osg::Uniform( "glLightSource1.spotDirection", Light1->getDirection());
        osg::Uniform* light1position = new osg::Uniform( "glLightSource1.position", Light1->getPosition());

        osg::Uniform* materialAmbient = new osg::Uniform( "glMaterial.ambient",osg::Vec4(1.0,1.0,1.0,1.0));
        osg::Uniform* materialDiffuse = new osg::Uniform( "glMaterial.diffuse",osg::Vec4(1.0,1.0,1.0,1.0));
        osg::Uniform* materialSpecular = new osg::Uniform( "glMaterial.specular", osg::Vec4(1.0,1.0,1.0,1.0));
        osg::Uniform* materialShiness = new osg::Uniform( "glMaterial.shiness",(float)32.0 );
        osg::Uniform* materialEmission = new osg::Uniform( "glMaterial.emission", osg::Vec4(0.0,0.0,0.0,0.0));
        
        osg::StateSet* ss = rootnode->getOrCreateStateSet();
        ss->addUniform(light0Ambient);
        ss->addUniform(light0Diffuse);
        ss->addUniform(light0Specular);
        ss->addUniform(light0SpotExponent);
        ss->addUniform(light0SpotCutoff);
        ss->addUniform(light0linearAttenuation);
        ss->addUniform(light0constantAttenuation); 
        ss->addUniform(light0quadraticAttenuation);
        ss->addUniform(light0spotDirection); 
        ss->addUniform(light0position);

        ss->addUniform(light1Ambient);
        ss->addUniform(light1Diffuse);
        ss->addUniform(light1Specular);
        ss->addUniform(light1SpotExponent);
        ss->addUniform(light1SpotCutoff);
        ss->addUniform(light1linearAttenuation);
        ss->addUniform(light1constantAttenuation); 
        ss->addUniform(light1quadraticAttenuation);
        ss->addUniform(light1spotDirection); 
        ss->addUniform(light1position);

        ss->addUniform(materialAmbient);
        ss->addUniform(materialDiffuse);
        ss->addUniform(materialSpecular);
        ss->addUniform(materialShiness);
        ss->addUniform(materialEmission);
    }

    // add shader to OSG scenegraph
    {
        osg::ref_ptr<osg::Shader> vShader = new osg::Shader(
            osg::Shader::VERTEX,
            defaultVertexShader);

        osg::ref_ptr<osg::Shader> fShader = new osg::Shader(
            osg::Shader::FRAGMENT,
            defaultFragmentShader);

        osg::ref_ptr<osg::Program> program = new osg::Program();
        program->addShader(vShader);
        program->addShader(fShader);
        rootnode->getOrCreateStateSet()->setAttribute(program);
		
    }

    osgViewer::Viewer * viewer = new osgViewer::Viewer;

    osgWt::WtOSGWidget * viewWidget = new osgWt::WtOSGWidget(800,600, glContainer);

    // IMPORTANT
    viewWidget->setViewer(viewer);

    // IMPORTANT
    viewer->setUpViewerAsEmbeddedInWindow(100,100,800,600);
    
    viewer->setSceneData(rootnode);
    viewer->setCameraManipulator(new osgGA::TrackballManipulator);

    viewer->getCamera()->setComputeNearFarMode(osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR);
    viewer->getCamera()->setProjectionMatrixAsPerspective(45,800.0/600.0, 0.5, 100.0);

    viewer->realize();   
    return w;

	////////////// ADDED
}