Mailinglist Archive: yast-commit (1037 mails)

< Previous Next >
[yast-commit] r44124 - in /trunk: core/ core/libyui/src/ ncurses/ ncurses/src/ qt/ qt/src/
  • From: sh-sh-sh@xxxxxxxxxxxxxxxx
  • Date: Mon, 04 Feb 2008 14:58:33 -0000
  • Message-id: <20080204145834.3356531B9A@xxxxxxxxxxxxxxxx>
Author: sh-sh-sh
Date: Mon Feb 4 15:58:33 2008
New Revision: 44124

URL: http://svn.opensuse.org/viewcvs/yast?rev=44124&view=rev
Log:
Moved stuff from UI to YApp

Modified:
trunk/core/VERSION
trunk/core/libyui/src/YApplication.cc
trunk/core/libyui/src/YApplication.h
trunk/core/libyui/src/YUI.h
trunk/core/libyui/src/YUISymbols.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/ncurses/yast2-ncurses.spec.in
trunk/qt/src/YQApplication.cc
trunk/qt/src/YQApplication.h
trunk/qt/src/YQGenericButton.cc
trunk/qt/src/YQRadioButton.cc
trunk/qt/src/YQSelectionBox.cc
trunk/qt/src/YQUI.h
trunk/qt/src/YQUI_core.cc
trunk/qt/src/YQUI_x11.cc
trunk/qt/yast2-qt.spec.in

Modified: trunk/core/VERSION
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/VERSION?rev=44124&r1=44123&r2=44124&view=diff
==============================================================================
--- trunk/core/VERSION (original)
+++ trunk/core/VERSION Mon Feb 4 15:58:33 2008
@@ -1 +1 @@
-2.16.26
+2.16.27

Modified: trunk/core/libyui/src/YApplication.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YApplication.cc?rev=44124&r1=44123&r2=44124&view=diff
==============================================================================
--- trunk/core/libyui/src/YApplication.cc (original)
+++ trunk/core/libyui/src/YApplication.cc Mon Feb 4 15:58:33 2008
@@ -169,3 +169,13 @@
return "";
}
}
+
+
+int
+YApplication::runInTerminal ( const string & module )
+{
+ yuiError() << "Not in text mode: Cannot run external program in terminal."
<< endl;
+
+ return -1;
+}
+

