# HG changeset patch # User Chris Cannam # Date 1313615631 -3600 # Node ID 86cdaa346e59735654cf2b9e545f2ebe46f6bb7e # Parent 2f59333952cefc042a9e3351153de76af7adbd3a# Parent 12195f4b51055f92f4e9b7c68acf0d91ea852ad0 Merge diff -r 2f59333952ce -r 86cdaa346e59 .hgtags --- a/.hgtags Wed Aug 17 22:13:14 2011 +0100 +++ b/.hgtags Wed Aug 17 22:13:51 2011 +0100 @@ -12,3 +12,4 @@ 820512d49fcac53b902a053cede055b903400006 easyhg_v0.9.5 a206deb6c1aab16f5bfb4c1d9d10074d1a93fa7e easyhg_v0.9.6 9510a32a96ab9ea3c2bec5998f3f702b29ec0114 easyhg_v0.9.7 +319f920a51ee61df29701db8ad9bdb413c66a399 easyhg_v0.9.8 diff -r 2f59333952ce -r 86cdaa346e59 README.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README.txt Wed Aug 17 22:13:51 2011 +0100 @@ -0,0 +1,52 @@ + +EasyMercurial +============= + +EasyMercurial is a user interface for the Mercurial distributed +version control system. + +EasyMercurial is intended to be: + + * simple to teach and to learn + * indicative of repository state using a history graph representation + * recognisably close to normal command-line workflow for Mercurial + * consistent across platforms + +We are not trying to produce "the best" Mercurial client for any one +purpose. We actively encourage users to move on to other clients as +their needs evolve. The aim is simply to provide something accessible +for beginners in small project groups working with a shared remote +repository. + +The application is developed by Chris Cannam for SoundSoftware.ac.uk, +based on the HgExplorer application by Jari Korhonen, and is published +under the GPL. See the file COPYING for license details. + + +Building EasyMercurial +====================== + +EasyMercurial is written in C++ using the Qt4 toolkit. On most +platforms, you can build it by running "qmake" followed by "make". Qt +version 4.6 or newer is required. + + +To run EasyMercurial +==================== + +Just run the EasyMercurial application that is produced by the build. +You will of course also need to have Mercurial installed (version 1.7 +or newer). If you want to use the EasyHg authentication extension, +you will also need PyQt4 (the Python bindings for Qt4); you may also +wish to install the python-crypto library for the password store. +Finally, an external diff/merge utility is required, typically kdiff3. + + +EasyMercurial is +Copyright 2010 Jari Korhonen +Copyright 2010-2011 Chris Cannam +Copyright 2010-2011 Queen Mary, University of London + + + + diff -r 2f59333952ce -r 86cdaa346e59 deploy/linux/control --- a/deploy/linux/control Wed Aug 17 22:13:14 2011 +0100 +++ b/deploy/linux/control Wed Aug 17 22:13:51 2011 +0100 @@ -3,5 +3,5 @@ Maintainer: Chris Cannam Architecture: amd64 Version: 0.9.8cc-1 -Depends: mercurial (>= 1.7.0),libqtgui4,libqt4-network,python-crypto,python-qt4 +Depends: mercurial (>= 1.7.0),libqtgui4 (>= 4.6.0),libqt4-network,python-crypto,python-qt4 Description: A simple user interface for the Mercurial version-control system diff -r 2f59333952ce -r 86cdaa346e59 easyhg_en.qm Binary file easyhg_en.qm has changed diff -r 2f59333952ce -r 86cdaa346e59 easyhg_en.ts --- a/easyhg_en.ts Wed Aug 17 22:13:14 2011 +0100 +++ b/easyhg_en.ts Wed Aug 17 22:13:51 2011 +0100 @@ -2,6 +2,25 @@ + AnnotateDialog + + User + + + + Revision + + + + Date + + + + Content + + + + ChangesetItem <qt><b>&nbsp;Revision: </b>%1</qt> @@ -109,10 +128,6 @@ - These files are unresolved following an incomplete merge.<br>Select a file and use Merge to try to resolve the merge again. - - - Files highlighted <font color=#d40000>in red</font> have appeared since your most recent commit or update. @@ -160,6 +175,112 @@ <qt>You have no uncommitted changes.</qt> + + Show annotated version + + + + Diff to parent + + + + Commit... + + + + Revert to last committed state + + + + Rename... + + + + Copy... + + + + Add to version control + + + + Remove from version control + + + + Redo merge + + + + Mark conflict as resolved + + + + Ignore... + + + + Edit .hgignore File + + + + These files are unresolved following an incomplete merge.<br>Use Merge to try to resolve the merge again. + + + + + HgIgnoreDialog + + Ignore files + + + + You have asked to ignore the following files:</p><p> + + + + You have asked to ignore %n file(s). + + + + + + Ignore these files only + + + + Ignore files with these names, in any folder + + + + Ignore this file only + + + + Ignore files with the same name as this, in any folder + + + + Ignore the whole folder "%1" + + + + Ignore all files with these extensions: +%1 + + + + Ignore all files with the extension "%1" + + + + <p>Please choose whether to:</p> + + + + Ignore + + HgRunner @@ -215,7 +336,7 @@ There are %n change(s) ready to pull - + There is %n change ready to pull There are %n changes ready to pull @@ -253,8 +374,8 @@ You are about to <b>revert</b> %n file(s).<br><br>This will <b>throw away any changes</b> that you have made to these files but have not committed. - - You are about to <b>revert</b> %n file.<br><br>This will <b>throw away any changes</b> that you have made to these files but have not committed. + + You are about to <b>revert</b> %n file.<br><br>This will <b>throw away any changes</b> that you have made to this file but have not committed. You are about to <b>revert</b> %n files.<br><br>This will <b>throw away any changes</b> that you have made to these files but have not committed. @@ -363,10 +484,6 @@ - <qt><b>Initialise a repository here?</b><br><br>You asked to open "%1".<br>This folder does not contain a Mercurial repository.<br><br>Would you like to initialise a repository here?</qt> - - - <qt><b>Initialise a new repository?</b><br><br>You asked to open "%1".<br>This folder does not yet exist.<br><br>Would you like to create the folder and initialise a new empty repository in it?</qt> @@ -378,17 +495,9 @@ <qt><b>Open existing repository?</b><br><br>You asked to initialise a new repository at "%1".<br>This folder already contains a repository. Would you like to open it?</qt> - - Ok - - - - Mercurial command did not return any output. - - Pushed %n changeset(s) - + Pushed %n changeset Pushed %n changesets @@ -403,7 +512,7 @@ Pulled %n changeset(s) - + Pulled %n changeset Pulled %n changesets @@ -454,7 +563,7 @@ You are about to commit %n file(s) to %1. - + You are about to commit %n file to %1. You are about to commit %n files to %1. @@ -485,7 +594,7 @@ At one of %n heads of %1 - + At one of %n heads of %1 At one of %n heads of %1 @@ -495,22 +604,10 @@ - Open... - - - - Settings... - - - View and change application settings - Refresh - - - Preview @@ -527,10 +624,6 @@ - Revert - - - Add @@ -539,34 +632,10 @@ - Commit - - - - Annotate - - - - Show line-by-line version information for selected file - - - - Serve local repository via http for workgroup access - - - File - Advanced - - - - Help - - - Ready @@ -579,10 +648,6 @@ - You are about to commit the following files to %1: - - - New Branch @@ -591,14 +656,6 @@ - Start Branch - - - - Add Tag - - - <p><b>Note:</b> you are reverting only the files you have selected, not all of the files that have been changed! @@ -627,10 +684,6 @@ - <qt><p>You are about to push your changes to the remote repository at <code>%1</code>.</p></qt> - - - Serve @@ -639,18 +692,6 @@ - <p>Press Close to stop the server and return.</p> - - - - Change Remote Location - - - - <qt><big>Change the remote location</big></qt> - - - Provide a new URL to use for push and pull actions from the current local repository. @@ -695,10 +736,6 @@ - The new changes will be highlighted in the history.<br>Use Update to bring these changes into your working copy. - - - Your local repository already contains all changes found in the remote repository. @@ -727,10 +764,6 @@ - The Mercurial program either could not be found or failed to run.<br>Check that the Mercurial program path is correct in %1. - - - Failed to run Mercurial with extension enabled @@ -747,10 +780,6 @@ - Clone successful - - - The remote repository was successfully cloned to the local folder <code>%1</code>. @@ -799,22 +828,6 @@ - Change Remote Location... - - - - Change the default remote repository for pull and push actions - - - - Quit - - - - Quit EasyMercurial - - - Refresh the window to show the current state of the working folder @@ -839,14 +852,6 @@ - Mark the selected file(s) to be added on the next commit - - - - Mark the selected file(s) to be removed from version control on the next commit - - - Update the working folder to the head of the current repository branch @@ -859,27 +864,348 @@ - Edit .hgignore File - - - Edit the .hgignore file, containing the names of files that should be ignored by Mercurial - Serve via HTTP - - - <qt><h2>EasyMercurial v%1</h2><font size=-1><p>EasyMercurial is a simple user interface for the Mercurial</a> version control system.</p><h4>Credits and Copyright</h4><p>Development carried out by Chris Cannam for SoundSoftware.ac.uk at the Centre for Digital Music, Queen Mary, University of London.</p><p>EasyMercurial is based on HgExplorer by Jari Korhonen, with thanks.</p><p style="margin-left: 2em;">Copyright &copy; 2011 Queen Mary, University of London.<br>Copyright &copy; 2010 Jari Korhonen.<br>Copyright &copy; 2011 Chris Cannam.</p><p style="margin-left: 2em;">This program requires Mercurial, by Matt Mackall and others.<br>This program uses Qt by Nokia.<br>This program uses Nuvola icons by David Vignoni.<br>This program may use KDiff3 by Joachim Eibl.<br>This program may use PyQt by River Bank Computing.<br>Packaging for Mercurial and other dependencies on Windows is derived from TortoiseHg by Steve Borho and others.</p><h4>License</h4><p>This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. See the file COPYING included with this distribution for more information.</p></font> + + You are about to commit changes to the following files in %1: + + - Running temporary server at %n address(es): - - + You are about to commit changes to %n file(s) in %1. + + You are about to commit changes to %n file in %1. + You are about to commit changes to %n files in %1. + + Co&mmit + + + + Start &Branch + + + + Add &Tag + + + + <qt><h3>Ignored File Patterns</h3></qt> + + + + Write failed + + + + Failed to open file %1 for writing + + + + Ignored files + + + + The following lines have been added to the .hgignore file for this working copy: + + + + Re&vert + + + + Rename + + + + Rename <code>%1</code> to: + + + + Re&name + + + + Copy + + + + Copy <code>%1</code> to: + + + + Co&py + + + + &Pull + + + + <p><b>Note:</b> You have uncommitted changes. If you want to push these changes to the remote repository, you need to commit them first. + + + + <qt><p>You are about to push your commits to the remote repository at <code>%1</code>.</p>%2</qt> + + + + &Push + + + + Sharing Repository + + + + Your local repository is now being made temporarily available via HTTP for workgroup access. + + + + Users who have network access to your computer can now clone your repository, by using one of the following URLs as a remote location: + + + + Users who have network access to your computer can now clone your repository, by using the following URL as a remote location: + + + + <p>Press Close to terminate this server, end remote access, and return.</p> + + + + Share Repository + + + + Set Remote Location + + + + <qt><big>Set the remote location</big></qt> + + + + 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. + + + + <qt><b>Initialise a repository here?</b><br><br>You asked to open "%1".<br>This folder is not a Mercurial working copy.<br><br>Would you like to initialise a repository here?</qt> + + + + New changes will be highlighted in yellow in the history. + + + + Your local repository could not be pushed to the remote repository.<br><br>You have an uncommitted merge in your local folder. You probably need to commit it before you push. + + + + Authorization failed + + + + You may have entered an incorrect user name or password, or the remote URL may be wrong.<br><br>Or you may lack the necessary permissions on the remote repository.<br><br>Check with the administrator of your remote repository if necessary. + + + + The Mercurial program either could not be found or failed to run.<br><br>Check that the Mercurial program path is correct in %1. + + + + Merge failed + + + + 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. + + + + A Mercurial command failed to run correctly. This may indicate an installation problem or some other problem with EasyMercurial. + + + + Newer Mercurial version required + + + + To use EasyMercurial, you should have at least Mercurial v1.7 installed.<br><br>The version found on this system (v%1.%2) does not support all of the features required by EasyMercurial. + + + + Open successful + + + + No recent local repositories + + + + &Open... + + + + Ctrl+O + + + + Set Remote &Location... + + + + Set or change the default remote repository for pull and push actions + + + + &Settings... + + + + E&xit + + + + &Quit + + + + Exit EasyMercurial + + + + &Refresh + + + + Ctrl+R + + + + Pre&view Incoming Changes + + + + Pu&ll from Remote Repository + + + + Ctrl+L + + + + Pus&h to Remote Repository + + + + Ctrl+H + + + + &Diff + + + + Ctrl+D + + + + &Add Files + + + + + + + + + Mark the selected files to be added on the next commit + + + + &Remove Files + + + + Del + + + + Mark the selected files to be removed from version control on the next commit + + + + &Ignore Files... + + + + Add the selected filenames to the ignored list, of files that should never be tracked in this repository + + + + Edit Ignored List + + + + &Update to Branch Head + + + + Ctrl+U + + + + &Commit... + + + + Ctrl+Return + + + + &Merge + + + + Ctrl+M + + + + Serve local repository temporarily via HTTP for workgroup access + + + + &File + + + + Open Re&cent + + + + &Work + + + + &Remote + + + + &Help + + + + Remote + + + + Work + + MoreInformationDialog @@ -922,6 +1248,18 @@ &Folder: + + Documents + + + + My Documents + + + + Desktop + + QApplication @@ -1039,10 +1377,6 @@ - External text editor: - - - EasyHg Mercurial extension: @@ -1067,10 +1401,6 @@ - External text editor - - - EasyHg Mercurial extension @@ -1082,6 +1412,14 @@ <qt><b>Restore default settings?</b><br><br>Are you sure you want to reset all settings to their default values? + + SSH program (for ssh URLs): + + + + SSH program + + StartupDialog @@ -1148,6 +1486,18 @@ Cancel new branch + + <qt><b>&nbsp;Uncommitted merge</b></qt> + + + + Uncommitted merge + + + + merge + + WorkStatusWidget diff -r 2f59333952ce -r 86cdaa346e59 src/changesetitem.cpp --- a/src/changesetitem.cpp Wed Aug 17 22:13:14 2011 +0100 +++ b/src/changesetitem.cpp Wed Aug 17 22:13:51 2011 +0100 @@ -101,17 +101,16 @@ } else { showDetail(); } - } else if (e->button() == Qt::RightButton) { - if (m_detail) { - hideDetail(); - } - activateMenu(); } } void -ChangesetItem::activateMenu() +ChangesetItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *) { + if (m_detail) { + hideDetail(); + } + m_parentDiffActions.clear(); m_summaryActions.clear(); @@ -201,9 +200,9 @@ QAction *tag = menu->addAction(tr("Add tag...")); connect(tag, SIGNAL(triggered()), this, SLOT(tagActivated())); + ungrabMouse(); + menu->exec(QCursor::pos()); - - ungrabMouse(); } void diff -r 2f59333952ce -r 86cdaa346e59 src/changesetitem.h --- a/src/changesetitem.h Wed Aug 17 22:13:14 2011 +0100 +++ b/src/changesetitem.h Wed Aug 17 22:13:51 2011 +0100 @@ -85,6 +85,7 @@ protected: virtual void mousePressEvent(QGraphicsSceneMouseEvent *); + virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *); private: void activateMenu(); diff -r 2f59333952ce -r 86cdaa346e59 src/debug.cpp --- a/src/debug.cpp Wed Aug 17 22:13:14 2011 +0100 +++ b/src/debug.cpp Wed Aug 17 22:13:51 2011 +0100 @@ -25,6 +25,7 @@ #include #include #include +#include #include @@ -39,7 +40,15 @@ if (!debug) { prefix = new char[20]; sprintf(prefix, "[%lu]", (unsigned long)QCoreApplication::applicationPid()); - logFile = new QFile(QDir::homePath() + "/.easyhg.log"); + QString logFileName = QDir::homePath() + "/.easyhg.log"; // the fallback + QString logDir = QDesktopServices::storageLocation + (QDesktopServices::DataLocation); + if (logDir != "" && + (QDir(logDir).exists() || + QDir().mkpath(logDir))) { + logFileName = logDir + "/debug.log"; + } + logFile = new QFile(logFileName); if (logFile->open(QIODevice::WriteOnly | QIODevice::Truncate)) { QDebug(QtDebugMsg) << (const char *)prefix << "Opened debug log file " diff -r 2f59333952ce -r 86cdaa346e59 src/filestatuswidget.cpp --- a/src/filestatuswidget.cpp Wed Aug 17 22:13:14 2011 +0100 +++ b/src/filestatuswidget.cpp Wed Aug 17 22:13:51 2011 +0100 @@ -79,7 +79,7 @@ m_descriptions[FileStates::Missing] = tr("These files are recorded in the version control, but absent from your working folder.
" "If you intended to delete them, select them and use Remove to tell the version control system about it.
" "If you deleted them by accident, select them and use Revert to restore their previous contents."); - m_descriptions[FileStates::InConflict] = tr("These files are unresolved following an incomplete merge.
Select a file and use Merge to try to resolve the merge again."); + m_descriptions[FileStates::InConflict] = tr("These files are unresolved following an incomplete merge.
Use Merge to try to resolve the merge again."); m_descriptions[FileStates::Unknown] = tr("These files are in your working folder but are not under version control.
" // "Select a file and use Add to place it under version control or Ignore to remove it from this list."); "Select a file and use Add to place it under version control."); @@ -157,15 +157,27 @@ m_showAllFiles = new QCheckBox(tr("Show all files"), this); m_showAllFiles->setEnabled(false); layout->addWidget(m_showAllFiles, ++row, 0, Qt::AlignLeft); + + QSettings settings; + m_showAllFiles->setChecked(settings.value("showall", false).toBool()); + connect(m_showAllFiles, SIGNAL(toggled(bool)), - this, SIGNAL(showAllChanged(bool))); + this, SIGNAL(showAllChanged())); } FileStatusWidget::~FileStatusWidget() { + QSettings settings; + settings.setValue("showall", m_showAllFiles->isChecked()); + delete m_dateReference; } +bool FileStatusWidget::shouldShowAll() const +{ + return m_showAllFiles->isChecked(); +} + QString FileStatusWidget::labelFor(FileStates::State s, bool addHighlightExplanation) { QSettings settings; diff -r 2f59333952ce -r 86cdaa346e59 src/filestatuswidget.h --- a/src/filestatuswidget.h Wed Aug 17 22:13:14 2011 +0100 +++ b/src/filestatuswidget.h Wed Aug 17 22:13:51 2011 +0100 @@ -54,9 +54,11 @@ QStringList getSelectedAddableFiles() const; QStringList getSelectedRemovableFiles() const; + bool shouldShowAll() const; + signals: void selectionChanged(); - void showAllChanged(bool); + void showAllChanged(); void annotateFiles(QStringList); void diffFiles(QStringList); diff -r 2f59333952ce -r 86cdaa346e59 src/hgrunner.cpp --- a/src/hgrunner.cpp Wed Aug 17 22:13:14 2011 +0100 +++ b/src/hgrunner.cpp Wed Aug 17 22:13:51 2011 +0100 @@ -40,6 +40,8 @@ #include #include #include +#else +#include #endif HgRunner::HgRunner(QString myDirPath, QWidget * parent) : @@ -497,9 +499,6 @@ return; } - QSettings settings; - settings.beginGroup("General"); - if (executable == "") { // This is a Hg command executable = getHgBinaryName(); @@ -514,6 +513,7 @@ if (action.mayBeInteractive()) { params.push_front("ui.interactive=true"); params.push_front("--config"); + QSettings settings; if (settings.value("useextension", true).toBool()) { params = addExtensionOptions(params); } diff -r 2f59333952ce -r 86cdaa346e59 src/hgtabwidget.cpp --- a/src/hgtabwidget.cpp Wed Aug 17 22:13:14 2011 +0100 +++ b/src/hgtabwidget.cpp Wed Aug 17 22:13:51 2011 +0100 @@ -37,8 +37,8 @@ connect(m_fileStatusWidget, SIGNAL(selectionChanged()), this, SIGNAL(selectionChanged())); - connect(m_fileStatusWidget, SIGNAL(showAllChanged(bool)), - this, SIGNAL(showAllChanged(bool))); + connect(m_fileStatusWidget, SIGNAL(showAllChanged()), + this, SIGNAL(showAllChanged())); connect(m_fileStatusWidget, SIGNAL(annotateFiles(QStringList)), this, SIGNAL(annotateFiles(QStringList))); @@ -268,3 +268,8 @@ setCurrentWidget(m_historyWidget); } +bool HgTabWidget::shouldShowAll() const +{ + return m_fileStatusWidget->shouldShowAll(); +} + diff -r 2f59333952ce -r 86cdaa346e59 src/hgtabwidget.h --- a/src/hgtabwidget.h Wed Aug 17 22:13:14 2011 +0100 +++ b/src/hgtabwidget.h Wed Aug 17 22:13:51 2011 +0100 @@ -70,9 +70,11 @@ QStringList getSelectedAddableFiles() const; QStringList getSelectedRemovableFiles() const; + bool shouldShowAll() const; + signals: void selectionChanged(); - void showAllChanged(bool); + void showAllChanged(); void commit(); void revert(); diff -r 2f59333952ce -r 86cdaa346e59 src/mainwindow.cpp --- a/src/mainwindow.cpp Wed Aug 17 22:13:14 2011 +0100 +++ b/src/mainwindow.cpp Wed Aug 17 22:13:51 2011 +0100 @@ -33,6 +33,7 @@ #include #include #include +#include #include #include "mainwindow.h" @@ -110,8 +111,8 @@ connect(m_hgTabs, SIGNAL(selectionChanged()), this, SLOT(enableDisableActions())); - connect(m_hgTabs, SIGNAL(showAllChanged(bool)), - this, SLOT(showAllChanged(bool))); + connect(m_hgTabs, SIGNAL(showAllChanged()), + this, SLOT(showAllChanged())); setUnifiedTitleAndToolBarOnMac(true); connectActions(); @@ -205,9 +206,8 @@ m_hgTabs->clearSelections(); } -void MainWindow::showAllChanged(bool s) +void MainWindow::showAllChanged() { - m_showAllFiles = s; hgQueryPaths(); } @@ -256,6 +256,8 @@ void MainWindow::hgQueryPaths() { + m_showAllFiles = m_hgTabs->shouldShowAll(); + // Quickest is to just read the file QFileInfo hgrc(m_workFolderPath + "/.hg/hgrc"); @@ -456,10 +458,10 @@ (this, cf, tr("

%1

%2%3").arg(cf) - .arg(tr("You are about to commit the following files to %1:").arg(branchText)) + .arg(tr("You are about to commit changes to the following files in %1:").arg(branchText)) .arg(subsetNote), tr("

%1

%2%3").arg(cf) - .arg(tr("You are about to commit %n file(s) to %1.", "", reportFiles.size()).arg(branchText)) + .arg(tr("You are about to commit changes to %n file(s) in %1.", "", reportFiles.size()).arg(branchText)) .arg(subsetNote), reportFiles, comment, @@ -577,23 +579,50 @@ initHgIgnore(); QString hgIgnorePath = m_workFolderPath + "/.hgignore"; - QStringList params; - - params << hgIgnorePath; + + QFile f(hgIgnorePath); + if (!f.exists()) return; // shouldn't happen (after initHgIgnore called) + + if (!f.open(QFile::ReadOnly)) return; + QTextStream sin(&f); + QString all = sin.readAll(); + f.close(); + + QDialog d; + QGridLayout layout; + d.setLayout(&layout); + + int row = 0; + layout.addWidget(new QLabel(tr("

Ignored File Patterns

")), row++, 0);//!!! todo: link to Hg docs? + + QTextEdit ed; + ed.setAcceptRichText(false); + ed.setLineWrapMode(QTextEdit::NoWrap); + layout.setRowStretch(row, 10); + layout.addWidget(&ed, row++, 0); - QString editor = getEditorBinaryName(); - - if (editor == "") { - QMessageBox::critical - (this, tr("Edit .hgignore"), - tr("Failed to locate a system text editor program!")); - return; + QDialogButtonBox bb(QDialogButtonBox::Save | QDialogButtonBox::Cancel); + connect(bb.button(QDialogButtonBox::Save), SIGNAL(clicked()), + &d, SLOT(accept())); + connect(bb.button(QDialogButtonBox::Cancel), SIGNAL(clicked()), + &d, SLOT(reject())); + layout.addWidget(&bb, row++, 0); + + ed.document()->setPlainText(all); + + d.resize(QSize(300, 400)); + + if (d.exec() == QDialog::Accepted) { + if (!f.open(QFile::WriteOnly | QFile::Truncate)) { + QMessageBox::critical(this, tr("Write failed"), + tr("Failed to open file %1 for writing") + .arg(f.fileName())); + return; + } + QTextStream sout(&f); + sout << ed.document()->toPlainText(); + f.close(); } - - HgAction action(ACT_HG_IGNORE, m_workFolderPath, params); - action.executable = editor; - - m_runner->requestAction(action); } static QString regexEscape(QString filename) @@ -767,13 +796,6 @@ return settings.value("mergebinary", "").toString(); } -QString MainWindow::getEditorBinaryName() -{ - QSettings settings; - settings.beginGroup("Locations"); - return settings.value("editorbinary", "").toString(); -} - void MainWindow::hgShowSummary() { QStringList params; @@ -1313,7 +1335,7 @@ MultiChoiceDialog::DirectoryArg); QSettings settings; - settings.beginGroup("General"); + settings.beginGroup(""); QString lastChoice = settings.value("lastopentype", "remote").toString(); if (lastChoice != "local" && lastChoice != "remote" && @@ -2042,7 +2064,7 @@ (this, tr("Failed to run Mercurial"), tr("Failed to run Mercurial"), - tr("The Mercurial program either could not be found or failed to run.
Check that the Mercurial program path is correct in %1.").arg(setstr), + tr("The Mercurial program either could not be found or failed to run.

