Open Source Snapmatic and Savegame viewer/editor for GTA V https://gta5view.syping.de/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2383 lines
103 KiB

/*****************************************************************************
* gta5view Grand Theft Auto V Profile Viewer
* Copyright (C) 2016-2021 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 "ProfileInterface.h"
#include "ui_ProfileInterface.h"
#include "PlayerListDialog.h"
#include "SidebarGenerator.h"
#include "SnapmaticWidget.h"
#include "DatabaseThread.h"
#include "SavegameWidget.h"
#include "PictureDialog.h"
#include "PictureExport.h"
#include "StandardPaths.h"
#include "ProfileLoader.h"
#include "ExportThread.h"
#include "ImportDialog.h"
#include "UiModLabel.h"
#include "pcg_basic.h"
#include "wrapper.h"
#include "AppEnv.h"
#include "config.h"
#include <QNetworkAccessManager>
#include <QProgressDialog>
#include <QNetworkRequest>
#include <QStringBuilder>
#include <QNetworkReply>
#include <QImageReader>
#include <QProgressBar>
#include <QInputDialog>
#include <QPushButton>
#include <QSpacerItem>
#include <QMessageBox>
#include <QMouseEvent>
#include <QFileDialog>
#include <QVBoxLayout>
#include <QEventLoop>
#include <QScrollBar>
#include <QClipboard>
#include <QFileInfo>
#include <QPainter>
#include <QAction>
#include <QDebug>
#include <QColor>
#include <QTimer>
4 years ago
#include <QStyle>
#include <QFile>
#include <QUrl>
#include <QDir>
#include <cstdint>
#include <random>
#include <ctime>
#ifdef GTA5SYNC_TELEMETRY
#include "TelemetryClass.h"
#include <QJsonDocument>
#include <QJsonObject>
#endif
#define importTimeFormat "HHmmss"
#define findRetryLimit 500
ProfileInterface::ProfileInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, DatabaseThread *threadDB, QWidget *parent) :
QWidget(parent), profileDB(profileDB), crewDB(crewDB), threadDB(threadDB),
ui(new Ui::ProfileInterface)
{
ui->setupUi(this);
ui->cmdImport->setEnabled(false);
ui->cmdCloseProfile->setEnabled(false);
loadingStr = ui->labProfileLoading->text();
enabledPicStr = tr("Enabled pictures: %1 of %2");
selectedWidgts = 0;
profileFolder = "";
contextMenuOpened = false;
isProfileLoaded = false;
previousWidget = nullptr;
profileLoader = nullptr;
saSpacerItem = nullptr;
updatePalette();
QString appVersion = QApplication::applicationVersion();
const char* literalBuildType = GTA5SYNC_BUILDTYPE;
#ifdef GTA5SYNC_COMMIT
if ((strcmp(literalBuildType, REL_BUILDTYPE) != 0) && !appVersion.contains("-"))
appVersion = appVersion % "-" % GTA5SYNC_COMMIT;
#endif
ui->labVersion->setText(QString("%1 %2").arg(GTA5SYNC_APPSTR, appVersion));
ui->saProfileContent->setFilesDropEnabled(true);
ui->saProfileContent->setImageDropEnabled(true);
4 years ago
// Set Icon for Close Button
if (QIcon::hasThemeIcon("dialog-close")) {
ui->cmdCloseProfile->setIcon(QIcon::fromTheme("dialog-close"));
}
else if (QIcon::hasThemeIcon("gtk-close")) {
4 years ago
ui->cmdCloseProfile->setIcon(QIcon::fromTheme("gtk-close"));
}
// Set Icon for Import Button
if (QIcon::hasThemeIcon("document-import")) {
4 years ago
ui->cmdImport->setIcon(QIcon::fromTheme("document-import"));
}
else if (QIcon::hasThemeIcon("document-open")) {
4 years ago
ui->cmdImport->setIcon(QIcon::fromTheme("document-open"));
}
// DPI calculation
qreal screenRatio = AppEnv::screenRatio();
#ifndef Q_OS_MAC
ui->hlButtons->setSpacing(6 * screenRatio);
ui->hlButtons->setContentsMargins(9 * screenRatio, 9 * screenRatio, 9 * screenRatio, 9 * screenRatio);
#else
if (QApplication::style()->objectName() == "macintosh") {
ui->hlButtons->setSpacing(6 * screenRatio);
ui->hlButtons->setContentsMargins(9 * screenRatio, 15 * screenRatio, 15 * screenRatio, 17 * screenRatio);
}
else {
ui->hlButtons->setSpacing(6 * screenRatio);
ui->hlButtons->setContentsMargins(9 * screenRatio, 9 * screenRatio, 9 * screenRatio, 9 * screenRatio);
}
#endif
// Seed RNG
pcg32_srandom_r(&rng, time(NULL), (intptr_t)&rng);
12 months ago
#if QT_VERSION >= 0x050000
// Register Metatypes
qRegisterMetaType<QVector<QString>>();
12 months ago
#endif
setMouseTracking(true);
installEventFilter(this);
}
ProfileInterface::~ProfileInterface()
{
for (const QString &widgetStr : qAsConst(widgets)) {
ProfileWidget *widget = widgets.key(widgetStr, nullptr);
if (widget != nullptr) {
widget->removeEventFilter(this);
widget->disconnect();
delete widget;
}
}
widgets.clear();
for (SavegameData *savegame : qAsConst(savegames)) {
delete savegame;
}
savegames.clear();
for (SnapmaticPicture *picture : qAsConst(pictures)) {
delete picture;
}
pictures.clear();
delete profileLoader;
delete ui;
}
void ProfileInterface::setProfileFolder(QString folder, QString profile)
{
profileFolder = folder;
profileName = profile;
}
void ProfileInterface::setupProfileInterface()
{
fixedPictures.clear();
ui->labProfileLoading->setText(tr("Loading..."));
profileLoader = new ProfileLoader(profileFolder, crewDB);
12 months ago
#if QT_VERSION >= 0x050000
QObject::connect(profileLoader, SIGNAL(directoryScanned(QVector<QString>,QVector<QString>)), this, SLOT(directoryScanned(QVector<QString>,QVector<QString>)));
12 months ago
#endif
QObject::connect(profileLoader, SIGNAL(savegameLoaded(SavegameData*, QString)), this, SLOT(savegameLoaded_event(SavegameData*, QString)));
QObject::connect(profileLoader, SIGNAL(pictureLoaded(SnapmaticPicture*)), this, SLOT(pictureLoaded_event(SnapmaticPicture*)));
QObject::connect(profileLoader, SIGNAL(pictureFixed(SnapmaticPicture*)), this, SLOT(pictureFixed_event(SnapmaticPicture*)));
QObject::connect(profileLoader, SIGNAL(loadingProgress(int,int)), this, SLOT(loadingProgress(int,int)));
QObject::connect(profileLoader, SIGNAL(finished()), this, SLOT(profileLoaded_p()));
profileLoader->start();
}
void ProfileInterface::savegameLoaded_event(SavegameData *savegame, QString savegamePath)
{
savegameLoaded(savegame, savegamePath, false);
}
void ProfileInterface::savegameLoaded(SavegameData *savegame, QString savegamePath, bool inserted)
{
SavegameWidget *sgdWidget = new SavegameWidget(this);
sgdWidget->setSavegameData(savegame, savegamePath);
sgdWidget->setContentMode(contentMode);
sgdWidget->setMouseTracking(true);
sgdWidget->installEventFilter(this);
widgets[sgdWidget] = "SGD" % QFileInfo(savegamePath).fileName();
savegames += savegame;
if (selectedWidgts != 0 || contentMode == 2)
sgdWidget->setSelectionMode(true);
QObject::connect(sgdWidget, SIGNAL(savegameDeleted()), this, SLOT(savegameDeleted_event()));
QObject::connect(sgdWidget, SIGNAL(widgetSelected()), this, SLOT(profileWidgetSelected()));
QObject::connect(sgdWidget, SIGNAL(widgetDeselected()), this, SLOT(profileWidgetDeselected()));
QObject::connect(sgdWidget, SIGNAL(allWidgetsSelected()), this, SLOT(selectAllWidgets()));
QObject::connect(sgdWidget, SIGNAL(allWidgetsDeselected()), this, SLOT(deselectAllWidgets()));
QObject::connect(sgdWidget, SIGNAL(contextMenuTriggered(QContextMenuEvent*)), this, SLOT(contextMenuTriggeredSGD(QContextMenuEvent*)));
if (inserted)
insertSavegameIPI(sgdWidget);
}
void ProfileInterface::pictureLoaded_event(SnapmaticPicture *picture)
{
pictureLoaded(picture, false);
}
void ProfileInterface::pictureFixed_event(SnapmaticPicture *picture)
{
QString fixedPicture = picture->getPictureStr() % " (" % picture->getPictureTitl() % ")";
fixedPictures << fixedPicture;
}
void ProfileInterface::pictureLoaded(SnapmaticPicture *picture, bool inserted)
{
SnapmaticWidget *picWidget = new SnapmaticWidget(profileDB, crewDB, threadDB, profileName, this);
picWidget->setSnapmaticPicture(picture);
picWidget->setContentMode(contentMode);
picWidget->setMouseTracking(true);
picWidget->installEventFilter(this);
widgets[picWidget] = "PIC" % picture->getPictureSortStr();
pictures += picture;
if (selectedWidgts != 0 || contentMode == 2)
picWidget->setSelectionMode(true);
QObject::connect(picWidget, SIGNAL(pictureDeleted()), this, SLOT(pictureDeleted_event()));
QObject::connect(picWidget, SIGNAL(widgetSelected()), this, SLOT(profileWidgetSelected()));
QObject::connect(picWidget, SIGNAL(widgetDeselected()), this, SLOT(profileWidgetDeselected()));
QObject::connect(picWidget, SIGNAL(allWidgetsSelected()), this, SLOT(selectAllWidgets()));
QObject::connect(picWidget, SIGNAL(allWidgetsDeselected()), this, SLOT(deselectAllWidgets()));
QObject::connect(picWidget, SIGNAL(nextPictureRequested(QWidget*)), this, SLOT(dialogNextPictureRequested(QWidget*)));
QObject::connect(picWidget, SIGNAL(previousPictureRequested(QWidget*)), this, SLOT(dialogPreviousPictureRequested(QWidget*)));
QObject::connect(picWidget, SIGNAL(contextMenuTriggered(QContextMenuEvent*)), this, SLOT(contextMenuTriggeredPIC(QContextMenuEvent*)));
if (inserted)
insertSnapmaticIPI(picWidget);
}
void ProfileInterface::loadingProgress(int value, int maximum)
{
ui->pbPictureLoading->setMaximum(maximum);
ui->pbPictureLoading->setValue(value);
ui->labProfileLoading->setText(loadingStr.arg(QString::number(value), QString::number(maximum)));
}
12 months ago
#if QT_VERSION >= 0x050000
void ProfileInterface::directoryChanged(const QString &path)
{
12 months ago
Q_UNUSED(path)
QDir dir(profileFolder);
QVector<QString> t_savegameFiles;
QVector<QString> t_snapmaticPics;
QVector<QString> n_savegameFiles;
QVector<QString> n_snapmaticPics;
const QStringList files = dir.entryList(QDir::Files);
for (const QString &fileName : files) {
if (fileName.startsWith("SGTA5") && !fileName.endsWith(".bak")) {
t_savegameFiles << fileName;
if (!savegameFiles.contains(fileName)) {
n_savegameFiles << fileName;
}
}
if (fileName.startsWith("PGTA5") && !fileName.endsWith(".bak")) {
t_snapmaticPics << fileName;
if (!snapmaticPics.contains(fileName)) {
n_snapmaticPics << fileName;
}
}
}
savegameFiles = t_savegameFiles;
snapmaticPics = t_snapmaticPics;
if (!n_savegameFiles.isEmpty() || !n_snapmaticPics.isEmpty()) {
QTimer::singleShot(1000, this, [=](){
for (const QString &fileName : qAsConst(n_savegameFiles)) {
const QString filePath = profileFolder % "/" % fileName;
SavegameData *savegame = new SavegameData(filePath);
if (savegame->readingSavegame())
savegameLoaded(savegame, filePath, true);
else
delete savegame;
}
for (const QString &fileName : qAsConst(n_snapmaticPics)) {
const QString filePath = profileFolder % "/" % fileName;
SnapmaticPicture *picture = new SnapmaticPicture(filePath);
if (picture->readingPicture(true))
pictureLoaded(picture, true);
else
delete picture;
}
});
}
}
void ProfileInterface::directoryScanned(QVector<QString> savegameFiles_s, QVector<QString> snapmaticPics_s)
{
savegameFiles = savegameFiles_s;
snapmaticPics = snapmaticPics_s;
fileSystemWatcher.addPath(profileFolder);
QObject::connect(&fileSystemWatcher, &QFileSystemWatcher::directoryChanged, this, &ProfileInterface::directoryChanged);
}
12 months ago
#endif
void ProfileInterface::insertSnapmaticIPI(QWidget *widget)
{
ProfileWidget *proWidget = qobject_cast<ProfileWidget*>(widget);
const QString widgetKey = widgets.value(proWidget, QString());
if (!widgetKey.isNull()) {
QStringList widgetsKeyList = widgets.values();
QStringList pictureKeyList = widgetsKeyList.filter("PIC", Qt::CaseSensitive);
#if QT_VERSION >= 0x050600
std::sort(pictureKeyList.rbegin(), pictureKeyList.rend());
#else
qSort(pictureKeyList.begin(), pictureKeyList.end(), qGreater<QString>());
#endif
int picIndex = pictureKeyList.indexOf(widgetKey);
ui->vlSnapmatic->insertWidget(picIndex, proWidget);
QApplication::processEvents();
ui->saProfile->ensureWidgetVisible(proWidget, 0, 0);
}
}
void ProfileInterface::insertSavegameIPI(QWidget *widget)
{
ProfileWidget *proWidget = qobject_cast<ProfileWidget*>(widget);
const QString widgetKey = widgets.value(proWidget, QString());
if (!widgetKey.isNull()) {
QStringList widgetsKeyList = widgets.values();
QStringList savegameKeyList = widgetsKeyList.filter("SGD", Qt::CaseSensitive);
#if QT_VERSION >= 0x050600
std::sort(savegameKeyList.begin(), savegameKeyList.end());
#else
qSort(savegameKeyList.begin(), savegameKeyList.end());
#endif
int sgdIndex = savegameKeyList.indexOf(widgetKey);
ui->vlSavegame->insertWidget(sgdIndex, proWidget);
QApplication::processEvents();
ui->saProfile->ensureWidgetVisible(proWidget, 0, 0);
}
}
void ProfileInterface::dialogNextPictureRequested(QWidget *dialog)
{
PictureDialog *picDialog = qobject_cast<PictureDialog*>(dialog);
ProfileWidget *proWidget = qobject_cast<ProfileWidget*>(sender());
const QString widgetKey = widgets.value(proWidget, QString());
if (!widgetKey.isNull()) {
QStringList widgetsKeyList = widgets.values();
QStringList pictureKeyList = widgetsKeyList.filter("PIC", Qt::CaseSensitive);
#if QT_VERSION >= 0x050600
std::sort(pictureKeyList.rbegin(), pictureKeyList.rend());
#else
qSort(pictureKeyList.begin(), pictureKeyList.end(), qGreater<QString>());
#endif
int picIndex;
if (picDialog->isIndexed()) {
picIndex = picDialog->getIndex();
}
else {
picIndex = pictureKeyList.indexOf(widgetKey);
}
picIndex++;
if (pictureKeyList.length() > picIndex) {
const QString newWidgetKey = pictureKeyList.at(picIndex);
SnapmaticWidget *picWidget = static_cast<SnapmaticWidget*>(widgets.key(newWidgetKey));
picDialog->setSnapmaticPicture(picWidget->getPicture(), picIndex);
}
}
}
void ProfileInterface::dialogPreviousPictureRequested(QWidget *dialog)
{
PictureDialog *picDialog = qobject_cast<PictureDialog*>(dialog);
ProfileWidget *proWidget = qobject_cast<ProfileWidget*>(sender());
const QString widgetKey = widgets.value(proWidget, QString());
if (!widgetKey.isNull()) {
QStringList widgetsKeyList = widgets.values();
QStringList pictureKeyList = widgetsKeyList.filter("PIC", Qt::CaseSensitive);
#if QT_VERSION >= 0x050600
std::sort(pictureKeyList.rbegin(), pictureKeyList.rend());
#else
qSort(pictureKeyList.begin(), pictureKeyList.end(), qGreater<QString>());
#endif
int picIndex;
if (picDialog->isIndexed()) {
picIndex = picDialog->getIndex();
}
else {
picIndex = pictureKeyList.indexOf(widgetKey);
}
if (picIndex > 0) {
picIndex--;
const QString newWidgetKey = pictureKeyList.at(picIndex);
SnapmaticWidget *picWidget = static_cast<SnapmaticWidget*>(widgets.key(newWidgetKey));
picDialog->setSnapmaticPicture(picWidget->getPicture(), picIndex);
}
}
}
void ProfileInterface::sortingProfileInterface()
{
ui->vlSavegame->setEnabled(false);
ui->vlSnapmatic->setEnabled(false);
QStringList widgetsKeyList = widgets.values();
#if QT_VERSION >= 0x050600
std::sort(widgetsKeyList.begin(), widgetsKeyList.end());
#else
qSort(widgetsKeyList.begin(), widgetsKeyList.end());
#endif
for (const QString &widgetKey : qAsConst(widgetsKeyList)) {
ProfileWidget *widget = widgets.key(widgetKey);
if (widget->getWidgetType() == "SnapmaticWidget") {
ui->vlSnapmatic->insertWidget(0, widget);
}
else if (widget->getWidgetType() == "SavegameWidget") {
ui->vlSavegame->addWidget(widget);
}
}
ui->vlSavegame->setEnabled(true);
ui->vlSnapmatic->setEnabled(true);
QApplication::processEvents();
}
void ProfileInterface::profileLoaded_p()
{
sortingProfileInterface();
saSpacerItem = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
ui->saProfileContent->layout()->addItem(saSpacerItem);
ui->swProfile->setCurrentWidget(ui->pageProfile);
ui->cmdCloseProfile->setEnabled(true);
ui->cmdImport->setEnabled(true);
isProfileLoaded = true;
emit profileLoaded();
if (!fixedPictures.isEmpty()) {
int fixedInt = 0;
QString fixedStr;
for (const QString &fixedPicture : qAsConst(fixedPictures)) {
if (fixedInt != 0) { fixedStr += "<br>"; }
fixedStr += fixedPicture;
fixedInt++;
}
QMessageBox::information(this, tr("Snapmatic Loader"), tr("<h4>Following Snapmatic Pictures got repaired</h4>%1").arg(fixedStr));
}
}
void ProfileInterface::savegameDeleted_event()
{
savegameDeleted(qobject_cast<SavegameWidget*>(sender()), true);
}
void ProfileInterface::savegameDeleted(SavegameWidget *sgdWidget, bool isRemoteEmited)
{
SavegameData *savegame = sgdWidget->getSavegame();
if (sgdWidget->isSelected())
sgdWidget->setSelected(false);
widgets.remove(sgdWidget);
sgdWidget->disconnect();
sgdWidget->removeEventFilter(this);
if (sgdWidget == previousWidget) {
previousWidget = nullptr;
}
// Deleting when the widget did send a event cause a crash
isRemoteEmited ? sgdWidget->deleteLater() : delete sgdWidget;
savegames.removeAll(savegame);
delete savegame;
}
void ProfileInterface::pictureDeleted_event()
{
pictureDeleted(qobject_cast<SnapmaticWidget*>(sender()), true);
}
void ProfileInterface::pictureDeleted(SnapmaticWidget *picWidget, bool isRemoteEmited)
{
SnapmaticPicture *picture = picWidget->getPicture();
if (picWidget->isSelected())
picWidget->setSelected(false);
widgets.remove(picWidget);
picWidget->disconnect();
picWidget->removeEventFilter(this);
if (picWidget == previousWidget) {
previousWidget = nullptr;
}
// Deleting when the widget did send a event cause a crash
isRemoteEmited ? picWidget->deleteLater() : delete picWidget;
pictures.removeAll(picture);
delete picture;
}
void ProfileInterface::on_cmdCloseProfile_clicked()
{
emit profileClosed();
}
void ProfileInterface::on_cmdImport_clicked()
{
QSettings settings(GTA5SYNC_APPVENDOR, GTA5SYNC_APPSTR);
settings.beginGroup("FileDialogs");
bool dontUseNativeDialog = settings.value("DontUseNativeDialog", false).toBool();
settings.beginGroup("ImportCopy");
fileDialogPreOpen: //Work?
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(tr("Import..."));
fileDialog.setLabelText(QFileDialog::Accept, tr("Import..."));
// Getting readable Image formats
QString imageFormatsStr = " ";
for (const QByteArray &imageFormat : QImageReader::supportedImageFormats()) {
imageFormatsStr += QString("*.") % QString::fromUtf8(imageFormat).toLower() % " ";
}
QString importableFormatsStr = QString("*.g5e SGTA* PGTA*");
if (!imageFormatsStr.trimmed().isEmpty()) {
importableFormatsStr = QString("*.g5e%1SGTA* PGTA*").arg(imageFormatsStr);
}
QStringList filters;
filters << tr("Importable files (%1)").arg(importableFormatsStr);
filters << tr("GTA V Export (*.g5e)");
filters << tr("Savegames files (SGTA*)");
filters << tr("Snapmatic pictures (PGTA*)");
filters << tr("All image files (%1)").arg(imageFormatsStr.trimmed());
filters << 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);
QDateTime importDateTime = QDateTime::currentDateTime();
if (!importFile(selectedFile, importDateTime, true)) goto fileDialogPreOpen; //Work?
}
else if (selectedFiles.length() > 1) {
importFilesProgress(selectedFiles);
}
else {
QMessageBox::warning(this, tr("Import..."), tr("No valid file is selected"));
goto fileDialogPreOpen; //Work?
}
}
settings.setValue(profileName % "+Geometry", fileDialog.saveGeometry());
settings.setValue(profileName % "+Directory", fileDialog.directory().absolutePath());
settings.endGroup();
settings.endGroup();
}
4 years ago
bool ProfileInterface::importFilesProgress(QStringList selectedFiles)
{
int maximumId = selectedFiles.length();
int overallId = 0;
QString errorStr;
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(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();
// THREADING HERE PLEASE
QDateTime importDateTime = QDateTime::currentDateTime();
for (const QString &selectedFile : selectedFiles) {