/////////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_); }
/////////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); } }