added mass tool and improved import

This commit is contained in:
Syping 2017-12-17 13:03:43 +01:00
parent 98b7c766fe
commit 9b6253b848
40 changed files with 19799 additions and 1189 deletions

View file

@ -32,14 +32,14 @@ before_script:
script:
- cd qt5
- qmake -qt=5 GTA5SYNC_PREFIX=/usr QMAKE_CXXFLAGS+=-std=c++11 DEFINES+=GTA5SYNC_BUILDTYPE_DEV "DEFINES+=GTA5SYNC_APPVER=\\\\\\\"$PACKAGE_VERSION-dev6\\\\\\\"" DEFINES+=GTA5SYNC_QCONF ../../gta5view.pro
- qmake -qt=5 GTA5SYNC_PREFIX=/usr QMAKE_CXXFLAGS+=-std=c++11 DEFINES+=GTA5SYNC_BUILDTYPE_DEV "DEFINES+=GTA5SYNC_APPVER=\\\\\\\"$PACKAGE_VERSION-dev7\\\\\\\"" DEFINES+=GTA5SYNC_QCONF ../../gta5view.pro
- make -j 4
- sudo checkinstall -D --default --nodoc --install=no --pkgname=gta5view-qt5 --pkgversion=$PACKAGE_VERSION --pkgrelease=dev6 --pkggroup=utility --maintainer="Syping on Travis \<travisci@syping.de\>" --requires=libqt5core5a,libqt5gui5,libqt5network5,libqt5widgets5,qttranslations5-l10n --conflicts=gta5view,gta5view-qt4 --replaces=gta5view,gta5view-qt4 --pakdir=../../package
- sudo checkinstall -D --default --nodoc --install=no --pkgname=gta5view-qt5 --pkgversion=$PACKAGE_VERSION --pkgrelease=dev7 --pkggroup=utility --maintainer="Syping on Travis \<travisci@syping.de\>" --requires=libqt5core5a,libqt5gui5,libqt5network5,libqt5widgets5,qttranslations5-l10n --conflicts=gta5view,gta5view-qt4 --replaces=gta5view,gta5view-qt4 --pakdir=../../package
- cd ..
- cd qt4
- qmake -qt=4 GTA5SYNC_PREFIX=/usr QMAKE_CXXFLAGS+=-std=c++11 DEFINES+=GTA5SYNC_BUILDTYPE_DEV "DEFINES+=GTA5SYNC_APPVER=\\\\\\\"$PACKAGE_VERSION-dev6\\\\\\\"" DEFINES+=GTA5SYNC_QCONF ../../gta5view.pro
- qmake -qt=4 GTA5SYNC_PREFIX=/usr QMAKE_CXXFLAGS+=-std=c++11 DEFINES+=GTA5SYNC_BUILDTYPE_DEV "DEFINES+=GTA5SYNC_APPVER=\\\\\\\"$PACKAGE_VERSION-dev7\\\\\\\"" DEFINES+=GTA5SYNC_QCONF ../../gta5view.pro
- make -j 4
- sudo checkinstall -D --default --nodoc --install=no --pkgname=gta5view-qt4 --pkgversion=$PACKAGE_VERSION --pkgrelease=dev6 --pkggroup=utility --maintainer="Syping on Travis \<travisci@syping.de\>" --requires=libqtcore4,libqtgui4,libqt4-network,qtcore4-l10n --conflicts=gta5view,gta5view-qt5 --replaces=gta5view,gta5view-qt5 --pakdir=../../package
- sudo checkinstall -D --default --nodoc --install=no --pkgname=gta5view-qt4 --pkgversion=$PACKAGE_VERSION --pkgrelease=dev7 --pkggroup=utility --maintainer="Syping on Travis \<travisci@syping.de\>" --requires=libqtcore4,libqtgui4,libqt4-network,qtcore4-l10n --conflicts=gta5view,gta5view-qt5 --replaces=gta5view,gta5view-qt5 --pakdir=../../package
- cd ..
deploy:

View file

