Пример #1
0
void DkImageContainerT::checkForFileUpdates() {

#ifdef WITH_QUAZIP
	if(isFromZip()) 
		setFilePath(getZipData()->getZipFilePath());
#endif

	QDateTime modifiedBefore = fileInfo().lastModified();
	mFileInfo.refresh();
	
	bool changed = false;

	// if image exists_not don't do this
	if (!mFileInfo.exists() && mLoadState == loaded) {
		changed = true;
	}

	if (mFileInfo.lastModified() != modifiedBefore)
		mWaitForUpdate = true;

#ifdef WITH_QUAZIP
	if(isFromZip()) 
		setFilePath(getZipData()->getImageFileName());
#endif

	if (changed) {
		mFileUpdateTimer.stop();
		if (DkSettings::global.askToSaveDeletedFiles) {
			mEdited = changed;
			emit fileLoadedSignal(true);
		}
		return;
	}

	// we use our own file watcher, since the qt watcher
	// uses locks to check for updates. this might
	// be more accurate. however, the locks are pretty nasty
	// if the user e.g. wants to delete the file while watching
	// it in nomacs
	if (mWaitForUpdate && mFileInfo.isReadable()) {
		mWaitForUpdate = false;
		getThumb()->setImage(QImage());
		loadImageThreaded(true);
	}

}
Пример #2
0
void DkImageContainerT::checkForFileUpdates() {

#ifdef WITH_QUAZIP
	if(isFromZip()) fileInfo = zipData->getZipFileInfo();
#endif

	QDateTime modifiedBefore = fileInfo.lastModified();
	fileInfo.refresh();
	
	// if image exists_not don't do this
	if (!fileInfo.exists() && loadState == loaded) {
		edited = true;
		emit fileLoadedSignal(true);
	}


	if (fileInfo.lastModified() != modifiedBefore)
		waitForUpdate = true;

#ifdef WITH_QUAZIP
	if(isFromZip()) fileInfo = zipData->getImageFileInfo();
#endif

	if (edited) {
		fileUpdateTimer.stop();
		return;
	}

	// we use our own file watcher, since the qt watcher
	// uses locks to check for updates. this might
	// be more accurate. however, the locks are pretty nasty
	// if the user e.g. wants to delete the file while watching
	// it in nomacs
	if (waitForUpdate && fileInfo.isReadable()) {
		waitForUpdate = false;
		thumb->setImage(QImage());
		loadImageThreaded(true);
	}

}