Пример #1
0
void
WFunctionSummary::init() {
    Wt::WVBoxLayout *vbox = new Wt::WVBoxLayout;
    this->setLayout(vbox);

    analyzers().push_back(FunctionEntryAddress::instance());
    analyzers().push_back(FunctionName::instance());
    analyzers().push_back(FunctionSizeBytes::instance());
    analyzers().push_back(FunctionSizeInsns::instance());
    analyzers().push_back(FunctionSizeBBlocks::instance());
    analyzers().push_back(FunctionSizeDBlocks::instance());
    analyzers().push_back(FunctionNDiscontiguousBlocks::instance());
    analyzers().push_back(FunctionNIntervals::instance());
    analyzers().push_back(FunctionImported::instance());
    analyzers().push_back(FunctionExported::instance());
    analyzers().push_back(FunctionNCallers::instance());
    analyzers().push_back(FunctionNReturns::instance());
    analyzers().push_back(FunctionMayReturn::instance());
    analyzers().push_back(FunctionStackDelta::instance());

    // Build a table to hold analysis results. The results will be organized into NCOLS each occupying two table columns (one
    // for the name and one for the value).
    const size_t NROWS = (analyzers_.size() + NCOLS - 1) / NCOLS;
    wAnalysisResultTable_ = new Wt::WTable();
    vbox->addWidget(wAnalysisResultTable_);

    Wt::WCssDecorationStyle labelDecor;
    labelDecor.setBackgroundColor(toWt(Color::HSV(0, 0, 0.95)));
    for (size_t col=0, i=0; col<NCOLS && i<analyzers_.size(); ++col) {
        for (size_t row=0; row<NROWS && i<analyzers_.size(); ++row) {
            Wt::WText *wLabel = new Wt::WText("<b>" + analyzers_[i]->name() + "</b>");
            wLabel->setToolTip(analyzers_[i]->toolTip());
            wAnalysisResultTable_->elementAt(row, 2*col+0)->addWidget(wLabel);
            wAnalysisResultTable_->elementAt(row, 2*col+0)->setContentAlignment(Wt::AlignRight);
            wAnalysisResultTable_->elementAt(row, 2*col+0)->setDecorationStyle(labelDecor);

            Wt::WText *wValue = new Wt::WText;
            wValue->setTextFormat(Wt::PlainText);
            analyzerResults_.push_back(wValue);
            analyzerResults_.back()->setToolTip(analyzers_[i]->toolTip());
            wAnalysisResultTable_->elementAt(row, 2*col+1)->addWidget(analyzerResults_.back());
            wAnalysisResultTable_->elementAt(row, 2*col+1)->setPadding(Wt::WLength(1, Wt::WLength::FontEm), Wt::Left);
            wAnalysisResultTable_->elementAt(row, 2*col+1)->setPadding(Wt::WLength(10, Wt::WLength::FontEm), Wt::Right);
            ++i;
        }
    }

    // Text area to hold function comments
    wFunctionComments_ = new Wt::WTextArea;
    vbox->addWidget(wFunctionComments_, 1 /*stretch*/);

    // FIXME[Robb P. Matzke 2015-05-06]: We don't provide a way to save results yet, so don't allow comment editing
    wFunctionComments_->setEnabled(false);
}
Пример #2
0
		AddFriendDialog(RsPeers *mp) : mPeers(mp)
	{
		Wt::WVBoxLayout *layout = new Wt::WVBoxLayout ;
		contents()->setLayout(layout) ;

		// add a text box to paste the certificate into
		_cert_area = new Wt::WTextArea(contents()) ;
		_cert_area->setEmptyText("Paste a Retroshare certificate here to make friend with someone.") ;
		_cert_area->setMinimumSize(560,300) ;
		layout->addWidget(_cert_area,1) ;

		_cert_area->changed().connect(this,&AddFriendDialog::updateCertInfo) ;

		// add a text label to display the info
	Wt::WString str ;
	str += "Not a valid certificate<br/>" ;
	str += "<b>Name</b>   \t\t: <br/>" ;
	str += "<b>PGP id</b> \t\t: <br/>" ;
	str += "<b>PGP fingerprint</b> \t: <br/>" ;
	str += "<b>Location name  </b> \t: <br/>" ;
	str += "<b>Location ID    </b> \t: <br/>" ;

		_info_label = new Wt::WLabel(str,contents()) ;
		_info_label->setMinimumSize(128,0) ;

		layout->addWidget(_info_label) ;

		// add buttons 'make friend', 'only add to keyring', 'cancel'

		Wt::WHBoxLayout *lay2 = new Wt::WHBoxLayout;

		_ok_bnt = new Wt::WPushButton("Make friend", contents());
		lay2->addWidget(_ok_bnt) ;
		_ok_bnt->clicked().connect(this, &AddFriendDialog::makeFriend);
		_ok_bnt->setEnabled(false) ;

		Wt::WPushButton *cn_bnt = new Wt::WPushButton("Cancel", contents());
		lay2->addWidget(cn_bnt) ;
		cn_bnt->clicked().connect(this, &Wt::WDialog::reject);

		lay2->addStretch() ;

		layout->addLayout(lay2) ;
		layout->addSpacing(0);

		_timer = new Wt::WTimer(this) ;
		_timer->setInterval(1000) ;
		_timer->timeout().connect(this,&AddFriendDialog::updateCertInfo) ;
		_timer->start() ;

		setMinimumSize(620,300) ;
		//resize() ;
	}
