Пример #1
0
void TupMainWindow::createGUI()
{
    // Adding the color palette to the left side of the interface 

    m_colorPalette = new TupColorPalette;
    colorView = addToolView(m_colorPalette, Qt::LeftDockWidgetArea, Animation, "Color Palette", QKeySequence(tr("Shift+P")));
    //colorView->setShortcut(QKeySequence(tr("Shift+P")));

    m_actionManager->insert(colorView->toggleViewAction(), "show palette");
    addToPerspective(colorView->toggleViewAction(), Animation);

    connectToDisplays(m_colorPalette);
    connectWidgetToPaintArea(m_colorPalette);

    // Adding the pen parameters widget to the left side of the interface 

    m_penWidget = new TupPenWidget;
    penView = addToolView(m_penWidget, Qt::LeftDockWidgetArea, Animation, "Pen", QKeySequence(tr("Shift+B")));
    m_actionManager->insert(penView->toggleViewAction(), "show pen");
    addToPerspective(penView->toggleViewAction(), Animation);

    connectToDisplays(m_penWidget);
    connectWidgetToPaintArea(m_penWidget);

    // Adding the objects library widget to the left side of the interface

    m_libraryWidget = new TupLibraryWidget(this);
    m_libraryWidget->setLibrary(m_projectManager->project()->library());

    libraryView = addToolView(m_libraryWidget, Qt::LeftDockWidgetArea, Animation, "Library", QKeySequence(tr("Shift+L")));
    m_actionManager->insert(libraryView->toggleViewAction(), "show library");
    addToPerspective(libraryView->toggleViewAction(), Animation);
    connectToDisplays(m_libraryWidget);

    new TAction(QPixmap(THEME_DIR + "icons/bitmap.png"), tr("Bitmap"), QKeySequence(tr("Alt+B")), m_libraryWidget, SLOT(importBitmap()),
                m_actionManager, "importbitmap");

    new TAction(QPixmap(THEME_DIR + "icons/bitmap_array.png"), tr("Bitmap Array"), QKeySequence(tr("Alt+Shift+B")), 
                m_libraryWidget, SLOT(importBitmapArray()), m_actionManager, "importbitmaparray");

    new TAction(QPixmap(THEME_DIR + "icons/svg.png"), tr("SVG File"), QKeySequence(tr("Alt+S")), m_libraryWidget, SLOT(importSvg()),
                m_actionManager, "importsvg");

    new TAction(QPixmap(THEME_DIR + "icons/svg_array.png"), tr("SVG Array"), QKeySequence(tr("Alt+Shift+S")), m_libraryWidget, 
                SLOT(importSvgArray()), m_actionManager, "importsvgarray");

    //new TAction(QPixmap(), tr("Audio File..."), QKeySequence(), m_libraryWidget, SLOT(importSound()),
    //            m_actionManager, "importaudiofile");

    // SQA: Temporary code
    //m_actionManager->enable("importsvg", false);
    //m_actionManager->enable("importsvgarray", false);

    connectWidgetToManager(m_libraryWidget);
    connectWidgetToLocalManager(m_libraryWidget);

    // Adding the scenes widget to the right side of the interface

    m_scenes = new TupScenesWidget;
    scenesView = addToolView(m_scenes, Qt::RightDockWidgetArea, Animation, "Scenes Manager", QKeySequence(tr("Shift+C")));
    m_actionManager->insert(scenesView->toggleViewAction(), "show scenes");
    addToPerspective(scenesView->toggleViewAction(), Animation);

    connectWidgetToManager(m_scenes);
    connectWidgetToLocalManager(m_scenes);
    connectToDisplays(m_scenes);

    // Adding the exposure sheet to the right side of the interface
    m_exposureSheet = new TupExposureSheet;
    exposureView = addToolView(m_exposureSheet, Qt::RightDockWidgetArea, Animation, "Exposure Sheet", QKeySequence(tr("Shift+E")));
    m_actionManager->insert(exposureView->toggleViewAction(), "show exposure");
    addToPerspective(exposureView->toggleViewAction(), Animation);

    connectWidgetToManager(m_exposureSheet);
    connectWidgetToLocalManager(m_exposureSheet);
    connectToDisplays(m_exposureSheet);

    // Adding the help widget to the right side of the interface

    m_helper = new TupHelpWidget(SHARE_DIR + "data/help/");
    helpView = addToolView(m_helper, Qt::RightDockWidgetArea, All, "Help", QKeySequence(tr("Shift+H")));
    m_actionManager->insert(helpView->toggleViewAction(), "show help");
    addToPerspective(helpView->toggleViewAction(), All);

    TViewButton *helpButton = helpView->button();

    connect(helpButton, SIGNAL(helpIsOpen()), this,
            SLOT(setHelpPerspective()));

    connect(m_helper, SIGNAL(pageLoaded(const QString &)), this, 
            SLOT(showHelpPage(const QString &)));
    connectToDisplays(m_helper);

    // Adding the time line widget to the bottom side of the interface
    m_timeLine = new TupTimeLine;
    m_timeLine->setLibrary(m_projectManager->project()->library());
    timeView = addToolView(m_timeLine, Qt::BottomDockWidgetArea, Animation, "Time Line", QKeySequence(tr("Shift+T")));
    m_actionManager->insert(timeView->toggleViewAction(), "show timeline");
    addToPerspective(timeView->toggleViewAction(), Animation);

    connectWidgetToManager(m_timeLine);
    connectWidgetToLocalManager(m_timeLine);
    connectToDisplays(m_timeLine);

#if defined(QT_GUI_LIB) && defined(K_DEBUG)
    QDesktopWidget desktop;
    m_debug = new TupDebugWidget(this, desktop.screenGeometry().width());
    debugView = addToolView(m_debug, Qt::BottomDockWidgetArea, Animation, "Debug Term", QKeySequence(tr("Shift+D")));
    m_actionManager->insert(debugView->toggleViewAction(), "show debug");
    addToPerspective(debugView->toggleViewAction(), Animation);
#endif

    // Adding the script editor to the bottom side, if kinas was enabled
    /*
#ifdef ENABLE_KINAS
    KinasWidget *m_scriptEditor = new KinasWidget;
    addToolView(m_scriptEditor, Qt::BottomDockWidgetArea, Animation, "Tupi Script", QKeySequence(tr("Shift+K"));
#endif
    */

    enableToolViews(false);
}
Пример #2
0
void TWorkspaceMainWindow::addWidget(QWidget *widget, int perspective)
{
    addToPerspective(widget, perspective);
    m_workspace->addWindow(widget);
    widget->show();
}