changeset 573:da2dd0e290ac

Merge
author Chris Cannam
date Tue, 06 Mar 2012 14:25:09 +0000
parents 88ec0ae91dcc (current diff) 012ba1b83328 (diff)
children f185ac2c49b5
files
diffstat 3 files changed, 25 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/hgaction.h	Tue Mar 06 14:24:48 2012 +0000
+++ b/src/hgaction.h	Tue Mar 06 14:25:09 2012 +0000
@@ -118,6 +118,20 @@
 	    return false;
 	}
     }
+
+    bool makesSenseToCancel() const {
+        switch (action) {
+        case ACT_INCOMING:
+        case ACT_PUSH:
+        case ACT_PULL:
+        case ACT_CLONEFROMREMOTE:
+        case ACT_FOLDERDIFF:
+        case ACT_CHGSETDIFF:
+            return true;
+        default:
+            return false;
+        }
+    }
 };
 
 #endif
--- a/src/hgrunner.cpp	Tue Mar 06 14:24:48 2012 +0000
+++ b/src/hgrunner.cpp	Tue Mar 06 14:25:09 2012 +0000
@@ -26,7 +26,7 @@
 #include <QTemporaryFile>
 #include <QDir>
 #include <QProgressBar>
-#include <QToolButton>
+#include <QPushButton>
 #include <QGridLayout>
 
 #include <iostream>
@@ -52,10 +52,11 @@
     m_progress = new QProgressBar;
     layout->addWidget(m_progress, 0, 0);
 
-    m_cancel = new QToolButton;
+    m_cancel = new QPushButton;
     m_cancel->setIcon(QIcon(":images/cancel-small.png"));
-    m_cancel->setToolButtonStyle(Qt::ToolButtonIconOnly);
-    m_cancel->setAutoRaise(true);
+    m_cancel->setFlat(true);
+    m_cancel->setFixedHeight(m_progress->sizeHint().height());
+    m_cancel->setFixedWidth(m_progress->sizeHint().height());
     connect(m_cancel, SIGNAL(clicked()), this, SLOT(killCurrentActions()));
     layout->addWidget(m_cancel, 0, 1);
 
@@ -538,7 +539,10 @@
 
     m_isRunning = true;
     m_progress->setRange(0, 0);
-    if (!action.shouldBeFast()) show();
+    if (!action.shouldBeFast()) {
+        show();
+        m_cancel->setVisible(action.makesSenseToCancel());
+    }
     m_stdout.clear();
     m_stderr.clear();
     m_realm = "";
--- a/src/hgrunner.h	Tue Mar 06 14:24:48 2012 +0000
+++ b/src/hgrunner.h	Tue Mar 06 14:25:09 2012 +0000
@@ -24,7 +24,7 @@
 #include <QProcess>
 
 class QProgressBar;
-class QToolButton;
+class QPushButton;
 class QFile;
 
 #include <deque>
@@ -88,7 +88,7 @@
     QString unbundleExtension();
 
     QProgressBar *m_progress;
-    QToolButton *m_cancel;
+    QPushButton *m_cancel;
 
     QStringList addExtensionOptions(QStringList);