added new content modes
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Syping 2020-11-23 03:13:07 +01:00
parent 563b09e060
commit 099400b439
5 changed files with 172 additions and 78 deletions

View file

@ -206,14 +206,16 @@ void ProfileInterface::savegameLoaded(SavegameData *savegame, QString savegamePa
sgdWidget->installEventFilter(this);
widgets[sgdWidget] = "SGD" % QFileInfo(savegamePath).fileName();
savegames += savegame;
if (selectedWidgts != 0 || contentMode == 2) { sgdWidget->setSelectionMode(true); }
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); }
if (inserted)
insertSavegameIPI(sgdWidget);
}
void ProfileInterface::pictureLoaded_event(SnapmaticPicture *picture)
@ -236,7 +238,8 @@ void ProfileInterface::pictureLoaded(SnapmaticPicture *picture, bool inserted)
picWidget->installEventFilter(this);
widgets[picWidget] = "PIC" % picture->getPictureSortStr();
pictures += picture;
if (selectedWidgts != 0 || contentMode == 2) { picWidget->setSelectionMode(true); }
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()));
@ -245,7 +248,8 @@ void ProfileInterface::pictureLoaded(SnapmaticPicture *picture, bool inserted)
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); }
if (inserted)
insertSnapmaticIPI(picWidget);
}
void ProfileInterface::loadingProgress(int value, int maximum)
@ -1508,6 +1512,26 @@ void ProfileInterface::deleteSelected()
}
}
void ProfileInterface::massToolQualify()
{
massTool(MassTool::Qualify);
}
void ProfileInterface::massToolPlayers()
{
massTool(MassTool::Players);
}
void ProfileInterface::massToolCrew()
{
massTool(MassTool::Crew);
}
void ProfileInterface::massToolTitle()
{
massTool(MassTool::Title);
}
void ProfileInterface::importFiles()
{
on_cmdImport_clicked();
@ -1630,23 +1654,21 @@ int ProfileInterface::selectedWidgets()
void ProfileInterface::contextMenuTriggeredPIC(QContextMenuEvent *ev)
{
SnapmaticWidget *picWidget = qobject_cast<SnapmaticWidget*>(sender());
if (picWidget != previousWidget)
{
if (previousWidget != nullptr)
{
if (picWidget != previousWidget) {
if (previousWidget != nullptr) {
previousWidget->setStyleSheet(QLatin1String(""));
}
picWidget->setStyleSheet(QString("QFrame#SnapmaticFrame{background-color:palette(highlight)}QLabel#labPicStr{color:palette(highlighted-text)}"));
previousWidget = picWidget;
}
QMenu contextMenu(picWidget);
const int selectedCount = selectedWidgets();
if (contentMode < 20 || selectedCount <= 1) {
QMenu editMenu(SnapmaticWidget::tr("Edi&t"), picWidget);
if (picWidget->isHidden())
{
if (picWidget->isHidden()) {
editMenu.addAction(SnapmaticWidget::tr("Show &In-game"), picWidget, SLOT(makePictureVisibleSlot()));
}
else
{
else {
editMenu.addAction(SnapmaticWidget::tr("Hide &In-game"), picWidget, SLOT(makePictureHiddenSlot()));
}
editMenu.addAction(PictureDialog::tr("&Edit Properties..."), picWidget, SLOT(editSnapmaticProperties()));
@ -1662,53 +1684,116 @@ void ProfileInterface::contextMenuTriggeredPIC(QContextMenuEvent *ev)
contextMenu.addMenu(&exportMenu);
contextMenu.addAction(SnapmaticWidget::tr("&Remove"), picWidget, SLOT(on_cmdDelete_clicked()));
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())
{
if (!picWidget->isSelected())
contextMenu.addAction(SnapmaticWidget::tr("&Select"), picWidget, SLOT(pictureSelected()));
else {
contextMenu.addAction(SnapmaticWidget::tr("&Deselect"), picWidget, SLOT(pictureSelected()));
}
if (selectedCount != widgets.count()) {
contextMenu.addAction(SnapmaticWidget::tr("Select &All"), picWidget, SLOT(selectAllWidgets()), QKeySequence::fromString("Ctrl+A"));
}
if (selectedWidgets() != 0)
{
if (selectedCount != 0) {
contextMenu.addAction(SnapmaticWidget::tr("&Deselect All"), picWidget, SLOT(deselectAllWidgets()), QKeySequence::fromString("Ctrl+D"));
}
contextMenuOpened = true;
contextMenu.exec(ev->globalPos());
contextMenuOpened = false;
QTimer::singleShot(0, this, SLOT(hoverProfileWidgetCheck()));
}
else {
QMenu editMenu(SnapmaticWidget::tr("Edi&t"), picWidget);
editMenu.addAction(QApplication::translate("UserInterface", "&Qualify as Avatar"), this, SLOT(massToolQualify()), QKeySequence::fromString("Shift+Q"));
editMenu.addAction(QApplication::translate("UserInterface", "Change &Players..."), this, SLOT(massToolPlayers()), QKeySequence::fromString("Shift+P"));
editMenu.addAction(QApplication::translate("UserInterface", "Change &Crew..."), this, SLOT(massToolCrew()), QKeySequence::fromString("Shift+C"));
editMenu.addAction(QApplication::translate("UserInterface", "Change &Title..."), this, SLOT(massToolTitle()), QKeySequence::fromString("Shift+T"));
editMenu.addSeparator();
editMenu.addAction(SnapmaticWidget::tr("Show &In-game"), this, SLOT(enableSelected()), QKeySequence::fromString("Shift+E"));
editMenu.addAction(SnapmaticWidget::tr("Hide &In-game"), this, SLOT(disableSelected()), QKeySequence::fromString("Shift+D"));
contextMenu.addMenu(&editMenu);
contextMenu.addAction(SnapmaticWidget::tr("&Export"), this, SLOT(exportSelected()));
contextMenu.addAction(SnapmaticWidget::tr("&Remove"), this, SLOT(deleteSelected()));
contextMenu.addSeparator();
if (!picWidget->isSelected())
contextMenu.addAction(SnapmaticWidget::tr("&Select"), picWidget, SLOT(pictureSelected()));
else {
contextMenu.addAction(SnapmaticWidget::tr("&Deselect"), picWidget, SLOT(pictureSelected()));
}
if (selectedCount != widgets.count()) {
contextMenu.addAction(SnapmaticWidget::tr("Select &All"), picWidget, SLOT(selectAllWidgets()), QKeySequence::fromString("Ctrl+A"));
}
if (selectedCount != 0) {
contextMenu.addAction(SnapmaticWidget::tr("&Deselect All"), picWidget, SLOT(deselectAllWidgets()), QKeySequence::fromString("Ctrl+D"));
}
contextMenuOpened = true;
contextMenu.exec(ev->globalPos());
contextMenuOpened = false;
QTimer::singleShot(0, this, SLOT(hoverProfileWidgetCheck()));
}
}
void ProfileInterface::contextMenuTriggeredSGD(QContextMenuEvent *ev)
{
SavegameWidget *sgdWidget = qobject_cast<SavegameWidget*>(sender());
if (sgdWidget != previousWidget)
{
if (previousWidget != nullptr)
{
if (sgdWidget != previousWidget) {
if (previousWidget != nullptr) {
previousWidget->setStyleSheet(QLatin1String(""));
}
sgdWidget->setStyleSheet(QString("QFrame#SavegameFrame{background-color:palette(highlight)}QLabel#labSavegameStr{color:palette(highlighted-text)}"));
previousWidget = sgdWidget;
}
QMenu contextMenu(sgdWidget);
const int selectedCount = selectedWidgets();
if (contentMode < 20 || selectedCount <= 1) {
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()));
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())
{
if (!sgdWidget->isSelected()) {
contextMenu.addAction(SavegameWidget::tr("&Select"), sgdWidget, SLOT(savegameSelected()));
}
else {
contextMenu.addAction(SavegameWidget::tr("&Deselect"), sgdWidget, SLOT(savegameSelected()));
}
if (selectedCount != widgets.count()) {
contextMenu.addAction(SavegameWidget::tr("Select &All"), sgdWidget, SLOT(selectAllWidgets()), QKeySequence::fromString("Ctrl+A"));
}
if (selectedWidgets() != 0)
{
if (selectedCount != 0) {
contextMenu.addAction(SavegameWidget::tr("&Deselect All"), sgdWidget, SLOT(deselectAllWidgets()), QKeySequence::fromString("Ctrl+D"));
}
contextMenuOpened = true;
contextMenu.exec(ev->globalPos());
contextMenuOpened = false;
QTimer::singleShot(0, this, SLOT(hoverProfileWidgetCheck()));
}
else {
QMenu editMenu(SnapmaticWidget::tr("Edi&t"), sgdWidget);
editMenu.addAction(QApplication::translate("UserInterface", "&Qualify as Avatar"), this, SLOT(massToolQualify()), QKeySequence::fromString("Shift+Q"));
editMenu.addAction(QApplication::translate("UserInterface", "Change &Players..."), this, SLOT(massToolPlayers()), QKeySequence::fromString("Shift+P"));
editMenu.addAction(QApplication::translate("UserInterface", "Change &Crew..."), this, SLOT(massToolCrew()), QKeySequence::fromString("Shift+C"));
editMenu.addAction(QApplication::translate("UserInterface", "Change &Title..."), this, SLOT(massToolTitle()), QKeySequence::fromString("Shift+T"));
editMenu.addSeparator();
editMenu.addAction(SnapmaticWidget::tr("Show &In-game"), this, SLOT(enableSelected()), QKeySequence::fromString("Shift+E"));
editMenu.addAction(SnapmaticWidget::tr("Hide &In-game"), this, SLOT(disableSelected()), QKeySequence::fromString("Shift+D"));
contextMenu.addMenu(&editMenu);
contextMenu.addAction(SavegameWidget::tr("&Export"), this, SLOT(exportSelected()));
contextMenu.addAction(SavegameWidget::tr("&Remove"), this, SLOT(deleteSelected()));
contextMenu.addSeparator();
if (!sgdWidget->isSelected())
contextMenu.addAction(SavegameWidget::tr("&Select"), sgdWidget, SLOT(savegameSelected()));
else {
contextMenu.addAction(SavegameWidget::tr("&Deselect"), sgdWidget, SLOT(savegameSelected()));
}
if (selectedCount != widgets.count()) {
contextMenu.addAction(SavegameWidget::tr("Select &All"), sgdWidget, SLOT(selectAllWidgets()), QKeySequence::fromString("Ctrl+A"));
}
if (selectedCount != 0) {
contextMenu.addAction(SavegameWidget::tr("&Deselect All"), sgdWidget, SLOT(deselectAllWidgets()), QKeySequence::fromString("Ctrl+D"));
}
contextMenuOpened = true;
contextMenu.exec(ev->globalPos());
contextMenuOpened = false;
QTimer::singleShot(0, this, SLOT(hoverProfileWidgetCheck()));
}
}
void ProfileInterface::on_saProfileContent_dropped(const QMimeData *mimeData)

View file

@ -52,8 +52,6 @@ public:
void settingsApplied(int contentMode, bool languageChanged);
void setupProfileInterface();
void massTool(MassTool tool);
void disableSelected();
void enableSelected();
int selectedWidgets();
void retranslateUi();
~ProfileInterface();
@ -64,6 +62,8 @@ public slots:
void hoverProfileWidgetCheck();
void selectAllWidgets();
void deselectAllWidgets();
void disableSelected();
void enableSelected();
void exportSelected();
void deleteSelected();
void updatePalette();
@ -81,6 +81,10 @@ private slots:
void profileLoaded_p();
void profileWidgetSelected();
void profileWidgetDeselected();
void massToolQualify();
void massToolPlayers();
void massToolCrew();
void massToolTitle();
void dialogNextPictureRequested(QWidget *dialog);
void dialogPreviousPictureRequested(QWidget *dialog);
void on_saProfileContent_dropped(const QMimeData *mimeData);

View file

@ -217,7 +217,8 @@ void SavegameWidget::mouseReleaseEvent(QMouseEvent *ev)
}
else
{
if (getContentMode() == 0 && rect().contains(ev->pos()) && ev->button() == Qt::LeftButton)
const int contentMode = getContentMode();
if ((contentMode == 0 || contentMode == 10 || contentMode == 20) && rect().contains(ev->pos()) && ev->button() == Qt::LeftButton)
{
if (ev->modifiers().testFlag(Qt::ShiftModifier))
{
@ -228,7 +229,7 @@ void SavegameWidget::mouseReleaseEvent(QMouseEvent *ev)
on_cmdView_clicked();
}
}
else if (!ui->cbSelected->isVisible() && getContentMode() == 1 && ev->button() == Qt::LeftButton && ev->modifiers().testFlag(Qt::ShiftModifier))
else if (!ui->cbSelected->isVisible() && (contentMode == 1 || contentMode == 11 || contentMode == 21) && ev->button() == Qt::LeftButton && ev->modifiers().testFlag(Qt::ShiftModifier))
{
ui->cbSelected->setChecked(!ui->cbSelected->isChecked());
}
@ -239,7 +240,8 @@ void SavegameWidget::mouseDoubleClickEvent(QMouseEvent *ev)
{
ProfileWidget::mouseDoubleClickEvent(ev);
if (!ui->cbSelected->isVisible() && getContentMode() == 1 && ev->button() == Qt::LeftButton)
const int contentMode = getContentMode();
if (!ui->cbSelected->isVisible() && (contentMode == 1 || contentMode == 11 || contentMode == 21) && ev->button() == Qt::LeftButton)
{
on_cmdView_clicked();
}

View file

@ -216,7 +216,8 @@ void SnapmaticWidget::mouseReleaseEvent(QMouseEvent *ev)
}
else
{
if (getContentMode() == 0 && rect().contains(ev->pos()) && ev->button() == Qt::LeftButton)
const int contentMode = getContentMode();
if ((contentMode == 0 || contentMode == 10 || contentMode == 20) && rect().contains(ev->pos()) && ev->button() == Qt::LeftButton)
{
if (ev->modifiers().testFlag(Qt::ShiftModifier))
{
@ -227,7 +228,7 @@ void SnapmaticWidget::mouseReleaseEvent(QMouseEvent *ev)
on_cmdView_clicked();
}
}
else if (!ui->cbSelected->isVisible() && getContentMode() == 1 && ev->button() == Qt::LeftButton && ev->modifiers().testFlag(Qt::ShiftModifier))
else if (!ui->cbSelected->isVisible() && (contentMode == 1 || contentMode == 11 || contentMode == 21) && ev->button() == Qt::LeftButton && ev->modifiers().testFlag(Qt::ShiftModifier))
{
ui->cbSelected->setChecked(!ui->cbSelected->isChecked());
}
@ -238,7 +239,8 @@ void SnapmaticWidget::mouseDoubleClickEvent(QMouseEvent *ev)
{
ProfileWidget::mouseDoubleClickEvent(ev);
if (!ui->cbSelected->isVisible() && getContentMode() == 1 && ev->button() == Qt::LeftButton)
const int contentMode = getContentMode();
if (!ui->cbSelected->isVisible() && (contentMode == 1 || contentMode == 11 || contentMode == 21) && ev->button() == Qt::LeftButton)
{
on_cmdView_clicked();
}

View file

@ -67,7 +67,7 @@ UserInterface::UserInterface(ProfileDatabase *profileDB, CrewDatabase *crewDB, D
ui->cmdClose->setToolTip(ui->cmdClose->toolTip().arg(GTA5SYNC_APPSTR));
defaultWindowTitle = tr("%2 - %1").arg("%1", GTA5SYNC_APPSTR);
this->setWindowTitle(defaultWindowTitle.arg(tr("Select Profile")));
setWindowTitle(defaultWindowTitle.arg(tr("Select Profile")));
QString appVersion = GTA5SYNC_APPVER;
#ifndef GTA5SYNC_BUILDTYPE_REL
#ifdef GTA5SYNC_COMMIT
@ -218,7 +218,7 @@ void UserInterface::setupDirEnv(bool showFolderDialog)
bool contentModeOk;
contentMode = settings.value("ContentMode", 0).toInt(&contentModeOk);
if (contentMode != 0 && contentMode != 1 && contentMode != 2)
if (contentMode != 0 && contentMode != 1 && contentMode != 2 && contentMode != 10 && contentMode != 11 && contentMode != 20 && contentMode != 21)
{
contentMode = 0;
}
@ -311,7 +311,7 @@ void UserInterface::openProfile(const QString &profileName_)
profileUI->setupProfileInterface();
QObject::connect(profileUI, SIGNAL(profileClosed()), this, SLOT(closeProfile()));
QObject::connect(profileUI, SIGNAL(profileLoaded()), this, SLOT(profileLoaded()));
this->setWindowTitle(defaultWindowTitle.arg(profileName));
setWindowTitle(defaultWindowTitle.arg(profileName));
}
void UserInterface::closeProfile()
@ -320,7 +320,7 @@ void UserInterface::closeProfile()
{
closeProfile_p();
}
this->setWindowTitle(defaultWindowTitle.arg(tr("Select Profile")));
setWindowTitle(defaultWindowTitle.arg(tr("Select Profile")));
}
void UserInterface::closeProfile_p()
@ -361,7 +361,7 @@ UserInterface::~UserInterface()
void UserInterface::on_actionExit_triggered()
{
this->close();
close();
}
void UserInterface::on_actionSelect_profile_triggered()
@ -573,7 +573,8 @@ void UserInterface::openSnapmaticFile(SnapmaticPicture *picture)
picDialog.setModal(true);
int crewID = picture->getSnapmaticProperties().crewID;
if (crewID != 0) { crewDB->addCrew(crewID); }
if (crewID != 0)
crewDB->addCrew(crewID);
QObject::connect(threadDB, SIGNAL(crewNameUpdated()), &picDialog, SLOT(crewNameUpdated()));
QObject::connect(threadDB, SIGNAL(playerNameUpdated()), &picDialog, SLOT(playerNameUpdated()));
@ -775,11 +776,11 @@ void UserInterface::retranslateUi()
ui->labVersion->setText(QString("%1 %2").arg(GTA5SYNC_APPSTR, appVersion));
if (profileOpen)
{
this->setWindowTitle(defaultWindowTitle.arg(profileName));
setWindowTitle(defaultWindowTitle.arg(profileName));
}
else
{
this->setWindowTitle(defaultWindowTitle.arg(tr("Select Profile")));
setWindowTitle(defaultWindowTitle.arg(tr("Select Profile")));
}
}