Disabling feature for snapmatics added
This commit is contained in:
parent
01bd695022
commit
1c0ad45024
7 changed files with 231 additions and 93 deletions
|
@ -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))
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
Binary file not shown.
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue