added drop support, latest changes from gta5sync

This commit is contained in:
Syping 2017-07-28 19:53:07 +02:00
parent e041c576cd
commit 8ddd79d667
12 changed files with 288 additions and 102 deletions

View file

@ -24,15 +24,15 @@ before_script:
- echo "Grand Theft Auto V Snapmatic and Savegame viewer" > ./description-pak - echo "Grand Theft Auto V Snapmatic and Savegame viewer" > ./description-pak
script: script:
- qmake -qt=5 "DEFINES+=GTA5SYNC_DAILYB=\\\\\\\"$PACKAGE_VERSION-rc1\\\\\\\"" ../gta5view.pro - qmake -qt=5 "DEFINES+=GTA5SYNC_DAILYB=\\\\\\\"$PACKAGE_VERSION-rc2\\\\\\\"" ../gta5view.pro
- make -j 4 - make -j 4
- sudo checkinstall -D --default --nodoc --pkgname=gta5view --pkgversion=$PACKAGE_VERSION --pkgrelease=rc1 --pkggroup=utility --maintainer="Syping on Travis \<travisci@syping.de\>" --requires=libqt5core5a,libqt5gui5,libqt5network5,libqt5widgets5 --pakdir=../package - sudo checkinstall -D --default --nodoc --pkgname=gta5view --pkgversion=$PACKAGE_VERSION --pkgrelease=rc2 --pkggroup=utility --maintainer="Syping on Travis \<travisci@syping.de\>" --requires=libqt5core5a,libqt5gui5,libqt5network5,libqt5widgets5 --pakdir=../package
deploy: deploy:
provider: releases provider: releases
api_key: api_key:
secure: "o7VneEz1aHfdVwZvOZLfopf6uJWNrFsZaBvunTmXFzpmNFhlNS1qwqgMUkIA2yBRbZ3wIzVs4vfwIHv7W9yE/PqK+AYL+R8+AwKGrwlgT4HqJNuk6VM/LNJ6GwT/qkQuaoOVw29bUjmzzgIRdHmw53SlJv6Hh1VE8HphlTT//aex6nCfcFhUZ0BETdZDWz5FSHwL3NalUoqfKfQrJeky5RXzCyCANQC2tKt0bV46GaWIgWrDo2KCTNqPtRWWf5GDmnkXE5IYRMQ3mXvO9iYh0v5Y2jo4PiXGUiFUU6Z3aAWFAiPdGclrBO697cf3lCTzDMhuCETR153qFYsLShUlFf61ITAmCeHAWETjZDri0lmPONo3GoNB6alGfYEA51qw14kXakrTpICtTJj7gw/gtUYOabW6hrzmieNzMBIy62RikDPjyakFnuwW2qNHRlD65e0jYv+6nCpb6E+OV16Ysh1zhV2vTfpfzVmSuyu2J+ELqXD3OZCXRSPpDIih9UQ8335p8FBji6jHORcgym/TRgdgRmENibh8tLzWp+UjpWHuWfcpvZgOskjfwU0iDMCayMJ7tDpOhXHcAhDRnd6XRIiOJ5YZCzflj2nEwmt3YUd7DwXS/AU+WHOmcNQBjXBxF/FJa35XXcy3HKJM5TTKqtph3medo30us5yXHeG6NNg=" secure: "o7VneEz1aHfdVwZvOZLfopf6uJWNrFsZaBvunTmXFzpmNFhlNS1qwqgMUkIA2yBRbZ3wIzVs4vfwIHv7W9yE/PqK+AYL+R8+AwKGrwlgT4HqJNuk6VM/LNJ6GwT/qkQuaoOVw29bUjmzzgIRdHmw53SlJv6Hh1VE8HphlTT//aex6nCfcFhUZ0BETdZDWz5FSHwL3NalUoqfKfQrJeky5RXzCyCANQC2tKt0bV46GaWIgWrDo2KCTNqPtRWWf5GDmnkXE5IYRMQ3mXvO9iYh0v5Y2jo4PiXGUiFUU6Z3aAWFAiPdGclrBO697cf3lCTzDMhuCETR153qFYsLShUlFf61ITAmCeHAWETjZDri0lmPONo3GoNB6alGfYEA51qw14kXakrTpICtTJj7gw/gtUYOabW6hrzmieNzMBIy62RikDPjyakFnuwW2qNHRlD65e0jYv+6nCpb6E+OV16Ysh1zhV2vTfpfzVmSuyu2J+ELqXD3OZCXRSPpDIih9UQ8335p8FBji6jHORcgym/TRgdgRmENibh8tLzWp+UjpWHuWfcpvZgOskjfwU0iDMCayMJ7tDpOhXHcAhDRnd6XRIiOJ5YZCzflj2nEwmt3YUd7DwXS/AU+WHOmcNQBjXBxF/FJa35XXcy3HKJM5TTKqtph3medo30us5yXHeG6NNg="
file: "../package/gta5view_$PACKAGE_VERSION-rc1_amd64.deb" file: "../package/gta5view_$PACKAGE_VERSION-rc2_amd64.deb"
skip_cleanup: true skip_cleanup: true
on: on:
tags: true tags: true

View file

@ -142,5 +142,9 @@ qreal AppEnv::screenRatio()
#else #else
qreal dpi = qApp->desktop()->logicalDpiX(); qreal dpi = qApp->desktop()->logicalDpiX();
#endif #endif
#ifdef Q_OS_MAC
return (dpi / 72);
#else
return (dpi / 96); return (dpi / 96);
#endif
} }

View file

@ -158,6 +158,10 @@ void PictureDialog::setupPictureDialog(bool withDatabase_)
installEventFilter(ui->labPicture); installEventFilter(ui->labPicture);
ui->labPicture->setFixedSize(960 * screenRatio, 536 * screenRatio); ui->labPicture->setFixedSize(960 * screenRatio, 536 * screenRatio);
ui->labPicture->setFocusPolicy(Qt::StrongFocus); ui->labPicture->setFocusPolicy(Qt::StrongFocus);
// Pre-adapt window for DPI
setFixedWidth(960 * screenRatio);
setFixedHeight(536 * screenRatio);
} }
PictureDialog::~PictureDialog() PictureDialog::~PictureDialog()

View file

@ -51,6 +51,19 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<spacer name="vsJSONUpper">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item> <item>
<widget class="QFrame" name="jsonFrame"> <widget class="QFrame" name="jsonFrame">
<property name="frameShape"> <property name="frameShape">

View file

@ -69,6 +69,7 @@ ProfileInterface::ProfileInterface(ProfileDatabase *profileDB, CrewDatabase *cre
QColor baseColor = palette.base().color(); QColor baseColor = palette.base().color();
ui->labVersion->setText(ui->labVersion->text().arg(GTA5SYNC_APPSTR, GTA5SYNC_APPVER)); ui->labVersion->setText(ui->labVersion->text().arg(GTA5SYNC_APPSTR, GTA5SYNC_APPVER));
ui->saProfile->setStyleSheet(QString("QWidget#saProfileContent{background-color: rgb(%1, %2, %3)}").arg(QString::number(baseColor.red()),QString::number(baseColor.green()),QString::number(baseColor.blue()))); ui->saProfile->setStyleSheet(QString("QWidget#saProfileContent{background-color: rgb(%1, %2, %3)}").arg(QString::number(baseColor.red()),QString::number(baseColor.green()),QString::number(baseColor.blue())));
ui->saProfileContent->setFilesMode(true);
if (QIcon::hasThemeIcon("dialog-close")) if (QIcon::hasThemeIcon("dialog-close"))
{ {
@ -77,8 +78,13 @@ ProfileInterface::ProfileInterface(ProfileDatabase *profileDB, CrewDatabase *cre
// DPI calculation // DPI calculation
qreal screenRatio = AppEnv::screenRatio(); qreal screenRatio = AppEnv::screenRatio();
#ifndef Q_OS_MAC
ui->hlButtons->setSpacing(6 * screenRatio); ui->hlButtons->setSpacing(6 * screenRatio);
ui->hlButtons->setContentsMargins(9 * screenRatio, 9 * screenRatio, 9 * screenRatio, 9 * screenRatio); ui->hlButtons->setContentsMargins(9 * screenRatio, 9 * screenRatio, 9 * screenRatio, 9 * screenRatio);
#else
ui->hlButtons->setSpacing(6 * screenRatio);
ui->hlButtons->setContentsMargins(9 * screenRatio, 15 * screenRatio, 15 * screenRatio, 17 * screenRatio);
#endif
} }
ProfileInterface::~ProfileInterface() ProfileInterface::~ProfileInterface()
@ -415,71 +421,7 @@ fileDialogPreOpen: //Work?
} }
else if (selectedFiles.length() > 1) else if (selectedFiles.length() > 1)
{ {
int maximumId = selectedFiles.length(); importFilesProgress(selectedFiles);
int overallId = 1;
int currentId = 0;
QString errorStr;
QStringList failedFiles;
// 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.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.show();
QTime t;
t.start();
foreach(const QString &selectedFile, selectedFiles)
{
pbDialog.setValue(overallId);
pbDialog.setLabelText(tr("Import file %1 of %2 files").arg(QString::number(overallId), QString::number(maximumId)));
if (currentId == 10)
{
// Break until two seconds are over (this prevent import failures)
int elapsedTime = t.elapsed();
if (elapsedTime > 2000)
{
}
else if (elapsedTime < 0)
{
QEventLoop loop;
QTimer::singleShot(2000, &loop, SLOT(quit()));
loop.exec();
}
else
{
QEventLoop loop;
QTimer::singleShot(2000 - elapsedTime, &loop, SLOT(quit()));
loop.exec();
}
currentId = 0;
t.restart();
}
if (!importFile(selectedFile, false, currentId))
{
failedFiles << QFileInfo(selectedFile).fileName();
}
overallId++;
currentId++;
}
pbDialog.close();
foreach (const QString &curErrorStr, failedFiles)
{
errorStr.append(", " + curErrorStr);
}
if (errorStr != "")
{
errorStr.remove(0, 2);
QMessageBox::warning(this, tr("Import"), tr("Import failed with...\n\n%1").arg(errorStr));
}
} }
else else
{ {
@ -494,6 +436,75 @@ fileDialogPreOpen: //Work?
settings.endGroup(); settings.endGroup();
} }
void ProfileInterface::importFilesProgress(QStringList selectedFiles)
{
int maximumId = selectedFiles.length();
int overallId = 1;
int currentId = 0;
QString errorStr;
QStringList failedFiles;
// 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.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.show();
QTime t;
t.start();
foreach(const QString &selectedFile, selectedFiles)
{
pbDialog.setValue(overallId);
pbDialog.setLabelText(tr("Import file %1 of %2 files").arg(QString::number(overallId), QString::number(maximumId)));
if (currentId == 10)
{
// Break until two seconds are over (this prevent import failures)
int elapsedTime = t.elapsed();
if (elapsedTime > 2000)
{
}
else if (elapsedTime < 0)
{
QEventLoop loop;
QTimer::singleShot(2000, &loop, SLOT(quit()));
loop.exec();
}
else
{
QEventLoop loop;
QTimer::singleShot(2000 - elapsedTime, &loop, SLOT(quit()));
loop.exec();
}
currentId = 0;
t.restart();
}
if (!importFile(selectedFile, false, currentId))
{
failedFiles << QFileInfo(selectedFile).fileName();
}
overallId++;
currentId++;
}
pbDialog.close();
foreach (const QString &curErrorStr, failedFiles)
{
errorStr.append(", " + curErrorStr);
}
if (errorStr != "")
{
errorStr.remove(0, 2);
QMessageBox::warning(this, tr("Import"), tr("Import failed with...\n\n%1").arg(errorStr));
}
}
bool ProfileInterface::importFile(QString selectedFile, bool notMultiple, int currentId) bool ProfileInterface::importFile(QString selectedFile, bool notMultiple, int currentId)
{ {
QString selectedFileName = QFileInfo(selectedFile).fileName(); QString selectedFileName = QFileInfo(selectedFile).fileName();
@ -1097,22 +1108,16 @@ void ProfileInterface::contextMenuTriggeredPIC(QContextMenuEvent *ev)
contextMenu.addMenu(&editMenu); contextMenu.addMenu(&editMenu);
contextMenu.addMenu(&exportMenu); contextMenu.addMenu(&exportMenu);
contextMenu.addAction(SnapmaticWidget::tr("&Remove"), picWidget, SLOT(on_cmdDelete_clicked())); contextMenu.addAction(SnapmaticWidget::tr("&Remove"), picWidget, SLOT(on_cmdDelete_clicked()));
if (picWidget->isSelected()) contextMenu.addSeparator();
if (!picWidget->isSelected()) { contextMenu.addAction(SnapmaticWidget::tr("&Select"), picWidget, SLOT(pictureSelected())); }
if (picWidget->isSelected()) { contextMenu.addAction(SnapmaticWidget::tr("&Deselect"), picWidget, SLOT(pictureSelected())); }
if (selectedWidgets() != widgets.count())
{ {
contextMenu.addSeparator();
if (!picWidget->isSelected()) { contextMenu.addAction(SnapmaticWidget::tr("&Select"), picWidget, SLOT(pictureSelected())); }
if (picWidget->isSelected()) { contextMenu.addAction(SnapmaticWidget::tr("&Deselect"), picWidget, SLOT(pictureSelected())); }
contextMenu.addAction(SnapmaticWidget::tr("Select &All"), picWidget, SLOT(selectAllWidgets()), QKeySequence::fromString("Ctrl+A")); contextMenu.addAction(SnapmaticWidget::tr("Select &All"), picWidget, SLOT(selectAllWidgets()), QKeySequence::fromString("Ctrl+A"));
if (selectedWidgets() != 0)
{
contextMenu.addAction(SnapmaticWidget::tr("&Deselect All"), picWidget, SLOT(deselectAllWidgets()), QKeySequence::fromString("Ctrl+D"));
}
} }
else if (selectedWidgets() != 0)
{ {
contextMenu.addSeparator(); contextMenu.addAction(SnapmaticWidget::tr("&Deselect All"), picWidget, SLOT(deselectAllWidgets()), QKeySequence::fromString("Ctrl+D"));
contextMenu.addAction(SnapmaticWidget::tr("&Select"), picWidget, SLOT(pictureSelected()));
contextMenu.addAction(SnapmaticWidget::tr("Select &All"), picWidget, SLOT(selectAllWidgets()), QKeySequence::fromString("Ctrl+A"));
} }
contextMenu.exec(ev->globalPos()); contextMenu.exec(ev->globalPos());
} }
@ -1124,22 +1129,41 @@ void ProfileInterface::contextMenuTriggeredSGD(QContextMenuEvent *ev)
contextMenu.addAction(SavegameWidget::tr("&View"), sgdWidget, SLOT(on_cmdView_clicked())); contextMenu.addAction(SavegameWidget::tr("&View"), sgdWidget, SLOT(on_cmdView_clicked()));
contextMenu.addAction(SavegameWidget::tr("&Export"), sgdWidget, SLOT(on_cmdCopy_clicked())); contextMenu.addAction(SavegameWidget::tr("&Export"), sgdWidget, SLOT(on_cmdCopy_clicked()));
contextMenu.addAction(SavegameWidget::tr("&Remove"), sgdWidget, SLOT(on_cmdDelete_clicked())); contextMenu.addAction(SavegameWidget::tr("&Remove"), sgdWidget, SLOT(on_cmdDelete_clicked()));
if (sgdWidget->isSelected()) contextMenu.addSeparator();
if (!sgdWidget->isSelected()) { contextMenu.addAction(SavegameWidget::tr("&Select"), sgdWidget, SLOT(savegameSelected())); }
if (sgdWidget->isSelected()) { contextMenu.addAction(SavegameWidget::tr("&Deselect"), sgdWidget, SLOT(savegameSelected())); }
if (selectedWidgets() != widgets.count())
{ {
contextMenu.addSeparator();
if (!sgdWidget->isSelected()) { contextMenu.addAction(SavegameWidget::tr("&Select"), this, SLOT(savegameSelected())); }
if (sgdWidget->isSelected()) { contextMenu.addAction(SavegameWidget::tr("&Deselect"), this, SLOT(savegameSelected())); }
contextMenu.addAction(SavegameWidget::tr("Select &All"), sgdWidget, SLOT(selectAllWidgets()), QKeySequence::fromString("Ctrl+A")); contextMenu.addAction(SavegameWidget::tr("Select &All"), sgdWidget, SLOT(selectAllWidgets()), QKeySequence::fromString("Ctrl+A"));
if (selectedWidgets() != 0)
{
contextMenu.addAction(SavegameWidget::tr("&Deselect All"), sgdWidget, SLOT(deselectAllWidgets()), QKeySequence::fromString("Ctrl+D"));
}
} }
else if (selectedWidgets() != 0)
{ {
contextMenu.addSeparator(); contextMenu.addAction(SavegameWidget::tr("&Deselect All"), sgdWidget, SLOT(deselectAllWidgets()), QKeySequence::fromString("Ctrl+D"));
contextMenu.addAction(SavegameWidget::tr("&Select"), sgdWidget, SLOT(savegameSelected()));
contextMenu.addAction(SavegameWidget::tr("Select &All"), sgdWidget, SLOT(selectAllWidgets()), QKeySequence::fromString("Ctrl+A"));
} }
contextMenu.exec(ev->globalPos()); contextMenu.exec(ev->globalPos());
} }
void ProfileInterface::on_saProfileContent_dropped(const QMimeData *mimeData)
{
if (!mimeData) return;
QStringList pathList;
QList<QUrl> urlList = mimeData->urls();
foreach(const QUrl &currentUrl, urlList)
{
if (currentUrl.isLocalFile())
{
pathList.append(currentUrl.toLocalFile());
}
}
if (pathList.length() == 1)
{
QString selectedFile = pathList.at(0);
importFile(selectedFile, true, 0);
}
else if (pathList.length() > 1)
{
importFilesProgress(pathList);
}
}

