Fixed export bug for hidden snapmatic when you have opened the file
through the Explorer as example
This commit is contained in:
parent
f645863562
commit
44c6d38d9c
5 changed files with 62 additions and 32 deletions
|
@ -301,10 +301,12 @@ void PictureDialog::copySnapmaticPicture()
|
|||
{
|
||||
if (rqfullscreen && fullscreenWidget)
|
||||
{
|
||||
QMessageBox::information(fullscreenWidget, picPath, picPath);
|
||||
PictureCopy::copyPicture(fullscreenWidget, picPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::information(this, picPath, picPath);
|
||||
PictureCopy::copyPicture(this, picPath);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,10 +79,6 @@ 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))
|
||||
{
|
||||
|
@ -484,3 +480,44 @@ QDateTime SnapmaticPicture::getCreatedDateTime()
|
|||
{
|
||||
return jsonCreatedDateTime;
|
||||
}
|
||||
|
||||
// VISIBILITY
|
||||
|
||||
bool SnapmaticPicture::isHidden()
|
||||
{
|
||||
if (picFileName.right(7) == ".hidden")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SnapmaticPicture::setPictureHidden()
|
||||
{
|
||||
if (!isHidden())
|
||||
{
|
||||
QString newPicFileName = QString(picFileName + ".hidden");
|
||||
if (QFile::rename(picFileName, newPicFileName))
|
||||
{
|
||||
picFileName = newPicFileName;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SnapmaticPicture::setPictureVisible()
|
||||
{
|
||||
if (isHidden())
|
||||
{
|
||||
QString newPicFileName = QString(picFileName).remove(picFileName.length() - 7, 7);
|
||||
if (QFile::rename(picFileName, newPicFileName))
|
||||
{
|
||||
picFileName = newPicFileName;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -57,6 +57,11 @@ public:
|
|||
double getLocationZ();
|
||||
QStringList getPlayers();
|
||||
|
||||
// VISIBILITY
|
||||
bool isHidden();
|
||||
bool setPictureHidden();
|
||||
bool setPictureVisible();
|
||||
|
||||
private:
|
||||
QString getSnapmaticPictureString(const QByteArray &snapmaticHeader);
|
||||
QString getSnapmaticJSONString(const QByteArray &jsonBytes);
|
||||
|
|
|
@ -261,48 +261,34 @@ void SnapmaticWidget::adjustTextColor()
|
|||
}
|
||||
}
|
||||
|
||||
bool SnapmaticWidget::makePictureVisible()
|
||||
void SnapmaticWidget::makePictureHidden()
|
||||
{
|
||||
if (isHidden())
|
||||
{
|
||||
QString newPicPath = QString(picPath).remove(picPath.length() - 7, 7);
|
||||
if (QFile::rename(picPath, newPicPath))
|
||||
{
|
||||
picPath = newPicPath;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
QString newPicPath = QString(picPath + ".hidden");
|
||||
picPath = newPicPath;
|
||||
}
|
||||
|
||||
bool SnapmaticWidget::makePictureHidden()
|
||||
void SnapmaticWidget::makePictureVisible()
|
||||
{
|
||||
if (!isHidden())
|
||||
{
|
||||
QString newPicPath = QString(picPath + ".hidden");
|
||||
if (QFile::rename(picPath, newPicPath))
|
||||
{
|
||||
picPath = newPicPath;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
QString newPicPath = QString(picPath).remove(picPath.length() - 7, 7);
|
||||
picPath = newPicPath;
|
||||
}
|
||||
|
||||
void SnapmaticWidget::makePictureHiddenSlot()
|
||||
{
|
||||
if (makePictureHidden())
|
||||
SnapmaticPicture *picture = (SnapmaticPicture*)smpic;
|
||||
if (picture->setPictureHidden())
|
||||
{
|
||||
makePictureHidden();
|
||||
adjustTextColor();
|
||||
}
|
||||
}
|
||||
|
||||
void SnapmaticWidget::makePictureVisibleSlot()
|
||||
{
|
||||
if (makePictureVisible())
|
||||
SnapmaticPicture *picture = (SnapmaticPicture*)smpic;
|
||||
if (picture->setPictureVisible())
|
||||
{
|
||||
makePictureVisible();
|
||||
adjustTextColor();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,8 +44,6 @@ public:
|
|||
void setSnapmaticPicture(SnapmaticPicture *picture);
|
||||
void setSelectionMode(bool selectionMode);
|
||||
void setSelected(bool isSelected);
|
||||
bool makePictureVisible();
|
||||
bool makePictureHidden();
|
||||
SnapmaticPicture *getPicture();
|
||||
QString getPicturePath();
|
||||
QString getWidgetType();
|
||||
|
@ -74,6 +72,8 @@ protected:
|
|||
void mouseReleaseEvent(QMouseEvent *ev);
|
||||
void mousePressEvent(QMouseEvent *ev);
|
||||
void contextMenuEvent(QContextMenuEvent *ev);
|
||||
void makePictureVisible();
|
||||
void makePictureHidden();
|
||||
|
||||
private:
|
||||
ProfileDatabase *profileDB;
|
||||
|
|
Loading…
Reference in a new issue