Author: sh-sh-sh
Date: Thu Feb 7 15:51:03 2008
New Revision: 44242
URL: http://svn.opensuse.org/viewcvs/yast?rev=44242&view=rev
Log:
Moved UI built-ins out to separate class YCP_UI
Added:
trunk/core/libyui/src/YCP_UI.cc
- copied, changed from r44211, trunk/core/libyui/src/YUI_builtins.cc
trunk/core/libyui/src/YCP_UI.h
Removed:
trunk/core/libyui/src/YUI_builtins.cc
Modified:
trunk/core/VERSION
trunk/core/libyui/src/Makefile.am
trunk/core/libyui/src/Y2UINamespace.cc
trunk/core/libyui/src/YCPMacroRecorder.cc
trunk/core/libyui/src/YUI.h
trunk/core/libyui/src/YUIComponent.cc
trunk/core/libyui/src/YUIComponent.h
trunk/core/libyui/src/YUI_core.cc
trunk/core/package/yast2-core.changes
trunk/ncurses/src/pkg/NCPackageSelector.cc
trunk/ncurses/yast2-ncurses.spec.in
trunk/qt/src/YQMultiProgressMeter.cc
trunk/qt/yast2-qt.spec.in
Modified: trunk/core/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/VERSION?rev=44242&r1=44241&r2=44242&view=diff
==============================================================================
--- trunk/core/VERSION (original)
+++ trunk/core/VERSION Thu Feb 7 15:51:03 2008
@@ -1 +1 @@
-2.16.29
+2.16.30
Modified: trunk/core/libyui/src/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/Makefile.am?rev=44242&r1=44241&r2=44242&view=diff
==============================================================================
--- trunk/core/libyui/src/Makefile.am (original)
+++ trunk/core/libyui/src/Makefile.am Thu Feb 7 15:51:03 2008
@@ -14,7 +14,7 @@
libpy2UI_la_SOURCES = \
Y2UINamespace.cc \
Y2CCUI.cc \
- YApplication.cc \
+ YCP_UI.cc \
YCPDialogParser.cc \
YCPErrorDialog.cc \
YCPEvent.cc \
@@ -41,8 +41,8 @@
YUIException.cc \
YUILog.cc \
YUIPlugin.cc \
- YUI_builtins.cc \
YUI_core.cc \
+ YApplication.cc \
YWidget.cc \
YWidgetFactory.cc \
YOptionalWidgetFactory.cc \
@@ -110,6 +110,7 @@
YApplication.h \
YBothDim.h \
YColor.h \
+ YCP_UI.h \
YCPDialogParser.h \
YCPErrorDialog.h \
YCPEvent.h \
Modified: trunk/core/libyui/src/Y2UINamespace.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/Y2UINamespace.cc?rev=44242&r1=44241&r2=44242&view=diff
==============================================================================
--- trunk/core/libyui/src/Y2UINamespace.cc (original)
+++ trunk/core/libyui/src/Y2UINamespace.cc Thu Feb 7 15:51:03 2008
@@ -30,6 +30,7 @@
#include
#include "YUI.h"
+#include "YCP_UI.h"
#include "YUISymbols.h"
#include "YUIComponent.h"
#include "Y2UINamespace.h"
@@ -42,7 +43,7 @@
Y2UINamespace::SetLanguage( const YCPString & language )
{
if ( YUIComponent::ui() )
- YUIComponent::ui()->evaluateSetLanguage( language );
+ YCP_UI::SetLanguage( language );
return YCPVoid();
}
@@ -52,7 +53,7 @@
Y2UINamespace::SetLanguage( const YCPString & language, const YCPString & encoding )
{
if ( YUIComponent::ui() )
- YUIComponent::ui()->evaluateSetLanguage( language, encoding );
+ YCP_UI::SetLanguage( language, encoding );
return YCPVoid();
}
@@ -62,7 +63,7 @@
Y2UINamespace::GetProductName()
{
if ( YUIComponent::ui() )
- return YUIComponent::ui()->evaluateGetProductName();
+ return YCP_UI::GetProductName();
else
return YCPVoid();
}
@@ -72,7 +73,7 @@
Y2UINamespace::SetProductName( const YCPString & name )
{
if ( YUIComponent::ui() )
- YUIComponent::ui()->evaluateSetProductName( name );
+ YCP_UI::SetProductName( name );
return YCPVoid();
}
@@ -86,7 +87,7 @@
const YCPString & encoding )
{
if ( YUIComponent::ui() )
- YUIComponent::ui()->evaluateSetConsoleFont( console_magic,
+ YCP_UI::SetConsoleFont( console_magic,
font,
screen_map,
unicode_map,
@@ -99,7 +100,7 @@
Y2UINamespace::SetKeyboard()
{
if ( YUIComponent::ui() )
- YUIComponent::ui()->evaluateSetKeyboard();
+ YCP_UI::SetKeyboard();
return YCPVoid();
}
@@ -109,7 +110,7 @@
Y2UINamespace::GetLanguage( const YCPBoolean & strip )
{
if ( YUIComponent::ui() )
- return YUIComponent::ui()->evaluateGetLanguage( strip );
+ return YCP_UI::GetLanguage( strip );
else
return YCPVoid();
}
@@ -118,8 +119,8 @@
YCPValue
Y2UINamespace::RunInTerminal( const YCPString &module )
{
- if (YUIComponent::ui() )
- return YUIComponent::ui()->evaluateRunInTerminal( module );
+ if ( YUIComponent::ui() )
+ return YCP_UI::RunInTerminal( module );
else
return YCPVoid();
}
@@ -127,7 +128,10 @@
YCPValue
Y2UINamespace::UserInput()
{
- return m_comp->ui()->evaluateUserInput();
+ if ( YUIComponent::ui() )
+ return YCP_UI::UserInput();
+ else
+ return YCPVoid();
}
@@ -135,7 +139,7 @@
Y2UINamespace::PollInput()
{
if ( YUIComponent::ui() )
- return YUIComponent::ui()->evaluatePollInput();
+ return YCP_UI::PollInput();
else
return YCPVoid();
}
@@ -145,7 +149,7 @@
Y2UINamespace::TimeoutUserInput( const YCPInteger& timeout )
{
if ( YUIComponent::ui() )
- return YUIComponent::ui()->evaluateTimeoutUserInput( timeout );
+ return YCP_UI::TimeoutUserInput( timeout );
else
return YCPVoid();
}
@@ -155,7 +159,7 @@
Y2UINamespace::WaitForEvent()
{
if ( YUIComponent::ui() )
- return YUIComponent::ui()->evaluateWaitForEvent();
+ return YCP_UI::WaitForEvent();
else
return YCPVoid();
}
@@ -165,7 +169,7 @@
Y2UINamespace::WaitForEvent( const YCPInteger & timeout )
{
if ( YUIComponent::ui() )
- return YUIComponent::ui()->evaluateWaitForEvent( timeout );
+ return YCP_UI::WaitForEvent( timeout );
else
return YCPVoid();
}
@@ -175,7 +179,7 @@
Y2UINamespace::OpenDialog( const YCPTerm & opts, const YCPTerm & dialog_term )
{
if ( YUIComponent::ui() )
- return YUIComponent::ui()->evaluateOpenDialog( opts, dialog_term );
+ return YCP_UI::OpenDialog( opts, dialog_term );
else
return YCPVoid();
}
@@ -184,7 +188,10 @@
YCPValue
Y2UINamespace::OpenDialog( const YCPTerm & dialog_term )
{
- return m_comp->ui()->evaluateOpenDialog( YCPNull(), dialog_term );
+ if ( YUIComponent::ui() )
+ return YCP_UI::OpenDialog( YCPNull(), dialog_term );
+ else
+ return YCPVoid();
}
@@ -192,7 +199,7 @@
Y2UINamespace::CloseDialog()
{
if ( YUIComponent::ui() )
- return YUIComponent::ui()->evaluateCloseDialog();
+ return YCP_UI::CloseDialog();
else
return YCPVoid();
}
@@ -202,7 +209,7 @@
Y2UINamespace::ChangeWidget( const YCPSymbol & widget_id, const YCPSymbol & property, const YCPValue & new_value )
{
if ( YUIComponent::ui() )
- return YUIComponent::ui()->evaluateChangeWidget( widget_id, property, new_value );
+ return YCP_UI::ChangeWidget( widget_id, property, new_value );
else
return YCPVoid();
}
@@ -212,7 +219,7 @@
Y2UINamespace::ChangeWidget( const YCPTerm & widget_id, const YCPSymbol & property, const YCPValue & new_value )
{
if ( YUIComponent::ui() )
- return YUIComponent::ui()->evaluateChangeWidget( widget_id, property, new_value );
+ return YCP_UI::ChangeWidget( widget_id, property, new_value );
else
return YCPVoid();
}
@@ -222,7 +229,7 @@
Y2UINamespace::ChangeWidget( const YCPTerm & widget_id, const YCPTerm & property, const YCPValue & new_value )
{
if ( YUIComponent::ui() )
- return YUIComponent::ui()->evaluateChangeWidget( widget_id, property, new_value );
+ return YCP_UI::ChangeWidget( widget_id, property, new_value );
else
return YCPVoid();
}
@@ -232,7 +239,7 @@
Y2UINamespace::QueryWidget( const YCPSymbol & widget_id, const YCPSymbol & property )
{
if ( YUIComponent::ui() )
- return YUIComponent::ui()->evaluateQueryWidget( widget_id, property );
+ return YCP_UI::QueryWidget( widget_id, property );
else
return YCPVoid();
}
@@ -242,7 +249,7 @@
Y2UINamespace::QueryWidget( const YCPSymbol & widget_id, const YCPTerm & property )
{
if ( YUIComponent::ui() )
- return YUIComponent::ui()->evaluateQueryWidget( widget_id, property );
+ return YCP_UI::QueryWidget( widget_id, property );
else
return YCPVoid();
}
@@ -252,7 +259,7 @@
Y2UINamespace::QueryWidget( const YCPTerm & widget_id, const YCPSymbol & property )
{
if ( YUIComponent::ui() )
- return YUIComponent::ui()->evaluateQueryWidget( widget_id, property );
+ return YCP_UI::QueryWidget( widget_id, property );
else
return YCPVoid();
}
@@ -262,7 +269,7 @@
Y2UINamespace::QueryWidget( const YCPTerm & widget_id, const YCPTerm & property )
{
if ( YUIComponent::ui() )
- return YUIComponent::ui()->evaluateQueryWidget( widget_id, property );
+ return YCP_UI::QueryWidget( widget_id, property );
else
return YCPVoid();
}
@@ -272,7 +279,7 @@
Y2UINamespace::ReplaceWidget( const YCPSymbol & widget_id, const YCPTerm & new_widget )
{
if ( YUIComponent::ui() )
- return YUIComponent::ui()->evaluateReplaceWidget( widget_id, new_widget );
+ return YCP_UI::ReplaceWidget( widget_id, new_widget );
else
return YCPVoid();
}
@@ -282,7 +289,7 @@
Y2UINamespace::ReplaceWidget( const YCPTerm & widget_id, const YCPTerm & new_widget )
{
if ( YUIComponent::ui() )
- return YUIComponent::ui()->evaluateReplaceWidget( widget_id, new_widget );
+ return YCP_UI::ReplaceWidget( widget_id, new_widget );
else
return YCPVoid();
}
@@ -292,7 +299,7 @@
Y2UINamespace::SetFocus( const YCPSymbol & widget_id )
{
if ( YUIComponent::ui() )
- return YUIComponent::ui()->evaluateSetFocus( widget_id );
+ return YCP_UI::SetFocus( widget_id );
else
return YCPVoid();
}
@@ -302,7 +309,7 @@
Y2UINamespace::SetFocus( const YCPTerm & widget_id )
{
if ( YUIComponent::ui() )
- return YUIComponent::ui()->evaluateSetFocus( widget_id );
+ return YCP_UI::SetFocus( widget_id );
else
return YCPVoid();
}
@@ -312,7 +319,7 @@
Y2UINamespace::BusyCursor()
{
if ( YUIComponent::ui() )
- YUIComponent::ui()->evaluateBusyCursor();
+ YCP_UI::BusyCursor();
return YCPVoid();
}
@@ -322,7 +329,7 @@
Y2UINamespace::RedrawScreen()
{
if ( YUIComponent::ui() )
- YUIComponent::ui()->evaluateRedrawScreen();
+ YCP_UI::RedrawScreen();
return YCPVoid();
}
@@ -332,7 +339,7 @@
Y2UINamespace::NormalCursor()
{
if ( YUIComponent::ui() )
- YUIComponent::ui()->evaluateNormalCursor();
+ YCP_UI::NormalCursor();
return YCPVoid();
}
@@ -342,7 +349,7 @@
Y2UINamespace::MakeScreenShot( const YCPString & filename )
{
if ( YUIComponent::ui() )
- YUIComponent::ui()->evaluateMakeScreenShot( filename );
+ YCP_UI::MakeScreenShot( filename );
return YCPVoid();
}
@@ -362,7 +369,7 @@
Y2UINamespace::DumpWidgetTree()
{
if ( YUIComponent::ui() )
- YUIComponent::ui()->evaluateDumpWidgetTree();
+ YCP_UI::DumpWidgetTree();
return YCPVoid();
}
@@ -372,7 +379,7 @@
Y2UINamespace::Beep()
{
if ( YUIComponent::ui() )
- YUIComponent::ui()->evaluateBeep();
+ YCP_UI::Beep();
return YCPVoid();
}
@@ -381,7 +388,7 @@
Y2UINamespace::RecordMacro( const YCPString & filename )
{
if ( YUIComponent::ui() )
- YUIComponent::ui()->evaluateRecordMacro( filename );
+ YCP_UI::RecordMacro( filename );
return YCPVoid();
}
@@ -391,7 +398,7 @@
Y2UINamespace::StopRecordMacro()
{
if ( YUIComponent::ui() )
- YUIComponent::ui()->evaluateStopRecordMacro();
+ YCP_UI::StopRecordMacro();
return YCPVoid();
}
@@ -401,7 +408,7 @@
Y2UINamespace::PlayMacro( const YCPString & filename )
{
if ( YUIComponent::ui() )
- YUIComponent::ui()->evaluatePlayMacro( filename );
+ YCP_UI::PlayMacro( filename );
return YCPVoid();
}
@@ -410,7 +417,7 @@
Y2UINamespace::FakeUserInput()
{
if ( YUIComponent::ui() )
- YUIComponent::ui()->evaluateFakeUserInput( YCPVoid() );
+ YCP_UI::FakeUserInput( YCPVoid() );
return YCPVoid();
}
@@ -420,7 +427,7 @@
Y2UINamespace::FakeUserInput( const YCPValue & next_input )
{
if ( YUIComponent::ui() )
- YUIComponent::ui()->evaluateFakeUserInput( next_input );
+ YCP_UI::FakeUserInput( next_input );
return YCPVoid();
}
@@ -431,7 +438,7 @@
Y2UINamespace::Glyph( const YCPSymbol & glyphSym )
{
if ( YUIComponent::ui() )
- return YUIComponent::ui()->evaluateGlyph( glyphSym );
+ return YCP_UI::Glyph( glyphSym );
else
return YCPString( "*" );
}
@@ -441,7 +448,7 @@
Y2UINamespace::GetDisplayInfo()
{
if ( YUIComponent::ui() )
- return YUIComponent::ui()->evaluateGetDisplayInfo();
+ return YCP_UI::GetDisplayInfo();
else
return YCPVoid();
}
@@ -451,7 +458,7 @@
Y2UINamespace::RecalcLayout()
{
if ( YUIComponent::ui() )
- YUIComponent::ui()->evaluateRecalcLayout();
+ YCP_UI::RecalcLayout();
return YCPVoid();
}
@@ -461,7 +468,7 @@
Y2UINamespace::PostponeShortcutCheck()
{
if ( YUIComponent::ui() )
- YUIComponent::ui()->evaluatePostponeShortcutCheck();
+ YCP_UI::PostponeShortcutCheck();
return YCPVoid();
}
@@ -470,7 +477,7 @@
Y2UINamespace::CheckShortcuts()
{
if ( YUIComponent::ui() )
- YUIComponent::ui()->evaluateCheckShortcuts();
+ YCP_UI::CheckShortcuts();
return YCPVoid();
}
@@ -480,7 +487,7 @@
Y2UINamespace::WidgetExists( const YCPSymbol & widget_id )
{
if ( YUIComponent::ui() )
- return YUIComponent::ui()->evaluateWidgetExists( widget_id );
+ return YCP_UI::WidgetExists( widget_id );
else
return YCPVoid();
}
@@ -490,7 +497,7 @@
Y2UINamespace::WidgetExists( const YCPTerm & widget_id )
{
if ( YUIComponent::ui() )
- return YUIComponent::ui()->evaluateWidgetExists( widget_id );
+ return YCP_UI::WidgetExists( widget_id );
else
return YCPVoid();
}
@@ -500,7 +507,7 @@
Y2UINamespace::RunPkgSelection( const YCPValue & widget_id )
{
if ( YUIComponent::ui() )
- return YUIComponent::ui()->evaluateRunPkgSelection( widget_id );
+ return YCP_UI::RunPkgSelection( widget_id );
else
return YCPVoid();
}
@@ -510,7 +517,7 @@
Y2UINamespace::AskForExistingDirectory( const YCPString & startDir, const YCPString & headline )
{
if ( YUIComponent::ui() )
- return YUIComponent::ui()->evaluateAskForExistingDirectory( startDir, headline );
+ return YCP_UI::AskForExistingDirectory( startDir, headline );
else
return YCPVoid();
}
@@ -520,7 +527,7 @@
Y2UINamespace::AskForExistingFile( const YCPString & startWith, const YCPString & filter, const YCPString & headline )
{
if ( YUIComponent::ui() )
- return YUIComponent::ui()->evaluateAskForExistingFile( startWith, filter, headline );
+ return YCP_UI::AskForExistingFile( startWith, filter, headline );
else
return YCPVoid();
}
@@ -530,7 +537,7 @@
Y2UINamespace::AskForSaveFileName( const YCPString & startWith, const YCPString & filter, const YCPString & headline )
{
if ( YUIComponent::ui() )
- return YUIComponent::ui()->evaluateAskForSaveFileName( startWith, filter, headline );
+ return YCP_UI::AskForSaveFileName( startWith, filter, headline );
else
return YCPVoid();
}
@@ -540,7 +547,7 @@
Y2UINamespace::SetFunctionKeys( const YCPMap & new_fkeys )
{
if ( YUIComponent::ui() )
- YUIComponent::ui()->evaluateSetFunctionKeys( new_fkeys );
+ YCP_UI::SetFunctionKeys( new_fkeys );
return YCPVoid();
}
@@ -550,7 +557,7 @@
Y2UINamespace::Recode( const YCPString & from, const YCPString & to, const YCPString & text )
{
if ( YUIComponent::ui() )
- return YUIComponent::ui()->evaluateRecode( from, to, text );
+ return YCP_UI::Recode( from, to, text );
else
return YCPVoid();
}
@@ -560,7 +567,7 @@
Y2UINamespace::HasSpecialWidget( const YCPSymbol & widget )
{
if ( YUIComponent::ui() )
- return YUIComponent::ui()->evaluateHasSpecialWidget( widget );
+ return YCP_UI::HasSpecialWidget( widget );
else
return YCPBoolean( false );
}
@@ -570,7 +577,7 @@
Y2UINamespace::WizardCommand( const YCPTerm & command )
{
if ( YUIComponent::ui() )
- return YUIComponent::ui()->evaluateWizardCommand( command );
+ return YCP_UI::WizardCommand( command );
else
return YCPBoolean( false );
}
@@ -590,9 +597,16 @@
}
}
-// -------------
-Y2UIFunction::Y2UIFunction (Y2UINamespace* instance, YUIComponent* comp, unsigned int pos, bool play_macro_blocks) :
+//
+// --------------------------------------------------------------------
+//
+
+
+Y2UIFunction::Y2UIFunction (Y2UINamespace * instance,
+ YUIComponent * comp,
+ unsigned pos,
+ bool play_macro_blocks) :
m_position (pos)
, m_instance (instance)
, m_comp (comp)
@@ -603,23 +617,26 @@
, m_param4 ( YCPNull() )
, m_param5 ( YCPNull() )
{
+
};
+
bool Y2UIFunction::attachParameter (const YCPValue& arg, const int position)
{
switch (position)
{
- case 0: m_param1 = arg; break;
- case 1: m_param2 = arg; break;
- case 2: m_param3 = arg; break;
- case 3: m_param4 = arg; break;
- case 4: m_param5 = arg; break;
- default: return false;
+ case 0: m_param1 = arg; break;
+ case 1: m_param2 = arg; break;
+ case 2: m_param3 = arg; break;
+ case 3: m_param4 = arg; break;
+ case 4: m_param5 = arg; break;
+ default: return false;
}
return true;
}
+
constTypePtr Y2UIFunction::wantedParameterType() const
{
// we do not help them with type conversion
@@ -627,6 +644,7 @@
return Type::Any; // FIXME make this the default behavior in parent class
}
+
bool Y2UIFunction::appendParameter (const YCPValue& arg)
{
if (m_param1.isNull())
@@ -654,6 +672,7 @@
return false;
}
+
bool Y2UIFunction::finishParameters()
{
// Aha, perl could give us any garbage.
@@ -665,6 +684,7 @@
return true;
}
+
YCPValue Y2UIFunction::evaluateCall()
{
if ( ! m_comp->ui() )
@@ -704,15 +724,18 @@
return ret;
}
+
YCPValue Y2UIFunction::evaluateCall_int()
{
- switch (m_position) {
+ switch (m_position)
+ {
#include "UIBuiltinCalls.h"
}
return YCPNull();
}
+
bool Y2UIFunction::reset()
{
m_param1 = YCPNull();
@@ -724,12 +747,14 @@
return true;
}
+
string Y2UIFunction::name() const
{
// FIXME. when is this called at all?
return("Y2UI");
}
+
// error reporting helper
static
void no_match (const char * name, constTypePtr type,
@@ -742,7 +767,10 @@
}
-Y2UIOverloadedFunction::Y2UIOverloadedFunction ( Y2UINamespace* instance, YUIComponent* comp,
+
+
+Y2UIOverloadedFunction::Y2UIOverloadedFunction ( Y2UINamespace * instance,
+ YUIComponent * comp,
unsigned pos_offset,
vector<SymbolEntryPtr>::iterator candidates_b,
vector<SymbolEntryPtr>::iterator candidates_e,
Modified: trunk/core/libyui/src/YCPMacroRecorder.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YCPMacroRecorder.cc?rev=44242&r1=44241&r2=44242&view=diff
==============================================================================
--- trunk/core/libyui/src/YCPMacroRecorder.cc (original)
+++ trunk/core/libyui/src/YCPMacroRecorder.cc Thu Feb 7 15:51:03 2008
@@ -36,6 +36,7 @@
#include "YCPValueWidgetID.h"
#include "YUI.h"
#include "YCP_util.h"
+#include "YCP_UI.h"
#ifndef Y2LOG_DATE
# define Y2LOG_DATE "%Y-%m-%d %H:%M:%S" /* The date format */
@@ -347,7 +348,7 @@
}
else
{
- YCPValue val = YUI::ui()->evaluateQueryWidget( idTerm, YCPSymbol( propertyName ) );
+ YCPValue val = YCP_UI::QueryWidget( idTerm, YCPSymbol( propertyName ) );
fprintf( _macroFile, "%s%sUI::%s( %s,\t`%s,\t%s );\t// %s \"%s\"\n",
// UI::ChangeWidget( `id( `something ), `Value, 42 ) // YWidget
Copied: trunk/core/libyui/src/YCP_UI.cc (from r44211, trunk/core/libyui/src/YUI_builtins.cc)
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YCP_UI.cc?p2=trunk/core/libyui/src/YCP_UI.cc&p1=trunk/core/libyui/src/YUI_builtins.cc&r1=44211&r2=44242&rev=44242&view=diff
==============================================================================
--- trunk/core/libyui/src/YUI_builtins.cc (original)
+++ trunk/core/libyui/src/YCP_UI.cc Thu Feb 7 15:51:03 2008
@@ -10,13 +10,9 @@
| (C) SuSE GmbH |
\----------------------------------------------------------------------/
- File: YUI_builtins.cc
+ File: YCP_UI.cc
- Authors: Mathias Kettner
- Stefan Hundhammer
- Stanislav Visnovsky
-
- Maintainer: Stefan Hundhammer
+ Authors: Stefan Hundhammer
/-*/
@@ -25,13 +21,7 @@
#define VERBOSE_EVENTS 0
#include
-#include // pipe()
-#include // fcntl()
-#include // strerror()
-#include
-#include
#include
-#include
#define y2log_component "ui"
#include // ycperror()
@@ -40,35 +30,38 @@
#include "YUILog.h"
#include
-#include
+#include "YCP_UI.h"
#include "YUI.h"
-#include "YCP_util.h"
-#include "YApplication.h"
-#include "YWidget.h"
-#include "YEvent.h"
+#include "YUIComponent.h"
#include "YUIException.h"
#include "YUISymbols.h"
-#include "YDialog.h"
-#include "YMacro.h"
-#include "YCPMacroRecorder.h"
-#include "YCPMacroPlayer.h"
-#include "YReplacePoint.h"
-#include "YShortcut.h"
-#include "YWizard.h"
-#include "YWidgetFactory.h"
+#include "YApplication.h"
+#include "YCPDialogParser.h"
#include "YCPErrorDialog.h"
#include "YCPEvent.h"
-#include "YCPValueWidgetID.h"
-#include "YCPDialogParser.h"
#include "YCPItemParser.h"
+#include "YCPMacroPlayer.h"
+#include "YCPMacroRecorder.h"
#include "YCPPropertyHandler.h"
+#include "YCPValueWidgetID.h"
#include "YCPWizardCommandParser.h"
-#include "YOptionalWidgetFactory.h"
+#include "YCP_util.h"
#include "YCheckBox.h"
+#include "YDialog.h"
+#include "YEvent.h"
+#include "YMacro.h"
+#include "YOptionalWidgetFactory.h"
+#include "YReplacePoint.h"
+#include "YShortcut.h"
+#include "YWidget.h"
+#include "YWidgetFactory.h"
+#include "YWizard.h"
using std::string;
+std::deque<YCPValue> YCP_UI::_fakeUserInputQueue;
+
/**
* @builtin HasSpecialWidget
@@ -82,7 +75,7 @@
* Returns true if the UI supports the special widget and false if not.
*/
-YCPValue YUI::evaluateHasSpecialWidget( const YCPSymbol & widget )
+YCPValue YCP_UI::HasSpecialWidget( const YCPSymbol & widget )
{
YOptionalWidgetFactory * fact = YUI::optionalWidgetFactory();
@@ -134,7 +127,7 @@
* @usage SetLanguage( "en_GB" )
*/
-void YUI::evaluateSetLanguage( const YCPString & language, const YCPString & encoding )
+void YCP_UI::SetLanguage( const YCPString & language, const YCPString & encoding )
{
YUI::app()->setLanguage( language->value(), encoding->value() );
}
@@ -153,7 +146,7 @@
* @return string Product Name
* @usage sformat( "Welcome to %1", GetProductName() );
**/
-YCPString YUI::evaluateGetProductName()
+YCPString YCP_UI::GetProductName()
{
return YCPString( YUI::app()->productName() );
}
@@ -178,7 +171,7 @@
*
* @usage SetProductName( "SuSE HyperWall" );
**/
-void YUI::evaluateSetProductName( const YCPString & name )
+void YCP_UI::SetProductName( const YCPString & name )
{
YUI::app()->setProductName( name->value() );
}
@@ -201,7 +194,7 @@
* @usage SetConsoleFont( "( K", "lat2u-16.psf", "latin2u.scrnmap", "lat2u.uni", "latin1" )
*/
-void YUI::evaluateSetConsoleFont( const YCPString & console_magic,
+void YCP_UI::SetConsoleFont( const YCPString & console_magic,
const YCPString & font,
const YCPString & screen_map,
const YCPString & unicode_map,
@@ -230,7 +223,7 @@
* @usage RunInTerminal("/bin/bash")
*/
-YCPInteger YUI::evaluateRunInTerminal(const YCPString & command )
+YCPInteger YCP_UI::RunInTerminal(const YCPString & command )
{
return YCPInteger( YUI::app()->runInTerminal( command->value() ) );
}
@@ -243,7 +236,7 @@
* @return void
* @usage SetKeyboard()
*/
-void YUI::evaluateSetKeyboard( )
+void YCP_UI::SetKeyboard( )
{
YUI::app()->initConsoleKeyboard();
}
@@ -270,7 +263,7 @@
*
*/
-YCPString YUI::evaluateGetLanguage( const YCPBoolean & strip )
+YCPString YCP_UI::GetLanguage( const YCPBoolean & strip )
{
return YCPString( YUI::app()->language( strip->value() ) );
}
@@ -289,7 +282,7 @@
*
* @return any
*/
-YCPValue YUI::evaluateUserInput()
+YCPValue YCP_UI::UserInput()
{
#if VERBOSE_EVENTS
yuiDebug() << "UI::UserInput()" << endl;
@@ -317,7 +310,7 @@
* @return any
*
*/
-YCPValue YUI::evaluatePollInput()
+YCPValue YCP_UI::PollInput()
{
#if VERBOSE_EVENTS
yuiDebug() << "UI::PollInput()" << endl;
@@ -345,7 +338,7 @@
* @param integer timeout_millisec
* @return any
*/
-YCPValue YUI::evaluateTimeoutUserInput( const YCPInteger & timeout )
+YCPValue YCP_UI::TimeoutUserInput( const YCPInteger & timeout )
{
long timeout_millisec = timeout->value();
@@ -370,7 +363,7 @@
* @optarg timeout_millisec
* @return map
*/
-YCPValue YUI::evaluateWaitForEvent( const YCPInteger & timeout )
+YCPValue YCP_UI::WaitForEvent( const YCPInteger & timeout )
{
long timeout_millisec = 0;
@@ -392,10 +385,10 @@
-YCPValue YUI::doUserInput( const char * builtin_name,
- long timeout_millisec,
- bool wait,
- bool detailed )
+YCPValue YCP_UI::doUserInput( const char * builtin_name,
+ long timeout_millisec,
+ bool wait,
+ bool detailed )
{
// Plausibility check for timeout
@@ -429,7 +422,7 @@
// Handle events
- if ( fakeUserInputQueue.empty() )
+ if ( _fakeUserInputQueue.empty() )
{
if ( wait )
event = dialog->waitForEvent( timeout_millisec );
@@ -450,13 +443,13 @@
#endif
}
}
- else // fakeUserInputQueue contains elements -> use the first one
+ else // _fakeUserInputQueue contains elements -> use the first one
{
// Handle macro playing
- input = fakeUserInputQueue.front();
+ input = _fakeUserInputQueue.front();
yuiDebug() << "Using event from fakeUserInputQueue: "<< input << endl;
- fakeUserInputQueue.pop_front();
+ _fakeUserInputQueue.pop_front();
}
// Handle macro recording
@@ -531,7 +524,7 @@
* @usage OpenDialog( `opt( `defaultsize ), `Label( "Hello, World!" ) )
*/
-YCPBoolean YUI::evaluateOpenDialog( const YCPTerm & opts, const YCPTerm & dialogTerm )
+YCPBoolean YCP_UI::OpenDialog( const YCPTerm & opts, const YCPTerm & dialogTerm )
{
YDialogType dialogType = YPopupDialog;
YDialogColorMode colorMode = YDialogNormalColor;
@@ -599,7 +592,7 @@
* @return boolean Returns true on success.
*/
-YCPValue YUI::evaluateCloseDialog()
+YCPValue YCP_UI::CloseDialog()
{
YUI::ui()->blockEvents(); // We don't want self-generated events from UI builtins.
YDialog::deleteTopmostDialog();
@@ -627,7 +620,7 @@
* @return boolean Returns true on success.
*/
-YCPValue YUI::evaluateChangeWidget( const YCPValue & idValue, const YCPValue & property, const YCPValue & newValue )
+YCPValue YCP_UI::ChangeWidget( const YCPValue & idValue, const YCPValue & property, const YCPValue & newValue )
{
YCPValue ret = YCPVoid();
@@ -717,7 +710,7 @@
* @return any
*/
-YCPValue YUI::evaluateQueryWidget( const YCPValue & idValue, const YCPValue & property )
+YCPValue YCP_UI::QueryWidget( const YCPValue & idValue, const YCPValue & property )
{
YCPValue ret = YCPVoid();
@@ -789,7 +782,7 @@
* @return true if success, false if failed
*/
-YCPBoolean YUI::evaluateReplaceWidget( const YCPValue & idValue, const YCPTerm & newContentTerm )
+YCPBoolean YCP_UI::ReplaceWidget( const YCPValue & idValue, const YCPTerm & newContentTerm )
{
bool success = true;
@@ -867,7 +860,7 @@
* @return boolean Returns true on success.
*/
-YCPValue YUI::evaluateWizardCommand( const YCPTerm & command )
+YCPValue YCP_UI::WizardCommand( const YCPTerm & command )
{
if ( ! YUI::optionalWidgetFactory()->hasWizard() )
return YCPBoolean( false );
@@ -907,7 +900,7 @@
* @return boolean Returns true on success (i.e. the widget accepted the focus).
*/
-YCPBoolean YUI::evaluateSetFocus( const YCPValue & idValue )
+YCPBoolean YCP_UI::SetFocus( const YCPValue & idValue )
{
if ( ! YCPDialogParser::isSymbolOrId( idValue ) )
return YCPNull();
@@ -937,7 +930,7 @@
* @return void
*/
-void YUI::evaluateBusyCursor()
+void YCP_UI::BusyCursor()
{
YUI::app()->busyCursor();
}
@@ -958,7 +951,7 @@
* @return void
*/
-void YUI::evaluateNormalCursor()
+void YCP_UI::NormalCursor()
{
YUI::app()->normalCursor();
}
@@ -979,7 +972,7 @@
* @return void
*/
-void YUI::evaluateRedrawScreen()
+void YCP_UI::RedrawScreen()
{
YUI::app()->redrawScreen();
}
@@ -997,7 +990,7 @@
* @return void
*/
-void YUI::evaluateMakeScreenShot( const YCPString & filename )
+void YCP_UI::MakeScreenShot( const YCPString & filename )
{
YUI::app()->makeScreenShot( filename->value () );
}
@@ -1014,7 +1007,7 @@
* @return void
*/
-void YUI::evaluateDumpWidgetTree()
+void YCP_UI::DumpWidgetTree()
{
YDialog::currentDialog()->dumpDialogWidgetTree();
}
@@ -1029,7 +1022,7 @@
*
* @return void
*/
-void YUI::evaluateBeep()
+void YCP_UI::Beep()
{
YUI::app()->beep();
}
@@ -1043,7 +1036,7 @@
* @param string macroFileName
* @return void
*/
-void YUI::evaluateRecordMacro( const YCPString & filename )
+void YCP_UI::RecordMacro( const YCPString & filename )
{
YMacro::record( filename->value () );
}
@@ -1059,7 +1052,7 @@
*
* @return void
*/
-void YUI::evaluateStopRecordMacro()
+void YCP_UI::StopRecordMacro()
{
YMacro::endRecording();
}
@@ -1076,7 +1069,7 @@
* @param string macroFileName
* @return void
*/
-void YUI::evaluatePlayMacro( const YCPString & filename )
+void YCP_UI::PlayMacro( const YCPString & filename )
{
YMacro::play( filename->value() );
}
@@ -1096,10 +1089,10 @@
* @optarg any nextUserInput
* @return void
*/
-void YUI::evaluateFakeUserInput( const YCPValue & next_input )
+void YCP_UI::FakeUserInput( const YCPValue & next_input )
{
yuiDebug() << "UI::FakeUserInput( " << next_input << " )" << endl;
- fakeUserInputQueue.push_back( next_input );
+ _fakeUserInputQueue.push_back( next_input );
}
@@ -1126,7 +1119,7 @@
* @param symbol glyph
* @return string
*/
-YCPString YUI::evaluateGlyph( const YCPSymbol & glyphSym )
+YCPString YCP_UI::Glyph( const YCPSymbol & glyphSym )
{
return YCPString( YUI::app()->glyph( glyphSym->symbol() ) );
}
@@ -1181,7 +1174,7 @@
* @return map <string any>
*
*/
-YCPMap YUI::evaluateGetDisplayInfo()
+YCPMap YCP_UI::GetDisplayInfo()
{
YCPMap info_map;
YApplication * app = YUI::app(); // slight optimization
@@ -1218,7 +1211,7 @@
*
* @return void
*/
-void YUI::evaluateRecalcLayout()
+void YCP_UI::RecalcLayout()
{
YDialog::currentDialog()->setInitialSize();
}
@@ -1261,7 +1254,7 @@
*
* @return void
*/
-void YUI::evaluatePostponeShortcutCheck()
+void YCP_UI::PostponeShortcutCheck()
{
YDialog::currentDialog()->postponeShortcutCheck();
}
@@ -1289,7 +1282,7 @@
*
* @return void
*/
-void YUI::evaluateCheckShortcuts()
+void YCP_UI::CheckShortcuts()
{
YDialog * dialog = YDialog::currentDialog();
@@ -1313,7 +1306,7 @@
* @param symbol widgetId
* @return boolean
*/
-YCPBoolean YUI::evaluateWidgetExists( const YCPValue & idValue )
+YCPBoolean YCP_UI::WidgetExists( const YCPValue & idValue )
{
if ( ! YCPDialogParser::isSymbolOrId( idValue ) ) return YCPNull();
@@ -1338,7 +1331,7 @@
* @return any Returns `cancel if the user wishes to cancel his selections.
*
*/
-YCPValue YUI::evaluateRunPkgSelection( const YCPValue & value_id )
+YCPValue YCP_UI::RunPkgSelection( const YCPValue & value_id )
{
YCPValue result = YCPNull();
@@ -1354,7 +1347,7 @@
YWidget * selector = YCPDialogParser::findWidgetWithId( id );
yuiMilestone() << "Running package selection..." << endl;
- YEvent * event = runPkgSelection( selector );
+ YEvent * event = YUI::ui()->runPkgSelection( selector );
if ( event )
{
@@ -1393,10 +1386,9 @@
* @return string Returns the selected directory name or <i>nil</i> if the
* user canceled the operation.
*/
-YCPValue
-YUI::evaluateAskForExistingDirectory( const YCPString & startDir, const YCPString & headline )
+YCPValue YCP_UI::AskForExistingDirectory( const YCPString & startDir, const YCPString & headline )
{
- string ret = app()->askForExistingDirectory( startDir->value(), headline->value() );
+ string ret = YUI::app()->askForExistingDirectory( startDir->value(), headline->value() );
if ( ret.empty() )
return YCPVoid();
@@ -1419,9 +1411,11 @@
* @return string Returns the selected file name or <i>nil</i> if the user
* canceled the operation.
*/
-YCPValue YUI::evaluateAskForExistingFile( const YCPString & startWith, const YCPString & filter, const YCPString & headline )
+YCPValue YCP_UI::AskForExistingFile( const YCPString & startWith,
+ const YCPString & filter,
+ const YCPString & headline )
{
- string ret = app()->askForExistingFile( startWith->value(), filter->value(), headline->value() );
+ string ret = YUI::app()->askForExistingFile( startWith->value(), filter->value(), headline->value() );
if ( ret.empty() )
return YCPVoid();
@@ -1444,9 +1438,11 @@
*
* @return string Returns the selected file name or <i>nil</i> if the user canceled the operation.
*/
-YCPValue YUI::evaluateAskForSaveFileName( const YCPString & startWith, const YCPString & filter, const YCPString & headline )
+YCPValue YCP_UI::AskForSaveFileName( const YCPString & startWith,
+ const YCPString & filter,
+ const YCPString & headline )
{
- string ret = app()->askForSaveFileName( startWith->value(), filter->value(), headline->value() );
+ string ret = YUI::app()->askForSaveFileName( startWith->value(), filter->value(), headline->value() );
if ( ret.empty() )
return YCPVoid();
@@ -1470,7 +1466,7 @@
* @return void
* @usage SetFunctionKeys( $[ "Back": 8, "Next": 10, ... ] );
*/
-void YUI::evaluateSetFunctionKeys( const YCPMap & new_fkeys )
+void YCP_UI::SetFunctionKeys( const YCPMap & new_fkeys )
{
for ( YCPMapIterator it = new_fkeys->begin(); it != new_fkeys->end(); ++it )
{
@@ -1482,7 +1478,7 @@
if ( fkey > 0 && fkey <= 24 )
{
yuiDebug() << "Mapping \"" << label << "\"\t-> F" << fkey << endl;
- app()->setDefaultFunctionKey( label, fkey );
+ YUI::app()->setDefaultFunctionKey( label, fkey );
}
else
{
@@ -1501,44 +1497,6 @@
/**
- * @builtin WFM/SCR
- * @id WFM_SCR
- * @short callback
- * @description
- * This is used for a callback mechanism. The expression will
- * be sent to the WFM interpreter and evaluated there.
- * USE WITH CAUTION.
- *
- * @param block expression
- * @return any
- */
-
-YCPValue YUI::evaluateCallback( const YCPTerm & term, bool to_wfm )
-{
- if ( term->size() != 1 ) // must have 1 arg - anything allowed
- {
- return YCPNull();
- }
-
- if ( _callback )
- {
- YCPValue v = YCPNull();
- if ( to_wfm ) // if it goes to WFM, just send the value
- {
- v = _callback->evaluate ( term->value(0) );
- }
- else // going to SCR, send the complete term
- {
- v = _callback->evaluate( term );
- }
- return v;
- }
-
- return YCPVoid();
-}
-
-
-/**
* @builtin Recode
* @short Recodes encoding of string from or to "UTF-8" encoding.
* @description
@@ -1553,7 +1511,9 @@
* @return any
*/
-YCPValue YUI::evaluateRecode( const YCPString & fromEncoding, const YCPString & toEncoding, const YCPString & text )
+YCPValue YCP_UI::Recode( const YCPString & fromEncoding,
+ const YCPString & toEncoding,
+ const YCPString & text )
{
string outstr;
if ( recode ( text->value(), fromEncoding->value(), toEncoding->value(), outstr ) != 0 )
@@ -1571,6 +1531,47 @@
}
+/**
+ * @builtin WFM/SCR
+ * @id WFM_SCR
+ * @short callback
+ * @description
+ * This is used for a callback mechanism. The expression will
+ * be sent to the WFM interpreter and evaluated there.
+ * USE WITH CAUTION.
+ *
+ * @param block expression
+ * @return any
+ */
+YCPValue YCP_UI::evaluateCallback( const YCPTerm & term, bool to_wfm )
+{
+ if ( term->size() != 1 ) // must have 1 arg - anything allowed
+ {
+ y2error( "No arguments" );
+ return YCPNull();
+ }
+
+ Y2Component * callbackComponent = YUIComponent::uiComponent()->getCallback();
+
+ if ( callbackComponent )
+ {
+ YCPValue ret = YCPNull();
+
+ if ( to_wfm ) // if it goes to WFM, just send the value
+ {
+ ret = callbackComponent->evaluate( term->value(0) );
+ }
+ else // going to SCR, send the complete term
+ {
+ ret = callbackComponent->evaluate( term );
+ }
+ return ret;
+ }
+
+ return YCPVoid();
+}
+
+
// EOF
Added: trunk/core/libyui/src/YCP_UI.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YCP_UI.h?rev=44242&view=auto
==============================================================================
--- trunk/core/libyui/src/YCP_UI.h (added)
+++ trunk/core/libyui/src/YCP_UI.h Thu Feb 7 15:51:03 2008
@@ -0,0 +1,135 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: YCP_UI.cc
+
+ Authors: Stefan Hundhammer
+
+/-*/
+
+
+#ifndef YCP_UI_h
+#define YCP_UI_h
+
+#include <deque>
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+
+class YCP_UI
+{
+public:
+ //
+ // UI Built-ins. Each function directly corresponds to a YCP UI::Something() call.
+ //
+ // See the documentation at the function definitions for details
+ //
+
+ static YCPValue AskForExistingDirectory ( const YCPString & startDir, const YCPString & headline );
+ static YCPValue AskForExistingFile ( const YCPString & startDir, const YCPString & filter, const YCPString & headline );
+ static YCPValue AskForSaveFileName ( const YCPString & startDir, const YCPString & filter, const YCPString & headline );
+ static void BusyCursor ();
+ static void Beep ();
+ static YCPValue ChangeWidget ( const YCPValue & widgetId, const YCPValue & property, const YCPValue & new_value );
+ static void CheckShortcuts ();
+ static YCPValue CloseDialog ();
+ static void DumpWidgetTree ();
+ static void FakeUserInput ( const YCPValue & nextInput );
+ static YCPMap GetDisplayInfo ();
+ static YCPString GetLanguage ( const YCPBoolean & stripEncoding );
+ static YCPString GetProductName ();
+ static YCPString Glyph ( const YCPSymbol & symbol );
+ static YCPValue HasSpecialWidget ( const YCPSymbol & widget );
+ static void MakeScreenShot ( const YCPString & filename );
+ static void NormalCursor ();
+ static YCPBoolean OpenDialog ( const YCPTerm & opts, const YCPTerm & dialogTerm );
+ static void PlayMacro ( const YCPString & filename );
+ static void PostponeShortcutCheck ();
+ static YCPValue QueryWidget ( const YCPValue & widgetId, const YCPValue& property );
+ static void RecalcLayout ();
+ static YCPValue Recode ( const YCPString & fromEncoding, const YCPString & toEncoding, const YCPString & text );
+ static void RecordMacro ( const YCPString & fileName );
+ static void RedrawScreen ();
+ static YCPBoolean ReplaceWidget ( const YCPValue & widgetId, const YCPTerm & term );
+ static YCPValue RunPkgSelection ( const YCPValue & widgetId );
+ static void SetConsoleFont ( const YCPString & magic,
+ const YCPString & font,
+ const YCPString & screen_map,
+ const YCPString & unicode_map,
+ const YCPString & encoding );
+ static void SetKeyboard ();
+ static YCPInteger RunInTerminal ( const YCPString & module);
+ static YCPBoolean SetFocus ( const YCPValue & widgetId );
+ static void SetFunctionKeys ( const YCPMap & functionKeyMap );
+ static void SetLanguage ( const YCPString & lang, const YCPString & encoding = YCPNull() );
+ static void SetProductName ( const YCPString & name );
+ static void StopRecordMacro ();
+ static YCPBoolean WidgetExists ( const YCPValue & widgetId );
+ static YCPValue UserInput ();
+ static YCPValue TimeoutUserInput ( const YCPInteger & timeout );
+ static YCPValue WaitForEvent ( const YCPInteger & timeout = YCPNull() );
+ static YCPValue WizardCommand ( const YCPTerm & command );
+ static YCPValue PollInput ();
+
+ /**
+ * Not really a UI built-in: This implements the WFM or SCR callback command.
+ **/
+ static YCPValue evaluateCallback ( const YCPTerm & term, bool to_wfm );
+
+protected:
+
+ /**
+ * Mid-level handler for the user input related UI commands:
+ * UserInput()
+ * TimeoutUserInput()
+ * WaitForEvent()
+ * PollInput()
+ *
+ * 'builtin_name' is the name of the specific UI builtin command (to use
+ * the correct name in the log file).
+ *
+ * 'timeout_millisec' is the timeout in milliseconds to use (0 for "wait
+ * forever").
+ *
+ * 'wait' specifies if this should wait until an event is available if
+ * there is none yet.
+ *
+ * 'detailed' specifies if a full-fledged event map is desired as return
+ * value (WaitForEvent()) or one simple YCPValue (an ID).
+ **/
+ static YCPValue doUserInput( const char * builtin_name,
+ long timeout_millisec,
+ bool wait,
+ bool detailed );
+
+ //
+ // Data members
+ //
+
+ /**
+ * Queue for synthetic (faked) user input events.
+ * Filled with FakeUserInput(), consumed with UserInput() and related.
+ **/
+ static std::deque<YCPValue> _fakeUserInputQueue;
+
+
+private:
+ YCP_UI() {}
+ ~YCP_UI() {}
+};
+
+#endif // YCP_UI_h
Modified: trunk/core/libyui/src/YUI.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YUI.h?rev=44242&r1=44241&r2=44242&view=diff
==============================================================================
--- trunk/core/libyui/src/YUI.h (original)
+++ trunk/core/libyui/src/YUI.h Thu Feb 7 15:51:03 2008
@@ -20,18 +20,11 @@
#define YUI_h
#include
-#include <deque>
#include <string>
-using std::deque;
using std::string;
-#include
#include
-#include
-#include
-#include
-#include
#include "YTypes.h"
#include "YWidgetOpt.h"
@@ -45,7 +38,6 @@
class YDialog;
class YMacroPlayer;
class YMacroRecorder;
-class Y2Component;
class Y2UIFunction;
class YUIBuiltinCallData;
@@ -197,91 +189,12 @@
bool runningWithThreads() const { return _withThreads; }
/**
- * Call a UI builtin function in the correct thread (the UI thread).
- * This is called from libycp/YExpression via the UI builtin declarations
- * that call UICallHandler.
- **/
- YCPValue callBuiltin( void * /*function*/, int /*argc*/, YCPValue /*argv*/[] )
- {
- // FIXME dummy UI?
- return YCPNull();
- }
-
- /**
* Call 'function' with 'argc' YCPValue parameters and return the result of
* 'function'.
**/
static YCPValue callFunction( void * function, int argc, YCPValue argv[] );
/**
- * Set a callback component.
- **/
- void setCallback( Y2Component * callback ) { _callback = callback; }
-
- /**
- * Returns the callback previously set with setCallback().
- **/
- Y2Component * getCallback() const { return _callback; }
-
- /**
- * Implementations for most UI builtins.
- * Each method corresponds directly to one UI builtin.
- **/
- YCPValue evaluateAskForExistingDirectory ( const YCPString& startDir, const YCPString& headline );
- YCPValue evaluateAskForExistingFile ( const YCPString& startDir, const YCPString& filter, const YCPString& headline );
- YCPValue evaluateAskForSaveFileName ( const YCPString& startDir, const YCPString& filter, const YCPString& headline );
- void evaluateBusyCursor ();
- void evaluateBeep ();
- YCPValue evaluateChangeWidget ( const YCPValue & value_id, const YCPValue & property, const YCPValue & new_value );
- void evaluateCheckShortcuts ();
- YCPValue evaluateCloseDialog ();
- void evaluateDumpWidgetTree ();
- void evaluateFakeUserInput ( const YCPValue & next_input );
- YCPMap evaluateGetDisplayInfo ();
- YCPString evaluateGetLanguage ( const YCPBoolean & strip_encoding );
- YCPString evaluateGetProductName ();
- YCPString evaluateGlyph ( const YCPSymbol & symbol );
- YCPValue evaluateHasSpecialWidget ( const YCPSymbol & widget );
- void evaluateMakeScreenShot ( const YCPString & filename );
- void evaluateNormalCursor ();
- YCPBoolean evaluateOpenDialog ( const YCPTerm & opts, const YCPTerm & dialogTerm );
- void evaluatePlayMacro ( const YCPString & filename );
- void evaluatePostponeShortcutCheck ();
- YCPValue evaluateQueryWidget ( const YCPValue& value_id, const YCPValue& property );
- void evaluateRecalcLayout ();
- YCPValue evaluateRecode ( const YCPString & from, const YCPString & to, const YCPString & text );
- void evaluateRecordMacro ( const YCPString & filename );
- void evaluateRedrawScreen ();
- YCPBoolean evaluateReplaceWidget ( const YCPValue & value_id, const YCPTerm & term );
- YCPValue evaluateRunPkgSelection ( const YCPValue & value_id );
- void evaluateSetConsoleFont ( const YCPString& magic,
- const YCPString& font,
- const YCPString& screen_map,
- const YCPString& unicode_map,
- const YCPString& encoding );
- void evaluateSetKeyboard ();
- YCPInteger evaluateRunInTerminal ( const YCPString& module);
- YCPBoolean evaluateSetFocus ( const YCPValue & value_id );
- void evaluateSetFunctionKeys ( const YCPMap & new_keys );
- void evaluateSetLanguage ( const YCPString& lang, const YCPString& encoding = YCPNull() );
- void evaluateSetProductName ( const YCPString & name );
- void evaluateStopRecordMacro ();
- YCPBoolean evaluateWidgetExists ( const YCPValue & value_id );
-
- YCPValue evaluateUserInput ();
- YCPValue evaluateTimeoutUserInput ( const YCPInteger & timeout );
- YCPValue evaluateWaitForEvent ( const YCPInteger & timeout = YCPNull() );
- YCPValue evaluateWizardCommand ( const YCPTerm & command );
- YCPValue evaluatePollInput ();
-
- /**
- * Handlers for not-so-simple property types.
- **/
- YCPValue queryWidgetComplexTypes ( YWidget * widget, const string & propertyName );
- void changeWidgetComplexTypes( YWidget * widget, const string & propertyName, const YCPValue & val );
-
-
- /**
* This method implements the UI thread in case it is existing.
* The loop consists of calling idleLoop, getting the next
* command from the @ref YCPUIComponent, evaluating it, which
@@ -291,10 +204,16 @@
**/
void uiThreadMainLoop();
+ /**
+ * UI-specific runPkgSelection method.
+ *
+ * Derived classes are required to implement this.
+ **/
+ virtual YEvent * runPkgSelection( YWidget * packageSelector ) = 0;
+
protected:
-
/**
* This virtual method is called when threads are activated in case the
* execution control is currently on the side of the module. This means
@@ -312,22 +231,6 @@
virtual void idleLoop( int fd_ycp ) = 0;
/**
- * UI-specific runPkgSelection method.
- *
- * Derived classes are required to implement this.
- **/
- virtual YEvent * runPkgSelection( YWidget * packageSelector ) = 0;
-
- YCPValue callback( const YCPValue & value );
-
- /**
- * Evaluates a locale. Evaluate _( "string" ) to "string".
- **/
- YCPValue evaluateLocale( const YCPLocale & );
-
-
-protected:
- /**
* Tells the ui thread that it should terminate and waits
* until it does so.
**/
@@ -364,35 +267,6 @@
bool waitForYCPThread();
/**
- * Mid-level handler for the user input related UI commands:
- * UserInput()
- * TimeoutUserInput()
- * WaitForEvent()
- * PollInput()
- *
- * 'builtin_name' is the name of the specific UI builtin command (to use
- * the correct name in the log file).
- *
- * 'timeout_millisec' is the timeout in milliseconds to use (0 for "wait
- * forever").
- *
- * 'wait' specifies if this should wait until an event is available if
- * there is none yet.
- *
- * 'detailed' specifies if a full-fledged event map is desired as return
- * value (WaitForEvent()) or one simple YCPValue (an ID).
- **/
- YCPValue doUserInput( const char * builtin_name,
- long timeout_millisec,
- bool wait,
- bool detailed );
-
- /**
- * Implements the WFM or SCR callback command.
- **/
- YCPValue evaluateCallback( const YCPTerm & term, bool to_wfm );
-
- /**
* Check if debug logging is enabled.
**/
bool debugLoggingEnabled() const;
@@ -405,7 +279,6 @@
void enableDebugLogging( bool enable = true );
-
//
// Data members
//
@@ -452,22 +325,12 @@
bool terminate_ui_thread;
/**
- * Queue for synthetic (faked) user input events.
- **/
- deque<YCPValue> fakeUserInputQueue;
-
- /**
* Flag that keeps track of blocked events.
* Never query this directly, use eventsBlocked() instead.
**/
bool _eventsBlocked;
/**
- * The callback component previously set with setCallback().
- **/
- Y2Component * _callback;
-
- /**
* Global reference to the UI
**/
static YUI * _yui;
Modified: trunk/core/libyui/src/YUIComponent.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YUIComponent.cc?rev=44242&r1=44241&r2=44242&view=diff
==============================================================================
--- trunk/core/libyui/src/YUIComponent.cc (original)
+++ trunk/core/libyui/src/YUIComponent.cc Thu Feb 7 15:51:03 2008
@@ -42,7 +42,8 @@
_macro_file = 0;
_with_threads = false;
_have_server_options = false;
- _namespace = NULL;
+ _namespace = NULL;
+ _callbackComponent = 0;
if ( _uiComponent )
{
@@ -117,7 +118,14 @@
}
if ( _ui )
+ {
+#if 0
+ // obsolete? The corresponding UI function always returns YCPull()
return _ui->callBuiltin( function, fn_argc, fn_argv );
+#else
+ return YCPNull();
+#endif
+ }
else
return YCPVoid();
}
@@ -175,22 +183,6 @@
}
-void YUIComponent::setCallback( Y2Component * callback )
-{
- if ( _ui )
- _ui->setCallback( callback );
-}
-
-
-Y2Component * YUIComponent::getCallback() const
-{
- if ( _ui )
- return _ui->getCallback();
- else
- return 0;
-}
-
-
YUI * YUIComponent::createUI( int /*argc*/, char ** /*argv*/, bool /*with_threads*/, const char * /*macro_file*/ )
{
// This component can be instantiated for compilation purposes
Modified: trunk/core/libyui/src/YUIComponent.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YUIComponent.h?rev=44242&r1=44241&r2=44242&view=diff
==============================================================================
--- trunk/core/libyui/src/YUIComponent.h (original)
+++ trunk/core/libyui/src/YUIComponent.h Thu Feb 7 15:51:03 2008
@@ -52,7 +52,10 @@
*
* Implement this method in derived classes.
**/
- virtual YUI * createUI( int argc, char **argv, bool with_threads, const char * macro_file );
+ virtual YUI * createUI( int argc,
+ char **argv,
+ bool with_threads,
+ const char * macro_file );
public:
@@ -104,15 +107,15 @@
virtual string name() const { return string( "UI" ); }
/**
- * Set a callback component - call the UI's setCallback() method.
+ * Set a callback component.
**/
- void setCallback( Y2Component * callback );
+ void setCallback( Y2Component * callbackComponent )
+ { _callbackComponent = callbackComponent; }
/**
- * Returns the UI's callback component previously set with setCallback();
- * calls the UI's getCallback() method.
+ * Return the UI's callback component previously set with setCallback().
**/
- Y2Component * getCallback() const;
+ Y2Component * getCallback() const { return _callbackComponent; }
private:
@@ -120,12 +123,13 @@
static YUI * _ui;
static YUIComponent * _uiComponent;
Y2Namespace * _namespace;
+ Y2Component * _callbackComponent;
- int _argc;
- char ** _argv;
- const char * _macro_file;
- bool _with_threads;
- bool _have_server_options;
+ int _argc;
+ char ** _argv;
+ const char * _macro_file;
+ bool _with_threads;
+ bool _have_server_options;
};
#endif // YUIComponent_h
Modified: trunk/core/libyui/src/YUI_core.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YUI_core.cc?rev=44242&r1=44241&r2=44242&view=diff
==============================================================================
--- trunk/core/libyui/src/YUI_core.cc (original)
+++ trunk/core/libyui/src/YUI_core.cc Thu Feb 7 15:51:03 2008
@@ -76,7 +76,6 @@
: _withThreads( withThreads )
, _uiThread( 0 )
, _eventsBlocked( false )
- , _callback( 0 )
{
_yui = this;
Modified: trunk/core/package/yast2-core.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/package/yast2-core.changes?rev=44242&r1=44241&r2=44242&view=diff
==============================================================================
--- trunk/core/package/yast2-core.changes (original)
+++ trunk/core/package/yast2-core.changes Thu Feb 7 15:51:03 2008
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Thu Feb 7 15:50:14 CET 2008 - sh@suse.de
+
+- Moved UI built-ins out to separate class YCP_UI
+- V 2.16.30
+
+-------------------------------------------------------------------
Thu Feb 7 11:09:39 CET 2008 - mvidner@suse.cz
- Make SCR registration lazy: to find .foo, open only foo.scr.
Modified: trunk/ncurses/src/pkg/NCPackageSelector.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/pkg/NCPackageSelector.cc?rev=44242&r1=44241&r2=44242&view=diff
==============================================================================
--- trunk/ncurses/src/pkg/NCPackageSelector.cc (original)
+++ trunk/ncurses/src/pkg/NCPackageSelector.cc Thu Feb 7 15:51:03 2008
@@ -69,6 +69,7 @@
#include
#include
#include
+#include "YCP_UI.h" // FIXME: Get rid of this when ReplaceWidget() is no longer done with YCP
#include "YEvent.h"
#define DEFAULT_EXPORT_FILE_NAME "user-packages.xml"
@@ -371,7 +372,11 @@
if (parsed_code != NULL)
layout = parsed_code->evaluate();
if ( !layout.isNull() )
- y2ui->evaluateReplaceWidget( YCPSymbol("replacefilter"), layout->asTerm() );
+ {
+#warning FIXME: Dependency on YCP UI!
+ // Also don't forget to remove the #include YCP_UI above
+ YCP_UI::ReplaceWidget( YCPSymbol("replacefilter"), layout->asTerm() );
+ }
}
else if ( patterns && selections )
@@ -400,8 +405,11 @@
if (parsed_code != NULL)
layout = parsed_code->evaluate();
if ( !layout.isNull() )
- y2ui->evaluateReplaceWidget( YCPSymbol("replacefilter"), layout->asTerm() );
-
+ {
+#warning FIXME: Dependency on YCP UI!
+ // Also don't forget to remove the #include YCP_UI above
+ YCP_UI::ReplaceWidget( YCPSymbol("replacefilter"), layout->asTerm() );
+ }
}
}
Modified: trunk/ncurses/yast2-ncurses.spec.in
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/yast2-ncurses.spec.in?rev=44242&r1=44241&r2=44242&view=diff
==============================================================================
--- trunk/ncurses/yast2-ncurses.spec.in (original)
+++ trunk/ncurses/yast2-ncurses.spec.in Thu Feb 7 15:51:03 2008
@@ -17,8 +17,8 @@
Provides: y2curses
Obsoletes: y2curses
Requires: glibc-locale
-BuildRequires: yast2-core-devel >= 2.16.29
-Requires: yast2-core >= 2.16.29
+BuildRequires: yast2-core-devel >= 2.16.30
+Requires: yast2-core >= 2.16.30
#adapted to libzypp 3.11 refactoring
Requires: libzypp >= 3.11.8
%description
Modified: trunk/qt/src/YQMultiProgressMeter.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQMultiProgressMeter.cc?rev=44242&r1=44241&r2=44242&view=diff
==============================================================================
--- trunk/qt/src/YQMultiProgressMeter.cc (original)
+++ trunk/qt/src/YQMultiProgressMeter.cc Thu Feb 7 15:51:03 2008
@@ -26,6 +26,7 @@
#include <QDebug>
#include "YQUI.h"
#include "YQMultiProgressMeter.h"
+#include "YDialog.h"
@@ -208,7 +209,7 @@
setTriangularShaped( ! triangularShaped() );
setSize( vertical() ? preferredWidth() : width(),
horizontal() ? preferredHeight() : height() );
- YQUI::ui()->evaluateRecalcLayout();
+ findDialog()->recalcLayout();
QWidget::update();
}
}
Modified: trunk/qt/yast2-qt.spec.in
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/yast2-qt.spec.in?rev=44242&r1=44241&r2=44242&view=diff
==============================================================================
--- trunk/qt/yast2-qt.spec.in (original)
+++ trunk/qt/yast2-qt.spec.in Thu Feb 7 15:51:03 2008
@@ -6,8 +6,8 @@
Summary: -
BuildRequires: yast2-devtools >= 2.16.3
-BuildRequires: yast2-core-devel >= 2.16.29
-Requires: yast2-core >= 2.16.29
+BuildRequires: yast2-core-devel >= 2.16.30
+Requires: yast2-core >= 2.16.30
Requires: yast2_theme >= 2.16.1
Requires: libzypp >= 3.11.8
Provides: yast2_ui
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org