Skip to content

Commit

Permalink
Merge branch 'testbuild'
Browse files Browse the repository at this point in the history
  • Loading branch information
CarVac committed Oct 28, 2020
2 parents 6ae941d + afe6a9c commit 3fa7f70
Show file tree
Hide file tree
Showing 44 changed files with 1,485 additions and 682 deletions.
13 changes: 7 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@ dist: xenial
before_install:
# C++14
- sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
# Qt 5.14.2
- sudo add-apt-repository ppa:beineri/opt-qt-5.14.2-xenial -y
# Qt 5.15.0
- sudo add-apt-repository ppa:beineri/opt-qt-5.15.0-xenial -y
- sudo apt-get update -qq

install:
# C++14
- sudo apt-get -y install g++-9
- sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 90
# Qt 5.14.2
- sudo apt-get -y install qt514base qt514declarative qt514quickcontrols qt514quickcontrols2 libtiff-dev libgomp1 libexiv2-dev libjpeg-dev libglibmm-2.4-dev libgl1-mesa-dev libglu1-mesa-dev mesa-common-dev libcurl4-openssl-dev libarchive-dev
- source /opt/qt514/bin/qt514-env.sh
# Qt 5.15.0
- sudo apt-get -y install qt515base qt515declarative qt515quickcontrols qt515quickcontrols2 libtiff-dev libgomp1 libexiv2-dev libjpeg-dev libglibmm-2.4-dev libgl1-mesa-dev libglu1-mesa-dev mesa-common-dev libcurl4-openssl-dev libarchive-dev
- source /opt/qt515/bin/qt515-env.sh

script:
#build libraw
- git clone https://github.com/LibRaw/LibRaw.git
- cd LibRaw
- git checkout 0.19-stable
- git checkout 0209b6a2caec189e6d1a9b21c10e9e49f46e5a92 #0.20-Release
- git apply ../patches/libraw-makefile.patch
- make -j3 -f Makefile.dist
- sudo make install -f Makefile.dist
Expand Down Expand Up @@ -64,6 +64,7 @@ script:
- sed -i -e 's|^Exec=.*|Exec=filmulator-gui|g' appdir/usr/share/applications/filmulator-gui.desktop
- mkdir -p appdir/usr/share/icons/hicolor/64x64/apps/
- cp ../filmulator-gui64.png appdir/usr/share/icons/hicolor/64x64/apps/filmulator-gui.png
- cp ../filmulator-gui64.png appdir/filmulator-gui.png
- find appdir/
- wget -c "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage"
- chmod a+x linuxdeployqt*.AppImage
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ libarchive
```
We highly encourage you to compile libraw yourself to ensure you have support for recent cameras.

It also requires Qt 5.14 or newer: open the `.pro` file from Qt Creator and select `Build` in order to run it. You may have to initialize the build configurations upon first loading the project; I suggest you add the `-j#` flag to the `Make build` parameters to speed compilation.
It also requires Qt 5.15 or newer: open the `.pro` file from Qt Creator and select `Build` in order to run it. You may have to initialize the build configurations upon first loading the project; I suggest you add the `-j#` flag to the `Make build` parameters to speed compilation.

A note: Use a standalone git client to clone the repository initially, and then you can use Qt Creator's built-in git tools.

Expand Down
1 change: 1 addition & 0 deletions filmulator-gui/core/exposure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ void exposure(matrix<float> &input_image, float crystals_per_pixel,
{
rolloff_boundary = std::max(std::min(rolloff_boundary, 65534.f), 1.f);
toe_boundary = std::max(std::min(toe_boundary, rolloff_boundary/2),0.f);//bound this to lower than half the rolloff boundary
rolloff_boundary = std::min(65535.f, rolloff_boundary - toe_boundary);//we mustn't let rolloff boundary exceed 65535
const int nrows = input_image.nr();
const int ncols = input_image.nc();
const float max_crystals = 65535.f - toe_boundary;
Expand Down
4 changes: 2 additions & 2 deletions filmulator-gui/core/imagePipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ int ImagePipeline::libraw_callback(void *data, LibRaw_progress, int, int)
}

matrix<unsigned short>& ImagePipeline::processImage(ParameterManager * paramManager,
Interface * interface_in,
Exiv2::ExifData &exifOutput)
Interface * interface_in,
Exiv2::ExifData &exifOutput)
{
//Say that we've started processing to prevent cache status from changing..
hasStartedProcessing = true;
Expand Down
5 changes: 3 additions & 2 deletions filmulator-gui/core/imagePipeline.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ class ImagePipeline

//Loads and processes an image according to the 'params' structure, monitoring 'aborted' for cancellation.
matrix<unsigned short>& processImage(ParameterManager * paramManager,
Interface * histoInterface,
Exiv2::ExifData &exifOutput);
Interface * histoInterface,
Exiv2::ExifData &exifOutput);