View file

@ -74,6 +74,7 @@ private slots:
void profileWidgetDeselected(); void profileWidgetDeselected();
void dialogNextPictureRequested(QWidget *dialog); void dialogNextPictureRequested(QWidget *dialog);
void dialogPreviousPictureRequested(QWidget *dialog); void dialogPreviousPictureRequested(QWidget *dialog);
void on_saProfileContent_dropped(const QMimeData *mimeData);
private: private:
ProfileDatabase *profileDB; ProfileDatabase *profileDB;
@ -94,6 +95,7 @@ private:
int contentMode; int contentMode;
bool importFile(QString selectedFile, bool notMultiple, int currentId); bool importFile(QString selectedFile, bool notMultiple, int currentId);
void importFilesProgress(QStringList selectedFiles);
bool importSnapmaticPicture(SnapmaticPicture *picture, bool warn = true); bool importSnapmaticPicture(SnapmaticPicture *picture, bool warn = true);
bool importSavegameData(SavegameData *savegame, QString sgdPath, bool warn = true); bool importSavegameData(SavegameData *savegame, QString sgdPath, bool warn = true);
void pictureLoaded(SnapmaticPicture *picture, bool inserted); void pictureLoaded(SnapmaticPicture *picture, bool inserted);

View file

@ -103,15 +103,18 @@
<property name="widgetResizable"> <property name="widgetResizable">
<bool>true</bool> <bool>true</bool>
</property> </property>
<widget class="QWidget" name="saProfileContent"> <widget class="UiModWidget" name="saProfileContent">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>98</width> <width>398</width>
<height>28</height> <height>257</height>
</rect> </rect>
</property> </property>
<property name="acceptDrops">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="vlProfile"> <layout class="QVBoxLayout" name="vlProfile">
<property name="leftMargin"> <property name="leftMargin">
<number>0</number> <number>0</number>
@ -225,6 +228,17 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<customwidgets>
<customwidget>
<class>UiModWidget</class>
<extends>QWidget</extends>
<header>UiModWidget.h</header>
<container>1</container>
<slots>
<signal>dropped(QMimeData*)</signal>
</slots>
</customwidget>
</customwidgets>
<resources/> <resources/>
<connections/> <connections/>
</ui> </ui>

