Mercurial > hg > easyhg
comparison mainwindow.cpp @ 115:78374cefa10f
* Add useful state message to file status page.
Also add shouldBeFast() method to HgAction; use it to avoid showing progress bar for fast actions
author | Chris Cannam |
---|---|
date | Fri, 26 Nov 2010 21:48:25 +0000 |
parents | bb2d2eecdd60 |
children | 807c79350bf1 |
comparison
equal
deleted
inserted
replaced
114:bb2d2eecdd60 | 115:78374cefa10f |
---|---|
174 runner->requestAction(HgAction(ACT_QUERY_HEADS, workFolderPath, params)); | 174 runner->requestAction(HgAction(ACT_QUERY_HEADS, workFolderPath, params)); |
175 } | 175 } |
176 | 176 |
177 void MainWindow::hgLog() | 177 void MainWindow::hgLog() |
178 { | 178 { |
179 //!!! This needs to be incremental, except when we pull or set new repo | 179 //!!! This needs to be incremental, except when we pull or set new repo. |
180 // Be sure to use ACT_LOG_INCREMENTAL for incremental logs | |
180 QStringList params; | 181 QStringList params; |
181 params << "log"; | 182 params << "log"; |
182 params << "--template"; | 183 params << "--template"; |
183 params << "id: {rev}:{node|short}\\nauthor: {author}\\nbranch: {branches}\\ntag: {tag}\\ndatetime: {date|isodate}\\ntimestamp: {date|hgdate}\\nage: {date|age}\\nparents: {parents}\\ncomment: {desc|json}\\n\\n"; | 184 params << "id: {rev}:{node|short}\\nauthor: {author}\\nbranch: {branches}\\ntag: {tag}\\ndatetime: {date|isodate}\\ntimestamp: {date|hgdate}\\nage: {date|age}\\nparents: {parents}\\ncomment: {desc|json}\\n\\n"; |
184 | 185 |
979 pending.pop_front(); | 980 pending.pop_front(); |
980 fsWatcher->addPath(path); | 981 fsWatcher->addPath(path); |
981 DEBUG << "Added to file system watcher: " << path << endl; | 982 DEBUG << "Added to file system watcher: " << path << endl; |
982 QDir d(path); | 983 QDir d(path); |
983 if (d.exists()) { | 984 if (d.exists()) { |
984 d.setFilter(QDir::Files | QDir::Dirs | | 985 d.setFilter(QDir::Dirs | QDir::NoDotAndDotDot | QDir::Readable); |
985 QDir::NoDotAndDotDot | QDir::Readable); | |
986 foreach (QString entry, d.entryList()) { | 986 foreach (QString entry, d.entryList()) { |
987 if (entry == ".hg") continue; | 987 if (entry == ".hg") continue; |
988 QString entryPath = d.absoluteFilePath(entry); | 988 QString entryPath = d.absoluteFilePath(entry); |
989 pending.push_back(entryPath); | 989 pending.push_back(entryPath); |
990 } | 990 } |
1075 DEBUG << "Set remote path to " << remoteRepoPath << endl; | 1075 DEBUG << "Set remote path to " << remoteRepoPath << endl; |
1076 } | 1076 } |
1077 MultiChoiceDialog::addRecentArgument("local", workFolderPath); | 1077 MultiChoiceDialog::addRecentArgument("local", workFolderPath); |
1078 MultiChoiceDialog::addRecentArgument("remote", remoteRepoPath); | 1078 MultiChoiceDialog::addRecentArgument("remote", remoteRepoPath); |
1079 hgTabs->setWorkFolderAndRepoNames(workFolderPath, remoteRepoPath); | 1079 hgTabs->setWorkFolderAndRepoNames(workFolderPath, remoteRepoPath); |
1080 enableDisableActions(); | |
1081 break; | 1080 break; |
1082 } | 1081 } |
1083 | 1082 |
1084 case ACT_QUERY_BRANCH: | 1083 case ACT_QUERY_BRANCH: |
1085 currentBranch = output.trimmed(); | 1084 currentBranch = output.trimmed(); |
1086 hgTabs->setBranch(currentBranch); | |
1087 break; | 1085 break; |
1088 | 1086 |
1089 case ACT_STAT: | 1087 case ACT_STAT: |
1090 hgTabs->updateWorkFolderFileList(output); | 1088 hgTabs->updateWorkFolderFileList(output); |
1091 updateFileSystemWatcher(); | 1089 updateFileSystemWatcher(); |
1257 */ | 1255 */ |
1258 void MainWindow::enableDisableActions() | 1256 void MainWindow::enableDisableActions() |
1259 { | 1257 { |
1260 DEBUG << "MainWindow::enableDisableActions" << endl; | 1258 DEBUG << "MainWindow::enableDisableActions" << endl; |
1261 | 1259 |
1260 //!!! should also do things like set the status texts for the | |
1261 //!!! actions appropriately by context | |
1262 | |
1262 QDir localRepoDir; | 1263 QDir localRepoDir; |
1263 QDir workFolderDir; | 1264 QDir workFolderDir; |
1264 bool workFolderExist; | 1265 bool workFolderExist; |
1265 bool localRepoExist; | 1266 bool localRepoExist; |
1266 | 1267 |
1365 } | 1366 } |
1366 } | 1367 } |
1367 } | 1368 } |
1368 hgMergeAct->setEnabled(localRepoActionsEnabled && canMerge); | 1369 hgMergeAct->setEnabled(localRepoActionsEnabled && canMerge); |
1369 hgUpdateAct->setEnabled(localRepoActionsEnabled && canUpdate); | 1370 hgUpdateAct->setEnabled(localRepoActionsEnabled && canUpdate); |
1371 | |
1372 // Set the state field on the file status widget | |
1373 | |
1374 QString branchText; | |
1375 if (currentBranch == "" || currentBranch == "default") { | |
1376 branchText = tr("the default branch"); | |
1377 } else { | |
1378 branchText = tr("branch \"%1\"").arg(currentBranch); | |
1379 } | |
1380 if (canUpdate) { | |
1381 hgTabs->setState(tr("On %1. Not at the head of the branch: consider updating").arg(branchText)); | |
1382 } else if (canMerge) { | |
1383 hgTabs->setState(tr("<b>Awaiting merge</b> on %1").arg(branchText)); | |
1384 } else { | |
1385 hgTabs->setState(tr("At the head of %1").arg(branchText)); | |
1386 } | |
1370 } | 1387 } |
1371 | 1388 |
1372 void MainWindow::createActions() | 1389 void MainWindow::createActions() |
1373 { | 1390 { |
1374 //File actions | 1391 //File actions |