Пример #3
0
void
WHexDump::init() {
    Wt::WVBoxLayout *vbox = new Wt::WVBoxLayout;
    setLayout(vbox);

    Wt::WContainerWidget *actionsBox = new Wt::WContainerWidget;
    vbox->addWidget(actionsBox);
    {
        new Wt::WText("Goto: ", actionsBox);
        wAddressEdit_ = new Wt::WLineEdit(actionsBox);
        wAddressEdit_->enterPressed().connect(this, &WHexDump::handleGoto);

        new Wt::WBreak(actionsBox);
        new Wt::WText("Search: ", actionsBox);
        wSearchEdit_ = new Wt::WLineEdit(actionsBox);
        wSearchEdit_->keyPressed().connect(this, &WHexDump::resetSearch);
        wSearchNext_ = new Wt::WPushButton("Find", actionsBox);
        wSearchNext_->clicked().connect(this, &WHexDump::handleSearch);
        wSearchResults_ = new Wt::WText("Enter a big-endian hexadecimal value", actionsBox);
        
    }

    Wt::WContainerWidget *tableContainer = new Wt::WContainerWidget;
    vbox->addWidget(tableContainer, 1 /*stretch*/);
    Wt::WHBoxLayout *hbox = new Wt::WHBoxLayout;        // so the table scrolls horizontally
    tableContainer->setLayout(hbox);

    model_ = new HexDumpModel;

    tableView_ = new Wt::WTableView;
    tableView_->setModel(model_);
    tableView_->setRowHeaderCount(1);                   // this must be first property set
    tableView_->setHeaderHeight(28);
    tableView_->setSortingEnabled(false);
    tableView_->setAlternatingRowColors(false);         // true interferes with our blacking out unmapped addresses
    tableView_->setColumnResizeEnabled(true);
    tableView_->setSelectionMode(Wt::SingleSelection);
    tableView_->setEditTriggers(Wt::WAbstractItemView::NoEditTrigger);
    tableView_->setColumnWidth(addressColumn, Wt::WLength(6, Wt::WLength::FontEm));
    tableView_->setColumnWidth(sep1Column, Wt::WLength(1, Wt::WLength::FontEm));
    tableView_->setColumnWidth(sep2Column, Wt::WLength(1, Wt::WLength::FontEm));
    for (size_t i=0; i<bytesPerRow; ++i) {
        int extra = 7==i%8 && i+1<bytesPerRow ? 1 : 0;
        tableView_->setColumnWidth(bytesColumn + i, Wt::WLength(2+extra, Wt::WLength::FontEm));
        tableView_->setColumnWidth(asciiColumn + i, Wt::WLength(2+extra, Wt::WLength::FontEm));
    }
    tableView_->clicked().connect(boost::bind(&WHexDump::handleClick, this, _1));
    hbox->addWidget(tableView_);
}
Пример #4
0
void RSWappFriendsPage::showFriendDetails(const std::string& friend_id)
{
	RsPeerDetails info ;

	if(!mPeers->getPeerDetails(friend_id,info))
	{
		std::cerr << "Can't get file details for friend " << friend_id << std::endl;
		return ;
	}

#ifdef DEBUG_FRIENDSPAGE	
	std::cerr << "Showing peer details: " << std::endl;
	std::cerr << info << std::endl;
#endif

	Wt::WDialog dialog ;
	dialog.setModal(false) ;

	Wt::WVBoxLayout *layout = new Wt::WVBoxLayout ;
	dialog.contents()->setLayout(layout) ;

	Wt::WHBoxLayout *layout2 = new Wt::WHBoxLayout ;
	Wt::WImage *img = new Wt::WImage(_model->getAvatarUrl(friend_id),dialog.contents());

	img->setMinimumSize(128,128) ;
	img->setMaximumSize(128,128) ;

	layout2->addWidget(img) ;
	layout2->addStretch() ;

	layout->addLayout(layout2,1) ;

	Wt::WString str ;
	str += "<br/>" ;
	str += "<b>Name</b>   \t\t: " + info.name + "<br/>" ;
	str += "<b>PGP id</b> \t\t: " + info.gpg_id + "<br/>" ;
	str += "<b>PGP fingerprint</b> \t: " + info.fpr + "<br/>" ;
	str += "<b>Location name  </b> \t: " + info.location + "<br/>" ;
	str += "<b>Location ID    </b> \t: " + info.id + "<br/>" ;

	layout->addWidget(new Wt::WLabel(str,dialog.contents())) ;

	Wt::WPushButton ok("Ok", dialog.contents());
	layout->addWidget(&ok) ;

	ok.clicked().connect(&dialog, &Wt::WDialog::accept);

	dialog.exec() ;
}
Пример #5
0
Tester::Tester(const Wt::WEnvironment& env)
    : Wt::WApplication(env)
{

    setTheme(new Wt::WBootstrapTheme());
    useStyleSheet("resources/lpeg_tester.css");

    Wt::WContainerWidget* container = new Wt::WContainerWidget();
    container->setStyleClass("page");

    Wt::WVBoxLayout* vbox = new Wt::WVBoxLayout();
    container->setLayout(vbox);

    vbox->addWidget(Title(), 1);

    Wt::WHBoxLayout* hbox = new Wt::WHBoxLayout();
    vbox->addLayout(hbox);

    hbox->addWidget(Input(), 1);
    hbox->addWidget(Result(), 1);

    root()->addWidget(container);

    HandleInternalPath(internalPath());
    internalPathChanged().connect(this, &Tester::HandleInternalPath);
}
Пример #6
0
        /*!
         * \brief Конструктор класса сайта.
         * \param[in] Класс хранения окружения сайта
         */
        CompanyesApplication(const Wt::WEnvironment& env)
            : Wt::WApplication(env)
        {
            this->messageResourceBundle().use(this->appRoot() + "rus_locale");
            this->useStyleSheet(this->appRoot() + "main.css");
            this->setTitle(Wt::WString::tr("Title"));

            Wt::WApplication *app = Wt::WApplication::instance();
            app->setLoadingIndicator(new Wt::WOverlayLoadingIndicator());
            app->styleSheet().addRule("body", "margin: 0px");

            Wt::WStackedWidget* contents = new Wt::WStackedWidget();
            contents->setOverflow(Wt::WContainerWidget::OverflowAuto);
            contents->setPositionScheme(Wt::Relative);

            Wt::WMenu* menu = new Wt::WMenu(contents, Wt::Vertical, 0);
            menu->setRenderAsList(true);
            menu->setStyleClass("menu");

            std::string absolute_path = boost::filesystem::system_complete(boost::filesystem::path(".")).string();
            new RegionsCreator(absolute_path, contents, menu);

            Wt::WHBoxLayout* hlayout = new Wt::WHBoxLayout();
            hlayout->addWidget(menu, 0);
            hlayout->addWidget(contents, 1);

            Wt::WVBoxLayout* vlayout = new Wt::WVBoxLayout(this->root());
            vlayout->addWidget(new Wt::WText(Wt::WString::tr("Header")), 0);
            vlayout->addLayout(hlayout, 1);
        }