View file

@ -50,7 +50,7 @@
#ifndef GTA5SYNC_APPVER #ifndef GTA5SYNC_APPVER
#ifndef GTA5SYNC_DAILYB #ifndef GTA5SYNC_DAILYB
#define GTA5SYNC_APPVER "1.4.0-rc1" #define GTA5SYNC_APPVER "1.4.0-rc2"
#else #else
#define GTA5SYNC_APPVER QString("%1").arg(GTA5SYNC_DAILYB) #define GTA5SYNC_APPVER QString("%1").arg(GTA5SYNC_DAILYB)
#endif #endif

View file

@ -56,7 +56,8 @@ SOURCES += main.cpp \
StandardPaths.cpp \ StandardPaths.cpp \
StringParser.cpp \ StringParser.cpp \
UserInterface.cpp \ UserInterface.cpp \
uimod/UiModLabel.cpp uimod/UiModLabel.cpp \
uimod/UiModWidget.cpp
HEADERS += \ HEADERS += \
AboutDialog.h \ AboutDialog.h \
@ -87,7 +88,8 @@ HEADERS += \
StandardPaths.h \ StandardPaths.h \
StringParser.h \ StringParser.h \
UserInterface.h \ UserInterface.h \
uimod/UiModLabel.h uimod/UiModLabel.h \
uimod/UiModWidget.h
PRECOMPILED_HEADER += config.h PRECOMPILED_HEADER += config.h

