Deselect All doesn't show always anymore when checkboxes are visible

This commit is contained in:
Rafael 2016-10-27 10:35:20 +02:00
parent 48c9507aeb
commit 569b192fe6
6 changed files with 22 additions and 4 deletions

View file

@ -117,7 +117,7 @@ void ProfileInterface::savegameLoaded(SavegameData *savegame, QString savegamePa
void ProfileInterface::savegameLoaded_f(SavegameData *savegame, QString savegamePath, bool inserted) void ProfileInterface::savegameLoaded_f(SavegameData *savegame, QString savegamePath, bool inserted)
{ {
SavegameWidget *sgdWidget = new SavegameWidget(); SavegameWidget *sgdWidget = new SavegameWidget(this);
sgdWidget->setSavegameData(savegame, savegamePath); sgdWidget->setSavegameData(savegame, savegamePath);
sgdWidget->setContentMode(contentMode); sgdWidget->setContentMode(contentMode);
widgets[sgdWidget] = "SGD" + QFileInfo(savegamePath).fileName(); widgets[sgdWidget] = "SGD" + QFileInfo(savegamePath).fileName();
@ -138,7 +138,7 @@ void ProfileInterface::pictureLoaded(SnapmaticPicture *picture, QString pictureP
void ProfileInterface::pictureLoaded_f(SnapmaticPicture *picture, QString picturePath, bool inserted) void ProfileInterface::pictureLoaded_f(SnapmaticPicture *picture, QString picturePath, bool inserted)
{ {
SnapmaticWidget *picWidget = new SnapmaticWidget(profileDB, crewDB, threadDB); SnapmaticWidget *picWidget = new SnapmaticWidget(profileDB, crewDB, threadDB, this);
picWidget->setSnapmaticPicture(picture, picturePath); picWidget->setSnapmaticPicture(picture, picturePath);
picWidget->setContentMode(contentMode); picWidget->setContentMode(contentMode);
widgets[picWidget] = "PIC" + picture->getPictureSortStr(); widgets[picWidget] = "PIC" + picture->getPictureSortStr();
@ -832,3 +832,8 @@ void ProfileInterface::settingsApplied(int _contentMode, QString language)
} }
} }
} }
int ProfileInterface::selectedWidgets()
{
return selectedWidgts;
}

View file

@ -47,6 +47,7 @@ public:
void setProfileFolder(QString folder, QString profile); void setProfileFolder(QString folder, QString profile);
void settingsApplied(int contentMode, QString language); void settingsApplied(int contentMode, QString language);
void setupProfileInterface(); void setupProfileInterface();
int selectedWidgets();
~ProfileInterface(); ~ProfileInterface();
public slots: public slots:

View file

@ -56,6 +56,7 @@ SavegameWidget::SavegameWidget(QWidget *parent) :
labelAutosaveStr = tr("AUTOSAVE - %1\n%2"); labelAutosaveStr = tr("AUTOSAVE - %1\n%2");
labelSaveStr = tr("SAVE %3 - %1\n%2"); labelSaveStr = tr("SAVE %3 - %1\n%2");
snwgt = parent;
sgdPath = ""; sgdPath = "";
sgdStr = ""; sgdStr = "";
sgdata = 0; sgdata = 0;
@ -214,7 +215,11 @@ void SavegameWidget::contextMenuEvent(QContextMenuEvent *ev)
if (!ui->cbSelected->isChecked()) { contextMenu.addAction(tr("&Select"), this, SLOT(savegameSelected())); } if (!ui->cbSelected->isChecked()) { contextMenu.addAction(tr("&Select"), this, SLOT(savegameSelected())); }
if (ui->cbSelected->isChecked()) { contextMenu.addAction(tr("&Deselect"), 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")); contextMenu.addAction(tr("Select &All"), this, SLOT(selectAllWidgets()), QKeySequence::fromString("Ctrl+A"));
contextMenu.addAction(tr("&Deselect All"), this, SLOT(deselectAllWidgets()), QKeySequence::fromString("Ctrl+D")); ProfileInterface *profileInterface = (ProfileInterface*)snwgt;
if (profileInterface->selectedWidgets() != 0)
{
contextMenu.addAction(tr("&Deselect All"), this, SLOT(deselectAllWidgets()), QKeySequence::fromString("Ctrl+D"));
}
} }
else else
{ {

View file

@ -70,6 +70,7 @@ private:
QString labelSaveStr; QString labelSaveStr;
QString sgdPath; QString sgdPath;
QString sgdStr; QString sgdStr;
QWidget *snwgt;
signals: signals:
void savegameDeleted(); void savegameDeleted();

View file

@ -47,6 +47,7 @@ SnapmaticWidget::SnapmaticWidget(ProfileDatabase *profileDB, CrewDatabase *crewD
palette.setCurrentColorGroup(QPalette::Disabled); palette.setCurrentColorGroup(QPalette::Disabled);
highlightHiddenColor = palette.text().color(); highlightHiddenColor = palette.text().color();
snwgt = parent;
picPath = ""; picPath = "";
picStr = ""; picStr = "";
smpic = 0; smpic = 0;
@ -216,7 +217,11 @@ void SnapmaticWidget::contextMenuEvent(QContextMenuEvent *ev)
if (!ui->cbSelected->isChecked()) { contextMenu.addAction(tr("&Select"), this, SLOT(pictureSelected())); } if (!ui->cbSelected->isChecked()) { contextMenu.addAction(tr("&Select"), this, SLOT(pictureSelected())); }
if (ui->cbSelected->isChecked()) { contextMenu.addAction(tr("&Deselect"), 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")); contextMenu.addAction(tr("Select &All"), this, SLOT(selectAllWidgets()), QKeySequence::fromString("Ctrl+A"));
contextMenu.addAction(tr("&Deselect All"), this, SLOT(deselectAllWidgets()), QKeySequence::fromString("Ctrl+D")); ProfileInterface *profileInterface = (ProfileInterface*)snwgt;
if (profileInterface->selectedWidgets() != 0)
{
contextMenu.addAction(tr("&Deselect All"), this, SLOT(deselectAllWidgets()), QKeySequence::fromString("Ctrl+D"));
}
} }
else else
{ {

View file

@ -87,6 +87,7 @@ private:
QString picPath; QString picPath;
QString picTitl; QString picTitl;
QString picStr; QString picStr;
QWidget *snwgt;
signals: signals:
void pictureDeleted(); void pictureDeleted();