Modified: trunk/core/libyui/src/YApplication.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YApplication.h?rev=44124&r1=44123&r2=44124&view=diff
==============================================================================
--- trunk/core/libyui/src/YApplication.h (original)
+++ trunk/core/libyui/src/YApplication.h Mon Feb 4 15:58:33 2008
@@ -135,14 +135,14 @@
/**
* Return a string for a named glyph:
*
- * YUIGlyph_ArrowLeft
- * YUIGlyph_ArrowRight
- * YUIGlyph_ArrowUp
- * YUIGlyph_ArrowDown
- * YUIGlyph_CheckMark
- * YUIGlyph_BulletArrowRight
- * YUIGlyph_BulletCircle
- * YUIGlyph_BulletSquare
+ * YUIGlyph_ArrowLeft
+ * YUIGlyph_ArrowRight
+ * YUIGlyph_ArrowUp
+ * YUIGlyph_ArrowDown
+ * YUIGlyph_CheckMark
+ * YUIGlyph_BulletArrowRight
+ * YUIGlyph_BulletCircle
+ * YUIGlyph_BulletSquare
*
* Using this is discouraged in new applications.
* This method is available for backward compatibility.
@@ -154,7 +154,7 @@
* call this base class method in a new implementation.
**/
virtual string glyph( const string & glyphSymbolName );
-
+
/**
* Open a directory selection box and prompt the user for an existing
* directory.
@@ -214,9 +214,53 @@
const string & filter,
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 );
+
+
+ //
+ // Display information.
+ //
+ // Width and height are returned in the the UI's native dimension:
+ // Pixels for graphical UIs, character cells for text UIs.
+ // -1 means "value cannot be obtained" for int functions.
+ //
+ // Derived classes are required to implement these functions.
+ //
+
+ virtual int displayWidth() = 0;
+ virtual int displayHeight() = 0;
+ virtual int displayDepth() = 0;
+ virtual long displayColors() = 0;
+
+ // Size of main dialogs
+ virtual int defaultWidth() = 0;
+ virtual int defaultHeight() = 0;
+
+ //
+ // UI capabilities
+ //
+
+ virtual bool isTextMode() = 0;
+ virtual bool hasImageSupport() = 0;
+ virtual bool hasIconSupport() = 0;
+ virtual bool hasAnimationSupport() = 0;
+ virtual bool hasFullUtf8Support() = 0;
+ virtual bool richTextSupportsTable() = 0;
+ virtual bool leftHandedMouse() = 0;
+
+
private:

-
ImplPtr<YApplicationPrivate> priv;
};


Modified: trunk/core/libyui/src/YUI.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YUI.h?rev=44124&r1=44123&r2=44124&view=diff
==============================================================================
--- trunk/core/libyui/src/YUI.h (original)
+++ trunk/core/libyui/src/YUI.h Mon Feb 4 15:58:33 2008
@@ -58,7 +58,7 @@
YUIBuiltinCallData()
: result( YCPVoid() )
{
- function = 0;
+ function = 0;
}
};

@@ -383,34 +383,6 @@

virtual YCPValue setKeyboard();

-
- /**
- * UI-specific runInTerminal() function.
- * Returns (integer) return code of external program it spawns
- * in the same terminal
- **/
-
- virtual int runInTerminal( const YCPString & module );
-
- /**
- * UI-specific getDisplayInfo() functions.
- * See UI builtin GetDisplayInfo() doc for details.
- **/
- virtual int getDisplayWidth() { return -1; }
- virtual int getDisplayHeight() { return -1; }
- virtual int getDisplayDepth() { return -1; }
- virtual long getDisplayColors() { return -1; }
- virtual int getDefaultWidth() { return -1; }
- virtual int getDefaultHeight() { return -1; }
- virtual bool textMode() { return true; }
- virtual bool hasImageSupport() { return false; }
- virtual bool hasLocalImageSupport() { return true; }
- virtual bool hasAnimationSupport() { return false; }
- virtual bool hasIconSupport() { return false; }
- virtual bool hasFullUtf8Support() { return false; }
- virtual bool richTextSupportsTable() { return false; }
- virtual bool leftHandedMouse() { return false; }
-
/**
* UI-specific busyCursor function.
* This default implementation does nothing.

Modified: trunk/core/libyui/src/YUISymbols.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YUISymbols.h?rev=44124&r1=44123&r2=44124&view=diff
==============================================================================
--- trunk/core/libyui/src/YUISymbols.h (original)
+++ trunk/core/libyui/src/YUISymbols.h Mon Feb 4 15:58:33 2008
@@ -278,7 +278,6 @@
#define YUICap_DefaultHeight "DefaultHeight"
#define YUICap_TextMode "TextMode"
#define YUICap_HasImageSupport "HasImageSupport"
-#define YUICap_HasLocalImageSupport "HasLocalImageSupport"
#define YUICap_HasAnimationSupport "HasAnimationSupport"
#define YUICap_HasIconSupport "HasIconSupport"
#define YUICap_HasFullUtf8Support "HasFullUtf8Support"

Modified: trunk/core/libyui/src/YUI_builtins.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YUI_builtins.cc?rev=44124&r1=44123&r2=44124&view=diff
==============================================================================
--- trunk/core/libyui/src/YUI_builtins.cc (original)
+++ trunk/core/libyui/src/YUI_builtins.cc Mon Feb 4 15:58:33 2008
@@ -265,32 +265,22 @@
* @builtin RunInTerminal
* @short runs external program in the same terminal
* @description
- * Use this builtin if you want to run external program from ncurses UI
- * as a separate process. It saves current window layout to the stack and
- * runs the external program in the same terminal. When done, it restores
- * the original window layout and returns exit code of the external program
- * (an integer value returned by system() call). When called from the Qt UI,
- * an error message is printed to the log.
+ * Use this builtin if you want to run an external program from the NCcurses UI
+ * as a separate process. It saves the current window layout and runs the
+ * external program in the same terminal. When done, it restores the original
+ * window layout and returns the exit code of the external program.
+ * When called from the Qt UI, an error message is printed to the log.
* @param string external_program
* return integer
*
* @usage RunInTerminal("/bin/bash")
*/

-YCPInteger YUI::evaluateRunInTerminal(const YCPString & module )
+YCPInteger YUI::evaluateRunInTerminal(const YCPString & command )
{
- int ret = runInTerminal( module );
-
- return YCPInteger ( ret );
-
+ return YCPInteger( yApp()->runInTerminal( command->value() ) );
}

