示例#1
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent)
  ,ui(new Ui::MainWindow)
  ,mStartDelay( 0 )
  ,mPrevMode( 0 )
  ,mLastCapture( 0 )
{
    ui->setupUi(this);

    ui->previewLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    ui->previewLabel->setAlignment(Qt::AlignCenter);
    ui->previewLabel->setMinimumSize(240, 160);

    pProgress = new QProgressBar(0);
    statusBar()->addPermanentWidget( pProgress );

    QMenu *saveMenu = new QMenu( this );
    QAction *pAct;

#ifdef WITH_ANIMATED_GIF
    pAct = saveMenu->addAction( tr( "Save GIF" ), this, SLOT(saveGif()) );
    pAct = saveMenu->addAction( tr( "Save customized GIF" ), this, SLOT(saveGifCustom()) );
    pAct->setEnabled( false );
#endif // WITH_ANIMATED_GIF

    pAct = saveMenu->addAction( tr( "Save separated PNGs" ), this, SLOT(saveSeria()) );
    pAct = saveMenu->addAction( tr( "Copy last to clipboard" ), this, SLOT(saveCopy()) );
    pAct = saveMenu->addAction( tr( "Send to" ), this, SLOT(saveSendTo()) );
    pAct->setEnabled( false );

    ui->saveButton->setMenu( saveMenu );

    pGrabber = new LSCCapturer( this );


    showSaveProgress( 0,0 );

    if( !loadPlugins() )
    {
        qWarning() << "Not found plugins! Aborting.";
        QTimer::singleShot( 10, qApp, SLOT(quit()) ) ;
    }

    pGrabber->setAreaSelector( plugins.at( 0 ) );

    connect( pGrabber, SIGNAL(finished()),
             this, SLOT(finishCapturing()) );
    connect( pGrabber, SIGNAL(savingProgress(int, int, QString)),
         this, SLOT(showSaveProgress( int, int, QString )));

    on_snapshotOneBtn_clicked();
}
示例#2
0
void GifWidget::save()
{
     qDebug() << "saving gif...";

     QString filename = QFileDialog::getSaveFileName(
	  this, tr("Save GIF file"), 
	  set->value("last_gif_dir","").toString()+
	  (suggestedName.isEmpty() ? "" : "/"+suggestedName+".gif"),
	  "GIF files (*.gif);;All files (*.*)");

     if(filename.isEmpty())
	  return;

     if(!prevFrames.size())
	  return;
     saveGif(filename);
}