Beispiel #1
0
void MainWindow::Toolbar()
{
    QPixmap openIcon((const char**) open_xpm);
    QPixmap redoIcon((const char**) redo_xpm);
    QPixmap simulateIcon((const char**) simulate_xpm);
    QPixmap stopIcon((const char**) stop_xpm);
    QPixmap cameraIcon((const char**) camera_xpm);
    QPixmap filmIcon((const char**) film_xpm);
    QPixmap frontViewIcon((const char**) frontView_xpm);
    QPixmap topViewIcon((const char**) topView_xpm);
    QPixmap rightSideViewIcon((const char**) rightSideView_xpm);

    toolbar = addToolBar("main toolbar");
    QAction *open = toolbar->addAction(QIcon(openIcon), "Open Scene (Ctrl + O)");
    QAction *redo = toolbar->addAction(QIcon(redoIcon), "Load last viewed scene (Ctrl + Shift + Q)");
    toolbar->addSeparator();
    QAction *simulate = toolbar->addAction(QIcon(simulateIcon), "Start Simulation (Ctrl + R");
    QAction *stop = toolbar->addAction(QIcon(stopIcon), "Stop Simulation (Ctrl + C");
    stop->setVisible(false);
    toolbar->addSeparator();
    QAction *camera = toolbar->addAction(QIcon(cameraIcon), "Export screenshot");
    QAction *film = toolbar->addAction(QIcon(filmIcon), "Export film sequence");
    toolbar->addSeparator();
    QAction *front = toolbar->addAction(QIcon(frontViewIcon), "View scene from front");
    QAction *top = toolbar->addAction(QIcon(topViewIcon), "View scene from top");
    QAction *rightSide = toolbar->addAction(QIcon(rightSideViewIcon), "View scene from right");

    connect(open, SIGNAL(triggered()), this, SLOT(loadScene()));
    connect(redo, SIGNAL(triggered()), this, SLOT(quickLoad()));
    connect(simulate, SIGNAL(triggered()), this, SLOT(startSimulation()));
    connect(stop, SIGNAL(triggered()), this, SLOT(stopSimulation()));
    connect(camera, SIGNAL(triggered()), this, SLOT(camera()));
    connect(film, SIGNAL(triggered()), this, SLOT(film()));
    connect(front, SIGNAL(triggered()), this, SLOT(front()));
    connect(top, SIGNAL(triggered()), this, SLOT(top()));
    connect(rightSide, SIGNAL(triggered()), this, SLOT(side()));
}
Beispiel #2
0
DeveloperWindow::DeveloperWindow
(GApp*                                      app,
 const shared_ptr<FirstPersonManipulator>&   manualManipulator,
 const shared_ptr<UprightSplineManipulator>& trackManipulator,
 const Pointer< shared_ptr<Manipulator> >&   cameraManipulator,
 const shared_ptr<Camera>&                  debugCamera,
 const shared_ptr<Scene>&                   scene,
 const shared_ptr<Film>&                    film,
 const shared_ptr<GuiTheme>&                theme,
 const shared_ptr<GConsole>&                console,
 const Pointer<bool>&                       debugVisible,
 bool*                                      showStats,
 bool*                                      showText,
 const std::string&                         screenshotPrefix) :
    GuiWindow("Developer (F11)", theme, Rect2D::xywh(600, 80, 0, 0), GuiTheme::TOOL_WINDOW_STYLE, HIDE_ON_CLOSE), consoleWindow(console) {

    alwaysAssertM(this != NULL, "Memory corruption");
    alwaysAssertM(notNull(debugCamera), "NULL camera");

    cameraControlWindow = CameraControlWindow::create(manualManipulator, trackManipulator, cameraManipulator,
                          debugCamera, film, theme);

    cameraControlWindow->moveTo(Point2(app->window()->width() - cameraControlWindow->rect().width(), 0));

    videoRecordDialog = VideoRecordDialog::create(theme, screenshotPrefix, app);

    profilerWindow = ProfilerWindow::create(theme);
    app->addWidget(profilerWindow);
    profilerWindow->setVisible(false);

    if (notNull(scene)) {
        sceneEditorWindow = SceneEditorWindow::create(app, scene, theme);
        sceneEditorWindow->moveTo(cameraControlWindow->rect().x0y1() + Vector2(0, 15));
    }

    // For texture windows
    m_app      = app;
    m_theme    = theme;

    GuiPane* root = pane();

    const float iconSize = 32;
    Vector2 buttonSize(iconSize, iconSize);

    shared_ptr<IconSet> iconSet = IconSet::fromFile(System::findDataFile("icon/tango.icn"));
    GuiText cameraIcon(iconSet->get("22x22/devices/camera-photo.png"));
    GuiText movieIcon(iconSet->get("22x22/categories/applications-multimedia.png"));
    GuiText consoleIcon(iconSet->get("22x22/apps/utilities-terminal.png"));
    GuiText statsIcon(iconSet->get("22x22/apps/utilities-system-monitor.png"));
    GuiText debugIcon(iconSet->get("22x22/categories/preferences-desktop.png"));
    GuiText sceneIcon(iconSet->get("22x22/categories/preferences-system.png"));
    GuiText textIcon(iconSet->get("22x22/mimetypes/text-x-generic.png"));
    GuiText textureBrowserIcon(iconSet->get("22x22/actions/window-new.png"));
    GuiText profilerIcon(iconSet->get("22x22/actions/appointment-new.png"));

    Pointer<bool> ptr = Pointer<bool>((shared_ptr<GuiWindow>)cameraControlWindow, &GuiWindow::visible, &GuiWindow::setVisible);
    GuiControl* cameraButton = root->addCheckBox(cameraIcon, ptr, GuiTheme::TOOL_CHECK_BOX_STYLE);
    cameraButton->setSize(buttonSize);
    cameraButton->setPosition(0, 0);

    Pointer<bool> ptr2 = Pointer<bool>((shared_ptr<GuiWindow>)videoRecordDialog, &GuiWindow::visible, &GuiWindow::setVisible);
    GuiControl* movieButton = root->addCheckBox(movieIcon, ptr2, GuiTheme::TOOL_CHECK_BOX_STYLE);
    movieButton->setSize(buttonSize);

    static bool ignore = false;
    if (notNull(scene)) {
        Pointer<bool> ptr3 = Pointer<bool>((shared_ptr<GuiWindow>)sceneEditorWindow, &GuiWindow::visible, &GuiWindow::setVisible);
        GuiControl* sceneButton = root->addCheckBox(sceneIcon, ptr3, GuiTheme::TOOL_CHECK_BOX_STYLE);
        sceneButton->setSize(buttonSize);
    } else {
        GuiControl* sceneButton = root->addCheckBox(sceneIcon, &ignore, GuiTheme::TOOL_CHECK_BOX_STYLE);
        sceneButton->setSize(buttonSize);
        sceneButton->setEnabled(false);
    }

    Pointer<bool> profilePtr = Pointer<bool>((shared_ptr<GuiWindow>)profilerWindow, &GuiWindow::visible, &GuiWindow::setVisible);
    GuiControl* profilerButton = root->addCheckBox(profilerIcon, profilePtr, GuiTheme::TOOL_CHECK_BOX_STYLE);
    profilerButton->setSize(buttonSize);

    GuiControl* textureBrowserButton = root->addButton(textureBrowserIcon, this, &DeveloperWindow::makeNewTexturePane, GuiTheme::TOOL_BUTTON_STYLE);
    textureBrowserButton->setSize(buttonSize);

    GuiControl* consoleButton = root->addCheckBox(consoleIcon, Pointer<bool>(consoleWindow, &GConsole::active, &GConsole::setActive), GuiTheme::TOOL_CHECK_BOX_STYLE);
    consoleButton->setSize(buttonSize);

    GuiControl* debugButton = root->addCheckBox(debugIcon, debugVisible, GuiTheme::TOOL_CHECK_BOX_STYLE);
    debugButton->setSize(buttonSize);

    GuiControl* statsButton = root->addCheckBox(statsIcon, showStats, GuiTheme::TOOL_CHECK_BOX_STYLE);
    statsButton->setSize(buttonSize);

    GuiControl* printButton = root->addCheckBox(textIcon, showText, GuiTheme::TOOL_CHECK_BOX_STYLE);
    printButton->setSize(buttonSize);

    cameraControlWindow->setVisible(true);
    videoRecordDialog->setVisible(false);
    pack();

}