-int YUI::runInTerminal ( const YCPString & module )
-{
- yuiError() << "Not in text mode: Cannot run external program in terminal."
<< endl;
-
- return -1;
-}

/**
* @builtin SetKeyboard
@@ -568,7 +558,7 @@
if ( event )
{
YCPEvent ycpEvent( event );
-
+
if ( detailed )
input = ycpEvent.eventMap();
else
@@ -1341,7 +1331,6 @@
* "HasFullUtf8Support":true,
* "HasIconSupport":false,
* "HasImageSupport":true,
- * "HasLocalImageSupport":true,
* "Height":1050,
* "LeftHandedMouse":false,
* "RichTextSupportsTable":true,
@@ -1361,7 +1350,6 @@
* "HasFullUtf8Support":true,
* "HasIconSupport":false,
* "HasImageSupport":false,
- * "HasLocalImageSupport":true,
* "Height":54,
* "LeftHandedMouse":false,
* "RichTextSupportsTable":false,
@@ -1378,21 +1366,21 @@
YCPMap YUI::evaluateGetDisplayInfo()
{
YCPMap info_map;
+ YApplication * app = yApp(); // slight optimization

- info_map->add( YCPString( YUICap_Width ), YCPInteger(
getDisplayWidth() ) );
- info_map->add( YCPString( YUICap_Height ), YCPInteger(
getDisplayHeight() ) );
- info_map->add( YCPString( YUICap_Depth ), YCPInteger(
getDisplayDepth() ) );
- info_map->add( YCPString( YUICap_Colors ), YCPInteger(
getDisplayColors() ) );
- info_map->add( YCPString( YUICap_DefaultWidth ), YCPInteger(
getDefaultWidth() ) );
- info_map->add( YCPString( YUICap_DefaultHeight ), YCPInteger(
getDefaultHeight() ) );
- info_map->add( YCPString( YUICap_TextMode ), YCPBoolean(
textMode() ) );
- info_map->add( YCPString( YUICap_HasImageSupport ), YCPBoolean(
hasImageSupport() ) );
- info_map->add( YCPString( YUICap_HasLocalImageSupport ), YCPBoolean(
hasLocalImageSupport() ) );
- info_map->add( YCPString( YUICap_HasAnimationSupport ), YCPBoolean(
hasAnimationSupport() ) );
- info_map->add( YCPString( YUICap_HasIconSupport ), YCPBoolean(
hasIconSupport() ) );
- info_map->add( YCPString( YUICap_HasFullUtf8Support ),
YCPBoolean( hasFullUtf8Support() ) );
- info_map->add( YCPString( YUICap_RichTextSupportsTable ), YCPBoolean(
richTextSupportsTable() ) );
- info_map->add( YCPString( YUICap_LeftHandedMouse ), YCPBoolean(
leftHandedMouse() ) );
+ info_map->add( YCPString( YUICap_Width ), YCPInteger(
app->displayWidth() ) );
+ info_map->add( YCPString( YUICap_Height ), YCPInteger(
app->displayHeight() ) );
+ info_map->add( YCPString( YUICap_Depth ), YCPInteger(
app->displayDepth() ) );
+ info_map->add( YCPString( YUICap_Colors ), YCPInteger(
app->displayColors() ) );
+ info_map->add( YCPString( YUICap_DefaultWidth ), YCPInteger(
app->defaultWidth() ) );
+ info_map->add( YCPString( YUICap_DefaultHeight ), YCPInteger(
app->defaultHeight() ) );
+ info_map->add( YCPString( YUICap_TextMode ), YCPBoolean(
app->isTextMode() ) );
+ info_map->add( YCPString( YUICap_HasImageSupport ), YCPBoolean(
app->hasImageSupport() ) );
+ info_map->add( YCPString( YUICap_HasIconSupport ), YCPBoolean(
app->hasIconSupport() ) );
+ info_map->add( YCPString( YUICap_HasAnimationSupport ), YCPBoolean(
app->hasAnimationSupport() ) );
+ info_map->add( YCPString( YUICap_HasFullUtf8Support ),
YCPBoolean( app->hasFullUtf8Support() ) );
+ info_map->add( YCPString( YUICap_RichTextSupportsTable ), YCPBoolean(
app->richTextSupportsTable() ) );
+ info_map->add( YCPString( YUICap_LeftHandedMouse ), YCPBoolean(
app->leftHandedMouse() ) );

return info_map;
}
@@ -1555,7 +1543,7 @@
YCPEvent ycpEvent( event );
result = ycpEvent.eventId();

- if ( result->isString() )
+ if ( result->isString() )
result = YCPSymbol( result->asString()->value() ); // "accept"
-> `accept

yuiMilestone() << "Package selection done. Returning with " <<
result << endl;

Modified: trunk/ncurses/src/NCApplication.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/NCApplication.cc?rev=44124&r1=44123&r2=44124&view=diff
==============================================================================
--- trunk/ncurses/src/NCApplication.cc (original)
+++ trunk/ncurses/src/NCApplication.cc Mon Feb 4 15:58:33 2008
@@ -10,15 +10,19 @@
| (C) SuSE GmbH |
\----------------------------------------------------------------------/

- File: NCApplication.cc
+ File: NCApplication.cc

- Author: Gabriele Mohr <gs@xxxxxxx>
+ Authors: Gabriele Mohr <gs@xxxxxxx>
+ Stefan Hundhammer <sh@xxxxxxx>

/-*/


