Mercurial > hg > easyhg
comparison src/mainwindow.cpp @ 541:0a16db274f2c fswatcher
Update the filesystem watcher with work directory / file state. Still doesn't track "clean" files properly unless "show all files" is enabled
author | Chris Cannam |
---|---|
date | Tue, 14 Feb 2012 16:17:23 +0000 |
parents | fc2df97920e8 |
children | 7829da6abe97 |
comparison
equal
deleted
inserted
replaced
540:fc2df97920e8 | 541:0a16db274f2c |
---|---|
66 m_showAllFiles = false; | 66 m_showAllFiles = false; |
67 | 67 |
68 m_fsWatcher = new FsWatcher(); | 68 m_fsWatcher = new FsWatcher(); |
69 m_fsWatcherToken = m_fsWatcher->getNewToken(); | 69 m_fsWatcherToken = m_fsWatcher->getNewToken(); |
70 m_commandSequenceInProgress = false; | 70 m_commandSequenceInProgress = false; |
71 connect(m_fsWatcher, SIGNAL(changed()), this, SLOT(fsWatcherChanged())); | 71 connect(m_fsWatcher, SIGNAL(changed()), this, SLOT(checkFilesystem())); |
72 | 72 |
73 m_commitsSincePush = 0; | 73 m_commitsSincePush = 0; |
74 m_shouldHgStat = true; | 74 m_shouldHgStat = true; |
75 | 75 |
76 createActions(); | 76 createActions(); |
120 this, SLOT(showAllChanged())); | 120 this, SLOT(showAllChanged())); |
121 | 121 |
122 setUnifiedTitleAndToolBarOnMac(true); | 122 setUnifiedTitleAndToolBarOnMac(true); |
123 connectActions(); | 123 connectActions(); |
124 clearState(); | 124 clearState(); |
125 updateFsWatcher(); | |
125 enableDisableActions(); | 126 enableDisableActions(); |
126 | 127 |
127 if (m_firstStart) { | 128 if (m_firstStart) { |
128 startupDialog(); | 129 startupDialog(); |
129 } | 130 } |
259 params << "stat" << "-ardum"; | 260 params << "stat" << "-ardum"; |
260 } | 261 } |
261 | 262 |
262 m_lastStatOutput = ""; | 263 m_lastStatOutput = ""; |
263 | 264 |
265 // We're about to do a stat, so we can silently bring ourselves | |
266 // up-to-date on any file changes to this point | |
267 (void)m_fsWatcher->getChangedPaths(m_fsWatcherToken); | |
268 | |
264 m_runner->requestAction(HgAction(ACT_STAT, m_workFolderPath, params)); | 269 m_runner->requestAction(HgAction(ACT_STAT, m_workFolderPath, params)); |
265 } | 270 } |
266 | 271 |
267 void MainWindow::hgQueryPaths() | 272 void MainWindow::hgQueryPaths() |
268 { | 273 { |
1422 } | 1427 } |
1423 | 1428 |
1424 if (result) { | 1429 if (result) { |
1425 enableDisableActions(); | 1430 enableDisableActions(); |
1426 clearState(); | 1431 clearState(); |
1432 updateFsWatcher(); | |
1427 hgQueryPaths(); | 1433 hgQueryPaths(); |
1428 done = true; | 1434 done = true; |
1429 } | 1435 } |
1430 | 1436 |
1431 } else { | 1437 } else { |
1507 void MainWindow::open(QString local) | 1513 void MainWindow::open(QString local) |
1508 { | 1514 { |
1509 if (openLocal(local)) { | 1515 if (openLocal(local)) { |
1510 enableDisableActions(); | 1516 enableDisableActions(); |
1511 clearState(); | 1517 clearState(); |
1518 updateFsWatcher(); | |
1512 hgQueryPaths(); | 1519 hgQueryPaths(); |
1513 } | 1520 } |
1514 } | 1521 } |
1515 | 1522 |
1516 bool MainWindow::complainAboutFilePath(QString arg) | 1523 bool MainWindow::complainAboutFilePath(QString arg) |
1813 updateToolBarStyle(); | 1820 updateToolBarStyle(); |
1814 hgRefresh(); | 1821 hgRefresh(); |
1815 } | 1822 } |
1816 } | 1823 } |
1817 | 1824 |
1825 void MainWindow::updateFsWatcher() | |
1826 { | |
1827 m_fsWatcher->setWorkDirPath(m_workFolderPath); | |
1828 m_fsWatcher->setTrackedFilePaths(m_hgTabs->getFileStates().trackedFiles()); | |
1829 } | |
1830 | |
1818 void MainWindow::checkFilesystem() | 1831 void MainWindow::checkFilesystem() |
1819 { | 1832 { |
1820 DEBUG << "MainWindow::checkFilesystem" << endl; | 1833 DEBUG << "MainWindow::checkFilesystem" << endl; |
1821 hgRefresh(); | 1834 if (!m_commandSequenceInProgress) { |
1822 } | 1835 if (!m_fsWatcher->getChangedPaths(m_fsWatcherToken).empty()) { |
1823 | 1836 hgRefresh(); |
1824 void MainWindow::fsWatcherChanged() | 1837 return; |
1825 { | 1838 } |
1826 DEBUG << "MainWindow::fsWatcherChanged" << endl; | 1839 } |
1827 | 1840 updateFsWatcher(); |
1828 } | 1841 } |
1829 | 1842 |
1830 QString MainWindow::format1(QString head) | 1843 QString MainWindow::format1(QString head) |
1831 { | 1844 { |
1832 return QString("<qt><h3>%1</h3></qt>").arg(head); | 1845 return QString("<qt><h3>%1</h3></qt>").arg(head); |
2505 m_commandSequenceInProgress = false; | 2518 m_commandSequenceInProgress = false; |
2506 m_stateUnknown = false; | 2519 m_stateUnknown = false; |
2507 enableDisableActions(); | 2520 enableDisableActions(); |
2508 m_hgTabs->updateHistory(); | 2521 m_hgTabs->updateHistory(); |
2509 updateRecentMenu(); | 2522 updateRecentMenu(); |
2523 checkFilesystem(); | |
2510 } | 2524 } |
2511 } | 2525 } |
2512 | 2526 |
2513 void MainWindow::connectActions() | 2527 void MainWindow::connectActions() |
2514 { | 2528 { |