Disabling feature for snapmatics added

This commit is contained in:
Rafael 2016-10-27 06:50:53 +02:00
parent 01bd695022
commit 1c0ad45024
7 changed files with 231 additions and 93 deletions

View file

@ -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))
{

View file

@ -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 &GTA 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);

View file

@ -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;

View file

@ -893,8 +893,8 @@ Copyright &amp;copy; &lt;a href=&quot;https://github.com/Syping/&quot;&gt;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 &amp;copy; &lt;a href=&quot;https://github.com/Syping/&quot;&gt;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>&amp;Export</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../SnapmaticWidget.cpp" line="194"/>
<source>Export as &amp;JPG picture...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../SnapmaticWidget.cpp" line="195"/>
<source>Export as &amp;GTA Snapmatic...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../SnapmaticWidget.cpp" line="196"/>
<source>&amp;View</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../SnapmaticWidget.cpp" line="198"/>
<source>&amp;Remove</source>
<source>Edi&amp;t</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../SnapmaticWidget.cpp" line="202"/>
<location filename="../SnapmaticWidget.cpp" line="210"/>
<source>&amp;Select</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../SnapmaticWidget.cpp" line="203"/>
<source>&amp;Deselect</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../SnapmaticWidget.cpp" line="204"/>
<location filename="../SnapmaticWidget.cpp" line="211"/>
<source>Select &amp;All</source>
<location filename="../SnapmaticWidget.cpp" line="201"/>
<source>Enable &amp;In-game</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../SnapmaticWidget.cpp" line="205"/>
<source>Disable &amp;In-game</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../SnapmaticWidget.cpp" line="207"/>
<source>&amp;Export</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../SnapmaticWidget.cpp" line="208"/>
<source>Export as &amp;JPG picture...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../SnapmaticWidget.cpp" line="209"/>
<source>Export as &amp;GTA Snapmatic...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../SnapmaticWidget.cpp" line="210"/>
<source>&amp;View</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../SnapmaticWidget.cpp" line="213"/>
<source>&amp;Remove</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../SnapmaticWidget.cpp" line="217"/>
<location filename="../SnapmaticWidget.cpp" line="225"/>
<source>&amp;Select</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../SnapmaticWidget.cpp" line="218"/>
<source>&amp;Deselect</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../SnapmaticWidget.cpp" line="219"/>
<location filename="../SnapmaticWidget.cpp" line="226"/>
<source>Select &amp;All</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../SnapmaticWidget.cpp" line="220"/>
<source>&amp;Deselect All</source>
<translation type="unfinished"></translation>
</message>

View file

@ -970,65 +970,80 @@ Copyright &amp;copy; &lt;a href=&quot;https://github.com/Syping/&quot;&gt;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>&amp;Export</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../SnapmaticWidget.cpp" line="194"/>
<source>Export as &amp;JPG picture...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../SnapmaticWidget.cpp" line="195"/>
<source>Export as &amp;GTA Snapmatic...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../SnapmaticWidget.cpp" line="196"/>
<source>&amp;View</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../SnapmaticWidget.cpp" line="198"/>
<source>&amp;Remove</source>
<source>Edi&amp;t</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../SnapmaticWidget.cpp" line="202"/>
<location filename="../SnapmaticWidget.cpp" line="210"/>
<source>&amp;Select</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../SnapmaticWidget.cpp" line="203"/>
<source>&amp;Deselect</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../SnapmaticWidget.cpp" line="204"/>
<location filename="../SnapmaticWidget.cpp" line="211"/>
<source>Select &amp;All</source>
<location filename="../SnapmaticWidget.cpp" line="201"/>
<source>Enable &amp;In-game</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../SnapmaticWidget.cpp" line="205"/>
<source>Disable &amp;In-game</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../SnapmaticWidget.cpp" line="207"/>
<source>&amp;Export</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../SnapmaticWidget.cpp" line="208"/>
<source>Export as &amp;JPG picture...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../SnapmaticWidget.cpp" line="209"/>
<source>Export as &amp;GTA Snapmatic...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../SnapmaticWidget.cpp" line="210"/>
<source>&amp;View</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../SnapmaticWidget.cpp" line="213"/>
<source>&amp;Remove</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../SnapmaticWidget.cpp" line="217"/>
<location filename="../SnapmaticWidget.cpp" line="225"/>
<source>&amp;Select</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../SnapmaticWidget.cpp" line="218"/>
<source>&amp;Deselect</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../SnapmaticWidget.cpp" line="219"/>
<location filename="../SnapmaticWidget.cpp" line="226"/>
<source>Select &amp;All</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../SnapmaticWidget.cpp" line="220"/>
<source>&amp;Deselect All</source>
<translation type="unfinished"></translation>
</message>

Binary file not shown.

View file

@ -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&amp;t</source>
<translation>Bearbei&amp;ten</translation>
</message>
<message>
<location filename="../SnapmaticWidget.cpp" line="201"/>
<source>Enable &amp;In-game</source>
<translation>&amp;Im Spiel aktivieren</translation>
</message>
<message>
<location filename="../SnapmaticWidget.cpp" line="205"/>
<source>Disable &amp;In-game</source>
<translation>&amp;Im Spiel deaktivieren</translation>
</message>
<message>
<location filename="../SnapmaticWidget.cpp" line="207"/>
<source>&amp;Export</source>
<translation>&amp;Exportieren</translation>
</message>
@ -1256,44 +1271,44 @@ Exportieren als:</translation>
<translation type="obsolete">Exportiere als &amp;GTA Snapmatic</translation>
</message>
<message>
<location filename="../SnapmaticWidget.cpp" line="194"/>
<location filename="../SnapmaticWidget.cpp" line="208"/>
<source>Export as &amp;JPG picture...</source>
<translation>Exportiere als &amp;JPG Bild...</translation>
</message>
<message>
<location filename="../SnapmaticWidget.cpp" line="195"/>
<location filename="../SnapmaticWidget.cpp" line="209"/>
<source>Export as &amp;GTA Snapmatic...</source>
<translation>Exportiere als &amp;GTA Snapmatic...</translation>
</message>
<message>
<location filename="../SnapmaticWidget.cpp" line="196"/>
<location filename="../SnapmaticWidget.cpp" line="210"/>
<source>&amp;View</source>
<translation>A&amp;nsehen</translation>
</message>
<message>
<location filename="../SnapmaticWidget.cpp" line="198"/>
<location filename="../SnapmaticWidget.cpp" line="213"/>
<source>&amp;Remove</source>
<translation>Entfe&amp;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>&amp;Select</source>
<translation>Au&amp;swählen</translation>
</message>
<message>
<location filename="../SnapmaticWidget.cpp" line="203"/>
<location filename="../SnapmaticWidget.cpp" line="218"/>
<source>&amp;Deselect</source>
<translation>A&amp;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 &amp;All</source>
<translation>Alles &amp;auswählen</translation>
</message>
<message>
<location filename="../SnapmaticWidget.cpp" line="205"/>
<location filename="../SnapmaticWidget.cpp" line="220"/>
<source>&amp;Deselect All</source>
<translation>Alles a&amp;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>