comparison mainwindow.cpp @ 74:10eb97683aa9

* Show branch names even for changes with children, if those children are on a different branch * Pick up remote repo path from local repo via hg paths * Some work towards breaking down files into various groups based on status * Add /usr/local/bin to path for hg (temporary hack I hope)
author Chris Cannam
date Fri, 19 Nov 2010 14:54:19 +0000
parents a773c6e7b301
children d575a8f76a53
comparison
equal deleted inserted replaced
73:a773c6e7b301 74:10eb97683aa9
33 #include "settingsdialog.h" 33 #include "settingsdialog.h"
34 #include "multichoicedialog.h" 34 #include "multichoicedialog.h"
35 #include "startupdialog.h" 35 #include "startupdialog.h"
36 #include "colourset.h" 36 #include "colourset.h"
37 #include "debug.h" 37 #include "debug.h"
38 #include "logparser.h"
38 39
39 40
40 MainWindow::MainWindow() 41 MainWindow::MainWindow()
41 { 42 {
42 QString wndTitle; 43 QString wndTitle;
81 82
82 if (workFolderPath == "") { 83 if (workFolderPath == "") {
83 open(); 84 open();
84 } 85 }
85 86
86 hgStat(); 87 hgPaths();
87 } 88 }
88 89
89 90
90 void MainWindow::closeEvent(QCloseEvent *) 91 void MainWindow::closeEvent(QCloseEvent *)
91 { 92 {
143 } 144 }
144 145
145 146
146 runner -> startHgCommand(workFolderPath, params); 147 runner -> startHgCommand(workFolderPath, params);
147 runningAction = ACT_STAT; 148 runningAction = ACT_STAT;
149 }
150 }
151
152 void MainWindow::hgPaths()
153 {
154 if (runningAction == ACT_NONE)
155 {
156 QStringList params;
157 params << "paths";
158 runner -> startHgCommand(workFolderPath, params);
159 runningAction = ACT_PATHS;
148 } 160 }
149 } 161 }
150 162
151 void MainWindow::hgHeads() 163 void MainWindow::hgHeads()
152 { 164 {
737 //!!! 749 //!!!
738 } 750 }
739 751
740 hgExp->clearLists(); 752 hgExp->clearLists();
741 enableDisableActions(); 753 enableDisableActions();
742 hgStat(); 754 hgPaths();
743 } 755 }
744 756
745 delete d; 757 delete d;
746 } 758 }
747 759
979 991
980 992
981 void MainWindow::commandFailed() 993 void MainWindow::commandFailed()
982 { 994 {
983 DEBUG << "MainWindow::commandFailed" << endl; 995 DEBUG << "MainWindow::commandFailed" << endl;
996 runningAction = ACT_NONE;
997 runner -> hideProgBar();
998
999 //!!! N.B hg incoming returns failure even if successful, if there were no changes
984 } 1000 }
985 1001
986 void MainWindow::commandCompleted() 1002 void MainWindow::commandCompleted()
987 { 1003 {
988 bool shouldHgStat = false; 1004 bool shouldHgStat = false;
1001 if ((EXITOK(exitCode)) || ((exitCode == 1) && (runningAction == ACT_INCOMING))) 1017 if ((EXITOK(exitCode)) || ((exitCode == 1) && (runningAction == ACT_INCOMING)))
1002 { 1018 {
1003 //Successful running. 1019 //Successful running.
1004 switch(runningAction) 1020 switch(runningAction)
1005 { 1021 {
1022 case ACT_PATHS:
1023 {
1024 QString stdout = runner->getStdOut();
1025 DEBUG << "stdout is " << stdout << endl;
1026 LogParser lp(stdout, "=");
1027 LogList ll = lp.parse();
1028 DEBUG << ll.size() << " results" << endl;
1029 if (!ll.empty()) {
1030 remoteRepoPath = lp.parse()[0]["default"].trimmed();
1031 DEBUG << "Set remote path to " << remoteRepoPath << endl;
1032 }
1033 MultiChoiceDialog::addRecentArgument("local", workFolderPath);
1034 MultiChoiceDialog::addRecentArgument("remote", remoteRepoPath);
1035 enableDisableActions();
1036 break;
1037 }
1038
1006 case ACT_STAT: 1039 case ACT_STAT:
1007 MultiChoiceDialog::addRecentArgument("local", workFolderPath);
1008 hgExp -> updateWorkFolderFileList(runner -> getStdOut()); 1040 hgExp -> updateWorkFolderFileList(runner -> getStdOut());
1009 break; 1041 break;
1010 1042
1011 case ACT_INCOMING: 1043 case ACT_INCOMING:
1012 case ACT_ANNOTATE: 1044 case ACT_ANNOTATE:
1095 break; 1127 break;
1096 } 1128 }
1097 } 1129 }
1098 1130
1099 1131
1100 //Typical sequence goes stat -> heads -> parents -> log 1132 //Typical sequence goes paths -> stat -> heads -> parents -> log
1101 if (runningAction == ACT_STAT) 1133 if (runningAction == ACT_PATHS)
1134 {
1135 runningAction = ACT_NONE;
1136 hgStat();
1137 }
1138 else if (runningAction == ACT_STAT)
1102 { 1139 {
1103 runningAction = ACT_NONE; 1140 runningAction = ACT_NONE;
1104 hgHeads(); 1141 hgHeads();
1105 } 1142 }
1106 else if (runningAction == ACT_HEADS) 1143 else if (runningAction == ACT_HEADS)
1130 else 1167 else
1131 { 1168 {
1132 runningAction = ACT_NONE; 1169 runningAction = ACT_NONE;
1133 if (shouldHgStat) 1170 if (shouldHgStat)
1134 { 1171 {
1135 hgStat(); 1172 hgPaths();
1136 } 1173 }
1137 } 1174 }
1138 } 1175 }
1139 } 1176 }
1140 else 1177 else
1147 { 1184 {
1148 connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); 1185 connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));
1149 connect(aboutAct, SIGNAL(triggered()), this, SLOT(about())); 1186 connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));
1150 connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt())); 1187 connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
1151 1188
1152 connect(hgStatAct, SIGNAL(triggered()), this, SLOT(hgStat())); 1189 connect(hgStatAct, SIGNAL(triggered()), this, SLOT(hgPaths()));
1153 connect(hgExp, SIGNAL(workFolderViewTypesChanged()), this, SLOT(hgStat())); 1190 connect(hgExp, SIGNAL(workFolderViewTypesChanged()), this, SLOT(hgPaths()));
1154 connect(hgRemoveAct, SIGNAL(triggered()), this, SLOT(hgRemove())); 1191 connect(hgRemoveAct, SIGNAL(triggered()), this, SLOT(hgRemove()));
1155 connect(hgAddAct, SIGNAL(triggered()), this, SLOT(hgAdd())); 1192 connect(hgAddAct, SIGNAL(triggered()), this, SLOT(hgAdd()));
1156 connect(hgCommitAct, SIGNAL(triggered()), this, SLOT(hgCommit())); 1193 connect(hgCommitAct, SIGNAL(triggered()), this, SLOT(hgCommit()));
1157 connect(hgFileDiffAct, SIGNAL(triggered()), this, SLOT(hgFileDiff())); 1194 connect(hgFileDiffAct, SIGNAL(triggered()), this, SLOT(hgFileDiff()));
1158 connect(hgFolderDiffAct, SIGNAL(triggered()), this, SLOT(hgFolderDiff())); 1195 connect(hgFolderDiffAct, SIGNAL(triggered()), this, SLOT(hgFolderDiff()));