Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 3358 → Rev 3359

/branches/Version13x/Scribus/scribus/filewatcher.h
17,15 → 17,28
public:
FileWatcher(QWidget* parent);
~FileWatcher();
bool isActive();
// Set the timer length in milliseconds
void setTimeOut(const int);
// Get the timer length
const int timeOut();
QValueList<QString> files();
public slots:
//Add a file to the watch list for monitoring
void addFile(QString fileName);
//Remove a file from the watch list
void removeFile(QString fileName);
//Add a directory to the watch list for monitoring
void addDir(QString fileName);
//Remove a directory from the watch list
void removeDir(QString fileName);
//Start the watcher's timer for file monitoring
void start();
//Stop the watcher's timer
void stop();
//Force a scan of the watched item list
void forceScan();
bool isActive();
QValueList<QString> files();
 
private:
struct fileMod
36,6 → 49,7
QMap<QString, fileMod> watchedFiles;
QTimer* watchTimer;
bool blockAddRemove;
int m_timeOut; // milliseconds
 
private slots:
void checkFiles();
/branches/Version13x/Scribus/scribus/filewatcher.cpp
13,10 → 13,11
 
FileWatcher::FileWatcher( QWidget* parent) : QObject(parent)
{
m_timeOut=10000;
watchedFiles.clear();
watchTimer = new QTimer(this);
connect(watchTimer, SIGNAL(timeout()), this, SLOT(checkFiles()));
watchTimer->start(10000, true);
watchTimer->start(m_timeOut, true);
blockAddRemove = false;
}
 
28,6 → 29,16
delete watchTimer;
}
 
void FileWatcher::setTimeOut(const int newTimeOut)
{
m_timeOut=newTimeOut;
}
 
const int FileWatcher::timeOut()
{
return m_timeOut;
}
 
void FileWatcher::addFile(QString fileName)
{
watchTimer->stop();
38,7 → 49,7
fi.timeInfo = fi.info.lastModified();
watchedFiles.insert(fileName, fi);
}
watchTimer->start(10000, true);
watchTimer->start(m_timeOut, true);
}
 
void FileWatcher::removeFile(QString fileName)
45,7 → 56,7
{
watchTimer->stop();
watchedFiles.remove(fileName);
watchTimer->start(10000, true);
watchTimer->start(m_timeOut, true);
}
 
void FileWatcher::addDir(QString fileName)
61,7 → 72,7
void FileWatcher::start()
{
watchTimer->stop();
watchTimer->start(10000, true);
watchTimer->start(m_timeOut, true);
}
 
void FileWatcher::stop()
134,6 → 145,6
}
}
blockAddRemove = false;
watchTimer->start(10000, true);
watchTimer->start(m_timeOut, true);
}