void saveImage(int w, int h, rgb_t **tex, char *filename, int fileType) {
	if (fileType == PNG) {
		saveAsPNG(w, h, tex, strcat(filename, ".png"));
	} else {
		saveAsPPM(w, h, tex, strcat(filename, ".ppm"));
	}
}
RealTimePlotWindow::RealTimePlotWindow(QWidget *parent) :
    QMainWindow(parent),
    keyCounter(0),
    wait(0),
    MPS(0),
   // dialogWindow(0),
    measurementState(false),
    triger(false),
    ui(new Ui::RealTimePlotWindow)
{
    ui->setupUi(this);

    setWindowTitle("SkateboardAnalyzer v0.5 measuring");
    setWindowIcon(QIcon(":/skate"));

    //--------------SETS VARIABLES--------------//
    dialogWindow = new DialogWindow(this);
    instValWindow = new instValuesWindow(this);
    saveGraphWindow = new SaveGraphWindow(this);

    timer = new QTimer(this);
    timer->start(200);

    instValues = new QVector<double> (10);

    //---------------------------------------------------//
    //-----------------CONNECTS--------------------------//
    //---------------------------------------------------//
    //buttons
  //  connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(close()));
    connect(ui->terminalButton, SIGNAL(clicked()), SLOT(onTerminalButton()));
    connect(ui->instantValuesButton, SIGNAL(clicked()), SLOT(onInstButton()));

    connect(ui->stopButton, SIGNAL(clicked()), SLOT(onStopButton()));
    connect(ui->startButton, SIGNAL(clicked()), SLOT(onStartButton()));

    connect(saveGraphWindow, SIGNAL(putGraphsAsPNG(QString)),this, SLOT(saveAsPNG(QString)));
    connect(saveGraphWindow, SIGNAL(putGraphsAsBMP(QString)),this, SLOT(saveAsBMP(QString)));
    connect(saveGraphWindow, SIGNAL(putGraphsAsPDF(QString)),this, SLOT(saveAsPDF(QString)));
    connect(saveGraphWindow, SIGNAL(putGraphsAsJPG(QString)),this, SLOT(saveAsJPG(QString)));

    connect(ui->saveGraphButton, SIGNAL(clicked()), SLOT(onSaveGraphButton()));

    //dialog window
    connect(dialogWindow, SIGNAL(dataAvaible(QByteArray)), this, SLOT(dataAvaible(QByteArray)));
    //timers
    connect(timer, SIGNAL(timeout()), this, SLOT(onTimer()));


    //--------------ON PLOTS-----------------//
     ui->accPlot->replot();
     ui->gyroPlot->replot();
     startGraph(ui->accPlot, ui->gyroPlot/*, ui->an_gyroPlot*/);
}
Example #3
0
void MainWindow::createActions()
 {
     openAct = new QAction(tr("&Open..."), this);
     openAct->setShortcuts(QKeySequence::Open);
     openAct->setStatusTip(tr("Open an existing file"));
     connect(openAct, SIGNAL(triggered()), this, SLOT(open()));

     saveAct = new QAction(tr("&Save..."), this);
     saveAct->setShortcuts(QKeySequence::Save);
     saveAct->setStatusTip(tr("Save this file on a disk"));
     connect(saveAct, SIGNAL(triggered()), this, SLOT(save()));

     savePNGAct = new QAction(tr("&Save as PNG..."), this);
     saveAct->setStatusTip(tr("Save this file on a disk as PNG"));
     connect(savePNGAct, SIGNAL(triggered()), this, SLOT(saveAsPNG()));
}