Author: sh-sh-sh
Date: Tue Sep 9 12:16:15 2008
New Revision: 50883
URL: http://svn.opensuse.org/viewcvs/yast?rev=50883&view=rev
Log:
Naming conventions
+ moved timeout busy cursor to separate function
Modified:
trunk/qt/src/YQUI.h
trunk/qt/src/YQUI_core.cc
trunk/qt/src/YQUI_x11.cc
Modified: trunk/qt/src/YQUI.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQUI.h?rev=50883&r1=50882&r2=50883&view=diff
==============================================================================
--- trunk/qt/src/YQUI.h (original)
+++ trunk/qt/src/YQUI.h Tue Sep 9 12:16:15 2008
@@ -217,6 +217,12 @@
void normalCursor();
/**
+ * Show mouse cursor indicating busy state if the UI is unable to respond
+ * to user input for more than a predefined timeout (200 millisec).
+ **/
+ void timeoutBusyCursor();
+
+ /**
* Open file selection box and let the user save y2logs to that location.
* (Shift-F8)
**/
@@ -230,15 +236,11 @@
/**
* Go into event loop until next user input is available.
- *
- * Reimplemented from YUI.
**/
YEvent * userInput( int timeout_millisec = 0 );
/**
* Check the event queue for user input. Don't wait.
- *
- * Reimplemented from YUI.
**/
YEvent * pollInput();
@@ -358,7 +360,10 @@
**/
YSimpleEventHandler _eventHandler;
- int blockedLevel;
+ /**
+ * Number of times that events were blocked
+ **/
+ int _blockedLevel;
/**
* Saved normal palette
Modified: trunk/qt/src/YQUI_core.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQUI_core.cc?rev=50883&r1=50882&r2=50883&view=diff
==============================================================================
--- trunk/qt/src/YQUI_core.cc (original)
+++ trunk/qt/src/YQUI_core.cc Tue Sep 9 12:16:15 2008
@@ -48,8 +48,6 @@
using std::max;
-#define BUSY_CURSOR_TIMEOUT 200 // milliseconds
-
static void qMessageHandler( QtMsgType type, const char * msg );
YQUI * YQUI::_ui = 0;
@@ -86,7 +84,7 @@
_usingVisionImpairedPalette = false;
_noborder = false;
screenShotNameTemplate = "";
- blockedLevel = 0;
+ _blockedLevel = 0;
qInstallMsgHandler( qMessageHandler );
@@ -247,7 +245,7 @@
qApp->setFont( yqApp()->currentFont() );
busyCursor();
- QObject::connect( _userInputTimer, SIGNAL( timeout() ),
+ QObject::connect( _userInputTimer, SIGNAL( timeout() ),
_signalReceiver, SLOT ( slotUserInputTimeout() ) );
QObject::connect( _busyCursorTimer, SIGNAL( timeout() ),
@@ -428,9 +426,13 @@
notifier->setEnabled( true );
+ // yuiDebug() << "Entering idle loop" << endl;
+
while ( !_leave_idle_loop )
_eventLoop->processEvents( QEventLoop::ExcludeUserInputEvents | QEventLoop::WaitForMoreEvents );
+ // yuiDebug() << "Leaving idle loop" << endl;
+
delete notifier;
}
@@ -446,6 +448,7 @@
if ( event )
{
_eventHandler.sendEvent( event );
+ // yuiDebug() << "Sending event " << event << endl;
if ( _do_exit_loop )
_eventLoop->exit( 1 );
@@ -453,13 +456,14 @@
}
-YEvent * YQUI::userInput( int timeout_millisec )
+YEvent *
+YQUI::userInput( int timeout_millisec )
{
initUI();
_eventHandler.blockEvents( false );
_eventLoop->wakeUp();
- blockedLevel = 0;
+ _blockedLevel = 0;
#if 0
yuiMilestone() << "userInput( " << timeout_millisec
@@ -482,15 +486,20 @@
normalCursor();
_do_exit_loop = true; // should exit_loop() be called in sendEvent()?
- _eventLoop->exec();
+
+ if ( ! _eventLoop->isRunning() )
+ {
+ // yuiDebug() << "Executing event loop" << endl;
+ _eventLoop->exec();
+ // yuiDebug() << "Event loop finished" << endl;
+ }
+ else
+ yuiDebug() << "Event loop still running" << endl;
+
_do_exit_loop = false;
event = _eventHandler.consumePendingEvent();
-
- // Display a busy cursor, but only if there is no other activity within
- // BUSY_CURSOR_TIMEOUT milliseconds: Avoid cursor flicker.
-
- _busyCursorTimer->start( BUSY_CURSOR_TIMEOUT ); // single shot
+ YQUI::ui()->timeoutBusyCursor();
}
_userInputTimer->stop();
@@ -499,7 +508,8 @@
}
-YEvent * YQUI::pollInput()
+YEvent *
+YQUI::pollInput()
{
YEvent * event = 0;
@@ -551,7 +561,7 @@
if ( block )
{
- if ( ++blockedLevel == 1 )
+ if ( ++_blockedLevel == 1 )
{
_eventHandler.blockEvents( true );
_eventLoop->exit();
@@ -559,7 +569,7 @@
}
else
{
- if ( --blockedLevel == 0 )
+ if ( --_blockedLevel == 0 )
{
_eventHandler.blockEvents( false );
_eventLoop->wakeUp();
Modified: trunk/qt/src/YQUI_x11.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQUI_x11.cc?rev=50883&r1=50882&r2=50883&view=diff
==============================================================================
--- trunk/qt/src/YQUI_x11.cc (original)
+++ trunk/qt/src/YQUI_x11.cc Tue Sep 9 12:16:15 2008
@@ -42,6 +42,9 @@
// like "Above", "Below" etc. that clash with some Qt headers.
#include