# HG changeset patch # User Chris Cannam # Date 1290695440 0 # Node ID af314dd436d50049cef5a40e87a88c392ecba3cb # Parent 0bd32aedc6f684ac3bfadbf16ed38c25be018024 * Slightly more useful commit dialog diff -r 0bd32aedc6f6 -r af314dd436d5 confirmcommentdialog.cpp --- a/confirmcommentdialog.cpp Wed Nov 24 22:44:40 2010 +0000 +++ b/confirmcommentdialog.cpp Thu Nov 25 14:30:40 2010 +0000 @@ -19,6 +19,10 @@ #include #include +#include +#include +#include +#include bool ConfirmCommentDialog::confirmFilesAction(QWidget *parent, QString title, @@ -50,7 +54,8 @@ QString introText, QString introTextWithCount, QStringList files, - QString &comment) + QString &comment, + bool longComment) { QString text; if (files.size() <= 10) { @@ -63,17 +68,38 @@ } else { text = "" + introText.arg(files.size()); } - return confirmAndComment(parent, title, text, comment); + return confirmAndComment(parent, title, text, comment, longComment); } bool ConfirmCommentDialog::confirmAndComment(QWidget *parent, QString title, QString introText, - QString &comment) + QString &comment, + bool longComment) { bool ok = false; - //!!! ok, for comments need more than one line - comment = QInputDialog::getText(parent, title, introText, - QLineEdit::Normal, comment, &ok); + if (!longComment) { + comment = QInputDialog::getText(parent, title, introText, + QLineEdit::Normal, comment, &ok); + } else { + QDialog *d = new QDialog(parent); + d->setWindowTitle(title); + QGridLayout *layout = new QGridLayout; + d->setLayout(layout); + QLabel *label = new QLabel(introText); + layout->addWidget(label, 0, 0); + QTextEdit *textEdit = new QTextEdit; + textEdit->setAcceptRichText(false); + layout->addWidget(textEdit, 1, 0); + QDialogButtonBox *bbox = new QDialogButtonBox(QDialogButtonBox::Ok | + QDialogButtonBox::Cancel); + layout->addWidget(bbox, 2, 0); + QObject::connect(bbox, SIGNAL(accepted()), d, SLOT(accept())); + QObject::connect(bbox, SIGNAL(rejected()), d, SLOT(reject())); + if (d->exec() == QDialog::Accepted) { + comment = textEdit->document()->toPlainText(); + ok = true; + } + } return ok; } diff -r 0bd32aedc6f6 -r af314dd436d5 confirmcommentdialog.h --- a/confirmcommentdialog.h Wed Nov 24 22:44:40 2010 +0000 +++ b/confirmcommentdialog.h Thu Nov 25 14:30:40 2010 +0000 @@ -36,12 +36,14 @@ QString introText, QString introTextWithCount, QStringList files, - QString &comment); + QString &comment, + bool longComment); static bool confirmAndComment(QWidget *parent, QString title, QString introText, - QString &comment); + QString &comment, + bool longComment); }; diff -r 0bd32aedc6f6 -r af314dd436d5 hgrunner.cpp --- a/hgrunner.cpp Wed Nov 24 22:44:40 2010 +0000 +++ b/hgrunner.cpp Thu Nov 25 14:30:40 2010 +0000 @@ -47,6 +47,7 @@ QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); env.insert("LANG", "en_US.utf8"); env.insert("LC_ALL", "en_US.utf8"); + env.insert("HGPLAIN", "1"); m_proc->setProcessEnvironment(env); m_proc->setProcessChannelMode(QProcess::MergedChannels); @@ -86,14 +87,11 @@ void HgRunner::started() { + DEBUG << "started" << endl; /* - if (procInput) procInput->write("blah\n"); - if (procInput) procInput->write("blah\n"); - if (procInput) { - procInput->close(); -// ::close(ptyMasterFd); - } - proc -> closeWriteChannel(); + m_proc->write("blah\n"); + m_proc->write("blah\n"); + m_proc -> closeWriteChannel(); */ } @@ -230,6 +228,14 @@ void HgRunner::startHgCommand(QString workingDir, QStringList params) { +#ifdef Q_OS_WIN32 + // This at least means we won't block on the non-working password prompt + params.push_front("ui.interactive=false"); +#else + // password prompt should work here + params.push_front("ui.interactive=true"); +#endif + params.push_front("--config"); startCommand(getHgBinaryName(), workingDir, params); } diff -r 0bd32aedc6f6 -r af314dd436d5 mainwindow.cpp --- a/mainwindow.cpp Wed Nov 24 22:44:40 2010 +0000 +++ b/mainwindow.cpp Thu Nov 25 14:30:40 2010 +0000 @@ -336,7 +336,8 @@ tr("About to commit the following files:"), tr("About to commit %1 files."), files, - comment)) { + comment, + true)) { //!!! do something more sensible when the comment is empty // (i.e. tell the user about it?) @@ -383,7 +384,8 @@ if (ConfirmCommentDialog::confirmAndComment(this, tr("Tag"), tr("Enter tag:"), - tag)) { + tag, + false)) { if (!tag.isEmpty()) //!!! do something better if it is empty { params << "tag" << "--user" << getUserInfo() << filterTag(tag); @@ -577,8 +579,19 @@ { QStringList params; + if (!QDir(workFolderPath).exists()) { + if (!QDir().mkpath(workFolderPath)) { + DEBUG << "hgCloneFromRemote: Failed to create target path " + << workFolderPath << endl; + //!!! report error + return; + } + } + params << "clone" << remoteRepoPath << workFolderPath; + hgTabs->setWorkFolderAndRepoNames(workFolderPath, remoteRepoPath); + runner -> startHgCommand(workFolderPath, params); runningAction = ACT_CLONEFROMREMOTE; }