[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdegraphics/kdvi
From: Stefan Kebekus <stefan.kebekus () uni-bayreuth ! de>
Date: 2005-03-09 13:06:11
Message-ID: 20050309130611.8616210B25 () office ! kde ! org
[Download RAW message or body]
CVS commit by kebekus:
moved the reload method
M +0 -63 kdvi_multipage.cpp 1.172
M +0 -10 kdvi_multipage.h 1.63
--- kdegraphics/kdvi/kdvi_multipage.cpp #1.171:1.172
@@ -55,5 +55,4 @@ KDVIMultiPage::KDVIMultiPage(QWidget *pa
#endif
- timer_id = -1;
setInstance(KDVIMultiPageFactory::instance());
@@ -184,7 +183,4 @@ bool KDVIMultiPage::isModified()
KDVIMultiPage::~KDVIMultiPage()
{
- if (timer_id != -1)
- killTimer(timer_id);
- timer_id = -1;
writeSettings();
Prefs::writeConfig();
@@ -449,63 +445,4 @@ bool KDVIMultiPage::print(const QStringL
-// Explanation of the timerEvent.
-//
-// This is a dreadful hack. The problem we adress with this timer
-// event is the following: the kviewshell has a KDirWatch object which
-// looks at the DVI file and calls reload() when the object has
-// changed. That works very nicely in principle, but in practise, when
-// TeX runs for several seconds over a complicated file, this does not
-// work at all. First, most of the time, while TeX is still writing,
-// the file is invalid. Thus, reload() is very often called when the
-// DVI file is bad. We solve this problem by checking the file
-// first. If the file is bad, we do not reload. Second, when the file
-// finally becomes good, it very often happens that KDirWatch does not
-// notify us anymore. Whether this is a bug or a side effect of a
-// feature of KDirWatch, I dare not say. We remedy that problem by
-// using a timer: when reload() was called on a bad file, we
-// automatically come back (via the timerEvent() function) every
-// second and check if the file became good. If so, we stop the
-// timer. It may well happen that KDirWatch calls us several times
-// while we are waiting for the file to become good, but that does not
-// do any harm.
-//
-// -- Stefan Kebekus.
-
-void KDVIMultiPage::timerEvent( QTimerEvent * )
-{
-#ifdef KDVI_MULTIPAGE_DEBUG
- kdDebug(4300) << "Timer Event " << endl;
-#endif
- reload();
-}
-
-
-void KDVIMultiPage::reload()
-{
-#ifdef KDVI_MULTIPAGE_DEBUG
- kdDebug(4300) << "Reload file " << m_file << endl;
-#endif
-
- if (DVIRenderer.isValidFile(m_file)) {
- userSelection.clear();
- Q_INT32 pg = currentPageNumber();
-
- killTimer(timer_id);
- timer_id = -1;
- bool r = DVIRenderer.setFile(m_file);
-
- generateDocumentWidgets();
- emit numberOfPages(DVIRenderer.totalPages());
- enableActions(r);
- emit setStatusBarText(QString::null);
- markList()->setCurrentPageNumber(pg);
- emit pageInfo(DVIRenderer.totalPages(), pg );
- } else {
- if (timer_id == -1)
- timer_id = startTimer(1000);
- }
-}
-
-
void KDVIMultiPage::enableActions(bool b)
{
--- kdegraphics/kdvi/kdvi_multipage.h #1.62:1.63
@@ -60,14 +60,4 @@ public slots:
virtual void preferencesChanged();
-protected:
- /// For internal use only. See the comments in kdvi_multipage.cpp, right
- //before the timerEvent function.
- int timer_id;
- /// For internal use only. See the comments in kdvi_multipage.cpp, right
- //before the timerEvent function.
- void timerEvent( QTimerEvent *e );
-
- virtual void reload();
-
protected slots:
void doExportText();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic