changeset 494:41a156d439d0

Start adding Help
author Chris Cannam
date Thu, 18 Aug 2011 16:37:27 +0100
parents 75ebcacd3f75
children e6141a238811
files .hgignore easyhg.qrc help/a-04.html help/a-10.html help/generate.sh help/help.css help/images/openremote.png help/images/openremote50.png help/intro.html help/topics.html help/topics/04.txt help/topics/10.txt src/mainwindow.cpp src/mainwindow.h
diffstat 14 files changed, 348 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Thu Aug 18 16:37:11 2011 +0100
+++ b/.hgignore	Thu Aug 18 16:37:27 2011 +0100
@@ -1,29 +1,28 @@
-syntax: glob
-*.core
-*.o
-*~
-*.exe
-*.dll
-*.pyc
-*.orig
-*.user
-moc_*
-qrc_*
-o/*
-core
-easyhg
-debug/*
-release/*
-Makefile
-Makefile.Debug
-Makefile.Release
-*.app/*
-.DS_Store
-*.pdb
-
-re:^EasyMercurial$
-re:^kdiff3$
-re:^_UpgradeReport_Files/
+syntax: glob
+*.core
+*.o
+*~
+*.exe
+*.dll
+*.pyc
+*.orig
+*.user
+moc_*
+qrc_*
+o/*
+core
+easyhg
+debug/*
+release/*
+Makefile
+Makefile.Debug
+Makefile.Release
+*.app/*
+.DS_Store
+*.pdb
+re:^EasyMercurial$
+re:^kdiff3$
+re:^_UpgradeReport_Files/
 *.dmg
 *.xcodeproj
 *.bak
--- a/easyhg.qrc	Thu Aug 18 16:37:11 2011 +0100
+++ b/easyhg.qrc	Thu Aug 18 16:37:27 2011 +0100
@@ -24,6 +24,11 @@
         <file>images/fileopen.png</file>
         <file>images/star.png</file>
         <file>images/easyhg-icon.png</file>
+	<file>help/topics.html</file>
+	<file>help/help.css</file>
+	<file>help/a-04.html</file>
+	<file>help/a-10.html</file>
+	<file>help/images/openremote50.png</file>
 	<file>easyhg.py</file>
 	<file>easyhg_en.qm</file>
     </qresource>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/help/a-04.html	Thu Aug 18 16:37:27 2011 +0100
@@ -0,0 +1,40 @@
+<link rel="stylesheet" type="text/css" href="help.css"/>
+<p><a href="topics.html">Back to Topics</a></p><hr>
+
+
+<h2>What is a repository?</h2>
+
+<p>When you use a version control system to keep track of your changes to
+a set of files, there are two different concepts you're dealing with:
+a <i>working copy</i> and a <i>repository</i>.</p>
+
+<p>A <i>working copy</i> is just a folder with your project's files in it.  It
+contains the versions of the files that you are working with now.
+<ul><li>EasyMercurial's &ldquo;My Work&rdquo; tab shows you which files you have been working on in your current working copy.</li></ul></p>
+
+<p>A <i>repository</i> is a record of the entire history of your project. When
+change something in the working copy, you can then commit it to the
+repository and your change gets added to the history.
+<ul><li>EasyMercurial's &ldquo;History&rdquo; tab shows you the changes that have been committed to your project's history in its repository.</li></ul></p>
+
+<p>You can also go back and grab an older version from the repository if
+you find you need it.  (If you do this, then the working copy will be
+updated so as to contain that older version rather than the most
+recent one.)</p>
+
+<p>Older centralised version control systems use a separate database for
+the repository.  But with a distributed version control system such as
+Mercurial, the repository &ndash; the entire history of your project files
+&ndash; is stowed into a special folder inside the working copy on your
+hard drive.  Every change you commit gets added to the history in that
+hidden folder. (The history is compressed, so it doesn't take as much
+space as you might imagine.)</p>
+
+<p>The term <i>remote repository</i> simply refers to a repository related to
+your local one, but stored on another computer somewhere else.  Often
+this may be a &ldquo;master copy&rdquo; of your project stored on a server
+elsewhere, which you and your collaborators can use to keep up with
+each other's work, or which you can use to make your work public, or
+simply use as a private backup.</p>
+
+<hr><p><a href="topics.html">Back to Topics</a></p>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/help/a-10.html	Thu Aug 18 16:37:27 2011 +0100
@@ -0,0 +1,39 @@
+<link rel="stylesheet" type="text/css" href="help.css"/>
+<p><a href="topics.html">Back to Topics</a></p><hr>
+
+
+<h2>Someone gave me a repository URL and asked me to clone it</h2>
+
+<p>A Mercurial repository location is usually described by a URL, like
+that of a website.</p>
+
+<p>For example, the URL for the repository containing the source code for
+EasyMercurial itself is <code>https://bitbucket.org/cannam/easyhg</code>.</p>
+
+<p>To get a copy of the files in a repository, you need to <i>clone</i> the
+repository from the remote URL into a folder on your own computer.  To
+do this,</p>
+
+<p><b>1. click the Open toolbar button or use File -> Open</b></p>
+
+<p><center><img src="images/openremote50.png"></center></p>
+
+<p><b>2. select &ldquo;Remote Repository&rdquo; as the thing you want to open</b></p>
+
+<p><b>3. enter the repository URL into the URL field</b></p>
+
+<p><b>4. give the name of a folder on your local computer to clone into</b> &ndash;
+ this folder will be created for you, so it shouldn't be one that already
+ exists</p>
+
+<p><b>5. click OK</b></p>
+
+<p>If the remote repository has restricted access, you may be asked to
+provide a username and password to log in to the server it is hosted
+on.  If the repository is large, you may have to wait a while for all the
+data to be transferred.</p>
+
+<p>Provided the clone has been successful, you should now have a local
+repository to work in.</p>
+
+<hr><p><a href="topics.html">Back to Topics</a></p>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/help/generate.sh	Thu Aug 18 16:37:27 2011 +0100
@@ -0,0 +1,56 @@
+#!/bin/bash
+
+css='<link rel="stylesheet" type="text/css" href="help.css"/>'
+backlink='<p><a href="topics.html">Back to Topics</a></p>'
+
+echo "$css" > topics.html
+cat intro.html >> topics.html
+
+pcat=""
+
+for x in topics/*.txt ; do
+
+    b=`basename "$x" .txt`
+    out="a-$b.html"
+
+    echo "$css" > "$out"
+    echo "$backlink<hr>" >> "$out"
+
+    cat "$x" | perl -e '
+$_ = join "", <>;
+s/^{[\w\s]+}//s;
+s/^(\s*)([A-Za-z][^\n]*)/$1<h2>$2<\/h2>/s;
+s/^\s+\*\s+(.*)$/<ul><li>$1<\/li><\/ul>/gm;
+s/"([\w])/&ldquo;$1/gs;
+s/([\w])"/$1&rdquo;/gs;
+s/^\#([^\s]+)$/<center><img src="images\/$1"><\/center>/gm;
+s/\n-+\n/\n/gs;
+s/\n\n([^\n])/\n\n<p>$1/gs;
+s/^\n*([^<\n])/\n<p>$1/gs;
+s/^\n*(<[^p])/\n<p>$1/gs;
+s/([^\n])\n\n/$1<\/p>\n\n/gs;
+s/([^>\n])\n*$/$1<\/p>\n\n/gs;
+s/\[\[([^\|]*)\|([^\]]*)\]\]/<a href="$1">$2<\/a>/gs;
+s/\[\[([^\|\]]*)\]\]/<a href="$1">$1<\/a>/gs;
+s/\b_([^_]+)_\b/<i>$1<\/i>/gs;
+s/\*(\w[^\*]+)\*/<b>$1<\/b>/gs;
+s/@(\w[^@]+)@/<code>$1<\/code>/gs;
+s/---/&mdash;/gs;
+s/--/&ndash;/gs;
+s/<p><h2>/<h2>/gs;
+s/<\/h2><\/p>/<\/h2>/gs;
+print;
+' >> "$out"
+
+    echo "<hr>$backlink" >> "$out"
+
+    category=`grep '^{.*}$' "$x" | sed 's/[{}]//g'`
+
+    if [ "$category" != "$pcat" ]; then
+	echo "<h3>$category</h3>" >> topics.html
+    fi
+
+    grep '<h2>' "$out" | sed "s|<h2>|<p><a href=\"$out\">|" | sed 's/<\/h2>/<\/a><\/p>/' >> topics.html
+
+done
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/help/help.css	Thu Aug 18 16:37:27 2011 +0100
@@ -0,0 +1,59 @@
+
+body {
+  background: #fdfaf0;
+  color: #3e442c;
+  margin: 0;
+  padding: 0;
+  margin-bottom: 40px;
+  font-family: sans-serif;
+}
+
+h1, h2, h3, h4 {
+  margin-left: 10px;
+  margin-bottom: 0.4em;
+}
+
+h2 {
+  font-size: 1.3em;
+  margin-top: 0;
+}
+
+h3 {
+  font-size: 1.2em;
+}
+
+h4 { 
+  font-size: 1.1em;
+}
+
+ol, ul, ol li, ul li {
+  margin-left: 0;
+  color: #808080;
+  font-style: italic;
+}
+
+p, pre { 
+  margin-left: 20px;
+  margin-bottom: 0.5em;
+  margin-right: 10px;
+  margin-top: 0;
+}
+
+blockquote {
+  margin-left: 70px;
+}
+
+table { 
+  padding-top: 0;
+}
+
+a {
+  color: #be5700;
+  text-decoration: none;
+}
+
+a:hover {
+  text-decoration: underline;
+}
+
+
Binary file help/images/openremote.png has changed
Binary file help/images/openremote50.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/help/intro.html	Thu Aug 18 16:37:27 2011 +0100
@@ -0,0 +1,4 @@
+
+<h1>Quick Topics</h1>
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/help/topics.html	Thu Aug 18 16:37:27 2011 +0100
@@ -0,0 +1,9 @@
+<link rel="stylesheet" type="text/css" href="help.css"/>
+
+<h1>Quick Topics</h1>
+
+
+<h3>Terminology</h3>
+<p><a href="a-04.html">What is a repository?</a></p>
+<h3>Opening and initialising things</h3>
+<p><a href="a-10.html">Someone gave me a repository URL and asked me to clone it</a></p>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/help/topics/04.txt	Thu Aug 18 16:37:27 2011 +0100
@@ -0,0 +1,39 @@
+{Terminology}
+
+What is a repository?
+
+When you use a version control system to keep track of your changes to
+a set of files, there are two different concepts you're dealing with:
+a _working copy_ and a _repository_.
+
+A _working copy_ is just a folder with your project's files in it.  It
+contains the versions of the files that you are working with now.
+
+ * EasyMercurial's "My Work" tab shows you which files you have been working on in your current working copy.
+
+A _repository_ is a record of the entire history of your project. When
+change something in the working copy, you can then commit it to the
+repository and your change gets added to the history.
+
+ * EasyMercurial's "History" tab shows you the changes that have been committed to your project's history in its repository.
+
+You can also go back and grab an older version from the repository if
+you find you need it.  (If you do this, then the working copy will be
+updated so as to contain that older version rather than the most
+recent one.)
+
+Older centralised version control systems use a separate database for
+the repository.  But with a distributed version control system such as
+Mercurial, the repository -- the entire history of your project files
+-- is stowed into a special folder inside the working copy on your
+hard drive.  Every change you commit gets added to the history in that
+hidden folder. (The history is compressed, so it doesn't take as much
+space as you might imagine.)
+
+The term _remote repository_ simply refers to a repository related to
+your local one, but stored on another computer somewhere else.  Often
+this may be a "master copy" of your project stored on a server
+elsewhere, which you and your collaborators can use to keep up with
+each other's work, or which you can use to make your work public, or
+simply use as a private backup.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/help/topics/10.txt	Thu Aug 18 16:37:27 2011 +0100
@@ -0,0 +1,36 @@
+{Opening and initialising things}
+
+Someone gave me a repository URL and asked me to clone it
+
+A Mercurial repository location is usually described by a URL, like
+that of a website.
+
+For example, the URL for the repository containing the source code for
+EasyMercurial itself is @https://bitbucket.org/cannam/easyhg@.
+
+To get a copy of the files in a repository, you need to _clone_ the
+repository from the remote URL into a folder on your own computer.  To
+do this,
+
+*1. Click the Open toolbar button or use File -> Open*
+
+#openremote50.png
+
+*2. Select "Remote Repository" as the thing you want to open*
+
+*3. Enter the repository URL into the URL field*
+
+*4. Give the name of a folder on your local computer to clone into* --
+ this folder will be created for you, so it shouldn't be one that already
+ exists
+
+*5. Click OK*
+
+If the remote repository has restricted access, you may be asked to
+provide a username and password to log in to the server it is hosted
+on.  If the repository is large, you may have to wait a while for all the
+data to be transferred.
+
+Provided the clone has been successful, you should now have a local
+repository to work in.
+
--- a/src/mainwindow.cpp	Thu Aug 18 16:37:11 2011 +0100
+++ b/src/mainwindow.cpp	Thu Aug 18 16:37:27 2011 +0100
@@ -35,6 +35,7 @@
 #include <QUrl>
 #include <QDialogButtonBox>
 #include <QTimer>
+#include <QTextBrowser>
 
 #include "mainwindow.h"
 #include "multichoicedialog.h"
@@ -57,7 +58,8 @@
     m_myDirPath(myDirPath),
     m_fsWatcherGeneralTimer(0),
     m_fsWatcherRestoreTimer(0),
-    m_fsWatcherSuspended(false)
+    m_fsWatcherSuspended(false),
+    m_helpDialog(0)
 {
     setWindowIcon(QIcon(":images/easyhg-icon.png"));
 
@@ -2534,6 +2536,7 @@
 {
     connect(m_exitAct, SIGNAL(triggered()), this, SLOT(close()));
     connect(m_aboutAct, SIGNAL(triggered()), this, SLOT(about()));
+    connect(m_helpAct, SIGNAL(triggered()), this, SLOT(help()));
 
     connect(m_hgRefreshAct, SIGNAL(triggered()), this, SLOT(hgRefresh()));
     connect(m_hgRemoveAct, SIGNAL(triggered()), this, SLOT(hgRemove()));
@@ -2925,6 +2928,12 @@
     m_hgServeAct->setStatusTip(tr("Serve local repository temporarily via HTTP for workgroup access"));
 
     //Help actions
+#ifdef Q_OS_MAC
+    m_helpAct = new QAction(tr("EasyMercurial Help"), this);
+#else
+    m_helpAct = new QAction(tr("Help Topics"), this);
+#endif
+    m_helpAct->setShortcuts(QKeySequence::HelpContents);
     m_aboutAct = new QAction(tr("About EasyMercurial"), this);
 
     // Miscellaneous
@@ -2973,6 +2982,7 @@
     remoteMenu->addAction(m_hgPushAct);
 
     m_helpMenu = menuBar()->addMenu(tr("&Help"));
+    m_helpMenu->addAction(m_helpAct);
     m_helpMenu->addAction(m_aboutAct);
 }
 
@@ -3082,3 +3092,24 @@
     settings.endGroup();
 }
 
+void MainWindow::help()
+{
+    if (!m_helpDialog) {
+        m_helpDialog = new QDialog;
+        QGridLayout *layout = new QGridLayout;
+        m_helpDialog->setLayout(layout);
+        QTextBrowser *text = new QTextBrowser;
+        text->setOpenExternalLinks(true);
+        layout->addWidget(text, 0, 0);
+        text->setSource(QUrl("qrc:help/topics.html"));
+        QDialogButtonBox *bb = new QDialogButtonBox(QDialogButtonBox::Close);
+        connect(bb, SIGNAL(rejected()), m_helpDialog, SLOT(hide()));
+        layout->addWidget(bb, 1, 0);
+        m_helpDialog->resize(450, 500);
+    }
+    QTextBrowser *tb = m_helpDialog->findChild<QTextBrowser *>();
+    if (tb) tb->home();
+    m_helpDialog->show();
+    m_helpDialog->raise();
+}
+
--- a/src/mainwindow.h	Thu Aug 18 16:37:11 2011 +0100
+++ b/src/mainwindow.h	Thu Aug 18 16:37:27 2011 +0100
@@ -57,6 +57,7 @@
 
 private slots:
     void about();
+    void help();
     void settings();
     void settings(SettingsDialog::Tab);
     void open();
@@ -234,11 +235,14 @@
 
     // Help menu actions
     QAction *m_aboutAct;
+    QAction *m_helpAct;
 
     QToolBar *m_fileToolBar;
     QToolBar *m_repoToolBar;
     QToolBar *m_workFolderToolBar;
 
+    QDialog *m_helpDialog;
+
     HgRunner *m_runner;
 
     bool m_shouldHgStat;