diff --git a/SnapmaticPicture.cpp b/SnapmaticPicture.cpp index 2bb28e7..3fcd246 100755 --- a/SnapmaticPicture.cpp +++ b/SnapmaticPicture.cpp @@ -79,6 +79,10 @@ bool SnapmaticPicture::readingPicture(bool writeEnabled_) QFile *picFile = new QFile(picFileName); QIODevice *picStream; + if (picFileName.right(7) == ".hidden") // for the hidden file system + { + picFileName.remove(picFileName.length() - 7, 7); + } if (!picFile->open(QFile::ReadOnly)) { diff --git a/SnapmaticWidget.cpp b/SnapmaticWidget.cpp index 8fe57ec..340c815 100755 --- a/SnapmaticWidget.cpp +++ b/SnapmaticWidget.cpp @@ -44,6 +44,8 @@ SnapmaticWidget::SnapmaticWidget(ProfileDatabase *profileDB, CrewDatabase *crewD QPalette palette; highlightBackColor = palette.highlight().color(); highlightTextColor = palette.highlightedText().color(); + palette.setCurrentColorGroup(QPalette::Disabled); + highlightHiddenColor = palette.text().color(); picPath = ""; picStr = ""; @@ -79,6 +81,7 @@ void SnapmaticWidget::setSnapmaticPicture(SnapmaticPicture *picture, QString pic { smpic = picture; picPath = picturePath; + qDebug() << picPath; picStr = picture->getPictureStr(); picTitl = picture->getPictureTitl(); @@ -86,6 +89,8 @@ void SnapmaticWidget::setSnapmaticPicture(SnapmaticPicture *picture, QString pic SnapmaticPixmap.scaled(ui->labPicture->width(), ui->labPicture->height(), Qt::KeepAspectRatio, Qt::SmoothTransformation); ui->labPicStr->setText(picStr + "\n" + picTitl + ""); ui->labPicture->setPixmap(SnapmaticPixmap); + + adjustTextColor(); } void SnapmaticWidget::setSnapmaticPicture(SnapmaticPicture *picture) @@ -190,10 +195,20 @@ void SnapmaticWidget::pictureSelected() void SnapmaticWidget::contextMenuEvent(QContextMenuEvent *ev) { QMenu contextMenu(this); + QMenu editMenu(tr("Edi&t"), this); + if (isHidden()) + { + editMenu.addAction(tr("Enable &In-game"), this, SLOT(makePictureVisibleSlot())); + } + else + { + editMenu.addAction(tr("Disable &In-game"), this, SLOT(makePictureHiddenSlot())); + } 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()) @@ -235,11 +250,78 @@ void SnapmaticWidget::on_cbSelected_stateChanged(int arg1) } } +void SnapmaticWidget::adjustTextColor() +{ + if (isHidden()) + { + ui->labPicStr->setStyleSheet(QString("QLabel{color: rgb(%1, %2, %3);}").arg(QString::number(highlightHiddenColor.red()), QString::number(highlightHiddenColor.green()), QString::number(highlightHiddenColor.blue()))); + } + else + { + ui->labPicStr->setStyleSheet(""); + } +} + +bool SnapmaticWidget::makePictureVisible() +{ + if (isHidden()) + { + QString newPicPath = QString(picPath).remove(picPath.length() - 7, 7); + if (QFile::rename(picPath, newPicPath)) + { + picPath = newPicPath; + return true; + } + return false; + } + return true; +} + +bool SnapmaticWidget::makePictureHidden() +{ + if (!isHidden()) + { + QString newPicPath = QString(picPath + ".hidden"); + if (QFile::rename(picPath, newPicPath)) + { + picPath = newPicPath; + return true; + } + return false; + } + return true; +} + +void SnapmaticWidget::makePictureHiddenSlot() +{ + if (makePictureHidden()) + { + adjustTextColor(); + } +} + +void SnapmaticWidget::makePictureVisibleSlot() +{ + if (makePictureVisible()) + { + adjustTextColor(); + } +} + bool SnapmaticWidget::isSelected() { return ui->cbSelected->isChecked(); } +bool SnapmaticWidget::isHidden() +{ + if (picPath.right(7) == ".hidden") + { + return true; + } + return false; +} + void SnapmaticWidget::setSelectionMode(bool selectionMode) { ui->cbSelected->setVisible(selectionMode); diff --git a/SnapmaticWidget.h b/SnapmaticWidget.h index 1c85fff..e02faf1 100755 --- a/SnapmaticWidget.h +++ b/SnapmaticWidget.h @@ -44,9 +44,12 @@ public: void setSnapmaticPicture(SnapmaticPicture *picture); void setSelectionMode(bool selectionMode); void setSelected(bool isSelected); + bool makePictureVisible(); + bool makePictureHidden(); SnapmaticPicture *getPicture(); QString getWidgetType(); bool isSelected(); + bool isHidden(); ~SnapmaticWidget(); private slots: @@ -55,9 +58,12 @@ private slots: void on_cmdExport_clicked(); void on_cmdDelete_clicked(); void on_cbSelected_stateChanged(int arg1); + void adjustTextColor(); void pictureSelected(); void selectAllWidgets(); void deselectAllWidgets(); + void makePictureHiddenSlot(); + void makePictureVisibleSlot(); void dialogNextPictureRequested(); void dialogPreviousPictureRequested(); @@ -76,6 +82,7 @@ private: SnapmaticPicture *smpic; QColor highlightBackColor; QColor highlightTextColor; + QColor highlightHiddenColor; QString picPath; QString picTitl; QString picStr; diff --git a/lang/gta5sync_fr.ts b/lang/gta5sync_fr.ts index f792fc9..60f8602 100644 --- a/lang/gta5sync_fr.ts +++ b/lang/gta5sync_fr.ts @@ -893,8 +893,8 @@ Copyright &copy; <a href="https://github.com/Syping/">Syping - - + + Delete picture @@ -904,59 +904,74 @@ Copyright &copy; <a href="https://github.com/Syping/">Syping - + Are you sure to delete %1 from your Snapmatic pictures? - + Failed at deleting %1 from your Snapmatic pictures - - - &Export - - - - - Export as &JPG picture... - - - - - Export as &GTA Snapmatic... - - - - - &View - - - &Remove + Edi&t - - - &Select - - - - - &Deselect - - - - - - Select &All + + Enable &In-game + Disable &In-game + + + + + &Export + + + + + Export as &JPG picture... + + + + + Export as &GTA Snapmatic... + + + + + &View + + + + + &Remove + + + + + + &Select + + + + + &Deselect + + + + + + Select &All + + + + &Deselect All diff --git a/lang/gta5sync_ru.ts b/lang/gta5sync_ru.ts index d5244b7..3c59def 100755 --- a/lang/gta5sync_ru.ts +++ b/lang/gta5sync_ru.ts @@ -970,65 +970,80 @@ Copyright &copy; <a href="https://github.com/Syping/">Syping - - + + Delete picture Удалить картинку - + Are you sure to delete %1 from your Snapmatic pictures? Уверены, что хотите удалить %1 из коллекции картинок Snapmatic? - + Failed at deleting %1 from your Snapmatic pictures Не удалось удалить %1 из колелкции картинок Snapmatic - - - &Export - - - - - Export as &JPG picture... - - - - - Export as &GTA Snapmatic... - - - - - &View - - - &Remove + Edi&t - - - &Select - - - - - &Deselect - - - - - - Select &All + + Enable &In-game + Disable &In-game + + + + + &Export + + + + + Export as &JPG picture... + + + + + Export as &GTA Snapmatic... + + + + + &View + + + + + &Remove + + + + + + &Select + + + + + &Deselect + + + + + + Select &All + + + + &Deselect All diff --git a/res/gta5sync_de.qm b/res/gta5sync_de.qm index f346880..2d61664 100755 Binary files a/res/gta5sync_de.qm and b/res/gta5sync_de.qm differ diff --git a/res/gta5sync_de.ts b/res/gta5sync_de.ts index b9e4d65..b465165 100755 --- a/res/gta5sync_de.ts +++ b/res/gta5sync_de.ts @@ -1232,18 +1232,33 @@ Exportieren als: - - + + Delete picture Bild löschen - + Are you sure to delete %1 from your Snapmatic pictures? Bist du sicher %1 von deinen Snapmatic Bilder zu löschen? - + + Edi&t + Bearbei&ten + + + + Enable &In-game + &Im Spiel aktivieren + + + + Disable &In-game + &Im Spiel deaktivieren + + + &Export &Exportieren @@ -1256,44 +1271,44 @@ Exportieren als: Exportiere als &GTA Snapmatic - + Export as &JPG picture... Exportiere als &JPG Bild... - + Export as &GTA Snapmatic... Exportiere als &GTA Snapmatic... - + &View A&nsehen - + &Remove Entfe&rnen - - + + &Select Au&swählen - + &Deselect A&bwählen - - + + Select &All Alles &auswählen - + &Deselect All Alles a&bwählen @@ -1341,7 +1356,7 @@ Exportieren als: Bist du sicher %1 von deinen Snapmatic Bilder zu löschen? - + Failed at deleting %1 from your Snapmatic pictures Fehlgeschlagen beim Löschen %1 von deinen Snapmatic Bildern