+#include <curses.h>
+
#include "Y2Log.h"
#include "NCurses.h"
+#include "YNCursesUI.h"
#include "NCApplication.h"
#include "NCAskForDirectory.h"
#include "NCAskForFile.h"
@@ -94,3 +98,81 @@
return retEvent.result;
}

+
+/**
+ * Run external program supplied as string parameter the same terminal.
+ **/
+int
+NCApplication::runInTerminal( const string & cmd )
+{
+ int ret;
+
+ // Save tty modes and end ncurses mode temporarily
+ ::def_prog_mode();
+ ::endwin();
+
+ // Regenerate saved stdout and stderr, so that app called
+ // via system() can use them and draw something to the terminal
+ dup2( YNCursesUI::ui()->stdout_save, 1 );
+ dup2( YNCursesUI::ui()->stderr_save, 2 );
+
+ // Call external program
+ ret = system( cmd.c_str() );
+
+ if ( ret != 0 )
+ {
+ NCERR << cmd << " returned:" << ret << endl;
+ }
+
+ // Redirect stdout and stderr to y2log again
+ YNCursesUI::ui()->RedirectToLog();
+
+ // Resume tty modes and refresh the screen
+ ::reset_prog_mode();
+ ::refresh();
+
+ return ret;
+}
+
+
+int
+NCApplication::displayWidth()
+{
+ return ::COLS; // exported from ncurses.h
+}
+
+int
+NCApplication::displayHeight()
+{
+ return ::LINES; // exported from ncurses.h
+}
+
+int
+NCApplication::displayDepth()
+{
+ return -1;
+}
+
+long
+NCApplication::displayColors()
+{
+ return NCattribute::colors();
+}
+
+int
+NCApplication::defaultWidth()
+{
+ return ::COLS; // exported from ncurses.h
+}
+
+int
+NCApplication::defaultHeight()
+{
+ return ::LINES; // exported from ncurses.h
+}
+
+bool
+NCApplication::hasFullUtf8Support()
+{
+ return ( NCstring::terminalEncoding() == "UTF-8" );
+}

Modified: trunk/ncurses/src/NCApplication.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/NCApplication.h?rev=44124&r1=44123&r2=44124&view=diff
==============================================================================
--- trunk/ncurses/src/NCApplication.h (original)
+++ trunk/ncurses/src/NCApplication.h Mon Feb 4 15:58:33 2008
@@ -115,6 +115,40 @@
virtual string askForSaveFileName( const string & startWith,
const string & filter,
const string & headline );
+
+ /**
+ * Run a shell command (typically an interactive program using NCurses)
+ * in a terminal (window).
+ *
+ * Here in the NCurses UI, this shuts down the NCurses lib, runs the
+ * command and then restores the status of the NCurses lib so that the next
+ * instance of the NCurses lib from the started command doesn't interfere
+ * with the NCurses UI's instance.
+ *
+ * Reimplemented from YApplication.
+ **/
+ virtual int runInTerminal ( const string & command );
+
+
+ // Display information and UI capabilities.
+ //
+ // All implemented from YApplication.
+
+ virtual int displayWidth();
+ virtual int displayHeight();
+ virtual int displayDepth();
+ virtual long displayColors();
+
+ virtual int defaultWidth();
+ virtual int defaultHeight();
+
+ virtual bool isTextMode() { return true; }
+ virtual bool hasImageSupport() { return false; }
+ virtual bool hasIconSupport() { return false; }
+ virtual bool hasAnimationSupport() { return false; }
+ virtual bool hasFullUtf8Support();
+ virtual bool richTextSupportsTable() { return false; }
+ virtual bool leftHandedMouse() { return false; }
};



