comparison src/mainwindow.cpp @ 619:4f7ca2d192df

Merge
author Chris Cannam
date Tue, 03 Jul 2012 20:10:04 +0100
parents 54ca6a0e9aef 864cf6bc6eff
children 7f1adcdc6cdc
comparison
equal deleted inserted replaced
618:54ca6a0e9aef 619:4f7ca2d192df
764 return; 764 return;
765 } 765 }
766 766
767 f.open(QFile::ReadOnly); 767 f.open(QFile::ReadOnly);
768 bool glob = false; 768 bool glob = false;
769 bool cr = false; // whether the last line examined ended with a CR
769 while (!f.atEnd()) { 770 while (!f.atEnd()) {
770 QByteArray ba = f.readLine(); 771 QByteArray ba = f.readLine();
771 QString s = QString::fromLocal8Bit(ba).trimmed(); 772 QString s = QString::fromLocal8Bit(ba);
773 cr = (s.endsWith('\n') || s.endsWith('\r'));
774 s = s.trimmed();
772 if (s.startsWith("syntax:")) { 775 if (s.startsWith("syntax:")) {
773 if (s.endsWith("glob")) { 776 if (s.endsWith("glob")) {
774 glob = true; 777 glob = true;
775 } else { 778 } else {
776 glob = false; 779 glob = false;
779 } 782 }
780 f.close(); 783 f.close();
781 784
782 f.open(QFile::Append); 785 f.open(QFile::Append);
783 QTextStream out(&f); 786 QTextStream out(&f);
787
788 if (!cr) {
789 out << endl;
790 }
784 791
785 if (!glob) { 792 if (!glob) {
786 out << "syntax: glob" << endl; 793 out << "syntax: glob" << endl;
787 } 794 }
788 795
1206 1213
1207 if (!QDir(m_workFolderPath).exists()) { 1214 if (!QDir(m_workFolderPath).exists()) {
1208 if (!QDir().mkpath(m_workFolderPath)) { 1215 if (!QDir().mkpath(m_workFolderPath)) {
1209 DEBUG << "hgCloneFromRemote: Failed to create target path " 1216 DEBUG << "hgCloneFromRemote: Failed to create target path "
1210 << m_workFolderPath << endl; 1217 << m_workFolderPath << endl;
1211 //!!! report error 1218 QMessageBox::critical
1219 (this, tr("Could not create target folder"),
1220 tr("<qt><b>Could not create target folder</b><br><br>The local target folder \"%1\" does not exist<br>and could not be created.</qt>").arg(xmlEncode(m_workFolderPath)));
1221 m_workFolderPath = "";
1212 return; 1222 return;
1213 } 1223 }
1214 } 1224 }
1215 1225
1216 params << "clone" << m_remoteRepoPath << m_workFolderPath; 1226 params << "clone" << m_remoteRepoPath << m_workFolderPath;
1217 1227
1218 updateWorkFolderAndRepoNames(); 1228 updateWorkFolderAndRepoNames();
1219 m_hgTabs->updateWorkFolderFileList(""); 1229 m_hgTabs->updateWorkFolderFileList("");
1230 m_hgTabs->clearAll();
1220 1231
1221 m_runner->requestAction(HgAction(ACT_CLONEFROMREMOTE, m_workFolderPath, params)); 1232 m_runner->requestAction(HgAction(ACT_CLONEFROMREMOTE, m_workFolderPath, params));
1222 } 1233 }
1223 1234
1224 void MainWindow::hgInit() 1235 void MainWindow::hgInit()
1483 tr("<qt><big>Set the remote location</big></qt>"), 1494 tr("<qt><big>Set the remote location</big></qt>"),
1484 this); 1495 this);
1485 1496
1486 QString explanation; 1497 QString explanation;
1487 if (initial) { 1498 if (initial) {
1488 explanation = tr("Provide a URL to use for push and pull actions from the current local repository.<br>This will be the default for subsequent pushes and pulls.<br>You can change it using &ldquo;Set Remote Location&rdquo; on the File menu."); 1499 explanation = tr("Provide a remote URL to use when pushing from, or pulling to, the local<br>repository <code>%1</code>.<br>This will be the default for subsequent pushes and pulls.<br>You can change it using &ldquo;Set Remote Location&rdquo; on the File menu.").arg(m_workFolderPath);
1489 } else { 1500 } else {
1490 explanation = tr("Provide a new URL to use for push and pull actions from the current local repository."); 1501 explanation = tr("Provide a new remote URL to use when pushing from, or pulling to, the local<br>repository <code>%1</code>.").arg(m_workFolderPath);
1491 } 1502 }
1492 1503
1493 d->addChoice("remote", 1504 d->addChoice("remote",
1494 tr("<qt><center><img src=\":images/browser-64.png\"><br>Remote repository</center></qt>"), 1505 tr("<qt><center><img src=\":images/browser-64.png\"><br>Remote repository</center></qt>"),
1495 explanation, 1506 explanation,
2131 MoreInformationDialog::information 2142 MoreInformationDialog::information
2132 (this, tr("Merge"), tr("Merge failed"), 2143 (this, tr("Merge"), tr("Merge failed"),
2133 tr("Some files were not merged successfully.<p>You can Merge again to repeat the interactive merge; use Revert to abandon the merge entirely; or edit the files that are in conflict in an editor and, when you are happy with them, choose Mark Resolved in each file's right-button menu."), 2144 tr("Some files were not merged successfully.<p>You can Merge again to repeat the interactive merge; use Revert to abandon the merge entirely; or edit the files that are in conflict in an editor and, when you are happy with them, choose Mark Resolved in each file's right-button menu."),
2134 stdErr); 2145 stdErr);
2135 m_mergeCommitComment = ""; 2146 m_mergeCommitComment = "";
2147 hgQueryPaths();
2136 return; 2148 return;
2137 case ACT_STAT: 2149 case ACT_STAT:
2138 break; // go on to default report 2150 break; // go on to default report
2139 default: 2151 default:
2140 break; 2152 break;
2880 wa->setDefaultWidget(label); 2892 wa->setDefaultWidget(label);
2881 return; 2893 return;
2882 } 2894 }
2883 foreach (QString r, recent) { 2895 foreach (QString r, recent) {
2884 QAction *a = m_recentMenu->addAction(r); 2896 QAction *a = m_recentMenu->addAction(r);
2885 connect(a, SIGNAL(activated()), this, SLOT(recentMenuActivated())); 2897 connect(a, SIGNAL(triggered()), this, SLOT(recentMenuActivated()));
2886 } 2898 }
2887 } 2899 }
2888 2900
2889 void MainWindow::createActions() 2901 void MainWindow::createActions()
2890 { 2902 {
2891 //File actions 2903 //File actions
2892 m_openAct = new QAction(QIcon(":/images/fileopen.png"), tr("&Open..."), this); 2904 m_openAct = new QAction(QIcon(":/images/fileopen.png"), tr("&Open..."), this);
2893 m_openAct->setStatusTip(tr("Open an existing repository or working folder")); 2905 m_openAct->setStatusTip(tr("Open a remote repository or an existing local folder"));
2894 m_openAct->setShortcut(tr("Ctrl+O")); 2906 m_openAct->setShortcut(tr("Ctrl+O"));
2895 2907
2896 m_changeRemoteRepoAct = new QAction(tr("Set Remote &Location..."), this); 2908 m_changeRemoteRepoAct = new QAction(tr("Set Push and Pull &Location..."), this);
2897 m_changeRemoteRepoAct->setStatusTip(tr("Set or change the default remote repository for pull and push actions")); 2909 m_changeRemoteRepoAct->setStatusTip(tr("Set or change the default URL for pull and push actions from this repository"));
2898 2910
2899 m_settingsAct = new QAction(QIcon(":/images/settings.png"), tr("&Settings..."), this); 2911 m_settingsAct = new QAction(QIcon(":/images/settings.png"), tr("&Settings..."), this);
2900 m_settingsAct->setStatusTip(tr("View and change application settings")); 2912 m_settingsAct->setStatusTip(tr("View and change application settings"));
2901 2913
2902 #ifdef Q_OS_WIN32 2914 #ifdef Q_OS_WIN32
3012 workMenu->addSeparator(); 3024 workMenu->addSeparator();
3013 workMenu->addAction(m_hgRevertAct); 3025 workMenu->addAction(m_hgRevertAct);
3014 3026
3015 QMenu *remoteMenu; 3027 QMenu *remoteMenu;
3016 remoteMenu = menuBar()->addMenu(tr("&Remote")); 3028 remoteMenu = menuBar()->addMenu(tr("&Remote"));
3017 remoteMenu->addAction(m_changeRemoteRepoAct);
3018 remoteMenu->addSeparator();
3019 remoteMenu->addAction(m_hgIncomingAct); 3029 remoteMenu->addAction(m_hgIncomingAct);
3020 remoteMenu->addSeparator(); 3030 remoteMenu->addSeparator();
3031 remoteMenu->addAction(m_changeRemoteRepoAct);
3021 remoteMenu->addAction(m_hgPullAct); 3032 remoteMenu->addAction(m_hgPullAct);
3022 remoteMenu->addAction(m_hgPushAct); 3033 remoteMenu->addAction(m_hgPushAct);
3023 3034
3024 m_helpMenu = menuBar()->addMenu(tr("&Help")); 3035 m_helpMenu = menuBar()->addMenu(tr("&Help"));
3025 m_helpMenu->addAction(m_helpAct); 3036 m_helpMenu->addAction(m_helpAct);