update version to 0.5.0

This commit is contained in:
Syping 2020-10-23 14:21:33 +02:00
parent 68dff71d17
commit a4c5ad6c66
17 changed files with 1809 additions and 1782 deletions

View File

@ -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"
@ -39,8 +40,6 @@
#include <QRgb>
// IMAGES VALUES
#define snapmaticResolutionW 960
#define snapmaticResolutionH 536
#define snapmaticAvatarResolution 470
#define snapmaticAvatarPlacementW 145
#define snapmaticAvatarPlacementH 66
@ -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();
@ -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())
{
@ -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); }
@ -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
@ -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
@ -788,7 +789,7 @@ fileDialogPreOpen:
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);

View File

@ -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"
@ -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;

View File

@ -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
{
@ -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);
@ -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()
@ -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
@ -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
@ -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);
@ -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);

View File

@ -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())
@ -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);

View File

@ -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;
}
@ -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;
}
@ -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)
{
@ -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))))
@ -1346,8 +1366,7 @@ bool SnapmaticPicture::setPictureVisible()
QSize SnapmaticPicture::getSnapmaticResolution()
{
// keep old UI size for now
return QSize(960, 536);
return snapmaticResolution;
}
// SNAPMATIC DEFAULTS

View File

@ -38,6 +38,7 @@ struct SnapmaticProperties {
int size;
int crewID;
int streetID;
QSize pictureSize;
QStringList playersList;
uint createdTimestamp;
QDateTime createdDateTime;

View File

@ -44,7 +44,7 @@
#endif
#ifndef GTA5SYNC_APPVER
#define GTA5SYNC_APPVER "0.4.0"
#define GTA5SYNC_APPVER "0.5.0"
#endif
#if __cplusplus

View File

@ -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
@ -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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.