Modified: trunk/ncurses/src/YNCursesUI.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/YNCursesUI.cc?rev=44124&r1=44123&r2=44124&view=diff
==============================================================================
--- trunk/ncurses/src/YNCursesUI.cc (original)
+++ trunk/ncurses/src/YNCursesUI.cc Mon Feb 4 15:58:33 2008
@@ -278,48 +278,6 @@
///////////////////////////////////////////////////////////////////
//
//
-// METHOD NAME : YNCursesUI::runInTerminal
-// METHOD TYPE : YCPValue
-//
-// DESCRIPTION:: Run external program supplied as string parameter
-// in the same terminal
-//
-
-int YNCursesUI::runInTerminal( const YCPString & module )
-{
- int ret;
- string cmd = module->value();
-
- //Save tty modes and end ncurses mode temporarily
- ::def_prog_mode();
- ::endwin();
-
- //Regenerate saved stdout and stderr, so that app called
- //via system() can use them and draw something to the terminal
- dup2(NCurses::stdout_save, 1);
- dup2(NCurses::stderr_save, 2);
-
- //Call external program
- ret = system(cmd.c_str());
-
- if ( ret != 0 )
- {
- NCERR << cmd << " returned:" << ret << endl;
- }
-
- //Redirect stdout and stderr to y2log again
- NCurses::RedirectToLog();
-
- //Resume tty modes and refresh the screen
- ::reset_prog_mode();
- ::refresh();
-
- return ret;
-}
-
-///////////////////////////////////////////////////////////////////
-//
-//
// METHOD NAME : YNCursesUI::setConsoleFont
// METHOD TYPE : YCPValue
//
@@ -406,26 +364,6 @@
///////////////////////////////////////////////////////////////////
//
//
-// METHOD NAME : YNCursesUI::hasFullUtf8Support
-// METHOD TYPE : bool
-//
-// DESCRIPTION :
-//
-bool YNCursesUI::hasFullUtf8Support()
-{
- if ( NCstring::terminalEncoding() == "UTF-8" )
- {
- return true;
- }
- else
- {
- return false;
- }
-}
-
-///////////////////////////////////////////////////////////////////
-//
-//
// METHOD NAME : YNCursesUI::init_title
// METHOD TYPE : void
//

Modified: trunk/ncurses/src/YNCursesUI.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/YNCursesUI.h?rev=44124&r1=44123&r2=44124&view=diff
==============================================================================
--- trunk/ncurses/src/YNCursesUI.h (original)
+++ trunk/ncurses/src/YNCursesUI.h Mon Feb 4 15:58:33 2008
@@ -124,14 +124,6 @@
virtual YCPValue setKeyboard ( );

/**
- * UI-specific runInTerminal() function.
- * Returns (integer) return code of external program it spawns
- * in the same terminal
- */
-
- virtual int runInTerminal ( const YCPString & module);
-
- /**
* UI-specific beep() function.
* Beeps the system bell.
*/
@@ -148,22 +140,6 @@
* This default implementation does nothing.
*/
virtual void redrawScreen() { Refresh(); }
-
- /**
- * UI-specific getDisplayInfo() functions.
- * See UI builtin GetDisplayInfo() doc for details.
- **/
- virtual int getDisplayWidth() { return cols(); }
- virtual int getDisplayHeight() { return lines(); }
- virtual int getDisplayDepth() { return -1; }
- virtual long getDisplayColors() { return NCattribute::colors(); }
- virtual int getDefaultWidth() { return cols(); }
- virtual int getDefaultHeight() { return lines(); }
- virtual bool textMode() { return true; }
- virtual bool hasImageSupport() { return false; }
- virtual bool hasIconSupport() { return false; }
-
- virtual bool hasFullUtf8Support();
};

#endif // YNCursesUI_h

Modified: trunk/ncurses/yast2-ncurses.spec.in
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/yast2-ncurses.spec.in?rev=44124&r1=44123&r2=44124&view=diff
==============================================================================
--- trunk/ncurses/yast2-ncurses.spec.in (original)
+++ trunk/ncurses/yast2-ncurses.spec.in Mon Feb 4 15:58:33 2008
@@ -17,8 +17,8 @@
Provides: y2curses
Obsoletes: y2curses
Requires: glibc-locale
-BuildRequires: yast2-core-devel >= 2.16.26
-Requires: yast2-core >= 2.16.26
+BuildRequires: yast2-core-devel >= 2.16.27
+Requires: yast2-core >= 2.16.27
#adapted to libzypp 3.11 refactoring
Requires: libzypp >= 3.11.8
%description

Modified: trunk/qt/src/YQApplication.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQApplication.cc?rev=44124&r1=44123&r2=44124&view=diff
==============================================================================
--- trunk/qt/src/YQApplication.cc (original)
+++ trunk/qt/src/YQApplication.cc Mon Feb 4 15:58:33 2008
@@ -18,16 +18,19 @@
/-*/


+#include <unistd.h> // access()
+
#include <QApplication>
#include <QLocale>
-#include <unistd.h> // access()
-#include <qregexp.h>
-#include <qfiledialog.h>
-#include <qmessagebox.h>
+#include <QRegExp>
+#include <QFileDialog>
+#include <QDesktopWidget>
+#include <QMessageBox>

#define YUILogComponent "qt-ui"
#include "YUILog.h"
#include "YUISymbols.h"
+#include "YQUI.h"

#include "utf8.h"
#include "YQi18n.h"
@@ -47,6 +50,8 @@
, _autoFonts( false )
, _autoNormalFontSize( -1 )
, _autoHeadingFontSize( -1 )
+ , _leftHandedMouse( false )
+ , _askedForLeftHandedMouse( false )
{
yuiDebug() << "YQApplication constructor start" << endl;

@@ -535,5 +540,96 @@
}


+int
+YQApplication::displayWidth()
+{
+ return qApp->desktop()->width();
+}
+
+
+int
+YQApplication::displayHeight()
+{
+ return qApp->desktop()->height();
+}
+
+
+int
+YQApplication::displayDepth()
+{
+ return qApp->desktop()->depth();
+}
+
+
+long
+YQApplication::displayColors()
+{
+ return 1L << qApp->desktop()->depth();
+}
+
+
+int
+YQApplication::defaultWidth()
+{
+ return YQUI::ui()->defaultSize( YD_HORIZ );
+}
+
+
+int
+YQApplication::defaultHeight()
+{
+ return YQUI::ui()->defaultSize( YD_VERT );
+}
+
+
+bool
+YQApplication::leftHandedMouse()
+{
+ return _leftHandedMouse;
+}
+
+
+void
+YQApplication::maybeLeftHandedUser()
+{
+ if ( _askedForLeftHandedMouse )
+ return;
+
+ QString message =
+ _( "You clicked the right mouse button "
+ "where a left-click was expected."
+ "\n"
+ "Switch left and right mouse buttons?"
+ );
+ int button = QMessageBox::question( 0,
+ // Popup dialog caption
+ _( "Unexpected Click" ),
+ message,
+ QMessageBox::Yes | QMessageBox::Default,
+ QMessageBox::No,
+ QMessageBox::Cancel |
QMessageBox::Escape );
+
+ if ( button == QMessageBox::Yes )
+ {
+
+ const char * command =
+ _leftHandedMouse ?
+ "xmodmap -e \"pointer = 1 2 3\"": // switch back to right-handed
mouse
+ "xmodmap -e \"pointer = 3 2 1\""; // switch to left-handed mouse
+
+ _leftHandedMouse = ! _leftHandedMouse; // might be set
repeatedly!
+ _askedForLeftHandedMouse = false; // give the user a chance to
switch back
+ yuiMilestone() << "Switching mouse buttons: " << command << endl;
+
+ system( command );
+ }
+ else if ( button == 1 ) // No
+ {
+ _askedForLeftHandedMouse = true;
+ }
+}
+
+
+

#include "YQApplication.moc"

Modified: trunk/qt/src/YQApplication.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQApplication.h?rev=44124&r1=44123&r2=44124&view=diff
==============================================================================
--- trunk/qt/src/YQApplication.h (original)
+++ trunk/qt/src/YQApplication.h Mon Feb 4 15:58:33 2008
@@ -207,7 +207,44 @@
**/
static YQPackageSelectorPlugin * packageSelectorPlugin();

