Exemple #1
0
void SLStudio::onActionLoadCalibration(){
    QString fileName = QFileDialog::getOpenFileName(this, "Choose calibration file", QString(), "*.xml");
    if(!(fileName.length() == 0)){
        CalibrationData calibration;
        calibration.load(fileName);
        calibration.save("calibration.xml");
    }
}
void SLStudio::onActionExportCalibration() {
    CalibrationData calibration;
    calibration.load("calibration.xml");
//  Non native file dialog
//    QFileDialog saveFileDialog(this, "Export Calibration", QString(), "*.slcalib;;*.xml;;*.m");
//    saveFileDialog.setDefaultSuffix("slcalib");
//    saveFileDialog.exec();
//    QString fileName = saveFileDialog.selectedFiles().first();
//  Native file dialog
    QString selectedFilter;
    QString fileName = QFileDialog::getSaveFileName(this, "Export Calibration", QString(), "*.slcalib;;*.xml;;*.m", &selectedFilter);
    QFileInfo info(fileName);
    QString type = info.suffix();
    if(type == "")
        fileName.append(selectedFilter.remove(0,1));
    calibration.save(fileName);
}