Пример #7
0
RSWappFriendsPage::RSWappFriendsPage(Wt::WContainerWidget *parent,RsPeers *mpeers,RsMsgs *mmsgs)
	: WCompositeWidget(parent),mPeers(mpeers)
{
	setImplementation(_impl = new Wt::WContainerWidget()) ;

	Wt::WVBoxLayout *layout = new Wt::WVBoxLayout() ;
	_impl->setLayout(layout) ;

	_tableView = new Wt::WTableView(_impl);
	_tableView->setAlternatingRowColors(true);

	//tableView->setModel(fileFilterModel_);
	_tableView->setSelectionMode(Wt::ExtendedSelection);
	_tableView->setDragEnabled(true);

	_tableView->setColumnWidth(COLUMN_AVATAR,  20);
	_tableView->setColumnWidth(COLUMN_NAME  , 200);
	_tableView->setColumnWidth(COLUMN_PGP_ID, 150);
	_tableView->setColumnWidth(COLUMN_SSL_ID, 250);
	_tableView->setColumnWidth(COLUMN_LAST_S, 150);
	_tableView->setColumnWidth(COLUMN_IP    , 150);

	_tableView->setModel(_model = new FriendListModel(mpeers,mmsgs)) ;
	_model->refresh() ;

	_tableView->setItemDelegateForColumn(COLUMN_AVATAR,new FriendPageAvatarDelegate(_model)) ;

	Wt::WPushButton *add_friend_button = new Wt::WPushButton("Add new friend") ;
	layout->addWidget(add_friend_button,1) ;

	layout->addWidget(_tableView) ;

	_popupMenu = NULL ;
	_tableView->mouseWentUp().connect(this,&RSWappFriendsPage::showCustomPopupMenu) ;

	add_friend_button->clicked().connect(this,&RSWappFriendsPage::addFriend) ;

	// add a button to add new friends.
	//
	_timer = new Wt::WTimer(this) ;

	_timer->setInterval(5000) ;
	_timer->timeout().connect(this,&RSWappFriendsPage::refresh) ;
	_timer->start() ;
}
Пример #8
0
WidgetGallery::WidgetGallery()
  : WContainerWidget()
{
  setOverflow(OverflowHidden);

  navigation_ = new Wt::WNavigationBar();
  navigation_->addStyleClass("main-nav");
  navigation_->setTitle("Wt Widget Gallery",
			"https://www.webtoolkit.eu/widgets");
  navigation_->setResponsive(true);

  contentsStack_ = new Wt::WStackedWidget();

  Wt::WAnimation animation(Wt::WAnimation::Fade,
			   Wt::WAnimation::Linear,
			   200);
  contentsStack_->setTransitionAnimation(animation, true);

  /*
   * Setup the top-level menu
   */
  Wt::WMenu *menu = new Wt::WMenu(contentsStack_, 0);
  menu->setInternalPathEnabled();
  menu->setInternalBasePath("/");

  addToMenu(menu, "Layout", new Layout());
  addToMenu(menu, "Forms", new FormWidgets());
  addToMenu(menu, "Navigation", new Navigation());
  addToMenu(menu, "Trees & Tables", new TreesTables())
    ->setPathComponent("trees-tables");
  addToMenu(menu, "Graphics & Charts", new GraphicsWidgets())
    ->setPathComponent("graphics-charts");
  // addToMenu(menu, "Events", new EventsDemo());
  addToMenu(menu, "Media", new Media());

  navigation_->addMenu(menu);

  /*
   * Add it all inside a layout
   */
  Wt::WVBoxLayout *layout = new Wt::WVBoxLayout(this);
  layout->addWidget(navigation_);
  layout->addWidget(contentsStack_, 1);
  layout->setContentsMargins(0, 0, 0, 0);
}
Пример #9
0
void PopupChatWidget::createLayout(Wt::WWidget *messages,
				   Wt::WWidget *userList,
				   Wt::WWidget *messageEdit,
				   Wt::WWidget *sendButton,
				   Wt::WWidget *logoutButton)
{
  Wt::WVBoxLayout *layout = new Wt::WVBoxLayout();
  layout->setContentsMargins(0, 0, 0, 0);
  layout->setSpacing(0);

  Wt::WContainerWidget *bar = createBar();

  layout->addWidget(bar);
  layout->addWidget(messages, 1);
  layout->addWidget(messageEdit);

  setLayout(layout);
}
Пример #10
0
WeldingTypesPannel::WeldingTypesPannel() {
    this->setStyleClass("welding-type");

    Wt::WVBoxLayout *vlayout = new Wt::WVBoxLayout(this);
    vlayout->setContentsMargins(5, 5, 5, 5);
    vlayout->addWidget(new Wt::WText(Wt::WString::tr("WeldingTypesPannel")));
    Wt::WPushButton *button = new Wt::WPushButton(Wt::WString::tr("gas_check_button"));
    button->clicked().connect(std::bind([=] () {
        //canvas->clear();
    }));
    vlayout->addWidget(button);
    vlayout->addWidget(new LightDiode("indication_standart_welding"));
    vlayout->addWidget(new LightDiode("indication_pulse_welding"));
    button = new Wt::WPushButton(Wt::WString::tr("welding_type_button"));
    button->clicked().connect(std::bind([=] () {
        //canvas->clear();
    }));
    vlayout->addWidget(button);
}
Пример #11
0
Wt::WMenuItem *WidgetGallery::addToMenu(Wt::WMenu *menu,
					const Wt::WString& name,
					TopicWidget *topic)
{
  Wt::WContainerWidget *result = new Wt::WContainerWidget();

  Wt::WContainerWidget *pane = new Wt::WContainerWidget();

  Wt::WVBoxLayout *vLayout = new Wt::WVBoxLayout(result);
  vLayout->setContentsMargins(0, 0, 0, 0);
  vLayout->addWidget(topic);
  vLayout->addWidget(pane, 1);

  Wt::WHBoxLayout *hLayout = new Wt::WHBoxLayout(pane);

  Wt::WMenuItem *item = new Wt::WMenuItem(name, result);
  menu->addItem(item);

  Wt::WStackedWidget *subStack = new Wt::WStackedWidget();
  subStack->addStyleClass("contents");
  subStack->setOverflow(WContainerWidget::OverflowAuto);

  /*
  Wt::WAnimation animation(Wt::WAnimation::Fade,
			   Wt::WAnimation::Linear,
			   100);
  subStack->setTransitionAnimation(animation, true);
  */

  Wt::WMenu *subMenu = new Wt::WMenu(subStack);
  subMenu->addStyleClass("nav-pills nav-stacked");
  subMenu->setWidth(200);

  hLayout->addWidget(subMenu);
  hLayout->addWidget(subStack,1);

  subMenu->setInternalPathEnabled();
  subMenu->setInternalBasePath("/" + item->pathComponent());

  topic->populateSubMenu(subMenu);

  return item;
}
Пример #12
0
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();
}
Пример #13
0
Wt::WContainerWidget*
Application::instantiateMainTabs() {
    Wt::WContainerWidget *mainTabContainer = new Wt::WContainerWidget;
    Wt::WVBoxLayout *vbox = new Wt::WVBoxLayout;
    mainTabContainer->setLayout(vbox);

    wMainTabs_ = new Wt::WTabWidget;
    wMainTabs_->currentChanged().connect(boost::bind(&Application::changeTab2, this, _1));
    vbox->addWidget(wMainTabs_, 1 /*stretch*/);

    for (size_t i=0; i<NMainTabs; ++i) {
        Wt::WString tabName;
        Wt::WContainerWidget *tabContent = NULL;
        switch ((MainTab)i) {
        case PartitionerTab: {
            tabName = "Partitioner";
            tabContent = wPartitioner_ = new WPartitioner(ctx_);
            wPartitioner_->specimenParsed().connect(boost::bind(&Application::handleSpecimenParsed, this, _1));
            wPartitioner_->specimenLoaded().connect(boost::bind(&Application::handleSpecimenLoaded, this, _1));
            wPartitioner_->specimenPartitioned().connect(boost::bind(&Application::handleSpecimenPartitioned, this, _1));
            break;
        }
        case MemoryMapTab: {
            tabName = "Memory Map";
            tabContent = wMemoryMap_ = new WMemoryMap;
            wMemoryMap_->mapChanged().connect(boost::bind(&Application::memoryMapChanged, this));
            wMemoryMap_->allowDownloads(ctx_.settings.allowDownloads);
            break;
        }
        case FunctionListTab: {
            tabName = "Functions";
            tabContent = wFunctionList_ = new WFunctionList(ctx_);
            wFunctionList_->functionChanged().connect(boost::bind(&Application::changeFunction, this, _1));
            wFunctionList_->functionRowDoubleClicked()
            .connect(boost::bind(&Application::changeFunctionDoubleClick, this, _1));
            break;
        }
        case FunctionSummaryTab: {
            tabName = "Summary";
            tabContent = wFunctionSummary_ = new WFunctionSummary(ctx_);
            break;
        }
        case FunctionCfgTab: {
            tabName = "CFG";
            tabContent = wFunctionCfg_ = new WFunctionCfg(ctx_);
            wFunctionCfg_->functionChanged().connect(boost::bind(&Application::changeFunction, this, _1));
            wFunctionCfg_->functionClicked().connect(boost::bind(&Application::changeFunction, this, _1));
            wFunctionCfg_->addressClicked().connect(boost::bind(&Application::showHexDumpAtAddress, this, _1));
            wFunctionCfg_->basicBlockClicked().connect(boost::bind(&Application::changeBasicBlock, this, _1));
            break;
        }
        case AssemblyTab: {
            tabName = "Assembly";
            tabContent = wAssembly_ = new WAssemblyListing(ctx_);
            break;
        }
        case HexDumpTab: {
            tabName = "Hexdump";
            tabContent = wHexDump_ = new WHexDump;
            wHexDump_->byteClicked().connect(boost::bind(&Application::updateAddressCrossReferences, this, _1));
            break;
        }
        case MagicTab: {
            tabName = "Magic";
            tabContent = wMagic_ = new WMagic;
            break;
        }
        case StringsTab: {
            tabName = "Strings";
            tabContent = wStrings_ = new WStrings;
            wStrings_->stringClicked().connect(boost::bind(&Application::updateStringCrossReferences, this, _1));
            break;
        }
        case StatusTab: {
            tabName = "Status";
            tabContent = wStatus_ = new WStatus(ctx_);
            break;
        }
        default:
            ASSERT_not_reachable("invalid main tab");
        }
        ASSERT_not_null(tabContent);
        ASSERT_forbid(tabName.empty());
        wMainTabs_->addTab(tabContent, tabName);
    }
    return mainTabContainer;
}
Пример #14
0
RSWappSearchFilesPage::RSWappSearchFilesPage(Wt::WContainerWidget *parent,RsFiles *mfiles)
	: WCompositeWidget(parent),mFiles(mfiles)
{
	setImplementation(_impl = new Wt::WContainerWidget()) ;

	//_treeView = new Wt::WTreeView(_impl);
	_tableView = new Wt::WTableView(_impl);

	Wt::WVBoxLayout *layout = new Wt::WVBoxLayout() ;
	_impl->setLayout(layout) ;


	search_box = new Wt::WLineEdit(_impl) ;
	search_box->setText("mp3") ;
	search_box->enterPressed().connect(this,&RSWappSearchFilesPage::searchClicked) ;

	//search_box->setHeight(50) ;

	localcb = new Wt::WCheckBox(Wt::WString("Search Local"),_impl) ;
	remotecb = new Wt::WCheckBox(Wt::WString("Search Remote"),_impl) ;
	distantcb = new Wt::WCheckBox(Wt::WString("Search Distant"),_impl) ;

	localcb->setChecked(false);
	remotecb->setChecked(true);
	distantcb->setChecked(true);

	Wt::WPushButton *btn = new Wt::WPushButton("Search!") ;
	btn->clicked().connect(this,&RSWappSearchFilesPage::searchClicked) ;

	Wt::WContainerWidget *hSearchBox = new Wt::WContainerWidget();
	Wt::WHBoxLayout *hSearchLayout = new Wt::WHBoxLayout ;
	hSearchBox->setLayout(hSearchLayout);

	hSearchLayout->addWidget(search_box) ;
	hSearchLayout->addWidget(localcb);
	hSearchLayout->addWidget(distantcb);
	hSearchLayout->addWidget(remotecb);
	hSearchLayout->addWidget(btn) ;

	layout->addWidget(hSearchBox) ;
	search_box->setWidth(1000);

	_tableView->setAlternatingRowColors(true);

	_tableView->setSelectionMode(Wt::ExtendedSelection);
	_tableView->setDragEnabled(true);


	_tableView->setColumnWidth(0, 250);
	_tableView->setColumnWidth(1, 150);
	_tableView->setColumnWidth(2, 250);
	_tableView->setColumnWidth(3, 150);
	_tableView->setColumnWidth(4, 150);
	_tableView->setColumnWidth(5, 100);

	_shared_files_model = new LocalSearchFilesModel(mfiles) ;

	_tableView->setModel(_shared_files_model) ;

	_tableView->doubleClicked().connect(this,&RSWappSearchFilesPage::tableClicked) ;
	layout->addWidget(_tableView,1) ;

	_tableView->setHeight(300) ;


	Wt::WPushButton *dlbtn = new Wt::WPushButton("Download selected") ;
	dlbtn->clicked().connect(this,&RSWappSearchFilesPage::searchClicked) ;
	layout->addWidget(dlbtn) ;

	_timer = new Wt::WTimer(this) ;
	_timer->setInterval(5000) ;
	_timer->timeout().connect(this,&RSWappSearchFilesPage::refresh) ;
	_timer->start() ;
}
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;
}
std::string ProfileEditor::checkJsonProfile(JSONNode&root) {
  std::string result;
  /*check the root conatins required data*/
  if (!root.contains("name")) {
    result = "no profile name given!";
  } else if (!root.contains("format")) {
    result = "no format attribute found!";
  } else if (!root.contains("video")) {
    result = "no video attribute found!";
  } else if (!root.contains("audio")) {
    result = "no audio attribute found!";
  } else if (!root["format"].contains("id")) {
    result = "no id attribute found in attribute \"format\"!";
  } else if (!root["video"].contains("id")) {
    result = "no id attribute found in attribute \"video\"!";
  } else if (!root["audio"].contains("id")) {
    result = "no id attribute found in attribute \"audio\"!";
  }else{
    //Wt::WApplication::instance()->attachThread(true);

    analyzerDialog=new Wt::WDialog(this);
    analyzerDialog->setWidth(800);
    analyzerDialog->setHeight(500);
    progressBar=new Wt::WProgressBar();
    progressBar->setMinimum(0);
    progressBar->setMaximum(250);

    fpsText=new Wt::WText("FPS");
    psnrText=new Wt::WText("PSNR");
    Wt::WVBoxLayout *vbox = new Wt::WVBoxLayout();
    analyzerDialog->contents()->setLayout(vbox);

    chart=new Wt::Chart::WCartesianChart();
    chart->resize(700,350);
    //chart->setHidden(true);
    vbox->addWidget(progressBar);
    vbox->addWidget(fpsText);
    vbox->addWidget(psnrText);
    vbox->addWidget(chart);


    analyzerDialog->show();


    //app->enableUpdates();
    LOGDEBUG("thread attached");
    _verifier=new org::esb::plugin::PresetVerifier();
    _verifier->progress=boost::bind(&ProfileEditor::progress, this, _1);
    _verifier->completed=boost::bind(&ProfileEditor::completed, this, _1);

    Wt::WPushButton *ok = new Wt::WPushButton("Close", analyzerDialog->footer());
    ok->setDefault(true);
    ok->setEnabled(false);
    ok->clicked().connect(this, &ProfileEditor::closeAnalyzer);

    _selfApp=Wt::WApplication::instance();
    _selfApp->enableUpdates();
    a=0;
    go(org::esb::plugin::PresetVerifier::verify, _verifier, root, true, true);

    //verifier.verify(root);
    //analyzerDialog->reject();
    //go(ProfileEditor::startAnalyzeThread, this, root, Wt::WApplication::instance());
  }
  return result;
}
Пример #17
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();
}