Ejemplo n.º 1
0
ExportImageDialog::ExportImageDialog(const QString &url, const QSize &size, ImageExporter *imgExporter)
    : QDialog((QWidget*) KStars::Instance()), m_KStars(KStars::Instance()), m_Url(url), m_Size(size)
{
#ifdef Q_OS_OSX
    setWindowFlags(Qt::Tool| Qt::WindowStaysOnTopHint);
#endif
    m_DialogUI = new ExportImageDialogUI(this);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addWidget(m_DialogUI);
    setLayout(mainLayout);

    QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
    mainLayout->addWidget(buttonBox);
    connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));

    connect(buttonBox, SIGNAL(accepted()), this, SLOT(exportImage()));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(close()));

    QPushButton *previewB = new QPushButton(i18n("Preview image"));
    buttonBox->addButton(previewB, QDialogButtonBox::ActionRole);
    connect(previewB, SIGNAL(clicked()), this, SLOT(previewImage()));

    connect(m_DialogUI->addLegendCheckBox, SIGNAL(toggled(bool)), this, SLOT(switchLegendEnabled(bool)));
    connect(m_DialogUI->addLegendCheckBox, SIGNAL(toggled(bool)), previewB, SLOT(setEnabled(bool)));

    m_ImageExporter = ( ( imgExporter ) ? imgExporter : new ImageExporter( this ) );

    setWindowTitle(i18n("Export sky image"));

    setupWidgets();
}
Ejemplo n.º 2
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    view = new QGraphicsView;
    scene = new ExQGraphicsScene;
    inputParams = new InputParamsDialog;
    exportImageDialog = new ExportImageDialog;
    progressBar = new ProgressBarWidget;
    this->zoomFactor=1.2;
    this->load();

    QObject::connect(this->scene,SIGNAL(mouse_pressed()),this,SLOT(moused()));
    QObject::connect(inputParams,SIGNAL(accepted()),this,SLOT(draw()));
    QObject::connect(ui->closeBtn,SIGNAL(clicked()),this,SLOT(close()));
    QObject::connect(ui->closeBtn,SIGNAL(clicked()),this->view,SLOT(close()));
    QObject::connect(ui->zoomInBtn,SIGNAL(clicked()),this,SLOT(zoomIn()));
    QObject::connect(ui->zoomOutBtn,SIGNAL(clicked()),this,SLOT(zoomOut()));
    QObject::connect(ui->exportBtn,SIGNAL(clicked()),this,SLOT(exportCalled()));
    QObject::connect(exportImageDialog,SIGNAL(accepted()),this,SLOT(exportImage()));
    QObject::connect(exportImageDialog,SIGNAL(accepted()),this,SLOT(showProgressBar()));
    QObject::connect(exportImageDialog,SIGNAL(accepted()),this->progressBar,SLOT(start()));
}
Ejemplo n.º 3
0
void MultiLayer::exportToFile(const QString &fileName) {
  if (fileName.isEmpty()) {
    QMessageBox::critical(0, tr("Error"),
                          tr("Please provide a valid file name!"));
    return;
  }

  if (fileName.contains(".eps") || fileName.contains(".pdf") ||
      fileName.contains(".ps")) {
    exportVector(fileName);
    return;
  } else if (fileName.contains(".svg")) {
    exportSVG(fileName);
    return;
  } else {
    QList<QByteArray> list = QImageWriter::supportedImageFormats();
    for (int i = 0; i < list.count(); i++) {
      if (fileName.contains("." + list[i].toLower())) {
        exportImage(fileName);
        return;
      }
    }
    QMessageBox::critical(this, tr("Error"),
                          tr("File format not handled, operation aborted!"));
  }
}
Ejemplo n.º 4
0
void ExportImageDialog::setupConnections()
{
    connect(this, SIGNAL(okClicked()), this, SLOT(exportImage()));
    connect(this, SIGNAL(cancelClicked()), this, SLOT(close()));
    connect(this, SIGNAL(user1Clicked()), this, SLOT(previewImage()));

    connect(m_DialogUI->addLegendCheckBox, SIGNAL(toggled(bool)), this, SLOT(switchLegendEnabled(bool)));
    connect(m_DialogUI->addLegendCheckBox, SIGNAL(toggled(bool)), button(KDialog::User1), SLOT(setEnabled(bool)));
}
Ejemplo n.º 5
0
void QRImageWidget::saveImage()
{
    if(!pixmap())
        return;
    QString fn = GUIUtil::getSaveFileName(this, tr("Save QR Code"), QString(), tr("PNG Image (*.png)"), NULL);
    if (!fn.isEmpty())
    {
        exportImage().save(fn);
    }
}
Ejemplo n.º 6
0
TableEditor::TableEditor(QWidget *parent): Editor(parent)
{
    QVBoxLayout *layout = new QVBoxLayout(this);
    setLayout(layout);

    // toolbar
    _toolbar = new QWidget(this);
    layout->addWidget(_toolbar);
    _ui_toolbar = new Ui::TableEditorToolbar;
    _ui_toolbar->setupUi(_toolbar);
    _ui_toolbar->firstPageButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/actions/allLeft")));
    _ui_toolbar->previousPageButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/actions/left")));
    _ui_toolbar->nextPageButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/actions/right")));
    _ui_toolbar->lastPageButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/actions/allRight")));

    _ui_toolbar->refreshButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/actions/refresh")));

    _ui_toolbar->addRowButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/general/add")));
    _ui_toolbar->deleteRowButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/general/remove")));

    _ui_toolbar->commitButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/actions/checked")));
    _ui_toolbar->rollbackButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/actions/rollback")));

    _ui_toolbar->dumpDataButton->setIcon(QIcon(IconLoader::getIconIdentifier(":/drawable/actions/export")));

    _tableView = new QTableView(this);
    _tableModel = new QSqlTableModel(_tableView /* TODO database connection */);
    _tableView->setModel(_tableModel);
    layout->addWidget(_tableView);

    // connections
    connect(_ui_toolbar->commitButton, SIGNAL(clicked()), _tableModel, SLOT(submitAll()));
    connect(_ui_toolbar->rollbackButton, SIGNAL(clicked()), _tableModel, SLOT(revertAll()));
    connect(_ui_toolbar->addRowButton, SIGNAL(clicked()), this, SLOT(addRow()));
    connect(_ui_toolbar->deleteRowButton, SIGNAL(clicked()), this, SLOT(deleteRows()));
    connect(_ui_toolbar->refreshButton, SIGNAL(clicked()), _tableModel, SLOT(select()));



    connect(_ui_toolbar->toolButtonExportImage, SIGNAL(clicked()),_imageView, SLOT(exportImage()));
    connect(_ui_toolbar->toolButtonZoomIn, SIGNAL(clicked()),_imageView,SLOT(zoomIn()));
    connect(_ui_toolbar->toolButtonZoomOut, SIGNAL(clicked()),_imageView, SLOT(zoomOut()));
    connect(_ui_toolbar->toolButtonFitToScreen, SIGNAL(clicked()),_imageView, SLOT(fitToScreen()));
    connect(_ui_toolbar->toolButtonOriginalSize, SIGNAL(clicked()),_imageView, SLOT(resetToOriginalSize()));
    connect(_ui_toolbar->toolButtonBackground, SIGNAL(toggled()),_imageView, SLOT(setViewBackground()));
    connect(_ui_toolbar->toolButtonOutline, SIGNAL(toggled()),_imageView, SLOT(setViewOutline()));
    connect(_ui_toolbar->toolButtonPlayPause, SIGNAL(clicked()),this, SLOT(playToggled()));
    connect(_file, SIGNAL(imageSizeChanged()),this, SLOT(imageSizeUpdated()));
    connect(_file, SIGNAL(openFinished()),_imageView, SLOT(createScene()));
    connect(_file, SIGNAL(openFinished()),this, SLOT(updateToolButtons()));
    connect(_file, SIGNAL(aboutToReload()),_imageView, SLOT(reset()));
    connect(_file, SIGNAL(reloadFinished()),_imageView, SLOT(createScene()));
    connect(_file, SIGNAL(isPausedChanged()),this, SLOT(updatePauseAction()));
    connect(_imageView, SIGNAL(scaleFactorChanged()),this, SLOT(scaleFactorUpdate()));
}
    //---------------------------------------------------------------
    String EffectTextureExporter::exportImage ( const MObject &texture )
    {
        // Retrieve the texture filename
        MFnDependencyNode textureNode ( texture );
        MString mayaName = textureNode.name();
        MPlug filenamePlug = textureNode.findPlug ( ATTR_FILE_TEXTURE_NAME );

        // Get the maya image id.
        String mayaImageId = DocumentExporter::mayaNameToColladaName ( textureNode.name() );

        // Generate a COLLADA id for the new light object
        String colladaImageId;

        // Check if there is an extra attribute "colladaId" and use this as export id.
        MString attributeValue;
        DagHelper::getPlugValue ( texture, COLLADA_ID_ATTRIBUTE_NAME, attributeValue );
        if ( attributeValue != EMPTY_CSTRING )
        {
            // Generate a valid collada name, if necessary.
            colladaImageId = mDocumentExporter->mayaNameToColladaName ( attributeValue, false );
        }
        else
        {
            // Generate a COLLADA id for the new light object
            colladaImageId = DocumentExporter::mayaNameToColladaName ( textureNode.name() );
        }
        // Make the id unique and store it in a map for refernences.
        colladaImageId = mImageIdList.addId ( colladaImageId );
        mMayaIdColladaImageId [mayaImageId] = colladaImageId;

        // Get the maya filename with the path to the file.
        MString mayaFileName;
        filenamePlug.getValue ( mayaFileName );
        if ( mayaFileName.length () == 0 ) return NULL;
        String sourceFile = mayaFileName.asChar ();
        COLLADASW::URI sourceFileUri ( COLLADASW::URI::nativePathToUri ( sourceFile ) );
        if ( sourceFileUri.getScheme ().empty () )
            sourceFileUri.setScheme ( COLLADASW::URI::SCHEME_FILE );

        COLLADASW::Image* colladaImage = exportImage ( mayaImageId, colladaImageId, sourceFileUri );
        if ( colladaImage == NULL ) return NULL;

        // Export the node type, because PSD textures don't behave the same as File textures.
        String nodeType = texture.hasFn ( MFn::kPsdFileTexture ) ? MAYA_TEXTURE_PSDTEXTURE : MAYA_TEXTURE_FILETEXTURE;
        colladaImage->addExtraTechniqueParameter ( PROFILE_MAYA, MAYA_TEXTURE_NODETYPE, nodeType );

        // Export whether this image is in fact an image sequence
        MPlug imgSeqPlug = textureNode.findPlug ( ATTR_IMAGE_SEQUENCE );
        bool isImgSeq = false;
        imgSeqPlug.getValue ( isImgSeq );
        colladaImage->addExtraTechniqueParameter ( PROFILE_MAYA, MAYA_TEXTURE_IMAGE_SEQUENCE, isImgSeq );

        return colladaImage->getImageId();
    }
Ejemplo n.º 8
0
void QRImageWidget::mousePressEvent(QMouseEvent *event)
{
    if(event->button() == Qt::LeftButton && pixmap())
    {
        event->accept();
        QMimeData *mimeData = new QMimeData;
        mimeData->setImageData(exportImage());

        QDrag *drag = new QDrag(this);
        drag->setMimeData(mimeData);
        drag->exec();
    } else {
        QLabel::mousePressEvent(event);
    }
}
Ejemplo n.º 9
0
void ExportDlg::accept()
{
	int  w = widthEdit->text().toInt();
	int  h = heightEdit->text().toInt();

	QString filepath = QFileDialog::getSaveFileName(this,
		tr("Save As"), "",
		tr("PNG (*.png);;JPEG (*.jpg);;BMP (*.bmp)"));
	if (filepath.isEmpty())
	{
		return;
	}
	else
	{
		emit exportImage(filepath, w, h);
		this->close();
	}
}
Ejemplo n.º 10
0
void MainWindow::createMenu() {
  QMenu *fileMenu = menuBar()->addMenu(tr("File"));
  fileMenu->addAction(tr("New project"), this, SLOT(newProject()),
                      QKeySequence::New);
  fileMenu->addAction(tr("Open project"), this, SLOT(openProject()),
                      QKeySequence::Open);
  fileMenu->addAction(tr("Save project"), this, SLOT(saveProject()),
                      QKeySequence::Save);
  fileMenu->addAction(tr("Save as.."), this, SLOT(saveAsProject()),
                      QKeySequence::SaveAs);
  fileMenu->addSeparator();
  fileMenu->addAction(tr("Export image"), this, SLOT(exportImage()),
                      QKeySequence(Qt::CTRL + Qt::Key_E));

  QMenu *editMenu = menuBar()->addMenu(tr("Edit"));
  QMenu *gridEditMenu = editMenu->addMenu(tr("Grid"));
  gridEditMenu->addAction(tr("Clear fields"), this, SLOT(clearFields()));
  gridEditMenu->addAction(tr("Clear borders"), this, SLOT(clearBorders()));
}
Ejemplo n.º 11
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    this->setGeometry(300,50,600,600);
    this->setWindowTitle("Self-organizing Maps");

    edg = new Edges();
    ver = new Vertices();
    v = new Voronoi();
    dir = new Vertices();

    nGas = NeuralGas(0.005,0.4,0.01);
    kohonen = Kohonen(4,0.05);

    ui->actionKMeans_Algorithm->setEnabled(false);
    ui->actionKohonen_s_Algorithm->setEnabled(false);
    ui->actionNeural_Gas_Algorithm->setEnabled(false);
    ui->actionSet_Data->setEnabled(false);
    ui->actionExport_Image->setEnabled(false);
    ui->actionLoad_image->setEnabled(false);
    ui->actionNeural_Gas_Image->setEnabled(false);
    ui->graphicsView->setVisible(false);
    ui->graphicsView_2->setVisible(false);

    connect(ui->actionSet_Data,SIGNAL(triggered()),this,SLOT(setData()));
    connect(ui->actionSet_Centroids,SIGNAL(triggered()),this,SLOT(setCentroids()));
    connect(ui->actionKMeans_Algorithm,SIGNAL(triggered()),this,SLOT(kmeansSwitch()));
    connect(ui->actionKohonen_s_Algorithm,SIGNAL(triggered()),this,SLOT(kohonenSwitch()));
    connect(ui->actionNeural_Gas_Algorithm,SIGNAL(triggered()),this,SLOT(neuralGasSwitch()));
    connect(ui->actionLoad_image,SIGNAL(triggered()),this,SLOT(loadImage()));
    connect(ui->actionExport_Image,SIGNAL(triggered()),this,SLOT(exportImage()));
    connect(ui->actionNeural_Gas_Image,SIGNAL(triggered()),this,SLOT(neuralGasImageSwitch()));

    QShortcut *repaint = new QShortcut(QKeySequence("SPACE"),this);
    connect(repaint,SIGNAL(activated()),this,SLOT(doAction()));
}
Ejemplo n.º 12
0
ossimQtSingleImageWindow::ossimQtSingleImageWindow(QWidget* parent,
        const char* name,
        Qt::WFlags f)
    : QMainWindow(parent, name, f),
      ossimConnectableObject(),
      ossimConnectableDisplayListener(),
      theImageWidget(0),
      theLastOpenedDirectory(),
      theResolutionLevelMenu(0)
{
    ossimReferenced::ref();
    setCaption("iview");

    QSize size(DEFAULT_WIDTH, DEFAULT_HEIGHT);
    setBaseSize(size);

    // This set the window's widget size.
    setGeometry(0,0,DEFAULT_WIDTH-1,DEFAULT_HEIGHT-1);

    // Create the image widget parenting it to this.
    theImageWidget = new ossimQtScrollingImageWidget(this, "image_widget");

    // This will clear out any initial garbage in the widget.
    theImageWidget->refresh();

    // Disable random caching scheme.
    theImageWidget->setRandomPriorityQueueEnabledFlag(false);

    // Set the the width and height of the window.
    theImageWidget->resize(DEFAULT_WIDTH, DEFAULT_HEIGHT);

    // Make the image widget the centralized widget.
    setCentralWidget(theImageWidget);

    // Make the "File" pull down menu.
    QMenu* file = new QMenu( this );
    menuBar()->insertItem( "&File", file );
    file->insertItem( "&Open Image",  this, SLOT(openImage()), Qt::CTRL+Qt::Key_O );
    file->insertItem( "&Close Image",  this, SLOT(closeImage()), Qt::CTRL+Qt::Key_C );
    file->insertItem( "&Export",  this, SLOT(exportImage()), Qt::CTRL+Qt::Key_E );
    file->insertItem( "&Quit",  this, SLOT(closeWindow()), Qt::CTRL+Qt::Key_Q );

    // Make the "Edit" pull down menu.
    QMenu* edit = new QMenu( this );
    menuBar()->insertItem( "&Edit", edit );
    edit->insertItem( "Image Chain",  this, SLOT(editImageChain()));

    // Make the "Utilities" pull down menu.
    QMenu* utilities = new QMenu( this );
    menuBar()->insertItem( "&Utilities", utilities );
    utilities->insertItem( "Refresh",  this, SLOT(refreshDisplay()));

    // Make the "Resolution_Level" pull down menu.
    theResolutionLevelMenu = new QMenu( this );
    menuBar()->insertItem( "&Resolution_Level",  theResolutionLevelMenu);

    QAction* rsetAct = new QAction(QString("0"), this);
    rsetAct->setCheckable(true);
    rsetAct->setChecked(true);
    rsetAct->setData(0);
    rsetAct->setEnabled(false);

    theResolutionLevelMenu->addAction( rsetAct );

    // Connect the activated signal to the changeResolutionLevel slot.
    connect( theResolutionLevelMenu, SIGNAL( triggered( QAction * ) ),
             this, SLOT ( changeResolutionLevel( QAction * ) ) );

    // Make the "Help" pull down menu.
    QMenu* help = new QMenu( this );
    menuBar()->insertItem( "&Help", help );
    help->insertItem( "&About",  this, SLOT(about()), Qt::CTRL+Qt::Key_A );

    // Connect up the slot to capture mouse events.
    connect(theImageWidget,
            SIGNAL(scrollingImageWidgetMouseEvent(ossimQtMouseEvent*)),
            this,
            SLOT(trackImageWidget(ossimQtMouseEvent*)));

    // Add us in as a listener for display events like refresh.
    addListener((ossimConnectableDisplayListener*)this);

    //---
    // Connect this display up to "theImageWidget" so that event propagation
    // comes up the chain to us.
    //---
    connectMyInputTo(theImageWidget);

    // Send a dummy message to make the status bar show.
    statusBar()->message( QString(" ") );

    //---
    // Set the last open directory to the current working dir so the open image
    // dialog will come up where you started.
    //---
    theLastOpenedDirectory = getenv("PWD");
}
Ejemplo n.º 13
0
// MAIN
int main(int argc, char* argv[]) {

    try
    {
        DataParams params(argc, argv);

        params.doSanityChecks();
        int stacksize = params.shape(2);
        Size2D size2 (params.shape(0), params.shape(1)); // isnt' there a slicing operator?


        if(params.getVerbose()) {
            std::cout << "Images with Shape: " << params.shape() << std::endl;
            std::cout << "Processing a stack of " << stacksize << " images..." << std::endl;
        }


        // found spots. One Vector over all images in stack
        // the inner set contains all spots in the image
        std::vector<std::set<Coord<float> > > res_coords(stacksize);

        DImage res((size2-Diff2D(1,1))*params.getFactor()+Diff2D(1,1));
        // check if outfile is writable, otherwise throw error -> exit
        exportImage(srcImageRange(res), ImageExportInfo(params.getOutFile().c_str()));
        std::ofstream cf;
        if(!params.getCoordsFile().empty()) {
            cf.open(params.getCoordsFile());
            vigra_precondition(cf.is_open(), "Could not open coordinate-file for writing.");
        }

        USE_NESTED_TICTOC;
        //USETICTOC;
        TICPUSH;  // measure the time

        // STORM Algorithmut

        CliProgressFunctor func;
        wienerStorm(params, res_coords, func);

        // resulting image
        drawCoordsToImage<Coord<float> >(res_coords, res);

        int numSpots = 0;
        if(cf.is_open()) {
            numSpots = saveCoordsFile(params, cf, res_coords);
            cf.close();
        }

        // end: done.
        std::cout << std::endl << TOCS << std::endl;
        std::cout << "detected " << numSpots << " spots." << std::endl;

        // some maxima are very strong so we scale the image as appropriate :
        double maxlim = 0., minlim = 0;
        findMinMaxPercentile(res, 0., minlim, 0.996, maxlim);
        std::cout << "cropping output values to range [" << minlim << ", " << maxlim << "]" << std::endl;
        if(maxlim > minlim) {
            transformImage(srcImageRange(res), destImage(res), ifThenElse(Arg1()>Param(maxlim), Param(maxlim), Arg1()));
        }
        exportImage(srcImageRange(res), ImageExportInfo(params.getOutFile().c_str()));
        if (!params.getSettingsFile().empty())
            params.save();


    }
    catch (vigra::StdException & e)
    {
        std::cout<<"There was an error:"<<std::endl;
        std::cout << e.what() << std::endl;
        return 1;
    }

    return 0;
}
Ejemplo n.º 14
0
void MainWindow::onExportAsImageActionTriggered()
{
    exportImage("");
}
Ejemplo n.º 15
0
void MainWindow::onExportImageActionTriggered()
{
    exportImage(m_exportPath);
}
Ejemplo n.º 16
0
Window::Window( const QString& scene_name, QWidget* parent )
: QMainWindow( parent )
, m_content_widget( nullptr )
{
  m_content_widget = new ContentWidget{ scene_name, this };

  QMenu* file{ menuBar()->addMenu( tr( "File" ) ) };

  QMenu* view{ menuBar()->addMenu( tr( "View" ) ) };
  
  QAction* separator{ new QAction{ this } };
  separator->setSeparator( true );

  // File menu actions

  // Load the input xml file
  QAction* open_scene{ new QAction{ tr( "Open..." ), this } };
  open_scene->setShortcut( tr( "Ctrl+o" ) );
  file->addAction( open_scene );
  connect( open_scene, SIGNAL( triggered() ), m_content_widget, SLOT( openScene() ) );

  // Reload the current xml file
  QAction* reload_scene{ new QAction{ tr( "Reload" ), this } };
  reload_scene->setShortcut( tr( "Ctrl+r" ) );
  file->addAction( reload_scene );
  connect( reload_scene, SIGNAL( triggered() ), m_content_widget, SLOT( reloadScene() ) );

  // Add a separator
  file->addAction( separator );

  // Export an image of the scene
  QAction* export_image{ new QAction{ tr( "Export Image..." ), this } };
  export_image->setShortcut( tr( "Ctrl+i" ) );
  file->addAction( export_image );
  connect( export_image, SIGNAL( triggered() ), m_content_widget, SLOT( exportImage() ) );

  // Export a movie of the scene
  QAction* export_movie{ new QAction{ tr( "Export Movie..." ), this } };
  export_movie->setShortcut( tr( "Ctrl+m" ) );
  file->addAction( export_movie );
  connect( export_movie, SIGNAL( triggered() ), m_content_widget, SLOT( exportMovie() ) );

  // Add a separator
  QAction* separator2{ new QAction{ this } };
  separator2->setSeparator( true );
  file->addAction( separator2 );
  
  // Export the current camera settings
  QAction* export_camera_settings{ new QAction{ tr( "Export Camera..." ), this } };
  file->addAction( export_camera_settings );
  connect( export_camera_settings, SIGNAL( triggered() ), m_content_widget, SLOT( exportCameraSettings() ) );

  // View menu actions

  // Toggle the heads up display
  QAction* toggle_hud{ new QAction{ tr( "Togge HUD" ), this } };
  toggle_hud->setShortcut( tr( "h" ) );
  view->addAction( toggle_hud );
  connect( toggle_hud, SIGNAL( triggered() ), m_content_widget, SLOT( toggleHUD() ) );

  // Add a separator
  view->addAction( separator );

  // Center the camera
  QAction* center_camera{ new QAction( tr( "Center Camera" ), this ) };
  center_camera->setShortcut( tr( "c" ) );
  view->addAction( center_camera );
  connect( center_camera, SIGNAL( triggered() ), m_content_widget, SLOT( centerCamera() ) );

  setCentralWidget( m_content_widget );  
}
Ejemplo n.º 17
0
void MainWindow2::createMenus()
{
    // ---------- File Menu -------------
    connect(ui->actionNew, SIGNAL(triggered()), this, SLOT(newDocument()));
    connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(openDocument()));
    connect(ui->actionSave_as, SIGNAL(triggered()), this, SLOT(saveAsNewDocument()));
    connect(ui->actionSave, SIGNAL(triggered()), this, SLOT(saveDocument()));
    connect(ui->actionPrint, SIGNAL(triggered()), editor, SLOT(print()));
    connect(ui->actionExit, SIGNAL(triggered()), this, SLOT(close()));

    /// --- Export Menu ---
    connect(ui->actionExport_X_sheet , SIGNAL(triggered()), editor, SLOT(exportX()));
    connect(ui->actionExport_Image_Sequence, SIGNAL(triggered()), editor, SLOT(exportSeq()));
    connect(ui->actionExport_Image, SIGNAL(triggered()), editor, SLOT(exportImage()));
    connect(ui->actionExport_Movie, SIGNAL(triggered()), editor, SLOT(exportMov()));

    //exportFlashAct = new QAction(tr("&Flash/SWF..."), this);
    //exportFlashAct->setShortcut(tr("Ctrl+Alt+F"));
    //connect(exportFlashAct, SIGNAL(triggered()), editor, SLOT(exportFlash()));

    connect(ui->actionExport_Palette, SIGNAL(triggered()), this, SLOT(exportPalette()));

    /// --- Import Menu ---
    connect(ui->actionExport_Svg_Image, SIGNAL(triggered()), editor, SLOT(saveSvg()));
    connect(ui->actionImport_Image, SIGNAL(triggered()), editor, SLOT(importImage()));
    connect(ui->actionImport_Image_Sequence, SIGNAL(triggered()), editor, SLOT(importImageSequence()));
    connect(ui->actionImport_Movie, SIGNAL(triggered()), editor, SLOT(importMov()));
    connect(ui->actionImport_Sound, SIGNAL(triggered()), editor, SLOT(importSound()));
    connect(ui->actionImport_Palette, SIGNAL(triggered()), this, SLOT(importPalette()));

    /// --- Edit Menu ---
    connect(ui->actionUndo, SIGNAL(triggered()), editor, SLOT(undo()));
    connect(ui->actionRedo, SIGNAL(triggered()), editor, SLOT(redo()));
    connect(ui->actionCut, SIGNAL(triggered()), editor, SLOT(cut()));
    connect(ui->actionCopy, SIGNAL(triggered()), editor, SLOT(copy()));
    connect(ui->actionPaste, SIGNAL(triggered()), editor, SLOT(paste()));
    connect(ui->actionDelete, SIGNAL(triggered()), editor, SLOT(clearCurrentFrame()));
    connect(ui->actionCrop, SIGNAL(triggered()), editor, SLOT(crop()));
    connect(ui->actionCrop_To_Selection, SIGNAL(triggered()), editor, SLOT(croptoselect()));
    connect(ui->actionSelect_All, SIGNAL(triggered()), editor, SIGNAL(selectAll()));
    connect(ui->actionDeselect_All, SIGNAL(triggered()), editor, SLOT(deselectAll()));
    connect(ui->actionPreference, SIGNAL(triggered()), this, SLOT(showPreferences()));

    ui->actionRedo->setEnabled(false);

    /// --- Layer Menu ---
    connect(ui->actionNew_Bitmap_Layer, SIGNAL(triggered()), editor, SLOT(newBitmapLayer()));
    connect(ui->actionNew_Vector_Layer, SIGNAL(triggered()), editor, SLOT(newVectorLayer()));
    connect(ui->actionNew_Sound_Layer, SIGNAL(triggered()), editor, SLOT(newSoundLayer()));
    connect(ui->actionNew_Camera_Layer, SIGNAL(triggered()), editor, SLOT(newCameraLayer()));
    connect(ui->actionDelete_Current_Layer, SIGNAL(triggered()), editor, SLOT(deleteCurrentLayer()));

    /// --- View Menu ---
    connect(ui->actionZoom_In, SIGNAL(triggered()), editor, SLOT(setzoom()));
    connect(ui->actionZoom_Out, SIGNAL(triggered()), editor, SLOT(setzoom1()));
    connect(ui->actionRotate_Clockwise, SIGNAL(triggered()), editor, SLOT(rotatecw()));
    connect(ui->actionRotate_Anticlosewise, SIGNAL(triggered()), editor, SLOT(rotateacw()));
    connect(ui->actionReset_Windows, SIGNAL(triggered()), this, SLOT(dockAllPalettes()));
    connect(ui->actionReset_View, SIGNAL(triggered()), editor, SLOT(resetView()));
    connect(ui->actionHorizontal_Flip, SIGNAL(triggered()), editor, SLOT(toggleMirror()));
    connect(ui->actionVertical_Flip, SIGNAL(triggered()), editor, SLOT(toggleMirrorV()));

    ui->actionPreview->setEnabled(false);
    //#	connect(previewAct, SIGNAL(triggered()), editor, SLOT(getCameraLayer()));//TODO: Preview view

    ui->actionGrid->setEnabled(false);
    connect(ui->actionGrid, SIGNAL(triggered()), editor, SLOT(gridview())); //TODO: Grid view

    connect(ui->actionOnionPrevious, SIGNAL(triggered(bool)), editor, SIGNAL(toggleOnionPrev(bool)));
    connect(editor, SIGNAL(onionPrevChanged(bool)), ui->actionOnionPrevious, SLOT(setChecked(bool)));

    connect(ui->actionOnionNext, SIGNAL(triggered(bool)), editor, SIGNAL(toggleOnionNext(bool)));
    connect(editor, SIGNAL(onionNextChanged(bool)), ui->actionOnionNext, SLOT(setChecked(bool)));

    /// --- Animation Menu ---
    connect(ui->actionPlay, SIGNAL(triggered()), editor, SLOT(play()));
    connect(ui->actionLoop, SIGNAL(triggered(bool)), editor, SLOT(setLoop(bool)));
    connect(ui->actionLoop, SIGNAL(toggled(bool)), editor, SIGNAL(toggleLoop(bool))); //TODO: WTF?
    connect(editor, SIGNAL(loopToggled(bool)), ui->actionLoop, SLOT(setChecked(bool)));

    connect(ui->actionAdd_Frame, SIGNAL(triggered()), editor, SLOT(addKey()));
    connect(ui->actionRemove_Frame, SIGNAL(triggered()), editor, SLOT(removeKey()));
    connect(ui->actionNext_Frame, SIGNAL(triggered()), editor, SLOT(playNextFrame()));
    connect(ui->actionPrevious_Frame, SIGNAL(triggered()), editor, SLOT(playPrevFrame()));
    connect(ui->actionNext_Keyframe, SIGNAL(triggered()), editor, SLOT(scrubNextKeyframe()));
    connect(ui->actionPrev_Keyframe, SIGNAL(triggered()), editor, SLOT(scrubPreviousKeyframe()));
    connect(ui->actionDuplicate_Frame, SIGNAL(triggered()), editor, SLOT(duplicateKey()));

    /// --- Tool Menu ---
    connect(ui->actionClear, SIGNAL(triggered()), editor, SLOT(clearCurrentFrame()));

    connect(ui->actionMove, SIGNAL(triggered()), m_toolSet, SLOT(moveOn()));
    connect(ui->actionSelect, SIGNAL(triggered()), m_toolSet, SLOT(selectOn()));
    connect(ui->actionBrush, SIGNAL(triggered()), m_toolSet, SLOT(brushOn()));
    connect(ui->actionPolyline, SIGNAL(triggered()), m_toolSet, SLOT(polylineOn()));
    connect(ui->actionSmudge, SIGNAL(triggered()), m_toolSet, SLOT(smudgeOn()));
    connect(ui->actionPen, SIGNAL(triggered()), m_toolSet, SLOT(penOn()));
    connect(ui->actionHand, SIGNAL(triggered()), m_toolSet, SLOT(handOn()));
    connect(ui->actionPencil, SIGNAL(triggered()), m_toolSet, SLOT(pencilOn()));
    connect(ui->actionBucket, SIGNAL(triggered()), m_toolSet, SLOT(bucketOn()));
    connect(ui->actionEyedropper, SIGNAL(triggered()), m_toolSet, SLOT(eyedropperOn()));
    connect(ui->actionEraser, SIGNAL(triggered()), m_toolSet, SLOT(eraserOn()));

    connect(ui->actionResetToolsDefault, SIGNAL(triggered()), this, SLOT(resetToolsSettings()));

    /// --- Help Menu ---
    connect(ui->actionHelp, SIGNAL(triggered()), this, SLOT(helpBox()));
    connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(aboutPencil()));

    // --------------- Menus ------------------
    openRecentMenu = new QMenu(tr("Open recent"), this);

    connect(ui->menuEdit, SIGNAL(aboutToShow()), this, SLOT(undoActSetText()));
    connect(ui->menuEdit, SIGNAL(aboutToHide()), this, SLOT(undoActSetEnabled()));


}
    //---------------------------------------------------------------
    void EffectTextureExporter::exportTexture (
        COLLADASW::Texture* colladaTexture,
        String channelSemantic,
        const MObject& texture,
        int blendMode,
        const String& targetPath )
    {
        mAnimationTargetPath = targetPath;

        // Set the image name
        String colladaImageId = exportImage ( texture );
        colladaTexture->setImageId ( colladaImageId );
        colladaTexture->setTexcoord ( channelSemantic );

        // Get the current stream writer
        COLLADASW::StreamWriter* streamWriter = mDocumentExporter->getStreamWriter();

        // Create the sampler
        String samplerSid = colladaImageId + COLLADASW::Sampler::SAMPLER_SID_SUFFIX;
        String surfaceSid = colladaImageId + COLLADASW::Sampler::SURFACE_SID_SUFFIX;

        COLLADASW::Sampler sampler ( COLLADASW::Sampler::SAMPLER_TYPE_2D, samplerSid, surfaceSid );
        sampler.setFormat ( FORMAT );
        sampler.setImageId ( colladaImageId );

        colladaTexture->setSampler ( sampler );

        // Add 2D placement parameters
        add2DPlacement ( colladaTexture, texture );

        // Check for 3D projection node
        MObject colorReceiver = DagHelper::getSourceNodeConnectedTo ( texture, ATTR_OUT_COLOR );
        if ( colorReceiver != MObject::kNullObj && colorReceiver.apiType() == MFn::kProjection )
        {
            add3DProjection ( colladaTexture, colorReceiver );
        }

        // Add blend mode information
        String blendModeString = getBlendMode ( blendMode );
        colladaTexture->addExtraTechniqueParameter ( PROFILE_MAYA, MAYA_TEXTURE_BLENDMODE_PARAMETER, blendModeString );

        // Wrap elements
        switch ( colladaTexture->getSampler().getSamplerType() )
        {

        case COLLADASW::Sampler::SAMPLER_TYPE_1D:
            sampler.setWrapS ( COLLADASW::Sampler::WRAP_MODE_WRAP );
            break;

        case COLLADASW::Sampler::SAMPLER_TYPE_2D:
        {
            sampler.setWrapS ( COLLADASW::Sampler::WRAP_MODE_WRAP );
            sampler.setWrapT ( COLLADASW::Sampler::WRAP_MODE_WRAP );
        }
        break;

        case COLLADASW::Sampler::SAMPLER_TYPE_3D:
        case COLLADASW::Sampler::SAMPLER_TYPE_CUBE:
        {
            sampler.setWrapS ( COLLADASW::Sampler::WRAP_MODE_WRAP );
            sampler.setWrapT ( COLLADASW::Sampler::WRAP_MODE_WRAP );
            sampler.setWrapP ( COLLADASW::Sampler::WRAP_MODE_WRAP );
        }
        break;
        }

        sampler.setMinFilter ( COLLADASW::Sampler::SAMPLER_FILTER_NONE );
        sampler.setMagFilter ( COLLADASW::Sampler::SAMPLER_FILTER_NONE );
        sampler.setMipFilter ( COLLADASW::Sampler::SAMPLER_FILTER_NONE );
    }
