Mailinglist Archive: yast-commit (1056 mails)
| < Previous | Next > |
[yast-commit] r44211 - in /trunk: core/libyui/src/ ncurses/src/ qt/src/
- From: sh-sh-sh@xxxxxxxxxxxxxxxx
- Date: Wed, 06 Feb 2008 17:36:19 -0000
- Message-id: <20080206173619.B177224839@xxxxxxxxxxxxxxxx>
Author: sh-sh-sh
Date: Wed Feb 6 18:36:19 2008
New Revision: 44211
URL: http://svn.opensuse.org/viewcvs/yast?rev=44211&view=rev
Log:
moved from YUI to YApplication
Modified:
trunk/core/libyui/src/UIBuiltinCalls.h
trunk/core/libyui/src/UIBuiltinTable.h
trunk/core/libyui/src/Y2UINamespace.cc
trunk/core/libyui/src/Y2UINamespace.h
trunk/core/libyui/src/YApplication.h
trunk/core/libyui/src/YUI.h
trunk/core/libyui/src/YUI_builtins.cc
trunk/ncurses/src/NCApplication.cc
trunk/ncurses/src/NCApplication.h
trunk/ncurses/src/YNCursesUI.cc
trunk/ncurses/src/YNCursesUI.h
trunk/qt/src/YQApplication.cc
trunk/qt/src/YQApplication.h
trunk/qt/src/YQUI.h
trunk/qt/src/YQUI_core.cc
trunk/qt/src/YQUI_x11.cc
Modified: trunk/core/libyui/src/UIBuiltinCalls.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/UIBuiltinCalls.h?rev=44211&r1=44210&r2=44211&view=diff
==============================================================================
--- trunk/core/libyui/src/UIBuiltinCalls.h (original)
+++ trunk/core/libyui/src/UIBuiltinCalls.h Wed Feb 6 18:36:19 2008
@@ -181,12 +181,9 @@
if (m_param2->isVoid()) {ycp2error("Parameter %d is
nil, %s is required", 2, "String"); return YCPVoid();}
if (m_param3->isVoid()) {ycp2error("Parameter %d is
nil, %s is required", 3, "String"); return YCPVoid();}
return m_instance->Recode (m_param1->asString(),
m_param2->asString(), m_param3->asString());
- case 52: // SetModulename
- if (m_param1->isVoid()) {ycp2error("Parameter %d is
nil, %s is required", 1, "String"); return YCPVoid();}
- return m_instance->SetModulename
(m_param1->asString());
- case 53: // HasSpecialWidget
+ case 52: // HasSpecialWidget
if (m_param1->isVoid()) {ycp2error("Parameter %d is
nil, %s is required", 1, "Symbol"); return YCPVoid();}
return m_instance->HasSpecialWidget
(m_param1->asSymbol());
- case 54: // WizardCommand
+ case 53: // WizardCommand
if (m_param1->isVoid()) {ycp2error("Parameter %d is
nil, %s is required", 1, "Term"); return YCPVoid();}
return m_instance->WizardCommand (m_param1->asTerm());
Modified: trunk/core/libyui/src/UIBuiltinTable.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/UIBuiltinTable.h?rev=44211&r1=44210&r2=44211&view=diff
==============================================================================
--- trunk/core/libyui/src/UIBuiltinTable.h (original)
+++ trunk/core/libyui/src/UIBuiltinTable.h Wed Feb 6 18:36:19 2008
@@ -104,9 +104,7 @@
_registered_functions.push_back ("SetFunctionKeys");
enterSymbol (new SymbolEntry (this, 51, "Recode",
SymbolEntry::c_function, Type::fromSignature ("any (string, string, string)") )
);
_registered_functions.push_back ("Recode");
- enterSymbol (new SymbolEntry (this, 52, "SetModulename",
SymbolEntry::c_function, Type::fromSignature ("void (string)") ) );
- _registered_functions.push_back ("SetModulename");
- enterSymbol (new SymbolEntry (this, 53, "HasSpecialWidget",
SymbolEntry::c_function, Type::fromSignature ("boolean (symbol)") ) );
+ enterSymbol (new SymbolEntry (this, 52, "HasSpecialWidget",
SymbolEntry::c_function, Type::fromSignature ("boolean (symbol)") ) );
_registered_functions.push_back ("HasSpecialWidget");
- enterSymbol (new SymbolEntry (this, 54, "WizardCommand",
SymbolEntry::c_function, Type::fromSignature ("boolean (term)") ) );
+ enterSymbol (new SymbolEntry (this, 53, "WizardCommand",
SymbolEntry::c_function, Type::fromSignature ("boolean (term)") ) );
_registered_functions.push_back ("WizardCommand");
Modified: trunk/core/libyui/src/Y2UINamespace.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/Y2UINamespace.cc?rev=44211&r1=44210&r2=44211&view=diff
==============================================================================
--- trunk/core/libyui/src/Y2UINamespace.cc (original)
+++ trunk/core/libyui/src/Y2UINamespace.cc Wed Feb 6 18:36:19 2008
@@ -557,16 +557,6 @@
YCPValue
-Y2UINamespace::SetModulename( const YCPString & name )
-{
- if ( YUIComponent::ui() )
- YUIComponent::ui()->evaluateSetModulename( name );
-
- return YCPVoid();
-}
-
-
-YCPValue
Y2UINamespace::HasSpecialWidget( const YCPSymbol & widget )
{
if ( YUIComponent::ui() )
Modified: trunk/core/libyui/src/Y2UINamespace.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/Y2UINamespace.h?rev=44211&r1=44210&r2=44211&view=diff
==============================================================================
--- trunk/core/libyui/src/Y2UINamespace.h (original)
+++ trunk/core/libyui/src/Y2UINamespace.h Wed Feb 6 18:36:19 2008
@@ -294,9 +294,6 @@
/* TYPEINFO: any (string, string, string) */
YCPValue Recode( const YCPString & from, const YCPString & to, const
YCPString & text );
- /* TYPEINFO: void (string) */
- YCPValue SetModulename( const YCPString & name );
-
/* TYPEINFO: boolean (symbol) */
YCPValue HasSpecialWidget( const YCPSymbol & widget );
Modified: trunk/core/libyui/src/YApplication.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YApplication.h?rev=44211&r1=44210&r2=44211&view=diff
==============================================================================
--- trunk/core/libyui/src/YApplication.h (original)
+++ trunk/core/libyui/src/YApplication.h Wed Feb 6 18:36:19 2008
@@ -215,18 +215,6 @@
const string & headline ) = 0;
/**
- * Run a shell command (typically an interactive program using NCurses)
- * in a terminal (window).
- *
- * This is useful for text UIs (e.g., NCurses) that need special
- * preparation prior to running an NCurses-based application and special
- * clean-up afterwards.
- *
- * This default implementation logs an error and returns with -1.
- **/
- virtual int runInTerminal( const string & command );
-
- /**
* Set the current product name ("openSUSE", "SLES", ...).
* This name will be expanded in help texts when the &product; entity is
* used.
@@ -271,6 +259,72 @@
**/
bool reverseLayout() const;
+ /**
+ * Change the (mouse) cursor to indicate busy status.
+ * This default implementation does nothing.
+ **/
+ virtual void busyCursor() {}
+
+ /**
+ * Change the (mouse) cursor back from busy status to normal.
+ * This default implementation does nothing.
+ **/
+ virtual void normalCursor() {}
+
+ /**
+ * Make a screen shot and save it to the specified file.
+ * This default implementation does nothing.
+ **/
+ virtual void makeScreenShot( const string & fileName ) {}
+
+ /**
+ * Beep.
+ * This default implementation does nothing.
+ **/
+ virtual void beep() {}
+
+
+ //
+ // NCurses (text mode) specific
+ //
+
+ /**
+ * Redraw the screen.
+ * This default implementation does nothing.
+ **/
+ virtual void redrawScreen() {}
+
+ /**
+ * Initialize the (text) console keyboard.
+ * This default implementation does nothing.
+ **/
+ virtual void initConsoleKeyboard() {}
+
+ /**
+ * Set the (text) console font according to the current encoding etc.
+ * See the setfont(8) command and the console HowTo for details.
+ *
+ * This default implementation does nothing.
+ **/
+ virtual void setConsoleFont( const string & console_magic,
+ const string & font,
+ const string & screen_map,
+ const string & unicode_map,
+ const string & encoding )
+ {}
+
+ /**
+ * Run a shell command (typically an interactive program using NCurses)
+ * in a terminal (window).
+ *
+ * This is useful for text UIs (e.g., NCurses) that need special
+ * preparation prior to running an NCurses-based application and special
+ * clean-up afterwards.
+ *
+ * This default implementation logs an error and returns -1.
+ **/
+ virtual int runInTerminal( const string & command );
+
//
// Display information.
Modified: trunk/core/libyui/src/YUI.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YUI.h?rev=44211&r1=44210&r2=44211&view=diff
==============================================================================
--- trunk/core/libyui/src/YUI.h (original)
+++ trunk/core/libyui/src/YUI.h Wed Feb 6 18:36:19 2008
@@ -239,7 +239,6 @@
void evaluateFakeUserInput ( const YCPValue &
next_input );
YCPMap evaluateGetDisplayInfo ();
YCPString evaluateGetLanguage ( const YCPBoolean &
strip_encoding );
- YCPValue evaluateGetModulename ( const YCPTerm & term
);
YCPString evaluateGetProductName ();
YCPString evaluateGlyph ( const YCPSymbol &
symbol );
YCPValue evaluateHasSpecialWidget ( const YCPSymbol &
widget );
@@ -265,7 +264,6 @@
YCPBoolean evaluateSetFocus ( const
YCPValue & value_id );
void evaluateSetFunctionKeys ( const YCPMap &
new_keys );
void evaluateSetLanguage ( const YCPString&
lang, const YCPString& encoding = YCPNull() );
- void evaluateSetModulename ( const YCPString &
name );
void evaluateSetProductName ( const
YCPString & name );
void evaluateStopRecordMacro ();
YCPBoolean evaluateWidgetExists ( const YCPValue &
value_id );
@@ -313,52 +311,6 @@
**/
virtual void idleLoop( int fd_ycp ) = 0;
-
- /**
- * UI-specific setConsoleFont() function.
- * Returns YCPVoid() if OK and YCPNull() on error.
- * This default implementation does nothing.
- **/
- virtual YCPValue setConsoleFont( const YCPString & console_magic,
- const YCPString & font,
- const YCPString & screen_map,
- const YCPString & unicode_map,
- const YCPString & encoding );
-
- virtual YCPValue setKeyboard();
-
- /**
- * UI-specific busyCursor function.
- * This default implementation does nothing.
- **/
- virtual void busyCursor();
-
- /**
- * UI-specific normalCursor function.
- * This default implementation does nothing.
- **/
- virtual void normalCursor();
-
- /**
- * UI-specific redrawScreen method.
- * This default implementation does nothing.
- **/
- virtual void redrawScreen();
-
- /**
- * UI-specific makeScreenShot function.
- * This default implementation does nothing.
- **/
- virtual void makeScreenShot( string filename );
-
- /**
- * UI-specific beep method.
- *
- * Emit acoustic signal or something equivalent.
- * This default implementation does nothing.
- **/
- virtual void beep();
-
/**
* UI-specific runPkgSelection method.
*
@@ -381,7 +333,6 @@
**/
void terminateUIThread();
-
/**
* Creates and launches the ui thread.
**/
Modified: trunk/core/libyui/src/YUI_builtins.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YUI_builtins.cc?rev=44211&r1=44210&r2=44211&view=diff
==============================================================================
--- trunk/core/libyui/src/YUI_builtins.cc (original)
+++ trunk/core/libyui/src/YUI_builtins.cc Wed Feb 6 18:36:19 2008
@@ -116,34 +116,6 @@
}
-
-/**
- * @builtin GetModulename
- * @short Gets the name of a Module
- * @description
- * This is tricky. The UI doesn't care about the current module
- * name, only the translator does. However, since the translator
- * acts as a filter between a client and the UI, it cant directly
- * return the module name. The current implementation inserts the
- * modules name in the translator and it arrives here as the term
- * argument. So the example has no arguments, but the internal code
- * checks for a string argument.
- * @return string
- *
- * @usage GetModulename()
- */
-
-YCPValue YUI::evaluateGetModulename( const YCPTerm & term )
-{
- if ( ( term->size() == 1 ) && ( term->value(0)->isString() ) )
- {
- return term->value(0);
- }
- else return YCPNull();
-}
-
-
-
/**
* @builtin SetLanguage
* @short Sets the language of the UI
@@ -229,10 +201,17 @@
* @usage SetConsoleFont( "( K", "lat2u-16.psf", "latin2u.scrnmap",
"lat2u.uni", "latin1" )
*/
-void YUI::evaluateSetConsoleFont( const YCPString & console_magic, const
YCPString & font,
- const YCPString & screen_map, const YCPString & unicode_map, const
YCPString & encoding )
-{
- setConsoleFont( console_magic, font, screen_map, unicode_map, encoding );
+void YUI::evaluateSetConsoleFont( const YCPString & console_magic,
+ const YCPString & font,
+ const YCPString & screen_map,
+ const YCPString & unicode_map,
+ const YCPString & encoding )
+{
+ YUI::app()->setConsoleFont( console_magic->value(),
+ font->value(),
+ screen_map->value(),
+ unicode_map->value(),
+ encoding->value() );
}
@@ -253,7 +232,7 @@
YCPInteger YUI::evaluateRunInTerminal(const YCPString & command )
{
- return YCPInteger( yApp()->runInTerminal( command->value() ) );
+ return YCPInteger( YUI::app()->runInTerminal( command->value() ) );
}
@@ -266,80 +245,7 @@
*/
void YUI::evaluateSetKeyboard( )
{
- setKeyboard( );
-}
-
-
-/*
- * Default UI-specific setKeyboard()
- * Returns OK ( YCPVoid() )
- */
-YCPValue YUI::setKeyboard( )
-{
- // NOP
-
- return YCPVoid(); // OK ( YCPNull() would mean error )
-}
-
-
-/*
- * Default UI-specific setConsoleFont()
- * Returns OK (YCPVoid())
- */
-YCPValue YUI::setConsoleFont( const YCPString & console_magic,
- const YCPString & font,
- const YCPString & screen_map,
- const YCPString & unicode_map,
- const YCPString & encoding )
-{
- // NOP
-
- return YCPVoid(); // OK ( YCPNull() would mean error )
-}
-
-
-/**
- * Default UI-specific busyCursor() - does nothing
- */
-void YUI::busyCursor()
-{
- // NOP
-}
-
-
-/**
- * Default UI-specific normalCursor() - does nothing
- */
-void YUI::normalCursor()
-{
- // NOP
-}
-
-
-/**
- * Default UI-specific redrawScreen() - does nothing
- */
-void YUI::redrawScreen()
-{
- // NOP
-}
-
-
-/**
- * Default UI-specific makeScreenShot() - does nothing
- */
-void YUI::makeScreenShot( string filename )
-{
- // NOP
-}
-
-
-/**
- * Default UI-specific beep() - does nothing
- */
-void YUI::beep()
-{
- // NOP
+ YUI::app()->initConsoleKeyboard();
}
@@ -650,7 +556,7 @@
}
}
- blockEvents(); // Prevent self-generated events from UI built-ins.
+ YUI::ui()->blockEvents(); // Prevent self-generated events from UI
built-ins.
bool ok = true;
@@ -676,7 +582,7 @@
YCPErrorDialog::exceptionDialog( "UI Syntax Error", exception );
}
- unblockEvents();
+ YUI::ui()->unblockEvents();
return YCPBoolean( ok );
}
@@ -695,9 +601,9 @@
YCPValue YUI::evaluateCloseDialog()
{
- blockEvents(); // We don't want self-generated events from UI builtins.
+ YUI::ui()->blockEvents(); // We don't want self-generated events from UI
builtins.
YDialog::deleteTopmostDialog();
- unblockEvents();
+ YUI::ui()->unblockEvents();
return YCPBoolean( true );
}
@@ -727,7 +633,7 @@
try
{
- blockEvents(); // We don't want self-generated events from
UI::ChangeWidget().
+ YUI::ui()->blockEvents(); // We don't want self-generated events
from UI::ChangeWidget().
if ( ! YCPDialogParser::isSymbolOrId( idValue ) )
{
@@ -788,7 +694,7 @@
ret = YCPNull();
}
- unblockEvents();
+ YUI::ui()->unblockEvents();
return ret;
}
@@ -895,7 +801,7 @@
idValue->toString().c_str() ) );
}
- blockEvents(); // Prevent self-generated events
+ YUI::ui()->blockEvents(); // Prevent self-generated events
YCPValue id = YCPDialogParser::parseIdTerm( idValue );
YWidget * widget = YCPDialogParser::findWidgetWithId( id,
true ); // throw
if not found
@@ -936,7 +842,7 @@
YCPErrorDialog::exceptionDialog( "UI Syntax Error", exception );
}
- unblockEvents();
+ YUI::ui()->unblockEvents();
return YCPBoolean( success );
}
@@ -978,9 +884,9 @@
if ( ! wizard )
return YCPBoolean( false );
- blockEvents(); // Avoid self-generated events from builtins
+ YUI::ui()->blockEvents(); // Avoid self-generated events from builtins
bool ret = YCPWizardCommandParser::parseAndExecute( wizard, command );
- unblockEvents();
+ YUI::ui()->unblockEvents();
return YCPBoolean( ret );
}
@@ -1033,50 +939,49 @@
void YUI::evaluateBusyCursor()
{
- busyCursor();
+ YUI::app()->busyCursor();
}
-
/**
- * @builtin RedrawScreen
- * @short Redraws the screen
+ * @builtin NormalCursor
+ * @short Sets the mouse cursor to the normal cursor
* @description
- * Redraws the screen after it very likely has become garbled by some other
output.
+ * Sets the mouse cursor to the normal cursor (after BusyCursor), if the UI
+ * supports such a feature.
*
- * This should normally not be necessary: The (specific) UI redraws the screen
- * automatically whenever required. Under rare circumstances, however, the
- * screen might have changes due to circumstances beyond the UI's control: For
- * text based UIs, for example, system commands that cause output to every tty
- * might make this necessary. Call this in the YCP code after such a command.
+ * This should normally not be necessary. The UI handles mouse cursors itself:
+ * When input is possible (i.e. inside UserInput() ), there is automatically a
+ * normal cursor, otherwise, there is the busy cursor. Override this at your
+ * own risk.
*
* @return void
*/
-void YUI::evaluateRedrawScreen()
+void YUI::evaluateNormalCursor()
{
- redrawScreen();
+ YUI::app()->normalCursor();
}
/**
- * @builtin NormalCursor
- * @short Sets the mouse cursor to the normal cursor
+ * @builtin RedrawScreen
+ * @short Redraws the screen
* @description
- * Sets the mouse cursor to the normal cursor (after BusyCursor), if the UI
- * supports such a feature.
+ * Redraws the screen after it very likely has become garbled by some other
output.
*
- * This should normally not be necessary. The UI handles mouse cursors itself:
- * When input is possible (i.e. inside UserInput() ), there is automatically a
- * normal cursor, otherwise, there is the busy cursor. Override this at your
- * own risk.
+ * This should normally not be necessary: The (specific) UI redraws the screen
+ * automatically whenever required. Under rare circumstances, however, the
+ * screen might have changes due to circumstances beyond the UI's control: For
+ * text based UIs, for example, system commands that cause output to every tty
+ * might make this necessary. Call this in the YCP code after such a command.
*
* @return void
*/
-void YUI::evaluateNormalCursor()
+void YUI::evaluateRedrawScreen()
{
- normalCursor();
+ YUI::app()->redrawScreen();
}
@@ -1094,7 +999,7 @@
void YUI::evaluateMakeScreenShot( const YCPString & filename )
{
- makeScreenShot( filename->value () );
+ YUI::app()->makeScreenShot( filename->value () );
}
@@ -1126,9 +1031,10 @@
*/
void YUI::evaluateBeep()
{
- beep();
+ YUI::app()->beep();
}
+
/**
* @builtin RecordMacro
* @short Records Macro into a file
@@ -1278,7 +1184,7 @@
YCPMap YUI::evaluateGetDisplayInfo()
{
YCPMap info_map;
- YApplication * app = yApp(); // slight optimization
+ YApplication * app = YUI::app(); // slight optimization
info_map->add( YCPString( YUICap_Width ), YCPInteger(
app->displayWidth() ) );
info_map->add( YCPString( YUICap_Height ), YCPInteger(
app->displayHeight() ) );
Modified: trunk/ncurses/src/NCApplication.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/NCApplication.cc?rev=44211&r1=44210&r2=44211&view=diff
==============================================================================
--- trunk/ncurses/src/NCApplication.cc (original)
+++ trunk/ncurses/src/NCApplication.cc Wed Feb 6 18:36:19 2008
@@ -99,9 +99,56 @@
}
-/**
- * Run external program supplied as string parameter the same terminal.
- **/
+void
+NCApplication::beep()
+{
+ ::beep();
+}
+
+
+void NCApplication::redrawScreen()
+{
+ YNCursesUI::ui()->Refresh();
+}
+
+
+void
+NCApplication::initConsoleKeyboard()
+{
+ string cmd = "/bin/dumpkeys | /bin/loadkeys --unicode";
+ if ( NCstring::terminalEncoding() == "UTF-8" )
+ {
+ int ret = system( (cmd + " >/dev/null 2>&1").c_str() );
+ if ( ret != 0 )
+ {
+ NCERR << "ERROR: /bin/dumpkeys | /bin/loadkeys --unicode returned:
"<< ret << endl;
+ }
+ }
+}
+
+
+void
+NCApplication::setConsoleFont( const string & console_magic,
+ const string & font,
+ const string & screen_map,
+ const string & unicode_map,
+ const string & encoding )
+{
+ /**
+ * Moving that code from YNCursesUI to this class turned out to be
+ * impossible (or at least a lot more work than it's worth) that I finally
+ * gave it up.
+ *
+ * - sh@xxxxxxx 2008-02-06
+ **/
+ YNCursesUI::ui()->setConsoleFont( console_magic,
+ font,
+ screen_map,
+ unicode_map,
+ encoding );
+}
+
+
int
NCApplication::runInTerminal( const string & cmd )
{
Modified: trunk/ncurses/src/NCApplication.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/NCApplication.h?rev=44211&r1=44210&r2=44211&view=diff
==============================================================================
--- trunk/ncurses/src/NCApplication.h (original)
+++ trunk/ncurses/src/NCApplication.h Wed Feb 6 18:36:19 2008
@@ -117,6 +117,39 @@
const string & headline );
/**
+ * Beep.
+ *
+ * Reimplemented from YApplication.
+ **/
+ virtual void beep();
+
+ /**
+ * Redraw the screen.
+ *
+ * Reimplemented from YApplication.
+ **/
+ virtual void redrawScreen();
+
+ /**
+ * Initialize the (text) console keyboard.
+ *
+ * Reimplemented from YApplication.
+ **/
+ virtual void initConsoleKeyboard();
+
+ /**
+ * Set the (text) console font according to the current encoding etc.
+ * See the setfont(8) command and the console HowTo for details.
+ *
+ * Reimplemented from YApplication.
+ **/
+ virtual void setConsoleFont( const string & console_magic,
+ const string & font,
+ const string & screen_map,
+ const string & unicode_map,
+ const string & encoding );
+
+ /**
* Run a shell command (typically an interactive program using NCurses)
* in a terminal (window).
*
Modified: trunk/ncurses/src/YNCursesUI.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/YNCursesUI.cc?rev=44211&r1=44210&r2=44211&view=diff
==============================================================================
--- trunk/ncurses/src/YNCursesUI.cc (original)
+++ trunk/ncurses/src/YNCursesUI.cc Wed Feb 6 18:36:19 2008
@@ -257,114 +257,6 @@
///////////////////////////////////////////////////////////////////
//
//
-// METHOD NAME : YNCursesUI::setKeyboard
-// METHOD TYPE : YCPValue
-//
-//
-YCPValue YNCursesUI::setKeyboard()
-{
- string cmd = "/bin/dumpkeys | /bin/loadkeys --unicode";
- if ( NCstring::terminalEncoding() == "UTF-8" )
- {
- int ret = system( (cmd + " >/dev/null 2>&1").c_str() );
- if ( ret != 0 )
- {
- NCERR << "ERROR: /bin/dumpkeys | /bin/loadkeys --unicode returned:
"<< ret << endl;
- }
- }
-
- return YCPVoid();
-}
-
-///////////////////////////////////////////////////////////////////
-//
-//
-// METHOD NAME : YNCursesUI::setConsoleFont
-// METHOD TYPE : YCPValue
-//
-// DESCRIPTION : UI::setConsoleFont() is called in Console.ycp.
-// The terminal encoding must be set correctly.
-//
-YCPValue YNCursesUI::setConsoleFont( const YCPString & console_magic,
- const YCPString & font,
- const YCPString & screen_map,
- const YCPString & unicode_map,
- const YCPString & lang )
-{
- string cmd( "setfont" );
- cmd += " -C " + myTerm;
- cmd += " " + font->value();
- if ( !screen_map->value().empty() )
- cmd += " -m " + screen_map->value();
- if ( !unicode_map->value().empty() )
- cmd += " -u " + unicode_map->value();
-
- UIMIL << cmd << endl;
- int ret = system( (cmd + " >/dev/null 2>&1").c_str() );
-
- // setfont returns error if called e.g. on a xterm -> return YCPVoid()
- if ( ret ) {
- UIERR << cmd.c_str() << " returned " << ret << endl;
- Refresh();
- return YCPVoid();
- }
- // go on in case of a "real" console
- cmd = "(echo -en \"\\033";
- if ( console_magic->value().length() )
- cmd += console_magic->value();
- else
- cmd += "(B";
- cmd += "\" >" + myTerm + ")";
- UIMIL << cmd << endl;
- ret = system( (cmd + " >/dev/null 2>&1").c_str() );
- if ( ret ) {
- UIERR << cmd.c_str() << " returned " << ret << endl;
- }
-
- // set terminal encoding for console
- // (setConsoleFont() in Console.ycp has passed the encoding as last argument
- // but this encoding was not correct; now Console.ycp passes the language)
-
- // if the encoding is NOT UTF-8 set the console encoding according to the
language
- if ( NCstring::terminalEncoding() != "UTF-8" )
- {
- string language = lang->value();
- string::size_type pos = language.find( '.' );
-
- if ( pos != string::npos )
- {
- language.erase( pos );
- }
- pos = language.find( '_' );
- if ( pos != string::npos )
- {
- language.erase( pos );
- }
-
- string code = language2encoding( language );
-
- NCMIL << "setConsoleFont( ENCODING: " << code << " )" << endl;
-
- if ( NCstring::setTerminalEncoding( code ) )
- {
- Redraw();
- }
- else
- {
- Refresh();
- }
- }
- else
- {
- Refresh();
- }
-
- return YCPVoid();
-}
-
-///////////////////////////////////////////////////////////////////
-//
-//
// METHOD NAME : YNCursesUI::init_title
// METHOD TYPE : void
//
@@ -404,17 +296,92 @@
return true;
}
+
///////////////////////////////////////////////////////////////////
//
//
-// METHOD NAME : YNCursesUI::beep()
-// METHOD TYPE : void
+// METHOD NAME : YNCursesUI::setConsoleFont
//
-// DESCRIPTION : beeps the system bell
+// DESCRIPTION : UI::setConsoleFont() is called in Console.ycp.
+// The terminal encoding must be set correctly.
//
-void YNCursesUI::beep()
+/**
+ * This doesn't belong here, but it is so utterly entangled with member
+ * variables that are not exported at all (sic!) that it's not really feasible
+ * to extract the relevant parts.
+ **/
+void YNCursesUI::setConsoleFont( const string & console_magic,
+ const string & font,
+ const string & screen_map,
+ const string & unicode_map,
+ const string & encoding )
{
- ::beep();
-}
+ string cmd( "setfont" );
+ cmd += " -C " + myTerm;
+ cmd += " " + font;
+ if ( !screen_map.empty() )
+ cmd += " -m " + screen_map;
+ if ( !unicode_map.empty() )
+ cmd += " -u " + unicode_map;
+
+ UIMIL << cmd << endl;
+ int ret = system( (cmd + " >/dev/null 2>&1").c_str() );
+
+ // setfont returns error if called e.g. on a xterm -> return YCPVoid()
+ if ( ret ) {
+ UIERR << cmd.c_str() << " returned " << ret << endl;
+ Refresh();
+ return;
+ }
+ // go on in case of a "real" console
+ cmd = "(echo -en \"\\033";
+ if ( console_magic.length() )
+ cmd += console_magic;
+ else
+ cmd += "(B";
+ cmd += "\" >" + myTerm + ")";
+ UIMIL << cmd << endl;
+ ret = system( (cmd + " >/dev/null 2>&1").c_str() );
+ if ( ret ) {
+ UIERR << cmd.c_str() << " returned " << ret << endl;
+ }
+
+ // set terminal encoding for console
+ // (setConsoleFont() in Console.ycp has passed the encoding as last
+ // argument but this encoding was not correct; now Console.ycp passes the
+ // language) if the encoding is NOT UTF-8 set the console encoding
+ // according to the language
+
+ if ( NCstring::terminalEncoding() != "UTF-8" )
+ {
+ string language = YUI::app()->language();
+ string::size_type pos = language.find( '.' );
+ if ( pos != string::npos )
+ {
+ language.erase( pos );
+ }
+ pos = language.find( '_' );
+ if ( pos != string::npos )
+ {
+ language.erase( pos );
+ }
+
+ string code = language2encoding( language );
+ NCMIL << "setConsoleFont( ENCODING: " << code << " )" << endl;
+
+ if ( NCstring::setTerminalEncoding( code ) )
+ {
+ Redraw();
+ }
+ else
+ {
+ Refresh();
+ }
+ }
+ else
+ {
+ Refresh();
+ }
+}
Modified: trunk/ncurses/src/YNCursesUI.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/YNCursesUI.h?rev=44211&r1=44210&r2=44211&view=diff
==============================================================================
--- trunk/ncurses/src/YNCursesUI.h (original)
+++ trunk/ncurses/src/YNCursesUI.h Wed Feb 6 18:36:19 2008
@@ -107,40 +107,30 @@
virtual void idleLoop( int fd_ycp );
/**
+ * Set the (text) console font according to the current encoding etc.
+ * See the setfont(8) command and the console HowTo for details.
+ *
+ * This should really be in NCApplication, but it uses so many non-exported
+ * member variables that it's not easy to move it there.
+ **/
+ virtual void setConsoleFont( const string & console_magic,
+ const string & font,
+ const string & screen_map,
+ const string & unicode_map,
+ const string & encoding );
+
+ /**
* Fills the PackageSelector widget and runs package selection.
*/
virtual YEvent * runPkgSelection( YWidget * packageSelector );
/**
- * UI-specific setConsoleFont() function.
- * Returns YCPVoid() if OK and YCPNull() on error.
- */
- virtual YCPValue setConsoleFont ( const YCPString & console_magic,
- const YCPString & font,
- const YCPString & screen_map,
- const YCPString & unicode_map,
- const YCPString & encoding );
-
- virtual YCPValue setKeyboard ( );
-
- /**
- * UI-specific beep() function.
- * Beeps the system bell.
- */
- virtual void beep();
-
- /**
* Returns the package selector plugin singleton of this UI or creates it
* (including loading the plugin lib) if it does not exist yet.
**/
NCPackageSelectorPlugin * packageSelectorPlugin();
-
- /**
- * UI-specific redrawScreen method.
- * This default implementation does nothing.
- */
- virtual void redrawScreen() { Refresh(); }
};
+
#endif // YNCursesUI_h
Modified: trunk/qt/src/YQApplication.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQApplication.cc?rev=44211&r1=44210&r2=44211&view=diff
==============================================================================
--- trunk/qt/src/YQApplication.cc (original)
+++ trunk/qt/src/YQApplication.cc Wed Feb 6 18:36:19 2008
@@ -635,12 +635,7 @@
}
-/**
- * UI-specific conversion from logical layout spacing units (80x25)
- * to device dependent units (640x480).
- **/
-int
-YQApplication::deviceUnits( YUIDimension dim, float layoutUnits )
+int YQApplication::deviceUnits( YUIDimension dim, float layoutUnits )
{
if ( dim==YD_HORIZ ) layoutUnits *= ( 640.0/80 );
else layoutUnits *= ( 480.0/25 );
@@ -649,15 +644,7 @@
}
-/**
- * Default conversion from device dependent layout spacing units (640x480)
- * to logical layout units (80x25).
- *
- * This default function assumes 80x25 units.
- * Derived UIs may want to reimplement this.
- **/
-float
-YQApplication::layoutUnits( YUIDimension dim, int deviceUnits )
+float YQApplication::layoutUnits( YUIDimension dim, int deviceUnits )
{
float size = (float) deviceUnits;
@@ -668,6 +655,28 @@
}
+void YQApplication::beep()
+{
+ qApp->beep();
+}
+
+
+void YQApplication::busyCursor()
+{
+ YQUI::ui()->busyCursor();
+}
+
+
+void YQApplication::normalCursor()
+{
+ YQUI::ui()->normalCursor();
+}
+
+
+void YQApplication::makeScreenShot( const string & fileName )
+{
+ YQUI::ui()->makeScreenShot( fileName );
+}
#include "YQApplication.moc"
Modified: trunk/qt/src/YQApplication.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQApplication.h?rev=44211&r1=44210&r2=44211&view=diff
==============================================================================
--- trunk/qt/src/YQApplication.h (original)
+++ trunk/qt/src/YQApplication.h Wed Feb 6 18:36:19 2008
@@ -234,6 +234,34 @@
**/
virtual float layoutUnits( YUIDimension dim, int deviceUnits );
+ /**
+ * Change the (mouse) cursor to indicate busy status.
+ *
+ * Reimplemented from YApplication.
+ **/
+ virtual void busyCursor();
+
+ /**
+ * Change the (mouse) cursor back from busy status to normal.
+ *
+ * Reimplemented from YApplication.
+ **/
+ virtual void normalCursor();
+
+ /**
+ * Make a screen shot and save it to the specified file.
+ *
+ * Reimplemented from YApplication.
+ **/
+ virtual void makeScreenShot( const string & fileName );
+
+ /**
+ * Beep.
+ *
+ * Reimplemented from YApplication.
+ **/
+ virtual void beep();
+
// Display information and UI capabilities.
//
Modified: trunk/qt/src/YQUI.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQUI.h?rev=44211&r1=44210&r2=44211&view=diff
==============================================================================
--- trunk/qt/src/YQUI.h (original)
+++ trunk/qt/src/YQUI.h Wed Feb 6 18:36:19 2008
@@ -41,7 +41,7 @@
class YQOptionalWidgetFactory;
class YQWidgetFactory;
class YQApplication;
-class YQUI_Ui;
+class YQUISignalReceiver;
using std::string;
using std::vector;
@@ -49,7 +49,7 @@
class YQUI: public YUI
{
- friend class YQUI_Ui;
+ friend class YQUISignalReceiver;
public:
@@ -205,21 +205,17 @@
virtual bool eventsBlocked() const;
/**
- * Beep - activate the system (X11) bell.
- *
- * Reimplemented from YUI.
+ * Show mouse cursor indicating busy state.
**/
- void beep();
-
+ void busyCursor();
+
/**
- * Show pointer cursor.
- *
- * Reimplemented from YUI.
+ * Show normal mouse cursor not indicating busy status.
**/
void normalCursor();
/**
- * Open file selection box and let the user Save y2logs to that location.
+ * Open file selection box and let the user save y2logs to that location.
* (Shift-F8)
**/
void askSaveLogs();
@@ -270,16 +266,7 @@
**/
bool usingVisionImpairedPalette() const { return
_usingVisionImpairedPalette; }
- /**
- * Show hourglass cursor.
- *
- * Reimplemented from YUI.
- **/
- virtual void busyCursor();
-
-protected:
-
-
+
protected:
/**
@@ -314,7 +301,6 @@
void leaveIdleLoop();
-
//
// Data members
@@ -406,33 +392,28 @@
*/
QY2Styler *_styler;
- YQUI_Ui *_qobject;
+ YQUISignalReceiver * _signalReceiver;
};
-
-class YQUI_Ui : public QObject
+/**
+ * Helper class that acts as a Qt signal receiver for YQUI.
+ * YQUI itself cannot be a QObject to avoid problems with starting up the UI
+ * with multiple threads.
+ **/
+class YQUISignalReceiver : public QObject
{
Q_OBJECT
public:
- YQUI_Ui();
+ YQUISignalReceiver();
public slots:
- /**
- * Show hourglass cursor.
- *
- * Reimplemented from YUI.
- **/
void slotBusyCursor();
-
- /**
- * Timeout during TimeoutUserInput() / WaitForEvent()
- **/
void slotUserInputTimeout();
-
void slotLeaveIdleLoop();
};
+
#endif // YQUI_h
Modified: trunk/qt/src/YQUI_core.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQUI_core.cc?rev=44211&r1=44210&r2=44211&view=diff
==============================================================================
--- trunk/qt/src/YQUI_core.cc (original)
+++ trunk/qt/src/YQUI_core.cc Wed Feb 6 18:36:19 2008
@@ -88,10 +88,6 @@
topmostConstructorHasFinished();
}
-YQUI_Ui::YQUI_Ui()
- : QObject()
-{
-}
void YQUI::init_ui()
{
@@ -105,11 +101,11 @@
new QApplication( _ui_argc, _ui_argv);
- _qobject = new YQUI_Ui();
- _busy_cursor_timer = new QTimer( _qobject );
+ _signalReceiver = new YQUISignalReceiver();
+ _busy_cursor_timer = new QTimer( _signalReceiver );
_busy_cursor_timer->setSingleShot( true );
- _user_input_timer = new QTimer( _qobject );
+ _user_input_timer = new QTimer( _signalReceiver );
_user_input_timer->setSingleShot( true );
_normalPalette = qApp->palette();
@@ -211,10 +207,10 @@
busyCursor();
QObject::connect( _user_input_timer, SIGNAL( timeout() ),
- _qobject, SLOT ( slotUserInputTimeout()
) );
+ _signalReceiver, SLOT (
slotUserInputTimeout() ) );
QObject::connect( _busy_cursor_timer, SIGNAL( timeout() ),
- _qobject, SLOT ( slotBusyCursor() ) );
+ _signalReceiver, SLOT (
slotBusyCursor() ) );
#warning macro_file
// if ( macro_file )
@@ -294,7 +290,7 @@
qApp->exit();
qApp->deleteLater();
- delete _qobject;
+ delete _signalReceiver;
}
@@ -387,8 +383,8 @@
// process Qt events until fd_ycp is readable.
QSocketNotifier * notifier = new QSocketNotifier( fd_ycp,
QSocketNotifier::Read );
- QObject::connect( notifier, SIGNAL( activated ( int ) ),
- _qobject, SLOT( slotLeaveIdleLoop() ) );
+ QObject::connect( notifier, SIGNAL( activated( int ) ),
+ _signalReceiver, SLOT ( slotLeaveIdleLoop() ) );
notifier->setEnabled( true );
@@ -405,12 +401,6 @@
}
-void YQUI_Ui::slotLeaveIdleLoop()
-{
- YQUI::ui()->leaveIdleLoop();
-}
-
-
void YQUI::sendEvent( YEvent * event )
{
if ( event )
@@ -493,11 +483,6 @@
}
-void YQUI_Ui::slotUserInputTimeout()
-{
- YQUI::ui()->userInputTimeout();
-}
-
void YQUI::userInputTimeout()
{
if ( ! pendingEvent() )
@@ -548,6 +533,36 @@
return _event_handler.eventsBlocked();
}
+
+
+
+
+YQUISignalReceiver::YQUISignalReceiver()
+ : QObject()
+{
+}
+
+
+void YQUISignalReceiver::slotBusyCursor()
+{
+ YQUI::ui()->busyCursor();
+}
+
+
+void YQUISignalReceiver::slotUserInputTimeout()
+{
+ YQUI::ui()->userInputTimeout();
+}
+
+
+void YQUISignalReceiver::slotLeaveIdleLoop()
+{
+ YQUI::ui()->leaveIdleLoop();
+}
+
+
+
+
static void
qMessageHandler( QtMsgType type, const char * msg )
{
Modified: trunk/qt/src/YQUI_x11.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQUI_x11.cc?rev=44211&r1=44210&r2=44211&view=diff
==============================================================================
--- trunk/qt/src/YQUI_x11.cc (original)
+++ trunk/qt/src/YQUI_x11.cc Wed Feb 6 18:36:19 2008
@@ -50,26 +50,13 @@
}
-void YQUI::beep()
-{
- qApp->beep();
-}
-
-void
-YQUI_Ui::slotBusyCursor()
-{
- YQUI::ui()->busyCursor();
-}
-
-void
-YQUI::busyCursor( void )
+void YQUI::busyCursor()
{
qApp->setOverrideCursor( Qt::BusyCursor );
}
-void
-YQUI::normalCursor( void )
+void YQUI::normalCursor()
{
if ( _busy_cursor_timer->isActive() )
_busy_cursor_timer->stop();
@@ -131,6 +118,9 @@
}
+/**
+ * Handle WM_CLOSE
+ **/
bool YQUI::close()
{
sendEvent( new YCancelEvent() );
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx
Date: Wed Feb 6 18:36:19 2008
New Revision: 44211
URL: http://svn.opensuse.org/viewcvs/yast?rev=44211&view=rev
Log:
moved from YUI to YApplication
Modified:
trunk/core/libyui/src/UIBuiltinCalls.h
trunk/core/libyui/src/UIBuiltinTable.h
trunk/core/libyui/src/Y2UINamespace.cc
trunk/core/libyui/src/Y2UINamespace.h
trunk/core/libyui/src/YApplication.h
trunk/core/libyui/src/YUI.h
trunk/core/libyui/src/YUI_builtins.cc
trunk/ncurses/src/NCApplication.cc
trunk/ncurses/src/NCApplication.h
trunk/ncurses/src/YNCursesUI.cc
trunk/ncurses/src/YNCursesUI.h
trunk/qt/src/YQApplication.cc
trunk/qt/src/YQApplication.h
trunk/qt/src/YQUI.h
trunk/qt/src/YQUI_core.cc
trunk/qt/src/YQUI_x11.cc
Modified: trunk/core/libyui/src/UIBuiltinCalls.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/UIBuiltinCalls.h?rev=44211&r1=44210&r2=44211&view=diff
==============================================================================
--- trunk/core/libyui/src/UIBuiltinCalls.h (original)
+++ trunk/core/libyui/src/UIBuiltinCalls.h Wed Feb 6 18:36:19 2008
@@ -181,12 +181,9 @@
if (m_param2->isVoid()) {ycp2error("Parameter %d is
nil, %s is required", 2, "String"); return YCPVoid();}
if (m_param3->isVoid()) {ycp2error("Parameter %d is
nil, %s is required", 3, "String"); return YCPVoid();}
return m_instance->Recode (m_param1->asString(),
m_param2->asString(), m_param3->asString());
- case 52: // SetModulename
- if (m_param1->isVoid()) {ycp2error("Parameter %d is
nil, %s is required", 1, "String"); return YCPVoid();}
- return m_instance->SetModulename
(m_param1->asString());
- case 53: // HasSpecialWidget
+ case 52: // HasSpecialWidget
if (m_param1->isVoid()) {ycp2error("Parameter %d is
nil, %s is required", 1, "Symbol"); return YCPVoid();}
return m_instance->HasSpecialWidget
(m_param1->asSymbol());
- case 54: // WizardCommand
+ case 53: // WizardCommand
if (m_param1->isVoid()) {ycp2error("Parameter %d is
nil, %s is required", 1, "Term"); return YCPVoid();}
return m_instance->WizardCommand (m_param1->asTerm());
Modified: trunk/core/libyui/src/UIBuiltinTable.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/UIBuiltinTable.h?rev=44211&r1=44210&r2=44211&view=diff
==============================================================================
--- trunk/core/libyui/src/UIBuiltinTable.h (original)
+++ trunk/core/libyui/src/UIBuiltinTable.h Wed Feb 6 18:36:19 2008
@@ -104,9 +104,7 @@
_registered_functions.push_back ("SetFunctionKeys");
enterSymbol (new SymbolEntry (this, 51, "Recode",
SymbolEntry::c_function, Type::fromSignature ("any (string, string, string)") )
);
_registered_functions.push_back ("Recode");
- enterSymbol (new SymbolEntry (this, 52, "SetModulename",
SymbolEntry::c_function, Type::fromSignature ("void (string)") ) );
- _registered_functions.push_back ("SetModulename");
- enterSymbol (new SymbolEntry (this, 53, "HasSpecialWidget",
SymbolEntry::c_function, Type::fromSignature ("boolean (symbol)") ) );
+ enterSymbol (new SymbolEntry (this, 52, "HasSpecialWidget",
SymbolEntry::c_function, Type::fromSignature ("boolean (symbol)") ) );
_registered_functions.push_back ("HasSpecialWidget");
- enterSymbol (new SymbolEntry (this, 54, "WizardCommand",
SymbolEntry::c_function, Type::fromSignature ("boolean (term)") ) );
+ enterSymbol (new SymbolEntry (this, 53, "WizardCommand",
SymbolEntry::c_function, Type::fromSignature ("boolean (term)") ) );
_registered_functions.push_back ("WizardCommand");
Modified: trunk/core/libyui/src/Y2UINamespace.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/Y2UINamespace.cc?rev=44211&r1=44210&r2=44211&view=diff
==============================================================================
--- trunk/core/libyui/src/Y2UINamespace.cc (original)
+++ trunk/core/libyui/src/Y2UINamespace.cc Wed Feb 6 18:36:19 2008
@@ -557,16 +557,6 @@
YCPValue
-Y2UINamespace::SetModulename( const YCPString & name )
-{
- if ( YUIComponent::ui() )
- YUIComponent::ui()->evaluateSetModulename( name );
-
- return YCPVoid();
-}
-
-
-YCPValue
Y2UINamespace::HasSpecialWidget( const YCPSymbol & widget )
{
if ( YUIComponent::ui() )
Modified: trunk/core/libyui/src/Y2UINamespace.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/Y2UINamespace.h?rev=44211&r1=44210&r2=44211&view=diff
==============================================================================
--- trunk/core/libyui/src/Y2UINamespace.h (original)
+++ trunk/core/libyui/src/Y2UINamespace.h Wed Feb 6 18:36:19 2008
@@ -294,9 +294,6 @@
/* TYPEINFO: any (string, string, string) */
YCPValue Recode( const YCPString & from, const YCPString & to, const
YCPString & text );
- /* TYPEINFO: void (string) */
- YCPValue SetModulename( const YCPString & name );
-
/* TYPEINFO: boolean (symbol) */
YCPValue HasSpecialWidget( const YCPSymbol & widget );
Modified: trunk/core/libyui/src/YApplication.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YApplication.h?rev=44211&r1=44210&r2=44211&view=diff
==============================================================================
--- trunk/core/libyui/src/YApplication.h (original)
+++ trunk/core/libyui/src/YApplication.h Wed Feb 6 18:36:19 2008
@@ -215,18 +215,6 @@
const string & headline ) = 0;
/**
- * Run a shell command (typically an interactive program using NCurses)
- * in a terminal (window).
- *
- * This is useful for text UIs (e.g., NCurses) that need special
- * preparation prior to running an NCurses-based application and special
- * clean-up afterwards.
- *
- * This default implementation logs an error and returns with -1.
- **/
- virtual int runInTerminal( const string & command );
-
- /**
* Set the current product name ("openSUSE", "SLES", ...).
* This name will be expanded in help texts when the &product; entity is
* used.
@@ -271,6 +259,72 @@
**/
bool reverseLayout() const;
+ /**
+ * Change the (mouse) cursor to indicate busy status.
+ * This default implementation does nothing.
+ **/
+ virtual void busyCursor() {}
+
+ /**
+ * Change the (mouse) cursor back from busy status to normal.
+ * This default implementation does nothing.
+ **/
+ virtual void normalCursor() {}
+
+ /**
+ * Make a screen shot and save it to the specified file.
+ * This default implementation does nothing.
+ **/
+ virtual void makeScreenShot( const string & fileName ) {}
+
+ /**
+ * Beep.
+ * This default implementation does nothing.
+ **/
+ virtual void beep() {}
+
+
+ //
+ // NCurses (text mode) specific
+ //
+
+ /**
+ * Redraw the screen.
+ * This default implementation does nothing.
+ **/
+ virtual void redrawScreen() {}
+
+ /**
+ * Initialize the (text) console keyboard.
+ * This default implementation does nothing.
+ **/
+ virtual void initConsoleKeyboard() {}
+
+ /**
+ * Set the (text) console font according to the current encoding etc.
+ * See the setfont(8) command and the console HowTo for details.
+ *
+ * This default implementation does nothing.
+ **/
+ virtual void setConsoleFont( const string & console_magic,
+ const string & font,
+ const string & screen_map,
+ const string & unicode_map,
+ const string & encoding )
+ {}
+
+ /**
+ * Run a shell command (typically an interactive program using NCurses)
+ * in a terminal (window).
+ *
+ * This is useful for text UIs (e.g., NCurses) that need special
+ * preparation prior to running an NCurses-based application and special
+ * clean-up afterwards.
+ *
+ * This default implementation logs an error and returns -1.
+ **/
+ virtual int runInTerminal( const string & command );
+
//
// Display information.
Modified: trunk/core/libyui/src/YUI.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YUI.h?rev=44211&r1=44210&r2=44211&view=diff
==============================================================================
--- trunk/core/libyui/src/YUI.h (original)
+++ trunk/core/libyui/src/YUI.h Wed Feb 6 18:36:19 2008
@@ -239,7 +239,6 @@
void evaluateFakeUserInput ( const YCPValue &
next_input );
YCPMap evaluateGetDisplayInfo ();
YCPString evaluateGetLanguage ( const YCPBoolean &
strip_encoding );
- YCPValue evaluateGetModulename ( const YCPTerm & term
);
YCPString evaluateGetProductName ();
YCPString evaluateGlyph ( const YCPSymbol &
symbol );
YCPValue evaluateHasSpecialWidget ( const YCPSymbol &
widget );
@@ -265,7 +264,6 @@
YCPBoolean evaluateSetFocus ( const
YCPValue & value_id );
void evaluateSetFunctionKeys ( const YCPMap &
new_keys );
void evaluateSetLanguage ( const YCPString&
lang, const YCPString& encoding = YCPNull() );
- void evaluateSetModulename ( const YCPString &
name );
void evaluateSetProductName ( const
YCPString & name );
void evaluateStopRecordMacro ();
YCPBoolean evaluateWidgetExists ( const YCPValue &
value_id );
@@ -313,52 +311,6 @@
**/
virtual void idleLoop( int fd_ycp ) = 0;
-
- /**
- * UI-specific setConsoleFont() function.
- * Returns YCPVoid() if OK and YCPNull() on error.
- * This default implementation does nothing.
- **/
- virtual YCPValue setConsoleFont( const YCPString & console_magic,
- const YCPString & font,
- const YCPString & screen_map,
- const YCPString & unicode_map,
- const YCPString & encoding );
-
- virtual YCPValue setKeyboard();
-
- /**
- * UI-specific busyCursor function.
- * This default implementation does nothing.
- **/
- virtual void busyCursor();
-
- /**
- * UI-specific normalCursor function.
- * This default implementation does nothing.
- **/
- virtual void normalCursor();
-
- /**
- * UI-specific redrawScreen method.
- * This default implementation does nothing.
- **/
- virtual void redrawScreen();
-
- /**
- * UI-specific makeScreenShot function.
- * This default implementation does nothing.
- **/
- virtual void makeScreenShot( string filename );
-
- /**
- * UI-specific beep method.
- *
- * Emit acoustic signal or something equivalent.
- * This default implementation does nothing.
- **/
- virtual void beep();
-
/**
* UI-specific runPkgSelection method.
*
@@ -381,7 +333,6 @@
**/
void terminateUIThread();
-
/**
* Creates and launches the ui thread.
**/
Modified: trunk/core/libyui/src/YUI_builtins.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YUI_builtins.cc?rev=44211&r1=44210&r2=44211&view=diff
==============================================================================
--- trunk/core/libyui/src/YUI_builtins.cc (original)
+++ trunk/core/libyui/src/YUI_builtins.cc Wed Feb 6 18:36:19 2008
@@ -116,34 +116,6 @@
}
-
-/**
- * @builtin GetModulename
- * @short Gets the name of a Module
- * @description
- * This is tricky. The UI doesn't care about the current module
- * name, only the translator does. However, since the translator
- * acts as a filter between a client and the UI, it cant directly
- * return the module name. The current implementation inserts the
- * modules name in the translator and it arrives here as the term
- * argument. So the example has no arguments, but the internal code
- * checks for a string argument.
- * @return string
- *
- * @usage GetModulename()
- */
-
-YCPValue YUI::evaluateGetModulename( const YCPTerm & term )
-{
- if ( ( term->size() == 1 ) && ( term->value(0)->isString() ) )
- {
- return term->value(0);
- }
- else return YCPNull();
-}
-
-
-
/**
* @builtin SetLanguage
* @short Sets the language of the UI
@@ -229,10 +201,17 @@
* @usage SetConsoleFont( "( K", "lat2u-16.psf", "latin2u.scrnmap",
"lat2u.uni", "latin1" )
*/
-void YUI::evaluateSetConsoleFont( const YCPString & console_magic, const
YCPString & font,
- const YCPString & screen_map, const YCPString & unicode_map, const
YCPString & encoding )
-{
- setConsoleFont( console_magic, font, screen_map, unicode_map, encoding );
+void YUI::evaluateSetConsoleFont( const YCPString & console_magic,
+ const YCPString & font,
+ const YCPString & screen_map,
+ const YCPString & unicode_map,
+ const YCPString & encoding )
+{
+ YUI::app()->setConsoleFont( console_magic->value(),
+ font->value(),
+ screen_map->value(),
+ unicode_map->value(),
+ encoding->value() );
}
@@ -253,7 +232,7 @@
YCPInteger YUI::evaluateRunInTerminal(const YCPString & command )
{
- return YCPInteger( yApp()->runInTerminal( command->value() ) );
+ return YCPInteger( YUI::app()->runInTerminal( command->value() ) );
}
@@ -266,80 +245,7 @@
*/
void YUI::evaluateSetKeyboard( )
{
- setKeyboard( );
-}
-
-
-/*
- * Default UI-specific setKeyboard()
- * Returns OK ( YCPVoid() )
- */
-YCPValue YUI::setKeyboard( )
-{
- // NOP
-
- return YCPVoid(); // OK ( YCPNull() would mean error )
-}
-
-
-/*
- * Default UI-specific setConsoleFont()
- * Returns OK (YCPVoid())
- */
-YCPValue YUI::setConsoleFont( const YCPString & console_magic,
- const YCPString & font,
- const YCPString & screen_map,
- const YCPString & unicode_map,
- const YCPString & encoding )
-{
- // NOP
-
- return YCPVoid(); // OK ( YCPNull() would mean error )
-}
-
-
-/**
- * Default UI-specific busyCursor() - does nothing
- */
-void YUI::busyCursor()
-{
- // NOP
-}
-
-
-/**
- * Default UI-specific normalCursor() - does nothing
- */
-void YUI::normalCursor()
-{
- // NOP
-}
-
-
-/**
- * Default UI-specific redrawScreen() - does nothing
- */
-void YUI::redrawScreen()
-{
- // NOP
-}
-
-
-/**
- * Default UI-specific makeScreenShot() - does nothing
- */
-void YUI::makeScreenShot( string filename )
-{
- // NOP
-}
-
-
-/**
- * Default UI-specific beep() - does nothing
- */
-void YUI::beep()
-{
- // NOP
+ YUI::app()->initConsoleKeyboard();
}
@@ -650,7 +556,7 @@
}
}
- blockEvents(); // Prevent self-generated events from UI built-ins.
+ YUI::ui()->blockEvents(); // Prevent self-generated events from UI
built-ins.
bool ok = true;
@@ -676,7 +582,7 @@
YCPErrorDialog::exceptionDialog( "UI Syntax Error", exception );
}
- unblockEvents();
+ YUI::ui()->unblockEvents();
return YCPBoolean( ok );
}
@@ -695,9 +601,9 @@
YCPValue YUI::evaluateCloseDialog()
{
- blockEvents(); // We don't want self-generated events from UI builtins.
+ YUI::ui()->blockEvents(); // We don't want self-generated events from UI
builtins.
YDialog::deleteTopmostDialog();
- unblockEvents();
+ YUI::ui()->unblockEvents();
return YCPBoolean( true );
}
@@ -727,7 +633,7 @@
try
{
- blockEvents(); // We don't want self-generated events from
UI::ChangeWidget().
+ YUI::ui()->blockEvents(); // We don't want self-generated events
from UI::ChangeWidget().
if ( ! YCPDialogParser::isSymbolOrId( idValue ) )
{
@@ -788,7 +694,7 @@
ret = YCPNull();
}
- unblockEvents();
+ YUI::ui()->unblockEvents();
return ret;
}
@@ -895,7 +801,7 @@
idValue->toString().c_str() ) );
}
- blockEvents(); // Prevent self-generated events
+ YUI::ui()->blockEvents(); // Prevent self-generated events
YCPValue id = YCPDialogParser::parseIdTerm( idValue );
YWidget * widget = YCPDialogParser::findWidgetWithId( id,
true ); // throw
if not found
@@ -936,7 +842,7 @@
YCPErrorDialog::exceptionDialog( "UI Syntax Error", exception );
}
- unblockEvents();
+ YUI::ui()->unblockEvents();
return YCPBoolean( success );
}
@@ -978,9 +884,9 @@
if ( ! wizard )
return YCPBoolean( false );
- blockEvents(); // Avoid self-generated events from builtins
+ YUI::ui()->blockEvents(); // Avoid self-generated events from builtins
bool ret = YCPWizardCommandParser::parseAndExecute( wizard, command );
- unblockEvents();
+ YUI::ui()->unblockEvents();
return YCPBoolean( ret );
}
@@ -1033,50 +939,49 @@
void YUI::evaluateBusyCursor()
{
- busyCursor();
+ YUI::app()->busyCursor();
}
-
/**
- * @builtin RedrawScreen
- * @short Redraws the screen
+ * @builtin NormalCursor
+ * @short Sets the mouse cursor to the normal cursor
* @description
- * Redraws the screen after it very likely has become garbled by some other
output.
+ * Sets the mouse cursor to the normal cursor (after BusyCursor), if the UI
+ * supports such a feature.
*
- * This should normally not be necessary: The (specific) UI redraws the screen
- * automatically whenever required. Under rare circumstances, however, the
- * screen might have changes due to circumstances beyond the UI's control: For
- * text based UIs, for example, system commands that cause output to every tty
- * might make this necessary. Call this in the YCP code after such a command.
+ * This should normally not be necessary. The UI handles mouse cursors itself:
+ * When input is possible (i.e. inside UserInput() ), there is automatically a
+ * normal cursor, otherwise, there is the busy cursor. Override this at your
+ * own risk.
*
* @return void
*/
-void YUI::evaluateRedrawScreen()
+void YUI::evaluateNormalCursor()
{
- redrawScreen();
+ YUI::app()->normalCursor();
}
/**
- * @builtin NormalCursor
- * @short Sets the mouse cursor to the normal cursor
+ * @builtin RedrawScreen
+ * @short Redraws the screen
* @description
- * Sets the mouse cursor to the normal cursor (after BusyCursor), if the UI
- * supports such a feature.
+ * Redraws the screen after it very likely has become garbled by some other
output.
*
- * This should normally not be necessary. The UI handles mouse cursors itself:
- * When input is possible (i.e. inside UserInput() ), there is automatically a
- * normal cursor, otherwise, there is the busy cursor. Override this at your
- * own risk.
+ * This should normally not be necessary: The (specific) UI redraws the screen
+ * automatically whenever required. Under rare circumstances, however, the
+ * screen might have changes due to circumstances beyond the UI's control: For
+ * text based UIs, for example, system commands that cause output to every tty
+ * might make this necessary. Call this in the YCP code after such a command.
*
* @return void
*/
-void YUI::evaluateNormalCursor()
+void YUI::evaluateRedrawScreen()
{
- normalCursor();
+ YUI::app()->redrawScreen();
}
@@ -1094,7 +999,7 @@
void YUI::evaluateMakeScreenShot( const YCPString & filename )
{
- makeScreenShot( filename->value () );
+ YUI::app()->makeScreenShot( filename->value () );
}
@@ -1126,9 +1031,10 @@
*/
void YUI::evaluateBeep()
{
- beep();
+ YUI::app()->beep();
}
+
/**
* @builtin RecordMacro
* @short Records Macro into a file
@@ -1278,7 +1184,7 @@
YCPMap YUI::evaluateGetDisplayInfo()
{
YCPMap info_map;
- YApplication * app = yApp(); // slight optimization
+ YApplication * app = YUI::app(); // slight optimization
info_map->add( YCPString( YUICap_Width ), YCPInteger(
app->displayWidth() ) );
info_map->add( YCPString( YUICap_Height ), YCPInteger(
app->displayHeight() ) );
Modified: trunk/ncurses/src/NCApplication.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/NCApplication.cc?rev=44211&r1=44210&r2=44211&view=diff
==============================================================================
--- trunk/ncurses/src/NCApplication.cc (original)
+++ trunk/ncurses/src/NCApplication.cc Wed Feb 6 18:36:19 2008
@@ -99,9 +99,56 @@
}
-/**
- * Run external program supplied as string parameter the same terminal.
- **/
+void
+NCApplication::beep()
+{
+ ::beep();
+}
+
+
+void NCApplication::redrawScreen()
+{
+ YNCursesUI::ui()->Refresh();
+}
+
+
+void
+NCApplication::initConsoleKeyboard()
+{
+ string cmd = "/bin/dumpkeys | /bin/loadkeys --unicode";
+ if ( NCstring::terminalEncoding() == "UTF-8" )
+ {
+ int ret = system( (cmd + " >/dev/null 2>&1").c_str() );
+ if ( ret != 0 )
+ {
+ NCERR << "ERROR: /bin/dumpkeys | /bin/loadkeys --unicode returned:
"<< ret << endl;
+ }
+ }
+}
+
+
+void
+NCApplication::setConsoleFont( const string & console_magic,
+ const string & font,
+ const string & screen_map,
+ const string & unicode_map,
+ const string & encoding )
+{
+ /**
+ * Moving that code from YNCursesUI to this class turned out to be
+ * impossible (or at least a lot more work than it's worth) that I finally
+ * gave it up.
+ *
+ * - sh@xxxxxxx 2008-02-06
+ **/
+ YNCursesUI::ui()->setConsoleFont( console_magic,
+ font,
+ screen_map,
+ unicode_map,
+ encoding );
+}
+
+
int
NCApplication::runInTerminal( const string & cmd )
{
Modified: trunk/ncurses/src/NCApplication.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/NCApplication.h?rev=44211&r1=44210&r2=44211&view=diff
==============================================================================
--- trunk/ncurses/src/NCApplication.h (original)
+++ trunk/ncurses/src/NCApplication.h Wed Feb 6 18:36:19 2008
@@ -117,6 +117,39 @@
const string & headline );
/**
+ * Beep.
+ *
+ * Reimplemented from YApplication.
+ **/
+ virtual void beep();
+
+ /**
+ * Redraw the screen.
+ *
+ * Reimplemented from YApplication.
+ **/
+ virtual void redrawScreen();
+
+ /**
+ * Initialize the (text) console keyboard.
+ *
+ * Reimplemented from YApplication.
+ **/
+ virtual void initConsoleKeyboard();
+
+ /**
+ * Set the (text) console font according to the current encoding etc.
+ * See the setfont(8) command and the console HowTo for details.
+ *
+ * Reimplemented from YApplication.
+ **/
+ virtual void setConsoleFont( const string & console_magic,
+ const string & font,
+ const string & screen_map,
+ const string & unicode_map,
+ const string & encoding );
+
+ /**
* Run a shell command (typically an interactive program using NCurses)
* in a terminal (window).
*
Modified: trunk/ncurses/src/YNCursesUI.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/YNCursesUI.cc?rev=44211&r1=44210&r2=44211&view=diff
==============================================================================
--- trunk/ncurses/src/YNCursesUI.cc (original)
+++ trunk/ncurses/src/YNCursesUI.cc Wed Feb 6 18:36:19 2008
@@ -257,114 +257,6 @@
///////////////////////////////////////////////////////////////////
//
//
-// METHOD NAME : YNCursesUI::setKeyboard
-// METHOD TYPE : YCPValue
-//
-//
-YCPValue YNCursesUI::setKeyboard()
-{
- string cmd = "/bin/dumpkeys | /bin/loadkeys --unicode";
- if ( NCstring::terminalEncoding() == "UTF-8" )
- {
- int ret = system( (cmd + " >/dev/null 2>&1").c_str() );
- if ( ret != 0 )
- {
- NCERR << "ERROR: /bin/dumpkeys | /bin/loadkeys --unicode returned:
"<< ret << endl;
- }
- }
-
- return YCPVoid();
-}
-
-///////////////////////////////////////////////////////////////////
-//
-//
-// METHOD NAME : YNCursesUI::setConsoleFont
-// METHOD TYPE : YCPValue
-//
-// DESCRIPTION : UI::setConsoleFont() is called in Console.ycp.
-// The terminal encoding must be set correctly.
-//
-YCPValue YNCursesUI::setConsoleFont( const YCPString & console_magic,
- const YCPString & font,
- const YCPString & screen_map,
- const YCPString & unicode_map,
- const YCPString & lang )
-{
- string cmd( "setfont" );
- cmd += " -C " + myTerm;
- cmd += " " + font->value();
- if ( !screen_map->value().empty() )
- cmd += " -m " + screen_map->value();
- if ( !unicode_map->value().empty() )
- cmd += " -u " + unicode_map->value();
-
- UIMIL << cmd << endl;
- int ret = system( (cmd + " >/dev/null 2>&1").c_str() );
-
- // setfont returns error if called e.g. on a xterm -> return YCPVoid()
- if ( ret ) {
- UIERR << cmd.c_str() << " returned " << ret << endl;
- Refresh();
- return YCPVoid();
- }
- // go on in case of a "real" console
- cmd = "(echo -en \"\\033";
- if ( console_magic->value().length() )
- cmd += console_magic->value();
- else
- cmd += "(B";
- cmd += "\" >" + myTerm + ")";
- UIMIL << cmd << endl;
- ret = system( (cmd + " >/dev/null 2>&1").c_str() );
- if ( ret ) {
- UIERR << cmd.c_str() << " returned " << ret << endl;
- }
-
- // set terminal encoding for console
- // (setConsoleFont() in Console.ycp has passed the encoding as last argument
- // but this encoding was not correct; now Console.ycp passes the language)
-
- // if the encoding is NOT UTF-8 set the console encoding according to the
language
- if ( NCstring::terminalEncoding() != "UTF-8" )
- {
- string language = lang->value();
- string::size_type pos = language.find( '.' );
-
- if ( pos != string::npos )
- {
- language.erase( pos );
- }
- pos = language.find( '_' );
- if ( pos != string::npos )
- {
- language.erase( pos );
- }
-
- string code = language2encoding( language );
-
- NCMIL << "setConsoleFont( ENCODING: " << code << " )" << endl;
-
- if ( NCstring::setTerminalEncoding( code ) )
- {
- Redraw();
- }
- else
- {
- Refresh();
- }
- }
- else
- {
- Refresh();
- }
-
- return YCPVoid();
-}
-
-///////////////////////////////////////////////////////////////////
-//
-//
// METHOD NAME : YNCursesUI::init_title
// METHOD TYPE : void
//
@@ -404,17 +296,92 @@
return true;
}
+
///////////////////////////////////////////////////////////////////
//
//
-// METHOD NAME : YNCursesUI::beep()
-// METHOD TYPE : void
+// METHOD NAME : YNCursesUI::setConsoleFont
//
-// DESCRIPTION : beeps the system bell
+// DESCRIPTION : UI::setConsoleFont() is called in Console.ycp.
+// The terminal encoding must be set correctly.
//
-void YNCursesUI::beep()
+/**
+ * This doesn't belong here, but it is so utterly entangled with member
+ * variables that are not exported at all (sic!) that it's not really feasible
+ * to extract the relevant parts.
+ **/
+void YNCursesUI::setConsoleFont( const string & console_magic,
+ const string & font,
+ const string & screen_map,
+ const string & unicode_map,
+ const string & encoding )
{
- ::beep();
-}
+ string cmd( "setfont" );
+ cmd += " -C " + myTerm;
+ cmd += " " + font;
+ if ( !screen_map.empty() )
+ cmd += " -m " + screen_map;
+ if ( !unicode_map.empty() )
+ cmd += " -u " + unicode_map;
+
+ UIMIL << cmd << endl;
+ int ret = system( (cmd + " >/dev/null 2>&1").c_str() );
+
+ // setfont returns error if called e.g. on a xterm -> return YCPVoid()
+ if ( ret ) {
+ UIERR << cmd.c_str() << " returned " << ret << endl;
+ Refresh();
+ return;
+ }
+ // go on in case of a "real" console
+ cmd = "(echo -en \"\\033";
+ if ( console_magic.length() )
+ cmd += console_magic;
+ else
+ cmd += "(B";
+ cmd += "\" >" + myTerm + ")";
+ UIMIL << cmd << endl;
+ ret = system( (cmd + " >/dev/null 2>&1").c_str() );
+ if ( ret ) {
+ UIERR << cmd.c_str() << " returned " << ret << endl;
+ }
+
+ // set terminal encoding for console
+ // (setConsoleFont() in Console.ycp has passed the encoding as last
+ // argument but this encoding was not correct; now Console.ycp passes the
+ // language) if the encoding is NOT UTF-8 set the console encoding
+ // according to the language
+
+ if ( NCstring::terminalEncoding() != "UTF-8" )
+ {
+ string language = YUI::app()->language();
+ string::size_type pos = language.find( '.' );
+ if ( pos != string::npos )
+ {
+ language.erase( pos );
+ }
+ pos = language.find( '_' );
+ if ( pos != string::npos )
+ {
+ language.erase( pos );
+ }
+
+ string code = language2encoding( language );
+ NCMIL << "setConsoleFont( ENCODING: " << code << " )" << endl;
+
+ if ( NCstring::setTerminalEncoding( code ) )
+ {
+ Redraw();
+ }
+ else
+ {
+ Refresh();
+ }
+ }
+ else
+ {
+ Refresh();
+ }
+}
Modified: trunk/ncurses/src/YNCursesUI.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/YNCursesUI.h?rev=44211&r1=44210&r2=44211&view=diff
==============================================================================
--- trunk/ncurses/src/YNCursesUI.h (original)
+++ trunk/ncurses/src/YNCursesUI.h Wed Feb 6 18:36:19 2008
@@ -107,40 +107,30 @@
virtual void idleLoop( int fd_ycp );
/**
+ * Set the (text) console font according to the current encoding etc.
+ * See the setfont(8) command and the console HowTo for details.
+ *
+ * This should really be in NCApplication, but it uses so many non-exported
+ * member variables that it's not easy to move it there.
+ **/
+ virtual void setConsoleFont( const string & console_magic,
+ const string & font,
+ const string & screen_map,
+ const string & unicode_map,
+ const string & encoding );
+
+ /**
* Fills the PackageSelector widget and runs package selection.
*/
virtual YEvent * runPkgSelection( YWidget * packageSelector );
/**
- * UI-specific setConsoleFont() function.
- * Returns YCPVoid() if OK and YCPNull() on error.
- */
- virtual YCPValue setConsoleFont ( const YCPString & console_magic,
- const YCPString & font,
- const YCPString & screen_map,
- const YCPString & unicode_map,
- const YCPString & encoding );
-
- virtual YCPValue setKeyboard ( );
-
- /**
- * UI-specific beep() function.
- * Beeps the system bell.
- */
- virtual void beep();
-
- /**
* Returns the package selector plugin singleton of this UI or creates it
* (including loading the plugin lib) if it does not exist yet.
**/
NCPackageSelectorPlugin * packageSelectorPlugin();
-
- /**
- * UI-specific redrawScreen method.
- * This default implementation does nothing.
- */
- virtual void redrawScreen() { Refresh(); }
};
+
#endif // YNCursesUI_h
Modified: trunk/qt/src/YQApplication.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQApplication.cc?rev=44211&r1=44210&r2=44211&view=diff
==============================================================================
--- trunk/qt/src/YQApplication.cc (original)
+++ trunk/qt/src/YQApplication.cc Wed Feb 6 18:36:19 2008
@@ -635,12 +635,7 @@
}
-/**
- * UI-specific conversion from logical layout spacing units (80x25)
- * to device dependent units (640x480).
- **/
-int
-YQApplication::deviceUnits( YUIDimension dim, float layoutUnits )
+int YQApplication::deviceUnits( YUIDimension dim, float layoutUnits )
{
if ( dim==YD_HORIZ ) layoutUnits *= ( 640.0/80 );
else layoutUnits *= ( 480.0/25 );
@@ -649,15 +644,7 @@
}
-/**
- * Default conversion from device dependent layout spacing units (640x480)
- * to logical layout units (80x25).
- *
- * This default function assumes 80x25 units.
- * Derived UIs may want to reimplement this.
- **/
-float
-YQApplication::layoutUnits( YUIDimension dim, int deviceUnits )
+float YQApplication::layoutUnits( YUIDimension dim, int deviceUnits )
{
float size = (float) deviceUnits;
@@ -668,6 +655,28 @@
}
+void YQApplication::beep()
+{
+ qApp->beep();
+}
+
+
+void YQApplication::busyCursor()
+{
+ YQUI::ui()->busyCursor();
+}
+
+
+void YQApplication::normalCursor()
+{
+ YQUI::ui()->normalCursor();
+}
+
+
+void YQApplication::makeScreenShot( const string & fileName )
+{
+ YQUI::ui()->makeScreenShot( fileName );
+}
#include "YQApplication.moc"
Modified: trunk/qt/src/YQApplication.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQApplication.h?rev=44211&r1=44210&r2=44211&view=diff
==============================================================================
--- trunk/qt/src/YQApplication.h (original)
+++ trunk/qt/src/YQApplication.h Wed Feb 6 18:36:19 2008
@@ -234,6 +234,34 @@
**/
virtual float layoutUnits( YUIDimension dim, int deviceUnits );
+ /**
+ * Change the (mouse) cursor to indicate busy status.
+ *
+ * Reimplemented from YApplication.
+ **/
+ virtual void busyCursor();
+
+ /**
+ * Change the (mouse) cursor back from busy status to normal.
+ *
+ * Reimplemented from YApplication.
+ **/
+ virtual void normalCursor();
+
+ /**
+ * Make a screen shot and save it to the specified file.
+ *
+ * Reimplemented from YApplication.
+ **/
+ virtual void makeScreenShot( const string & fileName );
+
+ /**
+ * Beep.
+ *
+ * Reimplemented from YApplication.
+ **/
+ virtual void beep();
+
// Display information and UI capabilities.
//
Modified: trunk/qt/src/YQUI.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQUI.h?rev=44211&r1=44210&r2=44211&view=diff
==============================================================================
--- trunk/qt/src/YQUI.h (original)
+++ trunk/qt/src/YQUI.h Wed Feb 6 18:36:19 2008
@@ -41,7 +41,7 @@
class YQOptionalWidgetFactory;
class YQWidgetFactory;
class YQApplication;
-class YQUI_Ui;
+class YQUISignalReceiver;
using std::string;
using std::vector;
@@ -49,7 +49,7 @@
class YQUI: public YUI
{
- friend class YQUI_Ui;
+ friend class YQUISignalReceiver;
public:
@@ -205,21 +205,17 @@
virtual bool eventsBlocked() const;
/**
- * Beep - activate the system (X11) bell.
- *
- * Reimplemented from YUI.
+ * Show mouse cursor indicating busy state.
**/
- void beep();
-
+ void busyCursor();
+
/**
- * Show pointer cursor.
- *
- * Reimplemented from YUI.
+ * Show normal mouse cursor not indicating busy status.
**/
void normalCursor();
/**
- * Open file selection box and let the user Save y2logs to that location.
+ * Open file selection box and let the user save y2logs to that location.
* (Shift-F8)
**/
void askSaveLogs();
@@ -270,16 +266,7 @@
**/
bool usingVisionImpairedPalette() const { return
_usingVisionImpairedPalette; }
- /**
- * Show hourglass cursor.
- *
- * Reimplemented from YUI.
- **/
- virtual void busyCursor();
-
-protected:
-
-
+
protected:
/**
@@ -314,7 +301,6 @@
void leaveIdleLoop();
-
//
// Data members
@@ -406,33 +392,28 @@
*/
QY2Styler *_styler;
- YQUI_Ui *_qobject;
+ YQUISignalReceiver * _signalReceiver;
};
-
-class YQUI_Ui : public QObject
+/**
+ * Helper class that acts as a Qt signal receiver for YQUI.
+ * YQUI itself cannot be a QObject to avoid problems with starting up the UI
+ * with multiple threads.
+ **/
+class YQUISignalReceiver : public QObject
{
Q_OBJECT
public:
- YQUI_Ui();
+ YQUISignalReceiver();
public slots:
- /**
- * Show hourglass cursor.
- *
- * Reimplemented from YUI.
- **/
void slotBusyCursor();
-
- /**
- * Timeout during TimeoutUserInput() / WaitForEvent()
- **/
void slotUserInputTimeout();
-
void slotLeaveIdleLoop();
};
+
#endif // YQUI_h
Modified: trunk/qt/src/YQUI_core.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQUI_core.cc?rev=44211&r1=44210&r2=44211&view=diff
==============================================================================
--- trunk/qt/src/YQUI_core.cc (original)
+++ trunk/qt/src/YQUI_core.cc Wed Feb 6 18:36:19 2008
@@ -88,10 +88,6 @@
topmostConstructorHasFinished();
}
-YQUI_Ui::YQUI_Ui()
- : QObject()
-{
-}
void YQUI::init_ui()
{
@@ -105,11 +101,11 @@
new QApplication( _ui_argc, _ui_argv);
- _qobject = new YQUI_Ui();
- _busy_cursor_timer = new QTimer( _qobject );
+ _signalReceiver = new YQUISignalReceiver();
+ _busy_cursor_timer = new QTimer( _signalReceiver );
_busy_cursor_timer->setSingleShot( true );
- _user_input_timer = new QTimer( _qobject );
+ _user_input_timer = new QTimer( _signalReceiver );
_user_input_timer->setSingleShot( true );
_normalPalette = qApp->palette();
@@ -211,10 +207,10 @@
busyCursor();
QObject::connect( _user_input_timer, SIGNAL( timeout() ),
- _qobject, SLOT ( slotUserInputTimeout()
) );
+ _signalReceiver, SLOT (
slotUserInputTimeout() ) );
QObject::connect( _busy_cursor_timer, SIGNAL( timeout() ),
- _qobject, SLOT ( slotBusyCursor() ) );
+ _signalReceiver, SLOT (
slotBusyCursor() ) );
#warning macro_file
// if ( macro_file )
@@ -294,7 +290,7 @@
qApp->exit();
qApp->deleteLater();
- delete _qobject;
+ delete _signalReceiver;
}
@@ -387,8 +383,8 @@
// process Qt events until fd_ycp is readable.
QSocketNotifier * notifier = new QSocketNotifier( fd_ycp,
QSocketNotifier::Read );
- QObject::connect( notifier, SIGNAL( activated ( int ) ),
- _qobject, SLOT( slotLeaveIdleLoop() ) );
+ QObject::connect( notifier, SIGNAL( activated( int ) ),
+ _signalReceiver, SLOT ( slotLeaveIdleLoop() ) );
notifier->setEnabled( true );
@@ -405,12 +401,6 @@
}
-void YQUI_Ui::slotLeaveIdleLoop()
-{
- YQUI::ui()->leaveIdleLoop();
-}
-
-
void YQUI::sendEvent( YEvent * event )
{
if ( event )
@@ -493,11 +483,6 @@
}
-void YQUI_Ui::slotUserInputTimeout()
-{
- YQUI::ui()->userInputTimeout();
-}
-
void YQUI::userInputTimeout()
{
if ( ! pendingEvent() )
@@ -548,6 +533,36 @@
return _event_handler.eventsBlocked();
}
+
+
+
+
+YQUISignalReceiver::YQUISignalReceiver()
+ : QObject()
+{
+}
+
+
+void YQUISignalReceiver::slotBusyCursor()
+{
+ YQUI::ui()->busyCursor();
+}
+
+
+void YQUISignalReceiver::slotUserInputTimeout()
+{
+ YQUI::ui()->userInputTimeout();
+}
+
+
+void YQUISignalReceiver::slotLeaveIdleLoop()
+{
+ YQUI::ui()->leaveIdleLoop();
+}
+
+
+
+
static void
qMessageHandler( QtMsgType type, const char * msg )
{
Modified: trunk/qt/src/YQUI_x11.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQUI_x11.cc?rev=44211&r1=44210&r2=44211&view=diff
==============================================================================
--- trunk/qt/src/YQUI_x11.cc (original)
+++ trunk/qt/src/YQUI_x11.cc Wed Feb 6 18:36:19 2008
@@ -50,26 +50,13 @@
}
-void YQUI::beep()
-{
- qApp->beep();
-}
-
-void
-YQUI_Ui::slotBusyCursor()
-{
- YQUI::ui()->busyCursor();
-}
-
-void
-YQUI::busyCursor( void )
+void YQUI::busyCursor()
{
qApp->setOverrideCursor( Qt::BusyCursor );
}
-void
-YQUI::normalCursor( void )
+void YQUI::normalCursor()
{
if ( _busy_cursor_timer->isActive() )
_busy_cursor_timer->stop();
@@ -131,6 +118,9 @@
}
+/**
+ * Handle WM_CLOSE
+ **/
bool YQUI::close()
{
sendEvent( new YCancelEvent() );
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx
| < Previous | Next > |