void KTMainWindow::newProject()
{
	KTNewProject *wizard = new KTNewProject;
	connectToDisplays(wizard);
	if ( wizard->exec() != QDialog::Rejected )
	{
		createNewProject( wizard->projectName(), wizard->dimension(), wizard->fps() );
	}
	delete wizard;
	
	
}
Beispiel #2
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);
}
Beispiel #3
0
void TupMainWindow::setWorkSpace(const QStringList &users)
{
    #ifdef K_DEBUG
           T_FUNCINFO;
    #endif

    if (m_projectManager->isOpen()) {

        if (TupMainWindow::requestType == NewLocalProject || TupMainWindow::requestType == NewNetProject)
            TOsd::self()->display(tr("Information"), tr("Opening a new document..."));

        contextMode = TupProject::FRAMES_EDITION;

        // Setting undo/redo actions
        setUndoRedoActions();

        drawingTab = new TupViewDocument(m_projectManager->project(), this, isNetworked, users);

        TCONFIG->beginGroup("Network");
        QString server = TCONFIG->value("Server").toString();
        if (isNetworked && server.compare("tupitube.com") == 0) {
            connect(drawingTab, SIGNAL(requestExportImageToServer(int, int, const QString &, const QString &, const QString &)),                         
                    netProjectManagerHandler, SLOT(sendExportImageRequestToServer(int, int, const QString &, const QString &, const QString &)));
        }

        drawingTab->setWindowTitle(tr("Animation"));
        addWidget(drawingTab);

        connectToDisplays(drawingTab);
        connectWidgetToManager(drawingTab);
        connectWidgetToLocalManager(drawingTab);
        connect(drawingTab, SIGNAL(modeHasChanged(int)), this, SLOT(expandExposureView(int))); 
        connect(drawingTab, SIGNAL(expandColorPanel()), this, SLOT(expandColorView()));

        connect(drawingTab, SIGNAL(updateColorFromFullScreen(const QColor &)), this, SLOT(updatePenColor(const QColor &)));
        connect(drawingTab, SIGNAL(updatePenFromFullScreen(const QPen &)), this, SLOT(updatePenThickness(const QPen &)));
      
        drawingTab->setAntialiasing(true);

        int width = drawingTab->workSpaceSize().width();
        int height = drawingTab->workSpaceSize().height();
        int pWidth = m_projectManager->project()->dimension().width();
        int pHeight = m_projectManager->project()->dimension().height();

        /*
        tError() << "W: " << width;
        tError() << "H: " << height;
        tError() << "Pw: " << pWidth;
        tError() << "Ph: " << pHeight;
        */

        double proportion = 1;

        if (pWidth > pHeight)
            proportion = (double) width / (double) pWidth;
        else
            proportion = (double) height / (double) pHeight;

        if (proportion <= 0.5) {
            drawingTab->setZoomView("20");
        } else if (proportion > 0.5 && proportion <= 0.75) {
                   drawingTab->setZoomView("25");
        } else if (proportion > 0.75 && proportion <= 1.5) {
                   drawingTab->setZoomView("50");
        } else if (proportion > 1.5 && proportion < 2) {
                   drawingTab->setZoomView("75");
        }

        // TupViewCamera *
        viewCamera = new TupViewCamera(m_projectManager->project(), isNetworked);
        connectWidgetToManager(viewCamera);

        m_libraryWidget->setNetworking(isNetworked);

        if (isNetworked) {
            connect(viewCamera, SIGNAL(requestForExportVideoToServer(const QString &, const QString &, const QString &, int, const QList<int>)), 
                    this, SLOT(postVideo(const QString &, const QString &, const QString &, int, const QList<int>)));
            connect(viewCamera, SIGNAL(requestForExportStoryboardToServer(const QString &, const QString &, const QString &, const QList<int>)),
                    this, SLOT(postStoryboard(const QString &, const QString &, const QString &, const QList<int>)));
        } else {
            connect(drawingTab, SIGNAL(autoSave()), this, SLOT(callSave()));
        }

        animationTab = new TupAnimationspace(viewCamera);
        animationTab->setWindowIcon(QIcon(THEME_DIR + "icons/play_small.png"));
        animationTab->setWindowTitle(tr("Player"));
        addWidget(animationTab);

        helpTab = new TupHelpBrowser(this);
        helpTab->setDataDirs(QStringList() << m_helper->helpPath());

        QString lang = (QLocale::system().name()).left(2);
        if (lang.length() < 2)  
            lang = "en";

        QString helpPath = SHARE_DIR + "data/help/" + QString(lang + "/cover.html");

        QFile file(helpPath);
        if (!file.exists())
            helpPath = SHARE_DIR + "data/help/" + QString("en/cover.html");

        helpTab->setSource(helpPath);

        addWidget(helpTab);

        QString twitterPath = QDir::homePath() + "/." + QCoreApplication::applicationName() 
                              + "/twitter.html";

        if (QFile::exists(twitterPath)) {
            internetOn = true;
            newsTab = new TupTwitterWidget(this); 
            newsTab->setSource(twitterPath);
            addWidget(newsTab);
        } 

        connect(this, SIGNAL(tabHasChanged(int)), this, SLOT(updateCurrentTab(int)));

        exposureView->expandDock(true);

        // if (!isNetworked)
        //     connect(drawingTab, SIGNAL(autoSave()), this, SLOT(callSave()));

        m_projectManager->undoModified();

        // SQA: Check if this instruction is really required
        m_colorPalette->init();

        TCONFIG->beginGroup("PenParameters");
        int thicknessValue = TCONFIG->value("Thickness", -1).toInt();
        m_penWidget->init();
        m_penWidget->setThickness(thicknessValue);

        if (TupMainWindow::requestType == OpenLocalProject || TupMainWindow::requestType == OpenNetProject)
            TOsd::self()->display(tr("Information"), tr("Project <b>%1</b> opened!").arg(m_projectManager->project()->projectName()));

        connect(m_projectManager, SIGNAL(modified(bool)), this, SLOT(updatePlayer(bool)));

        m_exposureSheet->setScene(0);
    }