Ejemplo n.º 19
0
void QRImageWidget::copyImage()
{
    if(!pixmap())
        return;
    QApplication::clipboard()->setImage(exportImage());
}
Ejemplo n.º 20
0
/* Processes the events from the menu */
void processMenu(int value) {
	switch (value) {
		// Set colour	
		case BLACK:
			Model::getInstance()->setColour(0.0f, 0.0f, 0.0f);
			Controller::penType = true;
			break;
		case RED:
			Model::getInstance()->setColour(2.5f, 0.0f, 0.0f);
			Controller::penType = true;
			break;
		case GREEN:
			Model::getInstance()->setColour(0.0f, 2.5f, 0.0f);
			Controller::penType = true;
			break;
		case BLUE:
			Model::getInstance()->setColour(0.0f, 0.0f, 2.5f);
			Controller::penType = true;
			break;
		case YELLOW:
			Model::getInstance()->setColour(4.5f, 4.5f, 0.5f);
			Controller::penType = true;
			break;
		
		// Set pen type
		case PEN:
			Controller::penType = true;
			Controller::shape = false;
			break;
		case ERASER:
			Controller::penType = false;
			break;
		case EXIT:
			// Probably should shut stuff down properly
			exit(0);
		
		// Set the width of the line 
		case POINTLARGE:
			Controller::pointSize = 12.0f;
			Controller::penType = true;
			break;
		case POINTMEDIUM:
			Controller::pointSize = 6.0f;
			Controller::penType = true;
			break;
		case POINTSMALL:
			Controller::pointSize = 3.0f;
			Controller::penType = true;
			break;
		
		// Set shape options 	
		case RECTANGLE:
			Controller::shape = !Controller::shape;
			Controller::shapeType = Rectangle;
			break;
		case CIRCLE:
			
			break;
			
		// Set the display type 
		case STEREO:
			Settings::stereoMode = STEREOMODE;
			break;
		case MONO:
			Settings::stereoMode = MONOMODE;
			break;
		case ANAGLYPH:
			Settings::stereoMode = ANAGLYPHMODE;
			break;
		
		// File options
		case NEWIMAGE:
			Model::getInstance()->clearData();
		case EXPORT:
			toExport = true;
			exportImage();
			toExport = false;
			break;
		case SAVE: {
			if (!fileOpen) {
				SaveBrowser *sB = new SaveBrowser(mainWindow, &fName, &save);
				sB->buildInterface();
			}
			else {
				save = true;
			}
		}
		break;
		case OPEN: {
			FileBrowser *fb = new FileBrowser(mainWindow, &fName, &fileOpen);
			fb->buildInterface();
			break;
		}
		case OPENXML: {
			
			break;	
		}
		case SAVEXML: {
			Model::getInstance()->saveXML("test3d.xml");
			break;
		}
		case BACKGROUNDIMAGE: {
			ImageBrowser *imBrowser = new ImageBrowser(mainWindow, &backgroundName, &setBackground);
			imBrowser->buildInterface();
			break;
		}
		case STEREOBACKGROUNDIMAGE: {
			StereoBrowser *stereoBrowser = new StereoBrowser(mainWindow, &leftBackground, &rightBackground, &setStereoBackground);
			stereoBrowser->buildInterface();
			break;
		}
		default:
			break;
	}
}