ram usage fix from gta5sync
This commit is contained in:
parent
98de3f5560
commit
33a5faa7bf
8 changed files with 86 additions and 80 deletions
|
@ -17,6 +17,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
#include "SnapmaticPicture.h"
|
||||
#include "ProfileInterface.h"
|
||||
#include "PictureExport.h"
|
||||
#include "ProfileWidget.h"
|
||||
#include "ExportThread.h"
|
||||
|
|
|
@ -135,6 +135,7 @@ void ProfileInterface::savegameLoaded(SavegameData *savegame, QString savegamePa
|
|||
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); }
|
||||
}
|
||||
|
||||
|
@ -158,6 +159,7 @@ void ProfileInterface::pictureLoaded(SnapmaticPicture *picture, bool inserted)
|
|||
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); }
|
||||
}
|
||||
|
||||
|
@ -319,9 +321,8 @@ void ProfileInterface::savegameDeleted_event()
|
|||
savegameDeleted((SavegameWidget*)sender());
|
||||
}
|
||||
|
||||
void ProfileInterface::savegameDeleted(QWidget *sgdWidget_)
|
||||
void ProfileInterface::savegameDeleted(SavegameWidget *sgdWidget)
|
||||
{
|
||||
SavegameWidget *sgdWidget = (SavegameWidget*)sgdWidget_;
|
||||
SavegameData *savegame = sgdWidget->getSavegame();
|
||||
if (sgdWidget->isSelected()) { sgdWidget->setSelected(false); }
|
||||
widgets.remove(sgdWidget);
|
||||
|
@ -336,9 +337,8 @@ void ProfileInterface::pictureDeleted_event()
|
|||
pictureDeleted((SnapmaticWidget*)sender());
|
||||
}
|
||||
|
||||
void ProfileInterface::pictureDeleted(QWidget *picWidget_)
|
||||
void ProfileInterface::pictureDeleted(SnapmaticWidget *picWidget)
|
||||
{
|
||||
SnapmaticWidget *picWidget = (SnapmaticWidget*)picWidget_;
|
||||
SnapmaticPicture *picture = picWidget->getPicture();
|
||||
if (picWidget->isSelected()) { picWidget->setSelected(false); }
|
||||
widgets.remove(picWidget);
|
||||
|
@ -1057,3 +1057,71 @@ int ProfileInterface::selectedWidgets()
|
|||
{
|
||||
return selectedWidgts;
|
||||
}
|
||||
|
||||
void ProfileInterface::contextMenuTriggeredPIC(QContextMenuEvent *ev)
|
||||
{
|
||||
SnapmaticWidget *picWidget = (SnapmaticWidget*)sender();
|
||||
QMenu contextMenu(picWidget);
|
||||
QMenu editMenu(SnapmaticWidget::tr("Edi&t"), picWidget);
|
||||
if (isHidden())
|
||||
{
|
||||
editMenu.addAction(SnapmaticWidget::tr("Show &In-game"), picWidget, SLOT(makePictureVisibleSlot()));
|
||||
}
|
||||
else
|
||||
{
|
||||
editMenu.addAction(SnapmaticWidget::tr("Hide &In-game"), picWidget, SLOT(makePictureHiddenSlot()));
|
||||
}
|
||||
editMenu.addAction(SnapmaticWidget::tr("&Edit Properties..."), picWidget, SLOT(editSnapmaticProperties()));
|
||||
QMenu exportMenu(SnapmaticWidget::tr("&Export"), this);
|
||||
exportMenu.addAction(SnapmaticWidget::tr("Export as &JPG picture..."), picWidget, SLOT(on_cmdExport_clicked()));
|
||||
exportMenu.addAction(SnapmaticWidget::tr("Export as >A Snapmatic..."), picWidget, SLOT(on_cmdCopy_clicked()));
|
||||
contextMenu.addAction(SnapmaticWidget::tr("&View"), picWidget, SLOT(on_cmdView_clicked()));
|
||||
contextMenu.addMenu(&editMenu);
|
||||
contextMenu.addMenu(&exportMenu);
|
||||
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())); }
|
||||
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
|
||||
{
|
||||
contextMenu.addSeparator();
|
||||
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());
|
||||
}
|
||||
|
||||
void ProfileInterface::contextMenuTriggeredSGD(QContextMenuEvent *ev)
|
||||
{
|
||||
SavegameWidget *sgdWidget = (SavegameWidget*)sender();
|
||||
QMenu contextMenu(sgdWidget);
|
||||
contextMenu.addAction(SavegameWidget::tr("&View"), sgdWidget, SLOT(on_cmdView_clicked()));
|
||||
contextMenu.addAction(SavegameWidget::tr("&Export"), sgdWidget, SLOT(on_cmdCopy_clicked()));
|
||||
contextMenu.addAction(SavegameWidget::tr("&Remove"), sgdWidget, SLOT(on_cmdDelete_clicked()));
|
||||
if (sgdWidget->isSelected())
|
||||
{
|
||||
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"));
|
||||
if (selectedWidgets() != 0)
|
||||
{
|
||||
contextMenu.addAction(SavegameWidget::tr("&Deselect All"), sgdWidget, SLOT(deselectAllWidgets()), QKeySequence::fromString("Ctrl+D"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
contextMenu.addSeparator();
|
||||
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());
|
||||
}
|
||||
|
|
|
@ -53,6 +53,8 @@ public:
|
|||
~ProfileInterface();
|
||||
|
||||
public slots:
|
||||
void contextMenuTriggeredPIC(QContextMenuEvent* ev);
|
||||
void contextMenuTriggeredSGD(QContextMenuEvent* ev);
|
||||
void selectAllWidgets();
|
||||
void deselectAllWidgets();
|
||||
void exportSelected();
|
||||
|
@ -96,8 +98,8 @@ private:
|
|||
bool importSavegameData(SavegameData *savegame, QString sgdPath, bool warn = true);
|
||||
void pictureLoaded(SnapmaticPicture *picture, bool inserted);
|
||||
void savegameLoaded(SavegameData *savegame, QString savegamePath, bool inserted);
|
||||
void savegameDeleted(QWidget *sgdWidget);
|
||||
void pictureDeleted(QWidget *picWidget);
|
||||
void savegameDeleted(SavegameWidget *sgdWidget);
|
||||
void pictureDeleted(SnapmaticWidget *picWidget);
|
||||
void insertSnapmaticIPI(QWidget *widget);
|
||||
void insertSavegameIPI(QWidget *widget);
|
||||
void sortingProfileInterface();
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include "SavegameWidget.h"
|
||||
#include "ui_SavegameWidget.h"
|
||||
#include "SidebarGenerator.h"
|
||||
#include "ProfileInterface.h"
|
||||
#include "SavegameDialog.h"
|
||||
#include "StandardPaths.h"
|
||||
#include "SavegameData.h"
|
||||
|
@ -205,31 +204,7 @@ void SavegameWidget::savegameSelected()
|
|||
|
||||
void SavegameWidget::contextMenuEvent(QContextMenuEvent *ev)
|
||||
{
|
||||
QMenu contextMenu(this);
|
||||
contextMenu.addAction(tr("&View"), this, SLOT(on_cmdView_clicked()));
|
||||
contextMenu.addAction(tr("&Export"), this, SLOT(on_cmdCopy_clicked()));
|
||||
contextMenu.addAction(tr("&Remove"), this, SLOT(on_cmdDelete_clicked()));
|
||||
if (ui->cbSelected->isVisible())
|
||||
{
|
||||
contextMenu.addSeparator();
|
||||
if (!ui->cbSelected->isChecked()) { contextMenu.addAction(tr("&Select"), this, SLOT(savegameSelected())); }
|
||||
if (ui->cbSelected->isChecked()) { contextMenu.addAction(tr("&Deselect"), this, SLOT(savegameSelected())); }
|
||||
contextMenu.addAction(tr("Select &All"), this, SLOT(selectAllWidgets()), QKeySequence::fromString("Ctrl+A"));
|
||||
ProfileInterface *profileInterface = (ProfileInterface*)snwgt;
|
||||
if (profileInterface->selectedWidgets() != 0)
|
||||
{
|
||||
contextMenu.addAction(tr("&Deselect All"), this, SLOT(deselectAllWidgets()), QKeySequence::fromString("Ctrl+D"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
contextMenu.addSeparator();
|
||||
contextMenu.addAction(tr("&Select"), this, SLOT(savegameSelected()));
|
||||
contextMenu.addAction(tr("Select &All"), this, SLOT(selectAllWidgets()), QKeySequence::fromString("Ctrl+A"));
|
||||
}
|
||||
//ui->SavegameFrame->setStyleSheet(QString("QFrame#SavegameFrame{background-color: rgb(%1, %2, %3)}QLabel#labSavegameStr{color: rgb(%4, %5, %6)}").arg(QString::number(highlightBackColor.red()), QString::number(highlightBackColor.green()), QString::number(highlightBackColor.blue()), QString::number(highlightTextColor.red()), QString::number(highlightTextColor.green()), QString::number(highlightTextColor.blue())));
|
||||
contextMenu.exec(ev->globalPos());
|
||||
//ui->SavegameFrame->setStyleSheet("");
|
||||
emit contextMenuTriggered(ev);
|
||||
}
|
||||
|
||||
void SavegameWidget::on_cbSelected_stateChanged(int arg1)
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
|
||||
#ifndef SAVEGAMEWIDGET_H
|
||||
#define SAVEGAMEWIDGET_H
|
||||
|
||||
#include "ProfileInterface.h"
|
||||
#include "ProfileWidget.h"
|
||||
#include "SavegameData.h"
|
||||
#include <QContextMenuEvent>
|
||||
|
@ -78,6 +76,7 @@ signals:
|
|||
void widgetDeselected();
|
||||
void allWidgetsSelected();
|
||||
void allWidgetsDeselected();
|
||||
void contextMenuTriggered(QContextMenuEvent *ev);
|
||||
};
|
||||
|
||||
#endif // SAVEGAMEWIDGET_H
|
||||
|
|
|
@ -48,7 +48,6 @@ SnapmaticWidget::SnapmaticWidget(ProfileDatabase *profileDB, CrewDatabase *crewD
|
|||
palette.setCurrentColorGroup(QPalette::Disabled);
|
||||
highlightHiddenColor = palette.text().color();
|
||||
|
||||
snwgt = parent;
|
||||
picPath = "";
|
||||
picStr = "";
|
||||
smpic = 0;
|
||||
|
@ -201,43 +200,7 @@ void SnapmaticWidget::pictureSelected()
|
|||
|
||||
void SnapmaticWidget::contextMenuEvent(QContextMenuEvent *ev)
|
||||
{
|
||||
QMenu contextMenu(this);
|
||||
QMenu editMenu(tr("Edi&t"), this);
|
||||
if (isHidden())
|
||||
{
|
||||
editMenu.addAction(tr("Show &In-game"), this, SLOT(makePictureVisibleSlot()));
|
||||
}
|
||||
else
|
||||
{
|
||||
editMenu.addAction(tr("Hide &In-game"), this, SLOT(makePictureHiddenSlot()));
|
||||
}
|
||||
editMenu.addAction(tr("&Edit Properties..."), this, SLOT(editSnapmaticProperties()));
|
||||
QMenu exportMenu(tr("&Export"), this);
|
||||
exportMenu.addAction(tr("Export as &JPG picture..."), this, SLOT(on_cmdExport_clicked()));
|
||||
exportMenu.addAction(tr("Export as >A Snapmatic..."), this, SLOT(on_cmdCopy_clicked()));
|
||||
contextMenu.addAction(tr("&View"), this, SLOT(on_cmdView_clicked()));
|
||||
contextMenu.addMenu(&editMenu);
|
||||
contextMenu.addMenu(&exportMenu);
|
||||
contextMenu.addAction(tr("&Remove"), this, SLOT(on_cmdDelete_clicked()));
|
||||
if (ui->cbSelected->isVisible())
|
||||
{
|
||||
contextMenu.addSeparator();
|
||||
if (!ui->cbSelected->isChecked()) { contextMenu.addAction(tr("&Select"), this, SLOT(pictureSelected())); }
|
||||
if (ui->cbSelected->isChecked()) { contextMenu.addAction(tr("&Deselect"), this, SLOT(pictureSelected())); }
|
||||
contextMenu.addAction(tr("Select &All"), this, SLOT(selectAllWidgets()), QKeySequence::fromString("Ctrl+A"));
|
||||
ProfileInterface *profileInterface = (ProfileInterface*)snwgt;
|
||||
if (profileInterface->selectedWidgets() != 0)
|
||||
{
|
||||
contextMenu.addAction(tr("&Deselect All"), this, SLOT(deselectAllWidgets()), QKeySequence::fromString("Ctrl+D"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
contextMenu.addSeparator();
|
||||
contextMenu.addAction(tr("&Select"), this, SLOT(pictureSelected()));
|
||||
contextMenu.addAction(tr("Select &All"), this, SLOT(selectAllWidgets()), QKeySequence::fromString("Ctrl+A"));
|
||||
}
|
||||
contextMenu.exec(ev->globalPos());
|
||||
emit contextMenuTriggered(ev);
|
||||
}
|
||||
|
||||
void SnapmaticWidget::dialogNextPictureRequested()
|
||||
|
@ -276,10 +239,9 @@ void SnapmaticWidget::adjustTextColor()
|
|||
|
||||
bool SnapmaticWidget::makePictureHidden()
|
||||
{
|
||||
SnapmaticPicture *picture = (SnapmaticPicture*)smpic;
|
||||
if (picture->setPictureHidden())
|
||||
if (smpic->setPictureHidden())
|
||||
{
|
||||
picPath = picture->getPictureFilePath();
|
||||
picPath = smpic->getPictureFilePath();
|
||||
adjustTextColor();
|
||||
return true;
|
||||
}
|
||||
|
@ -288,10 +250,9 @@ bool SnapmaticWidget::makePictureHidden()
|
|||
|
||||
bool SnapmaticWidget::makePictureVisible()
|
||||
{
|
||||
SnapmaticPicture *picture = (SnapmaticPicture*)smpic;
|
||||
if (picture->setPictureVisible())
|
||||
if (smpic->setPictureVisible())
|
||||
{
|
||||
picPath = picture->getPictureFilePath();
|
||||
picPath = smpic->getPictureFilePath();
|
||||
adjustTextColor();
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#define SNAPMATICWIDGET_H
|
||||
|
||||
#include "SnapmaticPicture.h"
|
||||
#include "ProfileInterface.h"
|
||||
#include "ProfileDatabase.h"
|
||||
#include "DatabaseThread.h"
|
||||
#include "ProfileWidget.h"
|
||||
|
@ -97,6 +96,7 @@ signals:
|
|||
void allWidgetsDeselected();
|
||||
void nextPictureRequested(QWidget *dialog);
|
||||
void previousPictureRequested(QWidget *dialog);
|
||||
void contextMenuTriggered(QContextMenuEvent *ev);
|
||||
};
|
||||
|
||||
#endif // SNAPMATICWIDGET_H
|
||||
|
|
2
config.h
2
config.h
|
@ -50,7 +50,7 @@
|
|||
|
||||
#ifndef GTA5SYNC_APPVER
|
||||
#ifndef GTA5SYNC_DAILYB
|
||||
#define GTA5SYNC_APPVER "1.3.0"
|
||||
#define GTA5SYNC_APPVER "1.3.1"
|
||||
#else
|
||||
#define GTA5SYNC_APPVER QString("%1").arg(GTA5SYNC_DAILYB)
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue