On 23/04/11 21:10, Michael Riepe wrote:
The obvious solution is to leave the button enabled and change its
function from "cancel" to "close" as soon as the export is finished.

- modify the cancel button to change it's text from cancel to close when
export completes, and instead activate the close handler. This could
also have a facecolour change from say yellow to green, perhaps ?

Why not give `cancel' a red background and change it back to normal when
the export is finished? I don't want to overdo the color thing. Besides
that, some people can't distinguish particular colors. Yellow and green
might look like similar shades of gray to them.

OK. Colour blindness is a good reason to use striking colors, and not alienate users.

I attach a patch that modifies progresswindow.cpp to perform the above.

Some queries:
1. To me, it would make sense to change "cancelbutton" to "cancelorclosebutton" to inform of it's new purpose. This seems to require changing the .ui as well as code in progresswindow.cpp/h

Shall I do that ?

2. If escape is pressed during export, the progress form disappears. However, export continues, and at the end, the progresswindow reappears, with the correct green-close button, and the button works.
[I think this may have always been present].

3. When changing the button's text/colour, I disable, change, re-enable. Is this necessary / useful ?

4. Is this a translated app ? Do I just use "Close", or does this need to access some i10n code / translation tables ?

Cheers,
David Timms.
--- src/progresswindow.cpp.orig 2011-02-11 23:27:18.000000000 +1100
+++ src/progresswindow.cpp      2011-04-24 10:36:35.417959154 +1000
@@ -51,6 +51,8 @@
   item->setFontWeight( QFont::Bold );
   item->setFontUnderline( TRUE );
 
+  cancelbutton->setPaletteBackgroundColor( QColor( 255,0,0 ) );
+
   show();
   qApp->processEvents();
   }
@@ -67,6 +69,9 @@
   {
   cancelbutton->setEnabled(false);
   waitingforclose=true;
+  cancelbutton->setText( "Close" );
+  cancelbutton->setPaletteBackgroundColor( QColor( 0,255,0 ) );
+  cancelbutton->setEnabled(true);
   exec();
   }
 
@@ -149,9 +154,18 @@
 
 void progresswindow::clickedcancel()
   {
-  cancelwasclicked=true;
-  cancelbutton->setEnabled(false);
-  qApp->processEvents();
+  if ((cancelwasclicked==false) && (waitingforclose==false)) {
+    // button function is cancel
+    cancelwasclicked=true;
+    cancelbutton->setEnabled(false);
+    qApp->processEvents();
+    cancelbutton->setText( "Close" );
+    cancelbutton->setPaletteBackgroundColor( QColor( 0,255,0 ) );
+    cancelbutton->setEnabled(true);
+  } else {
+    // button function is close
+    close();
+  }
   }
 
 QString progresswindow::quotetext(const char *text)
------------------------------------------------------------------------------
Fulfilling the Lean Software Promise
Lean software platforms are now widely adopted and the benefits have been 
demonstrated beyond question. Learn why your peers are replacing JEE 
containers with lightweight application servers - and what you can gain 
from the move. http://p.sf.net/sfu/vmware-sfemails
_______________________________________________
DVBCUT-user mailing list
DVBCUT-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dvbcut-user

Reply via email to