Skip to content

Commit

Permalink
tiff support added to align!
Browse files Browse the repository at this point in the history
  • Loading branch information
RussellGarwood committed Feb 1, 2020
1 parent 40b95d8 commit ac21b56
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions SPIERSalign/src/mainwindowimpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ MainWindowImpl::MainWindowImpl(QWidget *parent, Qt::WindowFlags f)
//Set up initial variables
setupUi(this);

qDebug() << QImageWriter::supportedImageFormats();

setWindowTitle(QString(PRODUCTNAME) + " - Version " + QString(SOFTWARE_VERSION));

showMaximized();
Expand Down Expand Up @@ -1949,7 +1951,7 @@ void MainWindowImpl::on_actionOpen_triggered()
recentFile(filesDirectoryString);

QStringList FilterList;
FilterList << "*.bmp" << "*.jpg" << "*.jpeg" << "*.png";
FilterList << "*.bmp" << "*.jpg" << "*.jpeg" << "*.png" << "*.tiff" << "*.tif";
drectoryFileList = filesDirectory.entryList(FilterList, QDir::Files, QDir::Name);

if (drectoryFileList.count() == 0)
Expand Down Expand Up @@ -2101,12 +2103,14 @@ void MainWindowImpl::on_actionOpen_triggered()
for (i = 0; i < imageList.count(); i++)
{
imageList[i]->format = -1;
if (imageList[i]->fileName.endsWith(".tif", Qt::CaseInsensitive) || imageList[i]->fileName.endsWith(".tiff", Qt::CaseInsensitive))imageList[i]->format = 3;
if (imageList[i]->fileName.endsWith(".png", Qt::CaseInsensitive))imageList[i]->format = 2;
if (imageList[i]->fileName.endsWith(".jpg", Qt::CaseInsensitive) || imageList[i]->fileName.endsWith(".jpeg", Qt::CaseInsensitive))imageList[i]->format = 1;
if (imageList[i]->fileName.endsWith(".bmp", Qt::CaseInsensitive))imageList[i]->format = 0;

if (imageList[i]->format == -1)
{
QMessageBox::warning(this, "Error", "Please check extensions - should be either .jpg, .jpeg, .bmp or .png", QMessageBox::Ok);
QMessageBox::warning(this, "Error", "Please check extensions - should be either .jpg, .jpeg, .bmp, .tif, .tiff or .png", QMessageBox::Ok);
return;
}
}
Expand Down Expand Up @@ -3442,6 +3446,7 @@ void MainWindowImpl::on_actionApply_Propogation_triggered()
if (imageList[i]->format == 0)imageToDraw.save(savename, "BMP", 100);
if (imageList[i]->format == 1)imageToDraw.save(savename, "JPG", 100);
if (imageList[i]->format == 2)imageToDraw.save(savename, "PNG", 50);
if (imageList[i]->format == 3)imageToDraw.save(savename, "TIFF");
}
}
else if (actionLock_Back->isChecked())
Expand Down Expand Up @@ -3552,6 +3557,7 @@ void MainWindowImpl::on_actionApply_Propogation_triggered()
if (imageList[i]->format == 0)imageToDraw.save(savename, "BMP", 100);
if (imageList[i]->format == 1)imageToDraw.save(savename, "JPG", 100);
if (imageList[i]->format == 2)imageToDraw.save(savename, "PNG", 50);
if (imageList[i]->format == 3)imageToDraw.save(savename, "TIFF");
}
}
else QMessageBox::warning(this, "Error", "You should never see this - propagation failed, email me.", QMessageBox::Ok);
Expand Down Expand Up @@ -4356,6 +4362,7 @@ void MainWindowImpl::on_actionLoad_Settings_File_triggered()
for (i = 0; i < imageList.count(); i++)
{
imageList[i]->format = -1;
if (imageList[i]->fileName.endsWith(".tif", Qt::CaseInsensitive) || imageList[i]->fileName.endsWith(".tiff", Qt::CaseInsensitive))imageList[i]->format = 3;
if (imageList[i]->fileName.endsWith(".png", Qt::CaseInsensitive))imageList[i]->format = 2;
if (imageList[i]->fileName.endsWith(".jpg", Qt::CaseInsensitive) || imageList[i]->fileName.endsWith(".jpeg", Qt::CaseInsensitive))imageList[i]->format = 1;
if (imageList[i]->fileName.endsWith(".bmp", Qt::CaseInsensitive))imageList[i]->format = 0;
Expand Down Expand Up @@ -4430,6 +4437,7 @@ void MainWindowImpl::on_actionLoad_Settings_File_triggered()
if (imageList[i]->format == 0)imageToDraw.save(savename, "BMP", 100);
if (imageList[i]->format == 1)imageToDraw.save(savename, "JPG", 100);
if (imageList[i]->format == 2)imageToDraw.save(savename, "PNG", 50);
if (imageList[i]->format == 3)imageToDraw.save(savename, "TIFF");

redrawImage();
}
Expand Down

0 comments on commit ac21b56

Please sign in to comment.