Aspect Ratio fixes, HiDPI fullscreen fix
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
0fcd4615cd
commit
9adc8d9650
18 changed files with 2233 additions and 2315 deletions
|
@ -49,7 +49,7 @@ void ExportThread::run()
|
||||||
// Quality Settings
|
// Quality Settings
|
||||||
settings.beginGroup("Pictures");
|
settings.beginGroup("Pictures");
|
||||||
int defaultQuality = 100;
|
int defaultQuality = 100;
|
||||||
QSize defExportSize = QSize(960, 536);
|
QSize defExportSize = SnapmaticPicture::getSnapmaticResolution();
|
||||||
int customQuality = settings.value("CustomQuality", defaultQuality).toInt();
|
int customQuality = settings.value("CustomQuality", defaultQuality).toInt();
|
||||||
if (customQuality < 1 || customQuality > 100)
|
if (customQuality < 1 || customQuality > 100)
|
||||||
{
|
{
|
||||||
|
|
|
@ -75,7 +75,7 @@ OptionsDialog::OptionsDialog(ProfileDatabase *profileDB, QWidget *parent) :
|
||||||
int desktopSizeHeight = desktopResolution.height();
|
int desktopSizeHeight = desktopResolution.height();
|
||||||
#endif
|
#endif
|
||||||
aspectRatio = Qt::KeepAspectRatio;
|
aspectRatio = Qt::KeepAspectRatio;
|
||||||
defExportSize = QSize(960, 536);
|
defExportSize = SnapmaticPicture::getSnapmaticResolution();
|
||||||
cusExportSize = defExportSize;
|
cusExportSize = defExportSize;
|
||||||
defaultQuality = 100;
|
defaultQuality = 100;
|
||||||
customQuality = 100;
|
customQuality = 100;
|
||||||
|
@ -298,6 +298,9 @@ void OptionsDialog::setupRadioButtons()
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
ui->rbClassic->setChecked(true);
|
ui->rbClassic->setChecked(true);
|
||||||
|
#if QT_VERSION >= 0x050800
|
||||||
|
Q_FALLTHROUGH();
|
||||||
|
#endif
|
||||||
case 11:
|
case 11:
|
||||||
ui->cbDoubleclick->setChecked(true);
|
ui->cbDoubleclick->setChecked(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -285,11 +285,7 @@ void PictureDialog::addPreviousNextButtons()
|
||||||
void PictureDialog::adaptNewDialogSize(QSize newLabelSize)
|
void PictureDialog::adaptNewDialogSize(QSize newLabelSize)
|
||||||
{
|
{
|
||||||
Q_UNUSED(newLabelSize)
|
Q_UNUSED(newLabelSize)
|
||||||
#if QT_VERSION >= 0x050F00
|
int newDialogHeight = SnapmaticPicture::getSnapmaticResolution().height() * AppEnv::screenRatio();
|
||||||
int newDialogHeight = SnapmaticPicture::getSnapmaticResolution().height();
|
|
||||||
#else
|
|
||||||
int newDialogHeight = (ui->labPicture->pixmap()->height() / AppEnv::screenRatioPR());
|
|
||||||
#endif
|
|
||||||
newDialogHeight = newDialogHeight + ui->jsonFrame->height();
|
newDialogHeight = newDialogHeight + ui->jsonFrame->height();
|
||||||
if (naviEnabled) newDialogHeight = newDialogHeight + layout()->menuBar()->height();
|
if (naviEnabled) newDialogHeight = newDialogHeight + layout()->menuBar()->height();
|
||||||
setMaximumSize(width(), newDialogHeight);
|
setMaximumSize(width(), newDialogHeight);
|
||||||
|
@ -304,19 +300,17 @@ void PictureDialog::styliseDialog()
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
#if QT_VERSION >= 0x050200
|
#if QT_VERSION >= 0x050200
|
||||||
if (QtWin::isCompositionEnabled())
|
if (QtWin::isCompositionEnabled()) {
|
||||||
{
|
|
||||||
QPalette palette;
|
QPalette palette;
|
||||||
QtWin::extendFrameIntoClientArea(this, 0, qRound(layout()->menuBar()->height() * AppEnv::screenRatioPR()), 0, 0);
|
QtWin::extendFrameIntoClientArea(this, 0, qRound(layout()->menuBar()->height() * AppEnv::screenRatioPR()), 0, 0);
|
||||||
ui->jsonFrame->setStyleSheet(QString("QFrame { background: %1; }").arg(palette.window().color().name()));
|
ui->jsonFrame->setStyleSheet(QString("QFrame{background:%1;}").arg(palette.window().color().name()));
|
||||||
setStyleSheet("PictureDialog { background: transparent; }");
|
setStyleSheet("PictureDialog{background:transparent;}");
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
QPalette palette;
|
QPalette palette;
|
||||||
QtWin::resetExtendedFrame(this);
|
QtWin::resetExtendedFrame(this);
|
||||||
ui->jsonFrame->setStyleSheet(QString("QFrame { background: %1; }").arg(palette.window().color().name()));
|
ui->jsonFrame->setStyleSheet(QString("QFrame{background:%1;}").arg(palette.window().color().name()));
|
||||||
setStyleSheet(QString("PictureDialog { background: %1; }").arg(QtWin::realColorizationColor().name()));
|
setStyleSheet(QString("PictureDialog{background:%1;}").arg(QtWin::realColorizationColor().name()));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -326,10 +320,8 @@ bool PictureDialog::event(QEvent *event)
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
#if QT_VERSION >= 0x050200
|
#if QT_VERSION >= 0x050200
|
||||||
if (naviEnabled)
|
if (naviEnabled) {
|
||||||
{
|
if (event->type() == QWinEvent::CompositionChange || event->type() == QWinEvent::ColorizationChange) {
|
||||||
if (event->type() == QWinEvent::CompositionChange || event->type() == QWinEvent::ColorizationChange)
|
|
||||||
{
|
|
||||||
styliseDialog();
|
styliseDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -543,8 +535,7 @@ void PictureDialog::renderOverlayPicture()
|
||||||
|
|
||||||
void PictureDialog::setSnapmaticPicture(SnapmaticPicture *picture, bool readOk, bool _indexed, int _index)
|
void PictureDialog::setSnapmaticPicture(SnapmaticPicture *picture, bool readOk, bool _indexed, int _index)
|
||||||
{
|
{
|
||||||
if (smpic != nullptr)
|
if (smpic != nullptr) {
|
||||||
{
|
|
||||||
QObject::disconnect(smpic, SIGNAL(updated()), this, SLOT(updated()));
|
QObject::disconnect(smpic, SIGNAL(updated()), this, SLOT(updated()));
|
||||||
QObject::disconnect(smpic, SIGNAL(customSignal(QString)), this, SLOT(customSignal(QString)));
|
QObject::disconnect(smpic, SIGNAL(customSignal(QString)), this, SLOT(customSignal(QString)));
|
||||||
}
|
}
|
||||||
|
@ -552,35 +543,29 @@ void PictureDialog::setSnapmaticPicture(SnapmaticPicture *picture, bool readOk,
|
||||||
indexed = _indexed;
|
indexed = _indexed;
|
||||||
index = _index;
|
index = _index;
|
||||||
smpic = picture;
|
smpic = picture;
|
||||||
if (!readOk)
|
if (!readOk) {
|
||||||
{
|
|
||||||
QMessageBox::warning(this, tr("Snapmatic Picture Viewer"), tr("Failed at %1").arg(picture->getLastStep()));
|
QMessageBox::warning(this, tr("Snapmatic Picture Viewer"), tr("Failed at %1").arg(picture->getLastStep()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (picture->isPicOk())
|
if (picture->isPicOk()) {
|
||||||
{
|
|
||||||
snapmaticPicture = picture->getImage();
|
snapmaticPicture = picture->getImage();
|
||||||
renderPicture();
|
renderPicture();
|
||||||
ui->cmdManage->setEnabled(true);
|
ui->cmdManage->setEnabled(true);
|
||||||
}
|
}
|
||||||
if (picture->isJsonOk())
|
if (picture->isJsonOk()) {
|
||||||
{
|
|
||||||
crewStr = crewDB->getCrewName(crewID);
|
crewStr = crewDB->getCrewName(crewID);
|
||||||
if (globalMap.contains(picArea))
|
if (globalMap.contains(picArea)) {
|
||||||
{
|
picAreaStr = globalMap.value(picArea);
|
||||||
picAreaStr = globalMap[picArea];
|
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
picAreaStr = picArea;
|
picAreaStr = picArea;
|
||||||
}
|
}
|
||||||
setWindowTitle(windowTitleStr.arg(picTitl));
|
setWindowTitle(windowTitleStr.arg(picTitl));
|
||||||
ui->labJSON->setText(jsonDrawString.arg(locX, locY, locZ, generatePlayersString(), generateCrewString(), picTitl, picAreaStr, created));
|
ui->labJSON->setText(jsonDrawString.arg(locX, locY, locZ, generatePlayersString(), generateCrewString(), picTitl, picAreaStr, created));
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
ui->labJSON->setText(jsonDrawString.arg("0", "0", "0", tr("No Players"), tr("No Crew"), tr("Unknown Location")));
|
ui->labJSON->setText(jsonDrawString.arg("0", "0", "0", tr("No Players"), tr("No Crew"), tr("Unknown Location")));
|
||||||
QMessageBox::warning(this,tr("Snapmatic Picture Viewer"),tr("Failed at %1").arg(picture->getLastStep()));
|
// QMessageBox::warning(this, tr("Snapmatic Picture Viewer"), tr("Failed at %1").arg(picture->getLastStep()));
|
||||||
}
|
}
|
||||||
QObject::connect(smpic, SIGNAL(updated()), this, SLOT(updated()));
|
QObject::connect(smpic, SIGNAL(updated()), this, SLOT(updated()));
|
||||||
QObject::connect(smpic, SIGNAL(customSignal(QString)), this, SLOT(customSignal(QString)));
|
QObject::connect(smpic, SIGNAL(customSignal(QString)), this, SLOT(customSignal(QString)));
|
||||||
|
@ -609,57 +594,39 @@ void PictureDialog::setSnapmaticPicture(SnapmaticPicture *picture)
|
||||||
|
|
||||||
void PictureDialog::renderPicture()
|
void PictureDialog::renderPicture()
|
||||||
{
|
{
|
||||||
qreal screenRatio = AppEnv::screenRatio();
|
const qreal screenRatio = AppEnv::screenRatio();
|
||||||
qreal screenRatioPR = AppEnv::screenRatioPR();
|
const qreal screenRatioPR = AppEnv::screenRatioPR();
|
||||||
if (!previewMode)
|
const QSize snapmaticResolution(SnapmaticPicture::getSnapmaticResolution());
|
||||||
{
|
const QSize renderResolution(snapmaticResolution.width() * screenRatio * screenRatioPR, snapmaticResolution.height() * screenRatio * screenRatioPR);
|
||||||
if (overlayEnabled)
|
QPixmap shownImagePixmap(renderResolution);
|
||||||
{
|
shownImagePixmap.fill(Qt::black);
|
||||||
QSize snapmaticResolution = SnapmaticPicture::getSnapmaticResolution();
|
|
||||||
QPixmap shownImagePixmap(snapmaticResolution.width() * screenRatio * screenRatioPR, snapmaticResolution.height() * screenRatio * screenRatioPR);
|
|
||||||
shownImagePixmap.fill(Qt::transparent);
|
|
||||||
QPainter shownImagePainter(&shownImagePixmap);
|
QPainter shownImagePainter(&shownImagePixmap);
|
||||||
shownImagePainter.drawImage(0, 0, snapmaticPicture.scaled(snapmaticResolution.width() * screenRatio * screenRatioPR, snapmaticResolution.height() * screenRatio * screenRatioPR, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
|
const QImage renderImage = snapmaticPicture.scaled(renderResolution, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||||
shownImagePainter.drawImage(3 * screenRatio * screenRatioPR, 3 * screenRatio * screenRatioPR, overlayTempImage);
|
if (renderImage.width() < renderResolution.width()) {
|
||||||
|
shownImagePainter.drawImage((renderResolution.width() - renderImage.width()) / 2, 0, renderImage, Qt::AutoColor);
|
||||||
|
}
|
||||||
|
else if (renderImage.height() < renderResolution.height()) {
|
||||||
|
shownImagePainter.drawImage(0, (renderResolution.height() - renderImage.height()) / 2, renderImage, Qt::AutoColor);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
shownImagePainter.drawImage(0, 0, renderImage, Qt::AutoColor);
|
||||||
|
}
|
||||||
|
if (previewMode) {
|
||||||
|
QFont shownImagePainterFont;
|
||||||
|
shownImagePainterFont.setPixelSize(12 * screenRatio * screenRatioPR);
|
||||||
|
shownImagePainter.drawImage(0, 0, avatarAreaPicture);
|
||||||
|
shownImagePainter.setPen(QColor::fromRgb(255, 255, 255, 255));
|
||||||
|
shownImagePainter.setFont(shownImagePainterFont);
|
||||||
|
shownImagePainter.drawText(QRect(3 * screenRatio * screenRatioPR, 3 * screenRatio * screenRatioPR, 140 * screenRatio * screenRatioPR, snapmaticResolution.height() * screenRatio * screenRatioPR), Qt::AlignLeft | Qt::TextWordWrap, tr("Avatar Preview Mode\nPress 1 for Default View"));
|
||||||
|
}
|
||||||
|
else if (overlayEnabled) {
|
||||||
|
shownImagePainter.drawImage(3 * screenRatio * screenRatioPR, 3 * screenRatio * screenRatioPR, overlayTempImage, Qt::AutoColor);
|
||||||
|
}
|
||||||
shownImagePainter.end();
|
shownImagePainter.end();
|
||||||
#if QT_VERSION >= 0x050600
|
#if QT_VERSION >= 0x050600
|
||||||
shownImagePixmap.setDevicePixelRatio(screenRatioPR);
|
shownImagePixmap.setDevicePixelRatio(screenRatioPR);
|
||||||
#endif
|
#endif
|
||||||
ui->labPicture->setPixmap(shownImagePixmap);
|
ui->labPicture->setPixmap(shownImagePixmap);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
QSize snapmaticResolution = SnapmaticPicture::getSnapmaticResolution();
|
|
||||||
QPixmap shownImagePixmap(snapmaticResolution.width() * screenRatio * screenRatioPR, snapmaticResolution.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.end();
|
|
||||||
#if QT_VERSION >= 0x050600
|
|
||||||
shownImagePixmap.setDevicePixelRatio(screenRatioPR);
|
|
||||||
#endif
|
|
||||||
ui->labPicture->setPixmap(shownImagePixmap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Generating Avatar Preview
|
|
||||||
QSize snapmaticResolution = SnapmaticPicture::getSnapmaticResolution();
|
|
||||||
QPixmap avatarPixmap(snapmaticResolution.width() * screenRatio * screenRatioPR, snapmaticResolution.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, avatarAreaPicture);
|
|
||||||
snapPainter.setPen(QColor::fromRgb(255, 255, 255, 255));
|
|
||||||
snapPainter.setFont(snapPainterFont);
|
|
||||||
snapPainter.drawText(QRect(3 * screenRatio * screenRatioPR, 3 * screenRatio * screenRatioPR, 140 * screenRatio * screenRatioPR, snapmaticResolution.height() * screenRatio * screenRatioPR), Qt::AlignLeft | Qt::TextWordWrap, tr("Avatar Preview Mode\nPress 1 for Default View"));
|
|
||||||
snapPainter.end();
|
|
||||||
#if QT_VERSION >= 0x050600
|
|
||||||
avatarPixmap.setDevicePixelRatio(screenRatioPR);
|
|
||||||
#endif
|
|
||||||
ui->labPicture->setPixmap(avatarPixmap);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PictureDialog::crewNameUpdated()
|
void PictureDialog::crewNameUpdated()
|
||||||
|
@ -703,10 +670,8 @@ QString PictureDialog::generatePlayersString()
|
||||||
SnapmaticPicture *picture = smpic; // used by macro
|
SnapmaticPicture *picture = smpic; // used by macro
|
||||||
const QStringList playersList = plyrsList; // save operation time
|
const QStringList playersList = plyrsList; // save operation time
|
||||||
QString plyrsStr;
|
QString plyrsStr;
|
||||||
if (playersList.length() >= 1)
|
if (playersList.length() >= 1) {
|
||||||
{
|
for (const QString &player : playersList) {
|
||||||
for (const QString &player : playersList)
|
|
||||||
{
|
|
||||||
const QString playerName = profileDB->getPlayerName(player);
|
const QString playerName = profileDB->getPlayerName(player);
|
||||||
if (player != playerName) {
|
if (player != playerName) {
|
||||||
plyrsStr += ", <a href=\"https://socialclub.rockstargames.com/member/" % playerName % "/" % player % "\">" % playerName % "</a>";
|
plyrsStr += ", <a href=\"https://socialclub.rockstargames.com/member/" % playerName % "/" % player % "\">" % playerName % "</a>";
|
||||||
|
@ -717,8 +682,7 @@ QString PictureDialog::generatePlayersString()
|
||||||
}
|
}
|
||||||
plyrsStr.remove(0, 2);
|
plyrsStr.remove(0, 2);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
plyrsStr = tr("No Players");
|
plyrsStr = tr("No Players");
|
||||||
}
|
}
|
||||||
return plyrsStr;
|
return plyrsStr;
|
||||||
|
@ -726,32 +690,27 @@ QString PictureDialog::generatePlayersString()
|
||||||
|
|
||||||
void PictureDialog::exportSnapmaticPicture()
|
void PictureDialog::exportSnapmaticPicture()
|
||||||
{
|
{
|
||||||
if (rqFullscreen && fullscreenWidget != nullptr)
|
if (rqFullscreen && fullscreenWidget != nullptr) {
|
||||||
{
|
|
||||||
PictureExport::exportAsPicture(fullscreenWidget, smpic);
|
PictureExport::exportAsPicture(fullscreenWidget, smpic);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
PictureExport::exportAsPicture(this, smpic);
|
PictureExport::exportAsPicture(this, smpic);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PictureDialog::copySnapmaticPicture()
|
void PictureDialog::copySnapmaticPicture()
|
||||||
{
|
{
|
||||||
if (rqFullscreen && fullscreenWidget != nullptr)
|
if (rqFullscreen && fullscreenWidget != nullptr) {
|
||||||
{
|
|
||||||
PictureExport::exportAsSnapmatic(fullscreenWidget, smpic);
|
PictureExport::exportAsSnapmatic(fullscreenWidget, smpic);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
PictureExport::exportAsSnapmatic(this, smpic);
|
PictureExport::exportAsSnapmatic(this, smpic);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PictureDialog::on_labPicture_mouseDoubleClicked(Qt::MouseButton button)
|
void PictureDialog::on_labPicture_mouseDoubleClicked(Qt::MouseButton button)
|
||||||
{
|
{
|
||||||
if (button == Qt::LeftButton)
|
if (button == Qt::LeftButton) {
|
||||||
{
|
|
||||||
#if QT_VERSION >= 0x060000
|
#if QT_VERSION >= 0x060000
|
||||||
QRect desktopRect = QApplication::screenAt(pos())->geometry();
|
QRect desktopRect = QApplication::screenAt(pos())->geometry();
|
||||||
#else
|
#else
|
||||||
|
@ -765,8 +724,8 @@ void PictureDialog::on_labPicture_mouseDoubleClicked(Qt::MouseButton button)
|
||||||
pictureWidget->setWindowFlags(pictureWidget->windowFlags()^Qt::FramelessWindowHint);
|
pictureWidget->setWindowFlags(pictureWidget->windowFlags()^Qt::FramelessWindowHint);
|
||||||
#endif
|
#endif
|
||||||
pictureWidget->setWindowTitle(windowTitle());
|
pictureWidget->setWindowTitle(windowTitle());
|
||||||
pictureWidget->setStyleSheet("QLabel#pictureLabel{background-color: black;}");
|
pictureWidget->setStyleSheet("QLabel#pictureLabel{background-color:black;}");
|
||||||
pictureWidget->setImage(snapmaticPicture, desktopRect);
|
pictureWidget->setImage(smpic->getImage(), desktopRect);
|
||||||
pictureWidget->setModal(true);
|
pictureWidget->setModal(true);
|
||||||
|
|
||||||
fullscreenWidget = pictureWidget;
|
fullscreenWidget = pictureWidget;
|
||||||
|
|
|
@ -40,7 +40,6 @@
|
||||||
|
|
||||||
PictureExport::PictureExport()
|
PictureExport::PictureExport()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PictureExport::exportAsPicture(QWidget *parent, SnapmaticPicture *picture)
|
void PictureExport::exportAsPicture(QWidget *parent, SnapmaticPicture *picture)
|
||||||
|
@ -51,30 +50,25 @@ void PictureExport::exportAsPicture(QWidget *parent, SnapmaticPicture *picture)
|
||||||
// Quality Settings
|
// Quality Settings
|
||||||
settings.beginGroup("Pictures");
|
settings.beginGroup("Pictures");
|
||||||
int defaultQuality = 100;
|
int defaultQuality = 100;
|
||||||
QSize defExportSize = QSize(960, 536);
|
QSize defExportSize = SnapmaticPicture::getSnapmaticResolution();
|
||||||
int customQuality = settings.value("CustomQuality", defaultQuality).toInt();
|
int customQuality = settings.value("CustomQuality", defaultQuality).toInt();
|
||||||
if (customQuality < 1 || customQuality > 100)
|
if (customQuality < 1 || customQuality > 100) {
|
||||||
{
|
|
||||||
customQuality = 100;
|
customQuality = 100;
|
||||||
}
|
}
|
||||||
bool useCustomQuality = settings.value("CustomQualityEnabled", false).toBool();
|
bool useCustomQuality = settings.value("CustomQualityEnabled", false).toBool();
|
||||||
|
|
||||||
// Size Settings
|
// Size Settings
|
||||||
QSize cusExportSize = settings.value("CustomSize", defExportSize).toSize();
|
QSize cusExportSize = settings.value("CustomSize", defExportSize).toSize();
|
||||||
if (cusExportSize.width() > 3840)
|
if (cusExportSize.width() > 3840) {
|
||||||
{
|
|
||||||
cusExportSize.setWidth(3840);
|
cusExportSize.setWidth(3840);
|
||||||
}
|
}
|
||||||
else if (cusExportSize.height() > 2160)
|
else if (cusExportSize.height() > 2160) {
|
||||||
{
|
|
||||||
cusExportSize.setHeight(2160);
|
cusExportSize.setHeight(2160);
|
||||||
}
|
}
|
||||||
if (cusExportSize.width() < 1)
|
if (cusExportSize.width() < 1) {
|
||||||
{
|
|
||||||
cusExportSize.setWidth(1);
|
cusExportSize.setWidth(1);
|
||||||
}
|
}
|
||||||
else if (cusExportSize.height() < 1)
|
else if (cusExportSize.height() < 1) {
|
||||||
{
|
|
||||||
cusExportSize.setHeight(1);
|
cusExportSize.setHeight(1);
|
||||||
}
|
}
|
||||||
QString sizeMode = settings.value("ExportSizeMode", "Default").toString();
|
QString sizeMode = settings.value("ExportSizeMode", "Default").toString();
|
||||||
|
@ -113,54 +107,42 @@ fileDialogPreSave: //Work?
|
||||||
QString newPictureFileName = getPictureFileName(picture) % defaultExportFormat;
|
QString newPictureFileName = getPictureFileName(picture) % defaultExportFormat;
|
||||||
fileDialog.selectFile(newPictureFileName);
|
fileDialog.selectFile(newPictureFileName);
|
||||||
|
|
||||||
if (fileDialog.exec())
|
if (fileDialog.exec()) {
|
||||||
{
|
|
||||||
QStringList selectedFiles = fileDialog.selectedFiles();
|
QStringList selectedFiles = fileDialog.selectedFiles();
|
||||||
if (selectedFiles.length() == 1)
|
if (selectedFiles.length() == 1) {
|
||||||
{
|
|
||||||
QString saveFileFormat;
|
QString saveFileFormat;
|
||||||
QString selectedFile = selectedFiles.at(0);
|
QString selectedFile = selectedFiles.at(0);
|
||||||
|
|
||||||
if (selectedFile.right(4) == ".jpg")
|
if (selectedFile.right(4) == ".jpg") {
|
||||||
{
|
|
||||||
saveFileFormat = "JPEG";
|
saveFileFormat = "JPEG";
|
||||||
}
|
}
|
||||||
else if (selectedFile.right(4) == ".jpeg")
|
else if (selectedFile.right(4) == ".jpeg") {
|
||||||
{
|
|
||||||
saveFileFormat = "JPEG";
|
saveFileFormat = "JPEG";
|
||||||
}
|
}
|
||||||
else if (selectedFile.right(4) == ".png")
|
else if (selectedFile.right(4) == ".png") {
|
||||||
{
|
|
||||||
saveFileFormat = "PNG";
|
saveFileFormat = "PNG";
|
||||||
}
|
}
|
||||||
else if (selectedFile.right(7) == ".suffix")
|
else if (selectedFile.right(7) == ".suffix") {
|
||||||
{
|
if (fileDialog.selectedNameFilter() == "JPEG picture (*.jpg)") {
|
||||||
if (fileDialog.selectedNameFilter() == "JPEG picture (*.jpg)")
|
|
||||||
{
|
|
||||||
selectedFile.replace(".suffix", ".jpg");
|
selectedFile.replace(".suffix", ".jpg");
|
||||||
}
|
}
|
||||||
else if (fileDialog.selectedNameFilter() == "Portable Network Graphics (*.png)")
|
else if (fileDialog.selectedNameFilter() == "Portable Network Graphics (*.png)") {
|
||||||
{
|
|
||||||
selectedFile.replace(".suffix", ".png");
|
selectedFile.replace(".suffix", ".png");
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
selectedFile.replace(".suffix", ".jpg");
|
selectedFile.replace(".suffix", ".jpg");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (QFile::exists(selectedFile))
|
if (QFile::exists(selectedFile)) {
|
||||||
{
|
if (QMessageBox::No == QMessageBox::warning(parent, PictureDialog::tr("Export as Picture"), PictureDialog::tr("Overwrite %1 with current Snapmatic picture?").arg("\""+selectedFile+"\""), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes)) {
|
||||||
if (QMessageBox::No == QMessageBox::warning(parent, PictureDialog::tr("Export as Picture"), PictureDialog::tr("Overwrite %1 with current Snapmatic picture?").arg("\""+selectedFile+"\""), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes))
|
|
||||||
{
|
|
||||||
goto fileDialogPreSave; //Work?
|
goto fileDialogPreSave; //Work?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scale Picture
|
// Scale Picture
|
||||||
QImage exportPicture = picture->getImage();
|
QImage exportPicture = picture->getImage();
|
||||||
if (sizeMode == "Desktop")
|
if (sizeMode == "Desktop") {
|
||||||
{
|
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
qreal screenRatioPR = AppEnv::screenRatioPR();
|
qreal screenRatioPR = AppEnv::screenRatioPR();
|
||||||
QRect desktopResolution = QApplication::primaryScreen()->geometry();
|
QRect desktopResolution = QApplication::primaryScreen()->geometry();
|
||||||
|
@ -173,8 +155,7 @@ fileDialogPreSave: //Work?
|
||||||
#endif
|
#endif
|
||||||
exportPicture = exportPicture.scaled(desktopSizeWidth, desktopSizeHeight, aspectRatio, Qt::SmoothTransformation);
|
exportPicture = exportPicture.scaled(desktopSizeWidth, desktopSizeHeight, aspectRatio, Qt::SmoothTransformation);
|
||||||
}
|
}
|
||||||
else if (sizeMode == "Custom")
|
else if (sizeMode == "Custom") {
|
||||||
{
|
|
||||||
exportPicture = exportPicture.scaled(cusExportSize, aspectRatio, Qt::SmoothTransformation);
|
exportPicture = exportPicture.scaled(cusExportSize, aspectRatio, Qt::SmoothTransformation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,32 +166,26 @@ fileDialogPreSave: //Work?
|
||||||
#else
|
#else
|
||||||
QFile *picFile = new QFile(selectedFile);
|
QFile *picFile = new QFile(selectedFile);
|
||||||
#endif
|
#endif
|
||||||
if (picFile->open(QIODevice::WriteOnly))
|
if (picFile->open(QIODevice::WriteOnly)) {
|
||||||
{
|
|
||||||
isSaved = exportPicture.save(picFile, saveFileFormat.toStdString().c_str(), useCustomQuality ? customQuality : defaultQuality);
|
isSaved = exportPicture.save(picFile, saveFileFormat.toStdString().c_str(), useCustomQuality ? customQuality : defaultQuality);
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
if (isSaved)
|
if (isSaved) {
|
||||||
{
|
|
||||||
isSaved = picFile->commit();
|
isSaved = picFile->commit();
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
errorId = 1;
|
errorId = 1;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
picFile->close();
|
picFile->close();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
errorId = 2;
|
errorId = 2;
|
||||||
}
|
}
|
||||||
delete picFile;
|
delete picFile;
|
||||||
|
|
||||||
if (!isSaved)
|
if (!isSaved) {
|
||||||
{
|
switch (errorId) {
|
||||||
switch (errorId)
|
|
||||||
{
|
|
||||||
case 0:
|
case 0:
|
||||||
QMessageBox::warning(parent, PictureDialog::tr("Export as Picture"), PictureDialog::tr("Failed to export the picture because the system occurred a write failure"));
|
QMessageBox::warning(parent, PictureDialog::tr("Export as Picture"), PictureDialog::tr("Failed to export the picture because the system occurred a write failure"));
|
||||||
break;
|
break;
|
||||||
|
@ -226,8 +201,7 @@ fileDialogPreSave: //Work?
|
||||||
goto fileDialogPreSave; //Work?
|
goto fileDialogPreSave; //Work?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
QMessageBox::warning(parent, PictureDialog::tr("Export as Picture"), PictureDialog::tr("No valid file is selected"));
|
QMessageBox::warning(parent, PictureDialog::tr("Export as Picture"), PictureDialog::tr("No valid file is selected"));
|
||||||
goto fileDialogPreSave; //Work?
|
goto fileDialogPreSave; //Work?
|
||||||
}
|
}
|
||||||
|
@ -263,7 +237,9 @@ fileDialogPreSave: //Work?
|
||||||
|
|
||||||
QStringList filters;
|
QStringList filters;
|
||||||
filters << PictureDialog::tr("GTA V Export (*.g5e)");
|
filters << PictureDialog::tr("GTA V Export (*.g5e)");
|
||||||
|
#ifndef GTA5SYNC_FLATPAK
|
||||||
filters << PictureDialog::tr("GTA V Raw Export (*.auto)");
|
filters << PictureDialog::tr("GTA V Raw Export (*.auto)");
|
||||||
|
#endif
|
||||||
filters << PictureDialog::tr("Snapmatic pictures (PGTA*)");
|
filters << PictureDialog::tr("Snapmatic pictures (PGTA*)");
|
||||||
fileDialog.setNameFilters(filters);
|
fileDialog.setNameFilters(filters);
|
||||||
|
|
||||||
|
@ -274,58 +250,48 @@ fileDialogPreSave: //Work?
|
||||||
fileDialog.restoreGeometry(settings.value(parent->objectName() % "+Geometry", "").toByteArray());
|
fileDialog.restoreGeometry(settings.value(parent->objectName() % "+Geometry", "").toByteArray());
|
||||||
fileDialog.selectFile(QString(picture->getExportPictureFileName() % ".g5e"));
|
fileDialog.selectFile(QString(picture->getExportPictureFileName() % ".g5e"));
|
||||||
|
|
||||||
if (fileDialog.exec())
|
if (fileDialog.exec()) {
|
||||||
{
|
|
||||||
QStringList selectedFiles = fileDialog.selectedFiles();
|
QStringList selectedFiles = fileDialog.selectedFiles();
|
||||||
if (selectedFiles.length() == 1)
|
if (selectedFiles.length() == 1) {
|
||||||
{
|
|
||||||
QString selectedFile = selectedFiles.at(0);
|
QString selectedFile = selectedFiles.at(0);
|
||||||
bool isAutoExt = false;
|
bool isAutoExt = false;
|
||||||
if (selectedFile.right(5) == ".auto")
|
#ifndef GTA5SYNC_FLATPAK
|
||||||
{
|
if (selectedFile.right(5) == ".auto") {
|
||||||
isAutoExt = true;
|
isAutoExt = true;
|
||||||
QString dirPath = QFileInfo(selectedFile).dir().path();
|
QString dirPath = QFileInfo(selectedFile).dir().path();
|
||||||
QString stockFileName = sgdFileInfo.fileName();
|
QString stockFileName = sgdFileInfo.fileName();
|
||||||
selectedFile = dirPath % "/" % stockFileName;
|
selectedFile = dirPath % "/" % stockFileName;
|
||||||
}
|
}
|
||||||
else if (selectedFile.right(4) == ".rem")
|
#endif
|
||||||
{
|
if (selectedFile.right(4) == ".rem") {
|
||||||
selectedFile.remove(selectedFile.length() - 4, 4);
|
selectedFile.remove(selectedFile.length() - 4, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (QFile::exists(selectedFile))
|
if (QFile::exists(selectedFile)) {
|
||||||
{
|
if (QMessageBox::No == QMessageBox::warning(parent, PictureDialog::tr("Export as Snapmatic"), PictureDialog::tr("Overwrite %1 with current Snapmatic picture?").arg("\""+selectedFile+"\""), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes)) {
|
||||||
if (QMessageBox::No == QMessageBox::warning(parent, PictureDialog::tr("Export as Snapmatic"), PictureDialog::tr("Overwrite %1 with current Snapmatic picture?").arg("\""+selectedFile+"\""), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes))
|
|
||||||
{
|
|
||||||
goto fileDialogPreSave; //Work?
|
goto fileDialogPreSave; //Work?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedFile.right(4) == ".g5e")
|
if (selectedFile.right(4) == ".g5e") {
|
||||||
{
|
|
||||||
bool isExported = picture->exportPicture(selectedFile, SnapmaticFormat::G5E_Format);
|
bool isExported = picture->exportPicture(selectedFile, SnapmaticFormat::G5E_Format);
|
||||||
if (!isExported)
|
if (!isExported) {
|
||||||
{
|
|
||||||
QMessageBox::warning(parent, PictureDialog::tr("Export as Snapmatic"), PictureDialog::tr("Failed to export current Snapmatic picture"));
|
QMessageBox::warning(parent, PictureDialog::tr("Export as Snapmatic"), PictureDialog::tr("Failed to export current Snapmatic picture"));
|
||||||
goto fileDialogPreSave; //Work?
|
goto fileDialogPreSave; //Work?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
bool isCopied = picture->exportPicture(selectedFile, SnapmaticFormat::PGTA_Format);
|
bool isCopied = picture->exportPicture(selectedFile, SnapmaticFormat::PGTA_Format);
|
||||||
if (!isCopied)
|
if (!isCopied) {
|
||||||
{
|
|
||||||
QMessageBox::warning(parent, PictureDialog::tr("Export as Snapmatic"), PictureDialog::tr("Failed to export current Snapmatic picture"));
|
QMessageBox::warning(parent, PictureDialog::tr("Export as Snapmatic"), PictureDialog::tr("Failed to export current Snapmatic picture"));
|
||||||
goto fileDialogPreSave; //Work?
|
goto fileDialogPreSave; //Work?
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
if (isAutoExt) QMessageBox::information(parent, PictureDialog::tr("Export as Snapmatic"), PictureDialog::tr("Exported Snapmatic to \"%1\" because of using the .auto extension.").arg(selectedFile));
|
if (isAutoExt) QMessageBox::information(parent, PictureDialog::tr("Export as Snapmatic"), PictureDialog::tr("Exported Snapmatic to \"%1\" because of using the .auto extension.").arg(selectedFile));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
QMessageBox::warning(parent, PictureDialog::tr("Export as Snapmatic"), PictureDialog::tr("No valid file is selected"));
|
QMessageBox::warning(parent, PictureDialog::tr("Export as Snapmatic"), PictureDialog::tr("No valid file is selected"));
|
||||||
goto fileDialogPreSave; //Work?
|
goto fileDialogPreSave; //Work?
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5view Grand Theft Auto V Profile Viewer
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2016-2017 Syping
|
* Copyright (C) 2016-2020 Syping
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -19,13 +19,12 @@
|
||||||
#include "PictureDialog.h"
|
#include "PictureDialog.h"
|
||||||
#include "PictureWidget.h"
|
#include "PictureWidget.h"
|
||||||
#include "UiModLabel.h"
|
#include "UiModLabel.h"
|
||||||
|
#include "AppEnv.h"
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
#include <QEvent>
|
#include <QEvent>
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
#if QT_VERSION < 0x060000
|
#if QT_VERSION < 0x060000
|
||||||
#include <QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
#endif
|
#endif
|
||||||
|
@ -63,12 +62,10 @@ PictureWidget::~PictureWidget()
|
||||||
|
|
||||||
bool PictureWidget::eventFilter(QObject *obj, QEvent *ev)
|
bool PictureWidget::eventFilter(QObject *obj, QEvent *ev)
|
||||||
{
|
{
|
||||||
if (obj == this)
|
if (obj == this) {
|
||||||
{
|
if (ev->type() == QEvent::KeyPress) {
|
||||||
if (ev->type() == QEvent::KeyPress)
|
|
||||||
{
|
|
||||||
QKeyEvent *keyEvent = (QKeyEvent*)ev;
|
QKeyEvent *keyEvent = (QKeyEvent*)ev;
|
||||||
switch (keyEvent->key()){
|
switch (keyEvent->key()) {
|
||||||
case Qt::Key_Left:
|
case Qt::Key_Left:
|
||||||
emit previousPictureRequested();
|
emit previousPictureRequested();
|
||||||
break;
|
break;
|
||||||
|
@ -83,36 +80,49 @@ bool PictureWidget::eventFilter(QObject *obj, QEvent *ev)
|
||||||
|
|
||||||
void PictureWidget::pictureDoubleClicked(Qt::MouseButton button)
|
void PictureWidget::pictureDoubleClicked(Qt::MouseButton button)
|
||||||
{
|
{
|
||||||
if (button == Qt::LeftButton)
|
if (button == Qt::LeftButton) {
|
||||||
{
|
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PictureWidget::setImage(QImage image_, QRect rec)
|
void PictureWidget::setImage(QImage image_, QRect rec)
|
||||||
{
|
{
|
||||||
|
const qreal screenRatioPR = AppEnv::screenRatioPR();
|
||||||
image = image_;
|
image = image_;
|
||||||
pictureLabel->setPixmap(QPixmap::fromImage(image.scaled(rec.width(), rec.height(), Qt::KeepAspectRatio, Qt::SmoothTransformation)));
|
QPixmap pixmap = QPixmap::fromImage(image.scaled(rec.width() * screenRatioPR, rec.height() * screenRatioPR, Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
||||||
|
#if QT_VERSION >= 0x050600
|
||||||
|
pixmap.setDevicePixelRatio(AppEnv::screenRatioPR());
|
||||||
|
#endif
|
||||||
|
pictureLabel->setPixmap(pixmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PictureWidget::setImage(QImage image_)
|
void PictureWidget::setImage(QImage image_)
|
||||||
{
|
{
|
||||||
|
const qreal screenRatioPR = AppEnv::screenRatioPR();
|
||||||
image = image_;
|
image = image_;
|
||||||
pictureLabel->setPixmap(QPixmap::fromImage(image.scaled(geometry().width(), geometry().height(), Qt::KeepAspectRatio, Qt::SmoothTransformation)));
|
QPixmap pixmap = QPixmap::fromImage(image.scaled(geometry().width() * screenRatioPR, geometry().height() * screenRatioPR, Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
||||||
|
#if QT_VERSION >= 0x050600
|
||||||
|
pixmap.setDevicePixelRatio(screenRatioPR);
|
||||||
|
#endif
|
||||||
|
pictureLabel->setPixmap(pixmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PictureWidget::updateWindowSize(int screenID)
|
void PictureWidget::updateWindowSize(int screenID)
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= 0x060000
|
#if QT_VERSION >= 0x060000
|
||||||
Q_UNUSED(screenID)
|
Q_UNUSED(screenID)
|
||||||
|
const qreal screenRatioPR = AppEnv::screenRatioPR();
|
||||||
QRect desktopRect = QApplication::screenAt(pos())->geometry();
|
QRect desktopRect = QApplication::screenAt(pos())->geometry();
|
||||||
move(desktopRect.x(), desktopRect.y());
|
move(desktopRect.x(), desktopRect.y());
|
||||||
resize(desktopRect.width(), desktopRect.height());
|
resize(desktopRect.width(), desktopRect.height());
|
||||||
showFullScreen();
|
showFullScreen();
|
||||||
pictureLabel->setPixmap(QPixmap::fromImage(image.scaled(desktopRect.width(), desktopRect.height(), Qt::KeepAspectRatio, Qt::SmoothTransformation)));
|
QPixmap pixmap = QPixmap::fromImage(image.scaled(geometry().width() * screenRatioPR, geometry().height() * screenRatioPR, Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
||||||
|
#if QT_VERSION >= 0x050600
|
||||||
|
pixmap.setDevicePixelRatio(screenRatioPR);
|
||||||
|
#endif
|
||||||
|
pictureLabel->setPixmap(pixmap);
|
||||||
#else
|
#else
|
||||||
if (screenID == QApplication::desktop()->screenNumber(this))
|
if (screenID == QApplication::desktop()->screenNumber(this)) {
|
||||||
{
|
|
||||||
QRect desktopRect = QApplication::desktop()->screenGeometry(this);
|
QRect desktopRect = QApplication::desktop()->screenGeometry(this);
|
||||||
move(desktopRect.x(), desktopRect.y());
|
move(desktopRect.x(), desktopRect.y());
|
||||||
resize(desktopRect.width(), desktopRect.height());
|
resize(desktopRect.width(), desktopRect.height());
|
||||||
|
|
|
@ -262,8 +262,7 @@ void ProfileInterface::loadingProgress(int value, int maximum)
|
||||||
void ProfileInterface::insertSnapmaticIPI(QWidget *widget)
|
void ProfileInterface::insertSnapmaticIPI(QWidget *widget)
|
||||||
{
|
{
|
||||||
ProfileWidget *proWidget = qobject_cast<ProfileWidget*>(widget);
|
ProfileWidget *proWidget = qobject_cast<ProfileWidget*>(widget);
|
||||||
if (widgets.contains(proWidget))
|
if (widgets.contains(proWidget)) {
|
||||||
{
|
|
||||||
QString widgetKey = widgets[proWidget];
|
QString widgetKey = widgets[proWidget];
|
||||||
QStringList widgetsKeyList = widgets.values();
|
QStringList widgetsKeyList = widgets.values();
|
||||||
QStringList pictureKeyList = widgetsKeyList.filter("PIC", Qt::CaseSensitive);
|
QStringList pictureKeyList = widgetsKeyList.filter("PIC", Qt::CaseSensitive);
|
||||||
|
@ -283,8 +282,7 @@ void ProfileInterface::insertSnapmaticIPI(QWidget *widget)
|
||||||
void ProfileInterface::insertSavegameIPI(QWidget *widget)
|
void ProfileInterface::insertSavegameIPI(QWidget *widget)
|
||||||
{
|
{
|
||||||
ProfileWidget *proWidget = qobject_cast<ProfileWidget*>(widget);
|
ProfileWidget *proWidget = qobject_cast<ProfileWidget*>(widget);
|
||||||
if (widgets.contains(proWidget))
|
if (widgets.contains(proWidget)) {
|
||||||
{
|
|
||||||
QString widgetKey = widgets[proWidget];
|
QString widgetKey = widgets[proWidget];
|
||||||
QStringList widgetsKeyList = widgets.values();
|
QStringList widgetsKeyList = widgets.values();
|
||||||
QStringList savegameKeyList = widgetsKeyList.filter("SGD", Qt::CaseSensitive);
|
QStringList savegameKeyList = widgetsKeyList.filter("SGD", Qt::CaseSensitive);
|
||||||
|
@ -305,8 +303,7 @@ void ProfileInterface::dialogNextPictureRequested(QWidget *dialog)
|
||||||
{
|
{
|
||||||
PictureDialog *picDialog = qobject_cast<PictureDialog*>(dialog);
|
PictureDialog *picDialog = qobject_cast<PictureDialog*>(dialog);
|
||||||
ProfileWidget *proWidget = qobject_cast<ProfileWidget*>(sender());
|
ProfileWidget *proWidget = qobject_cast<ProfileWidget*>(sender());
|
||||||
if (widgets.contains(proWidget))
|
if (widgets.contains(proWidget)) {
|
||||||
{
|
|
||||||
QString widgetKey = widgets[proWidget];
|
QString widgetKey = widgets[proWidget];
|
||||||
QStringList widgetsKeyList = widgets.values();
|
QStringList widgetsKeyList = widgets.values();
|
||||||
QStringList pictureKeyList = widgetsKeyList.filter("PIC", Qt::CaseSensitive);
|
QStringList pictureKeyList = widgetsKeyList.filter("PIC", Qt::CaseSensitive);
|
||||||
|
@ -1358,10 +1355,10 @@ void ProfileInterface::exportSelected()
|
||||||
QString ExportPreSpan;
|
QString ExportPreSpan;
|
||||||
QString ExportPostSpan;
|
QString ExportPostSpan;
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
ExportPreSpan = "<span style=\"color: #003399; font-size: 12pt\">";
|
ExportPreSpan = "<span style=\"color:#003399;font-size:12pt\">";
|
||||||
ExportPostSpan = "</span>";
|
ExportPostSpan = "</span>";
|
||||||
#else
|
#else
|
||||||
ExportPreSpan = "<span style=\"font-weight: bold\">";
|
ExportPreSpan = "<span style=\"font-weight:bold\">";
|
||||||
ExportPostSpan = "</span>";
|
ExportPostSpan = "</span>";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5view Grand Theft Auto V Profile Viewer
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2016-2017 Syping
|
* Copyright (C) 2016-2020 Syping
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -30,7 +30,6 @@
|
||||||
|
|
||||||
ProfileLoader::ProfileLoader(QString profileFolder, CrewDatabase *crewDB, QObject *parent) : QThread(parent), profileFolder(profileFolder), crewDB(crewDB)
|
ProfileLoader::ProfileLoader(QString profileFolder, CrewDatabase *crewDB, QObject *parent) : QThread(parent), profileFolder(profileFolder), crewDB(crewDB)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProfileLoader::run()
|
void ProfileLoader::run()
|
||||||
|
@ -50,8 +49,7 @@ void ProfileLoader::run()
|
||||||
|
|
||||||
SavegameFiles.removeDuplicates();
|
SavegameFiles.removeDuplicates();
|
||||||
SnapmaticPics.removeDuplicates();
|
SnapmaticPics.removeDuplicates();
|
||||||
for (QString BackupFile : BackupFiles)
|
for (const QString &BackupFile : BackupFiles) {
|
||||||
{
|
|
||||||
SavegameFiles.removeAll(BackupFile);
|
SavegameFiles.removeAll(BackupFile);
|
||||||
SnapmaticPics.removeAll(BackupFile);
|
SnapmaticPics.removeAll(BackupFile);
|
||||||
}
|
}
|
||||||
|
@ -60,36 +58,29 @@ void ProfileLoader::run()
|
||||||
|
|
||||||
// Loading pictures and savegames
|
// Loading pictures and savegames
|
||||||
emit loadingProgress(curFile, maximumV);
|
emit loadingProgress(curFile, maximumV);
|
||||||
for (QString SavegameFile : SavegameFiles)
|
for (const QString &SavegameFile : SavegameFiles) {
|
||||||
{
|
|
||||||
emit loadingProgress(curFile, maximumV);
|
emit loadingProgress(curFile, maximumV);
|
||||||
QString sgdPath = profileFolder % "/" % SavegameFile;
|
const QString sgdPath = profileFolder % "/" % SavegameFile;
|
||||||
SavegameData *savegame = new SavegameData(sgdPath);
|
SavegameData *savegame = new SavegameData(sgdPath);
|
||||||
if (savegame->readingSavegame())
|
if (savegame->readingSavegame()) {
|
||||||
{
|
|
||||||
emit savegameLoaded(savegame, sgdPath);
|
emit savegameLoaded(savegame, sgdPath);
|
||||||
}
|
}
|
||||||
curFile++;
|
curFile++;
|
||||||
}
|
}
|
||||||
for (QString SnapmaticPic : SnapmaticPics)
|
for (const QString &SnapmaticPic : SnapmaticPics) {
|
||||||
{
|
|
||||||
emit loadingProgress(curFile, maximumV);
|
emit loadingProgress(curFile, maximumV);
|
||||||
QString picturePath = profileFolder % "/" % SnapmaticPic;
|
const QString picturePath = profileFolder % "/" % SnapmaticPic;
|
||||||
SnapmaticPicture *picture = new SnapmaticPicture(picturePath);
|
SnapmaticPicture *picture = new SnapmaticPicture(picturePath);
|
||||||
if (picture->readingPicture(true))
|
if (picture->readingPicture(true)) {
|
||||||
{
|
if (picture->isFormatSwitched()) {
|
||||||
if (picture->isFormatSwitched())
|
|
||||||
{
|
|
||||||
picture->setSnapmaticFormat(SnapmaticFormat::PGTA_Format);
|
picture->setSnapmaticFormat(SnapmaticFormat::PGTA_Format);
|
||||||
if (picture->exportPicture(picturePath, SnapmaticFormat::PGTA_Format))
|
if (picture->exportPicture(picturePath, SnapmaticFormat::PGTA_Format)) {
|
||||||
{
|
|
||||||
emit pictureFixed(picture);
|
emit pictureFixed(picture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
emit pictureLoaded(picture);
|
emit pictureLoaded(picture);
|
||||||
int crewNumber = picture->getSnapmaticProperties().crewID;
|
int crewNumber = picture->getSnapmaticProperties().crewID;
|
||||||
if (!crewList.contains(crewNumber))
|
if (!crewList.contains(crewNumber)) {
|
||||||
{
|
|
||||||
crewList += crewNumber;
|
crewList += crewNumber;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,8 +89,7 @@ void ProfileLoader::run()
|
||||||
|
|
||||||
// adding found crews
|
// adding found crews
|
||||||
crewDB->setAddingCrews(true);
|
crewDB->setAddingCrews(true);
|
||||||
for (int crewID : crewList)
|
for (int crewID : crewList) {
|
||||||
{
|
|
||||||
crewDB->addCrew(crewID);
|
crewDB->addCrew(crewID);
|
||||||
}
|
}
|
||||||
crewDB->setAddingCrews(false);
|
crewDB->setAddingCrews(false);
|
||||||
|
@ -107,10 +97,9 @@ void ProfileLoader::run()
|
||||||
|
|
||||||
void ProfileLoader::preloaded()
|
void ProfileLoader::preloaded()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProfileLoader::loaded()
|
void ProfileLoader::loaded()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -376,15 +376,12 @@ QString SnapmaticPicture::getLastStep(bool readable)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage SnapmaticPicture::getImage(bool fastLoad)
|
QImage SnapmaticPicture::getImage()
|
||||||
{
|
{
|
||||||
Q_UNUSED(fastLoad)
|
if (cacheEnabled) {
|
||||||
if (cacheEnabled)
|
|
||||||
{
|
|
||||||
return cachePicture;
|
return cachePicture;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
return QImage::fromData(p_ragePhoto.photoData(), "JPEG");
|
return QImage::fromData(p_ragePhoto.photoData(), "JPEG");
|
||||||
}
|
}
|
||||||
return QImage();
|
return QImage();
|
||||||
|
|
|
@ -62,7 +62,7 @@ public:
|
||||||
bool readingPicture(bool cacheEnabled = false);
|
bool readingPicture(bool cacheEnabled = false);
|
||||||
bool isPicOk(); // Please use isPictureOk instead
|
bool isPicOk(); // Please use isPictureOk instead
|
||||||
void clearCache();
|
void clearCache();
|
||||||
QImage getImage(bool fastLoad = false);
|
QImage getImage();
|
||||||
QByteArray getPictureStream();
|
QByteArray getPictureStream();
|
||||||
QString getLastStep(bool readable = true);
|
QString getLastStep(bool readable = true);
|
||||||
QString getPictureStr();
|
QString getPictureStr();
|
||||||
|
|
|
@ -31,9 +31,9 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <QStringBuilder>
|
#include <QStringBuilder>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QPainter>
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QDebug>
|
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
|
||||||
|
@ -76,19 +76,32 @@ void SnapmaticWidget::setSnapmaticPicture(SnapmaticPicture *picture)
|
||||||
QObject::connect(picture, SIGNAL(updated()), this, SLOT(snapmaticUpdated()));
|
QObject::connect(picture, SIGNAL(updated()), this, SLOT(snapmaticUpdated()));
|
||||||
QObject::connect(picture, SIGNAL(customSignal(QString)), this, SLOT(customSignal(QString)));
|
QObject::connect(picture, SIGNAL(customSignal(QString)), this, SLOT(customSignal(QString)));
|
||||||
|
|
||||||
qreal screenRatio = AppEnv::screenRatio();
|
const qreal screenRatio = AppEnv::screenRatio();
|
||||||
qreal screenRatioPR = AppEnv::screenRatioPR();
|
const qreal screenRatioPR = AppEnv::screenRatioPR();
|
||||||
|
const QSize renderResolution(48 * screenRatio * screenRatioPR, 27 * screenRatio * screenRatioPR);
|
||||||
ui->labPicture->setFixedSize(48 * screenRatio, 27 * screenRatio);
|
ui->labPicture->setFixedSize(48 * screenRatio, 27 * screenRatio);
|
||||||
|
|
||||||
ui->labPicture->setScaledContents(true);
|
ui->labPicture->setScaledContents(true);
|
||||||
|
|
||||||
QPixmap SnapmaticPixmap = QPixmap::fromImage(picture->getImage().scaled(ui->labPicture->width() * screenRatioPR, ui->labPicture->height() * screenRatioPR, Qt::IgnoreAspectRatio, Qt::SmoothTransformation), Qt::AutoColor);
|
QPixmap renderPixmap(renderResolution);
|
||||||
|
renderPixmap.fill(Qt::transparent);
|
||||||
|
QPainter renderPainter(&renderPixmap);
|
||||||
|
const QImage renderImage = picture->getImage().scaled(renderResolution, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||||
|
if (renderImage.width() < renderResolution.width()) {
|
||||||
|
renderPainter.drawImage((renderResolution.width() - renderImage.width()) / 2, 0, renderImage, Qt::AutoColor);
|
||||||
|
}
|
||||||
|
else if (renderImage.height() < renderResolution.height()) {
|
||||||
|
renderPainter.drawImage(0, (renderResolution.height() - renderImage.height()) / 2, renderImage, Qt::AutoColor);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
renderPainter.drawImage(0, 0, renderImage, Qt::AutoColor);
|
||||||
|
}
|
||||||
|
renderPainter.end();
|
||||||
#if QT_VERSION >= 0x050600
|
#if QT_VERSION >= 0x050600
|
||||||
SnapmaticPixmap.setDevicePixelRatio(screenRatioPR);
|
renderPixmap.setDevicePixelRatio(screenRatioPR);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ui->labPicStr->setText(smpic->getPictureStr() % "\n" % smpic->getPictureTitl());
|
ui->labPicStr->setText(smpic->getPictureStr() % "\n" % smpic->getPictureTitl());
|
||||||
ui->labPicture->setPixmap(SnapmaticPixmap);
|
ui->labPicture->setPixmap(renderPixmap);
|
||||||
|
|
||||||
picture->clearCache();
|
picture->clearCache();
|
||||||
|
|
||||||
|
|
520
res/gta5sync.ts
520
res/gta5sync.ts
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
Loading…
Reference in a new issue