Index: rbutil/rbutilqt/accessibilityfix.cpp =================================================================== --- rbutil/rbutilqt/accessibilityfix.cpp (revision 0) +++ rbutil/rbutilqt/accessibilityfix.cpp (revision 0) @@ -0,0 +1,122 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2007 by Dominik Wenger + * $Id: sysinfo.cpp 19430 2008-12-13 20:20:42Z bluebrother $ + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#include "accessibilityfix.h" + +AccessibleFix* AccessibleFix::s_instance = NULL; +QList AccessibleFix::s_fixedObjects; + +QString stripAmp(const QString &text) +{ + if (text.isEmpty()) + return text; + + const QChar *ch = text.unicode(); + int length = text.length(); + QString str; + while (length > 0) { + if (*ch == QLatin1Char('&')) { + ++ch; + --length; + if (!ch) + --ch; + } + str += *ch; + ++ch; + --length; + } + return str; +} + +QAccessibleInterface *accessibilityFactory(const QString &classname, QObject *object) +{ + if(AccessibleFix::s_fixedObjects.contains(object)) + return NULL; + + AccessibleFix::s_fixedObjects.append(object); + + if (classname == "QTabBar" && object && object->isWidgetType()) + { + QTabBar* tabbar = qobject_cast(object); + QString text =stripAmp(tabbar->tabText(tabbar->currentIndex())); + tabbar->setAccessibleName(text); + QObject::connect(tabbar,SIGNAL(currentChanged(int)),AccessibleFix::s_instance,SLOT(updateAccessibilityTab())); + } + else if(classname == "QComboBox" && object && object->isWidgetType()) + { + QObject::connect(object,SIGNAL(currentIndexChanged(int)),AccessibleFix::s_instance,SLOT(updateAccessibility())); + } + else if(classname == "QMenu" && object && object->isWidgetType()) + { + QObject::connect(object,SIGNAL(hovered(QAction*)),AccessibleFix::s_instance,SLOT(updateAccessibilityMenu()),Qt::QueuedConnection); + } + else if(classname == "QSpinBox" || classname == "QDoubleSpinBox" && object && object->isWidgetType()) + { + QObject::connect(object,SIGNAL(valueChanged(const QString&)),AccessibleFix::s_instance,SLOT(updateAccessibiltySpinBox()),Qt::QueuedConnection); + } + return NULL; +} + +void AccessibleFix::updateAccessibilityTab() +{ + QTabBar *tabBar = qobject_cast(QObject::sender()); + if(tabBar != NULL) + { + qDebug() << "update tabBar"; + // change accessible Name, and tell accessibility layer. + QString text = stripAmp(tabBar->tabText(tabBar->currentIndex())); + tabBar->setAccessibleName(text); + QAccessible::updateAccessibility(QObject::sender(), 0, QAccessible::Focus); + } +} + +void AccessibleFix::updateAccessibility() +{ + QAccessible::updateAccessibility(QObject::sender(), 0, QAccessible::ValueChanged); +} + +void AccessibleFix::updateAccessibilityMenu() +{ + QMenu* menu = qobject_cast(QObject::sender()); + if(menu != NULL) + { + qDebug() << "update menu"; + delayedObject = QObject::sender(); + delayedIndex = menu->actions().indexOf(menu->activeAction())+1; + delayedEvent = QAccessible::Focus; + + QTimer::singleShot(50,this,SLOT(delayedUpdate())); + } +} + +void AccessibleFix::updateAccessibiltySpinBox() +{ + + delayedObject = QObject::sender(); + delayedIndex = 0; + delayedEvent = QAccessible::Focus; + + QTimer::singleShot(500,this,SLOT(delayedUpdate())); + +} + +void AccessibleFix::delayedUpdate() +{ + QAccessible::updateAccessibility(delayedObject,delayedIndex,delayedEvent); +} Index: rbutil/rbutilqt/accessibilityfix.h =================================================================== --- rbutil/rbutilqt/accessibilityfix.h (revision 0) +++ rbutil/rbutilqt/accessibilityfix.h (revision 0) @@ -0,0 +1,51 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2007 by Dominik Wenger + * $Id: sysinfo.cpp 19430 2008-12-13 20:20:42Z bluebrother $ + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#ifndef ACCESSIBILITYFIX_H +#define ACCESSIBILITYFIX_H + +#include + +QAccessibleInterface *accessibilityFactory(const QString &classname, QObject *object); + +class AccessibleFix : public QObject +{ + Q_OBJECT +public: + AccessibleFix(QObject* parent) : QObject(parent) {s_instance = this;} + + static AccessibleFix* s_instance; + static QList s_fixedObjects; + + QObject* delayedObject; + int delayedIndex; + QAccessible::Event delayedEvent; + +public slots: + void updateAccessibilityTab(); + void updateAccessibility(); + void updateAccessibilityMenu(); + void updateAccessibiltySpinBox(); + + void delayedUpdate(); +}; + + + +#endif Index: rbutil/rbutilqt/rbutilqt.cpp =================================================================== --- rbutil/rbutilqt/rbutilqt.cpp (revision 21300) +++ rbutil/rbutilqt/rbutilqt.cpp (working copy) @@ -35,6 +35,7 @@ #include "sysinfo.h" #include "detect.h" #include "rbsettings.h" +#include "accessibilityfix.h" #include "progressloggerinterface.h" @@ -129,6 +130,12 @@ connect(ui.actionInstall_Rockbox_Utility_on_player, SIGNAL(triggered()), this, SLOT(installPortable())); #endif + //fix acessibility + // create Fix object + new AccessibleFix(this); + // add as fake factory + QAccessible::installFactory(accessibilityFactory); + } Index: rbutil/rbutilqt/rbutilqt.pro =================================================================== --- rbutil/rbutilqt/rbutilqt.pro (revision 21300) +++ rbutil/rbutilqt/rbutilqt.pro (working copy) @@ -83,8 +83,9 @@ base/bootloaderinstallsansa.cpp \ base/bootloaderinstallfile.cpp \ ../../tools/mkboot.c \ - ../../tools/iriver.c - + ../../tools/iriver.c \ + accessibilityfix.cpp + HEADERS += rbutilqt.h \ install.h \ base/httpget.h \ @@ -135,7 +136,8 @@ base/bootloaderinstallsansa.h \ base/bootloaderinstallfile.h \ ../../tools/mkboot.h \ - ../../tools/iriver.h + ../../tools/iriver.h \ + accessibilityfix.h # Needed by QT on Win INCLUDEPATH = . irivertools zip zlib ../ipodpatcher ../sansapatcher ../../tools/rbspeex ../../tools @@ -151,7 +153,7 @@ } !dbg { CONFIG += release thread qt - DEFINES += QT_NO_DEBUG_OUTPUT + DEFINES -= QT_NO_DEBUG_OUTPUT message("release") } Index: rbutil/rbutilqt/rbutilqtfrm.ui =================================================================== --- rbutil/rbutilqt/rbutilqtfrm.ui (revision 21300) +++ rbutil/rbutilqt/rbutilqtfrm.ui (working copy) @@ -133,9 +133,6 @@ &Quick Start - - Welcome - @@ -227,9 +224,6 @@ &Installation - - Basic Rockbox installation - @@ -324,9 +318,6 @@ &Extras - - Install extras for Rockbox - @@ -438,9 +429,6 @@ &Accessibility - - Install accessibility add-ons - @@ -550,9 +538,6 @@ &Uninstallation - - Uninstall Rockbox - @@ -644,9 +629,6 @@ &Manual - - View and download the manual -