more RDR 2-awareness, some code rework
This commit is contained in:
parent
e7721404b6
commit
259e785165
10 changed files with 185 additions and 210 deletions
|
@ -36,7 +36,7 @@
|
||||||
#include <QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ExportThread::ExportThread(QMap<ProfileWidget*,QString> profileMap, QString exportDirectory, bool pictureCopyEnabled, bool pictureExportEnabled, int exportCount, QObject *parent) : QThread(parent),
|
ExportThread::ExportThread(QHash<ProfileWidget*,QString> profileMap, QString exportDirectory, bool pictureCopyEnabled, bool pictureExportEnabled, int exportCount, QObject *parent) : QThread(parent),
|
||||||
profileMap(profileMap), exportDirectory(exportDirectory), pictureCopyEnabled(pictureCopyEnabled), pictureExportEnabled(pictureExportEnabled), exportCount(exportCount)
|
profileMap(profileMap), exportDirectory(exportDirectory), pictureCopyEnabled(pictureCopyEnabled), pictureExportEnabled(pictureExportEnabled), exportCount(exportCount)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -59,9 +59,12 @@ void ExportThread::run()
|
||||||
emit exportStringUpdate(ProfileInterface::tr("Export file %1 of %2 files").arg(QString::number(intExportProgress), QString::number(exportCount)));
|
emit exportStringUpdate(ProfileInterface::tr("Export file %1 of %2 files").arg(QString::number(intExportProgress), QString::number(exportCount)));
|
||||||
emit exportProgressUpdate(intExportProgress);
|
emit exportProgressUpdate(intExportProgress);
|
||||||
|
|
||||||
|
bool isSaved = false;
|
||||||
QSaveFile exportFile(exportDirectory % "/" % exportFileName);
|
QSaveFile exportFile(exportDirectory % "/" % exportFileName);
|
||||||
|
if (exportFile.open(QIODevice::WriteOnly)) {
|
||||||
exportFile.write(picture->getPictureStream());
|
exportFile.write(picture->getPictureStream());
|
||||||
bool isSaved = exportFile.commit();
|
isSaved = exportFile.commit();
|
||||||
|
}
|
||||||
|
|
||||||
if (!isSaved)
|
if (!isSaved)
|
||||||
failedExportPictures += exportFileName;
|
failedExportPictures += exportFileName;
|
||||||
|
|
|
@ -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-2023 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
|
||||||
|
@ -29,7 +29,7 @@ class ExportThread : public QThread
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit ExportThread(QMap<ProfileWidget*,QString> profileMap, QString exportDirectory, bool pictureCopyEnabled, bool pictureExportEnabled, int exportCount, QObject *parent = 0);
|
explicit ExportThread(QHash<ProfileWidget*,QString> profileMap, QString exportDirectory, bool pictureCopyEnabled, bool pictureExportEnabled, int exportCount, QObject *parent = 0);
|
||||||
QStringList getFailedSavegames();
|
QStringList getFailedSavegames();
|
||||||
QStringList getFailedCopyPictures();
|
QStringList getFailedCopyPictures();
|
||||||
QStringList getFailedExportPictures();
|
QStringList getFailedExportPictures();
|
||||||
|
@ -38,7 +38,7 @@ protected:
|
||||||
void run();
|
void run();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QMap <ProfileWidget*, QString> profileMap;
|
QHash<ProfileWidget*,QString> profileMap;
|
||||||
QString exportDirectory;
|
QString exportDirectory;
|
||||||
bool pictureCopyEnabled;
|
bool pictureCopyEnabled;
|
||||||
bool pictureExportEnabled;
|
bool pictureExportEnabled;
|
||||||
|
|
|
@ -169,12 +169,13 @@ void PictureDialog::setupPictureDialog()
|
||||||
// Manage menu
|
// Manage menu
|
||||||
manageMenu = new QMenu(this);
|
manageMenu = new QMenu(this);
|
||||||
manageMenu->addAction(tr("Export as &Picture..."), this, &PictureDialog::exportSnapmaticPicture);
|
manageMenu->addAction(tr("Export as &Picture..."), this, &PictureDialog::exportSnapmaticPicture);
|
||||||
manageMenu->addAction(tr("Export as &Snapmatic..."), this, &PictureDialog::copySnapmaticPicture);
|
exportPhotoAction = manageMenu->addAction(tr("Export as &RAGE Photo..."), this, &PictureDialog::copySnapmaticPicture);
|
||||||
manageMenu->addSeparator();
|
manageMenu->addSeparator();
|
||||||
manageMenu->addAction(tr("&Edit Properties..."), this, &PictureDialog::editSnapmaticProperties);
|
manageMenu->addAction(tr("&Edit Properties..."), this, &PictureDialog::editSnapmaticProperties);
|
||||||
manageMenu->addAction(tr("&Overwrite Image..."), this, &PictureDialog::editSnapmaticImage);
|
manageMenu->addAction(tr("&Overwrite Image..."), this, &PictureDialog::editSnapmaticImage);
|
||||||
manageMenu->addSeparator();
|
manageMenu->addSeparator();
|
||||||
QAction *openViewerAction = manageMenu->addAction(tr("Open &Map Viewer..."), this, &PictureDialog::openPreviewMap);
|
openViewerAction = manageMenu->addAction(tr("Open &Map Viewer..."), this, &PictureDialog::openPreviewMap);
|
||||||
|
openViewerAction->setEnabled(false);
|
||||||
openViewerAction->setShortcut(Qt::Key_M);
|
openViewerAction->setShortcut(Qt::Key_M);
|
||||||
manageMenu->addAction(tr("Open &JSON Editor..."), this, &PictureDialog::editSnapmaticRawJson);
|
manageMenu->addAction(tr("Open &JSON Editor..."), this, &PictureDialog::editSnapmaticRawJson);
|
||||||
ui->cmdManage->setMenu(manageMenu);
|
ui->cmdManage->setMenu(manageMenu);
|
||||||
|
@ -490,6 +491,17 @@ void PictureDialog::setSnapmaticPicture(SnapmaticPicture *picture, bool readOk,
|
||||||
snapmaticPicture = picture->getImage();
|
snapmaticPicture = picture->getImage();
|
||||||
renderPicture();
|
renderPicture();
|
||||||
ui->cmdManage->setEnabled(true);
|
ui->cmdManage->setEnabled(true);
|
||||||
|
if (smpic->getSnapmaticFormat() == SnapmaticFormat::PGTA5_Format)
|
||||||
|
exportPhotoAction->setText(tr("Export as >A V Snapmatic..."));
|
||||||
|
else if (smpic->getSnapmaticFormat() == SnapmaticFormat::G5E_Format)
|
||||||
|
exportPhotoAction->setText(tr("Export as >A V Snapmatic..."));
|
||||||
|
else if (smpic->getSnapmaticFormat() == SnapmaticFormat::PRDR3_Format)
|
||||||
|
exportPhotoAction->setText(tr("Export as &RDR 2 Photo..."));
|
||||||
|
else
|
||||||
|
exportPhotoAction->setText(tr("Export as &RAGE Photo..."));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
exportPhotoAction->setText(tr("Export as &RAGE Photo..."));
|
||||||
}
|
}
|
||||||
if (picture->isJsonOk()) {
|
if (picture->isJsonOk()) {
|
||||||
crewStr = crewDB->getCrewName(crewID);
|
crewStr = crewDB->getCrewName(crewID);
|
||||||
|
@ -498,10 +510,17 @@ void PictureDialog::setSnapmaticPicture(SnapmaticPicture *picture, bool readOk,
|
||||||
else
|
else
|
||||||
picAreaStr = picArea;
|
picAreaStr = picArea;
|
||||||
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));
|
||||||
|
if (smpic->getSnapmaticFormat() == SnapmaticFormat::PGTA5_Format)
|
||||||
|
openViewerAction->setEnabled(true);
|
||||||
|
else if (smpic->getSnapmaticFormat() == SnapmaticFormat::G5E_Format)
|
||||||
|
openViewerAction->setEnabled(true);
|
||||||
|
else
|
||||||
|
openViewerAction->setEnabled(false);
|
||||||
QTimer::singleShot(0, this, &PictureDialog::adaptDialogSize);
|
QTimer::singleShot(0, this, &PictureDialog::adaptDialogSize);
|
||||||
}
|
}
|
||||||
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")));
|
||||||
|
openViewerAction->setEnabled(false);
|
||||||
QTimer::singleShot(0, this, &PictureDialog::adaptDialogSize);
|
QTimer::singleShot(0, this, &PictureDialog::adaptDialogSize);
|
||||||
}
|
}
|
||||||
QObject::connect(smpic, &SnapmaticPicture::updated, this, &PictureDialog::updated);
|
QObject::connect(smpic, &SnapmaticPicture::updated, this, &PictureDialog::updated);
|
||||||
|
@ -642,29 +661,28 @@ void PictureDialog::on_labPicture_mouseDoubleClicked(Qt::MouseButton button)
|
||||||
#else
|
#else
|
||||||
QRect desktopRect = QApplication::desktop()->screenGeometry(this);
|
QRect desktopRect = QApplication::desktop()->screenGeometry(this);
|
||||||
#endif
|
#endif
|
||||||
PictureWidget *pictureWidget = new PictureWidget(this); // Work!
|
PictureWidget pictureWidget(this);
|
||||||
pictureWidget->setObjectName("PictureWidget");
|
pictureWidget.setObjectName("PictureWidget");
|
||||||
pictureWidget->setWindowFlag(Qt::FramelessWindowHint, true);
|
pictureWidget.setWindowFlag(Qt::FramelessWindowHint, true);
|
||||||
pictureWidget->setWindowFlag(Qt::MaximizeUsingFullscreenGeometryHint, true);
|
pictureWidget.setWindowFlag(Qt::MaximizeUsingFullscreenGeometryHint, true);
|
||||||
pictureWidget->setWindowTitle(windowTitle());
|
pictureWidget.setWindowTitle(windowTitle());
|
||||||
pictureWidget->setStyleSheet("QLabel#pictureLabel{background-color:black;}");
|
pictureWidget.setStyleSheet("QLabel#pictureLabel{background-color:black;}");
|
||||||
pictureWidget->setImage(smpic->getImage(), desktopRect);
|
pictureWidget.setImage(smpic->getImage(), desktopRect);
|
||||||
pictureWidget->setModal(true);
|
pictureWidget.setModal(true);
|
||||||
|
|
||||||
fullscreenWidget = pictureWidget;
|
fullscreenWidget = &pictureWidget;
|
||||||
QObject::connect(this, &PictureDialog::newPictureCommited, pictureWidget, QOverload<QImage>::of(&PictureWidget::setImage));
|
QObject::connect(this, &PictureDialog::newPictureCommited, &pictureWidget, QOverload<QImage>::of(&PictureWidget::setImage));
|
||||||
QObject::connect(pictureWidget, &PictureWidget::nextPictureRequested, this, &PictureDialog::dialogNextPictureRequested);
|
QObject::connect(&pictureWidget, &PictureWidget::nextPictureRequested, this, &PictureDialog::dialogNextPictureRequested);
|
||||||
QObject::connect(pictureWidget, &PictureWidget::previousPictureRequested, this, &PictureDialog::dialogPreviousPictureRequested);
|
QObject::connect(&pictureWidget, &PictureWidget::previousPictureRequested, this, &PictureDialog::dialogPreviousPictureRequested);
|
||||||
|
|
||||||
pictureWidget->move(desktopRect.x(), desktopRect.y());
|
pictureWidget.move(desktopRect.x(), desktopRect.y());
|
||||||
pictureWidget->resize(desktopRect.width(), desktopRect.height());
|
pictureWidget.resize(desktopRect.width(), desktopRect.height());
|
||||||
pictureWidget->showFullScreen();
|
pictureWidget.showFullScreen();
|
||||||
pictureWidget->setFocus();
|
pictureWidget.setFocus();
|
||||||
pictureWidget->raise();
|
pictureWidget.raise();
|
||||||
pictureWidget->exec();
|
pictureWidget.exec();
|
||||||
|
|
||||||
fullscreenWidget = nullptr; // Work!
|
fullscreenWidget = nullptr;
|
||||||
delete pictureWidget; // Work!
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -861,7 +879,7 @@ void PictureDialog::updated()
|
||||||
void PictureDialog::customSignal(QString signal)
|
void PictureDialog::customSignal(QString signal)
|
||||||
{
|
{
|
||||||
SnapmaticPicture *picture = smpic; // used by macro
|
SnapmaticPicture *picture = smpic; // used by macro
|
||||||
if (signal == "PictureUpdated") {
|
if (signal == QStringLiteral("PictureUpdated")) {
|
||||||
snapmaticPicture = picture->getImage();
|
snapmaticPicture = picture->getImage();
|
||||||
renderPicture();
|
renderPicture();
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,6 +124,8 @@ private:
|
||||||
int avatarLocX;
|
int avatarLocX;
|
||||||
int avatarLocY;
|
int avatarLocY;
|
||||||
int avatarSize;
|
int avatarSize;
|
||||||
|
QAction *exportPhotoAction;
|
||||||
|
QAction *openViewerAction;
|
||||||
QMenu *manageMenu;
|
QMenu *manageMenu;
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
#if QT_VERSION >= 0x050000
|
#if QT_VERSION >= 0x050000
|
||||||
|
|
|
@ -925,20 +925,20 @@ bool ProfileInterface::importRemote(QUrl remoteUrl)
|
||||||
urlPasteDialog.setFixedSize(urlPasteDialog.sizeHint());
|
urlPasteDialog.setFixedSize(urlPasteDialog.sizeHint());
|
||||||
urlPasteDialog.show();
|
urlPasteDialog.show();
|
||||||
|
|
||||||
QNetworkAccessManager *netManager = new QNetworkAccessManager();
|
QNetworkAccessManager netManager;
|
||||||
QNetworkRequest netRequest(remoteUrl);
|
QNetworkRequest netRequest(remoteUrl);
|
||||||
netRequest.setRawHeader("User-Agent", AppEnv::getUserAgent());
|
netRequest.setRawHeader("User-Agent", AppEnv::getUserAgent());
|
||||||
netRequest.setRawHeader("Accept", "text/html");
|
netRequest.setRawHeader("Accept", "text/html");
|
||||||
netRequest.setRawHeader("Accept-Charset", "utf-8");
|
netRequest.setRawHeader("Accept-Charset", "utf-8");
|
||||||
netRequest.setRawHeader("Accept-Language", "en-US,en;q=0.9");
|
netRequest.setRawHeader("Accept-Language", "en-US,en;q=0.9");
|
||||||
netRequest.setRawHeader("Connection", "keep-alive");
|
netRequest.setRawHeader("Connection", "keep-alive");
|
||||||
QNetworkReply *netReply = netManager->get(netRequest);
|
QNetworkReply *netReply = netManager.get(netRequest);
|
||||||
QEventLoop *downloadLoop = new QEventLoop();
|
netReply->setParent(&netManager);
|
||||||
QObject::connect(netReply, SIGNAL(finished()), downloadLoop, SLOT(quit()));
|
QEventLoop downloadLoop;
|
||||||
QTimer::singleShot(30000, downloadLoop, SLOT(quit()));
|
QObject::connect(netReply, &QNetworkReply::finished, &downloadLoop, &QEventLoop::quit);
|
||||||
downloadLoop->exec();
|
QTimer::singleShot(30000, &downloadLoop, &QEventLoop::quit);
|
||||||
downloadLoop->disconnect();
|
downloadLoop.exec();
|
||||||
delete downloadLoop;
|
downloadLoop.disconnect();
|
||||||
|
|
||||||
urlPasteDialog.close();
|
urlPasteDialog.close();
|
||||||
|
|
||||||
|
@ -957,8 +957,6 @@ bool ProfileInterface::importRemote(QUrl remoteUrl)
|
||||||
else {
|
else {
|
||||||
netReply->abort();
|
netReply->abort();
|
||||||
}
|
}
|
||||||
delete netReply;
|
|
||||||
delete netManager;
|
|
||||||
return retValue;
|
return retValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -966,14 +964,14 @@ bool ProfileInterface::importImage(QImage *snapmaticImage, QDateTime importDateT
|
||||||
{
|
{
|
||||||
SnapmaticPicture *picture = new SnapmaticPicture();
|
SnapmaticPicture *picture = new SnapmaticPicture();
|
||||||
picture->initialise(photoFormat);
|
picture->initialise(photoFormat);
|
||||||
ImportDialog *importDialog = new ImportDialog(profileName, this);
|
ImportDialog importDialog(profileName, this);
|
||||||
importDialog->setImage(snapmaticImage);
|
importDialog.setImage(snapmaticImage);
|
||||||
importDialog->setModal(true);
|
importDialog.setModal(true);
|
||||||
importDialog->show();
|
importDialog.show();
|
||||||
importDialog->exec();
|
importDialog.exec();
|
||||||
bool success = false;
|
bool success = false;
|
||||||
if (importDialog->isImportAgreed()) {
|
if (importDialog.isImportAgreed()) {
|
||||||
if (picture->setImage(importDialog->image(), importDialog->isUnlimitedBuffer())) {
|
if (picture->setImage(importDialog.image(), importDialog.isUnlimitedBuffer())) {
|
||||||
QString fileFormat;
|
QString fileFormat;
|
||||||
switch (photoFormat) {
|
switch (photoFormat) {
|
||||||
case RagePhoto::PhotoFormat::GTA5:
|
case RagePhoto::PhotoFormat::GTA5:
|
||||||
|
@ -1011,7 +1009,7 @@ bool ProfileInterface::importImage(QImage *snapmaticImage, QDateTime importDateT
|
||||||
#endif
|
#endif
|
||||||
picture->setSnapmaticProperties(spJson);
|
picture->setSnapmaticProperties(spJson);
|
||||||
picture->setPicFileName(fileFormat.arg(QString::number(spJson.uid)));
|
picture->setPicFileName(fileFormat.arg(QString::number(spJson.uid)));
|
||||||
picture->setPictureTitle(importDialog->getImageTitle());
|
picture->setPictureTitle(importDialog.getImageTitle());
|
||||||
success = importSnapmaticPicture(picture, true);
|
success = importSnapmaticPicture(picture, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1019,7 +1017,6 @@ bool ProfileInterface::importImage(QImage *snapmaticImage, QDateTime importDateT
|
||||||
delete picture;
|
delete picture;
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
delete importDialog;
|
|
||||||
if (!success)
|
if (!success)
|
||||||
delete picture;
|
delete picture;
|
||||||
return success;
|
return success;
|
||||||
|
@ -1214,10 +1211,13 @@ void ProfileInterface::exportSelected()
|
||||||
|
|
||||||
if (exportPictures != 0) {
|
if (exportPictures != 0) {
|
||||||
QInputDialog inputDialog;
|
QInputDialog inputDialog;
|
||||||
|
inputDialog.setWindowFlag(Qt::WindowContextHelpButtonHint, false);
|
||||||
|
inputDialog.setWindowFlag(Qt::WindowMinMaxButtonsHint, false);
|
||||||
|
|
||||||
QStringList inputDialogItems;
|
QStringList inputDialogItems;
|
||||||
inputDialogItems << tr("JPG pictures and GTA Snapmatic");
|
inputDialogItems << tr("JPEG pictures, GTA V Snapmatic and RDR 2 Photo");
|
||||||
inputDialogItems << tr("JPG pictures only");
|
inputDialogItems << tr("JPEG pictures");
|
||||||
inputDialogItems << tr("GTA Snapmatic only");
|
inputDialogItems << tr("GTA V Snapmatic and RDR 2 Photo");
|
||||||
|
|
||||||
QString ExportPreSpan;
|
QString ExportPreSpan;
|
||||||
QString ExportPostSpan;
|
QString ExportPostSpan;
|
||||||
|
@ -1230,16 +1230,16 @@ void ProfileInterface::exportSelected()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool itemSelected = false;
|
bool itemSelected = false;
|
||||||
QString selectedItem = inputDialog.getItem(this, tr("Export selected..."), tr("%1Export Snapmatic pictures%2<br><br>JPG pictures make it possible to open the picture with a Image Viewer<br>GTA Snapmatic make it possible to import the picture into the game<br><br>Export as:").arg(ExportPreSpan, ExportPostSpan), inputDialogItems, 0, false, &itemSelected, inputDialog.windowFlags()^Qt::WindowContextHelpButtonHint);
|
QString selectedItem = inputDialog.getItem(this, tr("Export selected..."), tr("%1Export GTA V Snapmatic and RDR 2 Photo%2<br><br>JPEG pictures can be open by your operating system and various software, but will lose metadata saved from the game<br>GTA V Snapmatic and RDR 2 Photo keeps all metadata, but the software compatibility is limited<br><br>Export as:").arg(ExportPreSpan, ExportPostSpan), inputDialogItems, 0, false, &itemSelected, inputDialog.windowFlags());
|
||||||
if (itemSelected) {
|
if (itemSelected) {
|
||||||
if (selectedItem == tr("JPG pictures and GTA Snapmatic")) {
|
if (selectedItem == tr("JPEG pictures, GTA V Snapmatic and RDR 2 Photo")) {
|
||||||
pictureExportEnabled = true;
|
pictureExportEnabled = true;
|
||||||
pictureCopyEnabled = true;
|
pictureCopyEnabled = true;
|
||||||
}
|
}
|
||||||
else if (selectedItem == tr("JPG pictures only")) {
|
else if (selectedItem == tr("JPEG pictures")) {
|
||||||
pictureExportEnabled = true;
|
pictureExportEnabled = true;
|
||||||
}
|
}
|
||||||
else if (selectedItem == tr("GTA Snapmatic only")) {
|
else if (selectedItem == tr("GTA V Snapmatic and RDR 2 Photo")) {
|
||||||
pictureCopyEnabled = true;
|
pictureCopyEnabled = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -1278,17 +1278,17 @@ void ProfileInterface::exportSelected()
|
||||||
QList<QProgressBar*> pbBar = pbDialog.findChildren<QProgressBar*>();
|
QList<QProgressBar*> pbBar = pbDialog.findChildren<QProgressBar*>();
|
||||||
pbBar.at(0)->setTextVisible(false);
|
pbBar.at(0)->setTextVisible(false);
|
||||||
|
|
||||||
ExportThread *exportThread = new ExportThread(widgets, exportDirectory, pictureCopyEnabled, pictureExportEnabled, exportCount);
|
ExportThread exportThread(widgets, exportDirectory, pictureCopyEnabled, pictureExportEnabled, exportCount);
|
||||||
QObject::connect(exportThread, SIGNAL(exportStringUpdate(QString)), &pbDialog, SLOT(setLabelText(QString)));
|
QObject::connect(&exportThread, &ExportThread::exportStringUpdate, &pbDialog, &QProgressDialog::setLabelText);
|
||||||
QObject::connect(exportThread, SIGNAL(exportProgressUpdate(int)), &pbDialog, SLOT(setValue(int)));
|
QObject::connect(&exportThread, &ExportThread::exportProgressUpdate, &pbDialog, &QProgressDialog::setValue);
|
||||||
QObject::connect(exportThread, SIGNAL(exportFinished()), &pbDialog, SLOT(close()));
|
QObject::connect(&exportThread, &ExportThread::exportFinished, &pbDialog, &QProgressDialog::close);
|
||||||
exportThread->start();
|
exportThread.start();
|
||||||
|
|
||||||
pbDialog.setAutoClose(false);
|
pbDialog.setAutoClose(false);
|
||||||
pbDialog.exec();
|
pbDialog.exec();
|
||||||
QStringList getFailedSavegames = exportThread->getFailedSavegames();
|
QStringList getFailedSavegames = exportThread.getFailedSavegames();
|
||||||
QStringList getFailedCopyPictures = exportThread->getFailedCopyPictures();
|
QStringList getFailedCopyPictures = exportThread.getFailedCopyPictures();
|
||||||
QStringList getFailedExportPictures = exportThread->getFailedExportPictures();
|
QStringList getFailedExportPictures = exportThread.getFailedExportPictures();
|
||||||
|
|
||||||
QString errorStr;
|
QString errorStr;
|
||||||
QStringList errorList;
|
QStringList errorList;
|
||||||
|
@ -1299,33 +1299,29 @@ void ProfileInterface::exportSelected()
|
||||||
for (const QString &curErrorStr : qAsConst(errorList)) {
|
for (const QString &curErrorStr : qAsConst(errorList)) {
|
||||||
errorStr += ", " % curErrorStr;
|
errorStr += ", " % curErrorStr;
|
||||||
}
|
}
|
||||||
if (errorStr != "") {
|
if (!errorStr.isEmpty()) {
|
||||||
errorStr.remove(0, 2);
|
errorStr.remove(0, 2);
|
||||||
QMessageBox::warning(this, tr("Export selected..."), tr("Export failed with...\n\n%1").arg(errorStr));
|
QMessageBox::warning(this, tr("Export selected..."), tr("Export failed with...\n\n%1").arg(errorStr));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exportThread->isFinished()) {
|
if (!exportThread.isFinished()) {
|
||||||
delete exportThread;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
QEventLoop threadFinishLoop;
|
QEventLoop threadFinishLoop;
|
||||||
QObject::connect(exportThread, SIGNAL(finished()), &threadFinishLoop, SLOT(quit()));
|
QObject::connect(&exportThread, &ExportThread::finished, &threadFinishLoop, &QEventLoop::quit);
|
||||||
threadFinishLoop.exec();
|
threadFinishLoop.exec();
|
||||||
delete exportThread;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
QMessageBox::information(this, tr("Export selected..."), tr("No Snapmatic pictures or Savegames files are selected"));
|
QMessageBox::information(this, tr("Export selected..."), tr("No Snapmatic, Photo or Savegame files are selected"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProfileInterface::deleteSelectedL(bool isRemoteEmited)
|
void ProfileInterface::deleteSelectedL(bool isRemoteEmited)
|
||||||
{
|
{
|
||||||
if (selectedWidgts != 0) {
|
if (selectedWidgts != 0) {
|
||||||
if (QMessageBox::Yes == QMessageBox::warning(this, tr("Remove selected"), tr("You really want remove the selected Snapmatic picutres and Savegame files?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No)) {
|
if (QMessageBox::Yes == QMessageBox::warning(this, tr("Remove selected"), tr("You really want remove the selected Snapmatic, Photo and Savegame files?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No)) {
|
||||||
for (const QString &widgetStr : qAsConst(widgets)) {
|
for (const QString &widgetStr : qAsConst(widgets)) {
|
||||||
ProfileWidget *widget = widgets.key(widgetStr, nullptr);
|
ProfileWidget *widget = widgets.key(widgetStr, nullptr);
|
||||||
if (widget != nullptr) {
|
if (widget != nullptr) {
|
||||||
|
@ -1348,12 +1344,12 @@ void ProfileInterface::deleteSelectedL(bool isRemoteEmited)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (selectedWidgts != 0) {
|
if (selectedWidgts != 0) {
|
||||||
QMessageBox::warning(this, tr("Remove selected"), tr("Failed to remove all selected Snapmatic pictures and/or Savegame files"));
|
QMessageBox::warning(this, tr("Remove selected"), tr("Failed to remove all selected Snapmatic, Photo and/or Savegame files"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
QMessageBox::information(this, tr("Remove selected"), tr("No Snapmatic pictures or Savegames files are selected"));
|
QMessageBox::information(this, tr("Remove selected"), tr("No Snapmatic, Photo or Savegame files are selected"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1454,7 +1450,7 @@ void ProfileInterface::enableSelected()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (snapmaticWidgets.isEmpty()) {
|
if (snapmaticWidgets.isEmpty()) {
|
||||||
QMessageBox::information(this, QApplication::translate("UserInterface", "Show In-game"), QApplication::translate("ProfileInterface", "No Snapmatic pictures are selected"));
|
QMessageBox::information(this, QApplication::translate("UserInterface", "Show In-game"), QApplication::translate("ProfileInterface", "No Snapmatic or Photos are selected"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QStringList fails;
|
QStringList fails;
|
||||||
|
@ -1484,7 +1480,7 @@ void ProfileInterface::disableSelected()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (snapmaticWidgets.isEmpty()) {
|
if (snapmaticWidgets.isEmpty()) {
|
||||||
QMessageBox::information(this, QApplication::translate("UserInterface", "Hide In-game"), QApplication::translate("ProfileInterface", "No Snapmatic pictures are selected"));
|
QMessageBox::information(this, QApplication::translate("UserInterface", "Hide In-game"), QApplication::translate("ProfileInterface", "No Snapmatic or Photos are selected"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QStringList fails;
|
QStringList fails;
|
||||||
|
@ -1527,11 +1523,18 @@ void ProfileInterface::contextMenuTriggeredPIC(QContextMenuEvent *ev)
|
||||||
editMenu.addAction(PictureDialog::tr("&Edit Properties..."), picWidget, &SnapmaticWidget::editSnapmaticProperties);
|
editMenu.addAction(PictureDialog::tr("&Edit Properties..."), picWidget, &SnapmaticWidget::editSnapmaticProperties);
|
||||||
editMenu.addAction(PictureDialog::tr("&Overwrite Image..."), picWidget, &SnapmaticWidget::editSnapmaticImage);
|
editMenu.addAction(PictureDialog::tr("&Overwrite Image..."), picWidget, &SnapmaticWidget::editSnapmaticImage);
|
||||||
editMenu.addSeparator();
|
editMenu.addSeparator();
|
||||||
editMenu.addAction(PictureDialog::tr("Open &Map Viewer..."), picWidget, &SnapmaticWidget::openMapViewer);
|
QAction *openViewerAction = editMenu.addAction(PictureDialog::tr("Open &Map Viewer..."), picWidget, &SnapmaticWidget::openMapViewer);
|
||||||
|
if (photoFormat != RagePhoto::PhotoFormat::GTA5)
|
||||||
|
openViewerAction->setEnabled(false);
|
||||||
editMenu.addAction(PictureDialog::tr("Open &JSON Editor..."), picWidget, &SnapmaticWidget::editSnapmaticRawJson);
|
editMenu.addAction(PictureDialog::tr("Open &JSON Editor..."), picWidget, &SnapmaticWidget::editSnapmaticRawJson);
|
||||||
QMenu exportMenu(SnapmaticWidget::tr("&Export"), this);
|
QMenu exportMenu(SnapmaticWidget::tr("&Export"), this);
|
||||||
exportMenu.addAction(PictureDialog::tr("Export as &Picture..."), picWidget, &SnapmaticWidget::on_cmdExport_clicked);
|
exportMenu.addAction(PictureDialog::tr("Export as &Picture..."), picWidget, &SnapmaticWidget::on_cmdExport_clicked);
|
||||||
exportMenu.addAction(PictureDialog::tr("Export as &Snapmatic..."), picWidget, &SnapmaticWidget::on_cmdCopy_clicked);
|
if (photoFormat == RagePhoto::PhotoFormat::GTA5)
|
||||||
|
exportMenu.addAction(PictureDialog::tr("Export as >A V Snapmatic..."), picWidget, &SnapmaticWidget::on_cmdCopy_clicked);
|
||||||
|
else if (photoFormat == RagePhoto::PhotoFormat::RDR2)
|
||||||
|
exportMenu.addAction(PictureDialog::tr("Export as &RDR 2 Photo..."), picWidget, &SnapmaticWidget::on_cmdCopy_clicked);
|
||||||
|
else
|
||||||
|
exportMenu.addAction(PictureDialog::tr("Export as &RAGE Photo..."), picWidget, &SnapmaticWidget::on_cmdCopy_clicked);
|
||||||
contextMenu.addAction(SnapmaticWidget::tr("&View"), picWidget, &SnapmaticWidget::on_cmdView_clicked);
|
contextMenu.addAction(SnapmaticWidget::tr("&View"), picWidget, &SnapmaticWidget::on_cmdView_clicked);
|
||||||
contextMenu.addMenu(&editMenu);
|
contextMenu.addMenu(&editMenu);
|
||||||
contextMenu.addMenu(&exportMenu);
|
contextMenu.addMenu(&exportMenu);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* gta5view Grand Theft Auto V Profile Viewer
|
* gta5view Grand Theft Auto V Profile Viewer
|
||||||
* Copyright (C) 2016-2021 Syping
|
* Copyright (C) 2016-2023 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
|
||||||
|
@ -106,7 +106,7 @@ private:
|
||||||
ProfileWidget *previousWidget;
|
ProfileWidget *previousWidget;
|
||||||
QList<SavegameData*> savegames;
|
QList<SavegameData*> savegames;
|
||||||
QList<SnapmaticPicture*> pictures;
|
QList<SnapmaticPicture*> pictures;
|
||||||
QMap<ProfileWidget*,QString> widgets;
|
QHash<ProfileWidget*,QString> widgets;
|
||||||
QFileSystemWatcher fileSystemWatcher;
|
QFileSystemWatcher fileSystemWatcher;
|
||||||
QVector<QString> savegameFiles;
|
QVector<QString> savegameFiles;
|
||||||
QVector<QString> snapmaticPics;
|
QVector<QString> snapmaticPics;
|
||||||
|
|
|
@ -96,28 +96,20 @@ void SavegameWidget::renderString(const QString &savegameString, const QString &
|
||||||
QString savegameName = tr("WRONG FORMAT");
|
QString savegameName = tr("WRONG FORMAT");
|
||||||
QString savegameDate = tr("WRONG FORMAT");
|
QString savegameDate = tr("WRONG FORMAT");
|
||||||
QStringList savegameNDL = QString(savegameString).split(" - ");
|
QStringList savegameNDL = QString(savegameString).split(" - ");
|
||||||
if (savegameNDL.length() >= 2)
|
if (savegameNDL.length() >= 2) {
|
||||||
{
|
|
||||||
savegameDate = savegameNDL.at(savegameNDL.length() - 1);
|
savegameDate = savegameNDL.at(savegameNDL.length() - 1);
|
||||||
savegameName = QString(savegameString).remove(savegameString.length() - savegameDate.length() - 3, savegameDate.length() + 3);
|
savegameName = QString(savegameString).remove(savegameString.length() - savegameDate.length() - 3, savegameDate.length() + 3);
|
||||||
}
|
}
|
||||||
int savegameNumber = QString(fileName).remove(0, 5).toInt(&validNumber) + 1;
|
int savegameNumber = QString(fileName).remove(0, 5).toInt(&validNumber) + 1;
|
||||||
if (validNumber)
|
if (validNumber) {
|
||||||
{
|
|
||||||
if (savegameNumber == 16)
|
if (savegameNumber == 16)
|
||||||
{
|
|
||||||
ui->labSavegameStr->setText(labelAutosaveStr.arg(savegameDate, savegameName));
|
ui->labSavegameStr->setText(labelAutosaveStr.arg(savegameDate, savegameName));
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
ui->labSavegameStr->setText(labelSaveStr.arg(savegameDate, savegameName, QString::number(savegameNumber)));
|
ui->labSavegameStr->setText(labelSaveStr.arg(savegameDate, savegameName, QString::number(savegameNumber)));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
ui->labSavegameStr->setText(labelSaveStr.arg(savegameDate, savegameName, tr("UNKNOWN")));
|
ui->labSavegameStr->setText(labelSaveStr.arg(savegameDate, savegameName, tr("UNKNOWN")));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void SavegameWidget::retranslate()
|
void SavegameWidget::retranslate()
|
||||||
{
|
{
|
||||||
|
@ -136,18 +128,15 @@ void SavegameWidget::on_cmdCopy_clicked()
|
||||||
void SavegameWidget::on_cmdDelete_clicked()
|
void SavegameWidget::on_cmdDelete_clicked()
|
||||||
{
|
{
|
||||||
int uchoice = QMessageBox::question(this, tr("Delete Savegame"), tr("Are you sure to delete %1 from your savegames?").arg("\""+sgdStr+"\""), QMessageBox::No | QMessageBox::Yes, QMessageBox::No);
|
int uchoice = QMessageBox::question(this, tr("Delete Savegame"), tr("Are you sure to delete %1 from your savegames?").arg("\""+sgdStr+"\""), QMessageBox::No | QMessageBox::Yes, QMessageBox::No);
|
||||||
if (uchoice == QMessageBox::Yes)
|
if (uchoice == QMessageBox::Yes) {
|
||||||
{
|
if (!QFile::exists(sgdPath)) {
|
||||||
if (!QFile::exists(sgdPath))
|
|
||||||
{
|
|
||||||
emit savegameDeleted();
|
emit savegameDeleted();
|
||||||
#ifdef GTA5SYNC_TELEMETRY
|
#ifdef GTA5SYNC_TELEMETRY
|
||||||
QSettings telemetrySettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
QSettings telemetrySettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
||||||
telemetrySettings.beginGroup("Telemetry");
|
telemetrySettings.beginGroup("Telemetry");
|
||||||
bool pushUsageData = telemetrySettings.value("PushUsageData", false).toBool();
|
bool pushUsageData = telemetrySettings.value("PushUsageData", false).toBool();
|
||||||
telemetrySettings.endGroup();
|
telemetrySettings.endGroup();
|
||||||
if (pushUsageData && Telemetry->canPush())
|
if (pushUsageData && Telemetry->canPush()) {
|
||||||
{
|
|
||||||
QJsonDocument jsonDocument;
|
QJsonDocument jsonDocument;
|
||||||
QJsonObject jsonObject;
|
QJsonObject jsonObject;
|
||||||
jsonObject["Type"] = "DeleteSuccess";
|
jsonObject["Type"] = "DeleteSuccess";
|
||||||
|
@ -162,15 +151,13 @@ void SavegameWidget::on_cmdDelete_clicked()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (QFile::remove(sgdPath))
|
else if (QFile::remove(sgdPath)) {
|
||||||
{
|
|
||||||
#ifdef GTA5SYNC_TELEMETRY
|
#ifdef GTA5SYNC_TELEMETRY
|
||||||
QSettings telemetrySettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
QSettings telemetrySettings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
|
||||||
telemetrySettings.beginGroup("Telemetry");
|
telemetrySettings.beginGroup("Telemetry");
|
||||||
bool pushUsageData = telemetrySettings.value("PushUsageData", false).toBool();
|
bool pushUsageData = telemetrySettings.value("PushUsageData", false).toBool();
|
||||||
telemetrySettings.endGroup();
|
telemetrySettings.endGroup();
|
||||||
if (pushUsageData && Telemetry->canPush())
|
if (pushUsageData && Telemetry->canPush()) {
|
||||||
{
|
|
||||||
QJsonDocument jsonDocument;
|
QJsonDocument jsonDocument;
|
||||||
QJsonObject jsonObject;
|
QJsonObject jsonObject;
|
||||||
jsonObject["Type"] = "DeleteSuccess";
|
jsonObject["Type"] = "DeleteSuccess";
|
||||||
|
@ -187,25 +174,17 @@ void SavegameWidget::on_cmdDelete_clicked()
|
||||||
emit savegameDeleted();
|
emit savegameDeleted();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
QMessageBox::warning(this, tr("Delete Savegame"), tr("Failed at deleting %1 from your savegames").arg("\""+sgdStr+"\""));
|
QMessageBox::warning(this, tr("Delete Savegame"), tr("Failed at deleting %1 from your savegames").arg("\""+sgdStr+"\""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void SavegameWidget::on_cmdView_clicked()
|
void SavegameWidget::on_cmdView_clicked()
|
||||||
{
|
{
|
||||||
SavegameDialog *savegameDialog = new SavegameDialog(this);
|
SavegameDialog savegameDialog(this);
|
||||||
savegameDialog->setSavegameData(sgdata, sgdPath, true);
|
savegameDialog.setSavegameData(sgdata, sgdPath, true);
|
||||||
savegameDialog->setModal(true);
|
savegameDialog.setModal(true);
|
||||||
#ifdef Q_OS_ANDROID
|
savegameDialog.show();
|
||||||
// Android ...
|
savegameDialog.exec();
|
||||||
savegameDialog->showMaximized();
|
|
||||||
#else
|
|
||||||
savegameDialog->show();
|
|
||||||
#endif
|
|
||||||
savegameDialog->exec();
|
|
||||||
delete savegameDialog;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SavegameWidget::mousePressEvent(QMouseEvent *ev)
|
void SavegameWidget::mousePressEvent(QMouseEvent *ev)
|
||||||
|
@ -216,33 +195,22 @@ void SavegameWidget::mousePressEvent(QMouseEvent *ev)
|
||||||
void SavegameWidget::mouseReleaseEvent(QMouseEvent *ev)
|
void SavegameWidget::mouseReleaseEvent(QMouseEvent *ev)
|
||||||
{
|
{
|
||||||
ProfileWidget::mouseReleaseEvent(ev);
|
ProfileWidget::mouseReleaseEvent(ev);
|
||||||
if (ui->cbSelected->isVisible())
|
if (ui->cbSelected->isVisible()) {
|
||||||
{
|
|
||||||
if (rect().contains(ev->pos()) && ev->button() == Qt::LeftButton)
|
if (rect().contains(ev->pos()) && ev->button() == Qt::LeftButton)
|
||||||
{
|
|
||||||
ui->cbSelected->setChecked(!ui->cbSelected->isChecked());
|
ui->cbSelected->setChecked(!ui->cbSelected->isChecked());
|
||||||
}
|
}
|
||||||
}
|
else {
|
||||||
else
|
|
||||||
{
|
|
||||||
const int contentMode = getContentMode();
|
const int contentMode = getContentMode();
|
||||||
if ((contentMode == 0 || contentMode == 10 || contentMode == 20) && rect().contains(ev->pos()) && ev->button() == Qt::LeftButton)
|
if ((contentMode == 0 || contentMode == 10 || contentMode == 20) && rect().contains(ev->pos()) && ev->button() == Qt::LeftButton) {
|
||||||
{
|
|
||||||
if (ev->modifiers().testFlag(Qt::ShiftModifier))
|
if (ev->modifiers().testFlag(Qt::ShiftModifier))
|
||||||
{
|
|
||||||
ui->cbSelected->setChecked(!ui->cbSelected->isChecked());
|
ui->cbSelected->setChecked(!ui->cbSelected->isChecked());
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
on_cmdView_clicked();
|
on_cmdView_clicked();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else if (!ui->cbSelected->isVisible() && (contentMode == 1 || contentMode == 11 || contentMode == 21) && ev->button() == Qt::LeftButton && ev->modifiers().testFlag(Qt::ShiftModifier))
|
else if (!ui->cbSelected->isVisible() && (contentMode == 1 || contentMode == 11 || contentMode == 21) && ev->button() == Qt::LeftButton && ev->modifiers().testFlag(Qt::ShiftModifier))
|
||||||
{
|
|
||||||
ui->cbSelected->setChecked(!ui->cbSelected->isChecked());
|
ui->cbSelected->setChecked(!ui->cbSelected->isChecked());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void SavegameWidget::mouseDoubleClickEvent(QMouseEvent *ev)
|
void SavegameWidget::mouseDoubleClickEvent(QMouseEvent *ev)
|
||||||
{
|
{
|
||||||
|
@ -250,10 +218,8 @@ void SavegameWidget::mouseDoubleClickEvent(QMouseEvent *ev)
|
||||||
|
|
||||||
const int contentMode = getContentMode();
|
const int contentMode = getContentMode();
|
||||||
if (!ui->cbSelected->isVisible() && (contentMode == 1 || contentMode == 11 || contentMode == 21) && ev->button() == Qt::LeftButton)
|
if (!ui->cbSelected->isVisible() && (contentMode == 1 || contentMode == 11 || contentMode == 21) && ev->button() == Qt::LeftButton)
|
||||||
{
|
|
||||||
on_cmdView_clicked();
|
on_cmdView_clicked();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void SavegameWidget::setSelected(bool isSelected)
|
void SavegameWidget::setSelected(bool isSelected)
|
||||||
{
|
{
|
||||||
|
@ -273,14 +239,10 @@ void SavegameWidget::contextMenuEvent(QContextMenuEvent *ev)
|
||||||
void SavegameWidget::on_cbSelected_stateChanged(int arg1)
|
void SavegameWidget::on_cbSelected_stateChanged(int arg1)
|
||||||
{
|
{
|
||||||
if (arg1 == Qt::Checked)
|
if (arg1 == Qt::Checked)
|
||||||
{
|
|
||||||
emit widgetSelected();
|
emit widgetSelected();
|
||||||
}
|
|
||||||
else if (arg1 == Qt::Unchecked)
|
else if (arg1 == Qt::Unchecked)
|
||||||
{
|
|
||||||
emit widgetDeselected();
|
emit widgetDeselected();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
bool SavegameWidget::isSelected()
|
bool SavegameWidget::isSelected()
|
||||||
{
|
{
|
||||||
|
@ -309,5 +271,5 @@ SavegameData* SavegameWidget::getSavegame()
|
||||||
|
|
||||||
QString SavegameWidget::getWidgetType()
|
QString SavegameWidget::getWidgetType()
|
||||||
{
|
{
|
||||||
return "SavegameWidget";
|
return QStringLiteral("SavegameWidget");
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,8 +73,8 @@ SnapmaticWidget::~SnapmaticWidget()
|
||||||
void SnapmaticWidget::setSnapmaticPicture(SnapmaticPicture *picture)
|
void SnapmaticWidget::setSnapmaticPicture(SnapmaticPicture *picture)
|
||||||
{
|
{
|
||||||
smpic = picture;
|
smpic = picture;
|
||||||
QObject::connect(picture, SIGNAL(updated()), this, SLOT(snapmaticUpdated()));
|
QObject::connect(picture, &SnapmaticPicture::updated, this, &SnapmaticWidget::snapmaticUpdated);
|
||||||
QObject::connect(picture, SIGNAL(customSignal(QString)), this, SLOT(customSignal(QString)));
|
QObject::connect(picture, &SnapmaticPicture::customSignal, this, &SnapmaticWidget::customSignal);
|
||||||
|
|
||||||
const qreal screenRatio = AppEnv::screenRatio();
|
const qreal screenRatio = AppEnv::screenRatio();
|
||||||
const qreal screenRatioPR = AppEnv::screenRatioPR();
|
const qreal screenRatioPR = AppEnv::screenRatioPR();
|
||||||
|
@ -116,7 +116,7 @@ void SnapmaticWidget::snapmaticUpdated()
|
||||||
|
|
||||||
void SnapmaticWidget::customSignal(QString signal)
|
void SnapmaticWidget::customSignal(QString signal)
|
||||||
{
|
{
|
||||||
if (signal == "PictureUpdated") {
|
if (signal == QStringLiteral("PictureUpdated")) {
|
||||||
QPixmap SnapmaticPixmap = QPixmap::fromImage(smpic->getImage().scaled(ui->labPicture->width(), ui->labPicture->height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation), Qt::AutoColor);
|
QPixmap SnapmaticPixmap = QPixmap::fromImage(smpic->getImage().scaled(ui->labPicture->width(), ui->labPicture->height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation), Qt::AutoColor);
|
||||||
ui->labPicture->setPixmap(SnapmaticPixmap);
|
ui->labPicture->setPixmap(SnapmaticPixmap);
|
||||||
}
|
}
|
||||||
|
@ -135,33 +135,28 @@ void SnapmaticWidget::on_cmdView_clicked()
|
||||||
bool navigationBar = settings.value("NavigationBar", true).toBool();
|
bool navigationBar = settings.value("NavigationBar", true).toBool();
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
PictureDialog *picDialog = new PictureDialog(profileDB, crewDB, profileName, this);
|
PictureDialog picDialog(profileDB, crewDB, profileName, this);
|
||||||
picDialog->setSnapmaticPicture(smpic, true);
|
picDialog.setSnapmaticPicture(smpic, true);
|
||||||
picDialog->setModal(true);
|
picDialog.setModal(true);
|
||||||
|
|
||||||
// be ready for crewName and playerName updated
|
// be ready for crewName and playerName updated
|
||||||
QObject::connect(threadDB, SIGNAL(crewNameUpdated()), picDialog, SLOT(crewNameUpdated()));
|
QObject::connect(threadDB, &DatabaseThread::crewNameUpdated, &picDialog, &PictureDialog::crewNameUpdated);
|
||||||
QObject::connect(threadDB, SIGNAL(playerNameUpdated()), picDialog, SLOT(playerNameUpdated()));
|
QObject::connect(threadDB, &DatabaseThread::playerNameUpdated, &picDialog, &PictureDialog::playerNameUpdated);
|
||||||
QObject::connect(picDialog, SIGNAL(nextPictureRequested()), this, SLOT(dialogNextPictureRequested()));
|
QObject::connect(&picDialog, &PictureDialog::nextPictureRequested, this, &SnapmaticWidget::dialogNextPictureRequested);
|
||||||
QObject::connect(picDialog, SIGNAL(previousPictureRequested()), this, SLOT(dialogPreviousPictureRequested()));
|
QObject::connect(&picDialog, &PictureDialog::previousPictureRequested, this, &SnapmaticWidget::dialogPreviousPictureRequested);
|
||||||
|
|
||||||
// add previous next buttons
|
// add previous next buttons
|
||||||
if (navigationBar)
|
if (navigationBar)
|
||||||
picDialog->addPreviousNextButtons();
|
picDialog.addPreviousNextButtons();
|
||||||
|
|
||||||
// show picture dialog
|
// show picture dialog
|
||||||
#ifdef Q_OS_ANDROID
|
picDialog.show();
|
||||||
// Android ...
|
if (navigationBar)
|
||||||
picDialog->showMaximized();
|
picDialog.styliseDialog();
|
||||||
#else
|
|
||||||
picDialog->show();
|
picDialog.setMinimumSize(picDialog.size());
|
||||||
if (navigationBar) picDialog->styliseDialog();
|
picDialog.setMaximumSize(picDialog.size());
|
||||||
//picDialog->adaptNewDialogSize();
|
picDialog.exec();
|
||||||
picDialog->setMinimumSize(picDialog->size());
|
|
||||||
picDialog->setMaximumSize(picDialog->size());
|
|
||||||
#endif
|
|
||||||
picDialog->exec();
|
|
||||||
delete picDialog;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SnapmaticWidget::on_cmdCopy_clicked()
|
void SnapmaticWidget::on_cmdCopy_clicked()
|
||||||
|
@ -270,32 +265,28 @@ void SnapmaticWidget::contextMenuEvent(QContextMenuEvent *ev)
|
||||||
|
|
||||||
void SnapmaticWidget::dialogNextPictureRequested()
|
void SnapmaticWidget::dialogNextPictureRequested()
|
||||||
{
|
{
|
||||||
emit nextPictureRequested((QWidget*)sender());
|
emit nextPictureRequested(static_cast<QWidget*>(sender()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SnapmaticWidget::dialogPreviousPictureRequested()
|
void SnapmaticWidget::dialogPreviousPictureRequested()
|
||||||
{
|
{
|
||||||
emit previousPictureRequested((QWidget*)sender());
|
emit previousPictureRequested(static_cast<QWidget*>(sender()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SnapmaticWidget::on_cbSelected_stateChanged(int arg1)
|
void SnapmaticWidget::on_cbSelected_stateChanged(int arg1)
|
||||||
{
|
{
|
||||||
if (arg1 == Qt::Checked) {
|
if (arg1 == Qt::Checked)
|
||||||
emit widgetSelected();
|
emit widgetSelected();
|
||||||
}
|
else if (arg1 == Qt::Unchecked)
|
||||||
else if (arg1 == Qt::Unchecked) {
|
|
||||||
emit widgetDeselected();
|
emit widgetDeselected();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void SnapmaticWidget::adjustTextColor()
|
void SnapmaticWidget::adjustTextColor()
|
||||||
{
|
{
|
||||||
if (isHidden()) {
|
if (isHidden())
|
||||||
ui->labPicStr->setStyleSheet(QString("QLabel{color: rgb(%1, %2, %3);}").arg(QString::number(highlightHiddenColor.red()), QString::number(highlightHiddenColor.green()), QString::number(highlightHiddenColor.blue())));
|
ui->labPicStr->setStyleSheet(QString("QLabel{color: rgb(%1, %2, %3);}").arg(QString::number(highlightHiddenColor.red()), QString::number(highlightHiddenColor.green()), QString::number(highlightHiddenColor.blue())));
|
||||||
}
|
else
|
||||||
else {
|
ui->labPicStr->setStyleSheet(QString());
|
||||||
ui->labPicStr->setStyleSheet("");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SnapmaticWidget::makePictureHidden()
|
bool SnapmaticWidget::makePictureHidden()
|
||||||
|
@ -330,35 +321,33 @@ void SnapmaticWidget::makePictureVisibleSlot()
|
||||||
|
|
||||||
void SnapmaticWidget::editSnapmaticProperties()
|
void SnapmaticWidget::editSnapmaticProperties()
|
||||||
{
|
{
|
||||||
SnapmaticEditor *snapmaticEditor = new SnapmaticEditor(crewDB, profileDB, this);
|
SnapmaticEditor snapmaticEditor(crewDB, profileDB, this);
|
||||||
snapmaticEditor->setSnapmaticPicture(smpic);
|
snapmaticEditor.setSnapmaticPicture(smpic);
|
||||||
snapmaticEditor->setModal(true);
|
snapmaticEditor.setModal(true);
|
||||||
snapmaticEditor->show();
|
snapmaticEditor.show();
|
||||||
snapmaticEditor->exec();
|
snapmaticEditor.exec();
|
||||||
delete snapmaticEditor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SnapmaticWidget::editSnapmaticRawJson()
|
void SnapmaticWidget::editSnapmaticRawJson()
|
||||||
{
|
{
|
||||||
JsonEditorDialog *jsonEditor = new JsonEditorDialog(smpic, this);
|
JsonEditorDialog jsonEditor(smpic, this);
|
||||||
jsonEditor->setModal(true);
|
jsonEditor.setModal(true);
|
||||||
jsonEditor->show();
|
jsonEditor.show();
|
||||||
jsonEditor->exec();
|
jsonEditor.exec();
|
||||||
delete jsonEditor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SnapmaticWidget::editSnapmaticImage()
|
void SnapmaticWidget::editSnapmaticImage()
|
||||||
{
|
{
|
||||||
QImage *currentImage = new QImage(smpic->getImage());
|
QImage *currentImage = new QImage(smpic->getImage());
|
||||||
ImportDialog *importDialog = new ImportDialog(profileName, this);
|
ImportDialog importDialog(profileName, this);
|
||||||
importDialog->setImage(currentImage);
|
importDialog.setImage(currentImage);
|
||||||
importDialog->enableOverwriteMode();
|
importDialog.enableOverwriteMode();
|
||||||
importDialog->setModal(true);
|
importDialog.setModal(true);
|
||||||
importDialog->exec();
|
importDialog.exec();
|
||||||
if (importDialog->isImportAgreed()) {
|
if (importDialog.isImportAgreed()) {
|
||||||
const QSize previousSize = smpic->getPictureResolution();
|
const QSize previousSize = smpic->getPictureResolution();
|
||||||
const QByteArray previousPicture = smpic->getPictureStream();
|
const QByteArray previousPicture = smpic->getPictureStream();
|
||||||
bool success = smpic->setImage(importDialog->image(), importDialog->isUnlimitedBuffer());
|
bool success = smpic->setImage(importDialog.image(), importDialog.isUnlimitedBuffer());
|
||||||
if (success) {
|
if (success) {
|
||||||
QString currentFilePath = smpic->getPictureFilePath();
|
QString currentFilePath = smpic->getPictureFilePath();
|
||||||
QString originalFilePath = smpic->getOriginalPictureFilePath();
|
QString originalFilePath = smpic->getOriginalPictureFilePath();
|
||||||
|
@ -398,22 +387,21 @@ void SnapmaticWidget::editSnapmaticImage()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete importDialog;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SnapmaticWidget::openMapViewer()
|
void SnapmaticWidget::openMapViewer()
|
||||||
{
|
{
|
||||||
SnapmaticPicture *picture = smpic;
|
SnapmaticPicture *picture = smpic;
|
||||||
SnapmaticProperties currentProperties = picture->getSnapmaticProperties();
|
SnapmaticProperties currentProperties = picture->getSnapmaticProperties();
|
||||||
MapLocationDialog *mapLocDialog = new MapLocationDialog(currentProperties.location.x, currentProperties.location.y, this);
|
MapLocationDialog mapLocDialog(currentProperties.location.x, currentProperties.location.y, this);
|
||||||
mapLocDialog->setCayoPerico(currentProperties.location.isCayoPerico);
|
mapLocDialog.setCayoPerico(currentProperties.location.isCayoPerico);
|
||||||
mapLocDialog->setModal(true);
|
mapLocDialog.setModal(true);
|
||||||
mapLocDialog->show();
|
mapLocDialog.show();
|
||||||
mapLocDialog->exec();
|
mapLocDialog.exec();
|
||||||
if (mapLocDialog->propUpdated()) {
|
if (mapLocDialog.propUpdated()) {
|
||||||
// Update Snapmatic Properties
|
// Update Snapmatic Properties
|
||||||
currentProperties.location.x = mapLocDialog->getXpos();
|
currentProperties.location.x = mapLocDialog.getXpos();
|
||||||
currentProperties.location.y = mapLocDialog->getYpos();
|
currentProperties.location.y = mapLocDialog.getYpos();
|
||||||
currentProperties.location.z = 0;
|
currentProperties.location.z = 0;
|
||||||
|
|
||||||
// Update Snapmatic Picture
|
// Update Snapmatic Picture
|
||||||
|
@ -452,7 +440,6 @@ void SnapmaticWidget::openMapViewer()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
delete mapLocDialog;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SnapmaticWidget::isSelected()
|
bool SnapmaticWidget::isSelected()
|
||||||
|
@ -492,5 +479,5 @@ QString SnapmaticWidget::getPicturePath()
|
||||||
|
|
||||||
QString SnapmaticWidget::getWidgetType()
|
QString SnapmaticWidget::getWidgetType()
|
||||||
{
|
{
|
||||||
return "SnapmaticWidget";
|
return QStringLiteral("SnapmaticWidget");
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,8 +83,8 @@ UserInterface::UserInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, D
|
||||||
|
|
||||||
setWindowTitle(defaultWindowTitle.arg(tr("Select Profile")));
|
setWindowTitle(defaultWindowTitle.arg(tr("Select Profile")));
|
||||||
QString appVersion = QApplication::applicationVersion();
|
QString appVersion = QApplication::applicationVersion();
|
||||||
const char* literalBuildType = GTA5SYNC_BUILDTYPE;
|
|
||||||
#ifdef GTA5SYNC_COMMIT
|
#ifdef GTA5SYNC_COMMIT
|
||||||
|
const char* literalBuildType = GTA5SYNC_BUILDTYPE;
|
||||||
if ((strcmp(literalBuildType, REL_BUILDTYPE) != 0) && !appVersion.contains("-"))
|
if ((strcmp(literalBuildType, REL_BUILDTYPE) != 0) && !appVersion.contains("-"))
|
||||||
appVersion = appVersion % "-" % GTA5SYNC_COMMIT;
|
appVersion = appVersion % "-" % GTA5SYNC_COMMIT;
|
||||||
#endif
|
#endif
|
||||||
|
@ -129,7 +129,7 @@ UserInterface::UserInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, D
|
||||||
|
|
||||||
// Set Icon for Exit Menu Item
|
// Set Icon for Exit Menu Item
|
||||||
if (QIcon::hasThemeIcon("application-exit")) {
|
if (QIcon::hasThemeIcon("application-exit")) {
|
||||||
#ifndef Q_OS_MACOS // Setting icon for exit/quit lead to a crash in Mac OS X
|
#ifndef Q_OS_MACOS // Setting icon for exit/quit lead to a crash in macOS
|
||||||
ui->actionExit->setIcon(QIcon::fromTheme("application-exit"));
|
ui->actionExit->setIcon(QIcon::fromTheme("application-exit"));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -846,8 +846,8 @@ void UserInterface::retranslateUi()
|
||||||
ui->actionAbout_gta5sync->setText(tr("&About %1").arg(GTA5SYNC_APPSTR));
|
ui->actionAbout_gta5sync->setText(tr("&About %1").arg(GTA5SYNC_APPSTR));
|
||||||
#endif
|
#endif
|
||||||
QString appVersion = QApplication::applicationVersion();
|
QString appVersion = QApplication::applicationVersion();
|
||||||
const char* literalBuildType = GTA5SYNC_BUILDTYPE;
|
|
||||||
#ifdef GTA5SYNC_COMMIT
|
#ifdef GTA5SYNC_COMMIT
|
||||||
|
const char* literalBuildType = GTA5SYNC_BUILDTYPE;
|
||||||
if ((strcmp(literalBuildType, REL_BUILDTYPE) != 0) && !appVersion.contains("-"))
|
if ((strcmp(literalBuildType, REL_BUILDTYPE) != 0) && !appVersion.contains("-"))
|
||||||
appVersion = appVersion % "-" % GTA5SYNC_COMMIT;
|
appVersion = appVersion % "-" % GTA5SYNC_COMMIT;
|
||||||
#endif
|
#endif
|
||||||
|
|
18
src/main.cpp
18
src/main.cpp
|
@ -228,12 +228,12 @@ int main(int argc, char *argv[])
|
||||||
if (!readOk)
|
if (!readOk)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
QObject::connect(&threadDB, SIGNAL(crewNameFound(int, QString)), &crewDB, SLOT(setCrewName(int, QString)));
|
QObject::connect(&threadDB, &DatabaseThread::crewNameFound, &crewDB, &CrewDatabase::setCrewName);
|
||||||
QObject::connect(&threadDB, SIGNAL(crewNameUpdated()), &picDialog, SLOT(crewNameUpdated()));
|
QObject::connect(&threadDB, &DatabaseThread::crewNameUpdated, &picDialog, &PictureDialog::crewNameUpdated);
|
||||||
QObject::connect(&threadDB, SIGNAL(playerNameFound(int, QString)), &profileDB, SLOT(setPlayerName(int, QString)));
|
QObject::connect(&threadDB, &DatabaseThread::playerNameFound, &profileDB, &ProfileDatabase::setPlayerName);
|
||||||
QObject::connect(&threadDB, SIGNAL(playerNameUpdated()), &picDialog, SLOT(playerNameUpdated()));
|
QObject::connect(&threadDB, &DatabaseThread::playerNameUpdated, &picDialog, &PictureDialog::playerNameUpdated);
|
||||||
QObject::connect(&threadDB, SIGNAL(finished()), &a, SLOT(quit()));
|
QObject::connect(&threadDB, &DatabaseThread::finished, &a, &QApplication::quit);
|
||||||
QObject::connect(&picDialog, SIGNAL(endDatabaseThread()), &threadDB, SLOT(terminateThread()));
|
QObject::connect(&picDialog, &PictureDialog::endDatabaseThread, &threadDB, &DatabaseThread::terminateThread);
|
||||||
threadDB.start();
|
threadDB.start();
|
||||||
|
|
||||||
picDialog.show();
|
picDialog.show();
|
||||||
|
@ -261,9 +261,9 @@ int main(int argc, char *argv[])
|
||||||
ProfileDatabase profileDB;
|
ProfileDatabase profileDB;
|
||||||
DatabaseThread threadDB(&crewDB);
|
DatabaseThread threadDB(&crewDB);
|
||||||
|
|
||||||
QObject::connect(&threadDB, SIGNAL(crewNameFound(int,QString)), &crewDB, SLOT(setCrewName(int, QString)));
|
QObject::connect(&threadDB, &DatabaseThread::crewNameFound, &crewDB, &CrewDatabase::setCrewName);
|
||||||
QObject::connect(&threadDB, SIGNAL(playerNameFound(int, QString)), &profileDB, SLOT(setPlayerName(int, QString)));
|
QObject::connect(&threadDB, &DatabaseThread::playerNameFound, &profileDB, &ProfileDatabase::setPlayerName);
|
||||||
QObject::connect(&threadDB, SIGNAL(finished()), &a, SLOT(quit()));
|
QObject::connect(&threadDB, &DatabaseThread::finished, &a, &QApplication::quit);
|
||||||
threadDB.start();
|
threadDB.start();
|
||||||
|
|
||||||
#ifdef GTA5SYNC_MOTD
|
#ifdef GTA5SYNC_MOTD
|
||||||
|
|
Loading…
Reference in a new issue