@ -28,10 +28,6 @@ AboutDialog::AboutDialog(QWidget *parent) :
{
// Set Window Flags
setWindowFlags(windowFlags()^Qt::WindowContextHelpButtonHint);
#ifdef Q_OS_LINUX
// for stupid Window Manager (GNOME 3 should feel triggered)
setWindowFlags(windowFlags()^Qt::Dialog^Qt::Window);
#endif
// Build Strings
QString appVersion = qApp->applicationVersion();

185
ImageEditorDialog.cpp Normal file
View file

@ -0,0 +1,185 @@
/*****************************************************************************
* gta5sync GRAND THEFT AUTO V SYNC
* Copyright (C) 2016-2017 Syping
*
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#include "ImageEditorDialog.h"
#include "ui_ImageEditorDialog.h"
#include "ProfileInterface.h"
#include "SidebarGenerator.h"
#include "StandardPaths.h"
#include "ImportDialog.h"
#include "AppEnv.h"
#include "config.h"
#include <QStringBuilder>
#include <QImageReader>
#include <QFileDialog>
#include <QMessageBox>
ImageEditorDialog::ImageEditorDialog(SnapmaticPicture *picture, QString profileName, QWidget *parent) :
QDialog(parent), smpic(picture), profileName(profileName),
ui(new Ui::ImageEditorDialog)
{
// Set Window Flags
setWindowFlags(windowFlags()^Qt::WindowContextHelpButtonHint);
ui->setupUi(this);
ui->cmdClose->setFocus();
// DPI calculation
qreal screenRatio = AppEnv::screenRatio();
snapmaticResolutionLW = 516 * screenRatio; // 430
snapmaticResolutionLH = 288 * screenRatio; // 240
ui->labPicture->setMinimumSize(snapmaticResolutionLW, snapmaticResolutionLH);
ui->labCapacity->setText(tr("Capacity: %1").arg(QString::number(qRound((double)picture->getContentMaxLength() / 1024)) % " KB"));
imageIsChanged = false;
pictureCache = picture->getImage();
ui->labPicture->setPixmap(QPixmap::fromImage(pictureCache).scaled(snapmaticResolutionLW, snapmaticResolutionLH, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
setMaximumSize(sizeHint());
setMinimumSize(sizeHint());
setFixedSize(sizeHint());
}
ImageEditorDialog::~ImageEditorDialog()
{
delete ui;
}
void ImageEditorDialog::on_cmdClose_clicked()
{
close();
}
void ImageEditorDialog::on_cmdReplace_clicked()
{
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
settings.beginGroup("FileDialogs");
bool dontUseNativeDialog = settings.value("DontUseNativeDialog", false).toBool();
settings.beginGroup("ImportReplace");
fileDialogPreOpen: //Work?
QFileDialog fileDialog(this);
fileDialog.setFileMode(QFileDialog::ExistingFile);
fileDialog.setViewMode(QFileDialog::Detail);
fileDialog.setAcceptMode(QFileDialog::AcceptOpen);
fileDialog.setOption(QFileDialog::DontUseNativeDialog, dontUseNativeDialog);
fileDialog.setWindowFlags(fileDialog.windowFlags()^Qt::WindowContextHelpButtonHint);
fileDialog.setWindowTitle(ProfileInterface::tr("Import..."));
fileDialog.setLabelText(QFileDialog::Accept, ProfileInterface::tr("Import"));
// Getting readable Image formats
QString imageFormatsStr = " ";
for (QByteArray imageFormat : QImageReader::supportedImageFormats())
{
imageFormatsStr += QString("*.") % QString::fromUtf8(imageFormat).toLower() % " ";
}
QStringList filters;
filters << ProfileInterface::tr("All image files (%1)").arg(imageFormatsStr.trimmed());
filters << ProfileInterface::tr("All files (**)");
fileDialog.setNameFilters(filters);
QList<QUrl> sidebarUrls = SidebarGenerator::generateSidebarUrls(fileDialog.sidebarUrls());
fileDialog.setSidebarUrls(sidebarUrls);
fileDialog.setDirectory(settings.value(profileName % "+Directory", StandardPaths::documentsLocation()).toString());
fileDialog.restoreGeometry(settings.value(profileName % "+Geometry", "").toByteArray());
if (fileDialog.exec())
{
QStringList selectedFiles = fileDialog.selectedFiles();
if (selectedFiles.length() == 1)
{
QString selectedFile = selectedFiles.at(0);
QString selectedFileName = QFileInfo(selectedFile).fileName();
QFile snapmaticFile(selectedFile);
if (!snapmaticFile.open(QFile::ReadOnly))
{
QMessageBox::warning(this, ProfileInterface::tr("Import"), ProfileInterface::tr("Can't import %1 because file can't be open").arg("\""+selectedFileName+"\""));
goto fileDialogPreOpen;
}
QImage *importImage = new QImage();
QImageReader snapmaticImageReader;
snapmaticImageReader.setDecideFormatFromContent(true);
snapmaticImageReader.setDevice(&snapmaticFile);
if (!snapmaticImageReader.read(importImage))
{
QMessageBox::warning(this, ProfileInterface::tr("Import"), ProfileInterface::tr("Can't import %1 because file can't be parsed properly").arg("\""+selectedFileName+"\""));
delete importImage;
goto fileDialogPreOpen;
}
ImportDialog *importDialog = new ImportDialog(this);
importDialog->setImage(importImage);
importDialog->setModal(true);
importDialog->show();
importDialog->exec();
if (importDialog->isImportAgreed())
{
pictureCache = importDialog->image();
ui->labPicture->setPixmap(QPixmap::fromImage(pictureCache).scaled(snapmaticResolutionLW, snapmaticResolutionLH, Qt::KeepAspectRatio, Qt::SmoothTransformation));
imageIsChanged = true;
}
delete importDialog;
}
}
settings.setValue(profileName % "+Geometry", fileDialog.saveGeometry());
settings.setValue(profileName % "+Directory", fileDialog.directory().absolutePath());
settings.endGroup();
settings.endGroup();
}
void ImageEditorDialog::on_cmdSave_clicked()
{
if (imageIsChanged)
{
const QByteArray previousPicture = smpic->getPictureStream();
bool success = smpic->setImage(pictureCache);
if (success)
{
QString currentFilePath = smpic->getPictureFilePath();
QString originalFilePath = smpic->getOriginalPictureFilePath();
QString backupFileName = originalFilePath % ".bak";
if (!QFile::exists(backupFileName))
{
QFile::copy(currentFilePath, backupFileName);
}
if (!smpic->exportPicture(currentFilePath))
{
smpic->setPictureStream(previousPicture);
QMessageBox::warning(this, tr("Snapmatic Image Editor"), tr("Patching of Snapmatic Image failed because of I/O Error"));
return;
}
smpic->emitCustomSignal("PictureUpdated");
}
else
{
QMessageBox::warning(this, tr("Snapmatic Image Editor"), tr("Patching of Snapmatic Image failed because of Image Error"));
return;
}
}
close();
}
void ImageEditorDialog::on_cmdQuestion_clicked()
{
QMessageBox::information(this, tr("Snapmatic Image Editor"), tr("Every taken Snapmatic have a different Capacity, a Snapmatic with higher Capacity can store a picture with better quality."));
}

53
ImageEditorDialog.h Normal file
View file

@ -0,0 +1,53 @@
/*****************************************************************************
* gta5sync GRAND THEFT AUTO V SYNC
* Copyright (C) 2016-2017 Syping
*
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#ifndef IMAGEEDITORDIALOG_H
#define IMAGEEDITORDIALOG_H
#include "SnapmaticPicture.h"
#include <QDialog>
namespace Ui {
class ImageEditorDialog;
}
class ImageEditorDialog : public QDialog
{
Q_OBJECT
public:
explicit ImageEditorDialog(SnapmaticPicture *picture, QString profileName, QWidget *parent = 0);
~ImageEditorDialog();
private slots:
void on_cmdClose_clicked();
void on_cmdReplace_clicked();
void on_cmdSave_clicked();
void on_cmdQuestion_clicked();
private:
SnapmaticPicture *smpic;
QString profileName;
Ui::ImageEditorDialog *ui;
int snapmaticResolutionLW;
int snapmaticResolutionLH;
bool imageIsChanged;
QImage pictureCache;
};
#endif // IMAGEEDITORDIALOG_H

130
ImageEditorDialog.ui Normal file
View file

@ -0,0 +1,130 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ImageEditorDialog</class>
<widget class="QDialog" name="ImageEditorDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>516</width>
<height>335</height>
</rect>
</property>
<property name="windowTitle">
<string>Overwrite Image...</string>
</property>
<layout class="QVBoxLayout" name="vlInterface">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="labPicture">
<property name="minimumSize">
<size>
<width>516</width>
<height>288</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QFrame" name="buttomFrame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<layout class="QVBoxLayout" name="vlButtons">
<item>
<layout class="QHBoxLayout" name="hlCapacity">
<item>
<widget class="QLabel" name="labCapacity">
<property name="text">
<string>Capacity: %1</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="cmdQuestion">
<property name="text">
<string>?</string>
</property>
</widget>
</item>
<item>
<spacer name="hsCapacity">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="hlButtons">
<item>
<widget class="QPushButton" name="cmdReplace">
<property name="text">
<string>&amp;Import...</string>
</property>
</widget>
</item>
<item>
<spacer name="hsButtons">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="cmdSave">
<property name="text">
<string>&amp;Overwrite</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cmdClose">
<property name="text">
<string>&amp;Close</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View file

@ -18,13 +18,21 @@
#include "ImportDialog.h"
#include "ui_ImportDialog.h"
#include "SidebarGenerator.h"
#include "StandardPaths.h"
#include "AppEnv.h"
#include "config.h"
#include <QStringBuilder>
#include <QImageReader>
#include <QColorDialog>
#include <QFileDialog>
#include <QMessageBox>
#include <QSettings>
#include <QPainter>
#include <QPixmap>
#include <QImage>
#include <QDebug>
#include <QFile>
#include <QRgb>
// IMAGES VALUES
@ -39,11 +47,7 @@ ImportDialog::ImportDialog(QWidget *parent) :
ui(new Ui::ImportDialog)
{
// Set Window Flags
setWindowFlags(windowFlags()^Qt::WindowContextHelpButtonHint^Qt::WindowMinMaxButtonsHint);
#ifdef Q_OS_LINUX
// for stupid Window Manager (GNOME 3 should feel triggered)
setWindowFlags(windowFlags()^Qt::Dialog^Qt::Window);
#endif
setWindowFlags(windowFlags()^Qt::WindowContextHelpButtonHint);
ui->setupUi(this);
importAgreed = false;
@ -62,11 +66,15 @@ ImportDialog::ImportDialog(QWidget *parent) :
ui->cbIgnore->setChecked(false);
ui->labColour->setText(tr("Background Colour: <span style=\"color: %1\">%1</span>").arg(selectedColour.name()));
ui->labBackgroundImage->setText(tr("Background Image:"));
ui->cmdBackgroundWipe->setVisible(false);
// DPI calculation
qreal screenRatio = AppEnv::screenRatio();
snapmaticResolutionLW = 430 * screenRatio;
snapmaticResolutionLH = 240 * screenRatio;
snapmaticResolutionLW = 516 * screenRatio; // 430
snapmaticResolutionLH = 288 * screenRatio; // 240
ui->labPicture->setMinimumSize(snapmaticResolutionLW, snapmaticResolutionLH);
ui->vlButtom->setSpacing(6 * screenRatio);
#ifndef Q_OS_MAC
ui->vlButtom->setContentsMargins(9 * screenRatio, 6 * screenRatio, 9 * screenRatio, 9 * screenRatio);
@ -80,9 +88,10 @@ ImportDialog::ImportDialog(QWidget *parent) :
ui->vlButtom->setContentsMargins(9 * screenRatio, 6 * screenRatio, 9 * screenRatio, 9 * screenRatio);
}
#endif
setMinimumSize(430 * screenRatio, 380 * screenRatio);
setMaximumSize(430 * screenRatio, 380 * screenRatio);
setFixedSize(430 * screenRatio, 380 * screenRatio);
setMaximumSize(sizeHint());
setMinimumSize(sizeHint());
setFixedSize(sizeHint());
}
ImportDialog::~ImportDialog()
@ -97,6 +106,33 @@ void ImportDialog::processImage()
QPixmap snapmaticPixmap(snapmaticResolutionW, snapmaticResolutionH);
snapmaticPixmap.fill(selectedColour);
QPainter snapmaticPainter(&snapmaticPixmap);
if (!backImage.isNull())
{
if (!ui->cbStretch->isChecked())
{
int diffWidth = 0;
int diffHeight = 0;
if (backImage.width() != snapmaticResolutionW)
{
diffWidth = snapmaticResolutionW - backImage.width();
diffWidth = diffWidth / 2;
}
else if (backImage.height() != snapmaticResolutionH)
{
diffHeight = snapmaticResolutionH - backImage.height();
diffHeight = diffHeight / 2;
}
snapmaticPainter.drawImage(0 + diffWidth, 0 + diffHeight, backImage);
}
else
{
snapmaticPainter.drawImage(0, 0, QImage(backImage).scaled(snapmaticResolutionW, snapmaticResolutionH, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
}
if (ui->cbAvatar->isChecked() && ui->cbForceAvatarColour->isChecked())
{
snapmaticPainter.fillRect(snapmaticAvatarPlacementW, snapmaticAvatarPlacementH, snapmaticAvatarResolution, snapmaticAvatarResolution, selectedColour);
}
}
if (insideAvatarZone)
{
// Avatar mode
@ -262,3 +298,95 @@ void ImportDialog::on_cmdColourChange_clicked()
processImage();
}
}
void ImportDialog::on_cmdBackgroundChange_clicked()
{
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
settings.beginGroup("FileDialogs");
bool dontUseNativeDialog = settings.value("DontUseNativeDialog", false).toBool();
settings.beginGroup("ImportBackground");
fileDialogPreOpen:
QFileDialog fileDialog(this);
fileDialog.setFileMode(QFileDialog::ExistingFiles);
fileDialog.setViewMode(QFileDialog::Detail);
fileDialog.setAcceptMode(QFileDialog::AcceptOpen);
fileDialog.setOption(QFileDialog::DontUseNativeDialog, dontUseNativeDialog);
fileDialog.setWindowFlags(fileDialog.windowFlags()^Qt::WindowContextHelpButtonHint);
fileDialog.setWindowTitle(QApplication::translate("ProfileInterface", "Import..."));
fileDialog.setLabelText(QFileDialog::Accept, QApplication::translate("ProfileInterface", "Import"));
// Getting readable Image formats
QString imageFormatsStr = " ";
for (QByteArray imageFormat : QImageReader::supportedImageFormats())
{
imageFormatsStr += QString("*.") % QString::fromUtf8(imageFormat).toLower() % " ";
}
QStringList filters;
filters << QApplication::translate("ProfileInterface", "All image files (%1)").arg(imageFormatsStr.trimmed());
filters << QApplication::translate("ProfileInterface", "All files (**)");
fileDialog.setNameFilters(filters);
QList<QUrl> sidebarUrls = SidebarGenerator::generateSidebarUrls(fileDialog.sidebarUrls());
fileDialog.setSidebarUrls(sidebarUrls);
fileDialog.setDirectory(settings.value("Directory", StandardPaths::documentsLocation()).toString());
fileDialog.restoreGeometry(settings.value("Geometry", "").toByteArray());
if (fileDialog.exec())
{
QStringList selectedFiles = fileDialog.selectedFiles();
if (selectedFiles.length() == 1)
{
QString selectedFile = selectedFiles.at(0);
QString selectedFileName = QFileInfo(selectedFile).fileName();
QFile snapmaticFile(selectedFile);
if (!snapmaticFile.open(QFile::ReadOnly))
{
QMessageBox::warning(this, QApplication::translate("ProfileInterface", "Import"), QApplication::translate("ProfileInterface", "Can't import %1 because file can't be open").arg("\""+selectedFileName+"\""));
goto fileDialogPreOpen;
}
QImage importImage;
QImageReader snapmaticImageReader;
snapmaticImageReader.setDecideFormatFromContent(true);
snapmaticImageReader.setDevice(&snapmaticFile);
if (!snapmaticImageReader.read(&importImage))
{
QMessageBox::warning(this, QApplication::translate("ProfileInterface", "Import"), QApplication::translate("ProfileInterface", "Can't import %1 because file can't be parsed properly").arg("\""+selectedFileName+"\""));
goto fileDialogPreOpen;
}
backImage = importImage.scaled(snapmaticResolutionW, snapmaticResolutionH, Qt::KeepAspectRatio, Qt::SmoothTransformation);
backgroundPath = selectedFile;
ui->labBackgroundImage->setText(tr("Background Image: %1").arg(tr("File", "Background Image: File")));
ui->cmdBackgroundWipe->setVisible(true);
processImage();
}
}
settings.setValue("Geometry", fileDialog.saveGeometry());
settings.setValue("Directory", fileDialog.directory().absolutePath());
settings.endGroup();
settings.endGroup();
}
void ImportDialog::on_cmdBackgroundWipe_clicked()
{
backImage = QImage();
ui->labBackgroundImage->setText(tr("Background Image:"));
ui->cmdBackgroundWipe->setVisible(false);
processImage();
}
void ImportDialog::on_cbStretch_toggled(bool checked)
{
Q_UNUSED(checked)
processImage();
}
void ImportDialog::on_cbForceAvatarColour_toggled(bool checked)
{
Q_UNUSED(checked)
processImage();
}

View file

@ -45,11 +45,17 @@ private slots:
void on_cmdOK_clicked();
void on_labPicture_labelPainted();
void on_cmdColourChange_clicked();
void on_cmdBackgroundChange_clicked();
void on_cmdBackgroundWipe_clicked();
void on_cbStretch_toggled(bool checked);
void on_cbForceAvatarColour_toggled(bool checked);
private:
Ui::ImportDialog *ui;
QImage avatarAreaImage;
QString backgroundPath;
QString imageTitle;
QImage backImage;
QImage workImage;
QImage newImage;
QColor selectedColour;

View file

@ -6,20 +6,14 @@
<rect>
<x>0</x>
<y>0</y>
<width>430</width>
<height>380</height>
<width>516</width>
<height>425</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>430</width>
<height>380</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>430</width>
<height>380</height>
<width>516</width>
<height>425</height>
</size>
</property>
<property name="windowTitle">
@ -45,8 +39,8 @@
<widget class="UiModLabel" name="labPicture">
<property name="minimumSize">
<size>
<width>430</width>
<height>240</height>
<width>516</width>
<height>288</height>
</size>
</property>
<property name="text">
@ -87,40 +81,9 @@
<item>
<widget class="QGroupBox" name="gbSettings">
<property name="title">
<string>Settings</string>
<string>Picture</string>
</property>
<layout class="QVBoxLayout" name="vlSettings">
<item>
<layout class="QHBoxLayout" name="hlColor">
<item>
<widget class="QLabel" name="labColour">
<property name="text">
<string>Background Colour: &lt;span style=&quot;color: %1&quot;&gt;%1&lt;/span&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="cmdColourChange">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item>
<spacer name="hsColourSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="hlCheckboxes">
<item>
@ -155,7 +118,148 @@
</widget>
</item>
<item>
<spacer name="vsDialog">
<widget class="QGroupBox" name="gbBackground">
<property name="title">
<string>Background</string>
</property>
<layout class="QVBoxLayout" name="vlBackground">
<item>
<layout class="QHBoxLayout" name="hlColor">
<item>
<layout class="QHBoxLayout" name="hlColourManage">
<item>
<widget class="QLabel" name="labColour">
<property name="text">
<string>Background Colour: &lt;span style=&quot;color: %1&quot;&gt;%1&lt;/span&gt;</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="hlColourButton">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QToolButton" name="cmdColourChange">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="hsColour">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="hlBackgroundManage">
<item>
<widget class="QLabel" name="labBackgroundImage">
<property name="text">
<string>Background Image:</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="hlBackgroundButton">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QToolButton" name="cmdBackgroundChange">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="cmdBackgroundWipe">
<property name="text">
<string>X</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="hsBackgroundImage">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="hlBackground">
<item>
<widget class="QCheckBox" name="cbForceAvatarColour">
<property name="text">
<string>Force Colour in Avatar Zone</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbStretch">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Ignore Aspect Ratio</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="vsInterface">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>

View file

@ -35,10 +35,6 @@ JsonEditorDialog::JsonEditorDialog(SnapmaticPicture *picture, QWidget *parent) :
{
// Set Window Flags
setWindowFlags(windowFlags()^Qt::WindowContextHelpButtonHint^Qt::WindowMinMaxButtonsHint);
#ifdef Q_OS_LINUX
// for stupid Window Manager (GNOME 3 should feel triggered)
setWindowFlags(windowFlags()^Qt::Dialog^Qt::Window);
#endif
ui->setupUi(this);
ui->cmdClose->setDefault(true);

View file

@ -29,10 +29,6 @@ MapLocationDialog::MapLocationDialog(double x, double y, QWidget *parent) :
{
// Set Window Flags
setWindowFlags(windowFlags()^Qt::WindowContextHelpButtonHint);
#ifdef Q_OS_LINUX
// for stupid Window Manager (GNOME 3 should feel triggered)
setWindowFlags(windowFlags()^Qt::Dialog^Qt::Window);
#endif
ui->setupUi(this);
ui->cmdDone->setVisible(false);

View file

@ -42,10 +42,6 @@ OptionsDialog::OptionsDialog(ProfileDatabase *profileDB, QWidget *parent) :
{
// Set Window Flags
setWindowFlags(windowFlags()^Qt::WindowContextHelpButtonHint);
#ifdef Q_OS_LINUX
// for stupid Window Manager (GNOME 3 should feel triggered)
setWindowFlags(windowFlags()^Qt::Dialog^Qt::Window);
#endif
// Setup User Interface
ui->setupUi(this);
@ -86,9 +82,11 @@ OptionsDialog::OptionsDialog(ProfileDatabase *profileDB, QWidget *parent) :
setupInterfaceSettings();
setupSnapmaticPictureViewer();
#ifndef Q_QS_ANDROID
// DPI calculation
qreal screenRatio = AppEnv::screenRatio();
resize(435 * screenRatio, 405 * screenRatio);
#endif
#ifdef GTA5SYNC_DISABLED
ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tabSync));

View file

@ -22,6 +22,7 @@
#include "ui_PictureDialog.h"
#include "SidebarGenerator.h"
#include "MapLocationDialog.h"
#include "ImageEditorDialog.h"
#include "JsonEditorDialog.h"
#include "SnapmaticEditor.h"
#include "StandardPaths.h"
@ -84,6 +85,14 @@ PictureDialog::PictureDialog(ProfileDatabase *profileDB, CrewDatabase *crewDB, Q
setupPictureDialog();
}
PictureDialog::PictureDialog(ProfileDatabase *profileDB, CrewDatabase *crewDB, QString profileName, QWidget *parent) :
QDialog(parent), profileDB(profileDB), crewDB(crewDB), profileName(profileName),
ui(new Ui::PictureDialog)
{
primaryWindow = false;
setupPictureDialog();
}
PictureDialog::PictureDialog(bool primaryWindow, ProfileDatabase *profileDB, CrewDatabase *crewDB, QWidget *parent) :
QDialog(parent), primaryWindow(primaryWindow), profileDB(profileDB), crewDB(crewDB),
ui(new Ui::PictureDialog)
@ -91,6 +100,13 @@ PictureDialog::PictureDialog(bool primaryWindow, ProfileDatabase *profileDB, Cre
setupPictureDialog();
}
PictureDialog::PictureDialog(bool primaryWindow, ProfileDatabase *profileDB, CrewDatabase *crewDB, QString profileName, QWidget *parent) :
QDialog(parent), primaryWindow(primaryWindow), profileDB(profileDB), crewDB(crewDB), profileName(profileName),
ui(new Ui::PictureDialog)
{
setupPictureDialog();
}
void PictureDialog::setupPictureDialog()
{
// Set Window Flags
@ -137,6 +153,7 @@ void PictureDialog::setupPictureDialog()
manageMenu->addAction(tr("Export as &Snapmatic..."), this, SLOT(copySnapmaticPicture()));
manageMenu->addSeparator();
manageMenu->addAction(tr("&Edit Properties..."), this, SLOT(editSnapmaticProperties()));
manageMenu->addAction(tr("&Overwrite Image..."), this, SLOT(editSnapmaticImage()));
manageMenu->addSeparator();
QAction *openViewerAction = manageMenu->addAction(tr("Open &Map Viewer..."), this, SLOT(openPreviewMap()));
openViewerAction->setShortcut(Qt::Key_M);
@ -583,7 +600,7 @@ void PictureDialog::renderOverlayPicture()
void PictureDialog::setSnapmaticPicture(SnapmaticPicture *picture, bool readOk, bool _indexed, int _index)
{
if (smpic != nullptr) smpic->disconnect(this, SLOT(updated()));
if (smpic != nullptr) smpic->disconnect();
snapmaticPicture = QImage();
indexed = _indexed;
index = _index;
@ -620,6 +637,7 @@ void PictureDialog::setSnapmaticPicture(SnapmaticPicture *picture, bool readOk,
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(customSignal(QString)), this, SLOT(customSignal(QString)));
emit newPictureCommited(snapmaticPicture);
}
@ -808,6 +826,11 @@ void PictureDialog::on_labPicture_mouseDoubleClicked(Qt::MouseButton button)
pictureWidget->move(desktopRect.x(), desktopRect.y());
pictureWidget->resize(desktopRect.width(), desktopRect.height());
#ifdef GTA5SYNC_WIN
#if QT_VERSION >= 0x050200
QtWin::markFullscreenWindow(pictureWidget, true);
#endif
#endif
pictureWidget->showFullScreen();
pictureWidget->setFocus();
pictureWidget->raise();
@ -847,7 +870,11 @@ void PictureDialog::openPreviewMap()
}
mapLocDialog->setWindowIcon(windowIcon());
mapLocDialog->setModal(true);
#ifndef Q_OS_ANDROID
mapLocDialog->show();
#else
mapLocDialog->showMaximized();
#endif
mapLocDialog->exec();
if (mapLocDialog->propUpdated())
{
@ -895,11 +922,38 @@ void PictureDialog::editSnapmaticProperties()
snapmaticEditor->setWindowIcon(windowIcon());
snapmaticEditor->setSnapmaticPicture(picture);
snapmaticEditor->setModal(true);
#ifndef Q_OS_ANDROID
snapmaticEditor->show();
#else
snapmaticEditor->showMaximized();
#endif
snapmaticEditor->exec();
delete snapmaticEditor;
}
void PictureDialog::editSnapmaticImage()
{
SnapmaticPicture *picture = smpic;
ImageEditorDialog *imageEditor;
if (rqFullscreen && fullscreenWidget != nullptr)
{
imageEditor = new ImageEditorDialog(picture, profileName, fullscreenWidget);
}
else
{
imageEditor = new ImageEditorDialog(picture, profileName, this);
}
imageEditor->setWindowIcon(windowIcon());
imageEditor->setModal(true);
#ifndef Q_OS_ANDROID
imageEditor->show();
#else
snapmaticEditor->showMaximized();
#endif
imageEditor->exec();
delete imageEditor;
}
void PictureDialog::editSnapmaticRawJson()
{
SnapmaticPicture *picture = smpic;
@ -914,7 +968,11 @@ void PictureDialog::editSnapmaticRawJson()
}
jsonEditor->setWindowIcon(windowIcon());
jsonEditor->setModal(true);
#ifndef Q_OS_ANDROID
jsonEditor->show();
#else
jsonEditor->showMaximized();
#endif
jsonEditor->exec();
delete jsonEditor;
}
@ -933,3 +991,13 @@ void PictureDialog::updated()
}
ui->labJSON->setText(jsonDrawString.arg(locX, locY, locZ, generatePlayersString(), generateCrewString(), picTitl, picAreaStr, created));
}
void PictureDialog::customSignal(QString signal)
{
SnapmaticPicture *picture = smpic; // used by macro
if (signal == "PictureUpdated")
{
snapmaticPicture = picture->getImage();
renderPicture();
}
}

View file

@ -46,7 +46,9 @@ class PictureDialog : public QDialog
Q_OBJECT
public:
explicit PictureDialog(ProfileDatabase *profileDB, CrewDatabase *crewDB, QWidget *parent = 0);
explicit PictureDialog(ProfileDatabase *profileDB, CrewDatabase *crewDB, QString profileName, QWidget *parent = 0);
explicit PictureDialog(bool primaryWindow, ProfileDatabase *profileDB, CrewDatabase *crewDB, QWidget *parent = 0);
explicit PictureDialog(bool primaryWindow, ProfileDatabase *profileDB, CrewDatabase *crewDB, QString profileName, QWidget *parent = 0);
void setupPictureDialog();
void setSnapmaticPicture(SnapmaticPicture *picture, bool readOk, bool indexed, int index);
void setSnapmaticPicture(SnapmaticPicture *picture, bool readOk, int index);
@ -78,10 +80,12 @@ private slots:
void previousPictureRequestedSlot();
void editSnapmaticProperties();
void editSnapmaticRawJson();
void editSnapmaticImage();
void renderOverlayPicture();
void renderPicture();
void openPreviewMap();
void updated();
void customSignal(QString signal);
signals:
void nextPictureRequested();
@ -110,6 +114,7 @@ private:
bool primaryWindow;
ProfileDatabase *profileDB;
CrewDatabase *crewDB;
QString profileName;
Ui::PictureDialog *ui;
QMap<QString, QString> globalMap;
SnapmaticPicture *smpic;

View file

@ -32,10 +32,8 @@ PlayerListDialog::PlayerListDialog(QStringList players, ProfileDatabase *profile
{
// Set Window Flags
setWindowFlags(windowFlags()^Qt::WindowContextHelpButtonHint);
#ifdef Q_OS_LINUX
// for stupid Window Manager (GNOME 3 should feel triggered)
setWindowFlags(windowFlags()^Qt::Dialog^Qt::Window);
#endif
listUpdated = false;
ui->setupUi(this);
ui->cmdCancel->setDefault(true);
@ -237,5 +235,16 @@ void PlayerListDialog::on_cmdApply_clicked()
players += ui->listSePlayers->item(i)->text().split(" ").at(0);
}
emit playerListUpdated(players);
listUpdated = true;
close();
}
QStringList PlayerListDialog::getPlayerList() const
{
return players;
}
bool PlayerListDialog::isListUpdated()
{
return listUpdated;
}

View file

@ -32,6 +32,8 @@ class PlayerListDialog : public QDialog
public:
explicit PlayerListDialog(QStringList players, ProfileDatabase *profileDB, QWidget *parent = 0);
QStringList getPlayerList() const;
bool isListUpdated();
~PlayerListDialog();
private slots:
@ -45,6 +47,7 @@ private:
QStringList players;
ProfileDatabase *profileDB;
Ui::PlayerListDialog *ui;
bool listUpdated;
void drawSwitchButtons();
void buildInterface();

View file

@ -18,6 +18,7 @@
#include "ProfileInterface.h"
#include "ui_ProfileInterface.h"
#include "PlayerListDialog.h"
#include "SidebarGenerator.h"
#include "SnapmaticWidget.h"
#include "DatabaseThread.h"
@ -187,7 +188,7 @@ void ProfileInterface::pictureFixed_event(SnapmaticPicture *picture)
void ProfileInterface::pictureLoaded(SnapmaticPicture *picture, bool inserted)
{
SnapmaticWidget *picWidget = new SnapmaticWidget(profileDB, crewDB, threadDB, this);
SnapmaticWidget *picWidget = new SnapmaticWidget(profileDB, crewDB, threadDB, profileName, this);
picWidget->setSnapmaticPicture(picture);
picWidget->setContentMode(contentMode);
picWidget->setMouseTracking(true);
@ -502,15 +503,15 @@ fileDialogPreOpen: //Work?
void ProfileInterface::importFilesProgress(QStringList selectedFiles)
{
int maximumId = selectedFiles.length();
int overallId = 1;
int overallId = 0;
QString errorStr;
QStringList failedFiles;
QStringList failed;
// Progress dialog
QProgressDialog pbDialog(this);
pbDialog.setWindowFlags(pbDialog.windowFlags()^Qt::WindowContextHelpButtonHint^Qt::WindowCloseButtonHint);
pbDialog.setWindowTitle(tr("Import..."));
pbDialog.setLabelText(tr("Import file %1 of %2 files").arg(QString::number(overallId), QString::number(maximumId)));
pbDialog.setLabelText(tr("Import file %1 of %2 files").arg(QString::number(1), QString::number(maximumId)));
pbDialog.setRange(1, maximumId);
pbDialog.setValue(1);
pbDialog.setModal(true);
@ -518,6 +519,7 @@ void ProfileInterface::importFilesProgress(QStringList selectedFiles)
pbBtn.at(0)->setDisabled(true);
QList<QProgressBar*> pbBar = pbDialog.findChildren<QProgressBar*>();
pbBar.at(0)->setTextVisible(false);
pbDialog.setAutoClose(false);
pbDialog.show();
// THREADING HERE PLEASE
@ -525,18 +527,18 @@ void ProfileInterface::importFilesProgress(QStringList selectedFiles)
int currentTime = importDateTime.time().toString(importTimeFormat).toInt();
for (QString selectedFile : selectedFiles)
{
overallId++;
pbDialog.setValue(overallId);
pbDialog.setLabelText(tr("Import file %1 of %2 files").arg(QString::number(overallId), QString::number(maximumId)));
importDateTime = QDateTime::currentDateTime();
if (!importFile(selectedFile, importDateTime, &currentTime, false))
{
failedFiles << QFileInfo(selectedFile).fileName();
failed << QFileInfo(selectedFile).fileName();
}
overallId++;
}
pbDialog.close();
for (QString curErrorStr : failedFiles)
for (QString curErrorStr : failed)
{
errorStr += ", " % curErrorStr;
}
@ -685,6 +687,7 @@ bool ProfileInterface::importFile(QString selectedFile, QDateTime importDateTime
QFile snapmaticFile(selectedFile);
if (!snapmaticFile.open(QFile::ReadOnly))
{
QMessageBox::warning(this, tr("Import"), tr("Can't import %1 because file can't be open").arg("\""+selectedFileName+"\""));
delete picture;
return false;
}
@ -695,6 +698,7 @@ bool ProfileInterface::importFile(QString selectedFile, QDateTime importDateTime
if (!snapmaticImageReader.read(importImage))
{
QMessageBox::warning(this, tr("Import"), tr("Can't import %1 because file can't be parsed properly").arg("\""+selectedFileName+"\""));
delete importImage;
delete picture;
return false;
}
@ -913,7 +917,7 @@ void ProfileInterface::exportSelected()
settings.beginGroup("FileDialogs");
//bool dontUseNativeDialog = settings.value("DontUseNativeDialog", false).toBool();
settings.beginGroup("ExportDirectory");
QString exportDirectory = QFileDialog::getExistingDirectory(this, tr("Export selected"), settings.value(profileName, profileFolder).toString());
QString exportDirectory = QFileDialog::getExistingDirectory(this, tr("Export selected..."), settings.value(profileName, profileFolder).toString());
if (exportDirectory != "")
{
settings.setValue(profileName, exportDirectory);
@ -951,7 +955,7 @@ void ProfileInterface::exportSelected()
#endif
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 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);
if (itemSelected)
{
if (selectedItem == tr("JPG pictures and GTA Snapmatic"))
@ -1012,6 +1016,7 @@ void ProfileInterface::exportSelected()
QObject::connect(exportThread, SIGNAL(exportFinished()), &pbDialog, SLOT(close()));
exportThread->start();
pbDialog.setAutoClose(false);
pbDialog.exec();
QStringList getFailedSavegames = exportThread->getFailedSavegames();
QStringList getFailedCopyPictures = exportThread->getFailedCopyPictures();
@ -1208,6 +1213,7 @@ void ProfileInterface::contextMenuTriggeredPIC(QContextMenuEvent *ev)
editMenu.addAction(SnapmaticWidget::tr("Hide &In-game"), picWidget, SLOT(makePictureHiddenSlot()));
}
editMenu.addAction(PictureDialog::tr("&Edit Properties..."), picWidget, SLOT(editSnapmaticProperties()));
editMenu.addAction(PictureDialog::tr("&Overwrite Image..."), picWidget, SLOT(editSnapmaticImage()));
editMenu.addSeparator();
editMenu.addAction(PictureDialog::tr("Open &Map Viewer..."), picWidget, SLOT(openMapViewer()));
editMenu.addAction(PictureDialog::tr("Open &JSON Editor..."), picWidget, SLOT(editSnapmaticRawJson()));
@ -1490,3 +1496,406 @@ bool ProfileInterface::isSupportedImageFile(QString selectedFileName)
}
return false;
}
void ProfileInterface::massTool(MassTool tool)
{
switch(tool)
{
case MassTool::Qualify:
{
QList<SnapmaticWidget*> snapmaticWidgets;
for (ProfileWidget *widget : widgets.keys())
{
if (widget->isSelected())
{
if (widget->getWidgetType() == "SnapmaticWidget")
{
SnapmaticWidget *snapmaticWidget = qobject_cast<SnapmaticWidget*>(widget);
snapmaticWidgets += snapmaticWidget;
}
}
}
if (snapmaticWidgets.isEmpty())
{
QMessageBox::warning(this, tr("Snapmatic Mass Tool"), tr("You don't have any Snapmatics selected!"));
return;
}
// Prepare Progress
int maximumId = snapmaticWidgets.length();
int overallId = 0;
QProgressDialog pbDialog(this);
pbDialog.setWindowFlags(pbDialog.windowFlags()^Qt::WindowContextHelpButtonHint^Qt::WindowCloseButtonHint);
pbDialog.setWindowTitle(tr("Patch selected..."));
pbDialog.setLabelText(tr("Patch file %1 of %2 files").arg(QString::number(1), QString::number(maximumId)));
pbDialog.setRange(1, maximumId);
pbDialog.setValue(1);
pbDialog.setModal(true);
QList<QPushButton*> pbBtn = pbDialog.findChildren<QPushButton*>();
pbBtn.at(0)->setDisabled(true);
QList<QProgressBar*> pbBar = pbDialog.findChildren<QProgressBar*>();
pbBar.at(0)->setTextVisible(false);
pbDialog.setAutoClose(false);
pbDialog.show();
// Begin Progress
QStringList fails;
for (SnapmaticWidget *snapmaticWidget : snapmaticWidgets)
{
// Update Progress
overallId++;
pbDialog.setValue(overallId);
pbDialog.setLabelText(tr("Patch file %1 of %2 files").arg(QString::number(overallId), QString::number(maximumId)));
SnapmaticPicture *picture = snapmaticWidget->getPicture();
SnapmaticProperties snapmaticProperties = picture->getSnapmaticProperties();
snapmaticProperties.isSelfie = true;
snapmaticProperties.isMug = false;
snapmaticProperties.isFromRSEditor = false;
snapmaticProperties.isFromDirector = false;
snapmaticProperties.isMeme = false;
QString currentFilePath = picture->getPictureFilePath();
QString originalFilePath = picture->getOriginalPictureFilePath();
QString backupFileName = originalFilePath % ".bak";
if (!QFile::exists(backupFileName))
{
QFile::copy(currentFilePath, backupFileName);
}
SnapmaticProperties fallbackProperties = picture->getSnapmaticProperties();
picture->setSnapmaticProperties(snapmaticProperties);
if (!picture->exportPicture(currentFilePath))
{
picture->setSnapmaticProperties(fallbackProperties);
fails << QString("%1 [%2]").arg(picture->getPictureTitle(), picture->getPictureString());
}
else
{
picture->emitUpdate();
qApp->processEvents();
}
}
pbDialog.close();
if (!fails.isEmpty())
{
QMessageBox::warning(this, tr("Snapmatic Mass Tool"), tr("%1 failed with...\n\n%2", "Action failed with...").arg(tr("Qualify", "%1 failed with..."), fails.join(", ")));
}
}
break;
case MassTool::Players:
{
QList<SnapmaticWidget*> snapmaticWidgets;
for (ProfileWidget *widget : widgets.keys())
{
if (widget->isSelected())
{
if (widget->getWidgetType() == "SnapmaticWidget")
{
SnapmaticWidget *snapmaticWidget = qobject_cast<SnapmaticWidget*>(widget);
snapmaticWidgets += snapmaticWidget;
}
}
}
if (snapmaticWidgets.isEmpty())
{
QMessageBox::warning(this, tr("Snapmatic Mass Tool"), tr("You don't have any Snapmatics selected!"));
return;
}
PlayerListDialog *playerListDialog = new PlayerListDialog(QStringList(), profileDB, this);
playerListDialog->setModal(true);
playerListDialog->show();
playerListDialog->exec();
if (!playerListDialog->isListUpdated())
{
return;
}
QStringList players = playerListDialog->getPlayerList();
delete playerListDialog;
// Prepare Progress
int maximumId = snapmaticWidgets.length();
int overallId = 0;
QProgressDialog pbDialog(this);
pbDialog.setWindowFlags(pbDialog.windowFlags()^Qt::WindowContextHelpButtonHint^Qt::WindowCloseButtonHint);
pbDialog.setWindowTitle(tr("Patch selected..."));
pbDialog.setLabelText(tr("Patch file %1 of %2 files").arg(QString::number(1), QString::number(maximumId)));
pbDialog.setRange(1, maximumId);
pbDialog.setValue(1);
pbDialog.setModal(true);
QList<QPushButton*> pbBtn = pbDialog.findChildren<QPushButton*>();
pbBtn.at(0)->setDisabled(true);
QList<QProgressBar*> pbBar = pbDialog.findChildren<QProgressBar*>();
pbBar.at(0)->setTextVisible(false);
pbDialog.setAutoClose(false);
pbDialog.show();
// Begin Progress
QStringList fails;
for (SnapmaticWidget *snapmaticWidget : snapmaticWidgets)
{
// Update Progress
overallId++;
pbDialog.setValue(overallId);
pbDialog.setLabelText(tr("Patch file %1 of %2 files").arg(QString::number(overallId), QString::number(maximumId)));
SnapmaticPicture *picture = snapmaticWidget->getPicture();
SnapmaticProperties snapmaticProperties = picture->getSnapmaticProperties();
snapmaticProperties.playersList = players;
QString currentFilePath = picture->getPictureFilePath();
QString originalFilePath = picture->getOriginalPictureFilePath();
QString backupFileName = originalFilePath % ".bak";
if (!QFile::exists(backupFileName))
{
QFile::copy(currentFilePath, backupFileName);
}
SnapmaticProperties fallbackProperties = picture->getSnapmaticProperties();
picture->setSnapmaticProperties(snapmaticProperties);
if (!picture->exportPicture(currentFilePath))
{
picture->setSnapmaticProperties(fallbackProperties);
fails << QString("%1 [%2]").arg(picture->getPictureTitle(), picture->getPictureString());
}
else
{
picture->emitUpdate();
qApp->processEvents();
}
}
pbDialog.close();
if (!fails.isEmpty())
{
QMessageBox::warning(this, tr("Snapmatic Mass Tool"), tr("%1 failed with...\n\n%2", "Action failed with...").arg(tr("Change Players", "%1 failed with..."), fails.join(", ")));
}
}
break;
case MassTool::Crew:
{
QList<SnapmaticWidget*> snapmaticWidgets;
for (ProfileWidget *widget : widgets.keys())
{
if (widget->isSelected())
{
if (widget->getWidgetType() == "SnapmaticWidget")
{
SnapmaticWidget *snapmaticWidget = qobject_cast<SnapmaticWidget*>(widget);
snapmaticWidgets += snapmaticWidget;
}
}
}
if (snapmaticWidgets.isEmpty())
{
QMessageBox::warning(this, tr("Snapmatic Mass Tool"), tr("You don't have any Snapmatics selected!"));
return;
}
int crewID = 0;
{
preSelectionCrewID:
bool ok;
QStringList itemList;
QStringList crewList = crewDB->getCrews();
if (!crewList.contains(QLatin1String("0")))
{
crewList += QLatin1String("0");
}
crewList.sort();
for (QString crew : crewList)
{
itemList += QString("%1 (%2)").arg(crew, crewDB->getCrewName(crew.toInt()));
}
QString newCrew = QInputDialog::getItem(this, QApplication::translate("SnapmaticEditor", "Snapmatic Crew"), QApplication::translate("SnapmaticEditor", "New Snapmatic crew:"), itemList, 0, true, &ok, windowFlags()^Qt::Dialog^Qt::WindowMinMaxButtonsHint);
if (ok && !newCrew.isEmpty())
{
if (newCrew.contains(" ")) newCrew = newCrew.split(" ").at(0);
if (newCrew.length() > 10) return;
for (QChar crewChar : newCrew)
{
if (!crewChar.isNumber())
{
QMessageBox::warning(this, tr("Snapmatic Mass Tool"), tr("Failed to enter a valid Snapmatic Crew ID"));
goto preSelectionCrewID;
}
}
crewID = newCrew.toInt();
}
else
{
return;
}
}
// Prepare Progress
int maximumId = snapmaticWidgets.length();
int overallId = 0;
QProgressDialog pbDialog(this);
pbDialog.setWindowFlags(pbDialog.windowFlags()^Qt::WindowContextHelpButtonHint^Qt::WindowCloseButtonHint);
pbDialog.setWindowTitle(tr("Patch selected..."));
pbDialog.setLabelText(tr("Patch file %1 of %2 files").arg(QString::number(1), QString::number(maximumId)));
pbDialog.setRange(1, maximumId);
pbDialog.setValue(1);
pbDialog.setModal(true);
QList<QPushButton*> pbBtn = pbDialog.findChildren<QPushButton*>();
pbBtn.at(0)->setDisabled(true);
QList<QProgressBar*> pbBar = pbDialog.findChildren<QProgressBar*>();
pbBar.at(0)->setTextVisible(false);
pbDialog.setAutoClose(false);
pbDialog.show();
// Begin Progress
QStringList fails;
for (SnapmaticWidget *snapmaticWidget : snapmaticWidgets)
{
// Update Progress
overallId++;
pbDialog.setValue(overallId);
pbDialog.setLabelText(tr("Patch file %1 of %2 files").arg(QString::number(overallId), QString::number(maximumId)));
SnapmaticPicture *picture = snapmaticWidget->getPicture();
SnapmaticProperties snapmaticProperties = picture->getSnapmaticProperties();
snapmaticProperties.crewID = crewID;
QString currentFilePath = picture->getPictureFilePath();
QString originalFilePath = picture->getOriginalPictureFilePath();
QString backupFileName = originalFilePath % ".bak";
if (!QFile::exists(backupFileName))
{
QFile::copy(currentFilePath, backupFileName);
}
SnapmaticProperties fallbackProperties = picture->getSnapmaticProperties();
picture->setSnapmaticProperties(snapmaticProperties);
if (!picture->exportPicture(currentFilePath))
{
picture->setSnapmaticProperties(fallbackProperties);
fails << QString("%1 [%2]").arg(picture->getPictureTitle(), picture->getPictureString());
}
else
{
picture->emitUpdate();
qApp->processEvents();
}
}
pbDialog.close();
if (!fails.isEmpty())
{
QMessageBox::warning(this, tr("Snapmatic Mass Tool"), tr("%1 failed with...\n\n%2", "Action failed with...").arg(tr("Change Crew", "%1 failed with..."), fails.join(", ")));
}
}
break;
case MassTool::Title:
{
QList<SnapmaticWidget*> snapmaticWidgets;
for (ProfileWidget *widget : widgets.keys())
{
if (widget->isSelected())
{
if (widget->getWidgetType() == "SnapmaticWidget")
{
SnapmaticWidget *snapmaticWidget = qobject_cast<SnapmaticWidget*>(widget);
snapmaticWidgets += snapmaticWidget;
}
}
}
if (snapmaticWidgets.isEmpty())
{
QMessageBox::warning(this, tr("Snapmatic Mass Tool"), tr("You don't have any Snapmatics selected!"));
return;
}
QString snapmaticTitle;
{
preSelectionTitle:
bool ok;
QString newTitle = QInputDialog::getText(this, QApplication::translate("SnapmaticEditor", "Snapmatic Title"), QApplication::translate("SnapmaticEditor", "New Snapmatic title:"), QLineEdit::Normal, snapmaticTitle, &ok, windowFlags()^Qt::Dialog^Qt::WindowMinMaxButtonsHint);
if (ok && !newTitle.isEmpty())
{
if (!SnapmaticPicture::verifyTitle(newTitle))
{
QMessageBox::warning(this, tr("Snapmatic Mass Tool"), tr("Failed to enter a valid Snapmatic title"));
goto preSelectionTitle;
}
snapmaticTitle = newTitle;
}
else
{
return;
}
}
// Prepare Progress
int maximumId = snapmaticWidgets.length();
int overallId = 0;
QProgressDialog pbDialog(this);
pbDialog.setWindowFlags(pbDialog.windowFlags()^Qt::WindowContextHelpButtonHint^Qt::WindowCloseButtonHint);
pbDialog.setWindowTitle(tr("Patch selected..."));
pbDialog.setLabelText(tr("Patch file %1 of %2 files").arg(QString::number(overallId), QString::number(maximumId)));
pbDialog.setRange(1, maximumId);
pbDialog.setValue(1);
pbDialog.setModal(true);
QList<QPushButton*> pbBtn = pbDialog.findChildren<QPushButton*>();
pbBtn.at(0)->setDisabled(true);
QList<QProgressBar*> pbBar = pbDialog.findChildren<QProgressBar*>();
pbBar.at(0)->setTextVisible(false);
pbDialog.setAutoClose(false);
pbDialog.show();
// Begin Progress
QStringList fails;
for (SnapmaticWidget *snapmaticWidget : snapmaticWidgets)
{
// Update Progress
overallId++;
pbDialog.setValue(overallId);
pbDialog.setLabelText(tr("Patch file %1 of %2 files").arg(QString::number(overallId), QString::number(maximumId)));
SnapmaticPicture *picture = snapmaticWidget->getPicture();
QString currentFilePath = picture->getPictureFilePath();
QString originalFilePath = picture->getOriginalPictureFilePath();
QString backupFileName = originalFilePath % ".bak";
if (!QFile::exists(backupFileName))
{
QFile::copy(currentFilePath, backupFileName);
}
QString fallbackTitle = picture->getPictureTitle();
picture->setPictureTitle(snapmaticTitle);
if (!picture->exportPicture(currentFilePath))
{
picture->setPictureTitle(fallbackTitle);
fails << QString("%1 [%2]").arg(picture->getPictureTitle(), picture->getPictureString());
}
else
{
picture->emitUpdate();
qApp->processEvents();
}
}
pbDialog.close();
if (!fails.isEmpty())
{
QMessageBox::warning(this, tr("Snapmatic Mass Tool"), tr("%1 failed with...\n\n%2", "Action failed with...").arg(tr("Change Title", "%1 failed with..."), fails.join(", ")));
}
}
break;
}
}

View file

@ -40,6 +40,8 @@ namespace Ui {
class ProfileInterface;
}
enum class MassTool : int { Qualify = 0, Players = 1, Crew = 2, Title = 3 };
class ProfileInterface : public QWidget
{
Q_OBJECT
@ -48,6 +50,7 @@ public:
void setProfileFolder(QString folder, QString profile);
void settingsApplied(int contentMode, bool languageChanged);
void setupProfileInterface();
void massTool(MassTool tool);
void disableSelected();
void enableSelected();
int selectedWidgets();

View file

@ -3,6 +3,7 @@
#include "SavegameCopy.h"
#include "AppEnv.h"
#include <QMessageBox>
#include <QDebug>
SavegameDialog::SavegameDialog(QWidget *parent) :
QDialog(parent),
@ -10,10 +11,6 @@ SavegameDialog::SavegameDialog(QWidget *parent) :
{
// Set Window Flags
setWindowFlags(windowFlags()^Qt::WindowContextHelpButtonHint);
#ifdef Q_OS_LINUX
// for stupid Window Manager (GNOME 3 should feel triggered)
setWindowFlags(windowFlags()^Qt::Dialog^Qt::Window);
#endif
// Setup User Interface
ui->setupUi(this);
@ -24,9 +21,7 @@ SavegameDialog::SavegameDialog(QWidget *parent) :
ui->cmdClose->setIcon(QIcon::fromTheme("dialog-close"));
}
// DPI calculation
qreal screenRatio = AppEnv::screenRatio();
resize(400 * screenRatio, 105 * screenRatio);
refreshWindowSize();
}
SavegameDialog::~SavegameDialog()
@ -34,6 +29,19 @@ SavegameDialog::~SavegameDialog()
delete ui;
}
void SavegameDialog::refreshWindowSize()
{
// DPI calculation
qreal screenRatio = AppEnv::screenRatio();
int dpiWindowWidth = 400 * screenRatio;
int dpiWindowHeight = 105 * screenRatio;
if (dpiWindowHeight < heightForWidth(dpiWindowWidth))
{
dpiWindowHeight = heightForWidth(dpiWindowWidth);
}
resize(dpiWindowWidth, dpiWindowHeight);
}
void SavegameDialog::setSavegameData(SavegameData *savegame, QString savegamePath, bool readOk)
{
// Showing error if reading error
@ -44,6 +52,7 @@ void SavegameDialog::setSavegameData(SavegameData *savegame, QString savegamePat
}
sgdPath = savegamePath;
ui->labSavegameText->setText(savegameLabStr.arg(savegame->getSavegameStr()));
refreshWindowSize();
}
void SavegameDialog::on_cmdClose_clicked()

View file

@ -19,6 +19,7 @@ public:
private slots:
void on_cmdClose_clicked();
void on_cmdCopy_clicked();
void refreshWindowSize();
private:
Ui::SavegameDialog *ui;

View file

@ -36,10 +36,6 @@ SnapmaticEditor::SnapmaticEditor(CrewDatabase *crewDB, ProfileDatabase *profileD
{
// Set Window Flags
setWindowFlags(windowFlags()^Qt::WindowContextHelpButtonHint);
#ifdef Q_OS_LINUX
// for stupid Window Manager (GNOME 3 should feel triggered)
setWindowFlags(windowFlags()^Qt::Dialog^Qt::Window);
#endif
ui->setupUi(this);
ui->cmdCancel->setDefault(true);
@ -64,9 +60,11 @@ SnapmaticEditor::SnapmaticEditor(CrewDatabase *crewDB, ProfileDatabase *profileD
snapmaticTitle = QString();
smpic = 0;
#ifndef Q_OS_ANDROID
// DPI calculation
qreal screenRatio = AppEnv::screenRatio();
resize(400 * screenRatio, 360 * screenRatio);
#endif
}
SnapmaticEditor::~SnapmaticEditor()
@ -225,9 +223,11 @@ void SnapmaticEditor::setSnapmaticPlayers(const QStringList &players)
{
ui->labPlayers->setText(playersStr.arg(QApplication::translate("PictureDialog", "No Players"), editStr));
}
#ifndef Q_OS_ANDROID
ui->gbValues->resize(ui->gbValues->sizeHint());
ui->frameWidget->resize(ui->frameWidget->sizeHint());
resize(width(), heightForWidth(width()));
#endif
}
void SnapmaticEditor::setSnapmaticTitle(const QString &title)
@ -251,9 +251,11 @@ void SnapmaticEditor::setSnapmaticTitle(const QString &title)
{
ui->labAppropriate->setText(tr("Appropriate: %1").arg(QString("<span style=\"color: red\">%1</a>").arg(tr("No", "No, could lead to issues"))));
}
#ifndef Q_OS_ANDROID
ui->gbValues->resize(ui->gbValues->sizeHint());
ui->frameWidget->resize(ui->frameWidget->sizeHint());
resize(width(), heightForWidth(width()));
#endif
}
void SnapmaticEditor::setSnapmaticCrew(const QString &crew)
@ -261,9 +263,11 @@ void SnapmaticEditor::setSnapmaticCrew(const QString &crew)
QString editStr = QString("<a href=\"g5e://editcrew\" style=\"text-decoration: none;\">%1</a>").arg(tr("Edit"));
QString crewStr = tr("Crew: %1 (%2)").arg(StringParser::escapeString(crew), editStr);
ui->labCrew->setText(crewStr);
#ifndef Q_OS_ANDROID
ui->gbValues->resize(ui->gbValues->sizeHint());
ui->frameWidget->resize(ui->frameWidget->sizeHint());
resize(width(), heightForWidth(width()));
#endif
}
QString SnapmaticEditor::returnCrewName(int crewID_)
@ -355,6 +359,7 @@ void SnapmaticEditor::on_labPlayers_linkActivated(const QString &link)
{
PlayerListDialog *playerListDialog = new PlayerListDialog(playersList, profileDB, this);
connect(playerListDialog, SIGNAL(playerListUpdated(QStringList)), this, SLOT(playerListUpdated(QStringList)));
playerListDialog->setModal(true);
playerListDialog->show();
playerListDialog->exec();
delete playerListDialog;

View file

@ -810,6 +810,9 @@ QImage SnapmaticPicture::getImage(bool fastLoad)
picStream->close();
delete picStream;
rawPicContent.clear();
rawPicContent.squeeze();
if (returnOk)
{
if (!fastLoadU)
@ -835,6 +838,22 @@ QImage SnapmaticPicture::getImage(bool fastLoad)
return QImage();
}
QByteArray SnapmaticPicture::getPictureStream() // Incomplete because it just work in writeEnabled mode
{
QByteArray jpegRawContent;
if (writeEnabled)
{
QBuffer *picStream = new QBuffer(&rawPicContent);
picStream->open(QIODevice::ReadWrite);
if (picStream->seek(jpegStreamEditorBegin))
{
jpegRawContent = picStream->read(jpegPicStreamLength);
}
delete picStream;
}
return jpegRawContent;
}
int SnapmaticPicture::getContentMaxLength()
{
return jpegRawContentSize;
@ -856,6 +875,11 @@ void SnapmaticPicture::emitUpdate()
emit updated();
}
void SnapmaticPicture::emitCustomSignal(const QString &signal)
{
emit customSignal(signal);
}
// JSON part
bool SnapmaticPicture::isJsonOk()
@ -1351,7 +1375,7 @@ bool SnapmaticPicture::isFormatSwitched()
bool SnapmaticPicture::verifyTitle(const QString &title)
{
// VERIFY TITLE FOR BE A VALID SNAPMATIC TITLE
if (title.length() <= titlStreamCharacterMax)
if (title.length() <= titlStreamCharacterMax && title.length() > 0)
{
for (QChar titleChar : title)
{

View file

@ -62,6 +62,7 @@ public:
bool isPicOk(); // Please use isPictureOk instead
void clearCache();
QImage getImage(bool fastLoad = false);
QByteArray getPictureStream();
QString getLastStep(bool readable = true);
QString getPictureStr();
QString getPictureHead();
@ -79,6 +80,7 @@ public:
bool setPictureStream(const QByteArray &streamArray);
void updateStrings();
void emitUpdate();
void emitCustomSignal(const QString &signal);
// FILE MANAGEMENT
bool exportPicture(const QString &fileName, SnapmaticFormat format = SnapmaticFormat::Auto_Format);
@ -170,6 +172,7 @@ private:
static bool verifyTitleChar(const QChar &titleChar);
signals:
void customSignal(QString signal);
void preloaded();
void updated();
void loaded();

View file

@ -18,6 +18,7 @@
#include "SnapmaticWidget.h"
#include "ui_SnapmaticWidget.h"
#include "ImageEditorDialog.h"
#include "MapLocationDialog.h"
#include "JsonEditorDialog.h"
#include "SnapmaticPicture.h"
@ -36,8 +37,8 @@
#include <QMenu>
#include <QFile>
SnapmaticWidget::SnapmaticWidget(ProfileDatabase *profileDB, CrewDatabase *crewDB, DatabaseThread *threadDB, QWidget *parent) :
ProfileWidget(parent), profileDB(profileDB), crewDB(crewDB), threadDB(threadDB),
SnapmaticWidget::SnapmaticWidget(ProfileDatabase *profileDB, CrewDatabase *crewDB, DatabaseThread *threadDB, QString profileName, QWidget *parent) :
ProfileWidget(parent), profileDB(profileDB), crewDB(crewDB), threadDB(threadDB), profileName(profileName),
ui(new Ui::SnapmaticWidget)
{
ui->setupUi(this);
@ -67,6 +68,7 @@ void SnapmaticWidget::setSnapmaticPicture(SnapmaticPicture *picture)
{
smpic = picture;
QObject::connect(picture, SIGNAL(updated()), this, SLOT(snapmaticUpdated()));
QObject::connect(picture, SIGNAL(customSignal(QString)), this, SLOT(customSignal(QString)));
qreal screenRatio = AppEnv::screenRatio();
ui->labPicture->setFixedSize(48 * screenRatio, 27 * screenRatio);
@ -82,13 +84,22 @@ void SnapmaticWidget::setSnapmaticPicture(SnapmaticPicture *picture)
void SnapmaticWidget::snapmaticUpdated()
{
ui->labPicStr->setText(smpic->getPictureStr() % "\n" % smpic->getPictureTitl() % "");
ui->labPicStr->setText(smpic->getPictureStr() % "\n" % smpic->getPictureTitl());
}
void SnapmaticWidget::customSignal(QString signal)
{
if (signal == "PictureUpdated")
{
QPixmap SnapmaticPixmap = QPixmap::fromImage(smpic->getImage().scaled(ui->labPicture->width(), ui->labPicture->height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation), Qt::AutoColor);
ui->labPicture->setPixmap(SnapmaticPixmap);
}
}
void SnapmaticWidget::retranslate()
{
smpic->updateStrings();
ui->labPicStr->setText(smpic->getPictureStr() % "\n" % smpic->getPictureTitl() % "");
ui->labPicStr->setText(smpic->getPictureStr() % "\n" % smpic->getPictureTitl());
}
void SnapmaticWidget::on_cmdView_clicked()
@ -98,7 +109,7 @@ void SnapmaticWidget::on_cmdView_clicked()
bool navigationBar = settings.value("NavigationBar", false).toBool();
settings.endGroup();
PictureDialog *picDialog = new PictureDialog(profileDB, crewDB, this);
PictureDialog *picDialog = new PictureDialog(profileDB, crewDB, profileName, this);
picDialog->setSnapmaticPicture(smpic, true);
picDialog->setModal(true);
@ -301,11 +312,19 @@ void SnapmaticWidget::editSnapmaticRawJson()
delete jsonEditor;
}
void SnapmaticWidget::editSnapmaticImage()
{
ImageEditorDialog *imageEditor = new ImageEditorDialog(smpic, profileName, this);
imageEditor->setModal(true);
imageEditor->show();
imageEditor->exec();
delete imageEditor;
}
void SnapmaticWidget::openMapViewer()
{
SnapmaticPicture *picture = smpic;
MapLocationDialog *mapLocDialog;
mapLocDialog = new MapLocationDialog(picture->getSnapmaticProperties().location.x, picture->getSnapmaticProperties().location.y, this);
MapLocationDialog *mapLocDialog = new MapLocationDialog(picture->getSnapmaticProperties().location.x, picture->getSnapmaticProperties().location.y, this);
mapLocDialog->setModal(true);
mapLocDialog->show();
mapLocDialog->exec();

View file

@ -38,7 +38,7 @@ class SnapmaticWidget : public ProfileWidget
Q_OBJECT
public:
SnapmaticWidget(ProfileDatabase *profileDB, CrewDatabase *crewDB, DatabaseThread *threadDB, QWidget *parent = 0);
SnapmaticWidget(ProfileDatabase *profileDB, CrewDatabase *crewDB, DatabaseThread *threadDB, QString profileName, QWidget *parent = 0);
void setSnapmaticPicture(SnapmaticPicture *picture);
void setSelectionMode(bool selectionMode);
void setSelected(bool isSelected);
@ -69,8 +69,10 @@ private slots:
void makePictureHiddenSlot();
void editSnapmaticProperties();
void editSnapmaticRawJson();
void editSnapmaticImage();
void openMapViewer();
void snapmaticUpdated();
void customSignal(QString signal);
protected:
void mouseDoubleClickEvent(QMouseEvent *ev);
@ -82,6 +84,7 @@ private:
ProfileDatabase *profileDB;
CrewDatabase *crewDB;
DatabaseThread *threadDB;
QString profileName;
Ui::SnapmaticWidget *ui;
SnapmaticPicture *smpic;
QColor highlightHiddenColor;

View file

@ -82,7 +82,9 @@ UserInterface::UserInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, D
// DPI calculation
qreal screenRatio = AppEnv::screenRatio();
#ifndef Q_QS_ANDROID
resize(625 * screenRatio, 500 * screenRatio);
#endif
ui->vlUserInterface->setSpacing(6 * screenRatio);
ui->vlUserInterface->setContentsMargins(9 * screenRatio, 9 * screenRatio, 9 * screenRatio, 9 * screenRatio);
}
@ -560,3 +562,23 @@ void UserInterface::retranslateUi()
this->setWindowTitle(defaultWindowTitle.arg(tr("Select Profile")));
}
}
void UserInterface::on_actionQualify_as_Avatar_triggered()
{
profileUI->massTool(MassTool::Qualify);
}
void UserInterface::on_actionChange_Players_triggered()
{
profileUI->massTool(MassTool::Players);
}
void UserInterface::on_actionSet_Crew_triggered()
{
profileUI->massTool(MassTool::Crew);
}
void UserInterface::on_actionSet_Title_triggered()
{
profileUI->massTool(MassTool::Title);
}

View file

@ -62,6 +62,10 @@ private slots:
void on_actionSelect_GTA_Folder_triggered();
void on_action_Enable_In_game_triggered();
void on_action_Disable_In_game_triggered();
void on_actionQualify_as_Avatar_triggered();
void on_actionChange_Players_triggered();
void on_actionSet_Crew_triggered();
void on_actionSet_Title_triggered();
void settingsApplied(int contentMode, bool languageChanged);
protected:

View file

@ -207,10 +207,20 @@
<addaction name="action_Enable_In_game"/>
<addaction name="action_Disable_In_game"/>
</widget>
<widget class="QMenu" name="menuManage_selection">
<property name="title">
<string>Selection &amp;mass tools</string>
</property>
<addaction name="actionQualify_as_Avatar"/>
<addaction name="actionChange_Players"/>
<addaction name="actionSet_Crew"/>
<addaction name="actionSet_Title"/>
</widget>
<addaction name="action_Import"/>
<addaction name="actionExport_selected"/>
<addaction name="actionDelete_selected"/>
<addaction name="separator"/>
<addaction name="menuManage_selection"/>
<addaction name="menuSelection_visibility"/>
<addaction name="separator"/>
<addaction name="actionSelect_all"/>
@ -226,7 +236,7 @@
<string>&amp;About %1</string>
</property>
<property name="shortcut">
<string>Ctrl+P</string>
<string notr="true">Ctrl+P</string>
</property>
</action>
<action name="actionExit">
@ -237,7 +247,7 @@
<string>Exit</string>
</property>
<property name="shortcut">
<string>Ctrl+Q</string>
<string notr="true">Ctrl+Q</string>
</property>
</action>
<action name="actionSelect_profile">
@ -245,7 +255,7 @@
<string>Close &amp;Profile</string>
</property>
<property name="shortcut">
<string>Ctrl+End</string>
<string notr="true">Ctrl+End</string>
</property>
</action>
<action name="actionOptions">
@ -253,7 +263,7 @@
<string>&amp;Settings</string>
</property>
<property name="shortcut">
<string>Ctrl+S</string>
<string notr="true">Ctrl+S</string>
</property>
</action>
<action name="actionSelect_all">
@ -261,7 +271,7 @@
<string>Select &amp;All</string>
</property>
<property name="shortcut">
<string>Ctrl+A</string>
<string notr="true">Ctrl+A</string>
</property>
</action>
<action name="actionDeselect_all">
@ -269,7 +279,7 @@
<string>&amp;Deselect All</string>
</property>
<property name="shortcut">
<string>Ctrl+D</string>
<string notr="true">Ctrl+D</string>
</property>
</action>
<action name="actionExport_selected">
@ -277,7 +287,7 @@
<string>&amp;Export selected...</string>
</property>
<property name="shortcut">
<string>Ctrl+E</string>
<string notr="true">Ctrl+E</string>
</property>
</action>
<action name="actionDelete_selected">
@ -285,7 +295,7 @@
<string>&amp;Remove selected</string>
</property>
<property name="shortcut">
<string>Ctrl+Del</string>
<string notr="true">Ctrl+Del</string>
</property>
</action>
<action name="action_Import">
@ -293,7 +303,7 @@
<string>&amp;Import files...</string>
</property>
<property name="shortcut">
<string>Ctrl+I</string>
<string notr="true">Ctrl+I</string>
</property>
</action>
<action name="actionOpen_File">
@ -301,7 +311,7 @@
<string>&amp;Open File...</string>
</property>
<property name="shortcut">
<string>Ctrl+O</string>
<string notr="true">Ctrl+O</string>
</property>
</action>
<action name="actionSelect_GTA_Folder">
@ -312,7 +322,7 @@
<string>Select GTA V Folder...</string>
</property>
<property name="shortcut">
<string>Ctrl+G</string>
<string notr="true">Ctrl+G</string>
</property>
</action>
<action name="action_Enable_In_game">
@ -320,7 +330,7 @@
<string>Show In-gam&amp;e</string>
</property>
<property name="shortcut">
<string>Shift+E</string>
<string notr="true">Shift+E</string>
</property>
</action>
<action name="action_Disable_In_game">
@ -328,7 +338,39 @@
<string>Hi&amp;de In-game</string>
</property>
<property name="shortcut">
<string>Shift+D</string>
<string notr="true">Shift+D</string>
</property>
</action>
<action name="actionSet_Title">
<property name="text">
<string>Change &amp;Title...</string>
</property>
<property name="shortcut">
<string notr="true">Shift+T</string>
</property>
</action>
<action name="actionSet_Crew">
<property name="text">
<string>Change &amp;Crew...</string>
</property>
<property name="shortcut">
<string notr="true">Shift+C</string>
</property>
</action>
<action name="actionQualify_as_Avatar">
<property name="text">
<string>&amp;Qualify as Avatar</string>
</property>
<property name="shortcut">
<string notr="true">Shift+Q</string>
</property>
</action>
<action name="actionChange_Players">
<property name="text">
<string>Change &amp;Players...</string>
</property>
<property name="shortcut">
<string notr="true">Shift+P</string>
</property>
</action>
</widget>

View file

@ -50,7 +50,7 @@
#ifndef GTA5SYNC_APPVER
#ifndef GTA5SYNC_DAILYB
#define GTA5SYNC_APPVER "1.5.0-dev6"
#define GTA5SYNC_APPVER "1.5.0-dev7"
#else
#define GTA5SYNC_APPVER GTA5SYNC_DAILYB
#endif

View file

@ -37,6 +37,7 @@ SOURCES += main.cpp \
ExportThread.cpp \
GlobalString.cpp \
IconLoader.cpp \
ImageEditorDialog.cpp \
ImportDialog.cpp \
JsonEditorDialog.cpp \
MapLocationDialog.cpp \
@ -74,6 +75,7 @@ HEADERS += \
ExportThread.h \
GlobalString.h \
IconLoader.h \
ImageEditorDialog.h \
ImportDialog.h \
JsonEditorDialog.h \
MapLocationDialog.h \
@ -105,6 +107,7 @@ HEADERS += \
FORMS += \
AboutDialog.ui \
ExportDialog.ui \
ImageEditorDialog.ui \
ImportDialog.ui \
JsonEditorDialog.ui \
MapLocationDialog.ui \

View file

@ -179,6 +179,9 @@ int main(int argc, char *argv[])
bool readOk = picture.readingPictureFromFile(arg1);
picDialog.setWindowIcon(IconLoader::loadingAppIcon());
picDialog.setSnapmaticPicture(&picture, readOk);
#ifndef Q_OS_LINUX
picDialog.setWindowFlags(picDialog.windowFlags()^Qt::Dialog^Qt::Window);
#endif
int crewID = picture.getSnapmaticProperties().crewID;
if (crewID != 0) { crewDB.addCrew(crewID); }
@ -204,6 +207,7 @@ int main(int argc, char *argv[])
bool readOk = savegame.readingSavegameFromFile(arg1);
savegameDialog.setWindowIcon(IconLoader::loadingAppIcon());
savegameDialog.setSavegameData(&savegame, arg1, readOk);
savegameDialog.setWindowFlags(savegameDialog.windowFlags()^Qt::Dialog^Qt::Window);
if (!readOk) { return 1; }

View file

@ -25,12 +25,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "Syping"
VALUE "FileDescription", "gta5view\0"
VALUE "FileVersion", "1.5.0-dev6\0"
VALUE "FileVersion", "1.5.0-dev7\0"
VALUE "InternalName", "gta5view\0"
VALUE "LegalCopyright", "Copyright © 2016-2017 Syping\0"
VALUE "OriginalFilename", "gta5view.exe\0"
VALUE "ProductName", "gta5view\0"
VALUE "ProductVersion", "1.5.0-dev6\0"
VALUE "ProductVersion", "1.5.0-dev7\0"
END
END
END

Binary file not shown.

File diff suppressed because it is too large Load diff

Binary file not shown.

File diff suppressed because it is too large Load diff

Binary file not shown.

File diff suppressed because it is too large Load diff

Binary file not shown.

File diff suppressed because it is too large Load diff

16450
res/qtbase_en_GB.ts Normal file

File diff suppressed because it is too large Load diff