View file

@ -7,8 +7,8 @@ CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "gta5view.exe.manifest"
#include <windows.h> #include <windows.h>
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 1, 4, 0, 5 FILEVERSION 1, 4, 0, 6
PRODUCTVERSION 1, 4, 0, 5 PRODUCTVERSION 1, 4, 0, 6
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
FILEFLAGS 0 FILEFLAGS 0
FILEOS VOS_NT_WINDOWS32 FILEOS VOS_NT_WINDOWS32
@ -25,12 +25,12 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "Syping" VALUE "CompanyName", "Syping"
VALUE "FileDescription", "gta5view\0" VALUE "FileDescription", "gta5view\0"
VALUE "FileVersion", "1.4.0-rc1\0" VALUE "FileVersion", "1.4.0-rc2\0"
VALUE "InternalName", "gta5view\0" VALUE "InternalName", "gta5view\0"
VALUE "LegalCopyright", "Copyright © 2016-2017 Syping\0" VALUE "LegalCopyright", "Copyright © 2016-2017 Syping\0"
VALUE "OriginalFilename", "gta5view.exe\0" VALUE "OriginalFilename", "gta5view.exe\0"
VALUE "ProductName", "gta5view\0" VALUE "ProductName", "gta5view\0"
VALUE "ProductVersion", "1.4.0-rc1\0" VALUE "ProductVersion", "1.4.0-rc2\0"
END END
END END
END END

76
uimod/UiModWidget.cpp Normal file
View file

@ -0,0 +1,76 @@
/*****************************************************************************
* gta5sync GRAND THEFT AUTO V SYNC
* Copyright (C) 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 "UiModWidget.h"
#include <QStyleOption>
#include <QDropEvent>
#include <QMimeData>
#include <QPainter>
#include <QDebug>
#include <QUrl>
UiModWidget::UiModWidget(QWidget *parent) : QWidget(parent)
{
filesMode = false;
}
UiModWidget::~UiModWidget()
{
}
void UiModWidget::setFilesMode(bool filesModeEnabled)
{
filesMode = filesModeEnabled;
}
void UiModWidget::dragEnterEvent(QDragEnterEvent *dragEnterEvent)
{
if (filesMode && dragEnterEvent->mimeData()->hasUrls())
{
QStringList pathList;
QList<QUrl> urlList = dragEnterEvent->mimeData()->urls();
foreach(const QUrl &currentUrl, urlList)
{
if (currentUrl.isLocalFile())
{
pathList.append(currentUrl.toLocalFile());
}
}
if (!pathList.isEmpty())
{
dragEnterEvent->acceptProposedAction();
}
}
}
void UiModWidget::dropEvent(QDropEvent *dropEvent)
{
dropEvent->acceptProposedAction();
emit dropped(dropEvent->mimeData());
}
void UiModWidget::paintEvent(QPaintEvent *paintEvent)
{
Q_UNUSED(paintEvent)
QStyleOption opt;
opt.init(this);
QPainter p(this);
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
}

47
uimod/UiModWidget.h Normal file
View file

@ -0,0 +1,47 @@
/*****************************************************************************
* gta5sync GRAND THEFT AUTO V SYNC
* Copyright (C) 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 UIMODWIDGET_H
#define UIMODWIDGET_H
#include <QMimeData>
#include <QWidget>
#include <QString>
#include <QSize>
class UiModWidget : public QWidget
{
Q_OBJECT
public:
UiModWidget(QWidget *parent = 0);
void setFilesMode(bool enabled);
~UiModWidget();
protected:
void dragEnterEvent(QDragEnterEvent *dragEnterEvent);
void dropEvent(QDropEvent *dropEvent);
void paintEvent(QPaintEvent *paintEvent);
private:
bool filesMode;
signals:
void dropped(const QMimeData *mimeData);
};
#endif // UIMODWIDGET_H