From 1c0ad450240f5317e9f5d77fcf22194c5adeac6f Mon Sep 17 00:00:00 2001 From: Rafael <Syping@users.noreply.github.com> Date: Thu, 27 Oct 2016 06:50:53 +0200 Subject: [PATCH] Disabling feature for snapmatics added --- SnapmaticPicture.cpp | 4 ++ SnapmaticWidget.cpp | 82 ++++++++++++++++++++++++++++++++++++++ SnapmaticWidget.h | 7 ++++ lang/gta5sync_fr.ts | 93 +++++++++++++++++++++++++------------------ lang/gta5sync_ru.ts | 93 +++++++++++++++++++++++++------------------ res/gta5sync_de.qm | Bin 23806 -> 24080 bytes res/gta5sync_de.ts | 45 ++++++++++++++------- 7 files changed, 231 insertions(+), 93 deletions(-) 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 </message> <message> <location filename="../SnapmaticWidget.ui" line="125"/> - <location filename="../SnapmaticWidget.cpp" line="128"/> - <location filename="../SnapmaticWidget.cpp" line="141"/> + <location filename="../SnapmaticWidget.cpp" line="133"/> + <location filename="../SnapmaticWidget.cpp" line="146"/> <source>Delete picture</source> <translation type="unfinished"></translation> </message> @@ -904,59 +904,74 @@ Copyright &copy; <a href="https://github.com/Syping/">Syping <translation type="unfinished"></translation> </message> <message> - <location filename="../SnapmaticWidget.cpp" line="128"/> + <location filename="../SnapmaticWidget.cpp" line="133"/> <source>Are you sure to delete %1 from your Snapmatic pictures?</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../SnapmaticWidget.cpp" line="141"/> + <location filename="../SnapmaticWidget.cpp" line="146"/> <source>Failed at deleting %1 from your Snapmatic pictures</source> <translation type="unfinished"></translation> </message> - <message> - <location filename="../SnapmaticWidget.cpp" line="193"/> - <source>&Export</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="../SnapmaticWidget.cpp" line="194"/> - <source>Export as &JPG picture...</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="../SnapmaticWidget.cpp" line="195"/> - <source>Export as &GTA Snapmatic...</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="../SnapmaticWidget.cpp" line="196"/> - <source>&View</source> - <translation type="unfinished"></translation> - </message> <message> <location filename="../SnapmaticWidget.cpp" line="198"/> - <source>&Remove</source> + <source>Edi&t</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../SnapmaticWidget.cpp" line="202"/> - <location filename="../SnapmaticWidget.cpp" line="210"/> - <source>&Select</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="../SnapmaticWidget.cpp" line="203"/> - <source>&Deselect</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="../SnapmaticWidget.cpp" line="204"/> - <location filename="../SnapmaticWidget.cpp" line="211"/> - <source>Select &All</source> + <location filename="../SnapmaticWidget.cpp" line="201"/> + <source>Enable &In-game</source> <translation type="unfinished"></translation> </message> <message> <location filename="../SnapmaticWidget.cpp" line="205"/> + <source>Disable &In-game</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../SnapmaticWidget.cpp" line="207"/> + <source>&Export</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../SnapmaticWidget.cpp" line="208"/> + <source>Export as &JPG picture...</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../SnapmaticWidget.cpp" line="209"/> + <source>Export as &GTA Snapmatic...</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../SnapmaticWidget.cpp" line="210"/> + <source>&View</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../SnapmaticWidget.cpp" line="213"/> + <source>&Remove</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../SnapmaticWidget.cpp" line="217"/> + <location filename="../SnapmaticWidget.cpp" line="225"/> + <source>&Select</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../SnapmaticWidget.cpp" line="218"/> + <source>&Deselect</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../SnapmaticWidget.cpp" line="219"/> + <location filename="../SnapmaticWidget.cpp" line="226"/> + <source>Select &All</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../SnapmaticWidget.cpp" line="220"/> <source>&Deselect All</source> <translation type="unfinished"></translation> </message> 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 </message> <message> <location filename="../SnapmaticWidget.ui" line="125"/> - <location filename="../SnapmaticWidget.cpp" line="128"/> - <location filename="../SnapmaticWidget.cpp" line="141"/> + <location filename="../SnapmaticWidget.cpp" line="133"/> + <location filename="../SnapmaticWidget.cpp" line="146"/> <source>Delete picture</source> <translation>Удалить картинку</translation> </message> <message> - <location filename="../SnapmaticWidget.cpp" line="128"/> + <location filename="../SnapmaticWidget.cpp" line="133"/> <source>Are you sure to delete %1 from your Snapmatic pictures?</source> <translation>Уверены, что хотите удалить %1 из коллекции картинок Snapmatic?</translation> </message> <message> - <location filename="../SnapmaticWidget.cpp" line="141"/> + <location filename="../SnapmaticWidget.cpp" line="146"/> <source>Failed at deleting %1 from your Snapmatic pictures</source> <translation>Не удалось удалить %1 из колелкции картинок Snapmatic </translation> </message> - <message> - <location filename="../SnapmaticWidget.cpp" line="193"/> - <source>&Export</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="../SnapmaticWidget.cpp" line="194"/> - <source>Export as &JPG picture...</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="../SnapmaticWidget.cpp" line="195"/> - <source>Export as &GTA Snapmatic...</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="../SnapmaticWidget.cpp" line="196"/> - <source>&View</source> - <translation type="unfinished"></translation> - </message> <message> <location filename="../SnapmaticWidget.cpp" line="198"/> - <source>&Remove</source> + <source>Edi&t</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../SnapmaticWidget.cpp" line="202"/> - <location filename="../SnapmaticWidget.cpp" line="210"/> - <source>&Select</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="../SnapmaticWidget.cpp" line="203"/> - <source>&Deselect</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="../SnapmaticWidget.cpp" line="204"/> - <location filename="../SnapmaticWidget.cpp" line="211"/> - <source>Select &All</source> + <location filename="../SnapmaticWidget.cpp" line="201"/> + <source>Enable &In-game</source> <translation type="unfinished"></translation> </message> <message> <location filename="../SnapmaticWidget.cpp" line="205"/> + <source>Disable &In-game</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../SnapmaticWidget.cpp" line="207"/> + <source>&Export</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../SnapmaticWidget.cpp" line="208"/> + <source>Export as &JPG picture...</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../SnapmaticWidget.cpp" line="209"/> + <source>Export as &GTA Snapmatic...</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../SnapmaticWidget.cpp" line="210"/> + <source>&View</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../SnapmaticWidget.cpp" line="213"/> + <source>&Remove</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../SnapmaticWidget.cpp" line="217"/> + <location filename="../SnapmaticWidget.cpp" line="225"/> + <source>&Select</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../SnapmaticWidget.cpp" line="218"/> + <source>&Deselect</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../SnapmaticWidget.cpp" line="219"/> + <location filename="../SnapmaticWidget.cpp" line="226"/> + <source>Select &All</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../SnapmaticWidget.cpp" line="220"/> <source>&Deselect All</source> <translation type="unfinished"></translation> </message> diff --git a/res/gta5sync_de.qm b/res/gta5sync_de.qm index f346880cec1c55ec26fb6b2649dfec2072989a0b..2d6166465957df5c884117a3ee4871f5f29e0dd9 100755 GIT binary patch delta 687 zcmZwET}YEr7zgnG`=xvLPDxD3Q8~1|<ZLo8lxWa}wRgVzQm0e8FxYg($gMD4K`4Fc zO}P(FIS6kAg<yn)1cgyZbQPvh76j2ndQk-3q}7GmQ@iM*E)KtQp7WgZ@SL;#h|4_Y zGP}9U*$R#Cn#=a8HopYJbPy;pz_uU)ffKMT|8^3#6)Vu@fbENe?91NUZ*G4G_t<No zX%wF3+rXY3c=NQ@mF)XwK44-MTm#<`VlGbO{VQyOYcTun3znC!0Er2fHPU}gXd2!i zootm0v;_OaeCitz%#jrCEGEB`7s#Jvp4=fni1{>tu5ywi-K0QXVo_e@^;tH-t2Mzg zNle}X9K%xO-5gNeDB0tqK-GhSo_@AU*?}dt#V3vJuHu=+1ogJbMud|!-VIs(Q44tM z<hqMdz;L9X>6z@#r6_HZZ3(K`^H!ezyh=TL<e9|)5K`sYN(pGqGrM@y?28zkr=}=8 zX!L*5fnzs}Jzq<K?gMO0O!7S{+Y;4C`-pN=TL+xhf?BPT+TKgg@IpyrjoNi8Q}x$r zzptPcQJ%z~(=BgEI@dj}EDup*p{L5`!aJb&a6x6CNxb8tXZgs+B#rMVWlPdHudlOE zQ9a*tmi3zK^K(U4TWb$Ng^oBZ=)^h15XAt^`^hlQV2C0~cBQ7gY}fJF`EX<)YEkus z{d71UWf@<UwGu6VG6xYMV|3RLnJ~}?p@@d$>W`@`?K4*&{BNDVH8@vAY2u#(^Nnpw GCBFcTPQbhX delta 483 zcmXBPO-NKx6bJDCyYD@ndDm$nN+l_h_@FmtZ5$*)(DFH7Z$A8L5fvDQ2IES_O+tPI zp^OfPL6Dh6;cjRl5+a%)A?>m-Tu8HX7LpJ_pCsyuS^YTo-gD3SFKjBO>&ilfGMK8g zMfaQ3ebWj{xL$Sv9v7?)4R9X9+Wl_^*2j7v;)8X3lO0OEt|^ahp>yUl&@_RdFAZEe zOBH;=DW__sQN-?%qu3(6PidvGDzv87e%J$aQfm*{@C&tR^e5X!c_q>wAJTHkA3!|I z@^P1k{mnjQ|FSFW8C%eD^8mUpvkL35D*KEQ!W8}-rJ49edMj!~;0fiqa`s49$BbyG zba{K2S3jW{^}*HPKezd(4hY_GUmG6)T(^pry>oXiCiz*0bj>sZdH3>m1n6m?4z0B+ zG-$Lu&Tu(yI7b2C_N;OD+XbN4qO3M1`WmQGH~XVga?UOQE%in1I+;AZ!s$NAc^q<z zHkt8G^ZlcucE8+8?C>vNSnlhcle;4mJY`4z+Bg78n~TcoGHt1Y(;iV)w?(Xi3i@;5 d|4NAxujm`4@2%HY-<M4KY3+`8bvX9Qa}H%#lXd_A 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:</translation> </message> <message> <location filename="../SnapmaticWidget.ui" line="125"/> - <location filename="../SnapmaticWidget.cpp" line="128"/> - <location filename="../SnapmaticWidget.cpp" line="141"/> + <location filename="../SnapmaticWidget.cpp" line="133"/> + <location filename="../SnapmaticWidget.cpp" line="146"/> <source>Delete picture</source> <translation>Bild löschen</translation> </message> <message> - <location filename="../SnapmaticWidget.cpp" line="128"/> + <location filename="../SnapmaticWidget.cpp" line="133"/> <source>Are you sure to delete %1 from your Snapmatic pictures?</source> <translation>Bist du sicher %1 von deinen Snapmatic Bilder zu löschen?</translation> </message> <message> - <location filename="../SnapmaticWidget.cpp" line="193"/> + <location filename="../SnapmaticWidget.cpp" line="198"/> + <source>Edi&t</source> + <translation>Bearbei&ten</translation> + </message> + <message> + <location filename="../SnapmaticWidget.cpp" line="201"/> + <source>Enable &In-game</source> + <translation>&Im Spiel aktivieren</translation> + </message> + <message> + <location filename="../SnapmaticWidget.cpp" line="205"/> + <source>Disable &In-game</source> + <translation>&Im Spiel deaktivieren</translation> + </message> + <message> + <location filename="../SnapmaticWidget.cpp" line="207"/> <source>&Export</source> <translation>&Exportieren</translation> </message> @@ -1256,44 +1271,44 @@ Exportieren als:</translation> <translation type="obsolete">Exportiere als &GTA Snapmatic</translation> </message> <message> - <location filename="../SnapmaticWidget.cpp" line="194"/> + <location filename="../SnapmaticWidget.cpp" line="208"/> <source>Export as &JPG picture...</source> <translation>Exportiere als &JPG Bild...</translation> </message> <message> - <location filename="../SnapmaticWidget.cpp" line="195"/> + <location filename="../SnapmaticWidget.cpp" line="209"/> <source>Export as &GTA Snapmatic...</source> <translation>Exportiere als &GTA Snapmatic...</translation> </message> <message> - <location filename="../SnapmaticWidget.cpp" line="196"/> + <location filename="../SnapmaticWidget.cpp" line="210"/> <source>&View</source> <translation>A&nsehen</translation> </message> <message> - <location filename="../SnapmaticWidget.cpp" line="198"/> + <location filename="../SnapmaticWidget.cpp" line="213"/> <source>&Remove</source> <translation>Entfe&rnen</translation> </message> <message> - <location filename="../SnapmaticWidget.cpp" line="202"/> - <location filename="../SnapmaticWidget.cpp" line="210"/> + <location filename="../SnapmaticWidget.cpp" line="217"/> + <location filename="../SnapmaticWidget.cpp" line="225"/> <source>&Select</source> <translation>Au&swählen</translation> </message> <message> - <location filename="../SnapmaticWidget.cpp" line="203"/> + <location filename="../SnapmaticWidget.cpp" line="218"/> <source>&Deselect</source> <translation>A&bwählen</translation> </message> <message> - <location filename="../SnapmaticWidget.cpp" line="204"/> - <location filename="../SnapmaticWidget.cpp" line="211"/> + <location filename="../SnapmaticWidget.cpp" line="219"/> + <location filename="../SnapmaticWidget.cpp" line="226"/> <source>Select &All</source> <translation>Alles &auswählen</translation> </message> <message> - <location filename="../SnapmaticWidget.cpp" line="205"/> + <location filename="../SnapmaticWidget.cpp" line="220"/> <source>&Deselect All</source> <translation>Alles a&bwählen</translation> </message> @@ -1341,7 +1356,7 @@ Exportieren als:</translation> <translation type="obsolete">Bist du sicher %1 von deinen Snapmatic Bilder zu löschen?</translation> </message> <message> - <location filename="../SnapmaticWidget.cpp" line="141"/> + <location filename="../SnapmaticWidget.cpp" line="146"/> <source>Failed at deleting %1 from your Snapmatic pictures</source> <translation>Fehlgeschlagen beim Löschen %1 von deinen Snapmatic Bildern</translation> </message>