//Returns the progress of the pipeline from 0, incomplete, to 1, complete.
float getProgress(){return progress;}
Expand Down Expand Up @@ -77,6 +77,7 @@ class ImagePipeline
matrix<float> recovered_image;
matrix<float> pre_film_image;
Exiv2::ExifData exifData;
Exiv2::ExifData basicExifData;//for tiff writing
matrix<float> filmulated_image;
matrix<unsigned short> contrast_image;
matrix<unsigned short> color_curve_image;
Expand Down
2 changes: 1 addition & 1 deletion filmulator-gui/core/imwriteTiff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ bool imwrite_tiff(const matrix<unsigned short>& output, string outputfilename,
assert(image.get() != 0);

image->setExifData(exifData);
//image->writeMetadata();
image->writeMetadata();

return 0;
}
86 changes: 83 additions & 3 deletions filmulator-gui/database/importModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ ImportModel::ImportModel(QObject *parent) : SqlModel(parent)
const QDateTime,
const bool,
const bool,
const bool,
const bool)),
worker, SLOT(importFile(const QFileInfo,
const int,
Expand All @@ -40,6 +41,7 @@ ImportModel::ImportModel(QObject *parent) : SqlModel(parent)
const QDateTime,
const bool,
const bool,
const bool,
const bool)));
connect(worker, SIGNAL(doneProcessing(bool)), this, SLOT(workerFinished(bool)));
connect(worker, SIGNAL(enqueueThis(QString)), this, SLOT(enqueueRequested(QString)));
Expand Down Expand Up @@ -172,6 +174,7 @@ void ImportModel::importDirectory_r(const QString dir, const bool importInPlace,
params.appendHashParam = appendHash;
params.importInPlace = importInPlace;
params.replaceLocation = replaceLocation;
params.noThumbnail = false;
queue.push_back(params);
maxQueue++;
}
Expand All @@ -195,7 +198,7 @@ QStringList ImportModel::getNameFilters()
return dirNameFilters;
}