+ /**
+ * A mouse click with the wrong mouse button was detected - e.g., a right
+ * click on a push button. The user might be left-handed, but his mouse
+ * might not (yet) be configured for left-handed use - e.g., during
+ * installation. Ask him if he would like his mouse temporarily configured
+ * as a left-handed mouse.
+ *
+ * This status can be queried with YQApplication::leftHandedMouse().
+ **/
+ void maybeLeftHandedUser();

+
+ // Display information and UI capabilities.
+ //
+ // All implemented from YApplication.
+
+ virtual int displayWidth();
+ virtual int displayHeight();
+ virtual int displayDepth();
+ virtual long displayColors();
+
+ // Size of main dialogs
+ virtual int defaultWidth();
+ virtual int defaultHeight();
+
+ //
+ // UI capabilities
+ //
+
+ virtual bool isTextMode() { return false; }
+ virtual bool hasImageSupport() { return true; }
+ virtual bool hasIconSupport() { return true; }
+ virtual bool hasAnimationSupport() { return true; }
+ virtual bool hasFullUtf8Support() { return true; }
+ virtual bool richTextSupportsTable() { return true; }
+ virtual bool leftHandedMouse();
+
+
protected:

/**
@@ -247,13 +284,17 @@
**/
QTranslator * _qtTranslations;

- /**
- * For auto fonts
- **/
+ //
+ // Misc
+ //
+
bool _autoFonts;
int _autoNormalFontSize;
int _autoHeadingFontSize;

+ bool _leftHandedMouse;
+ bool _askedForLeftHandedMouse;
+

};


Modified: trunk/qt/src/YQGenericButton.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQGenericButton.cc?rev=44124&r1=44123&r2=44124&view=diff
==============================================================================
--- trunk/qt/src/YQGenericButton.cc (original)
+++ trunk/qt/src/YQGenericButton.cc Mon Feb 4 15:58:33 2008
@@ -27,6 +27,7 @@

#include "utf8.h"
#include "YQUI.h"
+#include "YQApplication.h"
#include "YEvent.h"
#include "YQGenericButton.h"
#include "YQDialog.h"
@@ -203,7 +204,7 @@
if ( mouseEvent && mouseEvent->button() == Qt::RightButton )
{
yuiMilestone() << "Right click on button detected" << endl;
- YQUI::ui()->maybeLeftHandedUser();
+ YQUI::yqApp()->maybeLeftHandedUser();
}
}
}

Modified: trunk/qt/src/YQRadioButton.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQRadioButton.cc?rev=44124&r1=44123&r2=44124&view=diff
==============================================================================
--- trunk/qt/src/YQRadioButton.cc (original)
+++ trunk/qt/src/YQRadioButton.cc Mon Feb 4 15:58:33 2008
@@ -150,7 +150,7 @@
if ( mouseEvent && mouseEvent->button() == Qt::RightButton )
{
yuiMilestone() << "Right click on button detected" << endl;
- YQUI::ui()->maybeLeftHandedUser();
+ YQUI::yqApp()->maybeLeftHandedUser();
}
}


Modified: trunk/qt/src/YQSelectionBox.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQSelectionBox.cc?rev=44124&r1=44123&r2=44124&view=diff
==============================================================================
--- trunk/qt/src/YQSelectionBox.cc (original)
+++ trunk/qt/src/YQSelectionBox.cc Mon Feb 4 15:58:33 2008
@@ -31,6 +31,7 @@
#include "utf8.h"
#include "YEvent.h"
#include "YQUI.h"
+#include "YQApplication.h"
#include "YQSelectionBox.h"
#include "YQSignalBlocker.h"
#include "YQDialog.h"
@@ -253,7 +254,7 @@
if ( mouseEvent && mouseEvent->button() == Qt::RightButton )
{
yuiMilestone() << "Right click in selecton box detected" << endl;
- YQUI::ui()->maybeLeftHandedUser();
+ YQUI::yqApp()->maybeLeftHandedUser();
}
}


Modified: trunk/qt/src/YQUI.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQUI.h?rev=44124&r1=44123&r2=44124&view=diff
==============================================================================
--- trunk/qt/src/YQUI.h (original)
+++ trunk/qt/src/YQUI.h Mon Feb 4 15:58:33 2008
@@ -238,18 +238,6 @@
void askConfigureLogging();

/**
- * A mouse click with the wrong mouse button was detected - e.g., a right
- * click on a push button. The user might be left-handed, but his mouse
- * might not (yet) be configured for left-handed use - e.g., during
- * installation. Ask him if he would like his mouse temporarily configured
- * as a left-handed mouse.
- *
- * This status can be queried with
- * UI::GetDisplayInfo() (map entry "LeftHandedMouse").
- **/
- void maybeLeftHandedUser();
-
- /**
* Go into event loop until next user input is available.
*
* Reimplemented from YUI.
@@ -263,7 +251,6 @@
**/
YEvent * pollInput();

-
/**
* Initialize and set a textdomain for gettext()
**/

Modified: trunk/qt/src/YQUI_core.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQUI_core.cc?rev=44124&r1=44123&r2=44124&view=diff
==============================================================================
--- trunk/qt/src/YQUI_core.cc (original)
+++ trunk/qt/src/YQUI_core.cc Mon Feb 4 15:58:33 2008
@@ -68,8 +68,6 @@
_fatal_error = false;
_fullscreen = false;
_usingVisionImpairedPalette = false;
- _leftHandedMouse = false;
- _askedForLeftHandedMouse = false;
_noborder = false;
screenShotNameTemplate = "";
blocked_level = 0;

Modified: trunk/qt/src/YQUI_x11.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQUI_x11.cc?rev=44124&r1=44123&r2=44124&view=diff
==============================================================================
--- trunk/qt/src/YQUI_x11.cc (original)
+++ trunk/qt/src/YQUI_x11.cc Mon Feb 4 15:58:33 2008
@@ -44,42 +44,6 @@
#include <X11/Xlib.h>


-int YQUI::getDisplayWidth()
-{
- return qApp->desktop()->width();
-}
-
-
-int YQUI::getDisplayHeight()
-{
- return qApp->desktop()->height();
-}
-
-
-int YQUI::getDisplayDepth()
-{
- return qApp->desktop()->depth();
-}
-
-
-long YQUI::getDisplayColors()
-{
- return 1L << qApp->desktop()->depth();
-}
-
-
-int YQUI::getDefaultWidth()
-{
- return _default_size.width();
-}
-
-
-int YQUI::getDefaultHeight()
-{
- return _default_size.height();
-}
-
-
int YQUI::defaultSize(YUIDimension dim) const
{
return dim == YD_HORIZ ? _default_size.width() : _default_size.height();
@@ -205,46 +169,5 @@
}


-void YQUI::maybeLeftHandedUser()
-{
- if ( _askedForLeftHandedMouse )
- return;
-
-
- QString message =
- _( "You clicked the right mouse button "
- "where a left-click was expected."
- "\n"
- "Switch left and right mouse buttons?"
- );
- int button = QMessageBox::question( 0,
- // Popup dialog caption
- _( "Unexpected Click" ),
- message,
- QMessageBox::Yes | QMessageBox::Default,
- QMessageBox::No,
- QMessageBox::Cancel |
QMessageBox::Escape );
-
- if ( button == QMessageBox::Yes )
- {
-
- const char * command =
- _leftHandedMouse ?
- "xmodmap -e \"pointer = 1 2 3\"": // switch back to right-handed
mouse
- "xmodmap -e \"pointer = 3 2 1\""; // switch to left-handed mouse
-
- _leftHandedMouse = ! _leftHandedMouse; // might be set
repeatedly!
- _askedForLeftHandedMouse = false; // give the user a chance to
switch back
- yuiMilestone() << "Switching mouse buttons: " << command << endl;
-
- system( command );
- }
- else if ( button == 1 ) // No
- {
- _askedForLeftHandedMouse = true;
- }
-}
-
-

// EOF

Modified: trunk/qt/yast2-qt.spec.in
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/qt/yast2-qt.spec.in?rev=44124&r1=44123&r2=44124&view=diff
==============================================================================
--- trunk/qt/yast2-qt.spec.in (original)
+++ trunk/qt/yast2-qt.spec.in Mon Feb 4 15:58:33 2008
@@ -6,8 +6,8 @@

Summary: -
BuildRequires: yast2-devtools >= 2.16.3
-BuildRequires: yast2-core-devel >= 2.16.26
-Requires: yast2-core >= 2.16.26
+BuildRequires: yast2-core-devel >= 2.16.27
+Requires: yast2-core >= 2.16.27
Requires: yast2_theme >= 2.16.1
Requires: libzypp >= 3.11.8
Provides: yast2_ui

--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages