[uim-commit] r3165 - trunk/qt
ekato at freedesktop.org
ekato at freedesktop.org
Sun Mar 12 07:51:36 PST 2006
Author: ekato
Date: 2006-03-12 07:51:30 -0800 (Sun, 12 Mar 2006)
New Revision: 3165
Modified:
trunk/qt/toolbar-common-uimstateindicator.cpp
trunk/qt/toolbar-common-uimstateindicator.h
Log:
* qt/toolbar-common-uimstateindicator.h (class QHelperPopupMenu) :
Use indicationIdStr as an argument for insertHelperItem.
* qt/toolbar-common-uimstateindicator.cpp : Include "config.h" for
UIM_PIXMAPSDIR.
(ICONDIR) : New.
(UimStateIndicator::propListUpdate) : Follow the change in icon
support to helper protocol.
(QHelperPopupMenu::insertHelperItem) : Use indicationIdStr as an
argument and draw its icon if possible.
Modified: trunk/qt/toolbar-common-uimstateindicator.cpp
===================================================================
--- trunk/qt/toolbar-common-uimstateindicator.cpp 2006-03-10 13:44:40 UTC (rev 3164)
+++ trunk/qt/toolbar-common-uimstateindicator.cpp 2006-03-12 15:51:30 UTC (rev 3165)
@@ -30,6 +30,7 @@
SUCH DAMAGE.
*/
+#include "uim/config.h"
#include "toolbar-common-uimstateindicator.h"
#include <qsocketnotifier.h>
@@ -42,6 +43,7 @@
#include <string.h>
#include <stdlib.h>
+static const QString ICONDIR = UIM_PIXMAPSDIR;
static int uim_fd;
static QHelperToolbarButton *fallbackButton = NULL;
static QSocketNotifier *notifier = NULL;
@@ -128,8 +130,12 @@
// create button
QHelperToolbarButton *button = new QHelperToolbarButton( this );
- button->setText( fields[ 1 ] );
- QToolTip::add( button, fields[ 2 ] );
+ QPixmap icon = QPixmap(ICONDIR + "/" + fields[1] + ".png");
+ if (!icon.isNull())
+ button->setPixmap(icon);
+ else
+ button->setText( fields[ 2 ] );
+ QToolTip::add( button, fields[ 3 ] );
button->setPopup( popupMenu );
button->setPopupDelay( 50 );
button->show();
@@ -139,13 +145,14 @@
else if ( fields[ 0 ].startsWith( "leaf" ) )
{
if ( popupMenu
- && !fields[ 2 ].isEmpty()
+ && !fields[ 1 ].isEmpty()
&& !fields[ 3 ].isEmpty()
- && !fields[ 4 ].isEmpty() )
+ && !fields[ 4 ].isEmpty()
+ && !fields[ 5 ].isEmpty() )
{
- int id = popupMenu->insertHelperItem( fields[ 2 ], fields[ 3 ], fields[ 4 ] );
+ int id = popupMenu->insertHelperItem( fields[1], fields[ 3 ], fields[ 4 ], fields[ 5 ] );
// check the item which is now used
- if ( !fields[ 5 ].isEmpty() && fields[ 5 ] == "*" )
+ if ( !fields[ 6 ].isEmpty() && fields[ 6 ] == "*" )
popupMenu->setItemChecked( id, true );
}
}
@@ -231,12 +238,19 @@
msgDict.clear();
}
-int QHelperPopupMenu::insertHelperItem( const QString &menulabelStr,
+int QHelperPopupMenu::insertHelperItem( const QString &indicationIdStr,
+ const QString &menulabelStr,
const QString &menutooltipStr,
const QString &menucommandStr )
{
- const int id = insertItem( menulabelStr, this, SLOT( slotMenuActivated( int ) ) );
+ int id;
+ QPixmap icon = QPixmap(ICONDIR + "/" + indicationIdStr + ".png");
+ if (!icon.isNull())
+ id = insertItem( icon, menulabelStr, this, SLOT( slotMenuActivated( int ) ) );
+ else
+ id = insertItem( menulabelStr, this, SLOT( slotMenuActivated( int ) ) );
+
setWhatsThis( id, menutooltipStr );
msgDict.insert( id, new QString( menucommandStr ) );
Modified: trunk/qt/toolbar-common-uimstateindicator.h
===================================================================
--- trunk/qt/toolbar-common-uimstateindicator.h 2006-03-10 13:44:40 UTC (rev 3164)
+++ trunk/qt/toolbar-common-uimstateindicator.h 2006-03-12 15:51:30 UTC (rev 3165)
@@ -90,7 +90,8 @@
QHelperPopupMenu( QWidget *parent = 0, const char *name = 0 );
~QHelperPopupMenu();
- int insertHelperItem( const QString &menulabelStr,
+ int insertHelperItem( const QString &indicationIdStr,
+ const QString &menulabelStr,
const QString &menutooltipStr,
const QString &menucommandStr );
More information about the uim-commit
mailing list