Skip to content

Commit

Permalink
update version to 0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Syping committed Oct 23, 2020
1 parent 68dff71 commit a4c5ad6
Show file tree
Hide file tree
Showing 17 changed files with 1,805 additions and 1,778 deletions.
45 changes: 23 additions & 22 deletions ImportDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/

#include "ImportDialog.h"
#include "ui_ImportDialog.h"
#include "SnapmaticPicture.h"
#include "SidebarGenerator.h"
#include "StandardPaths.h"
#include "ImportDialog.h"
#include "imagecropper.h"
#include "AppEnv.h"
#include "config.h"
Expand All @@ -39,8 +40,6 @@
#include <QRgb>

// IMAGES VALUES
#define snapmaticResolutionW 960
#define snapmaticResolutionH 536
#define snapmaticAvatarResolution 470
#define snapmaticAvatarPlacementW 145
#define snapmaticAvatarPlacementH 66
Expand Down Expand Up @@ -139,7 +138,8 @@ void ImportDialog::processImage()
{
if (workImage.isNull()) return;
QImage snapmaticImage = workImage;
QPixmap snapmaticPixmap(snapmaticResolutionW, snapmaticResolutionH);
QSize snapmaticResolution = SnapmaticPicture::getSnapmaticResolution();
QPixmap snapmaticPixmap(snapmaticResolution);
snapmaticPixmap.fill(selectedColour);
QPainter snapmaticPainter(&snapmaticPixmap);
qreal screenRatioPR = AppEnv::screenRatioPR();
Expand All @@ -149,21 +149,21 @@ void ImportDialog::processImage()
{
int diffWidth = 0;
int diffHeight = 0;
if (backImage.width() != snapmaticResolutionW)
if (backImage.width() != snapmaticResolution.width())
{
diffWidth = snapmaticResolutionW - backImage.width();
diffWidth = snapmaticResolution.width() - backImage.width();
diffWidth = diffWidth / 2;
}
else if (backImage.height() != snapmaticResolutionH)
else if (backImage.height() != snapmaticResolution.height())
{
diffHeight = snapmaticResolutionH - backImage.height();
diffHeight = snapmaticResolution.height() - backImage.height();
diffHeight = diffHeight / 2;
}
snapmaticPainter.drawImage(0 + diffWidth, 0 + diffHeight, backImage);
}
else
{
snapmaticPainter.drawImage(0, 0, QImage(backImage).scaled(snapmaticResolutionW, snapmaticResolutionH, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
snapmaticPainter.drawImage(0, 0, QImage(backImage).scaled(snapmaticResolution, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
}
if (ui->cbAvatar->isChecked() && ui->cbForceAvatarColour->isChecked())
{
Expand Down Expand Up @@ -204,21 +204,21 @@ void ImportDialog::processImage()
int diffHeight = 0;
if (!ui->cbIgnore->isChecked())
{
snapmaticImage = snapmaticImage.scaled(snapmaticResolutionW, snapmaticResolutionH, Qt::KeepAspectRatio, Qt::SmoothTransformation);
if (snapmaticImage.width() != snapmaticResolutionW)
snapmaticImage = snapmaticImage.scaled(snapmaticResolution, Qt::KeepAspectRatio, Qt::SmoothTransformation);
if (snapmaticImage.width() != snapmaticResolution.width())
{
diffWidth = snapmaticResolutionW - snapmaticImage.width();
diffWidth = snapmaticResolution.width() - snapmaticImage.width();
diffWidth = diffWidth / 2;
}
else if (snapmaticImage.height() != snapmaticResolutionH)
else if (snapmaticImage.height() != snapmaticResolution.height())
{
diffHeight = snapmaticResolutionH - snapmaticImage.height();
diffHeight = snapmaticResolution.height() - snapmaticImage.height();
diffHeight = diffHeight / 2;
}
}
else
{
snapmaticImage = snapmaticImage.scaled(snapmaticResolutionW, snapmaticResolutionH, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
snapmaticImage = snapmaticImage.scaled(snapmaticResolution, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
}
snapmaticPainter.drawImage(0 + diffWidth, 0 + diffHeight, snapmaticImage);
if (ui->cbWatermark->isChecked()) { processWatermark(&snapmaticPainter); }
Expand Down Expand Up @@ -575,15 +575,16 @@ QImage ImportDialog::image()

void ImportDialog::setImage(QImage *image_)
{
QSize snapmaticResolution = SnapmaticPicture::getSnapmaticResolution();
origImage = *image_;
workImage = QImage();
if (image_->width() == image_->height())
{
insideAvatarZone = true;
ui->cbAvatar->setChecked(true);
if (image_->height() > snapmaticResolutionH)
if (image_->height() > snapmaticResolution.height())
{
workImage = image_->scaled(snapmaticResolutionH, snapmaticResolutionH, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
workImage = image_->scaled(snapmaticResolution.height(), snapmaticResolution.height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
delete image_;
}
else
Expand All @@ -592,18 +593,18 @@ void ImportDialog::setImage(QImage *image_)
delete image_;
}
}
else if (image_->width() > snapmaticResolutionW && image_->width() > image_->height())
else if (image_->width() > snapmaticResolution.width() && image_->width() > image_->height())
{
insideAvatarZone = false;
ui->cbAvatar->setChecked(false);
workImage = image_->scaledToWidth(snapmaticResolutionW, Qt::SmoothTransformation);
workImage = image_->scaledToWidth(snapmaticResolution.width(), Qt::SmoothTransformation);
delete image_;
}
else if (image_->height() > snapmaticResolutionH && image_->height() > image_->width())
else if (image_->height() > snapmaticResolution.height() && image_->height() > image_->width())
{
insideAvatarZone = false;
ui->cbAvatar->setChecked(false);
workImage = image_->scaledToHeight(snapmaticResolutionH, Qt::SmoothTransformation);
workImage = image_->scaledToHeight(snapmaticResolution.height(), Qt::SmoothTransformation);
delete image_;
}
else
Expand Down Expand Up @@ -788,7 +789,7 @@ void ImportDialog::on_cmdBackgroundChange_clicked()
QMessageBox::warning(this, QApplication::translate("ProfileInterface", "Import"), QApplication::translate("ProfileInterface", "Can't import %1 because file can't be parsed properly").arg("\""+selectedFileName+"\""));
goto fileDialogPreOpen;
}
backImage = importImage.scaled(snapmaticResolutionW, snapmaticResolutionH, Qt::KeepAspectRatio, Qt::SmoothTransformation);
backImage = importImage.scaled(SnapmaticPicture::getSnapmaticResolution(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
backgroundPath = selectedFile;
ui->labBackgroundImage->setText(tr("Background Image: %1").arg(tr("File", "Background Image: File")));
ui->cmdBackgroundWipe->setVisible(true);
Expand Down
5 changes: 3 additions & 2 deletions OptionsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/

#include "OptionsDialog.h"
#include "ui_OptionsDialog.h"
#include "TranslationClass.h"
#include "SnapmaticPicture.h"
#include "OptionsDialog.h"
#include "StandardPaths.h"
#include "UserInterface.h"
#include "AppEnv.h"
Expand Down Expand Up @@ -74,7 +75,7 @@ OptionsDialog::OptionsDialog(ProfileDatabase *profileDB, QWidget *parent) :
int desktopSizeHeight = desktopResolution.height();
#endif
aspectRatio = Qt::KeepAspectRatio;
defExportSize = QSize(960, 536);
defExportSize = SnapmaticPicture::getSnapmaticResolution();
cusExportSize = defExportSize;
defaultQuality = 100;
customQuality = 100;
Expand Down
26 changes: 15 additions & 11 deletions PictureDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,14 @@ void PictureDialog::setupPictureDialog()

// Get Snapmatic Resolution
QSize snapmaticResolution = SnapmaticPicture::getSnapmaticResolution();
QSize windowResolution = QSize(snapmaticResolution.width() / 2, snapmaticResolution.height() / 2);

// Avatar area
qreal screenRatio = AppEnv::screenRatio();
qreal screenRatioPR = AppEnv::screenRatioPR();
if (screenRatio != 1 || screenRatioPR != 1)
{
avatarAreaPicture = QImage(":/img/avatararea.png").scaledToHeight(snapmaticResolution.height() * screenRatio * screenRatioPR, Qt::FastTransformation);
avatarAreaPicture = QImage(":/img/avatararea.png").scaledToHeight(windowResolution.height() * screenRatio * screenRatioPR, Qt::FastTransformation);
}
else
{
Expand All @@ -161,7 +162,7 @@ void PictureDialog::setupPictureDialog()
avatarSize = 470;

// DPI calculation (picture)
ui->labPicture->setFixedSize(snapmaticResolution.width() * screenRatio, snapmaticResolution.height() * screenRatio);
ui->labPicture->setFixedSize(windowResolution.width() * screenRatio, windowResolution.height() * screenRatio);
ui->labPicture->setFocusPolicy(Qt::StrongFocus);
ui->labPicture->setScaledContents(true);

Expand Down Expand Up @@ -209,8 +210,8 @@ void PictureDialog::setupPictureDialog()
ui->jsonLayout->setContentsMargins(4 * screenRatio, 10 * screenRatio, 4 * screenRatio, 4 * screenRatio);

// Pre-adapt window for DPI
setFixedWidth(snapmaticResolution.width() * screenRatio);
setFixedHeight(snapmaticResolution.height() * screenRatio);
setFixedWidth(windowResolution.width() * screenRatio);
setFixedHeight(windowResolution.height() * screenRatio);
}

PictureDialog::~PictureDialog()
Expand Down Expand Up @@ -287,7 +288,7 @@ void PictureDialog::adaptNewDialogSize(QSize newLabelSize)
{
Q_UNUSED(newLabelSize)
#if QT_VERSION >= 0x050F00
int newDialogHeight = SnapmaticPicture::getSnapmaticResolution().height();
int newDialogHeight = SnapmaticPicture::getSnapmaticResolution().height() / 2;
#else
int newDialogHeight = (ui->labPicture->pixmap()->height() / AppEnv::screenRatioPR());
#endif
Expand Down Expand Up @@ -609,10 +610,11 @@ void PictureDialog::renderPicture()
if (overlayEnabled)
{
QSize snapmaticResolution = SnapmaticPicture::getSnapmaticResolution();
QPixmap shownImagePixmap(snapmaticResolution.width() * screenRatio * screenRatioPR, snapmaticResolution.height() * screenRatio * screenRatioPR);
QSize windowResolution = QSize(snapmaticResolution.width() / 2, snapmaticResolution.height() / 2);
QPixmap shownImagePixmap(windowResolution.width() * screenRatio * screenRatioPR, windowResolution.height() * screenRatio * screenRatioPR);
shownImagePixmap.fill(Qt::transparent);
QPainter shownImagePainter(&shownImagePixmap);
shownImagePainter.drawImage(0, 0, snapmaticPicture.scaled(snapmaticResolution.width() * screenRatio * screenRatioPR, snapmaticResolution.height() * screenRatio * screenRatioPR, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
shownImagePainter.drawImage(0, 0, snapmaticPicture.scaled(windowResolution.width() * screenRatio * screenRatioPR, windowResolution.height() * screenRatio * screenRatioPR, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
shownImagePainter.drawImage(3 * screenRatio * screenRatioPR, 3 * screenRatio * screenRatioPR, overlayTempImage);
shownImagePainter.end();
#if QT_VERSION >= 0x050600
Expand All @@ -623,10 +625,11 @@ void PictureDialog::renderPicture()
else
{
QSize snapmaticResolution = SnapmaticPicture::getSnapmaticResolution();
QPixmap shownImagePixmap(snapmaticResolution.width() * screenRatio * screenRatioPR, snapmaticResolution.height() * screenRatio * screenRatioPR);
QSize windowResolution = QSize(snapmaticResolution.width() / 2, snapmaticResolution.height() / 2);
QPixmap shownImagePixmap(windowResolution.width() * screenRatio * screenRatioPR, windowResolution.height() * screenRatio * screenRatioPR);
shownImagePixmap.fill(Qt::transparent);
QPainter shownImagePainter(&shownImagePixmap);
shownImagePainter.drawImage(0, 0, snapmaticPicture.scaled(snapmaticResolution.width() * screenRatio * screenRatioPR, snapmaticResolution.height() * screenRatio * screenRatioPR, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
shownImagePainter.drawImage(0, 0, snapmaticPicture.scaled(windowResolution.width() * screenRatio * screenRatioPR, windowResolution.height() * screenRatio * screenRatioPR, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
shownImagePainter.end();
#if QT_VERSION >= 0x050600
shownImagePixmap.setDevicePixelRatio(screenRatioPR);
Expand All @@ -638,11 +641,12 @@ void PictureDialog::renderPicture()
{
// Generating Avatar Preview
QSize snapmaticResolution = SnapmaticPicture::getSnapmaticResolution();
QPixmap avatarPixmap(snapmaticResolution.width() * screenRatio * screenRatioPR, snapmaticResolution.height() * screenRatio * screenRatioPR);
QSize windowResolution = QSize(snapmaticResolution.width() / 2, snapmaticResolution.height() / 2);
QPixmap avatarPixmap(windowResolution.width() * screenRatio * screenRatioPR, windowResolution.height() * screenRatio * screenRatioPR);
QPainter snapPainter(&avatarPixmap);
QFont snapPainterFont;
snapPainterFont.setPixelSize(12 * screenRatio * screenRatioPR);
snapPainter.drawImage(0, 0, snapmaticPicture.scaled(snapmaticResolution.width() * screenRatio * screenRatioPR, snapmaticResolution.height() * screenRatio * screenRatioPR, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
snapPainter.drawImage(0, 0, snapmaticPicture.scaled(windowResolution.width() * screenRatio * screenRatioPR, windowResolution.height() * screenRatio * screenRatioPR, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
snapPainter.drawImage(0, 0, avatarAreaPicture);
snapPainter.setPen(QColor::fromRgb(255, 255, 255, 255));
snapPainter.setFont(snapPainterFont);
Expand Down
13 changes: 7 additions & 6 deletions ProfileInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,8 @@ bool ProfileInterface::importFile(QString selectedFile, QDateTime importDateTime
return false;
}
QString customImageTitle;
QPixmap snapmaticPixmap(960, 536);
QSize snapmaticResolution = SnapmaticPicture::getSnapmaticResolution();
QPixmap snapmaticPixmap(snapmaticResolution);
snapmaticPixmap.fill(Qt::black);
QPainter snapmaticPainter(&snapmaticPixmap);
if (snapmaticImage.height() == snapmaticImage.width())
Expand All @@ -724,15 +725,15 @@ bool ProfileInterface::importFile(QString selectedFile, QDateTime importDateTime
// Picture mode
int diffWidth = 0;
int diffHeight = 0;
snapmaticImage = snapmaticImage.scaled(960, 536, Qt::KeepAspectRatio, Qt::SmoothTransformation);
if (snapmaticImage.width() != 960)
snapmaticImage = snapmaticImage.scaled(snapmaticResolution, Qt::KeepAspectRatio, Qt::SmoothTransformation);
if (snapmaticImage.width() != snapmaticResolution.height())
{
diffWidth = 960 - snapmaticImage.width();
diffWidth = snapmaticResolution.height() - snapmaticImage.width();
diffWidth = diffWidth / 2;
}
else if (snapmaticImage.height() != 536)
else if (snapmaticImage.height() != snapmaticResolution.width())
{
diffHeight = 536 - snapmaticImage.height();
diffHeight = snapmaticResolution.width() - snapmaticImage.height();
diffHeight = diffHeight / 2;
}
snapmaticPainter.drawImage(0 + diffWidth, 0 + diffHeight, snapmaticImage);
Expand Down
27 changes: 23 additions & 4 deletions SnapmaticPicture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ void SnapmaticPicture::updateStrings()
pictureStr = tr("PHOTO - %1").arg(localProperties.createdDateTime.toString("MM/dd/yy HH:mm:ss"));
sortStr = localProperties.createdDateTime.toString("yyMMddHHmmss") % QString::number(localProperties.uid);
QString exportStr = localProperties.createdDateTime.toString("yyyyMMdd") % "-" % QString::number(localProperties.uid);
if (isModernFormat) { picFileName = "PRDR5" % QString::number(localProperties.uid); }
if (isModernFormat) { picFileName = "PRDR3" % QString::number(localProperties.uid); }
picExportFileName = exportStr % "_" % cmpPicTitl;
}

Expand Down Expand Up @@ -519,7 +519,17 @@ bool SnapmaticPicture::setImage(const QImage &picture)
}
}
}
if (saveSuccess) { return setPictureStream(picByteArray); }
if (saveSuccess) {
saveSuccess = setPictureStream(picByteArray);
if (saveSuccess) {
SnapmaticProperties properties = getSnapmaticProperties();
properties.pictureSize = picture.size();
if (!setSnapmaticProperties(properties)) {
qDebug() << "Failed to refresh Snapmatic properties!";
}
}
return saveSuccess;
}
}
return false;
}
Expand Down Expand Up @@ -1041,6 +1051,12 @@ void SnapmaticPicture::parseJsonContent()
else { jsonError = true; }
}
// else { jsonIncomplete = true; } // Game release Snapmatic pictures prior May 2015 left out rsedtr, so don't force exists on that one
// RDR 2
if (jsonObject.contains("width") && jsonObject.contains("height")) {
if (jsonObject["width"].isDouble() && jsonObject["height"].isDouble()) { localProperties.pictureSize = QSize(jsonObject["width"].toInt(), jsonObject["height"].toInt()); }
else { jsonError = true; }
}
else { jsonIncomplete = true; }

if (!jsonIncomplete && !jsonError)
{
Expand Down Expand Up @@ -1087,6 +1103,10 @@ bool SnapmaticPicture::setSnapmaticProperties(SnapmaticProperties properties)
jsonObject["drctr"] = properties.isFromDirector;
jsonObject["rsedtr"] = properties.isFromRSEditor;

// RDR 2
jsonObject["width"] = properties.pictureSize.width();
jsonObject["height"] = properties.pictureSize.height();

jsonDocument.setObject(jsonObject);

if (setJsonStr(QString::fromUtf8(jsonDocument.toJson(QJsonDocument::Compact))))
Expand Down Expand Up @@ -1346,8 +1366,7 @@ bool SnapmaticPicture::setPictureVisible()

QSize SnapmaticPicture::getSnapmaticResolution()
{
// keep old UI size for now
return QSize(960, 536);
return snapmaticResolution;
}

// SNAPMATIC DEFAULTS
Expand Down
1 change: 1 addition & 0 deletions SnapmaticPicture.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ struct SnapmaticProperties {
int size;
int crewID;
int streetID;
QSize pictureSize;
QStringList playersList;
uint createdTimestamp;
QDateTime createdDateTime;
Expand Down
2 changes: 1 addition & 1 deletion config.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
#endif

#ifndef GTA5SYNC_APPVER
#define GTA5SYNC_APPVER "0.4.0"
#define GTA5SYNC_APPVER "0.5.0"
#endif

#if __cplusplus
Expand Down
8 changes: 4 additions & 4 deletions res/app.rc
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "rdr2view.exe.manifest"
#include <windows.h>

VS_VERSION_INFO VERSIONINFO
FILEVERSION 0, 4, 0, 0
PRODUCTVERSION 0, 4, 0, 0
FILEVERSION 0, 5, 0, 0
PRODUCTVERSION 0, 5, 0, 0
FILEFLAGSMASK 0x3fL
FILEFLAGS 0
FILEOS VOS_NT_WINDOWS32
Expand All @@ -25,12 +25,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "Syping"
VALUE "FileDescription", "rdr2view"
VALUE "FileVersion", "0.4.0"
VALUE "FileVersion", "0.5.0"
VALUE "InternalName", "rdr2view"
VALUE "LegalCopyright", "Copyright � 2016-2020 Syping"
VALUE "OriginalFilename", "rdr2view.exe"
VALUE "ProductName", "rdr2view"
VALUE "ProductVersion", "0.4.0"
VALUE "ProductVersion", "0.5.0"
END
END
END
Loading

0 comments on commit a4c5ad6

Please sign in to comment.