# HG changeset patch # User Chris Cannam # Date 1329238081 0 # Node ID 7829da6abe975f9c959dc901863c872e158d13fd # Parent 0a16db274f2cec512a80df1ab0e6e459cc0df66e Provide all tracked files to the fs watcher, so now we get updates properly -- requires moving the "what should we display?" logic for show-all-files toggle from main window to file status widget, but it's probably better there anyway diff -r 0a16db274f2c -r 7829da6abe97 src/filestatuswidget.cpp --- a/src/filestatuswidget.cpp Tue Feb 14 16:17:23 2012 +0000 +++ b/src/filestatuswidget.cpp Tue Feb 14 16:48:01 2012 +0000 @@ -178,6 +178,13 @@ return m_showAllFiles->isChecked(); } +bool FileStatusWidget::shouldShow(FileStates::State s) const +{ + if (shouldShowAll()) return true; + else return (s != FileStates::Clean && + s != FileStates::Ignored); +} + QString FileStatusWidget::labelFor(FileStates::State s, bool addHighlightExplanation) { QSettings settings; @@ -193,11 +200,9 @@ .arg(m_simpleLabels[s]) .arg(m_descriptions[s]); } - } else { - return QString("%1") - .arg(m_simpleLabels[s]); } - settings.endGroup(); + return QString("%1") + .arg(m_simpleLabels[s]); } void FileStatusWidget::setNoModificationsLabelText() @@ -425,6 +430,12 @@ QListWidget *w = m_stateListMap[s]; w->clear(); + + if (!shouldShow(s)) { + w->parentWidget()->hide(); + continue; + } + QStringList files = m_fileStates.filesInState(s); QStringList highPriority, lowPriority; diff -r 0a16db274f2c -r 7829da6abe97 src/filestatuswidget.h --- a/src/filestatuswidget.h Tue Feb 14 16:17:23 2012 +0000 +++ b/src/filestatuswidget.h Tue Feb 14 16:48:01 2012 +0000 @@ -55,6 +55,7 @@ QStringList getSelectedRemovableFiles() const; bool shouldShowAll() const; + bool shouldShow(FileStates::State) const; signals: void selectionChanged(); diff -r 0a16db274f2c -r 7829da6abe97 src/fswatcher.cpp --- a/src/fswatcher.cpp Tue Feb 14 16:17:23 2012 +0000 +++ b/src/fswatcher.cpp Tue Feb 14 16:48:01 2012 +0000 @@ -82,6 +82,7 @@ QSet::fromList(m_watcher.files()); foreach (QString path, paths) { + path = m_workDirPath + QDir::separator() + path; if (!alreadyWatched.contains(path)) { m_watcher.addPath(path); } else { diff -r 0a16db274f2c -r 7829da6abe97 src/fswatcher.h --- a/src/fswatcher.h Tue Feb 14 16:17:23 2012 +0000 +++ b/src/fswatcher.h Tue Feb 14 16:48:01 2012 +0000 @@ -49,7 +49,8 @@ /** * Provide a set of paths for files which should be tracked. These - * will be the only non-directory files monitored for changes. + * will be the only non-directory files monitored for changes. The + * paths should be relative to the work directory. */ void setTrackedFilePaths(QStringList paths); diff -r 0a16db274f2c -r 7829da6abe97 src/mainwindow.cpp --- a/src/mainwindow.cpp Tue Feb 14 16:17:23 2012 +0000 +++ b/src/mainwindow.cpp Tue Feb 14 16:48:01 2012 +0000 @@ -122,7 +122,6 @@ setUnifiedTitleAndToolBarOnMac(true); connectActions(); clearState(); - updateFsWatcher(); enableDisableActions(); if (m_firstStart) { @@ -254,11 +253,9 @@ { QStringList params; - if (m_showAllFiles) { - params << "stat" << "-A"; - } else { - params << "stat" << "-ardum"; - } + // We always stat all files, regardless of whether we're showing + // them all, because we need them for the filesystem monitor + params << "stat" << "-A"; m_lastStatOutput = ""; @@ -1429,7 +1426,6 @@ if (result) { enableDisableActions(); clearState(); - updateFsWatcher(); hgQueryPaths(); done = true; } @@ -1515,7 +1511,6 @@ if (openLocal(local)) { enableDisableActions(); clearState(); - updateFsWatcher(); hgQueryPaths(); } }