Exemple #1
0
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8/////////9/////////A
void LocationTableRow::edit()
{
	clearRow();

	// the save image
	Wt::WImage *wiSave = new Wt::WImage("img/save.png");
	wiSave->setToolTip("speichern");
    wiSave->setStyleClass("operationImg");
	table_->elementAt(rowNr_, colOp)->addWidget(wiSave);
	wiSave->clicked().connect(SLOT(this, LocationTableRow::save));
	// the cancel image
	Wt::WImage *wiCancel = new Wt::WImage("img/undo.png");
	wiCancel->setToolTip("abbrechen");
	wiCancel->setStyleClass("operationImg");
	table_->elementAt(rowNr_, colOp)->addWidget(wiCancel);
	if(isNewEntry_)
        wiCancel->clicked().connect(SLOT(this, LocationTableRow::remove));
    else
        wiCancel->clicked().connect(SLOT(this, LocationTableRow::show));

    // area
    cbArea_ = new Wt::Ext::ComboBox();
    for(const auto& area : flightDb_->FlightAreas)
        cbArea_->addItem(area->name());
    for(int i=0; i<cbArea_->count(); ++i)
        if(location_->area()->name() == cbArea_->itemText(i).narrow())
            cbArea_->setCurrentIndex(i);
	table_->elementAt(rowNr_, colArea)->addWidget(cbArea_);
    // name
    edName_ = new Wt::Ext::LineEdit();
    edName_->setText(location_->name());
	table_->elementAt(rowNr_, colName)->addWidget(edName_);
    // height
    nfHeight_ = new Wt::Ext::NumberField();
    nfHeight_->setValue(location_->height());
	table_->elementAt(rowNr_, colHeight)->addWidget(nfHeight_);
    // position
    pfPosition_ = new Wt::WGeoPosEdit(0, Wt::WGeoPosEdit::WGS84_SEC);
    pfPosition_->setPos(std::make_pair(location_->pos().first, location_->pos().second));
	table_->elementAt(rowNr_, colPosition)->addWidget(pfPosition_);
	// use as takeoff
	cbTakeoff_ = new Wt::Ext::CheckBox();
	cbTakeoff_->setChecked(location_->usage() & Location::UA_TAKEOFF);
	table_->elementAt(rowNr_, colTakeoff)->addWidget(cbTakeoff_);
	// use as landing zone
	cbLanding_ = new Wt::Ext::CheckBox();
	cbLanding_->setChecked(location_->usage() & Location::UA_LANDING);
	table_->elementAt(rowNr_, colLanding)->addWidget(cbLanding_);
	// takeoff
	cbWayPnt_ = new Wt::Ext::CheckBox();
	cbWayPnt_->setChecked(location_->usage() & Location::UA_WAYPNT);
	table_->elementAt(rowNr_, colWaypnt)->addWidget(cbWayPnt_);

}
Exemple #2
0
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8/////////9/////////A
void LocationTable::createFooterRow()
{
    Wt::WImage *wiAdd = new Wt::WImage("img/add.png");
    wiAdd->setAlternateText("add new flight");
    wiAdd->setToolTip("Orte hinzufuegen");
	elementAt(insertRowNr_, 0)->addWidget(wiAdd);
	wiAdd->clicked().connect(SLOT(this, LocationTable::addNewLocation));
}
Exemple #3
0
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8/////////9/////////A
void LocationTableRow::show()
{
	clearRow();

    // the edit image
	Wt::WImage *wiEdit = new Wt::WImage("img/edit.png");
	wiEdit->setToolTip("Ort bearbeiten");
	wiEdit->setStyleClass("operationImg");
	table_->elementAt(rowNr_, colOp)->addWidget(wiEdit);
	wiEdit->clicked().connect(SLOT(this, LocationTableRow::edit));
    // the delete image
	Wt::WImage *wiDelete = new Wt::WImage("img/delete.png");
	wiDelete->setToolTip("Ort löschen");
	wiDelete->setStyleClass("operationImg");
	table_->elementAt(rowNr_, colOp)->addWidget(wiDelete);
	wiDelete->clicked().connect(SLOT(this, LocationTableRow::remove));
	// the map image
//	WImage *wiMap = new WImage("img/map.png");
//	wiMap->setToolTip("position anschauen");
//    wiMap->setStyleClass("operationImg");
//	table_->elementAt(rowNr_, colOp)->addWidget(wiMap);
//	wiMap->clicked.connect(SLOT(this, LocationTableRow::map));

	// prepare the text
	std::vector<std::string> vsText;
	vsText.push_back(location_->area()->name());
	vsText.push_back(location_->name());
	vsText.push_back(boost::lexical_cast<std::string>(location_->height()));
	vsText.push_back(Wt::WGeoPosEdit::format(std::make_pair(location_->pos().first, location_->pos().second), Wt::WGeoPosEdit::WGS84_SEC));
	vsText.push_back(location_->usage() & Location::UA_TAKEOFF ? "x" : "_");
	vsText.push_back(location_->usage() & Location::UA_LANDING ? "x" : "_");
	vsText.push_back(location_->usage() & Location::UA_WAYPNT  ? "x" : "_");
	// add the text widgets
	for(size_t i=0; i<vsText.size(); ++i)
	{
		Wt::WText *wtxt = new Wt::WText(vsText[i]);
		wtxt->setStyleClass("tableContent");
		table_->elementAt(rowNr_, i + 1)->addWidget(wtxt);
	}
}
Exemple #4
0
  OAuthApplication(const Wt::WEnvironment& env)
    : Wt::WApplication(env)
  {
    if (!googleService) {
      new Wt::WText("This example requires a Google Auth service "
		    "configuration", root());
      return;
    }

    process_ = googleService->createProcess
      (googleService->authenticationScope());
    Wt::WImage *ggi = new Wt::WImage("css/oauth-google.png", root());  
    ggi->clicked().connect(process_,
			   &Wt::Auth::OAuthProcess::startAuthenticate);

    process_->authenticated().connect(this, &OAuthApplication::authenticated);
  }
Exemple #5
0
void
Application::init() {
    setTitle("bROwSE");

    // This looks nicer than setCssTheme("polished"), but requires some minor CSS adjustments:
    //  + IMG should not be restricted to 100% available width, otherwise CFGs will be scaled down by the browser to a point
    //     which might be unreadable.
    setTheme(new Wt::WBootstrapTheme);

    // Hexdump style sheet rules. The colors here are the same as those used by WAddressSpace.
    styleSheet().addRule(".hexdump_evenrow", "font-family:monospace;");
    styleSheet().addRule(".hexdump_oddrow", "font-family:monospace; background-color:#f9f9f9;");
    styleSheet().addRule(".hexdump_unmapped", "background-color:black;");
    styleSheet().addRule(".hexdump_nochar", "background-color:lightgray;");
    styleSheet().addRule(".hexdump_addr_none", "font-family:monospace;"
                         " background-color:" + toHtml(darken(Color::red, 0.25)) + ";");
    styleSheet().addRule(".hexdump_addr_r", "font-family:monospace;"
                         "background-color:" + toHtml(Color::RGB(0.9, 0.8, 0)) + ";");
    styleSheet().addRule(".hexdump_addr_w", "font-family:monospace;"
                         " background-color:" + toHtml(fade(darken(Color::red, 0.25), 0.75)) + ";");
    styleSheet().addRule(".hexdump_addr_x", "font-family:monospace;"
                         " background-color:" + toHtml(darken(Color::green, 0.15)) + ";");
    styleSheet().addRule(".hexdump_addr_rw", "font-family:monospace;"
                         " background-color:" + toHtml(fade(Color::RGB(0.9, 0.8, 0), 0.75)) + ";");
    styleSheet().addRule(".hexdump_addr_rx", "font-family:monospace;"
                         " background-color:" + toHtml(darken(Color::green, 0.15)) + ";"); // same as execute-only
    styleSheet().addRule(".hexdump_addr_wx", "font-family:monospace;"
                         " background-color:" + toHtml(fade(darken(Color::green, 0.15), 0.75)) + ";");
    styleSheet().addRule(".hexdump_addr_rwx", "font-family:monospace;"
                         " background-color:" + toHtml(fade(darken(Color::green, 0.15), 0.75)) + ";");

    // Status message style sheet rules.
    styleSheet().addRule(".status_oddrow", "background-color:#f9f9f9;");
    styleSheet().addRule(".status_info", "background-color:#b5ffb3;");// light green
    styleSheet().addRule(".status_warn", "background-color:#f8ff81;");// light yellow
    styleSheet().addRule(".status_error", "background-color:#ffd781;");// light orange
    styleSheet().addRule(".status_fatal", "background-color:#ff8181;");// light red

    // Strings table style sheet rules
    styleSheet().addRule(".strings_oddrow", "background-color:#f9f9f9;");
    styleSheet().addRule(".strings_matched", "background-color:#fff195;");// light yellow

    // So other threads can obtain a lock, modify the DOM, and then call triggerUpdate.
    enableUpdates(true);

    // The application has mutually exclusive phases that are children of a stacked widget
    Wt::WVBoxLayout *vbox = new Wt::WVBoxLayout;
    root()->setLayout(vbox);
    wStacked_ = new Wt::WStackedWidget;
    vbox->addWidget(wStacked_);

    //--------------
    // Splash phase
    //--------------
    WSplash *wSplash = new WSplash;
    wSplash->clicked().connect(boost::bind(&Wt::WStackedWidget::setCurrentIndex, wStacked_, InteractivePhase));
    ASSERT_require(wStacked_->count() == SplashPhase);
    wStacked_->addWidget(wSplash);
    wStacked_->setCurrentIndex(SplashPhase);

    //------------
    // Busy phase
    //------------
    ctx_.busy = new WBusy(ctx_);
    ctx_.busy->workStarted().connect(boost::bind(&Wt::WStackedWidget::setCurrentIndex, wStacked_, BusyPhase));
    ctx_.busy->workFinished().connect(boost::bind(&Wt::WStackedWidget::setCurrentIndex, wStacked_, InteractivePhase));
    ASSERT_require(wStacked_->count() == BusyPhase);
    wStacked_->addWidget(ctx_.busy);

    //-------------------
    // Interactive phase
    //-------------------
    wInteractivePhase_ = new Wt::WContainerWidget;
    ASSERT_require(wStacked_->count() == InteractivePhase);
    wStacked_->addWidget(wInteractivePhase_);

    // Grid layout
    wInteractivePhase_->setLayout(wGrid_ = new Wt::WGridLayout);
    wGrid_->setRowStretch(1, 1);
    wGrid_->setColumnStretch(1, 1);

    // Logo (reset button)
    // FIXME[Robb P. Matzke 2014-12-27]: eventually this should be a reset button
    Wt::WImage *wLogo = new Wt::WImage("/images/logo.png");
    wLogo->setToolTip("Click here to reset the server");
    wLogo->clicked().connect(boost::bind(killServer));
    wLogo->resize(32, 32);
    wGrid_->addWidget(wLogo, 0, 0);
    wGrid_->addWidget(new Wt::WText("bROwSE: Binary ROSE On-line Workbench for Specimen Exploration"), 0, 1);

    // The central region the page is a set of tabs that are visible or not depending on the context
    wGrid_->addWidget(instantiateMainTabs(), 1, 1);

    // East side is a tool pane
    Wt::WContainerWidget *rightPane = new Wt::WContainerWidget;
    wGrid_->addWidget(rightPane, 1, 2);

    wSemantics_ = new WSemantics(ctx_, rightPane);

    wCrossRefs_ = new WCrossReferences(rightPane);
    wCrossRefs_->referenceClicked().connect(boost::bind(&Application::gotoReference, this, _1));

    // The bottom center is the status area
    wStatusBar_ = new WStatusBar;
    wStatus_->messageArrived().connect(boost::bind(&WStatusBar::appendMessage, wStatusBar_, _1));
    wGrid_->addWidget(wStatusBar_, 2, 1);

    //---------
    // Startup
    //---------

    wPartitioner_->memoryMapProvider(wMemoryMap_);
    showHideTabs();
}