Exemple #1
0
HWindow::HWindow(BRect rect, const char* name)
	:
	BWindow(rect, name, B_TITLED_WINDOW, B_AUTO_UPDATE_SIZE_LIMITS),
	fFilePanel(NULL),
	fPlayer(NULL)
{
	_InitGUI();

	fFilePanel = new BFilePanel();
	fFilePanel->SetTarget(this);

	BPath path;
	if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) == B_OK) {
		path.Append(kSettingsFile);
		BFile file(path.Path(), B_READ_ONLY);

		BMessage msg;
		if (file.InitCheck() == B_OK && msg.Unflatten(&file) == B_OK
			&& msg.FindRect("frame", &fFrame) == B_OK) {
			MoveTo(fFrame.LeftTop());
			ResizeTo(fFrame.Width(), fFrame.Height());
		}
	}

	MoveOnScreen();
}
QtOSGViewer::QtOSGViewer(EnvironmentBasePtr penv, std::istream& sinput) : QMainWindow(NULL, Qt::Window), ViewerBase(penv)
{
    _userdatakey = std::string("qtosg") + boost::lexical_cast<std::string>(this);
    int qtosgbuild = 0;
    bool bCreateStatusBar = true, bCreateMenu = true;
    int nAlwaysOnTopFlag = 0; // 1 - add on top flag (keep others), 2 - add on top flag (remove others)
    sinput >> qtosgbuild >> bCreateStatusBar >> bCreateMenu >> nAlwaysOnTopFlag;

    _name = str(boost::format("OpenRAVE %s")%OPENRAVE_VERSION_STRING);
    if( (OPENRAVE_VERSION_MINOR%2) || (OPENRAVE_VERSION_PATCH%2) ) {
        _name += " (Development Version)";
    }
    else {
        _name += " (Stable Release)";
    }

    setWindowTitle(_name.c_str());
    if(  bCreateStatusBar ) {
        statusBar()->showMessage(tr("Status Bar"));
    }

    __description = ":Interface Author: Gustavo Puche, Rosen Diankov\n\nProvides a viewer based on Open Scene Graph.";
//    RegisterCommand("SetFiguresInCamera",boost::bind(&QtOSGViewer::_SetFiguresInCamera,this,_1,_2),
//                    "Accepts 0/1 value that decides whether to render the figure plots in the camera image through GetCameraImage");
//    RegisterCommand("SetFeedbackVisibility",boost::bind(&QtOSGViewer::_SetFeedbackVisibility,this,_1,_2),
//                    "Accepts 0/1 value that decides whether to render the cross hairs");
//    RegisterCommand("ShowWorldAxes",boost::bind(&QtOSGViewer::_SetFeedbackVisibility,this,_1,_2),
//                    "Accepts 0/1 value that decides whether to render the cross hairs");
//    RegisterCommand("Resize",boost::bind(&QtOSGViewer::_CommandResize,this,_1,_2),
//                    "Accepts width x height to resize internal video frame");
//    RegisterCommand("SaveBodyLinkToVRML",boost::bind(&QtOSGViewer::_SaveBodyLinkToVRMLCommand,this,_1,_2),
//                    "Saves a body and/or a link to VRML. Format is::\n\n  bodyname linkindex filename\\n\n\nwhere linkindex >= 0 to save for a specific link, or < 0 to save all links");
//    RegisterCommand("SetNearPlane", boost::bind(&QtOSGViewer::_SetNearPlaneCommand, this, _1, _2),
//                    "Sets the near plane for rendering of the image. Useful when tweaking rendering units");
//    RegisterCommand("StartViewerLoop", boost::bind(&QtOSGViewer::_StartViewerLoopCommand, this, _1, _2),
//                    "starts the viewer sync loop and shows the viewer. expects someone else will call the qapplication exec fn");
//    RegisterCommand("Show", boost::bind(&QtOSGViewer::_ShowCommand, this, _1, _2),
//                    "executs the show directly");
//    RegisterCommand("TrackLink", boost::bind(&QtOSGViewer::_TrackLinkCommand, this, _1, _2),
//                    "camera tracks the link maintaining a specific relative transform: robotname, manipname, _fTrackingRadius");
//    RegisterCommand("TrackManipulator", boost::bind(&QtOSGViewer::_TrackManipulatorCommand, this, _1, _2),
//                    "camera tracks the manipulator maintaining a specific relative transform: robotname, manipname, _fTrackingRadius");
//    RegisterCommand("SetTrackingAngleToUp", boost::bind(&QtOSGViewer::_SetTrackingAngleToUpCommand, this, _1, _2),
//                    "sets a new angle to up");

    _bLockEnvironment = true;
    _InitGUI(bCreateStatusBar);
    _bUpdateEnvironment = true;
}