Check that the Mercurial program path is correct in %1.").arg(setstr), output); settings(SettingsDialog::PathsTab); return; @@ -2145,7 +2167,9 @@ (this, tr("Command failed"), tr("Command failed"), - tr("A Mercurial command failed to run correctly. This may indicate an installation problem or some other problem with EasyMercurial.

See “More Details” for the command output."), + (output == "" ? + tr("A Mercurial command failed to run correctly. This may indicate an installation problem or some other problem with EasyMercurial.") : + tr("A Mercurial command failed to run correctly. This may indicate an installation problem or some other problem with EasyMercurial.

See “More Details” for the command output.")), output); } @@ -2422,7 +2446,6 @@ case ACT_TEST_HG: { QSettings settings; - settings.beginGroup("General"); if (settings.value("useextension", true).toBool()) { hgTestExtension(); } else if (m_workFolderPath == "") { diff -r 2f59333952ce -r 86cdaa346e59 src/mainwindow.h --- a/src/mainwindow.h Wed Aug 17 22:13:14 2011 +0100 +++ b/src/mainwindow.h Wed Aug 17 22:13:51 2011 +0100 @@ -65,7 +65,7 @@ void changeRemoteRepo(bool initial); void startupDialog(); void clearSelections(); - void showAllChanged(bool); + void showAllChanged(); void hgTest(); void hgTestExtension(); diff -r 2f59333952ce -r 86cdaa346e59 src/multichoicedialog.cpp --- a/src/multichoicedialog.cpp Wed Aug 17 22:13:14 2011 +0100 +++ b/src/multichoicedialog.cpp Wed Aug 17 22:13:51 2011 +0100 @@ -171,11 +171,15 @@ QDir home(QDir::home()); QDir dflt; + dflt = QDir(home.filePath(tr("Documents"))); + DEBUG << "testing " << dflt << endl; + if (dflt.exists()) return dflt.canonicalPath(); + dflt = QDir(home.filePath(tr("My Documents"))); DEBUG << "testing " << dflt << endl; if (dflt.exists()) return dflt.canonicalPath(); - dflt = QDir(home.filePath(tr("Documents"))); + dflt = QDir(home.filePath(tr("Desktop"))); DEBUG << "testing " << dflt << endl; if (dflt.exists()) return dflt.canonicalPath(); @@ -218,6 +222,7 @@ MultiChoiceDialog::urlChanged(const QString &s) { updateOkButton(); + updateFileComboFromURL(); } void @@ -227,16 +232,11 @@ } void -MultiChoiceDialog::updateOkButton() +MultiChoiceDialog::updateFileComboFromURL() { -/* This doesn't work well if (m_argTypes[m_currentChoice] != UrlToDirectoryArg) { return; } - QDir dirPath(m_fileCombo->currentText()); - if (!dirPath.exists()) { - if (!dirPath.cdUp()) return; - } QString url = m_urlCombo->currentText(); if (QRegExp("^\\w+://").indexIn(url) < 0) { return; @@ -246,8 +246,23 @@ if (urlDirName == "" || urlDirName == url) { return; } - m_fileCombo->lineEdit()->setText(dirPath.filePath(urlDirName)); -*/ + QString dirPath = m_fileCombo->currentText(); + QString defaultPath = getDefaultPath(); + if (dirPath == defaultPath) { + dirPath += QDir::separator() + urlDirName; + } else if (dirPath == defaultPath + QDir::separator()) { + dirPath += urlDirName; + } else { + QDir d(dirPath); + d.cdUp(); + dirPath = d.filePath(urlDirName); + } + m_fileCombo->lineEdit()->setText(dirPath); +} + +void +MultiChoiceDialog::updateOkButton() +{ if (m_argTypes[m_currentChoice] == UrlToDirectoryArg) { m_okButton->setEnabled(getArgument() != "" && getAdditionalArgument() != ""); @@ -289,15 +304,17 @@ m_descriptionLabel->setText(m_descriptions[id]); - m_fileLabel->hide(); - m_fileCombo->hide(); m_browseButton->hide(); + m_urlLabel->hide(); + m_urlCombo->clear(); m_urlCombo->hide(); + m_fileLabel->hide(); + m_fileCombo->clear(); + m_fileCombo->hide(); + QSharedPointer rf = m_recentFiles[id]; - m_fileCombo->clear(); - m_urlCombo->clear(); switch (m_argTypes[id]) { @@ -334,6 +351,7 @@ m_fileLabel->show(); m_fileCombo->show(); m_fileCombo->lineEdit()->setText(getDefaultPath()); + updateFileComboFromURL(); m_browseButton->show(); break; } diff -r 2f59333952ce -r 86cdaa346e59 src/multichoicedialog.h --- a/src/multichoicedialog.h Wed Aug 17 22:13:14 2011 +0100 +++ b/src/multichoicedialog.h Wed Aug 17 22:13:51 2011 +0100 @@ -65,6 +65,7 @@ void browse(); private: + void updateFileComboFromURL(); void updateOkButton(); QMap m_texts; diff -r 2f59333952ce -r 86cdaa346e59 src/settingsdialog.cpp --- a/src/settingsdialog.cpp Wed Aug 17 22:13:14 2011 +0100 +++ b/src/settingsdialog.cpp Wed Aug 17 22:13:51 2011 +0100 @@ -151,15 +151,6 @@ pathsLayout->addWidget(browse, row++, 1); connect(browse, SIGNAL(clicked()), this, SLOT(sshPathBrowse())); - pathsLayout->addWidget(new QLabel(tr("External text editor:")), row, 0); - - m_editPathLabel = new QLineEdit(); - pathsLayout->addWidget(m_editPathLabel, row, 2); - - browse = new QPushButton(tr("Browse...")); - pathsLayout->addWidget(browse, row++, 1); - connect(browse, SIGNAL(clicked()), this, SLOT(editPathBrowse())); - pathsLayout->addWidget(new QLabel(tr("EasyHg Mercurial extension:")), row, 0); m_extensionPathLabel = new QLineEdit(); @@ -222,12 +213,6 @@ } void -SettingsDialog::editPathBrowse() -{ - browseFor(tr("External text editor"), m_editPathLabel); -} - -void SettingsDialog::extensionPathBrowse() { browseFor(tr("EasyHg Mercurial extension"), m_extensionPathLabel); @@ -275,7 +260,6 @@ findDiffBinaryName(); findMergeBinaryName(); findSshBinaryName(); - findEditorBinaryName(); } void @@ -409,40 +393,6 @@ } void -SettingsDialog::findEditorBinaryName() -{ - QSettings settings; - settings.beginGroup("Locations"); - QString editor = settings.value("editorbinary", "").toString(); - if (editor != "" && QFile(editor).exists()) { - return; - } - QStringList bases; - bases -#if defined Q_OS_WIN32 - << "wordpad.exe" - << "C:\\Program Files\\Windows NT\\Accessories\\wordpad.exe" - << "notepad.exe" -#elif defined Q_OS_MAC - << "/Applications/TextEdit.app/Contents/MacOS/TextEdit" -#else - << "gedit" << "kate" -#endif - ; - bool found = false; - foreach (QString base, bases) { - editor = findInPath(base, m_installPath, true); - if (editor != "") { - found = true; - break; - } - } - if (found) { - settings.setValue("editorbinary", editor); - } -} - -void SettingsDialog::clear() { // Clear everything that has a default setting @@ -458,10 +408,9 @@ settings.remove("extdiffbinary"); settings.remove("mergebinary"); settings.remove("sshbinary"); - settings.remove("editorbinary"); settings.remove("extensionpath"); settings.endGroup(); - settings.beginGroup("General"); + settings.beginGroup(""); settings.remove("useextension"); settings.endGroup(); } @@ -488,10 +437,9 @@ m_diffPathLabel->setText(settings.value("extdiffbinary").toString()); m_mergePathLabel->setText(settings.value("mergebinary").toString()); m_sshPathLabel->setText(settings.value("sshbinary").toString()); - m_editPathLabel->setText(settings.value("editorbinary").toString()); m_extensionPathLabel->setText(settings.value("extensionpath").toString()); settings.endGroup(); - settings.beginGroup("General"); + settings.beginGroup(""); m_useExtension->setChecked(settings.value("useextension", true).toBool()); settings.endGroup(); } @@ -536,10 +484,9 @@ settings.setValue("extdiffbinary", m_diffPathLabel->text()); settings.setValue("mergebinary", m_mergePathLabel->text()); settings.setValue("sshbinary", m_sshPathLabel->text()); - settings.setValue("editorbinary", m_editPathLabel->text()); settings.setValue("extensionpath", m_extensionPathLabel->text()); settings.endGroup(); - settings.beginGroup("General"); + settings.beginGroup(""); settings.setValue("useextension", m_useExtension->isChecked()); settings.endGroup(); QDialog::accept(); diff -r 2f59333952ce -r 86cdaa346e59 src/settingsdialog.h --- a/src/settingsdialog.h Wed Aug 17 22:13:14 2011 +0100 +++ b/src/settingsdialog.h Wed Aug 17 22:13:51 2011 +0100 @@ -53,7 +53,6 @@ void diffPathBrowse(); void mergePathBrowse(); void sshPathBrowse(); - void editPathBrowse(); void extensionPathBrowse(); void accept(); @@ -70,7 +69,6 @@ QLineEdit *m_diffPathLabel; QLineEdit *m_mergePathLabel; QLineEdit *m_sshPathLabel; - QLineEdit *m_editPathLabel; QCheckBox *m_useExtension; QLineEdit *m_extensionPathLabel; @@ -93,7 +91,6 @@ static void findDiffBinaryName(); static void findMergeBinaryName(); static void findSshBinaryName(); - static void findEditorBinaryName(); static QString m_installPath; }; diff -r 2f59333952ce -r 86cdaa346e59 src/version.h --- a/src/version.h Wed Aug 17 22:13:14 2011 +0100 +++ b/src/version.h Wed Aug 17 22:13:51 2011 +0100 @@ -1,1 +1,1 @@ -#define EASYHG_VERSION "0.9.7" +#define EASYHG_VERSION "1.0"