Wt::WContainerWidget * ThermometerPlugin::getTab() { Wt::WContainerWidget *tabContainer_ = new Wt::WContainerWidget(); Wt::WTable *tTable = new Wt::WTable(tabContainer_); unsigned int ii = 0; tTable = new Wt::WTable(tabContainer_); for (ii = 0; ii < addresses_.size(); ii++) { char ntitle[12]; sprintf(ntitle, "Probe %d", ii + 1); try { Thermometer * t = new Thermometer(addresses_[ii].c_str(), ntitle); thermos_.push_back(t); tTable->elementAt((int) ii / 8, ii % 8)->addWidget(t); } catch (int e) { errno = e; perror("OOPS"); } } refresh(); return tabContainer_; }
SayWindow::SayWindow(Wt::WContainerWidget* parent) : Wt::WContainerWidget(parent) { // Get the user's name to say Hi with HelloApp* app = dynamic_cast<HelloApp*>(Wt::WApplication::instance()); new Wt::WText(Wt::WString("I have the loggedin user as: ") + app->session().user()->getName() + app->userName(), this); addWidget(new Wt::WBreak()); new Wt::WAnchor(Wt::WLink(Wt::WLink::InternalPath, "/ask"), "Go back to ask page", this); // Show a list of users addWidget(new Wt::WBreak()); new Wt::WText(Wt::WString("in database i have to following users:"), this); addWidget(new Wt::WBreak()); addWidget(new Wt::WBreak()); Wt::WTable* table = new Wt::WTable(this); Wt::Dbo::Transaction t(app->session()); Users users = app->userList(); int i=0; for (Users::const_iterator user=users.begin(); user != users.end(); ++user) { table->elementAt(i++, 0)->addWidget( new Wt::WText(Wt::WString("user [number] is:") +(*user)->getName()) ); } }
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8/////////9/////////A /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8/////////9/////////A /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8/////////9/////////A LocationPanel::LocationPanel(boost::shared_ptr<FlightDatabase> flightDb, Wt::WContainerWidget *parent) : Wt::WCompositeWidget(parent), flightDb_(flightDb), impl_(new Wt::WContainerWidget()) { setImplementation(impl_); setStyleClass("flb_detail_panel"); impl_->setStyleClass("flb_detail_panel"); cbArea_ = new Wt::Ext::ComboBox(impl_); cbTakeoff_ = new Wt::Ext::CheckBox(impl_); cbLanding_ = new Wt::Ext::CheckBox(impl_); cbWayPnt_ = new Wt::Ext::CheckBox(impl_); table_ = new LocationTable(flightDb, impl_); pglist_ = new PagesList(table_); // signals cbArea_->activated().connect(SLOT(this, LocationPanel::filter)); cbTakeoff_->checked().connect(SLOT(this, LocationPanel::filter)); cbLanding_->checked().connect(SLOT(this, LocationPanel::filter)); cbWayPnt_->checked().connect(SLOT(this, LocationPanel::filter)); cbTakeoff_->unChecked().connect(SLOT(this, LocationPanel::filter)); cbLanding_->unChecked().connect(SLOT(this, LocationPanel::filter)); cbWayPnt_->unChecked().connect(SLOT(this, LocationPanel::filter)); // header Wt::WTable *topBar = new Wt::WTable(); topBar->setStyleClass("FilterBar"); Wt::WText *wtFilt = new Wt::WText("Filter : "); wtFilt->setStyleClass("FilterTitle"); Wt::WText *wtArea = new Wt::WText("Fluggebiet"); wtArea->setStyleClass("FilterSubTitle"); cbTakeoff_->setText("Startplaetze"); cbLanding_->setText("Landeplaetze"); cbWayPnt_->setText("Wegpunkte"); topBar->elementAt(0, 0)->addWidget(wtFilt); topBar->elementAt(0, 1)->addWidget(wtArea); topBar->elementAt(0, 2)->addWidget(cbArea_); topBar->elementAt(0, 3)->addWidget(cbTakeoff_); topBar->elementAt(0, 4)->addWidget(cbLanding_); topBar->elementAt(0, 5)->addWidget(cbWayPnt_); topBar->elementAt(0, 6)->addWidget(pglist_); Wt::WContainerWidget *botBar = new Wt::WContainerWidget(); Wt::WBorderLayout *borderLayout = new Wt::WBorderLayout(); impl_->setLayout(borderLayout); borderLayout->addWidget(topBar, Wt::WBorderLayout::North); borderLayout->addWidget(table_, Wt::WBorderLayout::Center); borderLayout->addWidget(botBar, Wt::WBorderLayout::South); load(); filter(); }
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8/////////9/////////A Wt::WWidget * WelcomeScreen::makeNormalLoginTab() { Wt::WContainerWidget *cont = new Wt::WContainerWidget(); nl_txt_ = new Wt::WText("Hier koennen Sie ihr bestehendes Flugbuch aufrufen.", cont); cont->addWidget(new Wt::WBreak()); cont->addWidget(new Wt::WBreak()); Wt::WTable *layout = new Wt::WTable(cont); Wt::WLabel *usernameLabel = new Wt::WLabel("Benutzername: ", layout->elementAt(0, 0)); layout->elementAt(0, 0)->resize(Wt::WLength(14, Wt::WLength::FontEx), Wt::WLength()); nl_username_ = new Wt::WLineEdit(layout->elementAt(0, 1)); usernameLabel->setBuddy(nl_username_); Wt::WLabel *passwordLabel = new Wt::WLabel("Password: "******"Login", layout->elementAt(2, 1)); LoginButton->clicked().connect(SLOT( this, WelcomeScreen::doLogin)); return cont; }
Wt::WContainerWidget* WidgetsCommon::CreateWidget() { PhidgetsInfo* item = ::GetPhidgetManager()->FindPhidgetBySerial(GetSerial()); if (!item) return NULL; CPhidgetHandle handle = item->m_phidget->GetHandle(); Wt::WContainerWidget* tab_container = new Wt::WContainerWidget(); Wt::WHBoxLayout* hbox = new Wt::WHBoxLayout(tab_container); Wt::WTable* table = new Wt::WTable(); hbox->addWidget(table); table->columnAt(0)->setWidth(GetLeftColumnWidth()); table->columnAt(1)->setWidth(Wt::WLength::Auto); int row = 0; const char* string_value; int int_value; if (EPHIDGET_OK == CPhidget_getDeviceName(handle, &string_value)) { table->elementAt(row, 0)->addWidget(new Wt::WText(Wt::WString::tr("DeviceName"))); table->elementAt(row++, 1)->addWidget(new Wt::WText(Wt::WString(string_value, Wt::UTF8))); } if (EPHIDGET_OK == CPhidget_getSerialNumber(handle, &int_value)) { table->elementAt(row, 0)->addWidget(new Wt::WText(Wt::WString::tr("SerialNumber"))); table->elementAt(row++, 1)->addWidget(new Wt::WText(Wt::WString("{1}").arg(int_value))); } if (EPHIDGET_OK == CPhidget_getDeviceVersion(handle, &int_value)) { table->elementAt(row, 0)->addWidget(new Wt::WText(Wt::WString::tr("DeviceVersion"))); table->elementAt(row++, 1)->addWidget(new Wt::WText(Wt::WString("{1}").arg(int_value))); } if (EPHIDGET_OK == CPhidget_getDeviceStatus(handle, &int_value)) { table->elementAt(row, 0)->addWidget(new Wt::WText(Wt::WString::tr("DeviceStatus"))); table->elementAt(row++, 1)->addWidget(new Wt::WText(Wt::WString("{1}").arg(int_value))); } if (EPHIDGET_OK == CPhidget_getDeviceType(handle, &string_value)) { table->elementAt(row, 0)->addWidget(new Wt::WText(Wt::WString::tr("DeviceType"))); table->elementAt(row++, 1)->addWidget(new Wt::WText(Wt::WString(string_value, Wt::UTF8))); } if (EPHIDGET_OK == CPhidget_getDeviceLabel(handle, &string_value)) { table->elementAt(row, 0)->addWidget(new Wt::WText(Wt::WString::tr("DeviceLabel"))); table->elementAt(row++, 1)->addWidget(new Wt::WText(Wt::WString(string_value, Wt::UTF8))); } return tab_container; }
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8/////////9/////////A Wt::WWidget * WelcomeScreen::makeRegistrationTab() { Wt::WContainerWidget *cont = new Wt::WContainerWidget(); rg_txt_ = new Wt::WText("Hier koennen Sie ihr neues Flugbuch eroeffnen.", cont); cont->addWidget(new Wt::WBreak()); cont->addWidget(new Wt::WBreak()); Wt::WTable *layout = new Wt::WTable(cont); Wt::WLabel *usernameLabel = new Wt::WLabel("Benutzername: ", layout->elementAt(0, 0)); layout->elementAt(0, 0)->resize(Wt::WLength(14, Wt::WLength::FontEx), Wt::WLength()); rg_username_ = new Wt::WLineEdit(layout->elementAt(0, 1)); usernameLabel->setBuddy(rg_username_); Wt::WLabel *passwordLabel = new Wt::WLabel("Passwort: ", layout->elementAt(1, 0)); rg_password_ = new Wt::WLineEdit(layout->elementAt(1, 1)); rg_password_->setEchoMode(Wt::WLineEdit::Password); passwordLabel->setBuddy(rg_password_); Wt::WLabel *passwordLabel2 = new Wt::WLabel("wiederholen: ", layout->elementAt(2, 0)); rg_password2_ = new Wt::WLineEdit(layout->elementAt(2, 1)); rg_password2_->setEchoMode(Wt::WLineEdit::Password); rg_password2_->enterPressed().connect(SLOT(this, WelcomeScreen::doRegister)); passwordLabel2->setBuddy(rg_password2_); Wt::WLabel *stdflareas = new Wt::WLabel("Standardfluggebiete importieren: ", layout->elementAt(3, 0)); rg_useStdLoc_ = new Wt::WCheckBox(layout->elementAt(3, 1)); stdflareas->setBuddy(rg_useStdLoc_); Wt::WPushButton *LoginButton = new Wt::WPushButton("Registrieren", layout->elementAt(4, 1)); LoginButton->clicked().connect(SLOT( this, WelcomeScreen::doRegister)); return cont; }
Wt::WContainerWidget* WidgetsInterfaceKit::CreateWidget() { Wt::WContainerWidget* tab_container = new Wt::WContainerWidget(); Wt::WVBoxLayout* vbox = new Wt::WVBoxLayout(tab_container); Wt::WGroupBox* spesific_box = new Wt::WGroupBox(Wt::WString::tr("PhidgetInterfaceKit")); vbox->addWidget(spesific_box); Wt::WHBoxLayout* hbox = new Wt::WHBoxLayout(spesific_box); Wt::WTable* table = new Wt::WTable(); hbox->addWidget(table); table->columnAt(0)->setWidth(GetLeftColumnWidth()); table->columnAt(1)->setWidth(Wt::WLength::Auto); int row = 0; int i, int_value; bool ratiometric = true; /* Ratiometric */ table->elementAt(row, 0)->addWidget(new Wt::WText(Wt::WString::tr("Ratiometric"))); m_ratiometric_checkbox = new Wt::WCheckBox(); table->elementAt(row++, 1)->addWidget(m_ratiometric_checkbox); m_ratiometric_checkbox->changed().connect(boost::bind(&WidgetsInterfaceKit::OnWtRatiometricStateChanged, this, m_ratiometric_checkbox)); if (EPHIDGET_OK == CPhidgetInterfaceKit_getRatiometric(m_phidget->GetNativeHandle(), &int_value)) { ratiometric = (PTRUE == int_value); m_ratiometric_checkbox->setChecked(ratiometric); } /* Sensors */ if (EPHIDGET_OK == CPhidgetInterfaceKit_getSensorCount(m_phidget->GetNativeHandle(), &int_value)) { m_sensor_widget_array_length = int_value; m_sensor_widget_array = new SensorWidget*[m_sensor_widget_array_length]; for (i=0; i<m_sensor_widget_array_length; i++) { m_sensor_widget_array[i] = new SensorWidget(m_phidget, i, ratiometric); table->elementAt(row, 0)->addWidget(new Wt::WText(Wt::WString::tr("SensorArgs").arg(i))); table->elementAt(row++, 1)->addWidget(m_sensor_widget_array[i]->CreateWidget()); } } /* Input */ if (EPHIDGET_OK == CPhidgetInterfaceKit_getInputCount(m_phidget->GetNativeHandle(), &int_value)) { table->elementAt(row, 0)->addWidget(new Wt::WText(Wt::WString::tr("Input"))); Wt::WTable* input_table = new Wt::WTable(); table->elementAt(row++, 1)->addWidget(input_table); m_input_checkbox_array_length = int_value; m_input_checkbox_array = new Wt::WCheckBox*[m_input_checkbox_array_length]; for (i=0; i<m_input_checkbox_array_length; i++) { m_input_checkbox_array[i] = new Wt::WCheckBox(); Wt::WTableCell* cell = input_table->elementAt(0, i); cell->addWidget(m_input_checkbox_array[i]); cell->setContentAlignment(Wt::AlignCenter|Wt::AlignMiddle); cell = input_table->elementAt(1, i); cell->addWidget(new Wt::WText(Wt::WString::tr("GeneralArg").arg(i))); cell->setContentAlignment(Wt::AlignCenter|Wt::AlignMiddle); int input_state; if (EPHIDGET_OK == CPhidgetInterfaceKit_getInputState(m_phidget->GetNativeHandle(), i, &input_state)) { m_input_checkbox_array[i]->setChecked(PTRUE == input_state); } m_input_checkbox_array[i]->setEnabled(false); } } /* Output */ if (EPHIDGET_OK == CPhidgetInterfaceKit_getOutputCount(m_phidget->GetNativeHandle(), &int_value)) { table->elementAt(row, 0)->addWidget(new Wt::WText(Wt::WString::tr("Output"))); Wt::WTable* output_table = new Wt::WTable(); table->elementAt(row++, 1)->addWidget(output_table); m_output_checkbox_array_length = int_value; m_output_checkbox_array = new Wt::WCheckBox*[m_output_checkbox_array_length]; for (i=0; i<m_output_checkbox_array_length; i++) { m_output_checkbox_array[i] = new Wt::WCheckBox(); m_output_checkbox_array[i]->changed().connect(boost::bind(&WidgetsInterfaceKit::OnWtOutputStateChanged, this, m_output_checkbox_array[i])); Wt::WTableCell* cell = output_table->elementAt(0, i); cell->addWidget(m_output_checkbox_array[i]); cell->setContentAlignment(Wt::AlignCenter|Wt::AlignMiddle); cell = output_table->elementAt(1, i); cell->addWidget(new Wt::WText(Wt::WString::tr("GeneralArg").arg(i))); cell->setContentAlignment(Wt::AlignCenter|Wt::AlignMiddle); int output_state; if (EPHIDGET_OK == CPhidgetInterfaceKit_getOutputState(m_phidget->GetNativeHandle(), i, &output_state)) { m_output_checkbox_array[i]->setChecked(PTRUE == output_state); } } } Wt::WGroupBox* generic_box = new Wt::WGroupBox(Wt::WString::tr("Phidget (Common)")); vbox->addWidget(generic_box); generic_box->addWidget(WidgetsCommon::CreateWidget()); return tab_container; }
// Updates all ranks void RecentMatchesContainer::update() { this->clear(); std::vector<RecentMatch> recent_matches = Spartan_->getRecentMatches(); // Create halo api with an api key (get api key from 343i api site) //HaloAPI halo_api("05cdc66c52ca4465b0b6e3c56bb87b71"); for (int i = 0; i < recent_matches.size() && i < 10; i++) { // CUSTOM CONTAINERS Wt::WContainerWidget *myContainer = new Wt::WContainerWidget(); myContainer->decorationStyle().setBorder(Wt::WBorder(Wt::WBorder::Style::Solid, Wt::WBorder::Width::Thin, Wt::WColor(0, 0, 0))); myContainer->decorationStyle().setBackgroundColor(Wt::WColor(240, 240, 240)); myContainer->setPadding(3); myContainer->setMargin(3, Wt::Bottom); std::string title_string = "<b>" + getNameFromHopper(recent_matches[i].hopper_id_) + " / </b>" + getNameFromBaseVariant(recent_matches[i].base_variant_) + "<b> / </b>" + getNameFromMap(recent_matches[i].map_id_) + ""; Wt::WText *someText = new Wt::WText(title_string, myContainer); Wt::WPushButton *myButton = new Wt::WPushButton(" + ", myContainer); myButton->setFloatSide(Wt::Right); std::string game_time = time_from_double(recent_matches[i].match_length_); Wt::WText *someMoreText = new Wt::WText(game_time, myContainer); someMoreText->setFloatSide(Wt::Right); Wt::WStackedWidget *myStack = new Wt::WStackedWidget(myContainer); Wt::WText *text1 = new Wt::WText("text1", myStack); myButton->clicked().connect(std::bind([=]() { if (myStack->currentIndex() == 0) { myButton->setText(" - "); Wt::WContainerWidget *stats_table = new Wt::WContainerWidget(myStack); Wt::WTable *table = new Wt::WTable(stats_table); table->setHeaderCount(1); table->elementAt(0, 0)->addWidget(new Wt::WText("Gamertag")); HaloAPI halo_api("05cdc66c52ca4465b0b6e3c56bb87b71"); std::vector<std::string> gamertags; std::string json_data = halo_api.getPostGameCarnageArena(recent_matches[i].match_id_); Json::Value root; // will contains the root value after parsing. Json::Reader reader; bool parsingSuccessful = reader.parse( json_data, root ); if ( !parsingSuccessful ) { // report to the user the failure and their locations in the document. std::cout << "Failed to parse configuration\n" << reader.getFormattedErrorMessages(); } const Json::Value plugins = root; for (int j = 0; j < plugins["PlayerStats"].size(); j++) { std::string tag( plugins["PlayerStats"][j]["Player"]["Gamertag"].asString() ); gamertags.push_back(tag); table->elementAt(j+1, 0)->addWidget(new Wt::WText(tag)); } table->addStyleClass("table table-condensed"); myStack->setCurrentIndex(1); } else { delete myStack->currentWidget(); myStack->setCurrentIndex(0); myButton->setText(" + "); } })); this->addWidget(myContainer); } }
void ribi::gtst::ParticipantDialogStateGroupReAssign::ShowPage(ParticipantDialog * const dialog) { assert(dialog); assert(GetDialog()->CanGetParticipant() && "A Participant must be logged in in this state"); const boost::shared_ptr<const Participant>& participant = dialog->GetParticipant(); assert(GetDialog()->GetParticipant()->CanGetId() && "A Participant must be assigned an ID before entering this state"); const auto payoffs = participant->GetPayoffs(); const Group * const group = m_server->GetGroups()->FindMyGroup(participant); assert(group); //Create the widget(s) ui.m_label_status = new Wt::WLabel; ui.m_label_time_left = new Wt::WLabel; //Check the widget(s) assert(ui.m_label_status); assert(ui.m_label_time_left); dialog->addWidget(new Wt::WBreak); dialog->addWidget(new Wt::WBreak); dialog->addWidget(new Wt::WLabel("Group re-assign")); dialog->addWidget(new Wt::WBreak); dialog->addWidget(new Wt::WBreak); dialog->addWidget(ui.m_label_time_left); dialog->addWidget(new Wt::WBreak); dialog->addWidget(new Wt::WBreak); dialog->addWidget(new Wt::WLabel("This is the end of this period")); dialog->addWidget(new Wt::WBreak); dialog->addWidget(new Wt::WBreak); dialog->addWidget(new Wt::WLabel( (std::string("You are in group #") + std::to_string(group->GetId())).c_str())); dialog->addWidget(new Wt::WBreak); dialog->addWidget(new Wt::WLabel( (std::string("Your earnings in this period are ") + CurrencyToStr(payoffs->GetLast()->m_payoff) + std::string(" points")).c_str())); dialog->addWidget(new Wt::WBreak); dialog->addWidget(new Wt::WLabel( (std::string("Your total earnings are ") + CurrencyToStr(payoffs->GetTotal()) + std::string(" points")).c_str())); dialog->addWidget(new Wt::WBreak); dialog->addWidget(new Wt::WBreak); dialog->addWidget(new Wt::WLabel("Group average earnings:")); dialog->addWidget(new Wt::WBreak); dialog->addWidget(new Wt::WBreak); Wt::WTable * table = new Wt::WTable(dialog); const auto groups = m_server->GetGroups()->CollectGroups(false,false,true,false); std::for_each(groups.begin(),groups.end(), [&dialog,&table,this,group](const Group* const any_group) { assert(!any_group->GetAveragePayoffs().empty()); table->insertRow(0); table->elementAt(0,0)->addWidget(new Wt::WText( Wt::WString("Group {1}").arg(any_group->GetId()))); table->elementAt(0,1)->addWidget(new Wt::WText( Wt::WString("{1} points").arg( this->CurrencyToStr(any_group->GetAveragePayoffs().back())))); if (any_group == group) { table->elementAt(0,2)->addWidget(new Wt::WText("your group")); } } ); dialog->addWidget(new Wt::WBreak); dialog->addWidget(new Wt::WBreak); ServerStateGroupReAssign * const server_state = dynamic_cast<ServerStateGroupReAssign*>(m_server->GetStates()->GetCurrentState()); if (!server_state) { std::clog << __func__ << ": warning: no ServerStateGroupReAssign\n"; return; } const auto p = server_state->GetWorstAndBestGroup(); if (group == p.first) { //Worst if (p.second->GetSize() == 5) { dialog->addWidget(new Wt::WText("Your group has the lowest average earnings in this period")); dialog->addWidget(new Wt::WBreak); dialog->addWidget(new Wt::WText("and has been selected to <b>be eliminated from the experiment</b>")); } else { dialog->addWidget(new Wt::WText(Wt::WString("Group {1} has the highest average earnings in this period and has been selected to grow").arg(p.first->GetId()))); dialog->addWidget(new Wt::WBreak); dialog->addWidget(new Wt::WText(Wt::WString("This group grows from 3 to 5 members."))); dialog->addWidget(new Wt::WBreak); dialog->addWidget(new Wt::WText(Wt::WString("Your group <b>remains the same</b>"))); } } else if (group == p.second) { if (group->GetSize() == 5) { dialog->addWidget(new Wt::WText("Your group has the highest average earnings in this period")); dialog->addWidget(new Wt::WBreak); dialog->addWidget(new Wt::WText("and has been selected to <b>grow and split</b> into two groups.")); dialog->addWidget(new Wt::WBreak); dialog->addWidget(new Wt::WText("Your group first grows from 5 to 6 members, and then splits into two groups of three members.")); dialog->addWidget(new Wt::WBreak); dialog->addWidget(new Wt::WText("Your group in the next period will be one of those two groups")); } else { dialog->addWidget(new Wt::WText("Your group has the highest average earnings in this period and has been selected to <b>grow</b>")); dialog->addWidget(new Wt::WBreak); dialog->addWidget(new Wt::WText("Your group grows from 3 to 5 members")); } } else { if (p.second->GetSize() == 3) { //Best group grows dialog->addWidget(new Wt::WText(Wt::WString("Group {1} has the highest average earnings in this period and has been selected to grow").arg(p.first->GetId()))); dialog->addWidget(new Wt::WBreak); dialog->addWidget(new Wt::WText(Wt::WString("This group grows from 3 to 5 members."))); dialog->addWidget(new Wt::WBreak); dialog->addWidget(new Wt::WText(Wt::WString("Your group <b>remains the same</b>"))); } else { //Best group splits, worst dies dialog->addWidget(new Wt::WText(Wt::WString("Group {1} has the highest average earnings in this period").arg(p.second->GetId()))); dialog->addWidget(new Wt::WBreak); dialog->addWidget(new Wt::WText("and has been selected to grow and split into two groups.")); dialog->addWidget(new Wt::WBreak); dialog->addWidget(new Wt::WText(Wt::WString("Group {1} has the lowest average earnings in this period").arg(p.first->GetId()))); dialog->addWidget(new Wt::WBreak); dialog->addWidget(new Wt::WText("and has been selected to be eliminated from the experiment.")); dialog->addWidget(new Wt::WBreak); dialog->addWidget(new Wt::WText(Wt::WString("Your group <b>remains the same</b>"))); } } dialog->addWidget(new Wt::WBreak); dialog->addWidget(new Wt::WBreak); if (group == p.first && p.second->GetSize() == 5) { //A dead Participant :3 dialog->addWidget(new Wt::WLabel("For you, this experiment ends now")); } else { //A survivor #define TEMP_DEBUG_215487632492487527652376428 #ifdef TEMP_DEBUG_215487632492487527652376428 if(!dynamic_cast<const PayoffReAssign*>(payoffs->GetLast().get())) { TRACE(group->GetId()); TRACE(participant->GetId()); } #endif assert(dynamic_cast<const PayoffReAssign*>(payoffs->GetLast().get())); dialog->addWidget(new Wt::WLabel( Wt::WString("You earn {1} points for reaching the next period").arg( CurrencyToStr(payoffs->GetLast()->m_payoff)))); } }
void SimpleWebWidget::login() { clear(); btnGroundPower_ = new Wt::WPushButton("Ground Power\nconnect/disconnect"); btnGroundAir_ = new Wt::WPushButton("Ground Air\n connect/disconnect"); btnDoor1_ = new Wt::WPushButton("Open/Close\n Door1"); btnDoor2_ = new Wt::WPushButton("Open/Close\n Door2"); btnDoor3_ = new Wt::WPushButton("Open/Close\n Door3"); btnPushBack1_ = new Wt::WPushButton("Start Pushback\nTail Left"); btnPushBack2_ = new Wt::WPushButton("Start Pushback\nStraight"); btnPushBack3_ = new Wt::WPushButton("Start Pushback\nTail Right"); btnPushBack4_ = new Wt::WPushButton("STOP\nPushBack"); btnVirtualKey1_ = new Wt::WPushButton("Send 1"); btnVirtualKey2_ = new Wt::WPushButton("Send 2"); btnVirtualKey3_ = new Wt::WPushButton("Send 3"); btnVirtualKey4_ = new Wt::WPushButton("Send 4"); btnVirtualKey5_ = new Wt::WPushButton("Send 5"); btnVirtualKey6_ = new Wt::WPushButton("Send 6"); btnVirtualKey7_ = new Wt::WPushButton("Send 7"); btnVirtualKey8_ = new Wt::WPushButton("Send 8"); btnVirtualKey9_ = new Wt::WPushButton("Send 9"); btnVirtualKey0_ = new Wt::WPushButton("Send 0"); btnVirtualKeyF12_ = new Wt::WPushButton("Send F12"); txtWxrDep = new Wt::WText("DEPARTURE AIRPORT IS NOT SET"); txtWxrTafDep = new Wt::WText("DEPARTURE AIRPORT IS NOT SET"); txtWxrArr = new Wt::WText("ARRIVAL AIRPORT IS NOT SET"); txtWxrTafArr = new Wt::WText("ARRIVAL AIRPORT IS NOT SET"); txtGSXText = new Wt::WText(""); btnGroundPower_->setStyleClass("btn-danger"); btnGroundAir_->setStyleClass("btn-danger"); btnDoor1_->setStyleClass("btn-danger"); btnDoor2_->setStyleClass("btn-danger"); btnDoor3_->setStyleClass("btn-danger"); btnPushBack1_->setStyleClass("btn-danger"); btnPushBack2_->setStyleClass("btn-danger"); btnPushBack3_->setStyleClass("btn-danger"); btnPushBack4_->setStyleClass("btn-danger"); dialog = new Wt::WDialog("No connection"); Wt::WLabel *label = new Wt::WLabel("Waiting for simulator connection with iFly 737NG", dialog->contents()); Wt::WNavigationBar *navigation = new Wt::WNavigationBar(); Wt::WStackedWidget *contentsStack = new Wt::WStackedWidget(); Wt::WContainerWidget *groundContainer = new Wt::WContainerWidget(); Wt::WContainerWidget *weatherContainer = new Wt::WContainerWidget(); Wt::WContainerWidget *mapContainer = new Wt::WContainerWidget(); Wt::WContainerWidget *infoContainer = new Wt::WContainerWidget(); Wt::WContainerWidget *gsxContainer = new Wt::WContainerWidget(); Wt::WContainerWidget *statusContainer = new Wt::WContainerWidget(); Wt::WVBoxLayout *mainVLayout = new WVBoxLayout(); setLayout(mainVLayout); // Create a navigation bar with a link to a web page. navigation->setTitle("737ng.kapsi.fi", "http://737ng.kapsi.fi"); navigation->setResponsive(true); // Setup a Left-aligned menu. contentsStack->addStyleClass("contents"); Wt::WMenu *leftMenu = new Wt::WMenu(contentsStack); navigation->addMenu(leftMenu); leftMenu->addItem("Ground", groundContainer); leftMenu->addItem("Weather", weatherContainer); leftMenu->addItem("Map", mapContainer); leftMenu->addItem("Info", infoContainer); leftMenu->addItem("GSX", gsxContainer); mainVLayout->addWidget(navigation, 0); mainVLayout->addWidget(contentsStack, 1); mainVLayout->addWidget(statusContainer, 0); Wt::WGroupBox *groundBox = new Wt::WGroupBox("Ground Equipment"); groundBox->addStyleClass("fieldset-header"); groundBox->addWidget(btnGroundPower_); groundBox->addWidget(btnGroundAir_); groundContainer->addWidget(groundBox); Wt::WGroupBox *doorBox = new Wt::WGroupBox("Aircraft Doors"); doorBox->addStyleClass("fieldset-header"); doorBox->addWidget(btnDoor1_); doorBox->addWidget(btnDoor2_); doorBox->addWidget(btnDoor3_); groundContainer->addWidget(doorBox); Wt::WGroupBox *pushBox = new Wt::WGroupBox("Default Pushback"); pushBox->addStyleClass("fieldset-header"); pushBox->addWidget(btnPushBack1_); pushBox->addWidget(btnPushBack2_); pushBox->addWidget(btnPushBack3_); pushBox->addWidget(new WBreak()); pushBox->addWidget(new WBreak()); pushBox->addWidget(btnPushBack4_); groundContainer->addWidget(pushBox); Wt::WGroupBox *wxrDepMetarBox = new Wt::WGroupBox("Departure Metar"); Wt::WGroupBox *wxrDepTafBox = new Wt::WGroupBox("Departure TAF"); Wt::WGroupBox *wxrArrMetarBox = new Wt::WGroupBox("Arrival Metar"); Wt::WGroupBox *wxrArrTafBox = new Wt::WGroupBox("Arrival TAF"); wxrDepMetarBox->addStyleClass("fieldset-header"); wxrDepTafBox->addStyleClass("fieldset-header"); wxrArrMetarBox->addStyleClass("fieldset-header"); wxrArrTafBox->addStyleClass("fieldset-header"); wxrDepMetarBox->addWidget(txtWxrDep); wxrDepTafBox->addWidget(txtWxrTafDep); wxrArrMetarBox->addWidget(txtWxrArr); wxrArrTafBox->addWidget(txtWxrTafArr); weatherContainer->addWidget(wxrDepMetarBox); weatherContainer->addWidget(wxrDepTafBox); weatherContainer->addWidget(wxrArrMetarBox); weatherContainer->addWidget(wxrArrTafBox); // Map tab //Google map test. No key needed for localhost. map = new Wt::WGoogleMap(Wt::WGoogleMap::Version3); map->setMapTypeControl(Wt::WGoogleMap::DefaultControl); map->enableScrollWheelZoom(); // settings here Wt::WFitLayout* mapBoxLayout = new Wt::WFitLayout(); mapContainer->setLayout(mapBoxLayout); Wt::WGroupBox *mapBox = new Wt::WGroupBox("Map"); mapBox->addStyleClass("fieldset-header"); mapBoxLayout->addWidget(mapBox); Wt::WFitLayout* mapLayout = new Wt::WFitLayout(); mapBox->setLayout(mapLayout); mapLayout->addWidget(map); // Flight info data tab starts here Wt::WContainerWidget *infoFirstRowContainer = new Wt::WContainerWidget(); Wt::WHBoxLayout *infoFirstRowHLayout = new WHBoxLayout(); infoFirstRowContainer->setLayout(infoFirstRowHLayout); Wt::WContainerWidget *infoSecondRowContainer = new Wt::WContainerWidget(); Wt::WHBoxLayout *infoSecondRowHLayout = new WHBoxLayout(); infoSecondRowContainer->setLayout(infoSecondRowHLayout); infoContainer->addWidget(infoFirstRowContainer); infoContainer->addWidget(infoSecondRowContainer); // infobox with flight no and dep and arr icao codes if available txtAlt = new Wt::WText("32013"); txtSpeed = new Wt::WText("450"); txtTemperature = new Wt::WText("-55"); txtOnGround = new Wt::WText("Yes/No"); Wt::WContainerWidget *flightInfoContainer1 = new Wt::WContainerWidget(); Wt::WContainerWidget *flightInfoContainer2 = new Wt::WContainerWidget(); Wt::WContainerWidget *flightInfoContainer3 = new Wt::WContainerWidget(); Wt::WContainerWidget *flightInfoContainer4 = new Wt::WContainerWidget(); flightInfoContainer1->addWidget(new Wt::WText("Alt: ")); flightInfoContainer1->addWidget(new WBreak()); flightInfoContainer1->addWidget(new Wt::WText("Speed: ")); flightInfoContainer2->addWidget(txtAlt); flightInfoContainer2->addWidget(new WBreak()); flightInfoContainer2->addWidget(txtSpeed); flightInfoContainer3->addWidget(new Wt::WText("Temp: ")); flightInfoContainer3->addWidget(new WBreak()); flightInfoContainer3->addWidget(new Wt::WText("On ground: ")); flightInfoContainer4->addWidget(txtTemperature); flightInfoContainer4->addWidget(new WBreak()); flightInfoContainer4->addWidget(txtOnGround); Wt::WHBoxLayout *flightInfoHLayout = new WHBoxLayout(); flightInfoHLayout->addWidget(flightInfoContainer1); flightInfoHLayout->addWidget(flightInfoContainer2); flightInfoHLayout->addWidget(flightInfoContainer3); flightInfoHLayout->addWidget(flightInfoContainer4); Wt::WContainerWidget *flightInfoContainer = new Wt::WContainerWidget(); flightInfoContainer->setLayout(flightInfoHLayout); infoBox = new Wt::WGroupBox(" ( - )"); infoBox->addStyleClass("fieldset-header"); infoBox->addWidget(flightInfoContainer); // OOOI box with out off on in times if available txtOut = new Wt::WText("00:00"); txtOff = new Wt::WText("00:00"); txtOn = new Wt::WText("00:00"); txtIn = new Wt::WText("00:00"); Wt::WContainerWidget *oooiContainer1 = new Wt::WContainerWidget(); Wt::WContainerWidget *oooiContainer2 = new Wt::WContainerWidget(); Wt::WContainerWidget *oooiContainer3 = new Wt::WContainerWidget(); Wt::WContainerWidget *oooiContainer4 = new Wt::WContainerWidget(); oooiContainer1->addWidget(new Wt::WText("Out: ")); oooiContainer1->addWidget(new WBreak()); oooiContainer1->addWidget(new Wt::WText("Off: ")); oooiContainer2->addWidget(txtOut); oooiContainer2->addWidget(new WBreak()); oooiContainer2->addWidget(txtOff); oooiContainer3->addWidget(new Wt::WText("On: ")); oooiContainer3->addWidget(new WBreak()); oooiContainer3->addWidget(new Wt::WText("In: ")); oooiContainer4->addWidget(txtOn); oooiContainer4->addWidget(new WBreak()); oooiContainer4->addWidget(txtIn); Wt::WHBoxLayout *oooiHLayout = new WHBoxLayout(); oooiHLayout->addWidget(oooiContainer1); oooiHLayout->addWidget(oooiContainer2); oooiHLayout->addWidget(oooiContainer3); oooiHLayout->addWidget(oooiContainer4); Wt::WContainerWidget *oooiContainer = new Wt::WContainerWidget(); oooiContainer->setLayout(oooiHLayout); Wt::WGroupBox *oooiBox = new Wt::WGroupBox("OOOI"); oooiBox->addStyleClass("fieldset-header"); oooiBox->addWidget(oooiContainer); // Destination box txtDestinationDTG = new Wt::WText("345"); txtDestinationETA = new Wt::WText("23:59:03"); txtDestinationFuel = new Wt::WText("2900"); Wt::WContainerWidget *destinationContainer1 = new Wt::WContainerWidget(); Wt::WContainerWidget *destinationContainer2 = new Wt::WContainerWidget(); Wt::WContainerWidget *destinationContainer3 = new Wt::WContainerWidget(); Wt::WContainerWidget *destinationContainer4 = new Wt::WContainerWidget(); destinationContainer1->addWidget(new Wt::WText("ETA: ")); destinationContainer1->addWidget(new WBreak()); destinationContainer1->addWidget(new Wt::WText("DTG: ")); destinationContainer2->addWidget(txtDestinationETA); destinationContainer2->addWidget(new WBreak()); destinationContainer2->addWidget(txtDestinationDTG); destinationContainer3->addWidget(new Wt::WText("Fuel: ")); destinationContainer4->addWidget(txtDestinationFuel); Wt::WHBoxLayout *destinationHLayout = new WHBoxLayout(); destinationHLayout->addWidget(destinationContainer1); destinationHLayout->addWidget(destinationContainer2); destinationHLayout->addWidget(destinationContainer3); destinationHLayout->addWidget(destinationContainer4); Wt::WContainerWidget *destinationContainer = new Wt::WContainerWidget(); destinationContainer->setLayout(destinationHLayout); Wt::WGroupBox *destinationBox = new Wt::WGroupBox("Destination"); destinationBox->addStyleClass("fieldset-header"); destinationBox->addWidget(destinationContainer); // Last waypoint box Wt::WContainerWidget *lastWptContainer1 = new Wt::WContainerWidget(); Wt::WContainerWidget *lastWptContainer2 = new Wt::WContainerWidget(); txtLastName = new Wt::WText("ROVIL"); txtLastAlt = new Wt::WText("FL280"); txtLastATA = new Wt::WText("20:38:51"); txtLastFuel = new Wt::WText("4300"); lastWptContainer1->addWidget(new Wt::WText("Name: ")); lastWptContainer1->addWidget(new WBreak()); lastWptContainer1->addWidget(new Wt::WText("ATA: ")); lastWptContainer1->addWidget(new WBreak()); lastWptContainer1->addWidget(new Wt::WText("Fuel: ")); lastWptContainer1->addWidget(new WBreak()); lastWptContainer1->addWidget(new Wt::WText("Alt: ")); lastWptContainer2->addWidget(txtLastName); lastWptContainer2->addWidget(new WBreak()); lastWptContainer2->addWidget(txtLastATA); lastWptContainer2->addWidget(new WBreak()); lastWptContainer2->addWidget(txtLastFuel); lastWptContainer2->addWidget(new WBreak()); lastWptContainer2->addWidget(txtLastAlt); Wt::WHBoxLayout *lastWptHLayout = new WHBoxLayout(); lastWptHLayout->addWidget(lastWptContainer1); lastWptHLayout->addWidget(lastWptContainer2); Wt::WContainerWidget *lastWpContainer = new Wt::WContainerWidget(); lastWpContainer->setLayout(lastWptHLayout); Wt::WGroupBox *progressLastBox = new Wt::WGroupBox("Last WPT"); progressLastBox->addStyleClass("fieldset-header"); progressLastBox->addWidget(lastWpContainer); // Actual waypoint box Wt::WContainerWidget *actWpContainer1 = new Wt::WContainerWidget(); Wt::WContainerWidget *actWpContainer2 = new Wt::WContainerWidget(); txtActName = new Wt::WText("TESTI"); txtActETA = new Wt::WText("20:48:32"); txtActFuel = new Wt::WText("4000"); txtActDTG = new Wt::WText("23"); actWpContainer1->addWidget(new Wt::WText("Name: ")); actWpContainer1->addWidget(new WBreak()); actWpContainer1->addWidget(new Wt::WText("ETA: ")); actWpContainer1->addWidget(new WBreak()); actWpContainer1->addWidget(new Wt::WText("Fuel: ")); actWpContainer1->addWidget(new WBreak()); actWpContainer1->addWidget(new Wt::WText("DTG: ")); actWpContainer2->addWidget(txtActName); actWpContainer2->addWidget(new WBreak()); actWpContainer2->addWidget(txtActETA); actWpContainer2->addWidget(new WBreak()); actWpContainer2->addWidget(txtActFuel); actWpContainer2->addWidget(new WBreak()); actWpContainer2->addWidget(txtActDTG); Wt::WHBoxLayout *actWptHLayout = new WHBoxLayout(); actWptHLayout->addWidget(actWpContainer1); actWptHLayout->addWidget(actWpContainer2); Wt::WContainerWidget *actWpContainer = new Wt::WContainerWidget(); actWpContainer->setLayout(actWptHLayout); Wt::WGroupBox *progressActBox = new Wt::WGroupBox("Actual WPT"); progressActBox->addStyleClass("fieldset-header"); progressActBox->addWidget(actWpContainer); // Next Waypoint Box Wt::WContainerWidget *nextWpContainer1 = new Wt::WContainerWidget(); Wt::WContainerWidget *nextWpContainer2 = new Wt::WContainerWidget(); txtNextName = new Wt::WText("FIXME"); txtNextETA = new Wt::WText("21:02:22"); txtNextFuel = new Wt::WText("3700"); txtNextDTG = new Wt::WText("46"); nextWpContainer1->addWidget(new Wt::WText("Name: ")); nextWpContainer1->addWidget(new WBreak()); nextWpContainer1->addWidget(new Wt::WText("ETA: ")); nextWpContainer1->addWidget(new WBreak()); nextWpContainer1->addWidget(new Wt::WText("Fuel: ")); nextWpContainer1->addWidget(new WBreak()); nextWpContainer1->addWidget(new Wt::WText("DTG: ")); nextWpContainer2->addWidget(txtNextName); nextWpContainer2->addWidget(new WBreak()); nextWpContainer2->addWidget(txtNextETA); nextWpContainer2->addWidget(new WBreak()); nextWpContainer2->addWidget(txtNextFuel); nextWpContainer2->addWidget(new WBreak()); nextWpContainer2->addWidget(txtNextDTG); Wt::WHBoxLayout *nextWptHLayout = new WHBoxLayout(); nextWptHLayout->addWidget(nextWpContainer1); nextWptHLayout->addWidget(nextWpContainer2); Wt::WContainerWidget *nextWpContainer = new Wt::WContainerWidget(); nextWpContainer->setLayout(nextWptHLayout); Wt::WGroupBox *progressNextBox = new Wt::WGroupBox("Next WPT"); progressNextBox->addStyleClass("fieldset-header"); progressNextBox->addWidget(nextWpContainer); // add groupboxes to Layouts infoFirstRowHLayout->addWidget(infoBox); infoFirstRowHLayout->addWidget(oooiBox); infoFirstRowHLayout->addWidget(destinationBox); infoSecondRowHLayout->addWidget(progressLastBox); infoSecondRowHLayout->addWidget(progressActBox); infoSecondRowHLayout->addWidget(progressNextBox); // GSX tab starts here gsxBox = new Wt::WGroupBox("GSX Menu"); gsxBox->addStyleClass("fieldset-header"); gsxContainer->addWidget(gsxBox); Wt::WTable* gsxTable = new Wt::WTable(); gsxTable->setWidth(Wt::WLength("100%")); btnVirtualKeyF12_->addStyleClass("buttongsx"); btnVirtualKey1_->addStyleClass("buttongsx"); btnVirtualKey2_->addStyleClass("buttongsx"); btnVirtualKey3_->addStyleClass("buttongsx"); btnVirtualKey4_->addStyleClass("buttongsx"); btnVirtualKey5_->addStyleClass("buttongsx"); btnVirtualKey6_->addStyleClass("buttongsx"); btnVirtualKey7_->addStyleClass("buttongsx"); btnVirtualKey8_->addStyleClass("buttongsx"); btnVirtualKey9_->addStyleClass("buttongsx"); btnVirtualKey0_->addStyleClass("buttongsx"); btnVirtualKey1_->hide(); btnVirtualKey2_->hide(); btnVirtualKey3_->hide(); btnVirtualKey4_->hide(); btnVirtualKey5_->hide(); btnVirtualKey6_->hide(); btnVirtualKey7_->hide(); btnVirtualKey8_->hide(); btnVirtualKey9_->hide(); btnVirtualKey0_->hide(); gsxTable->elementAt(0, 0)->addWidget(btnVirtualKey1_); gsxTable->elementAt(0, 1)->addWidget(btnVirtualKey6_); gsxTable->elementAt(1, 0)->addWidget(btnVirtualKey2_); gsxTable->elementAt(1, 1)->addWidget(btnVirtualKey7_); gsxTable->elementAt(2, 0)->addWidget(btnVirtualKey3_); gsxTable->elementAt(2, 1)->addWidget(btnVirtualKey8_); gsxTable->elementAt(3, 0)->addWidget(btnVirtualKey4_); gsxTable->elementAt(3, 1)->addWidget(btnVirtualKey9_); gsxTable->elementAt(4, 0)->addWidget(btnVirtualKey5_); gsxTable->elementAt(4, 1)->addWidget(btnVirtualKey0_); gsxTable->elementAt(6, 0)->addWidget(btnVirtualKeyF12_); gsxBox->addWidget(gsxTable); // Bottom statuscontaier with GSX text txtGSXText->addStyleClass("gsxtext"); statusContainer->addWidget(txtGSXText); // Bind the C++ and JavaScript event handlers. btnGroundPower_->clicked().connect(this, &SimpleWebWidget::pressedGroundPower); btnGroundAir_->clicked().connect(this, &SimpleWebWidget::pressedGroundAir); btnDoor1_->clicked().connect(this, &SimpleWebWidget::pressedButtonDoor1); btnDoor2_->clicked().connect(this, &SimpleWebWidget::pressedButtonDoor2); btnDoor3_->clicked().connect(this, &SimpleWebWidget::pressedButtonDoor3); btnPushBack1_->clicked().connect(this, &SimpleWebWidget::pressedPushBack1); btnPushBack2_->clicked().connect(this, &SimpleWebWidget::pressedPushBack2); btnPushBack3_->clicked().connect(this, &SimpleWebWidget::pressedPushBack3); btnPushBack4_->clicked().connect(this, &SimpleWebWidget::pressedPushBack4); btnVirtualKey1_->clicked().connect(this, &SimpleWebWidget::pressedVirtualKey1); btnVirtualKey2_->clicked().connect(this, &SimpleWebWidget::pressedVirtualKey2); btnVirtualKey3_->clicked().connect(this, &SimpleWebWidget::pressedVirtualKey3); btnVirtualKey4_->clicked().connect(this, &SimpleWebWidget::pressedVirtualKey4); btnVirtualKey5_->clicked().connect(this, &SimpleWebWidget::pressedVirtualKey5); btnVirtualKey6_->clicked().connect(this, &SimpleWebWidget::pressedVirtualKey6); btnVirtualKey7_->clicked().connect(this, &SimpleWebWidget::pressedVirtualKey7); btnVirtualKey8_->clicked().connect(this, &SimpleWebWidget::pressedVirtualKey8); btnVirtualKey9_->clicked().connect(this, &SimpleWebWidget::pressedVirtualKey9); btnVirtualKey0_->clicked().connect(this, &SimpleWebWidget::pressedVirtualKey0); btnVirtualKeyF12_->clicked().connect(this, &SimpleWebWidget::pressedVirtualKeyF12); // setup a timer which calls MyClass::timeout() every 60 seconds, until timer->stop() is called. Wt::WTimer *timer = new Wt::WTimer(); timer->setInterval(60000); timer->timeout().connect(this, &SimpleWebWidget::timerTimeout); timer->start(); connect(); }