//This imports a single file, taking in a file path URL as a QString.
//This puts a single file onto the import queue, taking in a file path URL as a QString.
//If invalid, returns Validity::invalid
Validity ImportModel::importFile(const QString name, const bool importInPlace, const bool replaceLocation, const bool onlyCheck)
{
Expand Down Expand Up @@ -265,6 +268,7 @@ Validity ImportModel::importFile(const QString name, const bool importInPlace, c
params.appendHashParam = appendHash;
params.importInPlace = importInPlace;
params.replaceLocation = replaceLocation;
params.noThumbnail = false;
queue.push_back(params);
maxQueue++;

Expand All @@ -277,7 +281,7 @@ Validity ImportModel::importFile(const QString name, const bool importInPlace, c
return Validity::valid;
}

//This will import multiple files recursively.
//This imports multiple files, recursively.
void ImportModel::importFileList(const QString name, const bool importInPlace, const bool replaceLocation)
{
Validity validity = Validity::valid;
Expand Down Expand Up @@ -306,6 +310,81 @@ void ImportModel::importFileList(const QString name, const bool importInPlace, c
}
}

//This imports a single file synchronously, taking in a file path URL as a QString.
//It returns the searchID of the file.
//If it fails, it returns an empty QString.
QString ImportModel::importFileNow(const QString name, Settings * settingsObj)
{

//Check for "url://" at the beginning
//On Windows, for some reason there's an extra / that must be removed
#ifdef Q_OS_WIN
const int count = name.startsWith("file://") ? 8 : 0;
#else
const int count = name.startsWith("file://") ? 7 : 0;
#endif

//Then check that it's a real file.
const QFileInfo file = QFileInfo(name.mid(count));
if (!file.isFile())
{
cout << "File not found: " << name.toStdString() << endl;
cout << "# chars removed: " << count << endl;
invalidFile = true;
return "";
}

bool isReadableFile = false;
//And then check if the file extension indicates that it's raw.
for (int i = 0; i < rawNameFilters.size(); i++)
{
if (file.fileName().endsWith(rawNameFilters.at(i).mid(1)))
{
isReadableFile = true;
}
}
//Future type checks go here.
//Now we tell the GUI the result:
if (!isReadableFile)
{
cout << "File " << file.fileName().toStdString() << " not readable file type" << endl;
return "";
}

QDateTime now = QDateTime::currentDateTime();
importParams params;
params.fileInfoParam = file;
params.importTZParam = settingsObj->getImportTZ();
params.cameraTZParam = settingsObj->getCameraTZ();
params.photoDirParam = "";
params.backupDirParam = "";
params.dirConfigParam = "";
params.importStartTimeParam = now;
params.appendHashParam = false;
params.importInPlace = true;
params.replaceLocation = true;
params.noThumbnail = true;

ImportWorker * worker = new ImportWorker;
const QString searchID = worker->importFile(params.fileInfoParam,
params.importTZParam,
params.cameraTZParam,
params.photoDirParam,
params.backupDirParam,
params.dirConfigParam,
params.importStartTimeParam,
params.appendHashParam,
params.importInPlace,
params.replaceLocation,
params.noThumbnail);
delete worker;
if (searchID != "")
{
emit enqueueThis(searchID);
}
return searchID;
}

void ImportModel::workerFinished(bool changedST)
{
QMutexLocker locker(&mutex);
Expand Down Expand Up @@ -366,5 +445,6 @@ void ImportModel::startWorker(const importParams params)
const bool append = params.appendHashParam;
const bool inPlace = params.importInPlace;
const bool replaceLocation = params.replaceLocation;
emit workForWorker(info, iTZ, cTZ, pDir, bDir, dConf, time, append, inPlace, replaceLocation);
const bool noThumbnail = params.noThumbnail;
emit workForWorker(info, iTZ, cTZ, pDir, bDir, dConf, time, append, inPlace, replaceLocation, noThumbnail);
}
6 changes: 5 additions & 1 deletion filmulator-gui/database/importModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <QMutexLocker>
#include <QDateTime>
#include <QStringList>
#include "../ui/settings.h"

struct importParams {
QFileInfo fileInfoParam;
Expand All @@ -24,6 +25,7 @@ struct importParams {
bool appendHashParam;
bool importInPlace;
bool replaceLocation;
bool noThumbnail;
};

enum Validity {
Expand Down Expand Up @@ -57,6 +59,7 @@ class ImportModel : public SqlModel
Q_INVOKABLE bool pathWritable(const QString dir);
Q_INVOKABLE void importDirectory_r(const QString dir, const bool importInPlace, const bool replaceLocation, const int depth = 0);
Q_INVOKABLE Validity importFile(const QString name, const bool importInPlace, const bool replaceLocation, const bool onlyCheck);
Q_INVOKABLE QString importFileNow(const QString name, Settings * settingsObj);
Q_INVOKABLE void importFileList(const QString name, const bool importInPlace, const bool replaceLocation);
Q_INVOKABLE QStringList getNameFilters();

Expand Down Expand Up @@ -124,7 +127,8 @@ public slots:
const QDateTime importStartTime,
const bool appendHash,
const bool importInPlace,
const bool replaceLocation);
const bool replaceLocation,
const bool noThumbnail);

void importChanged();

Expand Down
44 changes: 34 additions & 10 deletions filmulator-gui/database/importWorker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ImportWorker::ImportWorker(QObject *parent) : QObject(parent)
{
}

void ImportWorker::importFile(const QFileInfo infoIn,
QString ImportWorker::importFile(const QFileInfo infoIn,
const int importTZ,
const int cameraTZ,
const QString photoDir,
Expand All @@ -19,7 +19,8 @@ void ImportWorker::importFile(const QFileInfo infoIn,
const QDateTime importStartTime,
const bool appendHash,
const bool importInPlace,
const bool replaceLocation)
const bool replaceLocation,
const bool noThumbnail)
{
//Generate a hash of the raw file.
QCryptographicHash hash(QCryptographicHash::Md5);
Expand Down Expand Up @@ -157,10 +158,6 @@ void ImportWorker::importFile(const QFileInfo infoIn,
}
}





//Check to see if it's already present in the database.
//Open a new database connection for the thread
QSqlDatabase db = getDB();
Expand All @@ -179,6 +176,7 @@ void ImportWorker::importFile(const QFileInfo infoIn,
//And we're not updating locations
// (if we are updating locations, we don't want it to add new things to the db)
bool changedST = false;
QString STsearchID;
if (!inDatabaseAlready && !replaceLocation)
{
//Record the file location in the database.
Expand Down Expand Up @@ -234,12 +232,12 @@ void ImportWorker::importFile(const QFileInfo infoIn,
}

//Now create a profile and a search table entry, and a thumbnail.
QString STsearchID;
STsearchID = createNewProfile(hashString,
filename,
exifUtcTime(abspath, cameraTZ),
importStartTime,
abspath);
abspath,
noThumbnail);

//Request that we enqueue the image.
cout << "importFile SearchID: " << STsearchID.toStdString() << endl;
Expand Down Expand Up @@ -308,17 +306,43 @@ void ImportWorker::importFile(const QFileInfo infoIn,
fileInsert(hashString, infoIn.absoluteFilePath());
cout << "importWorker replace location: " << infoIn.absoluteFilePath().toStdString() << endl;

QString STsearchID = hashString.append(QString("%1").arg(1, 4, 10, QLatin1Char('0')));
STsearchID = hashString.append(QString("%1").arg(1, 4, 10, QLatin1Char('0')));
cout << "importWorker replace STsearchID: " << STsearchID.toStdString() << endl;

if (QString("") != STsearchID)
{
emit enqueueThis(STsearchID);
}
}
} else { //it's not in the database but we are hoping to replace the location.
//We only do this for CLI-based processing.
if (noThumbnail)
{
fileInsert(hashString, infoIn.absoluteFilePath());
cout << "importWorker replace location: " << infoIn.absoluteFilePath().toStdString() << endl;

//Now create a profile and a search table entry, and a thumbnail.
STsearchID = createNewProfile(hashString,
filename,
exifUtcTime(abspath, cameraTZ),
importStartTime,
abspath,
noThumbnail);

//Request that we enqueue the image.
cout << "importFile SearchID: " << STsearchID.toStdString() << endl;
if (QString("") != STsearchID)
{
emit enqueueThis(STsearchID);
}
//It might be ignored downstream, but that's not our problem here.

//Tell the views we need updating.
changedST = true;
}
}
//else do nothing.

//Tell the ImportModel whether we did anything to the SearchTable
emit doneProcessing(changedST);
return STsearchID;
}
21 changes: 11 additions & 10 deletions filmulator-gui/database/importWorker.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,17 @@ class ImportWorker : public QObject
explicit ImportWorker(QObject *parent = 0);

public slots:
void importFile(const QFileInfo infoIn,
const int importTZ,
const int cameraTZ,
const QString photoDir,
const QString backupDir,
const QString dirConfig,
const QDateTime importStartTime,
const bool appendHash,
const bool importInPlace,
const bool replaceLocation);
QString importFile(const QFileInfo infoIn,
const int importTZ,
const int cameraTZ,
const QString photoDir,
const QString backupDir,
const QString dirConfig,
const QDateTime importStartTime,
const bool appendHash,
const bool importInPlace,
const bool replaceLocation,
const bool noThumbnail);

signals:
void enqueueThis(QString STsearchID);
Expand Down
Loading

0 comments on commit 3fa7f70

Please sign in to comment.